camunda-bpmn-js 5.2.0 → 5.2.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/assets/properties-panel.css +1517 -1509
- package/dist/base-modeler.development.js +343 -303
- package/dist/base-modeler.production.min.js +3 -3
- package/dist/camunda-cloud-modeler.development.js +474 -434
- package/dist/camunda-cloud-modeler.production.min.js +3 -3
- package/dist/camunda-platform-modeler.development.js +396 -356
- package/dist/camunda-platform-modeler.production.min.js +3 -3
- package/package.json +4 -4
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
</ul>
|
|
100
100
|
`))}
|
|
101
101
|
</div>
|
|
102
|
-
`}function ql(e){const{onClose:t,onSelect:n,className:r,headerEntries:i,position:o,title:s,width:l,scale:c,search:p,emptyPlaceholder:u,searchFn:h,entries:f,onOpened:m,onClosed:g}=e,y=Pl((()=>!!a(p)&&f.length>5),[p,f]),[v,b]=_l(""),w=Sl(((e,t)=>{if(!y)return e;if(!t)return e.filter((({rank:e=0})=>e>=0));const n=e.filter((({searchable:e})=>!1!==e));return h(n,t,{keys:["label","description","search"]}).map((({item:e})=>e))}),[y]),[x,_]=_l(w(f,v)),[k,E]=_l(x[0]),O=Sl((e=>{k&&e.includes(k)||E(e[0]),_(e)}),[k,_,E]);kl((()=>{O(w(f,v))}),[v,f]);const P=Sl((e=>{let t=x.indexOf(k)+e;t<0&&(t=x.length-1),t>=x.length&&(t=0),E(x[t])}),[x,k,E]),S=Sl((e=>"Enter"===e.key&&k?n(e,k):"ArrowUp"===e.key?(P(-1),e.preventDefault()):"ArrowDown"===e.key?(P(1),e.preventDefault()):void 0),[n,k,P]),C=Sl((e=>{ye(e.target,"input")&&b((()=>e.target.value))}),[b]);kl((()=>(m(),()=>{g()})),[]);const T=Pl((()=>s||i.length>0),[s,i]);return dl`
|
|
102
|
+
`}function ql(e){const{onClose:t,onSelect:n,className:r,headerEntries:i,position:o,title:s,width:l,scale:c,search:p,emptyPlaceholder:u,searchFn:h,entries:f,onOpened:m,onClosed:g}=e,y=Pl((()=>!!a(p)&&f.length>5),[p,f]),[v,b]=_l(""),w=Sl(((e,t)=>{if(!y)return e;if(!t.trim())return e.filter((({rank:e=0})=>e>=0));const n=e.filter((({searchable:e})=>!1!==e));return h(n,t,{keys:["label","description","search"]}).map((({item:e})=>e))}),[y]),[x,_]=_l(w(f,v)),[k,E]=_l(x[0]),O=Sl((e=>{k&&e.includes(k)||E(e[0]),_(e)}),[k,_,E]);kl((()=>{O(w(f,v))}),[v,f]);const P=Sl((e=>{let t=x.indexOf(k)+e;t<0&&(t=x.length-1),t>=x.length&&(t=0),E(x[t])}),[x,k,E]),S=Sl((e=>"Enter"===e.key&&k?n(e,k):"ArrowUp"===e.key?(P(-1),e.preventDefault()):"ArrowDown"===e.key?(P(1),e.preventDefault()):void 0),[n,k,P]),C=Sl((e=>{ye(e.target,"input")&&b((()=>e.target.value))}),[b]);kl((()=>(m(),()=>{g()})),[]);const T=Pl((()=>s||i.length>0),[s,i]);return dl`
|
|
103
103
|
<${Fl}
|
|
104
104
|
onClose=${t}
|
|
105
105
|
onKeyup=${C}
|
|
@@ -153,7 +153,7 @@
|
|
|
153
153
|
>
|
|
154
154
|
${o}
|
|
155
155
|
</div>
|
|
156
|
-
`}var Vl=["contextPad.close","canvas.viewbox.changing","commandStack.changed"];function Hl(e,t,n,r){this._eventBus=t,this._canvas=n,this._search=r,this._current=null;var i=a(e&&e.scale)?e.scale:{min:1,max:1};this._config={scale:i},t.on("diagram.destroy",(()=>{this.close()})),t.on("element.changed",(e=>{const t=this.isOpen()&&this._current.target;e.element===t&&this.refresh()}))}function Ul(e,t){return Wl(t)-Wl(e)}function Wl(e){return e.reduce(((e,t)=>e+function(e){if(!e.match)return
|
|
156
|
+
`}var Vl=["contextPad.close","canvas.viewbox.changing","commandStack.changed"];function Hl(e,t,n,r){this._eventBus=t,this._canvas=n,this._search=r,this._current=null;var i=a(e&&e.scale)?e.scale:{min:1,max:1};this._config={scale:i},t.on("diagram.destroy",(()=>{this.close()})),t.on("element.changed",(e=>{const t=this.isOpen()&&this._current.target;e.element===t&&this.refresh()}))}function Ul(e,t){return Wl(t)-Wl(e)}function Wl(e){return e.reduce(((e,t)=>e+function(e){const t=Math.log(e.value.length);if(!e.match)return-.07*t;return(e.start?e.end?131.9:7.87:e.wordStart?2.19:1)*t}(t)),0)}function Gl(e="",t=""){return e.localeCompare(t)}function Ql(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}Hl.$inject=["config.popupMenu","eventBus","canvas","search"],Hl.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:r,emptyPlaceholder:i,options:o}=this._current,s=Object.entries(n).map((([e,t])=>({id:e,...t}))),a=Object.entries(r).map((([e,t])=>({id:e,...t}))),l=e&&(t=>this._ensureVisible(t,e)),c=this._updateScale(this._current.container);il(dl`
|
|
157
157
|
<${ql}
|
|
158
158
|
onClose=${e=>this.close(e)}
|
|
159
159
|
onSelect=${(e,t,n)=>this.trigger(e,t,n)}
|
|
@@ -168,7 +168,7 @@
|
|
|
168
168
|
searchFn=${this._search}
|
|
169
169
|
...${{...o}}
|
|
170
170
|
/>
|
|
171
|
-
`,this._current.container)},Hl.prototype.open=function(e,t,n,r){if(!e)throw new Error("target is missing");if(!t)throw new Error("providers for <"+t+"> not found");if(!n)throw new Error("position is missing");this.isOpen()&&this.close();const{entries:i,headerEntries:o,emptyPlaceholder:s}=this._getContext(e,t);this._current={position:n,providerId:t,target:e,entries:i,headerEntries:o,emptyPlaceholder:s,container:this._createContainer({provider:t}),options:r},this._emit("open"),this._bindAutoClose(),this._render()},Hl.prototype.refresh=function(){if(!this.isOpen())return;const{target:e,providerId:t}=this._current,{entries:n,headerEntries:r,emptyPlaceholder:i}=this._getContext(e,t);this._current={...this._current,entries:n,headerEntries:r,emptyPlaceholder:i},this._emit("refresh"),this._render()},Hl.prototype._getContext=function(e,t){const n=this._getProviders(t);if(!n||!n.length)throw new Error("provider for <"+t+"> not found");const r=this._getEntries(e,n),i=this._getHeaderEntries(e,n);return{entries:r,headerEntries:i,emptyPlaceholder:this._getEmptyPlaceholder(n),empty:!(Object.keys(r).length||Object.keys(i).length)}},Hl.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},Hl.prototype.reset=function(){const e=this._current.container;il(null,e),we(e)},Hl.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},Hl.prototype._onOpened=function(){this._emit("opened")},Hl.prototype._onClosed=function(){this._emit("closed")},Hl.prototype._createContainer=function(e){var t=this._canvas.getContainer();const n=ge(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return t.appendChild(n),n},Hl.prototype._bindAutoClose=function(){this._eventBus.once(Vl,this.close,this)},Hl.prototype._unbindAutoClose=function(){this._eventBus.off(Vl,this.close,this)},Hl.prototype._updateScale=function(){var e,t,n=this._canvas.zoom(),r=this._config.scale,i=n;return!0!==r&&(!1===r?(e=1,t=1):(e=r.min,t=r.max),a(e)&&n<e&&(i=e),a(t)&&n>t&&(i=t)),i},Hl.prototype._ensureVisible=function(e,t){var n=document.documentElement.getBoundingClientRect(),r=e.getBoundingClientRect(),i={},o=t.x,s=t.y;return t.x+r.width>n.width&&(i.x=!0),t.y+r.height>n.height&&(i.y=!0),i.x&&i.y?(o=t.x-r.width,s=t.y-r.height):i.x?(o=t.x-r.width,s=t.y):i.y&&t.y<r.height?(o=t.x,s=10):i.y&&(o=t.x,s=t.y-r.height),t.y<n.top&&(s=t.y+r.height),{x:o,y:s}},Hl.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},Hl.prototype.registerProvider=function(e,t,n){n||(n=t,t=1e3),this._eventBus.on("popupMenu.getProviders."+e,t,(function(e){e.providers.push(n)}))},Hl.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},Hl.prototype._getEntries=function(e,t){var n={};return v(t,(function(t){if(t.getPopupMenuEntries){var r=t.getPopupMenuEntries(e);d(r)?n=r(n):v(r,(function(e,t){n[t]=e}))}else v(t.getEntries(e),(function(e){var t=e.id;if(!t)throw new Error("entry ID is missing");n[t]=q(e,["id"])}))})),n},Hl.prototype._getHeaderEntries=function(e,t){var n={};return v(t,(function(t){if(t.getPopupMenuHeaderEntries){var r=t.getPopupMenuHeaderEntries(e);d(r)?n=r(n):v(r,(function(e,t){n[t]=e}))}else{if(!t.getHeaderEntries)return;v(t.getHeaderEntries(e),(function(e){var t=e.id;if(!t)throw new Error("entry ID is missing");n[t]=q(e,["id"])}))}})),n},Hl.prototype._getEmptyPlaceholder=function(e){const t=e.find((e=>d(e.getEmptyPlaceholder)));return t&&t.getEmptyPlaceholder()},Hl.prototype.isOpen=function(){return!!this._current},Hl.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let n=X(te(e.delegateTarget||e.target,".entry",!0),"data-id");t={id:n,...this._getEntry(n)}}const r=t.action;if(!1!==this._emit("trigger",{entry:t,event:e}))if(d(r)){if("click"===n)return r(e,t)}else if(r[n])return r[n](e,t)},Hl.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 Zl={search:["value",function(e,t,n){const{keys:r}=n,i=t.trim().toLowerCase().split(/\s+/);return e.flatMap((e=>{const t=function(e,t,n){const{matchedWords:r,tokens:i}=n.reduce(((n,r)=>{const i=e[r],{tokens:o,matchedWords:s}=function(e,t){if(!e)return{tokens:[],matchedWords:{}};const n=[],r={},i=t.map(Ql).flatMap((e=>["(?<wordStart>\\b"+e+")",e])).join("|"),o=new RegExp(i,"ig");let s,a=0;for(;s=o.exec(e);){const[t]=s;s.index>a&&n.push({value:e.slice(a,s.index),index:a}),n.push({value:t,index:s.index,match:!0,wordStart:!!s.groups.wordStart,start:0===s.index}),r[t.toLowerCase()]=!0,a=s.index+t.length}a<e.length&&n.push({value:e.slice(a),index:a});return{tokens:n,matchedWords:r}}(i,t);return{tokens:{...n.tokens,[r]:o},matchedWords:{...n.matchedWords,...s}}}),{matchedWords:{},tokens:{}});if(Object.keys(r).length!==t.length)return null;return i}(e,i,r);return t?{item:e,tokens:t}:[]})).sort(function(e){return(t,n)=>{for(const r of e){const e=Ul(t.tokens[r],n.tokens[r]);if(0!==e)return e;const i=Gl(t.item[r],n.item[r]);if(0!==i)return i}return 0}}(r))}]},Xl={__depends__:[Zl],__init__:["popupMenu"],popupMenu:["type",Hl]},Yl={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 Kl(e,t,n,r){e.registerProvider(900,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=r}Kl.$inject=["contextPad","popupMenu","translate","canvas"],Kl.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&I(t,this._getEntries(e)),t},Kl.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},Kl.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${Yl.align}</div>`,action:{click:function(t,n){var r=e._getMenuPosition(n);I(r,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",r)}}}}},Kl.prototype._getMenuPosition=function(e){var t=this._contextPad.getPad(e).html.getBoundingClientRect();return{x:t.left,y:t.bottom+5}};var Jl=["left","center","right","top","middle","bottom"];function ec(e,t,n,r){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=r,e.registerProvider("align-elements",this)}function tc(e){Ho.call(this,e),this.init()}function nc(e){tc.call(this,e)}ec.$inject=["popupMenu","alignElements","translate","rules"],ec.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&I(t,this._getEntries(e)),t},ec.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},ec.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,r=this._popupMenu,i={};return v(Jl,(function(o){i["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:Yl[o],action:function(){t.trigger(e,o),r.close()}}})),i},tc.$inject=["eventBus"],e(tc,Ho),tc.prototype.addRule=function(e,t,n){var r=this;"string"==typeof e&&(e=[e]),e.forEach((function(e){r.canExecute(e,t,(function(e,t,r){return n(e)}),!0)}))},tc.prototype.init=function(){},nc.$inject=["eventBus"],e(nc,tc),nc.prototype.init=function(){this.addRule("elements.align",(function(e){var t=y(e.elements,(function(e){return!(e.waypoints||e.host||e.labelTarget)}));return!((t=ht(t)).length<2)&&t}))};var rc={__depends__:[ba,Aa,Xl],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",Kl],alignElementsMenuProvider:["type",ec],bpmnAlignElements:["type",nc]},ic=10,oc=50,sc=250;function ac(e,t,n,r){for(var i;i=cc(e,n,t);)n=r(t,n,i);return n}function lc(e){return function(t,n,r){var i={x:n.x,y:n.y};return["x","y"].forEach((function(o){var s=e[o];if(s){var a="x"===o?"width":"height",l=s.margin,c=s.minDistance;i[o]=l<0?Math.min(r[o]+l-t[a]/2,n[o]-c+l):Math.max(r[o]+r[a]+l+t[a]/2,n[o]+c+l)}})),i}}function cc(e,t,n){var r={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},i=function(e){var t=pc(e);e.host&&(t=t.concat(pc(e.host)));e.attachers&&(t=t.concat(e.attachers.reduce((function(e,t){return e.concat(pc(t))}),[])));return t}(e);return m(i,(function(e){return e!==n&&"intersect"===xn(e,r,ic)}))}function pc(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 uc(){return!0}function dc(e,t,n){e.on("autoPlace",100,(function(e){var t=e.shape;return function(e,t,n){n||(n={});var r=n.defaultDistance||oc,i=wn(e),o=yn(e);return{x:o.right+r+t.width/2,y:i.y}}(e.source,t)})),e.on("autoPlace.end",(function(e){n.scrollToElement(e.shape)})),this.append=function(n,r,i){e.fire("autoPlace.start",{source:n,shape:r});var o=e.fire("autoPlace",{source:n,shape:r}),s=t.appendShape(n,r,o,n.parent,i);return e.fire("autoPlace.end",{source:n,shape:s}),s}}function hc(e,t){e.on("autoPlace.end",500,(function(e){t.select(e.shape)}))}dc.$inject=["eventBus","modeling","canvas"],hc.$inject=["eventBus","selection"];var fc={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",dc],autoPlaceSelectionBehavior:["type",hc]};function mc(e,t){for(h(t)&&(t=[t]);e=e.parent;)if(Ei(e,t))return e;return null}function gc(e,t){var n=mc(e,"bpmn:Process");if(n)return!0;var r,i=["bpmn:Participant","bpmn:Lane"];if(n=mc(e,i))return Hi(n);if(Ei(e,i))return Hi(e);for(r=Oi(e);r&&!ki(r,"bpmn:Process");r=r.$parent);if(!t)return!0;var o=t.find((function(e){var t=Oi(e);return t&&t.get("processRef")===r}));return!o||Hi(o)}function yc(e,t,n){var r=gc(e,n);return ki(t,"bpmn:TextAnnotation")?function(e,t,n){var r=yn(e),i=n?{x:r.right+t.width/2,y:r.top-50-t.height/2}:{x:r.right+50+t.width/2,y:r.bottom+t.height/2};hn(e)&&(i=wn(e),n?(i.x+=100,i.y-=50):(i.x+=100,i.y+=50));var o={margin:n?-30:30,minDistance:20},s=n?{y:o}:{x:o};return ac(e,t,i,lc(s))}(e,t,r):Ei(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])?function(e,t,n){var r=yn(e),i=n?{x:r.right-10+t.width/2,y:r.bottom+40+t.width/2}:{x:r.left-40-t.width/2,y:r.bottom-10+t.height/2},o={margin:30,minDistance:30},s=n?{x:o}:{y:o};return ac(e,t,i,lc(s))}(e,t,r):ki(t,"bpmn:FlowNode")?function(e,t,n){var r=yn(e),i=wn(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||oc,r=t.direction||"e",i=t.filter,o=t.getWeight||function(t){return t.source===e?1:-1},s=t.maxDistance||sc,a=t.reference||"start";function l(e,t){return"n"===r?"start"===a?yn(e).top-yn(t).bottom:"center"===a?yn(e).top-wn(t).y:yn(e).top-yn(t).top:"w"===r?"start"===a?yn(e).left-yn(t).right:"center"===a?yn(e).left-wn(t).x:yn(e).left-yn(t).left:"s"===r?"start"===a?yn(t).top-yn(e).bottom:"center"===a?wn(t).y-yn(e).bottom:yn(t).bottom-yn(e).bottom:"start"===a?yn(t).left-yn(e).right:"center"===a?wn(t).x-yn(e).right:yn(t).right-yn(e).right}i||(i=uc);var c=e.incoming.filter(i).map((function(t){var n=o(t),r=n<0?l(t.source,e):l(e,t.source);return{id:t.source.id,distance:r,weight:n}})),p=e.outgoing.filter(i).map((function(t){var n=o(t),r=n>0?l(e,t.target):l(t.target,e);return{id:t.target.id,distance:r,weight:n}})),u=w(c.concat(p).reduce((function(e,t){return e[t.id+"__weight_"+t.weight]=t,e}),{}),(function(e,t){var n=t.distance,r=t.weight;return n<0||n>s||(e[String(n)]||(e[String(n)]=0),e[String(n)]+=1*r,(!e.distance||e[e.distance]<e[String(n)])&&(e.distance=n)),e}),{});return u.distance||n}(e,{filter:function(e){return ki(e,"bpmn:SequenceFlow")},direction:o.directionHint}),a=30,l=o.minDistance,c=o.baseOrientation;ki(e,"bpmn:BoundaryEvent")&&-1!==(c=xn(e,e.host,-25)).indexOf(o.boundaryOrientation)&&(a*=-1);var p=n?{x:r.right+s+t.width/2,y:i.y+vc(c,l,o)}:{x:i.x+vc(c,l,o),y:r.bottom+s+t.height/2},u={margin:a,minDistance:l},d=n?{y:u}:{x:u};return ac(e,t,p,lc(d))}(e,t,r):void 0}function vc(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function bc(e,t){e.on("autoPlace",(function(e){var n=e.shape;return yc(e.source,n,t)}))}bc.$inject=["eventBus","elementRegistry"];var wc={__depends__:[fc],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",bc]};function xc(e,t,n,i){Ho.call(this,e),this._elementRegistry=t,this._modeling=n,this._rules=i;var o=this;this.postExecuted(["shape.create"],(function(e){var t=e.context,n=t.hints||{},r=t.shape,i=t.parent||t.newParent;!1!==n.autoResize&&o._expand([r],i)})),this.postExecuted(["elements.move"],(function(e){var t=e.context,n=r(O(t.closure.topLevel)),i=t.hints,s=!i||i.autoResize;!1!==s&&v(P(n,(function(e){return e.parent.id})),(function(e,t){c(s)&&(e=e.filter((function(e){return m(s,M({id:e.id}))}))),o._expand(e,t)}))})),this.postExecuted(["shape.toggleCollapse"],(function(e){var t=e.context,n=t.hints,r=t.shape;n&&!1===n.autoResize||r.collapsed||o._expand(r.children||[],r)})),this.postExecuted(["shape.resize"],(function(e){var t=e.context,n=t.hints,r=t.shape,i=r.parent;n&&!1===n.autoResize||i&&o._expand([r],i)}))}function _c(e){e.invoke(xc,this)}function kc(e){tc.call(this,e);var t=this;this.addRule("element.autoResize",(function(e){return t.canResize(e.elements,e.target)}))}function Ec(e,t){kc.call(this,e),this._modeling=t}xc.$inject=["eventBus","elementRegistry","modeling","rules"],e(xc,Ho),xc.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),r=this.getPadding(t),i=yn(vt(e)),o=yn(t),s={};return i.top-o.top<r.top&&(s.top=i.top-n.top),i.left-o.left<r.left&&(s.left=i.left-n.left),o.right-i.right<r.right&&(s.right=i.right+n.right),o.bottom-i.bottom<r.bottom&&(s.bottom=i.bottom+n.bottom),vn(I({},o,s))},xc.prototype._expand=function(e,t){if("string"==typeof t&&(t=this._elementRegistry.get(t)),this._rules.allowed("element.autoResize",{elements:e,target:t})){var n=this._getOptimalBounds(e,t);if(function(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}(n,t)){var r=function(e,t){var n="";e=yn(e),t=yn(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}($(t,["x","y","width","height"]),n);this.resize(t,n,{autoResize:r});var i=t.parent;i&&this._expand([t],i)}}},xc.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},xc.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},xc.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)},_c.$inject=["injector"],e(_c,xc),_c.prototype.resize=function(e,t,n){ki(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)},kc.$inject=["eventBus"],e(kc,tc),kc.prototype.canResize=function(e,t){return!1},e(Ec,kc),Ec.$inject=["eventBus","modeling"],Ec.prototype.canResize=function(e,t){if(ki(t.di,"bpmndi:BPMNPlane"))return!1;if(!ki(t,"bpmn:Participant")&&!ki(t,"bpmn:Lane")&&!ki(t,"bpmn:SubProcess"))return!1;var n=!0;return v(e,(function(e){(ki(e,"bpmn:Lane")||fn(e))&&(n=!1)})),n};var Oc={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",_c],bpmnAutoResizeProvider:["type",Ec]};function Pc(e,t,n){var r,i,o=this,s=n.get("dragging",!1);s&&t.on("drag.start",(function(n){t.once("drag.move",1500,(function(t){!function(t){if(!t.hover){var n=t.originalEvent,r=o._findTargetGfx(n),i=r&&e.get(r);r&&i&&(t.stopPropagation(),s.hover({element:i,gfx:r}),s.move(n))}}(t)}))})),t.on("element.hover",(function(e){r=e.gfx,i=e.element})),t.on("element.hover",1500,(function(e){i&&t.fire("element.out",{element:i,gfx:r})})),t.on("element.out",(function(){r=null,i=null})),this._findTargetGfx=function(e){var t;if(e instanceof MouseEvent)return t=gs(e),function(e){return te(e,"svg, .djs-element",!0)}(document.elementFromPoint(t.x,t.y))}}Pc.$inject=["elementRegistry","eventBus","injector"];var Sc={__init__:["hoverFix"],hoverFix:["type",Pc]},Cc=Math.round,Tc="djs-drag-active";function Mc(e){e.preventDefault()}function Ac(e,t,n,r){var i,o={threshold:5,trapClick:!0};function s(e){var n=t.viewbox(),r=t._container.getBoundingClientRect();return{x:n.x+(e.x-r.left)/n.scale,y:n.y+(e.y-r.top)/n.scale}}function a(t,n){n=n||i;var r=e.createEvent(I({},n.payload,n.data,{isTouch:n.isTouch}));return!1!==e.fire("drag."+t,r)&&e.fire(n.prefix+"."+t,r)}function l(e,r){var o,l=i.payload,c=i.displacement,p=i.globalStart,u=gs(e),d=ia(u,p),h=i.localStart,f=s(u),g=ia(f,h);if(!i.active&&(r||(o=d,Math.sqrt(Math.pow(o.x,2)+Math.pow(o.y,2))>i.threshold))){if(I(l,{x:Cc(h.x+c.x),y:Cc(h.y+c.y),dx:0,dy:0},{originalEvent:e}),!1===a("start"))return m();i.active=!0,i.keepSelection||(l.previousSelection=n.get(),n.select(null)),i.cursor&&Js(i.cursor),t.addMarker(t.getRootElement(),Tc)}ms(e),i.active&&(I(l,{x:Cc(f.x+c.x),y:Cc(f.y+c.y),dx:Cc(g.x),dy:Cc(g.y)},{originalEvent:e}),a("move"))}function c(e){var t=!0;i.active&&(e&&(i.payload.originalEvent=e,ms(e)),t=a("end")),!1===t&&a("rejected"),a("ended",g(!0!==t))}function p(e){Bs("Escape",e)&&(Mc(e),m())}function u(t){var n;i.active&&(n=na(e),setTimeout(n,400),Mc(t)),c(t)}function d(e){l(e)}function h(e){var t=i.payload;t.hoverGfx=e.gfx,t.hover=e.element,a("hover")}function f(e){a("out");var t=i.payload;t.hoverGfx=null,t.hover=null}function m(e){var t;if(i){var n=i.active;n&&a("cancel"),t=g(e),n&&a("canceled",t)}}function g(o){var s,g;a("cleanup"),ea(),g=i.trapClick?u:c,ce.unbind(document,"mousemove",l),ce.unbind(document,"dragstart",Mc),ce.unbind(document,"selectstart",Mc),ce.unbind(document,"mousedown",g,!0),ce.unbind(document,"mouseup",g,!0),ce.unbind(document,"keyup",p),ce.unbind(document,"touchstart",d,!0),ce.unbind(document,"touchcancel",m,!0),ce.unbind(document,"touchmove",l,!0),ce.unbind(document,"touchend",c,!0),e.off("element.hover",h),e.off("element.out",f),t.removeMarker(t.getRootElement(),Tc);var y=i.payload.previousSelection;return!1!==o&&y&&!n.get().length&&function(e){var t=e.filter((function(e){return r.get(e.id)}));t.length&&n.select(t)}(y),s=i,i=null,s}e.on("diagram.destroy",m),this.init=function(t,n,r,g){i&&m(!1),"string"==typeof n&&(g=r,r=n,n=null);var y,v,b,w,x,_=(g=I({},o,g||{})).data||{};w=g.trapClick?u:c,t?(y=fs(t)||t,v=gs(t),ms(t),"dragstart"===y.type&&Mc(y)):(y=null,v={x:0,y:0}),b=s(v),n||(n=b),x=function(e){return"undefined"!=typeof TouchEvent&&e instanceof TouchEvent}(y),i=I({prefix:r,data:_,payload:{},globalStart:v,displacement:ia(n,b),localStart:b,isTouch:x},g),g.manual||(x?(ce.bind(document,"touchstart",d,!0),ce.bind(document,"touchcancel",m,!0),ce.bind(document,"touchmove",l,!0),ce.bind(document,"touchend",c,!0)):(ce.bind(document,"mousemove",l),ce.bind(document,"dragstart",Mc),ce.bind(document,"selectstart",Mc),ce.bind(document,"mousedown",w,!0),ce.bind(document,"mouseup",w,!0)),ce.bind(document,"keyup",p),e.on("element.hover",h),e.on("element.out",f)),a("init"),g.autoActivate&&l(t,!0)},this.move=l,this.hover=h,this.out=f,this.end=c,this.cancel=m,this.context=function(){return i},this.setOptions=function(e){I(o,e)}}Ac.$inject=["eventBus","canvas","selection","elementRegistry"];var Dc={__depends__:[Sc,Ds],dragging:["type",Ac]};function Nc(e,t,n){this._canvas=n,this._opts=I({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var r=this;t.on("drag.move",(function(e){var t=r._toBorderPoint(e);r.startScroll(t)})),t.on(["drag.cleanup"],(function(){r.stopScroll()}))}function Rc(e,t,n){return t<e&&e<n}Nc.$inject=["config.autoScroll","eventBus","canvas"],Nc.prototype.startScroll=function(e){var t=this._canvas,n=this._opts,r=this,i=t.getContainer().getBoundingClientRect(),o=[e.x,e.y,i.width-e.x,i.height-e.y];this.stopScroll();for(var s=0,a=0,l=0;l<4;l++)Rc(o[l],n.scrollThresholdOut[l],n.scrollThresholdIn[l])&&(0===l?s=n.scrollStep:1==l?a=n.scrollStep:2==l?s=-n.scrollStep:3==l&&(a=-n.scrollStep));0===s&&0===a||(t.scroll({dx:s,dy:a}),this._scrolling=setTimeout((function(){r.startScroll(e)}),n.scrollRepeatTimeout))},Nc.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Nc.prototype.setOptions=function(e){this._opts=I({},this._opts,e)},Nc.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=gs(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};var jc={__depends__:[Dc],__init__:["autoScroll"],autoScroll:["type",Nc]};function Lc(e){this._commandStack=e.get("commandStack",!1)}Lc.$inject=["injector"],Lc.prototype.allowed=function(e,t){var n=!0,r=this._commandStack;return r&&(n=r.canExecute(e,t)),void 0===n||n};var Ic={__init__:["rules"],rules:["type",Lc]},zc=Math.round,Bc=Math.max;var $c=10;function qc(e,t){return function(e,t){var n,r;for(n=0;r=e[n];n++)if(St(r,t)<=$c)return{point:e[n],bendpoint:!0,index:n};return null}(e,t)||function(e,t){var n,r,i=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,$c),(n=[],e.forEach((function(e,t){n.push([0===t?"M":"L",e.x,e.y])})),n)),o=i[0],s=i[i.length-1];return o?o!==s?o.segment2!==s.segment2?{point:e[r=Bc(o.segment2,s.segment2)-1],bendpoint:!0,index:r}:{point:{x:zc(o.x+s.x)/2,y:zc(o.y+s.y)/2},index:o.segment2}:{point:{x:zc(o.x),y:zc(o.y)},index:o.segment2}:null}(e,t)}function Fc(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Vc(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function Hc(e,t){var n=t[0],r=t[1],i={x:r.x-n.x,y:r.y-n.y},o=function(e,t,n){var r=[{n:e[0]-n[0],lambda:t[0]},{n:e[1]-n[1],lambda:t[1]}];return-(r[0].n*t[0]+r[1].n*t[1])/(r[0].lambda*t[0]+r[1].lambda*t[1])}([n.x,n.y],[i.x,i.y],[e.x,e.y]);return{x:n.x+o*i.x,y:n.y+o*i.y}}function Uc(e,t){var n=Hc(e,t);return Fc({x:n.x-e.x,y:n.y-e.y})}function Wc(e,t){return Fc({x:e.x-t.x,y:e.y-t.y})}var Gc="djs-bendpoint",Qc="djs-segment-dragger";function Zc(e,t,n){var r=function(e,t){var n,r=gs(t),i=e._container.getBoundingClientRect();n={x:i.left,y:i.top};var o=e.viewbox();return{x:o.x+(r.x-n.x)/o.scale,y:o.y+(r.y-n.y)/o.scale}}(e,n);return qc(t,r)}function Xc(e,t){var n=Re("g");Se(n).add(Gc),xe(e,n);var r=Re("circle");Oe(r,{cx:0,cy:0,r:4}),Se(r).add("djs-visual"),xe(n,r);var i=Re("circle");return Oe(i,{cx:0,cy:0,r:10}),Se(i).add("djs-hit"),xe(n,i),t&&Se(n).add(t),n}function Yc(e,t,n,r){var i=Re("g");xe(e,i);var o=function(e,t,n){var r=t.x-e.x,i=t.y-e.y;return Jc("h"===n?r:i)}(t,n,r),s=Re("rect");Oe(s,{x:-9,y:-3,width:18,height:6}),Se(s).add("djs-visual"),xe(i,s);var a=Re("rect");return Oe(a,{x:-o/2,y:-8.5,width:o,height:17}),Se(a).add("djs-hit"),xe(i,a),Kn(i,"v"===r?90:0),i}function Kc(e,t,n){var r=Re("g"),i=Nt(t,n),o=Mt(t,n);return xe(e,r),Yc(r,t,n,o),Se(r).add(Qc),Se(r).add("h"===o?"horizontal":"vertical"),Yn(r,i.x,i.y),r}function Jc(e){return Math.abs(Math.round(2*e/3))}function ep(e,t){var n=function(e,t){for(var n,r=t.waypoints,i=1/0,o=0;o<r.length-1;o++){var s=Uc(e,[r[o],r[o+1]]);s<i&&(i=s,n=o)}return[r[n],r[n+1]]}(e,t);return Hc(e,n)}function tp(e,t,n,r,i){function o(e,n){var o,s=n.waypoints,a=Zc(t,s,e);if(a)return o=function(e,t){var n,r,i=e.waypoints;return t.index<=0||t.bendpoint?null:(r=Mt((n={start:i[t.index-1],end:i[t.index]}).start,n.end))?Jc("h"===r?n.end.x-n.start.x:n.end.y-n.start.y)/2:null}(n,a),!function(e,t,n){var r,i,o,s,a,l,c=e.index,p=e.point;return!(c<=0||e.bendpoint)&&(o=Nt(r=t[c-1],i=t[c]),s=Mt(r,i),a=Math.abs(p.x-o.x),l=Math.abs(p.y-o.y),s&&a<=n&&l<=n)}(a,s,o)?r.start(e,n,a.index,!a.bendpoint):i.start(e,n,a.index),!0}function s(e,t,r){ce.bind(e,t,(function(e){n.triggerMouseEvent(t,e,r),e.stopPropagation()}))}function a(e,n){var r=t.getLayer("overlays"),i=ve('.djs-bendpoints[data-element-id="'+Qo(e.id)+'"]',r);return!i&&n&&(Oe(i=Re("g"),{"data-element-id":e.id}),Se(i).add("djs-bendpoints"),xe(r,i),s(i,"mousedown",e),s(i,"click",e),s(i,"dblclick",e)),i}function l(e,t){return ve('.djs-segment-dragger[data-segment-idx="'+e+'"]',t)}function c(e,t){t.waypoints.forEach((function(t,n){var r=Xc(e);xe(e,r),Yn(r,t.x,t.y)})),Xc(e,"floating")}function p(e,t){for(var n,r,i,o=t.waypoints,a=1;a<o.length;a++)Mt(n=o[a-1],r=o[a])&&(Oe(i=Kc(e,n,r),{"data-segment-idx":a}),s(i,"mousemove",t))}function u(e){var t=a(e);return t||(c(t=a(e,!0),e),p(t,e)),t}function d(e){var t=a(e);t&&(!function(e){v(be("."+Qc,e),(function(e){Ue(e)}))}(t),function(e){v(be("."+Gc,e),(function(e){Ue(e)}))}(t),p(t,e),c(t,e))}function h(e,t,n){var r,i,o=l(t.index,e),s=n[t.index-1],a=n[t.index],c=t.point,p=Nt(s,a),u=Mt(s,a);o&&(r=function(e){return ve(".djs-visual",e)}(o),i={x:c.x-p.x,y:c.y-p.y},"v"===u&&(i={x:i.y,y:i.x}),Yn(r,i.x,i.y))}e.on("connection.changed",(function(e){d(e.element)})),e.on("connection.remove",(function(e){var t=a(e.element);t&&Ue(t)})),e.on("element.marker.update",(function(e){var t,n=e.element;n.waypoints&&(t=u(n),e.add?Se(t).add(e.marker):Se(t).remove(e.marker))})),e.on("element.mousemove",(function(e){var n,r,i=e.element,o=i.waypoints;if(o){if(n=a(i,!0),!(r=Zc(t,o,e.originalEvent)))return;!function(e,t){var n=ve(".floating",e),r=t.point;n&&Yn(n,r.x,r.y)}(n,r),r.bendpoint||h(n,r,o)}})),e.on("element.mousedown",(function(e){if(bs(e)){var t=e.originalEvent,n=e.element;if(n.waypoints)return o(t,n)}})),e.on("selection.changed",(function(e){var t=e.newSelection[0];t&&t.waypoints&&u(t)})),e.on("element.hover",(function(e){var t=e.element;t.waypoints&&(u(t),n.registerEvent(e.gfx,"mousemove","element.mousemove"))})),e.on("element.out",(function(e){n.unregisterEvent(e.gfx,"mousemove","element.mousemove")})),e.on("element.updateId",(function(e){var t=e.element,n=e.newId;if(t.waypoints){var r=a(t);r&&Oe(r,{"data-element-id":n})}})),this.addHandles=u,this.updateHandles=d,this.getBendpointsContainer=a,this.getSegmentDragger=l}tp.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];var np=Math.round,rp="reconnectStart",ip="reconnectEnd",op="updateWaypoints";function sp(e,t,n,r,i,o){this._injector=e,this.start=function(e,t,o,s){var a,l=n.getGraphics(t),c=t.source,p=t.target,u=t.waypoints,d=(a=s||0!==o?s||o!==u.length-1?op:ip:rp)===op?"connection.updateWaypoints":"connection.reconnect",h=i.allowed(d,{connection:t,source:c,target:p});!1===h&&(h=i.allowed(d,{connection:t,source:p,target:c})),!1!==h&&r.init(e,"bendpoint.move",{data:{connection:t,connectionGfx:l,context:{allowed:h,bendpointIndex:o,connection:t,source:c,target:p,insert:s,type:a}}})},t.on("bendpoint.move.hover",(function(e){var t,n=e.context,r=n.connection,o=r.source,s=r.target,a=e.hover,l=n.type;if(n.hover=a,a){var c=l===op?"connection.updateWaypoints":"connection.reconnect";if(t=n.allowed=i.allowed(c,{connection:r,source:l===rp?a:o,target:l===ip?a:s}))return n.source=l===rp?a:o,void(n.target=l===ip?a:s);!1===t&&(t=n.allowed=i.allowed(c,{connection:r,source:l===ip?a:s,target:l===rp?a:o})),t&&(n.source=l===ip?a:s,n.target=l===rp?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!==op&&(t.allowed=!1)})),t.on("bendpoint.move.end",(function(e){var t=e.context,n=t.allowed,r=t.bendpointIndex,i=t.connection,s=t.insert,a=i.waypoints.slice(),l=t.source,c=t.target,p=t.type,u=t.hints||{},d={x:np(e.x),y:np(e.y)};if(!n)return!1;p===op?(s?a.splice(r,0,d):a[r]=d,u.bendpointMove={insert:s,bendpointIndex:r},a=this.cropWaypoints(i,a),o.updateWaypoints(i,function(e){e=e.slice();for(var t,n,r,i=0;e[i];)t=e[i],n=e[i-1],0===St(t,r=e[i+1])||Ct(n,r,t)?e.splice(i,1):i++;return e}(a),u)):(p===rp?(u.docking="source",ap(t)&&(u.docking="target",u.newWaypoints=a.reverse())):p===ip&&(u.docking="target",ap(t)&&(u.docking="source",u.newWaypoints=a.reverse())),o.reconnect(i,l,c,d,u))}),this)}function ap(e){var t=e.hover,n=e.source,r=e.target,i=e.type;return i===rp?t&&r&&t===r&&n!==r:i===ip?t&&n&&t===n&&n!==r:void 0}sp.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],sp.prototype.cropWaypoints=function(e,t){var n=this._injector.get("connectionDocking",!1);if(!n)return t;var r=e.waypoints;return e.waypoints=t,e.waypoints=n.getCroppedWaypoints(e),t=e.waypoints,e.waypoints=r,t};var lp="updateWaypoints",cp="connect-ok",pp="connect-not-ok",up="connect-hover",dp="djs-updating",hp="djs-dragging";function fp(e,t,n,r){this._injector=t;var i=t.get("connectionPreview",!1);n.on("bendpoint.move.start",(function(e){var t=e.context,n=t.bendpointIndex,i=t.connection,o=t.insert,s=i.waypoints,a=s.slice();t.waypoints=s,o&&a.splice(n,0,{x:e.x,y:e.y}),i.waypoints=a,Se(t.draggerGfx=Xc(r.getLayer("overlays"))).add("djs-dragging"),r.addMarker(i,hp),r.addMarker(i,dp)})),n.on("bendpoint.move.hover",(function(e){var t=e.context,n=t.allowed,i=t.hover,o=t.type;if(i){if(r.addMarker(i,up),o===lp)return;n?(r.removeMarker(i,pp),r.addMarker(i,cp)):!1===n&&(r.removeMarker(i,cp),r.addMarker(i,pp))}})),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],1100,(function(e){var t=e.context,n=t.hover,i=t.target;n&&(r.removeMarker(n,up),r.removeMarker(n,i?cp:pp))})),n.on("bendpoint.move.move",(function(t){var n=t.context,r=n.allowed,o=n.bendpointIndex,s=n.draggerGfx,a=n.hover,l=n.type,c=n.connection,p=c.source,u=c.target,d=c.waypoints.slice(),h={x:t.x,y:t.y},f=n.hints||{},m={};i&&(f.connectionStart&&(m.connectionStart=f.connectionStart),f.connectionEnd&&(m.connectionEnd=f.connectionEnd),"reconnectStart"===l?ap(n)?(m.connectionEnd=m.connectionEnd||h,m.source=u,m.target=a||p,d=d.reverse()):(m.connectionStart=m.connectionStart||h,m.source=a||p,m.target=u):"reconnectEnd"===l?ap(n)?(m.connectionStart=m.connectionStart||h,m.source=a||u,m.target=p,d=d.reverse()):(m.connectionEnd=m.connectionEnd||h,m.source=p,m.target=a||u):(m.noCropping=!0,m.noLayout=!0,d[o]=h),l===lp&&(d=e.cropWaypoints(c,d)),m.waypoints=d,i.drawPreview(n,r,m)),Yn(s,t.x,t.y)}),this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],1100,(function(e){var t=e.context,n=t.connection,o=t.draggerGfx,s=t.hover,a=t.target,l=t.waypoints;n.waypoints=l,Ue(o),r.removeMarker(n,dp),r.removeMarker(n,hp),s&&(r.removeMarker(s,cp),r.removeMarker(s,a?cp:pp)),i&&i.cleanUp(t)}))}fp.$inject=["bendpointMove","injector","eventBus","canvas"];var mp="connect-hover",gp="djs-updating";function yp(e,t,n){return vp(e,t,e[t]+n)}function vp(e,t,n){return{x:"x"===t?n:e.x,y:"y"===t?n:e.y}}function bp(e){return"x"===e?"y":"x"}function wp(e,t,n){var r,i;return e.original?e.original:(r=wn(t),vp(e,i=bp(n),r[i]))}function xp(e,t,n,r,i,o){var s=e.get("connectionDocking",!1);function a(e,t){if(!s)return t;var n,r=e.waypoints;return e.waypoints=t,n=s.getCroppedWaypoints(e),e.waypoints=r,n}function l(e){i.update("connection",e.connection,e.connectionGfx)}function c(e,t,n){var r=e.newWaypoints,i=function(e,t,n,r){var i=Math.max(t[r],n[r]),o=Math.min(t[r],n[r]);return vp(t,r,Math.min(Math.max(o+20,e[r]),i-20))}(n,r[e.segmentStartIndex+t],r[e.segmentEndIndex+t],bp(e.axis));Yn(e.draggerGfx,i.x,i.y)}this.start=function(e,t,i){var o,s,a,l,c=n.getGraphics(t),p=i-1,u=i,d=t.waypoints,h=d[p],f=d[u],m=Zc(n,d,e);(s=Mt(h,f))&&(a="v"===s?"x":"y",0===p&&(h=wp(h,t.source,a)),u===d.length-1&&(f=wp(f,t.target,a)),o={connection:t,segmentStartIndex:p,segmentEndIndex:u,segmentStart:h,segmentEnd:f,axis:a,dragPosition:l=m?m.point:{x:(h.x+f.x)/2,y:(h.y+f.y)/2}},r.init(e,l,"connectionSegment.move",{cursor:"x"===a?"resize-ew":"resize-ns",data:{connection:t,connectionGfx:c,context:o}}))},t.on("connectionSegment.move.start",(function(e){var t=e.context,r=e.connection,i=n.getLayer("overlays");t.originalWaypoints=r.waypoints.slice(),t.draggerGfx=Kc(i,t.segmentStart,t.segmentEnd),Se(t.draggerGfx).add("djs-dragging"),n.addMarker(r,gp)})),t.on("connectionSegment.move.move",(function(e){var t,n,r=e.context,i=r.connection,o=r.segmentStartIndex,s=r.segmentEndIndex,p=r.segmentStart,u=r.segmentEnd,d=r.axis,h=r.originalWaypoints.slice(),f=yp(p,d,e["d"+d]),m=yp(u,d,e["d"+d]),g=h.length,y=0;h[o]=f,h[s]=m,o<2&&(t=xn(i.source,f),1===o?"intersect"===t&&(h.shift(),h[0]=f,y--):"intersect"!==t&&(h.unshift(p),y++)),s>g-3&&(n=xn(i.target,m),s===g-2?"intersect"===n&&(h.pop(),h[h.length-1]=m):"intersect"!==n&&h.push(u)),r.newWaypoints=i.waypoints=a(i,h),c(r,y,e),r.newSegmentStartIndex=o+y,l(e)})),t.on("connectionSegment.move.hover",(function(e){e.context.hover=e.hover,n.addMarker(e.hover,mp)})),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],(function(e){var t=e.context.hover;t&&n.removeMarker(t,mp)})),t.on("connectionSegment.move.cleanup",(function(e){var t=e.context,r=t.connection;t.draggerGfx&&Ue(t.draggerGfx),n.removeMarker(r,gp)})),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],(function(e){var t=e.context;t.connection.waypoints=t.originalWaypoints,l(e)})),t.on("connectionSegment.move.end",(function(e){var t=e.context,n=t.connection,r=t.newWaypoints,i=t.newSegmentStartIndex;r=r.map((function(e){return{original:e.original,x:Math.round(e.x),y:Math.round(e.y)}}));var s=function(e,t){var n=0,r=e.filter((function(r,i){return!Ct(e[i-1],e[i+1],r)||(n=i<=t?n-1:n,!1)}));return{waypoints:r,segmentOffset:n}}(r,i),l=a(n,s.waypoints),c=s.segmentOffset,p={segmentMove:{segmentStartIndex:t.segmentStartIndex,newSegmentStartIndex:i+c}};o.updateWaypoints(n,l,p)}))}xp.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var _p=Math.abs,kp=Math.round;function Ep(e){return{x:e.x,y:e.y}}function Op(e){return{x:e.x+e.width,y:e.y+e.height}}function Pp(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:kp(e.x+e.width/2),y:kp(e.y+e.height/2)}}function Sp(e,t){var n=e.snapped;return!!n&&("string"==typeof t?n[t]:n.x&&n.y)}function Cp(e,t,n){if("string"!=typeof t)throw new Error("axis must be in [x, y]");if("number"!=typeof n&&!1!==n)throw new Error("value must be Number or false");var r,i=e[t],o=e.snapped=e.snapped||{};return!1===n?o[t]=!1:(o[t]=!0,r=n-i,e[t]+=r,e["d"+t]+=r),i}function Tp(e){return e.children||[]}var Mp=Math.abs,Ap=Math.round;function Dp(e){function t(e,t){if(c(e)){for(var n=e.length;n--;)if(Mp(e[n]-t)<=10)return e[n]}else{var r=t%(e=+e);if(r<10)return t-r;if(r>e-10)return t-r+e}return t}function n(e,t){return e.waypoints?ep(t,e):e.width?{x:Ap(e.width/2+e.x),y:Ap(e.height/2+e.y)}:void 0}e.on("connectionSegment.move.move",1500,(function(e){var r,i,o=function(e){var t=e.context,r=t.snapPoints,i=t.connection,o=i.waypoints,s=t.segmentStart,a=t.segmentStartIndex,l=t.segmentEnd,c=t.segmentEndIndex,p=t.axis;if(r)return r;var u=[o[a-1],s,l,o[c+1]];return a<2&&u.unshift(n(i.source,e)),c>o.length-3&&u.unshift(n(i.target,e)),t.snapPoints=r={horizontal:[],vertical:[]},v(u,(function(e){e&&(e=e.original||e,"y"===p&&r.horizontal.push(e.y),"x"===p&&r.vertical.push(e.x))})),r}(e),s=e.x,a=e.y;if(o){var l=s-(r=t(o.vertical,s)),c=a-(i=t(o.horizontal,a));I(e,{dx:e.dx-l,dy:e.dy-c,x:r,y:i}),(l||-1!==o.vertical.indexOf(s))&&Cp(e,"x",r),(c||-1!==o.horizontal.indexOf(a))&&Cp(e,"y",i)}})),e.on(["connect.hover","connect.move","connect.end"],1500,(function(e){var t=e.context.hover,r=t&&n(t,e);hn(t)&&r&&r.x&&r.y&&(Cp(e,"x",r.x),Cp(e,"y",r.y))})),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,(function(e){var r,i,o=e.context,s=function(e){var t=e.snapPoints,n=e.connection.waypoints,r=e.bendpointIndex;if(t)return t;var i=[n[r-1],n[r+1]];return e.snapPoints=t={horizontal:[],vertical:[]},v(i,(function(e){e&&(e=e.original||e,t.horizontal.push(e.y),t.vertical.push(e.x))})),t}(o),a=o.hover,l=a&&n(a,e),c=e.x,p=e.y;if(s){var u=c-(r=t(l?s.vertical.concat([l.x]):s.vertical,c)),d=p-(i=t(l?s.horizontal.concat([l.y]):s.horizontal,p));I(e,{dx:e.dx-u,dy:e.dy-d,x:e.x-u,y:e.y-d}),(u||-1!==s.vertical.indexOf(c))&&Cp(e,"x",r),(d||-1!==s.horizontal.indexOf(p))&&Cp(e,"y",i)}}))}Dp.$inject=["eventBus"];var Np={__depends__:[Dc,Ic],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",tp],bendpointMove:["type",sp],bendpointMovePreview:["type",fp],connectionSegmentMove:["type",xp],bendpointSnapping:["type",Dp]};function Rp(e,t,n,r){function i(e,t){return r.allowed("connection.create",{source:e,target:t})}e.on("connect.hover",(function(e){var t,n=e.context,r=n.start,o=e.hover;if(n.hover=o,!l(t=n.canExecute=i(r,o))){if(!1!==t)return n.source=r,void(n.target=o);l(t=n.canExecute=i(o,r))||!1!==t&&(n.source=o,n.target=r)}})),e.on(["connect.out","connect.cleanup"],(function(e){var t=e.context;t.hover=null,t.source=null,t.target=null,t.canExecute=!1})),e.on("connect.end",(function(e){var t=e.context,r=t.canExecute,i=t.connectionStart,o={x:e.x,y:e.y},s=t.source,a=t.target;if(!r)return!1;var l=null,c={connectionStart:jp(t)?o:i,connectionEnd:jp(t)?i:o};p(r)&&(l=r),t.connection=n.connect(s,a,l,c)})),this.start=function(e,n,r,i){p(r)||(i=r,r=wn(n)),t.init(e,"connect",{autoActivate:i,data:{shape:n,context:{start:n,connectionStart:r}}})}}function jp(e){var t=e.hover,n=e.source,r=e.target;return t&&n&&t===n&&n!==r}Rp.$inject=["eventBus","dragging","modeling","rules"];var Lp="connect-ok",Ip="connect-not-ok";function zp(e,t,n){var r=e.get("connectionPreview",!1);r&&t.on("connect.move",(function(e){var t=e.context,n=t.canExecute,i=t.hover,o=t.source,s=t.start,a=t.startPosition,l=t.target,c=t.connectionStart||a,p=t.connectionEnd||{x:e.x,y:e.y},u=c,d=p;jp(t)&&(u=p,d=c),r.drawPreview(t,n,{source:o||s,target:l||i,connectionStart:u,connectionEnd:d})})),t.on("connect.hover",900,(function(e){var t=e.context,r=e.hover,i=t.canExecute;null!==i&&n.addMarker(r,i?Lp:Ip)})),t.on(["connect.out","connect.cleanup"],1100,(function(e){var t=e.hover;t&&(n.removeMarker(t,Lp),n.removeMarker(t,Ip))})),r&&t.on("connect.cleanup",(function(e){r.cleanUp(e.context)}))}zp.$inject=["injector","eventBus","canvas"];var Bp={__depends__:[Ds,Ic,Dc],__init__:["connectPreview"],connect:["type",Rp],connectPreview:["type",zp]};function $p(e,t,n,r){this._canvas=t,this._graphicsFactory=n,this._elementFactory=r,this._connectionDocking=e.get("connectionDocking",!1),this._layouter=e.get("layouter",!1)}$p.$inject=["injector","canvas","graphicsFactory","elementFactory"],$p.prototype.drawPreview=function(e,t,n){n=n||{};var r,i=e.connectionPreviewGfx,o=e.getConnection,s=n.source,a=n.target,l=n.waypoints,c=n.connectionStart,p=n.connectionEnd,u=n.noLayout,d=n.noCropping,h=n.noNoop,f=this;i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),Te(i),o||(o=e.getConnection=function(e){var t={};return function(n){var r=JSON.stringify(n),i=t[r];return i||(i=t[r]=e.apply(null,arguments)),i}}((function(e,t,n){return f.getConnection(e,t,n)}))),t&&(r=o(t,s,a)),r?(r.waypoints=l||[],this._layouter&&!u&&(r.waypoints=this._layouter.layoutConnection(r,{source:s,target:a,connectionStart:c,connectionEnd:p,waypoints:n.waypoints||r.waypoints})),r.waypoints&&r.waypoints.length||(r.waypoints=[s?wn(s):c,a?wn(a):p]),this._connectionDocking&&(s||a)&&!d&&(r.waypoints=this._connectionDocking.getCroppedWaypoints(r,s,a)),this._graphicsFactory.drawConnection(i,r,{stroke:"var(--element-dragger-color)"})):!h&&this.drawNoopPreview(i,n)},$p.prototype.drawNoopPreview=function(e,t){var n=t.source,r=t.target,i=t.connectionStart||wn(n),o=t.connectionEnd||wn(r),s=this.cropWaypoints(i,o,n,r);xe(e,this.createNoopConnection(s[0],s[1]))},$p.prototype.cropWaypoints=function(e,t,n,r){var i=this._graphicsFactory,o=n&&i.getShapePath(n),s=r&&i.getShapePath(r),a=i.getConnectionPath({waypoints:[e,t]});return[e=n&&_n(o,a,!0)||e,t=r&&_n(s,a,!1)||t]},$p.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&Ue(e.connectionPreviewGfx)},$p.prototype.getConnection=function(e){var t=function(e){return p(e)?e:{}}(e);return this._elementFactory.createConnection(t)},$p.prototype.createConnectionPreviewGfx=function(){var e=Re("g");return Oe(e,{pointerEvents:"none"}),Se(e).add("djs-dragger"),xe(this._canvas.getActiveLayer(),e),e},$p.prototype.createNoopConnection=function(e,t){return ut([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};var qp={__init__:["connectionPreview"],connectionPreview:["type",$p]};const Fp=new jo("ps");var Vp=["marker-start","marker-mid","marker-end"],Hp=["circle","ellipse","line","path","polygon","polyline","path","rect"];function Up(e,t,n,r){this._elementRegistry=e,this._canvas=n,this._styles=r}Up.$inject=["elementRegistry","eventBus","canvas","styles"],Up.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")},Up.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},Up.prototype.addDragger=function(e,t,n,r="djs-dragger"){var i=Me(n=n||this.getGfx(e)),o=n.getBoundingClientRect();return this._cloneMarkers(Zn(i),r),Oe(i,this._styles.cls(r,[],{x:o.top,y:o.left})),xe(t,i),Oe(i,"data-preview-support-element-id",e.id),i},Up.prototype.addFrame=function(e,t){var n=Re("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return xe(t,n),Oe(n,"data-preview-support-element-id",e.id),n},Up.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var r=this;e.childNodes&&e.childNodes.forEach((e=>{r._cloneMarkers(e,t,n)})),function(e){return-1!==Hp.indexOf(e.nodeName)}(e)&&Vp.forEach((function(i){if(Oe(e,i)){var o=function(e,t,n){var r=(i=Oe(e,t),i.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]);var i;return ve("marker#"+r,n||document)}(e,i,r._canvas.getContainer());o&&r._cloneMarker(n,e,o,i,t)}}))},Up.prototype._cloneMarker=function(e,t,n,r,i="djs-dragger"){var o=[n.id,i,Fp.next()].join("-"),s=ve("marker#"+n.id,e);e=e||this._canvas._svg;var a=s||Me(n);a.id=o,Se(a).add(i);var l=ve(":scope > defs",e);l||xe(e,l=Re("defs")),xe(l,a);var c=function(e){return"url(#"+e+")"}(a.id);Oe(t,r,c)};var Wp={__init__:["previewSupport"],previewSupport:["type",Up]};const Gp="complex-preview";class Qp{constructor(e,t,n){this._canvas=e,this._graphicsFactory=t,this._previewSupport=n,this._markers=[]}create(e){this.cleanUp();const{created:t=[],moved:n=[],removed:r=[],resized:i=[]}=e,o=this._canvas.getLayer(Gp);t.filter((e=>!function(e){return e.hidden}(e))).forEach((e=>{let t;hn(e)?(t=this._graphicsFactory._createContainer("connection",Re("g")),this._graphicsFactory.drawConnection(Zn(t),e)):(t=this._graphicsFactory._createContainer("shape",Re("g")),this._graphicsFactory.drawShape(Zn(t),e),Yn(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);hn(e)?Yn(n,t.x,t.y):Yn(n,e.x+t.x,e.y+t.y)})),r.forEach((e=>{this._previewSupport.addDragger(e,o,void 0,"djs-dragging"),this._canvas.addMarker(e,"djs-element-hidden"),this._markers.push([e,"djs-element-hidden"])})),i.forEach((({shape:e,bounds:t})=>{this._canvas.addMarker(e,"djs-hidden"),this._markers.push([e,"djs-hidden"]),this._previewSupport.addDragger(e,o,void 0,"djs-dragging");const n=this._graphicsFactory._createContainer("shape",Re("g"));this._graphicsFactory.drawShape(Zn(n),e,{width:t.width,height:t.height}),Yn(n,t.x,t.y),this._previewSupport.addDragger(e,o,n)}))}cleanUp(){Te(this._canvas.getLayer(Gp)),this._markers.forEach((([e,t])=>this._canvas.removeMarker(e,t))),this._markers=[]}show(){this._canvas.showLayer(Gp)}hide(){this._canvas.hideLayer(Gp)}}Qp.$inject=["canvas","graphicsFactory","previewSupport"];var Zp={__depends__:[Wp],__init__:["complexPreview"],complexPreview:["type",Qp]},Xp=["top","bottom","left","right"],Yp=10;function Kp(e,t){function n(e){if(Yi(e)&&!hn(e)){var n=function(e){var t=wn(e.label),n=wn(e),r=Jp(n,t);if(i=r,-1===Xp.indexOf(i))return;var i;var o=function(e){var t=wn(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 Jp(t,e)}));return n}(e);if(e.host){var s=function(e){var t,n=e.host,r=wn(e),i=xn(r,n);t=i.indexOf("-")>=0?i.split("-"):[i];var o=Xp.filter((function(e){return-1===t.indexOf(e)}));return o}(e);o=o.concat(s)}var a=Xp.filter((function(e){return-1===o.indexOf(e)}));if(-1!==a.indexOf(r))return;return a[0]}(e);n&&function(e,n){var r=wn(e),i=e.label,o=wn(i);if(!i.parent)return;var s,a=yn(e);switch(n){case"top":s={x:r.x,y:a.top-Yp-i.height/2};break;case"left":s={x:a.left-Yp-i.width/2,y:r.y};break;case"bottom":s={x:r.x,y:a.bottom+Yp+i.height/2};break;case"right":s={x:a.right+Yp+i.width/2,y:r.y}}var l=ia(s,o);t.moveShape(i,l)}(e,n)}}Ho.call(this,e),this.postExecuted(["connection.create","connection.layout","connection.updateWaypoints"],(function(e){var t=e.context,r=t.connection,i=r.source,o=r.target;!1!==(t.hints||{}).createElementsBehavior&&(n(i),n(o))})),this.postExecuted(["label.create"],(function(e){var t=e.context,r=t.shape;!1!==(t.hints||{}).createElementsBehavior&&n(r.labelTarget)})),this.postExecuted(["elements.create"],(function(e){var t=e.context,r=t.elements;!1!==(t.hints||{}).createElementsBehavior&&r.forEach((function(e){n(e)}))}))}function Jp(e,t){return xn(t,e,5)}function eu(e){Ho.call(this,e),this.preExecute("shape.append",(function(e){var t=e.source,n=e.shape;e.position||(ki(n,"bpmn:TextAnnotation")?e.position={x:t.x+t.width/2+75,y:t.y-50-n.height/2}:e.position={x:t.x+t.width+80+n.width/2,y:t.y+t.height/2})}),!0)}function tu(e,t){e.invoke(Ho,this),this.postExecute("shape.move",(function(e){var n=e.newParent,r=e.shape;v(y(r.incoming.concat(r.outgoing),(function(e){return ki(e,"bpmn:Association")})),(function(e){t.moveConnection(e,{x:0,y:0},n)}))}),!0)}e(Kp,Ho),Kp.$inject=["eventBus","modeling"],e(eu,Ho),eu.$inject=["eventBus"],e(tu,Ho),tu.$inject=["injector","modeling"];function nu(e,t){t.invoke(Ho,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 ru(e,e.host)}))).length&&t.map((function(e){return t.indexOf(e)})).forEach((function(r){var i=t[r];e.elements[r]=n._replaceShape(t[r],i)}))}),!0),this.preExecute("elements.move",500,(function(e){var t=e.shapes,r=e.newHost;if(1===t.length){var i=t[0];ru(i,r)&&(e.shapes=[n._replaceShape(i,r)])}}),!0)}function ru(e,t){return!fn(e)&&Ei(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function iu(e,t){function n(e){return y(e.attachers,(function(e){return ki(e,"bpmn:BoundaryEvent")}))}Ho.call(this,e),this.postExecute("connection.create",(function(e){var r=e.context.source,i=e.context.target,o=n(i);ki(r,"bpmn:EventBasedGateway")&&ki(i,"bpmn:ReceiveTask")&&o.length>0&&t.removeElements(o)})),this.postExecute("connection.reconnect",(function(e){var r=e.context.oldSource,i=e.context.newSource;ki(r,"bpmn:Gateway")&&ki(i,"bpmn:EventBasedGateway")&&v(i.outgoing,(function(e){var r=e.target,i=n(r);ki(r,"bpmn:ReceiveTask")&&i.length>0&&t.removeElements(i)}))}))}function ou(e,t,n){function r(e){t.updateProperties(e,{isForCompensation:!0})}function i(e){t.updateProperties(e,{isForCompensation:void 0})}Ho.call(this,e),this.preExecute("shape.replace",(function(e){const{newData:n,oldShape:r}=e;if(au(e.oldShape)&&"bpmn:CompensateEventDefinition"!==n.eventDefinitionType||"bpmn:BoundaryEvent"!==n.type){const t=r.outgoing.find((({target:e})=>su(e)));t&&t.target&&(e._connectionTarget=t.target)}else if(!au(e.oldShape)&&"bpmn:CompensateEventDefinition"===n.eventDefinitionType&&"bpmn:BoundaryEvent"===n.type){const n=r.outgoing.find((({target:e})=>lu(e)));n&&n.target&&(e._connectionTarget=n.target),function(e){const n=e.outgoing.filter((e=>ki(e,"bpmn:SequenceFlow")));t.removeElements(n)}(r)}}),!0),this.postExecuted("shape.replace",(function(e){const{_connectionTarget:n,newShape:r}=e;n&&t.connect(r,n)}),!0),this.preExecute("connection.create",(function(e){const n=e.connection,i=e.source,o=e.target;au(i)&&lu(o)&&(r(o),function(e,n){const r=e.outgoing.filter((e=>ki(e,"bpmn:Association"))),i=r.filter((e=>su(e.target)&&!n.includes(e)));i.forEach((e=>t.removeConnection(e)))}(i,[n]))}),!0),this.postExecuted("connection.delete",(function(e){const t=e.source,n=e.target;au(t)&&su(n)&&i(n)}),!0),this.postExecuted("connection.reconnect",(function(e){const t=e.newTarget,n=e.oldSource,o=e.oldTarget;if(o!==t){const e=n;su(o)&&i(o),au(e)&&lu(t)&&r(t)}}),!0),this.postExecuted("element.updateProperties",(function(e){const{element:r}=e;su(r)?(function(e){for(const r of e.incoming)n.canConnect(r.source,e)||t.removeConnection(r);for(const r of e.outgoing)n.canConnect(e,r.target)||t.removeConnection(r)}(r),function(e){const n=e.attachers.slice();if(!n.length)return;t.removeElements(n)}(r)):lu(r)&&function(e){const n=e.incoming.filter((e=>au(e.source)));t.removeElements(n)}(r)}),!0)}function su(e){const t=Oi(e);return t&&t.get("isForCompensation")}function au(e){return e&&ki(e,"bpmn:BoundaryEvent")&&Gi(e,"bpmn:CompensateEventDefinition")}function lu(e){return e&&ki(e,"bpmn:Activity")&&!Wi(e)}function cu(e){e.invoke(Ho,this),this.preExecute("shape.create",1500,(function(e){var t=e.context,n=t.parent,r=t.shape;ki(n,"bpmn:Lane")&&!ki(r,"bpmn:Lane")&&(t.parent=mc(n,"bpmn:Participant"))}))}function pu(e,t){Ho.call(this,e),this.preExecute("shape.create",(function(e){var n=e.context.shape;if(ki(n,"bpmn:DataObjectReference")&&"label"!==n.type){var r=t.create("bpmn:DataObject");n.businessObject.dataObjectRef=r}}))}nu.$inject=["bpmnReplace","injector"],e(nu,Ho),nu.prototype._replaceShape=function(e,t){var n,r=(n=Oi(e).eventDefinitions)&&n[0],i={type:"bpmn:BoundaryEvent",host:t};return r&&(i.eventDefinitionType=r.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})},iu.$inject=["eventBus","modeling"],e(iu,Ho),e(ou,Ho),ou.$inject=["eventBus","modeling","bpmnRules"],cu.$inject=["injector"],e(cu,Ho),pu.$inject=["eventBus","bpmnFactory"],e(pu,Ho);var uu=20,du=20,hu=30,fu=2e3;function mu(e,t,n){function r(){var t=e.getRootElement();return ki(t,"bpmn:Collaboration")?t:n.makeCollaboration()}Ho.call(this,t),t.on(["create.start","shape.move.start"],fu,(function(t){var n=t.context,r=n.shape,i=e.getRootElement();if(ki(r,"bpmn:Participant")&&ki(i,"bpmn:Process")&&i.children.length){var o=i.children.filter((function(e){return!ki(e,"bpmn:Group")&&!fn(e)&&!hn(e)}));if(o.length){var s=vt(o),a=function(e,t){t={width:t.width+2*uu+hu,height:t.height+2*du};var n=Math.max(e.width,t.width),r=Math.max(e.height,t.height);return{x:-n/2,y:-r/2,width:n,height:r}}(r,s);I(r,a),n.createConstraints=function(e,t){return t=yn(t),{bottom:t.top+e.height/2-du,left:t.right-e.width/2+uu,top:t.bottom-e.height/2+du,right:t.left+e.width/2-uu-hu}}(r,s)}}})),t.on("create.start",fu,(function(n){var r=n.context.shape,i=e.getRootElement(),o=e.getGraphics(i);function s(e){e.element=i,e.gfx=o}ki(r,"bpmn:Participant")&&ki(i,"bpmn:Process")&&(t.on("element.hover",fu,s),t.once("create.cleanup",(function(){t.off("element.hover",s)})))})),this.preExecute("elements.create",fu,(function(e){var t,n=e.elements,i=e.parent,o=function(e){return m(e,(function(e){return ki(e,"bpmn:Participant")}))}(n);o&&ki(i,"bpmn:Process")&&(e.parent=r(),(t=e.hints=e.hints||{}).participant=o,t.process=i,t.processRef=Oi(o).get("processRef"))}),!0),this.preExecute("shape.create",(function(e){var t=e.parent,n=e.shape;ki(n,"bpmn:Participant")&&ki(t,"bpmn:Process")&&(e.parent=r(),e.process=t,e.processRef=Oi(n).get("processRef"))}),!0),this.execute("shape.create",(function(e){var t=e.hints||{},n=e.process||t.process,r=e.shape,i=t.participant;!n||i&&r!==i||Oi(r).set("processRef",Oi(n))}),!0),this.revert("shape.create",(function(e){var t=e.hints||{},n=e.process||t.process,r=e.processRef||t.processRef,i=e.shape,o=t.participant;!n||o&&i!==o||Oi(i).set("processRef",r)}),!0),this.postExecute("shape.create",(function(e){var t=e.hints||{},r=e.process||e.hints.process,i=e.shape,o=t.participant;if(r){var s=r.children.slice();o?i===o&&n.moveElements(s,{x:0,y:0},o):n.moveElements(s,{x:0,y:0},i)}}),!0)}mu.$inject=["canvas","eventBus","modeling"],e(mu,Ho);var gu="__targetRef_placeholder";function yu(e,t){function n(e,n){var r=e.get("properties"),i=m(r,(function(e){return e.name===gu}));return!i&&n&&Ot(r,i=t.create("bpmn:Property",{name:gu})),i}function r(e,t){var r=n(e);r&&(function(e,t,n){return m(e.get("dataInputAssociations"),(function(e){return e!==n&&e.targetRef===t}))}(e,r,t)||Et(e.get("properties"),r))}function i(e){var t,i=e.context,o=i.connection,s=o.businessObject,a=o.target,l=a&&a.businessObject,c=i.newTarget,p=c&&c.businessObject,u=i.oldTarget||i.target,d=u&&u.businessObject,h=o.businessObject;d&&d!==l&&r(d,s),p&&p!==l&&r(p,s),l?(t=n(l,!0),h.targetRef=t):h.targetRef=null}Ho.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],vu(i)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],vu(i))}function vu(e){return function(t){if(ki(t.context.connection,"bpmn:DataInputAssociation"))return e(t)}}function bu(e){this._bpmnUpdater=e}function wu(e,t,n,r){function i(e){return e.children.filter((function(e){return ki(e,"bpmn:DataStoreReference")&&!e.labelTarget}))}function o(e,r){var i=e.businessObject||e;if(r=r||n.filter((function(e){return ki(e,"bpmn:Participant")&&Oi(e).processRef}))[0]){var o=r.businessObject||r;t.execute("dataStore.updateContainment",{dataStoreBo:i,dataStoreDi:Pi(e),newSemanticParent:o.processRef||o,newDiParent:Pi(r)})}}Ho.call(this,r),t.registerHandler("dataStore.updateContainment",bu),this.preExecute("shape.create",(function(e){var t=e.context,n=t.shape;ki(n,"bpmn:DataStoreReference")&&"label"!==n.type&&(t.hints||(t.hints={}),t.hints.autoResize=!1)})),this.preExecute("elements.move",(function(e){var t=e.context,n=t.shapes;n.filter((function(e){return ki(e,"bpmn:DataStoreReference")})).length&&(t.hints||(t.hints={}),t.hints.autoResize=n.filter((function(e){return!ki(e,"bpmn:DataStoreReference")})))})),this.postExecute("shape.create",(function(e){var t=e.context.shape,n=t.parent;ki(t,"bpmn:DataStoreReference")&&"label"!==t.type&&ki(n,"bpmn:Collaboration")&&o(t)})),this.postExecute("shape.move",(function(e){var t=e.context,n=t.shape,r=t.oldParent,i=n.parent;if(!ki(r,"bpmn:Collaboration")&&ki(n,"bpmn:DataStoreReference")&&"label"!==n.type&&ki(i,"bpmn:Collaboration")){var s=ki(r,"bpmn:Participant")?r:function(e,t){for(;e.parent;){if(ki(e.parent,t))return e.parent;e=e.parent}}(r,"bpmn:Participant");o(n,s)}})),this.postExecute("shape.delete",(function(t){var n=t.context.shape,r=e.getRootElement();Ei(n,["bpmn:Participant","bpmn:SubProcess"])&&ki(r,"bpmn:Collaboration")&&i(r).filter((function(e){return function(e,t){var n=e.businessObject||e,r=t.businessObject||t;for(;n.$parent;){if(n.$parent===r.processRef||r)return!0;n=n.$parent}return!1}(e,n)})).forEach((function(e){o(e)}))})),this.postExecute("canvas.updateRoot",(function(e){var t=e.context,n=t.oldRoot,r=t.newRoot;i(n).forEach((function(e){ki(r,"bpmn:Process")&&o(e,r)}))}))}yu.$inject=["eventBus","bpmnFactory"],e(yu,Ho),bu.$inject=["bpmnUpdater"],bu.prototype.execute=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,r=e.newSemanticParent,i=e.newDiParent;return e.oldSemanticParent=t.$parent,e.oldDiParent=n.$parent,this._bpmnUpdater.updateSemanticParent(t,r),this._bpmnUpdater.updateDiParent(n,i),[]},bu.prototype.revert=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,r=e.oldSemanticParent,i=e.oldDiParent;return this._bpmnUpdater.updateSemanticParent(t,r),this._bpmnUpdater.updateDiParent(n,i),[]},wu.$inject=["canvas","commandStack","elementRegistry","eventBus"],e(wu,Ho);var xu=Math.max,_u=Math.min,ku=20;function Eu(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function Ou(e,t,n){var r=t[e],i=n.min&&n.min[e],o=n.max&&n.max[e];return u(i)&&(r=(/top|left/.test(e)?_u:xu)(r,i)),u(o)&&(r=(/top|left/.test(e)?xu:_u)(r,o)),r}function Pu(e,t){return void 0!==e?e:ku}function Su(e){return!e.waypoints&&"label"!==e.type}function Cu(e,t){var n;if((n=void 0===e.length?y(e.children,Su):e).length)return function(e,t){var n,r,i,o;return"object"==typeof t?(n=Pu(t.left),r=Pu(t.right),i=Pu(t.top),o=Pu(t.bottom)):n=r=i=o=Pu(t),{x:e.x-n,y:e.y-i,width:e.width+n+r,height:e.height+i+o}}(vt(n),t)}var Tu=Math.abs;var Mu=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Au=30;function Du(e,t){return t=t||[],e.children.filter((function(e){ki(e,"bpmn:Lane")&&(Du(e,t),t.push(e))})),t}function Nu(e){return e.children.filter((function(e){return ki(e,"bpmn:Lane")}))}function Ru(e){return mc(e,Mu)||e}function ju(e,t){var n=Ru(e),r=Du(n,ki(n,"bpmn:Process")?[]:[n]),i=yn(e),o=yn(t),s=function(e,t){return Eu(yn(t),yn(e))}(e,t),a=[],l=Hi(e);return r.forEach((function(t){if(t!==e){var n,r,c=l?0:s.top,p=l?s.right:0,u=l?0:s.bottom,d=l?s.left:0,h=yn(t);s.top&&(Tu(h.bottom-i.top)<10&&(u=o.top-h.bottom),Tu(h.top-i.top)<5&&(c=o.top-h.top)),s.left&&(Tu(h.right-i.left)<10&&(p=o.left-h.right),Tu(h.left-i.left)<5&&(d=o.left-h.left)),s.bottom&&(Tu(h.top-i.bottom)<10&&(c=o.bottom-h.top),Tu(h.bottom-i.bottom)<5&&(u=o.bottom-h.bottom)),s.right&&(Tu(h.left-i.right)<10&&(d=o.right-h.left),Tu(h.right-i.right)<5&&(p=o.right-h.right)),(c||p||u||d)&&a.push({shape:t,newBounds:(n=t,r={top:c,right:p,bottom:u,left:d},{x:n.x+(r.left||0),y:n.y+(r.top||0),width:n.width-(r.left||0)+(r.right||0),height:n.height-(r.top||0)+(r.bottom||0)})})}})),a}function Lu(e,t){Ho.call(this,e),this.postExecuted("shape.delete",500,(function(e){var n=e.context,r=n.hints,i=n.shape,o=n.oldParent;ki(i,"bpmn:Lane")&&(r&&r.nested||function(e,n){var r,i,o,s,a,l=Hi(e),c=Nu(n),p=[],u=[],d=[],h=[];gt(c,(function(t){return l?t.y>e.y?u.push(t):p.push(t):t.x>e.x?h.push(t):d.push(t),t.children})),c.length&&(r=l?u.length&&p.length?e.height/2:e.height:h.length&&d.length?e.width/2:e.width,p.length&&(i=t.calculateAdjustments(p,"y",r,e.y-10),t.makeSpace(i.movingShapes,i.resizingShapes,{x:0,y:r},"s")),u.length&&(o=t.calculateAdjustments(u,"y",-r,e.y+e.height+10),t.makeSpace(o.movingShapes,o.resizingShapes,{x:0,y:-r},"n")),d.length&&(s=t.calculateAdjustments(d,"x",r,e.x-10),t.makeSpace(s.movingShapes,s.resizingShapes,{x:r,y:0},"e")),h.length&&(a=t.calculateAdjustments(h,"x",-r,e.x+e.width+10),t.makeSpace(a.movingShapes,a.resizingShapes,{x:-r,y:0},"w")))}(i,o))}))}Lu.$inject=["eventBus","spaceTool"],e(Lu,Ho);function Iu(e,t){t.invoke(Ho,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",500,(function(e){var t=e.elements;t.filter((function(e){return zu(e,e.host)})).map((function(e){return t.indexOf(e)})).forEach((function(r){e.elements[r]=n._replaceShape(t[r])}))}),!0),this.preExecute("elements.move",500,(function(e){var t=e.shapes,r=e.newHost;t.forEach((function(e,i){var o,s=e.host;zu(e,(o=s,-1!==t.indexOf(o)?s:r))&&(t[i]=n._replaceShape(e))}))}),!0)}function zu(e,t){return!fn(e)&&ki(e,"bpmn:BoundaryEvent")&&!t}function Bu(e,t,n){function r(e,r,i){var o,s,a,l,c,p,d,h,f=r.waypoints,m=e.outgoing.slice(),g=e.incoming.slice(),v=qc(f,h=u(i.width)?wn(i):i);if(v){if(o=f.slice(0,v.index),s=f.slice(v.index+(v.bendpoint?1:0)),!o.length||!s.length)return;a=v.bendpoint?f[v.index]:h,1!==o.length&&$u(e,o[o.length-1])||o.push(qu(a)),1!==s.length&&$u(e,s[0])||s.unshift(qu(a))}l=r.source,c=r.target,t.canConnect(l,e,r)&&(n.reconnectEnd(r,e,o||h),p=r),t.canConnect(e,c,r)&&(p?d=n.connect(e,c,{type:r.type,waypoints:s}):(n.reconnectStart(r,e,s||h),d=r));var b=[].concat(p&&y(g,(function(e){return e.source===p.source}))||[],d&&y(m,(function(e){return e.target===d.target}))||[]);b.length&&n.removeElements(b)}Ho.call(this,e),this.preExecute("elements.move",(function(e){var n=e.newParent,r=e.shapes,i=e.delta,o=r[0];if(o&&n){n&&n.waypoints&&(e.newParent=n=n.parent);var s=wn(o),a={x:s.x+i.x,y:s.y+i.y},l=m(n.children,(function(e){return t.canInsert(r,e)&&qc(e.waypoints,a)}));l&&(e.targetFlow=l,e.position=a)}}),!0),this.postExecuted("elements.move",(function(e){var t=e.shapes,n=e.targetFlow,i=e.position;n&&r(t[0],n,i)}),!0),this.preExecute("shape.create",(function(e){var n=e.parent,r=e.shape;t.canInsert(r,n)&&(e.targetFlow=n,e.parent=n.parent)}),!0),this.postExecuted("shape.create",(function(e){var t=e.shape,n=e.targetFlow,i=e.position;n&&r(t,n,i)}),!0)}function $u(e,t){var n=t.x,r=t.y;return n>=e.x&&n<=e.x+e.width&&r>=e.y&&r<=e.y+e.height}function qu(e){return I({},e)}function Fu(e,t){Ho.call(this,e),this.preExecuted("connection.create",(function(e){var n=e.context,r=n.connection,i=n.source,o=n.target,s=n.hints;if((!s||!1!==s.createElementsBehavior)&&Vu(r)){(ki(i,"bpmn:EventBasedGateway")?o.incoming.filter((e=>e!==r&&Vu(e))):o.incoming.filter((e=>e!==r&&Vu(e)&&ki(e.source,"bpmn:EventBasedGateway")))).forEach((function(e){t.removeConnection(e)}))}})),this.preExecuted("shape.replace",(function(e){var n=e.context.newShape;ki(n,"bpmn:EventBasedGateway")&&n.outgoing.filter(Vu).reduce((function(e,t){return e.includes(t.target)?e:e.concat(t.target)}),[]).forEach((function(e){e.incoming.filter(Vu).forEach((function(r){const i=e.incoming.filter(Vu).filter((function(e){return e.source===n}));(r.source!==n||i.length>1)&&t.removeConnection(r)}))}))}))}function Vu(e){return ki(e,"bpmn:SequenceFlow")}Iu.$inject=["bpmnReplace","injector"],e(Iu,Ho),Iu.prototype._replaceShape=function(e){var t,n,r=(n=Oi(e).eventDefinitions)&&n[0];return t=r?{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:r.$type}:{type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,t,{layoutConnection:!1})},e(Bu,Ho),Bu.$inject=["eventBus","bpmnRules","modeling"],Fu.$inject=["eventBus","modeling"],e(Fu,Ho);var Hu=1500;function Uu(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"],Hu,(function(t){var r=t.context.shape||t.shape,i=t.hover;ki(i,"bpmn:Lane")&&!Ei(r,["bpmn:Lane","bpmn:Participant"])&&(t.hover=Ru(i),t.hoverGfx=e.getGraphics(t.hover));var o=n.getRootElement();i!==o&&(r.labelTarget||Ei(r,["bpmn:Group","bpmn:TextAnnotation"]))&&(t.hover=o,t.hoverGfx=e.getGraphics(t.hover))})),t.on(["connect.hover","connect.out","connect.end","connect.cleanup","global-connect.hover","global-connect.out","global-connect.end","global-connect.cleanup"],Hu,(function(t){var n=t.hover;ki(n,"bpmn:Lane")&&(t.hover=Ru(n)||n,t.hoverGfx=e.getGraphics(t.hover))})),t.on(["bendpoint.move.hover"],Hu,(function(t){var n=t.context,r=t.hover,i=n.type;ki(r,"bpmn:Lane")&&/reconnect/.test(i)&&(t.hover=Ru(r)||r,t.hoverGfx=e.getGraphics(t.hover))})),t.on(["connect.start"],Hu,(function(e){var t=e.context,n=t.start;ki(n,"bpmn:Lane")&&(t.start=Ru(n)||n)})),t.on("shape.move.start",2e3,(function(e){var t=e.shape;ki(t,"bpmn:Lane")&&(e.shape=Ru(t)||t)})),t.on("spaceTool.move",2e3,(function(e){var t=e.hover;t&&ki(t,"bpmn:Lane")&&(e.hover=Ru(t))}))}Uu.$inject=["elementRegistry","eventBus","canvas"];function Wu(e,t,n,r,i,o){function s(e,t,r){var i=n.filter((function(e){return ki(e,"bpmn:Group")})).filter((function(e){return e.businessObject!==r}));t&&!function(e,t){return e.some((function(e){var n=Oi(e);return(n.categoryValueRef&&n.categoryValueRef.$parent)===t}))}(i,t)&&function(e){var t=e.$parent;t&&(Et(t.get("rootElements"),e),e.$parent=null)}(t),e&&!function(e,t){return e.some((function(e){return Oi(e).categoryValueRef===t}))}(i,e)&&function(e){var t=e.$parent;t&&(Et(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,r){var i=Oi(n),o=i.categoryValueRef;o||(o=i.categoryValueRef=r.categoryValue=r.categoryValue||function(e){return e.create("bpmn:CategoryValue")}(e));var s=o.$parent;s||(s=o.$parent=r.category=r.category||function(e){return e.create("bpmn:Category")}(e)),a(o,s,t.getDefinitions())}function c(e,t){var n=t.category,r=t.categoryValue,i=Oi(e);r?(i.categoryValueRef=null,s(r,n,i)):s(null,i.categoryValueRef.$parent,i)}function p(t,n){var r=e.create(t.$type);return o.copyElement(t,r,null,n)}i.invoke(Ho,this),this.execute("label.create",(function(e){var t=e.context,n=t.labelTarget;ki(n,"bpmn:Group")&&l(n,t)})),this.revert("label.create",(function(e){var t=e.context,n=t.labelTarget;ki(n,"bpmn:Group")&&c(n,t)})),this.execute("shape.delete",(function(e){var t=e.context,n=t.shape,r=Oi(n);if(ki(n,"bpmn:Group")&&!n.labelTarget){var i=t.categoryValue=r.categoryValueRef;i&&(s(i,t.category=i.$parent,r),r.categoryValueRef=null)}})),this.reverted("shape.delete",(function(e){var t=e.context,n=t.shape;if(ki(n,"bpmn:Group")&&!n.labelTarget){var r=t.category,i=t.categoryValue,o=Oi(n);i&&(o.categoryValueRef=i,a(i,r))}})),this.execute("shape.create",(function(e){var t=e.context,n=t.shape;ki(n,"bpmn:Group")&&!n.labelTarget&&Oi(n).categoryValueRef&&l(n,t)})),this.reverted("shape.create",(function(e){var t=e.context,n=t.shape;ki(n,"bpmn:Group")&&!n.labelTarget&&Oi(n).categoryValueRef&&c(n,t)})),r.on("copyPaste.copyElement",770,(function(e){var t=e.descriptor,n=e.element;if(ki(n,"bpmn:Group")&&!n.labelTarget){var r=Oi(n);if(r.categoryValueRef){var i=r.categoryValueRef;t.categoryValue=p(i,!0),i.$parent&&(t.category=p(i.$parent,!0))}}})),r.on("copyPaste.pasteElement",770,(function(e){var t=e.descriptor,n=t.businessObject,r=t.categoryValue,i=t.category;r&&(r=n.categoryValueRef=p(r)),i&&(r.$parent=p(i)),delete t.category,delete t.categoryValue}))}function Gu(e,t,n,r){var i,o,s,a;return 0==(i=(r.y-n.y)*(t.x-e.x)-(r.x-n.x)*(t.y-e.y))?null:(o=e.y-n.y,s=e.x-n.x,a=((r.x-n.x)*o-(r.y-n.y)*s)/i,{x:Math.round(e.x+a*(t.x-e.x)),y:Math.round(e.y+a*(t.y-e.y))})}function Qu(e){function t(e,t,n){var r,i={x:n.x,y:n.y-50},o={x:n.x-50,y:n.y},s=Gu(e,t,n,i),a=Gu(e,t,n,o);r=s&&a?Zu(s,n)>Zu(a,n)?a:s:s||a,e.original=r}e.on("bpmnElement.added",(function(e){var n,r,i=e.element;i.waypoints&&(t((r=(n=i).waypoints)[0],r[1],wn(n.source)),t(r[r.length-1],r[r.length-2],wn(n.target)))}))}function Zu(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Xu(e){Ho.call(this,e);var t=["bpmn:Participant","bpmn:Lane"];this.executed(["shape.move","shape.create","shape.resize"],(function(e){var n=e.context.shape,r=Oi(n),i=Pi(n);if(Ei(r,t)){var o=i.get("isHorizontal");void 0===o&&(o=!0),i.set("isHorizontal",o)}}))}Wu.$inject=["bpmnFactory","bpmnjs","elementRegistry","eventBus","injector","moddleCopy"],e(Wu,Ho),Qu.$inject=["eventBus"],Xu.$inject=["eventBus"],e(Xu,Ho);var Yu=Math.sqrt,Ku=Math.min,Ju=Math.max,ed=Math.abs;function td(e){return Math.pow(e,2)}function nd(e,t){return Yu(td(e.x-t.x)+td(e.y-t.y))}function rd(e,t,n,r){var i=t.x-e.x,o=t.y-e.y,s=n.x-e.x,a=n.y-e.y,l=i*i+o*o,c=(i*s+o*a)/l,p=c*c-(s*s+a*a-r*r)/l;if(p<0&&p>-1e-6&&(p=0),p<0)return[];var u=Yu(p),d=-c+u,h=-c-u,f={x:e.x-i*d,y:e.y-o*d};return 0===p?[f]:[f,{x:e.x-i*h,y:e.y-o*h}].filter((function(n){return function(e,t,n){return id(e.x,t.x,n.x)&&id(e.y,t.y,n.y)}(n,e,t)}))}function id(e,t,n){return e>=Ku(t,n)-od&&e<=Ju(t,n)+od}var od=.1;function sd(e,t){return ed(e.x-t.x)<=od&&ed(e.y-t.y)<=od}function ad(e,t,n,r){var i=0,o=0,s={point:e,delta:{x:0,y:0}},a=function(e,t){var n,r,i,o,s,a,l,c,p,u,d,h,f=0;for(f=0;f<t.length-1;f++){if(sd(n=t[f],r=t[f+1])?a=[n]:(i=nd(e,n),o=nd(e,r),a=rd(n,r,e,Ku(i,o))),a.length<1)throw new Error("expected between [1, 2] circle -> line intersections");1===a.length&&(l={type:"bendpoint",position:a[0],segmentIndex:f,bendpointIndex:sd(n,a[0])?f:f+1}),2===a.length&&(d=a[0],h=a[1],l={type:"segment",position:s={x:(d.x+h.x)/2,y:(d.y+h.y)/2},segmentIndex:f,relativeLocation:nd(n,s)/nd(n,r)}),c=nd(l.position,e),(!u||p>c)&&(u=l,p=c)}return u}(e,n),l=a.segmentIndex,c=function(e,t,n,r){var i=n.segmentIndex,o=t.length-e.length;if(r.segmentMove){var s=r.segmentMove.segmentStartIndex,a=r.segmentMove.newSegmentStartIndex;return i===s?a:i>=a?i+o<a?a:i+o:i}if(r.bendpointMove){var l,c=r.bendpointMove.insert,p=r.bendpointMove.bendpointIndex;return 0===o?i:(i>=p&&(l=c?i+1:i-1),i<p&&(l=i,c&&"bendpoint"!==n.type&&p-1===i&&ld(t,p)<n.relativeLocation&&l++),l)}return 0===o?i:r.connectionStart&&0===i?0:r.connectionEnd&&i===e.length-2?t.length-2:Math.floor((t.length-2)/2)}(n,t,a,r);if(c<0||c>t.length-2||null===c)return s;var p,u,d=cd(n,l),h=cd(t,c),f=a.position,m=function(e,t){var n=Wc(e[0],e[1]),r=Wc(e[0],t);return 0===n?0:r/n}(d,f),g=(p=h,u=Vc(d),Vc(p)-u);if("bendpoint"===a.type){var y=t.length-n.length,v=a.bendpointIndex,b=n[v];if(-1!==t.indexOf(b))return s;if(0===y){var w=t[v];return{delta:{x:i=w.x-a.position.x,y:o=w.y-a.position.y},point:{x:e.x+i,y:e.y+o}}}y<0&&0!==v&&v<n.length-1&&(m=ld(n,v))}var x,_,k={x:(h[1].x-h[0].x)*m+h[0].x,y:(h[1].y-h[0].y)*m+h[0].y},E=(x={x:e.x-f.x,y:e.y-f.y},(_=g)?{x:Math.cos(_)*x.x-Math.sin(_)*x.y,y:Math.sin(_)*x.x+Math.cos(_)*x.y}:x);return i=k.x+E.x-e.x,o=k.y+E.y-e.y,{point:gn(k),delta:gn({x:i,y:o})}}function ld(e,t){var n=Wc(e[t-1],e[t]);return n/(n+Wc(e[t],e[t+1]))}function cd(e,t){return[e[t],e[t+1]]}function pd(e,t,n){var r=ra(t),i=ra(n),o=ia(e,r),s=o.x*(n.width/t.width),a=o.y*(n.height/t.height);return gn({x:i.x+s,y:i.y+a})}function ud(e,t,n){var r=ra(e),i=ra(t),o=ra(n),s=ia(e,r),a=ia(r,i),l=function(e,t,n){var r=yn(t),i=yn(n);if(function(e,t){return function(e,t){return e.right!==t.right&&e.left!==t.left}(e,t)||function(e,t){return e.top!==t.top&&e.bottom!==t.bottom}(e,t)}(r,i))return null;var o,s,a,l=xn(t,e);if("top"===l)o={x:0,y:i.bottom-r.bottom};else if("bottom"===l)o={x:0,y:i.top-r.top};else if("right"===l)o={x:i.left-r.left,y:0};else{if("left"!==l)return null;o={x:i.right-r.right,y:0}}if(s={x:e.x+o.x,y:e.y+o.y},a=xn(n,s),a!==l)return null;return o}(r,t,n);if(l)return l;var c=a.x*(n.width/t.width),p=a.y*(n.height/t.height),u=o.x+c,d=o.y+p;return gn({x:u+s.x-e.x,y:d+s.y-e.y})}var dd="name",hd="text";function fd(e,t,n,r){function i(e){var n=e.context,i=n.element,o=n.properties;if(dd in o&&t.updateLabel(i,o[dd]),hd in o&&ki(i,"bpmn:TextAnnotation")){var s=r.getTextAnnotationBounds({x:i.x,y:i.y,width:i.width,height:i.height},o[hd]||"");t.updateLabel(i,o.text,s)}}function o(e){var t=e.context,n=t.connection,r=n.label,i=I({},t.hints),o=t.newWaypoints||n.waypoints,s=t.oldWaypoints;return void 0===i.startChanged&&(i.startChanged=!!i.connectionStart),void 0===i.endChanged&&(i.endChanged=!!i.connectionEnd),function(e,t,n,r){return ad(wn(e),t,n,r).delta}(r,o,s,i)}Ho.call(this,e),this.postExecute("element.updateProperties",i),this.postExecute("element.updateModdleProperties",(e=>{Oi(e.context.element)===e.context.moddleElement&&i(e)})),this.postExecute(["shape.create","connection.create"],(function(e){var n=e.context;if(!1!==(n.hints||{}).createElementsBehavior){var r=n.shape||n.connection;!fn(r)&&Xi(r)&&to(r)&&t.updateLabel(r,to(r))}})),this.postExecute("shape.delete",(function(e){var n=e.context,r=n.labelTarget,i=n.hints||{};r&&!1!==i.unsetLabel&&t.updateLabel(r,null,null,{removeShape:!1})})),this.postExecute(["connection.layout","connection.updateWaypoints"],(function(e){var n=e.context;if(!1!==(n.hints||{}).labelBehavior){var r,i=n.connection.label;i&&i.parent&&(r=o(e),t.moveShape(i,r))}})),this.postExecute(["shape.replace"],(function(e){var t=e.context,n=t.newShape,r=t.oldShape,i=Oi(n);i&&Xi(i)&&r.label&&n.label&&(n.label.x=r.label.x,n.label.y=r.label.y)})),this.postExecute("shape.resize",(function(e){var n,r=e.context,i=r.shape,o=r.newBounds,s=r.oldBounds;if(Yi(i)){var a=i.label,l=function(e,t){if(!t.length)return;var n=function(e,t){var n=t.map((function(t){return{line:t,distance:Uc(e,t)}}));return T(n,"distance")[0].line}(e,t);return Hc(e,n)}(wn(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=md(l,s,o);t.moveShape(a,c)}}))}function md(e,t,n){return gn(ia(pd(e,t,n),e))}function gd(e,t){function n(e,t){var n=e.context,r=n.connection,i=I({},n.hints),o=n.newWaypoints||r.waypoints,s=n.oldWaypoints;return void 0===i.startChanged&&(i.startChanged=!!i.connectionStart),void 0===i.endChanged&&(i.endChanged=!!i.connectionEnd),function(e,t,n,r){return ad(e,t,n,r).point}(t,o,s,i)}Ho.call(this,e),this.postExecute(["connection.layout","connection.updateWaypoints"],(function(e){var r=e.context.connection,i=r.outgoing;r.incoming.forEach((function(r){var i=r.waypoints[r.waypoints.length-1],o=n(e,i),s=[].concat(r.waypoints.slice(0,-1),[o]);t.updateWaypoints(r,s)})),i.forEach((function(r){var i=r.waypoints[0],o=n(e,i),s=[].concat([o],r.waypoints.slice(1));t.updateWaypoints(r,s)}))})),this.postExecute(["connection.move"],(function(e){var n=e.context,r=n.connection,i=r.outgoing,o=r.incoming,s=n.delta;o.forEach((function(e){var n=e.waypoints[e.waypoints.length-1],r={x:n.x+s.x,y:n.y+s.y},i=[].concat(e.waypoints.slice(0,-1),[r]);t.updateWaypoints(e,i)})),i.forEach((function(e){var n=e.waypoints[0],r={x:n.x+s.x,y:n.y+s.y},i=[].concat([r],e.waypoints.slice(1));t.updateWaypoints(e,i)}))}))}function yd(e,t,n){var r=_d(e),i=kd(r,t),o=r[0];return i.length?i[i.length-1]:pd(o.original||o,n,t)}function vd(e,t,n){var r=_d(e),i=kd(r,t),o=r[r.length-1];return i.length?i[0]:pd(o.original||o,n,t)}function bd(e,t,n){var r=_d(e),i=xd(t,n),o=r[0];return pd(o.original||o,i,t)}function wd(e,t,n){var r=_d(e),i=xd(t,n),o=r[r.length-1];return pd(o.original||o,i,t)}function xd(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function _d(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function kd(e,t){return y(k(e,Ed),(function(e){return function(e,t){return"intersect"===xn(t,e,1)}(e,t)}))}function Ed(e){return e.original||e}function Od(e,t){Ho.call(this,e),this.postExecute("shape.replace",(function(e){var n=e.oldShape,r=e.newShape;if(function(e,t){return ki(e,"bpmn:Participant")&&Vi(e)&&ki(t,"bpmn:Participant")&&!Vi(t)}(n,r)){var i,o,s,a,l=(o=yt([i=n],!1),s=[],a=[],o.forEach((function(e){e!==i&&(e.incoming.forEach((function(e){ki(e,"bpmn:MessageFlow")&&s.push(e)})),e.outgoing.forEach((function(e){ki(e,"bpmn:MessageFlow")&&a.push(e)})))}),[]),{incoming:s,outgoing:a});l.incoming.forEach((function(e){var i=vd(e,r,n);t.reconnectEnd(e,r,i)})),l.outgoing.forEach((function(e){var i=yd(e,r,n);t.reconnectStart(e,r,i)}))}}),!0)}e(fd,Ho),fd.$inject=["eventBus","modeling","bpmnFactory","textRenderer"],e(gd,Ho),gd.$inject=["eventBus","modeling"],Od.$inject=["eventBus","modeling"],e(Od,Ho);const Pd=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function Sd(e){const t=Oi(e);if(!(ki(t,"bpmn:BoundaryEvent")||ki(t,"bpmn:StartEvent")&&Wi(t.$parent)))return!1;const n=t.get("eventDefinitions");return!(!n||!n.length)&&Pd.some((e=>ki(n[0],e)))}function Cd(e){return ki(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function Td(e,t){e.invoke(Ho,this),this.postExecuted("shape.replace",(function(e){const n=e.context.oldShape,r=e.context.newShape,i=e.context.hints;if(!Sd(r))return;const o=Cd(r);if(i.targetElement&&void 0!==i.targetElement[o])return;const s=Oi(n).get(o);s!==Oi(r).get(o)&&t.updateProperties(r,{[o]:s})}))}function Md(e,t){Ho.call(this,e),this.preExecute("shape.resize",(function(e){var n=e.shape,r=Pi(n),i=r&&r.get("label");i&&i.get("bounds")&&t.updateModdleProperties(n,i,{bounds:void 0})}),!0)}function Ad(e,t,n){Ho.call(this,e),this.preExecute("shape.delete",(function(e){var r=e.context.shape;if(1===r.incoming.length&&1===r.outgoing.length){var i=r.incoming[0],o=r.outgoing[0];if(ki(i,"bpmn:SequenceFlow")&&ki(o,"bpmn:SequenceFlow")&&t.canConnect(i.source,o.target,i)){var s=function(e,t){var n=Gu(Dd(e[e.length-2]),Dd(e[e.length-1]),Dd(t[1]),Dd(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[Dd(e[0]),Dd(t[t.length-1])]}(i.waypoints,o.waypoints);n.reconnectEnd(i,o.target,s)}}}))}function Dd(e){return e.original||e}function Nd(e,t){Ho.call(this,e),this.preExecute("shape.delete",(function(e){var t=e.shape,n=t.parent;ki(t,"bpmn:Participant")&&(e.collaborationRoot=n)}),!0),this.postExecute("shape.delete",(function(e){var n=e.collaborationRoot;if(n&&!n.businessObject.participants.length){var r=t.makeProcess(),i=n.children.slice();t.moveElements(i,{x:0,y:0},r)}}),!0)}function Rd(e,t,n,r){Ho.call(this,e);var i=r.get("dragging",!1);function o(e){var r,i,o=e.source,s=e.target;e.parent&&(ki(e,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(o,s)||(i=!0),n.canConnectMessageFlow(o,s)&&(r="bpmn:MessageFlow")),ki(e,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(o,s)||(i=!0),n.canConnectSequenceFlow(o,s)&&(r="bpmn:SequenceFlow")),i&&t.removeConnection(e),r&&t.connect(o,s,{type:r,waypoints:e.waypoints.slice()}))}this.postExecuted("elements.move",(function(e){v(e.closure.allConnections,o)}),!0),this.preExecute("connection.reconnect",(function(e){var r,o,s=e.context,a=s.connection,l=s.newSource||a.source,c=s.newTarget||a.target;(r=n.canConnect(l,c))&&r.type!==a.type&&(o=t.connect(l,c,{type:r.type,associationDirection:r.associationDirection,waypoints:a.waypoints.slice()}),a.parent&&t.removeConnection(a),s.connection=o,i&&function(e,t){var n,r=i.context(),o=r&&r.payload.previousSelection;if(!o||!o.length)return;if(n=o.indexOf(e),-1===n)return;o.splice(n,1,t)}(a,o))})),this.postExecuted("element.updateProperties",(function(e){var n,r=e.context,i=r.properties,o=r.element,s=o.businessObject;i.default&&(n=m(o.outgoing,M({id:o.businessObject.default.id})))&&t.updateProperties(n,{conditionExpression:void 0}),i.conditionExpression&&s.sourceRef.default===s&&t.updateProperties(o.source,{default:void 0})}))}function jd(e,t,n,r,i,o){r.invoke(Ho,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=o,this.postExecuted(["elements.create"],500,(function(e){var n=e.context,r=n.parent,i=n.elements,o=w(i,(function(e,n){var i=t.canReplace([n],n.host||n.parent||r);return i?e.concat(i.replacements):e}),[]);o.length&&this._replaceElements(i,o)}),this),this.postExecuted(["elements.move"],500,(function(e){var n=e.context,r=n.newParent,i=n.newHost,o=[];v(n.closure.topLevel,(function(e){o=Wi(e)?o.concat(e.children):o.concat(e)})),1===o.length&&i&&(r=i);var s=t.canReplace(o,r);s&&this._replaceElements(o,s.replacements,i)}),this),this.postExecute(["shape.replace"],1500,(function(e){var n,r=e.context,i=r.oldShape,o=r.newShape,s=i.attachers;s&&s.length&&(n=t.canReplace(s,o),this._replaceElements(s,n.replacements))}),this),this.postExecuted(["shape.replace"],1500,(function(e){var t=e.context,n=t.oldShape,r=t.newShape;i.unclaimId(n.businessObject.id,n.businessObject),i.updateProperties(r,{id:n.id})}))}Td.$inject=["injector","modeling"],e(Td,Ho),e(Md,Ho),Md.$inject=["eventBus","modeling"],e(Ad,Ho),Ad.$inject=["eventBus","bpmnRules","modeling"],Nd.$inject=["eventBus","modeling"],e(Nd,Ho),e(Rd,Ho),Rd.$inject=["eventBus","modeling","bpmnRules","injector"],e(jd,Ho),jd.prototype._replaceElements=function(e,t){var n=this._elementRegistry,r=this._bpmnReplace,i=this._selection;v(t,(function(t){var i={type:t.newElementType},o=n.get(t.oldElementId),s=e.indexOf(o);e[s]=r.replaceElement(o,i,{select:!1})})),t&&i.select(e)},jd.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var Ld={width:140,height:120},Id={width:300,height:60},zd={width:60,height:300},Bd={width:300,height:150},$d={width:150,height:300},qd={width:140,height:120},Fd={width:50,height:30};function Vd(e){e.on("resize.start",1500,(function(e){var t=e.context,n=t.shape,r=t.direction,i=t.balanced;(ki(n,"bpmn:Lane")||ki(n,"bpmn:Participant"))&&(t.resizeConstraints=function(e,t,n){var r=Ru(e),i=!0,o=!0,s=Du(r,[r]),a=yn(e),l={},c={},p=Hi(e),u=p?Id:zd;/n/.test(t)?c.top=a.bottom-u.height:/e/.test(t)?c.right=a.left+u.width:/s/.test(t)?c.bottom=a.top+u.height:/w/.test(t)&&(c.left=a.right-u.width);s.forEach((function(e){var r=yn(e);p?(r.top<a.top-10&&(i=!1),r.bottom>a.bottom+10&&(o=!1)):(r.left<a.left-10&&(i=!1),r.right>a.right+10&&(o=!1)),/n/.test(t)&&(n&&Hd(a.top-r.bottom)<10&&Zd(l,"top",r.top+u.height),Hd(a.top-r.top)<5&&Qd(c,"top",r.bottom-u.height)),/e/.test(t)&&(n&&Hd(a.right-r.left)<10&&Qd(l,"right",r.right-u.width),Hd(a.right-r.right)<5&&Zd(c,"right",r.left+u.width)),/s/.test(t)&&(n&&Hd(a.bottom-r.top)<10&&Qd(l,"bottom",r.bottom-u.height),Hd(a.bottom-r.bottom)<5&&Zd(c,"bottom",r.top+u.height)),/w/.test(t)&&(n&&Hd(a.left-r.right)<10&&Zd(l,"left",r.left+u.width),Hd(a.left-r.left)<5&&Qd(c,"left",r.right-u.width))}));var d=r.children.filter((function(e){return!e.hidden&&!e.waypoints&&(ki(e,"bpmn:FlowElement")||ki(e,"bpmn:Artifact"))})),h=p?Xd:Yd;return d.forEach((function(e){var n=yn(e);!/n/.test(t)||p&&!i||Qd(c,"top",n.top-h.top),/e/.test(t)&&(p||o)&&Zd(c,"right",n.right+h.right),!/s/.test(t)||p&&!o||Zd(c,"bottom",n.bottom+h.bottom),/w/.test(t)&&(p||i)&&Qd(c,"left",n.left-h.left)})),{min:c,max:l}}(n,r,i)),ki(n,"bpmn:SubProcess")&&Vi(n)&&(t.minDimensions=qd),ki(n,"bpmn:TextAnnotation")&&(t.minDimensions=Fd)}))}Vd.$inject=["eventBus"];var Hd=Math.abs,Ud=Math.min,Wd=Math.max;function Gd(e,t,n,r){var i=e[t];e[t]=void 0===i?n:r(n,i)}function Qd(e,t,n){return Gd(e,t,n,Ud)}function Zd(e,t,n){return Gd(e,t,n,Wd)}var Xd={top:20,left:50,right:20,bottom:20},Yd={top:50,left:20,right:20,bottom:20};function Kd(e,t){e.on("resize.start",1501,(function(e){var t=e.context,n=t.shape;(ki(n,"bpmn:Lane")||ki(n,"bpmn:Participant"))&&(t.balanced=!ws(e))})),e.on("resize.end",1001,(function(e){var n=e.context,r=n.shape,i=n.canExecute,o=n.newBounds;if(ki(r,"bpmn:Lane")||ki(r,"bpmn:Participant"))return i&&(o=mn(o),t.resizeLane(r,o,n.balanced)),!1}))}Kd.$inject=["eventBus","modeling"];function Jd(e,t,n,r,i){function o(e){return Ei(e,["bpmn:ReceiveTask","bpmn:SendTask"])||function(e,t){c(t)||(t=[t]);return _(t,(function(t){return Gi(e,t)}))}(e,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function s(t){return!!m(e.getDefinitions().get("rootElements"),M({id:t.id}))}function a(e){return ki(e,"bpmn:ErrorEventDefinition")?"errorRef":ki(e,"bpmn:EscalationEventDefinition")?"escalationRef":ki(e,"bpmn:MessageEventDefinition")?"messageRef":ki(e,"bpmn:SignalEventDefinition")?"signalRef":void 0}function l(e){if(Ei(e,["bpmn:ReceiveTask","bpmn:SendTask"]))return e.get("messageRef");var t=e.get("eventDefinitions")[0];return t.get(a(t))}n.invoke(Ho,this),this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],(function(t){var n=t.shape||t.element;if(o(n)){var r=l(Oi(n));r&&!s(r)&&(Ot(e.getDefinitions().get("rootElements"),r),t.addedRootElement=r)}}),!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],(function(t){var n=t.addedRootElement;n&&Et(e.getDefinitions().get("rootElements"),n)}),!0),t.on("copyPaste.copyElement",(function(e){var t=e.descriptor,n=e.element;if(!n.labelTarget&&o(n)){var r=l(Oi(n));r&&(t.referencedRootElement=r)}})),t.on("copyPaste.pasteElement",500,(function(e){var t=e.descriptor,n=t.businessObject,o=t.referencedRootElement;o&&(s(o)||(o=r.copyElement(o,i.create(o.$type))),function(e,t){if(Ei(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)}))}Jd.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],e(Jd,Ho);var eh=Math.max;function th(e){e.on("spaceTool.getMinDimensions",(function(e){var t=e.shapes,n=e.axis,r=e.start,i={};return v(t,(function(e){var t=e.id;ki(e,"bpmn:Participant")&&(i[t]=function(e,t,n){var r=Hi(e);if(i=e,!Nu(i).length)return r?Bd:$d;var i;var o=function(e){return"x"===e}(t),s={};s=o?r?Bd:{width:rh(e,n,o),height:$d.height}:r?{width:Bd.width,height:nh(e,n,o)}:$d;return s}(e,n,r)),ki(e,"bpmn:Lane")&&(i[t]=Hi(e)?Id:zd),ki(e,"bpmn:SubProcess")&&Vi(e)&&(i[t]=qd),ki(e,"bpmn:TextAnnotation")&&(i[t]=Fd),ki(e,"bpmn:Group")&&(i[t]=Ld)})),i}))}function nh(e,t,n){var r;return r=function(e,t,n){var r,i=Nu(e);return r=ih(i,t,n),e.height-r.height+Id.height}(e,t,n),eh(Bd.height,r)}function rh(e,t,n){var r;return r=function(e,t,n){var r,i=Nu(e);return r=ih(i,t,n),e.width-r.width+zd.width}(e,t,n),eh($d.width,r)}function ih(e,t,n){var r,i,o;for(r=0;r<e.length;r++)if(i=e[r],!n&&t>=i.y&&t<=i.y+i.height||n&&t>=i.x&&t<=i.x+i.width)return(o=Nu(i)).length?ih(o,t,n):i}th.$inject=["eventBus"];var oh=180,sh=160;function ah(e,t,n,r,i,o,s){Ho.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=r,this._bpmnFactory=i,this._bpmnjs=o,this._elementRegistry=s;var a=this;function l(e){return ki(e,"bpmn:SubProcess")&&!Vi(e)}function c(t){var n=t.shape,r=t.newRootElement,i=Oi(n);r=a._addDiagram(r||i),t.newRootElement=e.addRootElement(r)}function p(t){var n=Oi(t.shape);a._removeDiagram(n);var r=t.newRootElement=s.get(Jo(n));e.removeRootElement(r)}this.executed("shape.create",(function(e){l(e.shape)&&c(e)}),!0),this.postExecuted("shape.create",(function(e){var t=e.shape,n=e.newRootElement;n&&t.children&&(a._showRecursively(t.children),a._moveChildrenToShape(t,n))}),!0),this.reverted("shape.create",(function(e){l(e.shape)&&p(e)}),!0),this.preExecuted("shape.delete",(function(e){var t=e.shape;if(l(t)){var r=s.get(Jo(t));r&&n.removeElements(r.children.slice())}}),!0),this.executed("shape.delete",(function(e){l(e.shape)&&p(e)}),!0),this.reverted("shape.delete",(function(e){l(e.shape)&&c(e)}),!0),this.preExecuted("shape.replace",(function(t){var n=t.oldShape,r=t.newShape;l(n)&&l(r)&&(t.oldRoot=e.removeRootElement(Jo(n)))}),!0),this.postExecuted("shape.replace",(function(t){var r=t.newShape,i=t.oldRoot,o=e.findRoot(Jo(r));if(i&&o){var s=i.children;n.moveElements(s,{x:0,y:0},o)}}),!0),this.executed("element.updateProperties",(function(e){var t=e.element;if(ki(t,"bpmn:SubProcess")){var n=e.properties,r=e.oldProperties.id,i=n.id;if(r!==i){if(ts(t))return s.updateId(t,es(i)),void s.updateId(r,i);s.get(es(r))&&s.updateId(es(r),es(i))}}}),!0),this.reverted("element.updateProperties",(function(e){var t=e.element;if(ki(t,"bpmn:SubProcess")){var n=e.properties,r=e.oldProperties.id,i=n.id;if(r!==i){if(ts(t))return s.updateId(t,es(r)),void s.updateId(i,r);var o=s.get(es(i));o&&s.updateId(o,es(r))}}}),!0),t.on("element.changed",(function(e){var n=e.element;if(ts(n)){var r=n,i=s.get(Ko(r));i&&i!==r&&t.fire("element.changed",{element:i})}})),this.executed("shape.toggleCollapse",400,(function(e){var t=e.shape;ki(t,"bpmn:SubProcess")&&(Vi(t)?p(e):(c(e),a._showRecursively(t.children)))}),!0),this.reverted("shape.toggleCollapse",400,(function(e){var t=e.shape;ki(t,"bpmn:SubProcess")&&(Vi(t)?p(e):(c(e),a._showRecursively(t.children)))}),!0),this.postExecuted("shape.toggleCollapse",600,(function(e){var t=e.shape;if(ki(t,"bpmn:SubProcess")){var n=e.newRootElement;n&&(Vi(t)?a._moveChildrenToShape(n,t):a._moveChildrenToShape(t,n))}}),!0),t.on("copyPaste.createTree",(function(e){var t=e.element,n=e.children;if(l(t)){var r=Jo(t),i=s.get(r);i&&n.push.apply(n,i.children)}})),t.on("copyPaste.copyElement",(function(e){var t=e.descriptor,n=e.element,r=e.elements,i=n.parent;if(ki(Pi(i),"bpmndi:BPMNPlane")){var o=Ko(i),s=m(r,(function(e){return e.id===o}));s&&(t.parent=s.id)}})),t.on("copyPaste.pasteElement",(function(e){var t=e.descriptor;t.parent&&(l(t.parent)||t.parent.hidden)&&(t.hidden=!0)}))}function lh(e,t){e.invoke(Ho,this),this.postExecuted("shape.replace",(function(e){var n=e.context.oldShape,r=e.context.newShape;if(ki(r,"bpmn:SubProcess")&&(ki(n,"bpmn:Task")||ki(n,"bpmn:CallActivity"))&&Vi(r)){var i,o={x:(i=r).x+i.width/6,y:i.y+i.height/2};t.createShape({type:"bpmn:StartEvent"},o,r)}}))}function ch(e){Ho.call(this,e),this.preExecute("connection.create",(function(e){const{target:t}=e;ki(t,"bpmn:TextAnnotation")&&(e.parent=t.parent)}),!0),this.preExecute(["shape.create","shape.resize","elements.move"],(function(e){const t=e.shapes||[e.shape];1===t.length&&ki(t[0],"bpmn:TextAnnotation")&&(e.hints=e.hints||{},e.hints.autoResize=!1)}),!0)}function ph(e,t){Ho.call(this,e),this.postExecuted("shape.toggleCollapse",1500,(function(e){var n=e.shape;if(!Vi(n)){var r=yt(n);r.forEach((function(e){var t=e.incoming.slice(),n=e.outgoing.slice();v(t,(function(e){i(e,!0)})),v(n,(function(e){i(e,!1)}))}))}function i(e,i){-1!==r.indexOf(e.source)&&-1!==r.indexOf(e.target)||(i?t.reconnectEnd(e,n,wn(n)):t.reconnectStart(e,n,wn(n)))}}),!0)}e(ah,Ho),ah.prototype._moveChildrenToShape=function(e,t){var n,r=this._modeling,i=e.children;if(i){var o=(i=i.concat(i.reduce((function(t,n){return n.label&&n.label.parent!==e?t.concat(n.label):t}),[]))).filter((function(e){return!e.hidden}));if(o.length){var s=vt(o);if(t.x){var a=wn(t),l=wn(s);n={x:a.x-l.x,y:a.y-l.y}}else n={x:oh-s.x,y:sh-s.y};r.moveElements(i,n,t,{autoResize:!1})}else r.moveElements(i,{x:0,y:0},t,{autoResize:!1})}},ah.prototype._showRecursively=function(e,t){var n=this,r=[];return e.forEach((function(e){e.hidden=!!t,r=r.concat(e),e.children&&(r=r.concat(n._showRecursively(e.children,e.collapsed||t)))})),r},ah.prototype._addDiagram=function(e){var t=this._bpmnjs.getDefinitions().diagrams;return e.businessObject||(e=this._createNewDiagram(e)),t.push(e.di.$parent),e},ah.prototype._createNewDiagram=function(e){var t=this._bpmnFactory,n=this._elementFactory,r=t.create("bpmndi:BPMNPlane",{bpmnElement:e}),i=t.create("bpmndi:BPMNDiagram",{plane:r});return r.$parent=i,n.createRoot({id:Jo(e),type:e.$type,di:r,businessObject:e,collapsed:!0})},ah.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},ah.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"],lh.$inject=["injector","modeling"],e(lh,Ho),e(ch,Ho),ch.$inject=["eventBus"],e(ph,Ho),ph.$inject=["eventBus","modeling"];function uh(e,t,n){Ho.call(this,e),this.executed(["shape.toggleCollapse"],500,(function(e){var t,n=e.context.shape;ki(n,"bpmn:SubProcess")&&(n.collapsed?Pi(n).isExpanded=!1:((t=n.children).length&&t.forEach((function(e){"label"!==e.type||e.businessObject.name||(e.hidden=!0)})),Pi(n).isExpanded=!0))})),this.reverted(["shape.toggleCollapse"],500,(function(e){var t=e.context.shape;t.collapsed?Pi(t).isExpanded=!1:Pi(t).isExpanded=!0})),this.postExecuted(["shape.toggleCollapse"],500,(function(e){var r,i=e.context.shape,o=t.getDefaultSize(i);r=i.collapsed?function(e,t){return{x:e.x+(e.width-t.width)/2,y:e.y+(e.height-t.height)/2,width:t.width,height:t.height}}(i,o):function(e,t){var n,r,i,o=e.children,s=t;return n=(i=o,i.filter((function(e){return!e.hidden}))).concat([e]),(r=Cu(n))?(s.width=Math.max(r.width,s.width),s.height=Math.max(r.height,s.height),s.x=r.x+(r.width-s.width)/2,s.y=r.y+(r.height-s.height)/2):(s.x=e.x+(e.width-s.width)/2,s.y=e.y+(e.height-s.height)/2),s}(i,o),n.resizeShape(i,r,null,{autoResize:!i.collapsed&&"nwse"})}))}function dh(e,t,n,r){t.invoke(Ho,this),this.preExecute("shape.delete",(function(e){var t=e.context.shape,i=t.businessObject;fn(t)||(ki(t,"bpmn:Participant")&&Vi(t)&&n.ids.unclaim(i.processRef.id),r.unclaimId(i.id,i))})),this.preExecute("connection.delete",(function(e){var t=e.context.connection.businessObject;r.unclaimId(t.id,t)})),this.preExecute("canvas.updateRoot",(function(){var t=e.getRootElement(),r=t.businessObject;ki(t,"bpmn:Collaboration")&&n.ids.unclaim(r.id)}))}function hh(e,t){Ho.call(this,e),this.preExecute("connection.delete",(function(e){var n=e.context.connection,r=n.source;(function(e,t){if(!ki(e,"bpmn:SequenceFlow"))return!1;var n=Oi(t),r=Oi(e);return n.get("default")===r})(n,r)&&t.updateProperties(r,{default:null})}))}e(uh,Ho),uh.$inject=["eventBus","elementFactory","modeling"],e(dh,Ho),dh.$inject=["canvas","injector","moddle","modeling"],e(hh,Ho),hh.$inject=["eventBus","modeling"];function fh(e,t){var n;function r(){if(!n)throw new Error("out of bounds release");return n}Ho.call(this,e);var i=["spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move","shape.create","shape.delete","shape.move","shape.resize"];this.preExecute(i,5e3,(function(e){(n=n||new mh).enter()})),this.postExecuted(i,500,(function(e){!function(){if(!n)throw new Error("out of bounds release");var e=n.leave();e&&(t.updateLaneRefs(n.flowNodes,n.lanes),n=null)}()})),this.preExecute(["shape.create","shape.move","shape.delete","shape.resize"],(function(e){var t=e.context.shape,n=r();t.labelTarget||(ki(t,"bpmn:Lane")&&n.addLane(t),ki(t,"bpmn:FlowNode")&&n.addFlowNode(t))}))}function mh(){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 gh(e,t){Ho.call(this,e),this.postExecuted("elements.create",(function(e){const n=e.context.elements;for(const e of n)yh(e)&&!vh(e)&&t.updateProperties(e,{isForCompensation:void 0})}))}function yh(e){const t=Oi(e);return t&&t.isForCompensation}function vh(e){return e.incoming.filter((e=>function(e){return e&&ki(e,"bpmn:BoundaryEvent")&&Gi(e,"bpmn:CompensateEventDefinition")}(e.source))).length>0}fh.$inject=["eventBus","modeling"],e(fh,Ho),e(gh,Ho),gh.$inject=["eventBus","modeling"];var bh={__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",Kp],appendBehavior:["type",eu],associationBehavior:["type",tu],attachEventBehavior:["type",nu],boundaryEventBehavior:["type",iu],compensateBoundaryEventBehaviour:["type",ou],createBehavior:["type",cu],createDataObjectBehavior:["type",pu],createParticipantBehavior:["type",mu],dataInputAssociationBehavior:["type",yu],dataStoreBehavior:["type",wu],deleteLaneBehavior:["type",Lu],detachEventBehavior:["type",Iu],dropOnFlowBehavior:["type",Bu],eventBasedGatewayBehavior:["type",Fu],fixHoverBehavior:["type",Uu],groupBehavior:["type",Wu],importDockingFix:["type",Qu],isHorizontalFix:["type",Xu],labelBehavior:["type",fd],layoutConnectionBehavior:["type",gd],messageFlowBehavior:["type",Od],nonInterruptingBehavior:["type",Td],removeElementBehavior:["type",Ad],removeEmbeddedLabelBoundsBehavior:["type",Md],removeParticipantBehavior:["type",Nd],replaceConnectionBehavior:["type",Rd],replaceElementBehaviour:["type",jd],resizeBehavior:["type",Vd],resizeLaneBehavior:["type",Kd],rootElementReferenceBehavior:["type",Jd],spaceToolBehavior:["type",th],subProcessPlaneBehavior:["type",ah],subProcessStartEventBehavior:["type",lh],textAnnotationBehavior:["type",ch],toggleCollapseConnectionBehaviour:["type",ph],toggleElementCollapseBehaviour:["type",uh],unclaimIdBehavior:["type",dh],unsetDefaultFlowBehavior:["type",hh],updateFlowNodeRefsBehavior:["type",fh],setCompensationActivityAfterPasteBehavior:["type",gh]};function wh(e,t){var n=xn(e,t,-15);return"intersect"!==n?n:null}function xh(e){tc.call(this,e)}function _h(e){return!e||fn(e)}function kh(e){do{if(ki(e,"bpmn:Process"))return Oi(e);if(ki(e,"bpmn:Participant"))return Oi(e).processRef||Oi(e)}while(e=e.parent)}function Eh(e){return ki(e,"bpmn:TextAnnotation")}function Oh(e){return ki(e,"bpmn:Group")&&!e.labelTarget}function Ph(e){return ki(e,"bpmn:BoundaryEvent")&&Mh(e,"bpmn:CompensateEventDefinition")}function Sh(e){return Oi(e).isForCompensation}function Ch(e){for(var t=e;t=t.parent;){if(ki(t,"bpmn:FlowElementsContainer"))return Oi(t);if(ki(t,"bpmn:Participant"))return Oi(t).processRef}return null}function Th(e,t){return Ch(e)===Ch(t)}function Mh(e,t){return!!m(Oi(e).eventDefinitions||[],(function(e){return ki(e,t)}))}function Ah(e,t){return(Oi(e).eventDefinitions||[]).every((function(e){return ki(e,t)}))}function Dh(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 Nh(e,t,n){if(_h(e)||_h(t))return null;if(!ki(n,"bpmn:DataAssociation")){if(Gh(e,t))return{type:"bpmn:MessageFlow"};if(Qh(e,t))return{type:"bpmn:SequenceFlow"}}var r=Zh(e,t);return r||(Wh(e,t)?{type:"bpmn:Association",associationDirection:"One"}:!!Uh(e,t)&&{type:"bpmn:Association",associationDirection:"None"})}function Rh(e,t){return!(!fn(e)&&!Oh(e))||!(ki(t,"bpmn:Participant")&&!Vi(t))&&(ki(e,"bpmn:Participant")?ki(t,"bpmn:Process")||ki(t,"bpmn:Collaboration"):Ei(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:ki(e,"bpmn:Lane")?ki(t,"bpmn:Participant")||ki(t,"bpmn:Lane"):!(ki(e,"bpmn:BoundaryEvent")&&!function(e){return Oi(e).cancelActivity&&(Ih(e)||zh(e))}(e))&&(ki(e,"bpmn:FlowElement")&&!ki(e,"bpmn:DataStoreReference")?ki(t,"bpmn:FlowElementsContainer")?Vi(t):Ei(t,["bpmn:Participant","bpmn:Lane"]):ki(e,"bpmn:DataStoreReference")&&ki(t,"bpmn:Collaboration")?_(Oi(t).get("participants"),(function(e){return!!e.get("processRef")})):Ei(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?Ei(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):!!ki(e,"bpmn:MessageFlow")&&(ki(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t)))}function jh(e){return ki(e,"bpmn:Lane")}function Lh(e){return!!function(e){return!fn(e)&&ki(e,"bpmn:BoundaryEvent")}(e)||(!(!ki(e,"bpmn:IntermediateThrowEvent")||!Ih(e))||ki(e,"bpmn:IntermediateCatchEvent")&&zh(e))}function Ih(e){var t=Oi(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function zh(e){return Bh(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function Bh(e,t){return t.some((function(t){return Mh(e,t)}))}function $h(e,t,n,r){if(Array.isArray(e)||(e=[e]),1!==e.length)return!1;var i=e[0];return!fn(i)&&(!!Lh(i)&&(!Wi(t)&&(!(!ki(t,"bpmn:Activity")||Sh(t))&&(!(r&&!wh(r,t))&&(!function(e){return ki(e,"bpmn:ReceiveTask")&&m(e.incoming,(function(e){return ki(e.source,"bpmn:EventBasedGateway")}))}(t)&&"attach")))))}function qh(e,t,n){if(!t)return!1;var r={replacements:[]};return v(e,(function(e){Wi(t)||ki(e,"bpmn:StartEvent")&&"label"!==e.type&&Rh(e,t)&&(Ui(e)||r.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"}),(function(e){return Gi(e,"bpmn:ErrorEventDefinition")}(e)||function(e){return Gi(e,"bpmn:EscalationEventDefinition")}(e)||function(e){return Gi(e,"bpmn:CompensateEventDefinition")}(e))&&r.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"}),Bh(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&ki(t,"bpmn:SubProcess")&&r.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"})),ki(t,"bpmn:Transaction")||Mh(e,"bpmn:CancelEventDefinition")&&"label"!==e.type&&(ki(e,"bpmn:EndEvent")&&Rh(e,t)&&r.replacements.push({oldElementId:e.id,newElementType:"bpmn:EndEvent"}),ki(e,"bpmn:BoundaryEvent")&&$h(e,t,0,n)&&r.replacements.push({oldElementId:e.id,newElementType:"bpmn:BoundaryEvent"}))})),!!r.replacements.length&&r}function Fh(e,t){return!_(e,jh)&&(!t||e.every((function(e){return Rh(e,t)})))}function Vh(e,t,n,r){return!!t&&(!(!fn(e)&&!Oh(e))||!function(e,t){return e===t}(n,t)&&((!n||!Dh(n,t))&&(Rh(e,t)||Xh(e,t))))}function Hh(e,t){return ki(e,"bpmn:SubProcess")?Vi(e)&&(!t||t.width>=100&&t.height>=80):!!ki(e,"bpmn:Lane")||(!!ki(e,"bpmn:Participant")||(!!Eh(e)||!!Oh(e)))}function Uh(e,t){return!Dh(t,e)&&!Dh(e,t)&&(!!function(e,t){var n=Eh(e),r=Eh(t);return(n||r)&&n!==r}(e,t)||!!Zh(e,t))}function Wh(e,t){return Th(e,t)&&Ph(e)&&ki(t,"bpmn:Activity")&&(n=e,!t.attachers.includes(n))&&!Wi(t);var n}function Gh(e,t){return!(Kh(e)&&!Kh(t))&&(ki(n=e,"bpmn:InteractionNode")&&!ki(n,"bpmn:BoundaryEvent")&&(!ki(n,"bpmn:Event")||ki(n,"bpmn:ThrowEvent")&&Ah(n,"bpmn:MessageEventDefinition"))&&function(e){return ki(e,"bpmn:InteractionNode")&&!Sh(e)&&(!ki(e,"bpmn:Event")||ki(e,"bpmn:CatchEvent")&&Ah(e,"bpmn:MessageEventDefinition"))&&!(ki(e,"bpmn:BoundaryEvent")&&!Mh(e,"bpmn:MessageEventDefinition"))}(t)&&!function(e,t){return kh(e)===kh(t)}(e,t));var n}function Qh(e,t){return ki(n=e,"bpmn:FlowNode")&&!ki(n,"bpmn:EndEvent")&&!Wi(n)&&!(ki(n,"bpmn:IntermediateThrowEvent")&&Mh(n,"bpmn:LinkEventDefinition"))&&!Ph(n)&&!Sh(n)&&function(e){return ki(e,"bpmn:FlowNode")&&!ki(e,"bpmn:StartEvent")&&!ki(e,"bpmn:BoundaryEvent")&&!Wi(e)&&!(ki(e,"bpmn:IntermediateCatchEvent")&&Mh(e,"bpmn:LinkEventDefinition"))&&!Sh(e)}(t)&&Th(e,t)&&!(ki(e,"bpmn:EventBasedGateway")&&!function(e){return ki(e,"bpmn:ReceiveTask")||ki(e,"bpmn:IntermediateCatchEvent")&&(Mh(e,"bpmn:MessageEventDefinition")||Mh(e,"bpmn:TimerEventDefinition")||Mh(e,"bpmn:ConditionalEventDefinition")||Mh(e,"bpmn:SignalEventDefinition"))}(t));var n}function Zh(e,t){return Ei(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&Ei(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:!(!Ei(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])||!Ei(e,["bpmn:Activity","bpmn:CatchEvent"]))&&{type:"bpmn:DataOutputAssociation"}}function Xh(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&&(Ei(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!fn(t)&&ki(e,"bpmn:FlowNode")&&!ki(e,"bpmn:BoundaryEvent")&&Rh(e,t.parent))}function Yh(e,t){return!!fn(t)||!(ki(t,"bpmn:Lane")&&!function(e,t){return e&&t&&-1!==e.indexOf(t)}(e,t.parent))}function Kh(e){return mc(e,"bpmn:Process")||mc(e,"bpmn:Collaboration")}e(xh,tc),xh.$inject=["eventBus"],xh.prototype.init=function(){this.addRule("connection.start",(function(e){return function(e){if(_h(e))return null;return Ei(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}(e.source)})),this.addRule("connection.create",(function(e){var t=e.source,n=e.target,r=e.hints||{},i=r.targetParent;if(r.targetAttach)return!1;i&&(n.parent=i);try{return Nh(t,n)}finally{i&&(n.parent=null)}})),this.addRule("connection.reconnect",(function(e){var t=e.connection;return Nh(e.source,e.target,t)})),this.addRule("connection.updateWaypoints",(function(e){return{type:e.connection.type}})),this.addRule("shape.resize",(function(e){return Hh(e.shape,e.newBounds)})),this.addRule("elements.create",(function(e){var t=e.elements,n=e.position,r=e.target;return!(hn(r)&&!Xh(t,r))&&x(t,(function(e){return hn(e)?Nh(e.source,e.target,e):e.host?$h(e,e.host,null,n):Vh(e,r,null)}))})),this.addRule("elements.move",(function(e){var t=e.target,n=e.shapes,r=e.position;return $h(n,t,null,r)||qh(n,t,r)||Fh(n,t)||Xh(n,t)})),this.addRule("shape.create",(function(e){return Vh(e.shape,e.target,e.source,e.position)})),this.addRule("shape.attach",(function(e){return $h(e.shape,e.target,null,e.position)})),this.addRule("element.copy",(function(e){var t=e.element;return Yh(e.elements,t)}))},xh.prototype.canConnectMessageFlow=Gh,xh.prototype.canConnectSequenceFlow=Qh,xh.prototype.canConnectDataAssociation=Zh,xh.prototype.canConnectAssociation=Uh,xh.prototype.canConnectCompensationAssociation=Wh,xh.prototype.canMove=Fh,xh.prototype.canAttach=$h,xh.prototype.canReplace=qh,xh.prototype.canDrop=Rh,xh.prototype.canInsert=Xh,xh.prototype.canCreate=Vh,xh.prototype.canConnect=Nh,xh.prototype.canResize=Hh,xh.prototype.canCopy=Yh;var Jh={__depends__:[Ic],__init__:["bpmnRules"],bpmnRules:["type",xh]};function ef(e,t){e.on("saveXML.start",2e3,(function(){v(t.getRootElements(),(function(e){var t,n=Pi(e);t=k(y(yt([e],!1),(function(t){return t!==e&&!t.labelTarget})),Pi),n.set("planeElement",t)}))}))}ef.$inject=["eventBus","canvas"];var tf={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",ef]};function nf(e){Ho.call(this,e);var t=this;this.preExecute(["shape.create","connection.create"],(function(e){var n=e.context,r=n.shape||n.connection,i=n.parent,o=t.getOrdering(r,i);o&&(void 0!==o.parent&&(n.parent=o.parent),n.parentIndex=o.index)})),this.preExecute(["shape.move","connection.move"],(function(e){var n=e.context,r=n.shape||n.connection,i=n.newParent||r.parent,o=t.getOrdering(r,i);o&&(void 0!==o.parent&&(n.newParent=o.parent),n.newParentIndex=o.index)}))}function rf(e,t){nf.call(this,e);var n=[{type:"bpmn:SubProcess",order:{level:6}},{type:"bpmn:SequenceFlow",order:{level:9,containers:["bpmn:Participant","bpmn:FlowElementsContainer"]}},{type:"bpmn:DataAssociation",order:{level:9,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:TextAnnotation",order:{level:9}},{type:"bpmn:MessageFlow",order:{level:9,containers:["bpmn:Collaboration"]}},{type:"bpmn:Association",order:{level:6,containers:["bpmn:Participant","bpmn:FlowElementsContainer","bpmn:Collaboration"]}},{type:"bpmn:BoundaryEvent",order:{level:8}},{type:"bpmn:Group",order:{level:10,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:FlowElement",order:{level:5}},{type:"bpmn:Participant",order:{level:-2}},{type:"bpmn:Lane",order:{level:-1}}];function r(e){var t=e.order;if(t||(e.order=t=function(e){if(e.labelTarget)return{level:10};var t=m(n,(function(t){return Ei(e,[t.type])}));return t&&t.order||{level:1}}(e)),!t)throw new Error(`no order for <${e.id}>`);return t}this.getOrdering=function(e,n){if(e.labelTarget||ki(e,"bpmn:TextAnnotation"))return{parent:t.findRoot(n)||t.getRootElement(),index:-1};var i=r(e);i.containers&&(n=function(e,t,n){for(var r=t;r&&!Ei(r,n);)r=r.parent;if(!r)throw new Error(`no parent for <${e.id}> in <${t&&t.id}>`);return r}(e,n,i.containers));var o=n.children.indexOf(e),s=g(n.children,(function(t){return!(!e.labelTarget&&t.labelTarget)&&i.level<r(t).level}));return-1!==s&&-1!==o&&o<s&&(s-=1),{index:s,parent:n}}}nf.prototype.getOrdering=function(e,t){return null},e(nf,Ho),rf.$inject=["eventBus","canvas"],e(rf,nf);var of={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",rf]};function sf(){}sf.prototype.get=function(){return this._data},sf.prototype.set=function(e){this._data=e},sf.prototype.clear=function(){var e=this._data;return delete this._data,e},sf.prototype.isEmpty=function(){return!this._data};var af={clipboard:["type",sf]},lf="drop-ok",cf="drop-not-ok",pf="attach-ok",uf="new-parent",df="create";function hf(e,t,n,r,i){function o(t,n){[pf,lf,cf,uf].forEach((function(r){r===n?e.addMarker(t,r):e.removeMarker(t,r)}))}function s(){var e=t.context();e&&e.prefix===df&&t.cancel()}n.on(["create.move","create.hover"],(function(e){var t=e.context,n=t.elements,r=e.hover,s=t.source,a=t.hints||{};if(!r)return t.canExecute=!1,void(t.target=null);ff(e);var l={x:e.x,y:e.y},c=t.canExecute=r&&function(e,t,n,r,o){if(!t)return!1;var s=m(e=y(e,(function(t){var n=t.labelTarget;return!(t.parent||fn(t)&&-1!==e.indexOf(n))})),(function(e){return!hn(e)})),a=!1,l=!1,c=!1;mf(e)&&(a=i.allowed("shape.attach",{position:n,shape:s,target:t})),a||(c=mf(e)?i.allowed("shape.create",{position:n,shape:s,source:r,target:t}):i.allowed("elements.create",{elements:e,position:n,target:t}));var p=o.connectionTarget;return c||a?(s&&r&&(l=i.allowed("connection.create",{source:p===r?s:r,target:p===r?r:s,hints:{targetParent:t,targetAttach:a}})),{attach:a,connect:l}):(null===c||null===a)&&null}(n,r,l,s,a);r&&null!==c&&(t.target=r,c&&c.attach?o(r,pf):o(r,c?uf:cf))})),n.on(["create.end","create.out","create.cleanup"],(function(e){var t=e.hover;t&&o(t,null)})),n.on("create.end",(function(e){var t=e.context,n=t.source,i=t.shape,o=t.elements,s=t.target,a=t.canExecute,l=a&&a.attach,c=a&&a.connect,p=t.hints||{};if(!1===a||!s)return!1;ff(e);var u={x:e.x,y:e.y};i=c?r.appendShape(n,i,u,s,{attach:l,connection:!0===c?{}:c,connectionTarget:p.connectionTarget}):m(o=r.createElements(o,u,s,I({},p,{attach:l})),(function(e){return!hn(e)})),I(t,{elements:o,shape:i}),I(e,{elements:o,shape:i})})),n.on("create.init",(function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],2e3,(function(){n.off("elements.changed",s)}))})),this.start=function(e,n,r){c(n)||(n=[n]);var i=m(n,(function(e){return!hn(e)}));if(i){r=I({elements:n,hints:{},shape:i},r||{}),v(n,(function(e){u(e.x)||(e.x=0),u(e.y)||(e.y=0)}));var o=vt(y(n,(function(e){return!e.hidden})));v(n,(function(e){hn(e)&&(e.waypoints=k(e.waypoints,(function(e){return{x:e.x-o.x-o.width/2,y:e.y-o.y-o.height/2}}))),I(e,{x:e.x-o.x-o.width/2,y:e.y-o.y-o.height/2})})),t.init(e,df,{cursor:"grabbing",autoActivate:!0,data:{shape:i,elements:n,context:r}})}}}function ff(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 mf(e){return e&&1===e.length&&!hn(e[0])}hf.$inject=["canvas","dragging","eventBus","modeling","rules"];function gf(e,t,n,r,i){t.on("create.move",750,(function(t){var o=t.hover,s=t.context,a=s.elements,l=s.dragGroup;l||(l=s.dragGroup=function(e){var t=Re("g");Oe(t,i.cls("djs-drag-group",["no-events"]));var o=Re("g");return e.forEach((function(e){var i;e.hidden||(e.waypoints?(i=n._createContainer("connection",o),n.drawConnection(Zn(i),e)):(i=n._createContainer("shape",o),n.drawShape(Zn(i),e),Yn(i,e.x,e.y)),r.addDragger(e,t,i))})),t}(a)),o?(l.parentNode||xe(e.getActiveLayer(),l),Yn(l,t.x,t.y)):Ue(l)})),t.on("create.cleanup",(function(e){var t=e.context.dragGroup;t&&Ue(t)}))}gf.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];var yf={__depends__:[Dc,Wp,Ic,Ds],__init__:["create","createPreview"],create:["type",hf],createPreview:["type",gf]};function vf(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)}))}vf.$inject=["eventBus"],vf.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||function(e,t){var n=document.createEvent("MouseEvent"),r=e,i=t,o=e,s=t;n.initMouseEvent&&n.initMouseEvent("mousemove",!0,!0,window,0,r,i,o,s,!1,!1,!1,!1,0,null);return n}(0,0)};var bf={__init__:["mouse"],mouse:["type",vf]};function wf(e,t,n,r,i,o,s,a){this._canvas=e,this._create=t,this._clipboard=n,this._elementFactory=r,this._eventBus=i,this._modeling=o,this._mouse=s,this._rules=a,i.on("copyPaste.copyElement",(function(e){var t=e.descriptor,n=e.element,r=e.elements;t.priority=1,t.id=n.id;var i=m(r,(function(e){return e===n.parent}));i&&(t.parent=n.parent.id),function(e){return!!e.host}(n)&&(t.priority=2,t.host=n.host.id),hn(n)&&(t.priority=3,t.source=n.source.id,t.target=n.target.id,t.waypoints=function(e){return k(e.waypoints,(function(e){return(e=xf(e)).original&&(e.original=xf(e.original)),e}))}(n)),fn(n)&&(t.priority=4,t.labelTarget=n.labelTarget.id),v(["x","y","width","height"],(function(e){u(n[e])&&(t[e]=n[e])})),t.hidden=n.hidden,t.collapsed=n.collapsed})),i.on("copyPaste.pasteElements",(function(e){I(e.hints,{createElementsBehavior:!1})}))}function xf(e){return I({},e)}function _f(e,t){var n=t.indexOf(e);return-1===n?t:t.splice(n,1)}wf.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],wf.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},wf.prototype.paste=function(e){var t=this._clipboard.get();if(!this._clipboard.isEmpty()){var n=e&&e.hints||{};this._eventBus.fire("copyPaste.pasteElements",{hints:n});var r=this._createElements(t);if(e&&e.element&&e.point)return this._paste(r,e.element,e.point,n);this._create.start(this._mouse.getLastMoveEvent(),r,{hints:n||{}})}},wf.prototype._paste=function(e,t,n,r){v(e,(function(e){u(e.x)||(e.x=0),u(e.y)||(e.y=0)}));var i=vt(e);return v(e,(function(e){hn(e)&&(e.waypoints=k(e.waypoints,(function(e){return{x:e.x-i.x-i.width/2,y:e.y-i.y-i.height/2}}))),I(e,{x:e.x-i.x-i.width/2,y:e.y-i.y-i.height/2})})),this._modeling.createElements(e,n,t,I({},r))},wf.prototype._createElements=function(e){var t=this,n=this._eventBus,r={},i=[];return v(e,(function(e,o){v(e=T(e,"priority"),(function(e){var o,s=I({},q(e,["priority"]));return r[e.parent]?s.parent=r[e.parent]:delete s.parent,n.fire("copyPaste.pasteElement",{cache:r,descriptor:s}),hn(s)?(s.source=r[e.source],s.target=r[e.target],o=r[e.id]=t.createConnection(s),void i.push(o)):fn(s)?(s.labelTarget=r[s.labelTarget],o=r[e.id]=t.createLabel(s),void i.push(o)):(s.host&&(s.host=r[s.host]),o=r[e.id]=t.createShape(s),void i.push(o))}))})),i},wf.prototype.createConnection=function(e){return this._elementFactory.createConnection(q(e,["id"]))},wf.prototype.createLabel=function(e){return this._elementFactory.createLabel(q(e,["id"]))},wf.prototype.createShape=function(e){return this._elementFactory.createShape(q(e,["id"]))},wf.prototype.hasRelations=function(e,t){var n,r;return!(hn(e)&&(n=m(t,M({id:e.source.id})),r=m(t,M({id:e.target.id})),!n||!r))&&!(fn(e)&&!m(t,M({id:e.labelTarget.id})))},wf.prototype.createTree=function(e){var t=this._rules,n=this,r={},i=[];function o(e,t){var n=m(i,(function(t){return e===t.element}));n?n.depth<t&&(i=function(e,t){var n=t.indexOf(e);-1!==n&&t.splice(n,1);return t}(n,i),i.push({element:n.element,depth:t})):i.push({element:e,depth:t})}return gt(ht(e),(function(e,t,r){if(!fn(e)){v(e.labels,(function(e){o(e,r)})),v([e.attachers,e.incoming,e.outgoing],(function(e){e&&e.length&&v(e,(function(e){v(e.labels,(function(e){o(e,r)})),o(e,r)}))})),o(e,r);var i=[];return e.children&&(i=e.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:e,children:i}),i}})),e=k(i,(function(e){return e.element})),i=k(i,(function(t){return t.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:t.descriptor,element:t.element,elements:e}),t})),i=T(i,(function(e){return e.descriptor.priority})),e=k(i,(function(e){return e.element})),v(i,(function(i){var o=i.depth;n.hasRelations(i.element,e)?!function(e,n){return t.allowed("element.copy",{element:e,elements:n})}(i.element,e)?_f(i.element,e):(r[o]||(r[o]=[]),r[o].push(i.descriptor)):_f(i.element,e)})),r};var kf={__depends__:[af,yf,bf,Ic],__init__:["copyPaste"],copyPaste:["type",wf]};function Ef(e,t,n){c(n)||(n=[n]),v(n,(function(n){s(e[n])||(t[n]=e[n])}))}function Of(e,t,n){function r(t,r){var i=e.create(t.$type);return n.copyElement(t,i,null,r)}t.on("copyPaste.copyElement",750,(function(e){var t=e.descriptor,n=e.element,i=Oi(n);if(fn(n))return t;var o=t.businessObject=r(i,!0),s=t.di=r(Pi(n),!0);s.bpmnElement=o,Ef(o,t,"name"),Ef(s,t,"isExpanded"),i.default&&(t.default=i.default.id)}));var i="-bpmn-js-refs";t.on("copyPaste.pasteElement",(function(e){var t=e.cache,n=e.descriptor,i=n.businessObject,o=n.di;if(fn(n))return n.businessObject=Oi(t[n.labelTarget]),void(n.di=Pi(t[n.labelTarget]));i=n.businessObject=r(i),(o=n.di=r(o)).bpmnElement=i,Ef(n,i,["isExpanded","name"]),n.type=i.$type})),t.on("copyPaste.copyElement",750,(function(e){var t=e.descriptor,n=e.element;if(ki(n,"bpmn:Participant")){var i=Oi(n);i.processRef&&(t.processRef=r(i.processRef,!0))}})),t.on("copyPaste.pasteElement",(function(e){var t=e.descriptor,n=t.processRef;n&&(t.processRef=r(n))})),t.on("copyPaste.pasteElement",750,(function(e){var t=e.cache;!function(e,t){e[i]=t}(t,function(e,t,n){var r=Oi(e);return e.default&&(n[e.default]={element:r,property:"default"}),e.host&&(Oi(e).attachedToRef=Oi(t[e.host])),q(n,w(n,(function(t,n,i){var o=n.element,s=n.property;return i===e.id&&(o.set(s,r),t.push(e.id)),t}),[]))}(e.descriptor,t,function(e){return e[i]=e[i]||{}}(t)))}))}Of.$inject=["bpmnFactory","eventBus","moddleCopy"];var Pf=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"];function Sf(e,t,n){this._bpmnFactory=t,this._eventBus=e,this._moddle=n,e.on("moddleCopy.canCopyProperties",(function(e){var t=e.propertyNames;if(t&&t.length)return T(t,(function(e){return"extensionElements"===e}))})),e.on("moddleCopy.canCopyProperty",(function(e){var t=e.parent,n=p(t)&&t.$descriptor,r=e.propertyName;return(!r||-1===Pf.indexOf(r))&&(!(r&&n&&!m(n.properties,M({name:r})))&&void 0)})),e.on("moddleCopy.canSetCopiedProperty",(function(e){var t=e.property;if(function(e,t){return e&&d(e.$instanceOf)&&e.$instanceOf(t)}(t,"bpmn:ExtensionElements")&&(!t.values||!t.values.length))return!1}))}function Cf(e,t){return w(e.properties,(function(e,n){return t&&n.default?e:e.concat(n.name)}),[])}Sf.$inject=["eventBus","bpmnFactory","moddle"],Sf.prototype.copyElement=function(e,t,n,r=!1){var i=this;n&&!c(n)&&(n=[n]),n=n||Cf(e.$descriptor);var o=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:r});return!1===o||(c(o)&&(n=o),v(n,(function(n){var o;f(e,n)&&(o=e.get(n));var s=i.copyProperty(o,t,n,r);a(s)&&(!1!==i._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:n})&&t.set(n,s))}))),t},Sf.prototype.copyProperty=function(e,t,n,r=!1){var i=this,o=this._eventBus.fire("moddleCopy.canCopyProperty",{parent:t,property:e,propertyName:n,clone:r});if(!1!==o){if(o)return p(o)&&o.$type&&!o.$parent&&(o.$parent=t),o;var s=this._moddle.getPropertyDescriptor(t,n);if(!s.isReference){if(s.isId)return e&&this._copyId(e,t,r);if(c(e))return w(e,(function(e,s){return(o=i.copyProperty(s,t,n,r))?e.concat(o):e}),[]);if(p(e)&&e.$type){if(this._moddle.getElementDescriptor(e).isGeneric)return;return(o=i._bpmnFactory.create(e.$type)).$parent=t,o=i.copyElement(e,o,null,r)}return e}}},Sf.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 Tf={__depends__:[kf],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",Of],moddleCopy:["type",Sf]},Mf=Math.round;function Af(e,t){this._modeling=e,this._eventBus=t}function Df(e,t){t.on("replace.end",500,(function(t){const{newElement:n,hints:r={}}=t;!1!==r.select&&e.select(n)}))}Af.$inject=["modeling","eventBus"],Af.prototype.replaceElement=function(e,t,n){if(e.waypoints)return null;var r=this._modeling,i=this._eventBus;i.fire("replace.start",{element:e,attrs:t,hints:n});var o=t.width||e.width,s=t.height||e.height,a=t.x||e.x,l=t.y||e.y,c=Mf(a+o/2),p=Mf(l+s/2),u=r.replaceShape(e,I({},t,{x:c,y:p,width:o,height:s}),n);return i.fire("replace.end",{element:e,newElement:u,hints:n}),u},Df.$inject=["selection","eventBus"];var Nf={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",Df],replace:["type",Af]};var Rf=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function jf(e,t,n,r,i,o){this.replaceElement=function(a,l,p){p=p||{};var u=l.type,d=a.businessObject;if(Lf(d)&&"bpmn:SubProcess"===u&&function(e,t){var n=e&&f(e,"collapsed")?e.collapsed:!Vi(e);return n!==(t&&(f(t,"collapsed")||f(t,"isExpanded"))?f(t,"collapsed")?t.collapsed:!t.isExpanded:n)}(a,l))return r.toggleCollapse(a),a;var h=e.create(u),m={type:u,businessObject:h,di:{}};"bpmn:ExclusiveGateway"===u&&(m.di.isMarkerVisible=!0),function(e,t,n){c(n)||(n=[n]),v(n,(function(n){s(e[n])||(t[n]=e[n])}))}(a.di,m.di,["fill","stroke","background-color","border-color","color"]);var g=function(e,t){return e.filter((function(e){return t.includes(e)}))}(Cf(d.$descriptor),Cf(h.$descriptor,!0));I(h,$(l,Rf));var b=y(g,(function(e){return"eventDefinitions"===e?If(a,l.eventDefinitionType):"loopCharacteristics"===e?!Wi(h):!f(h,e)&&(("processRef"!==e||!1!==l.isExpanded)&&("triggeredByEvent"!==e&&("isForCompensation"!==e||!Wi(h))))}));if(h=n.copyElement(d,h,b),l.eventDefinitionType&&(If(h,l.eventDefinitionType)||(m.eventDefinitionType=l.eventDefinitionType,m.eventDefinitionAttrs=l.eventDefinitionAttrs)),ki(d,"bpmn:Activity")){if(Lf(d))m.isExpanded=Vi(a);else if(l&&f(l,"isExpanded")){m.isExpanded=l.isExpanded;var w=t.getDefaultSize(h,{isExpanded:m.isExpanded});m.width=w.width,m.height=w.height,m.x=a.x-(m.width-a.width)/2,m.y=a.y-(m.height-a.height)/2}Vi(a)&&!ki(d,"bpmn:Task")&&m.isExpanded&&(m.width=a.width,m.height=a.height)}if(Lf(d)&&!Lf(h)&&(p.moveChildren=!1),ki(d,"bpmn:Participant")){!0===l.isExpanded?h.processRef=e.create("bpmn:Process"):p.moveChildren=!1;var x=Hi(a);Pi(a).isHorizontal||(Pi(m).isHorizontal=x),m.width=x?a.width:t.getDefaultSize(m).width,m.height=x?t.getDefaultSize(m).height:a.height}return o.allowed("shape.resize",{shape:h})||(m.height=t.getDefaultSize(m).height,m.width=t.getDefaultSize(m).width),h.name=d.name,Ei(d,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&Ei(h,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(h.default=d.default),l.host&&!ki(d,"bpmn:BoundaryEvent")&&ki(h,"bpmn:BoundaryEvent")&&(m.host=l.host),"bpmn:DataStoreReference"!==m.type&&"bpmn:DataObjectReference"!==m.type||(m.x=a.x+(a.width-m.width)/2),i.replaceElement(a,m,{...p,targetElement:l})}}function Lf(e){return ki(e,"bpmn:SubProcess")}function If(e,t){var n=Oi(e);return t&&n.get("eventDefinitions").some((function(e){return ki(e,t)}))}jf.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];var zf={__depends__:[Tf,Nf,Ds],bpmnReplace:["type",jf]};function Bf(e){this._eventBus=e,this._tools=[],this._active=null}Bf.$inject=["eventBus"],Bf.prototype.registerTool=function(e,t){var n=this._tools;if(!t)throw new Error('A tool has to be registered with it\'s "events"');n.push(e),this.bindEvents(e,t)},Bf.prototype.isActive=function(e){return e&&this._active===e},Bf.prototype.length=function(e){return this._tools.length},Bf.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Bf.prototype.bindEvents=function(e,t){var n=this._eventBus,r=[];n.on(t.tool+".init",(function(t){t.context.reactivate||!this.isActive(e)?this.setActive(e):this.setActive(null)}),this),v(t,(function(e){r.push(e+".ended"),r.push(e+".canceled")})),n.on(r,250,(function(e){this._active&&(function(e){var t=e.originalEvent&&e.originalEvent.target;return t&&te(t,'.group[data-group="tools"]')}(e)||this.setActive(null))}),this)};var $f={__depends__:[Dc],__init__:["toolManager"],toolManager:["type",Bf]};function qf(e,t){return-1!==e.indexOf(t)}var Ff=Math.abs,Vf=Math.round,Hf={x:"width",y:"height"},Uf="crosshair",Wf={n:"top",w:"left",s:"bottom",e:"right"},Gf=1500,Qf={n:"s",w:"e",s:"n",e:"w"},Zf=20;function Xf(e,t,n,r,i,o,s){this._canvas=e,this._dragging=t,this._eventBus=n,this._modeling=r,this._rules=i,this._toolManager=o,this._mouse=s;var a=this;o.registerTool("space",{tool:"spaceTool.selection",dragging:"spaceTool"}),n.on("spaceTool.selection.end",(function(e){n.once("spaceTool.selection.ended",(function(){a.activateMakeSpace(e.originalEvent)}))})),n.on("spaceTool.move",Gf,(function(e){var t=e.context,n=t.initialized;n||(n=t.initialized=a.init(e,t)),n&&Kf(e)})),n.on("spaceTool.end",(function(e){var t=e.context,r=t.axis,i=t.direction,o=t.movingShapes,s=t.resizingShapes,l=t.start;if(t.initialized){Kf(e);var c={x:0,y:0};c[r]=Vf(e["d"+r]),a.makeSpace(o,s,c,i,l),n.once("spaceTool.ended",(function(e){a.activateSelection(e.originalEvent,!0,!0)}))}}))}function Yf(e){return{top:e.top-Zf,right:e.right+Zf,bottom:e.bottom+Zf,left:e.left-Zf}}function Kf(e){var t,n,r=e.context.spaceToolConstraints;r&&(u(r.left)&&(t=Math.max(e.x,r.left),e.dx=e.dx+t-e.x,e.x=t),u(r.right)&&(t=Math.min(e.x,r.right),e.dx=e.dx+t-e.x,e.x=t),u(r.top)&&(n=Math.max(e.y,r.top),e.dy=e.dy+n-e.y,e.y=n),u(r.bottom)&&(n=Math.min(e.y,r.bottom),e.dy=e.dy+n-e.y,e.y=n))}function Jf(e,t){return-1!==e.indexOf(t)}Xf.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Xf.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:Uf,data:{context:{reactivate:n}},trapClick:!1})},Xf.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:Uf,data:{context:{}}})},Xf.prototype.makeSpace=function(e,t,n,r,i){return this._modeling.createSpace(e,t,n,r,i)},Xf.prototype.init=function(e,t){var n=Ff(e.dx)>Ff(e.dy)?"x":"y",r=e["d"+n],i=e[n]-r;if(Ff(r)<5)return!1;r<0&&(r*=-1),ws(e)&&(r*=-1);var o=function(e,t){if("x"===e){if(t>0)return"e";if(t<0)return"w"}if("y"===e){if(t>0)return"s";if(t<0)return"n"}return null}(n,r),s=this._canvas.getRootElement();!xs(e)&&e.hover&&(s=e.hover);var a=[...yt(s,!0),...s.attachers||[]],l=this.calculateAdjustments(a,n,r,i),c=function(e,t,n,r,i){var o=e.movingShapes,s=e.resizingShapes;if(!s.length)return;var a,l,c={};return v(s,(function(e){var p,d,h,f,m,g,v=e.attachers,b=e.children,w=yn(e),x=y(b,(function(e){return!(hn(e)||fn(e)||Jf(o,e)||Jf(s,e))})),_=y(b,(function(e){return!hn(e)&&!fn(e)&&Jf(o,e)})),k=[],E=[];x.length&&(d=Yf(yn(vt(x))),p=r-w[Wf[n]]+d[Wf[n]],"n"===n?c.bottom=l=u(l)?Math.min(l,p):p:"w"===n?c.right=l=u(l)?Math.min(l,p):p:"s"===n?c.top=a=u(a)?Math.max(a,p):p:"e"===n&&(c.left=a=u(a)?Math.max(a,p):p)),_.length&&(h=Yf(yn(vt(_))),p=r-h[Wf[Qf[n]]]+w[Wf[Qf[n]]],"n"===n?c.bottom=l=u(l)?Math.min(l,p):p:"w"===n?c.right=l=u(l)?Math.min(l,p):p:"s"===n?c.top=a=u(a)?Math.max(a,p):p:"e"===n&&(c.left=a=u(a)?Math.max(a,p):p)),v&&v.length&&(v.forEach((function(e){Jf(o,e)?k.push(e):E.push(e)})),k.length&&(f=yn(vt(k.map(wn))),m=w[Wf[Qf[n]]]-(f[Wf[Qf[n]]]-r)),E.length&&(g=yn(vt(E.map(wn)))[Wf[n]]-(w[Wf[n]]-r)),"n"===n?(p=Math.min(m||1/0,g||1/0),c.bottom=l=u(l)?Math.min(l,p):p):"w"===n?(p=Math.min(m||1/0,g||1/0),c.right=l=u(l)?Math.min(l,p):p):"s"===n?(p=Math.max(m||-1/0,g||-1/0),c.top=a=u(a)?Math.max(a,p):p):"e"===n&&(p=Math.max(m||-1/0,g||-1/0),c.left=a=u(a)?Math.max(a,p):p));var O=i&&i[e.id];O&&("n"===n?(p=r+e[Hf[t]]-O[Hf[t]],c.bottom=l=u(l)?Math.min(l,p):p):"w"===n?(p=r+e[Hf[t]]-O[Hf[t]],c.right=l=u(l)?Math.min(l,p):p):"s"===n?(p=r-e[Hf[t]]+O[Hf[t]],c.top=a=u(a)?Math.max(a,p):p):"e"===n&&(p=r-e[Hf[t]]+O[Hf[t]],c.left=a=u(a)?Math.max(a,p):p))})),c}(l,n,o,i,this._eventBus.fire("spaceTool.getMinDimensions",{axis:n,direction:o,shapes:l.resizingShapes,start:i}));return I(t,l,{axis:n,direction:o,spaceToolConstraints:c,start:i}),Js("resize-"+("x"===n?"ew":"ns")),!0},Xf.prototype.calculateAdjustments=function(e,t,n,r){var i=this._rules,o=[],s=[],a=[],l=[];function c(e){o.includes(e)||o.push(e);var t=e.label;t&&!o.includes(t)&&o.push(t)}v(e,(function(e){if(e.parent&&!fn(e))if(hn(e))l.push(e);else{var o=e[t],p=o+e[Hf[t]];if(function(e){return!!e.host}(e)&&(n>0&&wn(e)[t]>r||n<0&&wn(e)[t]<r))a.push(e);else{var u;if(!(n>0&&o>r||n<0&&p<r))return o<r&&p>r&&i.allowed("shape.resize",{shape:e})?(u=e,void(s.includes(u)||s.push(u))):void 0;c(e)}}})),v(o,(function(e){var t=e.attachers;t&&v(t,(function(e){c(e)}))}));var p=o.concat(s);return v(a,(function(e){var t=e.host;Jf(p,t)&&c(e)})),p=o.concat(s),v(l,(function(e){var t=e.source,n=e.target,r=e.label;Jf(p,t)&&Jf(p,n)&&r&&c(r)})),{movingShapes:o,resizingShapes:s}},Xf.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Xf.prototype.isActive=function(){var e=this._dragging.context();return!!e&&/^spaceTool/.test(e.prefix)};var em="djs-dragging",tm="djs-resizing",nm=Math.max;function rm(e,t,n,r,i){function o(e,t){v(e,(function(e){i.addDragger(e,t),n.addMarker(e,em)}))}e.on("spaceTool.selection.start",(function(e){var t=n.getLayer("space"),i=e.context,o="M 0,-10000 L 0,10000",s="M -10000,0 L 10000,0",a=Re("g");Oe(a,r.cls("djs-crosshair-group",["no-events"])),xe(t,a);var l=Re("path");Oe(l,"d",o),Se(l).add("djs-crosshair"),xe(a,l);var c=Re("path");Oe(c,"d",s),Se(c).add("djs-crosshair"),xe(a,c),i.crosshairGroup=a})),e.on("spaceTool.selection.move",(function(e){Yn(e.context.crosshairGroup,e.x,e.y)})),e.on("spaceTool.selection.cleanup",(function(e){var t=e.context.crosshairGroup;t&&Ue(t)})),e.on("spaceTool.move",250,(function(e){var s=e.context,a=s.line,l=s.axis,c=s.movingShapes,p=s.resizingShapes;if(s.initialized){if(!s.dragGroup){var u=n.getLayer("space");Oe(a=Re("path"),"d","M0,0 L0,0"),Se(a).add("djs-crosshair"),xe(u,a),s.line=a;var d=Re("g");Oe(d,r.cls("djs-drag-group",["no-events"])),xe(n.getActiveLayer(),d),o(c,d),o(s.movingConnections=t.filter((function(e){var t=!1;v(c,(function(n){v(n.outgoing,(function(n){e===n&&(t=!0)}))}));var n=!1;v(c,(function(t){v(t.incoming,(function(t){e===t&&(n=!0)}))}));var r=!1;v(p,(function(t){v(t.outgoing,(function(t){e===t&&(r=!0)}))}));var i=!1;return v(p,(function(t){v(t.incoming,(function(t){e===t&&(i=!0)}))})),hn(e)&&(t||r)&&(n||i)})),d),s.dragGroup=d}if(!s.frameGroup){var h=Re("g");Oe(h,r.cls("djs-frame-group",["no-events"])),xe(n.getActiveLayer(),h);var f=[];v(p,(function(e){var t=i.addFrame(e,h),r=t.getBBox();f.push({element:t,initialBounds:r}),n.addMarker(e,tm)})),s.frameGroup=h,s.frames=f}Oe(a,{d:{x:"M"+e.x+", -10000 L"+e.x+", 10000",y:"M -10000, "+e.y+" L 10000, "+e.y}[l]});var m={x:e.dx,y:e.dy};m[{x:"y",y:"x"}[s.axis]]=0,Yn(s.dragGroup,m.x,m.y),v(s.frames,(function(e){var t,n,r=e.element,i=e.initialBounds;"e"===s.direction?Oe(r,{width:nm(i.width+m.x,5)}):Oe(r,{width:t=nm(i.width-m.x,5),x:i.x+i.width-t}),"s"===s.direction?Oe(r,{height:nm(i.height+m.y,5)}):Oe(r,{height:n=nm(i.height-m.y,5),y:i.y+i.height-n})}))}})),e.on("spaceTool.cleanup",(function(e){var t=e.context,r=t.movingShapes,i=t.movingConnections,o=t.resizingShapes,s=t.line,a=t.dragGroup,l=t.frameGroup;v(r,(function(e){n.removeMarker(e,em)})),v(i,(function(e){n.removeMarker(e,em)})),a&&(Ue(s),Ue(a)),v(o,(function(e){n.removeMarker(e,tm)})),l&&Ue(l)}))}rm.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];var im={__init__:["spaceToolPreview"],__depends__:[Dc,Ic,$f,Wp,bf],spaceTool:["type",Xf],spaceToolPreview:["type",rm]};function om(e){e.invoke(Xf,this)}om.$inject=["injector"],e(om,Xf),om.prototype.calculateAdjustments=function(e,t,n,r){var i=Xf.prototype.calculateAdjustments.call(this,e,t,n,r);return i.resizingShapes=i.resizingShapes.filter((function(e){return!ki(e,"bpmn:TextAnnotation")&&(!function(e){return ki(e,"bpmn:Participant")&&!Oi(e).processRef}(e)||!("y"===t&&Hi(e)||"x"===t&&!Hi(e)))})),i};var sm={__depends__:[im],spaceTool:["type",om]};function am(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)}am.$inject=["eventBus","injector"],am.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()},am.prototype.canExecute=function(e,t){const n={command:e,context:t},r=this._getHandler(e);let i=this._fire(e,"canExecute",n);if(void 0===i){if(!r)return!1;r.canExecute&&(i=r.canExecute(t))}return i},am.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,!1!==e&&this._fire("changed",{trigger:"clear"})},am.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()}},am.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()}},am.prototype.register=function(e,t){this._setHandler(e,t)},am.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)},am.prototype.canUndo=function(){return!!this._getUndoAction()},am.prototype.canRedo=function(){return!!this._getRedoAction()},am.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},am.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},am.prototype._internalUndo=function(e){const t=e.command,n=e.context,r=this._getHandler(t);this._atomicDo((()=>{this._fire(t,"revert",e),r.revert&&this._markDirty(r.revert(n)),this._revertedAction(e),this._fire(t,"reverted",e)}))},am.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);const r=t?[e+"."+t,t]:[e];let i;n=this._eventBus.createEvent(n);for(const e of r)if(i=this._eventBus.fire("commandStack."+e,n),n.cancelBubble)break;return i},am.prototype._createId=function(){return this._uid++},am.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},am.prototype._internalExecute=function(e,t){const n=e.command,r=e.context,i=this._getHandler(n);if(!i)throw new Error("no command handler registered for <"+n+">");this._pushAction(e),t||(this._fire(n,"preExecute",e),i.preExecute&&i.preExecute(r),this._fire(n,"preExecuted",e)),this._atomicDo((()=>{this._fire(n,"execute",e),i.execute&&this._markDirty(i.execute(r)),this._executedAction(e,t),this._fire(n,"executed",e)})),t||(this._fire(n,"postExecute",e),i.postExecute&&i.postExecute(r),this._fire(n,"postExecuted",e)),this._popAction()},am.prototype._pushAction=function(e){const t=this._currentExecution,n=t.actions,r=n[0];if(t.atomic)throw new Error("illegal invocation in <execute> or <revert> phase (action: "+e.command+")");e.id||(e.id=r&&r.id||this._createId()),n.push(e)},am.prototype._popAction=function(){const e=this._currentExecution,t=e.trigger,n=e.actions,r=e.dirty;n.pop(),n.length||(this._eventBus.fire("elements.changed",{elements:S("id",r.reverse())}),r.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},am.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=c(e)?e:[e],t.dirty=t.dirty.concat(e))},am.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},am.prototype._revertedAction=function(e){this._stackIdx--},am.prototype._getHandler=function(e){return this._handlerMap[e]},am.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 lm={commandStack:["type",am]};function cm(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 pm(e,t,n){Ho.call(this,t);var r=e.get("movePreview",!1);t.on("shape.move.start",1400,(function(e){var t=e.context,n=t.shapes,r=t.validatedShapes;t.shapes=um(n),t.validatedShapes=um(r)})),r&&t.on("shape.move.start",250,(function(e){var t=e.context,n=t.shapes,i=[];v(n,(function(e){v(e.labels,(function(n){n.hidden||-1!==t.shapes.indexOf(n)||i.push(n),e.labelTarget&&i.push(e)}))})),v(i,(function(e){r.makeDraggable(t,e,!0)}))})),this.preExecuted("elements.move",1400,(function(e){var t=e.context.closure,n=t.enclosedElements,r=[];v(n,(function(e){v(e.labels,(function(e){n[e.id]||r.push(e)}))})),t.addAll(r)})),this.preExecute(["connection.delete","shape.delete"],(function(e){var t=e.context;cm((t.connection||t.shape).labels,(function(e){n.removeShape(e,{nested:!0})}))})),this.execute("shape.delete",(function(e){var t=e.context,n=t.shape,r=n.labelTarget;r&&(t.labelTargetIndex=Pt(r.labels,n),t.labelTarget=r,n.labelTarget=null)})),this.revert("shape.delete",(function(e){var t=e.context,n=t.shape,r=t.labelTarget,i=t.labelTargetIndex;r&&(Ot(r.labels,n,i),n.labelTarget=r)}))}function um(e){return y(e,(function(t){return-1===e.indexOf(t.labelTarget)}))}e(pm,Ho),pm.$inject=["injector","eventBus","modeling"];var dm={__init__:["labelSupport"],labelSupport:["type",pm]},hm="attach-ok";function fm(e,t,n,r,i){Ho.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",1401,(function(e){var t,n,r=e.context,i=r.shapes,o=r.validatedShapes;r.shapes=(n=mm(t=i),C("id",t,n)),r.validatedShapes=function(e){var t=P(e,"id");return y(e,(function(e){for(;e;){if(e.host&&t[e.host.id])return!1;e=e.parent}return!0}))}(o)})),o&&t.on("shape.move.start",251,(function(e){var t=e.context;v(mm(t.shapes),(function(e){o.makeDraggable(t,e,!0),v(e.labels,(function(e){o.makeDraggable(t,e,!0)}))}))})),o&&t.on("shape.move.start",(function(e){var r=e.context.shapes;if(1===r.length){var i=r[0].host;i&&(n.addMarker(i,hm),t.once(["shape.move.out","shape.move.cleanup"],(function(){n.removeMarker(i,hm)})))}})),this.preExecuted("elements.move",1401,(function(e){var t=e.context,n=t.closure;v(mm(t.shapes),(function(e){n.add(e,n.topLevel[e.host.id])}))})),this.postExecuted("elements.move",(function(e){var t=e.context,n=t.shapes,r=t.newHost;r&&1!==n.length||v(r?n:y(n,(function(e){var t,r=e.host;return function(e){return!!e.host}(e)&&(t=r,!(-1!==n.indexOf(t)))})),(function(e){i.updateAttachment(e,r)}))})),this.postExecuted("elements.move",(function(e){v(e.context.shapes,(function(e){v(e.attachers,(function(e){v(e.outgoing.slice(),(function(e){r.allowed("connection.reconnect",{connection:e,source:e.source,target:e.target})||i.removeConnection(e)})),v(e.incoming.slice(),(function(e){r.allowed("connection.reconnect",{connection:e,source:e.source,target:e.target})||i.removeConnection(e)}))}))}))})),this.postExecute("shape.create",(function(e){var t=e.context,n=t.shape,r=t.host;r&&i.updateAttachment(n,r)})),this.postExecute("shape.replace",(function(e){var t=e.context,n=t.oldShape,o=t.newShape;cm(n.attachers,(function(e){"attach"===r.allowed("elements.move",{target:o,shapes:[e]})?i.updateAttachment(e,o):i.removeShape(e)})),o.attachers.length&&v(o.attachers,(function(e){var t=ud(e,n,o);i.moveShape(e,t,e.parent)}))})),this.postExecute("shape.resize",(function(e){var t=e.context,n=t.shape,r=t.oldBounds,o=t.newBounds,s=n.attachers;!1!==(t.hints||{}).attachSupport&&v(s,(function(e){var t=ud(e,r,o);i.moveShape(e,t,e.parent),v(e.labels,(function(e){i.moveShape(e,t,e.parent)}))}))})),this.preExecute("shape.delete",(function(e){var t=e.context.shape;cm(t.attachers,(function(e){i.removeShape(e)})),t.host&&i.updateAttachment(t,null)}))}function mm(e){return r(k(e,(function(e){return e.attachers||[]})))}e(fm,Ho),fm.$inject=["injector","eventBus","canvas","rules","modeling"];var gm={__depends__:[Ic],__init__:["attachSupport"],attachSupport:["type",fm]};function ym(e){this._model=e}function vm(e,t,n){Ho.call(this,e),this._bpmnFactory=t;var r=this;function i(e){v(e.context.oldRoot.children,(function(e){ki(e,"bpmn:BaseElement")&&r.updateParent(e)}))}function o(e){var t=e.context.shape;ki(t,"bpmn:BaseElement")&&r.updateBounds(t)}function s(e){r.updateConnection(e.context)}function a(e){r.updateConnectionWaypoints(e.context.connection)}function l(e){r.updateAttachment(e.context)}function c(e){const{element:n}=e.context,r=to(n),i=Pi(n),o=i&&i.get("label");Xi(n)||ts(n)||(r&&!o?i.set("label",t.create("bpmndi:BPMNLabel")):!r&&o&&i.set("label",void 0))}this.executed(["connection.layout","connection.create"],(function(e){var t,r=e.context,i=r.hints||{};r.cropped||!1===i.createElementsBehavior||((t=r.connection).waypoints=n.getCroppedWaypoints(t),r.cropped=!0)})),this.reverted(["connection.layout"],(function(e){delete e.context.cropped})),this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],bm((function(e){var t=e.context;r.updateParent(t.shape||t.connection,t.oldParent)}))),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],bm((function(e){var t=e.context,n=t.shape||t.connection,i=t.parent||t.newParent;r.updateParent(n,i)}))),this.executed(["canvas.updateRoot"],i),this.reverted(["canvas.updateRoot"],i),this.executed(["shape.move","shape.create","shape.resize"],bm((function(e){"label"!==e.context.shape.type&&o(e)}))),this.reverted(["shape.move","shape.create","shape.resize"],bm((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"],bm(s)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],bm(s)),this.executed(["connection.layout","connection.move","connection.updateWaypoints"],bm(a)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],bm(a)),this.executed("connection.reconnect",bm((function(e){var t=e.context,n=t.connection,r=t.oldSource,i=t.newSource,o=Oi(n),s=Oi(r),a=Oi(i);o.conditionExpression&&!Ei(a,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(t.oldConditionExpression=o.conditionExpression,delete o.conditionExpression),r!==i&&s.default===o&&(t.oldDefault=s.default,delete s.default)}))),this.reverted("connection.reconnect",bm((function(e){var t=e.context,n=t.connection,r=t.oldSource,i=t.newSource,o=Oi(n),s=Oi(r),a=Oi(i);t.oldConditionExpression&&(o.conditionExpression=t.oldConditionExpression),t.oldDefault&&(s.default=t.oldDefault,delete a.default)}))),this.executed(["element.updateAttachment"],bm(l)),this.reverted(["element.updateAttachment"],bm(l)),this.executed("element.updateLabel",bm(c)),this.reverted("element.updateLabel",bm(c))}function bm(e){return function(t){var n=t.context;ki(n.shape||n.connection||n.element,"bpmn:BaseElement")&&e(t)}}function wm(e,t){Hn.call(this),this._bpmnFactory=e,this._moddle=t}function xm(e,t,n){return void 0===t[n]?t:(e[n]=t[n],q(t,[n]))}function _m(e,t){this._modeling=e,this._canvas=t}function km(e){this._modeling=e}function Em(e,t){this._canvas=e,this._layouter=t}ym.$inject=["moddle"],ym.prototype._needsId=function(e){return Ei(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"])},ym.prototype._ensureId=function(e){var t;e.id?this._model.ids.claim(e.id,e):(t=ki(e,"bpmn:Activity")?"Activity":ki(e,"bpmn:Event")?"Event":ki(e,"bpmn:Gateway")?"Gateway":Ei(e,["bpmn:SequenceFlow","bpmn:MessageFlow"])?"Flow":(e.$type||"").replace(/^[^:]*:/g,""),t+="_",!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e)))},ym.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},ym.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},ym.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",I({bpmnElement:e,bounds:this.createDiBounds()},t))},ym.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},ym.prototype.createDiWaypoints=function(e){var t=this;return k(e,(function(e){return t.createDiWaypoint(e)}))},ym.prototype.createDiWaypoint=function(e){return this.create("dc:Point",$(e,["x","y"]))},ym.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",I({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},ym.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",I({bpmnElement:e},t))},e(vm,Ho),vm.$inject=["eventBus","bpmnFactory","connectionDocking"],vm.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,r=t.host;n.attachedToRef=r&&r.businessObject},vm.prototype.updateParent=function(e,t){if(!(fn(e)||ki(e,"bpmn:DataStoreReference")&&e.parent&&ki(e.parent,"bpmn:Collaboration"))){var n=e.parent,r=e.businessObject,i=Pi(e),o=n&&n.businessObject,s=Pi(n);ki(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(r,o,t&&t.businessObject),ki(e,"bpmn:DataOutputAssociation")&&(o=e.source?e.source.businessObject:null),ki(e,"bpmn:DataInputAssociation")&&(o=e.target?e.target.businessObject:null),this.updateSemanticParent(r,o),ki(e,"bpmn:DataObjectReference")&&r.dataObjectRef&&this.updateSemanticParent(r.dataObjectRef,o),this.updateDiParent(i,s)}},vm.prototype.updateBounds=function(e){var t=Pi(e),n=function(e){if(!ki(e,"bpmn:Activity"))return;var t=Pi(e);if(!t)return;var n=t.get("label");if(!n)return;return n.get("bounds")}(e);if(n){var r=ia(n,t.get("bounds"));I(n,{x:e.x+r.x,y:e.y+r.y})}var i=fn(e)?this._getLabel(t):t,o=i.bounds;o||(o=this._bpmnFactory.createDiBounds(),i.set("bounds",o)),I(o,{x:e.x,y:e.y,width:e.width,height:e.height})},vm.prototype.updateFlowNodeRefs=function(e,t,n){n!==t&&(ki(n,"bpmn:Lane")&&Et(n.get("flowNodeRef"),e),ki(t,"bpmn:Lane")&&Ot(t.get("flowNodeRef"),e))},vm.prototype.updateDiConnection=function(e,t,n){var r=Pi(e),i=Pi(t),o=Pi(n);r.sourceElement&&r.sourceElement.bpmnElement!==Oi(t)&&(r.sourceElement=t&&i),r.targetElement&&r.targetElement.bpmnElement!==Oi(n)&&(r.targetElement=n&&o)},vm.prototype.updateDiParent=function(e,t){if(t&&!ki(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(Et(n,e),e.$parent=null)}},vm.prototype.getLaneSet=function(e){var t,n;return ki(e,"bpmn:Lane")?((t=e.childLaneSet)||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(ki(e,"bpmn:Participant")&&(e=e.processRef),(t=(n=e.get("laneSets"))[0])||((t=this._bpmnFactory.create("bpmn:LaneSet")).$parent=e,n.push(t)),t)},vm.prototype.updateSemanticParent=function(e,t,n){var r;if(e.$parent!==t&&(!ki(e,"bpmn:DataInput")&&!ki(e,"bpmn:DataOutput")||(ki(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),!("ioSpecification"in t)||t.ioSpecification!==e.$parent))){if(ki(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),r="lanes";else if(ki(e,"bpmn:FlowElement")){if(t)if(ki(t,"bpmn:Participant"))t=t.processRef;else if(ki(t,"bpmn:Lane"))do{t=t.$parent.$parent}while(ki(t,"bpmn:Lane"));r="flowElements"}else if(ki(e,"bpmn:Artifact")){for(;t&&!ki(t,"bpmn:Process")&&!ki(t,"bpmn:SubProcess")&&!ki(t,"bpmn:Collaboration");){if(ki(t,"bpmn:Participant")){t=t.processRef;break}t=t.$parent}r="artifacts"}else if(ki(e,"bpmn:MessageFlow"))r="messageFlows";else if(ki(e,"bpmn:Participant")){r="participants";var i,o=e.processRef;o&&(i=function(e){for(;e&&!ki(e,"bpmn:Definitions");)e=e.$parent;return e}(e.$parent||t),e.$parent&&(Et(i.get("rootElements"),o),o.$parent=null),t&&(Ot(i.get("rootElements"),o),o.$parent=i))}else ki(e,"bpmn:DataOutputAssociation")?r="dataOutputAssociations":ki(e,"bpmn:DataInputAssociation")&&(r="dataInputAssociations");if(!r)throw new Error(`no parent for <${e.id}> in <${t.id}>`);var s;if(e.$parent&&Et(s=e.$parent.get(r),e),t?((s=t.get(r)).push(e),e.$parent=t):e.$parent=null,n){var a=n.get(r);Et(s,e),t&&(a||(a=[],t.set(r,a)),a.push(e))}}},vm.prototype.updateConnectionWaypoints=function(e){Pi(e).set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},vm.prototype.updateConnection=function(e){var t,n=e.connection,r=Oi(n),i=n.source,o=Oi(i),s=n.target,a=Oi(n.target);if(ki(r,"bpmn:DataAssociation"))ki(r,"bpmn:DataInputAssociation")?(r.get("sourceRef")[0]=o,t=e.parent||e.newParent||a,this.updateSemanticParent(r,a,t)):ki(r,"bpmn:DataOutputAssociation")&&(t=e.parent||e.newParent||o,this.updateSemanticParent(r,o,t),r.targetRef=a);else{var l=ki(r,"bpmn:SequenceFlow");r.sourceRef!==o&&(l&&(Et(r.sourceRef&&r.sourceRef.get("outgoing"),r),o&&o.get("outgoing")&&o.get("outgoing").push(r)),r.sourceRef=o),r.targetRef!==a&&(l&&(Et(r.targetRef&&r.targetRef.get("incoming"),r),a&&a.get("incoming")&&a.get("incoming").push(r)),r.targetRef=a)}this.updateConnectionWaypoints(n),this.updateDiConnection(n,i,s)},vm.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label},e(wm,Hn),wm.$inject=["bpmnFactory","moddle"],wm.prototype._baseCreate=Hn.prototype.create,wm.prototype.create=function(e,t){if("label"===e){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,I({type:"label",di:n},Qi,t))}return this.createElement(e,t)},wm.prototype.createElement=function(e,t){var n,r,i,o=(t=I({},t||{})).businessObject,s=t.di;if(!o){if(!t.type)throw new Error("no shape type specified");wi(o=this._bpmnFactory.create(t.type))}if(!Ei(s,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])){var l=I({},s||{},{id:o.id+"_di"});s="root"===e?this._bpmnFactory.createDiPlane(o,l):"connection"===e?this._bpmnFactory.createDiEdge(o,l):this._bpmnFactory.createDiShape(o,l)}return ki(o,"bpmn:Group")&&(t=I({isFrame:!0},t)),t=function(e,t,n){return v(n,(function(n){t=xm(e,t,n)})),t}(o,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=xm(s,t,"isExpanded")),Ei(o,["bpmn:Lane","bpmn:Participant"])&&(t=xm(s,t,"isHorizontal")),ki(o,"bpmn:SubProcess")&&(t.collapsed=!Vi(o,s)),ki(o,"bpmn:ExclusiveGateway")&&(f(s,"isMarkerVisible")?void 0===s.isMarkerVisible&&(s.isMarkerVisible=!1):s.isMarkerVisible=!0),a(t.triggeredByEvent)&&(o.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),a(t.cancelActivity)&&(o.cancelActivity=t.cancelActivity,delete t.cancelActivity),t.eventDefinitionType&&(r=o.get("eventDefinitions")||[],i=this._bpmnFactory.create(t.eventDefinitionType,t.eventDefinitionAttrs),"bpmn:ConditionalEventDefinition"===t.eventDefinitionType&&(i.condition=this._bpmnFactory.create("bpmn:FormalExpression")),r.push(i),i.$parent=o,o.eventDefinitions=r,delete t.eventDefinitionType),n=this.getDefaultSize(o,s),t=I({id:o.id},n,t,{businessObject:o,di:s}),this._baseCreate(e,t)},wm.prototype.getDefaultSize=function(e,t){var n=Oi(e);if(t=t||Pi(e),ki(n,"bpmn:SubProcess"))return Vi(n,t)?{width:350,height:200}:{width:100,height:80};if(ki(n,"bpmn:Task"))return{width:100,height:80};if(ki(n,"bpmn:Gateway"))return{width:50,height:50};if(ki(n,"bpmn:Event"))return{width:36,height:36};if(ki(n,"bpmn:Participant")){var r=void 0===t.isHorizontal||!0===t.isHorizontal;return Vi(n,t)?r?{width:600,height:250}:{width:250,height:600}:r?{width:400,height:60}:{width:60,height:400}}return ki(n,"bpmn:Lane")?{width:400,height:100}:ki(n,"bpmn:DataObjectReference")?{width:36,height:50}:ki(n,"bpmn:DataStoreReference")?{width:50,height:50}:ki(n,"bpmn:TextAnnotation")?{width:100,height:30}:ki(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},wm.prototype.createParticipantShape=function(e){return p(e)||(e={isExpanded:e}),!1!==(e=I({type:"bpmn:Participant"},e||{})).isExpanded&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)},_m.$inject=["modeling","canvas"],_m.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,r=e.alignment;v(n,(function(e){var n={x:0,y:0};a(r.left)?n.x=r.left-e.x:a(r.right)?n.x=r.right-e.width-e.x:a(r.center)?n.x=r.center-Math.round(e.width/2)-e.x:a(r.top)?n.y=r.top-e.y:a(r.bottom)?n.y=r.bottom-e.height-e.y:a(r.middle)&&(n.y=r.middle-Math.round(e.height/2)-e.y),t.moveElements([e],n,e.parent)}))},_m.prototype.postExecute=function(e){},km.$inject=["modeling"],km.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var n=e.target||t.parent,r=e.shape,i=e.hints||{};r=e.shape=this._modeling.createShape(r,e.position,n,{attach:i.attach}),e.shape=r},km.prototype.postExecute=function(e){var t,n,r=e.hints||{};t=e.source,n=e.shape,_(t.outgoing,(function(e){return e.target===n}))||(r.connectionTarget===e.source?this._modeling.connect(e.shape,e.source,e.connection):this._modeling.connect(e.source,e.shape,e.connection))},Em.$inject=["canvas","layouter"],Em.prototype.execute=function(e){var t=e.connection,n=e.source,r=e.target,i=e.parent,o=e.parentIndex,s=e.hints;if(!n||!r)throw new Error("source and target required");if(!i)throw new Error("parent required");return t.source=n,t.target=r,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,s)),this._canvas.addConnection(t,i,o),t},Em.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var Om=Math.round;function Pm(e){this._modeling=e}Pm.$inject=["modeling"],Pm.prototype.preExecute=function(e){var t=e.elements,n=e.parent,r=e.parentIndex,i=e.position,o=e.hints,s=this._modeling;v(t,(function(e){u(e.x)||(e.x=0),u(e.y)||(e.y=0)}));var a=vt(y(t,(function(e){return!e.hidden})));v(t,(function(e){hn(e)&&(e.waypoints=k(e.waypoints,(function(e){return{x:Om(e.x-a.x-a.width/2+i.x),y:Om(e.y-a.y-a.height/2+i.y)}}))),I(e,{x:Om(e.x-a.x-a.width/2+i.x),y:Om(e.y-a.y-a.height/2+i.y)})}));var l=ht(t),c={};v(t,(function(e){if(hn(e))c[e.id]=u(r)?s.createConnection(c[e.source.id],c[e.target.id],r,e,e.parent||n,o):s.createConnection(c[e.source.id],c[e.target.id],e,e.parent||n,o);else{var t=I({},o);-1===l.indexOf(e)&&(t.autoResize=!1),fn(e)&&(t=q(t,["attach"])),c[e.id]=u(r)?s.createShape(e,$(e,["x","y","width","height"]),e.parent||n,r,t):s.createShape(e,$(e,["x","y","width","height"]),e.parent||n,t)}})),e.elements=O(c)};var Sm=Math.round;function Cm(e){this._canvas=e}function Tm(e){Cm.call(this,e)}Cm.$inject=["canvas"],Cm.prototype.execute=function(e){var t=e.shape,n=e.position,r=e.parent,i=e.parentIndex;if(!r)throw new Error("parent required");if(!n)throw new Error("position required");return void 0!==n.width?I(t,n):I(t,{x:n.x-Sm(t.width/2),y:n.y-Sm(t.height/2)}),this._canvas.addShape(t,r,i),t},Cm.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t},e(Tm,Cm),Tm.$inject=["canvas"];var Mm=Cm.prototype.execute;Tm.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,Mm.call(this,e)};var Am=Cm.prototype.revert;function Dm(e,t){this._canvas=e,this._modeling=t}function Nm(e,t){this._modeling=e,this._elementRegistry=t}function Rm(e,t){this._canvas=e,this._modeling=t}function jm(e){this._modeling=e}Tm.prototype.revert=function(e){return e.shape.labelTarget=null,Am.call(this,e)},Dm.$inject=["canvas","modeling"],Dm.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;cm(n.incoming,(function(e){t.removeConnection(e,{nested:!0})})),cm(n.outgoing,(function(e){t.removeConnection(e,{nested:!0})}))},Dm.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=Pt(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},Dm.prototype.revert=function(e){var t=e.connection,n=e.parent,r=e.parentIndex;return t.source=e.source,t.target=e.target,Ot(n.children,t,r),this._canvas.addConnection(t,n),t},Nm.$inject=["modeling","elementRegistry"],Nm.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry;v(e.elements,(function(e){n.get(e.id)&&(e.waypoints?t.removeConnection(e):t.removeShape(e))}))},Rm.$inject=["canvas","modeling"],Rm.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;cm(n.incoming,(function(e){t.removeConnection(e,{nested:!0})})),cm(n.outgoing,(function(e){t.removeConnection(e,{nested:!0})})),cm(n.children,(function(e){hn(e)?t.removeConnection(e,{nested:!0}):t.removeShape(e,{nested:!0})}))},Rm.prototype.execute=function(e){var t=this._canvas,n=e.shape,r=n.parent;return e.oldParent=r,e.oldParentIndex=Pt(r.children,n),t.removeShape(n),n},Rm.prototype.revert=function(e){var t=this._canvas,n=e.shape,r=e.oldParent,i=e.oldParentIndex;return Ot(r.children,n,i),t.addShape(n,r),n},jm.$inject=["modeling"];var Lm={x:"y",y:"x"};function Im(e,t){this._layouter=e,this._canvas=t}function zm(){}function Bm(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}function $m(e){this._modeling=e}function qm(e){this._helper=new $m(e)}function Fm(e){this._modeling=e,this._helper=new $m(e)}function Vm(e){this._modeling=e}function Hm(e){return e.original||e}function Um(e,t){this._modeling=e,this._rules=t}function Wm(e){this._modeling=e}function Gm(e){this._modeling=e}function Qm(e){return I({},e)}function Zm(e){switch(e){case"n":case"s":return"y";case"w":case"e":return"x"}}function Xm(e,t,n){var r=Zm(n);return/e|s/.test(n)?e[r]>t:/n|w/.test(n)?e[r]<t:void 0}function Ym(e,t){return-1!==e.indexOf(t)}function Km(e){this._modeling=e}function Jm(e){var t={};return v(e,(function(e){t[e.id]=e.hidden,e.children&&(t=I({},t,Jm(e.children)))})),t}function eg(e,t){var n=[];return v(e,(function(e){e.hidden=t,n=n.concat(e),e.children&&(n=n.concat(eg(e.children,e.collapsed||t)))})),n}function tg(e,t){var n=[];return v(e,(function(e){e.hidden=t[e.id],n=n.concat(e),e.children&&(n=n.concat(tg(e.children,t)))})),n}function ng(e){this._modeling=e}function rg(e,t){return Et(e&&e.attachers,t)}function ig(e,t,n){if(e){var r=e.attachers;r||(e.attachers=r=[]),Ot(r,t,n)}}function og(){}function sg(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var r=this;e.on("diagram.init",(function(){r.registerHandlers(n)}))}function ag(e){this._elementRegistry=e}function lg(e,t){v(t,(function(t,n){e.set(n,t)}))}jm.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,r=e.axis,i=e.dimension;function o(e,t){e.range.min=Math.min(t[r],e.range.min),e.range.max=Math.max(t[r]+t[i],e.range.max)}function s(e){return e[r]+e[i]/2}function a(e){return e.length-1}function l(e){return e.max-e.min}var c,p,u=n[0],d=a(n),h=n[d],f=0;v(n,(function(e,c){var p,u,h;e.elements.length<2?c&&c!==n.length-1&&(o(e,e.elements[0]),f+=l(e.range)):(u=(p=T(e.elements,r))[0],c===d&&(u=p[a(p)]),h=s(u),e.range=null,v(p,(function(n){!function(e,n){var i={y:0};i[r]=e-s(n),i[r]&&(i[Lm[r]]=0,t.moveElements([n],i,n.parent))}(h,n),null!==e.range?o(e,n):e.range={min:n[r],max:n[r]+n[i]}})),c&&c!==n.length-1&&(f+=l(e.range)))})),p=Math.abs(h.range.min-u.range.max),(c=Math.round((p-f)/(n.length-1)))<n.length-1||v(n,(function(e,o){var s,a={};e!==u&&e!==h&&(s=n[o-1],e.range.max=0,v(e.elements,(function(n,o){a[Lm[r]]=0,a[r]=s.range.max-n[r]+c,e.range.min!==n[r]&&(a[r]+=n[r]-e.range.min),a[r]&&t.moveElements([n],a,n.parent),e.range.max=Math.max(n[r]+n[i],o?e.range.max:0)})))}))},jm.prototype.postExecute=function(e){},Im.$inject=["layouter","canvas"],Im.prototype.execute=function(e){var t=e.connection;return I(e,{oldWaypoints:t.waypoints}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},Im.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t},zm.prototype.execute=function(e){var t=e.connection,n=e.delta,r=e.newParent||t.parent,i=e.newParentIndex,o=t.parent;return e.oldParent=o,e.oldParentIndex=Et(o.children,t),Ot(r.children,t,i),t.parent=r,v(t.waypoints,(function(e){e.x+=n.x,e.y+=n.y,e.original&&(e.original.x+=n.x,e.original.y+=n.y)})),t},zm.prototype.revert=function(e){var t=e.connection,n=t.parent,r=e.oldParent,i=e.oldParentIndex,o=e.delta;return Et(n.children,t),Ot(r.children,t,i),t.parent=r,v(t.waypoints,(function(e){e.x-=o.x,e.y-=o.y,e.original&&(e.original.x-=o.x,e.original.y-=o.y)})),t},Bm.prototype.add=function(e,t){return this.addAll([e],t)},Bm.prototype.addAll=function(e,t){var n=function(e,t,n){s(t)&&(t=!0),p(t)&&(n=t,t=!0);var r=xt((n=n||{}).allShapes),i=xt(n.allConnections),o=xt(n.enclosedElements),a=xt(n.enclosedConnections),l=xt(n.topLevel,t&&P(e,(function(e){return e.id})));function c(e){l[e.source.id]&&l[e.target.id]&&(l[e.id]=[e]),r[e.source.id]&&r[e.target.id]&&(a[e.id]=o[e.id]=e),i[e.id]=e}return gt(e,(function(e){if(o[e.id]=e,!e.waypoints)return r[e.id]=e,v(e.incoming,c),v(e.outgoing,c),e.children;a[e.id]=i[e.id]=e})),{allShapes:r,allConnections:i,topLevel:l,enclosedConnections:a,enclosedElements:o}}(e,!!t,this);return I(this,n),this},$m.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},$m.prototype.moveClosure=function(e,t,n,r,i){var o=this._modeling,s=e.allShapes,a=e.allConnections,l=e.enclosedConnections,c=e.topLevel,p=!1;i&&i.parent===n&&(p=!0),v(s,(function(e){o.moveShape(e,t,c[e.id]&&!p&&n,{recurse:!1,layout:!1})})),v(a,(function(e){var r=!!s[e.source.id],i=!!s[e.target.id];l[e.id]&&r&&i?o.moveConnection(e,t,c[e.id]&&!p&&n):o.layoutConnection(e,{connectionStart:r&&bd(e,e.source,t),connectionEnd:i&&wd(e,e.target,t)})}))},$m.prototype.getClosure=function(e){return(new Bm).addAll(e,!0)},qm.$inject=["modeling"],qm.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},qm.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)},Fm.$inject=["modeling"],Fm.prototype.execute=function(e){var t=e.shape,n=e.delta,r=e.newParent||t.parent,i=e.newParentIndex,o=t.parent;return e.oldBounds=$(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=Et(o.children,t),Ot(r.children,t,i),I(t,{parent:r,x:t.x+n.x,y:t.y+n.y}),t},Fm.prototype.postExecute=function(e){var t=e.shape,n=e.delta,r=e.hints,i=this._modeling;!1!==r.layout&&(v(t.incoming,(function(e){i.layoutConnection(e,{connectionEnd:wd(e,t,n)})})),v(t.outgoing,(function(e){i.layoutConnection(e,{connectionStart:bd(e,t,n)})}))),!1!==r.recurse&&this.moveChildren(e)},Fm.prototype.revert=function(e){var t=e.shape,n=e.oldParent,r=e.oldParentIndex,i=e.delta;return Ot(n.children,t,r),I(t,{parent:n,x:t.x-i.x,y:t.y-i.y}),t},Fm.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},Fm.prototype.getNewParent=function(e){return e.newParent||e.shape.parent},Vm.$inject=["modeling"],Vm.prototype.execute=function(e){var t=e.newSource,n=e.newTarget,r=e.connection,i=e.dockingOrPoints;if(!t&&!n)throw new Error("newSource or newTarget required");return c(i)&&(e.oldWaypoints=r.waypoints,r.waypoints=i),t&&(e.oldSource=r.source,r.source=t),n&&(e.oldTarget=r.target,r.target=n),r},Vm.prototype.postExecute=function(e){var t=e.connection,n=e.newSource,r=e.newTarget,i=e.dockingOrPoints,o=e.hints||{},s={};o.connectionStart&&(s.connectionStart=o.connectionStart),o.connectionEnd&&(s.connectionEnd=o.connectionEnd),!1!==o.layoutConnection&&(!n||r&&"source"!==o.docking||(s.connectionStart=s.connectionStart||Hm(c(i)?i[0]:i)),!r||n&&"target"!==o.docking||(s.connectionEnd=s.connectionEnd||Hm(c(i)?i[i.length-1]:i)),o.newWaypoints&&(s.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,s))},Vm.prototype.revert=function(e){var t=e.oldSource,n=e.oldTarget,r=e.oldWaypoints,i=e.connection;return t&&(i.source=t),n&&(i.target=n),r&&(i.waypoints=r),i},Um.$inject=["modeling","rules"],Um.prototype.preExecute=function(e){var t,n=this,r=this._modeling,i=this._rules,o=e.oldShape,s=e.newData,a=e.hints||{};function l(e,t,n){return i.allowed("connection.reconnect",{connection:n,source:e,target:t})}var c,p={x:s.x,y:s.y},u={x:o.x,y:o.y,width:o.width,height:o.height};t=e.newShape=e.newShape||n.createShape(s,p,o.parent,a),o.host&&r.updateAttachment(t,o.host),!1!==a.moveChildren&&(c=o.children.slice(),r.moveElements(c,{x:0,y:0},t,a));var d=o.incoming.slice(),h=o.outgoing.slice();v(d,(function(e){l(e.source,t,e)&&n.reconnectEnd(e,t,vd(e,t,u),a)})),v(h,(function(e){var r=e.target;l(t,r,e)&&n.reconnectStart(e,t,yd(e,t,u),a)}))},Um.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},Um.prototype.execute=function(e){},Um.prototype.revert=function(e){},Um.prototype.createShape=function(e,t,n,r){return this._modeling.createShape(e,t,n,r)},Um.prototype.reconnectStart=function(e,t,n,r){this._modeling.reconnectStart(e,t,n,r)},Um.prototype.reconnectEnd=function(e,t,n,r){this._modeling.reconnectEnd(e,t,n,r)},Wm.$inject=["modeling"],Wm.prototype.execute=function(e){var t=e.shape,n=e.newBounds,r=e.minBounds;if(void 0===n.x||void 0===n.y||void 0===n.width||void 0===n.height)throw new Error("newBounds must have {x, y, width, height} properties");if(r&&(n.width<r.width||n.height<r.height))throw new Error("width and height cannot be less than minimum height and width");if(!r&&n.width<10||n.height<10)throw new Error("width and height cannot be less than 10px");return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},I(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Wm.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,r=e.oldBounds;!1!==(e.hints||{}).layout&&(v(n.incoming,(function(e){t.layoutConnection(e,{connectionEnd:vd(e,n,r)})})),v(n.outgoing,(function(e){t.layoutConnection(e,{connectionStart:yd(e,n,r)})})))},Wm.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return I(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Gm.$inject=["modeling"],Gm.prototype.preExecute=function(e){var t=e.delta,n=e.direction,r=e.movingShapes,i=e.resizingShapes,o=e.start,s={};this.moveShapes(r,t),v(i,(function(e){s[e.id]=function(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}(e)})),this.resizeShapes(i,t,n),this.updateConnectionWaypoints(function(e,t){var n=[];return v(e.concat(t),(function(r){var i=r.incoming,o=r.outgoing;v(i.concat(o),(function(r){var i=r.source,o=r.target;(qf(e,i)||qf(e,o)||qf(t,i)||qf(t,o))&&(qf(n,r)||n.push(r))}))})),n}(r,i),t,n,o,r,i,s)},Gm.prototype.execute=function(){},Gm.prototype.revert=function(){},Gm.prototype.moveShapes=function(e,t){var n=this;v(e,(function(e){n._modeling.moveShape(e,t,null,{autoResize:!1,layout:!1,recurse:!1})}))},Gm.prototype.resizeShapes=function(e,t,n){var r=this;v(e,(function(e){var i=function(e,t,n){var r=e.x,i=e.y,o=e.width,s=e.height,a=n.x,l=n.y;switch(t){case"n":return{x:r,y:i+l,width:o,height:s-l};case"s":return{x:r,y:i,width:o,height:s+l};case"w":return{x:r+a,y:i,width:o-a,height:s};case"e":return{x:r,y:i,width:o+a,height:s};default:throw new Error("unknown direction: "+t)}}(e,n,t);r._modeling.resizeShape(e,i,null,{attachSupport:!1,autoResize:!1,layout:!1})}))},Gm.prototype.updateConnectionWaypoints=function(e,t,n,r,i,o,s){var a=this,l=i.concat(o);v(e,(function(e){var c=e.source,p=e.target,u=function(e){return k(e.waypoints,(function(e){return(e=Qm(e)).original&&(e.original=Qm(e.original)),e}))}(e),d=Zm(n),h={};Ym(l,c)&&Ym(l,p)?(u=k(u,(function(e){return Xm(e,r,n)&&(e[d]=e[d]+t[d]),e.original&&Xm(e.original,r,n)&&(e.original[d]=e.original[d]+t[d]),e})),a._modeling.updateWaypoints(e,u,{labelBehavior:!1})):(Ym(l,c)||Ym(l,p))&&(Ym(i,c)?h.connectionStart=bd(e,c,t):Ym(i,p)?h.connectionEnd=wd(e,p,t):Ym(o,c)?h.connectionStart=yd(e,c,s[c.id]):Ym(o,p)&&(h.connectionEnd=vd(e,p,s[p.id])),a._modeling.layoutConnection(e,h))}))},Km.$inject=["modeling"],Km.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=Jm(n),t.collapsed=!t.collapsed;var r=eg(n,t.collapsed);return[t].concat(r)},Km.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,r=tg(t.children,n);return t.collapsed=!t.collapsed,[t].concat(r)},ng.$inject=["modeling"],ng.prototype.execute=function(e){var t=e.shape,n=e.newHost,r=t.host;return e.oldHost=r,e.attacherIdx=rg(r,t),ig(n,t),t.host=n,t},ng.prototype.revert=function(e){var t=e.shape,n=e.newHost,r=e.oldHost,i=e.attacherIdx;return t.host=r,rg(n,t),ig(r,t,i),t},og.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},og.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t},sg.$inject=["eventBus","elementFactory","commandStack"],sg.prototype.getHandlers=function(){return{"shape.append":km,"shape.create":Cm,"shape.delete":Rm,"shape.move":Fm,"shape.resize":Wm,"shape.replace":Um,"shape.toggleCollapse":Km,spaceTool:Gm,"label.create":Tm,"connection.create":Em,"connection.delete":Dm,"connection.move":zm,"connection.layout":Im,"connection.updateWaypoints":og,"connection.reconnect":Vm,"elements.create":Pm,"elements.move":qm,"elements.delete":Nm,"elements.distribute":jm,"elements.align":_m,"element.updateAttachment":ng}},sg.prototype.registerHandlers=function(e){v(this.getHandlers(),(function(t,n){e.registerHandler(n,t)}))},sg.prototype.moveShape=function(e,t,n,r,i){"object"==typeof r&&(i=r,r=null);var o={shape:e,delta:t,newParent:n,newParentIndex:r,hints:i||{}};this._commandStack.execute("shape.move",o)},sg.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},sg.prototype.moveElements=function(e,t,n,r){var i,o=(r=r||{}).attach,s=n;!0===o?(i=n,s=n.parent):!1===o&&(i=null);var a={shapes:e,delta:t,newParent:s,newHost:i,hints:r};this._commandStack.execute("elements.move",a)},sg.prototype.moveConnection=function(e,t,n,r,i){"object"==typeof r&&(i=r,r=void 0);var o={connection:e,delta:t,newParent:n,newParentIndex:r,hints:i||{}};this._commandStack.execute("connection.move",o)},sg.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},sg.prototype.createConnection=function(e,t,n,r,i,o){"object"==typeof n&&(o=i,i=r,r=n,n=void 0);var s={source:e,target:t,parent:i,parentIndex:n,connection:r=this._create("connection",r),hints:o};return this._commandStack.execute("connection.create",s),s.connection},sg.prototype.createShape=function(e,t,n,r,i){"number"!=typeof r&&(i=r,r=void 0);var o,s,a=(i=i||{}).attach;e=this._create("shape",e),a?(o=n.parent,s=n):o=n;var l={position:t,shape:e,parent:o,parentIndex:r,host:s,hints:i};return this._commandStack.execute("shape.create",l),l.shape},sg.prototype.createElements=function(e,t,n,r,i){c(e)||(e=[e]),"number"!=typeof r&&(i=r,r=void 0);var o={position:t,elements:e,parent:n,parentIndex:r,hints:i=i||{}};return this._commandStack.execute("elements.create",o),o.elements},sg.prototype.createLabel=function(e,t,n,r){n=this._create("label",n);var i={labelTarget:e,position:t,parent:r||e.parent,shape:n};return this._commandStack.execute("label.create",i),i.shape},sg.prototype.appendShape=function(e,t,n,r,i){i=i||{};var o={source:e,position:n,target:r,shape:t=this._create("shape",t),connection:i.connection,connectionParent:i.connectionParent,hints:i};return this._commandStack.execute("shape.append",o),o.shape},sg.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},sg.prototype.distributeElements=function(e,t,n){var r={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",r)},sg.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},sg.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},sg.prototype.replaceShape=function(e,t,n){var r={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",r),r.newShape},sg.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},sg.prototype.resizeShape=function(e,t,n,r){var i={shape:e,newBounds:t,minBounds:n,hints:r};this._commandStack.execute("shape.resize",i)},sg.prototype.createSpace=function(e,t,n,r,i){var o={delta:n,direction:r,movingShapes:e,resizingShapes:t,start:i};this._commandStack.execute("spaceTool",o)},sg.prototype.updateWaypoints=function(e,t,n){var r={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",r)},sg.prototype.reconnect=function(e,t,n,r,i){var o={connection:e,newSource:t,newTarget:n,dockingOrPoints:r,hints:i||{}};this._commandStack.execute("connection.reconnect",o)},sg.prototype.reconnectStart=function(e,t,n,r){r||(r={}),this.reconnect(e,t,e.target,n,I(r,{docking:"source"}))},sg.prototype.reconnectEnd=function(e,t,n,r){r||(r={}),this.reconnect(e,e.source,t,n,I(r,{docking:"target"}))},sg.prototype.connect=function(e,t,n,r){return this.createConnection(e,t,n||{},e.parent,r)},sg.prototype._create=function(e,t){return t instanceof zn?t:this._elementFactory.create(e,t)},sg.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)},ag.$inject=["elementRegistry"],ag.prototype.execute=function(e){var t=e.element,n=e.moddleElement,r=e.properties;if(!n)throw new Error("<moddleElement> required");var i=e.changed||this._getVisualReferences(n).concat(t),o=e.oldProperties||function(e,t){return w(t,(function(t,n){return t[n]=e.get(n),t}),{})}(n,E(r));return lg(n,r),e.oldProperties=o,e.changed=i,i},ag.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,r=e.changed;return lg(n,t),r},ag.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return ki(e,"bpmn:DataObject")?function(e,t){return t.filter((function(t){return ki(t,"bpmn:DataObjectReference")&&Oi(t).dataObjectRef===e}))}(e,t):[]};var cg="default",pg="id",ug="di",dg={width:0,height:0};function hg(e,t,n,r){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=r}function fg(e,t){return pg in e&&e[pg]!==t[pg]}function mg(e,t){var n=e.businessObject,r=Pi(e);v(t,(function(e,t){t!==ug?n.set(t,e):r&&function(e,t){v(t,(function(t,n){e.set(n,t)}))}(r,e)}))}hg.$inject=["elementRegistry","moddle","modeling","textRenderer"],hg.prototype.execute=function(e){var t=e.element,n=[t];if(!t)throw new Error("element required");var r=this._elementRegistry,i=this._moddle.ids,o=t.businessObject,s=function(e){var t=I({},e);return gg.forEach((function(n){n in e&&(t[n]=Oi(t[n]))})),t}(e.properties),a=e.oldProperties||function(e,t){var n=E(t),r=e.businessObject,i=Pi(e);return w(n,(function(e,n){return e[n]=n!==ug?r.get(n):function(e,t){return w(t,(function(t,n){return t[n]=e&&e.get(n),t}),{})}(i,E(t.di)),e}),{})}(t,s);return fg(s,o)&&(i.unclaim(o[pg]),r.updateId(t,s[pg]),i.claim(s[pg],o)),cg in s&&(s[cg]&&n.push(r.get(s[cg].id)),o[cg]&&n.push(r.get(o[cg].id))),mg(t,s),e.oldProperties=a,e.changed=n,n},hg.prototype.postExecute=function(e){var t=e.element.label,n=t&&Oi(t).name;if(n){var r=this._textRenderer.getExternalLabelBounds(t,n);this._modeling.resizeShape(t,r,dg)}},hg.prototype.revert=function(e){var t=e.element,n=e.properties,r=e.oldProperties,i=t.businessObject,o=this._elementRegistry,s=this._moddle.ids;return mg(t,r),fg(n,i)&&(s.unclaim(n[pg]),o.updateId(t,r[pg]),s.claim(r[pg],i)),e.changed};var gg=["default"];function yg(e,t){this._canvas=e,this._modeling=t}function vg(e,t){this._modeling=e,this._spaceTool=t}function bg(e){this._modeling=e}function wg(e,t){this._modeling=e,this._spaceTool=t}yg.$inject=["canvas","modeling"],yg.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,r=n.businessObject,i=t.getRootElement(),o=i.businessObject,s=o.$parent,a=Pi(i);return t.setRootElement(n),t.removeRootElement(i),Ot(s.rootElements,r),r.$parent=s,Et(s.rootElements,o),o.$parent=null,i.di=null,a.bpmnElement=r,n.di=a,e.oldRoot=i,[]},yg.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,r=n.businessObject,i=e.oldRoot,o=i.businessObject,s=r.$parent,a=Pi(n);return t.setRootElement(i),t.removeRootElement(n),Et(s.rootElements,r),r.$parent=null,Ot(s.rootElements,o),o.$parent=s,n.di=null,a.bpmnElement=o,i.di=a,[]},vg.$inject=["modeling","spaceTool"],vg.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,r=e.shape,i=e.location,o=Ru(r),s=o===r,a=s?r:r.parent,l=Nu(a),c=Hi(r);if(c?"left"===i?i="top":"right"===i&&(i="bottom"):"top"===i?i="left":"bottom"===i&&(i="right"),!l.length){var p=c?{x:r.x+Au,y:r.y,width:r.width-Au,height:r.height}:{x:r.x,y:r.y+Au,width:r.width,height:r.height-Au};n.createShape({type:"bpmn:Lane",isHorizontal:c},p,a)}var u,d,h,f,m,g=[];gt(o,(function(e){return g.push(e),e.label&&g.push(e.label),e===r?[]:y(e.children,(function(e){return e!==r}))})),"top"===i?(u=-120,h=(d=r.y)+10,f="n",m="y"):"left"===i?(u=-120,h=(d=r.x)+10,f="w",m="x"):"bottom"===i?(u=120,h=(d=r.y+r.height)-10,f="s",m="y"):"right"===i&&(u=120,h=(d=r.x+r.width)-10,f="e",m="x");var v=t.calculateAdjustments(g,m,u,h),b=c?{x:0,y:u}:{x:u,y:0};t.makeSpace(v.movingShapes,v.resizingShapes,b,f,h);var w=c?{x:r.x+(s?Au:0),y:d-("top"===i?120:0),width:r.width-(s?Au:0),height:120}:{x:d-("left"===i?120:0),y:r.y+(s?Au:0),width:120,height:r.height-(s?Au:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:c},w,a)},bg.$inject=["modeling"],bg.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,r=e.count,i=Nu(n),o=i.length;if(o>r)throw new Error(`more than <${r}> child lanes`);var s,a,l,c,p=Hi(n),u=p?n.height:n.width,d=Math.round(u/r);for(c=0;c<r;c++)s=c===r-1?u-d*c:d,a=p?{x:n.x+Au,y:n.y+c*d,width:n.width-Au,height:s}:{x:n.x+c*d,y:n.y+Au,width:s,height:n.height-Au},c<o?t.resizeShape(i[c],a):(l={type:"bpmn:Lane",isHorizontal:p},t.createShape(l,a,n))},wg.$inject=["modeling","spaceTool"],wg.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds;!1!==e.balanced?this.resizeBalanced(t,n):this.resizeSpace(t,n)},wg.prototype.resizeBalanced=function(e,t){var n=this._modeling,r=ju(e,t);n.resizeShape(e,t),r.forEach((function(e){n.resizeShape(e.shape,e.newBounds)}))},wg.prototype.resizeSpace=function(e,t){var n,r,i,o,s,a=this._spaceTool,l=yn(e),c=Eu(yn(t),l),p=Ru(e),u=[],d=[];gt(p,(function(e){return u.push(e),(ki(e,"bpmn:Lane")||ki(e,"bpmn:Participant"))&&d.push(e),e.children})),(c.bottom||c.top)&&(n=c.bottom||c.top,r=e.y+(c.bottom?e.height:0)+(c.bottom?-10:10),i=c.bottom?"s":"n",o=c.top>0||c.bottom<0?-n:n,s=a.calculateAdjustments(u,"y",o,r),a.makeSpace(s.movingShapes,s.resizingShapes,{x:0,y:n},i)),(c.left||c.right)&&(n=c.right||c.left,r=e.x+(c.right?e.width:0)+(c.right?-10:100),i=c.right?"e":"w",o=c.left>0||c.right<0?-n:n,s=a.calculateAdjustments(d,"x",o,r),a.makeSpace(s.movingShapes,s.resizingShapes,{x:n,y:0},i))};var xg="flowNodeRef",_g="lanes";function kg(e){this._elementRegistry=e}function Eg(e){this._moddle=e}kg.$inject=["elementRegistry"],kg.prototype._computeUpdates=function(e,t){var n=[],r=[],i={},o=[];function s(e){-1===n.indexOf(e)&&(o.push(e),n.push(e))}function a(e){if(!e.parent)return[];var t=function(e){var t=Ru(e);return i[t.id]||(i[t.id]=Du(t)),i[t.id]}(e);return t.filter((function(t){return n=e,r=yn(t),i=n.x+n.width/2,o=n.y+n.height/2,i>r.left&&i<r.right&&o>r.top&&o<r.bottom;var n,r,i,o})).map((function(e){return e.businessObject}))}return t.forEach((function(e){var t=Ru(e);if(t&&-1===n.indexOf(t)){var r=t.children.filter((function(e){return ki(e,"bpmn:FlowNode")}));r.forEach(s),n.push(t)}})),e.forEach(s),o.forEach((function(e){var t=e.businessObject,n=t.get(_g).slice(),i=a(e);r.push({flowNode:t,remove:n,add:i})})),t.forEach((function(e){var t=e.businessObject;e.parent||t.get(xg).forEach((function(e){r.push({flowNode:e,remove:[t],add:[]})}))})),r},kg.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.flowNodeShapes,e.laneShapes)),t.forEach((function(e){var t=e.flowNode,n=t.get(_g);e.remove.forEach((function(e){Et(n,e),Et(e.get(xg),t)})),e.add.forEach((function(e){Ot(n,e),Ot(e.get(xg),t)}))})),[]},kg.prototype.revert=function(e){return e.updates.forEach((function(e){var t=e.flowNode,n=t.get(_g);e.add.forEach((function(e){Et(n,e),Et(e.get(xg),t)})),e.remove.forEach((function(e){Ot(n,e),Ot(e.get(xg),t)}))})),[]},Eg.$inject=["moddle"],Eg.prototype.execute=function(e){var t=this._moddle.ids,n=e.id,r=e.element;return e.claiming?t.claim(n,r):t.unclaim(n),[]},Eg.prototype.revert=function(e){var t=this._moddle.ids,n=e.id,r=e.element;return e.claiming?t.unclaim(n):t.claim(n,r),[]};var Og={fill:void 0,stroke:void 0};function Pg(e){this._commandStack=e,this._normalizeColor=function(e){if(e){if(h(e)){var t=function(e){var t=document.createElement("canvas").getContext("2d");return t.fillStyle="transparent",t.fillStyle=e,/^#[0-9a-fA-F]{6}$/.test(t.fillStyle)?t.fillStyle:null}(e);if(t)return t}throw new Error(`invalid color value: ${e}`)}}}Pg.$inject=["commandStack"],Pg.prototype.postExecute=function(e){var t=e.elements,n=e.colors||Og,r=this,i={};"fill"in n&&I(i,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&I(i,{"border-color":this._normalizeColor(n.stroke)}),v(t,(function(e){var t=hn(e)?$(i,["border-color"]):i,n=Pi(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))r._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:n.label,properties:{color:i["border-color"]}});else{if(!Ei(n,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;r._commandStack.execute("element.updateProperties",{element:e,properties:{di:t}})}}))};var Sg={width:0,height:0};function Cg(e,t,n){function r(e,t){var n=e.label||e,r=e.labelTarget||e;return no(n,t),[n,r]}this.preExecute=function(t){var n=t.element,r=n.businessObject,i=t.newLabel;if(!fn(n)&&Xi(n)&&!Yi(n)&&!Tg(i)){var o=Ji(n);o={x:o.x,y:o.y+7},e.createLabel(n,o,{id:r.id+"_label",businessObject:r,di:n.di})}},this.execute=function(e){return e.oldLabel=to(e.element),r(e.element,e.newLabel)},this.revert=function(e){return r(e.element,e.oldLabel)},this.postExecute=function(n){var r=n.element,i=r.label||r,o=n.newLabel,s=n.newBounds,a=n.hints||{};if(fn(i)||ki(i,"bpmn:TextAnnotation"))if(fn(i)&&Tg(o))!1!==a.removeShape&&e.removeShape(i,{unsetLabel:!1});else{var l=to(r);void 0===s&&(s=t.getExternalLabelBounds(i,l)),s&&e.resizeShape(i,s,Sg)}}}function Tg(e){return!e||!e.trim()}function Mg(e,t,n,r){sg.call(this,e,t,n),this._bpmnRules=r}function Ag(){}Cg.$inject=["modeling","textRenderer","bpmnFactory"],e(Mg,sg),Mg.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],Mg.prototype.getHandlers=function(){var e=sg.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=ag,e["element.updateProperties"]=hg,e["canvas.updateRoot"]=yg,e["lane.add"]=vg,e["lane.resize"]=wg,e["lane.split"]=bg,e["lane.updateRefs"]=kg,e["id.updateClaim"]=Eg,e["element.setColor"]=Pg,e["element.updateLabel"]=Cg,e},Mg.prototype.updateLabel=function(e,t,n,r){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:r||{}})},Mg.prototype.connect=function(e,t,n,r){var i=this._bpmnRules;if(n||(n=i.canConnect(e,t)),n)return this.createConnection(e,t,n,e.parent,r)},Mg.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},Mg.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},Mg.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},Mg.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},Mg.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},Mg.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Mg.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Mg.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},Mg.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},Mg.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},Mg.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})},Ag.prototype.layoutConnection=function(e,t){return[(t=t||{}).connectionStart||wn(t.source||e.source),t.connectionEnd||wn(t.target||e.target)]};var Dg=20,Ng=5,Rg=Math.round,jg=20,Lg={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function Ig(e,t,n){var r,i,o,s=xn(t,e,Ng),a=n.split(":")[0],l=Rg((t.x-e.x)/2+e.x),c=Rg((t.y-e.y)/2+e.y),p=(o=s,{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[a].test(o)),u=/h|r|l/.test(a),d=!1,h=!1;return p?(r=u?{x:l,y:e.y}:{x:e.x,y:c},i=u?"h:h":"v:v"):(d=function(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}(s,a),i=u?"h:v":"v:h",d?u?(h=c===e.y,r={x:e.x+Dg*(/l/.test(a)?-1:1),y:h?c+Dg:c}):r={x:(h=l===e.x)?l+Dg:l,y:e.y+Dg*(/t/.test(a)?-1:1)}:r={x:l,y:c}),{waypoints:Bg(e,r,i).concat(r),directions:i,turnNextDirections:h}}function zg(e){return e.split(":").reverse().join(":")}function Bg(e,t,n){if(!function(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}(n=n||"h:h"))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(Hg(n)){var r=function(e,t,n){return Ig(e,t,n)}(e,t,n),i=function(e,t,n){var r=Ig(t,e,zg(n));return{waypoints:r.waypoints.slice().reverse(),directions:zg(r.directions),turnNextDirections:r.turnNextDirections}}(e,t,n),o=function(e,t){var n=e.directions.split(":")[1],r=t.directions.split(":")[0];e.turnNextDirections&&(n="h"==n?"v":"h"),t.turnNextDirections&&(r="h"==r?"v":"h");var i=n+":"+r;return{waypoints:Bg(e.waypoints[e.waypoints.length-1],t.waypoints[0],i),directions:i}}(r,i);return[].concat(r.waypoints,o.waypoints,i.waypoints)}return function(e,t,n){var r=Rg((t.x-e.x)/2+e.x),i=Rg((t.y-e.y)/2+e.y);if("h:v"===n)return[{x:t.x,y:e.y}];if("v:h"===n)return[{x:e.x,y:t.y}];if("h:h"===n)return[{x:r,y:e.y},{x:r,y:t.y}];if("v:v"===n)return[{x:e.x,y:i},{x:t.x,y:i}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}(e,t,n)}function $g(e,t,n,r,i){var o=b(i&&i.preferredLayouts||[],"straight")[0]||"h:h",s=xn(e,t,Lg[o]||0),a=function(e,t){if(Hg(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||wn(e),r=r||wn(t);var l=a.split(":"),c=Ug(n,e,l[0],function(e){return{top:"bottom",bottom:"top",left:"right",right:"left","top-left":"bottom-right","bottom-right":"top-left","top-right":"bottom-left","bottom-left":"top-right"}[e]}(s));return function(e,t,n){var r=Bg(e,t,n);return r.unshift(e),r.push(t),Wg(r)}(c,Ug(r,t,l[1],s),a)}function qg(e,t,n,r,i,o){var s;return c(n)&&(i=n,o=r,n=wn(e),r=wn(t)),i=i||[],s=-1!==(o=I({preferredLayouts:[]},o)).preferredLayouts.indexOf("straight")&&function(e,t,n,r,i){var o,s,a={};if(s=xn(e,t),!/^(top|bottom|left|right)$/.test(s))return null;/top|bottom/.test(s)&&(o="x");/left|right/.test(s)&&(o="y");return"target"===i.preserveDocking?Fg(o,r,e)?(a[o]=r[o],[{x:void 0!==a.x?a.x:n.x,y:void 0!==a.y?a.y:n.y,original:{x:void 0!==a.x?a.x:n.x,y:void 0!==a.y?a.y:n.y}},{x:r.x,y:r.y}]):null:Fg(o,n,t)?(a[o]=n[o],[{x:n.x,y:n.y},{x:void 0!==a.x?a.x:r.x,y:void 0!==a.y?a.y:r.y,original:{x:void 0!==a.x?a.x:r.x,y:void 0!==a.y?a.y:r.y}}]):null}(e,t,n,r,o),s||(s=o.connectionEnd&&function(e,t,n,r){var i=r.slice().reverse();return i=Vg(e,t,n,i),i?i.reverse():null}(t,e,r,i),s||((s=o.connectionStart&&Vg(e,t,n,i))||(!o.connectionStart&&!o.connectionEnd&&i&&i.length?i:$g(e,t,n,r,o))))}function Fg(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 Vg(e,t,n,r){if(function(e){return e.length<3||!(e.length>4)&&!!m(e,(function(t,n){var r=e[n-1];return r&&St(t,r)<3}))}(r))return null;var i,o=r[0],s=r.slice();return s[0]=n,s[1]=function(e,t,n){switch(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),i=function(e,t,n){var r;for(r=e.length-2;0!==r;r--)if(Dt(e[r],t,jg)||Dt(e[r],n,jg))return e.slice(r);return e}(s,e,t),i!==s&&(s=Vg(e,t,n,i)),s&&Mt(s)?null:s}function Hg(e){return e&&/t|r|b|l/.test(e)}function Ug(e,t,n,r){if("h"===n&&(n=/left/.test(r)?"l":"r"),"v"===n&&(n=/top/.test(r)?"t":"b"),"t"===n)return{original:e,x:e.x,y:t.y};if("r"===n)return{original:e,x:t.x+t.width,y:e.y};if("b"===n)return{original:e,x:e.x,y:t.y+t.height};if("l"===n)return{original:e,x:t.x,y:e.y};throw new Error("unexpected dockingDirection: <"+n+">")}function Wg(e){return e.reduce((function(t,n,r){return Ct(t[t.length-1],e[r+1],n,0)||t.push(n),t}),[])}var Gg=-10,Qg=40,Zg={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},Xg={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},Yg={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},Kg={top:"t",right:"r",bottom:"b",left:"l"};function Jg(e){this._elementRegistry=e}function ey(e,t){return ki(t,"bpmn:Participant")?"source":ki(e,"bpmn:Participant")?"target":iy(t)?"source":iy(e)||ki(t,"bpmn:Event")?"target":ki(e,"bpmn:Event")?"source":null}function ty(e){return iy(e)?"target":"source"}function ny(e,t){return e?e.original||e:wn(t)}function ry(e,t){return ki(t,"bpmn:Activity")&&ki(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function iy(e){return ki(e,"bpmn:SubProcess")&&Vi(e)}function oy(e,t){return e===t}function sy(e){var t=/right|left/.exec(e);return t&&t[0]}function ay(e){var t=/top|bottom/.exec(e);return t&&t[0]}function ly(e,t){return Yg[e]===t}function cy(e){return"right"===e||"left"===e}function py(e,t,n){var r=t.waypoints,i=r&&r.length&&xn(r[0],e);return"top"===i?n.loop.fromTop:"right"===i?n.loop.fromRight:"left"===i?n.loop.fromLeft:n.loop.fromBottom}function uy(e,t,n,r){var i,o,s,a,l=wn(e),c=wn(t),p=(a=(s=e).host,xn(wn(s),a,Gg)),u=oy(e.host,t),d=-1!==["top","right","bottom","left"].indexOf(p),h=xn(c,l,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return u?function(e,t,n,r,i,o){var s,a=t?e:o.isHorizontal?ay(e):sy(e),l=Kg[a];s=t?cy(e)?dy("y",n,r,i)?"h":o.boundaryLoop.alternateHorizontalSide:dy("x",n,r,i)?"v":o.boundaryLoop.alternateVerticalSide:o.boundaryLoop.default;return[l+":"+s]}(p,d,e,t,n,r):(i=function(e,t,n,r){if(n)return Kg[e];var i=ay(e),o=sy(e),s=ay(t),a=sy(t);if(r){if(oy(i,s)||ly(o,a))return Kg[i]}else if(oy(o,a)||ly(i,s))return Kg[o];return Kg[r?o:i]}(p,h,d,r.isHorizontal),o=function(e,t,n,r){if(n)return cy(e)?function(e,t){var n=sy(e),r=Yg[n];return-1!==t.indexOf(r)}(e,t)||oy(e,t)?"h":"v":function(e,t){var n=ay(e),r=Yg[n];return-1!==t.indexOf(r)}(e,t)||oy(e,t)?"v":"h";return r?oy(ay(e),ay(t))?"h":"v":oy(sy(e),sy(t))?"v":"h"}(p,h,d,r.isHorizontal),[i+":"+o])}function dy(e,t,n,r){var i=Qg;return!(hy(e,r,n,i)||hy(e,r,{x:n.x+n.width,y:n.y+n.height},i)||hy(e,r,wn(t),i))}function hy(e,t,n,r){return Math.abs(t[e]-n[e])<r}function fy(e){return I({original:e.point.original||e.point},e.actual)}function my(e,t){this._elementRegistry=e,this._graphicsFactory=t}e(Jg,Ag),Jg.prototype.layoutConnection=function(e,t){t||(t={});var n,r,i=t.source||e.source,o=t.target||e.target,s=t.waypoints||e.waypoints,a=t.connectionStart,l=t.connectionEnd,c=this._elementRegistry;if(a||(a=ny(s&&s[0],i)),l||(l=ny(s&&s[s.length-1],o)),(ki(e,"bpmn:Association")||ki(e,"bpmn:DataAssociation"))&&s&&!ry(i,o))return[].concat([a],s.slice(1,-1),[l]);var p=gc(i,c)?Zg:Xg;return ki(e,"bpmn:MessageFlow")?n=function(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:ey(e,t)}}(i,o,p):(ki(e,"bpmn:SequenceFlow")||ry(i,o))&&(n=i===o?{preferredLayouts:py(i,e,p)}:ki(i,"bpmn:BoundaryEvent")?{preferredLayouts:uy(i,o,l,p)}:iy(i)||iy(o)?{preferredLayouts:p.subProcess,preserveDocking:ty(i)}:ki(i,"bpmn:Gateway")?{preferredLayouts:p.fromGateway}:ki(o,"bpmn:Gateway")?{preferredLayouts:p.toGateway}:{preferredLayouts:p.default}),n&&(r=Wg(qg(i,o,a,l,s,n=I(n,t)))),r||[a,l]},Jg.$inject=["elementRegistry"],my.$inject=["elementRegistry","graphicsFactory"],my.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var r=this.getDockingPoint(e,t,!0),i=this.getDockingPoint(e,n),o=e.waypoints.slice(r.idx+1,i.idx);return o.unshift(fy(r)),o.push(fy(i)),o},my.prototype.getDockingPoint=function(e,t,n){var r,i,o=e.waypoints;return{point:i=o[r=n?0:o.length-1],actual:this._getIntersection(t,e,n)||i,idx:r}},my.prototype._getIntersection=function(e,t,n){return _n(this._getShapePath(e),this._getConnectionPath(t),n)},my.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},my.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},my.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};var gy={__init__:["modeling","bpmnUpdater"],__depends__:[bh,Jh,tf,of,zf,lm,dm,gm,Ds,Vo,sm],bpmnFactory:["type",ym],bpmnUpdater:["type",vm],elementFactory:["type",wm],modeling:["type",Mg],layouter:["type",Jg],connectionDocking:["type",my]};const yy=Math.round;function vy(e,t,n,r,i,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=r,this._layouter=i,this._rules=o}vy.prototype.create=function(e,t,n){const r=this._complexPreview,i=this._connectionDocking,o=this._elementFactory,s=this._eventBus,a=this._layouter,c=this._rules,p=o.createShape(I({type:t},n)),u=s.fire("autoPlace",{source:e,shape:p});if(!u)return;I(p,{x:u.x-yy(p.width/2),y:u.y-yy(p.height/2)});const d=c.allowed("connection.create",{source:e,target:p,hints:{targetParent:e.parent}});let h=null;d&&(h=o.createConnection(d),h.waypoints=a.layoutConnection(h,{source:e,target:p}),h.waypoints=i.getCroppedWaypoints(h,e,p)),r.create({created:[p,h].filter((e=>!l(e)))})},vy.prototype.cleanUp=function(){this._complexPreview.cleanUp()},vy.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];var by={__depends__:[wc,Zp,gy],__init__:["appendPreview"],appendPreview:["type",vy]},wy=Math.min,xy=Math.max;function _y(e){e.preventDefault()}function ky(e){e.stopPropagation()}function Ey(e){this.container=e.container,this.parent=ge('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=ve("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.autoResize=L(this.autoResize,this),this.handlePaste=L(this.handlePaste,this)}function Oy(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new Ey({container:t.getContainer(),keyHandler:L(this._handleKey,this),resizeHandler:L(this._handleResize,this)})}Ey.prototype.create=function(e,t,n,r){var i=this.parent,o=this.content,s=this.container;r=this.options=r||{};var a=$(t=this.style=t||{},["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);I(i.style,{width:e.width+"px",height:e.height+"px",maxWidth:e.maxWidth+"px",maxHeight:e.maxHeight+"px",minWidth:e.minWidth+"px",minHeight:e.minHeight+"px",left:e.x+"px",top:e.y+"px",backgroundColor:"#ffffff",position:"absolute",overflow:"visible",border:"1px solid #ccc",boxSizing:"border-box",wordWrap:"normal",textAlign:"center",outline:"none"},a);var l=$(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return I(o.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},l),r.centerVertically&&I(o.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},l),o.innerText=n,ce.bind(o,"keydown",this.keyHandler),ce.bind(o,"mousedown",ky),ce.bind(o,"paste",this.handlePaste),r.autoResize&&ce.bind(o,"input",this.autoResize),r.resizable&&this.resizable(t),s.appendChild(i),this.setSelection(o.lastChild,o.lastChild&&o.lastChild.length),i},Ey.prototype.handlePaste=function(e){var t,n=this.options,r=this.style;if(e.preventDefault(),t=e.clipboardData?e.clipboardData.getData("text/plain"):window.clipboardData.getData("Text"),this.insertText(t),n.autoResize){var i=this.autoResize(r);i&&this.resizeHandler(i)}},Ey.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)},Ey.prototype._insertTextIE=function(e){var t,n,r,i=this.getSelection(),o=i.startContainer,s=i.endContainer,a=i.startOffset,l=i.endOffset,c=i.commonAncestorContainer,p=(t=c.childNodes,[].slice.call(t));if(function(e){return e.nodeType===Node.TEXT_NODE}(c)){var u=o.textContent;o.textContent=u.substring(0,a)+e+u.substring(l),n=o,r=a+e.length}else if(o===this.content&&s===this.content){var d=document.createTextNode(e);this.content.insertBefore(d,p[a]),n=d,r=d.textContent.length}else{var h=p.indexOf(o),f=p.indexOf(s);p.forEach((function(t,n){n===h?t.textContent=o.textContent.substring(0,a)+e+s.textContent.substring(l):n>h&&n<=f&&we(t)})),n=o,r=a+e.length}n&&void 0!==r&&setTimeout((function(){self.setSelection(n,r)}))},Ey.prototype.autoResize=function(){var e=this.parent,t=this.content,n=parseInt(this.style.fontSize)||12;if(t.scrollHeight>e.offsetHeight||t.scrollHeight<e.offsetHeight-n){var r=e.getBoundingClientRect(),i=t.scrollHeight;e.style.height=i+"px",this.resizeHandler({width:r.width,height:r.height,dx:0,dy:i-r.height})}},Ey.prototype.resizable=function(){var e=this,t=this.parent,n=this.resizeHandle,r=parseInt(this.style.minWidth)||0,i=parseInt(this.style.minHeight)||0,o=parseInt(this.style.maxWidth)||1/0,s=parseInt(this.style.maxHeight)||1/0;if(!n){var a,l,c,p;n=this.resizeHandle=ge('<div class="djs-direct-editing-resize-handle"></div>');var u=function(n){_y(n),ky(n);var u=wy(xy(c+n.clientX-a,r),o),d=wy(xy(p+n.clientY-l,i),s);t.style.width=u+"px",t.style.height=d+"px",e.resizeHandler({width:c,height:p,dx:n.clientX-a,dy:n.clientY-l})},d=function(e){_y(e),ky(e),ce.unbind(document,"mousemove",u,!1),ce.unbind(document,"mouseup",d,!1)};ce.bind(n,"mousedown",(function(e){_y(e),ky(e),a=e.clientX,l=e.clientY;var n=t.getBoundingClientRect();c=n.width,p=n.height,ce.bind(document,"mousemove",u),ce.bind(document,"mouseup",d)}))}I(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)},Ey.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),ce.unbind(t,"keydown",this.keyHandler),ce.unbind(t,"mousedown",ky),ce.unbind(t,"input",this.autoResize),ce.unbind(t,"paste",this.handlePaste),n&&(n.removeAttribute("style"),we(n)),we(e)},Ey.prototype.getValue=function(){return this.content.innerText.trim()},Ey.prototype.getSelection=function(){return window.getSelection().getRangeAt(0)},Ey.prototype.setSelection=function(e,t){var n=document.createRange();null===e?n.selectNodeContents(this.content):(n.setStart(e,t),n.setEnd(e,t));var r=window.getSelection();r.removeAllRanges(),r.addRange(n)},Oy.$inject=["eventBus","canvas"],Oy.prototype.registerProvider=function(e){this._providers.push(e)},Oy.prototype.isActive=function(e){return!(!this._active||e&&this._active.element!==e)},Oy.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},Oy.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},Oy.prototype.close=function(){this._textbox.destroy(),this._fire("deactivate"),this._active=null,this.resizable=void 0,this._canvas.restoreFocus&&this._canvas.restoreFocus()},Oy.prototype.complete=function(){var e=this._active;if(e){var t,n=e.context.bounds,r=this.$textbox.getBoundingClientRect(),i=this.getValue();i===e.context.text&&r.height===n.height&&r.width===n.width||(t=this._textbox.container.getBoundingClientRect(),e.provider.update(e.element,i,e.context.text,{x:r.left-t.left,y:r.top-t.top,width:r.width,height:r.height})),this._fire("complete"),this.close()}},Oy.prototype.getValue=function(){return this._textbox.getValue()},Oy.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())},Oy.prototype._handleResize=function(e){this._fire("resize",e)},Oy.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 Py={__depends__:[Os],__init__:["directEditing"],directEditing:["type",Oy]};function Sy(e){return function(t){var n=t.target,r=Oi(e),i=r.eventDefinitions&&r.eventDefinitions[0],o=r.$type===n.type,s=(i&&i.$type)===n.eventDefinitionType,a=!!n.triggeredByEvent==!!r.triggeredByEvent,l=void 0===n.isExpanded||n.isExpanded===Vi(e);return!(o&&s&&a&&l)}}var Cy=[{label:"Start event",actionName:"replace-with-none-start",className:"bpmn-icon-start-event-none",target:{type:"bpmn:StartEvent"}},{label:"Intermediate throw event",actionName:"replace-with-none-intermediate-throwing",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:IntermediateThrowEvent"}},{label:"End event",actionName:"replace-with-none-end",className:"bpmn-icon-end-event-none",target:{type:"bpmn:EndEvent"}},{label:"Message start event",actionName:"replace-with-message-start",className:"bpmn-icon-start-event-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Timer start event",actionName:"replace-with-timer-start",className:"bpmn-icon-start-event-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition"}},{label:"Conditional start event",actionName:"replace-with-conditional-start",className:"bpmn-icon-start-event-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition"}},{label:"Signal start event",actionName:"replace-with-signal-start",className:"bpmn-icon-start-event-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}}],Ty=[{label:"Start event",actionName:"replace-with-none-start",className:"bpmn-icon-start-event-none",target:{type:"bpmn:StartEvent"}},{label:"Intermediate throw event",actionName:"replace-with-none-intermediate-throwing",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:IntermediateThrowEvent"}},{label:"End event",actionName:"replace-with-none-end",className:"bpmn-icon-end-event-none",target:{type:"bpmn:EndEvent"}}],My=[{label:"Start event",actionName:"replace-with-none-start",className:"bpmn-icon-start-event-none",target:{type:"bpmn:StartEvent"}},{label:"Intermediate throw event",actionName:"replace-with-none-intermediate-throw",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:IntermediateThrowEvent"}},{label:"End event",actionName:"replace-with-none-end",className:"bpmn-icon-end-event-none",target:{type:"bpmn:EndEvent"}},{label:"Message intermediate catch event",actionName:"replace-with-message-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-message",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Message intermediate throw event",actionName:"replace-with-message-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-message",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Timer intermediate catch event",actionName:"replace-with-timer-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-timer",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:TimerEventDefinition"}},{label:"Escalation intermediate throw event",actionName:"replace-with-escalation-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-escalation",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},{label:"Conditional intermediate catch event",actionName:"replace-with-conditional-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-condition",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition"}},{label:"Link intermediate catch event",actionName:"replace-with-link-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-link",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:LinkEventDefinition",eventDefinitionAttrs:{name:""}}},{label:"Link intermediate throw event",actionName:"replace-with-link-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-link",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:LinkEventDefinition",eventDefinitionAttrs:{name:""}}},{label:"Compensation intermediate throw event",actionName:"replace-with-compensation-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-compensation",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},{label:"Signal intermediate catch event",actionName:"replace-with-signal-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-signal",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},{label:"Signal intermediate throw event",actionName:"replace-with-signal-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-signal",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}}],Ay=[{label:"Start event",actionName:"replace-with-none-start",className:"bpmn-icon-start-event-none",target:{type:"bpmn:StartEvent"}},{label:"Intermediate throw event",actionName:"replace-with-none-intermediate-throw",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:IntermediateThrowEvent"}},{label:"End event",actionName:"replace-with-none-end",className:"bpmn-icon-end-event-none",target:{type:"bpmn:EndEvent"}},{label:"Message end event",actionName:"replace-with-message-end",className:"bpmn-icon-end-event-message",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Escalation end event",actionName:"replace-with-escalation-end",className:"bpmn-icon-end-event-escalation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},{label:"Error end event",actionName:"replace-with-error-end",className:"bpmn-icon-end-event-error",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:ErrorEventDefinition"}},{label:"Cancel end event",actionName:"replace-with-cancel-end",className:"bpmn-icon-end-event-cancel",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:CancelEventDefinition"}},{label:"Compensation end event",actionName:"replace-with-compensation-end",className:"bpmn-icon-end-event-compensation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},{label:"Signal end event",actionName:"replace-with-signal-end",className:"bpmn-icon-end-event-signal",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},{label:"Terminate end event",actionName:"replace-with-terminate-end",className:"bpmn-icon-end-event-terminate",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:TerminateEventDefinition"}}],Dy=[{label:"Exclusive gateway",actionName:"replace-with-exclusive-gateway",className:"bpmn-icon-gateway-xor",target:{type:"bpmn:ExclusiveGateway"}},{label:"Parallel gateway",actionName:"replace-with-parallel-gateway",className:"bpmn-icon-gateway-parallel",target:{type:"bpmn:ParallelGateway"}},{label:"Inclusive gateway",actionName:"replace-with-inclusive-gateway",className:"bpmn-icon-gateway-or",target:{type:"bpmn:InclusiveGateway"}},{label:"Complex gateway",actionName:"replace-with-complex-gateway",className:"bpmn-icon-gateway-complex",target:{type:"bpmn:ComplexGateway"}},{label:"Event-based gateway",actionName:"replace-with-event-based-gateway",className:"bpmn-icon-gateway-eventbased",target:{type:"bpmn:EventBasedGateway",instantiate:!1,eventGatewayType:"Exclusive"}}],Ny=[{label:"Transaction",actionName:"replace-with-transaction",className:"bpmn-icon-transaction",target:{type:"bpmn:Transaction",isExpanded:!0}},{label:"Event sub-process",actionName:"replace-with-event-subprocess",className:"bpmn-icon-event-subprocess-expanded",target:{type:"bpmn:SubProcess",triggeredByEvent:!0,isExpanded:!0}},{label:"Sub-process (collapsed)",actionName:"replace-with-collapsed-subprocess",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:SubProcess",isExpanded:!1}}],Ry=[{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:"Event sub-process",actionName:"replace-with-event-subprocess",className:"bpmn-icon-event-subprocess-expanded",target:{type:"bpmn:SubProcess",triggeredByEvent:!0,isExpanded:!0}}],jy=Ry,Ly=[{label:"Task",actionName:"replace-with-task",className:"bpmn-icon-task",target:{type:"bpmn:Task"}},{label:"User task",actionName:"replace-with-user-task",className:"bpmn-icon-user",target:{type:"bpmn:UserTask"}},{label:"Service task",actionName:"replace-with-service-task",className:"bpmn-icon-service",target:{type:"bpmn:ServiceTask"}},{label:"Send task",actionName:"replace-with-send-task",className:"bpmn-icon-send",target:{type:"bpmn:SendTask"}},{label:"Receive task",actionName:"replace-with-receive-task",className:"bpmn-icon-receive",target:{type:"bpmn:ReceiveTask"}},{label:"Manual task",actionName:"replace-with-manual-task",className:"bpmn-icon-manual",target:{type:"bpmn:ManualTask"}},{label:"Business rule task",actionName:"replace-with-rule-task",className:"bpmn-icon-business-rule",target:{type:"bpmn:BusinessRuleTask"}},{label:"Script task",actionName:"replace-with-script-task",className:"bpmn-icon-script",target:{type:"bpmn:ScriptTask"}},{label:"Call activity",actionName:"replace-with-call-activity",className:"bpmn-icon-call-activity",target:{type:"bpmn:CallActivity"}},{label:"Sub-process (collapsed)",actionName:"replace-with-collapsed-subprocess",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:SubProcess",isExpanded:!1}},{label:"Sub-process (expanded)",actionName:"replace-with-expanded-subprocess",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:SubProcess",isExpanded:!0}}],Iy=[{label:"Data store reference",actionName:"replace-with-data-store-reference",className:"bpmn-icon-data-store",target:{type:"bpmn:DataStoreReference"}}],zy=[{label:"Data object reference",actionName:"replace-with-data-object-reference",className:"bpmn-icon-data-object",target:{type:"bpmn:DataObjectReference"}}],By=[{label:"Message boundary event",actionName:"replace-with-message-boundary",className:"bpmn-icon-intermediate-event-catch-message",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:MessageEventDefinition",cancelActivity:!0}},{label:"Timer boundary event",actionName:"replace-with-timer-boundary",className:"bpmn-icon-intermediate-event-catch-timer",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:TimerEventDefinition",cancelActivity:!0}},{label:"Escalation boundary event",actionName:"replace-with-escalation-boundary",className:"bpmn-icon-intermediate-event-catch-escalation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",cancelActivity:!0}},{label:"Conditional boundary event",actionName:"replace-with-conditional-boundary",className:"bpmn-icon-intermediate-event-catch-condition",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",cancelActivity:!0}},{label:"Error boundary event",actionName:"replace-with-error-boundary",className:"bpmn-icon-intermediate-event-catch-error",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ErrorEventDefinition",cancelActivity:!0}},{label:"Cancel boundary event",actionName:"replace-with-cancel-boundary",className:"bpmn-icon-intermediate-event-catch-cancel",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CancelEventDefinition",cancelActivity:!0}},{label:"Signal boundary event",actionName:"replace-with-signal-boundary",className:"bpmn-icon-intermediate-event-catch-signal",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:SignalEventDefinition",cancelActivity:!0}},{label:"Compensation boundary event",actionName:"replace-with-compensation-boundary",className:"bpmn-icon-intermediate-event-catch-compensation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CompensateEventDefinition",cancelActivity:!0}},{label:"Message boundary event (non-interrupting)",actionName:"replace-with-non-interrupting-message-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-message",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:MessageEventDefinition",cancelActivity:!1}},{label:"Timer boundary event (non-interrupting)",actionName:"replace-with-non-interrupting-timer-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-timer",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:TimerEventDefinition",cancelActivity:!1}},{label:"Escalation boundary event (non-interrupting)",actionName:"replace-with-non-interrupting-escalation-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-escalation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",cancelActivity:!1}},{label:"Conditional boundary event (non-interrupting)",actionName:"replace-with-non-interrupting-conditional-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-condition",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",cancelActivity:!1}},{label:"Signal boundary event (non-interrupting)",actionName:"replace-with-non-interrupting-signal-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-signal",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:SignalEventDefinition",cancelActivity:!1}}],$y=[{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}}],qy=[{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"}],Fy=[{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}}],Vy={"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 Hy(e,t,n,r,i,o,s,a){this._bpmnFactory=e,this._popupMenu=t,this._modeling=n,this._moddle=r,this._bpmnReplace=i,this._rules=o,this._translate=s,this._moddleCopy=a,this._register()}Hy.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],Hy.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Hy.prototype.getPopupMenuEntries=function(e){var t=e.businessObject,n=this._rules,r=[];if(c(e)||!n.allowed("shape.replace",{element:e}))return{};var i=Sy(e);return ki(t,"bpmn:DataObjectReference")?this._createEntries(e,Iy):ki(t,"bpmn:DataStoreReference")&&!ki(e.parent,"bpmn:Collaboration")?this._createEntries(e,zy):ki(t,"bpmn:StartEvent")&&!ki(t.$parent,"bpmn:SubProcess")?(r=y(Cy,i),this._createEntries(e,r)):ki(t,"bpmn:Participant")?(r=y(Fy,(function(t){return Vi(e)!==t.target.isExpanded})),this._createEntries(e,r)):ki(t,"bpmn:StartEvent")&&Wi(t.$parent)?(r=y($y,(function(e){var n=!1!==e.target.isInterrupting,r=t.isInterrupting===n;return i(e)||!i(e)&&!r})),this._createEntries(e,r)):ki(t,"bpmn:StartEvent")&&!Wi(t.$parent)&&ki(t.$parent,"bpmn:SubProcess")?(r=y(Ty,i),this._createEntries(e,r)):ki(t,"bpmn:EndEvent")?(r=y(Ay,(function(e){return!("bpmn:CancelEventDefinition"==e.target.eventDefinitionType&&!ki(t.$parent,"bpmn:Transaction"))&&i(e)})),this._createEntries(e,r)):ki(t,"bpmn:BoundaryEvent")?(r=y(By,(function(e){var n=e.target;if("bpmn:CancelEventDefinition"==n.eventDefinitionType&&!ki(t.attachedToRef,"bpmn:Transaction"))return!1;var r=!1!==n.cancelActivity,o=t.cancelActivity==r;return i(e)||!i(e)&&!o})),this._createEntries(e,r)):ki(t,"bpmn:IntermediateCatchEvent")||ki(t,"bpmn:IntermediateThrowEvent")?(r=y(My,i),this._createEntries(e,r)):ki(t,"bpmn:Gateway")?(r=y(Dy,i),this._createEntries(e,r)):ki(t,"bpmn:Transaction")?(r=y(Ry,i),this._createEntries(e,r)):Wi(t)&&Vi(e)?(r=y(jy,i),this._createEntries(e,r)):ki(t,"bpmn:SubProcess")&&Vi(e)?(r=y(Ny,i),this._createEntries(e,r)):ki(t,"bpmn:AdHocSubProcess")&&!Vi(e)?(r=y(Ly,(function(e){var t=e.target,n="bpmn:SubProcess"===t.type,r=!0===t.isExpanded;return Sy(t)&&(!n||r)})),this._createEntries(e,r)):ki(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,qy):ki(t,"bpmn:FlowNode")?(r=y(Ly,i),ki(t,"bpmn:SubProcess")&&!Vi(e)&&(r=y(r,(function(e){return"Sub-process (collapsed)"!==e.label}))),this._createEntries(e,r)):{}},Hy.prototype.getPopupMenuHeaderEntries=function(e){var t={};return ki(e,"bpmn:Activity")&&!Wi(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),ki(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),ki(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),!ki(e,"bpmn:SubProcess")||ki(e,"bpmn:Transaction")||Wi(e)||(t={...t,...this._getAdHocHeaderEntries(e)}),Sd(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},Hy.prototype._createEntries=function(e,t){var n={},r=this;return v(t,(function(t){n[t.actionName]=r._createEntry(t,e)})),n},Hy.prototype._createSequenceFlowEntries=function(e,t){var n=Oi(e),r={},i=this._modeling,o=this._moddle,s=this;return v(t,(function(t){switch(t.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(ki(n.sourceRef,"bpmn:ExclusiveGateway")||ki(n.sourceRef,"bpmn:InclusiveGateway")||ki(n.sourceRef,"bpmn:ComplexGateway")||ki(n.sourceRef,"bpmn:Activity"))&&(r={...r,[t.actionName]:s._createEntry(t,e,(function(){i.updateProperties(e.source,{default:n})}))});break;case"replace-with-conditional-flow":!n.conditionExpression&&ki(n.sourceRef,"bpmn:Activity")&&(r={...r,[t.actionName]:s._createEntry(t,e,(function(){var t=o.create("bpmn:FormalExpression",{body:""});i.updateProperties(e,{conditionExpression:t})}))});break;default:ki(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(r={...r,[t.actionName]:s._createEntry(t,e,(function(){i.updateProperties(e,{conditionExpression:void 0})}))}),(ki(n.sourceRef,"bpmn:ExclusiveGateway")||ki(n.sourceRef,"bpmn:InclusiveGateway")||ki(n.sourceRef,"bpmn:ComplexGateway")||ki(n.sourceRef,"bpmn:Activity"))&&n.sourceRef.default===n&&(r={...r,[t.actionName]:s._createEntry(t,e,(function(){i.updateProperties(e.source,{default:void 0})}))})}})),r},Hy.prototype._createEntry=function(e,t,n){var r=this._translate,i=this._bpmnReplace.replaceElement,o=e.label;return o&&"function"==typeof o&&(o=o(t)),n=n||function(){return i(t,e.target)},{label:r(o),className:e.className,action:n}},Hy.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function r(n,r){if(r.active)t._modeling.updateProperties(e,{loopCharacteristics:void 0});else{var i=e.businessObject.get("loopCharacteristics");i&&ki(i,r.options.loopCharacteristics)?t._modeling.updateModdleProperties(e,i,{isSequential:r.options.isSequential}):(i=t._moddle.create(r.options.loopCharacteristics,{isSequential:r.options.isSequential}),t._modeling.updateProperties(e,{loopCharacteristics:i}))}}var i,o,s,a=Oi(e).loopCharacteristics;return a&&(i=a.isSequential,o=void 0===a.isSequential,s=void 0!==a.isSequential&&!a.isSequential),{"toggle-parallel-mi":{className:"bpmn-icon-parallel-mi-marker",title:n("Parallel multi-instance"),active:s,action:r,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!1}},"toggle-sequential-mi":{className:"bpmn-icon-sequential-mi-marker",title:n("Sequential multi-instance"),active:i,action:r,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!0}},"toggle-loop":{className:"bpmn-icon-loop-marker",title:n("Loop"),active:o,action:r,options:{loopCharacteristics:"bpmn:StandardLoopCharacteristics"}}}},Hy.prototype._getCollectionHeaderEntries=function(e){var t=this,n=this._translate,r=e.businessObject.dataObjectRef;if(!r)return{};var i=r.isCollection;return{"toggle-is-collection":{className:"bpmn-icon-parallel-mi-marker",title:n("Collection"),active:i,action:function(n,i){t._modeling.updateModdleProperties(e,r,{isCollection:!i.active})}}}},Hy.prototype._getParticipantMultiplicityHeaderEntries=function(e){var t=this,n=this._bpmnFactory,r=this._translate;var i=e.businessObject.participantMultiplicity;return{"toggle-participant-multiplicity":{className:"bpmn-icon-parallel-mi-marker",title:r("Participant multiplicity"),active:!!i,action:function(r,i){var o;i.active||(o=n.create("bpmn:ParticipantMultiplicity")),t._modeling.updateProperties(e,{participantMultiplicity:o})}}}},Hy.prototype._getAdHocHeaderEntries=function(e){var t=this._translate,n=ki(Oi(e),"bpmn:AdHocSubProcess"),r=this._bpmnReplace.replaceElement;return{"toggle-adhoc":{className:"bpmn-icon-ad-hoc-marker",title:t("Ad-hoc"),active:n,action:function(t,i){return r(e,n?{type:"bpmn:SubProcess"}:{type:"bpmn:AdHocSubProcess"},{autoResize:!1,layoutConnection:!1})}}}},Hy.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=Oi(e),r=this,i=Cd(e),o=ki(e,"bpmn:BoundaryEvent")?Vy["intermediate-event-non-interrupting"]:Vy["start-event-non-interrupting"],s=!n[i];return{"toggle-non-interrupting":{imageHtml:o,title:t("Toggle non-interrupting"),active:s,action:function(){r._modeling.updateProperties(e,{[i]:!!s})}}}};var Uy={__depends__:[Xl,zf,wc],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Hy]};function Wy(e,t,n,r,i,o,s,a,l,c,p,u,d){e=e||{},r.registerProvider(this),this._contextPad=r,this._modeling=i,this._elementFactory=o,this._connect=s,this._create=a,this._popupMenu=l,this._canvas=c,this._rules=p,this._translate=u,this._eventBus=n,this._appendPreview=d,!1!==e.autoPlace&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,(function(e){var t=e.context.shape;if(ws(e)&&r.isOpen(t)){var n=r.getEntries(t);n.replace&&n.replace.action.click(e,t)}})),n.on("contextPad.close",(function(){d.cleanUp()}))}function Gy(e,t,n){var r=e.$instanceOf(t),i=!1;return v(e.eventDefinitions||[],(function(e){e.$type===n&&(i=!0)})),r&&i}Wy.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],Wy.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&I(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(e,n){t.removeElements(n.slice())}}}}),n},Wy.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return c(t)?x(e,(e=>t.includes(e))):t},Wy.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,r=this._elementFactory,i=this._connect,o=this._create,s=this._popupMenu,a=this._autoPlace,l=this._translate,c=this._appendPreview,p={};if("label"===e.type)return this._isDeleteAllowed([e])&&I(p,f()),p;var u=e.businessObject;function d(e,t){i.start(e,t)}function h(e,t){n.removeElements([t])}function f(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:l("Delete"),action:{click:h}}}}function m(e,t,n,i){function s(t,n){var s=r.createShape(I({type:e},i));o.start(t,s,{source:n})}var l=a?function(t,n){var o=r.createShape(I({type:e},i));a.append(n,o)}:s,p=a?function(t,n){return c.create(n,e,i),()=>{c.cleanUp()}}:null;return{group:"model",className:t,title:n,action:{dragstart:s,click:l,hover:p}}}function g(e){return function(r,i){n.splitLane(i,e),t.open(i,!0)}}if(Ei(u,["bpmn:Lane","bpmn:Participant"])&&Vi(e)){var y=Nu(e);I(p,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:l("Add lane above"),action:{click:function(e,t){n.addLane(t,"top")}}}}),y.length<2&&((Hi(e)?e.height>=120:e.width>=120)&&I(p,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:l("Divide into two lanes"),action:{click:g(2)}}}),(Hi(e)?e.height>=180:e.width>=180)&&I(p,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:l("Divide into three lanes"),action:{click:g(3)}}})),I(p,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:l("Add lane below"),action:{click:function(e,t){n.addLane(t,"bottom")}}}})}return ki(u,"bpmn:FlowNode")&&(ki(u,"bpmn:EventBasedGateway")?I(p,{"append.receive-task":m("bpmn:ReceiveTask","bpmn-icon-receive-task",l("Append receive task")),"append.message-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",l("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",l("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",l("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",l("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):Gy(u,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?I(p,{"append.compensation-activity":m("bpmn:Task","bpmn-icon-task",l("Append compensation activity"),{isForCompensation:!0})}):ki(u,"bpmn:EndEvent")||u.isForCompensation||Gy(u,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")||Wi(u)||I(p,{"append.end-event":m("bpmn:EndEvent","bpmn-icon-end-event-none",l("Append end event")),"append.gateway":m("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",l("Append gateway")),"append.append-task":m("bpmn:Task","bpmn-icon-task",l("Append task")),"append.intermediate-event":m("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",l("Append intermediate/boundary event"))})),s.isEmpty(e,"bpmn-replace")||I(p,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:l("Change element"),action:{click:function(e,n){var r=I(function(e){var n=t.getPad(e).html.getBoundingClientRect();return{x:n.left,y:n.bottom+5}}(n),{cursor:{x:e.x,y:e.y}});s.open(n,"bpmn-replace",r,{title:l("Change element"),width:300,search:!0})}}}}),ki(u,"bpmn:SequenceFlow")&&I(p,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",l("Add text annotation"))}),Ei(u,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&I(p,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",l("Add text annotation")),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:l("Connect to other element"),action:{click:d,dragstart:d}}}),ki(u,"bpmn:TextAnnotation")&&I(p,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:l("Connect using association"),action:{click:d,dragstart:d}}}),Ei(u,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&I(p,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:l("Connect using data input association"),action:{click:d,dragstart:d}}}),ki(u,"bpmn:Group")&&I(p,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",l("Add text annotation"))}),this._isDeleteAllowed([e])&&I(p,f()),p};var Qy={__depends__:[by,Py,Aa,Ds,Bp,yf,Uy],__init__:["contextPadProvider"],contextPadProvider:["type",Wy]},Zy={horizontal:["x","width"],vertical:["y","height"]};function Xy(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:[]}))}Xy.$inject=["modeling","rules"],Xy.prototype.registerFilter=function(e){if("function"!=typeof e)throw new Error("the filter has to be a function");this._filters.push(e)},Xy.prototype.trigger=function(e,t){var n,r,i=this._modeling;if(!(e.length<3||(this._setOrientation(t),r=this._filterElements(e),(n=this._createGroups(r)).length<=2)))return i.distributeElements(n,this._axis,this._dimension),n},Xy.prototype._filterElements=function(e){var t=this._filters,n=this._axis,r=this._dimension,i=[].concat(e);return t.length?(v(t,(function(e){i=e(i,n,r)})),i):e},Xy.prototype._createGroups=function(e){var t=[],n=this,r=this._axis,i=this._dimension;if(!r)throw new Error('must have a defined "axis" and "dimension"');return v(T(e,r),(function(e,o){var s,a=n._findRange(e,r,i),l=t[t.length-1];l&&n._hasIntersection(l.range,a)?t[t.length-1].elements.push(e):(s={range:a,elements:[e]},t.push(s))})),t},Xy.prototype._setOrientation=function(e){var t=Zy[e];this._axis=t[0],this._dimension=t[1]},Xy.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)},Xy.prototype._findRange=function(e){var t=e[this._axis];return{min:t+5,max:t+e[this._dimension]-5}};var Yy={__init__:["distributeElements"],distributeElements:["type",Xy]};function Ky(e){tc.call(this,e)}Ky.$inject=["eventBus"],e(Ky,tc),Ky.prototype.init=function(){this.addRule("elements.distribute",(function(e){var t=e.elements;return!((t=ht(t=y(t,(function(e){var t=Ei(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 Jy={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 ev(e,t,n,r){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=r,e.registerProvider("align-elements",900,this)}ev.$inject=["popupMenu","distributeElements","translate","rules"],ev.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&I(t,this._getEntries(e)),t},ev.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},ev.prototype._getEntries=function(e){var t=this._distributeElements,n=this._translate,r=this._popupMenu;return{"distribute-elements-horizontal":{group:"distribute",title:n("Distribute elements horizontally"),className:"bjs-align-elements-menu-entry",imageHtml:Jy.horizontal,action:function(n,i){t.trigger(e,"horizontal"),r.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:Jy.vertical,action:function(n,i){t.trigger(e,"vertical"),r.close()}}}};var tv={__depends__:[Xl,Yy],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",Ky],distributeElementsMenuProvider:["type",ev]},nv="is not a registered action";function rv(e,t){this._actions={};var n=this;e.on("diagram.init",(function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})}))}function iv(e,t){return new Error(e+" "+t)}rv.$inject=["eventBus","injector"],rv.prototype._registerDefaultActions=function(e){var t=e.get("commandStack",!1),n=e.get("modeling",!1),r=e.get("selection",!1),i=e.get("zoomScroll",!1),o=e.get("copyPaste",!1),s=e.get("canvas",!1),a=e.get("rules",!1),l=e.get("keyboardMove",!1),p=e.get("keyboardMoveSelection",!1);t&&(this.register("undo",(function(){t.undo()})),this.register("redo",(function(){t.redo()}))),o&&r&&this.register("copy",(function(){var e=r.get();if(e.length)return o.copy(e)})),o&&this.register("paste",(function(){o.paste()})),i&&this.register("stepZoom",(function(e){i.stepZoom(e.value)})),s&&this.register("zoom",(function(e){s.zoom(e.value)})),n&&r&&a&&this.register("removeSelection",(function(){var e=r.get();if(e.length){var t,i=a.allowed("elements.delete",{elements:e});!1!==i&&(t=c(i)?i:e).length&&n.removeElements(t.slice())}})),l&&this.register("moveCanvas",(function(e){l.moveCanvas(e)})),p&&this.register("moveSelection",(function(e){p.moveSelection(e.direction,e.accelerated)}))},rv.prototype.trigger=function(e,t){if(!this._actions[e])throw iv(e,nv);return this._actions[e](t)},rv.prototype.register=function(e,t){var n=this;if("string"==typeof e)return this._registerAction(e,t);v(e,(function(e,t){n._registerAction(t,e)}))},rv.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw iv(e,"is already registered");this._actions[e]=t},rv.prototype.unregister=function(e){if(!this.isRegistered(e))throw iv(e,nv);this._actions[e]=void 0},rv.prototype.getActions=function(){return Object.keys(this._actions)},rv.prototype.isRegistered=function(e){return!!this._actions[e]};var ov={__init__:["editorActions"],editorActions:["type",rv]};function sv(e){e.invoke(rv,this)}e(sv,rv),sv.$inject=["injector"],sv.prototype._registerDefaultActions=function(e){rv.prototype._registerDefaultActions.call(this,e);var t=e.get("canvas",!1),n=e.get("elementRegistry",!1),r=e.get("selection",!1),i=e.get("spaceTool",!1),o=e.get("lassoTool",!1),s=e.get("handTool",!1),a=e.get("globalConnect",!1),l=e.get("distributeElements",!1),c=e.get("alignElements",!1),p=e.get("directEditing",!1),u=e.get("searchPad",!1),d=e.get("modeling",!1),h=e.get("contextPad",!1);t&&n&&r&&this._registerAction("selectElements",(function(){var e=t.getRootElement(),i=n.filter((function(t){return t!==e}));return r.select(i),i})),i&&this._registerAction("spaceTool",(function(){i.toggle()})),o&&this._registerAction("lassoTool",(function(){o.toggle()})),s&&this._registerAction("handTool",(function(){s.toggle()})),a&&this._registerAction("globalConnectTool",(function(){a.toggle()})),r&&l&&this._registerAction("distributeElements",(function(e){var t=r.get(),n=e.type;t.length&&l.trigger(t,n)})),r&&c&&this._registerAction("alignElements",(function(e){var t=r.get(),n=[],i=e.type;t.length&&(n=y(t,(function(e){return!ki(e,"bpmn:Lane")})),c.trigger(n,i))})),r&&d&&this._registerAction("setColor",(function(e){var t=r.get();t.length&&d.setColor(t,e)})),r&&p&&this._registerAction("directEditing",(function(){var e=r.get();e.length&&p.activate(e[0])})),u&&this._registerAction("find",(function(){u.toggle()})),t&&d&&this._registerAction("moveToOrigin",(function(){var e,r,i=t.getRootElement();e=vt(r=ki(i,"bpmn:Collaboration")?n.filter((function(e){return ki(e.parent,"bpmn:Collaboration")})):n.filter((function(e){return e!==i&&!ki(e.parent,"bpmn:SubProcess")}))),d.moveElements(r,{x:-e.x,y:-e.y},i)})),r&&h&&this._registerAction("replaceElement",(function(e){h.triggerEntry("replace","click",e)}))};var av={__depends__:[ov],editorActions:["type",sv]};function lv(e){e.on(["create.init","shape.move.init"],(function(e){var t=e.context;Ei(e.shape,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(t.gridSnappingContext||(t.gridSnappingContext={}),t.gridSnappingContext.snapLocation="top-left")}))}lv.$inject=["eventBus"];var cv=10;function pv(e,t,n){return n||(n="round"),Math[n](e/t)*t}function uv(e,t,n){var r=!n||!1!==n.active;this._eventBus=t;var i=this;t.on("diagram.init",800,(function(){i.setActive(r)})),t.on(["create.move","create.end","bendpoint.move.move","bendpoint.move.end","connect.move","connect.end","connectionSegment.move.move","connectionSegment.move.end","resize.move","resize.end","shape.move.move","shape.move.end"],1200,(function(t){var n=t.originalEvent;if(!(!i.active||n&&zs(n))){var r=t.context,o=r.gridSnappingContext;o||(o=r.gridSnappingContext={}),["x","y"].forEach((function(n){var r={},o=function(e,t,n){var r=e.context,i=e.shape,o=r.gridSnappingContext,s=o.snapLocation,a=o.snapOffset;if(a&&u(a[t]))return a[t];a||(a=o.snapOffset={});u(a[t])||(a[t]=0);if(!i)return a[t];n.get(i.id)||(dv(t)?a[t]+=i[t]+i.width/2:a[t]+=i[t]+i.height/2);if(!s)return a[t];"x"===t?/left/.test(s)?a[t]-=i.width/2:/right/.test(s)&&(a[t]+=i.width/2):/top/.test(s)?a[t]-=i.height/2:/bottom/.test(s)&&(a[t]+=i.height/2);return a[t]}(t,n,e);o&&(r.offset=o);var s=function(e,t){var n=e.context,r=n.createConstraints,i=n.resizeConstraints||{},o=n.gridSnappingContext,s=o.snapConstraints;if(s&&s[t])return s[t];s||(s=o.snapConstraints={});s[t]||(s[t]={});var a=n.direction;r&&(dv(t)?(s.x.min=r.left,s.x.max=r.right):(s.y.min=r.top,s.y.max=r.bottom));var l=i.min,c=i.max;l&&(dv(t)?fv(a)?s.x.max=l.left:s.x.min=l.right:hv(a)?s.y.max=l.top:s.y.min=l.bottom);c&&(dv(t)?fv(a)?s.x.min=c.left:s.x.max=c.right:hv(a)?s.y.min=c.top:s.y.max=c.bottom);return s[t]}(t,n);s&&I(r,s),Sp(t,n)||i.snapEvent(t,n,r)}))}}))}function dv(e){return"x"===e}function hv(e){return-1!==e.indexOf("n")}function fv(e){return-1!==e.indexOf("w")}function mv(e,t){Ho.call(this,e),this._gridSnapping=t;var n=this;this.preExecute("shape.resize",(function(e){var t=e.context,r=(t.hints||{}).autoResize;if(r){var i=t.shape,o=t.newBounds;h(r)?t.newBounds=n.snapComplex(o,r):t.newBounds=n.snapSimple(i,o)}}))}uv.prototype.snapEvent=function(e,t,n){Cp(e,t,this.snapValue(e[t],n))},uv.prototype.getGridSpacing=function(){return cv},uv.prototype.snapValue=function(e,t){var n,r,i=0;return t&&t.offset&&(i=t.offset),e=pv(e+=i,cv),t&&t.min&&u(n=t.min)&&(n=pv(n+i,cv,"ceil"),e=Math.max(e,n)),t&&t.max&&u(r=t.max)&&(r=pv(r+i,cv,"floor"),e=Math.min(e,r)),e-=i},uv.prototype.isActive=function(){return this.active},uv.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},uv.prototype.toggleActive=function(){this.setActive(!this.active)},uv.$inject=["elementRegistry","eventBus","config.gridSnapping"],mv.$inject=["eventBus","gridSnapping","modeling"],e(mv,Ho),mv.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},mv.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},mv.prototype.snapHorizontally=function(e,t){var n=this._gridSnapping,r=/w/.test(t),i=/e/.test(t),o={};return o.width=n.snapValue(e.width,{min:e.width}),i&&(r?(o.x=n.snapValue(e.x,{max:e.x}),o.width+=n.snapValue(e.x-o.x,{min:e.x-o.x})):e.x=e.x+e.width-o.width),I(e,o),e},mv.prototype.snapVertically=function(e,t){var n=this._gridSnapping,r=/n/.test(t),i=/s/.test(t),o={};return o.height=n.snapValue(e.height,{min:e.height}),r&&(i?(o.y=n.snapValue(e.y,{max:e.y}),o.height+=n.snapValue(e.y-o.y,{min:e.y-o.y})):e.y=e.y+e.height-o.height),I(e,o),e};function gv(e,t){e.on(["spaceTool.move","spaceTool.end"],2e3,(function(e){var n,r=e.context;r.initialized&&("x"===r.axis?(n=t.snapValue(e.dx),e.x=e.x+n-e.dx,e.dx=n):(n=t.snapValue(e.dy),e.y=e.y+n-e.dy,e.dy=n))}))}gv.$inject=["eventBus","gridSnapping"];var yv={__depends__:[{__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",mv],gridSnappingSpaceToolBehavior:["type",gv]}],__init__:["gridSnapping"],gridSnapping:["type",uv]};function vv(e,t,n){e.on("autoPlace",2e3,(function(e){var r=e.source,i=wn(r),o=e.shape,s=yc(r,o,n);return["x","y"].forEach((function(e){var n={};s[e]!==i[e]&&(s[e]>i[e]?n.min=s[e]:n.max=s[e],ki(o,"bpmn:TextAnnotation")&&(!function(e){return"x"===e}(e)?n.offset=-o.height/2:n.offset=-o.width/2),s[e]=t.snapValue(s[e],n))})),s}))}vv.$inject=["eventBus","gridSnapping","elementRegistry"];function bv(e,t,n){t.on(["create.start","shape.move.start"],1750,(function(t){var r=t.context,i=r.shape,o=e.getRootElement();ki(i,"bpmn:Participant")&&ki(o,"bpmn:Process")&&o.children.length&&(r.createConstraints&&(i.width=n.snapValue(i.width,{min:i.width}),i.height=n.snapValue(i.height,{min:i.height})))}))}bv.$inject=["canvas","eventBus","gridSnapping"];function wv(e,t,n){Ho.call(this,e),this._gridSnapping=t;var r=this;this.postExecuted(["connection.create","connection.layout"],3e3,(function(e){var t=e.context,i=t.connection,o=t.hints||{},s=i.waypoints;o.connectionStart||o.connectionEnd||!1===o.createElementsBehavior||function(e){return e.length>3}(s)&&n.updateWaypoints(i,r.snapMiddleSegments(s))}))}function xv(e,t,n){var r=Mt(t,n),i={};return function(e){return"h"===e}(r)&&(i.y=e.snapValue(t.y)),function(e){return"v"===e}(r)&&(i.x=e.snapValue(t.x)),("x"in i||"y"in i)&&(t=I({},t,i),n=I({},n,i)),[t,n]}wv.$inject=["eventBus","gridSnapping","modeling"],e(wv,Ho),wv.prototype.snapMiddleSegments=function(e){var t,n=this._gridSnapping;e=e.slice();for(var r=1;r<e.length-2;r++)t=xv(n,e[r],e[r+1]),e[r]=t[0],e[r+1]=t[1];return e};var _v={__depends__:[yv,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",vv],gridSnappingParticipantBehavior:["type",bv],gridSnappingLayoutConnectionBehavior:["type",wv]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",lv]};function kv(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],(function(e){var t=e.element,r=e.gfx;return ki(t,"bpmn:Lane")?n._createParticipantHit(t,r):ki(t,"bpmn:Participant")?Vi(t)?n._createParticipantHit(t,r):n._createDefaultHit(t,r):ki(t,"bpmn:SubProcess")?Vi(t)?n._createSubProcessHit(t,r):n._createDefaultHit(t,r):void 0}))}kv.$inject=["eventBus","interactionEvents"],kv.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},kv.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=Hi(e)?{width:30,height:e.height}:{width:e.width,height:30};return this._interactionEvents.createBoxHit(t,"all",n),!0},kv.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 Ev={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",kv]};function Ov(e){e.invoke(Gs,this)}e(Ov,Gs),Ov.$inject=["injector"],Ov.prototype.registerBindings=function(e,t){function n(n,r){t.isRegistered(n)&&e.addListener(r)}Gs.prototype.registerBindings.call(this,e,t),n("selectElements",(function(n){var r=n.keyEvent;if(e.isKey(["a","A"],r)&&e.isCmd(r))return t.trigger("selectElements"),!0})),n("find",(function(n){var r=n.keyEvent;if(e.isKey(["f","F"],r)&&e.isCmd(r))return t.trigger("find"),!0})),n("spaceTool",(function(n){var r=n.keyEvent;if(!e.hasModifier(r))return e.isKey(["s","S"],r)?(t.trigger("spaceTool"),!0):void 0})),n("lassoTool",(function(n){var r=n.keyEvent;if(!e.hasModifier(r))return e.isKey(["l","L"],r)?(t.trigger("lassoTool"),!0):void 0})),n("handTool",(function(n){var r=n.keyEvent;if(!e.hasModifier(r))return e.isKey(["h","H"],r)?(t.trigger("handTool"),!0):void 0})),n("globalConnectTool",(function(n){var r=n.keyEvent;if(!e.hasModifier(r))return e.isKey(["c","C"],r)?(t.trigger("globalConnectTool"),!0):void 0})),n("directEditing",(function(n){var r=n.keyEvent;if(!e.hasModifier(r))return e.isKey(["e","E"],r)?(t.trigger("directEditing"),!0):void 0})),n("replaceElement",(function(n){var r=n.keyEvent;if(!e.hasModifier(r))return e.isKey(["r","R"],r)?(t.trigger("replaceElement",r),!0):void 0}))};var Pv={__depends__:[Qs],__init__:["keyboardBindings"],keyboardBindings:["type",Ov]},Sv={moveSpeed:1,moveSpeedAccelerated:10},Cv="left",Tv="right",Mv="down",Av={ArrowLeft:Cv,Left:Cv,ArrowUp:"up",Up:"up",ArrowRight:Tv,Right:Tv,ArrowDown:Mv,Down:Mv},Dv={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 Nv(e,t,n,r,i){var o=this;this._config=I({},Sv,e||{}),t.addListener(1500,(function(e){var n=e.keyEvent,r=Av[n.key];if(r&&!t.isCmd(n)){var i=t.isShift(n);return o.moveSelection(r,i),!0}})),this.moveSelection=function(e,t){var o=i.get();if(o.length){var s=this._config[t?"moveSpeedAccelerated":"moveSpeed"],a=Dv[e](s);r.allowed("elements.move",{shapes:o})&&n.moveElements(o,a)}}}Nv.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];var Rv={__depends__:[Qs,Ds],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",Nv]};function jv(e,t,n,r){this._dragging=r,this._rules=t;var i=this;function o(e,t){var n,r=e.shape,o=e.direction,s=e.resizeConstraints;e.delta=t,n=function(e,t,n){var r=n.x,i=n.y,o={x:e.x,y:e.y,width:e.width,height:e.height};return-1!==t.indexOf("n")?(o.y=e.y+i,o.height=e.height-i):-1!==t.indexOf("s")&&(o.height=e.height+i),-1!==t.indexOf("e")?o.width=e.width+r:-1!==t.indexOf("w")&&(o.x=e.x+r,o.width=e.width-r),o}(r,o,t),e.newBounds=function(e,t){if(!t)return e;var n=yn(e);return vn({top:Ou("top",n,t),right:Ou("right",n,t),bottom:Ou("bottom",n,t),left:Ou("left",n,t)})}(n,s),e.canExecute=i.canResize(e)}e.on("resize.start",(function(e){var t,n,r;t=e.context,n=t.resizeConstraints,r=t.minBounds,void 0===n&&(void 0===r&&(r=i.computeMinResizeBox(t)),t.resizeConstraints={min:yn(r)})})),e.on("resize.move",(function(e){var t={x:e.dx,y:e.dy};o(e.context,t)})),e.on("resize.end",(function(e){!function(e){var t=e.shape,r=e.canExecute,i=e.newBounds;if(r){if(!function(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}(t,i=mn(i)))return;n.resizeShape(t,i)}}(e.context)}))}function Lv(e,t){var n=wn(e),r=yn(e),i={x:n.x,y:n.y};return-1!==t.indexOf("n")?i.y=r.top:-1!==t.indexOf("s")&&(i.y=r.bottom),-1!==t.indexOf("e")?i.x=r.right:-1!==t.indexOf("w")&&(i.x=r.left),i}function Iv(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"}jv.prototype.canResize=function(e){var t=this._rules,n=$(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},jv.prototype.activate=function(e,t,n){var r,i,o=this._dragging;if("string"==typeof n&&(n={direction:n}),!(i=(r=I({shape:t},n)).direction))throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");o.init(e,Lv(t,i),"resize",{autoActivate:!0,cursor:Iv(i),data:{shape:t,context:r}})},jv.prototype.computeMinResizeBox=function(e){var t=e.shape;return function(e,t,n,r){var i=yn(t),o={top:/n/.test(e)?i.bottom-n.height:i.top,left:/w/.test(e)?i.right-n.width:i.left,bottom:/s/.test(e)?i.top+n.height:i.bottom,right:/e/.test(e)?i.left+n.width:i.right},s=r?yn(r):o;return vn({top:_u(o.top,s.top),left:_u(o.left,s.left),bottom:xu(o.bottom,s.bottom),right:xu(o.right,s.right)})}(e.direction,t,e.minDimensions||{width:10,height:10},Cu(t,e.childrenBoxPadding))},jv.$inject=["eventBus","rules","modeling","dragging"];var zv="djs-resizing",Bv="resize-not-ok";function $v(e,t,n){e.on("resize.move",500,(function(e){var r,i,o,s;r=e.context,i=r.shape,o=r.newBounds,(s=r.frame)||(s=r.frame=n.addFrame(i,t.getActiveLayer()),t.addMarker(i,zv)),o.width>5&&Oe(s,{x:o.x,width:o.width}),o.height>5&&Oe(s,{y:o.y,height:o.height}),r.canExecute?Se(s).remove(Bv):Se(s).add(Bv)})),e.on("resize.cleanup",(function(e){var n,r;n=e.context,r=n.shape,n.frame&&Ue(n.frame),t.removeMarker(r,zv)}))}$v.$inject=["eventBus","canvas","previewSupport"];var qv=-6,Fv="djs-resizer",Vv=["n","w","s","e","nw","ne","se","sw"];function Hv(e,t,n,r){this._resize=r,this._canvas=t;var i=this;e.on("selection.changed",(function(e){var t=e.newSelection;i.removeResizers(),1===t.length&&v(t,L(i.addResizer,i))})),e.on("shape.changed",(function(e){var t=e.element;n.isSelected(t)&&(i.removeResizers(),i.addResizer(t))}))}Hv.prototype.makeDraggable=function(e,t,n){var r=this._resize;function i(t){bs(t)&&r.activate(t,e,n)}ce.bind(t,"mousedown",i),ce.bind(t,"touchstart",i)},Hv.prototype._createResizer=function(e,t,n,r){var i=this._getResizersParent(),o=function(e){var t={x:0,y:0};-1!==e.indexOf("e")?t.x=6:-1!==e.indexOf("w")&&(t.x=qv);-1!==e.indexOf("s")?t.y=6:-1!==e.indexOf("n")&&(t.y=qv);return t}(r),s=Re("g");Se(s).add(Fv),Se(s).add(Fv+"-"+e.id),Se(s).add(Fv+"-"+r),xe(i,s);var a=Re("rect");Oe(a,{x:-4+o.x,y:-4+o.y,width:8,height:8}),Se(a).add(Fv+"-visual"),xe(s,a);var l=Re("rect");return Oe(l,{x:-10+o.x,y:-10+o.y,width:20,height:20}),Se(l).add(Fv+"-hit"),xe(s,l),Xn(s,t,n),s},Hv.prototype.createResizer=function(e,t){var n=Lv(e,t),r=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,r,t)},Hv.prototype.addResizer=function(e){var t=this;!hn(e)&&this._resize.canResize({shape:e})&&v(Vv,(function(n){t.createResizer(e,n)}))},Hv.prototype.removeResizers=function(){Te(this._getResizersParent())},Hv.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},Hv.$inject=["eventBus","canvas","selection","resize"];var Uv={__depends__:[Ic,Dc,Wp],__init__:["resize","resizePreview","resizeHandles"],resize:["type",jv],resizePreview:["type",$v],resizeHandles:["type",Hv]};function Wv(e,t,n,r,i,o,s){function a(e,t){(t||Ei(e,["bpmn:Task","bpmn:TextAnnotation","bpmn:Participant"])||Gv(e))&&r.activate(e)}this._bpmnFactory=t,this._canvas=n,this._modeling=i,this._textRenderer=s,r.registerProvider(this),e.on("element.dblclick",(function(e){a(e.element,!0)})),e.on(["autoPlace.start","canvas.viewbox.changing","drag.init","element.mousedown","popupMenu.open","root.set","selection.changed"],(function(){r.isActive()&&r.complete()})),e.on(["shape.remove","connection.remove"],2e3,(function(e){r.isActive(e.element)&&r.cancel()})),e.on(["commandStack.changed"],(function(e){r.isActive()&&r.cancel()})),e.on("directEditing.activate",(function(e){o.removeResizers()})),e.on("create.end",500,(function(e){var t=e.context,n=t.shape,r=e.context.canExecute;e.isTouch||r&&(t.hints&&!1===t.hints.createElementsBehavior||a(n))})),e.on("autoPlace.end",500,(function(e){a(e.shape)}))}function Gv(e){return ki(e,"bpmn:SubProcess")&&!Vi(e)}Wv.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],Wv.prototype.activate=function(e){var t=to(e);if(void 0!==t){var n={text:t};I(n,this.getEditingBBox(e));var r={},i=n.style||{};return I(i,{backgroundColor:null,border:null}),(Ei(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||Gv(e))&&I(r,{centerVertically:!0}),Xi(e)&&(I(r,{autoResize:!0}),I(i,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),ki(e,"bpmn:TextAnnotation")&&(I(r,{resizable:!0,autoResize:!0}),I(i,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),I(n,{options:r,style:i}),n}},Wv.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,r=t.getAbsoluteBBox(n),i=r.x+r.width/2,o=r.y+r.height/2,s={x:r.x,y:r.y},a=t.zoom(),l=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),p=c.fontSize*a,u=c.lineHeight,d=l.fontSize*a,h=l.lineHeight,f={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(ki(e,"bpmn:Lane")||function(e){return ki(e,"bpmn:Participant")&&Vi(e)}(e)){var m=Hi(e);I(s,m?{width:r.height,height:30*a,x:r.x-r.height/2+15*a,y:o-30*a/2}:{width:r.width,height:30*a}),I(f,{fontSize:d+"px",lineHeight:h,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:m?"rotate(-90deg)":null})}if(function(e){return ki(e,"bpmn:Participant")&&!Vi(e)}(e)){var g=Hi(e);I(s,g?{width:r.width,height:r.height}:{width:r.height,height:r.width,x:i-r.height/2,y:o-r.width/2}),I(f,{fontSize:d+"px",lineHeight:h,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:g?null:"rotate(-90deg)"})}(Ei(e,["bpmn:Task","bpmn:CallActivity"])||Gv(e))&&(I(s,{width:r.width,height:r.height}),I(f,{fontSize:d+"px",lineHeight:h,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),function(e){return ki(e,"bpmn:SubProcess")&&Vi(e)}(e)&&(I(s,{width:r.width,x:r.x}),I(f,{fontSize:d+"px",lineHeight:h,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var y=90*a,v=7*a,b=4*a;if(n.labelTarget&&(I(s,{width:y,height:r.height+v+b,x:i-y/2,y:r.y-v}),I(f,{fontSize:p+"px",lineHeight:u,paddingTop:v+"px",paddingBottom:b+"px"})),Xi(n)&&!Yi(n)&&!fn(n)){var w=Ji(e),x=t.getAbsoluteBBox({x:w.x,y:w.y,width:0,height:0}),_=p+v+b;I(s,{width:y,height:_,x:x.x-y/2,y:x.y-_/2}),I(f,{fontSize:p+"px",lineHeight:u,paddingTop:v+"px",paddingBottom:b+"px"})}return ki(e,"bpmn:TextAnnotation")&&(I(s,{width:r.width,height:r.height,minWidth:30*a,minHeight:10*a}),I(f,{textAlign:"left",paddingTop:5*a+"px",paddingBottom:7*a+"px",paddingLeft:7*a+"px",paddingRight:5*a+"px",fontSize:d+"px",lineHeight:h})),{bounds:s,style:f}},Wv.prototype.update=function(e,t,n,r){var i,o,s;ki(e,"bpmn:TextAnnotation")&&(o=this._canvas.getAbsoluteBBox(e),i={x:e.x,y:e.y,width:e.width/o.width*r.width,height:e.height/o.height*r.height}),(s=t)&&s.trim()||(t=null),this._modeling.updateLabel(e,t,i)};var Qv="djs-element-hidden",Zv="djs-label-hidden";function Xv(e,t,n){var r,i,o,s=this,a=t.getDefaultLayer();e.on("directEditing.activate",(function(e){var l=e.active;if(ki(r=l.element.label||l.element,"bpmn:TextAnnotation")){i=t.getAbsoluteBBox(r),o=Re("g");var c=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:r.width,containerHeight:r.height,position:{mx:0,my:0}}),p=s.path=Re("path");Oe(p,{d:c,strokeWidth:2,stroke:Yv(r)}),xe(o,p),xe(a,o),Yn(o,r.x,r.y)}ki(r,"bpmn:TextAnnotation")||r.labelTarget?t.addMarker(r,Qv):(ki(r,"bpmn:Task")||ki(r,"bpmn:CallActivity")||ki(r,"bpmn:SubProcess")||ki(r,"bpmn:Participant")||ki(r,"bpmn:Lane"))&&t.addMarker(r,Zv)})),e.on("directEditing.resize",(function(e){if(ki(r,"bpmn:TextAnnotation")){var t=e.height,o=e.dy,a=Math.max(r.height/i.height*(t+o),0),l=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:r.width,containerHeight:a,position:{mx:0,my:0}});Oe(s.path,{d:l})}})),e.on(["directEditing.complete","directEditing.cancel"],(function(e){var n=e.active;n&&(t.removeMarker(n.element.label||n.element,Qv),t.removeMarker(r,Zv)),r=void 0,i=void 0,o&&(Ue(o),o=void 0)}))}function Yv(e,t){return Pi(e).get("stroke")||t||"black"}Xv.$inject=["eventBus","canvas","pathMap"];var Kv={__depends__:[Vo,Uv,Py],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Wv],labelEditingPreview:["type",Xv]},Jv=new jo("tt");function eb(e,t){e.style.display=!1===t?"none":""}var tb="djs-tooltip",nb="."+tb;function rb(e,t){var n,r;this._eventBus=e,this._canvas=t,this._ids=Jv,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=(n=t.getContainer(),Z(r=ge('<div class="djs-tooltip-container" />'),{position:"absolute",width:"0",height:"0"}),n.insertBefore(r,n.firstChild),r);var i=this;de.bind(this._tooltipRoot,nb,"mousedown",(function(e){e.stopPropagation()})),de.bind(this._tooltipRoot,nb,"mouseover",(function(e){i.trigger("mouseover",e)})),de.bind(this._tooltipRoot,nb,"mouseout",(function(e){i.trigger("mouseout",e)})),this._init()}rb.$inject=["eventBus","canvas"],rb.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=I({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},rb.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,r=this.get(X(n,"data-tooltip-id"));r&&("mouseover"===e&&r.timeout&&this.clearTimeout(r),"mouseout"===e&&r.timeout&&(r.timeout=1e3,this.setTimeout(r)))},rb.prototype.get=function(e){return"string"!=typeof e&&(e=e.id),this._tooltips[e]},rb.prototype.clearTimeout=function(e){if(e=this.get(e)){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},rb.prototype.setTimeout=function(e){if(e=this.get(e)){this.clearTimeout(e);var t=this;e.removeTimer=setTimeout((function(){t.remove(e)}),e.timeout)}},rb.prototype.remove=function(e){var t=this.get(e);t&&(we(t.html),we(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},rb.prototype.show=function(){eb(this._tooltipRoot)},rb.prototype.hide=function(){eb(this._tooltipRoot,!1)},rb.prototype._updateRoot=function(e){var t=e.scale||1,n=e.scale||1,r="matrix("+t+",0,0,"+n+","+-1*e.x*t+","+-1*e.y*n+")";this._tooltipRoot.style.transform=r,this._tooltipRoot.style["-ms-transform"]=r},rb.prototype._addTooltip=function(e){var t,n=e.id,r=e.html,i=this._tooltipRoot;r.get&&r.constructor.prototype.jquery&&(r=r.get(0)),h(r)&&(r=ge(r)),Z(t=ge('<div data-tooltip-id="'+n+'" class="'+tb+'">'),{position:"absolute"}),t.appendChild(r),e.type&&K(t).add("djs-tooltip-"+e.type),e.className&&K(t).add(e.className),e.htmlContainer=t,i.appendChild(t),this._tooltips[n]=e,this._updateTooltip(e)},rb.prototype._updateTooltip=function(e){var t=e.position;!function(e,t,n){Z(e,{left:t+"px",top:n+"px"})}(e.htmlContainer,t.x,t.y)},rb.prototype._updateTooltipVisibilty=function(e){v(this._tooltips,(function(t){var n=t.show,r=t.htmlContainer,i=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(i=!1),eb(r,i))}))},rb.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 ib={__init__:["tooltips"],tooltips:["type",rb]};function ob(e,t,n){e.on(["shape.move.rejected","create.rejected"],(function(e){var r,i,o=e.context,s=o.shape;ki(o.target,"bpmn:Collaboration")&&ki(s,"bpmn:FlowNode")&&(r=e,i=n("flow elements must be children of pools/participants"),t.add({position:{x:r.x+5,y:r.y+5},type:"error",timeout:2e3,html:"<div>"+i+"</div>"}))}))}ob.$inject=["eventBus","tooltips","translate"];var sb={__depends__:[ib],__init__:["modelingFeedback"],modelingFeedback:["type",ob]};function ab(e,t){this._eventBus=e,this.offset=5;var n=t.cls("djs-outline",["no-fill"]),r=this;function i(e){var t=Re("rect");return Oe(t,I({x:0,y:0,rx:4,width:100,height:100},n)),t}e.on(["shape.added","shape.changed"],500,(function(e){var t=e.element,n=e.gfx,o=ve(".djs-outline",n);o||xe(n,o=r.getOutline(t)||i()),r.updateShapeOutline(o,t)})),e.on(["connection.added","connection.changed"],(function(e){var t=e.element,n=e.gfx,o=ve(".djs-outline",n);o||xe(n,o=i()),r.updateConnectionOutline(o,t)}))}ab.prototype.updateShapeOutline=function(e,t){var n=!1,r=this._getProviders();r.length&&v(r,(function(r){n=n||r.updateOutline(t,e)})),n||Oe(e,{x:-this.offset,y:-this.offset,width:t.width+2*this.offset,height:t.height+2*this.offset})},ab.prototype.updateConnectionOutline=function(e,t){var n=vt(t);Oe(e,{x:n.x-this.offset,y:n.y-this.offset,width:n.width+2*this.offset,height:n.height+2*this.offset})},ab.prototype.registerProvider=function(e,t){t||(t=e,e=1e3),this._eventBus.on("outline.getProviders",e,(function(e){e.providers.push(t)}))},ab.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},ab.prototype.getOutline=function(e){var t;return v(this._getProviders(),(function(n){d(n.getOutline)&&(t=t||n.getOutline(e))})),t},ab.$inject=["eventBus","styles","elementRegistry"];function lb(e,t,n){this._canvas=t;var r=this;e.on("element.changed",(function(e){n.isSelected(e.element)&&r._updateMultiSelectionOutline(n.get())})),e.on("selection.changed",(function(e){var t=e.newSelection;r._updateMultiSelectionOutline(t)}))}lb.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");Te(t);var n=e.length>1;if(Se(this._canvas.getContainer())[n?"add":"remove"]("djs-multi-select"),n){var r=function(e){return{x:e.x-6,y:e.y-6,width:e.width+12,height:e.height+12}}(vt(e)),i=Re("rect");Oe(i,I({rx:3},r)),Se(i).add("djs-selection-outline"),xe(t,i)}},lb.$inject=["eventBus","canvas","selection"];var cb={__depends__:[Ds],__init__:["outline","multiSelectionOutline"],outline:["type",ab],multiSelectionOutline:["type",lb]},pb=Math.round;function ub(e,t,n,r,i){function o(e,t,n,r){return i.allowed("elements.move",{shapes:e,delta:t,position:n,target:r})}function s(e,n,r,i){if(p(r)&&(i=r,r=!1),!n.waypoints&&n.parent&&!Se(e.target).has("djs-hit-no-move")){var o=function(e){return{x:e.x+pb(e.width/2),y:e.y+pb(e.height/2)}}(n);return t.init(e,o,"shape.move",{cursor:"grabbing",autoActivate:r,data:{shape:n,context:i||{}}}),!0}}e.on("shape.move.start",1500,(function(e){var t=e.context,n=e.shape,i=r.get().slice();-1===i.indexOf(n)&&(i=[n]),i=function(e){var t=P(e,"id");return y(e,(function(e){for(;e=e.parent;)if(t[e.id])return!1;return!0}))}(i),I(t,{shapes:i,validatedShapes:i,shape:n})})),e.on("shape.move.start",1250,(function(e){var t=e.context,n=t.validatedShapes;if(!(t.canExecute=o(n)))return!1})),e.on("shape.move.move",500,(function(e){var t,n=e.context,r=n.validatedShapes,i=e.hover,s={x:e.dx,y:e.dy};t=o(r,s,{x:e.x,y:e.y},i),n.delta=s,n.canExecute=t,n.target=null!==t?i:null})),e.on("shape.move.end",(function(e){var t=e.context,r=t.delta,i=t.canExecute,o="attach"===i,s=t.shapes;if(!1===i)return!1;r.x=pb(r.x),r.y=pb(r.y),0===r.x&&0===r.y||n.moveElements(s,r,t.target,{primaryShape:t.shape,attach:o})})),e.on("element.mousedown",(function(e){if(bs(e)){var t=fs(e);if(!t)throw new Error("must supply DOM mousedown event");return s(t,e.element)}})),this.start=s}ub.$inject=["eventBus","dragging","modeling","selection","rules"];var db="djs-dragging",hb="drop-ok",fb="drop-not-ok",mb="new-parent",gb="attach-ok";function yb(e,t,n,i){function o(e){var t=function(e){var t=y(e,(function(t){return!hn(t)||m(e,M({id:t.source.id}))&&m(e,M({id:t.target.id}))}));return t}(s(e));return t}function s(e){var t=yt(e,!0),n=t.flatMap((e=>(e.incoming||[]).concat(e.outgoing||[]))),r=t.concat(n);return[...new Set(r)]}function a(e,n){[gb,hb,fb,mb].forEach((function(r){r===n?t.addMarker(e,r):t.removeMarker(e,r)}))}e.on("shape.move.start",499,(function(e){var a,l=e.context,c=l.shapes,p=l.allDraggedElements,u=o(c);if(!l.dragGroup){var d=Re("g");Oe(d,n.cls("djs-drag-group",["no-events"])),xe(t.getActiveLayer(),d),l.dragGroup=d}u.forEach((function(e){i.addDragger(e,l.dragGroup)})),v(p=p?r([p,s(c)]):s(c),(function(e){t.addMarker(e,db)})),l.allDraggedElements=p,l.differentParents=1!==(a=P(c,(function(e){return e.parent&&e.parent.id})),E(a).length)})),e.on("shape.move.move",499,(function(e){var t=e.context,n=t.dragGroup,r=t.target,i=t.shape.parent,o=t.canExecute;r&&("attach"===o?a(r,gb):t.canExecute&&i&&r.id!==i.id?a(r,mb):a(r,t.canExecute?hb:fb)),Yn(n,e.dx,e.dy)})),e.on(["shape.move.out","shape.move.cleanup"],(function(e){var t=e.context.target;t&&a(t,null)})),e.on("shape.move.cleanup",(function(e){var n=e.context,r=n.allDraggedElements,i=n.dragGroup;v(r,(function(e){t.removeMarker(e,db)})),i&&Ue(i)})),this.makeDraggable=function(e,n,r){i.addDragger(n,e.dragGroup),r&&t.addMarker(n,db),e.allDraggedElements?e.allDraggedElements.push(n):e.allDraggedElements=[n]}}yb.$inject=["eventBus","canvas","styles","previewSupport"];var vb={__depends__:[Os,Ds,cb,Ic,Dc,Wp],__init__:["move","movePreview"],move:["type",ub],movePreview:["type",yb]},bb=".djs-palette-toggle",wb=".entry",xb=bb+", "+wb,_b="djs-palette-",kb="open",Eb="two-column";function Ob(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 Pb(e,t){var n=t.getPaletteEntries();return d(n)?n(e):(v(n,(function(t,n){e[n]=t})),e)}Ob.$inject=["eventBus","canvas"],Ob.prototype.registerProvider=function(e,t){t||(t=e,e=1e3),this._eventBus.on("palette.getProviders",e,(function(e){e.providers.push(t)})),this._rebuild()},Ob.prototype.getEntries=function(){return this._getProviders().reduce(Pb,{})},Ob.prototype._rebuild=function(){this._diagramInitialized&&(this._getProviders().length&&(this._container||this._init(),this._update()))},Ob.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),r=this._container=ge(Ob.HTML_MARKUP);n.appendChild(r),K(n).add(_b+"shown"),de.bind(r,xb,"click",(function(t){if(ye(t.delegateTarget,bb))return e.toggle();e.trigger("click",t)})),ce.bind(r,"mousedown",(function(e){e.stopPropagation()})),de.bind(r,wb,"dragstart",(function(t){e.trigger("dragstart",t)})),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:r})},Ob.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},Ob.prototype._toggleState=function(e){e=e||{};var t,n=this._getParentContainer(),r=this._container,i=this._eventBus,o=K(r),s=K(n);t="twoColumn"in e?e.twoColumn:this._needsCollapse(n.clientHeight,this._entries||{}),o.toggle(Eb,t),s.toggle(_b+Eb,t),"open"in e&&(o.toggle(kb,e.open),s.toggle(_b+kb,e.open)),i.fire("palette.changed",{twoColumn:t,open:this.isOpen()})},Ob.prototype._update=function(){var e=ve(".djs-palette-entries",this._container),t=this._entries=this.getEntries();ee(e),v(t,(function(t,n){var r=t.group||"default",i=ve("[data-group="+Qo(r)+"]",e);i||(X(i=ge('<div class="group"></div>'),"data-group",r),e.appendChild(i));var o=t.html||(t.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=ge(o);if(i.appendChild(s),!t.separator&&(X(s,"data-action",n),t.title&&X(s,"title",t.title),t.className&&function(e,t){var n=K(e),r=c(t)?t:t.split(/\s+/g);r.forEach((function(e){n.add(e)}))}(s,t.className),t.imageUrl)){var a=ge("<img>");X(a,"src",t.imageUrl),s.appendChild(a)}})),this.open()},Ob.prototype.trigger=function(e,t,n){var r,i,o=t.delegateTarget||t.target;return o?(r=X(o,"data-action"),i=t.originalEvent||t,this.triggerEntry(r,e,i,n)):t.preventDefault()},Ob.prototype.triggerEntry=function(e,t,n,r){var i,o;if((i=this._entries[e])&&(o=i.action,!1!==this._eventBus.fire("palette.trigger",{entry:i,event:n}))){if(d(o)){if("click"===t)return o(n,r)}else if(o[t])return o[t](n,r);n.preventDefault()}},Ob.prototype._layoutChanged=function(){this._toggleState({})},Ob.prototype._needsCollapse=function(e,t){return e<46*Object.keys(t).length+50},Ob.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},Ob.prototype.open=function(){this._toggleState({open:!0})},Ob.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Ob.prototype.isActiveTool=function(e){return e&&this._activeTool===e},Ob.prototype.updateToolHighlight=function(e){var t;this._toolsContainer||(t=ve(".djs-palette-entries",this._container),this._toolsContainer=ve("[data-group=tools]",t)),v(this._toolsContainer.children,(function(t){var n=t.getAttribute("data-action");if(n){var r=K(t);n=n.replace("-tool",""),r.contains("entry")&&n===e?r.add("highlighted-entry"):r.remove("highlighted-entry")}}))},Ob.prototype.isOpen=function(){return K(this._container).has(kb)},Ob.prototype._getParentContainer=function(){return this._canvas.getContainer()},Ob.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';var Sb={__init__:["palette"],palette:["type",Ob]},Cb="crosshair";function Tb(e,t,n,r,i,o,s){this._selection=i,this._dragging=n,this._mouse=s;var a=this,l=function(e){var n,r=t.getActiveLayer();Oe(n=e.frame=Re("rect"),{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),xe(r,n)},c=function(e){var t=e.frame,n=e.bbox;Oe(t,{x:n.x,y:n.y,width:n.width,height:n.height})},p=function(e){e.frame&&Ue(e.frame)};o.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",(function(t){var n=t.originalEvent.target;(t.hover||n instanceof SVGElement)&&e.once("lasso.selection.ended",(function(){a.activateLasso(t.originalEvent,!0)}))})),e.on("lasso.end",0,(function(e){var t=e.context,n=Mb(e),i=r.filter((function(e){return e})),o=xs(e);a.select(i,n,o?t.selection:[])})),e.on("lasso.start",(function(e){var t=e.context;t.bbox=Mb(e),l(t),t.selection=i.get()})),e.on("lasso.move",(function(e){var t=e.context;t.bbox=Mb(e),c(t)})),e.on("lasso.cleanup",(function(e){var t=e.context;p(t)})),e.on("element.mousedown",1500,(function(e){if(xs(e))return a.activateLasso(e.originalEvent),!0}))}function Mb(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}}Tb.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],Tb.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:Cb,data:{context:{}}})},Tb.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:Cb,data:{context:{}},keepSelection:!0})},Tb.prototype.select=function(e,t,n=[]){var r=function(e,t){var n={};return v(e,(function(e){var r=e;r.waypoints&&(r=vt(r)),!u(t.y)&&r.x>t.x&&(n[e.id]=e),!u(t.x)&&r.y>t.y&&(n[e.id]=e),r.x>t.x&&r.y>t.y&&(u(t.width)&&u(t.height)&&r.width+r.x<t.width+t.x&&r.height+r.y<t.height+t.y?n[e.id]=e:u(t.width)&&u(t.height)||(n[e.id]=e))})),n}(e,t);this._selection.select([...n,...O(r)])},Tb.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Tb.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};var Ab={__depends__:[$f,bf],__init__:["lassoTool"],lassoTool:["type",Tb]},Db=1500,Nb="grab";function Rb(e,t,n,r,i,o){this._dragging=n,this._mouse=o;var s=this,a=r.get("keyboard",!1);i.registerTool("hand",{tool:"hand",dragging:"hand.move"}),e.on("element.mousedown",Db,(function(e){if(ws(e))return s.activateMove(e.originalEvent,!0),!1})),a&&a.addListener(Db,(function(e){if(jb(e.keyEvent)&&!s.isActive()){var t=s._mouse.getLastMoveEvent();s.activateMove(t,!!t)}}),"keyboard.keydown"),a&&a.addListener(Db,(function(e){jb(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!ws(t)&&n&&e.once("hand.move.ended",(function(e){s.activateHand(e.originalEvent,!0,!0)})),!1}))}function jb(e){return Bs("Space",e)}Rb.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Rb.prototype.activateMove=function(e,t,n){"object"==typeof t&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:Nb,data:{context:n||{}}})},Rb.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:Nb,data:{context:{reactivate:n}}})},Rb.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Rb.prototype.isActive=function(){var e=this._dragging.context();return!!e&&/^(hand|hand\.move)$/.test(e.prefix)};var Lb={__depends__:[$f,bf],__init__:["handTool"],handTool:["type",Rb]},Ib="connect-ok",zb="connect-not-ok";function Bb(e,t,n,r,i,o,s){var a=this;this._dragging=t,this._rules=o,this._mouse=s,i.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),e.on("global-connect.hover",(function(e){var t=e.context,n=e.hover,i=t.canStartConnect=a.canStartConnect(n);null!==i&&(t.startTarget=n,r.addMarker(n,i?Ib:zb))})),e.on(["global-connect.out","global-connect.cleanup"],(function(e){var t=e.context.startTarget,n=e.context.canStartConnect;t&&r.removeMarker(t,n?Ib:zb)})),e.on(["global-connect.ended"],(function(t){var r=t.context.startTarget,i={x:t.x,y:t.y};if(a.canStartConnect(r))return e.once("element.out",(function(){e.once(["connect.ended","connect.canceled"],(function(){e.fire("global-connect.drag.ended")})),n.start(null,r,i)})),!1}))}Bb.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],Bb.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},Bb.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},Bb.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Bb.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};var $b={__depends__:[Bp,Ic,Dc,$f,bf],globalConnect:["type",Bb]};function qb(e,t,n,r,i,o,s,a){this._palette=e,this._create=t,this._elementFactory=n,this._spaceTool=r,this._lassoTool=i,this._handTool=o,this._globalConnect=s,this._translate=a,e.registerProvider(this)}qb.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],qb.prototype.getPaletteEntries=function(){var e={},t=this._create,n=this._elementFactory,r=this._spaceTool,i=this._lassoTool,o=this._handTool,s=this._globalConnect,a=this._translate;function l(e,r,i,o,s){function a(r){var i=n.createShape(I({type:e},s));t.start(r,i)}return{group:r,className:i,title:o,action:{dragstart:a,click:a}}}function c(e){var r=n.createShape({type:"bpmn:SubProcess",x:0,y:0,isExpanded:!0}),i=n.createShape({type:"bpmn:StartEvent",x:40,y:82,parent:r});t.start(e,[r,i],{hints:{autoSelect:[r]}})}function p(e){t.start(e,n.createParticipantShape())}return I(e,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:a("Activate hand tool"),action:{click:function(e){o.activateHand(e)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:a("Activate lasso tool"),action:{click:function(e){i.activateSelection(e)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:a("Activate create/remove space tool"),action:{click:function(e){r.activateSelection(e)}}},"global-connect-tool":{group:"tools",className:"bpmn-icon-connection-multi",title:a("Activate global connect tool"),action:{click:function(e){s.start(e)}}},"tool-separator":{group:"tools",separator:!0},"create.start-event":l("bpmn:StartEvent","event","bpmn-icon-start-event-none",a("Create start event")),"create.intermediate-event":l("bpmn:IntermediateThrowEvent","event","bpmn-icon-intermediate-event-none",a("Create intermediate/boundary event")),"create.end-event":l("bpmn:EndEvent","event","bpmn-icon-end-event-none",a("Create end event")),"create.exclusive-gateway":l("bpmn:ExclusiveGateway","gateway","bpmn-icon-gateway-none",a("Create gateway")),"create.task":l("bpmn:Task","activity","bpmn-icon-task",a("Create task")),"create.data-object":l("bpmn:DataObjectReference","data-object","bpmn-icon-data-object",a("Create data object reference")),"create.data-store":l("bpmn:DataStoreReference","data-store","bpmn-icon-data-store",a("Create data store reference")),"create.subprocess-expanded":{group:"activity",className:"bpmn-icon-subprocess-expanded",title:a("Create expanded sub-process"),action:{dragstart:c,click:c}},"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:a("Create pool/participant"),action:{dragstart:p,click:p}},"create.group":l("bpmn:Group","artifact","bpmn-icon-group",a("Create group"))}),e};var Fb={__depends__:[Sb,yf,sm,Ab,Lb,$b,To],__init__:["paletteProvider"],paletteProvider:["type",qb]};function Vb(e,t,n,r,i){Ho.call(this,e),e.on("shape.move.move",250,(function(e){var o=e.context,s=o.canExecute;o.visualReplacements||(o.visualReplacements={}),s&&s.replacements?function(e){v(e.canExecute.replacements,(function(o){var s=o.oldElementId,a={type:o.newElementType};if(!e.visualReplacements[s]){var l=t.get(s);I(a,{x:l.x,y:l.y});var c=n.createShape(a);r.addShape(c,l.parent);var p=ve('[data-element-id="'+Qo(l.id)+'"]',e.dragGroup);p&&Oe(p,{display:"none"});var u=i.addDragger(c,e.dragGroup);e.visualReplacements[s]=u,r.removeShape(c)}}))}(o):function(e){var t=e.visualReplacements;v(t,(function(n,r){var i=ve('[data-element-id="'+Qo(r)+'"]',e.dragGroup);i&&Oe(i,{display:"inline"}),n.remove(),t[r]&&delete t[r]}))}(o)}))}Vb.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],e(Vb,Ho);var Hb={__depends__:[Wp],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",Vb]},Ub=40,Wb=20,Gb=10,Qb=20,Zb=["x","y"],Xb=Math.abs;function Yb(e){e.on(["connect.hover","connect.move","connect.end"],1250,(function(e){var t=e.context,n=t.canExecute,r=t.start,i=t.hover,o=t.source,s=t.target;e.originalEvent&&zs(e.originalEvent)||(t.initialConnectionStart||(t.initialConnectionStart=t.connectionStart),n&&i&&function(e,t,n){Zb.forEach((function(r){var i=ew(r,t);e[r]<t[r]+n?Cp(e,r,t[r]+n):e[r]>t[r]+i-n&&Cp(e,r,t[r]+i-n)}))}(e,i,function(e){return ki(e,"bpmn:Task")?Gb:Wb}(i)),i&&function(e,t){return _(t,(function(t){return Jb(e,t)}))}(n,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(t.connectionStart=Pp(r),Ei(i,["bpmn:Event","bpmn:Gateway"])&&Kb(e,Pp(i)),Ei(i,["bpmn:Task","bpmn:SubProcess"])&&function(e,t){var n=Pp(t);Zb.forEach((function(r){(function(e,t,n){return e[n]>t[n]+Qb&&e[n]<t[n]+ew(n,t)-Qb})(e,t,r)&&Cp(e,r,n[r])}))}(e,i),ki(o,"bpmn:BoundaryEvent")&&s===o.host&&function(e){var t=e.context,n=t.source,r=t.target;if(function(e){var t=e.hover,n=e.source;return t&&n&&t===n}(t))return;var i=Pp(n),o=xn(i,r,-10),s=[];/top|bottom/.test(o)&&s.push("x");/left|right/.test(o)&&s.push("y");s.forEach((function(t){var n,r=e[t];Xb(r-i[t])<Ub&&(n=r>i[t]?i[t]+Ub:i[t]-Ub,Cp(e,t,n))}))}(e)):Jb(n,"bpmn:MessageFlow")?(ki(r,"bpmn:Event")&&(t.connectionStart=Pp(r)),ki(i,"bpmn:Event")&&Kb(e,Pp(i))):t.connectionStart=t.initialConnectionStart)}))}function Kb(e,t){Cp(e,"x",t.x),Cp(e,"y",t.y)}function Jb(e,t){return e&&e.type===t}function ew(e,t){return"x"===e?t.width:t.height}function tw(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}function nw(){this._snapValues={}}Yb.$inject=["eventBus"],tw.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},tw.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,-1===this._snapLocations.indexOf(e)&&this._snapLocations.push(e)},tw.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},tw.prototype.getSnapLocations=function(){return this._snapLocations},tw.prototype.setSnapLocations=function(e){this._snapLocations=e},tw.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new nw).initDefaults(this._defaultSnaps),n},nw.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)},nw.prototype.snap=function(e,t,n,r){var i=this._snapValues[t];return i&&function(e,t,n){var r,i;for(n=void 0===n?10:n,r=0;r<t.length;r++)if(i=t[r],_p(i-e)<=n)return i}(e[n],i[n],r)},nw.prototype.initDefaults=function(e){var t=this;v(e||{},(function(e,n){v(e,(function(e){t.add(n,e)}))}))};var rw=1250;function iw(e,t,n){var r=this;this._elementRegistry=e,t.on(["create.start","shape.move.start"],(function(e){r.initSnap(e)})),t.on(["create.move","create.end","shape.move.move","shape.move.end"],rw,(function(e){var t=e.context,i=t.shape,o=t.snapContext,s=t.target;if((!e.originalEvent||!zs(e.originalEvent))&&!Sp(e)&&s){var a=o.pointsForTarget(s);a.initialized||((a=r.addSnapTargetPoints(a,i,s)).initialized=!0),n.snap(e,a)}})),t.on(["create.cleanup","shape.move.cleanup"],(function(){n.hide()}))}iw.$inject=["elementRegistry","eventBus","snapping"],iw.prototype.initSnap=function(e){var t,n=this._elementRegistry,r=e.context,i=r.shape,o=r.snapContext;o||(o=r.snapContext=new tw);var s=(t=n.get(i.id)?Pp(i,e):{x:e.x+Pp(i).x,y:e.y+Pp(i).y}).x-i.width/2,a=t.y-i.height/2,l=t.x+i.width/2,c=t.y+i.height/2;return o.setSnapOrigin("mid",{x:t.x-e.x,y:t.y-e.y}),fn(i)||(o.setSnapOrigin("top-left",{x:s-e.x,y:a-e.y}),o.setSnapOrigin("bottom-right",{x:l-e.x,y:c-e.y})),o},iw.prototype.addSnapTargetPoints=function(e,t,n){return v(this.getSnapTargets(t,n),(function(n){if(fn(n))fn(t)&&e.add("mid",Pp(n));else if(hn(n)){if(n.waypoints.length<3)return;v(n.waypoints.slice(1,-1),(function(t){e.add("mid",t)}))}else e.add("mid",Pp(n))})),u(t.x)&&u(t.y)?(this._elementRegistry.get(t.id)&&e.add("mid",Pp(t)),e):e},iw.prototype.getSnapTargets=function(e,t){return Tp(t).filter((function(e){return!e.hidden}))};function ow(e,t){t.invoke(iw,this),e.on(["create.move","create.end"],1500,sw),e.on(["create.move","create.end","shape.move.move","shape.move.end"],1500,(function(e){var t=e.context,n=t.canExecute,r=t.target;n&&("attach"===n||n.attach)&&!Sp(e)&&function(e,t){var n,r=yn(t),i=wh(e,t),o=e.context,s=o.shape;n=s.parent?{x:0,y:0}:wn(s);/top/.test(i)?Cp(e,"y",r.top-n.y):/bottom/.test(i)&&Cp(e,"y",r.bottom-n.y);/left/.test(i)?Cp(e,"x",r.left-n.x):/right/.test(i)&&Cp(e,"x",r.right-n.x)}(e,r)}))}function sw(e){var t=e.context.createConstraints;if(t){var n=t.top,r=t.right,i=t.bottom,o=t.left;(o&&o>=e.x||r&&r<=e.x)&&Cp(e,"x",e.x),(n&&n>=e.y||i&&i<=e.y)&&Cp(e,"y",e.y)}}function aw(e,t){return-1!==e.indexOf(t)}function lw(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}e(ow,iw),ow.$inject=["eventBus","injector"],ow.prototype.initSnap=function(e){var t=iw.prototype.initSnap.call(this,e),n=e.shape,r=!!this._elementRegistry.get(n.id);return v(n.outgoing,(function(n){var i=n.waypoints[0];i=i.original||i,t.setSnapOrigin(n.id+"-docking",lw(i,r,e))})),v(n.incoming,(function(n){var i=n.waypoints[n.waypoints.length-1];i=i.original||i,t.setSnapOrigin(n.id+"-docking",lw(i,r,e))})),ki(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},ow.prototype.addSnapTargetPoints=function(e,t,n){iw.prototype.addSnapTargetPoints.call(this,e,t,n);var r=this.getSnapTargets(t,n);v(r,(function(n){(function(e){if(ki(e,"bpmn:SubProcess")&&Vi(e))return!0;return ki(e,"bpmn:Participant")}(n)||function(e,t){return e.every((function(e){return ki(e,t)}))}([t,n],"bpmn:TextAnnotation"))&&(e.add("top-left",Ep(n)),e.add("bottom-right",Op(n)))}));var i=this._elementRegistry;return v(t.incoming,(function(n){if(i.get(t.id)){aw(r,n.source)||e.add("mid",wn(n.source));var o=n.waypoints[0];e.add(n.id+"-docking",o.original||o)}})),v(t.outgoing,(function(n){if(i.get(t.id)){aw(r,n.target)||e.add("mid",wn(n.target));var o=n.waypoints[n.waypoints.length-1];e.add(n.id+"-docking",o.original||o)}})),ki(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},ow.prototype.getSnapTargets=function(e,t){return iw.prototype.getSnapTargets.call(this,e,t).filter((function(e){return!ki(e,"bpmn:Lane")}))};function cw(e,t){var n=this;e.on(["resize.start"],(function(e){n.initSnap(e)})),e.on(["resize.move","resize.end"],1250,(function(e){var r=e.context,i=r.shape,o=i.parent,s=r.direction,a=r.snapContext;if(!(e.originalEvent&&zs(e.originalEvent)||Sp(e))){var l=a.pointsForTarget(o);l.initialized||((l=n.addSnapTargetPoints(l,i,o,s)).initialized=!0),function(e){return"n"===e||"s"===e}(s)&&Cp(e,"x",e.x),function(e){return"e"===e||"w"===e}(s)&&Cp(e,"y",e.y),t.snap(e,l)}})),e.on(["resize.cleanup"],(function(){t.hide()}))}function pw(e,t){var n=wn(e),r=yn(e),i={x:n.x,y:n.y};return-1!==t.indexOf("n")?i.y=r.top:-1!==t.indexOf("s")&&(i.y=r.bottom),-1!==t.indexOf("e")?i.x=r.right:-1!==t.indexOf("w")&&(i.x=r.left),i}cw.prototype.initSnap=function(e){var t=e.context,n=t.shape,r=t.direction,i=t.snapContext;i||(i=t.snapContext=new tw);var o=pw(n,r);return i.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),i},cw.prototype.addSnapTargetPoints=function(e,t,n,r){return v(this.getSnapTargets(t,n),(function(t){e.add("corner",Op(t)),e.add("corner",Ep(t))})),e.add("corner",pw(t,r)),e},cw.$inject=["eventBus","snapping"],cw.prototype.getSnapTargets=function(e,t){return Tp(t).filter((function(t){return!(n=t,r=e,n.host===r||hn(t)||function(e){return!!e.hidden}(t)||fn(t));var n,r}))};function uw(e){this._canvas=e,this._asyncHide=j(L(this.hide,this),1e3)}uw.$inject=["canvas"],uw.prototype.snap=function(e,t){var n=e.context.snapContext,r=n.getSnapLocations(),i={x:Sp(e,"x"),y:Sp(e,"y")};v(r,(function(r){var o=n.getSnapOrigin(r),s={x:e.x+o.x,y:e.y+o.y};if(v(["x","y"],(function(e){var n;i[e]||void 0!==(n=t.snap(s,r,e,7))&&(i[e]={value:n,originValue:n-o[e]})})),i.x&&i.y)return!1})),this.showSnapLine("vertical",i.x&&i.x.value),this.showSnapLine("horizontal",i.y&&i.y.value),v(["x","y"],(function(t){var n=i[t];p(n)&&Cp(e,t,n.originValue)}))},uw.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=Re("path");return Oe(n,{d:"M0,0 L0,0"}),Se(n).add("djs-snap-line"),xe(t,n),{update:function(t){u(t)?Oe(n,"horizontal"===e?{d:"M-100000,"+t+" L+100000,"+t,display:""}:{d:"M "+t+",-100000 L "+t+", +100000",display:""}):Oe(n,{display:"none"})}}},uw.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},uw.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},uw.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},uw.prototype.hide=function(){v(this._snapLines,(function(e){e.update()}))};var dw={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",iw],resizeSnapping:["type",cw],snapping:["type",uw]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",Yb],createMoveSnapping:["type",ow]};function hw(e,t,n,r){this._open=!1,this._results={},this._eventMaps=[],this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._canvas=e,this._eventBus=t,this._selection=n,this._translate=r,this._container=this._getBoxHtml(),this._searchInput=ve(hw.INPUT_SELECTOR,this._container),this._resultsContainer=ve(hw.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 fw(e,t,n){var r=function(e){var t="";return e.forEach((function(e){var n=Xo(e.value||e.matched||e.normal),r=e.match||e.matched;t+=r?'<b class="'+hw.RESULT_HIGHLIGHT_CLASS+'">'+n+"</b>":n})),""!==t?t:null}(t),i=ge(n);i.innerHTML=r,e.appendChild(i)}hw.$inject=["canvas","eventBus","selection","translate"],hw.prototype._bindEvents=function(){var e=this;function t(t,n,r,i){e._eventMaps.push({el:t,type:r,listener:de.bind(t,n,r,i)})}t(document,"html","click",(function(t){e.close(!1)})),t(this._container,hw.INPUT_SELECTOR,"click",(function(e){e.stopPropagation(),e.delegateTarget.focus()})),t(this._container,hw.RESULT_SELECTOR,"mouseover",(function(t){t.stopPropagation(),e._scrollToNode(t.delegateTarget),e._preselect(t.delegateTarget)})),t(this._container,hw.RESULT_SELECTOR,"click",(function(t){t.stopPropagation(),e._select(t.delegateTarget)})),t(this._container,hw.INPUT_SELECTOR,"keydown",(function(e){Bs("ArrowUp",e)&&e.preventDefault(),Bs("ArrowDown",e)&&e.preventDefault()})),t(this._container,hw.INPUT_SELECTOR,"keyup",(function(t){if(Bs("Escape",t))return e.close();if(Bs("Enter",t)){var n=e._getCurrentResult();return n?e._select(n):e.close(!1)}return Bs("ArrowUp",t)?e._scrollToDirection(!0):Bs("ArrowDown",t)?e._scrollToDirection():void(Bs(["ArrowLeft","ArrowRight"],t)||e._search(t.delegateTarget.value))}))},hw.prototype._unbindEvents=function(){this._eventMaps.forEach((function(e){de.unbind(e.el,e.type,e.listener)}))},hw.prototype._search=function(e){var t=this;if(this._clearResults(),e&&""!==e){var n=this._searchProvider.find(e);if((n=n.filter((function(e){return!t._canvas.getRootElements().includes(e.element)}))).length){n.forEach((function(e){var n=e.element.id,r=t._createResultNode(e,n);t._results[n]={element:e.element,node:r}}));var r=ve(hw.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(r),this._preselect(r)}else this._selection.select(null)}},hw.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},hw.prototype._scrollToNode=function(e){if(e&&e!==this._getCurrentResult()){var t=e.offsetTop,n=this._resultsContainer.scrollTop,r=t-this._resultsContainer.clientHeight+e.clientHeight;t<n?this._resultsContainer.scrollTop=t:n<r&&(this._resultsContainer.scrollTop=r)}},hw.prototype._clearResults=function(){ee(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},hw.prototype._getCurrentResult=function(){return ve(hw.RESULT_SELECTED_SELECTOR,this._resultsContainer)},hw.prototype._createResultNode=function(e,t){var n=ge(hw.RESULT_HTML);return e.primaryTokens.length>0&&fw(n,e.primaryTokens,hw.RESULT_PRIMARY_HTML),fw(n,e.secondaryTokens,hw.RESULT_SECONDARY_HTML),X(n,hw.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},hw.prototype.registerProvider=function(e){this._searchProvider=e},hw.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"))},hw.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())},hw.prototype.toggle=function(){this.isOpen()?this.close():this.open()},hw.prototype.isOpen=function(){return this._open},hw.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&K(t).remove(hw.RESULT_SELECTED_CLASS);var n=X(e,hw.RESULT_ID_ATTRIBUTE),r=this._results[n].element;K(e).add(hw.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(r,{top:300}),this._selection.select(r),this._eventBus.fire("searchPad.preselected",r)}},hw.prototype._select=function(e){var t=X(e,hw.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)},hw.prototype._getBoxHtml=function(){const e=ge(hw.BOX_HTML),t=ve(hw.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e},hw.CONTAINER_SELECTOR=".djs-search-container",hw.INPUT_SELECTOR=".djs-search-input input",hw.RESULTS_CONTAINER_SELECTOR=".djs-search-results",hw.RESULT_SELECTOR=".djs-search-result",hw.RESULT_SELECTED_CLASS="djs-search-result-selected",hw.RESULT_SELECTED_SELECTOR="."+hw.RESULT_SELECTED_CLASS,hw.RESULT_ID_ATTRIBUTE="data-result-id",hw.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",hw.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>',hw.RESULT_HTML='<div class="djs-search-result"></div>',hw.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',hw.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';var mw={__depends__:[To,qo,Ds],searchPad:["type",hw]};function gw(e,t,n,r){this._elementRegistry=e,this._canvas=n,this._search=r,t.registerProvider(this)}function yw(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}gw.$inject=["elementRegistry","searchPad","canvas","search"],gw.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(yw)};var vw={__depends__:[mw,Zl],__init__:["bpmnSearch"],bpmnSearch:["type",gw]};const bw={width:36,height:50},ww={width:50,height:50};function xw(e,t,n){return Re("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}function _w(e,t){this._styles=t,e.registerProvider(this)}function kw(e,t){var n;return"bpmn:DataObjectReference"===t?n=bw:"bpmn:DataStoreReference"===t&&(n=ww),e.width===n.width&&e.height===n.height}_w.$inject=["outline","styles"],_w.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(!fn(e))return ki(e,"bpmn:Gateway")?(I((n=Re("rect")).style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),Oe(n,I({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):Ei(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?Oe(n=Re("rect"),I({x:-5,y:-5,rx:14,width:e.width+10,height:e.height+10},t)):ki(e,"bpmn:EndEvent")?Oe(n=Re("circle"),I({cx:e.width/2,cy:e.height/2,r:e.width/2+5+1},t)):ki(e,"bpmn:Event")?Oe(n=Re("circle"),I({cx:e.width/2,cy:e.height/2,r:e.width/2+5},t)):ki(e,"bpmn:DataObjectReference")&&kw(e,"bpmn:DataObjectReference")?n=xw("M44.7648 11.3263L36.9892 2.64074C36.0451 1.58628 34.5651 0.988708 33.1904 0.988708H5.98667C3.22688 0.988708 0.989624 3.34892 0.989624 6.26039V55.0235C0.989624 57.9349 3.22688 60.2952 5.98667 60.2952H40.966C43.7257 60.2952 45.963 57.9349 45.963 55.0235V14.9459C45.963 13.5998 45.6407 12.3048 44.7648 11.3263Z",{x:-6,y:-6},t):ki(e,"bpmn:DataStoreReference")&&kw(e,"bpmn:DataStoreReference")&&(n=xw("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},_w.prototype.updateOutline=function(e,t){if(!fn(e))return Ei(e,["bpmn:SubProcess","bpmn:Group"])?(Oe(t,{width:e.width+10,height:e.height+10}),!0):!!Ei(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};var Ew={__depends__:[cb],__init__:["outlineProvider"],outlineProvider:["type",_w]};function Ow(e){Fi.call(this,e)}e(Ow,Fi),Ow.Viewer=Ns,Ow.NavigatedViewer=ha,Ow.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>')},Ow.prototype._interactionModules=[Ys,sa,da],Ow.prototype._modelingModules=[rc,wc,jc,Oc,Np,Bp,qp,Qy,Tf,yf,tv,av,_v,Ev,Pv,Rv,Kv,gy,sb,vb,Fb,Hb,Uv,dw,vw,Ew],Ow.prototype._modules=[].concat(Ns.prototype._modules,Ow.prototype._interactionModules,Ow.prototype._modelingModules);var Pw=new jo,Sw={min:.2,max:4};function Cw(e,t,n,r,i){var o=this;function s(e){o._state._svgClientRect&&!Nw(o._state._svgClientRect)||(o._state._svgClientRect=o._svg.getBoundingClientRect()),Mw(Tw({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=zw(t);o._state._svgClientRect&&!Nw(o._state._svgClientRect)||(o._state._svgClientRect=o._svg.getBoundingClientRect()),e&&s(n);var i=Tw({x:n.x-o._state._svgClientRect.left,y:n.y-o._state._svgClientRect.top},o._svg,o._lastViewbox),a=r.viewbox(),p=function(e,t){var n={x:t.x+t.width/2,y:t.y+t.height/2};return{x:e.x-n.x,y:e.y-n.y}}(i,a),u=o._viewportDom.getBoundingClientRect(),d={x:n.x-u.left+1,y:n.y-u.top+1};I(o._state,{cachedViewbox:a,initialDragPosition:{x:n.x,y:n.y},isDragging:!0,offsetViewport:p,offsetViewportDom:d,viewportClientRect:o._viewport.getBoundingClientRect(),parentClientRect:o._parent.getBoundingClientRect()}),ce.bind(document,"mousemove",l),ce.bind(document,"mouseup",c)}}function l(e){var t=zw(e);if(o._state.isDragging){o._state._svgClientRect&&!Nw(o._state._svgClientRect)||(o._state._svgClientRect=o._svg.getBoundingClientRect());var n=o._state.offsetViewportDom,r=o._state.viewportClientRect,i=o._state.parentClientRect;I(o._viewportDom.style,{top:t.y-n.y-i.top+"px",left:t.x-n.x-i.left+"px"});var s=jw(i,{top:t.y-n.y-i.top,left:t.x-n.x-i.left,width:r.width,height:r.height});I(o._overlay.style,{clipPath:s});var a=Tw({x:t.x-o._state._svgClientRect.left,y:t.y-o._state._svgClientRect.top},o._svg,o._lastViewbox);Mw({x:a.x-o._state.offsetViewport.x,y:a.y-o._state.offsetViewport.y},o._canvas)}}function c(e){var t=zw(e);o._state.isDragging&&(o._state.initialDragPosition.x===t.x&&o._state.initialDragPosition.y===t.y&&s(e),o._update(),I(o._state,{cachedViewbox:null,initialDragPosition:null,isDragging:!1,offsetViewport:null,offsetViewportDom:null}),ce.unbind(document,"mousemove",l),ce.unbind(document,"mouseup",c))}this._canvas=r,this._elementRegistry=i,this._eventBus=n,this._injector=t,this._state={isOpen:void 0,isDragging:!1,initialDragPosition:null,offsetViewport:null,cachedViewbox:null,dragger:null,svgClientRect:null,parentClientRect:null,zoomDelta:0},this._minimapId=Pw.next(),this._init(),this.toggle(e&&e.open||!1),ce.bind(this._viewportDom,"mousedown",a(!1)),ce.bind(this._svg,"mousedown",a(!0)),ce.bind(this._parent,"wheel",(function(e){if(e.preventDefault(),e.stopPropagation(),e.ctrlKey&&(o._state._svgClientRect&&!Nw(o._state._svgClientRect)||(o._state._svgClientRect=o._svg.getBoundingClientRect()),t=e,n=o._state._svgClientRect,t.x>n.left&&t.x<n.left+n.width&&t.y>n.top&&t.y<n.top+n.height)){var t,n,i,s,a,l,c=0===e.deltaMode?.02:.32,p=Math.sqrt(Math.pow(e.deltaY,2)+Math.pow(e.deltaX,2))*Rw(e.deltaY)*-c;if(o._state.zoomDelta+=p,Math.abs(o._state.zoomDelta)>.1){var u=p>0?1:-1,d=Math.log(r.zoom())/Math.log(10),h=(i=Sw,s=20,a=Math.log(i.min)/Math.log(10),l=Math.log(i.max)/Math.log(10),(Math.abs(a)+Math.abs(l))/s),f=Math.round(d/h)*h;f+=h*u;var m=Math.pow(10,f);r.zoom(function(e,t){return Math.max(e.min,Math.min(e.max,t))}(Sw,m),g),o._state.zoomDelta=0;var g=Tw({x:e.clientX-o._state._svgClientRect.left,y:e.clientY-o._state._svgClientRect.top},o._svg,o._lastViewbox);Mw(g,o._canvas),o._update()}}})),ce.bind(this._toggle,"click",(function(e){e.preventDefault(),e.stopPropagation(),o.toggle()})),n.on(["shape.added","connection.added"],(function(e){var t=e.element;o._addElement(t),o._update()})),n.on(["shape.removed","connection.removed"],(function(e){var t=e.element;o._removeElement(t),o._update()})),n.on("elements.changed",250,(function(e){e.elements.forEach((function(e){o._updateElement(e)})),o._update()})),n.on("element.updateId",(function(e){var t=e.element,n=e.newId;o._updateElementId(t,n)})),n.on("canvas.viewbox.changed",(function(){o._state.isDragging||o._update()})),n.on("canvas.resized",(function(){document.body.contains(o._parent)&&(o._state.isDragging||o._update(),o._state._svgClientRect=o._svg.getBoundingClientRect())})),n.on(["root.set","plane.set"],(function(e){o._clear(),(e.element||e.plane.rootElement).children.forEach((function(e){o._addElement(e)})),o._update()}))}function Tw(e,t,n){var r=t.getBoundingClientRect(),i=function(e,t){var n=e.width/e.height,r=I({},{x:e.x,y:e.y,width:e.width,height:e.height});if(n>t){var i=r.width*(1/t);I(r,{y:r.y-(i-r.height)/2,height:i})}else if(n<t){var o=r.height*t;I(r,{x:r.x-(o-r.width)/2,width:o})}return r}(n,r.width/r.height);return{x:Aw(e.x,0,r.width,i.x,i.x+i.width),y:Aw(e.y,0,r.height,i.y,i.y+i.height)}}function Mw(e,t){var n=t.viewbox(),r=n.width,i=n.height;t.viewbox({x:e.x-r/2,y:e.y-i/2,width:r,height:i})}function Aw(e,t,n,r,i){return(e-t)*(i-r)/(n-t)+r}function Dw(e,t,n){var r=function(e){var t=ve(".children",e);t||xe(e,t=Re("g",{class:"children"}));return t}(t),i=[].slice.call(r.childNodes)[n];i?t.insertBefore(e,i.nextSibling):t.appendChild(e)}function Nw(e){return 0===e.width&&0===e.height}Cw.$inject=["config.minimap","injector","eventBus","canvas","elementRegistry"],Cw.prototype._init=function(){var e=this._canvas.getContainer(),t=this._parent=document.createElement("div");K(t).add("djs-minimap"),e.appendChild(t);var n=this._toggle=document.createElement("div");K(n).add("toggle"),t.appendChild(n);var r=this._map=document.createElement("div");K(r).add("map"),t.appendChild(r);var i=this._svg=Re("svg");Oe(i,{width:"100%",height:"100%"}),xe(r,i),xe(i,this._elementsGroup=Re("g"));var o=this._viewportGroup=Re("g");xe(i,o);var s=this._viewport=Re("rect");Se(s).add("viewport"),xe(o,s),ce.bind(t,"mousedown",(function(e){e.stopPropagation()}));var a=this._viewportDom=document.createElement("div");K(a).add("viewport-dom"),this._parent.appendChild(a);var l=this._overlay=document.createElement("div");K(l).add("overlay"),this._parent.appendChild(l)},Cw.prototype._update=function(){var e=this._canvas.viewbox(),t=e.inner,n=e.outer;if(Iw(e)){var r,i,o,s,a=n.width-t.width,l=n.height-t.height;t.width<n.width?(r=t.x-a/2,o=n.width,t.x+t.width<n.width&&(r=Math.min(0,t.x))):(r=t.x,o=t.width),t.height<n.height?(i=t.y-l/2,s=n.height,t.y+t.height<n.height&&(i=Math.min(0,t.y))):(i=t.y,s=t.height),r-=50,i-=50,o+=100,s+=100,this._lastViewbox={x:r,y:i,width:o,height:s},Oe(this._svg,{viewBox:r+", "+i+", "+o+", "+s}),Oe(this._viewport,{x:e.x,y:e.y,width:e.width,height:e.height});var c=this._state._parentClientRect=this._parent.getBoundingClientRect(),p=this._viewport.getBoundingClientRect(),u={top:p.top-c.top,left:p.left-c.left,width:p.width,height:p.height};I(this._viewportDom.style,{top:u.top+"px",left:u.left+"px",width:u.width+"px",height:u.height+"px"});var d=jw(c,u);I(this._overlay.style,{clipPath:d})}},Cw.prototype.open=function(){I(this._state,{isOpen:!0}),K(this._parent).add("open");var e=this._injector.get("translate",!1)||function(e){return e};X(this._toggle,"title",e("Close minimap")),this._update(),this._eventBus.fire("minimap.toggle",{open:!0})},Cw.prototype.close=function(){I(this._state,{isOpen:!1}),K(this._parent).remove("open");var e=this._injector.get("translate",!1)||function(e){return e};X(this._toggle,"title",e("Open minimap")),this._eventBus.fire("minimap.toggle",{open:!1})},Cw.prototype.toggle=function(e){var t=this.isOpen();void 0===e&&(e=!t),e!=t&&(e?this.open():this.close())},Cw.prototype.isOpen=function(){return this._state.isOpen},Cw.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)}},Cw.prototype._updateElementId=function(e,t){try{var n=ve("#"+Qo(this._prefixId(e.id)),this._elementsGroup);n&&(n.id=this._prefixId(t))}catch(e){console.warn("Minimap#_updateElementId errored",e)}},Cw.prototype.isOnActivePlane=function(e){var t=this._canvas;return t.findRoot?t.findRoot(e)===t.getRootElement():!t.findPlane||t.findPlane(e)===t.getActivePlane()},Cw.prototype._addElement=function(e){var t=this;if(this._removeElement(e),this.isOnActivePlane(e)){var n,r,i,o=this._createElement(e),s=ve("#"+Qo(this._prefixId(e.parent.id)),this._elementsGroup);if(o){var a=function(e,t){var n=ve(".djs-children",t.parentNode);if(!n)return;var r=[].slice.call(n.childNodes),i=-1;return r.forEach((function(t,n){ve(".djs-element",t)===e&&(i=n)})),i}(this._elementRegistry.getGraphics(e),this._elementRegistry.getGraphics(e.parent));return"undefined"!==a&&s?s.childNodes.length>a?Dw(o,s,a):Dw(o,s,s.childNodes.length-1):this._elementsGroup.appendChild(o),!function(e){return e.waypoints}(e)?(r=e.x,i=e.y,s&&(r-=(n=e.parent).x,i-=n.y),Oe(o,{transform:"translate("+r+" "+i+")"})):(r=0,i=0,void 0!==(n=e.parent).x&&void 0!==n.y&&(r=-n.x,i=-n.y),Oe(o,{transform:"translate("+r+" "+i+")"})),e.children&&e.children.length&&e.children.forEach((function(e){t._addElement(e)})),o}}},Cw.prototype._removeElement=function(e){var t=this._svg.getElementById(this._prefixId(e.id));t&&Ue(t)},Cw.prototype._createElement=function(e){var t,n=this._elementRegistry.getGraphics(e);if(n&&(t=Zn(n))){var r=function(e){return be("[id]",e).forEach((function(e){e.remove()})),e}(Me(t));return Oe(r,{id:this._prefixId(e.id)}),r}},Cw.prototype._clear=function(){Te(this._elementsGroup)},Cw.prototype._prefixId=function(e){return"djs-minimap-"+e+"-"+this._minimapId};var Rw=Math.sign||function(e){return e>=0?1:-1};function jw(e,t){return"polygon("+[Lw(t.left,t.top),Lw(t.left+t.width,t.top),Lw(t.left+t.width,t.top+t.height),Lw(t.left,t.top+t.height),Lw(t.left,e.height),Lw(e.width,e.height),Lw(e.width,0),Lw(0,0),Lw(0,e.height),Lw(t.left,e.height)].join(", ")+")"}function Lw(e,t){return e+"px "+t+"px"}function Iw(e){return x(e,(function(e){return p(e)?Iw(e):u(e)&&isFinite(e)}))}function zw(e){return e.center?e.center:{x:e.clientX,y:e.clientY}}var Bw={__init__:["minimap"],minimap:["type",Cw]},$w=1e5,qw=1e5;function Fw(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)}))}Fw.prototype._init=function(){var e=ve("defs",this._canvas._svg);e||(e=Re("defs"),xe(this._canvas._svg,e));var t=this._pattern=Re("pattern"),n="djs-grid-pattern-"+Math.trunc(1e6*Math.random());Oe(t,{id:n,width:cv,height:cv,patternUnits:"userSpaceOnUse"});var r=this._circle=Re("circle");Oe(r,{cx:.5,cy:.5,r:.5,fill:"#ccc"}),xe(t,r),xe(e,t),Oe(this._gfx=Re("rect"),{x:-$w/2,y:-qw/2,width:$w,height:qw,fill:`url(#${n})`})},Fw.prototype._centerGridAroundViewbox=function(e){e||(e=this._canvas.viewbox());var t=wn(e);Oe(this._gfx,{x:-$w/2+pv(t.x,cv),y:-qw/2+pv(t.y,cv)})},Fw.prototype.isVisible=function(){return this._visible},Fw.prototype.toggle=function(e){if(void 0===e&&(e=!this._visible),e!==this._visible){var t=this._getParent();e?xe(t,this._gfx):Te(t),this._visible=e}},Fw.prototype._getParent=function(){return this._canvas.getLayer("djs-grid",-2)},Fw.$inject=["canvas","eventBus"];var Vw={__init__:["grid"],grid:["type",Fw]};function Hw(e,t){var n,r,i=(e=e||{}).borderColor||"rgba(0,0,0,0.1)",o=e.crossColor||"#CCC",s=-1;xe(t.getLayer("djs-origin",-1),n=Gw("g",{"pointer-events":"none"})),!1!==e.showBorder&&xe(n,Gw("path",{class:Ww("border"),d:Uw(["M",-22,s,"H",-1e3,"M",22,s,"H",6e3,"M",s,-22,"V",-1e3,"M",s,22,"V",3e3]),fill:"none",stroke:i,"stroke-width":"2px","stroke-dasharray":"6, 6","shape-rendering":"crispedges"})),xe(n,Gw("path",{d:Uw(["M",-15,s,"H",15,"M",s,-15,"V",15]),class:Ww("cross"),fill:"none",stroke:o,"stroke-width":"2px","stroke-linecap":"round"})),(r=Gw("text",{x:-40,y:-10,fill:o,class:Ww("label")})).textContent="(0, 0)",xe(n,r)}function Uw(e){return e.join(" ")}function Ww(e){return"djs-origin-"+e}function Gw(e,t){var n=Re(e);return Oe(n,t),n}Hw.$inject=["config.origin","canvas"];var Qw={__init__:[Hw]},Zw={offset:{x:150,y:75},tolerance:50,alignOnSave:!0};function Xw(e,t,n,r,i,o){function s(e,n){var r=n.offset,i=n.tolerance,o={};return["x","y"].forEach((function(n){var s=-e[n]+r[n],a=t.get("gridSnapping",!1);a&&(s=function(e,t,n){n||(n="round");return Math[n](e/t)*t}(s,a.getGridSpacing())),o[n]=Math.abs(s)<i?0:s})),o}function a(){var t=i.viewbox().inner,n=i.getRootElement().children;if(n.length){var o=s(t,e);0===o.x&&0===o.y||r.execute("elements.alignToOrigin",{elements:n,delta:o})}}function l(e){return function(t){n.once("commandStack.changed",(function(){var n=t.delta,r=i.viewbox().scale;i.scroll({dx:e*n.x*r,dy:e*n.y*r})}))}}var c,p,d;e=function(e){var t=I({},Zw,e||{});return u(t.offset)&&(t.offset={x:t.offset,y:t.offset}),t}(e),r.register("elements.alignToOrigin",{preExecute:function(e){var t=e.delta,n=e.elements;o.moveElements(n,t)},execute:l(-1),revert:l(1)}),e.alignOnSave&&(c=t.get("_parent",!1),p=n,((d=c&&c._eventBus)||p).on("saveXML.start",1250,a),d&&p.on("diagram.destroy",(function(){d.off("saveXML.start",a)}))),this.align=a,this.computeAdjustment=s,this._config=e}Xw.$inject=["config.alignToOrigin","injector","eventBus","commandStack","canvas","modeling"];var Yw={__init__:["alignToOrigin"],alignToOrigin:["type",Xw]};function Kw(e){function t(e){if(!e.labelTarget){var t=Oi(e);ki(t,"bpmn:Participant")&&(t=t.processRef),ki(t,"bpmn:Process")&&(t.isExecutable=!!t.isExecutable)}}e.on(["shape.added","root.added"],(function(e){t(e.element)})),e.on("elements.changed",(function(e){e.elements.forEach((function(e){t(e)}))}))}Kw.$inject=["eventBus"];var Jw,ex,tx,nx,rx,ix,ox,sx,ax={__init__:[Kw]},lx={},cx=[],px=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,ux=Array.isArray;function dx(e,t){for(var n in t)e[n]=t[n];return e}function hx(e){var t=e.parentNode;t&&t.removeChild(e)}function fx(e,t,n){var r,i,o,s={};for(o in t)"key"==o?r=t[o]:"ref"==o?i=t[o]:s[o]=t[o];if(arguments.length>2&&(s.children=arguments.length>3?Jw.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 mx(e,s,r,i,null)}function mx(e,t,n,r,i){var o={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:null==i?++tx:i,__i:-1,__u:0};return null==i&&null!=ex.vnode&&ex.vnode(o),o}function gx(e){return e.children}function yx(e,t){this.props=e,this.context=t}function vx(e,t){if(null==t)return e.__?vx(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?vx(e):null}function bx(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 bx(e)}}function wx(e){(!e.__d&&(e.__d=!0)&&nx.push(e)&&!xx.__r++||rx!==ex.debounceRendering)&&((rx=ex.debounceRendering)||ix)(xx)}function xx(){var e,t,n,r,i,o,s,a,l;for(nx.sort(ox);e=nx.shift();)e.__d&&(t=nx.length,r=void 0,o=(i=(n=e).__v).__e,a=[],l=[],(s=n.__P)&&((r=dx({},i)).__v=i.__v+1,ex.vnode&&ex.vnode(r),Mx(s,r,i,n.__n,void 0!==s.ownerSVGElement,32&i.__u?[o]:null,a,null==o?vx(i):o,!!(32&i.__u),l),r.__.__k[r.__i]=r,Ax(a,r,l),r.__e!=o&&bx(r)),nx.length>t&&nx.sort(ox));xx.__r=0}function _x(e,t,n,r,i,o,s,a,l,c,p){var u,d,h,f,m,g=r&&r.__k||cx,y=t.length;for(n.__d=l,function(e,t,n){var r,i,o,s,a,l=t.length,c=n.length,p=c,u=0;for(e.__k=[],r=0;r<l;r++)null!=(i=e.__k[r]=null==(i=t[r])||"boolean"==typeof i||"function"==typeof i?null:"string"==typeof i||"number"==typeof i||"bigint"==typeof i||i.constructor==String?mx(null,i,null,null,i):ux(i)?mx(gx,{children:i},null,null,null):void 0===i.constructor&&i.__b>0?mx(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):i)?(i.__=e,i.__b=e.__b+1,a=Ox(i,n,s=r+u,p),i.__i=a,o=null,-1!==a&&(p--,(o=n[a])&&(o.__u|=131072)),null==o||null===o.__v?(-1==a&&u--,"function"!=typeof i.type&&(i.__u|=65536)):a!==s&&(a===s+1?u++:a>s?p>l-s?u+=a-s:u--:u=a<s&&a==s-1?a-s:0,a!==r+u&&(i.__u|=65536))):(o=n[r])&&null==o.key&&o.__e&&(o.__e==e.__d&&(e.__d=vx(o)),Nx(o,o,!1),n[r]=null,p--);if(p)for(r=0;r<c;r++)null!=(o=n[r])&&!(131072&o.__u)&&(o.__e==e.__d&&(e.__d=vx(o)),Nx(o,o))}(n,t,g),l=n.__d,u=0;u<y;u++)null!=(h=n.__k[u])&&"boolean"!=typeof h&&"function"!=typeof h&&(d=-1===h.__i?lx:g[h.__i]||lx,h.__i=u,Mx(e,h,d,i,o,s,a,l,c,p),f=h.__e,h.ref&&d.ref!=h.ref&&(d.ref&&Dx(d.ref,null,h),p.push(h.ref,h.__c||f,h)),null==m&&null!=f&&(m=f),65536&h.__u||d.__k===h.__k?l=kx(h,l,e):"function"==typeof h.type&&void 0!==h.__d?l=h.__d:f&&(l=f.nextSibling),h.__d=void 0,h.__u&=-196609);n.__d=l,n.__e=m}function kx(e,t,n){var r,i;if("function"==typeof e.type){for(r=e.__k,i=0;r&&i<r.length;i++)r[i]&&(r[i].__=e,t=kx(r[i],t,n));return t}return e.__e!=t&&(n.insertBefore(e.__e,t||null),t=e.__e),t&&t.nextSibling}function Ex(e,t){return t=t||[],null==e||"boolean"==typeof e||(ux(e)?e.some((function(e){Ex(e,t)})):t.push(e)),t}function Ox(e,t,n,r){var i=e.key,o=e.type,s=n-1,a=n+1,l=t[n];if(null===l||l&&i==l.key&&o===l.type)return n;if(r>(null==l||131072&l.__u?0:1))for(;s>=0||a<t.length;){if(s>=0){if((l=t[s])&&!(131072&l.__u)&&i==l.key&&o===l.type)return s;s--}if(a<t.length){if((l=t[a])&&!(131072&l.__u)&&i==l.key&&o===l.type)return a;a++}}return-1}function Px(e,t,n){"-"===t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||px.test(t)?n:n+"px"}function Sx(e,t,n,r,i){var o;e:if("style"===t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof r&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||Px(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||Px(e.style,t,n[t])}else if("o"===t[0]&&"n"===t[1])o=t!==(t=t.replace(/(PointerCapture)$|Capture$/,"$1")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?r?n.u=r.u:(n.u=Date.now(),e.addEventListener(t,o?Tx:Cx,o)):e.removeEventListener(t,o?Tx:Cx,o);else{if(i)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!==t&&"height"!==t&&"href"!==t&&"list"!==t&&"form"!==t&&"tabIndex"!==t&&"download"!==t&&"rowSpan"!==t&&"colSpan"!==t&&"role"!==t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!==t[4]?e.removeAttribute(t):e.setAttribute(t,n))}}function Cx(e){var t=this.l[e.type+!1];if(e.t){if(e.t<=t.u)return}else e.t=Date.now();return t(ex.event?ex.event(e):e)}function Tx(e){return this.l[e.type+!0](ex.event?ex.event(e):e)}function Mx(e,t,n,r,i,o,s,a,l,c){var p,u,d,h,f,m,g,y,v,b,w,x,_,k,E,O=t.type;if(void 0!==t.constructor)return null;128&n.__u&&(l=!!(32&n.__u),o=[a=t.__e=n.__e]),(p=ex.__b)&&p(t);e:if("function"==typeof O)try{if(y=t.props,v=(p=O.contextType)&&r[p.__c],b=p?v?v.props.value:p.__:r,n.__c?g=(u=t.__c=n.__c).__=u.__E:("prototype"in O&&O.prototype.render?t.__c=u=new O(y,b):(t.__c=u=new yx(y,b),u.constructor=O,u.render=Rx),v&&v.sub(u),u.props=y,u.state||(u.state={}),u.context=b,u.__n=r,d=u.__d=!0,u.__h=[],u._sb=[]),null==u.__s&&(u.__s=u.state),null!=O.getDerivedStateFromProps&&(u.__s==u.state&&(u.__s=dx({},u.__s)),dx(u.__s,O.getDerivedStateFromProps(y,u.__s))),h=u.props,f=u.state,u.__v=t,d)null==O.getDerivedStateFromProps&&null!=u.componentWillMount&&u.componentWillMount(),null!=u.componentDidMount&&u.__h.push(u.componentDidMount);else{if(null==O.getDerivedStateFromProps&&y!==h&&null!=u.componentWillReceiveProps&&u.componentWillReceiveProps(y,b),!u.__e&&(null!=u.shouldComponentUpdate&&!1===u.shouldComponentUpdate(y,u.__s,b)||t.__v===n.__v)){for(t.__v!==n.__v&&(u.props=y,u.state=u.__s,u.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.forEach((function(e){e&&(e.__=t)})),w=0;w<u._sb.length;w++)u.__h.push(u._sb[w]);u._sb=[],u.__h.length&&s.push(u);break e}null!=u.componentWillUpdate&&u.componentWillUpdate(y,u.__s,b),null!=u.componentDidUpdate&&u.__h.push((function(){u.componentDidUpdate(h,f,m)}))}if(u.context=b,u.props=y,u.__P=e,u.__e=!1,x=ex.__r,_=0,"prototype"in O&&O.prototype.render){for(u.state=u.__s,u.__d=!1,x&&x(t),p=u.render(u.props,u.state,u.context),k=0;k<u._sb.length;k++)u.__h.push(u._sb[k]);u._sb=[]}else do{u.__d=!1,x&&x(t),p=u.render(u.props,u.state,u.context),u.state=u.__s}while(u.__d&&++_<25);u.state=u.__s,null!=u.getChildContext&&(r=dx(dx({},r),u.getChildContext())),d||null==u.getSnapshotBeforeUpdate||(m=u.getSnapshotBeforeUpdate(h,f)),_x(e,ux(E=null!=p&&p.type===gx&&null==p.key?p.props.children:p)?E:[E],t,n,r,i,o,s,a,l,c),u.base=t.__e,t.__u&=-161,u.__h.length&&s.push(u),g&&(u.__E=u.__=null)}catch(e){t.__v=null,l||null!=o?(t.__e=a,t.__u|=l?160:32,o[o.indexOf(a)]=null):(t.__e=n.__e,t.__k=n.__k),ex.__e(e,t,n)}else null==o&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=function(e,t,n,r,i,o,s,a,l){var c,p,u,d,h,f,m,g=n.props,y=t.props,v=t.type;if("svg"===v&&(i=!0),null!=o)for(c=0;c<o.length;c++)if((h=o[c])&&"setAttribute"in h==!!v&&(v?h.localName===v:3===h.nodeType)){e=h,o[c]=null;break}if(null==e){if(null===v)return document.createTextNode(y);e=i?document.createElementNS("http://www.w3.org/2000/svg",v):document.createElement(v,y.is&&y),o=null,a=!1}if(null===v)g===y||a&&e.data===y||(e.data=y);else{if(o=o&&Jw.call(e.childNodes),g=n.props||lx,!a&&null!=o)for(g={},c=0;c<e.attributes.length;c++)g[(h=e.attributes[c]).name]=h.value;for(c in g)h=g[c],"children"==c||("dangerouslySetInnerHTML"==c?u=h:"key"===c||c in y||Sx(e,c,null,h,i));for(c in y)h=y[c],"children"==c?d=h:"dangerouslySetInnerHTML"==c?p=h:"value"==c?f=h:"checked"==c?m=h:"key"===c||a&&"function"!=typeof h||g[c]===h||Sx(e,c,h,g[c],i);if(p)a||u&&(p.__html===u.__html||p.__html===e.innerHTML)||(e.innerHTML=p.__html),t.__k=[];else if(u&&(e.innerHTML=""),_x(e,ux(d)?d:[d],t,n,r,i&&"foreignObject"!==v,o,s,o?o[0]:n.__k&&vx(n,0),a,l),null!=o)for(c=o.length;c--;)null!=o[c]&&hx(o[c]);a||(c="value",void 0!==f&&(f!==e[c]||"progress"===v&&!f||"option"===v&&f!==g[c])&&Sx(e,c,f,g[c],!1),c="checked",void 0!==m&&m!==e[c]&&Sx(e,c,m,g[c],!1))}return e}(n.__e,t,n,r,i,o,s,l,c);(p=ex.diffed)&&p(t)}function Ax(e,t,n){t.__d=void 0;for(var r=0;r<n.length;r++)Dx(n[r],n[++r],n[++r]);ex.__c&&ex.__c(t,e),e.some((function(t){try{e=t.__h,t.__h=[],e.some((function(e){e.call(t)}))}catch(e){ex.__e(e,t.__v)}}))}function Dx(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){ex.__e(e,n)}}function Nx(e,t,n){var r,i;if(ex.unmount&&ex.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||Dx(r,null,t)),null!=(r=e.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){ex.__e(e,t)}r.base=r.__P=null,e.__c=void 0}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&Nx(r[i],t,n||"function"!=typeof e.type);n||null==e.__e||hx(e.__e),e.__=e.__e=e.__d=void 0}function Rx(e,t,n){return this.constructor(e,n)}function jx(e,t,n){var r,i,o,s;ex.__&&ex.__(e,t),i=(r="function"==typeof n)?null:n&&n.__k||t.__k,o=[],s=[],Mx(t,e=(!r&&n||t).__k=fx(gx,null,[e]),i||lx,lx,void 0!==t.ownerSVGElement,!r&&n?[n]:i?null:t.firstChild?Jw.call(t.childNodes):null,o,!r&&n?n:i?i.__e:t.firstChild,r,s),Ax(o,e,s)}function Lx(e,t){var n={__c:t="__cC"+sx++,__:e,Consumer:function(e,t){return e.children(t)},Provider:function(e){var n,r;return this.getChildContext||(n=[],(r={})[t]=this,this.getChildContext=function(){return r},this.shouldComponentUpdate=function(e){this.props.value!==e.value&&n.some((function(e){e.__e=!0,wx(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}Jw=cx.slice,ex={__e:function(e,t,n,r){for(var i,o,s;t=t.__;)if((i=t.__c)&&!i.__)try{if((o=i.constructor)&&null!=o.getDerivedStateFromError&&(i.setState(o.getDerivedStateFromError(e)),s=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(e,r||{}),s=i.__d),s)return i.__E=i}catch(t){e=t}throw e}},tx=0,yx.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=dx({},this.state),"function"==typeof e&&(e=e(dx({},n),this.props)),e&&dx(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),wx(this))},yx.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),wx(this))},yx.prototype.render=gx,nx=[],ix="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,ox=function(e,t){return e.__v.__b-t.__v.__b},xx.__r=0,sx=0;var Ix,zx,Bx,$x,qx=0,Fx=[],Vx=[],Hx=ex.__b,Ux=ex.__r,Wx=ex.diffed,Gx=ex.__c,Qx=ex.unmount;function Zx(e,t){ex.__h&&ex.__h(zx,e,qx||t),qx=0;var n=zx.__H||(zx.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:Vx}),n.__[e]}function Xx(e){return qx=1,Yx(p_,e)}function Yx(e,t,n){var r=Zx(Ix++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):p_(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=zx,!zx.u)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=r.__c.__H.__.filter((function(e){return e.__c}));if(i.every((function(e){return!e.__N})))return!o||o.call(this,e,t,n);var s=!1;return i.forEach((function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(s=!0)}})),!(!s&&r.__c.props===e)&&(!o||o.call(this,e,t,n))};zx.u=!0;var o=zx.shouldComponentUpdate,s=zx.componentWillUpdate;zx.componentWillUpdate=function(e,t,n){if(this.__e){var r=o;o=void 0,i(e,t,n),o=r}s&&s.call(this,e,t,n)},zx.shouldComponentUpdate=i}return r.__N||r.__}function Kx(e,t){var n=Zx(Ix++,3);!ex.__s&&c_(n.__H,t)&&(n.__=e,n.i=t,zx.__H.__h.push(n))}function Jx(e,t){var n=Zx(Ix++,4);!ex.__s&&c_(n.__H,t)&&(n.__=e,n.i=t,zx.__h.push(n))}function e_(e){return qx=5,t_((function(){return{current:e}}),[])}function t_(e,t){var n=Zx(Ix++,7);return c_(n.__H,t)?(n.__V=e(),n.i=t,n.__h=e,n.__V):n.__}function n_(e,t){return qx=8,t_((function(){return e}),t)}function r_(e){var t=zx.context[e.__c],n=Zx(Ix++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub(zx)),t.props.value):e.__}function i_(){for(var e;e=Fx.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(a_),e.__H.__h.forEach(l_),e.__H.__h=[]}catch(t){e.__H.__h=[],ex.__e(t,e.__v)}}ex.__b=function(e){zx=null,Hx&&Hx(e)},ex.__r=function(e){Ux&&Ux(e),Ix=0;var t=(zx=e.__c).__H;t&&(Bx===zx?(t.__h=[],zx.__h=[],t.__.forEach((function(e){e.__N&&(e.__=e.__N),e.__V=Vx,e.__N=e.i=void 0}))):(t.__h.forEach(a_),t.__h.forEach(l_),t.__h=[],Ix=0)),Bx=zx},ex.diffed=function(e){Wx&&Wx(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==Fx.push(t)&&$x===ex.requestAnimationFrame||(($x=ex.requestAnimationFrame)||s_)(i_)),t.__H.__.forEach((function(e){e.i&&(e.__H=e.i),e.__V!==Vx&&(e.__=e.__V),e.i=void 0,e.__V=Vx}))),Bx=zx=null},ex.__c=function(e,t){t.some((function(e){try{e.__h.forEach(a_),e.__h=e.__h.filter((function(e){return!e.__||l_(e)}))}catch(n){t.some((function(e){e.__h&&(e.__h=[])})),t=[],ex.__e(n,e.__v)}})),Gx&&Gx(e,t)},ex.unmount=function(e){Qx&&Qx(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach((function(e){try{a_(e)}catch(e){t=e}})),n.__H=void 0,t&&ex.__e(t,n.__v))};var o_="function"==typeof requestAnimationFrame;function s_(e){var t,n=function(){clearTimeout(r),o_&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);o_&&(t=requestAnimationFrame(n))}function a_(e){var t=zx,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),zx=t}function l_(e){var t=zx;e.__c=e.__(),zx=t}function c_(e,t){return!e||e.length!==t.length||t.some((function(t,n){return t!==e[n]}))}function p_(e,t){return"function"==typeof t?t(e):t}function u_(e,t){for(var n in t)e[n]=t[n];return e}function d_(e,t){for(var n in e)if("__source"!==n&&!(n in t))return!0;for(var r in t)if("__source"!==r&&e[r]!==t[r])return!0;return!1}function h_(e){this.props=e}(h_.prototype=new yx).isPureReactComponent=!0,h_.prototype.shouldComponentUpdate=function(e,t){return d_(this.props,e)||d_(this.state,t)};var f_=ex.__b;ex.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),f_&&f_(e)};var m_="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function g_(e){function t(t){var n=u_({},t);return delete n.ref,e(n,t.ref||null)}return t.$$typeof=m_,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var y_=ex.__e;ex.__e=function(e,t,n,r){if(e.then)for(var i,o=t;o=o.__;)if((i=o.__c)&&i.__c)return null==t.__e&&(t.__e=n.__e,t.__k=n.__k),i.__c(e,t);y_(e,t,n,r)};var v_=ex.unmount;function b_(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=u_({},e)).__c&&(e.__c.__P===n&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map((function(e){return b_(e,t,n)}))),e}function w_(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map((function(e){return w_(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 x_(){this.__u=0,this.t=null,this.__b=null}function __(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function k_(){this.u=null,this.o=null}ex.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),v_&&v_(e)},(x_.prototype=new yx).__c=function(e,t){var n=t.__c,r=this;null==r.t&&(r.t=[]),r.t.push(n);var i=__(r.__v),o=!1,s=function(){o||(o=!0,n.__R=null,i?i(a):a())};n.__R=s;var a=function(){if(! --r.__u){if(r.state.__a){var e=r.state.__a;r.__v.__k[0]=w_(e,e.__c.__P,e.__c.__O)}var t;for(r.setState({__a:r.__b=null});t=r.t.pop();)t.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(s,s)},x_.prototype.componentWillUnmount=function(){this.t=[]},x_.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=b_(this.__b,n,r.__O=r.__P)}this.__b=null}var i=t.__a&&fx(gx,null,e.fallback);return i&&(i.__u&=-33),[fx(gx,null,t.__a?null:e.children),i]};var E_=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 O_(e){return this.getChildContext=function(){return e.context},e.children}function P_(e){var t=this,n=e.i;t.componentWillUnmount=function(){jx(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)}}),jx(fx(O_,{context:t.context},e.__v),t.l)}function S_(e,t){var n=fx(P_,{__v:e,i:t});return n.containerInfo=t,n}(k_.prototype=new yx).__a=function(e){var t=this,n=__(t.__v),r=t.o.get(e);return r[0]++,function(i){var o=function(){t.props.revealOrder?(r.push(i),E_(t,e,r)):i()};n?n(o):o()}},k_.prototype.render=function(e){this.u=null,this.o=new Map;var t=Ex(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},k_.prototype.componentDidUpdate=k_.prototype.componentDidMount=function(){var e=this;this.o.forEach((function(t,n){E_(e,n,t)}))};var C_="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,T_=/^(?: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]/,M_=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,A_=/[A-Z0-9]/g,D_="undefined"!=typeof document,N_=function(e){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(e)};yx.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach((function(e){Object.defineProperty(yx.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_=ex.event;function j_(){}function L_(){return this.cancelBubble}function I_(){return this.defaultPrevented}ex.event=function(e){return R_&&(e=R_(e)),e.persist=j_,e.isPropagationStopped=L_,e.isDefaultPrevented=I_,e.nativeEvent=e};var z_={enumerable:!1,configurable:!0,get:function(){return this.class}},B_=ex.vnode;ex.vnode=function(e){"string"==typeof e.type&&function(e){var t=e.props,n=e.type,r={};for(var i in t){var o=t[i];if(!("value"===i&&"defaultValue"in t&&null==o||D_&&"children"===i&&"noscript"===n||"class"===i||"className"===i)){var s=i.toLowerCase();"defaultValue"===i&&"value"in t&&null==t.value?i="value":"download"===i&&!0===o?o="":"ondoubleclick"===s?i="ondblclick":"onchange"!==s||"input"!==n&&"textarea"!==n||N_(t.type)?"onfocus"===s?i="onfocusin":"onblur"===s?i="onfocusout":M_.test(i)?i=s:-1===n.indexOf("-")&&T_.test(i)?i=i.replace(A_,"-$&").toLowerCase():null===o&&(o=void 0):s=i="oninput","oninput"===s&&r[i=s]&&(i="oninputCapture"),r[i]=o}}"select"==n&&r.multiple&&Array.isArray(r.value)&&(r.value=Ex(t.children).forEach((function(e){e.props.selected=-1!=r.value.indexOf(e.props.value)}))),"select"==n&&null!=r.defaultValue&&(r.value=Ex(t.children).forEach((function(e){e.props.selected=r.multiple?-1!=r.defaultValue.indexOf(e.props.value):r.defaultValue==e.props.value}))),t.class&&!t.className?(r.class=t.class,Object.defineProperty(r,"className",z_)):(t.className&&!t.class||t.class&&t.className)&&(r.class=r.className=t.className),e.props=r}(e),e.$$typeof=C_,B_&&B_(e)};var $_=ex.__r;ex.__r=function(e){$_&&$_(e),e.__c};var q_=ex.diffed;ex.diffed=function(e){q_&&q_(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 F_=fx,V_=0;function H_(e,t,n,r,i,o){var s,a,l={};for(a in t)"ref"==a?s=t[a]:l[a]=t[a];var c={type:e,props:l,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--V_,__i:-1,__u:0,__source:i,__self:o};if("function"==typeof e&&(s=e.defaultProps))for(a in s)void 0===l[a]&&(l[a]=s[a]);return ex.vnode&&ex.vnode(c),c}var U_="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function W_(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var G_,Q_={exports:{}};
|
|
171
|
+
`,this._current.container)},Hl.prototype.open=function(e,t,n,r){if(!e)throw new Error("target is missing");if(!t)throw new Error("providers for <"+t+"> not found");if(!n)throw new Error("position is missing");this.isOpen()&&this.close();const{entries:i,headerEntries:o,emptyPlaceholder:s}=this._getContext(e,t);this._current={position:n,providerId:t,target:e,entries:i,headerEntries:o,emptyPlaceholder:s,container:this._createContainer({provider:t}),options:r},this._emit("open"),this._bindAutoClose(),this._render()},Hl.prototype.refresh=function(){if(!this.isOpen())return;const{target:e,providerId:t}=this._current,{entries:n,headerEntries:r,emptyPlaceholder:i}=this._getContext(e,t);this._current={...this._current,entries:n,headerEntries:r,emptyPlaceholder:i},this._emit("refresh"),this._render()},Hl.prototype._getContext=function(e,t){const n=this._getProviders(t);if(!n||!n.length)throw new Error("provider for <"+t+"> not found");const r=this._getEntries(e,n),i=this._getHeaderEntries(e,n);return{entries:r,headerEntries:i,emptyPlaceholder:this._getEmptyPlaceholder(n),empty:!(Object.keys(r).length||Object.keys(i).length)}},Hl.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},Hl.prototype.reset=function(){const e=this._current.container;il(null,e),we(e)},Hl.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},Hl.prototype._onOpened=function(){this._emit("opened")},Hl.prototype._onClosed=function(){this._emit("closed")},Hl.prototype._createContainer=function(e){var t=this._canvas.getContainer();const n=ge(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return t.appendChild(n),n},Hl.prototype._bindAutoClose=function(){this._eventBus.once(Vl,this.close,this)},Hl.prototype._unbindAutoClose=function(){this._eventBus.off(Vl,this.close,this)},Hl.prototype._updateScale=function(){var e,t,n=this._canvas.zoom(),r=this._config.scale,i=n;return!0!==r&&(!1===r?(e=1,t=1):(e=r.min,t=r.max),a(e)&&n<e&&(i=e),a(t)&&n>t&&(i=t)),i},Hl.prototype._ensureVisible=function(e,t){var n=document.documentElement.getBoundingClientRect(),r=e.getBoundingClientRect(),i={},o=t.x,s=t.y;return t.x+r.width>n.width&&(i.x=!0),t.y+r.height>n.height&&(i.y=!0),i.x&&i.y?(o=t.x-r.width,s=t.y-r.height):i.x?(o=t.x-r.width,s=t.y):i.y&&t.y<r.height?(o=t.x,s=10):i.y&&(o=t.x,s=t.y-r.height),t.y<n.top&&(s=t.y+r.height),{x:o,y:s}},Hl.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},Hl.prototype.registerProvider=function(e,t,n){n||(n=t,t=1e3),this._eventBus.on("popupMenu.getProviders."+e,t,(function(e){e.providers.push(n)}))},Hl.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},Hl.prototype._getEntries=function(e,t){var n={};return v(t,(function(t){if(t.getPopupMenuEntries){var r=t.getPopupMenuEntries(e);d(r)?n=r(n):v(r,(function(e,t){n[t]=e}))}else v(t.getEntries(e),(function(e){var t=e.id;if(!t)throw new Error("entry ID is missing");n[t]=q(e,["id"])}))})),n},Hl.prototype._getHeaderEntries=function(e,t){var n={};return v(t,(function(t){if(t.getPopupMenuHeaderEntries){var r=t.getPopupMenuHeaderEntries(e);d(r)?n=r(n):v(r,(function(e,t){n[t]=e}))}else{if(!t.getHeaderEntries)return;v(t.getHeaderEntries(e),(function(e){var t=e.id;if(!t)throw new Error("entry ID is missing");n[t]=q(e,["id"])}))}})),n},Hl.prototype._getEmptyPlaceholder=function(e){const t=e.find((e=>d(e.getEmptyPlaceholder)));return t&&t.getEmptyPlaceholder()},Hl.prototype.isOpen=function(){return!!this._current},Hl.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let n=X(te(e.delegateTarget||e.target,".entry",!0),"data-id");t={id:n,...this._getEntry(n)}}const r=t.action;if(!1!==this._emit("trigger",{entry:t,event:e}))if(d(r)){if("click"===n)return r(e,t)}else if(r[n])return r[n](e,t)},Hl.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 Zl={search:["value",function(e,t,n){const{keys:r}=n;if(!(t=t.trim().toLowerCase()))throw new Error("<pattern> must not be empty");const i=t.trim().toLowerCase().split(/\s+/);return e.flatMap((e=>{const t=function(e,t,n){const{matchedWords:r,tokens:i}=n.reduce(((n,r)=>{const i=e[r],{tokens:o,matchedWords:s}=function(e,t){if(!e)return{tokens:[],matchedWords:{}};const n=[],r={},i=t.map(Ql),o=[`(?<all>${i.join("\\s+")})`,...i].join("|"),s=new RegExp(o,"ig");let a,l=0;for(;a=s.exec(e);){const[i]=a,o=a.index,s=a.index+i.length,c=0===o,p=s===e.length,u=!!a.groups.all,d=c||/\s/.test(e.charAt(o-1)),h=p||/\s/.test(e.charAt(s+1));a.index>l&&n.push({value:e.slice(l,a.index),index:l}),n.push({value:i,index:a.index,match:!0,wordStart:d,wordEnd:h,start:c,end:p,all:u});const f=u?t:[i];for(const e of f)r[e.toLowerCase()]=!0;l=a.index+i.length}l<e.length&&n.push({value:e.slice(l),index:l});return{tokens:n,matchedWords:r}}(i,t);return{tokens:{...n.tokens,[r]:o},matchedWords:{...n.matchedWords,...s}}}),{matchedWords:{},tokens:{}});if(Object.keys(r).length!==t.length)return null;return i}(e,i,r);return t?{item:e,tokens:t}:[]})).sort(function(e){return(t,n)=>{for(const r of e){const e=Ul(t.tokens[r],n.tokens[r]);if(0!==e)return e;const i=Gl(t.item[r],n.item[r]);if(0!==i)return i}return 0}}(r))}]},Xl={__depends__:[Zl],__init__:["popupMenu"],popupMenu:["type",Hl]},Yl={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 Kl(e,t,n,r){e.registerProvider(900,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=r}Kl.$inject=["contextPad","popupMenu","translate","canvas"],Kl.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&I(t,this._getEntries(e)),t},Kl.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},Kl.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${Yl.align}</div>`,action:{click:function(t,n){var r=e._getMenuPosition(n);I(r,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",r)}}}}},Kl.prototype._getMenuPosition=function(e){var t=this._contextPad.getPad(e).html.getBoundingClientRect();return{x:t.left,y:t.bottom+5}};var Jl=["left","center","right","top","middle","bottom"];function ec(e,t,n,r){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=r,e.registerProvider("align-elements",this)}function tc(e){Ho.call(this,e),this.init()}function nc(e){tc.call(this,e)}ec.$inject=["popupMenu","alignElements","translate","rules"],ec.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&I(t,this._getEntries(e)),t},ec.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},ec.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,r=this._popupMenu,i={};return v(Jl,(function(o){i["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:Yl[o],action:function(){t.trigger(e,o),r.close()}}})),i},tc.$inject=["eventBus"],e(tc,Ho),tc.prototype.addRule=function(e,t,n){var r=this;"string"==typeof e&&(e=[e]),e.forEach((function(e){r.canExecute(e,t,(function(e,t,r){return n(e)}),!0)}))},tc.prototype.init=function(){},nc.$inject=["eventBus"],e(nc,tc),nc.prototype.init=function(){this.addRule("elements.align",(function(e){var t=y(e.elements,(function(e){return!(e.waypoints||e.host||e.labelTarget)}));return!((t=ht(t)).length<2)&&t}))};var rc={__depends__:[ba,Aa,Xl],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",Kl],alignElementsMenuProvider:["type",ec],bpmnAlignElements:["type",nc]},ic=10,oc=50,sc=250;function ac(e,t,n,r){for(var i;i=cc(e,n,t);)n=r(t,n,i);return n}function lc(e){return function(t,n,r){var i={x:n.x,y:n.y};return["x","y"].forEach((function(o){var s=e[o];if(s){var a="x"===o?"width":"height",l=s.margin,c=s.minDistance;i[o]=l<0?Math.min(r[o]+l-t[a]/2,n[o]-c+l):Math.max(r[o]+r[a]+l+t[a]/2,n[o]+c+l)}})),i}}function cc(e,t,n){var r={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},i=function(e){var t=pc(e);e.host&&(t=t.concat(pc(e.host)));e.attachers&&(t=t.concat(e.attachers.reduce((function(e,t){return e.concat(pc(t))}),[])));return t}(e);return m(i,(function(e){return e!==n&&"intersect"===xn(e,r,ic)}))}function pc(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 uc(){return!0}function dc(e,t,n){e.on("autoPlace",100,(function(e){var t=e.shape;return function(e,t,n){n||(n={});var r=n.defaultDistance||oc,i=wn(e),o=yn(e);return{x:o.right+r+t.width/2,y:i.y}}(e.source,t)})),e.on("autoPlace.end",(function(e){n.scrollToElement(e.shape)})),this.append=function(n,r,i){e.fire("autoPlace.start",{source:n,shape:r});var o=e.fire("autoPlace",{source:n,shape:r}),s=t.appendShape(n,r,o,n.parent,i);return e.fire("autoPlace.end",{source:n,shape:s}),s}}function hc(e,t){e.on("autoPlace.end",500,(function(e){t.select(e.shape)}))}dc.$inject=["eventBus","modeling","canvas"],hc.$inject=["eventBus","selection"];var fc={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",dc],autoPlaceSelectionBehavior:["type",hc]};function mc(e,t){for(h(t)&&(t=[t]);e=e.parent;)if(Ei(e,t))return e;return null}function gc(e,t){var n=mc(e,"bpmn:Process");if(n)return!0;var r,i=["bpmn:Participant","bpmn:Lane"];if(n=mc(e,i))return Hi(n);if(Ei(e,i))return Hi(e);for(r=Oi(e);r&&!ki(r,"bpmn:Process");r=r.$parent);if(!t)return!0;var o=t.find((function(e){var t=Oi(e);return t&&t.get("processRef")===r}));return!o||Hi(o)}function yc(e,t,n){var r=gc(e,n);return ki(t,"bpmn:TextAnnotation")?function(e,t,n){var r=yn(e),i=n?{x:r.right+t.width/2,y:r.top-50-t.height/2}:{x:r.right+50+t.width/2,y:r.bottom+t.height/2};hn(e)&&(i=wn(e),n?(i.x+=100,i.y-=50):(i.x+=100,i.y+=50));var o={margin:n?-30:30,minDistance:20},s=n?{y:o}:{x:o};return ac(e,t,i,lc(s))}(e,t,r):Ei(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])?function(e,t,n){var r=yn(e),i=n?{x:r.right-10+t.width/2,y:r.bottom+40+t.width/2}:{x:r.left-40-t.width/2,y:r.bottom-10+t.height/2},o={margin:30,minDistance:30},s=n?{x:o}:{y:o};return ac(e,t,i,lc(s))}(e,t,r):ki(t,"bpmn:FlowNode")?function(e,t,n){var r=yn(e),i=wn(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||oc,r=t.direction||"e",i=t.filter,o=t.getWeight||function(t){return t.source===e?1:-1},s=t.maxDistance||sc,a=t.reference||"start";function l(e,t){return"n"===r?"start"===a?yn(e).top-yn(t).bottom:"center"===a?yn(e).top-wn(t).y:yn(e).top-yn(t).top:"w"===r?"start"===a?yn(e).left-yn(t).right:"center"===a?yn(e).left-wn(t).x:yn(e).left-yn(t).left:"s"===r?"start"===a?yn(t).top-yn(e).bottom:"center"===a?wn(t).y-yn(e).bottom:yn(t).bottom-yn(e).bottom:"start"===a?yn(t).left-yn(e).right:"center"===a?wn(t).x-yn(e).right:yn(t).right-yn(e).right}i||(i=uc);var c=e.incoming.filter(i).map((function(t){var n=o(t),r=n<0?l(t.source,e):l(e,t.source);return{id:t.source.id,distance:r,weight:n}})),p=e.outgoing.filter(i).map((function(t){var n=o(t),r=n>0?l(e,t.target):l(t.target,e);return{id:t.target.id,distance:r,weight:n}})),u=w(c.concat(p).reduce((function(e,t){return e[t.id+"__weight_"+t.weight]=t,e}),{}),(function(e,t){var n=t.distance,r=t.weight;return n<0||n>s||(e[String(n)]||(e[String(n)]=0),e[String(n)]+=1*r,(!e.distance||e[e.distance]<e[String(n)])&&(e.distance=n)),e}),{});return u.distance||n}(e,{filter:function(e){return ki(e,"bpmn:SequenceFlow")},direction:o.directionHint}),a=30,l=o.minDistance,c=o.baseOrientation;ki(e,"bpmn:BoundaryEvent")&&-1!==(c=xn(e,e.host,-25)).indexOf(o.boundaryOrientation)&&(a*=-1);var p=n?{x:r.right+s+t.width/2,y:i.y+vc(c,l,o)}:{x:i.x+vc(c,l,o),y:r.bottom+s+t.height/2},u={margin:a,minDistance:l},d=n?{y:u}:{x:u};return ac(e,t,p,lc(d))}(e,t,r):void 0}function vc(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function bc(e,t){e.on("autoPlace",(function(e){var n=e.shape;return yc(e.source,n,t)}))}bc.$inject=["eventBus","elementRegistry"];var wc={__depends__:[fc],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",bc]};function xc(e,t,n,i){Ho.call(this,e),this._elementRegistry=t,this._modeling=n,this._rules=i;var o=this;this.postExecuted(["shape.create"],(function(e){var t=e.context,n=t.hints||{},r=t.shape,i=t.parent||t.newParent;!1!==n.autoResize&&o._expand([r],i)})),this.postExecuted(["elements.move"],(function(e){var t=e.context,n=r(O(t.closure.topLevel)),i=t.hints,s=!i||i.autoResize;!1!==s&&v(P(n,(function(e){return e.parent.id})),(function(e,t){c(s)&&(e=e.filter((function(e){return m(s,M({id:e.id}))}))),o._expand(e,t)}))})),this.postExecuted(["shape.toggleCollapse"],(function(e){var t=e.context,n=t.hints,r=t.shape;n&&!1===n.autoResize||r.collapsed||o._expand(r.children||[],r)})),this.postExecuted(["shape.resize"],(function(e){var t=e.context,n=t.hints,r=t.shape,i=r.parent;n&&!1===n.autoResize||i&&o._expand([r],i)}))}function _c(e){e.invoke(xc,this)}function kc(e){tc.call(this,e);var t=this;this.addRule("element.autoResize",(function(e){return t.canResize(e.elements,e.target)}))}function Ec(e,t){kc.call(this,e),this._modeling=t}xc.$inject=["eventBus","elementRegistry","modeling","rules"],e(xc,Ho),xc.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),r=this.getPadding(t),i=yn(vt(e)),o=yn(t),s={};return i.top-o.top<r.top&&(s.top=i.top-n.top),i.left-o.left<r.left&&(s.left=i.left-n.left),o.right-i.right<r.right&&(s.right=i.right+n.right),o.bottom-i.bottom<r.bottom&&(s.bottom=i.bottom+n.bottom),vn(I({},o,s))},xc.prototype._expand=function(e,t){if("string"==typeof t&&(t=this._elementRegistry.get(t)),this._rules.allowed("element.autoResize",{elements:e,target:t})){var n=this._getOptimalBounds(e,t);if(function(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}(n,t)){var r=function(e,t){var n="";e=yn(e),t=yn(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}($(t,["x","y","width","height"]),n);this.resize(t,n,{autoResize:r});var i=t.parent;i&&this._expand([t],i)}}},xc.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},xc.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},xc.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)},_c.$inject=["injector"],e(_c,xc),_c.prototype.resize=function(e,t,n){ki(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)},kc.$inject=["eventBus"],e(kc,tc),kc.prototype.canResize=function(e,t){return!1},e(Ec,kc),Ec.$inject=["eventBus","modeling"],Ec.prototype.canResize=function(e,t){if(ki(t.di,"bpmndi:BPMNPlane"))return!1;if(!ki(t,"bpmn:Participant")&&!ki(t,"bpmn:Lane")&&!ki(t,"bpmn:SubProcess"))return!1;var n=!0;return v(e,(function(e){(ki(e,"bpmn:Lane")||fn(e))&&(n=!1)})),n};var Oc={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",_c],bpmnAutoResizeProvider:["type",Ec]};function Pc(e,t,n){var r,i,o=this,s=n.get("dragging",!1);s&&t.on("drag.start",(function(n){t.once("drag.move",1500,(function(t){!function(t){if(!t.hover){var n=t.originalEvent,r=o._findTargetGfx(n),i=r&&e.get(r);r&&i&&(t.stopPropagation(),s.hover({element:i,gfx:r}),s.move(n))}}(t)}))})),t.on("element.hover",(function(e){r=e.gfx,i=e.element})),t.on("element.hover",1500,(function(e){i&&t.fire("element.out",{element:i,gfx:r})})),t.on("element.out",(function(){r=null,i=null})),this._findTargetGfx=function(e){var t;if(e instanceof MouseEvent)return t=gs(e),function(e){return te(e,"svg, .djs-element",!0)}(document.elementFromPoint(t.x,t.y))}}Pc.$inject=["elementRegistry","eventBus","injector"];var Sc={__init__:["hoverFix"],hoverFix:["type",Pc]},Cc=Math.round,Tc="djs-drag-active";function Mc(e){e.preventDefault()}function Ac(e,t,n,r){var i,o={threshold:5,trapClick:!0};function s(e){var n=t.viewbox(),r=t._container.getBoundingClientRect();return{x:n.x+(e.x-r.left)/n.scale,y:n.y+(e.y-r.top)/n.scale}}function a(t,n){n=n||i;var r=e.createEvent(I({},n.payload,n.data,{isTouch:n.isTouch}));return!1!==e.fire("drag."+t,r)&&e.fire(n.prefix+"."+t,r)}function l(e,r){var o,l=i.payload,c=i.displacement,p=i.globalStart,u=gs(e),d=ia(u,p),h=i.localStart,f=s(u),g=ia(f,h);if(!i.active&&(r||(o=d,Math.sqrt(Math.pow(o.x,2)+Math.pow(o.y,2))>i.threshold))){if(I(l,{x:Cc(h.x+c.x),y:Cc(h.y+c.y),dx:0,dy:0},{originalEvent:e}),!1===a("start"))return m();i.active=!0,i.keepSelection||(l.previousSelection=n.get(),n.select(null)),i.cursor&&Js(i.cursor),t.addMarker(t.getRootElement(),Tc)}ms(e),i.active&&(I(l,{x:Cc(f.x+c.x),y:Cc(f.y+c.y),dx:Cc(g.x),dy:Cc(g.y)},{originalEvent:e}),a("move"))}function c(e){var t=!0;i.active&&(e&&(i.payload.originalEvent=e,ms(e)),t=a("end")),!1===t&&a("rejected"),a("ended",g(!0!==t))}function p(e){Bs("Escape",e)&&(Mc(e),m())}function u(t){var n;i.active&&(n=na(e),setTimeout(n,400),Mc(t)),c(t)}function d(e){l(e)}function h(e){var t=i.payload;t.hoverGfx=e.gfx,t.hover=e.element,a("hover")}function f(e){a("out");var t=i.payload;t.hoverGfx=null,t.hover=null}function m(e){var t;if(i){var n=i.active;n&&a("cancel"),t=g(e),n&&a("canceled",t)}}function g(o){var s,g;a("cleanup"),ea(),g=i.trapClick?u:c,ce.unbind(document,"mousemove",l),ce.unbind(document,"dragstart",Mc),ce.unbind(document,"selectstart",Mc),ce.unbind(document,"mousedown",g,!0),ce.unbind(document,"mouseup",g,!0),ce.unbind(document,"keyup",p),ce.unbind(document,"touchstart",d,!0),ce.unbind(document,"touchcancel",m,!0),ce.unbind(document,"touchmove",l,!0),ce.unbind(document,"touchend",c,!0),e.off("element.hover",h),e.off("element.out",f),t.removeMarker(t.getRootElement(),Tc);var y=i.payload.previousSelection;return!1!==o&&y&&!n.get().length&&function(e){var t=e.filter((function(e){return r.get(e.id)}));t.length&&n.select(t)}(y),s=i,i=null,s}e.on("diagram.destroy",m),this.init=function(t,n,r,g){i&&m(!1),"string"==typeof n&&(g=r,r=n,n=null);var y,v,b,w,x,_=(g=I({},o,g||{})).data||{};w=g.trapClick?u:c,t?(y=fs(t)||t,v=gs(t),ms(t),"dragstart"===y.type&&Mc(y)):(y=null,v={x:0,y:0}),b=s(v),n||(n=b),x=function(e){return"undefined"!=typeof TouchEvent&&e instanceof TouchEvent}(y),i=I({prefix:r,data:_,payload:{},globalStart:v,displacement:ia(n,b),localStart:b,isTouch:x},g),g.manual||(x?(ce.bind(document,"touchstart",d,!0),ce.bind(document,"touchcancel",m,!0),ce.bind(document,"touchmove",l,!0),ce.bind(document,"touchend",c,!0)):(ce.bind(document,"mousemove",l),ce.bind(document,"dragstart",Mc),ce.bind(document,"selectstart",Mc),ce.bind(document,"mousedown",w,!0),ce.bind(document,"mouseup",w,!0)),ce.bind(document,"keyup",p),e.on("element.hover",h),e.on("element.out",f)),a("init"),g.autoActivate&&l(t,!0)},this.move=l,this.hover=h,this.out=f,this.end=c,this.cancel=m,this.context=function(){return i},this.setOptions=function(e){I(o,e)}}Ac.$inject=["eventBus","canvas","selection","elementRegistry"];var Dc={__depends__:[Sc,Ds],dragging:["type",Ac]};function Nc(e,t,n){this._canvas=n,this._opts=I({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var r=this;t.on("drag.move",(function(e){var t=r._toBorderPoint(e);r.startScroll(t)})),t.on(["drag.cleanup"],(function(){r.stopScroll()}))}function Rc(e,t,n){return t<e&&e<n}Nc.$inject=["config.autoScroll","eventBus","canvas"],Nc.prototype.startScroll=function(e){var t=this._canvas,n=this._opts,r=this,i=t.getContainer().getBoundingClientRect(),o=[e.x,e.y,i.width-e.x,i.height-e.y];this.stopScroll();for(var s=0,a=0,l=0;l<4;l++)Rc(o[l],n.scrollThresholdOut[l],n.scrollThresholdIn[l])&&(0===l?s=n.scrollStep:1==l?a=n.scrollStep:2==l?s=-n.scrollStep:3==l&&(a=-n.scrollStep));0===s&&0===a||(t.scroll({dx:s,dy:a}),this._scrolling=setTimeout((function(){r.startScroll(e)}),n.scrollRepeatTimeout))},Nc.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Nc.prototype.setOptions=function(e){this._opts=I({},this._opts,e)},Nc.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=gs(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};var jc={__depends__:[Dc],__init__:["autoScroll"],autoScroll:["type",Nc]};function Lc(e){this._commandStack=e.get("commandStack",!1)}Lc.$inject=["injector"],Lc.prototype.allowed=function(e,t){var n=!0,r=this._commandStack;return r&&(n=r.canExecute(e,t)),void 0===n||n};var Ic={__init__:["rules"],rules:["type",Lc]},zc=Math.round,Bc=Math.max;var $c=10;function qc(e,t){return function(e,t){var n,r;for(n=0;r=e[n];n++)if(St(r,t)<=$c)return{point:e[n],bendpoint:!0,index:n};return null}(e,t)||function(e,t){var n,r,i=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,$c),(n=[],e.forEach((function(e,t){n.push([0===t?"M":"L",e.x,e.y])})),n)),o=i[0],s=i[i.length-1];return o?o!==s?o.segment2!==s.segment2?{point:e[r=Bc(o.segment2,s.segment2)-1],bendpoint:!0,index:r}:{point:{x:zc(o.x+s.x)/2,y:zc(o.y+s.y)/2},index:o.segment2}:{point:{x:zc(o.x),y:zc(o.y)},index:o.segment2}:null}(e,t)}function Fc(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Vc(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function Hc(e,t){var n=t[0],r=t[1],i={x:r.x-n.x,y:r.y-n.y},o=function(e,t,n){var r=[{n:e[0]-n[0],lambda:t[0]},{n:e[1]-n[1],lambda:t[1]}];return-(r[0].n*t[0]+r[1].n*t[1])/(r[0].lambda*t[0]+r[1].lambda*t[1])}([n.x,n.y],[i.x,i.y],[e.x,e.y]);return{x:n.x+o*i.x,y:n.y+o*i.y}}function Uc(e,t){var n=Hc(e,t);return Fc({x:n.x-e.x,y:n.y-e.y})}function Wc(e,t){return Fc({x:e.x-t.x,y:e.y-t.y})}var Gc="djs-bendpoint",Qc="djs-segment-dragger";function Zc(e,t,n){var r=function(e,t){var n,r=gs(t),i=e._container.getBoundingClientRect();n={x:i.left,y:i.top};var o=e.viewbox();return{x:o.x+(r.x-n.x)/o.scale,y:o.y+(r.y-n.y)/o.scale}}(e,n);return qc(t,r)}function Xc(e,t){var n=Re("g");Se(n).add(Gc),xe(e,n);var r=Re("circle");Oe(r,{cx:0,cy:0,r:4}),Se(r).add("djs-visual"),xe(n,r);var i=Re("circle");return Oe(i,{cx:0,cy:0,r:10}),Se(i).add("djs-hit"),xe(n,i),t&&Se(n).add(t),n}function Yc(e,t,n,r){var i=Re("g");xe(e,i);var o=function(e,t,n){var r=t.x-e.x,i=t.y-e.y;return Jc("h"===n?r:i)}(t,n,r),s=Re("rect");Oe(s,{x:-9,y:-3,width:18,height:6}),Se(s).add("djs-visual"),xe(i,s);var a=Re("rect");return Oe(a,{x:-o/2,y:-8.5,width:o,height:17}),Se(a).add("djs-hit"),xe(i,a),Kn(i,"v"===r?90:0),i}function Kc(e,t,n){var r=Re("g"),i=Nt(t,n),o=Mt(t,n);return xe(e,r),Yc(r,t,n,o),Se(r).add(Qc),Se(r).add("h"===o?"horizontal":"vertical"),Yn(r,i.x,i.y),r}function Jc(e){return Math.abs(Math.round(2*e/3))}function ep(e,t){var n=function(e,t){for(var n,r=t.waypoints,i=1/0,o=0;o<r.length-1;o++){var s=Uc(e,[r[o],r[o+1]]);s<i&&(i=s,n=o)}return[r[n],r[n+1]]}(e,t);return Hc(e,n)}function tp(e,t,n,r,i){function o(e,n){var o,s=n.waypoints,a=Zc(t,s,e);if(a)return o=function(e,t){var n,r,i=e.waypoints;return t.index<=0||t.bendpoint?null:(r=Mt((n={start:i[t.index-1],end:i[t.index]}).start,n.end))?Jc("h"===r?n.end.x-n.start.x:n.end.y-n.start.y)/2:null}(n,a),!function(e,t,n){var r,i,o,s,a,l,c=e.index,p=e.point;return!(c<=0||e.bendpoint)&&(o=Nt(r=t[c-1],i=t[c]),s=Mt(r,i),a=Math.abs(p.x-o.x),l=Math.abs(p.y-o.y),s&&a<=n&&l<=n)}(a,s,o)?r.start(e,n,a.index,!a.bendpoint):i.start(e,n,a.index),!0}function s(e,t,r){ce.bind(e,t,(function(e){n.triggerMouseEvent(t,e,r),e.stopPropagation()}))}function a(e,n){var r=t.getLayer("overlays"),i=ve('.djs-bendpoints[data-element-id="'+Qo(e.id)+'"]',r);return!i&&n&&(Oe(i=Re("g"),{"data-element-id":e.id}),Se(i).add("djs-bendpoints"),xe(r,i),s(i,"mousedown",e),s(i,"click",e),s(i,"dblclick",e)),i}function l(e,t){return ve('.djs-segment-dragger[data-segment-idx="'+e+'"]',t)}function c(e,t){t.waypoints.forEach((function(t,n){var r=Xc(e);xe(e,r),Yn(r,t.x,t.y)})),Xc(e,"floating")}function p(e,t){for(var n,r,i,o=t.waypoints,a=1;a<o.length;a++)Mt(n=o[a-1],r=o[a])&&(Oe(i=Kc(e,n,r),{"data-segment-idx":a}),s(i,"mousemove",t))}function u(e){var t=a(e);return t||(c(t=a(e,!0),e),p(t,e)),t}function d(e){var t=a(e);t&&(!function(e){v(be("."+Qc,e),(function(e){Ue(e)}))}(t),function(e){v(be("."+Gc,e),(function(e){Ue(e)}))}(t),p(t,e),c(t,e))}function h(e,t,n){var r,i,o=l(t.index,e),s=n[t.index-1],a=n[t.index],c=t.point,p=Nt(s,a),u=Mt(s,a);o&&(r=function(e){return ve(".djs-visual",e)}(o),i={x:c.x-p.x,y:c.y-p.y},"v"===u&&(i={x:i.y,y:i.x}),Yn(r,i.x,i.y))}e.on("connection.changed",(function(e){d(e.element)})),e.on("connection.remove",(function(e){var t=a(e.element);t&&Ue(t)})),e.on("element.marker.update",(function(e){var t,n=e.element;n.waypoints&&(t=u(n),e.add?Se(t).add(e.marker):Se(t).remove(e.marker))})),e.on("element.mousemove",(function(e){var n,r,i=e.element,o=i.waypoints;if(o){if(n=a(i,!0),!(r=Zc(t,o,e.originalEvent)))return;!function(e,t){var n=ve(".floating",e),r=t.point;n&&Yn(n,r.x,r.y)}(n,r),r.bendpoint||h(n,r,o)}})),e.on("element.mousedown",(function(e){if(bs(e)){var t=e.originalEvent,n=e.element;if(n.waypoints)return o(t,n)}})),e.on("selection.changed",(function(e){var t=e.newSelection[0];t&&t.waypoints&&u(t)})),e.on("element.hover",(function(e){var t=e.element;t.waypoints&&(u(t),n.registerEvent(e.gfx,"mousemove","element.mousemove"))})),e.on("element.out",(function(e){n.unregisterEvent(e.gfx,"mousemove","element.mousemove")})),e.on("element.updateId",(function(e){var t=e.element,n=e.newId;if(t.waypoints){var r=a(t);r&&Oe(r,{"data-element-id":n})}})),this.addHandles=u,this.updateHandles=d,this.getBendpointsContainer=a,this.getSegmentDragger=l}tp.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];var np=Math.round,rp="reconnectStart",ip="reconnectEnd",op="updateWaypoints";function sp(e,t,n,r,i,o){this._injector=e,this.start=function(e,t,o,s){var a,l=n.getGraphics(t),c=t.source,p=t.target,u=t.waypoints,d=(a=s||0!==o?s||o!==u.length-1?op:ip:rp)===op?"connection.updateWaypoints":"connection.reconnect",h=i.allowed(d,{connection:t,source:c,target:p});!1===h&&(h=i.allowed(d,{connection:t,source:p,target:c})),!1!==h&&r.init(e,"bendpoint.move",{data:{connection:t,connectionGfx:l,context:{allowed:h,bendpointIndex:o,connection:t,source:c,target:p,insert:s,type:a}}})},t.on("bendpoint.move.hover",(function(e){var t,n=e.context,r=n.connection,o=r.source,s=r.target,a=e.hover,l=n.type;if(n.hover=a,a){var c=l===op?"connection.updateWaypoints":"connection.reconnect";if(t=n.allowed=i.allowed(c,{connection:r,source:l===rp?a:o,target:l===ip?a:s}))return n.source=l===rp?a:o,void(n.target=l===ip?a:s);!1===t&&(t=n.allowed=i.allowed(c,{connection:r,source:l===ip?a:s,target:l===rp?a:o})),t&&(n.source=l===ip?a:s,n.target=l===rp?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!==op&&(t.allowed=!1)})),t.on("bendpoint.move.end",(function(e){var t=e.context,n=t.allowed,r=t.bendpointIndex,i=t.connection,s=t.insert,a=i.waypoints.slice(),l=t.source,c=t.target,p=t.type,u=t.hints||{},d={x:np(e.x),y:np(e.y)};if(!n)return!1;p===op?(s?a.splice(r,0,d):a[r]=d,u.bendpointMove={insert:s,bendpointIndex:r},a=this.cropWaypoints(i,a),o.updateWaypoints(i,function(e){e=e.slice();for(var t,n,r,i=0;e[i];)t=e[i],n=e[i-1],0===St(t,r=e[i+1])||Ct(n,r,t)?e.splice(i,1):i++;return e}(a),u)):(p===rp?(u.docking="source",ap(t)&&(u.docking="target",u.newWaypoints=a.reverse())):p===ip&&(u.docking="target",ap(t)&&(u.docking="source",u.newWaypoints=a.reverse())),o.reconnect(i,l,c,d,u))}),this)}function ap(e){var t=e.hover,n=e.source,r=e.target,i=e.type;return i===rp?t&&r&&t===r&&n!==r:i===ip?t&&n&&t===n&&n!==r:void 0}sp.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],sp.prototype.cropWaypoints=function(e,t){var n=this._injector.get("connectionDocking",!1);if(!n)return t;var r=e.waypoints;return e.waypoints=t,e.waypoints=n.getCroppedWaypoints(e),t=e.waypoints,e.waypoints=r,t};var lp="updateWaypoints",cp="connect-ok",pp="connect-not-ok",up="connect-hover",dp="djs-updating",hp="djs-dragging";function fp(e,t,n,r){this._injector=t;var i=t.get("connectionPreview",!1);n.on("bendpoint.move.start",(function(e){var t=e.context,n=t.bendpointIndex,i=t.connection,o=t.insert,s=i.waypoints,a=s.slice();t.waypoints=s,o&&a.splice(n,0,{x:e.x,y:e.y}),i.waypoints=a,Se(t.draggerGfx=Xc(r.getLayer("overlays"))).add("djs-dragging"),r.addMarker(i,hp),r.addMarker(i,dp)})),n.on("bendpoint.move.hover",(function(e){var t=e.context,n=t.allowed,i=t.hover,o=t.type;if(i){if(r.addMarker(i,up),o===lp)return;n?(r.removeMarker(i,pp),r.addMarker(i,cp)):!1===n&&(r.removeMarker(i,cp),r.addMarker(i,pp))}})),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],1100,(function(e){var t=e.context,n=t.hover,i=t.target;n&&(r.removeMarker(n,up),r.removeMarker(n,i?cp:pp))})),n.on("bendpoint.move.move",(function(t){var n=t.context,r=n.allowed,o=n.bendpointIndex,s=n.draggerGfx,a=n.hover,l=n.type,c=n.connection,p=c.source,u=c.target,d=c.waypoints.slice(),h={x:t.x,y:t.y},f=n.hints||{},m={};i&&(f.connectionStart&&(m.connectionStart=f.connectionStart),f.connectionEnd&&(m.connectionEnd=f.connectionEnd),"reconnectStart"===l?ap(n)?(m.connectionEnd=m.connectionEnd||h,m.source=u,m.target=a||p,d=d.reverse()):(m.connectionStart=m.connectionStart||h,m.source=a||p,m.target=u):"reconnectEnd"===l?ap(n)?(m.connectionStart=m.connectionStart||h,m.source=a||u,m.target=p,d=d.reverse()):(m.connectionEnd=m.connectionEnd||h,m.source=p,m.target=a||u):(m.noCropping=!0,m.noLayout=!0,d[o]=h),l===lp&&(d=e.cropWaypoints(c,d)),m.waypoints=d,i.drawPreview(n,r,m)),Yn(s,t.x,t.y)}),this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],1100,(function(e){var t=e.context,n=t.connection,o=t.draggerGfx,s=t.hover,a=t.target,l=t.waypoints;n.waypoints=l,Ue(o),r.removeMarker(n,dp),r.removeMarker(n,hp),s&&(r.removeMarker(s,cp),r.removeMarker(s,a?cp:pp)),i&&i.cleanUp(t)}))}fp.$inject=["bendpointMove","injector","eventBus","canvas"];var mp="connect-hover",gp="djs-updating";function yp(e,t,n){return vp(e,t,e[t]+n)}function vp(e,t,n){return{x:"x"===t?n:e.x,y:"y"===t?n:e.y}}function bp(e){return"x"===e?"y":"x"}function wp(e,t,n){var r,i;return e.original?e.original:(r=wn(t),vp(e,i=bp(n),r[i]))}function xp(e,t,n,r,i,o){var s=e.get("connectionDocking",!1);function a(e,t){if(!s)return t;var n,r=e.waypoints;return e.waypoints=t,n=s.getCroppedWaypoints(e),e.waypoints=r,n}function l(e){i.update("connection",e.connection,e.connectionGfx)}function c(e,t,n){var r=e.newWaypoints,i=function(e,t,n,r){var i=Math.max(t[r],n[r]),o=Math.min(t[r],n[r]);return vp(t,r,Math.min(Math.max(o+20,e[r]),i-20))}(n,r[e.segmentStartIndex+t],r[e.segmentEndIndex+t],bp(e.axis));Yn(e.draggerGfx,i.x,i.y)}this.start=function(e,t,i){var o,s,a,l,c=n.getGraphics(t),p=i-1,u=i,d=t.waypoints,h=d[p],f=d[u],m=Zc(n,d,e);(s=Mt(h,f))&&(a="v"===s?"x":"y",0===p&&(h=wp(h,t.source,a)),u===d.length-1&&(f=wp(f,t.target,a)),o={connection:t,segmentStartIndex:p,segmentEndIndex:u,segmentStart:h,segmentEnd:f,axis:a,dragPosition:l=m?m.point:{x:(h.x+f.x)/2,y:(h.y+f.y)/2}},r.init(e,l,"connectionSegment.move",{cursor:"x"===a?"resize-ew":"resize-ns",data:{connection:t,connectionGfx:c,context:o}}))},t.on("connectionSegment.move.start",(function(e){var t=e.context,r=e.connection,i=n.getLayer("overlays");t.originalWaypoints=r.waypoints.slice(),t.draggerGfx=Kc(i,t.segmentStart,t.segmentEnd),Se(t.draggerGfx).add("djs-dragging"),n.addMarker(r,gp)})),t.on("connectionSegment.move.move",(function(e){var t,n,r=e.context,i=r.connection,o=r.segmentStartIndex,s=r.segmentEndIndex,p=r.segmentStart,u=r.segmentEnd,d=r.axis,h=r.originalWaypoints.slice(),f=yp(p,d,e["d"+d]),m=yp(u,d,e["d"+d]),g=h.length,y=0;h[o]=f,h[s]=m,o<2&&(t=xn(i.source,f),1===o?"intersect"===t&&(h.shift(),h[0]=f,y--):"intersect"!==t&&(h.unshift(p),y++)),s>g-3&&(n=xn(i.target,m),s===g-2?"intersect"===n&&(h.pop(),h[h.length-1]=m):"intersect"!==n&&h.push(u)),r.newWaypoints=i.waypoints=a(i,h),c(r,y,e),r.newSegmentStartIndex=o+y,l(e)})),t.on("connectionSegment.move.hover",(function(e){e.context.hover=e.hover,n.addMarker(e.hover,mp)})),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],(function(e){var t=e.context.hover;t&&n.removeMarker(t,mp)})),t.on("connectionSegment.move.cleanup",(function(e){var t=e.context,r=t.connection;t.draggerGfx&&Ue(t.draggerGfx),n.removeMarker(r,gp)})),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],(function(e){var t=e.context;t.connection.waypoints=t.originalWaypoints,l(e)})),t.on("connectionSegment.move.end",(function(e){var t=e.context,n=t.connection,r=t.newWaypoints,i=t.newSegmentStartIndex;r=r.map((function(e){return{original:e.original,x:Math.round(e.x),y:Math.round(e.y)}}));var s=function(e,t){var n=0,r=e.filter((function(r,i){return!Ct(e[i-1],e[i+1],r)||(n=i<=t?n-1:n,!1)}));return{waypoints:r,segmentOffset:n}}(r,i),l=a(n,s.waypoints),c=s.segmentOffset,p={segmentMove:{segmentStartIndex:t.segmentStartIndex,newSegmentStartIndex:i+c}};o.updateWaypoints(n,l,p)}))}xp.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var _p=Math.abs,kp=Math.round;function Ep(e){return{x:e.x,y:e.y}}function Op(e){return{x:e.x+e.width,y:e.y+e.height}}function Pp(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:kp(e.x+e.width/2),y:kp(e.y+e.height/2)}}function Sp(e,t){var n=e.snapped;return!!n&&("string"==typeof t?n[t]:n.x&&n.y)}function Cp(e,t,n){if("string"!=typeof t)throw new Error("axis must be in [x, y]");if("number"!=typeof n&&!1!==n)throw new Error("value must be Number or false");var r,i=e[t],o=e.snapped=e.snapped||{};return!1===n?o[t]=!1:(o[t]=!0,r=n-i,e[t]+=r,e["d"+t]+=r),i}function Tp(e){return e.children||[]}var Mp=Math.abs,Ap=Math.round;function Dp(e){function t(e,t){if(c(e)){for(var n=e.length;n--;)if(Mp(e[n]-t)<=10)return e[n]}else{var r=t%(e=+e);if(r<10)return t-r;if(r>e-10)return t-r+e}return t}function n(e,t){return e.waypoints?ep(t,e):e.width?{x:Ap(e.width/2+e.x),y:Ap(e.height/2+e.y)}:void 0}e.on("connectionSegment.move.move",1500,(function(e){var r,i,o=function(e){var t=e.context,r=t.snapPoints,i=t.connection,o=i.waypoints,s=t.segmentStart,a=t.segmentStartIndex,l=t.segmentEnd,c=t.segmentEndIndex,p=t.axis;if(r)return r;var u=[o[a-1],s,l,o[c+1]];return a<2&&u.unshift(n(i.source,e)),c>o.length-3&&u.unshift(n(i.target,e)),t.snapPoints=r={horizontal:[],vertical:[]},v(u,(function(e){e&&(e=e.original||e,"y"===p&&r.horizontal.push(e.y),"x"===p&&r.vertical.push(e.x))})),r}(e),s=e.x,a=e.y;if(o){var l=s-(r=t(o.vertical,s)),c=a-(i=t(o.horizontal,a));I(e,{dx:e.dx-l,dy:e.dy-c,x:r,y:i}),(l||-1!==o.vertical.indexOf(s))&&Cp(e,"x",r),(c||-1!==o.horizontal.indexOf(a))&&Cp(e,"y",i)}})),e.on(["connect.hover","connect.move","connect.end"],1500,(function(e){var t=e.context.hover,r=t&&n(t,e);hn(t)&&r&&r.x&&r.y&&(Cp(e,"x",r.x),Cp(e,"y",r.y))})),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,(function(e){var r,i,o=e.context,s=function(e){var t=e.snapPoints,n=e.connection.waypoints,r=e.bendpointIndex;if(t)return t;var i=[n[r-1],n[r+1]];return e.snapPoints=t={horizontal:[],vertical:[]},v(i,(function(e){e&&(e=e.original||e,t.horizontal.push(e.y),t.vertical.push(e.x))})),t}(o),a=o.hover,l=a&&n(a,e),c=e.x,p=e.y;if(s){var u=c-(r=t(l?s.vertical.concat([l.x]):s.vertical,c)),d=p-(i=t(l?s.horizontal.concat([l.y]):s.horizontal,p));I(e,{dx:e.dx-u,dy:e.dy-d,x:e.x-u,y:e.y-d}),(u||-1!==s.vertical.indexOf(c))&&Cp(e,"x",r),(d||-1!==s.horizontal.indexOf(p))&&Cp(e,"y",i)}}))}Dp.$inject=["eventBus"];var Np={__depends__:[Dc,Ic],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",tp],bendpointMove:["type",sp],bendpointMovePreview:["type",fp],connectionSegmentMove:["type",xp],bendpointSnapping:["type",Dp]};function Rp(e,t,n,r){function i(e,t){return r.allowed("connection.create",{source:e,target:t})}e.on("connect.hover",(function(e){var t,n=e.context,r=n.start,o=e.hover;if(n.hover=o,!l(t=n.canExecute=i(r,o))){if(!1!==t)return n.source=r,void(n.target=o);l(t=n.canExecute=i(o,r))||!1!==t&&(n.source=o,n.target=r)}})),e.on(["connect.out","connect.cleanup"],(function(e){var t=e.context;t.hover=null,t.source=null,t.target=null,t.canExecute=!1})),e.on("connect.end",(function(e){var t=e.context,r=t.canExecute,i=t.connectionStart,o={x:e.x,y:e.y},s=t.source,a=t.target;if(!r)return!1;var l=null,c={connectionStart:jp(t)?o:i,connectionEnd:jp(t)?i:o};p(r)&&(l=r),t.connection=n.connect(s,a,l,c)})),this.start=function(e,n,r,i){p(r)||(i=r,r=wn(n)),t.init(e,"connect",{autoActivate:i,data:{shape:n,context:{start:n,connectionStart:r}}})}}function jp(e){var t=e.hover,n=e.source,r=e.target;return t&&n&&t===n&&n!==r}Rp.$inject=["eventBus","dragging","modeling","rules"];var Lp="connect-ok",Ip="connect-not-ok";function zp(e,t,n){var r=e.get("connectionPreview",!1);r&&t.on("connect.move",(function(e){var t=e.context,n=t.canExecute,i=t.hover,o=t.source,s=t.start,a=t.startPosition,l=t.target,c=t.connectionStart||a,p=t.connectionEnd||{x:e.x,y:e.y},u=c,d=p;jp(t)&&(u=p,d=c),r.drawPreview(t,n,{source:o||s,target:l||i,connectionStart:u,connectionEnd:d})})),t.on("connect.hover",900,(function(e){var t=e.context,r=e.hover,i=t.canExecute;null!==i&&n.addMarker(r,i?Lp:Ip)})),t.on(["connect.out","connect.cleanup"],1100,(function(e){var t=e.hover;t&&(n.removeMarker(t,Lp),n.removeMarker(t,Ip))})),r&&t.on("connect.cleanup",(function(e){r.cleanUp(e.context)}))}zp.$inject=["injector","eventBus","canvas"];var Bp={__depends__:[Ds,Ic,Dc],__init__:["connectPreview"],connect:["type",Rp],connectPreview:["type",zp]};function $p(e,t,n,r){this._canvas=t,this._graphicsFactory=n,this._elementFactory=r,this._connectionDocking=e.get("connectionDocking",!1),this._layouter=e.get("layouter",!1)}$p.$inject=["injector","canvas","graphicsFactory","elementFactory"],$p.prototype.drawPreview=function(e,t,n){n=n||{};var r,i=e.connectionPreviewGfx,o=e.getConnection,s=n.source,a=n.target,l=n.waypoints,c=n.connectionStart,p=n.connectionEnd,u=n.noLayout,d=n.noCropping,h=n.noNoop,f=this;i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),Te(i),o||(o=e.getConnection=function(e){var t={};return function(n){var r=JSON.stringify(n),i=t[r];return i||(i=t[r]=e.apply(null,arguments)),i}}((function(e,t,n){return f.getConnection(e,t,n)}))),t&&(r=o(t,s,a)),r?(r.waypoints=l||[],this._layouter&&!u&&(r.waypoints=this._layouter.layoutConnection(r,{source:s,target:a,connectionStart:c,connectionEnd:p,waypoints:n.waypoints||r.waypoints})),r.waypoints&&r.waypoints.length||(r.waypoints=[s?wn(s):c,a?wn(a):p]),this._connectionDocking&&(s||a)&&!d&&(r.waypoints=this._connectionDocking.getCroppedWaypoints(r,s,a)),this._graphicsFactory.drawConnection(i,r,{stroke:"var(--element-dragger-color)"})):!h&&this.drawNoopPreview(i,n)},$p.prototype.drawNoopPreview=function(e,t){var n=t.source,r=t.target,i=t.connectionStart||wn(n),o=t.connectionEnd||wn(r),s=this.cropWaypoints(i,o,n,r);xe(e,this.createNoopConnection(s[0],s[1]))},$p.prototype.cropWaypoints=function(e,t,n,r){var i=this._graphicsFactory,o=n&&i.getShapePath(n),s=r&&i.getShapePath(r),a=i.getConnectionPath({waypoints:[e,t]});return[e=n&&_n(o,a,!0)||e,t=r&&_n(s,a,!1)||t]},$p.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&Ue(e.connectionPreviewGfx)},$p.prototype.getConnection=function(e){var t=function(e){return p(e)?e:{}}(e);return this._elementFactory.createConnection(t)},$p.prototype.createConnectionPreviewGfx=function(){var e=Re("g");return Oe(e,{pointerEvents:"none"}),Se(e).add("djs-dragger"),xe(this._canvas.getActiveLayer(),e),e},$p.prototype.createNoopConnection=function(e,t){return ut([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};var qp={__init__:["connectionPreview"],connectionPreview:["type",$p]};const Fp=new jo("ps");var Vp=["marker-start","marker-mid","marker-end"],Hp=["circle","ellipse","line","path","polygon","polyline","path","rect"];function Up(e,t,n,r){this._elementRegistry=e,this._canvas=n,this._styles=r}Up.$inject=["elementRegistry","eventBus","canvas","styles"],Up.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")},Up.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},Up.prototype.addDragger=function(e,t,n,r="djs-dragger"){var i=Me(n=n||this.getGfx(e)),o=n.getBoundingClientRect();return this._cloneMarkers(Zn(i),r),Oe(i,this._styles.cls(r,[],{x:o.top,y:o.left})),xe(t,i),Oe(i,"data-preview-support-element-id",e.id),i},Up.prototype.addFrame=function(e,t){var n=Re("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return xe(t,n),Oe(n,"data-preview-support-element-id",e.id),n},Up.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var r=this;e.childNodes&&e.childNodes.forEach((e=>{r._cloneMarkers(e,t,n)})),function(e){return-1!==Hp.indexOf(e.nodeName)}(e)&&Vp.forEach((function(i){if(Oe(e,i)){var o=function(e,t,n){var r=(i=Oe(e,t),i.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]);var i;return ve("marker#"+r,n||document)}(e,i,r._canvas.getContainer());o&&r._cloneMarker(n,e,o,i,t)}}))},Up.prototype._cloneMarker=function(e,t,n,r,i="djs-dragger"){var o=[n.id,i,Fp.next()].join("-"),s=ve("marker#"+n.id,e);e=e||this._canvas._svg;var a=s||Me(n);a.id=o,Se(a).add(i);var l=ve(":scope > defs",e);l||xe(e,l=Re("defs")),xe(l,a);var c=function(e){return"url(#"+e+")"}(a.id);Oe(t,r,c)};var Wp={__init__:["previewSupport"],previewSupport:["type",Up]};const Gp="complex-preview";class Qp{constructor(e,t,n){this._canvas=e,this._graphicsFactory=t,this._previewSupport=n,this._markers=[]}create(e){this.cleanUp();const{created:t=[],moved:n=[],removed:r=[],resized:i=[]}=e,o=this._canvas.getLayer(Gp);t.filter((e=>!function(e){return e.hidden}(e))).forEach((e=>{let t;hn(e)?(t=this._graphicsFactory._createContainer("connection",Re("g")),this._graphicsFactory.drawConnection(Zn(t),e)):(t=this._graphicsFactory._createContainer("shape",Re("g")),this._graphicsFactory.drawShape(Zn(t),e),Yn(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);hn(e)?Yn(n,t.x,t.y):Yn(n,e.x+t.x,e.y+t.y)})),r.forEach((e=>{this._previewSupport.addDragger(e,o,void 0,"djs-dragging"),this._canvas.addMarker(e,"djs-element-hidden"),this._markers.push([e,"djs-element-hidden"])})),i.forEach((({shape:e,bounds:t})=>{this._canvas.addMarker(e,"djs-hidden"),this._markers.push([e,"djs-hidden"]),this._previewSupport.addDragger(e,o,void 0,"djs-dragging");const n=this._graphicsFactory._createContainer("shape",Re("g"));this._graphicsFactory.drawShape(Zn(n),e,{width:t.width,height:t.height}),Yn(n,t.x,t.y),this._previewSupport.addDragger(e,o,n)}))}cleanUp(){Te(this._canvas.getLayer(Gp)),this._markers.forEach((([e,t])=>this._canvas.removeMarker(e,t))),this._markers=[]}show(){this._canvas.showLayer(Gp)}hide(){this._canvas.hideLayer(Gp)}}Qp.$inject=["canvas","graphicsFactory","previewSupport"];var Zp={__depends__:[Wp],__init__:["complexPreview"],complexPreview:["type",Qp]},Xp=["top","bottom","left","right"],Yp=10;function Kp(e,t){function n(e){if(Yi(e)&&!hn(e)){var n=function(e){var t=wn(e.label),n=wn(e),r=Jp(n,t);if(i=r,-1===Xp.indexOf(i))return;var i;var o=function(e){var t=wn(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 Jp(t,e)}));return n}(e);if(e.host){var s=function(e){var t,n=e.host,r=wn(e),i=xn(r,n);t=i.indexOf("-")>=0?i.split("-"):[i];var o=Xp.filter((function(e){return-1===t.indexOf(e)}));return o}(e);o=o.concat(s)}var a=Xp.filter((function(e){return-1===o.indexOf(e)}));if(-1!==a.indexOf(r))return;return a[0]}(e);n&&function(e,n){var r=wn(e),i=e.label,o=wn(i);if(!i.parent)return;var s,a=yn(e);switch(n){case"top":s={x:r.x,y:a.top-Yp-i.height/2};break;case"left":s={x:a.left-Yp-i.width/2,y:r.y};break;case"bottom":s={x:r.x,y:a.bottom+Yp+i.height/2};break;case"right":s={x:a.right+Yp+i.width/2,y:r.y}}var l=ia(s,o);t.moveShape(i,l)}(e,n)}}Ho.call(this,e),this.postExecuted(["connection.create","connection.layout","connection.updateWaypoints"],(function(e){var t=e.context,r=t.connection,i=r.source,o=r.target;!1!==(t.hints||{}).createElementsBehavior&&(n(i),n(o))})),this.postExecuted(["label.create"],(function(e){var t=e.context,r=t.shape;!1!==(t.hints||{}).createElementsBehavior&&n(r.labelTarget)})),this.postExecuted(["elements.create"],(function(e){var t=e.context,r=t.elements;!1!==(t.hints||{}).createElementsBehavior&&r.forEach((function(e){n(e)}))}))}function Jp(e,t){return xn(t,e,5)}function eu(e){Ho.call(this,e),this.preExecute("shape.append",(function(e){var t=e.source,n=e.shape;e.position||(ki(n,"bpmn:TextAnnotation")?e.position={x:t.x+t.width/2+75,y:t.y-50-n.height/2}:e.position={x:t.x+t.width+80+n.width/2,y:t.y+t.height/2})}),!0)}function tu(e,t){e.invoke(Ho,this),this.postExecute("shape.move",(function(e){var n=e.newParent,r=e.shape;v(y(r.incoming.concat(r.outgoing),(function(e){return ki(e,"bpmn:Association")})),(function(e){t.moveConnection(e,{x:0,y:0},n)}))}),!0)}e(Kp,Ho),Kp.$inject=["eventBus","modeling"],e(eu,Ho),eu.$inject=["eventBus"],e(tu,Ho),tu.$inject=["injector","modeling"];function nu(e,t){t.invoke(Ho,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 ru(e,e.host)}))).length&&t.map((function(e){return t.indexOf(e)})).forEach((function(r){var i=t[r];e.elements[r]=n._replaceShape(t[r],i)}))}),!0),this.preExecute("elements.move",500,(function(e){var t=e.shapes,r=e.newHost;if(1===t.length){var i=t[0];ru(i,r)&&(e.shapes=[n._replaceShape(i,r)])}}),!0)}function ru(e,t){return!fn(e)&&Ei(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function iu(e,t){function n(e){return y(e.attachers,(function(e){return ki(e,"bpmn:BoundaryEvent")}))}Ho.call(this,e),this.postExecute("connection.create",(function(e){var r=e.context.source,i=e.context.target,o=n(i);ki(r,"bpmn:EventBasedGateway")&&ki(i,"bpmn:ReceiveTask")&&o.length>0&&t.removeElements(o)})),this.postExecute("connection.reconnect",(function(e){var r=e.context.oldSource,i=e.context.newSource;ki(r,"bpmn:Gateway")&&ki(i,"bpmn:EventBasedGateway")&&v(i.outgoing,(function(e){var r=e.target,i=n(r);ki(r,"bpmn:ReceiveTask")&&i.length>0&&t.removeElements(i)}))}))}function ou(e,t,n){function r(e){t.updateProperties(e,{isForCompensation:!0})}function i(e){t.updateProperties(e,{isForCompensation:void 0})}Ho.call(this,e),this.preExecute("shape.replace",(function(e){const{newData:n,oldShape:r}=e;if(au(e.oldShape)&&"bpmn:CompensateEventDefinition"!==n.eventDefinitionType||"bpmn:BoundaryEvent"!==n.type){const t=r.outgoing.find((({target:e})=>su(e)));t&&t.target&&(e._connectionTarget=t.target)}else if(!au(e.oldShape)&&"bpmn:CompensateEventDefinition"===n.eventDefinitionType&&"bpmn:BoundaryEvent"===n.type){const n=r.outgoing.find((({target:e})=>lu(e)));n&&n.target&&(e._connectionTarget=n.target),function(e){const n=e.outgoing.filter((e=>ki(e,"bpmn:SequenceFlow")));t.removeElements(n)}(r)}}),!0),this.postExecuted("shape.replace",(function(e){const{_connectionTarget:n,newShape:r}=e;n&&t.connect(r,n)}),!0),this.preExecute("connection.create",(function(e){const n=e.connection,i=e.source,o=e.target;au(i)&&lu(o)&&(r(o),function(e,n){const r=e.outgoing.filter((e=>ki(e,"bpmn:Association"))),i=r.filter((e=>su(e.target)&&!n.includes(e)));i.forEach((e=>t.removeConnection(e)))}(i,[n]))}),!0),this.postExecuted("connection.delete",(function(e){const t=e.source,n=e.target;au(t)&&su(n)&&i(n)}),!0),this.postExecuted("connection.reconnect",(function(e){const t=e.newTarget,n=e.oldSource,o=e.oldTarget;if(o!==t){const e=n;su(o)&&i(o),au(e)&&lu(t)&&r(t)}}),!0),this.postExecuted("element.updateProperties",(function(e){const{element:r}=e;su(r)?(function(e){for(const r of e.incoming)n.canConnect(r.source,e)||t.removeConnection(r);for(const r of e.outgoing)n.canConnect(e,r.target)||t.removeConnection(r)}(r),function(e){const n=e.attachers.slice();if(!n.length)return;t.removeElements(n)}(r)):lu(r)&&function(e){const n=e.incoming.filter((e=>au(e.source)));t.removeElements(n)}(r)}),!0)}function su(e){const t=Oi(e);return t&&t.get("isForCompensation")}function au(e){return e&&ki(e,"bpmn:BoundaryEvent")&&Gi(e,"bpmn:CompensateEventDefinition")}function lu(e){return e&&ki(e,"bpmn:Activity")&&!Wi(e)}function cu(e){e.invoke(Ho,this),this.preExecute("shape.create",1500,(function(e){var t=e.context,n=t.parent,r=t.shape;ki(n,"bpmn:Lane")&&!ki(r,"bpmn:Lane")&&(t.parent=mc(n,"bpmn:Participant"))}))}function pu(e,t){Ho.call(this,e),this.preExecute("shape.create",(function(e){var n=e.context.shape;if(ki(n,"bpmn:DataObjectReference")&&"label"!==n.type){var r=t.create("bpmn:DataObject");n.businessObject.dataObjectRef=r}}))}nu.$inject=["bpmnReplace","injector"],e(nu,Ho),nu.prototype._replaceShape=function(e,t){var n,r=(n=Oi(e).eventDefinitions)&&n[0],i={type:"bpmn:BoundaryEvent",host:t};return r&&(i.eventDefinitionType=r.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})},iu.$inject=["eventBus","modeling"],e(iu,Ho),e(ou,Ho),ou.$inject=["eventBus","modeling","bpmnRules"],cu.$inject=["injector"],e(cu,Ho),pu.$inject=["eventBus","bpmnFactory"],e(pu,Ho);var uu=20,du=20,hu=30,fu=2e3;function mu(e,t,n){function r(){var t=e.getRootElement();return ki(t,"bpmn:Collaboration")?t:n.makeCollaboration()}Ho.call(this,t),t.on(["create.start","shape.move.start"],fu,(function(t){var n=t.context,r=n.shape,i=e.getRootElement();if(ki(r,"bpmn:Participant")&&ki(i,"bpmn:Process")&&i.children.length){var o=i.children.filter((function(e){return!ki(e,"bpmn:Group")&&!fn(e)&&!hn(e)}));if(o.length){var s=vt(o),a=function(e,t){t={width:t.width+2*uu+hu,height:t.height+2*du};var n=Math.max(e.width,t.width),r=Math.max(e.height,t.height);return{x:-n/2,y:-r/2,width:n,height:r}}(r,s);I(r,a),n.createConstraints=function(e,t){return t=yn(t),{bottom:t.top+e.height/2-du,left:t.right-e.width/2+uu,top:t.bottom-e.height/2+du,right:t.left+e.width/2-uu-hu}}(r,s)}}})),t.on("create.start",fu,(function(n){var r=n.context.shape,i=e.getRootElement(),o=e.getGraphics(i);function s(e){e.element=i,e.gfx=o}ki(r,"bpmn:Participant")&&ki(i,"bpmn:Process")&&(t.on("element.hover",fu,s),t.once("create.cleanup",(function(){t.off("element.hover",s)})))})),this.preExecute("elements.create",fu,(function(e){var t,n=e.elements,i=e.parent,o=function(e){return m(e,(function(e){return ki(e,"bpmn:Participant")}))}(n);o&&ki(i,"bpmn:Process")&&(e.parent=r(),(t=e.hints=e.hints||{}).participant=o,t.process=i,t.processRef=Oi(o).get("processRef"))}),!0),this.preExecute("shape.create",(function(e){var t=e.parent,n=e.shape;ki(n,"bpmn:Participant")&&ki(t,"bpmn:Process")&&(e.parent=r(),e.process=t,e.processRef=Oi(n).get("processRef"))}),!0),this.execute("shape.create",(function(e){var t=e.hints||{},n=e.process||t.process,r=e.shape,i=t.participant;!n||i&&r!==i||Oi(r).set("processRef",Oi(n))}),!0),this.revert("shape.create",(function(e){var t=e.hints||{},n=e.process||t.process,r=e.processRef||t.processRef,i=e.shape,o=t.participant;!n||o&&i!==o||Oi(i).set("processRef",r)}),!0),this.postExecute("shape.create",(function(e){var t=e.hints||{},r=e.process||e.hints.process,i=e.shape,o=t.participant;if(r){var s=r.children.slice();o?i===o&&n.moveElements(s,{x:0,y:0},o):n.moveElements(s,{x:0,y:0},i)}}),!0)}mu.$inject=["canvas","eventBus","modeling"],e(mu,Ho);var gu="__targetRef_placeholder";function yu(e,t){function n(e,n){var r=e.get("properties"),i=m(r,(function(e){return e.name===gu}));return!i&&n&&Ot(r,i=t.create("bpmn:Property",{name:gu})),i}function r(e,t){var r=n(e);r&&(function(e,t,n){return m(e.get("dataInputAssociations"),(function(e){return e!==n&&e.targetRef===t}))}(e,r,t)||Et(e.get("properties"),r))}function i(e){var t,i=e.context,o=i.connection,s=o.businessObject,a=o.target,l=a&&a.businessObject,c=i.newTarget,p=c&&c.businessObject,u=i.oldTarget||i.target,d=u&&u.businessObject,h=o.businessObject;d&&d!==l&&r(d,s),p&&p!==l&&r(p,s),l?(t=n(l,!0),h.targetRef=t):h.targetRef=null}Ho.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],vu(i)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],vu(i))}function vu(e){return function(t){if(ki(t.context.connection,"bpmn:DataInputAssociation"))return e(t)}}function bu(e){this._bpmnUpdater=e}function wu(e,t,n,r){function i(e){return e.children.filter((function(e){return ki(e,"bpmn:DataStoreReference")&&!e.labelTarget}))}function o(e,r){var i=e.businessObject||e;if(r=r||n.filter((function(e){return ki(e,"bpmn:Participant")&&Oi(e).processRef}))[0]){var o=r.businessObject||r;t.execute("dataStore.updateContainment",{dataStoreBo:i,dataStoreDi:Pi(e),newSemanticParent:o.processRef||o,newDiParent:Pi(r)})}}Ho.call(this,r),t.registerHandler("dataStore.updateContainment",bu),this.preExecute("shape.create",(function(e){var t=e.context,n=t.shape;ki(n,"bpmn:DataStoreReference")&&"label"!==n.type&&(t.hints||(t.hints={}),t.hints.autoResize=!1)})),this.preExecute("elements.move",(function(e){var t=e.context,n=t.shapes;n.filter((function(e){return ki(e,"bpmn:DataStoreReference")})).length&&(t.hints||(t.hints={}),t.hints.autoResize=n.filter((function(e){return!ki(e,"bpmn:DataStoreReference")})))})),this.postExecute("shape.create",(function(e){var t=e.context.shape,n=t.parent;ki(t,"bpmn:DataStoreReference")&&"label"!==t.type&&ki(n,"bpmn:Collaboration")&&o(t)})),this.postExecute("shape.move",(function(e){var t=e.context,n=t.shape,r=t.oldParent,i=n.parent;if(!ki(r,"bpmn:Collaboration")&&ki(n,"bpmn:DataStoreReference")&&"label"!==n.type&&ki(i,"bpmn:Collaboration")){var s=ki(r,"bpmn:Participant")?r:function(e,t){for(;e.parent;){if(ki(e.parent,t))return e.parent;e=e.parent}}(r,"bpmn:Participant");o(n,s)}})),this.postExecute("shape.delete",(function(t){var n=t.context.shape,r=e.getRootElement();Ei(n,["bpmn:Participant","bpmn:SubProcess"])&&ki(r,"bpmn:Collaboration")&&i(r).filter((function(e){return function(e,t){var n=e.businessObject||e,r=t.businessObject||t;for(;n.$parent;){if(n.$parent===r.processRef||r)return!0;n=n.$parent}return!1}(e,n)})).forEach((function(e){o(e)}))})),this.postExecute("canvas.updateRoot",(function(e){var t=e.context,n=t.oldRoot,r=t.newRoot;i(n).forEach((function(e){ki(r,"bpmn:Process")&&o(e,r)}))}))}yu.$inject=["eventBus","bpmnFactory"],e(yu,Ho),bu.$inject=["bpmnUpdater"],bu.prototype.execute=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,r=e.newSemanticParent,i=e.newDiParent;return e.oldSemanticParent=t.$parent,e.oldDiParent=n.$parent,this._bpmnUpdater.updateSemanticParent(t,r),this._bpmnUpdater.updateDiParent(n,i),[]},bu.prototype.revert=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,r=e.oldSemanticParent,i=e.oldDiParent;return this._bpmnUpdater.updateSemanticParent(t,r),this._bpmnUpdater.updateDiParent(n,i),[]},wu.$inject=["canvas","commandStack","elementRegistry","eventBus"],e(wu,Ho);var xu=Math.max,_u=Math.min,ku=20;function Eu(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function Ou(e,t,n){var r=t[e],i=n.min&&n.min[e],o=n.max&&n.max[e];return u(i)&&(r=(/top|left/.test(e)?_u:xu)(r,i)),u(o)&&(r=(/top|left/.test(e)?xu:_u)(r,o)),r}function Pu(e,t){return void 0!==e?e:ku}function Su(e){return!e.waypoints&&"label"!==e.type}function Cu(e,t){var n;if((n=void 0===e.length?y(e.children,Su):e).length)return function(e,t){var n,r,i,o;return"object"==typeof t?(n=Pu(t.left),r=Pu(t.right),i=Pu(t.top),o=Pu(t.bottom)):n=r=i=o=Pu(t),{x:e.x-n,y:e.y-i,width:e.width+n+r,height:e.height+i+o}}(vt(n),t)}var Tu=Math.abs;var Mu=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Au=30;function Du(e,t){return t=t||[],e.children.filter((function(e){ki(e,"bpmn:Lane")&&(Du(e,t),t.push(e))})),t}function Nu(e){return e.children.filter((function(e){return ki(e,"bpmn:Lane")}))}function Ru(e){return mc(e,Mu)||e}function ju(e,t){var n=Ru(e),r=Du(n,ki(n,"bpmn:Process")?[]:[n]),i=yn(e),o=yn(t),s=function(e,t){return Eu(yn(t),yn(e))}(e,t),a=[],l=Hi(e);return r.forEach((function(t){if(t!==e){var n,r,c=l?0:s.top,p=l?s.right:0,u=l?0:s.bottom,d=l?s.left:0,h=yn(t);s.top&&(Tu(h.bottom-i.top)<10&&(u=o.top-h.bottom),Tu(h.top-i.top)<5&&(c=o.top-h.top)),s.left&&(Tu(h.right-i.left)<10&&(p=o.left-h.right),Tu(h.left-i.left)<5&&(d=o.left-h.left)),s.bottom&&(Tu(h.top-i.bottom)<10&&(c=o.bottom-h.top),Tu(h.bottom-i.bottom)<5&&(u=o.bottom-h.bottom)),s.right&&(Tu(h.left-i.right)<10&&(d=o.right-h.left),Tu(h.right-i.right)<5&&(p=o.right-h.right)),(c||p||u||d)&&a.push({shape:t,newBounds:(n=t,r={top:c,right:p,bottom:u,left:d},{x:n.x+(r.left||0),y:n.y+(r.top||0),width:n.width-(r.left||0)+(r.right||0),height:n.height-(r.top||0)+(r.bottom||0)})})}})),a}function Lu(e,t){Ho.call(this,e),this.postExecuted("shape.delete",500,(function(e){var n=e.context,r=n.hints,i=n.shape,o=n.oldParent;ki(i,"bpmn:Lane")&&(r&&r.nested||function(e,n){var r,i,o,s,a,l=Hi(e),c=Nu(n),p=[],u=[],d=[],h=[];gt(c,(function(t){return l?t.y>e.y?u.push(t):p.push(t):t.x>e.x?h.push(t):d.push(t),t.children})),c.length&&(r=l?u.length&&p.length?e.height/2:e.height:h.length&&d.length?e.width/2:e.width,p.length&&(i=t.calculateAdjustments(p,"y",r,e.y-10),t.makeSpace(i.movingShapes,i.resizingShapes,{x:0,y:r},"s")),u.length&&(o=t.calculateAdjustments(u,"y",-r,e.y+e.height+10),t.makeSpace(o.movingShapes,o.resizingShapes,{x:0,y:-r},"n")),d.length&&(s=t.calculateAdjustments(d,"x",r,e.x-10),t.makeSpace(s.movingShapes,s.resizingShapes,{x:r,y:0},"e")),h.length&&(a=t.calculateAdjustments(h,"x",-r,e.x+e.width+10),t.makeSpace(a.movingShapes,a.resizingShapes,{x:-r,y:0},"w")))}(i,o))}))}Lu.$inject=["eventBus","spaceTool"],e(Lu,Ho);function Iu(e,t){t.invoke(Ho,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",500,(function(e){var t=e.elements;t.filter((function(e){return zu(e,e.host)})).map((function(e){return t.indexOf(e)})).forEach((function(r){e.elements[r]=n._replaceShape(t[r])}))}),!0),this.preExecute("elements.move",500,(function(e){var t=e.shapes,r=e.newHost;t.forEach((function(e,i){var o,s=e.host;zu(e,(o=s,-1!==t.indexOf(o)?s:r))&&(t[i]=n._replaceShape(e))}))}),!0)}function zu(e,t){return!fn(e)&&ki(e,"bpmn:BoundaryEvent")&&!t}function Bu(e,t,n){function r(e,r,i){var o,s,a,l,c,p,d,h,f=r.waypoints,m=e.outgoing.slice(),g=e.incoming.slice(),v=qc(f,h=u(i.width)?wn(i):i);if(v){if(o=f.slice(0,v.index),s=f.slice(v.index+(v.bendpoint?1:0)),!o.length||!s.length)return;a=v.bendpoint?f[v.index]:h,1!==o.length&&$u(e,o[o.length-1])||o.push(qu(a)),1!==s.length&&$u(e,s[0])||s.unshift(qu(a))}l=r.source,c=r.target,t.canConnect(l,e,r)&&(n.reconnectEnd(r,e,o||h),p=r),t.canConnect(e,c,r)&&(p?d=n.connect(e,c,{type:r.type,waypoints:s}):(n.reconnectStart(r,e,s||h),d=r));var b=[].concat(p&&y(g,(function(e){return e.source===p.source}))||[],d&&y(m,(function(e){return e.target===d.target}))||[]);b.length&&n.removeElements(b)}Ho.call(this,e),this.preExecute("elements.move",(function(e){var n=e.newParent,r=e.shapes,i=e.delta,o=r[0];if(o&&n){n&&n.waypoints&&(e.newParent=n=n.parent);var s=wn(o),a={x:s.x+i.x,y:s.y+i.y},l=m(n.children,(function(e){return t.canInsert(r,e)&&qc(e.waypoints,a)}));l&&(e.targetFlow=l,e.position=a)}}),!0),this.postExecuted("elements.move",(function(e){var t=e.shapes,n=e.targetFlow,i=e.position;n&&r(t[0],n,i)}),!0),this.preExecute("shape.create",(function(e){var n=e.parent,r=e.shape;t.canInsert(r,n)&&(e.targetFlow=n,e.parent=n.parent)}),!0),this.postExecuted("shape.create",(function(e){var t=e.shape,n=e.targetFlow,i=e.position;n&&r(t,n,i)}),!0)}function $u(e,t){var n=t.x,r=t.y;return n>=e.x&&n<=e.x+e.width&&r>=e.y&&r<=e.y+e.height}function qu(e){return I({},e)}function Fu(e,t){Ho.call(this,e),this.preExecuted("connection.create",(function(e){var n=e.context,r=n.connection,i=n.source,o=n.target,s=n.hints;if((!s||!1!==s.createElementsBehavior)&&Vu(r)){(ki(i,"bpmn:EventBasedGateway")?o.incoming.filter((e=>e!==r&&Vu(e))):o.incoming.filter((e=>e!==r&&Vu(e)&&ki(e.source,"bpmn:EventBasedGateway")))).forEach((function(e){t.removeConnection(e)}))}})),this.preExecuted("shape.replace",(function(e){var n=e.context.newShape;ki(n,"bpmn:EventBasedGateway")&&n.outgoing.filter(Vu).reduce((function(e,t){return e.includes(t.target)?e:e.concat(t.target)}),[]).forEach((function(e){e.incoming.filter(Vu).forEach((function(r){const i=e.incoming.filter(Vu).filter((function(e){return e.source===n}));(r.source!==n||i.length>1)&&t.removeConnection(r)}))}))}))}function Vu(e){return ki(e,"bpmn:SequenceFlow")}Iu.$inject=["bpmnReplace","injector"],e(Iu,Ho),Iu.prototype._replaceShape=function(e){var t,n,r=(n=Oi(e).eventDefinitions)&&n[0];return t=r?{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:r.$type}:{type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,t,{layoutConnection:!1})},e(Bu,Ho),Bu.$inject=["eventBus","bpmnRules","modeling"],Fu.$inject=["eventBus","modeling"],e(Fu,Ho);var Hu=1500;function Uu(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"],Hu,(function(t){var r=t.context.shape||t.shape,i=t.hover;ki(i,"bpmn:Lane")&&!Ei(r,["bpmn:Lane","bpmn:Participant"])&&(t.hover=Ru(i),t.hoverGfx=e.getGraphics(t.hover));var o=n.getRootElement();i!==o&&(r.labelTarget||Ei(r,["bpmn:Group","bpmn:TextAnnotation"]))&&(t.hover=o,t.hoverGfx=e.getGraphics(t.hover))})),t.on(["connect.hover","connect.out","connect.end","connect.cleanup","global-connect.hover","global-connect.out","global-connect.end","global-connect.cleanup"],Hu,(function(t){var n=t.hover;ki(n,"bpmn:Lane")&&(t.hover=Ru(n)||n,t.hoverGfx=e.getGraphics(t.hover))})),t.on(["bendpoint.move.hover"],Hu,(function(t){var n=t.context,r=t.hover,i=n.type;ki(r,"bpmn:Lane")&&/reconnect/.test(i)&&(t.hover=Ru(r)||r,t.hoverGfx=e.getGraphics(t.hover))})),t.on(["connect.start"],Hu,(function(e){var t=e.context,n=t.start;ki(n,"bpmn:Lane")&&(t.start=Ru(n)||n)})),t.on("shape.move.start",2e3,(function(e){var t=e.shape;ki(t,"bpmn:Lane")&&(e.shape=Ru(t)||t)})),t.on("spaceTool.move",2e3,(function(e){var t=e.hover;t&&ki(t,"bpmn:Lane")&&(e.hover=Ru(t))}))}Uu.$inject=["elementRegistry","eventBus","canvas"];function Wu(e,t,n,r,i,o){function s(e,t,r){var i=n.filter((function(e){return ki(e,"bpmn:Group")})).filter((function(e){return e.businessObject!==r}));t&&!function(e,t){return e.some((function(e){var n=Oi(e);return(n.categoryValueRef&&n.categoryValueRef.$parent)===t}))}(i,t)&&function(e){var t=e.$parent;t&&(Et(t.get("rootElements"),e),e.$parent=null)}(t),e&&!function(e,t){return e.some((function(e){return Oi(e).categoryValueRef===t}))}(i,e)&&function(e){var t=e.$parent;t&&(Et(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,r){var i=Oi(n),o=i.categoryValueRef;o||(o=i.categoryValueRef=r.categoryValue=r.categoryValue||function(e){return e.create("bpmn:CategoryValue")}(e));var s=o.$parent;s||(s=o.$parent=r.category=r.category||function(e){return e.create("bpmn:Category")}(e)),a(o,s,t.getDefinitions())}function c(e,t){var n=t.category,r=t.categoryValue,i=Oi(e);r?(i.categoryValueRef=null,s(r,n,i)):s(null,i.categoryValueRef.$parent,i)}function p(t,n){var r=e.create(t.$type);return o.copyElement(t,r,null,n)}i.invoke(Ho,this),this.execute("label.create",(function(e){var t=e.context,n=t.labelTarget;ki(n,"bpmn:Group")&&l(n,t)})),this.revert("label.create",(function(e){var t=e.context,n=t.labelTarget;ki(n,"bpmn:Group")&&c(n,t)})),this.execute("shape.delete",(function(e){var t=e.context,n=t.shape,r=Oi(n);if(ki(n,"bpmn:Group")&&!n.labelTarget){var i=t.categoryValue=r.categoryValueRef;i&&(s(i,t.category=i.$parent,r),r.categoryValueRef=null)}})),this.reverted("shape.delete",(function(e){var t=e.context,n=t.shape;if(ki(n,"bpmn:Group")&&!n.labelTarget){var r=t.category,i=t.categoryValue,o=Oi(n);i&&(o.categoryValueRef=i,a(i,r))}})),this.execute("shape.create",(function(e){var t=e.context,n=t.shape;ki(n,"bpmn:Group")&&!n.labelTarget&&Oi(n).categoryValueRef&&l(n,t)})),this.reverted("shape.create",(function(e){var t=e.context,n=t.shape;ki(n,"bpmn:Group")&&!n.labelTarget&&Oi(n).categoryValueRef&&c(n,t)})),r.on("copyPaste.copyElement",770,(function(e){var t=e.descriptor,n=e.element;if(ki(n,"bpmn:Group")&&!n.labelTarget){var r=Oi(n);if(r.categoryValueRef){var i=r.categoryValueRef;t.categoryValue=p(i,!0),i.$parent&&(t.category=p(i.$parent,!0))}}})),r.on("copyPaste.pasteElement",770,(function(e){var t=e.descriptor,n=t.businessObject,r=t.categoryValue,i=t.category;r&&(r=n.categoryValueRef=p(r)),i&&(r.$parent=p(i)),delete t.category,delete t.categoryValue}))}function Gu(e,t,n,r){var i,o,s,a;return 0==(i=(r.y-n.y)*(t.x-e.x)-(r.x-n.x)*(t.y-e.y))?null:(o=e.y-n.y,s=e.x-n.x,a=((r.x-n.x)*o-(r.y-n.y)*s)/i,{x:Math.round(e.x+a*(t.x-e.x)),y:Math.round(e.y+a*(t.y-e.y))})}function Qu(e){function t(e,t,n){var r,i={x:n.x,y:n.y-50},o={x:n.x-50,y:n.y},s=Gu(e,t,n,i),a=Gu(e,t,n,o);r=s&&a?Zu(s,n)>Zu(a,n)?a:s:s||a,e.original=r}e.on("bpmnElement.added",(function(e){var n,r,i=e.element;i.waypoints&&(t((r=(n=i).waypoints)[0],r[1],wn(n.source)),t(r[r.length-1],r[r.length-2],wn(n.target)))}))}function Zu(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Xu(e){Ho.call(this,e);var t=["bpmn:Participant","bpmn:Lane"];this.executed(["shape.move","shape.create","shape.resize"],(function(e){var n=e.context.shape,r=Oi(n),i=Pi(n);if(Ei(r,t)){var o=i.get("isHorizontal");void 0===o&&(o=!0),i.set("isHorizontal",o)}}))}Wu.$inject=["bpmnFactory","bpmnjs","elementRegistry","eventBus","injector","moddleCopy"],e(Wu,Ho),Qu.$inject=["eventBus"],Xu.$inject=["eventBus"],e(Xu,Ho);var Yu=Math.sqrt,Ku=Math.min,Ju=Math.max,ed=Math.abs;function td(e){return Math.pow(e,2)}function nd(e,t){return Yu(td(e.x-t.x)+td(e.y-t.y))}function rd(e,t,n,r){var i=t.x-e.x,o=t.y-e.y,s=n.x-e.x,a=n.y-e.y,l=i*i+o*o,c=(i*s+o*a)/l,p=c*c-(s*s+a*a-r*r)/l;if(p<0&&p>-1e-6&&(p=0),p<0)return[];var u=Yu(p),d=-c+u,h=-c-u,f={x:e.x-i*d,y:e.y-o*d};return 0===p?[f]:[f,{x:e.x-i*h,y:e.y-o*h}].filter((function(n){return function(e,t,n){return id(e.x,t.x,n.x)&&id(e.y,t.y,n.y)}(n,e,t)}))}function id(e,t,n){return e>=Ku(t,n)-od&&e<=Ju(t,n)+od}var od=.1;function sd(e,t){return ed(e.x-t.x)<=od&&ed(e.y-t.y)<=od}function ad(e,t,n,r){var i=0,o=0,s={point:e,delta:{x:0,y:0}},a=function(e,t){var n,r,i,o,s,a,l,c,p,u,d,h,f=0;for(f=0;f<t.length-1;f++){if(sd(n=t[f],r=t[f+1])?a=[n]:(i=nd(e,n),o=nd(e,r),a=rd(n,r,e,Ku(i,o))),a.length<1)throw new Error("expected between [1, 2] circle -> line intersections");1===a.length&&(l={type:"bendpoint",position:a[0],segmentIndex:f,bendpointIndex:sd(n,a[0])?f:f+1}),2===a.length&&(d=a[0],h=a[1],l={type:"segment",position:s={x:(d.x+h.x)/2,y:(d.y+h.y)/2},segmentIndex:f,relativeLocation:nd(n,s)/nd(n,r)}),c=nd(l.position,e),(!u||p>c)&&(u=l,p=c)}return u}(e,n),l=a.segmentIndex,c=function(e,t,n,r){var i=n.segmentIndex,o=t.length-e.length;if(r.segmentMove){var s=r.segmentMove.segmentStartIndex,a=r.segmentMove.newSegmentStartIndex;return i===s?a:i>=a?i+o<a?a:i+o:i}if(r.bendpointMove){var l,c=r.bendpointMove.insert,p=r.bendpointMove.bendpointIndex;return 0===o?i:(i>=p&&(l=c?i+1:i-1),i<p&&(l=i,c&&"bendpoint"!==n.type&&p-1===i&&ld(t,p)<n.relativeLocation&&l++),l)}return 0===o?i:r.connectionStart&&0===i?0:r.connectionEnd&&i===e.length-2?t.length-2:Math.floor((t.length-2)/2)}(n,t,a,r);if(c<0||c>t.length-2||null===c)return s;var p,u,d=cd(n,l),h=cd(t,c),f=a.position,m=function(e,t){var n=Wc(e[0],e[1]),r=Wc(e[0],t);return 0===n?0:r/n}(d,f),g=(p=h,u=Vc(d),Vc(p)-u);if("bendpoint"===a.type){var y=t.length-n.length,v=a.bendpointIndex,b=n[v];if(-1!==t.indexOf(b))return s;if(0===y){var w=t[v];return{delta:{x:i=w.x-a.position.x,y:o=w.y-a.position.y},point:{x:e.x+i,y:e.y+o}}}y<0&&0!==v&&v<n.length-1&&(m=ld(n,v))}var x,_,k={x:(h[1].x-h[0].x)*m+h[0].x,y:(h[1].y-h[0].y)*m+h[0].y},E=(x={x:e.x-f.x,y:e.y-f.y},(_=g)?{x:Math.cos(_)*x.x-Math.sin(_)*x.y,y:Math.sin(_)*x.x+Math.cos(_)*x.y}:x);return i=k.x+E.x-e.x,o=k.y+E.y-e.y,{point:gn(k),delta:gn({x:i,y:o})}}function ld(e,t){var n=Wc(e[t-1],e[t]);return n/(n+Wc(e[t],e[t+1]))}function cd(e,t){return[e[t],e[t+1]]}function pd(e,t,n){var r=ra(t),i=ra(n),o=ia(e,r),s=o.x*(n.width/t.width),a=o.y*(n.height/t.height);return gn({x:i.x+s,y:i.y+a})}function ud(e,t,n){var r=ra(e),i=ra(t),o=ra(n),s=ia(e,r),a=ia(r,i),l=function(e,t,n){var r=yn(t),i=yn(n);if(function(e,t){return function(e,t){return e.right!==t.right&&e.left!==t.left}(e,t)||function(e,t){return e.top!==t.top&&e.bottom!==t.bottom}(e,t)}(r,i))return null;var o,s,a,l=xn(t,e);if("top"===l)o={x:0,y:i.bottom-r.bottom};else if("bottom"===l)o={x:0,y:i.top-r.top};else if("right"===l)o={x:i.left-r.left,y:0};else{if("left"!==l)return null;o={x:i.right-r.right,y:0}}if(s={x:e.x+o.x,y:e.y+o.y},a=xn(n,s),a!==l)return null;return o}(r,t,n);if(l)return l;var c=a.x*(n.width/t.width),p=a.y*(n.height/t.height),u=o.x+c,d=o.y+p;return gn({x:u+s.x-e.x,y:d+s.y-e.y})}var dd="name",hd="text";function fd(e,t,n,r){function i(e){var n=e.context,i=n.element,o=n.properties;if(dd in o&&t.updateLabel(i,o[dd]),hd in o&&ki(i,"bpmn:TextAnnotation")){var s=r.getTextAnnotationBounds({x:i.x,y:i.y,width:i.width,height:i.height},o[hd]||"");t.updateLabel(i,o.text,s)}}function o(e){var t=e.context,n=t.connection,r=n.label,i=I({},t.hints),o=t.newWaypoints||n.waypoints,s=t.oldWaypoints;return void 0===i.startChanged&&(i.startChanged=!!i.connectionStart),void 0===i.endChanged&&(i.endChanged=!!i.connectionEnd),function(e,t,n,r){return ad(wn(e),t,n,r).delta}(r,o,s,i)}Ho.call(this,e),this.postExecute("element.updateProperties",i),this.postExecute("element.updateModdleProperties",(e=>{Oi(e.context.element)===e.context.moddleElement&&i(e)})),this.postExecute(["shape.create","connection.create"],(function(e){var n=e.context;if(!1!==(n.hints||{}).createElementsBehavior){var r=n.shape||n.connection;!fn(r)&&Xi(r)&&to(r)&&t.updateLabel(r,to(r))}})),this.postExecute("shape.delete",(function(e){var n=e.context,r=n.labelTarget,i=n.hints||{};r&&!1!==i.unsetLabel&&t.updateLabel(r,null,null,{removeShape:!1})})),this.postExecute(["connection.layout","connection.updateWaypoints"],(function(e){var n=e.context;if(!1!==(n.hints||{}).labelBehavior){var r,i=n.connection.label;i&&i.parent&&(r=o(e),t.moveShape(i,r))}})),this.postExecute(["shape.replace"],(function(e){var t=e.context,n=t.newShape,r=t.oldShape,i=Oi(n);i&&Xi(i)&&r.label&&n.label&&(n.label.x=r.label.x,n.label.y=r.label.y)})),this.postExecute("shape.resize",(function(e){var n,r=e.context,i=r.shape,o=r.newBounds,s=r.oldBounds;if(Yi(i)){var a=i.label,l=function(e,t){if(!t.length)return;var n=function(e,t){var n=t.map((function(t){return{line:t,distance:Uc(e,t)}}));return T(n,"distance")[0].line}(e,t);return Hc(e,n)}(wn(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=md(l,s,o);t.moveShape(a,c)}}))}function md(e,t,n){return gn(ia(pd(e,t,n),e))}function gd(e,t){function n(e,t){var n=e.context,r=n.connection,i=I({},n.hints),o=n.newWaypoints||r.waypoints,s=n.oldWaypoints;return void 0===i.startChanged&&(i.startChanged=!!i.connectionStart),void 0===i.endChanged&&(i.endChanged=!!i.connectionEnd),function(e,t,n,r){return ad(e,t,n,r).point}(t,o,s,i)}Ho.call(this,e),this.postExecute(["connection.layout","connection.updateWaypoints"],(function(e){var r=e.context.connection,i=r.outgoing;r.incoming.forEach((function(r){var i=r.waypoints[r.waypoints.length-1],o=n(e,i),s=[].concat(r.waypoints.slice(0,-1),[o]);t.updateWaypoints(r,s)})),i.forEach((function(r){var i=r.waypoints[0],o=n(e,i),s=[].concat([o],r.waypoints.slice(1));t.updateWaypoints(r,s)}))})),this.postExecute(["connection.move"],(function(e){var n=e.context,r=n.connection,i=r.outgoing,o=r.incoming,s=n.delta;o.forEach((function(e){var n=e.waypoints[e.waypoints.length-1],r={x:n.x+s.x,y:n.y+s.y},i=[].concat(e.waypoints.slice(0,-1),[r]);t.updateWaypoints(e,i)})),i.forEach((function(e){var n=e.waypoints[0],r={x:n.x+s.x,y:n.y+s.y},i=[].concat([r],e.waypoints.slice(1));t.updateWaypoints(e,i)}))}))}function yd(e,t,n){var r=_d(e),i=kd(r,t),o=r[0];return i.length?i[i.length-1]:pd(o.original||o,n,t)}function vd(e,t,n){var r=_d(e),i=kd(r,t),o=r[r.length-1];return i.length?i[0]:pd(o.original||o,n,t)}function bd(e,t,n){var r=_d(e),i=xd(t,n),o=r[0];return pd(o.original||o,i,t)}function wd(e,t,n){var r=_d(e),i=xd(t,n),o=r[r.length-1];return pd(o.original||o,i,t)}function xd(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function _d(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function kd(e,t){return y(k(e,Ed),(function(e){return function(e,t){return"intersect"===xn(t,e,1)}(e,t)}))}function Ed(e){return e.original||e}function Od(e,t){Ho.call(this,e),this.postExecute("shape.replace",(function(e){var n=e.oldShape,r=e.newShape;if(function(e,t){return ki(e,"bpmn:Participant")&&Vi(e)&&ki(t,"bpmn:Participant")&&!Vi(t)}(n,r)){var i,o,s,a,l=(o=yt([i=n],!1),s=[],a=[],o.forEach((function(e){e!==i&&(e.incoming.forEach((function(e){ki(e,"bpmn:MessageFlow")&&s.push(e)})),e.outgoing.forEach((function(e){ki(e,"bpmn:MessageFlow")&&a.push(e)})))}),[]),{incoming:s,outgoing:a});l.incoming.forEach((function(e){var i=vd(e,r,n);t.reconnectEnd(e,r,i)})),l.outgoing.forEach((function(e){var i=yd(e,r,n);t.reconnectStart(e,r,i)}))}}),!0)}e(fd,Ho),fd.$inject=["eventBus","modeling","bpmnFactory","textRenderer"],e(gd,Ho),gd.$inject=["eventBus","modeling"],Od.$inject=["eventBus","modeling"],e(Od,Ho);const Pd=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function Sd(e){const t=Oi(e);if(!(ki(t,"bpmn:BoundaryEvent")||ki(t,"bpmn:StartEvent")&&Wi(t.$parent)))return!1;const n=t.get("eventDefinitions");return!(!n||!n.length)&&Pd.some((e=>ki(n[0],e)))}function Cd(e){return ki(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function Td(e,t){e.invoke(Ho,this),this.postExecuted("shape.replace",(function(e){const n=e.context.oldShape,r=e.context.newShape,i=e.context.hints;if(!Sd(r))return;const o=Cd(r);if(i.targetElement&&void 0!==i.targetElement[o])return;const s=Oi(n).get(o);s!==Oi(r).get(o)&&t.updateProperties(r,{[o]:s})}))}function Md(e,t){Ho.call(this,e),this.preExecute("shape.resize",(function(e){var n=e.shape,r=Pi(n),i=r&&r.get("label");i&&i.get("bounds")&&t.updateModdleProperties(n,i,{bounds:void 0})}),!0)}function Ad(e,t,n){Ho.call(this,e),this.preExecute("shape.delete",(function(e){var r=e.context.shape;if(1===r.incoming.length&&1===r.outgoing.length){var i=r.incoming[0],o=r.outgoing[0];if(ki(i,"bpmn:SequenceFlow")&&ki(o,"bpmn:SequenceFlow")&&t.canConnect(i.source,o.target,i)){var s=function(e,t){var n=Gu(Dd(e[e.length-2]),Dd(e[e.length-1]),Dd(t[1]),Dd(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[Dd(e[0]),Dd(t[t.length-1])]}(i.waypoints,o.waypoints);n.reconnectEnd(i,o.target,s)}}}))}function Dd(e){return e.original||e}function Nd(e,t){Ho.call(this,e),this.preExecute("shape.delete",(function(e){var t=e.shape,n=t.parent;ki(t,"bpmn:Participant")&&(e.collaborationRoot=n)}),!0),this.postExecute("shape.delete",(function(e){var n=e.collaborationRoot;if(n&&!n.businessObject.participants.length){var r=t.makeProcess(),i=n.children.slice();t.moveElements(i,{x:0,y:0},r)}}),!0)}function Rd(e,t,n,r){Ho.call(this,e);var i=r.get("dragging",!1);function o(e){var r,i,o=e.source,s=e.target;e.parent&&(ki(e,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(o,s)||(i=!0),n.canConnectMessageFlow(o,s)&&(r="bpmn:MessageFlow")),ki(e,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(o,s)||(i=!0),n.canConnectSequenceFlow(o,s)&&(r="bpmn:SequenceFlow")),i&&t.removeConnection(e),r&&t.connect(o,s,{type:r,waypoints:e.waypoints.slice()}))}this.postExecuted("elements.move",(function(e){v(e.closure.allConnections,o)}),!0),this.preExecute("connection.reconnect",(function(e){var r,o,s=e.context,a=s.connection,l=s.newSource||a.source,c=s.newTarget||a.target;(r=n.canConnect(l,c))&&r.type!==a.type&&(o=t.connect(l,c,{type:r.type,associationDirection:r.associationDirection,waypoints:a.waypoints.slice()}),a.parent&&t.removeConnection(a),s.connection=o,i&&function(e,t){var n,r=i.context(),o=r&&r.payload.previousSelection;if(!o||!o.length)return;if(n=o.indexOf(e),-1===n)return;o.splice(n,1,t)}(a,o))})),this.postExecuted("element.updateProperties",(function(e){var n,r=e.context,i=r.properties,o=r.element,s=o.businessObject;i.default&&(n=m(o.outgoing,M({id:o.businessObject.default.id})))&&t.updateProperties(n,{conditionExpression:void 0}),i.conditionExpression&&s.sourceRef.default===s&&t.updateProperties(o.source,{default:void 0})}))}function jd(e,t,n,r,i,o){r.invoke(Ho,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=o,this.postExecuted(["elements.create"],500,(function(e){var n=e.context,r=n.parent,i=n.elements,o=w(i,(function(e,n){var i=t.canReplace([n],n.host||n.parent||r);return i?e.concat(i.replacements):e}),[]);o.length&&this._replaceElements(i,o)}),this),this.postExecuted(["elements.move"],500,(function(e){var n=e.context,r=n.newParent,i=n.newHost,o=[];v(n.closure.topLevel,(function(e){o=Wi(e)?o.concat(e.children):o.concat(e)})),1===o.length&&i&&(r=i);var s=t.canReplace(o,r);s&&this._replaceElements(o,s.replacements,i)}),this),this.postExecute(["shape.replace"],1500,(function(e){var n,r=e.context,i=r.oldShape,o=r.newShape,s=i.attachers;s&&s.length&&(n=t.canReplace(s,o),this._replaceElements(s,n.replacements))}),this),this.postExecuted(["shape.replace"],1500,(function(e){var t=e.context,n=t.oldShape,r=t.newShape;i.unclaimId(n.businessObject.id,n.businessObject),i.updateProperties(r,{id:n.id})}))}Td.$inject=["injector","modeling"],e(Td,Ho),e(Md,Ho),Md.$inject=["eventBus","modeling"],e(Ad,Ho),Ad.$inject=["eventBus","bpmnRules","modeling"],Nd.$inject=["eventBus","modeling"],e(Nd,Ho),e(Rd,Ho),Rd.$inject=["eventBus","modeling","bpmnRules","injector"],e(jd,Ho),jd.prototype._replaceElements=function(e,t){var n=this._elementRegistry,r=this._bpmnReplace,i=this._selection;v(t,(function(t){var i={type:t.newElementType},o=n.get(t.oldElementId),s=e.indexOf(o);e[s]=r.replaceElement(o,i,{select:!1})})),t&&i.select(e)},jd.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var Ld={width:140,height:120},Id={width:300,height:60},zd={width:60,height:300},Bd={width:300,height:150},$d={width:150,height:300},qd={width:140,height:120},Fd={width:50,height:30};function Vd(e){e.on("resize.start",1500,(function(e){var t=e.context,n=t.shape,r=t.direction,i=t.balanced;(ki(n,"bpmn:Lane")||ki(n,"bpmn:Participant"))&&(t.resizeConstraints=function(e,t,n){var r=Ru(e),i=!0,o=!0,s=Du(r,[r]),a=yn(e),l={},c={},p=Hi(e),u=p?Id:zd;/n/.test(t)?c.top=a.bottom-u.height:/e/.test(t)?c.right=a.left+u.width:/s/.test(t)?c.bottom=a.top+u.height:/w/.test(t)&&(c.left=a.right-u.width);s.forEach((function(e){var r=yn(e);p?(r.top<a.top-10&&(i=!1),r.bottom>a.bottom+10&&(o=!1)):(r.left<a.left-10&&(i=!1),r.right>a.right+10&&(o=!1)),/n/.test(t)&&(n&&Hd(a.top-r.bottom)<10&&Zd(l,"top",r.top+u.height),Hd(a.top-r.top)<5&&Qd(c,"top",r.bottom-u.height)),/e/.test(t)&&(n&&Hd(a.right-r.left)<10&&Qd(l,"right",r.right-u.width),Hd(a.right-r.right)<5&&Zd(c,"right",r.left+u.width)),/s/.test(t)&&(n&&Hd(a.bottom-r.top)<10&&Qd(l,"bottom",r.bottom-u.height),Hd(a.bottom-r.bottom)<5&&Zd(c,"bottom",r.top+u.height)),/w/.test(t)&&(n&&Hd(a.left-r.right)<10&&Zd(l,"left",r.left+u.width),Hd(a.left-r.left)<5&&Qd(c,"left",r.right-u.width))}));var d=r.children.filter((function(e){return!e.hidden&&!e.waypoints&&(ki(e,"bpmn:FlowElement")||ki(e,"bpmn:Artifact"))})),h=p?Xd:Yd;return d.forEach((function(e){var n=yn(e);!/n/.test(t)||p&&!i||Qd(c,"top",n.top-h.top),/e/.test(t)&&(p||o)&&Zd(c,"right",n.right+h.right),!/s/.test(t)||p&&!o||Zd(c,"bottom",n.bottom+h.bottom),/w/.test(t)&&(p||i)&&Qd(c,"left",n.left-h.left)})),{min:c,max:l}}(n,r,i)),ki(n,"bpmn:SubProcess")&&Vi(n)&&(t.minDimensions=qd),ki(n,"bpmn:TextAnnotation")&&(t.minDimensions=Fd)}))}Vd.$inject=["eventBus"];var Hd=Math.abs,Ud=Math.min,Wd=Math.max;function Gd(e,t,n,r){var i=e[t];e[t]=void 0===i?n:r(n,i)}function Qd(e,t,n){return Gd(e,t,n,Ud)}function Zd(e,t,n){return Gd(e,t,n,Wd)}var Xd={top:20,left:50,right:20,bottom:20},Yd={top:50,left:20,right:20,bottom:20};function Kd(e,t){e.on("resize.start",1501,(function(e){var t=e.context,n=t.shape;(ki(n,"bpmn:Lane")||ki(n,"bpmn:Participant"))&&(t.balanced=!ws(e))})),e.on("resize.end",1001,(function(e){var n=e.context,r=n.shape,i=n.canExecute,o=n.newBounds;if(ki(r,"bpmn:Lane")||ki(r,"bpmn:Participant"))return i&&(o=mn(o),t.resizeLane(r,o,n.balanced)),!1}))}Kd.$inject=["eventBus","modeling"];function Jd(e,t,n,r,i){function o(e){return Ei(e,["bpmn:ReceiveTask","bpmn:SendTask"])||function(e,t){c(t)||(t=[t]);return _(t,(function(t){return Gi(e,t)}))}(e,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function s(t){return!!m(e.getDefinitions().get("rootElements"),M({id:t.id}))}function a(e){return ki(e,"bpmn:ErrorEventDefinition")?"errorRef":ki(e,"bpmn:EscalationEventDefinition")?"escalationRef":ki(e,"bpmn:MessageEventDefinition")?"messageRef":ki(e,"bpmn:SignalEventDefinition")?"signalRef":void 0}function l(e){if(Ei(e,["bpmn:ReceiveTask","bpmn:SendTask"]))return e.get("messageRef");var t=e.get("eventDefinitions")[0];return t.get(a(t))}n.invoke(Ho,this),this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],(function(t){var n=t.shape||t.element;if(o(n)){var r=l(Oi(n));r&&!s(r)&&(Ot(e.getDefinitions().get("rootElements"),r),t.addedRootElement=r)}}),!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],(function(t){var n=t.addedRootElement;n&&Et(e.getDefinitions().get("rootElements"),n)}),!0),t.on("copyPaste.copyElement",(function(e){var t=e.descriptor,n=e.element;if(!n.labelTarget&&o(n)){var r=l(Oi(n));r&&(t.referencedRootElement=r)}})),t.on("copyPaste.pasteElement",500,(function(e){var t=e.descriptor,n=t.businessObject,o=t.referencedRootElement;o&&(s(o)||(o=r.copyElement(o,i.create(o.$type))),function(e,t){if(Ei(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)}))}Jd.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],e(Jd,Ho);var eh=Math.max;function th(e){e.on("spaceTool.getMinDimensions",(function(e){var t=e.shapes,n=e.axis,r=e.start,i={};return v(t,(function(e){var t=e.id;ki(e,"bpmn:Participant")&&(i[t]=function(e,t,n){var r=Hi(e);if(i=e,!Nu(i).length)return r?Bd:$d;var i;var o=function(e){return"x"===e}(t),s={};s=o?r?Bd:{width:rh(e,n,o),height:$d.height}:r?{width:Bd.width,height:nh(e,n,o)}:$d;return s}(e,n,r)),ki(e,"bpmn:Lane")&&(i[t]=Hi(e)?Id:zd),ki(e,"bpmn:SubProcess")&&Vi(e)&&(i[t]=qd),ki(e,"bpmn:TextAnnotation")&&(i[t]=Fd),ki(e,"bpmn:Group")&&(i[t]=Ld)})),i}))}function nh(e,t,n){var r;return r=function(e,t,n){var r,i=Nu(e);return r=ih(i,t,n),e.height-r.height+Id.height}(e,t,n),eh(Bd.height,r)}function rh(e,t,n){var r;return r=function(e,t,n){var r,i=Nu(e);return r=ih(i,t,n),e.width-r.width+zd.width}(e,t,n),eh($d.width,r)}function ih(e,t,n){var r,i,o;for(r=0;r<e.length;r++)if(i=e[r],!n&&t>=i.y&&t<=i.y+i.height||n&&t>=i.x&&t<=i.x+i.width)return(o=Nu(i)).length?ih(o,t,n):i}th.$inject=["eventBus"];var oh=180,sh=160;function ah(e,t,n,r,i,o,s){Ho.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=r,this._bpmnFactory=i,this._bpmnjs=o,this._elementRegistry=s;var a=this;function l(e){return ki(e,"bpmn:SubProcess")&&!Vi(e)}function c(t){var n=t.shape,r=t.newRootElement,i=Oi(n);r=a._addDiagram(r||i),t.newRootElement=e.addRootElement(r)}function p(t){var n=Oi(t.shape);a._removeDiagram(n);var r=t.newRootElement=s.get(Jo(n));e.removeRootElement(r)}this.executed("shape.create",(function(e){l(e.shape)&&c(e)}),!0),this.postExecuted("shape.create",(function(e){var t=e.shape,n=e.newRootElement;n&&t.children&&(a._showRecursively(t.children),a._moveChildrenToShape(t,n))}),!0),this.reverted("shape.create",(function(e){l(e.shape)&&p(e)}),!0),this.preExecuted("shape.delete",(function(e){var t=e.shape;if(l(t)){var r=s.get(Jo(t));r&&n.removeElements(r.children.slice())}}),!0),this.executed("shape.delete",(function(e){l(e.shape)&&p(e)}),!0),this.reverted("shape.delete",(function(e){l(e.shape)&&c(e)}),!0),this.preExecuted("shape.replace",(function(t){var n=t.oldShape,r=t.newShape;l(n)&&l(r)&&(t.oldRoot=e.removeRootElement(Jo(n)))}),!0),this.postExecuted("shape.replace",(function(t){var r=t.newShape,i=t.oldRoot,o=e.findRoot(Jo(r));if(i&&o){var s=i.children;n.moveElements(s,{x:0,y:0},o)}}),!0),this.executed("element.updateProperties",(function(e){var t=e.element;if(ki(t,"bpmn:SubProcess")){var n=e.properties,r=e.oldProperties.id,i=n.id;if(r!==i){if(ts(t))return s.updateId(t,es(i)),void s.updateId(r,i);s.get(es(r))&&s.updateId(es(r),es(i))}}}),!0),this.reverted("element.updateProperties",(function(e){var t=e.element;if(ki(t,"bpmn:SubProcess")){var n=e.properties,r=e.oldProperties.id,i=n.id;if(r!==i){if(ts(t))return s.updateId(t,es(r)),void s.updateId(i,r);var o=s.get(es(i));o&&s.updateId(o,es(r))}}}),!0),t.on("element.changed",(function(e){var n=e.element;if(ts(n)){var r=n,i=s.get(Ko(r));i&&i!==r&&t.fire("element.changed",{element:i})}})),this.executed("shape.toggleCollapse",400,(function(e){var t=e.shape;ki(t,"bpmn:SubProcess")&&(Vi(t)?p(e):(c(e),a._showRecursively(t.children)))}),!0),this.reverted("shape.toggleCollapse",400,(function(e){var t=e.shape;ki(t,"bpmn:SubProcess")&&(Vi(t)?p(e):(c(e),a._showRecursively(t.children)))}),!0),this.postExecuted("shape.toggleCollapse",600,(function(e){var t=e.shape;if(ki(t,"bpmn:SubProcess")){var n=e.newRootElement;n&&(Vi(t)?a._moveChildrenToShape(n,t):a._moveChildrenToShape(t,n))}}),!0),t.on("copyPaste.createTree",(function(e){var t=e.element,n=e.children;if(l(t)){var r=Jo(t),i=s.get(r);i&&n.push.apply(n,i.children)}})),t.on("copyPaste.copyElement",(function(e){var t=e.descriptor,n=e.element,r=e.elements,i=n.parent;if(ki(Pi(i),"bpmndi:BPMNPlane")){var o=Ko(i),s=m(r,(function(e){return e.id===o}));s&&(t.parent=s.id)}})),t.on("copyPaste.pasteElement",(function(e){var t=e.descriptor;t.parent&&(l(t.parent)||t.parent.hidden)&&(t.hidden=!0)}))}function lh(e,t){e.invoke(Ho,this),this.postExecuted("shape.replace",(function(e){var n=e.context.oldShape,r=e.context.newShape;if(ki(r,"bpmn:SubProcess")&&(ki(n,"bpmn:Task")||ki(n,"bpmn:CallActivity"))&&Vi(r)){var i,o={x:(i=r).x+i.width/6,y:i.y+i.height/2};t.createShape({type:"bpmn:StartEvent"},o,r)}}))}function ch(e){Ho.call(this,e),this.preExecute("connection.create",(function(e){const{target:t}=e;ki(t,"bpmn:TextAnnotation")&&(e.parent=t.parent)}),!0),this.preExecute(["shape.create","shape.resize","elements.move"],(function(e){const t=e.shapes||[e.shape];1===t.length&&ki(t[0],"bpmn:TextAnnotation")&&(e.hints=e.hints||{},e.hints.autoResize=!1)}),!0)}function ph(e,t){Ho.call(this,e),this.postExecuted("shape.toggleCollapse",1500,(function(e){var n=e.shape;if(!Vi(n)){var r=yt(n);r.forEach((function(e){var t=e.incoming.slice(),n=e.outgoing.slice();v(t,(function(e){i(e,!0)})),v(n,(function(e){i(e,!1)}))}))}function i(e,i){-1!==r.indexOf(e.source)&&-1!==r.indexOf(e.target)||(i?t.reconnectEnd(e,n,wn(n)):t.reconnectStart(e,n,wn(n)))}}),!0)}e(ah,Ho),ah.prototype._moveChildrenToShape=function(e,t){var n,r=this._modeling,i=e.children;if(i){var o=(i=i.concat(i.reduce((function(t,n){return n.label&&n.label.parent!==e?t.concat(n.label):t}),[]))).filter((function(e){return!e.hidden}));if(o.length){var s=vt(o);if(t.x){var a=wn(t),l=wn(s);n={x:a.x-l.x,y:a.y-l.y}}else n={x:oh-s.x,y:sh-s.y};r.moveElements(i,n,t,{autoResize:!1})}else r.moveElements(i,{x:0,y:0},t,{autoResize:!1})}},ah.prototype._showRecursively=function(e,t){var n=this,r=[];return e.forEach((function(e){e.hidden=!!t,r=r.concat(e),e.children&&(r=r.concat(n._showRecursively(e.children,e.collapsed||t)))})),r},ah.prototype._addDiagram=function(e){var t=this._bpmnjs.getDefinitions().diagrams;return e.businessObject||(e=this._createNewDiagram(e)),t.push(e.di.$parent),e},ah.prototype._createNewDiagram=function(e){var t=this._bpmnFactory,n=this._elementFactory,r=t.create("bpmndi:BPMNPlane",{bpmnElement:e}),i=t.create("bpmndi:BPMNDiagram",{plane:r});return r.$parent=i,n.createRoot({id:Jo(e),type:e.$type,di:r,businessObject:e,collapsed:!0})},ah.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},ah.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"],lh.$inject=["injector","modeling"],e(lh,Ho),e(ch,Ho),ch.$inject=["eventBus"],e(ph,Ho),ph.$inject=["eventBus","modeling"];function uh(e,t,n){Ho.call(this,e),this.executed(["shape.toggleCollapse"],500,(function(e){var t,n=e.context.shape;ki(n,"bpmn:SubProcess")&&(n.collapsed?Pi(n).isExpanded=!1:((t=n.children).length&&t.forEach((function(e){"label"!==e.type||e.businessObject.name||(e.hidden=!0)})),Pi(n).isExpanded=!0))})),this.reverted(["shape.toggleCollapse"],500,(function(e){var t=e.context.shape;t.collapsed?Pi(t).isExpanded=!1:Pi(t).isExpanded=!0})),this.postExecuted(["shape.toggleCollapse"],500,(function(e){var r,i=e.context.shape,o=t.getDefaultSize(i);r=i.collapsed?function(e,t){return{x:e.x+(e.width-t.width)/2,y:e.y+(e.height-t.height)/2,width:t.width,height:t.height}}(i,o):function(e,t){var n,r,i,o=e.children,s=t;return n=(i=o,i.filter((function(e){return!e.hidden}))).concat([e]),(r=Cu(n))?(s.width=Math.max(r.width,s.width),s.height=Math.max(r.height,s.height),s.x=r.x+(r.width-s.width)/2,s.y=r.y+(r.height-s.height)/2):(s.x=e.x+(e.width-s.width)/2,s.y=e.y+(e.height-s.height)/2),s}(i,o),n.resizeShape(i,r,null,{autoResize:!i.collapsed&&"nwse"})}))}function dh(e,t,n,r){t.invoke(Ho,this),this.preExecute("shape.delete",(function(e){var t=e.context.shape,i=t.businessObject;fn(t)||(ki(t,"bpmn:Participant")&&Vi(t)&&n.ids.unclaim(i.processRef.id),r.unclaimId(i.id,i))})),this.preExecute("connection.delete",(function(e){var t=e.context.connection.businessObject;r.unclaimId(t.id,t)})),this.preExecute("canvas.updateRoot",(function(){var t=e.getRootElement(),r=t.businessObject;ki(t,"bpmn:Collaboration")&&n.ids.unclaim(r.id)}))}function hh(e,t){Ho.call(this,e),this.preExecute("connection.delete",(function(e){var n=e.context.connection,r=n.source;(function(e,t){if(!ki(e,"bpmn:SequenceFlow"))return!1;var n=Oi(t),r=Oi(e);return n.get("default")===r})(n,r)&&t.updateProperties(r,{default:null})}))}e(uh,Ho),uh.$inject=["eventBus","elementFactory","modeling"],e(dh,Ho),dh.$inject=["canvas","injector","moddle","modeling"],e(hh,Ho),hh.$inject=["eventBus","modeling"];function fh(e,t){var n;function r(){if(!n)throw new Error("out of bounds release");return n}Ho.call(this,e);var i=["spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move","shape.create","shape.delete","shape.move","shape.resize"];this.preExecute(i,5e3,(function(e){(n=n||new mh).enter()})),this.postExecuted(i,500,(function(e){!function(){if(!n)throw new Error("out of bounds release");var e=n.leave();e&&(t.updateLaneRefs(n.flowNodes,n.lanes),n=null)}()})),this.preExecute(["shape.create","shape.move","shape.delete","shape.resize"],(function(e){var t=e.context.shape,n=r();t.labelTarget||(ki(t,"bpmn:Lane")&&n.addLane(t),ki(t,"bpmn:FlowNode")&&n.addFlowNode(t))}))}function mh(){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 gh(e,t){Ho.call(this,e),this.postExecuted("elements.create",(function(e){const n=e.context.elements;for(const e of n)yh(e)&&!vh(e)&&t.updateProperties(e,{isForCompensation:void 0})}))}function yh(e){const t=Oi(e);return t&&t.isForCompensation}function vh(e){return e.incoming.filter((e=>function(e){return e&&ki(e,"bpmn:BoundaryEvent")&&Gi(e,"bpmn:CompensateEventDefinition")}(e.source))).length>0}fh.$inject=["eventBus","modeling"],e(fh,Ho),e(gh,Ho),gh.$inject=["eventBus","modeling"];var bh={__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",Kp],appendBehavior:["type",eu],associationBehavior:["type",tu],attachEventBehavior:["type",nu],boundaryEventBehavior:["type",iu],compensateBoundaryEventBehaviour:["type",ou],createBehavior:["type",cu],createDataObjectBehavior:["type",pu],createParticipantBehavior:["type",mu],dataInputAssociationBehavior:["type",yu],dataStoreBehavior:["type",wu],deleteLaneBehavior:["type",Lu],detachEventBehavior:["type",Iu],dropOnFlowBehavior:["type",Bu],eventBasedGatewayBehavior:["type",Fu],fixHoverBehavior:["type",Uu],groupBehavior:["type",Wu],importDockingFix:["type",Qu],isHorizontalFix:["type",Xu],labelBehavior:["type",fd],layoutConnectionBehavior:["type",gd],messageFlowBehavior:["type",Od],nonInterruptingBehavior:["type",Td],removeElementBehavior:["type",Ad],removeEmbeddedLabelBoundsBehavior:["type",Md],removeParticipantBehavior:["type",Nd],replaceConnectionBehavior:["type",Rd],replaceElementBehaviour:["type",jd],resizeBehavior:["type",Vd],resizeLaneBehavior:["type",Kd],rootElementReferenceBehavior:["type",Jd],spaceToolBehavior:["type",th],subProcessPlaneBehavior:["type",ah],subProcessStartEventBehavior:["type",lh],textAnnotationBehavior:["type",ch],toggleCollapseConnectionBehaviour:["type",ph],toggleElementCollapseBehaviour:["type",uh],unclaimIdBehavior:["type",dh],unsetDefaultFlowBehavior:["type",hh],updateFlowNodeRefsBehavior:["type",fh],setCompensationActivityAfterPasteBehavior:["type",gh]};function wh(e,t){var n=xn(e,t,-15);return"intersect"!==n?n:null}function xh(e){tc.call(this,e)}function _h(e){return!e||fn(e)}function kh(e){do{if(ki(e,"bpmn:Process"))return Oi(e);if(ki(e,"bpmn:Participant"))return Oi(e).processRef||Oi(e)}while(e=e.parent)}function Eh(e){return ki(e,"bpmn:TextAnnotation")}function Oh(e){return ki(e,"bpmn:Group")&&!e.labelTarget}function Ph(e){return ki(e,"bpmn:BoundaryEvent")&&Mh(e,"bpmn:CompensateEventDefinition")}function Sh(e){return Oi(e).isForCompensation}function Ch(e){for(var t=e;t=t.parent;){if(ki(t,"bpmn:FlowElementsContainer"))return Oi(t);if(ki(t,"bpmn:Participant"))return Oi(t).processRef}return null}function Th(e,t){return Ch(e)===Ch(t)}function Mh(e,t){return!!m(Oi(e).eventDefinitions||[],(function(e){return ki(e,t)}))}function Ah(e,t){return(Oi(e).eventDefinitions||[]).every((function(e){return ki(e,t)}))}function Dh(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 Nh(e,t,n){if(_h(e)||_h(t))return null;if(!ki(n,"bpmn:DataAssociation")){if(Gh(e,t))return{type:"bpmn:MessageFlow"};if(Qh(e,t))return{type:"bpmn:SequenceFlow"}}var r=Zh(e,t);return r||(Wh(e,t)?{type:"bpmn:Association",associationDirection:"One"}:!!Uh(e,t)&&{type:"bpmn:Association",associationDirection:"None"})}function Rh(e,t){return!(!fn(e)&&!Oh(e))||!(ki(t,"bpmn:Participant")&&!Vi(t))&&(ki(e,"bpmn:Participant")?ki(t,"bpmn:Process")||ki(t,"bpmn:Collaboration"):Ei(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:ki(e,"bpmn:Lane")?ki(t,"bpmn:Participant")||ki(t,"bpmn:Lane"):!(ki(e,"bpmn:BoundaryEvent")&&!function(e){return Oi(e).cancelActivity&&(Ih(e)||zh(e))}(e))&&(ki(e,"bpmn:FlowElement")&&!ki(e,"bpmn:DataStoreReference")?ki(t,"bpmn:FlowElementsContainer")?Vi(t):Ei(t,["bpmn:Participant","bpmn:Lane"]):ki(e,"bpmn:DataStoreReference")&&ki(t,"bpmn:Collaboration")?_(Oi(t).get("participants"),(function(e){return!!e.get("processRef")})):Ei(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?Ei(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):!!ki(e,"bpmn:MessageFlow")&&(ki(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t)))}function jh(e){return ki(e,"bpmn:Lane")}function Lh(e){return!!function(e){return!fn(e)&&ki(e,"bpmn:BoundaryEvent")}(e)||(!(!ki(e,"bpmn:IntermediateThrowEvent")||!Ih(e))||ki(e,"bpmn:IntermediateCatchEvent")&&zh(e))}function Ih(e){var t=Oi(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function zh(e){return Bh(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function Bh(e,t){return t.some((function(t){return Mh(e,t)}))}function $h(e,t,n,r){if(Array.isArray(e)||(e=[e]),1!==e.length)return!1;var i=e[0];return!fn(i)&&(!!Lh(i)&&(!Wi(t)&&(!(!ki(t,"bpmn:Activity")||Sh(t))&&(!(r&&!wh(r,t))&&(!function(e){return ki(e,"bpmn:ReceiveTask")&&m(e.incoming,(function(e){return ki(e.source,"bpmn:EventBasedGateway")}))}(t)&&"attach")))))}function qh(e,t,n){if(!t)return!1;var r={replacements:[]};return v(e,(function(e){Wi(t)||ki(e,"bpmn:StartEvent")&&"label"!==e.type&&Rh(e,t)&&(Ui(e)||r.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"}),(function(e){return Gi(e,"bpmn:ErrorEventDefinition")}(e)||function(e){return Gi(e,"bpmn:EscalationEventDefinition")}(e)||function(e){return Gi(e,"bpmn:CompensateEventDefinition")}(e))&&r.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"}),Bh(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&ki(t,"bpmn:SubProcess")&&r.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"})),ki(t,"bpmn:Transaction")||Mh(e,"bpmn:CancelEventDefinition")&&"label"!==e.type&&(ki(e,"bpmn:EndEvent")&&Rh(e,t)&&r.replacements.push({oldElementId:e.id,newElementType:"bpmn:EndEvent"}),ki(e,"bpmn:BoundaryEvent")&&$h(e,t,0,n)&&r.replacements.push({oldElementId:e.id,newElementType:"bpmn:BoundaryEvent"}))})),!!r.replacements.length&&r}function Fh(e,t){return!_(e,jh)&&(!t||e.every((function(e){return Rh(e,t)})))}function Vh(e,t,n,r){return!!t&&(!(!fn(e)&&!Oh(e))||!function(e,t){return e===t}(n,t)&&((!n||!Dh(n,t))&&(Rh(e,t)||Xh(e,t))))}function Hh(e,t){return ki(e,"bpmn:SubProcess")?Vi(e)&&(!t||t.width>=100&&t.height>=80):!!ki(e,"bpmn:Lane")||(!!ki(e,"bpmn:Participant")||(!!Eh(e)||!!Oh(e)))}function Uh(e,t){return!Dh(t,e)&&!Dh(e,t)&&(!!function(e,t){var n=Eh(e),r=Eh(t);return(n||r)&&n!==r}(e,t)||!!Zh(e,t))}function Wh(e,t){return Th(e,t)&&Ph(e)&&ki(t,"bpmn:Activity")&&(n=e,!t.attachers.includes(n))&&!Wi(t);var n}function Gh(e,t){return!(Kh(e)&&!Kh(t))&&(ki(n=e,"bpmn:InteractionNode")&&!ki(n,"bpmn:BoundaryEvent")&&(!ki(n,"bpmn:Event")||ki(n,"bpmn:ThrowEvent")&&Ah(n,"bpmn:MessageEventDefinition"))&&function(e){return ki(e,"bpmn:InteractionNode")&&!Sh(e)&&(!ki(e,"bpmn:Event")||ki(e,"bpmn:CatchEvent")&&Ah(e,"bpmn:MessageEventDefinition"))&&!(ki(e,"bpmn:BoundaryEvent")&&!Mh(e,"bpmn:MessageEventDefinition"))}(t)&&!function(e,t){return kh(e)===kh(t)}(e,t));var n}function Qh(e,t){return ki(n=e,"bpmn:FlowNode")&&!ki(n,"bpmn:EndEvent")&&!Wi(n)&&!(ki(n,"bpmn:IntermediateThrowEvent")&&Mh(n,"bpmn:LinkEventDefinition"))&&!Ph(n)&&!Sh(n)&&function(e){return ki(e,"bpmn:FlowNode")&&!ki(e,"bpmn:StartEvent")&&!ki(e,"bpmn:BoundaryEvent")&&!Wi(e)&&!(ki(e,"bpmn:IntermediateCatchEvent")&&Mh(e,"bpmn:LinkEventDefinition"))&&!Sh(e)}(t)&&Th(e,t)&&!(ki(e,"bpmn:EventBasedGateway")&&!function(e){return ki(e,"bpmn:ReceiveTask")||ki(e,"bpmn:IntermediateCatchEvent")&&(Mh(e,"bpmn:MessageEventDefinition")||Mh(e,"bpmn:TimerEventDefinition")||Mh(e,"bpmn:ConditionalEventDefinition")||Mh(e,"bpmn:SignalEventDefinition"))}(t));var n}function Zh(e,t){return Ei(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&Ei(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:!(!Ei(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])||!Ei(e,["bpmn:Activity","bpmn:CatchEvent"]))&&{type:"bpmn:DataOutputAssociation"}}function Xh(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&&(Ei(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!fn(t)&&ki(e,"bpmn:FlowNode")&&!ki(e,"bpmn:BoundaryEvent")&&Rh(e,t.parent))}function Yh(e,t){return!!fn(t)||!(ki(t,"bpmn:Lane")&&!function(e,t){return e&&t&&-1!==e.indexOf(t)}(e,t.parent))}function Kh(e){return mc(e,"bpmn:Process")||mc(e,"bpmn:Collaboration")}e(xh,tc),xh.$inject=["eventBus"],xh.prototype.init=function(){this.addRule("connection.start",(function(e){return function(e){if(_h(e))return null;return Ei(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}(e.source)})),this.addRule("connection.create",(function(e){var t=e.source,n=e.target,r=e.hints||{},i=r.targetParent;if(r.targetAttach)return!1;i&&(n.parent=i);try{return Nh(t,n)}finally{i&&(n.parent=null)}})),this.addRule("connection.reconnect",(function(e){var t=e.connection;return Nh(e.source,e.target,t)})),this.addRule("connection.updateWaypoints",(function(e){return{type:e.connection.type}})),this.addRule("shape.resize",(function(e){return Hh(e.shape,e.newBounds)})),this.addRule("elements.create",(function(e){var t=e.elements,n=e.position,r=e.target;return!(hn(r)&&!Xh(t,r))&&x(t,(function(e){return hn(e)?Nh(e.source,e.target,e):e.host?$h(e,e.host,null,n):Vh(e,r,null)}))})),this.addRule("elements.move",(function(e){var t=e.target,n=e.shapes,r=e.position;return $h(n,t,null,r)||qh(n,t,r)||Fh(n,t)||Xh(n,t)})),this.addRule("shape.create",(function(e){return Vh(e.shape,e.target,e.source,e.position)})),this.addRule("shape.attach",(function(e){return $h(e.shape,e.target,null,e.position)})),this.addRule("element.copy",(function(e){var t=e.element;return Yh(e.elements,t)}))},xh.prototype.canConnectMessageFlow=Gh,xh.prototype.canConnectSequenceFlow=Qh,xh.prototype.canConnectDataAssociation=Zh,xh.prototype.canConnectAssociation=Uh,xh.prototype.canConnectCompensationAssociation=Wh,xh.prototype.canMove=Fh,xh.prototype.canAttach=$h,xh.prototype.canReplace=qh,xh.prototype.canDrop=Rh,xh.prototype.canInsert=Xh,xh.prototype.canCreate=Vh,xh.prototype.canConnect=Nh,xh.prototype.canResize=Hh,xh.prototype.canCopy=Yh;var Jh={__depends__:[Ic],__init__:["bpmnRules"],bpmnRules:["type",xh]};function ef(e,t){e.on("saveXML.start",2e3,(function(){v(t.getRootElements(),(function(e){var t,n=Pi(e);t=k(y(yt([e],!1),(function(t){return t!==e&&!t.labelTarget})),Pi),n.set("planeElement",t)}))}))}ef.$inject=["eventBus","canvas"];var tf={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",ef]};function nf(e){Ho.call(this,e);var t=this;this.preExecute(["shape.create","connection.create"],(function(e){var n=e.context,r=n.shape||n.connection,i=n.parent,o=t.getOrdering(r,i);o&&(void 0!==o.parent&&(n.parent=o.parent),n.parentIndex=o.index)})),this.preExecute(["shape.move","connection.move"],(function(e){var n=e.context,r=n.shape||n.connection,i=n.newParent||r.parent,o=t.getOrdering(r,i);o&&(void 0!==o.parent&&(n.newParent=o.parent),n.newParentIndex=o.index)}))}function rf(e,t){nf.call(this,e);var n=[{type:"bpmn:SubProcess",order:{level:6}},{type:"bpmn:SequenceFlow",order:{level:9,containers:["bpmn:Participant","bpmn:FlowElementsContainer"]}},{type:"bpmn:DataAssociation",order:{level:9,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:TextAnnotation",order:{level:9}},{type:"bpmn:MessageFlow",order:{level:9,containers:["bpmn:Collaboration"]}},{type:"bpmn:Association",order:{level:6,containers:["bpmn:Participant","bpmn:FlowElementsContainer","bpmn:Collaboration"]}},{type:"bpmn:BoundaryEvent",order:{level:8}},{type:"bpmn:Group",order:{level:10,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:FlowElement",order:{level:5}},{type:"bpmn:Participant",order:{level:-2}},{type:"bpmn:Lane",order:{level:-1}}];function r(e){var t=e.order;if(t||(e.order=t=function(e){if(e.labelTarget)return{level:10};var t=m(n,(function(t){return Ei(e,[t.type])}));return t&&t.order||{level:1}}(e)),!t)throw new Error(`no order for <${e.id}>`);return t}this.getOrdering=function(e,n){if(e.labelTarget||ki(e,"bpmn:TextAnnotation"))return{parent:t.findRoot(n)||t.getRootElement(),index:-1};var i=r(e);i.containers&&(n=function(e,t,n){for(var r=t;r&&!Ei(r,n);)r=r.parent;if(!r)throw new Error(`no parent for <${e.id}> in <${t&&t.id}>`);return r}(e,n,i.containers));var o=n.children.indexOf(e),s=g(n.children,(function(t){return!(!e.labelTarget&&t.labelTarget)&&i.level<r(t).level}));return-1!==s&&-1!==o&&o<s&&(s-=1),{index:s,parent:n}}}nf.prototype.getOrdering=function(e,t){return null},e(nf,Ho),rf.$inject=["eventBus","canvas"],e(rf,nf);var of={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",rf]};function sf(){}sf.prototype.get=function(){return this._data},sf.prototype.set=function(e){this._data=e},sf.prototype.clear=function(){var e=this._data;return delete this._data,e},sf.prototype.isEmpty=function(){return!this._data};var af={clipboard:["type",sf]},lf="drop-ok",cf="drop-not-ok",pf="attach-ok",uf="new-parent",df="create";function hf(e,t,n,r,i){function o(t,n){[pf,lf,cf,uf].forEach((function(r){r===n?e.addMarker(t,r):e.removeMarker(t,r)}))}function s(){var e=t.context();e&&e.prefix===df&&t.cancel()}n.on(["create.move","create.hover"],(function(e){var t=e.context,n=t.elements,r=e.hover,s=t.source,a=t.hints||{};if(!r)return t.canExecute=!1,void(t.target=null);ff(e);var l={x:e.x,y:e.y},c=t.canExecute=r&&function(e,t,n,r,o){if(!t)return!1;var s=m(e=y(e,(function(t){var n=t.labelTarget;return!(t.parent||fn(t)&&-1!==e.indexOf(n))})),(function(e){return!hn(e)})),a=!1,l=!1,c=!1;mf(e)&&(a=i.allowed("shape.attach",{position:n,shape:s,target:t})),a||(c=mf(e)?i.allowed("shape.create",{position:n,shape:s,source:r,target:t}):i.allowed("elements.create",{elements:e,position:n,target:t}));var p=o.connectionTarget;return c||a?(s&&r&&(l=i.allowed("connection.create",{source:p===r?s:r,target:p===r?r:s,hints:{targetParent:t,targetAttach:a}})),{attach:a,connect:l}):(null===c||null===a)&&null}(n,r,l,s,a);r&&null!==c&&(t.target=r,c&&c.attach?o(r,pf):o(r,c?uf:cf))})),n.on(["create.end","create.out","create.cleanup"],(function(e){var t=e.hover;t&&o(t,null)})),n.on("create.end",(function(e){var t=e.context,n=t.source,i=t.shape,o=t.elements,s=t.target,a=t.canExecute,l=a&&a.attach,c=a&&a.connect,p=t.hints||{};if(!1===a||!s)return!1;ff(e);var u={x:e.x,y:e.y};i=c?r.appendShape(n,i,u,s,{attach:l,connection:!0===c?{}:c,connectionTarget:p.connectionTarget}):m(o=r.createElements(o,u,s,I({},p,{attach:l})),(function(e){return!hn(e)})),I(t,{elements:o,shape:i}),I(e,{elements:o,shape:i})})),n.on("create.init",(function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],2e3,(function(){n.off("elements.changed",s)}))})),this.start=function(e,n,r){c(n)||(n=[n]);var i=m(n,(function(e){return!hn(e)}));if(i){r=I({elements:n,hints:{},shape:i},r||{}),v(n,(function(e){u(e.x)||(e.x=0),u(e.y)||(e.y=0)}));var o=vt(y(n,(function(e){return!e.hidden})));v(n,(function(e){hn(e)&&(e.waypoints=k(e.waypoints,(function(e){return{x:e.x-o.x-o.width/2,y:e.y-o.y-o.height/2}}))),I(e,{x:e.x-o.x-o.width/2,y:e.y-o.y-o.height/2})})),t.init(e,df,{cursor:"grabbing",autoActivate:!0,data:{shape:i,elements:n,context:r}})}}}function ff(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 mf(e){return e&&1===e.length&&!hn(e[0])}hf.$inject=["canvas","dragging","eventBus","modeling","rules"];function gf(e,t,n,r,i){t.on("create.move",750,(function(t){var o=t.hover,s=t.context,a=s.elements,l=s.dragGroup;l||(l=s.dragGroup=function(e){var t=Re("g");Oe(t,i.cls("djs-drag-group",["no-events"]));var o=Re("g");return e.forEach((function(e){var i;e.hidden||(e.waypoints?(i=n._createContainer("connection",o),n.drawConnection(Zn(i),e)):(i=n._createContainer("shape",o),n.drawShape(Zn(i),e),Yn(i,e.x,e.y)),r.addDragger(e,t,i))})),t}(a)),o?(l.parentNode||xe(e.getActiveLayer(),l),Yn(l,t.x,t.y)):Ue(l)})),t.on("create.cleanup",(function(e){var t=e.context.dragGroup;t&&Ue(t)}))}gf.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];var yf={__depends__:[Dc,Wp,Ic,Ds],__init__:["create","createPreview"],create:["type",hf],createPreview:["type",gf]};function vf(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)}))}vf.$inject=["eventBus"],vf.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||function(e,t){var n=document.createEvent("MouseEvent"),r=e,i=t,o=e,s=t;n.initMouseEvent&&n.initMouseEvent("mousemove",!0,!0,window,0,r,i,o,s,!1,!1,!1,!1,0,null);return n}(0,0)};var bf={__init__:["mouse"],mouse:["type",vf]};function wf(e,t,n,r,i,o,s,a){this._canvas=e,this._create=t,this._clipboard=n,this._elementFactory=r,this._eventBus=i,this._modeling=o,this._mouse=s,this._rules=a,i.on("copyPaste.copyElement",(function(e){var t=e.descriptor,n=e.element,r=e.elements;t.priority=1,t.id=n.id;var i=m(r,(function(e){return e===n.parent}));i&&(t.parent=n.parent.id),function(e){return!!e.host}(n)&&(t.priority=2,t.host=n.host.id),hn(n)&&(t.priority=3,t.source=n.source.id,t.target=n.target.id,t.waypoints=function(e){return k(e.waypoints,(function(e){return(e=xf(e)).original&&(e.original=xf(e.original)),e}))}(n)),fn(n)&&(t.priority=4,t.labelTarget=n.labelTarget.id),v(["x","y","width","height"],(function(e){u(n[e])&&(t[e]=n[e])})),t.hidden=n.hidden,t.collapsed=n.collapsed})),i.on("copyPaste.pasteElements",(function(e){I(e.hints,{createElementsBehavior:!1})}))}function xf(e){return I({},e)}function _f(e,t){var n=t.indexOf(e);return-1===n?t:t.splice(n,1)}wf.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],wf.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},wf.prototype.paste=function(e){var t=this._clipboard.get();if(!this._clipboard.isEmpty()){var n=e&&e.hints||{};this._eventBus.fire("copyPaste.pasteElements",{hints:n});var r=this._createElements(t);if(e&&e.element&&e.point)return this._paste(r,e.element,e.point,n);this._create.start(this._mouse.getLastMoveEvent(),r,{hints:n||{}})}},wf.prototype._paste=function(e,t,n,r){v(e,(function(e){u(e.x)||(e.x=0),u(e.y)||(e.y=0)}));var i=vt(e);return v(e,(function(e){hn(e)&&(e.waypoints=k(e.waypoints,(function(e){return{x:e.x-i.x-i.width/2,y:e.y-i.y-i.height/2}}))),I(e,{x:e.x-i.x-i.width/2,y:e.y-i.y-i.height/2})})),this._modeling.createElements(e,n,t,I({},r))},wf.prototype._createElements=function(e){var t=this,n=this._eventBus,r={},i=[];return v(e,(function(e,o){v(e=T(e,"priority"),(function(e){var o,s=I({},q(e,["priority"]));return r[e.parent]?s.parent=r[e.parent]:delete s.parent,n.fire("copyPaste.pasteElement",{cache:r,descriptor:s}),hn(s)?(s.source=r[e.source],s.target=r[e.target],o=r[e.id]=t.createConnection(s),void i.push(o)):fn(s)?(s.labelTarget=r[s.labelTarget],o=r[e.id]=t.createLabel(s),void i.push(o)):(s.host&&(s.host=r[s.host]),o=r[e.id]=t.createShape(s),void i.push(o))}))})),i},wf.prototype.createConnection=function(e){return this._elementFactory.createConnection(q(e,["id"]))},wf.prototype.createLabel=function(e){return this._elementFactory.createLabel(q(e,["id"]))},wf.prototype.createShape=function(e){return this._elementFactory.createShape(q(e,["id"]))},wf.prototype.hasRelations=function(e,t){var n,r;return!(hn(e)&&(n=m(t,M({id:e.source.id})),r=m(t,M({id:e.target.id})),!n||!r))&&!(fn(e)&&!m(t,M({id:e.labelTarget.id})))},wf.prototype.createTree=function(e){var t=this._rules,n=this,r={},i=[];function o(e,t){var n=m(i,(function(t){return e===t.element}));n?n.depth<t&&(i=function(e,t){var n=t.indexOf(e);-1!==n&&t.splice(n,1);return t}(n,i),i.push({element:n.element,depth:t})):i.push({element:e,depth:t})}return gt(ht(e),(function(e,t,r){if(!fn(e)){v(e.labels,(function(e){o(e,r)})),v([e.attachers,e.incoming,e.outgoing],(function(e){e&&e.length&&v(e,(function(e){v(e.labels,(function(e){o(e,r)})),o(e,r)}))})),o(e,r);var i=[];return e.children&&(i=e.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:e,children:i}),i}})),e=k(i,(function(e){return e.element})),i=k(i,(function(t){return t.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:t.descriptor,element:t.element,elements:e}),t})),i=T(i,(function(e){return e.descriptor.priority})),e=k(i,(function(e){return e.element})),v(i,(function(i){var o=i.depth;n.hasRelations(i.element,e)?!function(e,n){return t.allowed("element.copy",{element:e,elements:n})}(i.element,e)?_f(i.element,e):(r[o]||(r[o]=[]),r[o].push(i.descriptor)):_f(i.element,e)})),r};var kf={__depends__:[af,yf,bf,Ic],__init__:["copyPaste"],copyPaste:["type",wf]};function Ef(e,t,n){c(n)||(n=[n]),v(n,(function(n){s(e[n])||(t[n]=e[n])}))}function Of(e,t,n){function r(t,r){var i=e.create(t.$type);return n.copyElement(t,i,null,r)}t.on("copyPaste.copyElement",750,(function(e){var t=e.descriptor,n=e.element,i=Oi(n);if(fn(n))return t;var o=t.businessObject=r(i,!0),s=t.di=r(Pi(n),!0);s.bpmnElement=o,Ef(o,t,"name"),Ef(s,t,"isExpanded"),i.default&&(t.default=i.default.id)}));var i="-bpmn-js-refs";t.on("copyPaste.pasteElement",(function(e){var t=e.cache,n=e.descriptor,i=n.businessObject,o=n.di;if(fn(n))return n.businessObject=Oi(t[n.labelTarget]),void(n.di=Pi(t[n.labelTarget]));i=n.businessObject=r(i),(o=n.di=r(o)).bpmnElement=i,Ef(n,i,["isExpanded","name"]),n.type=i.$type})),t.on("copyPaste.copyElement",750,(function(e){var t=e.descriptor,n=e.element;if(ki(n,"bpmn:Participant")){var i=Oi(n);i.processRef&&(t.processRef=r(i.processRef,!0))}})),t.on("copyPaste.pasteElement",(function(e){var t=e.descriptor,n=t.processRef;n&&(t.processRef=r(n))})),t.on("copyPaste.pasteElement",750,(function(e){var t=e.cache;!function(e,t){e[i]=t}(t,function(e,t,n){var r=Oi(e);return e.default&&(n[e.default]={element:r,property:"default"}),e.host&&(Oi(e).attachedToRef=Oi(t[e.host])),q(n,w(n,(function(t,n,i){var o=n.element,s=n.property;return i===e.id&&(o.set(s,r),t.push(e.id)),t}),[]))}(e.descriptor,t,function(e){return e[i]=e[i]||{}}(t)))}))}Of.$inject=["bpmnFactory","eventBus","moddleCopy"];var Pf=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"];function Sf(e,t,n){this._bpmnFactory=t,this._eventBus=e,this._moddle=n,e.on("moddleCopy.canCopyProperties",(function(e){var t=e.propertyNames;if(t&&t.length)return T(t,(function(e){return"extensionElements"===e}))})),e.on("moddleCopy.canCopyProperty",(function(e){var t=e.parent,n=p(t)&&t.$descriptor,r=e.propertyName;return(!r||-1===Pf.indexOf(r))&&(!(r&&n&&!m(n.properties,M({name:r})))&&void 0)})),e.on("moddleCopy.canSetCopiedProperty",(function(e){var t=e.property;if(function(e,t){return e&&d(e.$instanceOf)&&e.$instanceOf(t)}(t,"bpmn:ExtensionElements")&&(!t.values||!t.values.length))return!1}))}function Cf(e,t){return w(e.properties,(function(e,n){return t&&n.default?e:e.concat(n.name)}),[])}Sf.$inject=["eventBus","bpmnFactory","moddle"],Sf.prototype.copyElement=function(e,t,n,r=!1){var i=this;n&&!c(n)&&(n=[n]),n=n||Cf(e.$descriptor);var o=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:r});return!1===o||(c(o)&&(n=o),v(n,(function(n){var o;f(e,n)&&(o=e.get(n));var s=i.copyProperty(o,t,n,r);a(s)&&(!1!==i._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:n})&&t.set(n,s))}))),t},Sf.prototype.copyProperty=function(e,t,n,r=!1){var i=this,o=this._eventBus.fire("moddleCopy.canCopyProperty",{parent:t,property:e,propertyName:n,clone:r});if(!1!==o){if(o)return p(o)&&o.$type&&!o.$parent&&(o.$parent=t),o;var s=this._moddle.getPropertyDescriptor(t,n);if(!s.isReference){if(s.isId)return e&&this._copyId(e,t,r);if(c(e))return w(e,(function(e,s){return(o=i.copyProperty(s,t,n,r))?e.concat(o):e}),[]);if(p(e)&&e.$type){if(this._moddle.getElementDescriptor(e).isGeneric)return;return(o=i._bpmnFactory.create(e.$type)).$parent=t,o=i.copyElement(e,o,null,r)}return e}}},Sf.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 Tf={__depends__:[kf],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",Of],moddleCopy:["type",Sf]},Mf=Math.round;function Af(e,t){this._modeling=e,this._eventBus=t}function Df(e,t){t.on("replace.end",500,(function(t){const{newElement:n,hints:r={}}=t;!1!==r.select&&e.select(n)}))}Af.$inject=["modeling","eventBus"],Af.prototype.replaceElement=function(e,t,n){if(e.waypoints)return null;var r=this._modeling,i=this._eventBus;i.fire("replace.start",{element:e,attrs:t,hints:n});var o=t.width||e.width,s=t.height||e.height,a=t.x||e.x,l=t.y||e.y,c=Mf(a+o/2),p=Mf(l+s/2),u=r.replaceShape(e,I({},t,{x:c,y:p,width:o,height:s}),n);return i.fire("replace.end",{element:e,newElement:u,hints:n}),u},Df.$inject=["selection","eventBus"];var Nf={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",Df],replace:["type",Af]};var Rf=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function jf(e,t,n,r,i,o){this.replaceElement=function(a,l,p){p=p||{};var u=l.type,d=a.businessObject;if(Lf(d)&&"bpmn:SubProcess"===u&&function(e,t){var n=e&&f(e,"collapsed")?e.collapsed:!Vi(e);return n!==(t&&(f(t,"collapsed")||f(t,"isExpanded"))?f(t,"collapsed")?t.collapsed:!t.isExpanded:n)}(a,l))return r.toggleCollapse(a),a;var h=e.create(u),m={type:u,businessObject:h,di:{}};"bpmn:ExclusiveGateway"===u&&(m.di.isMarkerVisible=!0),function(e,t,n){c(n)||(n=[n]),v(n,(function(n){s(e[n])||(t[n]=e[n])}))}(a.di,m.di,["fill","stroke","background-color","border-color","color"]);var g=function(e,t){return e.filter((function(e){return t.includes(e)}))}(Cf(d.$descriptor),Cf(h.$descriptor,!0));I(h,$(l,Rf));var b=y(g,(function(e){return"eventDefinitions"===e?If(a,l.eventDefinitionType):"loopCharacteristics"===e?!Wi(h):!f(h,e)&&(("processRef"!==e||!1!==l.isExpanded)&&("triggeredByEvent"!==e&&("isForCompensation"!==e||!Wi(h))))}));if(h=n.copyElement(d,h,b),l.eventDefinitionType&&(If(h,l.eventDefinitionType)||(m.eventDefinitionType=l.eventDefinitionType,m.eventDefinitionAttrs=l.eventDefinitionAttrs)),ki(d,"bpmn:Activity")){if(Lf(d))m.isExpanded=Vi(a);else if(l&&f(l,"isExpanded")){m.isExpanded=l.isExpanded;var w=t.getDefaultSize(h,{isExpanded:m.isExpanded});m.width=w.width,m.height=w.height,m.x=a.x-(m.width-a.width)/2,m.y=a.y-(m.height-a.height)/2}Vi(a)&&!ki(d,"bpmn:Task")&&m.isExpanded&&(m.width=a.width,m.height=a.height)}if(Lf(d)&&!Lf(h)&&(p.moveChildren=!1),ki(d,"bpmn:Participant")){!0===l.isExpanded?h.processRef=e.create("bpmn:Process"):p.moveChildren=!1;var x=Hi(a);Pi(a).isHorizontal||(Pi(m).isHorizontal=x),m.width=x?a.width:t.getDefaultSize(m).width,m.height=x?t.getDefaultSize(m).height:a.height}return o.allowed("shape.resize",{shape:h})||(m.height=t.getDefaultSize(m).height,m.width=t.getDefaultSize(m).width),h.name=d.name,Ei(d,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&Ei(h,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(h.default=d.default),l.host&&!ki(d,"bpmn:BoundaryEvent")&&ki(h,"bpmn:BoundaryEvent")&&(m.host=l.host),"bpmn:DataStoreReference"!==m.type&&"bpmn:DataObjectReference"!==m.type||(m.x=a.x+(a.width-m.width)/2),i.replaceElement(a,m,{...p,targetElement:l})}}function Lf(e){return ki(e,"bpmn:SubProcess")}function If(e,t){var n=Oi(e);return t&&n.get("eventDefinitions").some((function(e){return ki(e,t)}))}jf.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];var zf={__depends__:[Tf,Nf,Ds],bpmnReplace:["type",jf]};function Bf(e){this._eventBus=e,this._tools=[],this._active=null}Bf.$inject=["eventBus"],Bf.prototype.registerTool=function(e,t){var n=this._tools;if(!t)throw new Error('A tool has to be registered with it\'s "events"');n.push(e),this.bindEvents(e,t)},Bf.prototype.isActive=function(e){return e&&this._active===e},Bf.prototype.length=function(e){return this._tools.length},Bf.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Bf.prototype.bindEvents=function(e,t){var n=this._eventBus,r=[];n.on(t.tool+".init",(function(t){t.context.reactivate||!this.isActive(e)?this.setActive(e):this.setActive(null)}),this),v(t,(function(e){r.push(e+".ended"),r.push(e+".canceled")})),n.on(r,250,(function(e){this._active&&(function(e){var t=e.originalEvent&&e.originalEvent.target;return t&&te(t,'.group[data-group="tools"]')}(e)||this.setActive(null))}),this)};var $f={__depends__:[Dc],__init__:["toolManager"],toolManager:["type",Bf]};function qf(e,t){return-1!==e.indexOf(t)}var Ff=Math.abs,Vf=Math.round,Hf={x:"width",y:"height"},Uf="crosshair",Wf={n:"top",w:"left",s:"bottom",e:"right"},Gf=1500,Qf={n:"s",w:"e",s:"n",e:"w"},Zf=20;function Xf(e,t,n,r,i,o,s){this._canvas=e,this._dragging=t,this._eventBus=n,this._modeling=r,this._rules=i,this._toolManager=o,this._mouse=s;var a=this;o.registerTool("space",{tool:"spaceTool.selection",dragging:"spaceTool"}),n.on("spaceTool.selection.end",(function(e){n.once("spaceTool.selection.ended",(function(){a.activateMakeSpace(e.originalEvent)}))})),n.on("spaceTool.move",Gf,(function(e){var t=e.context,n=t.initialized;n||(n=t.initialized=a.init(e,t)),n&&Kf(e)})),n.on("spaceTool.end",(function(e){var t=e.context,r=t.axis,i=t.direction,o=t.movingShapes,s=t.resizingShapes,l=t.start;if(t.initialized){Kf(e);var c={x:0,y:0};c[r]=Vf(e["d"+r]),a.makeSpace(o,s,c,i,l),n.once("spaceTool.ended",(function(e){a.activateSelection(e.originalEvent,!0,!0)}))}}))}function Yf(e){return{top:e.top-Zf,right:e.right+Zf,bottom:e.bottom+Zf,left:e.left-Zf}}function Kf(e){var t,n,r=e.context.spaceToolConstraints;r&&(u(r.left)&&(t=Math.max(e.x,r.left),e.dx=e.dx+t-e.x,e.x=t),u(r.right)&&(t=Math.min(e.x,r.right),e.dx=e.dx+t-e.x,e.x=t),u(r.top)&&(n=Math.max(e.y,r.top),e.dy=e.dy+n-e.y,e.y=n),u(r.bottom)&&(n=Math.min(e.y,r.bottom),e.dy=e.dy+n-e.y,e.y=n))}function Jf(e,t){return-1!==e.indexOf(t)}Xf.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Xf.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:Uf,data:{context:{reactivate:n}},trapClick:!1})},Xf.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:Uf,data:{context:{}}})},Xf.prototype.makeSpace=function(e,t,n,r,i){return this._modeling.createSpace(e,t,n,r,i)},Xf.prototype.init=function(e,t){var n=Ff(e.dx)>Ff(e.dy)?"x":"y",r=e["d"+n],i=e[n]-r;if(Ff(r)<5)return!1;r<0&&(r*=-1),ws(e)&&(r*=-1);var o=function(e,t){if("x"===e){if(t>0)return"e";if(t<0)return"w"}if("y"===e){if(t>0)return"s";if(t<0)return"n"}return null}(n,r),s=this._canvas.getRootElement();!xs(e)&&e.hover&&(s=e.hover);var a=[...yt(s,!0),...s.attachers||[]],l=this.calculateAdjustments(a,n,r,i),c=function(e,t,n,r,i){var o=e.movingShapes,s=e.resizingShapes;if(!s.length)return;var a,l,c={};return v(s,(function(e){var p,d,h,f,m,g,v=e.attachers,b=e.children,w=yn(e),x=y(b,(function(e){return!(hn(e)||fn(e)||Jf(o,e)||Jf(s,e))})),_=y(b,(function(e){return!hn(e)&&!fn(e)&&Jf(o,e)})),k=[],E=[];x.length&&(d=Yf(yn(vt(x))),p=r-w[Wf[n]]+d[Wf[n]],"n"===n?c.bottom=l=u(l)?Math.min(l,p):p:"w"===n?c.right=l=u(l)?Math.min(l,p):p:"s"===n?c.top=a=u(a)?Math.max(a,p):p:"e"===n&&(c.left=a=u(a)?Math.max(a,p):p)),_.length&&(h=Yf(yn(vt(_))),p=r-h[Wf[Qf[n]]]+w[Wf[Qf[n]]],"n"===n?c.bottom=l=u(l)?Math.min(l,p):p:"w"===n?c.right=l=u(l)?Math.min(l,p):p:"s"===n?c.top=a=u(a)?Math.max(a,p):p:"e"===n&&(c.left=a=u(a)?Math.max(a,p):p)),v&&v.length&&(v.forEach((function(e){Jf(o,e)?k.push(e):E.push(e)})),k.length&&(f=yn(vt(k.map(wn))),m=w[Wf[Qf[n]]]-(f[Wf[Qf[n]]]-r)),E.length&&(g=yn(vt(E.map(wn)))[Wf[n]]-(w[Wf[n]]-r)),"n"===n?(p=Math.min(m||1/0,g||1/0),c.bottom=l=u(l)?Math.min(l,p):p):"w"===n?(p=Math.min(m||1/0,g||1/0),c.right=l=u(l)?Math.min(l,p):p):"s"===n?(p=Math.max(m||-1/0,g||-1/0),c.top=a=u(a)?Math.max(a,p):p):"e"===n&&(p=Math.max(m||-1/0,g||-1/0),c.left=a=u(a)?Math.max(a,p):p));var O=i&&i[e.id];O&&("n"===n?(p=r+e[Hf[t]]-O[Hf[t]],c.bottom=l=u(l)?Math.min(l,p):p):"w"===n?(p=r+e[Hf[t]]-O[Hf[t]],c.right=l=u(l)?Math.min(l,p):p):"s"===n?(p=r-e[Hf[t]]+O[Hf[t]],c.top=a=u(a)?Math.max(a,p):p):"e"===n&&(p=r-e[Hf[t]]+O[Hf[t]],c.left=a=u(a)?Math.max(a,p):p))})),c}(l,n,o,i,this._eventBus.fire("spaceTool.getMinDimensions",{axis:n,direction:o,shapes:l.resizingShapes,start:i}));return I(t,l,{axis:n,direction:o,spaceToolConstraints:c,start:i}),Js("resize-"+("x"===n?"ew":"ns")),!0},Xf.prototype.calculateAdjustments=function(e,t,n,r){var i=this._rules,o=[],s=[],a=[],l=[];function c(e){o.includes(e)||o.push(e);var t=e.label;t&&!o.includes(t)&&o.push(t)}v(e,(function(e){if(e.parent&&!fn(e))if(hn(e))l.push(e);else{var o=e[t],p=o+e[Hf[t]];if(function(e){return!!e.host}(e)&&(n>0&&wn(e)[t]>r||n<0&&wn(e)[t]<r))a.push(e);else{var u;if(!(n>0&&o>r||n<0&&p<r))return o<r&&p>r&&i.allowed("shape.resize",{shape:e})?(u=e,void(s.includes(u)||s.push(u))):void 0;c(e)}}})),v(o,(function(e){var t=e.attachers;t&&v(t,(function(e){c(e)}))}));var p=o.concat(s);return v(a,(function(e){var t=e.host;Jf(p,t)&&c(e)})),p=o.concat(s),v(l,(function(e){var t=e.source,n=e.target,r=e.label;Jf(p,t)&&Jf(p,n)&&r&&c(r)})),{movingShapes:o,resizingShapes:s}},Xf.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Xf.prototype.isActive=function(){var e=this._dragging.context();return!!e&&/^spaceTool/.test(e.prefix)};var em="djs-dragging",tm="djs-resizing",nm=Math.max;function rm(e,t,n,r,i){function o(e,t){v(e,(function(e){i.addDragger(e,t),n.addMarker(e,em)}))}e.on("spaceTool.selection.start",(function(e){var t=n.getLayer("space"),i=e.context,o="M 0,-10000 L 0,10000",s="M -10000,0 L 10000,0",a=Re("g");Oe(a,r.cls("djs-crosshair-group",["no-events"])),xe(t,a);var l=Re("path");Oe(l,"d",o),Se(l).add("djs-crosshair"),xe(a,l);var c=Re("path");Oe(c,"d",s),Se(c).add("djs-crosshair"),xe(a,c),i.crosshairGroup=a})),e.on("spaceTool.selection.move",(function(e){Yn(e.context.crosshairGroup,e.x,e.y)})),e.on("spaceTool.selection.cleanup",(function(e){var t=e.context.crosshairGroup;t&&Ue(t)})),e.on("spaceTool.move",250,(function(e){var s=e.context,a=s.line,l=s.axis,c=s.movingShapes,p=s.resizingShapes;if(s.initialized){if(!s.dragGroup){var u=n.getLayer("space");Oe(a=Re("path"),"d","M0,0 L0,0"),Se(a).add("djs-crosshair"),xe(u,a),s.line=a;var d=Re("g");Oe(d,r.cls("djs-drag-group",["no-events"])),xe(n.getActiveLayer(),d),o(c,d),o(s.movingConnections=t.filter((function(e){var t=!1;v(c,(function(n){v(n.outgoing,(function(n){e===n&&(t=!0)}))}));var n=!1;v(c,(function(t){v(t.incoming,(function(t){e===t&&(n=!0)}))}));var r=!1;v(p,(function(t){v(t.outgoing,(function(t){e===t&&(r=!0)}))}));var i=!1;return v(p,(function(t){v(t.incoming,(function(t){e===t&&(i=!0)}))})),hn(e)&&(t||r)&&(n||i)})),d),s.dragGroup=d}if(!s.frameGroup){var h=Re("g");Oe(h,r.cls("djs-frame-group",["no-events"])),xe(n.getActiveLayer(),h);var f=[];v(p,(function(e){var t=i.addFrame(e,h),r=t.getBBox();f.push({element:t,initialBounds:r}),n.addMarker(e,tm)})),s.frameGroup=h,s.frames=f}Oe(a,{d:{x:"M"+e.x+", -10000 L"+e.x+", 10000",y:"M -10000, "+e.y+" L 10000, "+e.y}[l]});var m={x:e.dx,y:e.dy};m[{x:"y",y:"x"}[s.axis]]=0,Yn(s.dragGroup,m.x,m.y),v(s.frames,(function(e){var t,n,r=e.element,i=e.initialBounds;"e"===s.direction?Oe(r,{width:nm(i.width+m.x,5)}):Oe(r,{width:t=nm(i.width-m.x,5),x:i.x+i.width-t}),"s"===s.direction?Oe(r,{height:nm(i.height+m.y,5)}):Oe(r,{height:n=nm(i.height-m.y,5),y:i.y+i.height-n})}))}})),e.on("spaceTool.cleanup",(function(e){var t=e.context,r=t.movingShapes,i=t.movingConnections,o=t.resizingShapes,s=t.line,a=t.dragGroup,l=t.frameGroup;v(r,(function(e){n.removeMarker(e,em)})),v(i,(function(e){n.removeMarker(e,em)})),a&&(Ue(s),Ue(a)),v(o,(function(e){n.removeMarker(e,tm)})),l&&Ue(l)}))}rm.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];var im={__init__:["spaceToolPreview"],__depends__:[Dc,Ic,$f,Wp,bf],spaceTool:["type",Xf],spaceToolPreview:["type",rm]};function om(e){e.invoke(Xf,this)}om.$inject=["injector"],e(om,Xf),om.prototype.calculateAdjustments=function(e,t,n,r){var i=Xf.prototype.calculateAdjustments.call(this,e,t,n,r);return i.resizingShapes=i.resizingShapes.filter((function(e){return!ki(e,"bpmn:TextAnnotation")&&(!function(e){return ki(e,"bpmn:Participant")&&!Oi(e).processRef}(e)||!("y"===t&&Hi(e)||"x"===t&&!Hi(e)))})),i};var sm={__depends__:[im],spaceTool:["type",om]};function am(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)}am.$inject=["eventBus","injector"],am.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()},am.prototype.canExecute=function(e,t){const n={command:e,context:t},r=this._getHandler(e);let i=this._fire(e,"canExecute",n);if(void 0===i){if(!r)return!1;r.canExecute&&(i=r.canExecute(t))}return i},am.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,!1!==e&&this._fire("changed",{trigger:"clear"})},am.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()}},am.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()}},am.prototype.register=function(e,t){this._setHandler(e,t)},am.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)},am.prototype.canUndo=function(){return!!this._getUndoAction()},am.prototype.canRedo=function(){return!!this._getRedoAction()},am.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},am.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},am.prototype._internalUndo=function(e){const t=e.command,n=e.context,r=this._getHandler(t);this._atomicDo((()=>{this._fire(t,"revert",e),r.revert&&this._markDirty(r.revert(n)),this._revertedAction(e),this._fire(t,"reverted",e)}))},am.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);const r=t?[e+"."+t,t]:[e];let i;n=this._eventBus.createEvent(n);for(const e of r)if(i=this._eventBus.fire("commandStack."+e,n),n.cancelBubble)break;return i},am.prototype._createId=function(){return this._uid++},am.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},am.prototype._internalExecute=function(e,t){const n=e.command,r=e.context,i=this._getHandler(n);if(!i)throw new Error("no command handler registered for <"+n+">");this._pushAction(e),t||(this._fire(n,"preExecute",e),i.preExecute&&i.preExecute(r),this._fire(n,"preExecuted",e)),this._atomicDo((()=>{this._fire(n,"execute",e),i.execute&&this._markDirty(i.execute(r)),this._executedAction(e,t),this._fire(n,"executed",e)})),t||(this._fire(n,"postExecute",e),i.postExecute&&i.postExecute(r),this._fire(n,"postExecuted",e)),this._popAction()},am.prototype._pushAction=function(e){const t=this._currentExecution,n=t.actions,r=n[0];if(t.atomic)throw new Error("illegal invocation in <execute> or <revert> phase (action: "+e.command+")");e.id||(e.id=r&&r.id||this._createId()),n.push(e)},am.prototype._popAction=function(){const e=this._currentExecution,t=e.trigger,n=e.actions,r=e.dirty;n.pop(),n.length||(this._eventBus.fire("elements.changed",{elements:S("id",r.reverse())}),r.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},am.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=c(e)?e:[e],t.dirty=t.dirty.concat(e))},am.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},am.prototype._revertedAction=function(e){this._stackIdx--},am.prototype._getHandler=function(e){return this._handlerMap[e]},am.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 lm={commandStack:["type",am]};function cm(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 pm(e,t,n){Ho.call(this,t);var r=e.get("movePreview",!1);t.on("shape.move.start",1400,(function(e){var t=e.context,n=t.shapes,r=t.validatedShapes;t.shapes=um(n),t.validatedShapes=um(r)})),r&&t.on("shape.move.start",250,(function(e){var t=e.context,n=t.shapes,i=[];v(n,(function(e){v(e.labels,(function(n){n.hidden||-1!==t.shapes.indexOf(n)||i.push(n),e.labelTarget&&i.push(e)}))})),v(i,(function(e){r.makeDraggable(t,e,!0)}))})),this.preExecuted("elements.move",1400,(function(e){var t=e.context.closure,n=t.enclosedElements,r=[];v(n,(function(e){v(e.labels,(function(e){n[e.id]||r.push(e)}))})),t.addAll(r)})),this.preExecute(["connection.delete","shape.delete"],(function(e){var t=e.context;cm((t.connection||t.shape).labels,(function(e){n.removeShape(e,{nested:!0})}))})),this.execute("shape.delete",(function(e){var t=e.context,n=t.shape,r=n.labelTarget;r&&(t.labelTargetIndex=Pt(r.labels,n),t.labelTarget=r,n.labelTarget=null)})),this.revert("shape.delete",(function(e){var t=e.context,n=t.shape,r=t.labelTarget,i=t.labelTargetIndex;r&&(Ot(r.labels,n,i),n.labelTarget=r)}))}function um(e){return y(e,(function(t){return-1===e.indexOf(t.labelTarget)}))}e(pm,Ho),pm.$inject=["injector","eventBus","modeling"];var dm={__init__:["labelSupport"],labelSupport:["type",pm]},hm="attach-ok";function fm(e,t,n,r,i){Ho.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",1401,(function(e){var t,n,r=e.context,i=r.shapes,o=r.validatedShapes;r.shapes=(n=mm(t=i),C("id",t,n)),r.validatedShapes=function(e){var t=P(e,"id");return y(e,(function(e){for(;e;){if(e.host&&t[e.host.id])return!1;e=e.parent}return!0}))}(o)})),o&&t.on("shape.move.start",251,(function(e){var t=e.context;v(mm(t.shapes),(function(e){o.makeDraggable(t,e,!0),v(e.labels,(function(e){o.makeDraggable(t,e,!0)}))}))})),o&&t.on("shape.move.start",(function(e){var r=e.context.shapes;if(1===r.length){var i=r[0].host;i&&(n.addMarker(i,hm),t.once(["shape.move.out","shape.move.cleanup"],(function(){n.removeMarker(i,hm)})))}})),this.preExecuted("elements.move",1401,(function(e){var t=e.context,n=t.closure;v(mm(t.shapes),(function(e){n.add(e,n.topLevel[e.host.id])}))})),this.postExecuted("elements.move",(function(e){var t=e.context,n=t.shapes,r=t.newHost;r&&1!==n.length||v(r?n:y(n,(function(e){var t,r=e.host;return function(e){return!!e.host}(e)&&(t=r,!(-1!==n.indexOf(t)))})),(function(e){i.updateAttachment(e,r)}))})),this.postExecuted("elements.move",(function(e){v(e.context.shapes,(function(e){v(e.attachers,(function(e){v(e.outgoing.slice(),(function(e){r.allowed("connection.reconnect",{connection:e,source:e.source,target:e.target})||i.removeConnection(e)})),v(e.incoming.slice(),(function(e){r.allowed("connection.reconnect",{connection:e,source:e.source,target:e.target})||i.removeConnection(e)}))}))}))})),this.postExecute("shape.create",(function(e){var t=e.context,n=t.shape,r=t.host;r&&i.updateAttachment(n,r)})),this.postExecute("shape.replace",(function(e){var t=e.context,n=t.oldShape,o=t.newShape;cm(n.attachers,(function(e){"attach"===r.allowed("elements.move",{target:o,shapes:[e]})?i.updateAttachment(e,o):i.removeShape(e)})),o.attachers.length&&v(o.attachers,(function(e){var t=ud(e,n,o);i.moveShape(e,t,e.parent)}))})),this.postExecute("shape.resize",(function(e){var t=e.context,n=t.shape,r=t.oldBounds,o=t.newBounds,s=n.attachers;!1!==(t.hints||{}).attachSupport&&v(s,(function(e){var t=ud(e,r,o);i.moveShape(e,t,e.parent),v(e.labels,(function(e){i.moveShape(e,t,e.parent)}))}))})),this.preExecute("shape.delete",(function(e){var t=e.context.shape;cm(t.attachers,(function(e){i.removeShape(e)})),t.host&&i.updateAttachment(t,null)}))}function mm(e){return r(k(e,(function(e){return e.attachers||[]})))}e(fm,Ho),fm.$inject=["injector","eventBus","canvas","rules","modeling"];var gm={__depends__:[Ic],__init__:["attachSupport"],attachSupport:["type",fm]};function ym(e){this._model=e}function vm(e,t,n){Ho.call(this,e),this._bpmnFactory=t;var r=this;function i(e){v(e.context.oldRoot.children,(function(e){ki(e,"bpmn:BaseElement")&&r.updateParent(e)}))}function o(e){var t=e.context.shape;ki(t,"bpmn:BaseElement")&&r.updateBounds(t)}function s(e){r.updateConnection(e.context)}function a(e){r.updateConnectionWaypoints(e.context.connection)}function l(e){r.updateAttachment(e.context)}function c(e){const{element:n}=e.context,r=to(n),i=Pi(n),o=i&&i.get("label");Xi(n)||ts(n)||(r&&!o?i.set("label",t.create("bpmndi:BPMNLabel")):!r&&o&&i.set("label",void 0))}this.executed(["connection.layout","connection.create"],(function(e){var t,r=e.context,i=r.hints||{};r.cropped||!1===i.createElementsBehavior||((t=r.connection).waypoints=n.getCroppedWaypoints(t),r.cropped=!0)})),this.reverted(["connection.layout"],(function(e){delete e.context.cropped})),this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],bm((function(e){var t=e.context;r.updateParent(t.shape||t.connection,t.oldParent)}))),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],bm((function(e){var t=e.context,n=t.shape||t.connection,i=t.parent||t.newParent;r.updateParent(n,i)}))),this.executed(["canvas.updateRoot"],i),this.reverted(["canvas.updateRoot"],i),this.executed(["shape.move","shape.create","shape.resize"],bm((function(e){"label"!==e.context.shape.type&&o(e)}))),this.reverted(["shape.move","shape.create","shape.resize"],bm((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"],bm(s)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],bm(s)),this.executed(["connection.layout","connection.move","connection.updateWaypoints"],bm(a)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],bm(a)),this.executed("connection.reconnect",bm((function(e){var t=e.context,n=t.connection,r=t.oldSource,i=t.newSource,o=Oi(n),s=Oi(r),a=Oi(i);o.conditionExpression&&!Ei(a,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(t.oldConditionExpression=o.conditionExpression,delete o.conditionExpression),r!==i&&s.default===o&&(t.oldDefault=s.default,delete s.default)}))),this.reverted("connection.reconnect",bm((function(e){var t=e.context,n=t.connection,r=t.oldSource,i=t.newSource,o=Oi(n),s=Oi(r),a=Oi(i);t.oldConditionExpression&&(o.conditionExpression=t.oldConditionExpression),t.oldDefault&&(s.default=t.oldDefault,delete a.default)}))),this.executed(["element.updateAttachment"],bm(l)),this.reverted(["element.updateAttachment"],bm(l)),this.executed("element.updateLabel",bm(c)),this.reverted("element.updateLabel",bm(c))}function bm(e){return function(t){var n=t.context;ki(n.shape||n.connection||n.element,"bpmn:BaseElement")&&e(t)}}function wm(e,t){Hn.call(this),this._bpmnFactory=e,this._moddle=t}function xm(e,t,n){return void 0===t[n]?t:(e[n]=t[n],q(t,[n]))}function _m(e,t){this._modeling=e,this._canvas=t}function km(e){this._modeling=e}function Em(e,t){this._canvas=e,this._layouter=t}ym.$inject=["moddle"],ym.prototype._needsId=function(e){return Ei(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"])},ym.prototype._ensureId=function(e){var t;e.id?this._model.ids.claim(e.id,e):(t=ki(e,"bpmn:Activity")?"Activity":ki(e,"bpmn:Event")?"Event":ki(e,"bpmn:Gateway")?"Gateway":Ei(e,["bpmn:SequenceFlow","bpmn:MessageFlow"])?"Flow":(e.$type||"").replace(/^[^:]*:/g,""),t+="_",!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e)))},ym.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},ym.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},ym.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",I({bpmnElement:e,bounds:this.createDiBounds()},t))},ym.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},ym.prototype.createDiWaypoints=function(e){var t=this;return k(e,(function(e){return t.createDiWaypoint(e)}))},ym.prototype.createDiWaypoint=function(e){return this.create("dc:Point",$(e,["x","y"]))},ym.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",I({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},ym.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",I({bpmnElement:e},t))},e(vm,Ho),vm.$inject=["eventBus","bpmnFactory","connectionDocking"],vm.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,r=t.host;n.attachedToRef=r&&r.businessObject},vm.prototype.updateParent=function(e,t){if(!(fn(e)||ki(e,"bpmn:DataStoreReference")&&e.parent&&ki(e.parent,"bpmn:Collaboration"))){var n=e.parent,r=e.businessObject,i=Pi(e),o=n&&n.businessObject,s=Pi(n);ki(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(r,o,t&&t.businessObject),ki(e,"bpmn:DataOutputAssociation")&&(o=e.source?e.source.businessObject:null),ki(e,"bpmn:DataInputAssociation")&&(o=e.target?e.target.businessObject:null),this.updateSemanticParent(r,o),ki(e,"bpmn:DataObjectReference")&&r.dataObjectRef&&this.updateSemanticParent(r.dataObjectRef,o),this.updateDiParent(i,s)}},vm.prototype.updateBounds=function(e){var t=Pi(e),n=function(e){if(!ki(e,"bpmn:Activity"))return;var t=Pi(e);if(!t)return;var n=t.get("label");if(!n)return;return n.get("bounds")}(e);if(n){var r=ia(n,t.get("bounds"));I(n,{x:e.x+r.x,y:e.y+r.y})}var i=fn(e)?this._getLabel(t):t,o=i.bounds;o||(o=this._bpmnFactory.createDiBounds(),i.set("bounds",o)),I(o,{x:e.x,y:e.y,width:e.width,height:e.height})},vm.prototype.updateFlowNodeRefs=function(e,t,n){n!==t&&(ki(n,"bpmn:Lane")&&Et(n.get("flowNodeRef"),e),ki(t,"bpmn:Lane")&&Ot(t.get("flowNodeRef"),e))},vm.prototype.updateDiConnection=function(e,t,n){var r=Pi(e),i=Pi(t),o=Pi(n);r.sourceElement&&r.sourceElement.bpmnElement!==Oi(t)&&(r.sourceElement=t&&i),r.targetElement&&r.targetElement.bpmnElement!==Oi(n)&&(r.targetElement=n&&o)},vm.prototype.updateDiParent=function(e,t){if(t&&!ki(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(Et(n,e),e.$parent=null)}},vm.prototype.getLaneSet=function(e){var t,n;return ki(e,"bpmn:Lane")?((t=e.childLaneSet)||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(ki(e,"bpmn:Participant")&&(e=e.processRef),(t=(n=e.get("laneSets"))[0])||((t=this._bpmnFactory.create("bpmn:LaneSet")).$parent=e,n.push(t)),t)},vm.prototype.updateSemanticParent=function(e,t,n){var r;if(e.$parent!==t&&(!ki(e,"bpmn:DataInput")&&!ki(e,"bpmn:DataOutput")||(ki(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),!("ioSpecification"in t)||t.ioSpecification!==e.$parent))){if(ki(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),r="lanes";else if(ki(e,"bpmn:FlowElement")){if(t)if(ki(t,"bpmn:Participant"))t=t.processRef;else if(ki(t,"bpmn:Lane"))do{t=t.$parent.$parent}while(ki(t,"bpmn:Lane"));r="flowElements"}else if(ki(e,"bpmn:Artifact")){for(;t&&!ki(t,"bpmn:Process")&&!ki(t,"bpmn:SubProcess")&&!ki(t,"bpmn:Collaboration");){if(ki(t,"bpmn:Participant")){t=t.processRef;break}t=t.$parent}r="artifacts"}else if(ki(e,"bpmn:MessageFlow"))r="messageFlows";else if(ki(e,"bpmn:Participant")){r="participants";var i,o=e.processRef;o&&(i=function(e){for(;e&&!ki(e,"bpmn:Definitions");)e=e.$parent;return e}(e.$parent||t),e.$parent&&(Et(i.get("rootElements"),o),o.$parent=null),t&&(Ot(i.get("rootElements"),o),o.$parent=i))}else ki(e,"bpmn:DataOutputAssociation")?r="dataOutputAssociations":ki(e,"bpmn:DataInputAssociation")&&(r="dataInputAssociations");if(!r)throw new Error(`no parent for <${e.id}> in <${t.id}>`);var s;if(e.$parent&&Et(s=e.$parent.get(r),e),t?((s=t.get(r)).push(e),e.$parent=t):e.$parent=null,n){var a=n.get(r);Et(s,e),t&&(a||(a=[],t.set(r,a)),a.push(e))}}},vm.prototype.updateConnectionWaypoints=function(e){Pi(e).set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},vm.prototype.updateConnection=function(e){var t,n=e.connection,r=Oi(n),i=n.source,o=Oi(i),s=n.target,a=Oi(n.target);if(ki(r,"bpmn:DataAssociation"))ki(r,"bpmn:DataInputAssociation")?(r.get("sourceRef")[0]=o,t=e.parent||e.newParent||a,this.updateSemanticParent(r,a,t)):ki(r,"bpmn:DataOutputAssociation")&&(t=e.parent||e.newParent||o,this.updateSemanticParent(r,o,t),r.targetRef=a);else{var l=ki(r,"bpmn:SequenceFlow");r.sourceRef!==o&&(l&&(Et(r.sourceRef&&r.sourceRef.get("outgoing"),r),o&&o.get("outgoing")&&o.get("outgoing").push(r)),r.sourceRef=o),r.targetRef!==a&&(l&&(Et(r.targetRef&&r.targetRef.get("incoming"),r),a&&a.get("incoming")&&a.get("incoming").push(r)),r.targetRef=a)}this.updateConnectionWaypoints(n),this.updateDiConnection(n,i,s)},vm.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label},e(wm,Hn),wm.$inject=["bpmnFactory","moddle"],wm.prototype._baseCreate=Hn.prototype.create,wm.prototype.create=function(e,t){if("label"===e){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,I({type:"label",di:n},Qi,t))}return this.createElement(e,t)},wm.prototype.createElement=function(e,t){var n,r,i,o=(t=I({},t||{})).businessObject,s=t.di;if(!o){if(!t.type)throw new Error("no shape type specified");wi(o=this._bpmnFactory.create(t.type))}if(!Ei(s,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])){var l=I({},s||{},{id:o.id+"_di"});s="root"===e?this._bpmnFactory.createDiPlane(o,l):"connection"===e?this._bpmnFactory.createDiEdge(o,l):this._bpmnFactory.createDiShape(o,l)}return ki(o,"bpmn:Group")&&(t=I({isFrame:!0},t)),t=function(e,t,n){return v(n,(function(n){t=xm(e,t,n)})),t}(o,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=xm(s,t,"isExpanded")),Ei(o,["bpmn:Lane","bpmn:Participant"])&&(t=xm(s,t,"isHorizontal")),ki(o,"bpmn:SubProcess")&&(t.collapsed=!Vi(o,s)),ki(o,"bpmn:ExclusiveGateway")&&(f(s,"isMarkerVisible")?void 0===s.isMarkerVisible&&(s.isMarkerVisible=!1):s.isMarkerVisible=!0),a(t.triggeredByEvent)&&(o.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),a(t.cancelActivity)&&(o.cancelActivity=t.cancelActivity,delete t.cancelActivity),t.eventDefinitionType&&(r=o.get("eventDefinitions")||[],i=this._bpmnFactory.create(t.eventDefinitionType,t.eventDefinitionAttrs),"bpmn:ConditionalEventDefinition"===t.eventDefinitionType&&(i.condition=this._bpmnFactory.create("bpmn:FormalExpression")),r.push(i),i.$parent=o,o.eventDefinitions=r,delete t.eventDefinitionType),n=this.getDefaultSize(o,s),t=I({id:o.id},n,t,{businessObject:o,di:s}),this._baseCreate(e,t)},wm.prototype.getDefaultSize=function(e,t){var n=Oi(e);if(t=t||Pi(e),ki(n,"bpmn:SubProcess"))return Vi(n,t)?{width:350,height:200}:{width:100,height:80};if(ki(n,"bpmn:Task"))return{width:100,height:80};if(ki(n,"bpmn:Gateway"))return{width:50,height:50};if(ki(n,"bpmn:Event"))return{width:36,height:36};if(ki(n,"bpmn:Participant")){var r=void 0===t.isHorizontal||!0===t.isHorizontal;return Vi(n,t)?r?{width:600,height:250}:{width:250,height:600}:r?{width:400,height:60}:{width:60,height:400}}return ki(n,"bpmn:Lane")?{width:400,height:100}:ki(n,"bpmn:DataObjectReference")?{width:36,height:50}:ki(n,"bpmn:DataStoreReference")?{width:50,height:50}:ki(n,"bpmn:TextAnnotation")?{width:100,height:30}:ki(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},wm.prototype.createParticipantShape=function(e){return p(e)||(e={isExpanded:e}),!1!==(e=I({type:"bpmn:Participant"},e||{})).isExpanded&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)},_m.$inject=["modeling","canvas"],_m.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,r=e.alignment;v(n,(function(e){var n={x:0,y:0};a(r.left)?n.x=r.left-e.x:a(r.right)?n.x=r.right-e.width-e.x:a(r.center)?n.x=r.center-Math.round(e.width/2)-e.x:a(r.top)?n.y=r.top-e.y:a(r.bottom)?n.y=r.bottom-e.height-e.y:a(r.middle)&&(n.y=r.middle-Math.round(e.height/2)-e.y),t.moveElements([e],n,e.parent)}))},_m.prototype.postExecute=function(e){},km.$inject=["modeling"],km.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var n=e.target||t.parent,r=e.shape,i=e.hints||{};r=e.shape=this._modeling.createShape(r,e.position,n,{attach:i.attach}),e.shape=r},km.prototype.postExecute=function(e){var t,n,r=e.hints||{};t=e.source,n=e.shape,_(t.outgoing,(function(e){return e.target===n}))||(r.connectionTarget===e.source?this._modeling.connect(e.shape,e.source,e.connection):this._modeling.connect(e.source,e.shape,e.connection))},Em.$inject=["canvas","layouter"],Em.prototype.execute=function(e){var t=e.connection,n=e.source,r=e.target,i=e.parent,o=e.parentIndex,s=e.hints;if(!n||!r)throw new Error("source and target required");if(!i)throw new Error("parent required");return t.source=n,t.target=r,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,s)),this._canvas.addConnection(t,i,o),t},Em.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var Om=Math.round;function Pm(e){this._modeling=e}Pm.$inject=["modeling"],Pm.prototype.preExecute=function(e){var t=e.elements,n=e.parent,r=e.parentIndex,i=e.position,o=e.hints,s=this._modeling;v(t,(function(e){u(e.x)||(e.x=0),u(e.y)||(e.y=0)}));var a=vt(y(t,(function(e){return!e.hidden})));v(t,(function(e){hn(e)&&(e.waypoints=k(e.waypoints,(function(e){return{x:Om(e.x-a.x-a.width/2+i.x),y:Om(e.y-a.y-a.height/2+i.y)}}))),I(e,{x:Om(e.x-a.x-a.width/2+i.x),y:Om(e.y-a.y-a.height/2+i.y)})}));var l=ht(t),c={};v(t,(function(e){if(hn(e))c[e.id]=u(r)?s.createConnection(c[e.source.id],c[e.target.id],r,e,e.parent||n,o):s.createConnection(c[e.source.id],c[e.target.id],e,e.parent||n,o);else{var t=I({},o);-1===l.indexOf(e)&&(t.autoResize=!1),fn(e)&&(t=q(t,["attach"])),c[e.id]=u(r)?s.createShape(e,$(e,["x","y","width","height"]),e.parent||n,r,t):s.createShape(e,$(e,["x","y","width","height"]),e.parent||n,t)}})),e.elements=O(c)};var Sm=Math.round;function Cm(e){this._canvas=e}function Tm(e){Cm.call(this,e)}Cm.$inject=["canvas"],Cm.prototype.execute=function(e){var t=e.shape,n=e.position,r=e.parent,i=e.parentIndex;if(!r)throw new Error("parent required");if(!n)throw new Error("position required");return void 0!==n.width?I(t,n):I(t,{x:n.x-Sm(t.width/2),y:n.y-Sm(t.height/2)}),this._canvas.addShape(t,r,i),t},Cm.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t},e(Tm,Cm),Tm.$inject=["canvas"];var Mm=Cm.prototype.execute;Tm.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,Mm.call(this,e)};var Am=Cm.prototype.revert;function Dm(e,t){this._canvas=e,this._modeling=t}function Nm(e,t){this._modeling=e,this._elementRegistry=t}function Rm(e,t){this._canvas=e,this._modeling=t}function jm(e){this._modeling=e}Tm.prototype.revert=function(e){return e.shape.labelTarget=null,Am.call(this,e)},Dm.$inject=["canvas","modeling"],Dm.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;cm(n.incoming,(function(e){t.removeConnection(e,{nested:!0})})),cm(n.outgoing,(function(e){t.removeConnection(e,{nested:!0})}))},Dm.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=Pt(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},Dm.prototype.revert=function(e){var t=e.connection,n=e.parent,r=e.parentIndex;return t.source=e.source,t.target=e.target,Ot(n.children,t,r),this._canvas.addConnection(t,n),t},Nm.$inject=["modeling","elementRegistry"],Nm.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry;v(e.elements,(function(e){n.get(e.id)&&(e.waypoints?t.removeConnection(e):t.removeShape(e))}))},Rm.$inject=["canvas","modeling"],Rm.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;cm(n.incoming,(function(e){t.removeConnection(e,{nested:!0})})),cm(n.outgoing,(function(e){t.removeConnection(e,{nested:!0})})),cm(n.children,(function(e){hn(e)?t.removeConnection(e,{nested:!0}):t.removeShape(e,{nested:!0})}))},Rm.prototype.execute=function(e){var t=this._canvas,n=e.shape,r=n.parent;return e.oldParent=r,e.oldParentIndex=Pt(r.children,n),t.removeShape(n),n},Rm.prototype.revert=function(e){var t=this._canvas,n=e.shape,r=e.oldParent,i=e.oldParentIndex;return Ot(r.children,n,i),t.addShape(n,r),n},jm.$inject=["modeling"];var Lm={x:"y",y:"x"};function Im(e,t){this._layouter=e,this._canvas=t}function zm(){}function Bm(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}function $m(e){this._modeling=e}function qm(e){this._helper=new $m(e)}function Fm(e){this._modeling=e,this._helper=new $m(e)}function Vm(e){this._modeling=e}function Hm(e){return e.original||e}function Um(e,t){this._modeling=e,this._rules=t}function Wm(e){this._modeling=e}function Gm(e){this._modeling=e}function Qm(e){return I({},e)}function Zm(e){switch(e){case"n":case"s":return"y";case"w":case"e":return"x"}}function Xm(e,t,n){var r=Zm(n);return/e|s/.test(n)?e[r]>t:/n|w/.test(n)?e[r]<t:void 0}function Ym(e,t){return-1!==e.indexOf(t)}function Km(e){this._modeling=e}function Jm(e){var t={};return v(e,(function(e){t[e.id]=e.hidden,e.children&&(t=I({},t,Jm(e.children)))})),t}function eg(e,t){var n=[];return v(e,(function(e){e.hidden=t,n=n.concat(e),e.children&&(n=n.concat(eg(e.children,e.collapsed||t)))})),n}function tg(e,t){var n=[];return v(e,(function(e){e.hidden=t[e.id],n=n.concat(e),e.children&&(n=n.concat(tg(e.children,t)))})),n}function ng(e){this._modeling=e}function rg(e,t){return Et(e&&e.attachers,t)}function ig(e,t,n){if(e){var r=e.attachers;r||(e.attachers=r=[]),Ot(r,t,n)}}function og(){}function sg(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var r=this;e.on("diagram.init",(function(){r.registerHandlers(n)}))}function ag(e){this._elementRegistry=e}function lg(e,t){v(t,(function(t,n){e.set(n,t)}))}jm.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,r=e.axis,i=e.dimension;function o(e,t){e.range.min=Math.min(t[r],e.range.min),e.range.max=Math.max(t[r]+t[i],e.range.max)}function s(e){return e[r]+e[i]/2}function a(e){return e.length-1}function l(e){return e.max-e.min}var c,p,u=n[0],d=a(n),h=n[d],f=0;v(n,(function(e,c){var p,u,h;e.elements.length<2?c&&c!==n.length-1&&(o(e,e.elements[0]),f+=l(e.range)):(u=(p=T(e.elements,r))[0],c===d&&(u=p[a(p)]),h=s(u),e.range=null,v(p,(function(n){!function(e,n){var i={y:0};i[r]=e-s(n),i[r]&&(i[Lm[r]]=0,t.moveElements([n],i,n.parent))}(h,n),null!==e.range?o(e,n):e.range={min:n[r],max:n[r]+n[i]}})),c&&c!==n.length-1&&(f+=l(e.range)))})),p=Math.abs(h.range.min-u.range.max),(c=Math.round((p-f)/(n.length-1)))<n.length-1||v(n,(function(e,o){var s,a={};e!==u&&e!==h&&(s=n[o-1],e.range.max=0,v(e.elements,(function(n,o){a[Lm[r]]=0,a[r]=s.range.max-n[r]+c,e.range.min!==n[r]&&(a[r]+=n[r]-e.range.min),a[r]&&t.moveElements([n],a,n.parent),e.range.max=Math.max(n[r]+n[i],o?e.range.max:0)})))}))},jm.prototype.postExecute=function(e){},Im.$inject=["layouter","canvas"],Im.prototype.execute=function(e){var t=e.connection;return I(e,{oldWaypoints:t.waypoints}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},Im.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t},zm.prototype.execute=function(e){var t=e.connection,n=e.delta,r=e.newParent||t.parent,i=e.newParentIndex,o=t.parent;return e.oldParent=o,e.oldParentIndex=Et(o.children,t),Ot(r.children,t,i),t.parent=r,v(t.waypoints,(function(e){e.x+=n.x,e.y+=n.y,e.original&&(e.original.x+=n.x,e.original.y+=n.y)})),t},zm.prototype.revert=function(e){var t=e.connection,n=t.parent,r=e.oldParent,i=e.oldParentIndex,o=e.delta;return Et(n.children,t),Ot(r.children,t,i),t.parent=r,v(t.waypoints,(function(e){e.x-=o.x,e.y-=o.y,e.original&&(e.original.x-=o.x,e.original.y-=o.y)})),t},Bm.prototype.add=function(e,t){return this.addAll([e],t)},Bm.prototype.addAll=function(e,t){var n=function(e,t,n){s(t)&&(t=!0),p(t)&&(n=t,t=!0);var r=xt((n=n||{}).allShapes),i=xt(n.allConnections),o=xt(n.enclosedElements),a=xt(n.enclosedConnections),l=xt(n.topLevel,t&&P(e,(function(e){return e.id})));function c(e){l[e.source.id]&&l[e.target.id]&&(l[e.id]=[e]),r[e.source.id]&&r[e.target.id]&&(a[e.id]=o[e.id]=e),i[e.id]=e}return gt(e,(function(e){if(o[e.id]=e,!e.waypoints)return r[e.id]=e,v(e.incoming,c),v(e.outgoing,c),e.children;a[e.id]=i[e.id]=e})),{allShapes:r,allConnections:i,topLevel:l,enclosedConnections:a,enclosedElements:o}}(e,!!t,this);return I(this,n),this},$m.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},$m.prototype.moveClosure=function(e,t,n,r,i){var o=this._modeling,s=e.allShapes,a=e.allConnections,l=e.enclosedConnections,c=e.topLevel,p=!1;i&&i.parent===n&&(p=!0),v(s,(function(e){o.moveShape(e,t,c[e.id]&&!p&&n,{recurse:!1,layout:!1})})),v(a,(function(e){var r=!!s[e.source.id],i=!!s[e.target.id];l[e.id]&&r&&i?o.moveConnection(e,t,c[e.id]&&!p&&n):o.layoutConnection(e,{connectionStart:r&&bd(e,e.source,t),connectionEnd:i&&wd(e,e.target,t)})}))},$m.prototype.getClosure=function(e){return(new Bm).addAll(e,!0)},qm.$inject=["modeling"],qm.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},qm.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)},Fm.$inject=["modeling"],Fm.prototype.execute=function(e){var t=e.shape,n=e.delta,r=e.newParent||t.parent,i=e.newParentIndex,o=t.parent;return e.oldBounds=$(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=Et(o.children,t),Ot(r.children,t,i),I(t,{parent:r,x:t.x+n.x,y:t.y+n.y}),t},Fm.prototype.postExecute=function(e){var t=e.shape,n=e.delta,r=e.hints,i=this._modeling;!1!==r.layout&&(v(t.incoming,(function(e){i.layoutConnection(e,{connectionEnd:wd(e,t,n)})})),v(t.outgoing,(function(e){i.layoutConnection(e,{connectionStart:bd(e,t,n)})}))),!1!==r.recurse&&this.moveChildren(e)},Fm.prototype.revert=function(e){var t=e.shape,n=e.oldParent,r=e.oldParentIndex,i=e.delta;return Ot(n.children,t,r),I(t,{parent:n,x:t.x-i.x,y:t.y-i.y}),t},Fm.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},Fm.prototype.getNewParent=function(e){return e.newParent||e.shape.parent},Vm.$inject=["modeling"],Vm.prototype.execute=function(e){var t=e.newSource,n=e.newTarget,r=e.connection,i=e.dockingOrPoints;if(!t&&!n)throw new Error("newSource or newTarget required");return c(i)&&(e.oldWaypoints=r.waypoints,r.waypoints=i),t&&(e.oldSource=r.source,r.source=t),n&&(e.oldTarget=r.target,r.target=n),r},Vm.prototype.postExecute=function(e){var t=e.connection,n=e.newSource,r=e.newTarget,i=e.dockingOrPoints,o=e.hints||{},s={};o.connectionStart&&(s.connectionStart=o.connectionStart),o.connectionEnd&&(s.connectionEnd=o.connectionEnd),!1!==o.layoutConnection&&(!n||r&&"source"!==o.docking||(s.connectionStart=s.connectionStart||Hm(c(i)?i[0]:i)),!r||n&&"target"!==o.docking||(s.connectionEnd=s.connectionEnd||Hm(c(i)?i[i.length-1]:i)),o.newWaypoints&&(s.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,s))},Vm.prototype.revert=function(e){var t=e.oldSource,n=e.oldTarget,r=e.oldWaypoints,i=e.connection;return t&&(i.source=t),n&&(i.target=n),r&&(i.waypoints=r),i},Um.$inject=["modeling","rules"],Um.prototype.preExecute=function(e){var t,n=this,r=this._modeling,i=this._rules,o=e.oldShape,s=e.newData,a=e.hints||{};function l(e,t,n){return i.allowed("connection.reconnect",{connection:n,source:e,target:t})}var c,p={x:s.x,y:s.y},u={x:o.x,y:o.y,width:o.width,height:o.height};t=e.newShape=e.newShape||n.createShape(s,p,o.parent,a),o.host&&r.updateAttachment(t,o.host),!1!==a.moveChildren&&(c=o.children.slice(),r.moveElements(c,{x:0,y:0},t,a));var d=o.incoming.slice(),h=o.outgoing.slice();v(d,(function(e){l(e.source,t,e)&&n.reconnectEnd(e,t,vd(e,t,u),a)})),v(h,(function(e){var r=e.target;l(t,r,e)&&n.reconnectStart(e,t,yd(e,t,u),a)}))},Um.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},Um.prototype.execute=function(e){},Um.prototype.revert=function(e){},Um.prototype.createShape=function(e,t,n,r){return this._modeling.createShape(e,t,n,r)},Um.prototype.reconnectStart=function(e,t,n,r){this._modeling.reconnectStart(e,t,n,r)},Um.prototype.reconnectEnd=function(e,t,n,r){this._modeling.reconnectEnd(e,t,n,r)},Wm.$inject=["modeling"],Wm.prototype.execute=function(e){var t=e.shape,n=e.newBounds,r=e.minBounds;if(void 0===n.x||void 0===n.y||void 0===n.width||void 0===n.height)throw new Error("newBounds must have {x, y, width, height} properties");if(r&&(n.width<r.width||n.height<r.height))throw new Error("width and height cannot be less than minimum height and width");if(!r&&n.width<10||n.height<10)throw new Error("width and height cannot be less than 10px");return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},I(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Wm.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,r=e.oldBounds;!1!==(e.hints||{}).layout&&(v(n.incoming,(function(e){t.layoutConnection(e,{connectionEnd:vd(e,n,r)})})),v(n.outgoing,(function(e){t.layoutConnection(e,{connectionStart:yd(e,n,r)})})))},Wm.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return I(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Gm.$inject=["modeling"],Gm.prototype.preExecute=function(e){var t=e.delta,n=e.direction,r=e.movingShapes,i=e.resizingShapes,o=e.start,s={};this.moveShapes(r,t),v(i,(function(e){s[e.id]=function(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}(e)})),this.resizeShapes(i,t,n),this.updateConnectionWaypoints(function(e,t){var n=[];return v(e.concat(t),(function(r){var i=r.incoming,o=r.outgoing;v(i.concat(o),(function(r){var i=r.source,o=r.target;(qf(e,i)||qf(e,o)||qf(t,i)||qf(t,o))&&(qf(n,r)||n.push(r))}))})),n}(r,i),t,n,o,r,i,s)},Gm.prototype.execute=function(){},Gm.prototype.revert=function(){},Gm.prototype.moveShapes=function(e,t){var n=this;v(e,(function(e){n._modeling.moveShape(e,t,null,{autoResize:!1,layout:!1,recurse:!1})}))},Gm.prototype.resizeShapes=function(e,t,n){var r=this;v(e,(function(e){var i=function(e,t,n){var r=e.x,i=e.y,o=e.width,s=e.height,a=n.x,l=n.y;switch(t){case"n":return{x:r,y:i+l,width:o,height:s-l};case"s":return{x:r,y:i,width:o,height:s+l};case"w":return{x:r+a,y:i,width:o-a,height:s};case"e":return{x:r,y:i,width:o+a,height:s};default:throw new Error("unknown direction: "+t)}}(e,n,t);r._modeling.resizeShape(e,i,null,{attachSupport:!1,autoResize:!1,layout:!1})}))},Gm.prototype.updateConnectionWaypoints=function(e,t,n,r,i,o,s){var a=this,l=i.concat(o);v(e,(function(e){var c=e.source,p=e.target,u=function(e){return k(e.waypoints,(function(e){return(e=Qm(e)).original&&(e.original=Qm(e.original)),e}))}(e),d=Zm(n),h={};Ym(l,c)&&Ym(l,p)?(u=k(u,(function(e){return Xm(e,r,n)&&(e[d]=e[d]+t[d]),e.original&&Xm(e.original,r,n)&&(e.original[d]=e.original[d]+t[d]),e})),a._modeling.updateWaypoints(e,u,{labelBehavior:!1})):(Ym(l,c)||Ym(l,p))&&(Ym(i,c)?h.connectionStart=bd(e,c,t):Ym(i,p)?h.connectionEnd=wd(e,p,t):Ym(o,c)?h.connectionStart=yd(e,c,s[c.id]):Ym(o,p)&&(h.connectionEnd=vd(e,p,s[p.id])),a._modeling.layoutConnection(e,h))}))},Km.$inject=["modeling"],Km.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=Jm(n),t.collapsed=!t.collapsed;var r=eg(n,t.collapsed);return[t].concat(r)},Km.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,r=tg(t.children,n);return t.collapsed=!t.collapsed,[t].concat(r)},ng.$inject=["modeling"],ng.prototype.execute=function(e){var t=e.shape,n=e.newHost,r=t.host;return e.oldHost=r,e.attacherIdx=rg(r,t),ig(n,t),t.host=n,t},ng.prototype.revert=function(e){var t=e.shape,n=e.newHost,r=e.oldHost,i=e.attacherIdx;return t.host=r,rg(n,t),ig(r,t,i),t},og.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},og.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t},sg.$inject=["eventBus","elementFactory","commandStack"],sg.prototype.getHandlers=function(){return{"shape.append":km,"shape.create":Cm,"shape.delete":Rm,"shape.move":Fm,"shape.resize":Wm,"shape.replace":Um,"shape.toggleCollapse":Km,spaceTool:Gm,"label.create":Tm,"connection.create":Em,"connection.delete":Dm,"connection.move":zm,"connection.layout":Im,"connection.updateWaypoints":og,"connection.reconnect":Vm,"elements.create":Pm,"elements.move":qm,"elements.delete":Nm,"elements.distribute":jm,"elements.align":_m,"element.updateAttachment":ng}},sg.prototype.registerHandlers=function(e){v(this.getHandlers(),(function(t,n){e.registerHandler(n,t)}))},sg.prototype.moveShape=function(e,t,n,r,i){"object"==typeof r&&(i=r,r=null);var o={shape:e,delta:t,newParent:n,newParentIndex:r,hints:i||{}};this._commandStack.execute("shape.move",o)},sg.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},sg.prototype.moveElements=function(e,t,n,r){var i,o=(r=r||{}).attach,s=n;!0===o?(i=n,s=n.parent):!1===o&&(i=null);var a={shapes:e,delta:t,newParent:s,newHost:i,hints:r};this._commandStack.execute("elements.move",a)},sg.prototype.moveConnection=function(e,t,n,r,i){"object"==typeof r&&(i=r,r=void 0);var o={connection:e,delta:t,newParent:n,newParentIndex:r,hints:i||{}};this._commandStack.execute("connection.move",o)},sg.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},sg.prototype.createConnection=function(e,t,n,r,i,o){"object"==typeof n&&(o=i,i=r,r=n,n=void 0);var s={source:e,target:t,parent:i,parentIndex:n,connection:r=this._create("connection",r),hints:o};return this._commandStack.execute("connection.create",s),s.connection},sg.prototype.createShape=function(e,t,n,r,i){"number"!=typeof r&&(i=r,r=void 0);var o,s,a=(i=i||{}).attach;e=this._create("shape",e),a?(o=n.parent,s=n):o=n;var l={position:t,shape:e,parent:o,parentIndex:r,host:s,hints:i};return this._commandStack.execute("shape.create",l),l.shape},sg.prototype.createElements=function(e,t,n,r,i){c(e)||(e=[e]),"number"!=typeof r&&(i=r,r=void 0);var o={position:t,elements:e,parent:n,parentIndex:r,hints:i=i||{}};return this._commandStack.execute("elements.create",o),o.elements},sg.prototype.createLabel=function(e,t,n,r){n=this._create("label",n);var i={labelTarget:e,position:t,parent:r||e.parent,shape:n};return this._commandStack.execute("label.create",i),i.shape},sg.prototype.appendShape=function(e,t,n,r,i){i=i||{};var o={source:e,position:n,target:r,shape:t=this._create("shape",t),connection:i.connection,connectionParent:i.connectionParent,hints:i};return this._commandStack.execute("shape.append",o),o.shape},sg.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},sg.prototype.distributeElements=function(e,t,n){var r={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",r)},sg.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},sg.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},sg.prototype.replaceShape=function(e,t,n){var r={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",r),r.newShape},sg.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},sg.prototype.resizeShape=function(e,t,n,r){var i={shape:e,newBounds:t,minBounds:n,hints:r};this._commandStack.execute("shape.resize",i)},sg.prototype.createSpace=function(e,t,n,r,i){var o={delta:n,direction:r,movingShapes:e,resizingShapes:t,start:i};this._commandStack.execute("spaceTool",o)},sg.prototype.updateWaypoints=function(e,t,n){var r={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",r)},sg.prototype.reconnect=function(e,t,n,r,i){var o={connection:e,newSource:t,newTarget:n,dockingOrPoints:r,hints:i||{}};this._commandStack.execute("connection.reconnect",o)},sg.prototype.reconnectStart=function(e,t,n,r){r||(r={}),this.reconnect(e,t,e.target,n,I(r,{docking:"source"}))},sg.prototype.reconnectEnd=function(e,t,n,r){r||(r={}),this.reconnect(e,e.source,t,n,I(r,{docking:"target"}))},sg.prototype.connect=function(e,t,n,r){return this.createConnection(e,t,n||{},e.parent,r)},sg.prototype._create=function(e,t){return t instanceof zn?t:this._elementFactory.create(e,t)},sg.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)},ag.$inject=["elementRegistry"],ag.prototype.execute=function(e){var t=e.element,n=e.moddleElement,r=e.properties;if(!n)throw new Error("<moddleElement> required");var i=e.changed||this._getVisualReferences(n).concat(t),o=e.oldProperties||function(e,t){return w(t,(function(t,n){return t[n]=e.get(n),t}),{})}(n,E(r));return lg(n,r),e.oldProperties=o,e.changed=i,i},ag.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,r=e.changed;return lg(n,t),r},ag.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return ki(e,"bpmn:DataObject")?function(e,t){return t.filter((function(t){return ki(t,"bpmn:DataObjectReference")&&Oi(t).dataObjectRef===e}))}(e,t):[]};var cg="default",pg="id",ug="di",dg={width:0,height:0};function hg(e,t,n,r){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=r}function fg(e,t){return pg in e&&e[pg]!==t[pg]}function mg(e,t){var n=e.businessObject,r=Pi(e);v(t,(function(e,t){t!==ug?n.set(t,e):r&&function(e,t){v(t,(function(t,n){e.set(n,t)}))}(r,e)}))}hg.$inject=["elementRegistry","moddle","modeling","textRenderer"],hg.prototype.execute=function(e){var t=e.element,n=[t];if(!t)throw new Error("element required");var r=this._elementRegistry,i=this._moddle.ids,o=t.businessObject,s=function(e){var t=I({},e);return gg.forEach((function(n){n in e&&(t[n]=Oi(t[n]))})),t}(e.properties),a=e.oldProperties||function(e,t){var n=E(t),r=e.businessObject,i=Pi(e);return w(n,(function(e,n){return e[n]=n!==ug?r.get(n):function(e,t){return w(t,(function(t,n){return t[n]=e&&e.get(n),t}),{})}(i,E(t.di)),e}),{})}(t,s);return fg(s,o)&&(i.unclaim(o[pg]),r.updateId(t,s[pg]),i.claim(s[pg],o)),cg in s&&(s[cg]&&n.push(r.get(s[cg].id)),o[cg]&&n.push(r.get(o[cg].id))),mg(t,s),e.oldProperties=a,e.changed=n,n},hg.prototype.postExecute=function(e){var t=e.element.label,n=t&&Oi(t).name;if(n){var r=this._textRenderer.getExternalLabelBounds(t,n);this._modeling.resizeShape(t,r,dg)}},hg.prototype.revert=function(e){var t=e.element,n=e.properties,r=e.oldProperties,i=t.businessObject,o=this._elementRegistry,s=this._moddle.ids;return mg(t,r),fg(n,i)&&(s.unclaim(n[pg]),o.updateId(t,r[pg]),s.claim(r[pg],i)),e.changed};var gg=["default"];function yg(e,t){this._canvas=e,this._modeling=t}function vg(e,t){this._modeling=e,this._spaceTool=t}function bg(e){this._modeling=e}function wg(e,t){this._modeling=e,this._spaceTool=t}yg.$inject=["canvas","modeling"],yg.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,r=n.businessObject,i=t.getRootElement(),o=i.businessObject,s=o.$parent,a=Pi(i);return t.setRootElement(n),t.removeRootElement(i),Ot(s.rootElements,r),r.$parent=s,Et(s.rootElements,o),o.$parent=null,i.di=null,a.bpmnElement=r,n.di=a,e.oldRoot=i,[]},yg.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,r=n.businessObject,i=e.oldRoot,o=i.businessObject,s=r.$parent,a=Pi(n);return t.setRootElement(i),t.removeRootElement(n),Et(s.rootElements,r),r.$parent=null,Ot(s.rootElements,o),o.$parent=s,n.di=null,a.bpmnElement=o,i.di=a,[]},vg.$inject=["modeling","spaceTool"],vg.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,r=e.shape,i=e.location,o=Ru(r),s=o===r,a=s?r:r.parent,l=Nu(a),c=Hi(r);if(c?"left"===i?i="top":"right"===i&&(i="bottom"):"top"===i?i="left":"bottom"===i&&(i="right"),!l.length){var p=c?{x:r.x+Au,y:r.y,width:r.width-Au,height:r.height}:{x:r.x,y:r.y+Au,width:r.width,height:r.height-Au};n.createShape({type:"bpmn:Lane",isHorizontal:c},p,a)}var u,d,h,f,m,g=[];gt(o,(function(e){return g.push(e),e.label&&g.push(e.label),e===r?[]:y(e.children,(function(e){return e!==r}))})),"top"===i?(u=-120,h=(d=r.y)+10,f="n",m="y"):"left"===i?(u=-120,h=(d=r.x)+10,f="w",m="x"):"bottom"===i?(u=120,h=(d=r.y+r.height)-10,f="s",m="y"):"right"===i&&(u=120,h=(d=r.x+r.width)-10,f="e",m="x");var v=t.calculateAdjustments(g,m,u,h),b=c?{x:0,y:u}:{x:u,y:0};t.makeSpace(v.movingShapes,v.resizingShapes,b,f,h);var w=c?{x:r.x+(s?Au:0),y:d-("top"===i?120:0),width:r.width-(s?Au:0),height:120}:{x:d-("left"===i?120:0),y:r.y+(s?Au:0),width:120,height:r.height-(s?Au:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:c},w,a)},bg.$inject=["modeling"],bg.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,r=e.count,i=Nu(n),o=i.length;if(o>r)throw new Error(`more than <${r}> child lanes`);var s,a,l,c,p=Hi(n),u=p?n.height:n.width,d=Math.round(u/r);for(c=0;c<r;c++)s=c===r-1?u-d*c:d,a=p?{x:n.x+Au,y:n.y+c*d,width:n.width-Au,height:s}:{x:n.x+c*d,y:n.y+Au,width:s,height:n.height-Au},c<o?t.resizeShape(i[c],a):(l={type:"bpmn:Lane",isHorizontal:p},t.createShape(l,a,n))},wg.$inject=["modeling","spaceTool"],wg.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds;!1!==e.balanced?this.resizeBalanced(t,n):this.resizeSpace(t,n)},wg.prototype.resizeBalanced=function(e,t){var n=this._modeling,r=ju(e,t);n.resizeShape(e,t),r.forEach((function(e){n.resizeShape(e.shape,e.newBounds)}))},wg.prototype.resizeSpace=function(e,t){var n,r,i,o,s,a=this._spaceTool,l=yn(e),c=Eu(yn(t),l),p=Ru(e),u=[],d=[];gt(p,(function(e){return u.push(e),(ki(e,"bpmn:Lane")||ki(e,"bpmn:Participant"))&&d.push(e),e.children})),(c.bottom||c.top)&&(n=c.bottom||c.top,r=e.y+(c.bottom?e.height:0)+(c.bottom?-10:10),i=c.bottom?"s":"n",o=c.top>0||c.bottom<0?-n:n,s=a.calculateAdjustments(u,"y",o,r),a.makeSpace(s.movingShapes,s.resizingShapes,{x:0,y:n},i)),(c.left||c.right)&&(n=c.right||c.left,r=e.x+(c.right?e.width:0)+(c.right?-10:100),i=c.right?"e":"w",o=c.left>0||c.right<0?-n:n,s=a.calculateAdjustments(d,"x",o,r),a.makeSpace(s.movingShapes,s.resizingShapes,{x:n,y:0},i))};var xg="flowNodeRef",_g="lanes";function kg(e){this._elementRegistry=e}function Eg(e){this._moddle=e}kg.$inject=["elementRegistry"],kg.prototype._computeUpdates=function(e,t){var n=[],r=[],i={},o=[];function s(e){-1===n.indexOf(e)&&(o.push(e),n.push(e))}function a(e){if(!e.parent)return[];var t=function(e){var t=Ru(e);return i[t.id]||(i[t.id]=Du(t)),i[t.id]}(e);return t.filter((function(t){return n=e,r=yn(t),i=n.x+n.width/2,o=n.y+n.height/2,i>r.left&&i<r.right&&o>r.top&&o<r.bottom;var n,r,i,o})).map((function(e){return e.businessObject}))}return t.forEach((function(e){var t=Ru(e);if(t&&-1===n.indexOf(t)){var r=t.children.filter((function(e){return ki(e,"bpmn:FlowNode")}));r.forEach(s),n.push(t)}})),e.forEach(s),o.forEach((function(e){var t=e.businessObject,n=t.get(_g).slice(),i=a(e);r.push({flowNode:t,remove:n,add:i})})),t.forEach((function(e){var t=e.businessObject;e.parent||t.get(xg).forEach((function(e){r.push({flowNode:e,remove:[t],add:[]})}))})),r},kg.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.flowNodeShapes,e.laneShapes)),t.forEach((function(e){var t=e.flowNode,n=t.get(_g);e.remove.forEach((function(e){Et(n,e),Et(e.get(xg),t)})),e.add.forEach((function(e){Ot(n,e),Ot(e.get(xg),t)}))})),[]},kg.prototype.revert=function(e){return e.updates.forEach((function(e){var t=e.flowNode,n=t.get(_g);e.add.forEach((function(e){Et(n,e),Et(e.get(xg),t)})),e.remove.forEach((function(e){Ot(n,e),Ot(e.get(xg),t)}))})),[]},Eg.$inject=["moddle"],Eg.prototype.execute=function(e){var t=this._moddle.ids,n=e.id,r=e.element;return e.claiming?t.claim(n,r):t.unclaim(n),[]},Eg.prototype.revert=function(e){var t=this._moddle.ids,n=e.id,r=e.element;return e.claiming?t.unclaim(n):t.claim(n,r),[]};var Og={fill:void 0,stroke:void 0};function Pg(e){this._commandStack=e,this._normalizeColor=function(e){if(e){if(h(e)){var t=function(e){var t=document.createElement("canvas").getContext("2d");return t.fillStyle="transparent",t.fillStyle=e,/^#[0-9a-fA-F]{6}$/.test(t.fillStyle)?t.fillStyle:null}(e);if(t)return t}throw new Error(`invalid color value: ${e}`)}}}Pg.$inject=["commandStack"],Pg.prototype.postExecute=function(e){var t=e.elements,n=e.colors||Og,r=this,i={};"fill"in n&&I(i,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&I(i,{"border-color":this._normalizeColor(n.stroke)}),v(t,(function(e){var t=hn(e)?$(i,["border-color"]):i,n=Pi(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))r._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:n.label,properties:{color:i["border-color"]}});else{if(!Ei(n,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;r._commandStack.execute("element.updateProperties",{element:e,properties:{di:t}})}}))};var Sg={width:0,height:0};function Cg(e,t,n){function r(e,t){var n=e.label||e,r=e.labelTarget||e;return no(n,t),[n,r]}this.preExecute=function(t){var n=t.element,r=n.businessObject,i=t.newLabel;if(!fn(n)&&Xi(n)&&!Yi(n)&&!Tg(i)){var o=Ji(n);o={x:o.x,y:o.y+7},e.createLabel(n,o,{id:r.id+"_label",businessObject:r,di:n.di})}},this.execute=function(e){return e.oldLabel=to(e.element),r(e.element,e.newLabel)},this.revert=function(e){return r(e.element,e.oldLabel)},this.postExecute=function(n){var r=n.element,i=r.label||r,o=n.newLabel,s=n.newBounds,a=n.hints||{};if(fn(i)||ki(i,"bpmn:TextAnnotation"))if(fn(i)&&Tg(o))!1!==a.removeShape&&e.removeShape(i,{unsetLabel:!1});else{var l=to(r);void 0===s&&(s=t.getExternalLabelBounds(i,l)),s&&e.resizeShape(i,s,Sg)}}}function Tg(e){return!e||!e.trim()}function Mg(e,t,n,r){sg.call(this,e,t,n),this._bpmnRules=r}function Ag(){}Cg.$inject=["modeling","textRenderer","bpmnFactory"],e(Mg,sg),Mg.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],Mg.prototype.getHandlers=function(){var e=sg.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=ag,e["element.updateProperties"]=hg,e["canvas.updateRoot"]=yg,e["lane.add"]=vg,e["lane.resize"]=wg,e["lane.split"]=bg,e["lane.updateRefs"]=kg,e["id.updateClaim"]=Eg,e["element.setColor"]=Pg,e["element.updateLabel"]=Cg,e},Mg.prototype.updateLabel=function(e,t,n,r){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:r||{}})},Mg.prototype.connect=function(e,t,n,r){var i=this._bpmnRules;if(n||(n=i.canConnect(e,t)),n)return this.createConnection(e,t,n,e.parent,r)},Mg.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},Mg.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},Mg.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},Mg.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},Mg.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},Mg.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Mg.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Mg.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},Mg.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},Mg.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},Mg.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})},Ag.prototype.layoutConnection=function(e,t){return[(t=t||{}).connectionStart||wn(t.source||e.source),t.connectionEnd||wn(t.target||e.target)]};var Dg=20,Ng=5,Rg=Math.round,jg=20,Lg={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function Ig(e,t,n){var r,i,o,s=xn(t,e,Ng),a=n.split(":")[0],l=Rg((t.x-e.x)/2+e.x),c=Rg((t.y-e.y)/2+e.y),p=(o=s,{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[a].test(o)),u=/h|r|l/.test(a),d=!1,h=!1;return p?(r=u?{x:l,y:e.y}:{x:e.x,y:c},i=u?"h:h":"v:v"):(d=function(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}(s,a),i=u?"h:v":"v:h",d?u?(h=c===e.y,r={x:e.x+Dg*(/l/.test(a)?-1:1),y:h?c+Dg:c}):r={x:(h=l===e.x)?l+Dg:l,y:e.y+Dg*(/t/.test(a)?-1:1)}:r={x:l,y:c}),{waypoints:Bg(e,r,i).concat(r),directions:i,turnNextDirections:h}}function zg(e){return e.split(":").reverse().join(":")}function Bg(e,t,n){if(!function(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}(n=n||"h:h"))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(Hg(n)){var r=function(e,t,n){return Ig(e,t,n)}(e,t,n),i=function(e,t,n){var r=Ig(t,e,zg(n));return{waypoints:r.waypoints.slice().reverse(),directions:zg(r.directions),turnNextDirections:r.turnNextDirections}}(e,t,n),o=function(e,t){var n=e.directions.split(":")[1],r=t.directions.split(":")[0];e.turnNextDirections&&(n="h"==n?"v":"h"),t.turnNextDirections&&(r="h"==r?"v":"h");var i=n+":"+r;return{waypoints:Bg(e.waypoints[e.waypoints.length-1],t.waypoints[0],i),directions:i}}(r,i);return[].concat(r.waypoints,o.waypoints,i.waypoints)}return function(e,t,n){var r=Rg((t.x-e.x)/2+e.x),i=Rg((t.y-e.y)/2+e.y);if("h:v"===n)return[{x:t.x,y:e.y}];if("v:h"===n)return[{x:e.x,y:t.y}];if("h:h"===n)return[{x:r,y:e.y},{x:r,y:t.y}];if("v:v"===n)return[{x:e.x,y:i},{x:t.x,y:i}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}(e,t,n)}function $g(e,t,n,r,i){var o=b(i&&i.preferredLayouts||[],"straight")[0]||"h:h",s=xn(e,t,Lg[o]||0),a=function(e,t){if(Hg(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||wn(e),r=r||wn(t);var l=a.split(":"),c=Ug(n,e,l[0],function(e){return{top:"bottom",bottom:"top",left:"right",right:"left","top-left":"bottom-right","bottom-right":"top-left","top-right":"bottom-left","bottom-left":"top-right"}[e]}(s));return function(e,t,n){var r=Bg(e,t,n);return r.unshift(e),r.push(t),Wg(r)}(c,Ug(r,t,l[1],s),a)}function qg(e,t,n,r,i,o){var s;return c(n)&&(i=n,o=r,n=wn(e),r=wn(t)),i=i||[],s=-1!==(o=I({preferredLayouts:[]},o)).preferredLayouts.indexOf("straight")&&function(e,t,n,r,i){var o,s,a={};if(s=xn(e,t),!/^(top|bottom|left|right)$/.test(s))return null;/top|bottom/.test(s)&&(o="x");/left|right/.test(s)&&(o="y");return"target"===i.preserveDocking?Fg(o,r,e)?(a[o]=r[o],[{x:void 0!==a.x?a.x:n.x,y:void 0!==a.y?a.y:n.y,original:{x:void 0!==a.x?a.x:n.x,y:void 0!==a.y?a.y:n.y}},{x:r.x,y:r.y}]):null:Fg(o,n,t)?(a[o]=n[o],[{x:n.x,y:n.y},{x:void 0!==a.x?a.x:r.x,y:void 0!==a.y?a.y:r.y,original:{x:void 0!==a.x?a.x:r.x,y:void 0!==a.y?a.y:r.y}}]):null}(e,t,n,r,o),s||(s=o.connectionEnd&&function(e,t,n,r){var i=r.slice().reverse();return i=Vg(e,t,n,i),i?i.reverse():null}(t,e,r,i),s||((s=o.connectionStart&&Vg(e,t,n,i))||(!o.connectionStart&&!o.connectionEnd&&i&&i.length?i:$g(e,t,n,r,o))))}function Fg(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 Vg(e,t,n,r){if(function(e){return e.length<3||!(e.length>4)&&!!m(e,(function(t,n){var r=e[n-1];return r&&St(t,r)<3}))}(r))return null;var i,o=r[0],s=r.slice();return s[0]=n,s[1]=function(e,t,n){switch(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),i=function(e,t,n){var r;for(r=e.length-2;0!==r;r--)if(Dt(e[r],t,jg)||Dt(e[r],n,jg))return e.slice(r);return e}(s,e,t),i!==s&&(s=Vg(e,t,n,i)),s&&Mt(s)?null:s}function Hg(e){return e&&/t|r|b|l/.test(e)}function Ug(e,t,n,r){if("h"===n&&(n=/left/.test(r)?"l":"r"),"v"===n&&(n=/top/.test(r)?"t":"b"),"t"===n)return{original:e,x:e.x,y:t.y};if("r"===n)return{original:e,x:t.x+t.width,y:e.y};if("b"===n)return{original:e,x:e.x,y:t.y+t.height};if("l"===n)return{original:e,x:t.x,y:e.y};throw new Error("unexpected dockingDirection: <"+n+">")}function Wg(e){return e.reduce((function(t,n,r){return Ct(t[t.length-1],e[r+1],n,0)||t.push(n),t}),[])}var Gg=-10,Qg=40,Zg={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},Xg={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},Yg={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},Kg={top:"t",right:"r",bottom:"b",left:"l"};function Jg(e){this._elementRegistry=e}function ey(e,t){return ki(t,"bpmn:Participant")?"source":ki(e,"bpmn:Participant")?"target":iy(t)?"source":iy(e)||ki(t,"bpmn:Event")?"target":ki(e,"bpmn:Event")?"source":null}function ty(e){return iy(e)?"target":"source"}function ny(e,t){return e?e.original||e:wn(t)}function ry(e,t){return ki(t,"bpmn:Activity")&&ki(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function iy(e){return ki(e,"bpmn:SubProcess")&&Vi(e)}function oy(e,t){return e===t}function sy(e){var t=/right|left/.exec(e);return t&&t[0]}function ay(e){var t=/top|bottom/.exec(e);return t&&t[0]}function ly(e,t){return Yg[e]===t}function cy(e){return"right"===e||"left"===e}function py(e,t,n){var r=t.waypoints,i=r&&r.length&&xn(r[0],e);return"top"===i?n.loop.fromTop:"right"===i?n.loop.fromRight:"left"===i?n.loop.fromLeft:n.loop.fromBottom}function uy(e,t,n,r){var i,o,s,a,l=wn(e),c=wn(t),p=(a=(s=e).host,xn(wn(s),a,Gg)),u=oy(e.host,t),d=-1!==["top","right","bottom","left"].indexOf(p),h=xn(c,l,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return u?function(e,t,n,r,i,o){var s,a=t?e:o.isHorizontal?ay(e):sy(e),l=Kg[a];s=t?cy(e)?dy("y",n,r,i)?"h":o.boundaryLoop.alternateHorizontalSide:dy("x",n,r,i)?"v":o.boundaryLoop.alternateVerticalSide:o.boundaryLoop.default;return[l+":"+s]}(p,d,e,t,n,r):(i=function(e,t,n,r){if(n)return Kg[e];var i=ay(e),o=sy(e),s=ay(t),a=sy(t);if(r){if(oy(i,s)||ly(o,a))return Kg[i]}else if(oy(o,a)||ly(i,s))return Kg[o];return Kg[r?o:i]}(p,h,d,r.isHorizontal),o=function(e,t,n,r){if(n)return cy(e)?function(e,t){var n=sy(e),r=Yg[n];return-1!==t.indexOf(r)}(e,t)||oy(e,t)?"h":"v":function(e,t){var n=ay(e),r=Yg[n];return-1!==t.indexOf(r)}(e,t)||oy(e,t)?"v":"h";return r?oy(ay(e),ay(t))?"h":"v":oy(sy(e),sy(t))?"v":"h"}(p,h,d,r.isHorizontal),[i+":"+o])}function dy(e,t,n,r){var i=Qg;return!(hy(e,r,n,i)||hy(e,r,{x:n.x+n.width,y:n.y+n.height},i)||hy(e,r,wn(t),i))}function hy(e,t,n,r){return Math.abs(t[e]-n[e])<r}function fy(e){return I({original:e.point.original||e.point},e.actual)}function my(e,t){this._elementRegistry=e,this._graphicsFactory=t}e(Jg,Ag),Jg.prototype.layoutConnection=function(e,t){t||(t={});var n,r,i=t.source||e.source,o=t.target||e.target,s=t.waypoints||e.waypoints,a=t.connectionStart,l=t.connectionEnd,c=this._elementRegistry;if(a||(a=ny(s&&s[0],i)),l||(l=ny(s&&s[s.length-1],o)),(ki(e,"bpmn:Association")||ki(e,"bpmn:DataAssociation"))&&s&&!ry(i,o))return[].concat([a],s.slice(1,-1),[l]);var p=gc(i,c)?Zg:Xg;return ki(e,"bpmn:MessageFlow")?n=function(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:ey(e,t)}}(i,o,p):(ki(e,"bpmn:SequenceFlow")||ry(i,o))&&(n=i===o?{preferredLayouts:py(i,e,p)}:ki(i,"bpmn:BoundaryEvent")?{preferredLayouts:uy(i,o,l,p)}:iy(i)||iy(o)?{preferredLayouts:p.subProcess,preserveDocking:ty(i)}:ki(i,"bpmn:Gateway")?{preferredLayouts:p.fromGateway}:ki(o,"bpmn:Gateway")?{preferredLayouts:p.toGateway}:{preferredLayouts:p.default}),n&&(r=Wg(qg(i,o,a,l,s,n=I(n,t)))),r||[a,l]},Jg.$inject=["elementRegistry"],my.$inject=["elementRegistry","graphicsFactory"],my.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var r=this.getDockingPoint(e,t,!0),i=this.getDockingPoint(e,n),o=e.waypoints.slice(r.idx+1,i.idx);return o.unshift(fy(r)),o.push(fy(i)),o},my.prototype.getDockingPoint=function(e,t,n){var r,i,o=e.waypoints;return{point:i=o[r=n?0:o.length-1],actual:this._getIntersection(t,e,n)||i,idx:r}},my.prototype._getIntersection=function(e,t,n){return _n(this._getShapePath(e),this._getConnectionPath(t),n)},my.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},my.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},my.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};var gy={__init__:["modeling","bpmnUpdater"],__depends__:[bh,Jh,tf,of,zf,lm,dm,gm,Ds,Vo,sm],bpmnFactory:["type",ym],bpmnUpdater:["type",vm],elementFactory:["type",wm],modeling:["type",Mg],layouter:["type",Jg],connectionDocking:["type",my]};const yy=Math.round;function vy(e,t,n,r,i,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=r,this._layouter=i,this._rules=o}vy.prototype.create=function(e,t,n){const r=this._complexPreview,i=this._connectionDocking,o=this._elementFactory,s=this._eventBus,a=this._layouter,c=this._rules,p=o.createShape(I({type:t},n)),u=s.fire("autoPlace",{source:e,shape:p});if(!u)return;I(p,{x:u.x-yy(p.width/2),y:u.y-yy(p.height/2)});const d=c.allowed("connection.create",{source:e,target:p,hints:{targetParent:e.parent}});let h=null;d&&(h=o.createConnection(d),h.waypoints=a.layoutConnection(h,{source:e,target:p}),h.waypoints=i.getCroppedWaypoints(h,e,p)),r.create({created:[p,h].filter((e=>!l(e)))})},vy.prototype.cleanUp=function(){this._complexPreview.cleanUp()},vy.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];var by={__depends__:[wc,Zp,gy],__init__:["appendPreview"],appendPreview:["type",vy]},wy=Math.min,xy=Math.max;function _y(e){e.preventDefault()}function ky(e){e.stopPropagation()}function Ey(e){this.container=e.container,this.parent=ge('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=ve("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.autoResize=L(this.autoResize,this),this.handlePaste=L(this.handlePaste,this)}function Oy(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new Ey({container:t.getContainer(),keyHandler:L(this._handleKey,this),resizeHandler:L(this._handleResize,this)})}Ey.prototype.create=function(e,t,n,r){var i=this.parent,o=this.content,s=this.container;r=this.options=r||{};var a=$(t=this.style=t||{},["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);I(i.style,{width:e.width+"px",height:e.height+"px",maxWidth:e.maxWidth+"px",maxHeight:e.maxHeight+"px",minWidth:e.minWidth+"px",minHeight:e.minHeight+"px",left:e.x+"px",top:e.y+"px",backgroundColor:"#ffffff",position:"absolute",overflow:"visible",border:"1px solid #ccc",boxSizing:"border-box",wordWrap:"normal",textAlign:"center",outline:"none"},a);var l=$(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return I(o.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},l),r.centerVertically&&I(o.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},l),o.innerText=n,ce.bind(o,"keydown",this.keyHandler),ce.bind(o,"mousedown",ky),ce.bind(o,"paste",this.handlePaste),r.autoResize&&ce.bind(o,"input",this.autoResize),r.resizable&&this.resizable(t),s.appendChild(i),this.setSelection(o.lastChild,o.lastChild&&o.lastChild.length),i},Ey.prototype.handlePaste=function(e){var t,n=this.options,r=this.style;if(e.preventDefault(),t=e.clipboardData?e.clipboardData.getData("text/plain"):window.clipboardData.getData("Text"),this.insertText(t),n.autoResize){var i=this.autoResize(r);i&&this.resizeHandler(i)}},Ey.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)},Ey.prototype._insertTextIE=function(e){var t,n,r,i=this.getSelection(),o=i.startContainer,s=i.endContainer,a=i.startOffset,l=i.endOffset,c=i.commonAncestorContainer,p=(t=c.childNodes,[].slice.call(t));if(function(e){return e.nodeType===Node.TEXT_NODE}(c)){var u=o.textContent;o.textContent=u.substring(0,a)+e+u.substring(l),n=o,r=a+e.length}else if(o===this.content&&s===this.content){var d=document.createTextNode(e);this.content.insertBefore(d,p[a]),n=d,r=d.textContent.length}else{var h=p.indexOf(o),f=p.indexOf(s);p.forEach((function(t,n){n===h?t.textContent=o.textContent.substring(0,a)+e+s.textContent.substring(l):n>h&&n<=f&&we(t)})),n=o,r=a+e.length}n&&void 0!==r&&setTimeout((function(){self.setSelection(n,r)}))},Ey.prototype.autoResize=function(){var e=this.parent,t=this.content,n=parseInt(this.style.fontSize)||12;if(t.scrollHeight>e.offsetHeight||t.scrollHeight<e.offsetHeight-n){var r=e.getBoundingClientRect(),i=t.scrollHeight;e.style.height=i+"px",this.resizeHandler({width:r.width,height:r.height,dx:0,dy:i-r.height})}},Ey.prototype.resizable=function(){var e=this,t=this.parent,n=this.resizeHandle,r=parseInt(this.style.minWidth)||0,i=parseInt(this.style.minHeight)||0,o=parseInt(this.style.maxWidth)||1/0,s=parseInt(this.style.maxHeight)||1/0;if(!n){var a,l,c,p;n=this.resizeHandle=ge('<div class="djs-direct-editing-resize-handle"></div>');var u=function(n){_y(n),ky(n);var u=wy(xy(c+n.clientX-a,r),o),d=wy(xy(p+n.clientY-l,i),s);t.style.width=u+"px",t.style.height=d+"px",e.resizeHandler({width:c,height:p,dx:n.clientX-a,dy:n.clientY-l})},d=function(e){_y(e),ky(e),ce.unbind(document,"mousemove",u,!1),ce.unbind(document,"mouseup",d,!1)};ce.bind(n,"mousedown",(function(e){_y(e),ky(e),a=e.clientX,l=e.clientY;var n=t.getBoundingClientRect();c=n.width,p=n.height,ce.bind(document,"mousemove",u),ce.bind(document,"mouseup",d)}))}I(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)},Ey.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),ce.unbind(t,"keydown",this.keyHandler),ce.unbind(t,"mousedown",ky),ce.unbind(t,"input",this.autoResize),ce.unbind(t,"paste",this.handlePaste),n&&(n.removeAttribute("style"),we(n)),we(e)},Ey.prototype.getValue=function(){return this.content.innerText.trim()},Ey.prototype.getSelection=function(){return window.getSelection().getRangeAt(0)},Ey.prototype.setSelection=function(e,t){var n=document.createRange();null===e?n.selectNodeContents(this.content):(n.setStart(e,t),n.setEnd(e,t));var r=window.getSelection();r.removeAllRanges(),r.addRange(n)},Oy.$inject=["eventBus","canvas"],Oy.prototype.registerProvider=function(e){this._providers.push(e)},Oy.prototype.isActive=function(e){return!(!this._active||e&&this._active.element!==e)},Oy.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},Oy.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},Oy.prototype.close=function(){this._textbox.destroy(),this._fire("deactivate"),this._active=null,this.resizable=void 0,this._canvas.restoreFocus&&this._canvas.restoreFocus()},Oy.prototype.complete=function(){var e=this._active;if(e){var t,n=e.context.bounds,r=this.$textbox.getBoundingClientRect(),i=this.getValue();i===e.context.text&&r.height===n.height&&r.width===n.width||(t=this._textbox.container.getBoundingClientRect(),e.provider.update(e.element,i,e.context.text,{x:r.left-t.left,y:r.top-t.top,width:r.width,height:r.height})),this._fire("complete"),this.close()}},Oy.prototype.getValue=function(){return this._textbox.getValue()},Oy.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())},Oy.prototype._handleResize=function(e){this._fire("resize",e)},Oy.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 Py={__depends__:[Os],__init__:["directEditing"],directEditing:["type",Oy]};function Sy(e){return function(t){var n=t.target,r=Oi(e),i=r.eventDefinitions&&r.eventDefinitions[0],o=r.$type===n.type,s=(i&&i.$type)===n.eventDefinitionType,a=!!n.triggeredByEvent==!!r.triggeredByEvent,l=void 0===n.isExpanded||n.isExpanded===Vi(e);return!(o&&s&&a&&l)}}var Cy=[{label:"Start event",actionName:"replace-with-none-start",className:"bpmn-icon-start-event-none",target:{type:"bpmn:StartEvent"}},{label:"Intermediate throw event",actionName:"replace-with-none-intermediate-throwing",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:IntermediateThrowEvent"}},{label:"End event",actionName:"replace-with-none-end",className:"bpmn-icon-end-event-none",target:{type:"bpmn:EndEvent"}},{label:"Message start event",actionName:"replace-with-message-start",className:"bpmn-icon-start-event-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Timer start event",actionName:"replace-with-timer-start",className:"bpmn-icon-start-event-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition"}},{label:"Conditional start event",actionName:"replace-with-conditional-start",className:"bpmn-icon-start-event-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition"}},{label:"Signal start event",actionName:"replace-with-signal-start",className:"bpmn-icon-start-event-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}}],Ty=[{label:"Start event",actionName:"replace-with-none-start",className:"bpmn-icon-start-event-none",target:{type:"bpmn:StartEvent"}},{label:"Intermediate throw event",actionName:"replace-with-none-intermediate-throwing",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:IntermediateThrowEvent"}},{label:"End event",actionName:"replace-with-none-end",className:"bpmn-icon-end-event-none",target:{type:"bpmn:EndEvent"}}],My=[{label:"Start event",actionName:"replace-with-none-start",className:"bpmn-icon-start-event-none",target:{type:"bpmn:StartEvent"}},{label:"Intermediate throw event",actionName:"replace-with-none-intermediate-throw",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:IntermediateThrowEvent"}},{label:"End event",actionName:"replace-with-none-end",className:"bpmn-icon-end-event-none",target:{type:"bpmn:EndEvent"}},{label:"Message intermediate catch event",actionName:"replace-with-message-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-message",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Message intermediate throw event",actionName:"replace-with-message-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-message",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Timer intermediate catch event",actionName:"replace-with-timer-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-timer",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:TimerEventDefinition"}},{label:"Escalation intermediate throw event",actionName:"replace-with-escalation-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-escalation",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},{label:"Conditional intermediate catch event",actionName:"replace-with-conditional-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-condition",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition"}},{label:"Link intermediate catch event",actionName:"replace-with-link-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-link",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:LinkEventDefinition",eventDefinitionAttrs:{name:""}}},{label:"Link intermediate throw event",actionName:"replace-with-link-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-link",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:LinkEventDefinition",eventDefinitionAttrs:{name:""}}},{label:"Compensation intermediate throw event",actionName:"replace-with-compensation-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-compensation",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},{label:"Signal intermediate catch event",actionName:"replace-with-signal-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-signal",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},{label:"Signal intermediate throw event",actionName:"replace-with-signal-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-signal",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}}],Ay=[{label:"Start event",actionName:"replace-with-none-start",className:"bpmn-icon-start-event-none",target:{type:"bpmn:StartEvent"}},{label:"Intermediate throw event",actionName:"replace-with-none-intermediate-throw",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:IntermediateThrowEvent"}},{label:"End event",actionName:"replace-with-none-end",className:"bpmn-icon-end-event-none",target:{type:"bpmn:EndEvent"}},{label:"Message end event",actionName:"replace-with-message-end",className:"bpmn-icon-end-event-message",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Escalation end event",actionName:"replace-with-escalation-end",className:"bpmn-icon-end-event-escalation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},{label:"Error end event",actionName:"replace-with-error-end",className:"bpmn-icon-end-event-error",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:ErrorEventDefinition"}},{label:"Cancel end event",actionName:"replace-with-cancel-end",className:"bpmn-icon-end-event-cancel",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:CancelEventDefinition"}},{label:"Compensation end event",actionName:"replace-with-compensation-end",className:"bpmn-icon-end-event-compensation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},{label:"Signal end event",actionName:"replace-with-signal-end",className:"bpmn-icon-end-event-signal",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},{label:"Terminate end event",actionName:"replace-with-terminate-end",className:"bpmn-icon-end-event-terminate",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:TerminateEventDefinition"}}],Dy=[{label:"Exclusive gateway",actionName:"replace-with-exclusive-gateway",className:"bpmn-icon-gateway-xor",target:{type:"bpmn:ExclusiveGateway"}},{label:"Parallel gateway",actionName:"replace-with-parallel-gateway",className:"bpmn-icon-gateway-parallel",target:{type:"bpmn:ParallelGateway"}},{label:"Inclusive gateway",actionName:"replace-with-inclusive-gateway",className:"bpmn-icon-gateway-or",target:{type:"bpmn:InclusiveGateway"}},{label:"Complex gateway",actionName:"replace-with-complex-gateway",className:"bpmn-icon-gateway-complex",target:{type:"bpmn:ComplexGateway"}},{label:"Event-based gateway",actionName:"replace-with-event-based-gateway",className:"bpmn-icon-gateway-eventbased",target:{type:"bpmn:EventBasedGateway",instantiate:!1,eventGatewayType:"Exclusive"}}],Ny=[{label:"Transaction",actionName:"replace-with-transaction",className:"bpmn-icon-transaction",target:{type:"bpmn:Transaction",isExpanded:!0}},{label:"Event sub-process",actionName:"replace-with-event-subprocess",className:"bpmn-icon-event-subprocess-expanded",target:{type:"bpmn:SubProcess",triggeredByEvent:!0,isExpanded:!0}},{label:"Sub-process (collapsed)",actionName:"replace-with-collapsed-subprocess",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:SubProcess",isExpanded:!1}}],Ry=[{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:"Event sub-process",actionName:"replace-with-event-subprocess",className:"bpmn-icon-event-subprocess-expanded",target:{type:"bpmn:SubProcess",triggeredByEvent:!0,isExpanded:!0}}],jy=Ry,Ly=[{label:"Task",actionName:"replace-with-task",className:"bpmn-icon-task",target:{type:"bpmn:Task"}},{label:"User task",actionName:"replace-with-user-task",className:"bpmn-icon-user",target:{type:"bpmn:UserTask"}},{label:"Service task",actionName:"replace-with-service-task",className:"bpmn-icon-service",target:{type:"bpmn:ServiceTask"}},{label:"Send task",actionName:"replace-with-send-task",className:"bpmn-icon-send",target:{type:"bpmn:SendTask"}},{label:"Receive task",actionName:"replace-with-receive-task",className:"bpmn-icon-receive",target:{type:"bpmn:ReceiveTask"}},{label:"Manual task",actionName:"replace-with-manual-task",className:"bpmn-icon-manual",target:{type:"bpmn:ManualTask"}},{label:"Business rule task",actionName:"replace-with-rule-task",className:"bpmn-icon-business-rule",target:{type:"bpmn:BusinessRuleTask"}},{label:"Script task",actionName:"replace-with-script-task",className:"bpmn-icon-script",target:{type:"bpmn:ScriptTask"}},{label:"Call activity",actionName:"replace-with-call-activity",className:"bpmn-icon-call-activity",target:{type:"bpmn:CallActivity"}},{label:"Sub-process (collapsed)",actionName:"replace-with-collapsed-subprocess",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:SubProcess",isExpanded:!1}},{label:"Sub-process (expanded)",actionName:"replace-with-expanded-subprocess",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:SubProcess",isExpanded:!0}}],Iy=[{label:"Data store reference",actionName:"replace-with-data-store-reference",className:"bpmn-icon-data-store",target:{type:"bpmn:DataStoreReference"}}],zy=[{label:"Data object reference",actionName:"replace-with-data-object-reference",className:"bpmn-icon-data-object",target:{type:"bpmn:DataObjectReference"}}],By=[{label:"Message boundary event",actionName:"replace-with-message-boundary",className:"bpmn-icon-intermediate-event-catch-message",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:MessageEventDefinition",cancelActivity:!0}},{label:"Timer boundary event",actionName:"replace-with-timer-boundary",className:"bpmn-icon-intermediate-event-catch-timer",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:TimerEventDefinition",cancelActivity:!0}},{label:"Escalation boundary event",actionName:"replace-with-escalation-boundary",className:"bpmn-icon-intermediate-event-catch-escalation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",cancelActivity:!0}},{label:"Conditional boundary event",actionName:"replace-with-conditional-boundary",className:"bpmn-icon-intermediate-event-catch-condition",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",cancelActivity:!0}},{label:"Error boundary event",actionName:"replace-with-error-boundary",className:"bpmn-icon-intermediate-event-catch-error",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ErrorEventDefinition",cancelActivity:!0}},{label:"Cancel boundary event",actionName:"replace-with-cancel-boundary",className:"bpmn-icon-intermediate-event-catch-cancel",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CancelEventDefinition",cancelActivity:!0}},{label:"Signal boundary event",actionName:"replace-with-signal-boundary",className:"bpmn-icon-intermediate-event-catch-signal",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:SignalEventDefinition",cancelActivity:!0}},{label:"Compensation boundary event",actionName:"replace-with-compensation-boundary",className:"bpmn-icon-intermediate-event-catch-compensation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CompensateEventDefinition",cancelActivity:!0}},{label:"Message boundary event (non-interrupting)",actionName:"replace-with-non-interrupting-message-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-message",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:MessageEventDefinition",cancelActivity:!1}},{label:"Timer boundary event (non-interrupting)",actionName:"replace-with-non-interrupting-timer-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-timer",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:TimerEventDefinition",cancelActivity:!1}},{label:"Escalation boundary event (non-interrupting)",actionName:"replace-with-non-interrupting-escalation-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-escalation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",cancelActivity:!1}},{label:"Conditional boundary event (non-interrupting)",actionName:"replace-with-non-interrupting-conditional-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-condition",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",cancelActivity:!1}},{label:"Signal boundary event (non-interrupting)",actionName:"replace-with-non-interrupting-signal-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-signal",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:SignalEventDefinition",cancelActivity:!1}}],$y=[{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}}],qy=[{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"}],Fy=[{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}}],Vy={"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 Hy(e,t,n,r,i,o,s,a){this._bpmnFactory=e,this._popupMenu=t,this._modeling=n,this._moddle=r,this._bpmnReplace=i,this._rules=o,this._translate=s,this._moddleCopy=a,this._register()}Hy.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],Hy.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Hy.prototype.getPopupMenuEntries=function(e){var t=e.businessObject,n=this._rules,r=[];if(c(e)||!n.allowed("shape.replace",{element:e}))return{};var i=Sy(e);return ki(t,"bpmn:DataObjectReference")?this._createEntries(e,Iy):ki(t,"bpmn:DataStoreReference")&&!ki(e.parent,"bpmn:Collaboration")?this._createEntries(e,zy):ki(t,"bpmn:StartEvent")&&!ki(t.$parent,"bpmn:SubProcess")?(r=y(Cy,i),this._createEntries(e,r)):ki(t,"bpmn:Participant")?(r=y(Fy,(function(t){return Vi(e)!==t.target.isExpanded})),this._createEntries(e,r)):ki(t,"bpmn:StartEvent")&&Wi(t.$parent)?(r=y($y,(function(e){var n=!1!==e.target.isInterrupting,r=t.isInterrupting===n;return i(e)||!i(e)&&!r})),this._createEntries(e,r)):ki(t,"bpmn:StartEvent")&&!Wi(t.$parent)&&ki(t.$parent,"bpmn:SubProcess")?(r=y(Ty,i),this._createEntries(e,r)):ki(t,"bpmn:EndEvent")?(r=y(Ay,(function(e){return!("bpmn:CancelEventDefinition"==e.target.eventDefinitionType&&!ki(t.$parent,"bpmn:Transaction"))&&i(e)})),this._createEntries(e,r)):ki(t,"bpmn:BoundaryEvent")?(r=y(By,(function(e){var n=e.target;if("bpmn:CancelEventDefinition"==n.eventDefinitionType&&!ki(t.attachedToRef,"bpmn:Transaction"))return!1;var r=!1!==n.cancelActivity,o=t.cancelActivity==r;return i(e)||!i(e)&&!o})),this._createEntries(e,r)):ki(t,"bpmn:IntermediateCatchEvent")||ki(t,"bpmn:IntermediateThrowEvent")?(r=y(My,i),this._createEntries(e,r)):ki(t,"bpmn:Gateway")?(r=y(Dy,i),this._createEntries(e,r)):ki(t,"bpmn:Transaction")?(r=y(Ry,i),this._createEntries(e,r)):Wi(t)&&Vi(e)?(r=y(jy,i),this._createEntries(e,r)):ki(t,"bpmn:SubProcess")&&Vi(e)?(r=y(Ny,i),this._createEntries(e,r)):ki(t,"bpmn:AdHocSubProcess")&&!Vi(e)?(r=y(Ly,(function(e){var t=e.target,n="bpmn:SubProcess"===t.type,r=!0===t.isExpanded;return Sy(t)&&(!n||r)})),this._createEntries(e,r)):ki(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,qy):ki(t,"bpmn:FlowNode")?(r=y(Ly,i),ki(t,"bpmn:SubProcess")&&!Vi(e)&&(r=y(r,(function(e){return"Sub-process (collapsed)"!==e.label}))),this._createEntries(e,r)):{}},Hy.prototype.getPopupMenuHeaderEntries=function(e){var t={};return ki(e,"bpmn:Activity")&&!Wi(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),ki(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),ki(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),!ki(e,"bpmn:SubProcess")||ki(e,"bpmn:Transaction")||Wi(e)||(t={...t,...this._getAdHocHeaderEntries(e)}),Sd(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},Hy.prototype._createEntries=function(e,t){var n={},r=this;return v(t,(function(t){n[t.actionName]=r._createEntry(t,e)})),n},Hy.prototype._createSequenceFlowEntries=function(e,t){var n=Oi(e),r={},i=this._modeling,o=this._moddle,s=this;return v(t,(function(t){switch(t.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(ki(n.sourceRef,"bpmn:ExclusiveGateway")||ki(n.sourceRef,"bpmn:InclusiveGateway")||ki(n.sourceRef,"bpmn:ComplexGateway")||ki(n.sourceRef,"bpmn:Activity"))&&(r={...r,[t.actionName]:s._createEntry(t,e,(function(){i.updateProperties(e.source,{default:n})}))});break;case"replace-with-conditional-flow":!n.conditionExpression&&ki(n.sourceRef,"bpmn:Activity")&&(r={...r,[t.actionName]:s._createEntry(t,e,(function(){var t=o.create("bpmn:FormalExpression",{body:""});i.updateProperties(e,{conditionExpression:t})}))});break;default:ki(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(r={...r,[t.actionName]:s._createEntry(t,e,(function(){i.updateProperties(e,{conditionExpression:void 0})}))}),(ki(n.sourceRef,"bpmn:ExclusiveGateway")||ki(n.sourceRef,"bpmn:InclusiveGateway")||ki(n.sourceRef,"bpmn:ComplexGateway")||ki(n.sourceRef,"bpmn:Activity"))&&n.sourceRef.default===n&&(r={...r,[t.actionName]:s._createEntry(t,e,(function(){i.updateProperties(e.source,{default:void 0})}))})}})),r},Hy.prototype._createEntry=function(e,t,n){var r=this._translate,i=this._bpmnReplace.replaceElement,o=e.label;return o&&"function"==typeof o&&(o=o(t)),n=n||function(){return i(t,e.target)},{label:r(o),className:e.className,action:n}},Hy.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function r(n,r){if(r.active)t._modeling.updateProperties(e,{loopCharacteristics:void 0});else{var i=e.businessObject.get("loopCharacteristics");i&&ki(i,r.options.loopCharacteristics)?t._modeling.updateModdleProperties(e,i,{isSequential:r.options.isSequential}):(i=t._moddle.create(r.options.loopCharacteristics,{isSequential:r.options.isSequential}),t._modeling.updateProperties(e,{loopCharacteristics:i}))}}var i,o,s,a=Oi(e).loopCharacteristics;return a&&(i=a.isSequential,o=void 0===a.isSequential,s=void 0!==a.isSequential&&!a.isSequential),{"toggle-parallel-mi":{className:"bpmn-icon-parallel-mi-marker",title:n("Parallel multi-instance"),active:s,action:r,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!1}},"toggle-sequential-mi":{className:"bpmn-icon-sequential-mi-marker",title:n("Sequential multi-instance"),active:i,action:r,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!0}},"toggle-loop":{className:"bpmn-icon-loop-marker",title:n("Loop"),active:o,action:r,options:{loopCharacteristics:"bpmn:StandardLoopCharacteristics"}}}},Hy.prototype._getCollectionHeaderEntries=function(e){var t=this,n=this._translate,r=e.businessObject.dataObjectRef;if(!r)return{};var i=r.isCollection;return{"toggle-is-collection":{className:"bpmn-icon-parallel-mi-marker",title:n("Collection"),active:i,action:function(n,i){t._modeling.updateModdleProperties(e,r,{isCollection:!i.active})}}}},Hy.prototype._getParticipantMultiplicityHeaderEntries=function(e){var t=this,n=this._bpmnFactory,r=this._translate;var i=e.businessObject.participantMultiplicity;return{"toggle-participant-multiplicity":{className:"bpmn-icon-parallel-mi-marker",title:r("Participant multiplicity"),active:!!i,action:function(r,i){var o;i.active||(o=n.create("bpmn:ParticipantMultiplicity")),t._modeling.updateProperties(e,{participantMultiplicity:o})}}}},Hy.prototype._getAdHocHeaderEntries=function(e){var t=this._translate,n=ki(Oi(e),"bpmn:AdHocSubProcess"),r=this._bpmnReplace.replaceElement;return{"toggle-adhoc":{className:"bpmn-icon-ad-hoc-marker",title:t("Ad-hoc"),active:n,action:function(t,i){return r(e,n?{type:"bpmn:SubProcess"}:{type:"bpmn:AdHocSubProcess"},{autoResize:!1,layoutConnection:!1})}}}},Hy.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=Oi(e),r=this,i=Cd(e),o=ki(e,"bpmn:BoundaryEvent")?Vy["intermediate-event-non-interrupting"]:Vy["start-event-non-interrupting"],s=!n[i];return{"toggle-non-interrupting":{imageHtml:o,title:t("Toggle non-interrupting"),active:s,action:function(){r._modeling.updateProperties(e,{[i]:!!s})}}}};var Uy={__depends__:[Xl,zf,wc],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Hy]};function Wy(e,t,n,r,i,o,s,a,l,c,p,u,d){e=e||{},r.registerProvider(this),this._contextPad=r,this._modeling=i,this._elementFactory=o,this._connect=s,this._create=a,this._popupMenu=l,this._canvas=c,this._rules=p,this._translate=u,this._eventBus=n,this._appendPreview=d,!1!==e.autoPlace&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,(function(e){var t=e.context.shape;if(ws(e)&&r.isOpen(t)){var n=r.getEntries(t);n.replace&&n.replace.action.click(e,t)}})),n.on("contextPad.close",(function(){d.cleanUp()}))}function Gy(e,t,n){var r=e.$instanceOf(t),i=!1;return v(e.eventDefinitions||[],(function(e){e.$type===n&&(i=!0)})),r&&i}Wy.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],Wy.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&I(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(e,n){t.removeElements(n.slice())}}}}),n},Wy.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return c(t)?x(e,(e=>t.includes(e))):t},Wy.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,r=this._elementFactory,i=this._connect,o=this._create,s=this._popupMenu,a=this._autoPlace,l=this._translate,c=this._appendPreview,p={};if("label"===e.type)return this._isDeleteAllowed([e])&&I(p,f()),p;var u=e.businessObject;function d(e,t){i.start(e,t)}function h(e,t){n.removeElements([t])}function f(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:l("Delete"),action:{click:h}}}}function m(e,t,n,i){function s(t,n){var s=r.createShape(I({type:e},i));o.start(t,s,{source:n})}var l=a?function(t,n){var o=r.createShape(I({type:e},i));a.append(n,o)}:s,p=a?function(t,n){return c.create(n,e,i),()=>{c.cleanUp()}}:null;return{group:"model",className:t,title:n,action:{dragstart:s,click:l,hover:p}}}function g(e){return function(r,i){n.splitLane(i,e),t.open(i,!0)}}if(Ei(u,["bpmn:Lane","bpmn:Participant"])&&Vi(e)){var y=Nu(e);I(p,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:l("Add lane above"),action:{click:function(e,t){n.addLane(t,"top")}}}}),y.length<2&&((Hi(e)?e.height>=120:e.width>=120)&&I(p,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:l("Divide into two lanes"),action:{click:g(2)}}}),(Hi(e)?e.height>=180:e.width>=180)&&I(p,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:l("Divide into three lanes"),action:{click:g(3)}}})),I(p,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:l("Add lane below"),action:{click:function(e,t){n.addLane(t,"bottom")}}}})}return ki(u,"bpmn:FlowNode")&&(ki(u,"bpmn:EventBasedGateway")?I(p,{"append.receive-task":m("bpmn:ReceiveTask","bpmn-icon-receive-task",l("Append receive task")),"append.message-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",l("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",l("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",l("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",l("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):Gy(u,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?I(p,{"append.compensation-activity":m("bpmn:Task","bpmn-icon-task",l("Append compensation activity"),{isForCompensation:!0})}):ki(u,"bpmn:EndEvent")||u.isForCompensation||Gy(u,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")||Wi(u)||I(p,{"append.end-event":m("bpmn:EndEvent","bpmn-icon-end-event-none",l("Append end event")),"append.gateway":m("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",l("Append gateway")),"append.append-task":m("bpmn:Task","bpmn-icon-task",l("Append task")),"append.intermediate-event":m("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",l("Append intermediate/boundary event"))})),s.isEmpty(e,"bpmn-replace")||I(p,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:l("Change element"),action:{click:function(e,n){var r=I(function(e){var n=t.getPad(e).html.getBoundingClientRect();return{x:n.left,y:n.bottom+5}}(n),{cursor:{x:e.x,y:e.y}});s.open(n,"bpmn-replace",r,{title:l("Change element"),width:300,search:!0})}}}}),ki(u,"bpmn:SequenceFlow")&&I(p,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",l("Add text annotation"))}),Ei(u,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&I(p,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",l("Add text annotation")),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:l("Connect to other element"),action:{click:d,dragstart:d}}}),ki(u,"bpmn:TextAnnotation")&&I(p,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:l("Connect using association"),action:{click:d,dragstart:d}}}),Ei(u,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&I(p,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:l("Connect using data input association"),action:{click:d,dragstart:d}}}),ki(u,"bpmn:Group")&&I(p,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",l("Add text annotation"))}),this._isDeleteAllowed([e])&&I(p,f()),p};var Qy={__depends__:[by,Py,Aa,Ds,Bp,yf,Uy],__init__:["contextPadProvider"],contextPadProvider:["type",Wy]},Zy={horizontal:["x","width"],vertical:["y","height"]};function Xy(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:[]}))}Xy.$inject=["modeling","rules"],Xy.prototype.registerFilter=function(e){if("function"!=typeof e)throw new Error("the filter has to be a function");this._filters.push(e)},Xy.prototype.trigger=function(e,t){var n,r,i=this._modeling;if(!(e.length<3||(this._setOrientation(t),r=this._filterElements(e),(n=this._createGroups(r)).length<=2)))return i.distributeElements(n,this._axis,this._dimension),n},Xy.prototype._filterElements=function(e){var t=this._filters,n=this._axis,r=this._dimension,i=[].concat(e);return t.length?(v(t,(function(e){i=e(i,n,r)})),i):e},Xy.prototype._createGroups=function(e){var t=[],n=this,r=this._axis,i=this._dimension;if(!r)throw new Error('must have a defined "axis" and "dimension"');return v(T(e,r),(function(e,o){var s,a=n._findRange(e,r,i),l=t[t.length-1];l&&n._hasIntersection(l.range,a)?t[t.length-1].elements.push(e):(s={range:a,elements:[e]},t.push(s))})),t},Xy.prototype._setOrientation=function(e){var t=Zy[e];this._axis=t[0],this._dimension=t[1]},Xy.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)},Xy.prototype._findRange=function(e){var t=e[this._axis];return{min:t+5,max:t+e[this._dimension]-5}};var Yy={__init__:["distributeElements"],distributeElements:["type",Xy]};function Ky(e){tc.call(this,e)}Ky.$inject=["eventBus"],e(Ky,tc),Ky.prototype.init=function(){this.addRule("elements.distribute",(function(e){var t=e.elements;return!((t=ht(t=y(t,(function(e){var t=Ei(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 Jy={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 ev(e,t,n,r){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=r,e.registerProvider("align-elements",900,this)}ev.$inject=["popupMenu","distributeElements","translate","rules"],ev.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&I(t,this._getEntries(e)),t},ev.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},ev.prototype._getEntries=function(e){var t=this._distributeElements,n=this._translate,r=this._popupMenu;return{"distribute-elements-horizontal":{group:"distribute",title:n("Distribute elements horizontally"),className:"bjs-align-elements-menu-entry",imageHtml:Jy.horizontal,action:function(n,i){t.trigger(e,"horizontal"),r.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:Jy.vertical,action:function(n,i){t.trigger(e,"vertical"),r.close()}}}};var tv={__depends__:[Xl,Yy],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",Ky],distributeElementsMenuProvider:["type",ev]},nv="is not a registered action";function rv(e,t){this._actions={};var n=this;e.on("diagram.init",(function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})}))}function iv(e,t){return new Error(e+" "+t)}rv.$inject=["eventBus","injector"],rv.prototype._registerDefaultActions=function(e){var t=e.get("commandStack",!1),n=e.get("modeling",!1),r=e.get("selection",!1),i=e.get("zoomScroll",!1),o=e.get("copyPaste",!1),s=e.get("canvas",!1),a=e.get("rules",!1),l=e.get("keyboardMove",!1),p=e.get("keyboardMoveSelection",!1);t&&(this.register("undo",(function(){t.undo()})),this.register("redo",(function(){t.redo()}))),o&&r&&this.register("copy",(function(){var e=r.get();if(e.length)return o.copy(e)})),o&&this.register("paste",(function(){o.paste()})),i&&this.register("stepZoom",(function(e){i.stepZoom(e.value)})),s&&this.register("zoom",(function(e){s.zoom(e.value)})),n&&r&&a&&this.register("removeSelection",(function(){var e=r.get();if(e.length){var t,i=a.allowed("elements.delete",{elements:e});!1!==i&&(t=c(i)?i:e).length&&n.removeElements(t.slice())}})),l&&this.register("moveCanvas",(function(e){l.moveCanvas(e)})),p&&this.register("moveSelection",(function(e){p.moveSelection(e.direction,e.accelerated)}))},rv.prototype.trigger=function(e,t){if(!this._actions[e])throw iv(e,nv);return this._actions[e](t)},rv.prototype.register=function(e,t){var n=this;if("string"==typeof e)return this._registerAction(e,t);v(e,(function(e,t){n._registerAction(t,e)}))},rv.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw iv(e,"is already registered");this._actions[e]=t},rv.prototype.unregister=function(e){if(!this.isRegistered(e))throw iv(e,nv);this._actions[e]=void 0},rv.prototype.getActions=function(){return Object.keys(this._actions)},rv.prototype.isRegistered=function(e){return!!this._actions[e]};var ov={__init__:["editorActions"],editorActions:["type",rv]};function sv(e){e.invoke(rv,this)}e(sv,rv),sv.$inject=["injector"],sv.prototype._registerDefaultActions=function(e){rv.prototype._registerDefaultActions.call(this,e);var t=e.get("canvas",!1),n=e.get("elementRegistry",!1),r=e.get("selection",!1),i=e.get("spaceTool",!1),o=e.get("lassoTool",!1),s=e.get("handTool",!1),a=e.get("globalConnect",!1),l=e.get("distributeElements",!1),c=e.get("alignElements",!1),p=e.get("directEditing",!1),u=e.get("searchPad",!1),d=e.get("modeling",!1),h=e.get("contextPad",!1);t&&n&&r&&this._registerAction("selectElements",(function(){var e=t.getRootElement(),i=n.filter((function(t){return t!==e}));return r.select(i),i})),i&&this._registerAction("spaceTool",(function(){i.toggle()})),o&&this._registerAction("lassoTool",(function(){o.toggle()})),s&&this._registerAction("handTool",(function(){s.toggle()})),a&&this._registerAction("globalConnectTool",(function(){a.toggle()})),r&&l&&this._registerAction("distributeElements",(function(e){var t=r.get(),n=e.type;t.length&&l.trigger(t,n)})),r&&c&&this._registerAction("alignElements",(function(e){var t=r.get(),n=[],i=e.type;t.length&&(n=y(t,(function(e){return!ki(e,"bpmn:Lane")})),c.trigger(n,i))})),r&&d&&this._registerAction("setColor",(function(e){var t=r.get();t.length&&d.setColor(t,e)})),r&&p&&this._registerAction("directEditing",(function(){var e=r.get();e.length&&p.activate(e[0])})),u&&this._registerAction("find",(function(){u.toggle()})),t&&d&&this._registerAction("moveToOrigin",(function(){var e,r,i=t.getRootElement();e=vt(r=ki(i,"bpmn:Collaboration")?n.filter((function(e){return ki(e.parent,"bpmn:Collaboration")})):n.filter((function(e){return e!==i&&!ki(e.parent,"bpmn:SubProcess")}))),d.moveElements(r,{x:-e.x,y:-e.y},i)})),r&&h&&this._registerAction("replaceElement",(function(e){h.triggerEntry("replace","click",e)}))};var av={__depends__:[ov],editorActions:["type",sv]};function lv(e){e.on(["create.init","shape.move.init"],(function(e){var t=e.context;Ei(e.shape,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(t.gridSnappingContext||(t.gridSnappingContext={}),t.gridSnappingContext.snapLocation="top-left")}))}lv.$inject=["eventBus"];var cv=10;function pv(e,t,n){return n||(n="round"),Math[n](e/t)*t}function uv(e,t,n){var r=!n||!1!==n.active;this._eventBus=t;var i=this;t.on("diagram.init",800,(function(){i.setActive(r)})),t.on(["create.move","create.end","bendpoint.move.move","bendpoint.move.end","connect.move","connect.end","connectionSegment.move.move","connectionSegment.move.end","resize.move","resize.end","shape.move.move","shape.move.end"],1200,(function(t){var n=t.originalEvent;if(!(!i.active||n&&zs(n))){var r=t.context,o=r.gridSnappingContext;o||(o=r.gridSnappingContext={}),["x","y"].forEach((function(n){var r={},o=function(e,t,n){var r=e.context,i=e.shape,o=r.gridSnappingContext,s=o.snapLocation,a=o.snapOffset;if(a&&u(a[t]))return a[t];a||(a=o.snapOffset={});u(a[t])||(a[t]=0);if(!i)return a[t];n.get(i.id)||(dv(t)?a[t]+=i[t]+i.width/2:a[t]+=i[t]+i.height/2);if(!s)return a[t];"x"===t?/left/.test(s)?a[t]-=i.width/2:/right/.test(s)&&(a[t]+=i.width/2):/top/.test(s)?a[t]-=i.height/2:/bottom/.test(s)&&(a[t]+=i.height/2);return a[t]}(t,n,e);o&&(r.offset=o);var s=function(e,t){var n=e.context,r=n.createConstraints,i=n.resizeConstraints||{},o=n.gridSnappingContext,s=o.snapConstraints;if(s&&s[t])return s[t];s||(s=o.snapConstraints={});s[t]||(s[t]={});var a=n.direction;r&&(dv(t)?(s.x.min=r.left,s.x.max=r.right):(s.y.min=r.top,s.y.max=r.bottom));var l=i.min,c=i.max;l&&(dv(t)?fv(a)?s.x.max=l.left:s.x.min=l.right:hv(a)?s.y.max=l.top:s.y.min=l.bottom);c&&(dv(t)?fv(a)?s.x.min=c.left:s.x.max=c.right:hv(a)?s.y.min=c.top:s.y.max=c.bottom);return s[t]}(t,n);s&&I(r,s),Sp(t,n)||i.snapEvent(t,n,r)}))}}))}function dv(e){return"x"===e}function hv(e){return-1!==e.indexOf("n")}function fv(e){return-1!==e.indexOf("w")}function mv(e,t){Ho.call(this,e),this._gridSnapping=t;var n=this;this.preExecute("shape.resize",(function(e){var t=e.context,r=(t.hints||{}).autoResize;if(r){var i=t.shape,o=t.newBounds;h(r)?t.newBounds=n.snapComplex(o,r):t.newBounds=n.snapSimple(i,o)}}))}uv.prototype.snapEvent=function(e,t,n){Cp(e,t,this.snapValue(e[t],n))},uv.prototype.getGridSpacing=function(){return cv},uv.prototype.snapValue=function(e,t){var n,r,i=0;return t&&t.offset&&(i=t.offset),e=pv(e+=i,cv),t&&t.min&&u(n=t.min)&&(n=pv(n+i,cv,"ceil"),e=Math.max(e,n)),t&&t.max&&u(r=t.max)&&(r=pv(r+i,cv,"floor"),e=Math.min(e,r)),e-=i},uv.prototype.isActive=function(){return this.active},uv.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},uv.prototype.toggleActive=function(){this.setActive(!this.active)},uv.$inject=["elementRegistry","eventBus","config.gridSnapping"],mv.$inject=["eventBus","gridSnapping","modeling"],e(mv,Ho),mv.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},mv.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},mv.prototype.snapHorizontally=function(e,t){var n=this._gridSnapping,r=/w/.test(t),i=/e/.test(t),o={};return o.width=n.snapValue(e.width,{min:e.width}),i&&(r?(o.x=n.snapValue(e.x,{max:e.x}),o.width+=n.snapValue(e.x-o.x,{min:e.x-o.x})):e.x=e.x+e.width-o.width),I(e,o),e},mv.prototype.snapVertically=function(e,t){var n=this._gridSnapping,r=/n/.test(t),i=/s/.test(t),o={};return o.height=n.snapValue(e.height,{min:e.height}),r&&(i?(o.y=n.snapValue(e.y,{max:e.y}),o.height+=n.snapValue(e.y-o.y,{min:e.y-o.y})):e.y=e.y+e.height-o.height),I(e,o),e};function gv(e,t){e.on(["spaceTool.move","spaceTool.end"],2e3,(function(e){var n,r=e.context;r.initialized&&("x"===r.axis?(n=t.snapValue(e.dx),e.x=e.x+n-e.dx,e.dx=n):(n=t.snapValue(e.dy),e.y=e.y+n-e.dy,e.dy=n))}))}gv.$inject=["eventBus","gridSnapping"];var yv={__depends__:[{__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",mv],gridSnappingSpaceToolBehavior:["type",gv]}],__init__:["gridSnapping"],gridSnapping:["type",uv]};function vv(e,t,n){e.on("autoPlace",2e3,(function(e){var r=e.source,i=wn(r),o=e.shape,s=yc(r,o,n);return["x","y"].forEach((function(e){var n={};s[e]!==i[e]&&(s[e]>i[e]?n.min=s[e]:n.max=s[e],ki(o,"bpmn:TextAnnotation")&&(!function(e){return"x"===e}(e)?n.offset=-o.height/2:n.offset=-o.width/2),s[e]=t.snapValue(s[e],n))})),s}))}vv.$inject=["eventBus","gridSnapping","elementRegistry"];function bv(e,t,n){t.on(["create.start","shape.move.start"],1750,(function(t){var r=t.context,i=r.shape,o=e.getRootElement();ki(i,"bpmn:Participant")&&ki(o,"bpmn:Process")&&o.children.length&&(r.createConstraints&&(i.width=n.snapValue(i.width,{min:i.width}),i.height=n.snapValue(i.height,{min:i.height})))}))}bv.$inject=["canvas","eventBus","gridSnapping"];function wv(e,t,n){Ho.call(this,e),this._gridSnapping=t;var r=this;this.postExecuted(["connection.create","connection.layout"],3e3,(function(e){var t=e.context,i=t.connection,o=t.hints||{},s=i.waypoints;o.connectionStart||o.connectionEnd||!1===o.createElementsBehavior||function(e){return e.length>3}(s)&&n.updateWaypoints(i,r.snapMiddleSegments(s))}))}function xv(e,t,n){var r=Mt(t,n),i={};return function(e){return"h"===e}(r)&&(i.y=e.snapValue(t.y)),function(e){return"v"===e}(r)&&(i.x=e.snapValue(t.x)),("x"in i||"y"in i)&&(t=I({},t,i),n=I({},n,i)),[t,n]}wv.$inject=["eventBus","gridSnapping","modeling"],e(wv,Ho),wv.prototype.snapMiddleSegments=function(e){var t,n=this._gridSnapping;e=e.slice();for(var r=1;r<e.length-2;r++)t=xv(n,e[r],e[r+1]),e[r]=t[0],e[r+1]=t[1];return e};var _v={__depends__:[yv,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",vv],gridSnappingParticipantBehavior:["type",bv],gridSnappingLayoutConnectionBehavior:["type",wv]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",lv]};function kv(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],(function(e){var t=e.element,r=e.gfx;return ki(t,"bpmn:Lane")?n._createParticipantHit(t,r):ki(t,"bpmn:Participant")?Vi(t)?n._createParticipantHit(t,r):n._createDefaultHit(t,r):ki(t,"bpmn:SubProcess")?Vi(t)?n._createSubProcessHit(t,r):n._createDefaultHit(t,r):void 0}))}kv.$inject=["eventBus","interactionEvents"],kv.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},kv.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=Hi(e)?{width:30,height:e.height}:{width:e.width,height:30};return this._interactionEvents.createBoxHit(t,"all",n),!0},kv.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 Ev={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",kv]};function Ov(e){e.invoke(Gs,this)}e(Ov,Gs),Ov.$inject=["injector"],Ov.prototype.registerBindings=function(e,t){function n(n,r){t.isRegistered(n)&&e.addListener(r)}Gs.prototype.registerBindings.call(this,e,t),n("selectElements",(function(n){var r=n.keyEvent;if(e.isKey(["a","A"],r)&&e.isCmd(r))return t.trigger("selectElements"),!0})),n("find",(function(n){var r=n.keyEvent;if(e.isKey(["f","F"],r)&&e.isCmd(r))return t.trigger("find"),!0})),n("spaceTool",(function(n){var r=n.keyEvent;if(!e.hasModifier(r))return e.isKey(["s","S"],r)?(t.trigger("spaceTool"),!0):void 0})),n("lassoTool",(function(n){var r=n.keyEvent;if(!e.hasModifier(r))return e.isKey(["l","L"],r)?(t.trigger("lassoTool"),!0):void 0})),n("handTool",(function(n){var r=n.keyEvent;if(!e.hasModifier(r))return e.isKey(["h","H"],r)?(t.trigger("handTool"),!0):void 0})),n("globalConnectTool",(function(n){var r=n.keyEvent;if(!e.hasModifier(r))return e.isKey(["c","C"],r)?(t.trigger("globalConnectTool"),!0):void 0})),n("directEditing",(function(n){var r=n.keyEvent;if(!e.hasModifier(r))return e.isKey(["e","E"],r)?(t.trigger("directEditing"),!0):void 0})),n("replaceElement",(function(n){var r=n.keyEvent;if(!e.hasModifier(r))return e.isKey(["r","R"],r)?(t.trigger("replaceElement",r),!0):void 0}))};var Pv={__depends__:[Qs],__init__:["keyboardBindings"],keyboardBindings:["type",Ov]},Sv={moveSpeed:1,moveSpeedAccelerated:10},Cv="left",Tv="right",Mv="down",Av={ArrowLeft:Cv,Left:Cv,ArrowUp:"up",Up:"up",ArrowRight:Tv,Right:Tv,ArrowDown:Mv,Down:Mv},Dv={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 Nv(e,t,n,r,i){var o=this;this._config=I({},Sv,e||{}),t.addListener(1500,(function(e){var n=e.keyEvent,r=Av[n.key];if(r&&!t.isCmd(n)){var i=t.isShift(n);return o.moveSelection(r,i),!0}})),this.moveSelection=function(e,t){var o=i.get();if(o.length){var s=this._config[t?"moveSpeedAccelerated":"moveSpeed"],a=Dv[e](s);r.allowed("elements.move",{shapes:o})&&n.moveElements(o,a)}}}Nv.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];var Rv={__depends__:[Qs,Ds],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",Nv]};function jv(e,t,n,r){this._dragging=r,this._rules=t;var i=this;function o(e,t){var n,r=e.shape,o=e.direction,s=e.resizeConstraints;e.delta=t,n=function(e,t,n){var r=n.x,i=n.y,o={x:e.x,y:e.y,width:e.width,height:e.height};return-1!==t.indexOf("n")?(o.y=e.y+i,o.height=e.height-i):-1!==t.indexOf("s")&&(o.height=e.height+i),-1!==t.indexOf("e")?o.width=e.width+r:-1!==t.indexOf("w")&&(o.x=e.x+r,o.width=e.width-r),o}(r,o,t),e.newBounds=function(e,t){if(!t)return e;var n=yn(e);return vn({top:Ou("top",n,t),right:Ou("right",n,t),bottom:Ou("bottom",n,t),left:Ou("left",n,t)})}(n,s),e.canExecute=i.canResize(e)}e.on("resize.start",(function(e){var t,n,r;t=e.context,n=t.resizeConstraints,r=t.minBounds,void 0===n&&(void 0===r&&(r=i.computeMinResizeBox(t)),t.resizeConstraints={min:yn(r)})})),e.on("resize.move",(function(e){var t={x:e.dx,y:e.dy};o(e.context,t)})),e.on("resize.end",(function(e){!function(e){var t=e.shape,r=e.canExecute,i=e.newBounds;if(r){if(!function(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}(t,i=mn(i)))return;n.resizeShape(t,i)}}(e.context)}))}function Lv(e,t){var n=wn(e),r=yn(e),i={x:n.x,y:n.y};return-1!==t.indexOf("n")?i.y=r.top:-1!==t.indexOf("s")&&(i.y=r.bottom),-1!==t.indexOf("e")?i.x=r.right:-1!==t.indexOf("w")&&(i.x=r.left),i}function Iv(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"}jv.prototype.canResize=function(e){var t=this._rules,n=$(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},jv.prototype.activate=function(e,t,n){var r,i,o=this._dragging;if("string"==typeof n&&(n={direction:n}),!(i=(r=I({shape:t},n)).direction))throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");o.init(e,Lv(t,i),"resize",{autoActivate:!0,cursor:Iv(i),data:{shape:t,context:r}})},jv.prototype.computeMinResizeBox=function(e){var t=e.shape;return function(e,t,n,r){var i=yn(t),o={top:/n/.test(e)?i.bottom-n.height:i.top,left:/w/.test(e)?i.right-n.width:i.left,bottom:/s/.test(e)?i.top+n.height:i.bottom,right:/e/.test(e)?i.left+n.width:i.right},s=r?yn(r):o;return vn({top:_u(o.top,s.top),left:_u(o.left,s.left),bottom:xu(o.bottom,s.bottom),right:xu(o.right,s.right)})}(e.direction,t,e.minDimensions||{width:10,height:10},Cu(t,e.childrenBoxPadding))},jv.$inject=["eventBus","rules","modeling","dragging"];var zv="djs-resizing",Bv="resize-not-ok";function $v(e,t,n){e.on("resize.move",500,(function(e){var r,i,o,s;r=e.context,i=r.shape,o=r.newBounds,(s=r.frame)||(s=r.frame=n.addFrame(i,t.getActiveLayer()),t.addMarker(i,zv)),o.width>5&&Oe(s,{x:o.x,width:o.width}),o.height>5&&Oe(s,{y:o.y,height:o.height}),r.canExecute?Se(s).remove(Bv):Se(s).add(Bv)})),e.on("resize.cleanup",(function(e){var n,r;n=e.context,r=n.shape,n.frame&&Ue(n.frame),t.removeMarker(r,zv)}))}$v.$inject=["eventBus","canvas","previewSupport"];var qv=-6,Fv="djs-resizer",Vv=["n","w","s","e","nw","ne","se","sw"];function Hv(e,t,n,r){this._resize=r,this._canvas=t;var i=this;e.on("selection.changed",(function(e){var t=e.newSelection;i.removeResizers(),1===t.length&&v(t,L(i.addResizer,i))})),e.on("shape.changed",(function(e){var t=e.element;n.isSelected(t)&&(i.removeResizers(),i.addResizer(t))}))}Hv.prototype.makeDraggable=function(e,t,n){var r=this._resize;function i(t){bs(t)&&r.activate(t,e,n)}ce.bind(t,"mousedown",i),ce.bind(t,"touchstart",i)},Hv.prototype._createResizer=function(e,t,n,r){var i=this._getResizersParent(),o=function(e){var t={x:0,y:0};-1!==e.indexOf("e")?t.x=6:-1!==e.indexOf("w")&&(t.x=qv);-1!==e.indexOf("s")?t.y=6:-1!==e.indexOf("n")&&(t.y=qv);return t}(r),s=Re("g");Se(s).add(Fv),Se(s).add(Fv+"-"+e.id),Se(s).add(Fv+"-"+r),xe(i,s);var a=Re("rect");Oe(a,{x:-4+o.x,y:-4+o.y,width:8,height:8}),Se(a).add(Fv+"-visual"),xe(s,a);var l=Re("rect");return Oe(l,{x:-10+o.x,y:-10+o.y,width:20,height:20}),Se(l).add(Fv+"-hit"),xe(s,l),Xn(s,t,n),s},Hv.prototype.createResizer=function(e,t){var n=Lv(e,t),r=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,r,t)},Hv.prototype.addResizer=function(e){var t=this;!hn(e)&&this._resize.canResize({shape:e})&&v(Vv,(function(n){t.createResizer(e,n)}))},Hv.prototype.removeResizers=function(){Te(this._getResizersParent())},Hv.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},Hv.$inject=["eventBus","canvas","selection","resize"];var Uv={__depends__:[Ic,Dc,Wp],__init__:["resize","resizePreview","resizeHandles"],resize:["type",jv],resizePreview:["type",$v],resizeHandles:["type",Hv]};function Wv(e,t,n,r,i,o,s){function a(e,t){(t||Ei(e,["bpmn:Task","bpmn:TextAnnotation","bpmn:Participant"])||Gv(e))&&r.activate(e)}this._bpmnFactory=t,this._canvas=n,this._modeling=i,this._textRenderer=s,r.registerProvider(this),e.on("element.dblclick",(function(e){a(e.element,!0)})),e.on(["autoPlace.start","canvas.viewbox.changing","drag.init","element.mousedown","popupMenu.open","root.set","selection.changed"],(function(){r.isActive()&&r.complete()})),e.on(["shape.remove","connection.remove"],2e3,(function(e){r.isActive(e.element)&&r.cancel()})),e.on(["commandStack.changed"],(function(e){r.isActive()&&r.cancel()})),e.on("directEditing.activate",(function(e){o.removeResizers()})),e.on("create.end",500,(function(e){var t=e.context,n=t.shape,r=e.context.canExecute;e.isTouch||r&&(t.hints&&!1===t.hints.createElementsBehavior||a(n))})),e.on("autoPlace.end",500,(function(e){a(e.shape)}))}function Gv(e){return ki(e,"bpmn:SubProcess")&&!Vi(e)}Wv.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],Wv.prototype.activate=function(e){var t=to(e);if(void 0!==t){var n={text:t};I(n,this.getEditingBBox(e));var r={},i=n.style||{};return I(i,{backgroundColor:null,border:null}),(Ei(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||Gv(e))&&I(r,{centerVertically:!0}),Xi(e)&&(I(r,{autoResize:!0}),I(i,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),ki(e,"bpmn:TextAnnotation")&&(I(r,{resizable:!0,autoResize:!0}),I(i,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),I(n,{options:r,style:i}),n}},Wv.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,r=t.getAbsoluteBBox(n),i=r.x+r.width/2,o=r.y+r.height/2,s={x:r.x,y:r.y},a=t.zoom(),l=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),p=c.fontSize*a,u=c.lineHeight,d=l.fontSize*a,h=l.lineHeight,f={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(ki(e,"bpmn:Lane")||function(e){return ki(e,"bpmn:Participant")&&Vi(e)}(e)){var m=Hi(e);I(s,m?{width:r.height,height:30*a,x:r.x-r.height/2+15*a,y:o-30*a/2}:{width:r.width,height:30*a}),I(f,{fontSize:d+"px",lineHeight:h,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:m?"rotate(-90deg)":null})}if(function(e){return ki(e,"bpmn:Participant")&&!Vi(e)}(e)){var g=Hi(e);I(s,g?{width:r.width,height:r.height}:{width:r.height,height:r.width,x:i-r.height/2,y:o-r.width/2}),I(f,{fontSize:d+"px",lineHeight:h,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:g?null:"rotate(-90deg)"})}(Ei(e,["bpmn:Task","bpmn:CallActivity"])||Gv(e))&&(I(s,{width:r.width,height:r.height}),I(f,{fontSize:d+"px",lineHeight:h,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),function(e){return ki(e,"bpmn:SubProcess")&&Vi(e)}(e)&&(I(s,{width:r.width,x:r.x}),I(f,{fontSize:d+"px",lineHeight:h,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var y=90*a,v=7*a,b=4*a;if(n.labelTarget&&(I(s,{width:y,height:r.height+v+b,x:i-y/2,y:r.y-v}),I(f,{fontSize:p+"px",lineHeight:u,paddingTop:v+"px",paddingBottom:b+"px"})),Xi(n)&&!Yi(n)&&!fn(n)){var w=Ji(e),x=t.getAbsoluteBBox({x:w.x,y:w.y,width:0,height:0}),_=p+v+b;I(s,{width:y,height:_,x:x.x-y/2,y:x.y-_/2}),I(f,{fontSize:p+"px",lineHeight:u,paddingTop:v+"px",paddingBottom:b+"px"})}return ki(e,"bpmn:TextAnnotation")&&(I(s,{width:r.width,height:r.height,minWidth:30*a,minHeight:10*a}),I(f,{textAlign:"left",paddingTop:5*a+"px",paddingBottom:7*a+"px",paddingLeft:7*a+"px",paddingRight:5*a+"px",fontSize:d+"px",lineHeight:h})),{bounds:s,style:f}},Wv.prototype.update=function(e,t,n,r){var i,o,s;ki(e,"bpmn:TextAnnotation")&&(o=this._canvas.getAbsoluteBBox(e),i={x:e.x,y:e.y,width:e.width/o.width*r.width,height:e.height/o.height*r.height}),(s=t)&&s.trim()||(t=null),this._modeling.updateLabel(e,t,i)};var Qv="djs-element-hidden",Zv="djs-label-hidden";function Xv(e,t,n){var r,i,o,s=this,a=t.getDefaultLayer();e.on("directEditing.activate",(function(e){var l=e.active;if(ki(r=l.element.label||l.element,"bpmn:TextAnnotation")){i=t.getAbsoluteBBox(r),o=Re("g");var c=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:r.width,containerHeight:r.height,position:{mx:0,my:0}}),p=s.path=Re("path");Oe(p,{d:c,strokeWidth:2,stroke:Yv(r)}),xe(o,p),xe(a,o),Yn(o,r.x,r.y)}ki(r,"bpmn:TextAnnotation")||r.labelTarget?t.addMarker(r,Qv):(ki(r,"bpmn:Task")||ki(r,"bpmn:CallActivity")||ki(r,"bpmn:SubProcess")||ki(r,"bpmn:Participant")||ki(r,"bpmn:Lane"))&&t.addMarker(r,Zv)})),e.on("directEditing.resize",(function(e){if(ki(r,"bpmn:TextAnnotation")){var t=e.height,o=e.dy,a=Math.max(r.height/i.height*(t+o),0),l=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:r.width,containerHeight:a,position:{mx:0,my:0}});Oe(s.path,{d:l})}})),e.on(["directEditing.complete","directEditing.cancel"],(function(e){var n=e.active;n&&(t.removeMarker(n.element.label||n.element,Qv),t.removeMarker(r,Zv)),r=void 0,i=void 0,o&&(Ue(o),o=void 0)}))}function Yv(e,t){return Pi(e).get("stroke")||t||"black"}Xv.$inject=["eventBus","canvas","pathMap"];var Kv={__depends__:[Vo,Uv,Py],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Wv],labelEditingPreview:["type",Xv]},Jv=new jo("tt");function eb(e,t){e.style.display=!1===t?"none":""}var tb="djs-tooltip",nb="."+tb;function rb(e,t){var n,r;this._eventBus=e,this._canvas=t,this._ids=Jv,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=(n=t.getContainer(),Z(r=ge('<div class="djs-tooltip-container" />'),{position:"absolute",width:"0",height:"0"}),n.insertBefore(r,n.firstChild),r);var i=this;de.bind(this._tooltipRoot,nb,"mousedown",(function(e){e.stopPropagation()})),de.bind(this._tooltipRoot,nb,"mouseover",(function(e){i.trigger("mouseover",e)})),de.bind(this._tooltipRoot,nb,"mouseout",(function(e){i.trigger("mouseout",e)})),this._init()}rb.$inject=["eventBus","canvas"],rb.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=I({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},rb.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,r=this.get(X(n,"data-tooltip-id"));r&&("mouseover"===e&&r.timeout&&this.clearTimeout(r),"mouseout"===e&&r.timeout&&(r.timeout=1e3,this.setTimeout(r)))},rb.prototype.get=function(e){return"string"!=typeof e&&(e=e.id),this._tooltips[e]},rb.prototype.clearTimeout=function(e){if(e=this.get(e)){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},rb.prototype.setTimeout=function(e){if(e=this.get(e)){this.clearTimeout(e);var t=this;e.removeTimer=setTimeout((function(){t.remove(e)}),e.timeout)}},rb.prototype.remove=function(e){var t=this.get(e);t&&(we(t.html),we(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},rb.prototype.show=function(){eb(this._tooltipRoot)},rb.prototype.hide=function(){eb(this._tooltipRoot,!1)},rb.prototype._updateRoot=function(e){var t=e.scale||1,n=e.scale||1,r="matrix("+t+",0,0,"+n+","+-1*e.x*t+","+-1*e.y*n+")";this._tooltipRoot.style.transform=r,this._tooltipRoot.style["-ms-transform"]=r},rb.prototype._addTooltip=function(e){var t,n=e.id,r=e.html,i=this._tooltipRoot;r.get&&r.constructor.prototype.jquery&&(r=r.get(0)),h(r)&&(r=ge(r)),Z(t=ge('<div data-tooltip-id="'+n+'" class="'+tb+'">'),{position:"absolute"}),t.appendChild(r),e.type&&K(t).add("djs-tooltip-"+e.type),e.className&&K(t).add(e.className),e.htmlContainer=t,i.appendChild(t),this._tooltips[n]=e,this._updateTooltip(e)},rb.prototype._updateTooltip=function(e){var t=e.position;!function(e,t,n){Z(e,{left:t+"px",top:n+"px"})}(e.htmlContainer,t.x,t.y)},rb.prototype._updateTooltipVisibilty=function(e){v(this._tooltips,(function(t){var n=t.show,r=t.htmlContainer,i=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(i=!1),eb(r,i))}))},rb.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 ib={__init__:["tooltips"],tooltips:["type",rb]};function ob(e,t,n){e.on(["shape.move.rejected","create.rejected"],(function(e){var r,i,o=e.context,s=o.shape;ki(o.target,"bpmn:Collaboration")&&ki(s,"bpmn:FlowNode")&&(r=e,i=n("flow elements must be children of pools/participants"),t.add({position:{x:r.x+5,y:r.y+5},type:"error",timeout:2e3,html:"<div>"+i+"</div>"}))}))}ob.$inject=["eventBus","tooltips","translate"];var sb={__depends__:[ib],__init__:["modelingFeedback"],modelingFeedback:["type",ob]};function ab(e,t){this._eventBus=e,this.offset=5;var n=t.cls("djs-outline",["no-fill"]),r=this;function i(e){var t=Re("rect");return Oe(t,I({x:0,y:0,rx:4,width:100,height:100},n)),t}e.on(["shape.added","shape.changed"],500,(function(e){var t=e.element,n=e.gfx,o=ve(".djs-outline",n);o||xe(n,o=r.getOutline(t)||i()),r.updateShapeOutline(o,t)})),e.on(["connection.added","connection.changed"],(function(e){var t=e.element,n=e.gfx,o=ve(".djs-outline",n);o||xe(n,o=i()),r.updateConnectionOutline(o,t)}))}ab.prototype.updateShapeOutline=function(e,t){var n=!1,r=this._getProviders();r.length&&v(r,(function(r){n=n||r.updateOutline(t,e)})),n||Oe(e,{x:-this.offset,y:-this.offset,width:t.width+2*this.offset,height:t.height+2*this.offset})},ab.prototype.updateConnectionOutline=function(e,t){var n=vt(t);Oe(e,{x:n.x-this.offset,y:n.y-this.offset,width:n.width+2*this.offset,height:n.height+2*this.offset})},ab.prototype.registerProvider=function(e,t){t||(t=e,e=1e3),this._eventBus.on("outline.getProviders",e,(function(e){e.providers.push(t)}))},ab.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},ab.prototype.getOutline=function(e){var t;return v(this._getProviders(),(function(n){d(n.getOutline)&&(t=t||n.getOutline(e))})),t},ab.$inject=["eventBus","styles","elementRegistry"];function lb(e,t,n){this._canvas=t;var r=this;e.on("element.changed",(function(e){n.isSelected(e.element)&&r._updateMultiSelectionOutline(n.get())})),e.on("selection.changed",(function(e){var t=e.newSelection;r._updateMultiSelectionOutline(t)}))}lb.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");Te(t);var n=e.length>1;if(Se(this._canvas.getContainer())[n?"add":"remove"]("djs-multi-select"),n){var r=function(e){return{x:e.x-6,y:e.y-6,width:e.width+12,height:e.height+12}}(vt(e)),i=Re("rect");Oe(i,I({rx:3},r)),Se(i).add("djs-selection-outline"),xe(t,i)}},lb.$inject=["eventBus","canvas","selection"];var cb={__depends__:[Ds],__init__:["outline","multiSelectionOutline"],outline:["type",ab],multiSelectionOutline:["type",lb]},pb=Math.round;function ub(e,t,n,r,i){function o(e,t,n,r){return i.allowed("elements.move",{shapes:e,delta:t,position:n,target:r})}function s(e,n,r,i){if(p(r)&&(i=r,r=!1),!n.waypoints&&n.parent&&!Se(e.target).has("djs-hit-no-move")){var o=function(e){return{x:e.x+pb(e.width/2),y:e.y+pb(e.height/2)}}(n);return t.init(e,o,"shape.move",{cursor:"grabbing",autoActivate:r,data:{shape:n,context:i||{}}}),!0}}e.on("shape.move.start",1500,(function(e){var t=e.context,n=e.shape,i=r.get().slice();-1===i.indexOf(n)&&(i=[n]),i=function(e){var t=P(e,"id");return y(e,(function(e){for(;e=e.parent;)if(t[e.id])return!1;return!0}))}(i),I(t,{shapes:i,validatedShapes:i,shape:n})})),e.on("shape.move.start",1250,(function(e){var t=e.context,n=t.validatedShapes;if(!(t.canExecute=o(n)))return!1})),e.on("shape.move.move",500,(function(e){var t,n=e.context,r=n.validatedShapes,i=e.hover,s={x:e.dx,y:e.dy};t=o(r,s,{x:e.x,y:e.y},i),n.delta=s,n.canExecute=t,n.target=null!==t?i:null})),e.on("shape.move.end",(function(e){var t=e.context,r=t.delta,i=t.canExecute,o="attach"===i,s=t.shapes;if(!1===i)return!1;r.x=pb(r.x),r.y=pb(r.y),0===r.x&&0===r.y||n.moveElements(s,r,t.target,{primaryShape:t.shape,attach:o})})),e.on("element.mousedown",(function(e){if(bs(e)){var t=fs(e);if(!t)throw new Error("must supply DOM mousedown event");return s(t,e.element)}})),this.start=s}ub.$inject=["eventBus","dragging","modeling","selection","rules"];var db="djs-dragging",hb="drop-ok",fb="drop-not-ok",mb="new-parent",gb="attach-ok";function yb(e,t,n,i){function o(e){var t=function(e){var t=y(e,(function(t){return!hn(t)||m(e,M({id:t.source.id}))&&m(e,M({id:t.target.id}))}));return t}(s(e));return t}function s(e){var t=yt(e,!0),n=t.flatMap((e=>(e.incoming||[]).concat(e.outgoing||[]))),r=t.concat(n);return[...new Set(r)]}function a(e,n){[gb,hb,fb,mb].forEach((function(r){r===n?t.addMarker(e,r):t.removeMarker(e,r)}))}e.on("shape.move.start",499,(function(e){var a,l=e.context,c=l.shapes,p=l.allDraggedElements,u=o(c);if(!l.dragGroup){var d=Re("g");Oe(d,n.cls("djs-drag-group",["no-events"])),xe(t.getActiveLayer(),d),l.dragGroup=d}u.forEach((function(e){i.addDragger(e,l.dragGroup)})),v(p=p?r([p,s(c)]):s(c),(function(e){t.addMarker(e,db)})),l.allDraggedElements=p,l.differentParents=1!==(a=P(c,(function(e){return e.parent&&e.parent.id})),E(a).length)})),e.on("shape.move.move",499,(function(e){var t=e.context,n=t.dragGroup,r=t.target,i=t.shape.parent,o=t.canExecute;r&&("attach"===o?a(r,gb):t.canExecute&&i&&r.id!==i.id?a(r,mb):a(r,t.canExecute?hb:fb)),Yn(n,e.dx,e.dy)})),e.on(["shape.move.out","shape.move.cleanup"],(function(e){var t=e.context.target;t&&a(t,null)})),e.on("shape.move.cleanup",(function(e){var n=e.context,r=n.allDraggedElements,i=n.dragGroup;v(r,(function(e){t.removeMarker(e,db)})),i&&Ue(i)})),this.makeDraggable=function(e,n,r){i.addDragger(n,e.dragGroup),r&&t.addMarker(n,db),e.allDraggedElements?e.allDraggedElements.push(n):e.allDraggedElements=[n]}}yb.$inject=["eventBus","canvas","styles","previewSupport"];var vb={__depends__:[Os,Ds,cb,Ic,Dc,Wp],__init__:["move","movePreview"],move:["type",ub],movePreview:["type",yb]},bb=".djs-palette-toggle",wb=".entry",xb=bb+", "+wb,_b="djs-palette-",kb="open",Eb="two-column";function Ob(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 Pb(e,t){var n=t.getPaletteEntries();return d(n)?n(e):(v(n,(function(t,n){e[n]=t})),e)}Ob.$inject=["eventBus","canvas"],Ob.prototype.registerProvider=function(e,t){t||(t=e,e=1e3),this._eventBus.on("palette.getProviders",e,(function(e){e.providers.push(t)})),this._rebuild()},Ob.prototype.getEntries=function(){return this._getProviders().reduce(Pb,{})},Ob.prototype._rebuild=function(){this._diagramInitialized&&(this._getProviders().length&&(this._container||this._init(),this._update()))},Ob.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),r=this._container=ge(Ob.HTML_MARKUP);n.appendChild(r),K(n).add(_b+"shown"),de.bind(r,xb,"click",(function(t){if(ye(t.delegateTarget,bb))return e.toggle();e.trigger("click",t)})),ce.bind(r,"mousedown",(function(e){e.stopPropagation()})),de.bind(r,wb,"dragstart",(function(t){e.trigger("dragstart",t)})),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:r})},Ob.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},Ob.prototype._toggleState=function(e){e=e||{};var t,n=this._getParentContainer(),r=this._container,i=this._eventBus,o=K(r),s=K(n);t="twoColumn"in e?e.twoColumn:this._needsCollapse(n.clientHeight,this._entries||{}),o.toggle(Eb,t),s.toggle(_b+Eb,t),"open"in e&&(o.toggle(kb,e.open),s.toggle(_b+kb,e.open)),i.fire("palette.changed",{twoColumn:t,open:this.isOpen()})},Ob.prototype._update=function(){var e=ve(".djs-palette-entries",this._container),t=this._entries=this.getEntries();ee(e),v(t,(function(t,n){var r=t.group||"default",i=ve("[data-group="+Qo(r)+"]",e);i||(X(i=ge('<div class="group"></div>'),"data-group",r),e.appendChild(i));var o=t.html||(t.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=ge(o);if(i.appendChild(s),!t.separator&&(X(s,"data-action",n),t.title&&X(s,"title",t.title),t.className&&function(e,t){var n=K(e),r=c(t)?t:t.split(/\s+/g);r.forEach((function(e){n.add(e)}))}(s,t.className),t.imageUrl)){var a=ge("<img>");X(a,"src",t.imageUrl),s.appendChild(a)}})),this.open()},Ob.prototype.trigger=function(e,t,n){var r,i,o=t.delegateTarget||t.target;return o?(r=X(o,"data-action"),i=t.originalEvent||t,this.triggerEntry(r,e,i,n)):t.preventDefault()},Ob.prototype.triggerEntry=function(e,t,n,r){var i,o;if((i=this._entries[e])&&(o=i.action,!1!==this._eventBus.fire("palette.trigger",{entry:i,event:n}))){if(d(o)){if("click"===t)return o(n,r)}else if(o[t])return o[t](n,r);n.preventDefault()}},Ob.prototype._layoutChanged=function(){this._toggleState({})},Ob.prototype._needsCollapse=function(e,t){return e<46*Object.keys(t).length+50},Ob.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},Ob.prototype.open=function(){this._toggleState({open:!0})},Ob.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Ob.prototype.isActiveTool=function(e){return e&&this._activeTool===e},Ob.prototype.updateToolHighlight=function(e){var t;this._toolsContainer||(t=ve(".djs-palette-entries",this._container),this._toolsContainer=ve("[data-group=tools]",t)),v(this._toolsContainer.children,(function(t){var n=t.getAttribute("data-action");if(n){var r=K(t);n=n.replace("-tool",""),r.contains("entry")&&n===e?r.add("highlighted-entry"):r.remove("highlighted-entry")}}))},Ob.prototype.isOpen=function(){return K(this._container).has(kb)},Ob.prototype._getParentContainer=function(){return this._canvas.getContainer()},Ob.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';var Sb={__init__:["palette"],palette:["type",Ob]},Cb="crosshair";function Tb(e,t,n,r,i,o,s){this._selection=i,this._dragging=n,this._mouse=s;var a=this,l=function(e){var n,r=t.getActiveLayer();Oe(n=e.frame=Re("rect"),{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),xe(r,n)},c=function(e){var t=e.frame,n=e.bbox;Oe(t,{x:n.x,y:n.y,width:n.width,height:n.height})},p=function(e){e.frame&&Ue(e.frame)};o.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",(function(t){var n=t.originalEvent.target;(t.hover||n instanceof SVGElement)&&e.once("lasso.selection.ended",(function(){a.activateLasso(t.originalEvent,!0)}))})),e.on("lasso.end",0,(function(e){var t=e.context,n=Mb(e),i=r.filter((function(e){return e})),o=xs(e);a.select(i,n,o?t.selection:[])})),e.on("lasso.start",(function(e){var t=e.context;t.bbox=Mb(e),l(t),t.selection=i.get()})),e.on("lasso.move",(function(e){var t=e.context;t.bbox=Mb(e),c(t)})),e.on("lasso.cleanup",(function(e){var t=e.context;p(t)})),e.on("element.mousedown",1500,(function(e){if(xs(e))return a.activateLasso(e.originalEvent),!0}))}function Mb(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}}Tb.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],Tb.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:Cb,data:{context:{}}})},Tb.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:Cb,data:{context:{}},keepSelection:!0})},Tb.prototype.select=function(e,t,n=[]){var r=function(e,t){var n={};return v(e,(function(e){var r=e;r.waypoints&&(r=vt(r)),!u(t.y)&&r.x>t.x&&(n[e.id]=e),!u(t.x)&&r.y>t.y&&(n[e.id]=e),r.x>t.x&&r.y>t.y&&(u(t.width)&&u(t.height)&&r.width+r.x<t.width+t.x&&r.height+r.y<t.height+t.y?n[e.id]=e:u(t.width)&&u(t.height)||(n[e.id]=e))})),n}(e,t);this._selection.select([...n,...O(r)])},Tb.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Tb.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};var Ab={__depends__:[$f,bf],__init__:["lassoTool"],lassoTool:["type",Tb]},Db=1500,Nb="grab";function Rb(e,t,n,r,i,o){this._dragging=n,this._mouse=o;var s=this,a=r.get("keyboard",!1);i.registerTool("hand",{tool:"hand",dragging:"hand.move"}),e.on("element.mousedown",Db,(function(e){if(ws(e))return s.activateMove(e.originalEvent,!0),!1})),a&&a.addListener(Db,(function(e){if(jb(e.keyEvent)&&!s.isActive()){var t=s._mouse.getLastMoveEvent();s.activateMove(t,!!t)}}),"keyboard.keydown"),a&&a.addListener(Db,(function(e){jb(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!ws(t)&&n&&e.once("hand.move.ended",(function(e){s.activateHand(e.originalEvent,!0,!0)})),!1}))}function jb(e){return Bs("Space",e)}Rb.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Rb.prototype.activateMove=function(e,t,n){"object"==typeof t&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:Nb,data:{context:n||{}}})},Rb.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:Nb,data:{context:{reactivate:n}}})},Rb.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Rb.prototype.isActive=function(){var e=this._dragging.context();return!!e&&/^(hand|hand\.move)$/.test(e.prefix)};var Lb={__depends__:[$f,bf],__init__:["handTool"],handTool:["type",Rb]},Ib="connect-ok",zb="connect-not-ok";function Bb(e,t,n,r,i,o,s){var a=this;this._dragging=t,this._rules=o,this._mouse=s,i.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),e.on("global-connect.hover",(function(e){var t=e.context,n=e.hover,i=t.canStartConnect=a.canStartConnect(n);null!==i&&(t.startTarget=n,r.addMarker(n,i?Ib:zb))})),e.on(["global-connect.out","global-connect.cleanup"],(function(e){var t=e.context.startTarget,n=e.context.canStartConnect;t&&r.removeMarker(t,n?Ib:zb)})),e.on(["global-connect.ended"],(function(t){var r=t.context.startTarget,i={x:t.x,y:t.y};if(a.canStartConnect(r))return e.once("element.out",(function(){e.once(["connect.ended","connect.canceled"],(function(){e.fire("global-connect.drag.ended")})),n.start(null,r,i)})),!1}))}Bb.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],Bb.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},Bb.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},Bb.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Bb.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};var $b={__depends__:[Bp,Ic,Dc,$f,bf],globalConnect:["type",Bb]};function qb(e,t,n,r,i,o,s,a){this._palette=e,this._create=t,this._elementFactory=n,this._spaceTool=r,this._lassoTool=i,this._handTool=o,this._globalConnect=s,this._translate=a,e.registerProvider(this)}qb.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],qb.prototype.getPaletteEntries=function(){var e={},t=this._create,n=this._elementFactory,r=this._spaceTool,i=this._lassoTool,o=this._handTool,s=this._globalConnect,a=this._translate;function l(e,r,i,o,s){function a(r){var i=n.createShape(I({type:e},s));t.start(r,i)}return{group:r,className:i,title:o,action:{dragstart:a,click:a}}}function c(e){var r=n.createShape({type:"bpmn:SubProcess",x:0,y:0,isExpanded:!0}),i=n.createShape({type:"bpmn:StartEvent",x:40,y:82,parent:r});t.start(e,[r,i],{hints:{autoSelect:[r]}})}function p(e){t.start(e,n.createParticipantShape())}return I(e,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:a("Activate hand tool"),action:{click:function(e){o.activateHand(e)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:a("Activate lasso tool"),action:{click:function(e){i.activateSelection(e)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:a("Activate create/remove space tool"),action:{click:function(e){r.activateSelection(e)}}},"global-connect-tool":{group:"tools",className:"bpmn-icon-connection-multi",title:a("Activate global connect tool"),action:{click:function(e){s.start(e)}}},"tool-separator":{group:"tools",separator:!0},"create.start-event":l("bpmn:StartEvent","event","bpmn-icon-start-event-none",a("Create start event")),"create.intermediate-event":l("bpmn:IntermediateThrowEvent","event","bpmn-icon-intermediate-event-none",a("Create intermediate/boundary event")),"create.end-event":l("bpmn:EndEvent","event","bpmn-icon-end-event-none",a("Create end event")),"create.exclusive-gateway":l("bpmn:ExclusiveGateway","gateway","bpmn-icon-gateway-none",a("Create gateway")),"create.task":l("bpmn:Task","activity","bpmn-icon-task",a("Create task")),"create.data-object":l("bpmn:DataObjectReference","data-object","bpmn-icon-data-object",a("Create data object reference")),"create.data-store":l("bpmn:DataStoreReference","data-store","bpmn-icon-data-store",a("Create data store reference")),"create.subprocess-expanded":{group:"activity",className:"bpmn-icon-subprocess-expanded",title:a("Create expanded sub-process"),action:{dragstart:c,click:c}},"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:a("Create pool/participant"),action:{dragstart:p,click:p}},"create.group":l("bpmn:Group","artifact","bpmn-icon-group",a("Create group"))}),e};var Fb={__depends__:[Sb,yf,sm,Ab,Lb,$b,To],__init__:["paletteProvider"],paletteProvider:["type",qb]};function Vb(e,t,n,r,i){Ho.call(this,e),e.on("shape.move.move",250,(function(e){var o=e.context,s=o.canExecute;o.visualReplacements||(o.visualReplacements={}),s&&s.replacements?function(e){v(e.canExecute.replacements,(function(o){var s=o.oldElementId,a={type:o.newElementType};if(!e.visualReplacements[s]){var l=t.get(s);I(a,{x:l.x,y:l.y});var c=n.createShape(a);r.addShape(c,l.parent);var p=ve('[data-element-id="'+Qo(l.id)+'"]',e.dragGroup);p&&Oe(p,{display:"none"});var u=i.addDragger(c,e.dragGroup);e.visualReplacements[s]=u,r.removeShape(c)}}))}(o):function(e){var t=e.visualReplacements;v(t,(function(n,r){var i=ve('[data-element-id="'+Qo(r)+'"]',e.dragGroup);i&&Oe(i,{display:"inline"}),n.remove(),t[r]&&delete t[r]}))}(o)}))}Vb.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],e(Vb,Ho);var Hb={__depends__:[Wp],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",Vb]},Ub=40,Wb=20,Gb=10,Qb=20,Zb=["x","y"],Xb=Math.abs;function Yb(e){e.on(["connect.hover","connect.move","connect.end"],1250,(function(e){var t=e.context,n=t.canExecute,r=t.start,i=t.hover,o=t.source,s=t.target;e.originalEvent&&zs(e.originalEvent)||(t.initialConnectionStart||(t.initialConnectionStart=t.connectionStart),n&&i&&function(e,t,n){Zb.forEach((function(r){var i=ew(r,t);e[r]<t[r]+n?Cp(e,r,t[r]+n):e[r]>t[r]+i-n&&Cp(e,r,t[r]+i-n)}))}(e,i,function(e){return ki(e,"bpmn:Task")?Gb:Wb}(i)),i&&function(e,t){return _(t,(function(t){return Jb(e,t)}))}(n,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(t.connectionStart=Pp(r),Ei(i,["bpmn:Event","bpmn:Gateway"])&&Kb(e,Pp(i)),Ei(i,["bpmn:Task","bpmn:SubProcess"])&&function(e,t){var n=Pp(t);Zb.forEach((function(r){(function(e,t,n){return e[n]>t[n]+Qb&&e[n]<t[n]+ew(n,t)-Qb})(e,t,r)&&Cp(e,r,n[r])}))}(e,i),ki(o,"bpmn:BoundaryEvent")&&s===o.host&&function(e){var t=e.context,n=t.source,r=t.target;if(function(e){var t=e.hover,n=e.source;return t&&n&&t===n}(t))return;var i=Pp(n),o=xn(i,r,-10),s=[];/top|bottom/.test(o)&&s.push("x");/left|right/.test(o)&&s.push("y");s.forEach((function(t){var n,r=e[t];Xb(r-i[t])<Ub&&(n=r>i[t]?i[t]+Ub:i[t]-Ub,Cp(e,t,n))}))}(e)):Jb(n,"bpmn:MessageFlow")?(ki(r,"bpmn:Event")&&(t.connectionStart=Pp(r)),ki(i,"bpmn:Event")&&Kb(e,Pp(i))):t.connectionStart=t.initialConnectionStart)}))}function Kb(e,t){Cp(e,"x",t.x),Cp(e,"y",t.y)}function Jb(e,t){return e&&e.type===t}function ew(e,t){return"x"===e?t.width:t.height}function tw(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}function nw(){this._snapValues={}}Yb.$inject=["eventBus"],tw.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},tw.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,-1===this._snapLocations.indexOf(e)&&this._snapLocations.push(e)},tw.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},tw.prototype.getSnapLocations=function(){return this._snapLocations},tw.prototype.setSnapLocations=function(e){this._snapLocations=e},tw.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new nw).initDefaults(this._defaultSnaps),n},nw.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)},nw.prototype.snap=function(e,t,n,r){var i=this._snapValues[t];return i&&function(e,t,n){var r,i;for(n=void 0===n?10:n,r=0;r<t.length;r++)if(i=t[r],_p(i-e)<=n)return i}(e[n],i[n],r)},nw.prototype.initDefaults=function(e){var t=this;v(e||{},(function(e,n){v(e,(function(e){t.add(n,e)}))}))};var rw=1250;function iw(e,t,n){var r=this;this._elementRegistry=e,t.on(["create.start","shape.move.start"],(function(e){r.initSnap(e)})),t.on(["create.move","create.end","shape.move.move","shape.move.end"],rw,(function(e){var t=e.context,i=t.shape,o=t.snapContext,s=t.target;if((!e.originalEvent||!zs(e.originalEvent))&&!Sp(e)&&s){var a=o.pointsForTarget(s);a.initialized||((a=r.addSnapTargetPoints(a,i,s)).initialized=!0),n.snap(e,a)}})),t.on(["create.cleanup","shape.move.cleanup"],(function(){n.hide()}))}iw.$inject=["elementRegistry","eventBus","snapping"],iw.prototype.initSnap=function(e){var t,n=this._elementRegistry,r=e.context,i=r.shape,o=r.snapContext;o||(o=r.snapContext=new tw);var s=(t=n.get(i.id)?Pp(i,e):{x:e.x+Pp(i).x,y:e.y+Pp(i).y}).x-i.width/2,a=t.y-i.height/2,l=t.x+i.width/2,c=t.y+i.height/2;return o.setSnapOrigin("mid",{x:t.x-e.x,y:t.y-e.y}),fn(i)||(o.setSnapOrigin("top-left",{x:s-e.x,y:a-e.y}),o.setSnapOrigin("bottom-right",{x:l-e.x,y:c-e.y})),o},iw.prototype.addSnapTargetPoints=function(e,t,n){return v(this.getSnapTargets(t,n),(function(n){if(fn(n))fn(t)&&e.add("mid",Pp(n));else if(hn(n)){if(n.waypoints.length<3)return;v(n.waypoints.slice(1,-1),(function(t){e.add("mid",t)}))}else e.add("mid",Pp(n))})),u(t.x)&&u(t.y)?(this._elementRegistry.get(t.id)&&e.add("mid",Pp(t)),e):e},iw.prototype.getSnapTargets=function(e,t){return Tp(t).filter((function(e){return!e.hidden}))};function ow(e,t){t.invoke(iw,this),e.on(["create.move","create.end"],1500,sw),e.on(["create.move","create.end","shape.move.move","shape.move.end"],1500,(function(e){var t=e.context,n=t.canExecute,r=t.target;n&&("attach"===n||n.attach)&&!Sp(e)&&function(e,t){var n,r=yn(t),i=wh(e,t),o=e.context,s=o.shape;n=s.parent?{x:0,y:0}:wn(s);/top/.test(i)?Cp(e,"y",r.top-n.y):/bottom/.test(i)&&Cp(e,"y",r.bottom-n.y);/left/.test(i)?Cp(e,"x",r.left-n.x):/right/.test(i)&&Cp(e,"x",r.right-n.x)}(e,r)}))}function sw(e){var t=e.context.createConstraints;if(t){var n=t.top,r=t.right,i=t.bottom,o=t.left;(o&&o>=e.x||r&&r<=e.x)&&Cp(e,"x",e.x),(n&&n>=e.y||i&&i<=e.y)&&Cp(e,"y",e.y)}}function aw(e,t){return-1!==e.indexOf(t)}function lw(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}e(ow,iw),ow.$inject=["eventBus","injector"],ow.prototype.initSnap=function(e){var t=iw.prototype.initSnap.call(this,e),n=e.shape,r=!!this._elementRegistry.get(n.id);return v(n.outgoing,(function(n){var i=n.waypoints[0];i=i.original||i,t.setSnapOrigin(n.id+"-docking",lw(i,r,e))})),v(n.incoming,(function(n){var i=n.waypoints[n.waypoints.length-1];i=i.original||i,t.setSnapOrigin(n.id+"-docking",lw(i,r,e))})),ki(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},ow.prototype.addSnapTargetPoints=function(e,t,n){iw.prototype.addSnapTargetPoints.call(this,e,t,n);var r=this.getSnapTargets(t,n);v(r,(function(n){(function(e){if(ki(e,"bpmn:SubProcess")&&Vi(e))return!0;return ki(e,"bpmn:Participant")}(n)||function(e,t){return e.every((function(e){return ki(e,t)}))}([t,n],"bpmn:TextAnnotation"))&&(e.add("top-left",Ep(n)),e.add("bottom-right",Op(n)))}));var i=this._elementRegistry;return v(t.incoming,(function(n){if(i.get(t.id)){aw(r,n.source)||e.add("mid",wn(n.source));var o=n.waypoints[0];e.add(n.id+"-docking",o.original||o)}})),v(t.outgoing,(function(n){if(i.get(t.id)){aw(r,n.target)||e.add("mid",wn(n.target));var o=n.waypoints[n.waypoints.length-1];e.add(n.id+"-docking",o.original||o)}})),ki(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},ow.prototype.getSnapTargets=function(e,t){return iw.prototype.getSnapTargets.call(this,e,t).filter((function(e){return!ki(e,"bpmn:Lane")}))};function cw(e,t){var n=this;e.on(["resize.start"],(function(e){n.initSnap(e)})),e.on(["resize.move","resize.end"],1250,(function(e){var r=e.context,i=r.shape,o=i.parent,s=r.direction,a=r.snapContext;if(!(e.originalEvent&&zs(e.originalEvent)||Sp(e))){var l=a.pointsForTarget(o);l.initialized||((l=n.addSnapTargetPoints(l,i,o,s)).initialized=!0),function(e){return"n"===e||"s"===e}(s)&&Cp(e,"x",e.x),function(e){return"e"===e||"w"===e}(s)&&Cp(e,"y",e.y),t.snap(e,l)}})),e.on(["resize.cleanup"],(function(){t.hide()}))}function pw(e,t){var n=wn(e),r=yn(e),i={x:n.x,y:n.y};return-1!==t.indexOf("n")?i.y=r.top:-1!==t.indexOf("s")&&(i.y=r.bottom),-1!==t.indexOf("e")?i.x=r.right:-1!==t.indexOf("w")&&(i.x=r.left),i}cw.prototype.initSnap=function(e){var t=e.context,n=t.shape,r=t.direction,i=t.snapContext;i||(i=t.snapContext=new tw);var o=pw(n,r);return i.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),i},cw.prototype.addSnapTargetPoints=function(e,t,n,r){return v(this.getSnapTargets(t,n),(function(t){e.add("corner",Op(t)),e.add("corner",Ep(t))})),e.add("corner",pw(t,r)),e},cw.$inject=["eventBus","snapping"],cw.prototype.getSnapTargets=function(e,t){return Tp(t).filter((function(t){return!(n=t,r=e,n.host===r||hn(t)||function(e){return!!e.hidden}(t)||fn(t));var n,r}))};function uw(e){this._canvas=e,this._asyncHide=j(L(this.hide,this),1e3)}uw.$inject=["canvas"],uw.prototype.snap=function(e,t){var n=e.context.snapContext,r=n.getSnapLocations(),i={x:Sp(e,"x"),y:Sp(e,"y")};v(r,(function(r){var o=n.getSnapOrigin(r),s={x:e.x+o.x,y:e.y+o.y};if(v(["x","y"],(function(e){var n;i[e]||void 0!==(n=t.snap(s,r,e,7))&&(i[e]={value:n,originValue:n-o[e]})})),i.x&&i.y)return!1})),this.showSnapLine("vertical",i.x&&i.x.value),this.showSnapLine("horizontal",i.y&&i.y.value),v(["x","y"],(function(t){var n=i[t];p(n)&&Cp(e,t,n.originValue)}))},uw.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=Re("path");return Oe(n,{d:"M0,0 L0,0"}),Se(n).add("djs-snap-line"),xe(t,n),{update:function(t){u(t)?Oe(n,"horizontal"===e?{d:"M-100000,"+t+" L+100000,"+t,display:""}:{d:"M "+t+",-100000 L "+t+", +100000",display:""}):Oe(n,{display:"none"})}}},uw.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},uw.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},uw.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},uw.prototype.hide=function(){v(this._snapLines,(function(e){e.update()}))};var dw={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",iw],resizeSnapping:["type",cw],snapping:["type",uw]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",Yb],createMoveSnapping:["type",ow]};function hw(e,t,n,r){this._open=!1,this._results={},this._eventMaps=[],this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._canvas=e,this._eventBus=t,this._selection=n,this._translate=r,this._container=this._getBoxHtml(),this._searchInput=ve(hw.INPUT_SELECTOR,this._container),this._resultsContainer=ve(hw.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 fw(e,t,n){var r=function(e){var t="";return e.forEach((function(e){var n=Xo(e.value||e.matched||e.normal),r=e.match||e.matched;t+=r?'<b class="'+hw.RESULT_HIGHLIGHT_CLASS+'">'+n+"</b>":n})),""!==t?t:null}(t),i=ge(n);i.innerHTML=r,e.appendChild(i)}hw.$inject=["canvas","eventBus","selection","translate"],hw.prototype._bindEvents=function(){var e=this;function t(t,n,r,i){e._eventMaps.push({el:t,type:r,listener:de.bind(t,n,r,i)})}t(document,"html","click",(function(t){e.close(!1)})),t(this._container,hw.INPUT_SELECTOR,"click",(function(e){e.stopPropagation(),e.delegateTarget.focus()})),t(this._container,hw.RESULT_SELECTOR,"mouseover",(function(t){t.stopPropagation(),e._scrollToNode(t.delegateTarget),e._preselect(t.delegateTarget)})),t(this._container,hw.RESULT_SELECTOR,"click",(function(t){t.stopPropagation(),e._select(t.delegateTarget)})),t(this._container,hw.INPUT_SELECTOR,"keydown",(function(e){Bs("ArrowUp",e)&&e.preventDefault(),Bs("ArrowDown",e)&&e.preventDefault()})),t(this._container,hw.INPUT_SELECTOR,"keyup",(function(t){if(Bs("Escape",t))return e.close();if(Bs("Enter",t)){var n=e._getCurrentResult();return n?e._select(n):e.close(!1)}return Bs("ArrowUp",t)?e._scrollToDirection(!0):Bs("ArrowDown",t)?e._scrollToDirection():void(Bs(["ArrowLeft","ArrowRight"],t)||e._search(t.delegateTarget.value))}))},hw.prototype._unbindEvents=function(){this._eventMaps.forEach((function(e){de.unbind(e.el,e.type,e.listener)}))},hw.prototype._search=function(e){var t=this;if(this._clearResults(),e.trim()){var n=this._searchProvider.find(e);if((n=n.filter((function(e){return!t._canvas.getRootElements().includes(e.element)}))).length){n.forEach((function(e){var n=e.element.id,r=t._createResultNode(e,n);t._results[n]={element:e.element,node:r}}));var r=ve(hw.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(r),this._preselect(r)}else this._selection.select(null)}},hw.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},hw.prototype._scrollToNode=function(e){if(e&&e!==this._getCurrentResult()){var t=e.offsetTop,n=this._resultsContainer.scrollTop,r=t-this._resultsContainer.clientHeight+e.clientHeight;t<n?this._resultsContainer.scrollTop=t:n<r&&(this._resultsContainer.scrollTop=r)}},hw.prototype._clearResults=function(){ee(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},hw.prototype._getCurrentResult=function(){return ve(hw.RESULT_SELECTED_SELECTOR,this._resultsContainer)},hw.prototype._createResultNode=function(e,t){var n=ge(hw.RESULT_HTML);return e.primaryTokens.length>0&&fw(n,e.primaryTokens,hw.RESULT_PRIMARY_HTML),fw(n,e.secondaryTokens,hw.RESULT_SECONDARY_HTML),X(n,hw.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},hw.prototype.registerProvider=function(e){this._searchProvider=e},hw.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"))},hw.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())},hw.prototype.toggle=function(){this.isOpen()?this.close():this.open()},hw.prototype.isOpen=function(){return this._open},hw.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&K(t).remove(hw.RESULT_SELECTED_CLASS);var n=X(e,hw.RESULT_ID_ATTRIBUTE),r=this._results[n].element;K(e).add(hw.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(r,{top:300}),this._selection.select(r),this._eventBus.fire("searchPad.preselected",r)}},hw.prototype._select=function(e){var t=X(e,hw.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)},hw.prototype._getBoxHtml=function(){const e=ge(hw.BOX_HTML),t=ve(hw.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e},hw.CONTAINER_SELECTOR=".djs-search-container",hw.INPUT_SELECTOR=".djs-search-input input",hw.RESULTS_CONTAINER_SELECTOR=".djs-search-results",hw.RESULT_SELECTOR=".djs-search-result",hw.RESULT_SELECTED_CLASS="djs-search-result-selected",hw.RESULT_SELECTED_SELECTOR="."+hw.RESULT_SELECTED_CLASS,hw.RESULT_ID_ATTRIBUTE="data-result-id",hw.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",hw.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>',hw.RESULT_HTML='<div class="djs-search-result"></div>',hw.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',hw.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';var mw={__depends__:[To,qo,Ds],searchPad:["type",hw]};function gw(e,t,n,r){this._elementRegistry=e,this._canvas=n,this._search=r,t.registerProvider(this)}function yw(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}gw.$inject=["elementRegistry","searchPad","canvas","search"],gw.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(yw)};var vw={__depends__:[mw,Zl],__init__:["bpmnSearch"],bpmnSearch:["type",gw]};const bw={width:36,height:50},ww={width:50,height:50};function xw(e,t,n){return Re("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}function _w(e,t){this._styles=t,e.registerProvider(this)}function kw(e,t){var n;return"bpmn:DataObjectReference"===t?n=bw:"bpmn:DataStoreReference"===t&&(n=ww),e.width===n.width&&e.height===n.height}_w.$inject=["outline","styles"],_w.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(!fn(e))return ki(e,"bpmn:Gateway")?(I((n=Re("rect")).style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),Oe(n,I({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):Ei(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?Oe(n=Re("rect"),I({x:-5,y:-5,rx:14,width:e.width+10,height:e.height+10},t)):ki(e,"bpmn:EndEvent")?Oe(n=Re("circle"),I({cx:e.width/2,cy:e.height/2,r:e.width/2+5+1},t)):ki(e,"bpmn:Event")?Oe(n=Re("circle"),I({cx:e.width/2,cy:e.height/2,r:e.width/2+5},t)):ki(e,"bpmn:DataObjectReference")&&kw(e,"bpmn:DataObjectReference")?n=xw("M44.7648 11.3263L36.9892 2.64074C36.0451 1.58628 34.5651 0.988708 33.1904 0.988708H5.98667C3.22688 0.988708 0.989624 3.34892 0.989624 6.26039V55.0235C0.989624 57.9349 3.22688 60.2952 5.98667 60.2952H40.966C43.7257 60.2952 45.963 57.9349 45.963 55.0235V14.9459C45.963 13.5998 45.6407 12.3048 44.7648 11.3263Z",{x:-6,y:-6},t):ki(e,"bpmn:DataStoreReference")&&kw(e,"bpmn:DataStoreReference")&&(n=xw("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},_w.prototype.updateOutline=function(e,t){if(!fn(e))return Ei(e,["bpmn:SubProcess","bpmn:Group"])?(Oe(t,{width:e.width+10,height:e.height+10}),!0):!!Ei(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};var Ew={__depends__:[cb],__init__:["outlineProvider"],outlineProvider:["type",_w]};function Ow(e){Fi.call(this,e)}e(Ow,Fi),Ow.Viewer=Ns,Ow.NavigatedViewer=ha,Ow.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>')},Ow.prototype._interactionModules=[Ys,sa,da],Ow.prototype._modelingModules=[rc,wc,jc,Oc,Np,Bp,qp,Qy,Tf,yf,tv,av,_v,Ev,Pv,Rv,Kv,gy,sb,vb,Fb,Hb,Uv,dw,vw,Ew],Ow.prototype._modules=[].concat(Ns.prototype._modules,Ow.prototype._interactionModules,Ow.prototype._modelingModules);var Pw=new jo,Sw={min:.2,max:4};function Cw(e,t,n,r,i){var o=this;function s(e){o._state._svgClientRect&&!Nw(o._state._svgClientRect)||(o._state._svgClientRect=o._svg.getBoundingClientRect()),Mw(Tw({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=zw(t);o._state._svgClientRect&&!Nw(o._state._svgClientRect)||(o._state._svgClientRect=o._svg.getBoundingClientRect()),e&&s(n);var i=Tw({x:n.x-o._state._svgClientRect.left,y:n.y-o._state._svgClientRect.top},o._svg,o._lastViewbox),a=r.viewbox(),p=function(e,t){var n={x:t.x+t.width/2,y:t.y+t.height/2};return{x:e.x-n.x,y:e.y-n.y}}(i,a),u=o._viewportDom.getBoundingClientRect(),d={x:n.x-u.left+1,y:n.y-u.top+1};I(o._state,{cachedViewbox:a,initialDragPosition:{x:n.x,y:n.y},isDragging:!0,offsetViewport:p,offsetViewportDom:d,viewportClientRect:o._viewport.getBoundingClientRect(),parentClientRect:o._parent.getBoundingClientRect()}),ce.bind(document,"mousemove",l),ce.bind(document,"mouseup",c)}}function l(e){var t=zw(e);if(o._state.isDragging){o._state._svgClientRect&&!Nw(o._state._svgClientRect)||(o._state._svgClientRect=o._svg.getBoundingClientRect());var n=o._state.offsetViewportDom,r=o._state.viewportClientRect,i=o._state.parentClientRect;I(o._viewportDom.style,{top:t.y-n.y-i.top+"px",left:t.x-n.x-i.left+"px"});var s=jw(i,{top:t.y-n.y-i.top,left:t.x-n.x-i.left,width:r.width,height:r.height});I(o._overlay.style,{clipPath:s});var a=Tw({x:t.x-o._state._svgClientRect.left,y:t.y-o._state._svgClientRect.top},o._svg,o._lastViewbox);Mw({x:a.x-o._state.offsetViewport.x,y:a.y-o._state.offsetViewport.y},o._canvas)}}function c(e){var t=zw(e);o._state.isDragging&&(o._state.initialDragPosition.x===t.x&&o._state.initialDragPosition.y===t.y&&s(e),o._update(),I(o._state,{cachedViewbox:null,initialDragPosition:null,isDragging:!1,offsetViewport:null,offsetViewportDom:null}),ce.unbind(document,"mousemove",l),ce.unbind(document,"mouseup",c))}this._canvas=r,this._elementRegistry=i,this._eventBus=n,this._injector=t,this._state={isOpen:void 0,isDragging:!1,initialDragPosition:null,offsetViewport:null,cachedViewbox:null,dragger:null,svgClientRect:null,parentClientRect:null,zoomDelta:0},this._minimapId=Pw.next(),this._init(),this.toggle(e&&e.open||!1),ce.bind(this._viewportDom,"mousedown",a(!1)),ce.bind(this._svg,"mousedown",a(!0)),ce.bind(this._parent,"wheel",(function(e){if(e.preventDefault(),e.stopPropagation(),e.ctrlKey&&(o._state._svgClientRect&&!Nw(o._state._svgClientRect)||(o._state._svgClientRect=o._svg.getBoundingClientRect()),t=e,n=o._state._svgClientRect,t.x>n.left&&t.x<n.left+n.width&&t.y>n.top&&t.y<n.top+n.height)){var t,n,i,s,a,l,c=0===e.deltaMode?.02:.32,p=Math.sqrt(Math.pow(e.deltaY,2)+Math.pow(e.deltaX,2))*Rw(e.deltaY)*-c;if(o._state.zoomDelta+=p,Math.abs(o._state.zoomDelta)>.1){var u=p>0?1:-1,d=Math.log(r.zoom())/Math.log(10),h=(i=Sw,s=20,a=Math.log(i.min)/Math.log(10),l=Math.log(i.max)/Math.log(10),(Math.abs(a)+Math.abs(l))/s),f=Math.round(d/h)*h;f+=h*u;var m=Math.pow(10,f);r.zoom(function(e,t){return Math.max(e.min,Math.min(e.max,t))}(Sw,m),g),o._state.zoomDelta=0;var g=Tw({x:e.clientX-o._state._svgClientRect.left,y:e.clientY-o._state._svgClientRect.top},o._svg,o._lastViewbox);Mw(g,o._canvas),o._update()}}})),ce.bind(this._toggle,"click",(function(e){e.preventDefault(),e.stopPropagation(),o.toggle()})),n.on(["shape.added","connection.added"],(function(e){var t=e.element;o._addElement(t),o._update()})),n.on(["shape.removed","connection.removed"],(function(e){var t=e.element;o._removeElement(t),o._update()})),n.on("elements.changed",250,(function(e){e.elements.forEach((function(e){o._updateElement(e)})),o._update()})),n.on("element.updateId",(function(e){var t=e.element,n=e.newId;o._updateElementId(t,n)})),n.on("canvas.viewbox.changed",(function(){o._state.isDragging||o._update()})),n.on("canvas.resized",(function(){document.body.contains(o._parent)&&(o._state.isDragging||o._update(),o._state._svgClientRect=o._svg.getBoundingClientRect())})),n.on(["root.set","plane.set"],(function(e){o._clear(),(e.element||e.plane.rootElement).children.forEach((function(e){o._addElement(e)})),o._update()}))}function Tw(e,t,n){var r=t.getBoundingClientRect(),i=function(e,t){var n=e.width/e.height,r=I({},{x:e.x,y:e.y,width:e.width,height:e.height});if(n>t){var i=r.width*(1/t);I(r,{y:r.y-(i-r.height)/2,height:i})}else if(n<t){var o=r.height*t;I(r,{x:r.x-(o-r.width)/2,width:o})}return r}(n,r.width/r.height);return{x:Aw(e.x,0,r.width,i.x,i.x+i.width),y:Aw(e.y,0,r.height,i.y,i.y+i.height)}}function Mw(e,t){var n=t.viewbox(),r=n.width,i=n.height;t.viewbox({x:e.x-r/2,y:e.y-i/2,width:r,height:i})}function Aw(e,t,n,r,i){return(e-t)*(i-r)/(n-t)+r}function Dw(e,t,n){var r=function(e){var t=ve(".children",e);t||xe(e,t=Re("g",{class:"children"}));return t}(t),i=[].slice.call(r.childNodes)[n];i?t.insertBefore(e,i.nextSibling):t.appendChild(e)}function Nw(e){return 0===e.width&&0===e.height}Cw.$inject=["config.minimap","injector","eventBus","canvas","elementRegistry"],Cw.prototype._init=function(){var e=this._canvas.getContainer(),t=this._parent=document.createElement("div");K(t).add("djs-minimap"),e.appendChild(t);var n=this._toggle=document.createElement("div");K(n).add("toggle"),t.appendChild(n);var r=this._map=document.createElement("div");K(r).add("map"),t.appendChild(r);var i=this._svg=Re("svg");Oe(i,{width:"100%",height:"100%"}),xe(r,i),xe(i,this._elementsGroup=Re("g"));var o=this._viewportGroup=Re("g");xe(i,o);var s=this._viewport=Re("rect");Se(s).add("viewport"),xe(o,s),ce.bind(t,"mousedown",(function(e){e.stopPropagation()}));var a=this._viewportDom=document.createElement("div");K(a).add("viewport-dom"),this._parent.appendChild(a);var l=this._overlay=document.createElement("div");K(l).add("overlay"),this._parent.appendChild(l)},Cw.prototype._update=function(){var e=this._canvas.viewbox(),t=e.inner,n=e.outer;if(Iw(e)){var r,i,o,s,a=n.width-t.width,l=n.height-t.height;t.width<n.width?(r=t.x-a/2,o=n.width,t.x+t.width<n.width&&(r=Math.min(0,t.x))):(r=t.x,o=t.width),t.height<n.height?(i=t.y-l/2,s=n.height,t.y+t.height<n.height&&(i=Math.min(0,t.y))):(i=t.y,s=t.height),r-=50,i-=50,o+=100,s+=100,this._lastViewbox={x:r,y:i,width:o,height:s},Oe(this._svg,{viewBox:r+", "+i+", "+o+", "+s}),Oe(this._viewport,{x:e.x,y:e.y,width:e.width,height:e.height});var c=this._state._parentClientRect=this._parent.getBoundingClientRect(),p=this._viewport.getBoundingClientRect(),u={top:p.top-c.top,left:p.left-c.left,width:p.width,height:p.height};I(this._viewportDom.style,{top:u.top+"px",left:u.left+"px",width:u.width+"px",height:u.height+"px"});var d=jw(c,u);I(this._overlay.style,{clipPath:d})}},Cw.prototype.open=function(){I(this._state,{isOpen:!0}),K(this._parent).add("open");var e=this._injector.get("translate",!1)||function(e){return e};X(this._toggle,"title",e("Close minimap")),this._update(),this._eventBus.fire("minimap.toggle",{open:!0})},Cw.prototype.close=function(){I(this._state,{isOpen:!1}),K(this._parent).remove("open");var e=this._injector.get("translate",!1)||function(e){return e};X(this._toggle,"title",e("Open minimap")),this._eventBus.fire("minimap.toggle",{open:!1})},Cw.prototype.toggle=function(e){var t=this.isOpen();void 0===e&&(e=!t),e!=t&&(e?this.open():this.close())},Cw.prototype.isOpen=function(){return this._state.isOpen},Cw.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)}},Cw.prototype._updateElementId=function(e,t){try{var n=ve("#"+Qo(this._prefixId(e.id)),this._elementsGroup);n&&(n.id=this._prefixId(t))}catch(e){console.warn("Minimap#_updateElementId errored",e)}},Cw.prototype.isOnActivePlane=function(e){var t=this._canvas;return t.findRoot?t.findRoot(e)===t.getRootElement():!t.findPlane||t.findPlane(e)===t.getActivePlane()},Cw.prototype._addElement=function(e){var t=this;if(this._removeElement(e),this.isOnActivePlane(e)){var n,r,i,o=this._createElement(e),s=ve("#"+Qo(this._prefixId(e.parent.id)),this._elementsGroup);if(o){var a=function(e,t){var n=ve(".djs-children",t.parentNode);if(!n)return;var r=[].slice.call(n.childNodes),i=-1;return r.forEach((function(t,n){ve(".djs-element",t)===e&&(i=n)})),i}(this._elementRegistry.getGraphics(e),this._elementRegistry.getGraphics(e.parent));return"undefined"!==a&&s?s.childNodes.length>a?Dw(o,s,a):Dw(o,s,s.childNodes.length-1):this._elementsGroup.appendChild(o),!function(e){return e.waypoints}(e)?(r=e.x,i=e.y,s&&(r-=(n=e.parent).x,i-=n.y),Oe(o,{transform:"translate("+r+" "+i+")"})):(r=0,i=0,void 0!==(n=e.parent).x&&void 0!==n.y&&(r=-n.x,i=-n.y),Oe(o,{transform:"translate("+r+" "+i+")"})),e.children&&e.children.length&&e.children.forEach((function(e){t._addElement(e)})),o}}},Cw.prototype._removeElement=function(e){var t=this._svg.getElementById(this._prefixId(e.id));t&&Ue(t)},Cw.prototype._createElement=function(e){var t,n=this._elementRegistry.getGraphics(e);if(n&&(t=Zn(n))){var r=function(e){return be("[id]",e).forEach((function(e){e.remove()})),e}(Me(t));return Oe(r,{id:this._prefixId(e.id)}),r}},Cw.prototype._clear=function(){Te(this._elementsGroup)},Cw.prototype._prefixId=function(e){return"djs-minimap-"+e+"-"+this._minimapId};var Rw=Math.sign||function(e){return e>=0?1:-1};function jw(e,t){return"polygon("+[Lw(t.left,t.top),Lw(t.left+t.width,t.top),Lw(t.left+t.width,t.top+t.height),Lw(t.left,t.top+t.height),Lw(t.left,e.height),Lw(e.width,e.height),Lw(e.width,0),Lw(0,0),Lw(0,e.height),Lw(t.left,e.height)].join(", ")+")"}function Lw(e,t){return e+"px "+t+"px"}function Iw(e){return x(e,(function(e){return p(e)?Iw(e):u(e)&&isFinite(e)}))}function zw(e){return e.center?e.center:{x:e.clientX,y:e.clientY}}var Bw={__init__:["minimap"],minimap:["type",Cw]},$w=1e5,qw=1e5;function Fw(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)}))}Fw.prototype._init=function(){var e=ve("defs",this._canvas._svg);e||(e=Re("defs"),xe(this._canvas._svg,e));var t=this._pattern=Re("pattern"),n="djs-grid-pattern-"+Math.trunc(1e6*Math.random());Oe(t,{id:n,width:cv,height:cv,patternUnits:"userSpaceOnUse"});var r=this._circle=Re("circle");Oe(r,{cx:.5,cy:.5,r:.5,fill:"#ccc"}),xe(t,r),xe(e,t),Oe(this._gfx=Re("rect"),{x:-$w/2,y:-qw/2,width:$w,height:qw,fill:`url(#${n})`})},Fw.prototype._centerGridAroundViewbox=function(e){e||(e=this._canvas.viewbox());var t=wn(e);Oe(this._gfx,{x:-$w/2+pv(t.x,cv),y:-qw/2+pv(t.y,cv)})},Fw.prototype.isVisible=function(){return this._visible},Fw.prototype.toggle=function(e){if(void 0===e&&(e=!this._visible),e!==this._visible){var t=this._getParent();e?xe(t,this._gfx):Te(t),this._visible=e}},Fw.prototype._getParent=function(){return this._canvas.getLayer("djs-grid",-2)},Fw.$inject=["canvas","eventBus"];var Vw={__init__:["grid"],grid:["type",Fw]};function Hw(e,t){var n,r,i=(e=e||{}).borderColor||"rgba(0,0,0,0.1)",o=e.crossColor||"#CCC",s=-1;xe(t.getLayer("djs-origin",-1),n=Gw("g",{"pointer-events":"none"})),!1!==e.showBorder&&xe(n,Gw("path",{class:Ww("border"),d:Uw(["M",-22,s,"H",-1e3,"M",22,s,"H",6e3,"M",s,-22,"V",-1e3,"M",s,22,"V",3e3]),fill:"none",stroke:i,"stroke-width":"2px","stroke-dasharray":"6, 6","shape-rendering":"crispedges"})),xe(n,Gw("path",{d:Uw(["M",-15,s,"H",15,"M",s,-15,"V",15]),class:Ww("cross"),fill:"none",stroke:o,"stroke-width":"2px","stroke-linecap":"round"})),(r=Gw("text",{x:-40,y:-10,fill:o,class:Ww("label")})).textContent="(0, 0)",xe(n,r)}function Uw(e){return e.join(" ")}function Ww(e){return"djs-origin-"+e}function Gw(e,t){var n=Re(e);return Oe(n,t),n}Hw.$inject=["config.origin","canvas"];var Qw={__init__:[Hw]},Zw={offset:{x:150,y:75},tolerance:50,alignOnSave:!0};function Xw(e,t,n,r,i,o){function s(e,n){var r=n.offset,i=n.tolerance,o={};return["x","y"].forEach((function(n){var s=-e[n]+r[n],a=t.get("gridSnapping",!1);a&&(s=function(e,t,n){n||(n="round");return Math[n](e/t)*t}(s,a.getGridSpacing())),o[n]=Math.abs(s)<i?0:s})),o}function a(){var t=i.viewbox().inner,n=i.getRootElement().children;if(n.length){var o=s(t,e);0===o.x&&0===o.y||r.execute("elements.alignToOrigin",{elements:n,delta:o})}}function l(e){return function(t){n.once("commandStack.changed",(function(){var n=t.delta,r=i.viewbox().scale;i.scroll({dx:e*n.x*r,dy:e*n.y*r})}))}}var c,p,d;e=function(e){var t=I({},Zw,e||{});return u(t.offset)&&(t.offset={x:t.offset,y:t.offset}),t}(e),r.register("elements.alignToOrigin",{preExecute:function(e){var t=e.delta,n=e.elements;o.moveElements(n,t)},execute:l(-1),revert:l(1)}),e.alignOnSave&&(c=t.get("_parent",!1),p=n,((d=c&&c._eventBus)||p).on("saveXML.start",1250,a),d&&p.on("diagram.destroy",(function(){d.off("saveXML.start",a)}))),this.align=a,this.computeAdjustment=s,this._config=e}Xw.$inject=["config.alignToOrigin","injector","eventBus","commandStack","canvas","modeling"];var Yw={__init__:["alignToOrigin"],alignToOrigin:["type",Xw]};function Kw(e){function t(e){if(!e.labelTarget){var t=Oi(e);ki(t,"bpmn:Participant")&&(t=t.processRef),ki(t,"bpmn:Process")&&(t.isExecutable=!!t.isExecutable)}}e.on(["shape.added","root.added"],(function(e){t(e.element)})),e.on("elements.changed",(function(e){e.elements.forEach((function(e){t(e)}))}))}Kw.$inject=["eventBus"];var Jw,ex,tx,nx,rx,ix,ox,sx,ax={__init__:[Kw]},lx={},cx=[],px=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,ux=Array.isArray;function dx(e,t){for(var n in t)e[n]=t[n];return e}function hx(e){var t=e.parentNode;t&&t.removeChild(e)}function fx(e,t,n){var r,i,o,s={};for(o in t)"key"==o?r=t[o]:"ref"==o?i=t[o]:s[o]=t[o];if(arguments.length>2&&(s.children=arguments.length>3?Jw.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 mx(e,s,r,i,null)}function mx(e,t,n,r,i){var o={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:null==i?++tx:i,__i:-1,__u:0};return null==i&&null!=ex.vnode&&ex.vnode(o),o}function gx(e){return e.children}function yx(e,t){this.props=e,this.context=t}function vx(e,t){if(null==t)return e.__?vx(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?vx(e):null}function bx(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 bx(e)}}function wx(e){(!e.__d&&(e.__d=!0)&&nx.push(e)&&!xx.__r++||rx!==ex.debounceRendering)&&((rx=ex.debounceRendering)||ix)(xx)}function xx(){var e,t,n,r,i,o,s,a,l;for(nx.sort(ox);e=nx.shift();)e.__d&&(t=nx.length,r=void 0,o=(i=(n=e).__v).__e,a=[],l=[],(s=n.__P)&&((r=dx({},i)).__v=i.__v+1,ex.vnode&&ex.vnode(r),Mx(s,r,i,n.__n,void 0!==s.ownerSVGElement,32&i.__u?[o]:null,a,null==o?vx(i):o,!!(32&i.__u),l),r.__.__k[r.__i]=r,Ax(a,r,l),r.__e!=o&&bx(r)),nx.length>t&&nx.sort(ox));xx.__r=0}function _x(e,t,n,r,i,o,s,a,l,c,p){var u,d,h,f,m,g=r&&r.__k||cx,y=t.length;for(n.__d=l,function(e,t,n){var r,i,o,s,a,l=t.length,c=n.length,p=c,u=0;for(e.__k=[],r=0;r<l;r++)null!=(i=e.__k[r]=null==(i=t[r])||"boolean"==typeof i||"function"==typeof i?null:"string"==typeof i||"number"==typeof i||"bigint"==typeof i||i.constructor==String?mx(null,i,null,null,i):ux(i)?mx(gx,{children:i},null,null,null):void 0===i.constructor&&i.__b>0?mx(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):i)?(i.__=e,i.__b=e.__b+1,a=Ox(i,n,s=r+u,p),i.__i=a,o=null,-1!==a&&(p--,(o=n[a])&&(o.__u|=131072)),null==o||null===o.__v?(-1==a&&u--,"function"!=typeof i.type&&(i.__u|=65536)):a!==s&&(a===s+1?u++:a>s?p>l-s?u+=a-s:u--:u=a<s&&a==s-1?a-s:0,a!==r+u&&(i.__u|=65536))):(o=n[r])&&null==o.key&&o.__e&&(o.__e==e.__d&&(e.__d=vx(o)),Nx(o,o,!1),n[r]=null,p--);if(p)for(r=0;r<c;r++)null!=(o=n[r])&&!(131072&o.__u)&&(o.__e==e.__d&&(e.__d=vx(o)),Nx(o,o))}(n,t,g),l=n.__d,u=0;u<y;u++)null!=(h=n.__k[u])&&"boolean"!=typeof h&&"function"!=typeof h&&(d=-1===h.__i?lx:g[h.__i]||lx,h.__i=u,Mx(e,h,d,i,o,s,a,l,c,p),f=h.__e,h.ref&&d.ref!=h.ref&&(d.ref&&Dx(d.ref,null,h),p.push(h.ref,h.__c||f,h)),null==m&&null!=f&&(m=f),65536&h.__u||d.__k===h.__k?l=kx(h,l,e):"function"==typeof h.type&&void 0!==h.__d?l=h.__d:f&&(l=f.nextSibling),h.__d=void 0,h.__u&=-196609);n.__d=l,n.__e=m}function kx(e,t,n){var r,i;if("function"==typeof e.type){for(r=e.__k,i=0;r&&i<r.length;i++)r[i]&&(r[i].__=e,t=kx(r[i],t,n));return t}return e.__e!=t&&(n.insertBefore(e.__e,t||null),t=e.__e),t&&t.nextSibling}function Ex(e,t){return t=t||[],null==e||"boolean"==typeof e||(ux(e)?e.some((function(e){Ex(e,t)})):t.push(e)),t}function Ox(e,t,n,r){var i=e.key,o=e.type,s=n-1,a=n+1,l=t[n];if(null===l||l&&i==l.key&&o===l.type)return n;if(r>(null==l||131072&l.__u?0:1))for(;s>=0||a<t.length;){if(s>=0){if((l=t[s])&&!(131072&l.__u)&&i==l.key&&o===l.type)return s;s--}if(a<t.length){if((l=t[a])&&!(131072&l.__u)&&i==l.key&&o===l.type)return a;a++}}return-1}function Px(e,t,n){"-"===t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||px.test(t)?n:n+"px"}function Sx(e,t,n,r,i){var o;e:if("style"===t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof r&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||Px(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||Px(e.style,t,n[t])}else if("o"===t[0]&&"n"===t[1])o=t!==(t=t.replace(/(PointerCapture)$|Capture$/,"$1")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?r?n.u=r.u:(n.u=Date.now(),e.addEventListener(t,o?Tx:Cx,o)):e.removeEventListener(t,o?Tx:Cx,o);else{if(i)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!==t&&"height"!==t&&"href"!==t&&"list"!==t&&"form"!==t&&"tabIndex"!==t&&"download"!==t&&"rowSpan"!==t&&"colSpan"!==t&&"role"!==t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!==t[4]?e.removeAttribute(t):e.setAttribute(t,n))}}function Cx(e){var t=this.l[e.type+!1];if(e.t){if(e.t<=t.u)return}else e.t=Date.now();return t(ex.event?ex.event(e):e)}function Tx(e){return this.l[e.type+!0](ex.event?ex.event(e):e)}function Mx(e,t,n,r,i,o,s,a,l,c){var p,u,d,h,f,m,g,y,v,b,w,x,_,k,E,O=t.type;if(void 0!==t.constructor)return null;128&n.__u&&(l=!!(32&n.__u),o=[a=t.__e=n.__e]),(p=ex.__b)&&p(t);e:if("function"==typeof O)try{if(y=t.props,v=(p=O.contextType)&&r[p.__c],b=p?v?v.props.value:p.__:r,n.__c?g=(u=t.__c=n.__c).__=u.__E:("prototype"in O&&O.prototype.render?t.__c=u=new O(y,b):(t.__c=u=new yx(y,b),u.constructor=O,u.render=Rx),v&&v.sub(u),u.props=y,u.state||(u.state={}),u.context=b,u.__n=r,d=u.__d=!0,u.__h=[],u._sb=[]),null==u.__s&&(u.__s=u.state),null!=O.getDerivedStateFromProps&&(u.__s==u.state&&(u.__s=dx({},u.__s)),dx(u.__s,O.getDerivedStateFromProps(y,u.__s))),h=u.props,f=u.state,u.__v=t,d)null==O.getDerivedStateFromProps&&null!=u.componentWillMount&&u.componentWillMount(),null!=u.componentDidMount&&u.__h.push(u.componentDidMount);else{if(null==O.getDerivedStateFromProps&&y!==h&&null!=u.componentWillReceiveProps&&u.componentWillReceiveProps(y,b),!u.__e&&(null!=u.shouldComponentUpdate&&!1===u.shouldComponentUpdate(y,u.__s,b)||t.__v===n.__v)){for(t.__v!==n.__v&&(u.props=y,u.state=u.__s,u.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.forEach((function(e){e&&(e.__=t)})),w=0;w<u._sb.length;w++)u.__h.push(u._sb[w]);u._sb=[],u.__h.length&&s.push(u);break e}null!=u.componentWillUpdate&&u.componentWillUpdate(y,u.__s,b),null!=u.componentDidUpdate&&u.__h.push((function(){u.componentDidUpdate(h,f,m)}))}if(u.context=b,u.props=y,u.__P=e,u.__e=!1,x=ex.__r,_=0,"prototype"in O&&O.prototype.render){for(u.state=u.__s,u.__d=!1,x&&x(t),p=u.render(u.props,u.state,u.context),k=0;k<u._sb.length;k++)u.__h.push(u._sb[k]);u._sb=[]}else do{u.__d=!1,x&&x(t),p=u.render(u.props,u.state,u.context),u.state=u.__s}while(u.__d&&++_<25);u.state=u.__s,null!=u.getChildContext&&(r=dx(dx({},r),u.getChildContext())),d||null==u.getSnapshotBeforeUpdate||(m=u.getSnapshotBeforeUpdate(h,f)),_x(e,ux(E=null!=p&&p.type===gx&&null==p.key?p.props.children:p)?E:[E],t,n,r,i,o,s,a,l,c),u.base=t.__e,t.__u&=-161,u.__h.length&&s.push(u),g&&(u.__E=u.__=null)}catch(e){t.__v=null,l||null!=o?(t.__e=a,t.__u|=l?160:32,o[o.indexOf(a)]=null):(t.__e=n.__e,t.__k=n.__k),ex.__e(e,t,n)}else null==o&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=function(e,t,n,r,i,o,s,a,l){var c,p,u,d,h,f,m,g=n.props,y=t.props,v=t.type;if("svg"===v&&(i=!0),null!=o)for(c=0;c<o.length;c++)if((h=o[c])&&"setAttribute"in h==!!v&&(v?h.localName===v:3===h.nodeType)){e=h,o[c]=null;break}if(null==e){if(null===v)return document.createTextNode(y);e=i?document.createElementNS("http://www.w3.org/2000/svg",v):document.createElement(v,y.is&&y),o=null,a=!1}if(null===v)g===y||a&&e.data===y||(e.data=y);else{if(o=o&&Jw.call(e.childNodes),g=n.props||lx,!a&&null!=o)for(g={},c=0;c<e.attributes.length;c++)g[(h=e.attributes[c]).name]=h.value;for(c in g)h=g[c],"children"==c||("dangerouslySetInnerHTML"==c?u=h:"key"===c||c in y||Sx(e,c,null,h,i));for(c in y)h=y[c],"children"==c?d=h:"dangerouslySetInnerHTML"==c?p=h:"value"==c?f=h:"checked"==c?m=h:"key"===c||a&&"function"!=typeof h||g[c]===h||Sx(e,c,h,g[c],i);if(p)a||u&&(p.__html===u.__html||p.__html===e.innerHTML)||(e.innerHTML=p.__html),t.__k=[];else if(u&&(e.innerHTML=""),_x(e,ux(d)?d:[d],t,n,r,i&&"foreignObject"!==v,o,s,o?o[0]:n.__k&&vx(n,0),a,l),null!=o)for(c=o.length;c--;)null!=o[c]&&hx(o[c]);a||(c="value",void 0!==f&&(f!==e[c]||"progress"===v&&!f||"option"===v&&f!==g[c])&&Sx(e,c,f,g[c],!1),c="checked",void 0!==m&&m!==e[c]&&Sx(e,c,m,g[c],!1))}return e}(n.__e,t,n,r,i,o,s,l,c);(p=ex.diffed)&&p(t)}function Ax(e,t,n){t.__d=void 0;for(var r=0;r<n.length;r++)Dx(n[r],n[++r],n[++r]);ex.__c&&ex.__c(t,e),e.some((function(t){try{e=t.__h,t.__h=[],e.some((function(e){e.call(t)}))}catch(e){ex.__e(e,t.__v)}}))}function Dx(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){ex.__e(e,n)}}function Nx(e,t,n){var r,i;if(ex.unmount&&ex.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||Dx(r,null,t)),null!=(r=e.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){ex.__e(e,t)}r.base=r.__P=null,e.__c=void 0}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&Nx(r[i],t,n||"function"!=typeof e.type);n||null==e.__e||hx(e.__e),e.__=e.__e=e.__d=void 0}function Rx(e,t,n){return this.constructor(e,n)}function jx(e,t,n){var r,i,o,s;ex.__&&ex.__(e,t),i=(r="function"==typeof n)?null:n&&n.__k||t.__k,o=[],s=[],Mx(t,e=(!r&&n||t).__k=fx(gx,null,[e]),i||lx,lx,void 0!==t.ownerSVGElement,!r&&n?[n]:i?null:t.firstChild?Jw.call(t.childNodes):null,o,!r&&n?n:i?i.__e:t.firstChild,r,s),Ax(o,e,s)}function Lx(e,t){var n={__c:t="__cC"+sx++,__:e,Consumer:function(e,t){return e.children(t)},Provider:function(e){var n,r;return this.getChildContext||(n=[],(r={})[t]=this,this.getChildContext=function(){return r},this.shouldComponentUpdate=function(e){this.props.value!==e.value&&n.some((function(e){e.__e=!0,wx(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}Jw=cx.slice,ex={__e:function(e,t,n,r){for(var i,o,s;t=t.__;)if((i=t.__c)&&!i.__)try{if((o=i.constructor)&&null!=o.getDerivedStateFromError&&(i.setState(o.getDerivedStateFromError(e)),s=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(e,r||{}),s=i.__d),s)return i.__E=i}catch(t){e=t}throw e}},tx=0,yx.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=dx({},this.state),"function"==typeof e&&(e=e(dx({},n),this.props)),e&&dx(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),wx(this))},yx.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),wx(this))},yx.prototype.render=gx,nx=[],ix="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,ox=function(e,t){return e.__v.__b-t.__v.__b},xx.__r=0,sx=0;var Ix,zx,Bx,$x,qx=0,Fx=[],Vx=[],Hx=ex.__b,Ux=ex.__r,Wx=ex.diffed,Gx=ex.__c,Qx=ex.unmount;function Zx(e,t){ex.__h&&ex.__h(zx,e,qx||t),qx=0;var n=zx.__H||(zx.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:Vx}),n.__[e]}function Xx(e){return qx=1,Yx(p_,e)}function Yx(e,t,n){var r=Zx(Ix++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):p_(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=zx,!zx.u)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=r.__c.__H.__.filter((function(e){return e.__c}));if(i.every((function(e){return!e.__N})))return!o||o.call(this,e,t,n);var s=!1;return i.forEach((function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(s=!0)}})),!(!s&&r.__c.props===e)&&(!o||o.call(this,e,t,n))};zx.u=!0;var o=zx.shouldComponentUpdate,s=zx.componentWillUpdate;zx.componentWillUpdate=function(e,t,n){if(this.__e){var r=o;o=void 0,i(e,t,n),o=r}s&&s.call(this,e,t,n)},zx.shouldComponentUpdate=i}return r.__N||r.__}function Kx(e,t){var n=Zx(Ix++,3);!ex.__s&&c_(n.__H,t)&&(n.__=e,n.i=t,zx.__H.__h.push(n))}function Jx(e,t){var n=Zx(Ix++,4);!ex.__s&&c_(n.__H,t)&&(n.__=e,n.i=t,zx.__h.push(n))}function e_(e){return qx=5,t_((function(){return{current:e}}),[])}function t_(e,t){var n=Zx(Ix++,7);return c_(n.__H,t)?(n.__V=e(),n.i=t,n.__h=e,n.__V):n.__}function n_(e,t){return qx=8,t_((function(){return e}),t)}function r_(e){var t=zx.context[e.__c],n=Zx(Ix++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub(zx)),t.props.value):e.__}function i_(){for(var e;e=Fx.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(a_),e.__H.__h.forEach(l_),e.__H.__h=[]}catch(t){e.__H.__h=[],ex.__e(t,e.__v)}}ex.__b=function(e){zx=null,Hx&&Hx(e)},ex.__r=function(e){Ux&&Ux(e),Ix=0;var t=(zx=e.__c).__H;t&&(Bx===zx?(t.__h=[],zx.__h=[],t.__.forEach((function(e){e.__N&&(e.__=e.__N),e.__V=Vx,e.__N=e.i=void 0}))):(t.__h.forEach(a_),t.__h.forEach(l_),t.__h=[],Ix=0)),Bx=zx},ex.diffed=function(e){Wx&&Wx(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==Fx.push(t)&&$x===ex.requestAnimationFrame||(($x=ex.requestAnimationFrame)||s_)(i_)),t.__H.__.forEach((function(e){e.i&&(e.__H=e.i),e.__V!==Vx&&(e.__=e.__V),e.i=void 0,e.__V=Vx}))),Bx=zx=null},ex.__c=function(e,t){t.some((function(e){try{e.__h.forEach(a_),e.__h=e.__h.filter((function(e){return!e.__||l_(e)}))}catch(n){t.some((function(e){e.__h&&(e.__h=[])})),t=[],ex.__e(n,e.__v)}})),Gx&&Gx(e,t)},ex.unmount=function(e){Qx&&Qx(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach((function(e){try{a_(e)}catch(e){t=e}})),n.__H=void 0,t&&ex.__e(t,n.__v))};var o_="function"==typeof requestAnimationFrame;function s_(e){var t,n=function(){clearTimeout(r),o_&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);o_&&(t=requestAnimationFrame(n))}function a_(e){var t=zx,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),zx=t}function l_(e){var t=zx;e.__c=e.__(),zx=t}function c_(e,t){return!e||e.length!==t.length||t.some((function(t,n){return t!==e[n]}))}function p_(e,t){return"function"==typeof t?t(e):t}function u_(e,t){for(var n in t)e[n]=t[n];return e}function d_(e,t){for(var n in e)if("__source"!==n&&!(n in t))return!0;for(var r in t)if("__source"!==r&&e[r]!==t[r])return!0;return!1}function h_(e){this.props=e}(h_.prototype=new yx).isPureReactComponent=!0,h_.prototype.shouldComponentUpdate=function(e,t){return d_(this.props,e)||d_(this.state,t)};var f_=ex.__b;ex.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),f_&&f_(e)};var m_="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function g_(e){function t(t){var n=u_({},t);return delete n.ref,e(n,t.ref||null)}return t.$$typeof=m_,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var y_=ex.__e;ex.__e=function(e,t,n,r){if(e.then)for(var i,o=t;o=o.__;)if((i=o.__c)&&i.__c)return null==t.__e&&(t.__e=n.__e,t.__k=n.__k),i.__c(e,t);y_(e,t,n,r)};var v_=ex.unmount;function b_(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=u_({},e)).__c&&(e.__c.__P===n&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map((function(e){return b_(e,t,n)}))),e}function w_(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map((function(e){return w_(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 x_(){this.__u=0,this.t=null,this.__b=null}function __(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function k_(){this.u=null,this.o=null}ex.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),v_&&v_(e)},(x_.prototype=new yx).__c=function(e,t){var n=t.__c,r=this;null==r.t&&(r.t=[]),r.t.push(n);var i=__(r.__v),o=!1,s=function(){o||(o=!0,n.__R=null,i?i(a):a())};n.__R=s;var a=function(){if(! --r.__u){if(r.state.__a){var e=r.state.__a;r.__v.__k[0]=w_(e,e.__c.__P,e.__c.__O)}var t;for(r.setState({__a:r.__b=null});t=r.t.pop();)t.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(s,s)},x_.prototype.componentWillUnmount=function(){this.t=[]},x_.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=b_(this.__b,n,r.__O=r.__P)}this.__b=null}var i=t.__a&&fx(gx,null,e.fallback);return i&&(i.__u&=-33),[fx(gx,null,t.__a?null:e.children),i]};var E_=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 O_(e){return this.getChildContext=function(){return e.context},e.children}function P_(e){var t=this,n=e.i;t.componentWillUnmount=function(){jx(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)}}),jx(fx(O_,{context:t.context},e.__v),t.l)}function S_(e,t){var n=fx(P_,{__v:e,i:t});return n.containerInfo=t,n}(k_.prototype=new yx).__a=function(e){var t=this,n=__(t.__v),r=t.o.get(e);return r[0]++,function(i){var o=function(){t.props.revealOrder?(r.push(i),E_(t,e,r)):i()};n?n(o):o()}},k_.prototype.render=function(e){this.u=null,this.o=new Map;var t=Ex(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},k_.prototype.componentDidUpdate=k_.prototype.componentDidMount=function(){var e=this;this.o.forEach((function(t,n){E_(e,n,t)}))};var C_="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,T_=/^(?: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]/,M_=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,A_=/[A-Z0-9]/g,D_="undefined"!=typeof document,N_=function(e){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(e)};yx.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach((function(e){Object.defineProperty(yx.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_=ex.event;function j_(){}function L_(){return this.cancelBubble}function I_(){return this.defaultPrevented}ex.event=function(e){return R_&&(e=R_(e)),e.persist=j_,e.isPropagationStopped=L_,e.isDefaultPrevented=I_,e.nativeEvent=e};var z_={enumerable:!1,configurable:!0,get:function(){return this.class}},B_=ex.vnode;ex.vnode=function(e){"string"==typeof e.type&&function(e){var t=e.props,n=e.type,r={};for(var i in t){var o=t[i];if(!("value"===i&&"defaultValue"in t&&null==o||D_&&"children"===i&&"noscript"===n||"class"===i||"className"===i)){var s=i.toLowerCase();"defaultValue"===i&&"value"in t&&null==t.value?i="value":"download"===i&&!0===o?o="":"ondoubleclick"===s?i="ondblclick":"onchange"!==s||"input"!==n&&"textarea"!==n||N_(t.type)?"onfocus"===s?i="onfocusin":"onblur"===s?i="onfocusout":M_.test(i)?i=s:-1===n.indexOf("-")&&T_.test(i)?i=i.replace(A_,"-$&").toLowerCase():null===o&&(o=void 0):s=i="oninput","oninput"===s&&r[i=s]&&(i="oninputCapture"),r[i]=o}}"select"==n&&r.multiple&&Array.isArray(r.value)&&(r.value=Ex(t.children).forEach((function(e){e.props.selected=-1!=r.value.indexOf(e.props.value)}))),"select"==n&&null!=r.defaultValue&&(r.value=Ex(t.children).forEach((function(e){e.props.selected=r.multiple?-1!=r.defaultValue.indexOf(e.props.value):r.defaultValue==e.props.value}))),t.class&&!t.className?(r.class=t.class,Object.defineProperty(r,"className",z_)):(t.className&&!t.class||t.class&&t.className)&&(r.class=r.className=t.className),e.props=r}(e),e.$$typeof=C_,B_&&B_(e)};var $_=ex.__r;ex.__r=function(e){$_&&$_(e),e.__c};var q_=ex.diffed;ex.diffed=function(e){q_&&q_(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 F_=fx,V_=0;function H_(e,t,n,r,i,o){var s,a,l={};for(a in t)"ref"==a?s=t[a]:l[a]=t[a];var c={type:e,props:l,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--V_,__i:-1,__u:0,__source:i,__self:o};if("function"==typeof e&&(s=e.defaultProps))for(a in s)void 0===l[a]&&(l[a]=s[a]);return ex.vnode&&ex.vnode(c),c}var U_="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function W_(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var G_,Q_={exports:{}};
|
|
172
172
|
/*!
|
|
173
173
|
Copyright (c) 2018 Jed Watson.
|
|
174
174
|
Licensed under the MIT License (MIT), see
|