camunda-bpmn-js 3.12.0 → 3.12.1

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.
@@ -160,7 +160,7 @@
160
160
  onClosed=${this._onClosed.bind(this)}
161
161
  ...${{...i}}
162
162
  />
163
- `,this._current.container)},lc.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}=this._getContext(e,t);this._current={position:n,className:t,target:e,entries:i,headerEntries:o,container:this._createContainer({provider:t}),options:r},this._emit("open"),this._bindAutoClose(),this._render()},lc.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,empty:!(Object.keys(r).length||Object.keys(i).length)}},lc.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._current=null)},lc.prototype.reset=function(){const e=this._current.container;El(null,e),ke(e)},lc.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},lc.prototype._onOpened=function(){this._emit("opened")},lc.prototype._onClosed=function(){this._emit("closed")},lc.prototype._createContainer=function(e){var t=this._canvas.getContainer();const n=we(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return t.appendChild(n),n},lc.prototype._bindAutoClose=function(){this._eventBus.once(ac,this.close,this)},lc.prototype._unbindAutoClose=function(){this._eventBus.off(ac,this.close,this)},lc.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},lc.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}},lc.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},lc.prototype.registerProvider=function(e,t,n){n||(n=t,t=1e3),this._eventBus.on("popupMenu.getProviders."+e,t,(function(e){e.providers.push(n)}))},lc.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},lc.prototype._getEntries=function(e,t){var n={};return b(t,(function(t){if(t.getPopupMenuEntries){var r=t.getPopupMenuEntries(e);d(r)?n=r(n):b(r,(function(e,t){n[t]=e}))}else b(t.getEntries(e),(function(e){var t=e.id;if(!t)throw new Error("entry ID is missing");n[t]=V(e,["id"])}))})),n},lc.prototype._getHeaderEntries=function(e,t){var n={};return b(t,(function(t){if(t.getPopupMenuHeaderEntries){var r=t.getPopupMenuHeaderEntries(e);d(r)?n=r(n):b(r,(function(e,t){n[t]=e}))}else{if(!t.getHeaderEntries)return;b(t.getHeaderEntries(e),(function(e){var t=e.id;if(!t)throw new Error("entry ID is missing");n[t]=V(e,["id"])}))}})),n},lc.prototype.isOpen=function(){return!!this._current},lc.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let n=J(oe(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)},lc.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 cc={__init__:["popupMenu"],popupMenu:["type",lc]},pc={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 uc(e,t,n,r){e.registerProvider(900,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=r}uc.$inject=["contextPad","popupMenu","translate","canvas"],uc.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&z(t,this._getEntries(e)),t},uc.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},uc.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${pc.align}</div>`,action:{click:function(t,n){var r=e._getMenuPosition(n);z(r,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",r)}}}}},uc.prototype._getMenuPosition=function(e){var t=this._contextPad.getPad(e).html.getBoundingClientRect();return{x:t.left,y:t.bottom+5}};var dc=["left","center","right","top","middle","bottom"];function hc(e,t,n,r){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=r,e.registerProvider("align-elements",this)}function fc(e){ws.call(this,e),this.init()}function mc(e){fc.call(this,e)}hc.$inject=["popupMenu","alignElements","translate","rules"],hc.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&z(t,this._getEntries(e)),t},hc.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},hc.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,r=this._popupMenu,i={};return b(dc,(function(o){i["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:pc[o],action:function(){t.trigger(e,o),r.close()}}})),i},fc.$inject=["eventBus"],e(fc,ws),fc.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)}))},fc.prototype.init=function(){},mc.$inject=["eventBus"],e(mc,fc),mc.prototype.init=function(){this.addRule("elements.align",(function(e){var t=v(e.elements,(function(e){return!(e.waypoints||e.host||e.labelTarget)}));return!((t=vt(t)).length<2)&&t}))};var gc={__depends__:[qa,Ka,cc],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",uc],alignElementsMenuProvider:["type",hc],bpmnAlignElements:["type",mc]},yc=10,vc=50,bc=250;function wc(e,t,n,r){for(var i;i=_c(e,n,t);)n=r(t,n,i);return n}function xc(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 _c(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=kc(e);e.host&&(t=t.concat(kc(e.host)));e.attachers&&(t=t.concat(e.attachers.reduce((function(e,t){return e.concat(kc(t))}),[])));return t}(e);return g(i,(function(e){return e!==n&&"intersect"===Pn(e,r,yc)}))}function kc(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 Ec(){return!0}function Oc(e,t,n){e.on("autoPlace",100,(function(e){var t=e.shape;return function(e,t,n){n||(n={});var r=n.defaultDistance||vc,i=On(e),o=_n(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 Pc(e,t){e.on("autoPlace.end",500,(function(e){t.select(e.shape)}))}Oc.$inject=["eventBus","modeling","canvas"],Pc.$inject=["eventBus","selection"];var Sc={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",Oc],autoPlaceSelectionBehavior:["type",Pc]};function Cc(e,t){for(h(t)&&(t=[t]);e=e.parent;)if(Ai(e,t))return e;return null}function Tc(e,t){return Mi(t,"bpmn:TextAnnotation")?function(e,t){var n=_n(e),r={x:n.right+t.width/2,y:n.top-50-t.height/2};vn(e)&&((r=On(e)).x+=100,r.y-=50);return wc(e,t,r,xc({y:{margin:-30,minDistance:20}}))}(e,t):Ai(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])?function(e,t){var n=_n(e),r={x:n.right-10+t.width/2,y:n.bottom+40+t.width/2};return wc(e,t,r,xc({x:{margin:30,minDistance:30}}))}(e,t):Mi(t,"bpmn:FlowNode")?function(e,t){var n=_n(e),r=On(e),i=function(e,t){t||(t={});var n=t.defaultDistance||vc,r=t.direction||"e",i=t.filter,o=t.getWeight||function(t){return t.source===e?1:-1},s=t.maxDistance||bc,a=t.reference||"start";function l(e,t){return"n"===r?"start"===a?_n(e).top-_n(t).bottom:"center"===a?_n(e).top-On(t).y:_n(e).top-_n(t).top:"w"===r?"start"===a?_n(e).left-_n(t).right:"center"===a?_n(e).left-On(t).x:_n(e).left-_n(t).left:"s"===r?"start"===a?_n(t).top-_n(e).bottom:"center"===a?On(t).y-_n(e).bottom:_n(t).bottom-_n(e).bottom:"start"===a?_n(t).left-_n(e).right:"center"===a?On(t).x-_n(e).right:_n(t).right-_n(e).right}i||(i=Ec);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=x(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 Mi(e,"bpmn:SequenceFlow")}}),o=30,s=80,a="left";Mi(e,"bpmn:BoundaryEvent")&&-1!==(a=Pn(e,e.host,-25)).indexOf("top")&&(o*=-1);var l={x:n.right+i+t.width/2,y:r.y+Mc(a,s)};return wc(e,t,l,xc({y:{margin:o,minDistance:s}}))}(e,t):void 0}function Mc(e,t){return e.includes("top")?-1*t:e.includes("bottom")?t:0}function Ac(e){e.on("autoPlace",(function(e){var t=e.shape;return Tc(e.source,t)}))}Ac.$inject=["eventBus"];var Dc={__depends__:[Sc],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",Ac]};function Nc(e,t,n,i){ws.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(S(t.closure.topLevel)),i=t.hints,s=!i||i.autoResize;!1!==s&&b(C(n,(function(e){return e.parent.id})),(function(e,t){c(s)&&(e=e.filter((function(e){return g(s,D({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 Rc(e){e.invoke(Nc,this)}function jc(e){fc.call(this,e);var t=this;this.addRule("element.autoResize",(function(e){return t.canResize(e.elements,e.target)}))}function $c(e,t){jc.call(this,e),this._modeling=t}Nc.$inject=["eventBus","elementRegistry","modeling","rules"],e(Nc,ws),Nc.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),r=this.getPadding(t),i=_n(kt(e)),o=_n(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),kn(z({},o,s))},Nc.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=_n(e),t=_n(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}(F(t,["x","y","width","height"]),n);this.resize(t,n,{autoResize:r});var i=t.parent;i&&this._expand([t],i)}}},Nc.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},Nc.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},Nc.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)},Rc.$inject=["injector"],e(Rc,Nc),Rc.prototype.resize=function(e,t,n){Mi(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)},jc.$inject=["eventBus"],e(jc,fc),jc.prototype.canResize=function(e,t){return!1},e($c,jc),$c.$inject=["eventBus","modeling"],$c.prototype.canResize=function(e,t){if(Mi(t.di,"bpmndi:BPMNPlane"))return!1;if(!Mi(t,"bpmn:Participant")&&!Mi(t,"bpmn:Lane")&&!Mi(t,"bpmn:SubProcess"))return!1;var n=!0;return b(e,(function(e){(Mi(e,"bpmn:Lane")||bn(e))&&(n=!1)})),n};var Bc={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",Rc],bpmnAutoResizeProvider:["type",$c]};function Ic(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=Wo(e),function(e){return oe(e,"svg, .djs-element",!0)}(document.elementFromPoint(t.x,t.y))}}Ic.$inject=["elementRegistry","eventBus","injector"];var zc={__init__:["hoverFix"],hoverFix:["type",Ic]},Lc=Math.round,qc="djs-drag-active";function Fc(e){e.preventDefault()}function Vc(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(z({},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=Wo(e),d=fa(u,p),h=i.localStart,f=s(u),g=fa(f,h);if(!i.active&&(r||(o=d,Math.sqrt(Math.pow(o.x,2)+Math.pow(o.y,2))>i.threshold))){if(z(l,{x:Lc(h.x+c.x),y:Lc(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&&ca(i.cursor),t.addMarker(t.getRootElement(),qc)}Uo(e),i.active&&(z(l,{x:Lc(f.x+c.x),y:Lc(f.y+c.y),dx:Lc(g.x),dy:Lc(g.y)},{originalEvent:e}),a("move"))}function c(e){var t=!0;i.active&&(e&&(i.payload.originalEvent=e,Uo(e)),t=a("end")),!1===t&&a("rejected"),a("ended",g(!0!==t))}function p(e){Qs("Escape",e)&&(Fc(e),m())}function u(t){var n;i.active&&(n=da(e),setTimeout(n,400),Fc(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"),pa(),g=i.trapClick?u:c,he.unbind(document,"mousemove",l),he.unbind(document,"dragstart",Fc),he.unbind(document,"selectstart",Fc),he.unbind(document,"mousedown",g,!0),he.unbind(document,"mouseup",g,!0),he.unbind(document,"keyup",p),he.unbind(document,"touchstart",d,!0),he.unbind(document,"touchcancel",m,!0),he.unbind(document,"touchmove",l,!0),he.unbind(document,"touchend",c,!0),e.off("element.hover",h),e.off("element.out",f),t.removeMarker(t.getRootElement(),qc);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=z({},o,g||{})).data||{};w=g.trapClick?u:c,t?(y=Ho(t)||t,v=Wo(t),Uo(t),"dragstart"===y.type&&Fc(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=z({prefix:r,data:_,payload:{},globalStart:v,displacement:fa(n,b),localStart:b,isTouch:x},g),g.manual||(x?(he.bind(document,"touchstart",d,!0),he.bind(document,"touchcancel",m,!0),he.bind(document,"touchmove",l,!0),he.bind(document,"touchend",c,!0)):(he.bind(document,"mousemove",l),he.bind(document,"dragstart",Fc),he.bind(document,"selectstart",Fc),he.bind(document,"mousedown",w,!0),he.bind(document,"mouseup",w,!0)),he.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){z(o,e)}}Vc.$inject=["eventBus","canvas","selection","elementRegistry"];var Hc={__depends__:[zc,ps],dragging:["type",Vc]};function Uc(e,t,n){this._canvas=n,this._opts=z({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var r=this;t.on("drag.move",(function(e){var t=r._toBorderPoint(e);r.startScroll(t)})),t.on(["drag.cleanup"],(function(){r.stopScroll()}))}function Wc(e,t,n){return t<e&&e<n}Uc.$inject=["config.autoScroll","eventBus","canvas"],Uc.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++)Wc(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))},Uc.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Uc.prototype.setOptions=function(e){this._opts=z({},this._opts,e)},Uc.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=Wo(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};var Xc={__depends__:[Hc],__init__:["autoScroll"],autoScroll:["type",Uc]};function Gc(e){this._commandStack=e.get("commandStack",!1)}Gc.$inject=["injector"],Gc.prototype.allowed=function(e,t){var n=!0,r=this._commandStack;return r&&(n=r.canExecute(e,t)),void 0===n||n};var Qc={__init__:["rules"],rules:["type",Gc]},Yc=Math.round,Kc=Math.max;var Zc=10;function Jc(e,t){return function(e,t){var n,r;for(n=0;r=e[n];n++)if(Dt(r,t)<=Zc)return{point:e[n],bendpoint:!0,index:n};return null}(e,t)||function(e,t){var n,r,i=un(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,Zc),(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=Kc(o.segment2,s.segment2)-1],bendpoint:!0,index:r}:{point:{x:Yc(o.x+s.x)/2,y:Yc(o.y+s.y)/2},index:o.segment2}:{point:{x:Yc(o.x),y:Yc(o.y)},index:o.segment2}:null}(e,t)}function ep(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function tp(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function np(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 rp(e,t){var n=np(e,t);return ep({x:n.x-e.x,y:n.y-e.y})}function ip(e,t){return ep({x:e.x-t.x,y:e.y-t.y})}var op="djs-bendpoint",sp="djs-segment-dragger";function ap(e,t,n){var r=function(e,t){var n,r=Wo(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 Jc(t,r)}function lp(e,t){var n=ze("g");Ae(n).add(op),Oe(e,n);var r=ze("circle");Te(r,{cx:0,cy:0,r:4}),Ae(r).add("djs-visual"),Oe(n,r);var i=ze("circle");return Te(i,{cx:0,cy:0,r:10}),Ae(i).add("djs-hit"),Oe(n,i),t&&Ae(n).add(t),n}function cp(e,t,n,r){var i=ze("g");Oe(e,i);var o=function(e,t,n){var r=t.x-e.x,i=t.y-e.y;return up("h"===n?r:i)}(t,n,r),s=ze("rect");Te(s,{x:-9,y:-3,width:18,height:6}),Ae(s).add("djs-visual"),Oe(i,s);var a=ze("rect");return Te(a,{x:-o/2,y:-8.5,width:o,height:17}),Ae(a).add("djs-hit"),Oe(i,a),rr(i,"v"===r?90:0),i}function pp(e,t,n){var r=ze("g"),i=It(t,n),o=jt(t,n);return Oe(e,r),cp(r,t,n,o),Ae(r).add(sp),Ae(r).add("h"===o?"horizontal":"vertical"),nr(r,i.x,i.y),r}function up(e){return Math.abs(Math.round(2*e/3))}function dp(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=rp(e,[r[o],r[o+1]]);s<i&&(i=s,n=o)}return[r[n],r[n+1]]}(e,t);return np(e,n)}function hp(e,t,n,r,i){function o(e,n){var o,s=n.waypoints,a=ap(t,s,e);if(a)return o=function(e,t){var n,r,i=e.waypoints;return t.index<=0||t.bendpoint?null:(r=jt((n={start:i[t.index-1],end:i[t.index]}).start,n.end))?up("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=It(r=t[c-1],i=t[c]),s=jt(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){he.bind(e,t,(function(e){n.triggerMouseEvent(t,e,r),e.stopPropagation()}))}function a(e,n){var r=t.getLayer("overlays"),i=xe('.djs-bendpoints[data-element-id="'+Es(e.id)+'"]',r);return!i&&n&&(Te(i=ze("g"),{"data-element-id":e.id}),Ae(i).add("djs-bendpoints"),Oe(r,i),s(i,"mousedown",e),s(i,"click",e),s(i,"dblclick",e)),i}function l(e,t){return xe('.djs-segment-dragger[data-segment-idx="'+e+'"]',t)}function c(e,t){t.waypoints.forEach((function(t,n){var r=lp(e);Oe(e,r),nr(r,t.x,t.y)})),lp(e,"floating")}function p(e,t){for(var n,r,i,o=t.waypoints,a=1;a<o.length;a++)jt(n=o[a-1],r=o[a])&&(Te(i=pp(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){b(_e("."+sp,e),(function(e){Ne(e)}))}(t),function(e){b(_e("."+op,e),(function(e){Ne(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=It(s,a),u=jt(s,a);o&&(r=function(e){return xe(".djs-visual",e)}(o),i={x:c.x-p.x,y:c.y-p.y},"v"===u&&(i={x:i.y,y:i.x}),nr(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&&Ne(t)})),e.on("element.marker.update",(function(e){var t,n=e.element;n.waypoints&&(t=u(n),e.add?Ae(t).add(e.marker):Ae(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=ap(t,o,e.originalEvent)))return;!function(e,t){var n=xe(".floating",e),r=t.point;n&&nr(n,r.x,r.y)}(n,r),r.bendpoint||h(n,r,o)}})),e.on("element.mousedown",(function(e){if(Qo(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&&Te(r,{"data-element-id":n})}})),this.addHandles=u,this.updateHandles=d,this.getBendpointsContainer=a,this.getSegmentDragger=l}hp.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];var fp=Math.round,mp="reconnectStart",gp="reconnectEnd",yp="updateWaypoints";function vp(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?yp:gp:mp)===yp?"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===yp?"connection.updateWaypoints":"connection.reconnect";if(t=n.allowed=i.allowed(c,{connection:r,source:l===mp?a:o,target:l===gp?a:s}))return n.source=l===mp?a:o,void(n.target=l===gp?a:s);!1===t&&(t=n.allowed=i.allowed(c,{connection:r,source:l===gp?a:s,target:l===mp?a:o})),t&&(n.source=l===gp?a:s,n.target=l===mp?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!==yp&&(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:fp(e.x),y:fp(e.y)};if(!n)return!1;p===yp?(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===Dt(t,r=e[i+1])||Nt(n,r,t)?e.splice(i,1):i++;return e}(a),u)):(p===mp?(u.docking="source",bp(t)&&(u.docking="target",u.newWaypoints=a.reverse())):p===gp&&(u.docking="target",bp(t)&&(u.docking="source",u.newWaypoints=a.reverse())),o.reconnect(i,l,c,d,u))}),this)}function bp(e){var t=e.hover,n=e.source,r=e.target,i=e.type;return i===mp?t&&r&&t===r&&n!==r:i===gp?t&&n&&t===n&&n!==r:void 0}vp.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],vp.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 wp="updateWaypoints",xp="connect-ok",_p="connect-not-ok",kp="connect-hover",Ep="djs-updating",Op="djs-dragging";function Pp(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,Ae(t.draggerGfx=lp(r.getLayer("overlays"))).add("djs-dragging"),r.addMarker(i,Op),r.addMarker(i,Ep)})),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,kp),o===wp)return;n?(r.removeMarker(i,_p),r.addMarker(i,xp)):!1===n&&(r.removeMarker(i,xp),r.addMarker(i,_p))}})),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,kp),r.removeMarker(n,i?xp:_p))})),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?bp(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?bp(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===wp&&(d=e.cropWaypoints(c,d)),m.waypoints=d,i.drawPreview(n,r,m)),nr(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,Ne(o),r.removeMarker(n,Ep),r.removeMarker(n,Op),s&&(r.removeMarker(s,xp),r.removeMarker(s,a?xp:_p)),i&&i.cleanUp(t)}))}Pp.$inject=["bendpointMove","injector","eventBus","canvas"];var Sp="connect-hover",Cp="djs-updating";function Tp(e,t,n){return Mp(e,t,e[t]+n)}function Mp(e,t,n){return{x:"x"===t?n:e.x,y:"y"===t?n:e.y}}function Ap(e){return"x"===e?"y":"x"}function Dp(e,t,n){var r,i;return e.original?e.original:(r=On(t),Mp(e,i=Ap(n),r[i]))}function Np(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 Mp(t,r,Math.min(Math.max(o+20,e[r]),i-20))}(n,r[e.segmentStartIndex+t],r[e.segmentEndIndex+t],Ap(e.axis));nr(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=ap(n,d,e);(s=jt(h,f))&&(a="v"===s?"x":"y",0===p&&(h=Dp(h,t.source,a)),u===d.length-1&&(f=Dp(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=pp(i,t.segmentStart,t.segmentEnd),Ae(t.draggerGfx).add("djs-dragging"),n.addMarker(r,Cp)})),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=Tp(p,d,e["d"+d]),m=Tp(u,d,e["d"+d]),g=h.length,y=0;h[o]=f,h[s]=m,o<2&&(t=Pn(i.source,f),1===o?"intersect"===t&&(h.shift(),h[0]=f,y--):"intersect"!==t&&(h.unshift(p),y++)),s>g-3&&(n=Pn(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,Sp)})),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],(function(e){var t=e.context.hover;t&&n.removeMarker(t,Sp)})),t.on("connectionSegment.move.cleanup",(function(e){var t=e.context,r=t.connection;t.draggerGfx&&Ne(t.draggerGfx),n.removeMarker(r,Cp)})),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!Nt(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)}))}Np.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var Rp=Math.abs,jp=Math.round;function $p(e){return{x:e.x,y:e.y}}function Bp(e){return{x:e.x+e.width,y:e.y+e.height}}function Ip(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:jp(e.x+e.width/2),y:jp(e.y+e.height/2)}}function zp(e,t){var n=e.snapped;return!!n&&("string"==typeof t?n[t]:n.x&&n.y)}function Lp(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 qp(e){return e.children||[]}var Fp=Math.abs,Vp=Math.round;function Hp(e){function t(e,t){if(c(e)){for(var n=e.length;n--;)if(Fp(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?dp(t,e):e.width?{x:Vp(e.width/2+e.x),y:Vp(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:[]},b(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));z(e,{dx:e.dx-l,dy:e.dy-c,x:r,y:i}),(l||-1!==o.vertical.indexOf(s))&&Lp(e,"x",r),(c||-1!==o.horizontal.indexOf(a))&&Lp(e,"y",i)}})),e.on(["connect.hover","connect.move","connect.end"],1500,(function(e){var t=e.context.hover,r=t&&n(t,e);vn(t)&&r&&r.x&&r.y&&(Lp(e,"x",r.x),Lp(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:[]},b(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));z(e,{dx:e.dx-u,dy:e.dy-d,x:e.x-u,y:e.y-d}),(u||-1!==s.vertical.indexOf(c))&&Lp(e,"x",r),(d||-1!==s.horizontal.indexOf(p))&&Lp(e,"y",i)}}))}Hp.$inject=["eventBus"];var Up={__depends__:[Hc,Qc],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",hp],bendpointMove:["type",vp],bendpointMovePreview:["type",Pp],connectionSegmentMove:["type",Np],bendpointSnapping:["type",Hp]};function Wp(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:Xp(t)?o:i,connectionEnd:Xp(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=On(n)),t.init(e,"connect",{autoActivate:i,data:{shape:n,context:{start:n,connectionStart:r}}})}}function Xp(e){var t=e.hover,n=e.source,r=e.target;return t&&n&&t===n&&n!==r}Wp.$inject=["eventBus","dragging","modeling","rules"];var Gp="connect-ok",Qp="connect-not-ok";function Yp(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;Xp(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?Gp:Qp)})),t.on(["connect.out","connect.cleanup"],1100,(function(e){var t=e.hover;t&&(n.removeMarker(t,Gp),n.removeMarker(t,Qp))})),r&&t.on("connect.cleanup",(function(e){r.cleanUp(e.context)}))}Yp.$inject=["injector","eventBus","canvas"];var Kp={__depends__:[ps,Qc,Hc],__init__:["connectPreview"],connect:["type",Wp],connectPreview:["type",Yp]};function Zp(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)}Zp.$inject=["injector","canvas","graphicsFactory","elementFactory"],Zp.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()),Re(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?On(s):c,a?On(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)},Zp.prototype.drawNoopPreview=function(e,t){var n=t.source,r=t.target,i=t.connectionStart||On(n),o=t.connectionEnd||On(r),s=this.cropWaypoints(i,o,n,r);Oe(e,this.createNoopConnection(s[0],s[1]))},Zp.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&&Sn(o,a,!0)||e,t=r&&Sn(s,a,!1)||t]},Zp.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&Ne(e.connectionPreviewGfx)},Zp.prototype.getConnection=function(e){var t=function(e){return p(e)?e:{}}(e);return this._elementFactory.createConnection(t)},Zp.prototype.createConnectionPreviewGfx=function(){var e=ze("g");return Te(e,{pointerEvents:"none"}),Ae(e).add("djs-dragger"),Oe(this._canvas.getActiveLayer(),e),e},Zp.prototype.createNoopConnection=function(e,t){return gt([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};var Jp={__init__:["connectionPreview"],connectionPreview:["type",Zp]},eu=["marker-start","marker-mid","marker-end"],tu=["circle","ellipse","line","path","polygon","polyline","path","rect"];function nu(e,t,n,r){this._elementRegistry=e,this._canvas=n,this._styles=r,this._clonedMarkers={};var i=this;t.on("drag.cleanup",(function(){i.cleanUp()}))}nu.$inject=["elementRegistry","eventBus","canvas","styles"],nu.prototype.cleanUp=function(){b(this._clonedMarkers,(function(e){Ne(e)})),this._clonedMarkers={}},nu.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},nu.prototype.addDragger=function(e,t,n,r="djs-dragger"){var i=je(n=n||this.getGfx(e)),o=n.getBoundingClientRect();return this._cloneMarkers(er(i),r),Te(i,this._styles.cls(r,[],{x:o.top,y:o.left})),Oe(t,i),Te(i,"data-preview-support-element-id",e.id),i},nu.prototype.addFrame=function(e,t){var n=ze("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return Oe(t,n),Te(n,"data-preview-support-element-id",e.id),n},nu.prototype._cloneMarkers=function(e,t="djs-dragger"){var n=this;if(e.childNodes)for(var r=0;r<e.childNodes.length;r++)n._cloneMarkers(e.childNodes[r],t);(function(e){return-1!==tu.indexOf(e.nodeName)})(e)&&eu.forEach((function(r){if(Te(e,r)){var i=function(e,t,n){var r=(i=Te(e,t),i.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]);var i;return xe("marker#"+r,n||document)}(e,r,n._canvas.getContainer());n._cloneMarker(e,i,r,t)}}))},nu.prototype._cloneMarker=function(e,t,n,r="djs-dragger"){var i=t.id+"-"+r,o=this._clonedMarkers[i];if(!o){var s=i+"-clone";(o=je(t)).id=s,Ae(o).add(r),this._clonedMarkers[i]=o;var a=xe("defs",this._canvas._svg);a||(a=ze("defs"),Oe(this._canvas._svg,a)),Oe(a,o)}var l=function(e){return"url(#"+e+")"}(this._clonedMarkers[i].id);Te(e,n,l)};var ru={__init__:["previewSupport"],previewSupport:["type",nu]};const iu="complex-preview";class ou{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(iu);t.filter((e=>!function(e){return e.hidden}(e))).forEach((e=>{let t;vn(e)?(t=this._graphicsFactory._createContainer("connection",ze("g")),this._graphicsFactory.drawConnection(er(t),e)):(t=this._graphicsFactory._createContainer("shape",ze("g")),this._graphicsFactory.drawShape(er(t),e),nr(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);vn(e)?nr(n,t.x,t.y):nr(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",ze("g"));this._graphicsFactory.drawShape(er(n),e,{width:t.width,height:t.height}),nr(n,t.x,t.y),this._previewSupport.addDragger(e,o,n)}))}cleanUp(){Re(this._canvas.getLayer(iu)),this._markers.forEach((([e,t])=>this._canvas.removeMarker(e,t))),this._markers=[],this._previewSupport.cleanUp()}show(){this._canvas.showLayer(iu)}hide(){this._canvas.hideLayer(iu)}}ou.$inject=["canvas","graphicsFactory","previewSupport"];var su={__depends__:[ru],__init__:["complexPreview"],complexPreview:["type",ou]},au=["top","bottom","left","right"],lu=10;function cu(e,t){function n(e){if(io(e)){var n=function(e){var t=On(e.label),n=On(e),r=pu(n,t);if(i=r,-1===au.indexOf(i))return;var i;var o=function(e){var t=On(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 pu(t,e)}));return n}(e);if(e.host){var s=function(e){var t,n=e.host,r=On(e),i=Pn(r,n);t=i.indexOf("-")>=0?i.split("-"):[i];var o=au.filter((function(e){return-1===t.indexOf(e)}));return o}(e);o=o.concat(s)}var a=au.filter((function(e){return-1===o.indexOf(e)}));if(-1!==a.indexOf(r))return;return a[0]}(e);n&&function(e,n){var r=On(e),i=e.label,o=On(i);if(!i.parent)return;var s,a=_n(e);switch(n){case"top":s={x:r.x,y:a.top-lu-i.height/2};break;case"left":s={x:a.left-lu-i.width/2,y:r.y};break;case"bottom":s={x:r.x,y:a.bottom+lu+i.height/2};break;case"right":s={x:a.right+lu+i.width/2,y:r.y}}var l=fa(s,o);t.moveShape(i,l)}(e,n)}}ws.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 pu(e,t){return Pn(t,e,5)}function uu(e){ws.call(this,e),this.preExecute("shape.append",(function(e){var t=e.source,n=e.shape;e.position||(Mi(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 du(e,t){e.invoke(ws,this),this.postExecute("shape.move",(function(e){var n=e.newParent,r=e.shape;b(v(r.incoming.concat(r.outgoing),(function(e){return Mi(e,"bpmn:Association")})),(function(e){t.moveConnection(e,{x:0,y:0},n)}))}),!0)}e(cu,ws),cu.$inject=["eventBus","modeling"],e(uu,ws),uu.$inject=["eventBus"],e(du,ws),du.$inject=["injector","modeling"];function hu(e,t){t.invoke(ws,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 fu(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];fu(i,r)&&(e.shapes=[n._replaceShape(i,r)])}}),!0)}function fu(e,t){return!bn(e)&&Ai(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function mu(e,t){function n(e){return v(e.attachers,(function(e){return Mi(e,"bpmn:BoundaryEvent")}))}ws.call(this,e),this.postExecute("connection.create",(function(e){var r=e.context.source,i=e.context.target,o=n(i);Mi(r,"bpmn:EventBasedGateway")&&Mi(i,"bpmn:ReceiveTask")&&o.length>0&&t.removeElements(o)})),this.postExecute("connection.reconnect",(function(e){var r=e.context.oldSource,i=e.context.newSource;Mi(r,"bpmn:Gateway")&&Mi(i,"bpmn:EventBasedGateway")&&b(i.outgoing,(function(e){var r=e.target,i=n(r);Mi(r,"bpmn:ReceiveTask")&&i.length>0&&t.removeElements(i)}))}))}function gu(e,t,n){function r(e){t.updateProperties(e,{isForCompensation:!0})}function i(e){t.updateProperties(e,{isForCompensation:void 0})}ws.call(this,e),this.preExecute("shape.replace",(function(e){const{targetElement:n}=e.hints||{},{oldShape:r}=e;if(vu(e.oldShape)&&"bpmn:CompensateEventDefinition"!==n.eventDefinitionType||"bpmn:BoundaryEvent"!==n.type){const t=r.outgoing.find((({target:e})=>yu(e)));t&&t.target&&(e._connectionTarget=t.target)}else if(!vu(e.oldShape)&&"bpmn:CompensateEventDefinition"===n.eventDefinitionType&&"bpmn:BoundaryEvent"===n.type){const n=r.outgoing.find((({target:e})=>bu(e)));n&&n.target&&(e._connectionTarget=n.target),function(e){const n=e.outgoing.filter((e=>Mi(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.source,i=e.target;vu(n)&&bu(i)&&(r(i),function(e){const n=e.outgoing.filter((e=>Mi(e,"bpmn:Association"))),r=n.filter((e=>yu(e.target)));r.forEach((e=>t.removeConnection(e)))}(n))}),!0),this.postExecuted("connection.delete",(function(e){const t=e.source,n=e.target;vu(t)&&yu(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;yu(o)&&i(o),vu(e)&&bu(t)&&r(t)}}),!0),this.postExecuted("element.updateProperties",(function(e){const{element:r}=e;yu(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)):bu(r)&&function(e){const n=e.incoming.filter((e=>vu(e.source)));t.removeElements(n)}(r)}),!0)}function yu(e){const t=Di(e);return t&&t.get("isForCompensation")}function vu(e){return e&&Mi(e,"bpmn:BoundaryEvent")&&eo(e,"bpmn:CompensateEventDefinition")}function bu(e){return e&&Mi(e,"bpmn:Activity")&&!Ji(e)}function wu(e){e.invoke(ws,this),this.preExecute("shape.create",1500,(function(e){var t=e.context,n=t.parent,r=t.shape;Mi(n,"bpmn:Lane")&&!Mi(r,"bpmn:Lane")&&(t.parent=Cc(n,"bpmn:Participant"))}))}function xu(e,t){ws.call(this,e),this.preExecute("shape.create",(function(e){var n=e.context.shape;if(Mi(n,"bpmn:DataObjectReference")&&"label"!==n.type){var r=t.create("bpmn:DataObject");n.businessObject.dataObjectRef=r}}))}hu.$inject=["bpmnReplace","injector"],e(hu,ws),hu.prototype._replaceShape=function(e,t){var n,r=(n=Di(e).eventDefinitions)&&n[0],i={type:"bpmn:BoundaryEvent",host:t};return r&&(i.eventDefinitionType=r.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})},mu.$inject=["eventBus","modeling"],e(mu,ws),e(gu,ws),gu.$inject=["eventBus","modeling","bpmnRules"],wu.$inject=["injector"],e(wu,ws),xu.$inject=["eventBus","bpmnFactory"],e(xu,ws);var _u=20,ku=20,Eu=30,Ou=2e3;function Pu(e,t,n){function r(){var t=e.getRootElement();return Mi(t,"bpmn:Collaboration")?t:n.makeCollaboration()}ws.call(this,t),t.on(["create.start","shape.move.start"],Ou,(function(t){var n=t.context,r=n.shape,i=e.getRootElement();if(Mi(r,"bpmn:Participant")&&Mi(i,"bpmn:Process")&&i.children.length){var o=i.children.filter((function(e){return!Mi(e,"bpmn:Group")&&!bn(e)&&!vn(e)}));if(o.length){var s=kt(o),a=function(e,t){t={width:t.width+2*_u+Eu,height:t.height+2*ku};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);z(r,a),n.createConstraints=function(e,t){return t=_n(t),{bottom:t.top+e.height/2-ku,left:t.right-e.width/2+_u,top:t.bottom-e.height/2+ku,right:t.left+e.width/2-_u-Eu}}(r,s)}}})),t.on("create.start",Ou,(function(n){var r=n.context.shape,i=e.getRootElement(),o=e.getGraphics(i);function s(e){e.element=i,e.gfx=o}Mi(r,"bpmn:Participant")&&Mi(i,"bpmn:Process")&&(t.on("element.hover",Ou,s),t.once("create.cleanup",(function(){t.off("element.hover",s)})))})),this.preExecute("elements.create",Ou,(function(e){var t,n=e.elements,i=e.parent,o=function(e){return g(e,(function(e){return Mi(e,"bpmn:Participant")}))}(n);o&&Mi(i,"bpmn:Process")&&(e.parent=r(),(t=e.hints=e.hints||{}).participant=o,t.process=i,t.processRef=Di(o).get("processRef"))}),!0),this.preExecute("shape.create",(function(e){var t=e.parent,n=e.shape;Mi(n,"bpmn:Participant")&&Mi(t,"bpmn:Process")&&(e.parent=r(),e.process=t,e.processRef=Di(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||Di(r).set("processRef",Di(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||Di(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)}Pu.$inject=["canvas","eventBus","modeling"],e(Pu,ws);var Su="__targetRef_placeholder";function Cu(e,t){function n(e,n){var r=e.get("properties"),i=g(r,(function(e){return e.name===Su}));return!i&&n&&Mt(r,i=t.create("bpmn:Property",{name:Su})),i}function r(e,t){var r=n(e);r&&(function(e,t,n){return g(e.get("dataInputAssociations"),(function(e){return e!==n&&e.targetRef===t}))}(e,r,t)||Tt(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}ws.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],Tu(i)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],Tu(i))}function Tu(e){return function(t){if(Mi(t.context.connection,"bpmn:DataInputAssociation"))return e(t)}}function Mu(e){this._bpmnUpdater=e}function Au(e,t,n,r){function i(e){return e.children.filter((function(e){return Mi(e,"bpmn:DataStoreReference")&&!e.labelTarget}))}function o(e,r){var i=e.businessObject||e;if(r=r||n.filter((function(e){return Mi(e,"bpmn:Participant")&&Di(e).processRef}))[0]){var o=r.businessObject||r;t.execute("dataStore.updateContainment",{dataStoreBo:i,dataStoreDi:Ni(e),newSemanticParent:o.processRef||o,newDiParent:Ni(r)})}}ws.call(this,r),t.registerHandler("dataStore.updateContainment",Mu),this.preExecute("shape.create",(function(e){var t=e.context,n=t.shape;Mi(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 Mi(e,"bpmn:DataStoreReference")})).length&&(t.hints||(t.hints={}),t.hints.autoResize=n.filter((function(e){return!Mi(e,"bpmn:DataStoreReference")})))})),this.postExecute("shape.create",(function(e){var t=e.context.shape,n=t.parent;Mi(t,"bpmn:DataStoreReference")&&"label"!==t.type&&Mi(n,"bpmn:Collaboration")&&o(t)})),this.postExecute("shape.move",(function(e){var t=e.context,n=t.shape,r=t.oldParent,i=n.parent;Mi(r,"bpmn:Collaboration")||Mi(n,"bpmn:DataStoreReference")&&"label"!==n.type&&Mi(i,"bpmn:Collaboration")&&o(n,Mi(r,"bpmn:Participant")?r:function(e,t){for(;e.parent;){if(Mi(e.parent,t))return e.parent;e=e.parent}}(r,"bpmn:Participant"))})),this.postExecute("shape.delete",(function(t){var n=t.context.shape,r=e.getRootElement();Ai(n,["bpmn:Participant","bpmn:SubProcess"])&&Mi(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){Mi(r,"bpmn:Process")&&o(e,r)}))}))}Cu.$inject=["eventBus","bpmnFactory"],e(Cu,ws),Mu.$inject=["bpmnUpdater"],Mu.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),[]},Mu.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),[]},Au.$inject=["canvas","commandStack","elementRegistry","eventBus"],e(Au,ws);var Du=Math.max,Nu=Math.min,Ru=20;function ju(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function $u(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)?Nu:Du)(r,i)),u(o)&&(r=(/top|left/.test(e)?Du:Nu)(r,o)),r}function Bu(e,t){return void 0!==e?e:Ru}function Iu(e){return!e.waypoints&&"label"!==e.type}function zu(e,t){var n;if((n=void 0===e.length?v(e.children,Iu):e).length)return function(e,t){var n,r,i,o;return"object"==typeof t?(n=Bu(t.left),r=Bu(t.right),i=Bu(t.top),o=Bu(t.bottom)):n=r=i=o=Bu(t),{x:e.x-n,y:e.y-i,width:e.width+n+r,height:e.height+i+o}}(kt(n),t)}var Lu=Math.abs;var qu=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Fu=30;function Vu(e,t){return t=t||[],e.children.filter((function(e){Mi(e,"bpmn:Lane")&&(Vu(e,t),t.push(e))})),t}function Hu(e){return e.children.filter((function(e){return Mi(e,"bpmn:Lane")}))}function Uu(e){return Cc(e,qu)||e}function Wu(e,t){var n=Uu(e),r=Vu(n,Mi(n,"bpmn:Process")?[]:[n]),i=_n(e),o=_n(t),s=function(e,t){return ju(_n(t),_n(e))}(e,t),a=[];return r.forEach((function(t){if(t!==e){var n,r,l=0,c=s.right,p=0,u=s.left,d=_n(t);s.top&&(Lu(d.bottom-i.top)<10&&(p=o.top-d.bottom),Lu(d.top-i.top)<5&&(l=o.top-d.top)),s.bottom&&(Lu(d.top-i.bottom)<10&&(l=o.bottom-d.top),Lu(d.bottom-i.bottom)<5&&(p=o.bottom-d.bottom)),(l||c||p||u)&&a.push({shape:t,newBounds:(n=t,r={top:l,right:c,bottom:p,left:u},{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 Xu(e,t){ws.call(this,e),this.postExecuted("shape.delete",500,(function(e){var n=e.context,r=n.hints,i=n.shape,o=n.oldParent;Mi(i,"bpmn:Lane")&&(r&&r.nested||function(e,n){var r,i,o,s=Hu(n),a=[],l=[];xt(s,(function(t){return t.y>e.y?l.push(t):a.push(t),t.children})),s.length&&(r=l.length&&a.length?e.height/2:e.height,a.length&&(i=t.calculateAdjustments(a,"y",r,e.y-10),t.makeSpace(i.movingShapes,i.resizingShapes,{x:0,y:r},"s")),l.length&&(o=t.calculateAdjustments(l,"y",-r,e.y+e.height+10),t.makeSpace(o.movingShapes,o.resizingShapes,{x:0,y:-r},"n")))}(i,o))}))}Xu.$inject=["eventBus","spaceTool"],e(Xu,ws);function Gu(e,t){t.invoke(ws,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",500,(function(e){var t=e.elements;t.filter((function(e){return Qu(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;Qu(e,(o=s,-1!==t.indexOf(o)?s:r))&&(t[i]=n._replaceShape(e))}))}),!0)}function Qu(e,t){return!bn(e)&&Mi(e,"bpmn:BoundaryEvent")&&!t}function Yu(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(),y=Jc(f,h=u(i.width)?On(i):i);if(y){if(o=f.slice(0,y.index),s=f.slice(y.index+(y.bendpoint?1:0)),!o.length||!s.length)return;a=y.bendpoint?f[y.index]:h,1!==o.length&&Ku(e,o[o.length-1])||o.push(Zu(a)),1!==s.length&&Ku(e,s[0])||s.unshift(Zu(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&&v(g,(function(e){return e.source===p.source}))||[],d&&v(m,(function(e){return e.target===d.target}))||[]);b.length&&n.removeElements(b)}ws.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=On(o),a={x:s.x+i.x,y:s.y+i.y},l=g(n.children,(function(e){return t.canInsert(r,e)&&Jc(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 Ku(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 Zu(e){return z({},e)}function Ju(e,t){ws.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)&&ed(r)){(Mi(i,"bpmn:EventBasedGateway")?o.incoming.filter((e=>e!==r&&ed(e))):o.incoming.filter((e=>e!==r&&ed(e)&&Mi(e.source,"bpmn:EventBasedGateway")))).forEach((function(e){t.removeConnection(e)}))}})),this.preExecuted("shape.replace",(function(e){var n=e.context.newShape;Mi(n,"bpmn:EventBasedGateway")&&n.outgoing.filter(ed).reduce((function(e,t){return e.includes(t.target)?e:e.concat(t.target)}),[]).forEach((function(e){e.incoming.filter(ed).forEach((function(r){const i=e.incoming.filter(ed).filter((function(e){return e.source===n}));(r.source!==n||i.length>1)&&t.removeConnection(r)}))}))}))}function ed(e){return Mi(e,"bpmn:SequenceFlow")}Gu.$inject=["bpmnReplace","injector"],e(Gu,ws),Gu.prototype._replaceShape=function(e){var t,n,r=(n=Di(e).eventDefinitions)&&n[0];return t=r?{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:r.$type}:{type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,t,{layoutConnection:!1})},e(Yu,ws),Yu.$inject=["eventBus","bpmnRules","modeling"],Ju.$inject=["eventBus","modeling"],e(Ju,ws);var td=1500;function nd(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"],td,(function(t){var r=t.context.shape||t.shape,i=t.hover;Mi(i,"bpmn:Lane")&&!Ai(r,["bpmn:Lane","bpmn:Participant"])&&(t.hover=Uu(i),t.hoverGfx=e.getGraphics(t.hover));var o=n.getRootElement();i!==o&&(r.labelTarget||Mi(r,"bpmn:Group"))&&(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"],td,(function(t){var n=t.hover;Mi(n,"bpmn:Lane")&&(t.hover=Uu(n)||n,t.hoverGfx=e.getGraphics(t.hover))})),t.on(["bendpoint.move.hover"],td,(function(t){var n=t.context,r=t.hover,i=n.type;Mi(r,"bpmn:Lane")&&/reconnect/.test(i)&&(t.hover=Uu(r)||r,t.hoverGfx=e.getGraphics(t.hover))})),t.on(["connect.start"],td,(function(e){var t=e.context,n=t.start;Mi(n,"bpmn:Lane")&&(t.start=Uu(n)||n)})),t.on("shape.move.start",2e3,(function(e){var t=e.shape;Mi(t,"bpmn:Lane")&&(e.shape=Uu(t)||t)})),t.on("spaceTool.move",2e3,(function(e){var t=e.hover;t&&Mi(t,"bpmn:Lane")&&(e.hover=Uu(t))}))}nd.$inject=["elementRegistry","eventBus","canvas"];function rd(e,t,n,r,i,o){function s(e,t,r){var i=n.filter((function(e){return Mi(e,"bpmn:Group")})).filter((function(e){return e.businessObject!==r}));t&&!function(e,t){return e.some((function(e){var n=Di(e);return(n.categoryValueRef&&n.categoryValueRef.$parent)===t}))}(i,t)&&function(e){var t=e.$parent;t&&(Tt(t.get("rootElements"),e),e.$parent=null)}(t),e&&!function(e,t){return e.some((function(e){return Di(e).categoryValueRef===t}))}(i,e)&&function(e){var t=e.$parent;t&&(Tt(t.get("categoryValue"),e),e.$parent=null)}(e)}function a(e,n){return function(e,t,n){return Mt(t.get("categoryValue"),e),e.$parent=t,Mt(n.get("rootElements"),t),t.$parent=n,e}(e,n,t.getDefinitions())}function l(n,r){var i=Di(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=Di(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(ws,this),this.execute("label.create",(function(e){var t=e.context,n=t.labelTarget;Mi(n,"bpmn:Group")&&l(n,t)})),this.revert("label.create",(function(e){var t=e.context,n=t.labelTarget;Mi(n,"bpmn:Group")&&c(n,t)})),this.execute("shape.delete",(function(e){var t=e.context,n=t.shape,r=Di(n);if(Mi(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(Mi(n,"bpmn:Group")&&!n.labelTarget){var r=t.category,i=t.categoryValue,o=Di(n);i&&(o.categoryValueRef=i,a(i,r))}})),this.execute("shape.create",(function(e){var t=e.context,n=t.shape;Mi(n,"bpmn:Group")&&!n.labelTarget&&Di(n).categoryValueRef&&l(n,t)})),this.reverted("shape.create",(function(e){var t=e.context,n=t.shape;Mi(n,"bpmn:Group")&&!n.labelTarget&&Di(n).categoryValueRef&&c(n,t)})),r.on("copyPaste.copyElement",770,(function(e){var t=e.descriptor,n=e.element;if(Mi(n,"bpmn:Group")&&!n.labelTarget){var r=Di(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 id(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 od(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=id(e,t,n,i),a=id(e,t,n,o);r=s&&a?sd(s,n)>sd(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],On(n.source)),t(r[r.length-1],r[r.length-2],On(n.target)))}))}function sd(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function ad(e){ws.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=Di(n),i=Ni(n);if(Ai(r,t)){var o=i.get("isHorizontal");void 0===o&&(o=!0),i.set("isHorizontal",o)}}))}rd.$inject=["bpmnFactory","bpmnjs","elementRegistry","eventBus","injector","moddleCopy"],e(rd,ws),od.$inject=["eventBus"],ad.$inject=["eventBus"],e(ad,ws);var ld=Math.sqrt,cd=Math.min,pd=Math.max,ud=Math.abs;function dd(e){return Math.pow(e,2)}function hd(e,t){return ld(dd(e.x-t.x)+dd(e.y-t.y))}function fd(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=ld(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 md(e.x,t.x,n.x)&&md(e.y,t.y,n.y)}(n,e,t)}))}function md(e,t,n){return e>=cd(t,n)-gd&&e<=pd(t,n)+gd}var gd=.1;function yd(e,t){return ud(e.x-t.x)<=gd&&ud(e.y-t.y)<=gd}function vd(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(yd(n=t[f],r=t[f+1])?a=[n]:(i=hd(e,n),o=hd(e,r),a=fd(n,r,e,cd(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:yd(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:hd(n,s)/hd(n,r)}),c=hd(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&&bd(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=wd(n,l),h=wd(t,c),f=a.position,m=function(e,t){var n=ip(e[0],e[1]),r=ip(e[0],t);return 0===n?0:r/n}(d,f),g=(p=h,u=tp(d),tp(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=bd(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:xn(k),delta:xn({x:i,y:o})}}function bd(e,t){var n=ip(e[t-1],e[t]);return n/(n+ip(e[t],e[t+1]))}function wd(e,t){return[e[t],e[t+1]]}function xd(e,t,n){var r=ha(t),i=ha(n),o=fa(e,r),s=o.x*(n.width/t.width),a=o.y*(n.height/t.height);return xn({x:i.x+s,y:i.y+a})}function _d(e,t,n){var r=ha(e),i=ha(t),o=ha(n),s=fa(e,r),a=fa(r,i),l=function(e,t,n){var r=_n(t),i=_n(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=Pn(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=Pn(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 xn({x:u+s.x-e.x,y:d+s.y-e.y})}var kd="name",Ed="text";function Od(e,t,n,r){function i(e){var n=e.context,i=n.element,o=n.properties;if(kd in o&&t.updateLabel(i,o[kd]),Ed in o&&Mi(i,"bpmn:TextAnnotation")){var s=r.getTextAnnotationBounds({x:i.x,y:i.y,width:i.width,height:i.height},o[Ed]||"");t.updateLabel(i,o.text,s)}}function o(e){var t=e.context,n=t.connection,r=n.label,i=z({},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 vd(On(e),t,n,r).delta}(r,o,s,i)}ws.call(this,e),this.postExecute("element.updateProperties",i),this.postExecute("element.updateModdleProperties",(e=>{Di(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;!bn(r)&&ro(r)&&lo(r)&&t.updateLabel(r,lo(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=Di(n);i&&ro(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(io(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:rp(e,t)}}));return A(n,"distance")[0].line}(e,t);return np(e,n)}(On(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=Pd(l,s,o);t.moveShape(a,c)}}))}function Pd(e,t,n){return xn(fa(xd(e,t,n),e))}function Sd(e,t){function n(e,t){var n=e.context,r=n.connection,i=z({},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 vd(e,t,n,r).point}(t,o,s,i)}ws.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 Cd(e,t,n){var r=Nd(e),i=Rd(r,t),o=r[0];return i.length?i[i.length-1]:xd(o.original||o,n,t)}function Td(e,t,n){var r=Nd(e),i=Rd(r,t),o=r[r.length-1];return i.length?i[0]:xd(o.original||o,n,t)}function Md(e,t,n){var r=Nd(e),i=Dd(t,n),o=r[0];return xd(o.original||o,i,t)}function Ad(e,t,n){var r=Nd(e),i=Dd(t,n),o=r[r.length-1];return xd(o.original||o,i,t)}function Dd(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function Nd(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Rd(e,t){return v(E(e,jd),(function(e){return function(e,t){return"intersect"===Pn(t,e,1)}(e,t)}))}function jd(e){return e.original||e}function $d(e,t){ws.call(this,e),this.postExecute("shape.replace",(function(e){var n=e.oldShape,r=e.newShape;if(function(e,t){return Mi(e,"bpmn:Participant")&&Yi(e)&&Mi(t,"bpmn:Participant")&&!Yi(t)}(n,r)){var i,o,s,a,l=(o=_t([i=n],!1),s=[],a=[],o.forEach((function(e){e!==i&&(e.incoming.forEach((function(e){Mi(e,"bpmn:MessageFlow")&&s.push(e)})),e.outgoing.forEach((function(e){Mi(e,"bpmn:MessageFlow")&&a.push(e)})))}),[]),{incoming:s,outgoing:a});l.incoming.forEach((function(e){var i=Td(e,r,n);t.reconnectEnd(e,r,i)})),l.outgoing.forEach((function(e){var i=Cd(e,r,n);t.reconnectStart(e,r,i)}))}}),!0)}e(Od,ws),Od.$inject=["eventBus","modeling","bpmnFactory","textRenderer"],e(Sd,ws),Sd.$inject=["eventBus","modeling"],$d.$inject=["eventBus","modeling"],e($d,ws);const Bd=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function Id(e){const t=Di(e);if(!(Mi(t,"bpmn:BoundaryEvent")||Mi(t,"bpmn:StartEvent")&&Ji(t.$parent)))return!1;const n=t.get("eventDefinitions");return!(!n||!n.length)&&Bd.some((e=>Mi(n[0],e)))}function zd(e){return Mi(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function Ld(e,t){e.invoke(ws,this),this.postExecuted("shape.replace",(function(e){const n=e.context.oldShape,r=e.context.newShape,i=e.context.hints;if(!Id(r))return;const o=zd(r);if(i.targetElement&&void 0!==i.targetElement[o])return;const s=Di(n).get(o);s!==Di(r).get(o)&&t.updateProperties(r,{[o]:s})}))}function qd(e,t){ws.call(this,e),this.preExecute("shape.resize",(function(e){var n=e.shape,r=Ni(n),i=r&&r.get("label");i&&i.get("bounds")&&t.updateModdleProperties(n,i,{bounds:void 0})}),!0)}function Fd(e,t,n){ws.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(Mi(i,"bpmn:SequenceFlow")&&Mi(o,"bpmn:SequenceFlow")&&t.canConnect(i.source,o.target,i)){var s=function(e,t){var n=id(Vd(e[e.length-2]),Vd(e[e.length-1]),Vd(t[1]),Vd(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[Vd(e[0]),Vd(t[t.length-1])]}(i.waypoints,o.waypoints);n.reconnectEnd(i,o.target,s)}}}))}function Vd(e){return e.original||e}function Hd(e,t){ws.call(this,e),this.preExecute("shape.delete",(function(e){var t=e.shape,n=t.parent;Mi(t,"bpmn:Participant")&&(e.collaborationRoot=n)}),!0),this.postExecute("shape.delete",(function(e){var n=e.collaborationRoot;n&&!n.businessObject.participants.length&&t.makeProcess()}),!0)}function Ud(e,t,n,r){ws.call(this,e);var i=r.get("dragging",!1);function o(e){var r,i,o=e.source,s=e.target;e.parent&&(Mi(e,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(o,s)||(i=!0),n.canConnectMessageFlow(o,s)&&(r="bpmn:MessageFlow")),Mi(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){b(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=g(o.outgoing,D({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 Wd(e,t,n,r,i,o){r.invoke(ws,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=x(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=[];b(n.closure.topLevel,(function(e){o=Ji(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})}))}Ld.$inject=["injector","modeling"],e(Ld,ws),e(qd,ws),qd.$inject=["eventBus","modeling"],e(Fd,ws),Fd.$inject=["eventBus","bpmnRules","modeling"],Hd.$inject=["eventBus","modeling"],e(Hd,ws),e(Ud,ws),Ud.$inject=["eventBus","modeling","bpmnRules","injector"],e(Wd,ws),Wd.prototype._replaceElements=function(e,t){var n=this._elementRegistry,r=this._bpmnReplace,i=this._selection;b(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)},Wd.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var Xd={width:140,height:120},Gd={width:300,height:60},Qd={width:300,height:150},Yd={width:140,height:120},Kd={width:50,height:30};function Zd(e){e.on("resize.start",1500,(function(e){var t=e.context,n=t.shape,r=t.direction,i=t.balanced;(Mi(n,"bpmn:Lane")||Mi(n,"bpmn:Participant"))&&(t.resizeConstraints=function(e,t,n){var r=Uu(e),i=!0,o=!0,s=Vu(r,[r]),a=_n(e),l={},c={};/e/.test(t)?c.right=a.left+Gd.width:/w/.test(t)&&(c.left=a.right-Gd.width);s.forEach((function(e){var r=_n(e);/n/.test(t)&&(r.top<a.top-10&&(i=!1),n&&Jd(a.top-r.bottom)<10&&ih(l,"top",r.top+Gd.height),Jd(a.top-r.top)<5&&rh(c,"top",r.bottom-Gd.height)),/s/.test(t)&&(r.bottom>a.bottom+10&&(o=!1),n&&Jd(a.bottom-r.top)<10&&rh(l,"bottom",r.bottom-Gd.height),Jd(a.bottom-r.bottom)<5&&ih(c,"bottom",r.top+Gd.height))}));var p=r.children.filter((function(e){return!e.hidden&&!e.waypoints&&(Mi(e,"bpmn:FlowElement")||Mi(e,"bpmn:Artifact"))}));return p.forEach((function(e){var n=_n(e);i&&/n/.test(t)&&rh(c,"top",n.top-ah),/e/.test(t)&&ih(c,"right",n.right+oh),o&&/s/.test(t)&&ih(c,"bottom",n.bottom+lh),/w/.test(t)&&rh(c,"left",n.left-sh)})),{min:c,max:l}}(n,r,i)),Mi(n,"bpmn:Participant")&&(t.minDimensions=Qd),Mi(n,"bpmn:SubProcess")&&Yi(n)&&(t.minDimensions=Yd),Mi(n,"bpmn:TextAnnotation")&&(t.minDimensions=Kd)}))}Zd.$inject=["eventBus"];var Jd=Math.abs,eh=Math.min,th=Math.max;function nh(e,t,n,r){var i=e[t];e[t]=void 0===i?n:r(n,i)}function rh(e,t,n){return nh(e,t,n,eh)}function ih(e,t,n){return nh(e,t,n,th)}var oh=20,sh=50,ah=20,lh=20;function ch(e,t){e.on("resize.start",1501,(function(e){var t=e.context,n=t.shape;(Mi(n,"bpmn:Lane")||Mi(n,"bpmn:Participant"))&&(t.balanced=!Yo(e))})),e.on("resize.end",1001,(function(e){var n=e.context,r=n.shape,i=n.canExecute,o=n.newBounds;if(Mi(r,"bpmn:Lane")||Mi(r,"bpmn:Participant"))return i&&(o=wn(o),t.resizeLane(r,o,n.balanced)),!1}))}ch.$inject=["eventBus","modeling"];function ph(e,t,n,r,i){function o(e){return Ai(e,["bpmn:ReceiveTask","bpmn:SendTask"])||function(e,t){c(t)||(t=[t]);return k(t,(function(t){return eo(e,t)}))}(e,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function s(t){return!!g(e.getDefinitions().get("rootElements"),D({id:t.id}))}function a(e){return Mi(e,"bpmn:ErrorEventDefinition")?"errorRef":Mi(e,"bpmn:EscalationEventDefinition")?"escalationRef":Mi(e,"bpmn:MessageEventDefinition")?"messageRef":Mi(e,"bpmn:SignalEventDefinition")?"signalRef":void 0}function l(e){if(Ai(e,["bpmn:ReceiveTask","bpmn:SendTask"]))return e.get("messageRef");var t=e.get("eventDefinitions")[0];return t.get(a(t))}n.invoke(ws,this),this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],(function(t){var n=t.shape||t.element;if(o(n)){var r=l(Di(n));r&&!s(r)&&(Mt(e.getDefinitions().get("rootElements"),r),t.addedRootElement=r)}}),!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],(function(t){var n=t.addedRootElement;n&&Tt(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(Di(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(Ai(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)}))}ph.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],e(ph,ws);var uh=Math.max;function dh(e){e.on("spaceTool.getMinDimensions",(function(e){var t=e.shapes,n=e.axis,r=e.start,i={};return b(t,(function(e){var t=e.id;Mi(e,"bpmn:Participant")&&(!function(e){return"x"===e}(n)?i[t]={width:Qd.width,height:hh(e,r)}:i[t]=Qd),Mi(e,"bpmn:SubProcess")&&Yi(e)&&(i[t]=Yd),Mi(e,"bpmn:TextAnnotation")&&(i[t]=Kd),Mi(e,"bpmn:Group")&&(i[t]=Xd)})),i}))}function hh(e,t){var n;return Hu(e).length?(n=function(e,t){var n,r=Hu(e);return n=fh(r,t),e.height-n.height+Gd.height}(e,t),uh(Qd.height,n)):Qd.height}function fh(e,t){var n,r,i;for(n=0;n<e.length;n++)if(t>=(r=e[n]).y&&t<=r.y+r.height)return(i=Hu(r)).length?fh(i,t):r}dh.$inject=["eventBus"];var mh=180,gh=160;function yh(e,t,n,r,i,o,s){ws.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 Mi(e,"bpmn:SubProcess")&&!Yi(e)}function c(t){var n=t.shape,r=t.newRootElement,i=Di(n);r=a._addDiagram(r||i),t.newRootElement=e.addRootElement(r)}function p(t){var n=Di(t.shape);a._removeDiagram(n);var r=t.newRootElement=s.get(Ts(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(Ts(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(Ts(n)))}),!0),this.postExecuted("shape.replace",(function(t){var r=t.newShape,i=t.oldRoot,o=e.findRoot(Ts(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(Mi(t,"bpmn:SubProcess")){var n=e.properties,r=e.oldProperties.id,i=n.id;if(r!==i){if(As(t))return s.updateId(t,Ms(i)),void s.updateId(r,i);s.get(Ms(r))&&s.updateId(Ms(r),Ms(i))}}}),!0),this.reverted("element.updateProperties",(function(e){var t=e.element;if(Mi(t,"bpmn:SubProcess")){var n=e.properties,r=e.oldProperties.id,i=n.id;if(r!==i){if(As(t))return s.updateId(t,Ms(r)),void s.updateId(i,r);var o=s.get(Ms(i));o&&s.updateId(o,Ms(r))}}}),!0),t.on("element.changed",(function(e){var n=e.element;if(As(n)){var r=n,i=s.get(Cs(r));i&&i!==r&&t.fire("element.changed",{element:i})}})),this.executed("shape.toggleCollapse",400,(function(e){var t=e.shape;Mi(t,"bpmn:SubProcess")&&(Yi(t)?p(e):(c(e),a._showRecursively(t.children)))}),!0),this.reverted("shape.toggleCollapse",400,(function(e){var t=e.shape;Mi(t,"bpmn:SubProcess")&&(Yi(t)?p(e):(c(e),a._showRecursively(t.children)))}),!0),this.postExecuted("shape.toggleCollapse",600,(function(e){var t=e.shape;if(Mi(t,"bpmn:SubProcess")){var n=e.newRootElement;n&&(Yi(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=Ts(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(Mi(Ni(i),"bpmndi:BPMNPlane")){var o=Cs(i),s=g(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 vh(e,t){e.invoke(ws,this),this.postExecuted("shape.replace",(function(e){var n=e.context.oldShape,r=e.context.newShape;if(Mi(r,"bpmn:SubProcess")&&(Mi(n,"bpmn:Task")||Mi(n,"bpmn:CallActivity"))&&Yi(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 bh(e,t){ws.call(this,e),this.postExecuted("shape.toggleCollapse",1500,(function(e){var n=e.shape;if(!Yi(n)){var r=_t(n);r.forEach((function(e){var t=e.incoming.slice(),n=e.outgoing.slice();b(t,(function(e){i(e,!0)})),b(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,On(n)):t.reconnectStart(e,n,On(n)))}}),!0)}e(yh,ws),yh.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=kt(o);if(t.x){var a=On(t),l=On(s);n={x:a.x-l.x,y:a.y-l.y}}else n={x:mh-s.x,y:gh-s.y};r.moveElements(i,n,t,{autoResize:!1})}else r.moveElements(i,{x:0,y:0},t,{autoResize:!1})}},yh.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},yh.prototype._addDiagram=function(e){var t=this._bpmnjs.getDefinitions().diagrams;return e.businessObject||(e=this._createNewDiagram(e)),t.push(e.di.$parent),e},yh.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:Ts(e),type:e.$type,di:r,businessObject:e,collapsed:!0})},yh.prototype._removeDiagram=function(e){var t=this._bpmnjs.getDefinitions().diagrams,n=g(t,(function(t){return t.plane.bpmnElement.id===e.id}));return t.splice(t.indexOf(n),1),n},yh.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"],vh.$inject=["injector","modeling"],e(vh,ws),e(bh,ws),bh.$inject=["eventBus","modeling"];function wh(e,t,n){ws.call(this,e),this.executed(["shape.toggleCollapse"],500,(function(e){var t,n=e.context.shape;Mi(n,"bpmn:SubProcess")&&(n.collapsed?Ni(n).isExpanded=!1:((t=n.children).length&&t.forEach((function(e){"label"!==e.type||e.businessObject.name||(e.hidden=!0)})),Ni(n).isExpanded=!0))})),this.reverted(["shape.toggleCollapse"],500,(function(e){var t=e.context.shape;t.collapsed?Ni(t).isExpanded=!1:Ni(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=zu(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 xh(e,t,n,r){t.invoke(ws,this),this.preExecute("shape.delete",(function(e){var t=e.context.shape,i=t.businessObject;bn(t)||(Mi(t,"bpmn:Participant")&&Yi(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;Mi(t,"bpmn:Collaboration")&&n.ids.unclaim(r.id)}))}function _h(e,t){ws.call(this,e),this.preExecute("connection.delete",(function(e){var n=e.context.connection,r=n.source;(function(e,t){if(!Mi(e,"bpmn:SequenceFlow"))return!1;var n=Di(t),r=Di(e);return n.get("default")===r})(n,r)&&t.updateProperties(r,{default:null})}))}e(wh,ws),wh.$inject=["eventBus","elementFactory","modeling"],e(xh,ws),xh.$inject=["canvas","injector","moddle","modeling"],e(_h,ws),_h.$inject=["eventBus","modeling"];function kh(e,t,n){var r;function i(){if(!r)throw new Error(n("out of bounds release"));return r}ws.call(this,e);var o=["spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move","shape.create","shape.delete","shape.move","shape.resize"];this.preExecute(o,5e3,(function(e){(r=r||new Eh).enter()})),this.postExecuted(o,500,(function(e){!function(){if(!r)throw new Error(n("out of bounds release"));var e=r.leave();e&&(t.updateLaneRefs(r.flowNodes,r.lanes),r=null)}()})),this.preExecute(["shape.create","shape.move","shape.delete","shape.resize"],(function(e){var t=e.context.shape,n=i();t.labelTarget||(Mi(t,"bpmn:Lane")&&n.addLane(t),Mi(t,"bpmn:FlowNode")&&n.addFlowNode(t))}))}function Eh(){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}}kh.$inject=["eventBus","modeling","translate"],e(kh,ws);var Oh={__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","toggleCollapseConnectionBehaviour","toggleElementCollapseBehaviour","unclaimIdBehavior","updateFlowNodeRefsBehavior","unsetDefaultFlowBehavior"],adaptiveLabelPositioningBehavior:["type",cu],appendBehavior:["type",uu],associationBehavior:["type",du],attachEventBehavior:["type",hu],boundaryEventBehavior:["type",mu],compensateBoundaryEventBehaviour:["type",gu],createBehavior:["type",wu],createDataObjectBehavior:["type",xu],createParticipantBehavior:["type",Pu],dataInputAssociationBehavior:["type",Cu],dataStoreBehavior:["type",Au],deleteLaneBehavior:["type",Xu],detachEventBehavior:["type",Gu],dropOnFlowBehavior:["type",Yu],eventBasedGatewayBehavior:["type",Ju],fixHoverBehavior:["type",nd],groupBehavior:["type",rd],importDockingFix:["type",od],isHorizontalFix:["type",ad],labelBehavior:["type",Od],layoutConnectionBehavior:["type",Sd],messageFlowBehavior:["type",$d],nonInterruptingBehavior:["type",Ld],removeElementBehavior:["type",Fd],removeEmbeddedLabelBoundsBehavior:["type",qd],removeParticipantBehavior:["type",Hd],replaceConnectionBehavior:["type",Ud],replaceElementBehaviour:["type",Wd],resizeBehavior:["type",Zd],resizeLaneBehavior:["type",ch],rootElementReferenceBehavior:["type",ph],spaceToolBehavior:["type",dh],subProcessPlaneBehavior:["type",yh],subProcessStartEventBehavior:["type",vh],toggleCollapseConnectionBehaviour:["type",bh],toggleElementCollapseBehaviour:["type",wh],unclaimIdBehavior:["type",xh],unsetDefaultFlowBehavior:["type",_h],updateFlowNodeRefsBehavior:["type",kh]};function Ph(e,t){var n=Pn(e,t,-15);return"intersect"!==n?n:null}function Sh(e){fc.call(this,e)}function Ch(e){return!e||bn(e)}function Th(e){do{if(Mi(e,"bpmn:Process"))return Di(e);if(Mi(e,"bpmn:Participant"))return Di(e).processRef||Di(e)}while(e=e.parent)}function Mh(e){return Mi(e,"bpmn:TextAnnotation")}function Ah(e){return Mi(e,"bpmn:Group")&&!e.labelTarget}function Dh(e){return Mi(e,"bpmn:BoundaryEvent")&&$h(e,"bpmn:CompensateEventDefinition")}function Nh(e){return Di(e).isForCompensation}function Rh(e){for(var t=e;t=t.parent;){if(Mi(t,"bpmn:FlowElementsContainer"))return Di(t);if(Mi(t,"bpmn:Participant"))return Di(t).processRef}return null}function jh(e,t){return Rh(e)===Rh(t)}function $h(e,t){return!!g(Di(e).eventDefinitions||[],(function(e){return Mi(e,t)}))}function Bh(e,t){return(Di(e).eventDefinitions||[]).every((function(e){return Mi(e,t)}))}function Ih(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 zh(e,t,n){if(Ch(e)||Ch(t))return null;if(!Mi(n,"bpmn:DataAssociation")){if(Jh(e,t))return{type:"bpmn:MessageFlow"};if(ef(e,t))return{type:"bpmn:SequenceFlow"}}var r=tf(e,t);return r||(Zh(e,t)?{type:"bpmn:Association",associationDirection:"One"}:!!Kh(e,t)&&{type:"bpmn:Association",associationDirection:"None"})}function Lh(e,t){return!(!bn(e)&&!Ah(e))||!(Mi(t,"bpmn:Participant")&&!Yi(t))&&(Mi(e,"bpmn:Participant")?Mi(t,"bpmn:Process")||Mi(t,"bpmn:Collaboration"):Ai(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:Mi(e,"bpmn:Lane")?Mi(t,"bpmn:Participant")||Mi(t,"bpmn:Lane"):!(Mi(e,"bpmn:BoundaryEvent")&&!function(e){return Di(e).cancelActivity&&(Vh(e)||Hh(e))}(e))&&(Mi(e,"bpmn:FlowElement")&&!Mi(e,"bpmn:DataStoreReference")?Mi(t,"bpmn:FlowElementsContainer")?Yi(t):Ai(t,["bpmn:Participant","bpmn:Lane"]):Mi(e,"bpmn:DataStoreReference")&&Mi(t,"bpmn:Collaboration")?k(Di(t).get("participants"),(function(e){return!!e.get("processRef")})):Ai(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?Ai(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):!!Mi(e,"bpmn:MessageFlow")&&(Mi(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t)))}function qh(e){return Mi(e,"bpmn:Lane")}function Fh(e){return!!function(e){return!bn(e)&&Mi(e,"bpmn:BoundaryEvent")}(e)||(!(!Mi(e,"bpmn:IntermediateThrowEvent")||!Vh(e))||Mi(e,"bpmn:IntermediateCatchEvent")&&Hh(e))}function Vh(e){var t=Di(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function Hh(e){return Uh(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function Uh(e,t){return t.some((function(t){return $h(e,t)}))}function Wh(e,t,n,r){if(Array.isArray(e)||(e=[e]),1!==e.length)return!1;var i=e[0];return!bn(i)&&(!!Fh(i)&&(!Ji(t)&&(!(!Mi(t,"bpmn:Activity")||Nh(t))&&(!(r&&!Ph(r,t))&&(!function(e){return Mi(e,"bpmn:ReceiveTask")&&g(e.incoming,(function(e){return Mi(e.source,"bpmn:EventBasedGateway")}))}(t)&&"attach")))))}function Xh(e,t,n){if(!t)return!1;var r={replacements:[]};return b(e,(function(e){Ji(t)||Mi(e,"bpmn:StartEvent")&&"label"!==e.type&&Lh(e,t)&&(Zi(e)||r.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"}),(function(e){return eo(e,"bpmn:ErrorEventDefinition")}(e)||function(e){return eo(e,"bpmn:EscalationEventDefinition")}(e)||function(e){return eo(e,"bpmn:CompensateEventDefinition")}(e))&&r.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"}),Uh(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&Mi(t,"bpmn:SubProcess")&&r.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"})),Mi(t,"bpmn:Transaction")||$h(e,"bpmn:CancelEventDefinition")&&"label"!==e.type&&(Mi(e,"bpmn:EndEvent")&&Lh(e,t)&&r.replacements.push({oldElementId:e.id,newElementType:"bpmn:EndEvent"}),Mi(e,"bpmn:BoundaryEvent")&&Wh(e,t,0,n)&&r.replacements.push({oldElementId:e.id,newElementType:"bpmn:BoundaryEvent"}))})),!!r.replacements.length&&r}function Gh(e,t){return!k(e,qh)&&(!t||e.every((function(e){return Lh(e,t)})))}function Qh(e,t,n,r){return!!t&&(!(!bn(e)&&!Ah(e))||!function(e,t){return e===t}(n,t)&&((!n||!Ih(n,t))&&(Lh(e,t)||nf(e,t))))}function Yh(e,t){return Mi(e,"bpmn:SubProcess")?Yi(e)&&(!t||t.width>=100&&t.height>=80):Mi(e,"bpmn:Lane")?!t||t.width>=130&&t.height>=60:Mi(e,"bpmn:Participant")?!t||t.width>=250&&t.height>=50:!!Mh(e)||!!Ah(e)}function Kh(e,t){return!Ih(t,e)&&!Ih(e,t)&&(!!function(e,t){var n=Mh(e),r=Mh(t);return(n||r)&&n!==r}(e,t)||!!tf(e,t))}function Zh(e,t){return jh(e,t)&&Dh(e)&&Mi(t,"bpmn:Activity")&&(n=e,!t.attachers.includes(n))&&!Ji(t);var n}function Jh(e,t){return!(of(e)&&!of(t))&&(Mi(n=e,"bpmn:InteractionNode")&&!Mi(n,"bpmn:BoundaryEvent")&&(!Mi(n,"bpmn:Event")||Mi(n,"bpmn:ThrowEvent")&&Bh(n,"bpmn:MessageEventDefinition"))&&function(e){return Mi(e,"bpmn:InteractionNode")&&!Nh(e)&&(!Mi(e,"bpmn:Event")||Mi(e,"bpmn:CatchEvent")&&Bh(e,"bpmn:MessageEventDefinition"))&&!(Mi(e,"bpmn:BoundaryEvent")&&!$h(e,"bpmn:MessageEventDefinition"))}(t)&&!function(e,t){return Th(e)===Th(t)}(e,t));var n}function ef(e,t){return Mi(n=e,"bpmn:FlowNode")&&!Mi(n,"bpmn:EndEvent")&&!Ji(n)&&!(Mi(n,"bpmn:IntermediateThrowEvent")&&$h(n,"bpmn:LinkEventDefinition"))&&!Dh(n)&&!Nh(n)&&function(e){return Mi(e,"bpmn:FlowNode")&&!Mi(e,"bpmn:StartEvent")&&!Mi(e,"bpmn:BoundaryEvent")&&!Ji(e)&&!(Mi(e,"bpmn:IntermediateCatchEvent")&&$h(e,"bpmn:LinkEventDefinition"))&&!Nh(e)}(t)&&jh(e,t)&&!(Mi(e,"bpmn:EventBasedGateway")&&!function(e){return Mi(e,"bpmn:ReceiveTask")||Mi(e,"bpmn:IntermediateCatchEvent")&&($h(e,"bpmn:MessageEventDefinition")||$h(e,"bpmn:TimerEventDefinition")||$h(e,"bpmn:ConditionalEventDefinition")||$h(e,"bpmn:SignalEventDefinition"))}(t));var n}function tf(e,t){return Ai(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&Ai(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:!(!Ai(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])||!Ai(e,["bpmn:Activity","bpmn:CatchEvent"]))&&{type:"bpmn:DataOutputAssociation"}}function nf(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&&(Ai(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!bn(t)&&Mi(e,"bpmn:FlowNode")&&!Mi(e,"bpmn:BoundaryEvent")&&Lh(e,t.parent))}function rf(e,t){return!!bn(t)||!(Mi(t,"bpmn:Lane")&&!function(e,t){return e&&t&&-1!==e.indexOf(t)}(e,t.parent))}function of(e){return Cc(e,"bpmn:Process")||Cc(e,"bpmn:Collaboration")}e(Sh,fc),Sh.$inject=["eventBus"],Sh.prototype.init=function(){this.addRule("connection.start",(function(e){return function(e){if(Ch(e))return null;return Ai(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 zh(t,n)}finally{i&&(n.parent=null)}})),this.addRule("connection.reconnect",(function(e){var t=e.connection;return zh(e.source,e.target,t)})),this.addRule("connection.updateWaypoints",(function(e){return{type:e.connection.type}})),this.addRule("shape.resize",(function(e){return Yh(e.shape,e.newBounds)})),this.addRule("elements.create",(function(e){var t=e.elements,n=e.position,r=e.target;return!(vn(r)&&!nf(t,r))&&_(t,(function(e){return vn(e)?zh(e.source,e.target,e):e.host?Wh(e,e.host,null,n):Qh(e,r,null)}))})),this.addRule("elements.move",(function(e){var t=e.target,n=e.shapes,r=e.position;return Wh(n,t,null,r)||Xh(n,t,r)||Gh(n,t)||nf(n,t)})),this.addRule("shape.create",(function(e){return Qh(e.shape,e.target,e.source,e.position)})),this.addRule("shape.attach",(function(e){return Wh(e.shape,e.target,null,e.position)})),this.addRule("element.copy",(function(e){var t=e.element;return rf(e.elements,t)}))},Sh.prototype.canConnectMessageFlow=Jh,Sh.prototype.canConnectSequenceFlow=ef,Sh.prototype.canConnectDataAssociation=tf,Sh.prototype.canConnectAssociation=Kh,Sh.prototype.canConnectCompensationAssociation=Zh,Sh.prototype.canMove=Gh,Sh.prototype.canAttach=Wh,Sh.prototype.canReplace=Xh,Sh.prototype.canDrop=Lh,Sh.prototype.canInsert=nf,Sh.prototype.canCreate=Qh,Sh.prototype.canConnect=zh,Sh.prototype.canResize=Yh,Sh.prototype.canCopy=rf;var sf={__depends__:[Qc],__init__:["bpmnRules"],bpmnRules:["type",Sh]};function af(e,t){e.on("saveXML.start",2e3,(function(){b(t.getRootElements(),(function(e){var t,n=Ni(e);t=E(v(_t([e],!1),(function(t){return t!==e&&!t.labelTarget})),Ni),n.set("planeElement",t)}))}))}af.$inject=["eventBus","canvas"];var lf={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",af]};function cf(e){ws.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 pf(e,t,n){cf.call(this,e);var r=[{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:MessageFlow",order:{level:9,containers:["bpmn:Collaboration"]}},{type:"bpmn:Association",order:{level:6,containers:["bpmn:Participant","bpmn:FlowElementsContainer","bpmn:Collaboration"]}},{type:"bpmn:BoundaryEvent",order:{level:8}},{type:"bpmn:Group",order:{level:10,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:FlowElement",order:{level:5}},{type:"bpmn:Participant",order:{level:-2}},{type:"bpmn:Lane",order:{level:-1}}];function i(e){var t=e.order;if(t||(e.order=t=function(e){if(e.labelTarget)return{level:10};var t=g(r,(function(t){return Ai(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)return{parent:t.findRoot(n)||t.getRootElement(),index:-1};var r=i(e);r.containers&&(n=function(e,t,n){for(var r=t;r&&!Ai(r,n);)r=r.parent;if(!r)throw new Error("no parent for <"+e.id+"> in <"+(t&&t.id)+">");return r}(e,n,r.containers));var o=n.children.indexOf(e),s=y(n.children,(function(t){return!(!e.labelTarget&&t.labelTarget)&&r.level<i(t).level}));return-1!==s&&-1!==o&&o<s&&(s-=1),{index:s,parent:n}}}cf.prototype.getOrdering=function(e,t){return null},e(cf,ws),pf.$inject=["eventBus","canvas","translate"],e(pf,cf);var uf={__depends__:[Bo],__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",pf]};function df(){}df.prototype.get=function(){return this._data},df.prototype.set=function(e){this._data=e},df.prototype.clear=function(){var e=this._data;return delete this._data,e},df.prototype.isEmpty=function(){return!this._data};var hf={clipboard:["type",df]},ff="drop-ok",mf="drop-not-ok",gf="attach-ok",yf="new-parent",vf="create";function bf(e,t,n,r,i){function o(t,n){[gf,ff,mf,yf].forEach((function(r){r===n?e.addMarker(t,r):e.removeMarker(t,r)}))}function s(){var e=t.context();e&&e.prefix===vf&&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);wf(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=g(e=v(e,(function(t){var n=t.labelTarget;return!(t.parent||bn(t)&&-1!==e.indexOf(n))})),(function(e){return!vn(e)})),a=!1,l=!1,c=!1;xf(e)&&(a=i.allowed("shape.attach",{position:n,shape:s,target:t})),a||(c=xf(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,gf):o(r,c?yf:mf))})),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;wf(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}):g(o=r.createElements(o,u,s,z({},p,{attach:l})),(function(e){return!vn(e)})),z(t,{elements:o,shape:i}),z(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=g(n,(function(e){return!vn(e)}));if(i){r=z({elements:n,hints:{},shape:i},r||{}),b(n,(function(e){u(e.x)||(e.x=0),u(e.y)||(e.y=0)}));var o=kt(v(n,(function(e){return!e.hidden})));b(n,(function(e){vn(e)&&(e.waypoints=E(e.waypoints,(function(e){return{x:e.x-o.x-o.width/2,y:e.y-o.y-o.height/2}}))),z(e,{x:e.x-o.x-o.width/2,y:e.y-o.y-o.height/2})})),t.init(e,vf,{cursor:"grabbing",autoActivate:!0,data:{shape:i,elements:n,context:r}})}}}function wf(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 xf(e){return e&&1===e.length&&!vn(e[0])}bf.$inject=["canvas","dragging","eventBus","modeling","rules"];function _f(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=ze("g");Te(t,i.cls("djs-drag-group",["no-events"]));var o=ze("g");return e.forEach((function(e){var i;e.hidden||(e.waypoints?(i=n._createContainer("connection",o),n.drawConnection(er(i),e)):(i=n._createContainer("shape",o),n.drawShape(er(i),e),nr(i,e.x,e.y)),r.addDragger(e,t,i))})),t}(a)),o?(l.parentNode||Oe(e.getActiveLayer(),l),nr(l,t.x,t.y)):Ne(l)})),t.on("create.cleanup",(function(e){var t=e.context.dragGroup;t&&Ne(t)}))}_f.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];var kf={__depends__:[Hc,ru,Qc,ps],__init__:["create","createPreview"],create:["type",bf],createPreview:["type",_f]};function Ef(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)}))}Ef.$inject=["eventBus"],Ef.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 Of={__init__:["mouse"],mouse:["type",Ef]};function Pf(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=g(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),vn(n)&&(t.priority=3,t.source=n.source.id,t.target=n.target.id,t.waypoints=function(e){return E(e.waypoints,(function(e){return(e=Sf(e)).original&&(e.original=Sf(e.original)),e}))}(n)),bn(n)&&(t.priority=4,t.labelTarget=n.labelTarget.id),b(["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){z(e.hints,{createElementsBehavior:!1})}))}function Sf(e){return z({},e)}function Cf(e,t){var n=t.indexOf(e);return-1===n?t:t.splice(n,1)}Pf.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],Pf.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},Pf.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||{}})}},Pf.prototype._paste=function(e,t,n,r){b(e,(function(e){u(e.x)||(e.x=0),u(e.y)||(e.y=0)}));var i=kt(e);return b(e,(function(e){vn(e)&&(e.waypoints=E(e.waypoints,(function(e){return{x:e.x-i.x-i.width/2,y:e.y-i.y-i.height/2}}))),z(e,{x:e.x-i.x-i.width/2,y:e.y-i.y-i.height/2})})),this._modeling.createElements(e,n,t,z({},r))},Pf.prototype._createElements=function(e){var t=this,n=this._eventBus,r={},i=[];return b(e,(function(e,o){b(e=A(e,"priority"),(function(e){var o,s=z({},V(e,["priority"]));return r[e.parent]?s.parent=r[e.parent]:delete s.parent,n.fire("copyPaste.pasteElement",{cache:r,descriptor:s}),vn(s)?(s.source=r[e.source],s.target=r[e.target],o=r[e.id]=t.createConnection(s),void i.push(o)):bn(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},Pf.prototype.createConnection=function(e){return this._elementFactory.createConnection(V(e,["id"]))},Pf.prototype.createLabel=function(e){return this._elementFactory.createLabel(V(e,["id"]))},Pf.prototype.createShape=function(e){return this._elementFactory.createShape(V(e,["id"]))},Pf.prototype.hasRelations=function(e,t){var n,r;return!(vn(e)&&(n=g(t,D({id:e.source.id})),r=g(t,D({id:e.target.id})),!n||!r))&&!(bn(e)&&!g(t,D({id:e.labelTarget.id})))},Pf.prototype.createTree=function(e){var t=this._rules,n=this,r={},i=[];function o(e,t){var n=g(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 xt(vt(e),(function(e,t,r){if(!bn(e)){b(e.labels,(function(e){o(e,r)})),b([e.attachers,e.incoming,e.outgoing],(function(e){e&&e.length&&b(e,(function(e){b(e.labels,(function(e){o(e,r)})),o(e,r)}))})),o(e,r);var i=[];return e.children&&(i=e.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:e,children:i}),i}})),e=E(i,(function(e){return e.element})),i=E(i,(function(t){return t.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:t.descriptor,element:t.element,elements:e}),t})),i=A(i,(function(e){return e.descriptor.priority})),e=E(i,(function(e){return e.element})),b(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)?Cf(i.element,e):(r[o]||(r[o]=[]),r[o].push(i.descriptor)):Cf(i.element,e)})),r};var Tf={__depends__:[hf,kf,Of,Qc],__init__:["copyPaste"],copyPaste:["type",Pf]};function Mf(e,t,n){c(n)||(n=[n]),b(n,(function(n){s(e[n])||(t[n]=e[n])}))}function Af(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=Di(n);if(bn(n))return t;var o=t.businessObject=r(i,!0),s=t.di=r(Ni(n),!0);s.bpmnElement=o,Mf(o,t,"name"),Mf(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(bn(n))return n.businessObject=Di(t[n.labelTarget]),void(n.di=Ni(t[n.labelTarget]));i=n.businessObject=r(i),(o=n.di=r(o)).bpmnElement=i,Mf(n,i,["isExpanded","name"]),n.type=i.$type})),t.on("copyPaste.copyElement",750,(function(e){var t=e.descriptor,n=e.element;if(Mi(n,"bpmn:Participant")){var i=Di(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=Di(e);return e.default&&(n[e.default]={element:r,property:"default"}),e.host&&(Di(e).attachedToRef=Di(t[e.host])),V(n,x(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)))}))}Af.$inject=["bpmnFactory","eventBus","moddleCopy"];var Df=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"];function Nf(e,t,n){this._bpmnFactory=t,this._eventBus=e,this._moddle=n,e.on("moddleCopy.canCopyProperties",(function(e){var t=e.propertyNames;if(t&&t.length)return A(t,(function(e){return"extensionElements"===e}))})),e.on("moddleCopy.canCopyProperty",(function(e){var t=e.parent,n=p(t)&&t.$descriptor,r=e.propertyName;return(!r||-1===Df.indexOf(r))&&(!(r&&n&&!g(n.properties,D({name:r})))&&void 0)})),e.on("moddleCopy.canSetCopiedProperty",(function(e){var t,n,r=e.property;if(n="bpmn:ExtensionElements",(t=r)&&d(t.$instanceOf)&&t.$instanceOf(n)&&(!r.values||!r.values.length))return!1}))}function Rf(e,t){return x(e.properties,(function(e,n){return t&&n.default?e:e.concat(n.name)}),[])}Nf.$inject=["eventBus","bpmnFactory","moddle"],Nf.prototype.copyElement=function(e,t,n,r=!1){var i=this;n&&!c(n)&&(n=[n]),n=n||Rf(e.$descriptor);var o=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:r});return!1===o||(c(o)&&(n=o),b(n,(function(n){var o;m(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},Nf.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 x(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}}},Nf.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 jf={__depends__:[Tf],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",Af],moddleCopy:["type",Nf]},$f=Math.round;function Bf(e,t){this._modeling=e,this._eventBus=t}function If(e,t){t.on("replace.end",500,(function(t){const{newElement:n,hints:r={}}=t;!1!==r.select&&e.select(n)}))}Bf.$inject=["modeling","eventBus"],Bf.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=$f(a+o/2),p=$f(l+s/2),u=r.replaceShape(e,z({},t,{x:c,y:p,width:o,height:s}),n);return i.fire("replace.end",{element:e,newElement:u,hints:n}),u},If.$inject=["selection","eventBus"];var zf={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",If],replace:["type",Bf]};var Lf=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function qf(e,t,n,r,i,o){this.replaceElement=function(a,l,p){p=p||{};var u=l.type,d=a.businessObject;if(Ff(d)&&"bpmn:SubProcess"===u&&function(e,t){var n=e&&m(e,"collapsed")?e.collapsed:!Yi(e);return n!==(t&&(m(t,"collapsed")||m(t,"isExpanded"))?m(t,"collapsed")?t.collapsed:!t.isExpanded:n)}(a,l))return r.toggleCollapse(a),a;var h=e.create(u),f={type:u,businessObject:h,di:{}};!function(e,t,n){c(n)||(n=[n]),b(n,(function(n){s(e[n])||(t[n]=e[n])}))}(a.di,f.di,["fill","stroke","background-color","border-color","color"]);var g=function(e,t){return e.filter((function(e){return t.includes(e)}))}(Rf(d.$descriptor),Rf(h.$descriptor,!0));z(h,F(l,Lf));var y=v(g,(function(e){return"eventDefinitions"===e?Vf(a,l.eventDefinitionType):"loopCharacteristics"===e?!Ji(h):!m(h,e)&&(("processRef"!==e||!1!==l.isExpanded)&&("triggeredByEvent"!==e&&("isForCompensation"!==e||!Ji(h))))}));if(h=n.copyElement(d,h,y),l.eventDefinitionType&&(Vf(h,l.eventDefinitionType)||(f.eventDefinitionType=l.eventDefinitionType,f.eventDefinitionAttrs=l.eventDefinitionAttrs)),Mi(d,"bpmn:Activity")){if(Ff(d))f.isExpanded=Yi(a);else if(l&&m(l,"isExpanded")){f.isExpanded=l.isExpanded;var w=t.getDefaultSize(h,{isExpanded:f.isExpanded});f.width=w.width,f.height=w.height,f.x=a.x-(f.width-a.width)/2,f.y=a.y-(f.height-a.height)/2}Yi(a)&&!Mi(d,"bpmn:Task")&&f.isExpanded&&(f.width=a.width,f.height=a.height)}return Ff(d)&&!Ff(h)&&(p.moveChildren=!1),Mi(d,"bpmn:Participant")&&(!0===l.isExpanded?h.processRef=e.create("bpmn:Process"):p.moveChildren=!1,f.width=a.width,f.height=t.getDefaultSize(f).height),o.allowed("shape.resize",{shape:h})||(f.height=t.getDefaultSize(f).height,f.width=t.getDefaultSize(f).width),h.name=d.name,Ai(d,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&Ai(h,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(h.default=d.default),l.host&&!Mi(d,"bpmn:BoundaryEvent")&&Mi(h,"bpmn:BoundaryEvent")&&(f.host=l.host),"bpmn:DataStoreReference"!==f.type&&"bpmn:DataObjectReference"!==f.type||(f.x=a.x+(a.width-f.width)/2),i.replaceElement(a,f,{...p,targetElement:l})}}function Ff(e){return Mi(e,"bpmn:SubProcess")}function Vf(e,t){var n=Di(e);return t&&n.get("eventDefinitions").some((function(e){return Mi(e,t)}))}qf.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];var Hf={__depends__:[jf,zf,ps],bpmnReplace:["type",qf]};function Uf(e,t){this._eventBus=e,this._dragging=t,this._tools=[],this._active=null}Uf.$inject=["eventBus","dragging"],Uf.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)},Uf.prototype.isActive=function(e){return e&&this._active===e},Uf.prototype.length=function(e){return this._tools.length},Uf.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Uf.prototype.bindEvents=function(e,t){var n=this._eventBus,r=this._dragging,i=[];n.on(t.tool+".init",(function(t){if(!t.context.reactivate&&this.isActive(e))return this.setActive(null),void r.cancel();this.setActive(e)}),this),b(t,(function(e){i.push(e+".ended"),i.push(e+".canceled")})),n.on(i,250,(function(e){this._active&&(function(e){var t=e.originalEvent&&e.originalEvent.target;return t&&oe(t,'.group[data-group="tools"]')}(e)||this.setActive(null))}),this)};var Wf={__depends__:[Hc],__init__:["toolManager"],toolManager:["type",Uf]};function Xf(e,t){return-1!==e.indexOf(t)}var Gf=Math.abs,Qf=Math.round,Yf={x:"width",y:"height"},Kf="crosshair",Zf={n:"top",w:"left",s:"bottom",e:"right"},Jf=1500,em={n:"s",w:"e",s:"n",e:"w"},tm=20;function nm(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",Jf,(function(e){var t=e.context,n=t.initialized;n||(n=t.initialized=a.init(e,t)),n&&im(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){im(e);var c={x:0,y:0};c[r]=Qf(e["d"+r]),a.makeSpace(o,s,c,i,l),n.once("spaceTool.ended",(function(e){a.activateSelection(e.originalEvent,!0,!0)}))}}))}function rm(e){return{top:e.top-tm,right:e.right+tm,bottom:e.bottom+tm,left:e.left-tm}}function im(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 om(e,t){return-1!==e.indexOf(t)}nm.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],nm.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:Kf,data:{context:{reactivate:n}},trapClick:!1})},nm.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:Kf,data:{context:{}}})},nm.prototype.makeSpace=function(e,t,n,r,i){return this._modeling.createSpace(e,t,n,r,i)},nm.prototype.init=function(e,t){var n=Gf(e.dx)>Gf(e.dy)?"x":"y",r=e["d"+n],i=e[n]-r;if(Gf(r)<5)return!1;r<0&&(r*=-1),Yo(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();!Ko(e)&&e.hover&&(s=e.hover);var a=[..._t(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 b(s,(function(e){var p,d,h,f,m,g,y=e.attachers,b=e.children,w=_n(e),x=v(b,(function(e){return!(vn(e)||bn(e)||om(o,e)||om(s,e))})),_=v(b,(function(e){return!vn(e)&&!bn(e)&&om(o,e)})),k=[],E=[];x.length&&(d=rm(_n(kt(x))),p=r-w[Zf[n]]+d[Zf[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=rm(_n(kt(_))),p=r-h[Zf[em[n]]]+w[Zf[em[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)),y&&y.length&&(y.forEach((function(e){om(o,e)?k.push(e):E.push(e)})),k.length&&(f=_n(kt(k.map(On))),m=w[Zf[em[n]]]-(f[Zf[em[n]]]-r)),E.length&&(g=_n(kt(E.map(On)))[Zf[n]]-(w[Zf[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[Yf[t]]-O[Yf[t]],c.bottom=l=u(l)?Math.min(l,p):p):"w"===n?(p=r+e[Yf[t]]-O[Yf[t]],c.right=l=u(l)?Math.min(l,p):p):"s"===n?(p=r-e[Yf[t]]+O[Yf[t]],c.top=a=u(a)?Math.max(a,p):p):"e"===n&&(p=r-e[Yf[t]]+O[Yf[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 z(t,l,{axis:n,direction:o,spaceToolConstraints:c,start:i}),ca("resize-"+("x"===n?"ew":"ns")),!0},nm.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)}b(e,(function(e){if(e.parent&&!bn(e))if(vn(e))l.push(e);else{var o=e[t],p=o+e[Yf[t]];if(function(e){return!!e.host}(e)&&(n>0&&On(e)[t]>r||n<0&&On(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)}}})),b(o,(function(e){var t=e.attachers;t&&b(t,(function(e){c(e)}))}));var p=o.concat(s);return b(a,(function(e){var t=e.host;om(p,t)&&c(e)})),p=o.concat(s),b(l,(function(e){var t=e.source,n=e.target,r=e.label;om(p,t)&&om(p,n)&&r&&c(r)})),{movingShapes:o,resizingShapes:s}},nm.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},nm.prototype.isActive=function(){var e=this._dragging.context();return!!e&&/^spaceTool/.test(e.prefix)};var sm="djs-dragging",am="djs-resizing",lm=Math.max;function cm(e,t,n,r,i){function o(e,t){b(e,(function(e){i.addDragger(e,t),n.addMarker(e,sm)}))}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=ze("g");Te(a,r.cls("djs-crosshair-group",["no-events"])),Oe(t,a);var l=ze("path");Te(l,"d",o),Ae(l).add("djs-crosshair"),Oe(a,l);var c=ze("path");Te(c,"d",s),Ae(c).add("djs-crosshair"),Oe(a,c),i.crosshairGroup=a})),e.on("spaceTool.selection.move",(function(e){nr(e.context.crosshairGroup,e.x,e.y)})),e.on("spaceTool.selection.cleanup",(function(e){var t=e.context.crosshairGroup;t&&Ne(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");Te(a=ze("path"),"d","M0,0 L0,0"),Ae(a).add("djs-crosshair"),Oe(u,a),s.line=a;var d=ze("g");Te(d,r.cls("djs-drag-group",["no-events"])),Oe(n.getActiveLayer(),d),o(c,d),o(s.movingConnections=t.filter((function(e){var t=!1;b(c,(function(n){b(n.outgoing,(function(n){e===n&&(t=!0)}))}));var n=!1;b(c,(function(t){b(t.incoming,(function(t){e===t&&(n=!0)}))}));var r=!1;b(p,(function(t){b(t.outgoing,(function(t){e===t&&(r=!0)}))}));var i=!1;return b(p,(function(t){b(t.incoming,(function(t){e===t&&(i=!0)}))})),vn(e)&&(t||r)&&(n||i)})),d),s.dragGroup=d}if(!s.frameGroup){var h=ze("g");Te(h,r.cls("djs-frame-group",["no-events"])),Oe(n.getActiveLayer(),h);var f=[];b(p,(function(e){var t=i.addFrame(e,h),r=t.getBBox();f.push({element:t,initialBounds:r}),n.addMarker(e,am)})),s.frameGroup=h,s.frames=f}Te(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,nr(s.dragGroup,m.x,m.y),b(s.frames,(function(e){var t,n,r=e.element,i=e.initialBounds;"e"===s.direction?Te(r,{width:lm(i.width+m.x,5)}):Te(r,{width:t=lm(i.width-m.x,5),x:i.x+i.width-t}),"s"===s.direction?Te(r,{height:lm(i.height+m.y,5)}):Te(r,{height:n=lm(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;b(r,(function(e){n.removeMarker(e,sm)})),b(i,(function(e){n.removeMarker(e,sm)})),a&&(Ne(s),Ne(a)),b(o,(function(e){n.removeMarker(e,am)})),l&&Ne(l)}))}cm.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];var pm={__init__:["spaceToolPreview"],__depends__:[Hc,Qc,Wf,ru,Of],spaceTool:["type",nm],spaceToolPreview:["type",cm]};function um(e){e.invoke(nm,this)}um.$inject=["injector"],e(um,nm),um.prototype.calculateAdjustments=function(e,t,n,r){var i=nm.prototype.calculateAdjustments.call(this,e,t,n,r);return i.resizingShapes=i.resizingShapes.filter((function(e){return!Mi(e,"bpmn:TextAnnotation")&&("y"!==t||!function(e){return Mi(e,"bpmn:Participant")&&!Di(e).processRef}(e))})),i};var dm={__depends__:[pm],spaceTool:["type",um]};function hm(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)}hm.$inject=["eventBus","injector"],hm.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()},hm.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},hm.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,!1!==e&&this._fire("changed",{trigger:"clear"})},hm.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()}},hm.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()}},hm.prototype.register=function(e,t){this._setHandler(e,t)},hm.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)},hm.prototype.canUndo=function(){return!!this._getUndoAction()},hm.prototype.canRedo=function(){return!!this._getRedoAction()},hm.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},hm.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},hm.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)}))},hm.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},hm.prototype._createId=function(){return this._uid++},hm.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},hm.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()},hm.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)},hm.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:T("id",r.reverse())}),r.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},hm.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=c(e)?e:[e],t.dirty=t.dirty.concat(e))},hm.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},hm.prototype._revertedAction=function(e){this._stackIdx--},hm.prototype._getHandler=function(e){return this._handlerMap[e]},hm.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 fm={commandStack:["type",hm]};function mm(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 gm(e,t,n){ws.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=ym(n),t.validatedShapes=ym(r)})),r&&t.on("shape.move.start",250,(function(e){var t=e.context,n=t.shapes,i=[];b(n,(function(e){b(e.labels,(function(n){n.hidden||-1!==t.shapes.indexOf(n)||i.push(n),e.labelTarget&&i.push(e)}))})),b(i,(function(e){r.makeDraggable(t,e,!0)}))})),this.preExecuted("elements.move",1400,(function(e){var t=e.context.closure,n=t.enclosedElements,r=[];b(n,(function(e){b(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;mm((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=At(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&&(Mt(r.labels,n,i),n.labelTarget=r)}))}function ym(e){return v(e,(function(t){return-1===e.indexOf(t.labelTarget)}))}e(gm,ws),gm.$inject=["injector","eventBus","modeling"];var vm={__init__:["labelSupport"],labelSupport:["type",gm]},bm="attach-ok";function wm(e,t,n,r,i){ws.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=xm(t=i),M("id",t,n)),r.validatedShapes=function(e){var t=C(e,"id");return v(e,(function(e){for(;e;){if(e.host&&t[e.host.id])return!1;e=e.parent}return!0}))}(o)})),o&&t.on("shape.move.start",251,(function(e){var t=e.context;b(xm(t.shapes),(function(e){o.makeDraggable(t,e,!0),b(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,bm),t.once(["shape.move.out","shape.move.cleanup"],(function(){n.removeMarker(i,bm)})))}})),this.preExecuted("elements.move",1401,(function(e){var t=e.context,n=t.closure;b(xm(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||b(r?n:v(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){b(e.context.shapes,(function(e){b(e.attachers,(function(e){b(e.outgoing.slice(),(function(e){r.allowed("connection.reconnect",{connection:e,source:e.source,target:e.target})||i.removeConnection(e)})),b(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;mm(n.attachers,(function(e){"attach"===r.allowed("elements.move",{target:o,shapes:[e]})?i.updateAttachment(e,o):i.removeShape(e)})),o.attachers.length&&b(o.attachers,(function(e){var t=_d(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&&b(s,(function(e){var t=_d(e,r,o);i.moveShape(e,t,e.parent),b(e.labels,(function(e){i.moveShape(e,t,e.parent)}))}))})),this.preExecute("shape.delete",(function(e){var t=e.context.shape;mm(t.attachers,(function(e){i.removeShape(e)})),t.host&&i.updateAttachment(t,null)}))}function xm(e){return r(E(e,(function(e){return e.attachers||[]})))}e(wm,ws),wm.$inject=["injector","eventBus","canvas","rules","modeling"];var _m={__depends__:[Qc],__init__:["attachSupport"],attachSupport:["type",wm]};function km(e){this._model=e}function Em(e,t,n,r){ws.call(this,e),this._bpmnFactory=t,this._translate=r;var i=this;function o(e){b(e.context.oldRoot.children,(function(e){Mi(e,"bpmn:BaseElement")&&i.updateParent(e)}))}function s(e){var t=e.context.shape;Mi(t,"bpmn:BaseElement")&&i.updateBounds(t)}function a(e){i.updateConnection(e.context)}function l(e){i.updateConnectionWaypoints(e.context.connection)}function c(e){i.updateAttachment(e.context)}function p(e){const{element:n}=e.context,r=lo(n),i=Ni(n),o=i&&i.get("label");ro(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"],Om((function(e){var t=e.context;i.updateParent(t.shape||t.connection,t.oldParent)}))),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],Om((function(e){var t=e.context,n=t.shape||t.connection,r=t.parent||t.newParent;i.updateParent(n,r)}))),this.executed(["canvas.updateRoot"],o),this.reverted(["canvas.updateRoot"],o),this.executed(["shape.move","shape.create","shape.resize"],Om((function(e){"label"!==e.context.shape.type&&s(e)}))),this.reverted(["shape.move","shape.create","shape.resize"],Om((function(e){"label"!==e.context.shape.type&&s(e)}))),e.on("shape.changed",(function(e){"label"===e.element.type&&s({context:{shape:e.element}})})),this.executed(["connection.create","connection.move","connection.delete","connection.reconnect"],Om(a)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],Om(a)),this.executed(["connection.layout","connection.move","connection.updateWaypoints"],Om(l)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],Om(l)),this.executed("connection.reconnect",Om((function(e){var t=e.context,n=t.connection,r=t.oldSource,i=t.newSource,o=Di(n),s=Di(r),a=Di(i);o.conditionExpression&&!Ai(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",Om((function(e){var t=e.context,n=t.connection,r=t.oldSource,i=t.newSource,o=Di(n),s=Di(r),a=Di(i);t.oldConditionExpression&&(o.conditionExpression=t.oldConditionExpression),t.oldDefault&&(s.default=t.oldDefault,delete a.default)}))),this.executed(["element.updateAttachment"],Om(c)),this.reverted(["element.updateAttachment"],Om(c)),this.executed("element.updateLabel",Om(p)),this.reverted("element.updateLabel",Om(p))}function Om(e){return function(t){var n=t.context;Mi(n.shape||n.connection||n.element,"bpmn:BaseElement")&&e(t)}}function Pm(e,t,n){Qn.call(this),this._bpmnFactory=e,this._moddle=t,this._translate=n}function Sm(e,t,n){return void 0===t[n]?t:(e[n]=t[n],V(t,[n]))}function Cm(e,t){this._modeling=e,this._canvas=t}function Tm(e){this._modeling=e}function Mm(e,t){this._canvas=e,this._layouter=t}km.$inject=["moddle"],km.prototype._needsId=function(e){return Ai(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"])},km.prototype._ensureId=function(e){var t;e.id?this._model.ids.claim(e.id,e):(t=Mi(e,"bpmn:Activity")?"Activity":Mi(e,"bpmn:Event")?"Event":Mi(e,"bpmn:Gateway")?"Gateway":Ai(e,["bpmn:SequenceFlow","bpmn:MessageFlow"])?"Flow":(e.$type||"").replace(/^[^:]*:/g,""),t+="_",!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e)))},km.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},km.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},km.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",z({bpmnElement:e,bounds:this.createDiBounds()},t))},km.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},km.prototype.createDiWaypoints=function(e){var t=this;return E(e,(function(e){return t.createDiWaypoint(e)}))},km.prototype.createDiWaypoint=function(e){return this.create("dc:Point",F(e,["x","y"]))},km.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",z({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},km.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",z({bpmnElement:e},t))},e(Em,ws),Em.$inject=["eventBus","bpmnFactory","connectionDocking","translate"],Em.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,r=t.host;n.attachedToRef=r&&r.businessObject},Em.prototype.updateParent=function(e,t){if(!(bn(e)||Mi(e,"bpmn:DataStoreReference")&&e.parent&&Mi(e.parent,"bpmn:Collaboration"))){var n=e.parent,r=e.businessObject,i=Ni(e),o=n&&n.businessObject,s=Ni(n);Mi(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(r,o,t&&t.businessObject),Mi(e,"bpmn:DataOutputAssociation")&&(o=e.source?e.source.businessObject:null),Mi(e,"bpmn:DataInputAssociation")&&(o=e.target?e.target.businessObject:null),this.updateSemanticParent(r,o),Mi(e,"bpmn:DataObjectReference")&&r.dataObjectRef&&this.updateSemanticParent(r.dataObjectRef,o),this.updateDiParent(i,s)}},Em.prototype.updateBounds=function(e){var t=Ni(e),n=function(e){if(!Mi(e,"bpmn:Activity"))return;var t=Ni(e);if(!t)return;var n=t.get("label");if(!n)return;return n.get("bounds")}(e);if(n){var r=fa(n,t.get("bounds"));z(n,{x:e.x+r.x,y:e.y+r.y})}var i=bn(e)?this._getLabel(t):t,o=i.bounds;o||(o=this._bpmnFactory.createDiBounds(),i.set("bounds",o)),z(o,{x:e.x,y:e.y,width:e.width,height:e.height})},Em.prototype.updateFlowNodeRefs=function(e,t,n){n!==t&&(Mi(n,"bpmn:Lane")&&Tt(n.get("flowNodeRef"),e),Mi(t,"bpmn:Lane")&&Mt(t.get("flowNodeRef"),e))},Em.prototype.updateDiConnection=function(e,t,n){var r=Ni(e),i=Ni(t),o=Ni(n);r.sourceElement&&r.sourceElement.bpmnElement!==Di(t)&&(r.sourceElement=t&&i),r.targetElement&&r.targetElement.bpmnElement!==Di(n)&&(r.targetElement=n&&o)},Em.prototype.updateDiParent=function(e,t){if(t&&!Mi(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(Tt(n,e),e.$parent=null)}},Em.prototype.getLaneSet=function(e){var t,n;return Mi(e,"bpmn:Lane")?((t=e.childLaneSet)||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(Mi(e,"bpmn:Participant")&&(e=e.processRef),(t=(n=e.get("laneSets"))[0])||((t=this._bpmnFactory.create("bpmn:LaneSet")).$parent=e,n.push(t)),t)},Em.prototype.updateSemanticParent=function(e,t,n){var r,i=this._translate;if(e.$parent!==t&&(!Mi(e,"bpmn:DataInput")&&!Mi(e,"bpmn:DataOutput")||(Mi(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),!("ioSpecification"in t)||t.ioSpecification!==e.$parent))){if(Mi(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),r="lanes";else if(Mi(e,"bpmn:FlowElement")){if(t)if(Mi(t,"bpmn:Participant"))t=t.processRef;else if(Mi(t,"bpmn:Lane"))do{t=t.$parent.$parent}while(Mi(t,"bpmn:Lane"));r="flowElements"}else if(Mi(e,"bpmn:Artifact")){for(;t&&!Mi(t,"bpmn:Process")&&!Mi(t,"bpmn:SubProcess")&&!Mi(t,"bpmn:Collaboration");){if(Mi(t,"bpmn:Participant")){t=t.processRef;break}t=t.$parent}r="artifacts"}else if(Mi(e,"bpmn:MessageFlow"))r="messageFlows";else if(Mi(e,"bpmn:Participant")){r="participants";var o,s=e.processRef;s&&(o=function(e){for(;e&&!Mi(e,"bpmn:Definitions");)e=e.$parent;return e}(e.$parent||t),e.$parent&&(Tt(o.get("rootElements"),s),s.$parent=null),t&&(Mt(o.get("rootElements"),s),s.$parent=o))}else Mi(e,"bpmn:DataOutputAssociation")?r="dataOutputAssociations":Mi(e,"bpmn:DataInputAssociation")&&(r="dataInputAssociations");if(!r)throw new Error(i("no parent for {element} in {parent}",{element:e.id,parent:t.id}));var a;if(e.$parent&&Tt(a=e.$parent.get(r),e),t?((a=t.get(r)).push(e),e.$parent=t):e.$parent=null,n){var l=n.get(r);Tt(a,e),t&&(l||(l=[],t.set(r,l)),l.push(e))}}},Em.prototype.updateConnectionWaypoints=function(e){Ni(e).set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},Em.prototype.updateConnection=function(e){var t,n=e.connection,r=Di(n),i=n.source,o=Di(i),s=n.target,a=Di(n.target);if(Mi(r,"bpmn:DataAssociation"))Mi(r,"bpmn:DataInputAssociation")?(r.get("sourceRef")[0]=o,t=e.parent||e.newParent||a,this.updateSemanticParent(r,a,t)):Mi(r,"bpmn:DataOutputAssociation")&&(t=e.parent||e.newParent||o,this.updateSemanticParent(r,o,t),r.targetRef=a);else{var l=Mi(r,"bpmn:SequenceFlow");r.sourceRef!==o&&(l&&(Tt(r.sourceRef&&r.sourceRef.get("outgoing"),r),o&&o.get("outgoing")&&o.get("outgoing").push(r)),r.sourceRef=o),r.targetRef!==a&&(l&&(Tt(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)},Em.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label},e(Pm,Qn),Pm.$inject=["bpmnFactory","moddle","translate"],Pm.prototype._baseCreate=Qn.prototype.create,Pm.prototype.create=function(e,t){if("label"===e){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,z({type:"label",di:n},to,t))}return this.createElement(e,t)},Pm.prototype.createElement=function(e,t){var n,r,i,o=this._translate,s=(t=z({},t||{})).businessObject,l=t.di;if(!s){if(!t.type)throw new Error(o("no shape type specified"));Si(s=this._bpmnFactory.create(t.type))}if(!Ai(l,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])){var c=z({},l||{},{id:s.id+"_di"});l="root"===e?this._bpmnFactory.createDiPlane(s,c):"connection"===e?this._bpmnFactory.createDiEdge(s,c):this._bpmnFactory.createDiShape(s,c)}return Mi(s,"bpmn:Group")&&(t=z({isFrame:!0},t)),t=function(e,t,n){return b(n,(function(n){t=Sm(e,t,n)})),t}(s,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=Sm(l,t,"isExpanded")),Mi(s,"bpmn:SubProcess")&&(t.collapsed=!Yi(s,l)),Mi(s,"bpmn:ExclusiveGateway")&&(l.isMarkerVisible=!0),a(t.triggeredByEvent)&&(s.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),a(t.cancelActivity)&&(s.cancelActivity=t.cancelActivity,delete t.cancelActivity),t.eventDefinitionType&&(r=s.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=s,s.eventDefinitions=r,delete t.eventDefinitionType),n=this.getDefaultSize(s,l),t=z({id:s.id},n,t,{businessObject:s,di:l}),this._baseCreate(e,t)},Pm.prototype.getDefaultSize=function(e,t){var n=Di(e);return t=t||Ni(e),Mi(n,"bpmn:SubProcess")?Yi(n,t)?{width:350,height:200}:{width:100,height:80}:Mi(n,"bpmn:Task")?{width:100,height:80}:Mi(n,"bpmn:Gateway")?{width:50,height:50}:Mi(n,"bpmn:Event")?{width:36,height:36}:Mi(n,"bpmn:Participant")?Yi(n,t)?{width:600,height:250}:{width:400,height:60}:Mi(n,"bpmn:Lane")?{width:400,height:100}:Mi(n,"bpmn:DataObjectReference")?{width:36,height:50}:Mi(n,"bpmn:DataStoreReference")?{width:50,height:50}:Mi(n,"bpmn:TextAnnotation")?{width:100,height:30}:Mi(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},Pm.prototype.createParticipantShape=function(e){return p(e)||(e={isExpanded:e}),!1!==(e=z({type:"bpmn:Participant"},e||{})).isExpanded&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)},Cm.$inject=["modeling","canvas"],Cm.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,r=e.alignment;b(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)}))},Cm.prototype.postExecute=function(e){},Tm.$inject=["modeling"],Tm.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},Tm.prototype.postExecute=function(e){var t,n,r=e.hints||{};t=e.source,n=e.shape,k(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))},Mm.$inject=["canvas","layouter"],Mm.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},Mm.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var Am=Math.round;function Dm(e){this._modeling=e}Dm.$inject=["modeling"],Dm.prototype.preExecute=function(e){var t=e.elements,n=e.parent,r=e.parentIndex,i=e.position,o=e.hints,s=this._modeling;b(t,(function(e){u(e.x)||(e.x=0),u(e.y)||(e.y=0)}));var a=kt(v(t,(function(e){return!e.hidden})));b(t,(function(e){vn(e)&&(e.waypoints=E(e.waypoints,(function(e){return{x:Am(e.x-a.x-a.width/2+i.x),y:Am(e.y-a.y-a.height/2+i.y)}}))),z(e,{x:Am(e.x-a.x-a.width/2+i.x),y:Am(e.y-a.y-a.height/2+i.y)})}));var l=vt(t),c={};b(t,(function(e){if(vn(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=z({},o);-1===l.indexOf(e)&&(t.autoResize=!1),bn(e)&&(t=V(t,["attach"])),c[e.id]=u(r)?s.createShape(e,F(e,["x","y","width","height"]),e.parent||n,r,t):s.createShape(e,F(e,["x","y","width","height"]),e.parent||n,t)}})),e.elements=S(c)};var Nm=Math.round;function Rm(e){this._canvas=e}function jm(e){Rm.call(this,e)}Rm.$inject=["canvas"],Rm.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?z(t,n):z(t,{x:n.x-Nm(t.width/2),y:n.y-Nm(t.height/2)}),this._canvas.addShape(t,r,i),t},Rm.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t},e(jm,Rm),jm.$inject=["canvas"];var $m=Rm.prototype.execute;jm.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,$m.call(this,e)};var Bm=Rm.prototype.revert;function Im(e,t){this._canvas=e,this._modeling=t}function zm(e,t){this._modeling=e,this._elementRegistry=t}function Lm(e,t){this._canvas=e,this._modeling=t}function qm(e){this._modeling=e}jm.prototype.revert=function(e){return e.shape.labelTarget=null,Bm.call(this,e)},Im.$inject=["canvas","modeling"],Im.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;mm(n.incoming,(function(e){t.removeConnection(e,{nested:!0})})),mm(n.outgoing,(function(e){t.removeConnection(e,{nested:!0})}))},Im.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=At(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},Im.prototype.revert=function(e){var t=e.connection,n=e.parent,r=e.parentIndex;return t.source=e.source,t.target=e.target,Mt(n.children,t,r),this._canvas.addConnection(t,n),t},zm.$inject=["modeling","elementRegistry"],zm.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry;b(e.elements,(function(e){n.get(e.id)&&(e.waypoints?t.removeConnection(e):t.removeShape(e))}))},Lm.$inject=["canvas","modeling"],Lm.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;mm(n.incoming,(function(e){t.removeConnection(e,{nested:!0})})),mm(n.outgoing,(function(e){t.removeConnection(e,{nested:!0})})),mm(n.children,(function(e){vn(e)?t.removeConnection(e,{nested:!0}):t.removeShape(e,{nested:!0})}))},Lm.prototype.execute=function(e){var t=this._canvas,n=e.shape,r=n.parent;return e.oldParent=r,e.oldParentIndex=At(r.children,n),t.removeShape(n),n},Lm.prototype.revert=function(e){var t=this._canvas,n=e.shape,r=e.oldParent,i=e.oldParentIndex;return Mt(r.children,n,i),t.addShape(n,r),n},qm.$inject=["modeling"];var Fm={x:"y",y:"x"};function Vm(e,t){this._layouter=e,this._canvas=t}function Hm(){}function Um(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}function Wm(e){this._modeling=e}function Xm(e){this._helper=new Wm(e)}function Gm(e){this._modeling=e,this._helper=new Wm(e)}function Qm(e){this._modeling=e}function Ym(e){return e.original||e}function Km(e,t){this._modeling=e,this._rules=t}function Zm(e){this._modeling=e}function Jm(e){this._modeling=e}function eg(e){return z({},e)}function tg(e){switch(e){case"n":case"s":return"y";case"w":case"e":return"x"}}function ng(e,t,n){var r=tg(n);return/e|s/.test(n)?e[r]>t:/n|w/.test(n)?e[r]<t:void 0}function rg(e,t){return-1!==e.indexOf(t)}function ig(e){this._modeling=e}function og(e){var t={};return b(e,(function(e){t[e.id]=e.hidden,e.children&&(t=z({},t,og(e.children)))})),t}function sg(e,t){var n=[];return b(e,(function(e){e.hidden=t,n=n.concat(e),e.children&&(n=n.concat(sg(e.children,e.collapsed||t)))})),n}function ag(e,t){var n=[];return b(e,(function(e){e.hidden=t[e.id],n=n.concat(e),e.children&&(n=n.concat(ag(e.children,t)))})),n}function lg(e){this._modeling=e}function cg(e,t){return Tt(e&&e.attachers,t)}function pg(e,t,n){if(e){var r=e.attachers;r||(e.attachers=r=[]),Mt(r,t,n)}}function ug(){}function dg(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var r=this;e.on("diagram.init",(function(){r.registerHandlers(n)}))}function hg(e){this._elementRegistry=e}function fg(e,t){b(t,(function(t,n){e.set(n,t)}))}qm.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;b(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=A(e.elements,r))[0],c===d&&(u=p[a(p)]),h=s(u),e.range=null,b(p,(function(n){!function(e,n){var i={y:0};i[r]=e-s(n),i[r]&&(i[Fm[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||b(n,(function(e,o){var s,a={};e!==u&&e!==h&&(s=n[o-1],e.range.max=0,b(e.elements,(function(n,o){a[Fm[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)})))}))},qm.prototype.postExecute=function(e){},Vm.$inject=["layouter","canvas"],Vm.prototype.execute=function(e){var t=e.connection;return z(e,{oldWaypoints:t.waypoints}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},Vm.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t},Hm.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=Tt(o.children,t),Mt(r.children,t,i),t.parent=r,b(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},Hm.prototype.revert=function(e){var t=e.connection,n=t.parent,r=e.oldParent,i=e.oldParentIndex,o=e.delta;return Tt(n.children,t),Mt(r.children,t,i),t.parent=r,b(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},Um.prototype.add=function(e,t){return this.addAll([e],t)},Um.prototype.addAll=function(e,t){var n=function(e,t,n){s(t)&&(t=!0),p(t)&&(n=t,t=!0);var r=Pt((n=n||{}).allShapes),i=Pt(n.allConnections),o=Pt(n.enclosedElements),a=Pt(n.enclosedConnections),l=Pt(n.topLevel,t&&C(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 xt(e,(function(e){if(o[e.id]=e,!e.waypoints)return r[e.id]=e,b(e.incoming,c),b(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 z(this,n),this},Wm.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},Wm.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),b(s,(function(e){o.moveShape(e,t,c[e.id]&&!p&&n,{recurse:!1,layout:!1})})),b(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&&Md(e,e.source,t),connectionEnd:i&&Ad(e,e.target,t)})}))},Wm.prototype.getClosure=function(e){return(new Um).addAll(e,!0)},Xm.$inject=["modeling"],Xm.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},Xm.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)},Gm.$inject=["modeling"],Gm.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=F(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=Tt(o.children,t),Mt(r.children,t,i),z(t,{parent:r,x:t.x+n.x,y:t.y+n.y}),t},Gm.prototype.postExecute=function(e){var t=e.shape,n=e.delta,r=e.hints,i=this._modeling;!1!==r.layout&&(b(t.incoming,(function(e){i.layoutConnection(e,{connectionEnd:Ad(e,t,n)})})),b(t.outgoing,(function(e){i.layoutConnection(e,{connectionStart:Md(e,t,n)})}))),!1!==r.recurse&&this.moveChildren(e)},Gm.prototype.revert=function(e){var t=e.shape,n=e.oldParent,r=e.oldParentIndex,i=e.delta;return Mt(n.children,t,r),z(t,{parent:n,x:t.x-i.x,y:t.y-i.y}),t},Gm.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},Gm.prototype.getNewParent=function(e){return e.newParent||e.shape.parent},Qm.$inject=["modeling"],Qm.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},Qm.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||Ym(c(i)?i[0]:i)),!r||n&&"target"!==o.docking||(s.connectionEnd=s.connectionEnd||Ym(c(i)?i[i.length-1]:i)),o.newWaypoints&&(s.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,s))},Qm.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},Km.$inject=["modeling","rules"],Km.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();b(d,(function(e){l(e.source,t,e)&&n.reconnectEnd(e,t,Td(e,t,u),a)})),b(h,(function(e){var r=e.target;l(t,r,e)&&n.reconnectStart(e,t,Cd(e,t,u),a)}))},Km.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},Km.prototype.execute=function(e){},Km.prototype.revert=function(e){},Km.prototype.createShape=function(e,t,n,r){return this._modeling.createShape(e,t,n,r)},Km.prototype.reconnectStart=function(e,t,n,r){this._modeling.reconnectStart(e,t,n,r)},Km.prototype.reconnectEnd=function(e,t,n,r){this._modeling.reconnectEnd(e,t,n,r)},Zm.$inject=["modeling"],Zm.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},z(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Zm.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,r=e.oldBounds;!1!==(e.hints||{}).layout&&(b(n.incoming,(function(e){t.layoutConnection(e,{connectionEnd:Td(e,n,r)})})),b(n.outgoing,(function(e){t.layoutConnection(e,{connectionStart:Cd(e,n,r)})})))},Zm.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return z(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Jm.$inject=["modeling"],Jm.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),b(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 b(e.concat(t),(function(r){var i=r.incoming,o=r.outgoing;b(i.concat(o),(function(r){var i=r.source,o=r.target;(Xf(e,i)||Xf(e,o)||Xf(t,i)||Xf(t,o))&&(Xf(n,r)||n.push(r))}))})),n}(r,i),t,n,o,r,i,s)},Jm.prototype.execute=function(){},Jm.prototype.revert=function(){},Jm.prototype.moveShapes=function(e,t){var n=this;b(e,(function(e){n._modeling.moveShape(e,t,null,{autoResize:!1,layout:!1,recurse:!1})}))},Jm.prototype.resizeShapes=function(e,t,n){var r=this;b(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})}))},Jm.prototype.updateConnectionWaypoints=function(e,t,n,r,i,o,s){var a=this,l=i.concat(o);b(e,(function(e){var c=e.source,p=e.target,u=function(e){return E(e.waypoints,(function(e){return(e=eg(e)).original&&(e.original=eg(e.original)),e}))}(e),d=tg(n),h={};rg(l,c)&&rg(l,p)?(u=E(u,(function(e){return ng(e,r,n)&&(e[d]=e[d]+t[d]),e.original&&ng(e.original,r,n)&&(e.original[d]=e.original[d]+t[d]),e})),a._modeling.updateWaypoints(e,u,{labelBehavior:!1})):(rg(l,c)||rg(l,p))&&(rg(i,c)?h.connectionStart=Md(e,c,t):rg(i,p)?h.connectionEnd=Ad(e,p,t):rg(o,c)?h.connectionStart=Cd(e,c,s[c.id]):rg(o,p)&&(h.connectionEnd=Td(e,p,s[p.id])),a._modeling.layoutConnection(e,h))}))},ig.$inject=["modeling"],ig.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=og(n),t.collapsed=!t.collapsed;var r=sg(n,t.collapsed);return[t].concat(r)},ig.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,r=ag(t.children,n);return t.collapsed=!t.collapsed,[t].concat(r)},lg.$inject=["modeling"],lg.prototype.execute=function(e){var t=e.shape,n=e.newHost,r=t.host;return e.oldHost=r,e.attacherIdx=cg(r,t),pg(n,t),t.host=n,t},lg.prototype.revert=function(e){var t=e.shape,n=e.newHost,r=e.oldHost,i=e.attacherIdx;return t.host=r,cg(n,t),pg(r,t,i),t},ug.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},ug.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t},dg.$inject=["eventBus","elementFactory","commandStack"],dg.prototype.getHandlers=function(){return{"shape.append":Tm,"shape.create":Rm,"shape.delete":Lm,"shape.move":Gm,"shape.resize":Zm,"shape.replace":Km,"shape.toggleCollapse":ig,spaceTool:Jm,"label.create":jm,"connection.create":Mm,"connection.delete":Im,"connection.move":Hm,"connection.layout":Vm,"connection.updateWaypoints":ug,"connection.reconnect":Qm,"elements.create":Dm,"elements.move":Xm,"elements.delete":zm,"elements.distribute":qm,"elements.align":Cm,"element.updateAttachment":lg}},dg.prototype.registerHandlers=function(e){b(this.getHandlers(),(function(t,n){e.registerHandler(n,t)}))},dg.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)},dg.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},dg.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)},dg.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)},dg.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},dg.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},dg.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},dg.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},dg.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},dg.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},dg.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},dg.prototype.distributeElements=function(e,t,n){var r={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",r)},dg.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},dg.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},dg.prototype.replaceShape=function(e,t,n){var r={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",r),r.newShape},dg.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},dg.prototype.resizeShape=function(e,t,n,r){var i={shape:e,newBounds:t,minBounds:n,hints:r};this._commandStack.execute("shape.resize",i)},dg.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)},dg.prototype.updateWaypoints=function(e,t,n){var r={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",r)},dg.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)},dg.prototype.reconnectStart=function(e,t,n,r){r||(r={}),this.reconnect(e,t,e.target,n,z(r,{docking:"source"}))},dg.prototype.reconnectEnd=function(e,t,n,r){r||(r={}),this.reconnect(e,e.source,t,n,z(r,{docking:"target"}))},dg.prototype.connect=function(e,t,n,r){return this.createConnection(e,t,n||{},e.parent,r)},dg.prototype._create=function(e,t){return t instanceof Vn?t:this._elementFactory.create(e,t)},dg.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)},hg.$inject=["elementRegistry"],hg.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 x(t,(function(t,n){return t[n]=e.get(n),t}),{})}(n,O(r));return fg(n,r),e.oldProperties=o,e.changed=i,i},hg.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,r=e.changed;return fg(n,t),r},hg.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return Mi(e,"bpmn:DataObject")?function(e,t){return t.filter((function(t){return Mi(t,"bpmn:DataObjectReference")&&Di(t).dataObjectRef===e}))}(e,t):[]};var mg="default",gg="id",yg="di",vg={width:0,height:0};function bg(e,t,n,r,i){this._elementRegistry=e,this._moddle=t,this._translate=n,this._modeling=r,this._textRenderer=i}function wg(e,t){return gg in e&&e[gg]!==t[gg]}function xg(e,t){var n=e.businessObject,r=Ni(e);b(t,(function(e,t){t!==yg?n.set(t,e):r&&function(e,t){b(t,(function(t,n){e.set(n,t)}))}(r,e)}))}bg.$inject=["elementRegistry","moddle","translate","modeling","textRenderer"],bg.prototype.execute=function(e){var t=e.element,n=[t],r=this._translate;if(!t)throw new Error(r("element required"));var i=this._elementRegistry,o=this._moddle.ids,s=t.businessObject,a=function(e){var t=z({},e);return _g.forEach((function(n){n in e&&(t[n]=Di(t[n]))})),t}(e.properties),l=e.oldProperties||function(e,t){var n=O(t),r=e.businessObject,i=Ni(e);return x(n,(function(e,n){return e[n]=n!==yg?r.get(n):function(e,t){return x(t,(function(t,n){return t[n]=e&&e.get(n),t}),{})}(i,O(t.di)),e}),{})}(t,a);return wg(a,s)&&(o.unclaim(s[gg]),i.updateId(t,a[gg]),o.claim(a[gg],s)),mg in a&&(a[mg]&&n.push(i.get(a[mg].id)),s[mg]&&n.push(i.get(s[mg].id))),xg(t,a),e.oldProperties=l,e.changed=n,n},bg.prototype.postExecute=function(e){var t=e.element.label,n=t&&Di(t).name;if(n){var r=this._textRenderer.getExternalLabelBounds(t,n);this._modeling.resizeShape(t,r,vg)}},bg.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 xg(t,r),wg(n,i)&&(s.unclaim(n[gg]),o.updateId(t,r[gg]),s.claim(r[gg],i)),e.changed};var _g=["default"];function kg(e,t){this._canvas=e,this._modeling=t}function Eg(e,t){this._modeling=e,this._spaceTool=t}function Og(e,t){this._modeling=e,this._translate=t}function Pg(e,t){this._modeling=e,this._spaceTool=t}kg.$inject=["canvas","modeling"],kg.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,r=n.businessObject,i=t.getRootElement(),o=i.businessObject,s=o.$parent,a=Ni(i);return t.setRootElement(n),t.removeRootElement(i),Mt(s.rootElements,r),r.$parent=s,Tt(s.rootElements,o),o.$parent=null,i.di=null,a.bpmnElement=r,n.di=a,e.oldRoot=i,[]},kg.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,r=n.businessObject,i=e.oldRoot,o=i.businessObject,s=r.$parent,a=Ni(n);return t.setRootElement(i),t.removeRootElement(n),Tt(s.rootElements,r),r.$parent=null,Mt(s.rootElements,o),o.$parent=s,n.di=null,a.bpmnElement=o,i.di=a,[]},Eg.$inject=["modeling","spaceTool"],Eg.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,r=e.shape,i=e.location,o=Uu(r),s=o===r,a=s?r:r.parent;Hu(a).length||n.createShape({type:"bpmn:Lane"},{x:r.x+Fu,y:r.y,width:r.width-Fu,height:r.height},a);var l=[];xt(o,(function(e){return l.push(e),e.label&&l.push(e.label),e===r?[]:v(e.children,(function(e){return e!==r}))}));var c="top"===i?-120:120,p="top"===i?r.y:r.y+r.height,u=p+("top"===i?10:-10),d="top"===i?"n":"s",h=t.calculateAdjustments(l,"y",c,u);t.makeSpace(h.movingShapes,h.resizingShapes,{x:0,y:c},d,u),e.newLane=n.createShape({type:"bpmn:Lane"},{x:r.x+(s?Fu:0),y:p-("top"===i?120:0),width:r.width-(s?Fu:0),height:120},a)},Og.$inject=["modeling","translate"],Og.prototype.preExecute=function(e){var t=this._modeling,n=this._translate,r=e.shape,i=e.count,o=Hu(r),s=o.length;if(s>i)throw new Error(n("more than {count} child lanes",{count:i}));var a,l,c,p,u,d=Math.round(r.height/i);for(u=0;u<i;u++)a=r.y+u*d,l=u===i-1?r.height-d*u:d,c={x:r.x+Fu,y:a,width:r.width-Fu,height:l},u<s?t.resizeShape(o[u],c):(p={type:"bpmn:Lane"},t.createShape(p,c,r))},Pg.$inject=["modeling","spaceTool"],Pg.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds;!1!==e.balanced?this.resizeBalanced(t,n):this.resizeSpace(t,n)},Pg.prototype.resizeBalanced=function(e,t){var n=this._modeling,r=Wu(e,t);n.resizeShape(e,t),r.forEach((function(e){n.resizeShape(e.shape,e.newBounds)}))},Pg.prototype.resizeSpace=function(e,t){var n,r,i,o,s,a=this._spaceTool,l=_n(e),c=ju(_n(t),l),p=Uu(e),u=[],d=[];xt(p,(function(e){return u.push(e),(Mi(e,"bpmn:Lane")||Mi(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 Sg="flowNodeRef",Cg="lanes";function Tg(e){this._elementRegistry=e}function Mg(e){this._moddle=e}Tg.$inject=["elementRegistry"],Tg.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=Uu(e);return i[t.id]||(i[t.id]=Vu(t)),i[t.id]}(e);return t.filter((function(t){return n=e,r=_n(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=Uu(e);if(t&&-1===n.indexOf(t)){var r=t.children.filter((function(e){return Mi(e,"bpmn:FlowNode")}));r.forEach(s),n.push(t)}})),e.forEach(s),o.forEach((function(e){var t=e.businessObject,n=t.get(Cg).slice(),i=a(e);r.push({flowNode:t,remove:n,add:i})})),t.forEach((function(e){var t=e.businessObject;e.parent||t.get(Sg).forEach((function(e){r.push({flowNode:e,remove:[t],add:[]})}))})),r},Tg.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(Cg);e.remove.forEach((function(e){Tt(n,e),Tt(e.get(Sg),t)})),e.add.forEach((function(e){Mt(n,e),Mt(e.get(Sg),t)}))})),[]},Tg.prototype.revert=function(e){return e.updates.forEach((function(e){var t=e.flowNode,n=t.get(Cg);e.add.forEach((function(e){Tt(n,e),Tt(e.get(Sg),t)})),e.remove.forEach((function(e){Mt(n,e),Mt(e.get(Sg),t)}))})),[]},Mg.$inject=["moddle"],Mg.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),[]},Mg.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 Ag={fill:void 0,stroke:void 0};function Dg(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)}}}Dg.$inject=["commandStack"],Dg.prototype.postExecute=function(e){var t=e.elements,n=e.colors||Ag,r=this,i={};"fill"in n&&z(i,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&z(i,{"border-color":this._normalizeColor(n.stroke)}),b(t,(function(e){var t=vn(e)?F(i,["border-color"]):i,n=Ni(e);if(function(e){"border-color"in e&&(e.stroke=e["border-color"]);"background-color"in e&&(e.fill=e["background-color"])}(t),bn(e))r._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:n.label,properties:{color:i["border-color"]}});else{if(!Ai(n,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;r._commandStack.execute("element.updateProperties",{element:e,properties:{di:t}})}}))};var Ng={width:0,height:0};function Rg(e,t,n){function r(e,t){var n=e.label||e,r=e.labelTarget||e;return co(n,t),[n,r]}this.preExecute=function(t){var n=t.element,r=n.businessObject,i=t.newLabel;if(!bn(n)&&ro(n)&&!io(n)&&!jg(i)){var o=so(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=lo(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(bn(i)||Mi(i,"bpmn:TextAnnotation"))if(bn(i)&&jg(o))!1!==a.removeShape&&e.removeShape(i,{unsetLabel:!1});else{var l=lo(r);void 0===s&&(s=t.getExternalLabelBounds(i,l)),s&&e.resizeShape(i,s,Ng)}}}function jg(e){return!e||!e.trim()}function $g(e,t,n,r){dg.call(this,e,t,n),this._bpmnRules=r}function Bg(){}Rg.$inject=["modeling","textRenderer","bpmnFactory"],e($g,dg),$g.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],$g.prototype.getHandlers=function(){var e=dg.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=hg,e["element.updateProperties"]=bg,e["canvas.updateRoot"]=kg,e["lane.add"]=Eg,e["lane.resize"]=Pg,e["lane.split"]=Og,e["lane.updateRefs"]=Tg,e["id.updateClaim"]=Mg,e["element.setColor"]=Dg,e["element.updateLabel"]=Rg,e},$g.prototype.updateLabel=function(e,t,n,r){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:r||{}})},$g.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)},$g.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},$g.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},$g.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},$g.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},$g.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},$g.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},$g.prototype.makeProcess=function(){var e={newRoot:this._create("root",{type:"bpmn:Process"})};this._commandStack.execute("canvas.updateRoot",e)},$g.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},$g.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},$g.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},$g.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})},Bg.prototype.layoutConnection=function(e,t){return[(t=t||{}).connectionStart||On(t.source||e.source),t.connectionEnd||On(t.target||e.target)]};var Ig=20,zg=5,Lg=Math.round,qg=20,Fg={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function Vg(e,t,n){var r,i,o,s=Pn(t,e,zg),a=n.split(":")[0],l=Lg((t.x-e.x)/2+e.x),c=Lg((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+Ig*(/l/.test(a)?-1:1),y:h?c+Ig:c}):r={x:(h=l===e.x)?l+Ig:l,y:e.y+Ig*(/t/.test(a)?-1:1)}:r={x:l,y:c}),{waypoints:Ug(e,r,i).concat(r),directions:i,turnNextDirections:h}}function Hg(e){return e.split(":").reverse().join(":")}function Ug(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(Yg(n)){var r=function(e,t,n){return Vg(e,t,n)}(e,t,n),i=function(e,t,n){var r=Vg(t,e,Hg(n));return{waypoints:r.waypoints.slice().reverse(),directions:Hg(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:Ug(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=Lg((t.x-e.x)/2+e.x),i=Lg((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 Wg(e,t,n,r,i){var o=w(i&&i.preferredLayouts||[],"straight")[0]||"h:h",s=Pn(e,t,Fg[o]||0),a=function(e,t){if(Yg(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||On(e),r=r||On(t);var l=a.split(":"),c=Kg(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=Ug(e,t,n);return r.unshift(e),r.push(t),Zg(r)}(c,Kg(r,t,l[1],s),a)}function Xg(e,t,n,r,i,o){var s;return c(n)&&(i=n,o=r,n=On(e),r=On(t)),i=i||[],s=-1!==(o=z({preferredLayouts:[]},o)).preferredLayouts.indexOf("straight")&&function(e,t,n,r,i){var o,s,a={};if(s=Pn(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?Gg(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:Gg(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=Qg(e,t,n,i),i?i.reverse():null}(t,e,r,i),s||((s=o.connectionStart&&Qg(e,t,n,i))||(!o.connectionStart&&!o.connectionEnd&&i&&i.length?i:Wg(e,t,n,r,o))))}function Gg(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 Qg(e,t,n,r){if(function(e){return e.length<3||!(e.length>4)&&!!g(e,(function(t,n){var r=e[n-1];return r&&Dt(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(jt(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(Bt(e[r],t,qg)||Bt(e[r],n,qg))return e.slice(r);return e}(s,e,t),i!==s&&(s=Qg(e,t,n,i)),s&&jt(s)?null:s}function Yg(e){return e&&/t|r|b|l/.test(e)}function Kg(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 Zg(e){return e.reduce((function(t,n,r){return Nt(t[t.length-1],e[r+1],n,0)||t.push(n),t}),[])}var Jg=-10,ey=40,ty={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},ny={top:"t",right:"r",bottom:"b",left:"l"};function ry(){}function iy(e,t){return Mi(t,"bpmn:Participant")?"source":Mi(e,"bpmn:Participant")?"target":ly(t)?"source":ly(e)||Mi(t,"bpmn:Event")?"target":Mi(e,"bpmn:Event")?"source":null}function oy(e){return ly(e)?"target":"source"}function sy(e,t){return e?e.original||e:On(t)}function ay(e,t){return Mi(t,"bpmn:Activity")&&Mi(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function ly(e){return Mi(e,"bpmn:SubProcess")&&Yi(e)}function cy(e,t){return e===t}function py(e){var t=/right|left/.exec(e);return t&&t[0]}function uy(e){var t=/top|bottom/.exec(e);return t&&t[0]}function dy(e){return"right"===e||"left"===e}function hy(e,t){var n=t.waypoints,r=n&&n.length&&Pn(n[0],e);return"top"===r?["t:r"]:"right"===r?["r:b"]:"left"===r?["l:t"]:["b:l"]}function fy(e,t,n){var r,i,o,s,a=On(e),l=On(t),c=(s=(o=e).host,Pn(On(o),s,Jg)),p=cy(e.host,t),u=-1!==["top","right","bottom","left"].indexOf(c),d=Pn(l,a,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return p?function(e,t,n,r,i){var o,s=t?e:uy(e),a=ny[s];o=t?dy(e)?my("y",n,r,i)?"h":"b":my("x",n,r,i)?"v":"l":"v";return[a+":"+o]}(c,u,e,t,n):(r=function(e,t,n){if(n)return ny[e];if(cy(uy(e),uy(t))||function(e,t){return ty[e]===t}(py(e),py(t)))return ny[uy(e)];return ny[py(e)]}(c,d,u),i=function(e,t,n){if(n)return dy(e)?function(e,t){var n=py(e),r=ty[n];return-1!==t.indexOf(r)}(e,t)||cy(e,t)?"h":"v":function(e,t){var n=uy(e),r=ty[n];return-1!==t.indexOf(r)}(e,t)||cy(e,t)?"v":"h";return dy(t)||cy(uy(e),uy(t))&&py(t)?"h":"v"}(c,d,u),[r+":"+i])}function my(e,t,n,r){var i=ey;return!(gy(e,r,n,i)||gy(e,r,{x:n.x+n.width,y:n.y+n.height},i)||gy(e,r,On(t),i))}function gy(e,t,n,r){return Math.abs(t[e]-n[e])<r}function yy(e){return z({original:e.point.original||e.point},e.actual)}function vy(e,t){this._elementRegistry=e,this._graphicsFactory=t}e(ry,Bg),ry.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;return a||(a=sy(s&&s[0],i)),l||(l=sy(s&&s[s.length-1],o)),(Mi(e,"bpmn:Association")||Mi(e,"bpmn:DataAssociation"))&&s&&!ay(i,o)?[].concat([a],s.slice(1,-1),[l]):(Mi(e,"bpmn:MessageFlow")?n=function(e,t){return{preferredLayouts:["straight","v:v"],preserveDocking:iy(e,t)}}(i,o):(Mi(e,"bpmn:SequenceFlow")||ay(i,o))&&(n=i===o?{preferredLayouts:hy(i,e)}:Mi(i,"bpmn:BoundaryEvent")?{preferredLayouts:fy(i,o,l)}:ly(i)||ly(o)?function(e){return{preferredLayouts:["straight","h:h"],preserveDocking:oy(e)}}(i):Mi(i,"bpmn:Gateway")?{preferredLayouts:["v:h"]}:Mi(o,"bpmn:Gateway")?{preferredLayouts:["h:v"]}:{preferredLayouts:["h:h"]}),n&&(r=Zg(Xg(i,o,a,l,s,n=z(n,t)))),r||[a,l])},vy.$inject=["elementRegistry","graphicsFactory"],vy.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(yy(r)),o.push(yy(i)),o},vy.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}},vy.prototype._getIntersection=function(e,t,n){return Sn(this._getShapePath(e),this._getConnectionPath(t),n)},vy.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},vy.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},vy.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};var by={__init__:["modeling","bpmnUpdater"],__depends__:[Oh,sf,lf,uf,Hf,fm,vm,_m,ps,bs,dm],bpmnFactory:["type",km],bpmnUpdater:["type",Em],elementFactory:["type",Pm],modeling:["type",$g],layouter:["type",ry],connectionDocking:["type",vy]};const wy=Math.round;function xy(e,t,n,r,i,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=r,this._layouter=i,this._rules=o}xy.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(z({type:t},n)),u=s.fire("autoPlace",{source:e,shape:p});if(!u)return;z(p,{x:u.x-wy(p.width/2),y:u.y-wy(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)))})},xy.prototype.cleanUp=function(){this._complexPreview.cleanUp()},xy.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];var _y={__depends__:[Dc,su,by],__init__:["appendPreview"],appendPreview:["type",xy]},ky=Math.min,Ey=Math.max;function Oy(e){e.preventDefault()}function Py(e){e.stopPropagation()}function Sy(e){this.container=e.container,this.parent=we('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=xe("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.autoResize=I(this.autoResize,this),this.handlePaste=I(this.handlePaste,this)}function Cy(e,t){this._eventBus=e,this._providers=[],this._textbox=new Sy({container:t.getContainer(),keyHandler:I(this._handleKey,this),resizeHandler:I(this._handleResize,this)})}Sy.prototype.create=function(e,t,n,r){var i=this.parent,o=this.content,s=this.container;r=this.options=r||{};var a=F(t=this.style=t||{},["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);z(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=F(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return z(o.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},l),r.centerVertically&&z(o.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},l),o.innerText=n,he.bind(o,"keydown",this.keyHandler),he.bind(o,"mousedown",Py),he.bind(o,"paste",this.handlePaste),r.autoResize&&he.bind(o,"input",this.autoResize),r.resizable&&this.resizable(t),s.appendChild(i),this.setSelection(o.lastChild,o.lastChild&&o.lastChild.length),i},Sy.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)}},Sy.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)},Sy.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&&ke(t)})),n=o,r=a+e.length}n&&void 0!==r&&setTimeout((function(){self.setSelection(n,r)}))},Sy.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})}},Sy.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=we('<div class="djs-direct-editing-resize-handle"></div>');var u=function(n){Oy(n),Py(n);var u=ky(Ey(c+n.clientX-a,r),o),d=ky(Ey(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){Oy(e),Py(e),he.unbind(document,"mousemove",u,!1),he.unbind(document,"mouseup",d,!1)};he.bind(n,"mousedown",(function(e){Oy(e),Py(e),a=e.clientX,l=e.clientY;var n=t.getBoundingClientRect();c=n.width,p=n.height,he.bind(document,"mousemove",u),he.bind(document,"mouseup",d)}))}z(n.style,{position:"absolute",bottom:"0px",right:"0px",cursor:"nwse-resize",width:"0",height:"0",borderTop:(parseInt(this.style.fontSize)/4||3)+"px solid transparent",borderRight:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderBottom:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderLeft:(parseInt(this.style.fontSize)/4||3)+"px solid transparent"}),t.appendChild(n)},Sy.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),he.unbind(t,"keydown",this.keyHandler),he.unbind(t,"mousedown",Py),he.unbind(t,"input",this.autoResize),he.unbind(t,"paste",this.handlePaste),n&&(n.removeAttribute("style"),ke(n)),ke(e)},Sy.prototype.getValue=function(){return this.content.innerText.trim()},Sy.prototype.getSelection=function(){return window.getSelection().getRangeAt(0)},Sy.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)},Cy.$inject=["eventBus","canvas"],Cy.prototype.registerProvider=function(e){this._providers.push(e)},Cy.prototype.isActive=function(e){return!(!this._active||e&&this._active.element!==e)},Cy.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},Cy.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},Cy.prototype.close=function(){this._textbox.destroy(),this._fire("deactivate"),this._active=null,this.resizable=void 0},Cy.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()}},Cy.prototype.getValue=function(){return this._textbox.getValue()},Cy.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())},Cy.prototype._handleResize=function(e){this._fire("resize",e)},Cy.prototype.activate=function(e){var t;this.isActive()&&this.cancel();var n=g(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 Ty={__depends__:[ts],__init__:["directEditing"],directEditing:["type",Cy]};function My(e){return function(t){var n=t.target,r=Di(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===Yi(e);return!(o&&s&&a&&l)}}var 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-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"}}],Dy=[{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"}}],Ny=[{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"}}],Ry=[{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"}}],jy=[{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"}}],$y=[{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}}],By=[{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}}],Iy=By,zy=[{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}}],Ly=[{label:"Data store reference",actionName:"replace-with-data-store-reference",className:"bpmn-icon-data-store",target:{type:"bpmn:DataStoreReference"}}],qy=[{label:"Data object reference",actionName:"replace-with-data-object-reference",className:"bpmn-icon-data-object",target:{type:"bpmn:DataObjectReference"}}],Fy=[{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}}],Vy=[{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}}],Hy=[{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"}],Uy=[{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}}],Wy={"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 Xy(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()}Xy.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],Xy.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Xy.prototype.getPopupMenuEntries=function(e){var t=e.businessObject,n=this._rules,r=[];if(c(e)||!n.allowed("shape.replace",{element:e}))return{};var i=My(e);return Mi(t,"bpmn:DataObjectReference")?this._createEntries(e,Ly):Mi(t,"bpmn:DataStoreReference")&&!Mi(e.parent,"bpmn:Collaboration")?this._createEntries(e,qy):Mi(t,"bpmn:StartEvent")&&!Mi(t.$parent,"bpmn:SubProcess")?(r=v(Ay,i),this._createEntries(e,r)):Mi(t,"bpmn:Participant")?(r=v(Uy,(function(t){return Yi(e)!==t.target.isExpanded})),this._createEntries(e,r)):Mi(t,"bpmn:StartEvent")&&Ji(t.$parent)?(r=v(Vy,(function(e){var n=!1!==e.target.isInterrupting,r=t.isInterrupting===n;return i(e)||!i(e)&&!r})),this._createEntries(e,r)):Mi(t,"bpmn:StartEvent")&&!Ji(t.$parent)&&Mi(t.$parent,"bpmn:SubProcess")?(r=v(Dy,i),this._createEntries(e,r)):Mi(t,"bpmn:EndEvent")?(r=v(Ry,(function(e){return!("bpmn:CancelEventDefinition"==e.target.eventDefinitionType&&!Mi(t.$parent,"bpmn:Transaction"))&&i(e)})),this._createEntries(e,r)):Mi(t,"bpmn:BoundaryEvent")?(r=v(Fy,(function(e){var n=e.target;if("bpmn:CancelEventDefinition"==n.eventDefinitionType&&!Mi(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)):Mi(t,"bpmn:IntermediateCatchEvent")||Mi(t,"bpmn:IntermediateThrowEvent")?(r=v(Ny,i),this._createEntries(e,r)):Mi(t,"bpmn:Gateway")?(r=v(jy,i),this._createEntries(e,r)):Mi(t,"bpmn:Transaction")?(r=v(By,i),this._createEntries(e,r)):Ji(t)&&Yi(e)?(r=v(Iy,i),this._createEntries(e,r)):Mi(t,"bpmn:SubProcess")&&Yi(e)?(r=v($y,i),this._createEntries(e,r)):Mi(t,"bpmn:AdHocSubProcess")&&!Yi(e)?(r=v(zy,(function(e){var t=e.target,n="bpmn:SubProcess"===t.type,r=!0===t.isExpanded;return My(t)&&(!n||r)})),this._createEntries(e,r)):Mi(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,Hy):Mi(t,"bpmn:FlowNode")?(r=v(zy,i),Mi(t,"bpmn:SubProcess")&&!Yi(e)&&(r=v(r,(function(e){return"Sub-process (collapsed)"!==e.label}))),this._createEntries(e,r)):{}},Xy.prototype.getPopupMenuHeaderEntries=function(e){var t={};return Mi(e,"bpmn:Activity")&&!Ji(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),Mi(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),Mi(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),!Mi(e,"bpmn:SubProcess")||Mi(e,"bpmn:Transaction")||Ji(e)||(t={...t,...this._getAdHocHeaderEntries(e)}),Id(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},Xy.prototype._createEntries=function(e,t){var n={},r=this;return b(t,(function(t){n[t.actionName]=r._createEntry(t,e)})),n},Xy.prototype._createSequenceFlowEntries=function(e,t){var n=Di(e),r={},i=this._modeling,o=this._moddle,s=this;return b(t,(function(t){switch(t.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(Mi(n.sourceRef,"bpmn:ExclusiveGateway")||Mi(n.sourceRef,"bpmn:InclusiveGateway")||Mi(n.sourceRef,"bpmn:ComplexGateway")||Mi(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&&Mi(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:Mi(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(r={...r,[t.actionName]:s._createEntry(t,e,(function(){i.updateProperties(e,{conditionExpression:void 0})}))}),(Mi(n.sourceRef,"bpmn:ExclusiveGateway")||Mi(n.sourceRef,"bpmn:InclusiveGateway")||Mi(n.sourceRef,"bpmn:ComplexGateway")||Mi(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},Xy.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}},Xy.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function r(n,r){if(r.active)return void t._modeling.updateProperties(e,{loopCharacteristics:void 0});const i=e.businessObject.get("loopCharacteristics"),o=t._moddle.create(r.options.loopCharacteristics);i&&t._moddleCopy.copyElement(i,o),o.set("isSequential",r.options.isSequential),t._modeling.updateProperties(e,{loopCharacteristics:o})}var i,o,s,a=Di(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"}}}},Xy.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})}}}},Xy.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})}}}},Xy.prototype._getAdHocHeaderEntries=function(e){var t=this._translate,n=Mi(Di(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})}}}},Xy.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=Di(e),r=this,i=zd(e),o=Mi(e,"bpmn:BoundaryEvent")?Wy["intermediate-event-non-interrupting"]:Wy["start-event-non-interrupting"],s=!n[i];return{"toggle-non-interrupting":{imageHtml:o,title:t("Toggle non-interrupting"),active:s,action:function(){r._modeling.updateProperties(e,{[i]:!!s})}}}};var Gy={__depends__:[cc,Hf,Dc],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Xy]};function Qy(e,t,n,r,i,o,s,a,l,c,p,u,d){e=e||{},r.registerProvider(this),this._contextPad=r,this._modeling=i,this._elementFactory=o,this._connect=s,this._create=a,this._popupMenu=l,this._canvas=c,this._rules=p,this._translate=u,this._eventBus=n,this._appendPreview=d,!1!==e.autoPlace&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,(function(e){var t=e.context.shape;if(Yo(e)&&r.isOpen(t)){var n=r.getEntries(t);n.replace&&n.replace.action.click(e,t)}}))}function Yy(e,t,n){var r=e.$instanceOf(t),i=!1;return b(e.eventDefinitions||[],(function(e){e.$type===n&&(i=!0)})),r&&i}Qy.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],Qy.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&z(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Remove"),action:{click:function(e,n){t.removeElements(n.slice())}}}}),n},Qy.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return c(t)?_(t,(function(e){return n=e,-1!==t.indexOf(n);var n})):t},Qy.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,r=this._elementFactory,i=this._connect,o=this._create,s=this._popupMenu,a=this._rules,l=this._autoPlace,p=this._translate,u=this._appendPreview,d={};if("label"===e.type)return d;var h=e.businessObject;function f(e,t){i.start(e,t)}function m(e,t,n,i){function s(t,n){var s=r.createShape(z({type:e},i));o.start(t,s,{source:n}),u.cleanUp()}var a=l?function(t,n){var o=r.createShape(z({type:e},i));l.append(n,o),u.cleanUp()}:s,c=l?function(t,n){return u.create(n,e,i),()=>{u.cleanUp()}}:null;return{group:"model",className:t,title:n,action:{dragstart:s,click:a,hover:c}}}function g(e){return function(r,i){n.splitLane(i,e),t.open(i,!0)}}if(Ai(h,["bpmn:Lane","bpmn:Participant"])&&Yi(e)){var y=Hu(e);z(d,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:p("Add lane above"),action:{click:function(e,t){n.addLane(t,"top")}}}}),y.length<2&&(e.height>=120&&z(d,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:p("Divide into two lanes"),action:{click:g(2)}}}),e.height>=180&&z(d,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:p("Divide into three lanes"),action:{click:g(3)}}})),z(d,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:p("Add lane below"),action:{click:function(e,t){n.addLane(t,"bottom")}}}})}Mi(h,"bpmn:FlowNode")&&(Mi(h,"bpmn:EventBasedGateway")?z(d,{"append.receive-task":m("bpmn:ReceiveTask","bpmn-icon-receive-task",p("Append receive task")),"append.message-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",p("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",p("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",p("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",p("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):Yy(h,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?z(d,{"append.compensation-activity":m("bpmn:Task","bpmn-icon-task",p("Append compensation activity"),{isForCompensation:!0})}):Mi(h,"bpmn:EndEvent")||h.isForCompensation||Yy(h,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")||Ji(h)||z(d,{"append.end-event":m("bpmn:EndEvent","bpmn-icon-end-event-none",p("Append end event")),"append.gateway":m("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",p("Append gateway")),"append.append-task":m("bpmn:Task","bpmn-icon-task",p("Append task")),"append.intermediate-event":m("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",p("Append intermediate/boundary event"))})),s.isEmpty(e,"bpmn-replace")||z(d,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:p("Change type"),action:{click:function(e,n){var r=z(function(e){var n=t.getPad(e).html.getBoundingClientRect();return{x:n.left,y:n.bottom+5}}(n),{cursor:{x:e.x,y:e.y}});s.open(n,"bpmn-replace",r,{title:p("Change element"),width:300,search:!0})}}}}),Mi(h,"bpmn:SequenceFlow")&&z(d,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",p("Append text annotation"))}),Ai(h,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&z(d,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",p("Append text annotation")),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:p("Connect using "+(h.isForCompensation?"":"sequence/message flow or ")+"association"),action:{click:f,dragstart:f}}}),Mi(h,"bpmn:TextAnnotation")&&z(d,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:p("Connect using association"),action:{click:f,dragstart:f}}}),Ai(h,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&z(d,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:p("Connect using data input association"),action:{click:f,dragstart:f}}}),Mi(h,"bpmn:Group")&&z(d,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",p("Append text annotation"))});var v=a.allowed("elements.delete",{elements:[e]});return c(v)&&(v=v[0]===e),v&&z(d,{delete:{group:"edit",className:"bpmn-icon-trash",title:p("Remove"),action:{click:function(e,t){n.removeElements([t])}}}}),d};var Ky={__depends__:[_y,Ty,Ka,ps,Kp,kf,Gy],__init__:["contextPadProvider"],contextPadProvider:["type",Qy]},Zy={horizontal:["x","width"],vertical:["y","height"]};function Jy(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:[]}))}Jy.$inject=["modeling","rules"],Jy.prototype.registerFilter=function(e){if("function"!=typeof e)throw new Error("the filter has to be a function");this._filters.push(e)},Jy.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},Jy.prototype._filterElements=function(e){var t=this._filters,n=this._axis,r=this._dimension,i=[].concat(e);return t.length?(b(t,(function(e){i=e(i,n,r)})),i):e},Jy.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 b(A(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},Jy.prototype._setOrientation=function(e){var t=Zy[e];this._axis=t[0],this._dimension=t[1]},Jy.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)},Jy.prototype._findRange=function(e){var t=e[this._axis];return{min:t+5,max:t+e[this._dimension]-5}};var ev={__init__:["distributeElements"],distributeElements:["type",Jy]};function tv(e){fc.call(this,e)}tv.$inject=["eventBus"],e(tv,fc),tv.prototype.init=function(){this.addRule("elements.distribute",(function(e){var t=e.elements;return!((t=vt(t=v(t,(function(e){var t=Ai(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 nv={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 rv(e,t,n,r){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=r,e.registerProvider("align-elements",900,this)}rv.$inject=["popupMenu","distributeElements","translate","rules"],rv.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&z(t,this._getEntries(e)),t},rv.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},rv.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:nv.horizontal,action:function(n,i){t.trigger(e,"horizontal"),r.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:nv.vertical,action:function(n,i){t.trigger(e,"vertical"),r.close()}}}};var iv={__depends__:[cc,ev],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",tv],distributeElementsMenuProvider:["type",rv]},ov="is not a registered action";function sv(e,t){this._actions={};var n=this;e.on("diagram.init",(function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})}))}function av(e,t){return new Error(e+" "+t)}sv.$inject=["eventBus","injector"],sv.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)}))},sv.prototype.trigger=function(e,t){if(!this._actions[e])throw av(e,ov);return this._actions[e](t)},sv.prototype.register=function(e,t){var n=this;if("string"==typeof e)return this._registerAction(e,t);b(e,(function(e,t){n._registerAction(t,e)}))},sv.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw av(e,"is already registered");this._actions[e]=t},sv.prototype.unregister=function(e){if(!this.isRegistered(e))throw av(e,ov);this._actions[e]=void 0},sv.prototype.getActions=function(){return Object.keys(this._actions)},sv.prototype.isRegistered=function(e){return!!this._actions[e]};var lv={__init__:["editorActions"],editorActions:["type",sv]};function cv(e){e.invoke(sv,this)}e(cv,sv),cv.$inject=["injector"],cv.prototype._registerDefaultActions=function(e){sv.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=v(t,(function(e){return!Mi(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=kt(r=Mi(i,"bpmn:Collaboration")?n.filter((function(e){return Mi(e.parent,"bpmn:Collaboration")})):n.filter((function(e){return e!==i&&!Mi(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 pv={__depends__:[lv],editorActions:["type",cv]};function uv(e){e.on(["create.init","shape.move.init"],(function(e){var t=e.context;Ai(e.shape,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(t.gridSnappingContext||(t.gridSnappingContext={}),t.gridSnappingContext.snapLocation="top-left")}))}uv.$inject=["eventBus"];var dv=10;function hv(e,t,n){return n||(n="round"),Math[n](e/t)*t}function fv(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&&Gs(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)||(mv(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&&(mv(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&&(mv(t)?yv(a)?s.x.max=l.left:s.x.min=l.right:gv(a)?s.y.max=l.top:s.y.min=l.bottom);c&&(mv(t)?yv(a)?s.x.min=c.left:s.x.max=c.right:gv(a)?s.y.min=c.top:s.y.max=c.bottom);return s[t]}(t,n);s&&z(r,s),zp(t,n)||i.snapEvent(t,n,r)}))}}))}function mv(e){return"x"===e}function gv(e){return-1!==e.indexOf("n")}function yv(e){return-1!==e.indexOf("w")}function vv(e,t){ws.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)}}))}fv.prototype.snapEvent=function(e,t,n){Lp(e,t,this.snapValue(e[t],n))},fv.prototype.getGridSpacing=function(){return dv},fv.prototype.snapValue=function(e,t){var n,r,i=0;return t&&t.offset&&(i=t.offset),e=hv(e+=i,dv),t&&t.min&&u(n=t.min)&&(n=hv(n+i,dv,"ceil"),e=Math.max(e,n)),t&&t.max&&u(r=t.max)&&(r=hv(r+i,dv,"floor"),e=Math.min(e,r)),e-=i},fv.prototype.isActive=function(){return this.active},fv.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},fv.prototype.toggleActive=function(){this.setActive(!this.active)},fv.$inject=["elementRegistry","eventBus","config.gridSnapping"],vv.$inject=["eventBus","gridSnapping","modeling"],e(vv,ws),vv.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},vv.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},vv.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),z(e,o),e},vv.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),z(e,o),e};function bv(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))}))}bv.$inject=["eventBus","gridSnapping"];var wv={__depends__:[{__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",vv],gridSnappingSpaceToolBehavior:["type",bv]}],__init__:["gridSnapping"],gridSnapping:["type",fv]};function xv(e,t){e.on("autoPlace",2e3,(function(e){var n=e.source,r=On(n),i=e.shape,o=Tc(n,i);return["x","y"].forEach((function(e){var n={};o[e]!==r[e]&&(o[e]>r[e]?n.min=o[e]:n.max=o[e],Mi(i,"bpmn:TextAnnotation")&&(!function(e){return"x"===e}(e)?n.offset=-i.height/2:n.offset=-i.width/2),o[e]=t.snapValue(o[e],n))})),o}))}xv.$inject=["eventBus","gridSnapping"];function _v(e,t,n){t.on(["create.start","shape.move.start"],1750,(function(t){var r=t.context,i=r.shape,o=e.getRootElement();Mi(i,"bpmn:Participant")&&Mi(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})))}))}_v.$inject=["canvas","eventBus","gridSnapping"];function kv(e,t,n){ws.call(this,e),this._gridSnapping=t;var r=this;this.postExecuted(["connection.create","connection.layout"],3e3,(function(e){var t=e.context,i=t.connection,o=t.hints||{},s=i.waypoints;o.connectionStart||o.connectionEnd||!1===o.createElementsBehavior||function(e){return e.length>3}(s)&&n.updateWaypoints(i,r.snapMiddleSegments(s))}))}function Ev(e,t,n){var r=jt(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=z({},t,i),n=z({},n,i)),[t,n]}kv.$inject=["eventBus","gridSnapping","modeling"],e(kv,ws),kv.prototype.snapMiddleSegments=function(e){var t,n=this._gridSnapping;e=e.slice();for(var r=1;r<e.length-2;r++)t=Ev(n,e[r],e[r+1]),e[r]=t[0],e[r+1]=t[1];return e};var Ov={__depends__:[wv,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",xv],gridSnappingParticipantBehavior:["type",_v],gridSnappingLayoutConnectionBehavior:["type",kv]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",uv]};function Pv(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],(function(e){var t=e.element,r=e.gfx;return Mi(t,"bpmn:Lane")?n._createParticipantHit(t,r):Mi(t,"bpmn:Participant")?Yi(t)?n._createParticipantHit(t,r):n._createDefaultHit(t,r):Mi(t,"bpmn:SubProcess")?Yi(t)?n._createSubProcessHit(t,r):n._createDefaultHit(t,r):void 0}))}Pv.$inject=["eventBus","interactionEvents"],Pv.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},Pv.prototype._createParticipantHit=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:30,height:e.height}),!0},Pv.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 Sv={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",Pv]};function Cv(e){e.invoke(ra,this)}e(Cv,ra),Cv.$inject=["injector"],Cv.prototype.registerBindings=function(e,t){function n(n,r){t.isRegistered(n)&&e.addListener(r)}ra.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 Tv={__depends__:[ia],__init__:["keyboardBindings"],keyboardBindings:["type",Cv]},Mv={moveSpeed:1,moveSpeedAccelerated:10},Av="left",Dv="right",Nv="down",Rv={ArrowLeft:Av,Left:Av,ArrowUp:"up",Up:"up",ArrowRight:Dv,Right:Dv,ArrowDown:Nv,Down:Nv},jv={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 $v(e,t,n,r,i){var o=this;this._config=z({},Mv,e||{}),t.addListener(1500,(function(e){var n=e.keyEvent,r=Rv[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=jv[e](s);r.allowed("elements.move",{shapes:o})&&n.moveElements(o,a)}}}$v.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];var Bv={__depends__:[ia,ps],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",$v]};function Iv(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=_n(e);return kn({top:$u("top",n,t),right:$u("right",n,t),bottom:$u("bottom",n,t),left:$u("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:_n(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=wn(i)))return;n.resizeShape(t,i)}}(e.context)}))}function zv(e,t){var n=On(e),r=_n(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 Lv(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"}Iv.prototype.canResize=function(e){var t=this._rules,n=F(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},Iv.prototype.activate=function(e,t,n){var r,i,o=this._dragging;if("string"==typeof n&&(n={direction:n}),!(i=(r=z({shape:t},n)).direction))throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");o.init(e,zv(t,i),"resize",{autoActivate:!0,cursor:Lv(i),data:{shape:t,context:r}})},Iv.prototype.computeMinResizeBox=function(e){var t=e.shape;return function(e,t,n,r){var i=_n(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?_n(r):o;return kn({top:Nu(o.top,s.top),left:Nu(o.left,s.left),bottom:Du(o.bottom,s.bottom),right:Du(o.right,s.right)})}(e.direction,t,e.minDimensions||{width:10,height:10},zu(t,e.childrenBoxPadding))},Iv.$inject=["eventBus","rules","modeling","dragging"];var qv="djs-resizing",Fv="resize-not-ok";function Vv(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,qv)),o.width>5&&Te(s,{x:o.x,width:o.width}),o.height>5&&Te(s,{y:o.y,height:o.height}),r.canExecute?Ae(s).remove(Fv):Ae(s).add(Fv)})),e.on("resize.cleanup",(function(e){var n,r;n=e.context,r=n.shape,n.frame&&Ne(n.frame),t.removeMarker(r,qv)}))}Vv.$inject=["eventBus","canvas","previewSupport"];var Hv=-6,Uv="djs-resizer",Wv=["n","w","s","e","nw","ne","se","sw"];function Xv(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&&b(t,I(i.addResizer,i))})),e.on("shape.changed",(function(e){var t=e.element;n.isSelected(t)&&(i.removeResizers(),i.addResizer(t))}))}Xv.prototype.makeDraggable=function(e,t,n){var r=this._resize;function i(t){Qo(t)&&r.activate(t,e,n)}he.bind(t,"mousedown",i),he.bind(t,"touchstart",i)},Xv.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=Hv);-1!==e.indexOf("s")?t.y=6:-1!==e.indexOf("n")&&(t.y=Hv);return t}(r),s=ze("g");Ae(s).add(Uv),Ae(s).add(Uv+"-"+e.id),Ae(s).add(Uv+"-"+r),Oe(i,s);var a=ze("rect");Te(a,{x:-4+o.x,y:-4+o.y,width:8,height:8}),Ae(a).add(Uv+"-visual"),Oe(s,a);var l=ze("rect");return Te(l,{x:-10+o.x,y:-10+o.y,width:20,height:20}),Ae(l).add(Uv+"-hit"),Oe(s,l),tr(s,t,n),s},Xv.prototype.createResizer=function(e,t){var n=zv(e,t),r=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,r,t)},Xv.prototype.addResizer=function(e){var t=this;!vn(e)&&this._resize.canResize({shape:e})&&b(Wv,(function(n){t.createResizer(e,n)}))},Xv.prototype.removeResizers=function(){Re(this._getResizersParent())},Xv.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},Xv.$inject=["eventBus","canvas","selection","resize"];var Gv={__depends__:[Qc,Hc,ru],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Iv],resizePreview:["type",Vv],resizeHandles:["type",Xv]};function Qv(e,t,n,r,i,o,s){function a(e,t){(t||Ai(e,["bpmn:Task","bpmn:TextAnnotation","bpmn:Participant"])||Yv(e))&&r.activate(e)}this._bpmnFactory=t,this._canvas=n,this._modeling=i,this._textRenderer=s,r.registerProvider(this),e.on("element.dblclick",(function(e){a(e.element,!0)})),e.on(["autoPlace.start","canvas.viewbox.changing","drag.init","element.mousedown","popupMenu.open","root.set","selection.changed"],(function(){r.isActive()&&r.complete()})),e.on(["shape.remove","connection.remove"],2e3,(function(e){r.isActive(e.element)&&r.cancel()})),e.on(["commandStack.changed"],(function(e){r.isActive()&&r.cancel()})),e.on("directEditing.activate",(function(e){o.removeResizers()})),e.on("create.end",500,(function(e){var t=e.context,n=t.shape,r=e.context.canExecute;e.isTouch||r&&(t.hints&&!1===t.hints.createElementsBehavior||a(n))})),e.on("autoPlace.end",500,(function(e){a(e.shape)}))}function Yv(e){return Mi(e,"bpmn:SubProcess")&&!Yi(e)}Qv.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],Qv.prototype.activate=function(e){var t=lo(e);if(void 0!==t){var n={text:t};z(n,this.getEditingBBox(e));var r={};return(Ai(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||Yv(e))&&z(r,{centerVertically:!0}),ro(e)&&z(r,{autoResize:!0}),Mi(e,"bpmn:TextAnnotation")&&z(r,{resizable:!0,autoResize:!0}),z(n,{options:r}),n}},Qv.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,r=t.getAbsoluteBBox(n),i=r.x+r.width/2,o=r.y+r.height/2,s={x:r.x,y:r.y},a=t.zoom(),l=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),p=c.fontSize*a,u=c.lineHeight,d=l.fontSize*a,h=l.lineHeight,f={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(Mi(e,"bpmn:Lane")||function(e){return Mi(e,"bpmn:Participant")&&Yi(e)}(e)){var m=Ki(e);z(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}),z(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 Mi(e,"bpmn:Participant")&&!Yi(e)}(e)){var g=Ki(e);z(s,g?{width:r.width,height:r.height}:{width:r.height,height:r.width,x:i-r.height/2,y:o-r.width/2}),z(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)"})}(Ai(e,["bpmn:Task","bpmn:CallActivity"])||Yv(e))&&(z(s,{width:r.width,height:r.height}),z(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 Mi(e,"bpmn:SubProcess")&&Yi(e)}(e)&&(z(s,{width:r.width,x:r.x}),z(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&&(z(s,{width:y,height:r.height+v+b,x:i-y/2,y:r.y-v}),z(f,{fontSize:p+"px",lineHeight:u,paddingTop:v+"px",paddingBottom:b+"px"})),ro(n)&&!io(n)&&!bn(n)){var w=so(e),x=t.getAbsoluteBBox({x:w.x,y:w.y,width:0,height:0}),_=p+v+b;z(s,{width:y,height:_,x:x.x-y/2,y:x.y-_/2}),z(f,{fontSize:p+"px",lineHeight:u,paddingTop:v+"px",paddingBottom:b+"px"})}return Mi(e,"bpmn:TextAnnotation")&&(z(s,{width:r.width,height:r.height,minWidth:30*a,minHeight:10*a}),z(f,{textAlign:"left",paddingTop:5*a+"px",paddingBottom:7*a+"px",paddingLeft:7*a+"px",paddingRight:5*a+"px",fontSize:d+"px",lineHeight:h})),{bounds:s,style:f}},Qv.prototype.update=function(e,t,n,r){var i,o,s;Mi(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 Kv="djs-element-hidden",Zv="djs-label-hidden";function Jv(e,t,n){var r,i,o,s=this,a=t.getDefaultLayer();e.on("directEditing.activate",(function(e){var l=e.active;if(Mi(r=l.element.label||l.element,"bpmn:TextAnnotation")){i=t.getAbsoluteBBox(r),o=ze("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=ze("path");Te(p,{d:c,strokeWidth:2,stroke:eb(r)}),Oe(o,p),Oe(a,o),nr(o,r.x,r.y)}Mi(r,"bpmn:TextAnnotation")||r.labelTarget?t.addMarker(r,Kv):(Mi(r,"bpmn:Task")||Mi(r,"bpmn:CallActivity")||Mi(r,"bpmn:SubProcess")||Mi(r,"bpmn:Participant"))&&t.addMarker(r,Zv)})),e.on("directEditing.resize",(function(e){if(Mi(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}});Te(s.path,{d:l})}})),e.on(["directEditing.complete","directEditing.cancel"],(function(e){var n=e.active;n&&(t.removeMarker(n.element.label||n.element,Kv),t.removeMarker(r,Zv)),r=void 0,i=void 0,o&&(Ne(o),o=void 0)}))}function eb(e,t){return Ni(e).get("stroke")||t||"black"}Jv.$inject=["eventBus","canvas","pathMap"];var tb={__depends__:[bs,Gv,Ty],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Qv],labelEditingPreview:["type",Jv]},nb=new us("tt");function rb(e,t){e.style.display=!1===t?"none":""}var ib="djs-tooltip",ob="."+ib;function sb(e,t){var n,r;this._eventBus=e,this._canvas=t,this._ids=nb,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=(n=t.getContainer(),Z(r=we('<div class="djs-tooltip-container" />'),{position:"absolute",width:"0",height:"0"}),n.insertBefore(r,n.firstChild),r);var i=this;ge.bind(this._tooltipRoot,ob,"mousedown",(function(e){e.stopPropagation()})),ge.bind(this._tooltipRoot,ob,"mouseover",(function(e){i.trigger("mouseover",e)})),ge.bind(this._tooltipRoot,ob,"mouseout",(function(e){i.trigger("mouseout",e)})),this._init()}sb.$inject=["eventBus","canvas"],sb.prototype.add=function(e){if(!e.position)throw new Error("must specifiy tooltip position");if(!e.html)throw new Error("must specifiy tooltip html");var t=this._ids.next();return e=z({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},sb.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,r=this.get(J(n,"data-tooltip-id"));r&&("mouseover"===e&&r.timeout&&this.clearTimeout(r),"mouseout"===e&&r.timeout&&(r.timeout=1e3,this.setTimeout(r)))},sb.prototype.get=function(e){return"string"!=typeof e&&(e=e.id),this._tooltips[e]},sb.prototype.clearTimeout=function(e){if(e=this.get(e)){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},sb.prototype.setTimeout=function(e){if(e=this.get(e)){this.clearTimeout(e);var t=this;e.removeTimer=setTimeout((function(){t.remove(e)}),e.timeout)}},sb.prototype.remove=function(e){var t=this.get(e);t&&(ke(t.html),ke(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},sb.prototype.show=function(){rb(this._tooltipRoot)},sb.prototype.hide=function(){rb(this._tooltipRoot,!1)},sb.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},sb.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=we(r)),Z(t=we('<div data-tooltip-id="'+n+'" class="'+ib+'">'),{position:"absolute"}),t.appendChild(r),e.type&&te(t).add("djs-tooltip-"+e.type),e.className&&te(t).add(e.className),e.htmlContainer=t,i.appendChild(t),this._tooltips[n]=e,this._updateTooltip(e)},sb.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)},sb.prototype._updateTooltipVisibilty=function(e){b(this._tooltips,(function(t){var n=t.show,r=t.htmlContainer,i=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(i=!1),rb(r,i))}))},sb.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 ab={__init__:["tooltips"],tooltips:["type",sb]};function lb(e,t,n){e.on(["shape.move.rejected","create.rejected"],(function(e){var r,i,o,s=e.context,a=s.shape;Mi(s.target,"bpmn:Collaboration")&&Mi(a,"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:o||2e3,html:"<div>"+i+"</div>"}))}))}lb.$inject=["eventBus","tooltips","translate"];var cb={__depends__:[ab],__init__:["modelingFeedback"],modelingFeedback:["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&&!Ae(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=C(e,"id");return v(e,(function(e){for(;e=e.parent;)if(t[e.id])return!1;return!0}))}(i),z(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(Qo(e)){var t=Ho(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=v(e,(function(t){return!vn(t)||g(e,D({id:t.source.id}))&&g(e,D({id:t.target.id}))}));return t}(s(e));return t}function s(e){var t=_t(e,!0),n=E(t,(function(e){return(e.incoming||[]).concat(e.outgoing||[])}));return r(t.concat(n))}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=e.context,l=a.shapes,c=a.allDraggedElements,p=o(l);if(!a.dragGroup){var u=ze("g");Te(u,n.cls("djs-drag-group",["no-events"])),Oe(t.getActiveLayer(),u),a.dragGroup=u}p.forEach((function(e){i.addDragger(e,a.dragGroup)})),b(c=c?r([c,s(l)]):s(l),(function(e){t.addMarker(e,db)})),a.allDraggedElements=c,a.differentParents=1!==P(C(l,(function(e){return e.parent&&e.parent.id})))})),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&&r&&r.id!==i.id?a(r,mb):a(r,t.canExecute?hb:fb)),nr(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;b(r,(function(e){t.removeMarker(e,db)})),i&&Ne(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__:[ts,ps,rs,Qc,Hc,ru],__init__:["move","movePreview"],move:["type",ub],movePreview:["type",yb]};const bb={width:36,height:50},wb={width:50,height:50};function xb(e,t,n){return ze("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}function _b(e,t){this._styles=t,e.registerProvider(this)}function kb(e,t){var n;return"bpmn:DataObjectReference"===t?n=bb:"bpmn:DataStoreReference"===t&&(n=wb),e.width===n.width&&e.height===n.height}_b.$inject=["outline","styles"],_b.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(!bn(e))return Mi(e,"bpmn:Gateway")?(z((n=ze("rect")).style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),Te(n,z({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):Ai(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group"])?Te(n=ze("rect"),z({x:-5,y:-5,rx:14,width:e.width+10,height:e.height+10},t)):Mi(e,"bpmn:EndEvent")?Te(n=ze("circle"),z({cx:e.width/2,cy:e.height/2,r:e.width/2+5+1},t)):Mi(e,"bpmn:Event")?Te(n=ze("circle"),z({cx:e.width/2,cy:e.height/2,r:e.width/2+5},t)):Mi(e,"bpmn:DataObjectReference")&&kb(e,"bpmn:DataObjectReference")?n=xb("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):Mi(e,"bpmn:DataStoreReference")&&kb(e,"bpmn:DataStoreReference")&&(n=xb("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},_b.prototype.updateOutline=function(e,t){if(!bn(e))return Ai(e,["bpmn:SubProcess","bpmn:Group"])?(Te(t,{width:e.width+10,height:e.height+10}),!0):!!Ai(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};var Eb={__depends__:[rs],__init__:["outlineProvider"],outlineProvider:["type",_b]},Ob=".djs-palette-toggle",Pb=".entry",Sb=Ob+", "+Pb,Cb="djs-palette-",Tb="open",Mb="two-column";function Ab(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 Db(e,t){var n=t.getPaletteEntries();return d(n)?n(e):(b(n,(function(t,n){e[n]=t})),e)}Ab.$inject=["eventBus","canvas"],Ab.prototype.registerProvider=function(e,t){t||(t=e,e=1e3),this._eventBus.on("palette.getProviders",e,(function(e){e.providers.push(t)})),this._rebuild()},Ab.prototype.getEntries=function(){return this._getProviders().reduce(Db,{})},Ab.prototype._rebuild=function(){this._diagramInitialized&&(this._getProviders().length&&(this._container||this._init(),this._update()))},Ab.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),r=this._container=we(Ab.HTML_MARKUP);n.appendChild(r),te(n).add(Cb+"shown"),ge.bind(r,Sb,"click",(function(t){if(ie(t.delegateTarget,Ob))return e.toggle();e.trigger("click",t)})),he.bind(r,"mousedown",(function(e){e.stopPropagation()})),ge.bind(r,Pb,"dragstart",(function(t){e.trigger("dragstart",t)})),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:r})},Ab.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},Ab.prototype._toggleState=function(e){e=e||{};var t,n=this._getParentContainer(),r=this._container,i=this._eventBus,o=te(r),s=te(n);t="twoColumn"in e?e.twoColumn:this._needsCollapse(n.clientHeight,this._entries||{}),o.toggle(Mb,t),s.toggle(Cb+Mb,t),"open"in e&&(o.toggle(Tb,e.open),s.toggle(Cb+Tb,e.open)),i.fire("palette.changed",{twoColumn:t,open:this.isOpen()})},Ab.prototype._update=function(){var e=xe(".djs-palette-entries",this._container),t=this._entries=this.getEntries();re(e),b(t,(function(t,n){var r=t.group||"default",i=xe("[data-group="+Es(r)+"]",e);i||(J(i=we('<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=we(o);if(i.appendChild(s),!t.separator&&(J(s,"data-action",n),t.title&&J(s,"title",t.title),t.className&&function(e,t){var n=te(e),r=c(t)?t:t.split(/\s+/g);r.forEach((function(e){n.add(e)}))}(s,t.className),t.imageUrl)){var a=we("<img>");J(a,"src",t.imageUrl),s.appendChild(a)}})),this.open()},Ab.prototype.trigger=function(e,t,n){var r,i,o=t.delegateTarget||t.target;return o?(r=J(o,"data-action"),i=t.originalEvent||t,this.triggerEntry(r,e,i,n)):t.preventDefault()},Ab.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()}},Ab.prototype._layoutChanged=function(){this._toggleState({})},Ab.prototype._needsCollapse=function(e,t){return e<46*Object.keys(t).length+50},Ab.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},Ab.prototype.open=function(){this._toggleState({open:!0})},Ab.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Ab.prototype.isActiveTool=function(e){return e&&this._activeTool===e},Ab.prototype.updateToolHighlight=function(e){var t;this._toolsContainer||(t=xe(".djs-palette-entries",this._container),this._toolsContainer=xe("[data-group=tools]",t)),b(this._toolsContainer.children,(function(t){var n=t.getAttribute("data-action");if(n){var r=te(t);n=n.replace("-tool",""),r.contains("entry")&&n===e?r.add("highlighted-entry"):r.remove("highlighted-entry")}}))},Ab.prototype.isOpen=function(){return te(this._container).has(Tb)},Ab.prototype._getParentContainer=function(){return this._canvas.getContainer()},Ab.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';var Nb={__init__:["palette"],palette:["type",Ab]},Rb="crosshair";function jb(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();Te(n=e.frame=ze("rect"),{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),Oe(r,n)},c=function(e){var t=e.frame,n=e.bbox;Te(t,{x:n.x,y:n.y,width:n.width,height:n.height})},p=function(e){e.frame&&Ne(e.frame)};o.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",(function(t){var n=t.originalEvent.target;(t.hover||n instanceof SVGElement)&&e.once("lasso.selection.ended",(function(){a.activateLasso(t.originalEvent,!0)}))})),e.on("lasso.end",(function(e){var t=$b(e),n=r.filter((function(e){return e}));a.select(n,t)})),e.on("lasso.start",(function(e){var t=e.context;t.bbox=$b(e),l(t)})),e.on("lasso.move",(function(e){var t=e.context;t.bbox=$b(e),c(t)})),e.on("lasso.cleanup",(function(e){var t=e.context;p(t)})),e.on("element.mousedown",1500,(function(e){if(Ko(e))return a.activateLasso(e.originalEvent),!0}))}function $b(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}}jb.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],jb.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:Rb,data:{context:{}}})},jb.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:Rb,data:{context:{}}})},jb.prototype.select=function(e,t){var n=function(e,t){var n={};return b(e,(function(e){var r=e;r.waypoints&&(r=kt(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(S(n))},jb.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},jb.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};var Bb={__depends__:[Wf,Of],__init__:["lassoTool"],lassoTool:["type",jb]},Ib=1500,zb="grab";function Lb(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",Ib,(function(e){if(Yo(e))return s.activateMove(e.originalEvent,!0),!1})),a&&a.addListener(Ib,(function(e){if(qb(e.keyEvent)&&!s.isActive()){var t=s._mouse.getLastMoveEvent();s.activateMove(t,!!t)}}),"keyboard.keydown"),a&&a.addListener(Ib,(function(e){qb(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!Yo(t)&&n&&e.once("hand.move.ended",(function(e){s.activateHand(e.originalEvent,!0,!0)})),!1}))}function qb(e){return Qs("Space",e)}Lb.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Lb.prototype.activateMove=function(e,t,n){"object"==typeof t&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:zb,data:{context:n||{}}})},Lb.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:zb,data:{context:{reactivate:n}}})},Lb.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Lb.prototype.isActive=function(){var e=this._dragging.context();return!!e&&/^(hand|hand\.move)$/.test(e.prefix)};var Fb={__depends__:[Wf,Of],__init__:["handTool"],handTool:["type",Lb]},Vb="connect-ok",Hb="connect-not-ok";function Ub(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?Vb:Hb))})),e.on(["global-connect.out","global-connect.cleanup"],(function(e){var t=e.context.startTarget,n=e.context.canStartConnect;t&&r.removeMarker(t,n?Vb:Hb)})),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}))}Ub.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],Ub.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},Ub.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},Ub.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Ub.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};var Wb={__depends__:[Kp,Qc,Hc,Wf,Of],globalConnect:["type",Ub]};function Xb(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)}Xb.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],Xb.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(z({type:e},s));s&&(Ni(i).isExpanded=s.isExpanded);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 z(e,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:a("Activate hand tool"),action:{click:function(e){o.activateHand(e)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:a("Activate lasso tool"),action:{click:function(e){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 Gb={__depends__:[Nb,kf,dm,Bb,Fb,Wb,Bo],__init__:["paletteProvider"],paletteProvider:["type",Xb]};function Qb(e,t,n,r,i){ws.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){b(e.canExecute.replacements,(function(o){var s=o.oldElementId,a={type:o.newElementType};if(!e.visualReplacements[s]){var l=t.get(s);z(a,{x:l.x,y:l.y});var c=n.createShape(a);r.addShape(c,l.parent);var p=xe('[data-element-id="'+Es(l.id)+'"]',e.dragGroup);p&&Te(p,{display:"none"});var u=i.addDragger(c,e.dragGroup);e.visualReplacements[s]=u,r.removeShape(c)}}))}(o):function(e){var t=e.visualReplacements;b(t,(function(n,r){var i=xe('[data-element-id="'+Es(r)+'"]',e.dragGroup);i&&Te(i,{display:"inline"}),n.remove(),t[r]&&delete t[r]}))}(o)}))}Qb.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],e(Qb,ws);var Yb={__depends__:[ru],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",Qb]},Kb=40,Zb=20,Jb=10,ew=20,tw=["x","y"],nw=Math.abs;function rw(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&&Gs(e.originalEvent)||(t.initialConnectionStart||(t.initialConnectionStart=t.connectionStart),n&&i&&function(e,t,n){tw.forEach((function(r){var i=sw(r,t);e[r]<t[r]+n?Lp(e,r,t[r]+n):e[r]>t[r]+i-n&&Lp(e,r,t[r]+i-n)}))}(e,i,function(e){return Mi(e,"bpmn:Task")?Jb:Zb}(i)),i&&function(e,t){return k(t,(function(t){return ow(e,t)}))}(n,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(t.connectionStart=Ip(r),Ai(i,["bpmn:Event","bpmn:Gateway"])&&iw(e,Ip(i)),Ai(i,["bpmn:Task","bpmn:SubProcess"])&&function(e,t){var n=Ip(t);tw.forEach((function(r){(function(e,t,n){return e[n]>t[n]+ew&&e[n]<t[n]+sw(n,t)-ew})(e,t,r)&&Lp(e,r,n[r])}))}(e,i),Mi(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=Ip(n),o=Pn(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];nw(r-i[t])<Kb&&(n=r>i[t]?i[t]+Kb:i[t]-Kb,Lp(e,t,n))}))}(e)):ow(n,"bpmn:MessageFlow")?(Mi(r,"bpmn:Event")&&(t.connectionStart=Ip(r)),Mi(i,"bpmn:Event")&&iw(e,Ip(i))):t.connectionStart=t.initialConnectionStart)}))}function iw(e,t){Lp(e,"x",t.x),Lp(e,"y",t.y)}function ow(e,t){return e&&e.type===t}function sw(e,t){return"x"===e?t.width:t.height}function aw(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}function lw(){this._snapValues={}}rw.$inject=["eventBus"],aw.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},aw.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,-1===this._snapLocations.indexOf(e)&&this._snapLocations.push(e)},aw.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},aw.prototype.getSnapLocations=function(){return this._snapLocations},aw.prototype.setSnapLocations=function(e){this._snapLocations=e},aw.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new lw).initDefaults(this._defaultSnaps),n},lw.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)},lw.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],Rp(i-e)<=n)return i}(e[n],i[n],r)},lw.prototype.initDefaults=function(e){var t=this;b(e||{},(function(e,n){b(e,(function(e){t.add(n,e)}))}))};var cw=1250;function pw(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"],cw,(function(e){var t=e.context,i=t.shape,o=t.snapContext,s=t.target;if((!e.originalEvent||!Gs(e.originalEvent))&&!zp(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()}))}pw.$inject=["elementRegistry","eventBus","snapping"],pw.prototype.initSnap=function(e){var t,n=this._elementRegistry,r=e.context,i=r.shape,o=r.snapContext;o||(o=r.snapContext=new aw);var s=(t=n.get(i.id)?Ip(i,e):{x:e.x+Ip(i).x,y:e.y+Ip(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}),bn(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},pw.prototype.addSnapTargetPoints=function(e,t,n){return b(this.getSnapTargets(t,n),(function(n){if(bn(n))bn(t)&&e.add("mid",Ip(n));else if(vn(n)){if(n.waypoints.length<3)return;b(n.waypoints.slice(1,-1),(function(t){e.add("mid",t)}))}else e.add("mid",Ip(n))})),u(t.x)&&u(t.y)?(this._elementRegistry.get(t.id)&&e.add("mid",Ip(t)),e):e},pw.prototype.getSnapTargets=function(e,t){return qp(t).filter((function(e){return!e.hidden}))};function uw(e,t){t.invoke(pw,this),e.on(["create.move","create.end"],1500,dw),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)&&!zp(e)&&function(e,t){var n,r=_n(t),i=Ph(e,t),o=e.context,s=o.shape;n=s.parent?{x:0,y:0}:On(s);/top/.test(i)?Lp(e,"y",r.top-n.y):/bottom/.test(i)&&Lp(e,"y",r.bottom-n.y);/left/.test(i)?Lp(e,"x",r.left-n.x):/right/.test(i)&&Lp(e,"x",r.right-n.x)}(e,r)}))}function dw(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)&&Lp(e,"x",e.x),(n&&n>=e.y||i&&i<=e.y)&&Lp(e,"y",e.y)}}function hw(e,t){return-1!==e.indexOf(t)}function fw(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}e(uw,pw),uw.$inject=["eventBus","injector"],uw.prototype.initSnap=function(e){var t=pw.prototype.initSnap.call(this,e),n=e.shape,r=!!this._elementRegistry.get(n.id);return b(n.outgoing,(function(n){var i=n.waypoints[0];i=i.original||i,t.setSnapOrigin(n.id+"-docking",fw(i,r,e))})),b(n.incoming,(function(n){var i=n.waypoints[n.waypoints.length-1];i=i.original||i,t.setSnapOrigin(n.id+"-docking",fw(i,r,e))})),Mi(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},uw.prototype.addSnapTargetPoints=function(e,t,n){pw.prototype.addSnapTargetPoints.call(this,e,t,n);var r=this.getSnapTargets(t,n);b(r,(function(n){var r;(function(e){if(Mi(e,"bpmn:SubProcess")&&Yi(e))return!0;return Mi(e,"bpmn:Participant")}(n)||(r="bpmn:TextAnnotation",[t,n].every((function(e){return Mi(e,r)}))))&&(e.add("top-left",$p(n)),e.add("bottom-right",Bp(n)))}));var i=this._elementRegistry;return b(t.incoming,(function(n){if(i.get(t.id)){hw(r,n.source)||e.add("mid",On(n.source));var o=n.waypoints[0];e.add(n.id+"-docking",o.original||o)}})),b(t.outgoing,(function(n){if(i.get(t.id)){hw(r,n.target)||e.add("mid",On(n.target));var o=n.waypoints[n.waypoints.length-1];e.add(n.id+"-docking",o.original||o)}})),Mi(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},uw.prototype.getSnapTargets=function(e,t){return pw.prototype.getSnapTargets.call(this,e,t).filter((function(e){return!Mi(e,"bpmn:Lane")}))};function mw(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&&Gs(e.originalEvent)||zp(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)&&Lp(e,"x",e.x),function(e){return"e"===e||"w"===e}(s)&&Lp(e,"y",e.y),t.snap(e,l)}})),e.on(["resize.cleanup"],(function(){t.hide()}))}function gw(e,t){var n=On(e),r=_n(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}mw.prototype.initSnap=function(e){var t=e.context,n=t.shape,r=t.direction,i=t.snapContext;i||(i=t.snapContext=new aw);var o=gw(n,r);return i.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),i},mw.prototype.addSnapTargetPoints=function(e,t,n,r){return b(this.getSnapTargets(t,n),(function(t){e.add("corner",Bp(t)),e.add("corner",$p(t))})),e.add("corner",gw(t,r)),e},mw.$inject=["eventBus","snapping"],mw.prototype.getSnapTargets=function(e,t){return qp(t).filter((function(t){return!(n=t,r=e,n.host===r||vn(t)||function(e){return!!e.hidden}(t)||bn(t));var n,r}))};function yw(e){this._canvas=e,this._asyncHide=B(I(this.hide,this),1e3)}yw.$inject=["canvas"],yw.prototype.snap=function(e,t){var n=e.context.snapContext,r=n.getSnapLocations(),i={x:zp(e,"x"),y:zp(e,"y")};b(r,(function(r){var o=n.getSnapOrigin(r),s={x:e.x+o.x,y:e.y+o.y};if(b(["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),b(["x","y"],(function(t){var n=i[t];p(n)&&Lp(e,t,n.originValue)}))},yw.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=ze("path");return Te(n,{d:"M0,0 L0,0"}),Ae(n).add("djs-snap-line"),Oe(t,n),{update:function(t){u(t)?Te(n,"horizontal"===e?{d:"M-100000,"+t+" L+100000,"+t,display:""}:{d:"M "+t+",-100000 L "+t+", +100000",display:""}):Te(n,{display:"none"})}}},yw.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},yw.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},yw.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},yw.prototype.hide=function(){b(this._snapLines,(function(e){e.update()}))};var vw={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",pw],resizeSnapping:["type",mw],snapping:["type",yw]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",rw],createMoveSnapping:["type",uw]};function bw(e,t,n,r){this._open=!1,this._results=[],this._eventMaps=[],this._canvas=e,this._eventBus=t,this._overlays=n,this._selection=r,this._container=we(bw.BOX_HTML),this._searchInput=xe(bw.INPUT_SELECTOR,this._container),this._resultsContainer=xe(bw.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy"],this.close,this)}function ww(e,t,n){var r=function(e){var t="";return e.forEach((function(e){e.matched?t+='<strong class="'+bw.RESULT_HIGHLIGHT_CLASS+'">'+Ps(e.matched)+"</strong>":t+=Ps(e.normal)})),""!==t?t:null}(t),i=we(n);i.innerHTML=r,e.appendChild(i)}bw.$inject=["canvas","eventBus","overlays","selection"],bw.prototype._bindEvents=function(){var e=this;function t(t,n,r,i){e._eventMaps.push({el:t,type:r,listener:ge.bind(t,n,r,i)})}t(document,"html","click",(function(t){e.close()})),t(this._container,bw.INPUT_SELECTOR,"click",(function(e){e.stopPropagation(),e.delegateTarget.focus()})),t(this._container,bw.RESULT_SELECTOR,"mouseover",(function(t){t.stopPropagation(),e._scrollToNode(t.delegateTarget),e._preselect(t.delegateTarget)})),t(this._container,bw.RESULT_SELECTOR,"click",(function(t){t.stopPropagation(),e._select(t.delegateTarget)})),t(this._container,bw.INPUT_SELECTOR,"keydown",(function(e){Qs("ArrowUp",e)&&e.preventDefault(),Qs("ArrowDown",e)&&e.preventDefault()})),t(this._container,bw.INPUT_SELECTOR,"keyup",(function(t){if(Qs("Escape",t))return e.close();if(Qs("Enter",t)){var n=e._getCurrentResult();return n?e._select(n):e.close()}return Qs("ArrowUp",t)?e._scrollToDirection(!0):Qs("ArrowDown",t)?e._scrollToDirection():void(Qs(["ArrowLeft","ArrowRight"],t)||e._search(t.delegateTarget.value))}))},bw.prototype._unbindEvents=function(){this._eventMaps.forEach((function(e){ge.unbind(e.el,e.type,e.listener)}))},bw.prototype._search=function(e){var t=this;if(this._clearResults(),e&&""!==e){var n=this._searchProvider.find(e);if(n.length){n.forEach((function(e){var n=e.element.id,r=t._createResultNode(e,n);t._results[n]={element:e.element,node:r}}));var r=xe(bw.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(r),this._preselect(r)}}},bw.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},bw.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)}},bw.prototype._clearResults=function(){re(this._resultsContainer),this._results=[],this._resetOverlay(),this._eventBus.fire("searchPad.cleared")},bw.prototype._getCurrentResult=function(){return xe(bw.RESULT_SELECTED_SELECTOR,this._resultsContainer)},bw.prototype._createResultNode=function(e,t){var n=we(bw.RESULT_HTML);return e.primaryTokens.length>0&&ww(n,e.primaryTokens,bw.RESULT_PRIMARY_HTML),ww(n,e.secondaryTokens,bw.RESULT_SECONDARY_HTML),J(n,bw.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},bw.prototype.registerProvider=function(e){this._searchProvider=e},bw.prototype.open=function(){if(!this._searchProvider)throw new Error("no search provider registered");this.isOpen()||(this._bindEvents(),this._open=!0,te(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},bw.prototype.close=function(){this.isOpen()&&(this._unbindEvents(),this._open=!1,te(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._resetOverlay(),this._eventBus.fire("searchPad.closed"))},bw.prototype.toggle=function(){this.isOpen()?this.close():this.open()},bw.prototype.isOpen=function(){return this._open},bw.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&te(t).remove(bw.RESULT_SELECTED_CLASS);var n=J(e,bw.RESULT_ID_ATTRIBUTE),r=this._results[n].element;te(e).add(bw.RESULT_SELECTED_CLASS),this._resetOverlay(r),this._canvas.scrollToElement(r,{top:400}),this._selection.select(r),this._eventBus.fire("searchPad.preselected",r)}},bw.prototype._select=function(e){var t=J(e,bw.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this.close(),this._resetOverlay(),this._canvas.scrollToElement(n,{top:400}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},bw.prototype._resetOverlay=function(e){if(this._overlayId&&this._overlays.remove(this._overlayId),e){var t=function(e){var t=6,n=e.width+2*t,r=e.height+2*t,i={width:n+"px",height:r+"px"},o=we('<div class="'+bw.OVERLAY_CLASS+'"></div>');return Z(o,i),{position:{bottom:r-t,right:n-t},show:!0,html:o}}(kt(e));this._overlayId=this._overlays.add(e,t)}},bw.CONTAINER_SELECTOR=".djs-search-container",bw.INPUT_SELECTOR=".djs-search-input input",bw.RESULTS_CONTAINER_SELECTOR=".djs-search-results",bw.RESULT_SELECTOR=".djs-search-result",bw.RESULT_SELECTED_CLASS="djs-search-result-selected",bw.RESULT_SELECTED_SELECTOR="."+bw.RESULT_SELECTED_CLASS,bw.RESULT_ID_ATTRIBUTE="data-result-id",bw.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",bw.OVERLAY_CLASS="djs-search-overlay",bw.BOX_HTML='<div class="djs-search-container djs-draggable djs-scrollable"><div class="djs-search-input"><input type="text"/></div><div class="djs-search-results"></div></div>',bw.RESULT_HTML='<div class="djs-search-result"></div>',bw.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',bw.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';var xw={__depends__:[ys,ps],searchPad:["type",bw]};function _w(e,t,n){this._elementRegistry=e,this._canvas=n,t.registerProvider(this)}function kw(e){return v(e,(function(e){return!!e.matched})).length>0}function Ew(e,t){var n=[],r=e;if(!e)return n;e=e.toLowerCase(),t=t.toLowerCase();var i=e.indexOf(t);return i>-1?(0!==i&&n.push({normal:r.substr(0,i)}),n.push({matched:r.substr(i,t.length)}),t.length+i<e.length&&n.push({normal:r.substr(t.length+i,e.length)})):n.push({normal:r}),n}_w.$inject=["elementRegistry","searchPad","canvas"],_w.prototype.find=function(e){var t=this._canvas.getRootElement(),n=this._elementRegistry.filter((function(e){return!e.labelTarget}));return n=v(n,(function(e){return e!==t})),n=A(n=v(n=E(n,(function(t){return{primaryTokens:Ew(lo(t),e),secondaryTokens:Ew(t.id,e),element:t}})),(function(e){return kw(e.primaryTokens)||kw(e.secondaryTokens)})),(function(e){return lo(e.element)+e.element.id}))};var Ow={__depends__:[xw],__init__:["bpmnSearch"],bpmnSearch:["type",_w]};function Pw(e){Qi.call(this,e)}e(Pw,Qi),Pw.Viewer=Vs,Pw.NavigatedViewer=ka,Pw.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>')},Pw.prototype._interactionModules=[aa,ga,ja,_a],Pw.prototype._modelingModules=[gc,Dc,Xc,Bc,Up,Kp,Jp,Ky,jf,kf,iv,pv,Ov,Sv,Tv,Bv,tb,by,cb,vb,Eb,Gb,Yb,Gv,vw,Ow],Pw.prototype._modules=[].concat(Vs.prototype._modules,Pw.prototype._interactionModules,Pw.prototype._modelingModules);var Sw={min:.2,max:4};function Cw(e,t,n,r,i){var o=this;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._init();var s=new Ca.Manager(document);s.add(new Ca.Pan),s.on("panmove",u),s.on("panend",d);var a=new Ca.Manager(this._svg);a.add(new Ca.Pan),a.on("panstart",p(!0)),a.add(new Ca.Tap),a.on("tap",(function(e){c(Iw(e))}));var l=new Ca.Manager(this._viewportDom);function c(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 p(e){return function(t){var n=Iw(t);o._state._svgClientRect&&!Nw(o._state._svgClientRect)||(o._state._svgClientRect=o._svg.getBoundingClientRect()),e&&c(n);var i=Tw({x:n.x-o._state._svgClientRect.left,y:n.y-o._state._svgClientRect.top},o._svg,o._lastViewbox),s=r.viewbox(),a=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,s),l=o._viewportDom.getBoundingClientRect(),p={x:n.x-l.left+1,y:n.y-l.top+1};z(o._state,{cachedViewbox:s,initialDragPosition:{x:n.x,y:n.y},isDragging:!0,offsetViewport:a,offsetViewportDom:p,viewportClientRect:o._viewport.getBoundingClientRect(),parentClientRect:o._parent.getBoundingClientRect()}),he.bind(document,"mousemove",u),he.bind(document,"mouseup",d)}}function u(e){var t=Iw(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;z(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});z(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 d(e){var t=Iw(e);o._state.isDragging&&(o._state.initialDragPosition.x===t.x&&o._state.initialDragPosition.y===t.y&&c(e),o._update(),z(o._state,{cachedViewbox:null,initialDragPosition:null,isDragging:!1,offsetViewport:null,offsetViewportDom:null}),he.unbind(document,"mousemove",u),he.unbind(document,"mouseup",d))}l.add(new Ca.Pan),l.on("panstart",p(!1)),this.toggle(e&&e.open||!1),he.bind(this._viewportDom,"mousedown",p(!1)),he.bind(this._svg,"mousedown",p(!0)),he.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()}}})),he.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=z({},{x:e.x,y:e.y,width:e.width,height:e.height});if(n>t){var i=r.width*(1/t);z(r,{y:r.y-(i-r.height)/2,height:i})}else if(n<t){var o=r.height*t;z(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=xe(".children",e);t||Oe(e,t=ze("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");te(t).add("djs-minimap"),e.appendChild(t);var n=this._toggle=document.createElement("div");te(n).add("toggle"),t.appendChild(n);var r=this._map=document.createElement("div");te(r).add("map"),t.appendChild(r);var i=this._svg=ze("svg");Te(i,{width:"100%",height:"100%"}),Oe(r,i),Oe(i,this._elementsGroup=ze("g"));var o=this._viewportGroup=ze("g");Oe(i,o);var s=this._viewport=ze("rect");Ae(s).add("viewport"),Oe(o,s),he.bind(t,"mousedown",(function(e){e.stopPropagation()}));var a=this._viewportDom=document.createElement("div");te(a).add("viewport-dom"),this._parent.appendChild(a);var l=this._overlay=document.createElement("div");te(l).add("overlay"),this._parent.appendChild(l)},Cw.prototype._update=function(){var e=this._canvas.viewbox(),t=e.inner,n=e.outer;if(Bw(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},Te(this._svg,{viewBox:r+", "+i+", "+o+", "+s}),Te(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};z(this._viewportDom.style,{top:u.top+"px",left:u.left+"px",width:u.width+"px",height:u.height+"px"});var d=jw(c,u);z(this._overlay.style,{clipPath:d})}},Cw.prototype.open=function(){z(this._state,{isOpen:!0}),te(this._parent).add("open");var e=this._injector.get("translate",!1)||function(e){return e};J(this._toggle,"title",e("Close minimap")),this._update(),this._eventBus.fire("minimap.toggle",{open:!0})},Cw.prototype.close=function(){z(this._state,{isOpen:!1}),te(this._parent).remove("open");var e=this._injector.get("translate",!1)||function(e){return e};J(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=xe("#"+Es(e.id),this._elementsGroup);n&&(n.id=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=xe("#"+Es(e.parent.id),this._elementsGroup);if(o){var a=function(e,t){var n=xe(".djs-children",t.parentNode);if(!n)return;var r=[].slice.call(n.childNodes),i=-1;return r.forEach((function(t,n){xe(".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),Te(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),Te(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(e.id);t&&Ne(t)},Cw.prototype._createElement=function(e){var t,n=this._elementRegistry.getGraphics(e);if(n&&(t=er(n))){var r=je(t);return Te(r,{id:e.id}),r}},Cw.prototype._clear=function(){Re(this._elementsGroup)};var Rw=Math.sign||function(e){return e>=0?1:-1};function jw(e,t){return"polygon("+[$w(t.left,t.top),$w(t.left+t.width,t.top),$w(t.left+t.width,t.top+t.height),$w(t.left,t.top+t.height),$w(t.left,e.height),$w(e.width,e.height),$w(e.width,0),$w(0,0),$w(0,e.height),$w(t.left,e.height)].join(", ")+")"}function $w(e,t){return e+"px "+t+"px"}function Bw(e){return _(e,(function(e){return p(e)?Bw(e):u(e)&&isFinite(e)}))}function Iw(e){return e.center?e.center:{x:e.clientX,y:e.clientY}}var zw={__init__:["minimap"],minimap:["type",Cw]},Lw=1e5,qw=1e5;function Fw(e,t){this._canvas=e,this._visible=!1;var n=this;t.on("diagram.init",(function(){n._init()})),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=xe("defs",this._canvas._svg);e||(e=ze("defs"),Oe(this._canvas._svg,e));var t=this._pattern=ze("pattern"),n="djs-grid-pattern-"+Math.trunc(1e6*Math.random());Te(t,{id:n,width:dv,height:dv,patternUnits:"userSpaceOnUse"});var r=this._circle=ze("circle");Te(r,{cx:.5,cy:.5,r:.5,fill:"#ccc"}),Oe(t,r),Oe(e,t),Te(this._gfx=ze("rect"),{x:-Lw/2,y:-qw/2,width:Lw,height:qw,fill:`url(#${n})`})},Fw.prototype._centerGridAroundViewbox=function(e){e||(e=this._canvas.viewbox());var t=On(e);Te(this._gfx,{x:-Lw/2+hv(t.x,dv),y:-qw/2+hv(t.y,dv)})},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?Oe(t,this._gfx):Re(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;Oe(t.getLayer("djs-origin",-1),n=Xw("g",{"pointer-events":"none"})),!1!==e.showBorder&&Oe(n,Xw("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"})),Oe(n,Xw("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=Xw("text",{x:-40,y:-10,fill:o,class:Ww("label")})).textContent="(0, 0)",Oe(n,r)}function Uw(e){return e.join(" ")}function Ww(e){return"djs-origin-"+e}function Xw(e,t){var n=ze(e);return Te(n,t),n}Hw.$inject=["config.origin","canvas"];var Gw={__init__:[Hw]},Qw={offset:{x:150,y:75},tolerance:50,alignOnSave:!0};function Yw(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=z({},Qw,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}Yw.$inject=["config.alignToOrigin","injector","eventBus","commandStack","canvas","modeling"];var Kw={__init__:["alignToOrigin"],alignToOrigin:["type",Yw]};function Zw(e){function t(e){if(!e.labelTarget){var t=Di(e);Mi(t,"bpmn:Participant")&&(t=t.processRef),Mi(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)}))}))}Zw.$inject=["eventBus"];var Jw,ex,tx,nx,rx,ix,ox,sx,ax={__init__:[Zw]},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])&&0==(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&&0==(131072&l.__u)?1:0))for(;s>=0||a<t.length;){if(s>=0){if((l=t[s])&&0==(131072&l.__u)&&i==l.key&&o===l.type)return s;s--}if(a<t.length){if((l=t[a])&&0==(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 $x(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 Bx,Ix,zx,Lx,qx=0,Fx=[],Vx=[],Hx=ex.__b,Ux=ex.__r,Wx=ex.diffed,Xx=ex.__c,Gx=ex.unmount;function Qx(e,t){ex.__h&&ex.__h(Ix,e,qx||t),qx=0;var n=Ix.__H||(Ix.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:Vx}),n.__[e]}function Yx(e){return qx=1,Kx(p_,e)}function Kx(e,t,n){var r=Qx(Bx++,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=Ix,!Ix.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))};Ix.u=!0;var o=Ix.shouldComponentUpdate,s=Ix.componentWillUpdate;Ix.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)},Ix.shouldComponentUpdate=i}return r.__N||r.__}function Zx(e,t){var n=Qx(Bx++,3);!ex.__s&&c_(n.__H,t)&&(n.__=e,n.i=t,Ix.__H.__h.push(n))}function Jx(e,t){var n=Qx(Bx++,4);!ex.__s&&c_(n.__H,t)&&(n.__=e,n.i=t,Ix.__h.push(n))}function e_(e){return qx=5,t_((function(){return{current:e}}),[])}function t_(e,t){var n=Qx(Bx++,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=Ix.context[e.__c],n=Qx(Bx++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub(Ix)),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){Ix=null,Hx&&Hx(e)},ex.__r=function(e){Ux&&Ux(e),Bx=0;var t=(Ix=e.__c).__H;t&&(zx===Ix?(t.__h=[],Ix.__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=[],Bx=0)),zx=Ix},ex.diffed=function(e){Wx&&Wx(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==Fx.push(t)&&Lx===ex.requestAnimationFrame||((Lx=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}))),zx=Ix=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)}})),Xx&&Xx(e,t)},ex.unmount=function(e){Gx&&Gx(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=Ix,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),Ix=t}function l_(e){var t=Ix;e.__c=e.__(),Ix=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 $_(){return this.cancelBubble}function B_(){return this.defaultPrevented}ex.event=function(e){return R_&&(e=R_(e)),e.persist=j_,e.isPropagationStopped=$_,e.isDefaultPrevented=B_,e.nativeEvent=e};var I_={enumerable:!1,configurable:!0,get:function(){return this.class}},z_=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",I_)):(t.className&&!t.class||t.class&&t.className)&&(r.class=r.className=t.className),e.props=r}(e),e.$$typeof=C_,z_&&z_(e)};var L_=ex.__r;ex.__r=function(e){L_&&L_(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_={exports:{}};
163
+ `,this._current.container)},lc.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}=this._getContext(e,t);this._current={position:n,className:t,target:e,entries:i,headerEntries:o,container:this._createContainer({provider:t}),options:r},this._emit("open"),this._bindAutoClose(),this._render()},lc.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,empty:!(Object.keys(r).length||Object.keys(i).length)}},lc.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._current=null)},lc.prototype.reset=function(){const e=this._current.container;El(null,e),ke(e)},lc.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},lc.prototype._onOpened=function(){this._emit("opened")},lc.prototype._onClosed=function(){this._emit("closed")},lc.prototype._createContainer=function(e){var t=this._canvas.getContainer();const n=we(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return t.appendChild(n),n},lc.prototype._bindAutoClose=function(){this._eventBus.once(ac,this.close,this)},lc.prototype._unbindAutoClose=function(){this._eventBus.off(ac,this.close,this)},lc.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},lc.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}},lc.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},lc.prototype.registerProvider=function(e,t,n){n||(n=t,t=1e3),this._eventBus.on("popupMenu.getProviders."+e,t,(function(e){e.providers.push(n)}))},lc.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},lc.prototype._getEntries=function(e,t){var n={};return b(t,(function(t){if(t.getPopupMenuEntries){var r=t.getPopupMenuEntries(e);d(r)?n=r(n):b(r,(function(e,t){n[t]=e}))}else b(t.getEntries(e),(function(e){var t=e.id;if(!t)throw new Error("entry ID is missing");n[t]=V(e,["id"])}))})),n},lc.prototype._getHeaderEntries=function(e,t){var n={};return b(t,(function(t){if(t.getPopupMenuHeaderEntries){var r=t.getPopupMenuHeaderEntries(e);d(r)?n=r(n):b(r,(function(e,t){n[t]=e}))}else{if(!t.getHeaderEntries)return;b(t.getHeaderEntries(e),(function(e){var t=e.id;if(!t)throw new Error("entry ID is missing");n[t]=V(e,["id"])}))}})),n},lc.prototype.isOpen=function(){return!!this._current},lc.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let n=J(oe(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)},lc.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 cc={__init__:["popupMenu"],popupMenu:["type",lc]},pc={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 uc(e,t,n,r){e.registerProvider(900,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=r}uc.$inject=["contextPad","popupMenu","translate","canvas"],uc.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&z(t,this._getEntries(e)),t},uc.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},uc.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${pc.align}</div>`,action:{click:function(t,n){var r=e._getMenuPosition(n);z(r,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",r)}}}}},uc.prototype._getMenuPosition=function(e){var t=this._contextPad.getPad(e).html.getBoundingClientRect();return{x:t.left,y:t.bottom+5}};var dc=["left","center","right","top","middle","bottom"];function hc(e,t,n,r){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=r,e.registerProvider("align-elements",this)}function fc(e){ws.call(this,e),this.init()}function mc(e){fc.call(this,e)}hc.$inject=["popupMenu","alignElements","translate","rules"],hc.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&z(t,this._getEntries(e)),t},hc.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},hc.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,r=this._popupMenu,i={};return b(dc,(function(o){i["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:pc[o],action:function(){t.trigger(e,o),r.close()}}})),i},fc.$inject=["eventBus"],e(fc,ws),fc.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)}))},fc.prototype.init=function(){},mc.$inject=["eventBus"],e(mc,fc),mc.prototype.init=function(){this.addRule("elements.align",(function(e){var t=v(e.elements,(function(e){return!(e.waypoints||e.host||e.labelTarget)}));return!((t=vt(t)).length<2)&&t}))};var gc={__depends__:[qa,Ka,cc],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",uc],alignElementsMenuProvider:["type",hc],bpmnAlignElements:["type",mc]},yc=10,vc=50,bc=250;function wc(e,t,n,r){for(var i;i=_c(e,n,t);)n=r(t,n,i);return n}function xc(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 _c(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=kc(e);e.host&&(t=t.concat(kc(e.host)));e.attachers&&(t=t.concat(e.attachers.reduce((function(e,t){return e.concat(kc(t))}),[])));return t}(e);return g(i,(function(e){return e!==n&&"intersect"===Pn(e,r,yc)}))}function kc(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 Ec(){return!0}function Oc(e,t,n){e.on("autoPlace",100,(function(e){var t=e.shape;return function(e,t,n){n||(n={});var r=n.defaultDistance||vc,i=On(e),o=_n(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 Pc(e,t){e.on("autoPlace.end",500,(function(e){t.select(e.shape)}))}Oc.$inject=["eventBus","modeling","canvas"],Pc.$inject=["eventBus","selection"];var Sc={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",Oc],autoPlaceSelectionBehavior:["type",Pc]};function Cc(e,t){for(h(t)&&(t=[t]);e=e.parent;)if(Ai(e,t))return e;return null}function Tc(e,t){return Mi(t,"bpmn:TextAnnotation")?function(e,t){var n=_n(e),r={x:n.right+t.width/2,y:n.top-50-t.height/2};vn(e)&&((r=On(e)).x+=100,r.y-=50);return wc(e,t,r,xc({y:{margin:-30,minDistance:20}}))}(e,t):Ai(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])?function(e,t){var n=_n(e),r={x:n.right-10+t.width/2,y:n.bottom+40+t.width/2};return wc(e,t,r,xc({x:{margin:30,minDistance:30}}))}(e,t):Mi(t,"bpmn:FlowNode")?function(e,t){var n=_n(e),r=On(e),i=function(e,t){t||(t={});var n=t.defaultDistance||vc,r=t.direction||"e",i=t.filter,o=t.getWeight||function(t){return t.source===e?1:-1},s=t.maxDistance||bc,a=t.reference||"start";function l(e,t){return"n"===r?"start"===a?_n(e).top-_n(t).bottom:"center"===a?_n(e).top-On(t).y:_n(e).top-_n(t).top:"w"===r?"start"===a?_n(e).left-_n(t).right:"center"===a?_n(e).left-On(t).x:_n(e).left-_n(t).left:"s"===r?"start"===a?_n(t).top-_n(e).bottom:"center"===a?On(t).y-_n(e).bottom:_n(t).bottom-_n(e).bottom:"start"===a?_n(t).left-_n(e).right:"center"===a?On(t).x-_n(e).right:_n(t).right-_n(e).right}i||(i=Ec);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=x(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 Mi(e,"bpmn:SequenceFlow")}}),o=30,s=80,a="left";Mi(e,"bpmn:BoundaryEvent")&&-1!==(a=Pn(e,e.host,-25)).indexOf("top")&&(o*=-1);var l={x:n.right+i+t.width/2,y:r.y+Mc(a,s)};return wc(e,t,l,xc({y:{margin:o,minDistance:s}}))}(e,t):void 0}function Mc(e,t){return e.includes("top")?-1*t:e.includes("bottom")?t:0}function Ac(e){e.on("autoPlace",(function(e){var t=e.shape;return Tc(e.source,t)}))}Ac.$inject=["eventBus"];var Dc={__depends__:[Sc],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",Ac]};function Nc(e,t,n,i){ws.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(S(t.closure.topLevel)),i=t.hints,s=!i||i.autoResize;!1!==s&&b(C(n,(function(e){return e.parent.id})),(function(e,t){c(s)&&(e=e.filter((function(e){return g(s,D({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 Rc(e){e.invoke(Nc,this)}function jc(e){fc.call(this,e);var t=this;this.addRule("element.autoResize",(function(e){return t.canResize(e.elements,e.target)}))}function $c(e,t){jc.call(this,e),this._modeling=t}Nc.$inject=["eventBus","elementRegistry","modeling","rules"],e(Nc,ws),Nc.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),r=this.getPadding(t),i=_n(kt(e)),o=_n(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),kn(z({},o,s))},Nc.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=_n(e),t=_n(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}(F(t,["x","y","width","height"]),n);this.resize(t,n,{autoResize:r});var i=t.parent;i&&this._expand([t],i)}}},Nc.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},Nc.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},Nc.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)},Rc.$inject=["injector"],e(Rc,Nc),Rc.prototype.resize=function(e,t,n){Mi(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)},jc.$inject=["eventBus"],e(jc,fc),jc.prototype.canResize=function(e,t){return!1},e($c,jc),$c.$inject=["eventBus","modeling"],$c.prototype.canResize=function(e,t){if(Mi(t.di,"bpmndi:BPMNPlane"))return!1;if(!Mi(t,"bpmn:Participant")&&!Mi(t,"bpmn:Lane")&&!Mi(t,"bpmn:SubProcess"))return!1;var n=!0;return b(e,(function(e){(Mi(e,"bpmn:Lane")||bn(e))&&(n=!1)})),n};var Bc={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",Rc],bpmnAutoResizeProvider:["type",$c]};function Ic(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=Wo(e),function(e){return oe(e,"svg, .djs-element",!0)}(document.elementFromPoint(t.x,t.y))}}Ic.$inject=["elementRegistry","eventBus","injector"];var zc={__init__:["hoverFix"],hoverFix:["type",Ic]},Lc=Math.round,qc="djs-drag-active";function Fc(e){e.preventDefault()}function Vc(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(z({},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=Wo(e),d=fa(u,p),h=i.localStart,f=s(u),g=fa(f,h);if(!i.active&&(r||(o=d,Math.sqrt(Math.pow(o.x,2)+Math.pow(o.y,2))>i.threshold))){if(z(l,{x:Lc(h.x+c.x),y:Lc(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&&ca(i.cursor),t.addMarker(t.getRootElement(),qc)}Uo(e),i.active&&(z(l,{x:Lc(f.x+c.x),y:Lc(f.y+c.y),dx:Lc(g.x),dy:Lc(g.y)},{originalEvent:e}),a("move"))}function c(e){var t=!0;i.active&&(e&&(i.payload.originalEvent=e,Uo(e)),t=a("end")),!1===t&&a("rejected"),a("ended",g(!0!==t))}function p(e){Qs("Escape",e)&&(Fc(e),m())}function u(t){var n;i.active&&(n=da(e),setTimeout(n,400),Fc(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"),pa(),g=i.trapClick?u:c,he.unbind(document,"mousemove",l),he.unbind(document,"dragstart",Fc),he.unbind(document,"selectstart",Fc),he.unbind(document,"mousedown",g,!0),he.unbind(document,"mouseup",g,!0),he.unbind(document,"keyup",p),he.unbind(document,"touchstart",d,!0),he.unbind(document,"touchcancel",m,!0),he.unbind(document,"touchmove",l,!0),he.unbind(document,"touchend",c,!0),e.off("element.hover",h),e.off("element.out",f),t.removeMarker(t.getRootElement(),qc);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=z({},o,g||{})).data||{};w=g.trapClick?u:c,t?(y=Ho(t)||t,v=Wo(t),Uo(t),"dragstart"===y.type&&Fc(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=z({prefix:r,data:_,payload:{},globalStart:v,displacement:fa(n,b),localStart:b,isTouch:x},g),g.manual||(x?(he.bind(document,"touchstart",d,!0),he.bind(document,"touchcancel",m,!0),he.bind(document,"touchmove",l,!0),he.bind(document,"touchend",c,!0)):(he.bind(document,"mousemove",l),he.bind(document,"dragstart",Fc),he.bind(document,"selectstart",Fc),he.bind(document,"mousedown",w,!0),he.bind(document,"mouseup",w,!0)),he.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){z(o,e)}}Vc.$inject=["eventBus","canvas","selection","elementRegistry"];var Hc={__depends__:[zc,ps],dragging:["type",Vc]};function Uc(e,t,n){this._canvas=n,this._opts=z({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var r=this;t.on("drag.move",(function(e){var t=r._toBorderPoint(e);r.startScroll(t)})),t.on(["drag.cleanup"],(function(){r.stopScroll()}))}function Wc(e,t,n){return t<e&&e<n}Uc.$inject=["config.autoScroll","eventBus","canvas"],Uc.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++)Wc(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))},Uc.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Uc.prototype.setOptions=function(e){this._opts=z({},this._opts,e)},Uc.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=Wo(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};var Xc={__depends__:[Hc],__init__:["autoScroll"],autoScroll:["type",Uc]};function Gc(e){this._commandStack=e.get("commandStack",!1)}Gc.$inject=["injector"],Gc.prototype.allowed=function(e,t){var n=!0,r=this._commandStack;return r&&(n=r.canExecute(e,t)),void 0===n||n};var Qc={__init__:["rules"],rules:["type",Gc]},Yc=Math.round,Kc=Math.max;var Zc=10;function Jc(e,t){return function(e,t){var n,r;for(n=0;r=e[n];n++)if(Dt(r,t)<=Zc)return{point:e[n],bendpoint:!0,index:n};return null}(e,t)||function(e,t){var n,r,i=un(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,Zc),(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=Kc(o.segment2,s.segment2)-1],bendpoint:!0,index:r}:{point:{x:Yc(o.x+s.x)/2,y:Yc(o.y+s.y)/2},index:o.segment2}:{point:{x:Yc(o.x),y:Yc(o.y)},index:o.segment2}:null}(e,t)}function ep(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function tp(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function np(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 rp(e,t){var n=np(e,t);return ep({x:n.x-e.x,y:n.y-e.y})}function ip(e,t){return ep({x:e.x-t.x,y:e.y-t.y})}var op="djs-bendpoint",sp="djs-segment-dragger";function ap(e,t,n){var r=function(e,t){var n,r=Wo(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 Jc(t,r)}function lp(e,t){var n=ze("g");Ae(n).add(op),Oe(e,n);var r=ze("circle");Te(r,{cx:0,cy:0,r:4}),Ae(r).add("djs-visual"),Oe(n,r);var i=ze("circle");return Te(i,{cx:0,cy:0,r:10}),Ae(i).add("djs-hit"),Oe(n,i),t&&Ae(n).add(t),n}function cp(e,t,n,r){var i=ze("g");Oe(e,i);var o=function(e,t,n){var r=t.x-e.x,i=t.y-e.y;return up("h"===n?r:i)}(t,n,r),s=ze("rect");Te(s,{x:-9,y:-3,width:18,height:6}),Ae(s).add("djs-visual"),Oe(i,s);var a=ze("rect");return Te(a,{x:-o/2,y:-8.5,width:o,height:17}),Ae(a).add("djs-hit"),Oe(i,a),rr(i,"v"===r?90:0),i}function pp(e,t,n){var r=ze("g"),i=It(t,n),o=jt(t,n);return Oe(e,r),cp(r,t,n,o),Ae(r).add(sp),Ae(r).add("h"===o?"horizontal":"vertical"),nr(r,i.x,i.y),r}function up(e){return Math.abs(Math.round(2*e/3))}function dp(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=rp(e,[r[o],r[o+1]]);s<i&&(i=s,n=o)}return[r[n],r[n+1]]}(e,t);return np(e,n)}function hp(e,t,n,r,i){function o(e,n){var o,s=n.waypoints,a=ap(t,s,e);if(a)return o=function(e,t){var n,r,i=e.waypoints;return t.index<=0||t.bendpoint?null:(r=jt((n={start:i[t.index-1],end:i[t.index]}).start,n.end))?up("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=It(r=t[c-1],i=t[c]),s=jt(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){he.bind(e,t,(function(e){n.triggerMouseEvent(t,e,r),e.stopPropagation()}))}function a(e,n){var r=t.getLayer("overlays"),i=xe('.djs-bendpoints[data-element-id="'+Es(e.id)+'"]',r);return!i&&n&&(Te(i=ze("g"),{"data-element-id":e.id}),Ae(i).add("djs-bendpoints"),Oe(r,i),s(i,"mousedown",e),s(i,"click",e),s(i,"dblclick",e)),i}function l(e,t){return xe('.djs-segment-dragger[data-segment-idx="'+e+'"]',t)}function c(e,t){t.waypoints.forEach((function(t,n){var r=lp(e);Oe(e,r),nr(r,t.x,t.y)})),lp(e,"floating")}function p(e,t){for(var n,r,i,o=t.waypoints,a=1;a<o.length;a++)jt(n=o[a-1],r=o[a])&&(Te(i=pp(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){b(_e("."+sp,e),(function(e){Ne(e)}))}(t),function(e){b(_e("."+op,e),(function(e){Ne(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=It(s,a),u=jt(s,a);o&&(r=function(e){return xe(".djs-visual",e)}(o),i={x:c.x-p.x,y:c.y-p.y},"v"===u&&(i={x:i.y,y:i.x}),nr(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&&Ne(t)})),e.on("element.marker.update",(function(e){var t,n=e.element;n.waypoints&&(t=u(n),e.add?Ae(t).add(e.marker):Ae(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=ap(t,o,e.originalEvent)))return;!function(e,t){var n=xe(".floating",e),r=t.point;n&&nr(n,r.x,r.y)}(n,r),r.bendpoint||h(n,r,o)}})),e.on("element.mousedown",(function(e){if(Qo(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&&Te(r,{"data-element-id":n})}})),this.addHandles=u,this.updateHandles=d,this.getBendpointsContainer=a,this.getSegmentDragger=l}hp.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];var fp=Math.round,mp="reconnectStart",gp="reconnectEnd",yp="updateWaypoints";function vp(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?yp:gp:mp)===yp?"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===yp?"connection.updateWaypoints":"connection.reconnect";if(t=n.allowed=i.allowed(c,{connection:r,source:l===mp?a:o,target:l===gp?a:s}))return n.source=l===mp?a:o,void(n.target=l===gp?a:s);!1===t&&(t=n.allowed=i.allowed(c,{connection:r,source:l===gp?a:s,target:l===mp?a:o})),t&&(n.source=l===gp?a:s,n.target=l===mp?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!==yp&&(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:fp(e.x),y:fp(e.y)};if(!n)return!1;p===yp?(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===Dt(t,r=e[i+1])||Nt(n,r,t)?e.splice(i,1):i++;return e}(a),u)):(p===mp?(u.docking="source",bp(t)&&(u.docking="target",u.newWaypoints=a.reverse())):p===gp&&(u.docking="target",bp(t)&&(u.docking="source",u.newWaypoints=a.reverse())),o.reconnect(i,l,c,d,u))}),this)}function bp(e){var t=e.hover,n=e.source,r=e.target,i=e.type;return i===mp?t&&r&&t===r&&n!==r:i===gp?t&&n&&t===n&&n!==r:void 0}vp.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],vp.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 wp="updateWaypoints",xp="connect-ok",_p="connect-not-ok",kp="connect-hover",Ep="djs-updating",Op="djs-dragging";function Pp(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,Ae(t.draggerGfx=lp(r.getLayer("overlays"))).add("djs-dragging"),r.addMarker(i,Op),r.addMarker(i,Ep)})),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,kp),o===wp)return;n?(r.removeMarker(i,_p),r.addMarker(i,xp)):!1===n&&(r.removeMarker(i,xp),r.addMarker(i,_p))}})),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,kp),r.removeMarker(n,i?xp:_p))})),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?bp(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?bp(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===wp&&(d=e.cropWaypoints(c,d)),m.waypoints=d,i.drawPreview(n,r,m)),nr(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,Ne(o),r.removeMarker(n,Ep),r.removeMarker(n,Op),s&&(r.removeMarker(s,xp),r.removeMarker(s,a?xp:_p)),i&&i.cleanUp(t)}))}Pp.$inject=["bendpointMove","injector","eventBus","canvas"];var Sp="connect-hover",Cp="djs-updating";function Tp(e,t,n){return Mp(e,t,e[t]+n)}function Mp(e,t,n){return{x:"x"===t?n:e.x,y:"y"===t?n:e.y}}function Ap(e){return"x"===e?"y":"x"}function Dp(e,t,n){var r,i;return e.original?e.original:(r=On(t),Mp(e,i=Ap(n),r[i]))}function Np(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 Mp(t,r,Math.min(Math.max(o+20,e[r]),i-20))}(n,r[e.segmentStartIndex+t],r[e.segmentEndIndex+t],Ap(e.axis));nr(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=ap(n,d,e);(s=jt(h,f))&&(a="v"===s?"x":"y",0===p&&(h=Dp(h,t.source,a)),u===d.length-1&&(f=Dp(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=pp(i,t.segmentStart,t.segmentEnd),Ae(t.draggerGfx).add("djs-dragging"),n.addMarker(r,Cp)})),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=Tp(p,d,e["d"+d]),m=Tp(u,d,e["d"+d]),g=h.length,y=0;h[o]=f,h[s]=m,o<2&&(t=Pn(i.source,f),1===o?"intersect"===t&&(h.shift(),h[0]=f,y--):"intersect"!==t&&(h.unshift(p),y++)),s>g-3&&(n=Pn(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,Sp)})),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],(function(e){var t=e.context.hover;t&&n.removeMarker(t,Sp)})),t.on("connectionSegment.move.cleanup",(function(e){var t=e.context,r=t.connection;t.draggerGfx&&Ne(t.draggerGfx),n.removeMarker(r,Cp)})),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!Nt(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)}))}Np.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var Rp=Math.abs,jp=Math.round;function $p(e){return{x:e.x,y:e.y}}function Bp(e){return{x:e.x+e.width,y:e.y+e.height}}function Ip(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:jp(e.x+e.width/2),y:jp(e.y+e.height/2)}}function zp(e,t){var n=e.snapped;return!!n&&("string"==typeof t?n[t]:n.x&&n.y)}function Lp(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 qp(e){return e.children||[]}var Fp=Math.abs,Vp=Math.round;function Hp(e){function t(e,t){if(c(e)){for(var n=e.length;n--;)if(Fp(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?dp(t,e):e.width?{x:Vp(e.width/2+e.x),y:Vp(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:[]},b(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));z(e,{dx:e.dx-l,dy:e.dy-c,x:r,y:i}),(l||-1!==o.vertical.indexOf(s))&&Lp(e,"x",r),(c||-1!==o.horizontal.indexOf(a))&&Lp(e,"y",i)}})),e.on(["connect.hover","connect.move","connect.end"],1500,(function(e){var t=e.context.hover,r=t&&n(t,e);vn(t)&&r&&r.x&&r.y&&(Lp(e,"x",r.x),Lp(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:[]},b(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));z(e,{dx:e.dx-u,dy:e.dy-d,x:e.x-u,y:e.y-d}),(u||-1!==s.vertical.indexOf(c))&&Lp(e,"x",r),(d||-1!==s.horizontal.indexOf(p))&&Lp(e,"y",i)}}))}Hp.$inject=["eventBus"];var Up={__depends__:[Hc,Qc],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",hp],bendpointMove:["type",vp],bendpointMovePreview:["type",Pp],connectionSegmentMove:["type",Np],bendpointSnapping:["type",Hp]};function Wp(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:Xp(t)?o:i,connectionEnd:Xp(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=On(n)),t.init(e,"connect",{autoActivate:i,data:{shape:n,context:{start:n,connectionStart:r}}})}}function Xp(e){var t=e.hover,n=e.source,r=e.target;return t&&n&&t===n&&n!==r}Wp.$inject=["eventBus","dragging","modeling","rules"];var Gp="connect-ok",Qp="connect-not-ok";function Yp(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;Xp(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?Gp:Qp)})),t.on(["connect.out","connect.cleanup"],1100,(function(e){var t=e.hover;t&&(n.removeMarker(t,Gp),n.removeMarker(t,Qp))})),r&&t.on("connect.cleanup",(function(e){r.cleanUp(e.context)}))}Yp.$inject=["injector","eventBus","canvas"];var Kp={__depends__:[ps,Qc,Hc],__init__:["connectPreview"],connect:["type",Wp],connectPreview:["type",Yp]};function Zp(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)}Zp.$inject=["injector","canvas","graphicsFactory","elementFactory"],Zp.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()),Re(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?On(s):c,a?On(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)},Zp.prototype.drawNoopPreview=function(e,t){var n=t.source,r=t.target,i=t.connectionStart||On(n),o=t.connectionEnd||On(r),s=this.cropWaypoints(i,o,n,r);Oe(e,this.createNoopConnection(s[0],s[1]))},Zp.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&&Sn(o,a,!0)||e,t=r&&Sn(s,a,!1)||t]},Zp.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&Ne(e.connectionPreviewGfx)},Zp.prototype.getConnection=function(e){var t=function(e){return p(e)?e:{}}(e);return this._elementFactory.createConnection(t)},Zp.prototype.createConnectionPreviewGfx=function(){var e=ze("g");return Te(e,{pointerEvents:"none"}),Ae(e).add("djs-dragger"),Oe(this._canvas.getActiveLayer(),e),e},Zp.prototype.createNoopConnection=function(e,t){return gt([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};var Jp={__init__:["connectionPreview"],connectionPreview:["type",Zp]},eu=["marker-start","marker-mid","marker-end"],tu=["circle","ellipse","line","path","polygon","polyline","path","rect"];function nu(e,t,n,r){this._elementRegistry=e,this._canvas=n,this._styles=r,this._clonedMarkers={};var i=this;t.on("drag.cleanup",(function(){i.cleanUp()}))}nu.$inject=["elementRegistry","eventBus","canvas","styles"],nu.prototype.cleanUp=function(){b(this._clonedMarkers,(function(e){Ne(e)})),this._clonedMarkers={}},nu.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},nu.prototype.addDragger=function(e,t,n,r="djs-dragger"){var i=je(n=n||this.getGfx(e)),o=n.getBoundingClientRect();return this._cloneMarkers(er(i),r),Te(i,this._styles.cls(r,[],{x:o.top,y:o.left})),Oe(t,i),Te(i,"data-preview-support-element-id",e.id),i},nu.prototype.addFrame=function(e,t){var n=ze("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return Oe(t,n),Te(n,"data-preview-support-element-id",e.id),n},nu.prototype._cloneMarkers=function(e,t="djs-dragger"){var n=this;if(e.childNodes)for(var r=0;r<e.childNodes.length;r++)n._cloneMarkers(e.childNodes[r],t);(function(e){return-1!==tu.indexOf(e.nodeName)})(e)&&eu.forEach((function(r){if(Te(e,r)){var i=function(e,t,n){var r=(i=Te(e,t),i.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]);var i;return xe("marker#"+r,n||document)}(e,r,n._canvas.getContainer());n._cloneMarker(e,i,r,t)}}))},nu.prototype._cloneMarker=function(e,t,n,r="djs-dragger"){var i=t.id+"-"+r,o=this._clonedMarkers[i];if(!o){var s=i+"-clone";(o=je(t)).id=s,Ae(o).add(r),this._clonedMarkers[i]=o;var a=xe("defs",this._canvas._svg);a||(a=ze("defs"),Oe(this._canvas._svg,a)),Oe(a,o)}var l=function(e){return"url(#"+e+")"}(this._clonedMarkers[i].id);Te(e,n,l)};var ru={__init__:["previewSupport"],previewSupport:["type",nu]};const iu="complex-preview";class ou{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(iu);t.filter((e=>!function(e){return e.hidden}(e))).forEach((e=>{let t;vn(e)?(t=this._graphicsFactory._createContainer("connection",ze("g")),this._graphicsFactory.drawConnection(er(t),e)):(t=this._graphicsFactory._createContainer("shape",ze("g")),this._graphicsFactory.drawShape(er(t),e),nr(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);vn(e)?nr(n,t.x,t.y):nr(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",ze("g"));this._graphicsFactory.drawShape(er(n),e,{width:t.width,height:t.height}),nr(n,t.x,t.y),this._previewSupport.addDragger(e,o,n)}))}cleanUp(){Re(this._canvas.getLayer(iu)),this._markers.forEach((([e,t])=>this._canvas.removeMarker(e,t))),this._markers=[],this._previewSupport.cleanUp()}show(){this._canvas.showLayer(iu)}hide(){this._canvas.hideLayer(iu)}}ou.$inject=["canvas","graphicsFactory","previewSupport"];var su={__depends__:[ru],__init__:["complexPreview"],complexPreview:["type",ou]},au=["top","bottom","left","right"],lu=10;function cu(e,t){function n(e){if(io(e)){var n=function(e){var t=On(e.label),n=On(e),r=pu(n,t);if(i=r,-1===au.indexOf(i))return;var i;var o=function(e){var t=On(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 pu(t,e)}));return n}(e);if(e.host){var s=function(e){var t,n=e.host,r=On(e),i=Pn(r,n);t=i.indexOf("-")>=0?i.split("-"):[i];var o=au.filter((function(e){return-1===t.indexOf(e)}));return o}(e);o=o.concat(s)}var a=au.filter((function(e){return-1===o.indexOf(e)}));if(-1!==a.indexOf(r))return;return a[0]}(e);n&&function(e,n){var r=On(e),i=e.label,o=On(i);if(!i.parent)return;var s,a=_n(e);switch(n){case"top":s={x:r.x,y:a.top-lu-i.height/2};break;case"left":s={x:a.left-lu-i.width/2,y:r.y};break;case"bottom":s={x:r.x,y:a.bottom+lu+i.height/2};break;case"right":s={x:a.right+lu+i.width/2,y:r.y}}var l=fa(s,o);t.moveShape(i,l)}(e,n)}}ws.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 pu(e,t){return Pn(t,e,5)}function uu(e){ws.call(this,e),this.preExecute("shape.append",(function(e){var t=e.source,n=e.shape;e.position||(Mi(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 du(e,t){e.invoke(ws,this),this.postExecute("shape.move",(function(e){var n=e.newParent,r=e.shape;b(v(r.incoming.concat(r.outgoing),(function(e){return Mi(e,"bpmn:Association")})),(function(e){t.moveConnection(e,{x:0,y:0},n)}))}),!0)}e(cu,ws),cu.$inject=["eventBus","modeling"],e(uu,ws),uu.$inject=["eventBus"],e(du,ws),du.$inject=["injector","modeling"];function hu(e,t){t.invoke(ws,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 fu(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];fu(i,r)&&(e.shapes=[n._replaceShape(i,r)])}}),!0)}function fu(e,t){return!bn(e)&&Ai(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function mu(e,t){function n(e){return v(e.attachers,(function(e){return Mi(e,"bpmn:BoundaryEvent")}))}ws.call(this,e),this.postExecute("connection.create",(function(e){var r=e.context.source,i=e.context.target,o=n(i);Mi(r,"bpmn:EventBasedGateway")&&Mi(i,"bpmn:ReceiveTask")&&o.length>0&&t.removeElements(o)})),this.postExecute("connection.reconnect",(function(e){var r=e.context.oldSource,i=e.context.newSource;Mi(r,"bpmn:Gateway")&&Mi(i,"bpmn:EventBasedGateway")&&b(i.outgoing,(function(e){var r=e.target,i=n(r);Mi(r,"bpmn:ReceiveTask")&&i.length>0&&t.removeElements(i)}))}))}function gu(e,t,n){function r(e){t.updateProperties(e,{isForCompensation:!0})}function i(e){t.updateProperties(e,{isForCompensation:void 0})}ws.call(this,e),this.preExecute("shape.replace",(function(e){const{targetElement:n}=e.hints||{},{oldShape:r}=e;if(vu(e.oldShape)&&"bpmn:CompensateEventDefinition"!==n.eventDefinitionType||"bpmn:BoundaryEvent"!==n.type){const t=r.outgoing.find((({target:e})=>yu(e)));t&&t.target&&(e._connectionTarget=t.target)}else if(!vu(e.oldShape)&&"bpmn:CompensateEventDefinition"===n.eventDefinitionType&&"bpmn:BoundaryEvent"===n.type){const n=r.outgoing.find((({target:e})=>bu(e)));n&&n.target&&(e._connectionTarget=n.target),function(e){const n=e.outgoing.filter((e=>Mi(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;vu(i)&&bu(o)&&(r(o),function(e,n){const r=e.outgoing.filter((e=>Mi(e,"bpmn:Association"))),i=r.filter((e=>yu(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;vu(t)&&yu(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;yu(o)&&i(o),vu(e)&&bu(t)&&r(t)}}),!0),this.postExecuted("element.updateProperties",(function(e){const{element:r}=e;yu(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)):bu(r)&&function(e){const n=e.incoming.filter((e=>vu(e.source)));t.removeElements(n)}(r)}),!0)}function yu(e){const t=Di(e);return t&&t.get("isForCompensation")}function vu(e){return e&&Mi(e,"bpmn:BoundaryEvent")&&eo(e,"bpmn:CompensateEventDefinition")}function bu(e){return e&&Mi(e,"bpmn:Activity")&&!Ji(e)}function wu(e){e.invoke(ws,this),this.preExecute("shape.create",1500,(function(e){var t=e.context,n=t.parent,r=t.shape;Mi(n,"bpmn:Lane")&&!Mi(r,"bpmn:Lane")&&(t.parent=Cc(n,"bpmn:Participant"))}))}function xu(e,t){ws.call(this,e),this.preExecute("shape.create",(function(e){var n=e.context.shape;if(Mi(n,"bpmn:DataObjectReference")&&"label"!==n.type){var r=t.create("bpmn:DataObject");n.businessObject.dataObjectRef=r}}))}hu.$inject=["bpmnReplace","injector"],e(hu,ws),hu.prototype._replaceShape=function(e,t){var n,r=(n=Di(e).eventDefinitions)&&n[0],i={type:"bpmn:BoundaryEvent",host:t};return r&&(i.eventDefinitionType=r.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})},mu.$inject=["eventBus","modeling"],e(mu,ws),e(gu,ws),gu.$inject=["eventBus","modeling","bpmnRules"],wu.$inject=["injector"],e(wu,ws),xu.$inject=["eventBus","bpmnFactory"],e(xu,ws);var _u=20,ku=20,Eu=30,Ou=2e3;function Pu(e,t,n){function r(){var t=e.getRootElement();return Mi(t,"bpmn:Collaboration")?t:n.makeCollaboration()}ws.call(this,t),t.on(["create.start","shape.move.start"],Ou,(function(t){var n=t.context,r=n.shape,i=e.getRootElement();if(Mi(r,"bpmn:Participant")&&Mi(i,"bpmn:Process")&&i.children.length){var o=i.children.filter((function(e){return!Mi(e,"bpmn:Group")&&!bn(e)&&!vn(e)}));if(o.length){var s=kt(o),a=function(e,t){t={width:t.width+2*_u+Eu,height:t.height+2*ku};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);z(r,a),n.createConstraints=function(e,t){return t=_n(t),{bottom:t.top+e.height/2-ku,left:t.right-e.width/2+_u,top:t.bottom-e.height/2+ku,right:t.left+e.width/2-_u-Eu}}(r,s)}}})),t.on("create.start",Ou,(function(n){var r=n.context.shape,i=e.getRootElement(),o=e.getGraphics(i);function s(e){e.element=i,e.gfx=o}Mi(r,"bpmn:Participant")&&Mi(i,"bpmn:Process")&&(t.on("element.hover",Ou,s),t.once("create.cleanup",(function(){t.off("element.hover",s)})))})),this.preExecute("elements.create",Ou,(function(e){var t,n=e.elements,i=e.parent,o=function(e){return g(e,(function(e){return Mi(e,"bpmn:Participant")}))}(n);o&&Mi(i,"bpmn:Process")&&(e.parent=r(),(t=e.hints=e.hints||{}).participant=o,t.process=i,t.processRef=Di(o).get("processRef"))}),!0),this.preExecute("shape.create",(function(e){var t=e.parent,n=e.shape;Mi(n,"bpmn:Participant")&&Mi(t,"bpmn:Process")&&(e.parent=r(),e.process=t,e.processRef=Di(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||Di(r).set("processRef",Di(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||Di(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)}Pu.$inject=["canvas","eventBus","modeling"],e(Pu,ws);var Su="__targetRef_placeholder";function Cu(e,t){function n(e,n){var r=e.get("properties"),i=g(r,(function(e){return e.name===Su}));return!i&&n&&Mt(r,i=t.create("bpmn:Property",{name:Su})),i}function r(e,t){var r=n(e);r&&(function(e,t,n){return g(e.get("dataInputAssociations"),(function(e){return e!==n&&e.targetRef===t}))}(e,r,t)||Tt(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}ws.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],Tu(i)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],Tu(i))}function Tu(e){return function(t){if(Mi(t.context.connection,"bpmn:DataInputAssociation"))return e(t)}}function Mu(e){this._bpmnUpdater=e}function Au(e,t,n,r){function i(e){return e.children.filter((function(e){return Mi(e,"bpmn:DataStoreReference")&&!e.labelTarget}))}function o(e,r){var i=e.businessObject||e;if(r=r||n.filter((function(e){return Mi(e,"bpmn:Participant")&&Di(e).processRef}))[0]){var o=r.businessObject||r;t.execute("dataStore.updateContainment",{dataStoreBo:i,dataStoreDi:Ni(e),newSemanticParent:o.processRef||o,newDiParent:Ni(r)})}}ws.call(this,r),t.registerHandler("dataStore.updateContainment",Mu),this.preExecute("shape.create",(function(e){var t=e.context,n=t.shape;Mi(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 Mi(e,"bpmn:DataStoreReference")})).length&&(t.hints||(t.hints={}),t.hints.autoResize=n.filter((function(e){return!Mi(e,"bpmn:DataStoreReference")})))})),this.postExecute("shape.create",(function(e){var t=e.context.shape,n=t.parent;Mi(t,"bpmn:DataStoreReference")&&"label"!==t.type&&Mi(n,"bpmn:Collaboration")&&o(t)})),this.postExecute("shape.move",(function(e){var t=e.context,n=t.shape,r=t.oldParent,i=n.parent;Mi(r,"bpmn:Collaboration")||Mi(n,"bpmn:DataStoreReference")&&"label"!==n.type&&Mi(i,"bpmn:Collaboration")&&o(n,Mi(r,"bpmn:Participant")?r:function(e,t){for(;e.parent;){if(Mi(e.parent,t))return e.parent;e=e.parent}}(r,"bpmn:Participant"))})),this.postExecute("shape.delete",(function(t){var n=t.context.shape,r=e.getRootElement();Ai(n,["bpmn:Participant","bpmn:SubProcess"])&&Mi(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){Mi(r,"bpmn:Process")&&o(e,r)}))}))}Cu.$inject=["eventBus","bpmnFactory"],e(Cu,ws),Mu.$inject=["bpmnUpdater"],Mu.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),[]},Mu.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),[]},Au.$inject=["canvas","commandStack","elementRegistry","eventBus"],e(Au,ws);var Du=Math.max,Nu=Math.min,Ru=20;function ju(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function $u(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)?Nu:Du)(r,i)),u(o)&&(r=(/top|left/.test(e)?Du:Nu)(r,o)),r}function Bu(e,t){return void 0!==e?e:Ru}function Iu(e){return!e.waypoints&&"label"!==e.type}function zu(e,t){var n;if((n=void 0===e.length?v(e.children,Iu):e).length)return function(e,t){var n,r,i,o;return"object"==typeof t?(n=Bu(t.left),r=Bu(t.right),i=Bu(t.top),o=Bu(t.bottom)):n=r=i=o=Bu(t),{x:e.x-n,y:e.y-i,width:e.width+n+r,height:e.height+i+o}}(kt(n),t)}var Lu=Math.abs;var qu=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Fu=30;function Vu(e,t){return t=t||[],e.children.filter((function(e){Mi(e,"bpmn:Lane")&&(Vu(e,t),t.push(e))})),t}function Hu(e){return e.children.filter((function(e){return Mi(e,"bpmn:Lane")}))}function Uu(e){return Cc(e,qu)||e}function Wu(e,t){var n=Uu(e),r=Vu(n,Mi(n,"bpmn:Process")?[]:[n]),i=_n(e),o=_n(t),s=function(e,t){return ju(_n(t),_n(e))}(e,t),a=[];return r.forEach((function(t){if(t!==e){var n,r,l=0,c=s.right,p=0,u=s.left,d=_n(t);s.top&&(Lu(d.bottom-i.top)<10&&(p=o.top-d.bottom),Lu(d.top-i.top)<5&&(l=o.top-d.top)),s.bottom&&(Lu(d.top-i.bottom)<10&&(l=o.bottom-d.top),Lu(d.bottom-i.bottom)<5&&(p=o.bottom-d.bottom)),(l||c||p||u)&&a.push({shape:t,newBounds:(n=t,r={top:l,right:c,bottom:p,left:u},{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 Xu(e,t){ws.call(this,e),this.postExecuted("shape.delete",500,(function(e){var n=e.context,r=n.hints,i=n.shape,o=n.oldParent;Mi(i,"bpmn:Lane")&&(r&&r.nested||function(e,n){var r,i,o,s=Hu(n),a=[],l=[];xt(s,(function(t){return t.y>e.y?l.push(t):a.push(t),t.children})),s.length&&(r=l.length&&a.length?e.height/2:e.height,a.length&&(i=t.calculateAdjustments(a,"y",r,e.y-10),t.makeSpace(i.movingShapes,i.resizingShapes,{x:0,y:r},"s")),l.length&&(o=t.calculateAdjustments(l,"y",-r,e.y+e.height+10),t.makeSpace(o.movingShapes,o.resizingShapes,{x:0,y:-r},"n")))}(i,o))}))}Xu.$inject=["eventBus","spaceTool"],e(Xu,ws);function Gu(e,t){t.invoke(ws,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",500,(function(e){var t=e.elements;t.filter((function(e){return Qu(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;Qu(e,(o=s,-1!==t.indexOf(o)?s:r))&&(t[i]=n._replaceShape(e))}))}),!0)}function Qu(e,t){return!bn(e)&&Mi(e,"bpmn:BoundaryEvent")&&!t}function Yu(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(),y=Jc(f,h=u(i.width)?On(i):i);if(y){if(o=f.slice(0,y.index),s=f.slice(y.index+(y.bendpoint?1:0)),!o.length||!s.length)return;a=y.bendpoint?f[y.index]:h,1!==o.length&&Ku(e,o[o.length-1])||o.push(Zu(a)),1!==s.length&&Ku(e,s[0])||s.unshift(Zu(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&&v(g,(function(e){return e.source===p.source}))||[],d&&v(m,(function(e){return e.target===d.target}))||[]);b.length&&n.removeElements(b)}ws.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=On(o),a={x:s.x+i.x,y:s.y+i.y},l=g(n.children,(function(e){return t.canInsert(r,e)&&Jc(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 Ku(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 Zu(e){return z({},e)}function Ju(e,t){ws.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)&&ed(r)){(Mi(i,"bpmn:EventBasedGateway")?o.incoming.filter((e=>e!==r&&ed(e))):o.incoming.filter((e=>e!==r&&ed(e)&&Mi(e.source,"bpmn:EventBasedGateway")))).forEach((function(e){t.removeConnection(e)}))}})),this.preExecuted("shape.replace",(function(e){var n=e.context.newShape;Mi(n,"bpmn:EventBasedGateway")&&n.outgoing.filter(ed).reduce((function(e,t){return e.includes(t.target)?e:e.concat(t.target)}),[]).forEach((function(e){e.incoming.filter(ed).forEach((function(r){const i=e.incoming.filter(ed).filter((function(e){return e.source===n}));(r.source!==n||i.length>1)&&t.removeConnection(r)}))}))}))}function ed(e){return Mi(e,"bpmn:SequenceFlow")}Gu.$inject=["bpmnReplace","injector"],e(Gu,ws),Gu.prototype._replaceShape=function(e){var t,n,r=(n=Di(e).eventDefinitions)&&n[0];return t=r?{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:r.$type}:{type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,t,{layoutConnection:!1})},e(Yu,ws),Yu.$inject=["eventBus","bpmnRules","modeling"],Ju.$inject=["eventBus","modeling"],e(Ju,ws);var td=1500;function nd(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"],td,(function(t){var r=t.context.shape||t.shape,i=t.hover;Mi(i,"bpmn:Lane")&&!Ai(r,["bpmn:Lane","bpmn:Participant"])&&(t.hover=Uu(i),t.hoverGfx=e.getGraphics(t.hover));var o=n.getRootElement();i!==o&&(r.labelTarget||Mi(r,"bpmn:Group"))&&(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"],td,(function(t){var n=t.hover;Mi(n,"bpmn:Lane")&&(t.hover=Uu(n)||n,t.hoverGfx=e.getGraphics(t.hover))})),t.on(["bendpoint.move.hover"],td,(function(t){var n=t.context,r=t.hover,i=n.type;Mi(r,"bpmn:Lane")&&/reconnect/.test(i)&&(t.hover=Uu(r)||r,t.hoverGfx=e.getGraphics(t.hover))})),t.on(["connect.start"],td,(function(e){var t=e.context,n=t.start;Mi(n,"bpmn:Lane")&&(t.start=Uu(n)||n)})),t.on("shape.move.start",2e3,(function(e){var t=e.shape;Mi(t,"bpmn:Lane")&&(e.shape=Uu(t)||t)})),t.on("spaceTool.move",2e3,(function(e){var t=e.hover;t&&Mi(t,"bpmn:Lane")&&(e.hover=Uu(t))}))}nd.$inject=["elementRegistry","eventBus","canvas"];function rd(e,t,n,r,i,o){function s(e,t,r){var i=n.filter((function(e){return Mi(e,"bpmn:Group")})).filter((function(e){return e.businessObject!==r}));t&&!function(e,t){return e.some((function(e){var n=Di(e);return(n.categoryValueRef&&n.categoryValueRef.$parent)===t}))}(i,t)&&function(e){var t=e.$parent;t&&(Tt(t.get("rootElements"),e),e.$parent=null)}(t),e&&!function(e,t){return e.some((function(e){return Di(e).categoryValueRef===t}))}(i,e)&&function(e){var t=e.$parent;t&&(Tt(t.get("categoryValue"),e),e.$parent=null)}(e)}function a(e,n){return function(e,t,n){return Mt(t.get("categoryValue"),e),e.$parent=t,Mt(n.get("rootElements"),t),t.$parent=n,e}(e,n,t.getDefinitions())}function l(n,r){var i=Di(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=Di(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(ws,this),this.execute("label.create",(function(e){var t=e.context,n=t.labelTarget;Mi(n,"bpmn:Group")&&l(n,t)})),this.revert("label.create",(function(e){var t=e.context,n=t.labelTarget;Mi(n,"bpmn:Group")&&c(n,t)})),this.execute("shape.delete",(function(e){var t=e.context,n=t.shape,r=Di(n);if(Mi(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(Mi(n,"bpmn:Group")&&!n.labelTarget){var r=t.category,i=t.categoryValue,o=Di(n);i&&(o.categoryValueRef=i,a(i,r))}})),this.execute("shape.create",(function(e){var t=e.context,n=t.shape;Mi(n,"bpmn:Group")&&!n.labelTarget&&Di(n).categoryValueRef&&l(n,t)})),this.reverted("shape.create",(function(e){var t=e.context,n=t.shape;Mi(n,"bpmn:Group")&&!n.labelTarget&&Di(n).categoryValueRef&&c(n,t)})),r.on("copyPaste.copyElement",770,(function(e){var t=e.descriptor,n=e.element;if(Mi(n,"bpmn:Group")&&!n.labelTarget){var r=Di(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 id(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 od(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=id(e,t,n,i),a=id(e,t,n,o);r=s&&a?sd(s,n)>sd(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],On(n.source)),t(r[r.length-1],r[r.length-2],On(n.target)))}))}function sd(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function ad(e){ws.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=Di(n),i=Ni(n);if(Ai(r,t)){var o=i.get("isHorizontal");void 0===o&&(o=!0),i.set("isHorizontal",o)}}))}rd.$inject=["bpmnFactory","bpmnjs","elementRegistry","eventBus","injector","moddleCopy"],e(rd,ws),od.$inject=["eventBus"],ad.$inject=["eventBus"],e(ad,ws);var ld=Math.sqrt,cd=Math.min,pd=Math.max,ud=Math.abs;function dd(e){return Math.pow(e,2)}function hd(e,t){return ld(dd(e.x-t.x)+dd(e.y-t.y))}function fd(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=ld(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 md(e.x,t.x,n.x)&&md(e.y,t.y,n.y)}(n,e,t)}))}function md(e,t,n){return e>=cd(t,n)-gd&&e<=pd(t,n)+gd}var gd=.1;function yd(e,t){return ud(e.x-t.x)<=gd&&ud(e.y-t.y)<=gd}function vd(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(yd(n=t[f],r=t[f+1])?a=[n]:(i=hd(e,n),o=hd(e,r),a=fd(n,r,e,cd(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:yd(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:hd(n,s)/hd(n,r)}),c=hd(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&&bd(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=wd(n,l),h=wd(t,c),f=a.position,m=function(e,t){var n=ip(e[0],e[1]),r=ip(e[0],t);return 0===n?0:r/n}(d,f),g=(p=h,u=tp(d),tp(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=bd(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:xn(k),delta:xn({x:i,y:o})}}function bd(e,t){var n=ip(e[t-1],e[t]);return n/(n+ip(e[t],e[t+1]))}function wd(e,t){return[e[t],e[t+1]]}function xd(e,t,n){var r=ha(t),i=ha(n),o=fa(e,r),s=o.x*(n.width/t.width),a=o.y*(n.height/t.height);return xn({x:i.x+s,y:i.y+a})}function _d(e,t,n){var r=ha(e),i=ha(t),o=ha(n),s=fa(e,r),a=fa(r,i),l=function(e,t,n){var r=_n(t),i=_n(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=Pn(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=Pn(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 xn({x:u+s.x-e.x,y:d+s.y-e.y})}var kd="name",Ed="text";function Od(e,t,n,r){function i(e){var n=e.context,i=n.element,o=n.properties;if(kd in o&&t.updateLabel(i,o[kd]),Ed in o&&Mi(i,"bpmn:TextAnnotation")){var s=r.getTextAnnotationBounds({x:i.x,y:i.y,width:i.width,height:i.height},o[Ed]||"");t.updateLabel(i,o.text,s)}}function o(e){var t=e.context,n=t.connection,r=n.label,i=z({},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 vd(On(e),t,n,r).delta}(r,o,s,i)}ws.call(this,e),this.postExecute("element.updateProperties",i),this.postExecute("element.updateModdleProperties",(e=>{Di(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;!bn(r)&&ro(r)&&lo(r)&&t.updateLabel(r,lo(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=Di(n);i&&ro(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(io(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:rp(e,t)}}));return A(n,"distance")[0].line}(e,t);return np(e,n)}(On(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=Pd(l,s,o);t.moveShape(a,c)}}))}function Pd(e,t,n){return xn(fa(xd(e,t,n),e))}function Sd(e,t){function n(e,t){var n=e.context,r=n.connection,i=z({},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 vd(e,t,n,r).point}(t,o,s,i)}ws.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 Cd(e,t,n){var r=Nd(e),i=Rd(r,t),o=r[0];return i.length?i[i.length-1]:xd(o.original||o,n,t)}function Td(e,t,n){var r=Nd(e),i=Rd(r,t),o=r[r.length-1];return i.length?i[0]:xd(o.original||o,n,t)}function Md(e,t,n){var r=Nd(e),i=Dd(t,n),o=r[0];return xd(o.original||o,i,t)}function Ad(e,t,n){var r=Nd(e),i=Dd(t,n),o=r[r.length-1];return xd(o.original||o,i,t)}function Dd(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function Nd(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Rd(e,t){return v(E(e,jd),(function(e){return function(e,t){return"intersect"===Pn(t,e,1)}(e,t)}))}function jd(e){return e.original||e}function $d(e,t){ws.call(this,e),this.postExecute("shape.replace",(function(e){var n=e.oldShape,r=e.newShape;if(function(e,t){return Mi(e,"bpmn:Participant")&&Yi(e)&&Mi(t,"bpmn:Participant")&&!Yi(t)}(n,r)){var i,o,s,a,l=(o=_t([i=n],!1),s=[],a=[],o.forEach((function(e){e!==i&&(e.incoming.forEach((function(e){Mi(e,"bpmn:MessageFlow")&&s.push(e)})),e.outgoing.forEach((function(e){Mi(e,"bpmn:MessageFlow")&&a.push(e)})))}),[]),{incoming:s,outgoing:a});l.incoming.forEach((function(e){var i=Td(e,r,n);t.reconnectEnd(e,r,i)})),l.outgoing.forEach((function(e){var i=Cd(e,r,n);t.reconnectStart(e,r,i)}))}}),!0)}e(Od,ws),Od.$inject=["eventBus","modeling","bpmnFactory","textRenderer"],e(Sd,ws),Sd.$inject=["eventBus","modeling"],$d.$inject=["eventBus","modeling"],e($d,ws);const Bd=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function Id(e){const t=Di(e);if(!(Mi(t,"bpmn:BoundaryEvent")||Mi(t,"bpmn:StartEvent")&&Ji(t.$parent)))return!1;const n=t.get("eventDefinitions");return!(!n||!n.length)&&Bd.some((e=>Mi(n[0],e)))}function zd(e){return Mi(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function Ld(e,t){e.invoke(ws,this),this.postExecuted("shape.replace",(function(e){const n=e.context.oldShape,r=e.context.newShape,i=e.context.hints;if(!Id(r))return;const o=zd(r);if(i.targetElement&&void 0!==i.targetElement[o])return;const s=Di(n).get(o);s!==Di(r).get(o)&&t.updateProperties(r,{[o]:s})}))}function qd(e,t){ws.call(this,e),this.preExecute("shape.resize",(function(e){var n=e.shape,r=Ni(n),i=r&&r.get("label");i&&i.get("bounds")&&t.updateModdleProperties(n,i,{bounds:void 0})}),!0)}function Fd(e,t,n){ws.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(Mi(i,"bpmn:SequenceFlow")&&Mi(o,"bpmn:SequenceFlow")&&t.canConnect(i.source,o.target,i)){var s=function(e,t){var n=id(Vd(e[e.length-2]),Vd(e[e.length-1]),Vd(t[1]),Vd(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[Vd(e[0]),Vd(t[t.length-1])]}(i.waypoints,o.waypoints);n.reconnectEnd(i,o.target,s)}}}))}function Vd(e){return e.original||e}function Hd(e,t){ws.call(this,e),this.preExecute("shape.delete",(function(e){var t=e.shape,n=t.parent;Mi(t,"bpmn:Participant")&&(e.collaborationRoot=n)}),!0),this.postExecute("shape.delete",(function(e){var n=e.collaborationRoot;n&&!n.businessObject.participants.length&&t.makeProcess()}),!0)}function Ud(e,t,n,r){ws.call(this,e);var i=r.get("dragging",!1);function o(e){var r,i,o=e.source,s=e.target;e.parent&&(Mi(e,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(o,s)||(i=!0),n.canConnectMessageFlow(o,s)&&(r="bpmn:MessageFlow")),Mi(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){b(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=g(o.outgoing,D({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 Wd(e,t,n,r,i,o){r.invoke(ws,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=x(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=[];b(n.closure.topLevel,(function(e){o=Ji(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})}))}Ld.$inject=["injector","modeling"],e(Ld,ws),e(qd,ws),qd.$inject=["eventBus","modeling"],e(Fd,ws),Fd.$inject=["eventBus","bpmnRules","modeling"],Hd.$inject=["eventBus","modeling"],e(Hd,ws),e(Ud,ws),Ud.$inject=["eventBus","modeling","bpmnRules","injector"],e(Wd,ws),Wd.prototype._replaceElements=function(e,t){var n=this._elementRegistry,r=this._bpmnReplace,i=this._selection;b(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)},Wd.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var Xd={width:140,height:120},Gd={width:300,height:60},Qd={width:300,height:150},Yd={width:140,height:120},Kd={width:50,height:30};function Zd(e){e.on("resize.start",1500,(function(e){var t=e.context,n=t.shape,r=t.direction,i=t.balanced;(Mi(n,"bpmn:Lane")||Mi(n,"bpmn:Participant"))&&(t.resizeConstraints=function(e,t,n){var r=Uu(e),i=!0,o=!0,s=Vu(r,[r]),a=_n(e),l={},c={};/e/.test(t)?c.right=a.left+Gd.width:/w/.test(t)&&(c.left=a.right-Gd.width);s.forEach((function(e){var r=_n(e);/n/.test(t)&&(r.top<a.top-10&&(i=!1),n&&Jd(a.top-r.bottom)<10&&ih(l,"top",r.top+Gd.height),Jd(a.top-r.top)<5&&rh(c,"top",r.bottom-Gd.height)),/s/.test(t)&&(r.bottom>a.bottom+10&&(o=!1),n&&Jd(a.bottom-r.top)<10&&rh(l,"bottom",r.bottom-Gd.height),Jd(a.bottom-r.bottom)<5&&ih(c,"bottom",r.top+Gd.height))}));var p=r.children.filter((function(e){return!e.hidden&&!e.waypoints&&(Mi(e,"bpmn:FlowElement")||Mi(e,"bpmn:Artifact"))}));return p.forEach((function(e){var n=_n(e);i&&/n/.test(t)&&rh(c,"top",n.top-ah),/e/.test(t)&&ih(c,"right",n.right+oh),o&&/s/.test(t)&&ih(c,"bottom",n.bottom+lh),/w/.test(t)&&rh(c,"left",n.left-sh)})),{min:c,max:l}}(n,r,i)),Mi(n,"bpmn:Participant")&&(t.minDimensions=Qd),Mi(n,"bpmn:SubProcess")&&Yi(n)&&(t.minDimensions=Yd),Mi(n,"bpmn:TextAnnotation")&&(t.minDimensions=Kd)}))}Zd.$inject=["eventBus"];var Jd=Math.abs,eh=Math.min,th=Math.max;function nh(e,t,n,r){var i=e[t];e[t]=void 0===i?n:r(n,i)}function rh(e,t,n){return nh(e,t,n,eh)}function ih(e,t,n){return nh(e,t,n,th)}var oh=20,sh=50,ah=20,lh=20;function ch(e,t){e.on("resize.start",1501,(function(e){var t=e.context,n=t.shape;(Mi(n,"bpmn:Lane")||Mi(n,"bpmn:Participant"))&&(t.balanced=!Yo(e))})),e.on("resize.end",1001,(function(e){var n=e.context,r=n.shape,i=n.canExecute,o=n.newBounds;if(Mi(r,"bpmn:Lane")||Mi(r,"bpmn:Participant"))return i&&(o=wn(o),t.resizeLane(r,o,n.balanced)),!1}))}ch.$inject=["eventBus","modeling"];function ph(e,t,n,r,i){function o(e){return Ai(e,["bpmn:ReceiveTask","bpmn:SendTask"])||function(e,t){c(t)||(t=[t]);return k(t,(function(t){return eo(e,t)}))}(e,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function s(t){return!!g(e.getDefinitions().get("rootElements"),D({id:t.id}))}function a(e){return Mi(e,"bpmn:ErrorEventDefinition")?"errorRef":Mi(e,"bpmn:EscalationEventDefinition")?"escalationRef":Mi(e,"bpmn:MessageEventDefinition")?"messageRef":Mi(e,"bpmn:SignalEventDefinition")?"signalRef":void 0}function l(e){if(Ai(e,["bpmn:ReceiveTask","bpmn:SendTask"]))return e.get("messageRef");var t=e.get("eventDefinitions")[0];return t.get(a(t))}n.invoke(ws,this),this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],(function(t){var n=t.shape||t.element;if(o(n)){var r=l(Di(n));r&&!s(r)&&(Mt(e.getDefinitions().get("rootElements"),r),t.addedRootElement=r)}}),!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],(function(t){var n=t.addedRootElement;n&&Tt(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(Di(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(Ai(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)}))}ph.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],e(ph,ws);var uh=Math.max;function dh(e){e.on("spaceTool.getMinDimensions",(function(e){var t=e.shapes,n=e.axis,r=e.start,i={};return b(t,(function(e){var t=e.id;Mi(e,"bpmn:Participant")&&(!function(e){return"x"===e}(n)?i[t]={width:Qd.width,height:hh(e,r)}:i[t]=Qd),Mi(e,"bpmn:SubProcess")&&Yi(e)&&(i[t]=Yd),Mi(e,"bpmn:TextAnnotation")&&(i[t]=Kd),Mi(e,"bpmn:Group")&&(i[t]=Xd)})),i}))}function hh(e,t){var n;return Hu(e).length?(n=function(e,t){var n,r=Hu(e);return n=fh(r,t),e.height-n.height+Gd.height}(e,t),uh(Qd.height,n)):Qd.height}function fh(e,t){var n,r,i;for(n=0;n<e.length;n++)if(t>=(r=e[n]).y&&t<=r.y+r.height)return(i=Hu(r)).length?fh(i,t):r}dh.$inject=["eventBus"];var mh=180,gh=160;function yh(e,t,n,r,i,o,s){ws.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 Mi(e,"bpmn:SubProcess")&&!Yi(e)}function c(t){var n=t.shape,r=t.newRootElement,i=Di(n);r=a._addDiagram(r||i),t.newRootElement=e.addRootElement(r)}function p(t){var n=Di(t.shape);a._removeDiagram(n);var r=t.newRootElement=s.get(Ts(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(Ts(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(Ts(n)))}),!0),this.postExecuted("shape.replace",(function(t){var r=t.newShape,i=t.oldRoot,o=e.findRoot(Ts(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(Mi(t,"bpmn:SubProcess")){var n=e.properties,r=e.oldProperties.id,i=n.id;if(r!==i){if(As(t))return s.updateId(t,Ms(i)),void s.updateId(r,i);s.get(Ms(r))&&s.updateId(Ms(r),Ms(i))}}}),!0),this.reverted("element.updateProperties",(function(e){var t=e.element;if(Mi(t,"bpmn:SubProcess")){var n=e.properties,r=e.oldProperties.id,i=n.id;if(r!==i){if(As(t))return s.updateId(t,Ms(r)),void s.updateId(i,r);var o=s.get(Ms(i));o&&s.updateId(o,Ms(r))}}}),!0),t.on("element.changed",(function(e){var n=e.element;if(As(n)){var r=n,i=s.get(Cs(r));i&&i!==r&&t.fire("element.changed",{element:i})}})),this.executed("shape.toggleCollapse",400,(function(e){var t=e.shape;Mi(t,"bpmn:SubProcess")&&(Yi(t)?p(e):(c(e),a._showRecursively(t.children)))}),!0),this.reverted("shape.toggleCollapse",400,(function(e){var t=e.shape;Mi(t,"bpmn:SubProcess")&&(Yi(t)?p(e):(c(e),a._showRecursively(t.children)))}),!0),this.postExecuted("shape.toggleCollapse",600,(function(e){var t=e.shape;if(Mi(t,"bpmn:SubProcess")){var n=e.newRootElement;n&&(Yi(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=Ts(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(Mi(Ni(i),"bpmndi:BPMNPlane")){var o=Cs(i),s=g(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 vh(e,t){e.invoke(ws,this),this.postExecuted("shape.replace",(function(e){var n=e.context.oldShape,r=e.context.newShape;if(Mi(r,"bpmn:SubProcess")&&(Mi(n,"bpmn:Task")||Mi(n,"bpmn:CallActivity"))&&Yi(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 bh(e,t){ws.call(this,e),this.postExecuted("shape.toggleCollapse",1500,(function(e){var n=e.shape;if(!Yi(n)){var r=_t(n);r.forEach((function(e){var t=e.incoming.slice(),n=e.outgoing.slice();b(t,(function(e){i(e,!0)})),b(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,On(n)):t.reconnectStart(e,n,On(n)))}}),!0)}e(yh,ws),yh.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=kt(o);if(t.x){var a=On(t),l=On(s);n={x:a.x-l.x,y:a.y-l.y}}else n={x:mh-s.x,y:gh-s.y};r.moveElements(i,n,t,{autoResize:!1})}else r.moveElements(i,{x:0,y:0},t,{autoResize:!1})}},yh.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},yh.prototype._addDiagram=function(e){var t=this._bpmnjs.getDefinitions().diagrams;return e.businessObject||(e=this._createNewDiagram(e)),t.push(e.di.$parent),e},yh.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:Ts(e),type:e.$type,di:r,businessObject:e,collapsed:!0})},yh.prototype._removeDiagram=function(e){var t=this._bpmnjs.getDefinitions().diagrams,n=g(t,(function(t){return t.plane.bpmnElement.id===e.id}));return t.splice(t.indexOf(n),1),n},yh.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"],vh.$inject=["injector","modeling"],e(vh,ws),e(bh,ws),bh.$inject=["eventBus","modeling"];function wh(e,t,n){ws.call(this,e),this.executed(["shape.toggleCollapse"],500,(function(e){var t,n=e.context.shape;Mi(n,"bpmn:SubProcess")&&(n.collapsed?Ni(n).isExpanded=!1:((t=n.children).length&&t.forEach((function(e){"label"!==e.type||e.businessObject.name||(e.hidden=!0)})),Ni(n).isExpanded=!0))})),this.reverted(["shape.toggleCollapse"],500,(function(e){var t=e.context.shape;t.collapsed?Ni(t).isExpanded=!1:Ni(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=zu(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 xh(e,t,n,r){t.invoke(ws,this),this.preExecute("shape.delete",(function(e){var t=e.context.shape,i=t.businessObject;bn(t)||(Mi(t,"bpmn:Participant")&&Yi(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;Mi(t,"bpmn:Collaboration")&&n.ids.unclaim(r.id)}))}function _h(e,t){ws.call(this,e),this.preExecute("connection.delete",(function(e){var n=e.context.connection,r=n.source;(function(e,t){if(!Mi(e,"bpmn:SequenceFlow"))return!1;var n=Di(t),r=Di(e);return n.get("default")===r})(n,r)&&t.updateProperties(r,{default:null})}))}e(wh,ws),wh.$inject=["eventBus","elementFactory","modeling"],e(xh,ws),xh.$inject=["canvas","injector","moddle","modeling"],e(_h,ws),_h.$inject=["eventBus","modeling"];function kh(e,t,n){var r;function i(){if(!r)throw new Error(n("out of bounds release"));return r}ws.call(this,e);var o=["spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move","shape.create","shape.delete","shape.move","shape.resize"];this.preExecute(o,5e3,(function(e){(r=r||new Eh).enter()})),this.postExecuted(o,500,(function(e){!function(){if(!r)throw new Error(n("out of bounds release"));var e=r.leave();e&&(t.updateLaneRefs(r.flowNodes,r.lanes),r=null)}()})),this.preExecute(["shape.create","shape.move","shape.delete","shape.resize"],(function(e){var t=e.context.shape,n=i();t.labelTarget||(Mi(t,"bpmn:Lane")&&n.addLane(t),Mi(t,"bpmn:FlowNode")&&n.addFlowNode(t))}))}function Eh(){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}}kh.$inject=["eventBus","modeling","translate"],e(kh,ws);var Oh={__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","toggleCollapseConnectionBehaviour","toggleElementCollapseBehaviour","unclaimIdBehavior","updateFlowNodeRefsBehavior","unsetDefaultFlowBehavior"],adaptiveLabelPositioningBehavior:["type",cu],appendBehavior:["type",uu],associationBehavior:["type",du],attachEventBehavior:["type",hu],boundaryEventBehavior:["type",mu],compensateBoundaryEventBehaviour:["type",gu],createBehavior:["type",wu],createDataObjectBehavior:["type",xu],createParticipantBehavior:["type",Pu],dataInputAssociationBehavior:["type",Cu],dataStoreBehavior:["type",Au],deleteLaneBehavior:["type",Xu],detachEventBehavior:["type",Gu],dropOnFlowBehavior:["type",Yu],eventBasedGatewayBehavior:["type",Ju],fixHoverBehavior:["type",nd],groupBehavior:["type",rd],importDockingFix:["type",od],isHorizontalFix:["type",ad],labelBehavior:["type",Od],layoutConnectionBehavior:["type",Sd],messageFlowBehavior:["type",$d],nonInterruptingBehavior:["type",Ld],removeElementBehavior:["type",Fd],removeEmbeddedLabelBoundsBehavior:["type",qd],removeParticipantBehavior:["type",Hd],replaceConnectionBehavior:["type",Ud],replaceElementBehaviour:["type",Wd],resizeBehavior:["type",Zd],resizeLaneBehavior:["type",ch],rootElementReferenceBehavior:["type",ph],spaceToolBehavior:["type",dh],subProcessPlaneBehavior:["type",yh],subProcessStartEventBehavior:["type",vh],toggleCollapseConnectionBehaviour:["type",bh],toggleElementCollapseBehaviour:["type",wh],unclaimIdBehavior:["type",xh],unsetDefaultFlowBehavior:["type",_h],updateFlowNodeRefsBehavior:["type",kh]};function Ph(e,t){var n=Pn(e,t,-15);return"intersect"!==n?n:null}function Sh(e){fc.call(this,e)}function Ch(e){return!e||bn(e)}function Th(e){do{if(Mi(e,"bpmn:Process"))return Di(e);if(Mi(e,"bpmn:Participant"))return Di(e).processRef||Di(e)}while(e=e.parent)}function Mh(e){return Mi(e,"bpmn:TextAnnotation")}function Ah(e){return Mi(e,"bpmn:Group")&&!e.labelTarget}function Dh(e){return Mi(e,"bpmn:BoundaryEvent")&&$h(e,"bpmn:CompensateEventDefinition")}function Nh(e){return Di(e).isForCompensation}function Rh(e){for(var t=e;t=t.parent;){if(Mi(t,"bpmn:FlowElementsContainer"))return Di(t);if(Mi(t,"bpmn:Participant"))return Di(t).processRef}return null}function jh(e,t){return Rh(e)===Rh(t)}function $h(e,t){return!!g(Di(e).eventDefinitions||[],(function(e){return Mi(e,t)}))}function Bh(e,t){return(Di(e).eventDefinitions||[]).every((function(e){return Mi(e,t)}))}function Ih(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 zh(e,t,n){if(Ch(e)||Ch(t))return null;if(!Mi(n,"bpmn:DataAssociation")){if(Jh(e,t))return{type:"bpmn:MessageFlow"};if(ef(e,t))return{type:"bpmn:SequenceFlow"}}var r=tf(e,t);return r||(Zh(e,t)?{type:"bpmn:Association",associationDirection:"One"}:!!Kh(e,t)&&{type:"bpmn:Association",associationDirection:"None"})}function Lh(e,t){return!(!bn(e)&&!Ah(e))||!(Mi(t,"bpmn:Participant")&&!Yi(t))&&(Mi(e,"bpmn:Participant")?Mi(t,"bpmn:Process")||Mi(t,"bpmn:Collaboration"):Ai(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:Mi(e,"bpmn:Lane")?Mi(t,"bpmn:Participant")||Mi(t,"bpmn:Lane"):!(Mi(e,"bpmn:BoundaryEvent")&&!function(e){return Di(e).cancelActivity&&(Vh(e)||Hh(e))}(e))&&(Mi(e,"bpmn:FlowElement")&&!Mi(e,"bpmn:DataStoreReference")?Mi(t,"bpmn:FlowElementsContainer")?Yi(t):Ai(t,["bpmn:Participant","bpmn:Lane"]):Mi(e,"bpmn:DataStoreReference")&&Mi(t,"bpmn:Collaboration")?k(Di(t).get("participants"),(function(e){return!!e.get("processRef")})):Ai(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?Ai(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):!!Mi(e,"bpmn:MessageFlow")&&(Mi(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t)))}function qh(e){return Mi(e,"bpmn:Lane")}function Fh(e){return!!function(e){return!bn(e)&&Mi(e,"bpmn:BoundaryEvent")}(e)||(!(!Mi(e,"bpmn:IntermediateThrowEvent")||!Vh(e))||Mi(e,"bpmn:IntermediateCatchEvent")&&Hh(e))}function Vh(e){var t=Di(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function Hh(e){return Uh(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function Uh(e,t){return t.some((function(t){return $h(e,t)}))}function Wh(e,t,n,r){if(Array.isArray(e)||(e=[e]),1!==e.length)return!1;var i=e[0];return!bn(i)&&(!!Fh(i)&&(!Ji(t)&&(!(!Mi(t,"bpmn:Activity")||Nh(t))&&(!(r&&!Ph(r,t))&&(!function(e){return Mi(e,"bpmn:ReceiveTask")&&g(e.incoming,(function(e){return Mi(e.source,"bpmn:EventBasedGateway")}))}(t)&&"attach")))))}function Xh(e,t,n){if(!t)return!1;var r={replacements:[]};return b(e,(function(e){Ji(t)||Mi(e,"bpmn:StartEvent")&&"label"!==e.type&&Lh(e,t)&&(Zi(e)||r.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"}),(function(e){return eo(e,"bpmn:ErrorEventDefinition")}(e)||function(e){return eo(e,"bpmn:EscalationEventDefinition")}(e)||function(e){return eo(e,"bpmn:CompensateEventDefinition")}(e))&&r.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"}),Uh(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&Mi(t,"bpmn:SubProcess")&&r.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"})),Mi(t,"bpmn:Transaction")||$h(e,"bpmn:CancelEventDefinition")&&"label"!==e.type&&(Mi(e,"bpmn:EndEvent")&&Lh(e,t)&&r.replacements.push({oldElementId:e.id,newElementType:"bpmn:EndEvent"}),Mi(e,"bpmn:BoundaryEvent")&&Wh(e,t,0,n)&&r.replacements.push({oldElementId:e.id,newElementType:"bpmn:BoundaryEvent"}))})),!!r.replacements.length&&r}function Gh(e,t){return!k(e,qh)&&(!t||e.every((function(e){return Lh(e,t)})))}function Qh(e,t,n,r){return!!t&&(!(!bn(e)&&!Ah(e))||!function(e,t){return e===t}(n,t)&&((!n||!Ih(n,t))&&(Lh(e,t)||nf(e,t))))}function Yh(e,t){return Mi(e,"bpmn:SubProcess")?Yi(e)&&(!t||t.width>=100&&t.height>=80):Mi(e,"bpmn:Lane")?!t||t.width>=130&&t.height>=60:Mi(e,"bpmn:Participant")?!t||t.width>=250&&t.height>=50:!!Mh(e)||!!Ah(e)}function Kh(e,t){return!Ih(t,e)&&!Ih(e,t)&&(!!function(e,t){var n=Mh(e),r=Mh(t);return(n||r)&&n!==r}(e,t)||!!tf(e,t))}function Zh(e,t){return jh(e,t)&&Dh(e)&&Mi(t,"bpmn:Activity")&&(n=e,!t.attachers.includes(n))&&!Ji(t);var n}function Jh(e,t){return!(of(e)&&!of(t))&&(Mi(n=e,"bpmn:InteractionNode")&&!Mi(n,"bpmn:BoundaryEvent")&&(!Mi(n,"bpmn:Event")||Mi(n,"bpmn:ThrowEvent")&&Bh(n,"bpmn:MessageEventDefinition"))&&function(e){return Mi(e,"bpmn:InteractionNode")&&!Nh(e)&&(!Mi(e,"bpmn:Event")||Mi(e,"bpmn:CatchEvent")&&Bh(e,"bpmn:MessageEventDefinition"))&&!(Mi(e,"bpmn:BoundaryEvent")&&!$h(e,"bpmn:MessageEventDefinition"))}(t)&&!function(e,t){return Th(e)===Th(t)}(e,t));var n}function ef(e,t){return Mi(n=e,"bpmn:FlowNode")&&!Mi(n,"bpmn:EndEvent")&&!Ji(n)&&!(Mi(n,"bpmn:IntermediateThrowEvent")&&$h(n,"bpmn:LinkEventDefinition"))&&!Dh(n)&&!Nh(n)&&function(e){return Mi(e,"bpmn:FlowNode")&&!Mi(e,"bpmn:StartEvent")&&!Mi(e,"bpmn:BoundaryEvent")&&!Ji(e)&&!(Mi(e,"bpmn:IntermediateCatchEvent")&&$h(e,"bpmn:LinkEventDefinition"))&&!Nh(e)}(t)&&jh(e,t)&&!(Mi(e,"bpmn:EventBasedGateway")&&!function(e){return Mi(e,"bpmn:ReceiveTask")||Mi(e,"bpmn:IntermediateCatchEvent")&&($h(e,"bpmn:MessageEventDefinition")||$h(e,"bpmn:TimerEventDefinition")||$h(e,"bpmn:ConditionalEventDefinition")||$h(e,"bpmn:SignalEventDefinition"))}(t));var n}function tf(e,t){return Ai(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&Ai(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:!(!Ai(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])||!Ai(e,["bpmn:Activity","bpmn:CatchEvent"]))&&{type:"bpmn:DataOutputAssociation"}}function nf(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&&(Ai(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!bn(t)&&Mi(e,"bpmn:FlowNode")&&!Mi(e,"bpmn:BoundaryEvent")&&Lh(e,t.parent))}function rf(e,t){return!!bn(t)||!(Mi(t,"bpmn:Lane")&&!function(e,t){return e&&t&&-1!==e.indexOf(t)}(e,t.parent))}function of(e){return Cc(e,"bpmn:Process")||Cc(e,"bpmn:Collaboration")}e(Sh,fc),Sh.$inject=["eventBus"],Sh.prototype.init=function(){this.addRule("connection.start",(function(e){return function(e){if(Ch(e))return null;return Ai(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 zh(t,n)}finally{i&&(n.parent=null)}})),this.addRule("connection.reconnect",(function(e){var t=e.connection;return zh(e.source,e.target,t)})),this.addRule("connection.updateWaypoints",(function(e){return{type:e.connection.type}})),this.addRule("shape.resize",(function(e){return Yh(e.shape,e.newBounds)})),this.addRule("elements.create",(function(e){var t=e.elements,n=e.position,r=e.target;return!(vn(r)&&!nf(t,r))&&_(t,(function(e){return vn(e)?zh(e.source,e.target,e):e.host?Wh(e,e.host,null,n):Qh(e,r,null)}))})),this.addRule("elements.move",(function(e){var t=e.target,n=e.shapes,r=e.position;return Wh(n,t,null,r)||Xh(n,t,r)||Gh(n,t)||nf(n,t)})),this.addRule("shape.create",(function(e){return Qh(e.shape,e.target,e.source,e.position)})),this.addRule("shape.attach",(function(e){return Wh(e.shape,e.target,null,e.position)})),this.addRule("element.copy",(function(e){var t=e.element;return rf(e.elements,t)}))},Sh.prototype.canConnectMessageFlow=Jh,Sh.prototype.canConnectSequenceFlow=ef,Sh.prototype.canConnectDataAssociation=tf,Sh.prototype.canConnectAssociation=Kh,Sh.prototype.canConnectCompensationAssociation=Zh,Sh.prototype.canMove=Gh,Sh.prototype.canAttach=Wh,Sh.prototype.canReplace=Xh,Sh.prototype.canDrop=Lh,Sh.prototype.canInsert=nf,Sh.prototype.canCreate=Qh,Sh.prototype.canConnect=zh,Sh.prototype.canResize=Yh,Sh.prototype.canCopy=rf;var sf={__depends__:[Qc],__init__:["bpmnRules"],bpmnRules:["type",Sh]};function af(e,t){e.on("saveXML.start",2e3,(function(){b(t.getRootElements(),(function(e){var t,n=Ni(e);t=E(v(_t([e],!1),(function(t){return t!==e&&!t.labelTarget})),Ni),n.set("planeElement",t)}))}))}af.$inject=["eventBus","canvas"];var lf={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",af]};function cf(e){ws.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 pf(e,t,n){cf.call(this,e);var r=[{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:MessageFlow",order:{level:9,containers:["bpmn:Collaboration"]}},{type:"bpmn:Association",order:{level:6,containers:["bpmn:Participant","bpmn:FlowElementsContainer","bpmn:Collaboration"]}},{type:"bpmn:BoundaryEvent",order:{level:8}},{type:"bpmn:Group",order:{level:10,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:FlowElement",order:{level:5}},{type:"bpmn:Participant",order:{level:-2}},{type:"bpmn:Lane",order:{level:-1}}];function i(e){var t=e.order;if(t||(e.order=t=function(e){if(e.labelTarget)return{level:10};var t=g(r,(function(t){return Ai(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)return{parent:t.findRoot(n)||t.getRootElement(),index:-1};var r=i(e);r.containers&&(n=function(e,t,n){for(var r=t;r&&!Ai(r,n);)r=r.parent;if(!r)throw new Error("no parent for <"+e.id+"> in <"+(t&&t.id)+">");return r}(e,n,r.containers));var o=n.children.indexOf(e),s=y(n.children,(function(t){return!(!e.labelTarget&&t.labelTarget)&&r.level<i(t).level}));return-1!==s&&-1!==o&&o<s&&(s-=1),{index:s,parent:n}}}cf.prototype.getOrdering=function(e,t){return null},e(cf,ws),pf.$inject=["eventBus","canvas","translate"],e(pf,cf);var uf={__depends__:[Bo],__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",pf]};function df(){}df.prototype.get=function(){return this._data},df.prototype.set=function(e){this._data=e},df.prototype.clear=function(){var e=this._data;return delete this._data,e},df.prototype.isEmpty=function(){return!this._data};var hf={clipboard:["type",df]},ff="drop-ok",mf="drop-not-ok",gf="attach-ok",yf="new-parent",vf="create";function bf(e,t,n,r,i){function o(t,n){[gf,ff,mf,yf].forEach((function(r){r===n?e.addMarker(t,r):e.removeMarker(t,r)}))}function s(){var e=t.context();e&&e.prefix===vf&&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);wf(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=g(e=v(e,(function(t){var n=t.labelTarget;return!(t.parent||bn(t)&&-1!==e.indexOf(n))})),(function(e){return!vn(e)})),a=!1,l=!1,c=!1;xf(e)&&(a=i.allowed("shape.attach",{position:n,shape:s,target:t})),a||(c=xf(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,gf):o(r,c?yf:mf))})),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;wf(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}):g(o=r.createElements(o,u,s,z({},p,{attach:l})),(function(e){return!vn(e)})),z(t,{elements:o,shape:i}),z(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=g(n,(function(e){return!vn(e)}));if(i){r=z({elements:n,hints:{},shape:i},r||{}),b(n,(function(e){u(e.x)||(e.x=0),u(e.y)||(e.y=0)}));var o=kt(v(n,(function(e){return!e.hidden})));b(n,(function(e){vn(e)&&(e.waypoints=E(e.waypoints,(function(e){return{x:e.x-o.x-o.width/2,y:e.y-o.y-o.height/2}}))),z(e,{x:e.x-o.x-o.width/2,y:e.y-o.y-o.height/2})})),t.init(e,vf,{cursor:"grabbing",autoActivate:!0,data:{shape:i,elements:n,context:r}})}}}function wf(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 xf(e){return e&&1===e.length&&!vn(e[0])}bf.$inject=["canvas","dragging","eventBus","modeling","rules"];function _f(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=ze("g");Te(t,i.cls("djs-drag-group",["no-events"]));var o=ze("g");return e.forEach((function(e){var i;e.hidden||(e.waypoints?(i=n._createContainer("connection",o),n.drawConnection(er(i),e)):(i=n._createContainer("shape",o),n.drawShape(er(i),e),nr(i,e.x,e.y)),r.addDragger(e,t,i))})),t}(a)),o?(l.parentNode||Oe(e.getActiveLayer(),l),nr(l,t.x,t.y)):Ne(l)})),t.on("create.cleanup",(function(e){var t=e.context.dragGroup;t&&Ne(t)}))}_f.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];var kf={__depends__:[Hc,ru,Qc,ps],__init__:["create","createPreview"],create:["type",bf],createPreview:["type",_f]};function Ef(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)}))}Ef.$inject=["eventBus"],Ef.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 Of={__init__:["mouse"],mouse:["type",Ef]};function Pf(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=g(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),vn(n)&&(t.priority=3,t.source=n.source.id,t.target=n.target.id,t.waypoints=function(e){return E(e.waypoints,(function(e){return(e=Sf(e)).original&&(e.original=Sf(e.original)),e}))}(n)),bn(n)&&(t.priority=4,t.labelTarget=n.labelTarget.id),b(["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){z(e.hints,{createElementsBehavior:!1})}))}function Sf(e){return z({},e)}function Cf(e,t){var n=t.indexOf(e);return-1===n?t:t.splice(n,1)}Pf.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],Pf.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},Pf.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||{}})}},Pf.prototype._paste=function(e,t,n,r){b(e,(function(e){u(e.x)||(e.x=0),u(e.y)||(e.y=0)}));var i=kt(e);return b(e,(function(e){vn(e)&&(e.waypoints=E(e.waypoints,(function(e){return{x:e.x-i.x-i.width/2,y:e.y-i.y-i.height/2}}))),z(e,{x:e.x-i.x-i.width/2,y:e.y-i.y-i.height/2})})),this._modeling.createElements(e,n,t,z({},r))},Pf.prototype._createElements=function(e){var t=this,n=this._eventBus,r={},i=[];return b(e,(function(e,o){b(e=A(e,"priority"),(function(e){var o,s=z({},V(e,["priority"]));return r[e.parent]?s.parent=r[e.parent]:delete s.parent,n.fire("copyPaste.pasteElement",{cache:r,descriptor:s}),vn(s)?(s.source=r[e.source],s.target=r[e.target],o=r[e.id]=t.createConnection(s),void i.push(o)):bn(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},Pf.prototype.createConnection=function(e){return this._elementFactory.createConnection(V(e,["id"]))},Pf.prototype.createLabel=function(e){return this._elementFactory.createLabel(V(e,["id"]))},Pf.prototype.createShape=function(e){return this._elementFactory.createShape(V(e,["id"]))},Pf.prototype.hasRelations=function(e,t){var n,r;return!(vn(e)&&(n=g(t,D({id:e.source.id})),r=g(t,D({id:e.target.id})),!n||!r))&&!(bn(e)&&!g(t,D({id:e.labelTarget.id})))},Pf.prototype.createTree=function(e){var t=this._rules,n=this,r={},i=[];function o(e,t){var n=g(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 xt(vt(e),(function(e,t,r){if(!bn(e)){b(e.labels,(function(e){o(e,r)})),b([e.attachers,e.incoming,e.outgoing],(function(e){e&&e.length&&b(e,(function(e){b(e.labels,(function(e){o(e,r)})),o(e,r)}))})),o(e,r);var i=[];return e.children&&(i=e.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:e,children:i}),i}})),e=E(i,(function(e){return e.element})),i=E(i,(function(t){return t.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:t.descriptor,element:t.element,elements:e}),t})),i=A(i,(function(e){return e.descriptor.priority})),e=E(i,(function(e){return e.element})),b(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)?Cf(i.element,e):(r[o]||(r[o]=[]),r[o].push(i.descriptor)):Cf(i.element,e)})),r};var Tf={__depends__:[hf,kf,Of,Qc],__init__:["copyPaste"],copyPaste:["type",Pf]};function Mf(e,t,n){c(n)||(n=[n]),b(n,(function(n){s(e[n])||(t[n]=e[n])}))}function Af(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=Di(n);if(bn(n))return t;var o=t.businessObject=r(i,!0),s=t.di=r(Ni(n),!0);s.bpmnElement=o,Mf(o,t,"name"),Mf(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(bn(n))return n.businessObject=Di(t[n.labelTarget]),void(n.di=Ni(t[n.labelTarget]));i=n.businessObject=r(i),(o=n.di=r(o)).bpmnElement=i,Mf(n,i,["isExpanded","name"]),n.type=i.$type})),t.on("copyPaste.copyElement",750,(function(e){var t=e.descriptor,n=e.element;if(Mi(n,"bpmn:Participant")){var i=Di(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=Di(e);return e.default&&(n[e.default]={element:r,property:"default"}),e.host&&(Di(e).attachedToRef=Di(t[e.host])),V(n,x(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)))}))}Af.$inject=["bpmnFactory","eventBus","moddleCopy"];var Df=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"];function Nf(e,t,n){this._bpmnFactory=t,this._eventBus=e,this._moddle=n,e.on("moddleCopy.canCopyProperties",(function(e){var t=e.propertyNames;if(t&&t.length)return A(t,(function(e){return"extensionElements"===e}))})),e.on("moddleCopy.canCopyProperty",(function(e){var t=e.parent,n=p(t)&&t.$descriptor,r=e.propertyName;return(!r||-1===Df.indexOf(r))&&(!(r&&n&&!g(n.properties,D({name:r})))&&void 0)})),e.on("moddleCopy.canSetCopiedProperty",(function(e){var t,n,r=e.property;if(n="bpmn:ExtensionElements",(t=r)&&d(t.$instanceOf)&&t.$instanceOf(n)&&(!r.values||!r.values.length))return!1}))}function Rf(e,t){return x(e.properties,(function(e,n){return t&&n.default?e:e.concat(n.name)}),[])}Nf.$inject=["eventBus","bpmnFactory","moddle"],Nf.prototype.copyElement=function(e,t,n,r=!1){var i=this;n&&!c(n)&&(n=[n]),n=n||Rf(e.$descriptor);var o=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:r});return!1===o||(c(o)&&(n=o),b(n,(function(n){var o;m(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},Nf.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 x(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}}},Nf.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 jf={__depends__:[Tf],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",Af],moddleCopy:["type",Nf]},$f=Math.round;function Bf(e,t){this._modeling=e,this._eventBus=t}function If(e,t){t.on("replace.end",500,(function(t){const{newElement:n,hints:r={}}=t;!1!==r.select&&e.select(n)}))}Bf.$inject=["modeling","eventBus"],Bf.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=$f(a+o/2),p=$f(l+s/2),u=r.replaceShape(e,z({},t,{x:c,y:p,width:o,height:s}),n);return i.fire("replace.end",{element:e,newElement:u,hints:n}),u},If.$inject=["selection","eventBus"];var zf={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",If],replace:["type",Bf]};var Lf=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function qf(e,t,n,r,i,o){this.replaceElement=function(a,l,p){p=p||{};var u=l.type,d=a.businessObject;if(Ff(d)&&"bpmn:SubProcess"===u&&function(e,t){var n=e&&m(e,"collapsed")?e.collapsed:!Yi(e);return n!==(t&&(m(t,"collapsed")||m(t,"isExpanded"))?m(t,"collapsed")?t.collapsed:!t.isExpanded:n)}(a,l))return r.toggleCollapse(a),a;var h=e.create(u),f={type:u,businessObject:h,di:{}};!function(e,t,n){c(n)||(n=[n]),b(n,(function(n){s(e[n])||(t[n]=e[n])}))}(a.di,f.di,["fill","stroke","background-color","border-color","color"]);var g=function(e,t){return e.filter((function(e){return t.includes(e)}))}(Rf(d.$descriptor),Rf(h.$descriptor,!0));z(h,F(l,Lf));var y=v(g,(function(e){return"eventDefinitions"===e?Vf(a,l.eventDefinitionType):"loopCharacteristics"===e?!Ji(h):!m(h,e)&&(("processRef"!==e||!1!==l.isExpanded)&&("triggeredByEvent"!==e&&("isForCompensation"!==e||!Ji(h))))}));if(h=n.copyElement(d,h,y),l.eventDefinitionType&&(Vf(h,l.eventDefinitionType)||(f.eventDefinitionType=l.eventDefinitionType,f.eventDefinitionAttrs=l.eventDefinitionAttrs)),Mi(d,"bpmn:Activity")){if(Ff(d))f.isExpanded=Yi(a);else if(l&&m(l,"isExpanded")){f.isExpanded=l.isExpanded;var w=t.getDefaultSize(h,{isExpanded:f.isExpanded});f.width=w.width,f.height=w.height,f.x=a.x-(f.width-a.width)/2,f.y=a.y-(f.height-a.height)/2}Yi(a)&&!Mi(d,"bpmn:Task")&&f.isExpanded&&(f.width=a.width,f.height=a.height)}return Ff(d)&&!Ff(h)&&(p.moveChildren=!1),Mi(d,"bpmn:Participant")&&(!0===l.isExpanded?h.processRef=e.create("bpmn:Process"):p.moveChildren=!1,f.width=a.width,f.height=t.getDefaultSize(f).height),o.allowed("shape.resize",{shape:h})||(f.height=t.getDefaultSize(f).height,f.width=t.getDefaultSize(f).width),h.name=d.name,Ai(d,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&Ai(h,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(h.default=d.default),l.host&&!Mi(d,"bpmn:BoundaryEvent")&&Mi(h,"bpmn:BoundaryEvent")&&(f.host=l.host),"bpmn:DataStoreReference"!==f.type&&"bpmn:DataObjectReference"!==f.type||(f.x=a.x+(a.width-f.width)/2),i.replaceElement(a,f,{...p,targetElement:l})}}function Ff(e){return Mi(e,"bpmn:SubProcess")}function Vf(e,t){var n=Di(e);return t&&n.get("eventDefinitions").some((function(e){return Mi(e,t)}))}qf.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];var Hf={__depends__:[jf,zf,ps],bpmnReplace:["type",qf]};function Uf(e,t){this._eventBus=e,this._dragging=t,this._tools=[],this._active=null}Uf.$inject=["eventBus","dragging"],Uf.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)},Uf.prototype.isActive=function(e){return e&&this._active===e},Uf.prototype.length=function(e){return this._tools.length},Uf.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Uf.prototype.bindEvents=function(e,t){var n=this._eventBus,r=this._dragging,i=[];n.on(t.tool+".init",(function(t){if(!t.context.reactivate&&this.isActive(e))return this.setActive(null),void r.cancel();this.setActive(e)}),this),b(t,(function(e){i.push(e+".ended"),i.push(e+".canceled")})),n.on(i,250,(function(e){this._active&&(function(e){var t=e.originalEvent&&e.originalEvent.target;return t&&oe(t,'.group[data-group="tools"]')}(e)||this.setActive(null))}),this)};var Wf={__depends__:[Hc],__init__:["toolManager"],toolManager:["type",Uf]};function Xf(e,t){return-1!==e.indexOf(t)}var Gf=Math.abs,Qf=Math.round,Yf={x:"width",y:"height"},Kf="crosshair",Zf={n:"top",w:"left",s:"bottom",e:"right"},Jf=1500,em={n:"s",w:"e",s:"n",e:"w"},tm=20;function nm(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",Jf,(function(e){var t=e.context,n=t.initialized;n||(n=t.initialized=a.init(e,t)),n&&im(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){im(e);var c={x:0,y:0};c[r]=Qf(e["d"+r]),a.makeSpace(o,s,c,i,l),n.once("spaceTool.ended",(function(e){a.activateSelection(e.originalEvent,!0,!0)}))}}))}function rm(e){return{top:e.top-tm,right:e.right+tm,bottom:e.bottom+tm,left:e.left-tm}}function im(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 om(e,t){return-1!==e.indexOf(t)}nm.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],nm.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:Kf,data:{context:{reactivate:n}},trapClick:!1})},nm.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:Kf,data:{context:{}}})},nm.prototype.makeSpace=function(e,t,n,r,i){return this._modeling.createSpace(e,t,n,r,i)},nm.prototype.init=function(e,t){var n=Gf(e.dx)>Gf(e.dy)?"x":"y",r=e["d"+n],i=e[n]-r;if(Gf(r)<5)return!1;r<0&&(r*=-1),Yo(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();!Ko(e)&&e.hover&&(s=e.hover);var a=[..._t(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 b(s,(function(e){var p,d,h,f,m,g,y=e.attachers,b=e.children,w=_n(e),x=v(b,(function(e){return!(vn(e)||bn(e)||om(o,e)||om(s,e))})),_=v(b,(function(e){return!vn(e)&&!bn(e)&&om(o,e)})),k=[],E=[];x.length&&(d=rm(_n(kt(x))),p=r-w[Zf[n]]+d[Zf[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=rm(_n(kt(_))),p=r-h[Zf[em[n]]]+w[Zf[em[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)),y&&y.length&&(y.forEach((function(e){om(o,e)?k.push(e):E.push(e)})),k.length&&(f=_n(kt(k.map(On))),m=w[Zf[em[n]]]-(f[Zf[em[n]]]-r)),E.length&&(g=_n(kt(E.map(On)))[Zf[n]]-(w[Zf[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[Yf[t]]-O[Yf[t]],c.bottom=l=u(l)?Math.min(l,p):p):"w"===n?(p=r+e[Yf[t]]-O[Yf[t]],c.right=l=u(l)?Math.min(l,p):p):"s"===n?(p=r-e[Yf[t]]+O[Yf[t]],c.top=a=u(a)?Math.max(a,p):p):"e"===n&&(p=r-e[Yf[t]]+O[Yf[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 z(t,l,{axis:n,direction:o,spaceToolConstraints:c,start:i}),ca("resize-"+("x"===n?"ew":"ns")),!0},nm.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)}b(e,(function(e){if(e.parent&&!bn(e))if(vn(e))l.push(e);else{var o=e[t],p=o+e[Yf[t]];if(function(e){return!!e.host}(e)&&(n>0&&On(e)[t]>r||n<0&&On(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)}}})),b(o,(function(e){var t=e.attachers;t&&b(t,(function(e){c(e)}))}));var p=o.concat(s);return b(a,(function(e){var t=e.host;om(p,t)&&c(e)})),p=o.concat(s),b(l,(function(e){var t=e.source,n=e.target,r=e.label;om(p,t)&&om(p,n)&&r&&c(r)})),{movingShapes:o,resizingShapes:s}},nm.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},nm.prototype.isActive=function(){var e=this._dragging.context();return!!e&&/^spaceTool/.test(e.prefix)};var sm="djs-dragging",am="djs-resizing",lm=Math.max;function cm(e,t,n,r,i){function o(e,t){b(e,(function(e){i.addDragger(e,t),n.addMarker(e,sm)}))}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=ze("g");Te(a,r.cls("djs-crosshair-group",["no-events"])),Oe(t,a);var l=ze("path");Te(l,"d",o),Ae(l).add("djs-crosshair"),Oe(a,l);var c=ze("path");Te(c,"d",s),Ae(c).add("djs-crosshair"),Oe(a,c),i.crosshairGroup=a})),e.on("spaceTool.selection.move",(function(e){nr(e.context.crosshairGroup,e.x,e.y)})),e.on("spaceTool.selection.cleanup",(function(e){var t=e.context.crosshairGroup;t&&Ne(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");Te(a=ze("path"),"d","M0,0 L0,0"),Ae(a).add("djs-crosshair"),Oe(u,a),s.line=a;var d=ze("g");Te(d,r.cls("djs-drag-group",["no-events"])),Oe(n.getActiveLayer(),d),o(c,d),o(s.movingConnections=t.filter((function(e){var t=!1;b(c,(function(n){b(n.outgoing,(function(n){e===n&&(t=!0)}))}));var n=!1;b(c,(function(t){b(t.incoming,(function(t){e===t&&(n=!0)}))}));var r=!1;b(p,(function(t){b(t.outgoing,(function(t){e===t&&(r=!0)}))}));var i=!1;return b(p,(function(t){b(t.incoming,(function(t){e===t&&(i=!0)}))})),vn(e)&&(t||r)&&(n||i)})),d),s.dragGroup=d}if(!s.frameGroup){var h=ze("g");Te(h,r.cls("djs-frame-group",["no-events"])),Oe(n.getActiveLayer(),h);var f=[];b(p,(function(e){var t=i.addFrame(e,h),r=t.getBBox();f.push({element:t,initialBounds:r}),n.addMarker(e,am)})),s.frameGroup=h,s.frames=f}Te(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,nr(s.dragGroup,m.x,m.y),b(s.frames,(function(e){var t,n,r=e.element,i=e.initialBounds;"e"===s.direction?Te(r,{width:lm(i.width+m.x,5)}):Te(r,{width:t=lm(i.width-m.x,5),x:i.x+i.width-t}),"s"===s.direction?Te(r,{height:lm(i.height+m.y,5)}):Te(r,{height:n=lm(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;b(r,(function(e){n.removeMarker(e,sm)})),b(i,(function(e){n.removeMarker(e,sm)})),a&&(Ne(s),Ne(a)),b(o,(function(e){n.removeMarker(e,am)})),l&&Ne(l)}))}cm.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];var pm={__init__:["spaceToolPreview"],__depends__:[Hc,Qc,Wf,ru,Of],spaceTool:["type",nm],spaceToolPreview:["type",cm]};function um(e){e.invoke(nm,this)}um.$inject=["injector"],e(um,nm),um.prototype.calculateAdjustments=function(e,t,n,r){var i=nm.prototype.calculateAdjustments.call(this,e,t,n,r);return i.resizingShapes=i.resizingShapes.filter((function(e){return!Mi(e,"bpmn:TextAnnotation")&&("y"!==t||!function(e){return Mi(e,"bpmn:Participant")&&!Di(e).processRef}(e))})),i};var dm={__depends__:[pm],spaceTool:["type",um]};function hm(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)}hm.$inject=["eventBus","injector"],hm.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()},hm.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},hm.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,!1!==e&&this._fire("changed",{trigger:"clear"})},hm.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()}},hm.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()}},hm.prototype.register=function(e,t){this._setHandler(e,t)},hm.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)},hm.prototype.canUndo=function(){return!!this._getUndoAction()},hm.prototype.canRedo=function(){return!!this._getRedoAction()},hm.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},hm.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},hm.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)}))},hm.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},hm.prototype._createId=function(){return this._uid++},hm.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},hm.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()},hm.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)},hm.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:T("id",r.reverse())}),r.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},hm.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=c(e)?e:[e],t.dirty=t.dirty.concat(e))},hm.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},hm.prototype._revertedAction=function(e){this._stackIdx--},hm.prototype._getHandler=function(e){return this._handlerMap[e]},hm.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 fm={commandStack:["type",hm]};function mm(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 gm(e,t,n){ws.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=ym(n),t.validatedShapes=ym(r)})),r&&t.on("shape.move.start",250,(function(e){var t=e.context,n=t.shapes,i=[];b(n,(function(e){b(e.labels,(function(n){n.hidden||-1!==t.shapes.indexOf(n)||i.push(n),e.labelTarget&&i.push(e)}))})),b(i,(function(e){r.makeDraggable(t,e,!0)}))})),this.preExecuted("elements.move",1400,(function(e){var t=e.context.closure,n=t.enclosedElements,r=[];b(n,(function(e){b(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;mm((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=At(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&&(Mt(r.labels,n,i),n.labelTarget=r)}))}function ym(e){return v(e,(function(t){return-1===e.indexOf(t.labelTarget)}))}e(gm,ws),gm.$inject=["injector","eventBus","modeling"];var vm={__init__:["labelSupport"],labelSupport:["type",gm]},bm="attach-ok";function wm(e,t,n,r,i){ws.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=xm(t=i),M("id",t,n)),r.validatedShapes=function(e){var t=C(e,"id");return v(e,(function(e){for(;e;){if(e.host&&t[e.host.id])return!1;e=e.parent}return!0}))}(o)})),o&&t.on("shape.move.start",251,(function(e){var t=e.context;b(xm(t.shapes),(function(e){o.makeDraggable(t,e,!0),b(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,bm),t.once(["shape.move.out","shape.move.cleanup"],(function(){n.removeMarker(i,bm)})))}})),this.preExecuted("elements.move",1401,(function(e){var t=e.context,n=t.closure;b(xm(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||b(r?n:v(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){b(e.context.shapes,(function(e){b(e.attachers,(function(e){b(e.outgoing.slice(),(function(e){r.allowed("connection.reconnect",{connection:e,source:e.source,target:e.target})||i.removeConnection(e)})),b(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;mm(n.attachers,(function(e){"attach"===r.allowed("elements.move",{target:o,shapes:[e]})?i.updateAttachment(e,o):i.removeShape(e)})),o.attachers.length&&b(o.attachers,(function(e){var t=_d(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&&b(s,(function(e){var t=_d(e,r,o);i.moveShape(e,t,e.parent),b(e.labels,(function(e){i.moveShape(e,t,e.parent)}))}))})),this.preExecute("shape.delete",(function(e){var t=e.context.shape;mm(t.attachers,(function(e){i.removeShape(e)})),t.host&&i.updateAttachment(t,null)}))}function xm(e){return r(E(e,(function(e){return e.attachers||[]})))}e(wm,ws),wm.$inject=["injector","eventBus","canvas","rules","modeling"];var _m={__depends__:[Qc],__init__:["attachSupport"],attachSupport:["type",wm]};function km(e){this._model=e}function Em(e,t,n,r){ws.call(this,e),this._bpmnFactory=t,this._translate=r;var i=this;function o(e){b(e.context.oldRoot.children,(function(e){Mi(e,"bpmn:BaseElement")&&i.updateParent(e)}))}function s(e){var t=e.context.shape;Mi(t,"bpmn:BaseElement")&&i.updateBounds(t)}function a(e){i.updateConnection(e.context)}function l(e){i.updateConnectionWaypoints(e.context.connection)}function c(e){i.updateAttachment(e.context)}function p(e){const{element:n}=e.context,r=lo(n),i=Ni(n),o=i&&i.get("label");ro(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"],Om((function(e){var t=e.context;i.updateParent(t.shape||t.connection,t.oldParent)}))),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],Om((function(e){var t=e.context,n=t.shape||t.connection,r=t.parent||t.newParent;i.updateParent(n,r)}))),this.executed(["canvas.updateRoot"],o),this.reverted(["canvas.updateRoot"],o),this.executed(["shape.move","shape.create","shape.resize"],Om((function(e){"label"!==e.context.shape.type&&s(e)}))),this.reverted(["shape.move","shape.create","shape.resize"],Om((function(e){"label"!==e.context.shape.type&&s(e)}))),e.on("shape.changed",(function(e){"label"===e.element.type&&s({context:{shape:e.element}})})),this.executed(["connection.create","connection.move","connection.delete","connection.reconnect"],Om(a)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],Om(a)),this.executed(["connection.layout","connection.move","connection.updateWaypoints"],Om(l)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],Om(l)),this.executed("connection.reconnect",Om((function(e){var t=e.context,n=t.connection,r=t.oldSource,i=t.newSource,o=Di(n),s=Di(r),a=Di(i);o.conditionExpression&&!Ai(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",Om((function(e){var t=e.context,n=t.connection,r=t.oldSource,i=t.newSource,o=Di(n),s=Di(r),a=Di(i);t.oldConditionExpression&&(o.conditionExpression=t.oldConditionExpression),t.oldDefault&&(s.default=t.oldDefault,delete a.default)}))),this.executed(["element.updateAttachment"],Om(c)),this.reverted(["element.updateAttachment"],Om(c)),this.executed("element.updateLabel",Om(p)),this.reverted("element.updateLabel",Om(p))}function Om(e){return function(t){var n=t.context;Mi(n.shape||n.connection||n.element,"bpmn:BaseElement")&&e(t)}}function Pm(e,t,n){Qn.call(this),this._bpmnFactory=e,this._moddle=t,this._translate=n}function Sm(e,t,n){return void 0===t[n]?t:(e[n]=t[n],V(t,[n]))}function Cm(e,t){this._modeling=e,this._canvas=t}function Tm(e){this._modeling=e}function Mm(e,t){this._canvas=e,this._layouter=t}km.$inject=["moddle"],km.prototype._needsId=function(e){return Ai(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"])},km.prototype._ensureId=function(e){var t;e.id?this._model.ids.claim(e.id,e):(t=Mi(e,"bpmn:Activity")?"Activity":Mi(e,"bpmn:Event")?"Event":Mi(e,"bpmn:Gateway")?"Gateway":Ai(e,["bpmn:SequenceFlow","bpmn:MessageFlow"])?"Flow":(e.$type||"").replace(/^[^:]*:/g,""),t+="_",!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e)))},km.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},km.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},km.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",z({bpmnElement:e,bounds:this.createDiBounds()},t))},km.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},km.prototype.createDiWaypoints=function(e){var t=this;return E(e,(function(e){return t.createDiWaypoint(e)}))},km.prototype.createDiWaypoint=function(e){return this.create("dc:Point",F(e,["x","y"]))},km.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",z({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},km.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",z({bpmnElement:e},t))},e(Em,ws),Em.$inject=["eventBus","bpmnFactory","connectionDocking","translate"],Em.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,r=t.host;n.attachedToRef=r&&r.businessObject},Em.prototype.updateParent=function(e,t){if(!(bn(e)||Mi(e,"bpmn:DataStoreReference")&&e.parent&&Mi(e.parent,"bpmn:Collaboration"))){var n=e.parent,r=e.businessObject,i=Ni(e),o=n&&n.businessObject,s=Ni(n);Mi(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(r,o,t&&t.businessObject),Mi(e,"bpmn:DataOutputAssociation")&&(o=e.source?e.source.businessObject:null),Mi(e,"bpmn:DataInputAssociation")&&(o=e.target?e.target.businessObject:null),this.updateSemanticParent(r,o),Mi(e,"bpmn:DataObjectReference")&&r.dataObjectRef&&this.updateSemanticParent(r.dataObjectRef,o),this.updateDiParent(i,s)}},Em.prototype.updateBounds=function(e){var t=Ni(e),n=function(e){if(!Mi(e,"bpmn:Activity"))return;var t=Ni(e);if(!t)return;var n=t.get("label");if(!n)return;return n.get("bounds")}(e);if(n){var r=fa(n,t.get("bounds"));z(n,{x:e.x+r.x,y:e.y+r.y})}var i=bn(e)?this._getLabel(t):t,o=i.bounds;o||(o=this._bpmnFactory.createDiBounds(),i.set("bounds",o)),z(o,{x:e.x,y:e.y,width:e.width,height:e.height})},Em.prototype.updateFlowNodeRefs=function(e,t,n){n!==t&&(Mi(n,"bpmn:Lane")&&Tt(n.get("flowNodeRef"),e),Mi(t,"bpmn:Lane")&&Mt(t.get("flowNodeRef"),e))},Em.prototype.updateDiConnection=function(e,t,n){var r=Ni(e),i=Ni(t),o=Ni(n);r.sourceElement&&r.sourceElement.bpmnElement!==Di(t)&&(r.sourceElement=t&&i),r.targetElement&&r.targetElement.bpmnElement!==Di(n)&&(r.targetElement=n&&o)},Em.prototype.updateDiParent=function(e,t){if(t&&!Mi(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(Tt(n,e),e.$parent=null)}},Em.prototype.getLaneSet=function(e){var t,n;return Mi(e,"bpmn:Lane")?((t=e.childLaneSet)||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(Mi(e,"bpmn:Participant")&&(e=e.processRef),(t=(n=e.get("laneSets"))[0])||((t=this._bpmnFactory.create("bpmn:LaneSet")).$parent=e,n.push(t)),t)},Em.prototype.updateSemanticParent=function(e,t,n){var r,i=this._translate;if(e.$parent!==t&&(!Mi(e,"bpmn:DataInput")&&!Mi(e,"bpmn:DataOutput")||(Mi(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),!("ioSpecification"in t)||t.ioSpecification!==e.$parent))){if(Mi(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),r="lanes";else if(Mi(e,"bpmn:FlowElement")){if(t)if(Mi(t,"bpmn:Participant"))t=t.processRef;else if(Mi(t,"bpmn:Lane"))do{t=t.$parent.$parent}while(Mi(t,"bpmn:Lane"));r="flowElements"}else if(Mi(e,"bpmn:Artifact")){for(;t&&!Mi(t,"bpmn:Process")&&!Mi(t,"bpmn:SubProcess")&&!Mi(t,"bpmn:Collaboration");){if(Mi(t,"bpmn:Participant")){t=t.processRef;break}t=t.$parent}r="artifacts"}else if(Mi(e,"bpmn:MessageFlow"))r="messageFlows";else if(Mi(e,"bpmn:Participant")){r="participants";var o,s=e.processRef;s&&(o=function(e){for(;e&&!Mi(e,"bpmn:Definitions");)e=e.$parent;return e}(e.$parent||t),e.$parent&&(Tt(o.get("rootElements"),s),s.$parent=null),t&&(Mt(o.get("rootElements"),s),s.$parent=o))}else Mi(e,"bpmn:DataOutputAssociation")?r="dataOutputAssociations":Mi(e,"bpmn:DataInputAssociation")&&(r="dataInputAssociations");if(!r)throw new Error(i("no parent for {element} in {parent}",{element:e.id,parent:t.id}));var a;if(e.$parent&&Tt(a=e.$parent.get(r),e),t?((a=t.get(r)).push(e),e.$parent=t):e.$parent=null,n){var l=n.get(r);Tt(a,e),t&&(l||(l=[],t.set(r,l)),l.push(e))}}},Em.prototype.updateConnectionWaypoints=function(e){Ni(e).set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},Em.prototype.updateConnection=function(e){var t,n=e.connection,r=Di(n),i=n.source,o=Di(i),s=n.target,a=Di(n.target);if(Mi(r,"bpmn:DataAssociation"))Mi(r,"bpmn:DataInputAssociation")?(r.get("sourceRef")[0]=o,t=e.parent||e.newParent||a,this.updateSemanticParent(r,a,t)):Mi(r,"bpmn:DataOutputAssociation")&&(t=e.parent||e.newParent||o,this.updateSemanticParent(r,o,t),r.targetRef=a);else{var l=Mi(r,"bpmn:SequenceFlow");r.sourceRef!==o&&(l&&(Tt(r.sourceRef&&r.sourceRef.get("outgoing"),r),o&&o.get("outgoing")&&o.get("outgoing").push(r)),r.sourceRef=o),r.targetRef!==a&&(l&&(Tt(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)},Em.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label},e(Pm,Qn),Pm.$inject=["bpmnFactory","moddle","translate"],Pm.prototype._baseCreate=Qn.prototype.create,Pm.prototype.create=function(e,t){if("label"===e){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,z({type:"label",di:n},to,t))}return this.createElement(e,t)},Pm.prototype.createElement=function(e,t){var n,r,i,o=this._translate,s=(t=z({},t||{})).businessObject,l=t.di;if(!s){if(!t.type)throw new Error(o("no shape type specified"));Si(s=this._bpmnFactory.create(t.type))}if(!Ai(l,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])){var c=z({},l||{},{id:s.id+"_di"});l="root"===e?this._bpmnFactory.createDiPlane(s,c):"connection"===e?this._bpmnFactory.createDiEdge(s,c):this._bpmnFactory.createDiShape(s,c)}return Mi(s,"bpmn:Group")&&(t=z({isFrame:!0},t)),t=function(e,t,n){return b(n,(function(n){t=Sm(e,t,n)})),t}(s,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=Sm(l,t,"isExpanded")),Mi(s,"bpmn:SubProcess")&&(t.collapsed=!Yi(s,l)),Mi(s,"bpmn:ExclusiveGateway")&&(l.isMarkerVisible=!0),a(t.triggeredByEvent)&&(s.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),a(t.cancelActivity)&&(s.cancelActivity=t.cancelActivity,delete t.cancelActivity),t.eventDefinitionType&&(r=s.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=s,s.eventDefinitions=r,delete t.eventDefinitionType),n=this.getDefaultSize(s,l),t=z({id:s.id},n,t,{businessObject:s,di:l}),this._baseCreate(e,t)},Pm.prototype.getDefaultSize=function(e,t){var n=Di(e);return t=t||Ni(e),Mi(n,"bpmn:SubProcess")?Yi(n,t)?{width:350,height:200}:{width:100,height:80}:Mi(n,"bpmn:Task")?{width:100,height:80}:Mi(n,"bpmn:Gateway")?{width:50,height:50}:Mi(n,"bpmn:Event")?{width:36,height:36}:Mi(n,"bpmn:Participant")?Yi(n,t)?{width:600,height:250}:{width:400,height:60}:Mi(n,"bpmn:Lane")?{width:400,height:100}:Mi(n,"bpmn:DataObjectReference")?{width:36,height:50}:Mi(n,"bpmn:DataStoreReference")?{width:50,height:50}:Mi(n,"bpmn:TextAnnotation")?{width:100,height:30}:Mi(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},Pm.prototype.createParticipantShape=function(e){return p(e)||(e={isExpanded:e}),!1!==(e=z({type:"bpmn:Participant"},e||{})).isExpanded&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)},Cm.$inject=["modeling","canvas"],Cm.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,r=e.alignment;b(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)}))},Cm.prototype.postExecute=function(e){},Tm.$inject=["modeling"],Tm.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},Tm.prototype.postExecute=function(e){var t,n,r=e.hints||{};t=e.source,n=e.shape,k(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))},Mm.$inject=["canvas","layouter"],Mm.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},Mm.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var Am=Math.round;function Dm(e){this._modeling=e}Dm.$inject=["modeling"],Dm.prototype.preExecute=function(e){var t=e.elements,n=e.parent,r=e.parentIndex,i=e.position,o=e.hints,s=this._modeling;b(t,(function(e){u(e.x)||(e.x=0),u(e.y)||(e.y=0)}));var a=kt(v(t,(function(e){return!e.hidden})));b(t,(function(e){vn(e)&&(e.waypoints=E(e.waypoints,(function(e){return{x:Am(e.x-a.x-a.width/2+i.x),y:Am(e.y-a.y-a.height/2+i.y)}}))),z(e,{x:Am(e.x-a.x-a.width/2+i.x),y:Am(e.y-a.y-a.height/2+i.y)})}));var l=vt(t),c={};b(t,(function(e){if(vn(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=z({},o);-1===l.indexOf(e)&&(t.autoResize=!1),bn(e)&&(t=V(t,["attach"])),c[e.id]=u(r)?s.createShape(e,F(e,["x","y","width","height"]),e.parent||n,r,t):s.createShape(e,F(e,["x","y","width","height"]),e.parent||n,t)}})),e.elements=S(c)};var Nm=Math.round;function Rm(e){this._canvas=e}function jm(e){Rm.call(this,e)}Rm.$inject=["canvas"],Rm.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?z(t,n):z(t,{x:n.x-Nm(t.width/2),y:n.y-Nm(t.height/2)}),this._canvas.addShape(t,r,i),t},Rm.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t},e(jm,Rm),jm.$inject=["canvas"];var $m=Rm.prototype.execute;jm.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,$m.call(this,e)};var Bm=Rm.prototype.revert;function Im(e,t){this._canvas=e,this._modeling=t}function zm(e,t){this._modeling=e,this._elementRegistry=t}function Lm(e,t){this._canvas=e,this._modeling=t}function qm(e){this._modeling=e}jm.prototype.revert=function(e){return e.shape.labelTarget=null,Bm.call(this,e)},Im.$inject=["canvas","modeling"],Im.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;mm(n.incoming,(function(e){t.removeConnection(e,{nested:!0})})),mm(n.outgoing,(function(e){t.removeConnection(e,{nested:!0})}))},Im.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=At(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},Im.prototype.revert=function(e){var t=e.connection,n=e.parent,r=e.parentIndex;return t.source=e.source,t.target=e.target,Mt(n.children,t,r),this._canvas.addConnection(t,n),t},zm.$inject=["modeling","elementRegistry"],zm.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry;b(e.elements,(function(e){n.get(e.id)&&(e.waypoints?t.removeConnection(e):t.removeShape(e))}))},Lm.$inject=["canvas","modeling"],Lm.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;mm(n.incoming,(function(e){t.removeConnection(e,{nested:!0})})),mm(n.outgoing,(function(e){t.removeConnection(e,{nested:!0})})),mm(n.children,(function(e){vn(e)?t.removeConnection(e,{nested:!0}):t.removeShape(e,{nested:!0})}))},Lm.prototype.execute=function(e){var t=this._canvas,n=e.shape,r=n.parent;return e.oldParent=r,e.oldParentIndex=At(r.children,n),t.removeShape(n),n},Lm.prototype.revert=function(e){var t=this._canvas,n=e.shape,r=e.oldParent,i=e.oldParentIndex;return Mt(r.children,n,i),t.addShape(n,r),n},qm.$inject=["modeling"];var Fm={x:"y",y:"x"};function Vm(e,t){this._layouter=e,this._canvas=t}function Hm(){}function Um(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}function Wm(e){this._modeling=e}function Xm(e){this._helper=new Wm(e)}function Gm(e){this._modeling=e,this._helper=new Wm(e)}function Qm(e){this._modeling=e}function Ym(e){return e.original||e}function Km(e,t){this._modeling=e,this._rules=t}function Zm(e){this._modeling=e}function Jm(e){this._modeling=e}function eg(e){return z({},e)}function tg(e){switch(e){case"n":case"s":return"y";case"w":case"e":return"x"}}function ng(e,t,n){var r=tg(n);return/e|s/.test(n)?e[r]>t:/n|w/.test(n)?e[r]<t:void 0}function rg(e,t){return-1!==e.indexOf(t)}function ig(e){this._modeling=e}function og(e){var t={};return b(e,(function(e){t[e.id]=e.hidden,e.children&&(t=z({},t,og(e.children)))})),t}function sg(e,t){var n=[];return b(e,(function(e){e.hidden=t,n=n.concat(e),e.children&&(n=n.concat(sg(e.children,e.collapsed||t)))})),n}function ag(e,t){var n=[];return b(e,(function(e){e.hidden=t[e.id],n=n.concat(e),e.children&&(n=n.concat(ag(e.children,t)))})),n}function lg(e){this._modeling=e}function cg(e,t){return Tt(e&&e.attachers,t)}function pg(e,t,n){if(e){var r=e.attachers;r||(e.attachers=r=[]),Mt(r,t,n)}}function ug(){}function dg(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var r=this;e.on("diagram.init",(function(){r.registerHandlers(n)}))}function hg(e){this._elementRegistry=e}function fg(e,t){b(t,(function(t,n){e.set(n,t)}))}qm.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;b(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=A(e.elements,r))[0],c===d&&(u=p[a(p)]),h=s(u),e.range=null,b(p,(function(n){!function(e,n){var i={y:0};i[r]=e-s(n),i[r]&&(i[Fm[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||b(n,(function(e,o){var s,a={};e!==u&&e!==h&&(s=n[o-1],e.range.max=0,b(e.elements,(function(n,o){a[Fm[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)})))}))},qm.prototype.postExecute=function(e){},Vm.$inject=["layouter","canvas"],Vm.prototype.execute=function(e){var t=e.connection;return z(e,{oldWaypoints:t.waypoints}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},Vm.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t},Hm.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=Tt(o.children,t),Mt(r.children,t,i),t.parent=r,b(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},Hm.prototype.revert=function(e){var t=e.connection,n=t.parent,r=e.oldParent,i=e.oldParentIndex,o=e.delta;return Tt(n.children,t),Mt(r.children,t,i),t.parent=r,b(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},Um.prototype.add=function(e,t){return this.addAll([e],t)},Um.prototype.addAll=function(e,t){var n=function(e,t,n){s(t)&&(t=!0),p(t)&&(n=t,t=!0);var r=Pt((n=n||{}).allShapes),i=Pt(n.allConnections),o=Pt(n.enclosedElements),a=Pt(n.enclosedConnections),l=Pt(n.topLevel,t&&C(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 xt(e,(function(e){if(o[e.id]=e,!e.waypoints)return r[e.id]=e,b(e.incoming,c),b(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 z(this,n),this},Wm.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},Wm.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),b(s,(function(e){o.moveShape(e,t,c[e.id]&&!p&&n,{recurse:!1,layout:!1})})),b(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&&Md(e,e.source,t),connectionEnd:i&&Ad(e,e.target,t)})}))},Wm.prototype.getClosure=function(e){return(new Um).addAll(e,!0)},Xm.$inject=["modeling"],Xm.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},Xm.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)},Gm.$inject=["modeling"],Gm.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=F(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=Tt(o.children,t),Mt(r.children,t,i),z(t,{parent:r,x:t.x+n.x,y:t.y+n.y}),t},Gm.prototype.postExecute=function(e){var t=e.shape,n=e.delta,r=e.hints,i=this._modeling;!1!==r.layout&&(b(t.incoming,(function(e){i.layoutConnection(e,{connectionEnd:Ad(e,t,n)})})),b(t.outgoing,(function(e){i.layoutConnection(e,{connectionStart:Md(e,t,n)})}))),!1!==r.recurse&&this.moveChildren(e)},Gm.prototype.revert=function(e){var t=e.shape,n=e.oldParent,r=e.oldParentIndex,i=e.delta;return Mt(n.children,t,r),z(t,{parent:n,x:t.x-i.x,y:t.y-i.y}),t},Gm.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},Gm.prototype.getNewParent=function(e){return e.newParent||e.shape.parent},Qm.$inject=["modeling"],Qm.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},Qm.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||Ym(c(i)?i[0]:i)),!r||n&&"target"!==o.docking||(s.connectionEnd=s.connectionEnd||Ym(c(i)?i[i.length-1]:i)),o.newWaypoints&&(s.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,s))},Qm.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},Km.$inject=["modeling","rules"],Km.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();b(d,(function(e){l(e.source,t,e)&&n.reconnectEnd(e,t,Td(e,t,u),a)})),b(h,(function(e){var r=e.target;l(t,r,e)&&n.reconnectStart(e,t,Cd(e,t,u),a)}))},Km.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},Km.prototype.execute=function(e){},Km.prototype.revert=function(e){},Km.prototype.createShape=function(e,t,n,r){return this._modeling.createShape(e,t,n,r)},Km.prototype.reconnectStart=function(e,t,n,r){this._modeling.reconnectStart(e,t,n,r)},Km.prototype.reconnectEnd=function(e,t,n,r){this._modeling.reconnectEnd(e,t,n,r)},Zm.$inject=["modeling"],Zm.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},z(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Zm.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,r=e.oldBounds;!1!==(e.hints||{}).layout&&(b(n.incoming,(function(e){t.layoutConnection(e,{connectionEnd:Td(e,n,r)})})),b(n.outgoing,(function(e){t.layoutConnection(e,{connectionStart:Cd(e,n,r)})})))},Zm.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return z(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Jm.$inject=["modeling"],Jm.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),b(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 b(e.concat(t),(function(r){var i=r.incoming,o=r.outgoing;b(i.concat(o),(function(r){var i=r.source,o=r.target;(Xf(e,i)||Xf(e,o)||Xf(t,i)||Xf(t,o))&&(Xf(n,r)||n.push(r))}))})),n}(r,i),t,n,o,r,i,s)},Jm.prototype.execute=function(){},Jm.prototype.revert=function(){},Jm.prototype.moveShapes=function(e,t){var n=this;b(e,(function(e){n._modeling.moveShape(e,t,null,{autoResize:!1,layout:!1,recurse:!1})}))},Jm.prototype.resizeShapes=function(e,t,n){var r=this;b(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})}))},Jm.prototype.updateConnectionWaypoints=function(e,t,n,r,i,o,s){var a=this,l=i.concat(o);b(e,(function(e){var c=e.source,p=e.target,u=function(e){return E(e.waypoints,(function(e){return(e=eg(e)).original&&(e.original=eg(e.original)),e}))}(e),d=tg(n),h={};rg(l,c)&&rg(l,p)?(u=E(u,(function(e){return ng(e,r,n)&&(e[d]=e[d]+t[d]),e.original&&ng(e.original,r,n)&&(e.original[d]=e.original[d]+t[d]),e})),a._modeling.updateWaypoints(e,u,{labelBehavior:!1})):(rg(l,c)||rg(l,p))&&(rg(i,c)?h.connectionStart=Md(e,c,t):rg(i,p)?h.connectionEnd=Ad(e,p,t):rg(o,c)?h.connectionStart=Cd(e,c,s[c.id]):rg(o,p)&&(h.connectionEnd=Td(e,p,s[p.id])),a._modeling.layoutConnection(e,h))}))},ig.$inject=["modeling"],ig.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=og(n),t.collapsed=!t.collapsed;var r=sg(n,t.collapsed);return[t].concat(r)},ig.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,r=ag(t.children,n);return t.collapsed=!t.collapsed,[t].concat(r)},lg.$inject=["modeling"],lg.prototype.execute=function(e){var t=e.shape,n=e.newHost,r=t.host;return e.oldHost=r,e.attacherIdx=cg(r,t),pg(n,t),t.host=n,t},lg.prototype.revert=function(e){var t=e.shape,n=e.newHost,r=e.oldHost,i=e.attacherIdx;return t.host=r,cg(n,t),pg(r,t,i),t},ug.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},ug.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t},dg.$inject=["eventBus","elementFactory","commandStack"],dg.prototype.getHandlers=function(){return{"shape.append":Tm,"shape.create":Rm,"shape.delete":Lm,"shape.move":Gm,"shape.resize":Zm,"shape.replace":Km,"shape.toggleCollapse":ig,spaceTool:Jm,"label.create":jm,"connection.create":Mm,"connection.delete":Im,"connection.move":Hm,"connection.layout":Vm,"connection.updateWaypoints":ug,"connection.reconnect":Qm,"elements.create":Dm,"elements.move":Xm,"elements.delete":zm,"elements.distribute":qm,"elements.align":Cm,"element.updateAttachment":lg}},dg.prototype.registerHandlers=function(e){b(this.getHandlers(),(function(t,n){e.registerHandler(n,t)}))},dg.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)},dg.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},dg.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)},dg.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)},dg.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},dg.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},dg.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},dg.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},dg.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},dg.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},dg.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},dg.prototype.distributeElements=function(e,t,n){var r={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",r)},dg.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},dg.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},dg.prototype.replaceShape=function(e,t,n){var r={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",r),r.newShape},dg.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},dg.prototype.resizeShape=function(e,t,n,r){var i={shape:e,newBounds:t,minBounds:n,hints:r};this._commandStack.execute("shape.resize",i)},dg.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)},dg.prototype.updateWaypoints=function(e,t,n){var r={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",r)},dg.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)},dg.prototype.reconnectStart=function(e,t,n,r){r||(r={}),this.reconnect(e,t,e.target,n,z(r,{docking:"source"}))},dg.prototype.reconnectEnd=function(e,t,n,r){r||(r={}),this.reconnect(e,e.source,t,n,z(r,{docking:"target"}))},dg.prototype.connect=function(e,t,n,r){return this.createConnection(e,t,n||{},e.parent,r)},dg.prototype._create=function(e,t){return t instanceof Vn?t:this._elementFactory.create(e,t)},dg.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)},hg.$inject=["elementRegistry"],hg.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 x(t,(function(t,n){return t[n]=e.get(n),t}),{})}(n,O(r));return fg(n,r),e.oldProperties=o,e.changed=i,i},hg.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,r=e.changed;return fg(n,t),r},hg.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return Mi(e,"bpmn:DataObject")?function(e,t){return t.filter((function(t){return Mi(t,"bpmn:DataObjectReference")&&Di(t).dataObjectRef===e}))}(e,t):[]};var mg="default",gg="id",yg="di",vg={width:0,height:0};function bg(e,t,n,r,i){this._elementRegistry=e,this._moddle=t,this._translate=n,this._modeling=r,this._textRenderer=i}function wg(e,t){return gg in e&&e[gg]!==t[gg]}function xg(e,t){var n=e.businessObject,r=Ni(e);b(t,(function(e,t){t!==yg?n.set(t,e):r&&function(e,t){b(t,(function(t,n){e.set(n,t)}))}(r,e)}))}bg.$inject=["elementRegistry","moddle","translate","modeling","textRenderer"],bg.prototype.execute=function(e){var t=e.element,n=[t],r=this._translate;if(!t)throw new Error(r("element required"));var i=this._elementRegistry,o=this._moddle.ids,s=t.businessObject,a=function(e){var t=z({},e);return _g.forEach((function(n){n in e&&(t[n]=Di(t[n]))})),t}(e.properties),l=e.oldProperties||function(e,t){var n=O(t),r=e.businessObject,i=Ni(e);return x(n,(function(e,n){return e[n]=n!==yg?r.get(n):function(e,t){return x(t,(function(t,n){return t[n]=e&&e.get(n),t}),{})}(i,O(t.di)),e}),{})}(t,a);return wg(a,s)&&(o.unclaim(s[gg]),i.updateId(t,a[gg]),o.claim(a[gg],s)),mg in a&&(a[mg]&&n.push(i.get(a[mg].id)),s[mg]&&n.push(i.get(s[mg].id))),xg(t,a),e.oldProperties=l,e.changed=n,n},bg.prototype.postExecute=function(e){var t=e.element.label,n=t&&Di(t).name;if(n){var r=this._textRenderer.getExternalLabelBounds(t,n);this._modeling.resizeShape(t,r,vg)}},bg.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 xg(t,r),wg(n,i)&&(s.unclaim(n[gg]),o.updateId(t,r[gg]),s.claim(r[gg],i)),e.changed};var _g=["default"];function kg(e,t){this._canvas=e,this._modeling=t}function Eg(e,t){this._modeling=e,this._spaceTool=t}function Og(e,t){this._modeling=e,this._translate=t}function Pg(e,t){this._modeling=e,this._spaceTool=t}kg.$inject=["canvas","modeling"],kg.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,r=n.businessObject,i=t.getRootElement(),o=i.businessObject,s=o.$parent,a=Ni(i);return t.setRootElement(n),t.removeRootElement(i),Mt(s.rootElements,r),r.$parent=s,Tt(s.rootElements,o),o.$parent=null,i.di=null,a.bpmnElement=r,n.di=a,e.oldRoot=i,[]},kg.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,r=n.businessObject,i=e.oldRoot,o=i.businessObject,s=r.$parent,a=Ni(n);return t.setRootElement(i),t.removeRootElement(n),Tt(s.rootElements,r),r.$parent=null,Mt(s.rootElements,o),o.$parent=s,n.di=null,a.bpmnElement=o,i.di=a,[]},Eg.$inject=["modeling","spaceTool"],Eg.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,r=e.shape,i=e.location,o=Uu(r),s=o===r,a=s?r:r.parent;Hu(a).length||n.createShape({type:"bpmn:Lane"},{x:r.x+Fu,y:r.y,width:r.width-Fu,height:r.height},a);var l=[];xt(o,(function(e){return l.push(e),e.label&&l.push(e.label),e===r?[]:v(e.children,(function(e){return e!==r}))}));var c="top"===i?-120:120,p="top"===i?r.y:r.y+r.height,u=p+("top"===i?10:-10),d="top"===i?"n":"s",h=t.calculateAdjustments(l,"y",c,u);t.makeSpace(h.movingShapes,h.resizingShapes,{x:0,y:c},d,u),e.newLane=n.createShape({type:"bpmn:Lane"},{x:r.x+(s?Fu:0),y:p-("top"===i?120:0),width:r.width-(s?Fu:0),height:120},a)},Og.$inject=["modeling","translate"],Og.prototype.preExecute=function(e){var t=this._modeling,n=this._translate,r=e.shape,i=e.count,o=Hu(r),s=o.length;if(s>i)throw new Error(n("more than {count} child lanes",{count:i}));var a,l,c,p,u,d=Math.round(r.height/i);for(u=0;u<i;u++)a=r.y+u*d,l=u===i-1?r.height-d*u:d,c={x:r.x+Fu,y:a,width:r.width-Fu,height:l},u<s?t.resizeShape(o[u],c):(p={type:"bpmn:Lane"},t.createShape(p,c,r))},Pg.$inject=["modeling","spaceTool"],Pg.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds;!1!==e.balanced?this.resizeBalanced(t,n):this.resizeSpace(t,n)},Pg.prototype.resizeBalanced=function(e,t){var n=this._modeling,r=Wu(e,t);n.resizeShape(e,t),r.forEach((function(e){n.resizeShape(e.shape,e.newBounds)}))},Pg.prototype.resizeSpace=function(e,t){var n,r,i,o,s,a=this._spaceTool,l=_n(e),c=ju(_n(t),l),p=Uu(e),u=[],d=[];xt(p,(function(e){return u.push(e),(Mi(e,"bpmn:Lane")||Mi(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 Sg="flowNodeRef",Cg="lanes";function Tg(e){this._elementRegistry=e}function Mg(e){this._moddle=e}Tg.$inject=["elementRegistry"],Tg.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=Uu(e);return i[t.id]||(i[t.id]=Vu(t)),i[t.id]}(e);return t.filter((function(t){return n=e,r=_n(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=Uu(e);if(t&&-1===n.indexOf(t)){var r=t.children.filter((function(e){return Mi(e,"bpmn:FlowNode")}));r.forEach(s),n.push(t)}})),e.forEach(s),o.forEach((function(e){var t=e.businessObject,n=t.get(Cg).slice(),i=a(e);r.push({flowNode:t,remove:n,add:i})})),t.forEach((function(e){var t=e.businessObject;e.parent||t.get(Sg).forEach((function(e){r.push({flowNode:e,remove:[t],add:[]})}))})),r},Tg.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(Cg);e.remove.forEach((function(e){Tt(n,e),Tt(e.get(Sg),t)})),e.add.forEach((function(e){Mt(n,e),Mt(e.get(Sg),t)}))})),[]},Tg.prototype.revert=function(e){return e.updates.forEach((function(e){var t=e.flowNode,n=t.get(Cg);e.add.forEach((function(e){Tt(n,e),Tt(e.get(Sg),t)})),e.remove.forEach((function(e){Mt(n,e),Mt(e.get(Sg),t)}))})),[]},Mg.$inject=["moddle"],Mg.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),[]},Mg.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 Ag={fill:void 0,stroke:void 0};function Dg(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)}}}Dg.$inject=["commandStack"],Dg.prototype.postExecute=function(e){var t=e.elements,n=e.colors||Ag,r=this,i={};"fill"in n&&z(i,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&z(i,{"border-color":this._normalizeColor(n.stroke)}),b(t,(function(e){var t=vn(e)?F(i,["border-color"]):i,n=Ni(e);if(function(e){"border-color"in e&&(e.stroke=e["border-color"]);"background-color"in e&&(e.fill=e["background-color"])}(t),bn(e))r._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:n.label,properties:{color:i["border-color"]}});else{if(!Ai(n,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;r._commandStack.execute("element.updateProperties",{element:e,properties:{di:t}})}}))};var Ng={width:0,height:0};function Rg(e,t,n){function r(e,t){var n=e.label||e,r=e.labelTarget||e;return co(n,t),[n,r]}this.preExecute=function(t){var n=t.element,r=n.businessObject,i=t.newLabel;if(!bn(n)&&ro(n)&&!io(n)&&!jg(i)){var o=so(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=lo(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(bn(i)||Mi(i,"bpmn:TextAnnotation"))if(bn(i)&&jg(o))!1!==a.removeShape&&e.removeShape(i,{unsetLabel:!1});else{var l=lo(r);void 0===s&&(s=t.getExternalLabelBounds(i,l)),s&&e.resizeShape(i,s,Ng)}}}function jg(e){return!e||!e.trim()}function $g(e,t,n,r){dg.call(this,e,t,n),this._bpmnRules=r}function Bg(){}Rg.$inject=["modeling","textRenderer","bpmnFactory"],e($g,dg),$g.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],$g.prototype.getHandlers=function(){var e=dg.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=hg,e["element.updateProperties"]=bg,e["canvas.updateRoot"]=kg,e["lane.add"]=Eg,e["lane.resize"]=Pg,e["lane.split"]=Og,e["lane.updateRefs"]=Tg,e["id.updateClaim"]=Mg,e["element.setColor"]=Dg,e["element.updateLabel"]=Rg,e},$g.prototype.updateLabel=function(e,t,n,r){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:r||{}})},$g.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)},$g.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},$g.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},$g.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},$g.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},$g.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},$g.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},$g.prototype.makeProcess=function(){var e={newRoot:this._create("root",{type:"bpmn:Process"})};this._commandStack.execute("canvas.updateRoot",e)},$g.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},$g.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},$g.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},$g.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})},Bg.prototype.layoutConnection=function(e,t){return[(t=t||{}).connectionStart||On(t.source||e.source),t.connectionEnd||On(t.target||e.target)]};var Ig=20,zg=5,Lg=Math.round,qg=20,Fg={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function Vg(e,t,n){var r,i,o,s=Pn(t,e,zg),a=n.split(":")[0],l=Lg((t.x-e.x)/2+e.x),c=Lg((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+Ig*(/l/.test(a)?-1:1),y:h?c+Ig:c}):r={x:(h=l===e.x)?l+Ig:l,y:e.y+Ig*(/t/.test(a)?-1:1)}:r={x:l,y:c}),{waypoints:Ug(e,r,i).concat(r),directions:i,turnNextDirections:h}}function Hg(e){return e.split(":").reverse().join(":")}function Ug(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(Yg(n)){var r=function(e,t,n){return Vg(e,t,n)}(e,t,n),i=function(e,t,n){var r=Vg(t,e,Hg(n));return{waypoints:r.waypoints.slice().reverse(),directions:Hg(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:Ug(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=Lg((t.x-e.x)/2+e.x),i=Lg((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 Wg(e,t,n,r,i){var o=w(i&&i.preferredLayouts||[],"straight")[0]||"h:h",s=Pn(e,t,Fg[o]||0),a=function(e,t){if(Yg(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||On(e),r=r||On(t);var l=a.split(":"),c=Kg(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=Ug(e,t,n);return r.unshift(e),r.push(t),Zg(r)}(c,Kg(r,t,l[1],s),a)}function Xg(e,t,n,r,i,o){var s;return c(n)&&(i=n,o=r,n=On(e),r=On(t)),i=i||[],s=-1!==(o=z({preferredLayouts:[]},o)).preferredLayouts.indexOf("straight")&&function(e,t,n,r,i){var o,s,a={};if(s=Pn(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?Gg(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:Gg(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=Qg(e,t,n,i),i?i.reverse():null}(t,e,r,i),s||((s=o.connectionStart&&Qg(e,t,n,i))||(!o.connectionStart&&!o.connectionEnd&&i&&i.length?i:Wg(e,t,n,r,o))))}function Gg(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 Qg(e,t,n,r){if(function(e){return e.length<3||!(e.length>4)&&!!g(e,(function(t,n){var r=e[n-1];return r&&Dt(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(jt(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(Bt(e[r],t,qg)||Bt(e[r],n,qg))return e.slice(r);return e}(s,e,t),i!==s&&(s=Qg(e,t,n,i)),s&&jt(s)?null:s}function Yg(e){return e&&/t|r|b|l/.test(e)}function Kg(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 Zg(e){return e.reduce((function(t,n,r){return Nt(t[t.length-1],e[r+1],n,0)||t.push(n),t}),[])}var Jg=-10,ey=40,ty={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},ny={top:"t",right:"r",bottom:"b",left:"l"};function ry(){}function iy(e,t){return Mi(t,"bpmn:Participant")?"source":Mi(e,"bpmn:Participant")?"target":ly(t)?"source":ly(e)||Mi(t,"bpmn:Event")?"target":Mi(e,"bpmn:Event")?"source":null}function oy(e){return ly(e)?"target":"source"}function sy(e,t){return e?e.original||e:On(t)}function ay(e,t){return Mi(t,"bpmn:Activity")&&Mi(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function ly(e){return Mi(e,"bpmn:SubProcess")&&Yi(e)}function cy(e,t){return e===t}function py(e){var t=/right|left/.exec(e);return t&&t[0]}function uy(e){var t=/top|bottom/.exec(e);return t&&t[0]}function dy(e){return"right"===e||"left"===e}function hy(e,t){var n=t.waypoints,r=n&&n.length&&Pn(n[0],e);return"top"===r?["t:r"]:"right"===r?["r:b"]:"left"===r?["l:t"]:["b:l"]}function fy(e,t,n){var r,i,o,s,a=On(e),l=On(t),c=(s=(o=e).host,Pn(On(o),s,Jg)),p=cy(e.host,t),u=-1!==["top","right","bottom","left"].indexOf(c),d=Pn(l,a,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return p?function(e,t,n,r,i){var o,s=t?e:uy(e),a=ny[s];o=t?dy(e)?my("y",n,r,i)?"h":"b":my("x",n,r,i)?"v":"l":"v";return[a+":"+o]}(c,u,e,t,n):(r=function(e,t,n){if(n)return ny[e];if(cy(uy(e),uy(t))||function(e,t){return ty[e]===t}(py(e),py(t)))return ny[uy(e)];return ny[py(e)]}(c,d,u),i=function(e,t,n){if(n)return dy(e)?function(e,t){var n=py(e),r=ty[n];return-1!==t.indexOf(r)}(e,t)||cy(e,t)?"h":"v":function(e,t){var n=uy(e),r=ty[n];return-1!==t.indexOf(r)}(e,t)||cy(e,t)?"v":"h";return dy(t)||cy(uy(e),uy(t))&&py(t)?"h":"v"}(c,d,u),[r+":"+i])}function my(e,t,n,r){var i=ey;return!(gy(e,r,n,i)||gy(e,r,{x:n.x+n.width,y:n.y+n.height},i)||gy(e,r,On(t),i))}function gy(e,t,n,r){return Math.abs(t[e]-n[e])<r}function yy(e){return z({original:e.point.original||e.point},e.actual)}function vy(e,t){this._elementRegistry=e,this._graphicsFactory=t}e(ry,Bg),ry.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;return a||(a=sy(s&&s[0],i)),l||(l=sy(s&&s[s.length-1],o)),(Mi(e,"bpmn:Association")||Mi(e,"bpmn:DataAssociation"))&&s&&!ay(i,o)?[].concat([a],s.slice(1,-1),[l]):(Mi(e,"bpmn:MessageFlow")?n=function(e,t){return{preferredLayouts:["straight","v:v"],preserveDocking:iy(e,t)}}(i,o):(Mi(e,"bpmn:SequenceFlow")||ay(i,o))&&(n=i===o?{preferredLayouts:hy(i,e)}:Mi(i,"bpmn:BoundaryEvent")?{preferredLayouts:fy(i,o,l)}:ly(i)||ly(o)?function(e){return{preferredLayouts:["straight","h:h"],preserveDocking:oy(e)}}(i):Mi(i,"bpmn:Gateway")?{preferredLayouts:["v:h"]}:Mi(o,"bpmn:Gateway")?{preferredLayouts:["h:v"]}:{preferredLayouts:["h:h"]}),n&&(r=Zg(Xg(i,o,a,l,s,n=z(n,t)))),r||[a,l])},vy.$inject=["elementRegistry","graphicsFactory"],vy.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(yy(r)),o.push(yy(i)),o},vy.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}},vy.prototype._getIntersection=function(e,t,n){return Sn(this._getShapePath(e),this._getConnectionPath(t),n)},vy.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},vy.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},vy.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};var by={__init__:["modeling","bpmnUpdater"],__depends__:[Oh,sf,lf,uf,Hf,fm,vm,_m,ps,bs,dm],bpmnFactory:["type",km],bpmnUpdater:["type",Em],elementFactory:["type",Pm],modeling:["type",$g],layouter:["type",ry],connectionDocking:["type",vy]};const wy=Math.round;function xy(e,t,n,r,i,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=r,this._layouter=i,this._rules=o}xy.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(z({type:t},n)),u=s.fire("autoPlace",{source:e,shape:p});if(!u)return;z(p,{x:u.x-wy(p.width/2),y:u.y-wy(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)))})},xy.prototype.cleanUp=function(){this._complexPreview.cleanUp()},xy.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];var _y={__depends__:[Dc,su,by],__init__:["appendPreview"],appendPreview:["type",xy]},ky=Math.min,Ey=Math.max;function Oy(e){e.preventDefault()}function Py(e){e.stopPropagation()}function Sy(e){this.container=e.container,this.parent=we('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=xe("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.autoResize=I(this.autoResize,this),this.handlePaste=I(this.handlePaste,this)}function Cy(e,t){this._eventBus=e,this._providers=[],this._textbox=new Sy({container:t.getContainer(),keyHandler:I(this._handleKey,this),resizeHandler:I(this._handleResize,this)})}Sy.prototype.create=function(e,t,n,r){var i=this.parent,o=this.content,s=this.container;r=this.options=r||{};var a=F(t=this.style=t||{},["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);z(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=F(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return z(o.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},l),r.centerVertically&&z(o.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},l),o.innerText=n,he.bind(o,"keydown",this.keyHandler),he.bind(o,"mousedown",Py),he.bind(o,"paste",this.handlePaste),r.autoResize&&he.bind(o,"input",this.autoResize),r.resizable&&this.resizable(t),s.appendChild(i),this.setSelection(o.lastChild,o.lastChild&&o.lastChild.length),i},Sy.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)}},Sy.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)},Sy.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&&ke(t)})),n=o,r=a+e.length}n&&void 0!==r&&setTimeout((function(){self.setSelection(n,r)}))},Sy.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})}},Sy.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=we('<div class="djs-direct-editing-resize-handle"></div>');var u=function(n){Oy(n),Py(n);var u=ky(Ey(c+n.clientX-a,r),o),d=ky(Ey(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){Oy(e),Py(e),he.unbind(document,"mousemove",u,!1),he.unbind(document,"mouseup",d,!1)};he.bind(n,"mousedown",(function(e){Oy(e),Py(e),a=e.clientX,l=e.clientY;var n=t.getBoundingClientRect();c=n.width,p=n.height,he.bind(document,"mousemove",u),he.bind(document,"mouseup",d)}))}z(n.style,{position:"absolute",bottom:"0px",right:"0px",cursor:"nwse-resize",width:"0",height:"0",borderTop:(parseInt(this.style.fontSize)/4||3)+"px solid transparent",borderRight:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderBottom:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderLeft:(parseInt(this.style.fontSize)/4||3)+"px solid transparent"}),t.appendChild(n)},Sy.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),he.unbind(t,"keydown",this.keyHandler),he.unbind(t,"mousedown",Py),he.unbind(t,"input",this.autoResize),he.unbind(t,"paste",this.handlePaste),n&&(n.removeAttribute("style"),ke(n)),ke(e)},Sy.prototype.getValue=function(){return this.content.innerText.trim()},Sy.prototype.getSelection=function(){return window.getSelection().getRangeAt(0)},Sy.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)},Cy.$inject=["eventBus","canvas"],Cy.prototype.registerProvider=function(e){this._providers.push(e)},Cy.prototype.isActive=function(e){return!(!this._active||e&&this._active.element!==e)},Cy.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},Cy.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},Cy.prototype.close=function(){this._textbox.destroy(),this._fire("deactivate"),this._active=null,this.resizable=void 0},Cy.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()}},Cy.prototype.getValue=function(){return this._textbox.getValue()},Cy.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())},Cy.prototype._handleResize=function(e){this._fire("resize",e)},Cy.prototype.activate=function(e){var t;this.isActive()&&this.cancel();var n=g(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 Ty={__depends__:[ts],__init__:["directEditing"],directEditing:["type",Cy]};function My(e){return function(t){var n=t.target,r=Di(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===Yi(e);return!(o&&s&&a&&l)}}var 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-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"}}],Dy=[{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"}}],Ny=[{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"}}],Ry=[{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"}}],jy=[{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"}}],$y=[{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}}],By=[{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}}],Iy=By,zy=[{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}}],Ly=[{label:"Data store reference",actionName:"replace-with-data-store-reference",className:"bpmn-icon-data-store",target:{type:"bpmn:DataStoreReference"}}],qy=[{label:"Data object reference",actionName:"replace-with-data-object-reference",className:"bpmn-icon-data-object",target:{type:"bpmn:DataObjectReference"}}],Fy=[{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}}],Vy=[{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}}],Hy=[{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"}],Uy=[{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}}],Wy={"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 Xy(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()}Xy.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],Xy.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Xy.prototype.getPopupMenuEntries=function(e){var t=e.businessObject,n=this._rules,r=[];if(c(e)||!n.allowed("shape.replace",{element:e}))return{};var i=My(e);return Mi(t,"bpmn:DataObjectReference")?this._createEntries(e,Ly):Mi(t,"bpmn:DataStoreReference")&&!Mi(e.parent,"bpmn:Collaboration")?this._createEntries(e,qy):Mi(t,"bpmn:StartEvent")&&!Mi(t.$parent,"bpmn:SubProcess")?(r=v(Ay,i),this._createEntries(e,r)):Mi(t,"bpmn:Participant")?(r=v(Uy,(function(t){return Yi(e)!==t.target.isExpanded})),this._createEntries(e,r)):Mi(t,"bpmn:StartEvent")&&Ji(t.$parent)?(r=v(Vy,(function(e){var n=!1!==e.target.isInterrupting,r=t.isInterrupting===n;return i(e)||!i(e)&&!r})),this._createEntries(e,r)):Mi(t,"bpmn:StartEvent")&&!Ji(t.$parent)&&Mi(t.$parent,"bpmn:SubProcess")?(r=v(Dy,i),this._createEntries(e,r)):Mi(t,"bpmn:EndEvent")?(r=v(Ry,(function(e){return!("bpmn:CancelEventDefinition"==e.target.eventDefinitionType&&!Mi(t.$parent,"bpmn:Transaction"))&&i(e)})),this._createEntries(e,r)):Mi(t,"bpmn:BoundaryEvent")?(r=v(Fy,(function(e){var n=e.target;if("bpmn:CancelEventDefinition"==n.eventDefinitionType&&!Mi(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)):Mi(t,"bpmn:IntermediateCatchEvent")||Mi(t,"bpmn:IntermediateThrowEvent")?(r=v(Ny,i),this._createEntries(e,r)):Mi(t,"bpmn:Gateway")?(r=v(jy,i),this._createEntries(e,r)):Mi(t,"bpmn:Transaction")?(r=v(By,i),this._createEntries(e,r)):Ji(t)&&Yi(e)?(r=v(Iy,i),this._createEntries(e,r)):Mi(t,"bpmn:SubProcess")&&Yi(e)?(r=v($y,i),this._createEntries(e,r)):Mi(t,"bpmn:AdHocSubProcess")&&!Yi(e)?(r=v(zy,(function(e){var t=e.target,n="bpmn:SubProcess"===t.type,r=!0===t.isExpanded;return My(t)&&(!n||r)})),this._createEntries(e,r)):Mi(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,Hy):Mi(t,"bpmn:FlowNode")?(r=v(zy,i),Mi(t,"bpmn:SubProcess")&&!Yi(e)&&(r=v(r,(function(e){return"Sub-process (collapsed)"!==e.label}))),this._createEntries(e,r)):{}},Xy.prototype.getPopupMenuHeaderEntries=function(e){var t={};return Mi(e,"bpmn:Activity")&&!Ji(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),Mi(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),Mi(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),!Mi(e,"bpmn:SubProcess")||Mi(e,"bpmn:Transaction")||Ji(e)||(t={...t,...this._getAdHocHeaderEntries(e)}),Id(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},Xy.prototype._createEntries=function(e,t){var n={},r=this;return b(t,(function(t){n[t.actionName]=r._createEntry(t,e)})),n},Xy.prototype._createSequenceFlowEntries=function(e,t){var n=Di(e),r={},i=this._modeling,o=this._moddle,s=this;return b(t,(function(t){switch(t.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(Mi(n.sourceRef,"bpmn:ExclusiveGateway")||Mi(n.sourceRef,"bpmn:InclusiveGateway")||Mi(n.sourceRef,"bpmn:ComplexGateway")||Mi(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&&Mi(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:Mi(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(r={...r,[t.actionName]:s._createEntry(t,e,(function(){i.updateProperties(e,{conditionExpression:void 0})}))}),(Mi(n.sourceRef,"bpmn:ExclusiveGateway")||Mi(n.sourceRef,"bpmn:InclusiveGateway")||Mi(n.sourceRef,"bpmn:ComplexGateway")||Mi(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},Xy.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}},Xy.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function r(n,r){if(r.active)return void t._modeling.updateProperties(e,{loopCharacteristics:void 0});const i=e.businessObject.get("loopCharacteristics"),o=t._moddle.create(r.options.loopCharacteristics);i&&t._moddleCopy.copyElement(i,o),o.set("isSequential",r.options.isSequential),t._modeling.updateProperties(e,{loopCharacteristics:o})}var i,o,s,a=Di(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"}}}},Xy.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})}}}},Xy.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})}}}},Xy.prototype._getAdHocHeaderEntries=function(e){var t=this._translate,n=Mi(Di(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})}}}},Xy.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=Di(e),r=this,i=zd(e),o=Mi(e,"bpmn:BoundaryEvent")?Wy["intermediate-event-non-interrupting"]:Wy["start-event-non-interrupting"],s=!n[i];return{"toggle-non-interrupting":{imageHtml:o,title:t("Toggle non-interrupting"),active:s,action:function(){r._modeling.updateProperties(e,{[i]:!!s})}}}};var Gy={__depends__:[cc,Hf,Dc],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Xy]};function Qy(e,t,n,r,i,o,s,a,l,c,p,u,d){e=e||{},r.registerProvider(this),this._contextPad=r,this._modeling=i,this._elementFactory=o,this._connect=s,this._create=a,this._popupMenu=l,this._canvas=c,this._rules=p,this._translate=u,this._eventBus=n,this._appendPreview=d,!1!==e.autoPlace&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,(function(e){var t=e.context.shape;if(Yo(e)&&r.isOpen(t)){var n=r.getEntries(t);n.replace&&n.replace.action.click(e,t)}}))}function Yy(e,t,n){var r=e.$instanceOf(t),i=!1;return b(e.eventDefinitions||[],(function(e){e.$type===n&&(i=!0)})),r&&i}Qy.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],Qy.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&z(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Remove"),action:{click:function(e,n){t.removeElements(n.slice())}}}}),n},Qy.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return c(t)?_(t,(function(e){return n=e,-1!==t.indexOf(n);var n})):t},Qy.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,r=this._elementFactory,i=this._connect,o=this._create,s=this._popupMenu,a=this._rules,l=this._autoPlace,p=this._translate,u=this._appendPreview,d={};if("label"===e.type)return d;var h=e.businessObject;function f(e,t){i.start(e,t)}function m(e,t,n,i){function s(t,n){var s=r.createShape(z({type:e},i));o.start(t,s,{source:n}),u.cleanUp()}var a=l?function(t,n){var o=r.createShape(z({type:e},i));l.append(n,o),u.cleanUp()}:s,c=l?function(t,n){return u.create(n,e,i),()=>{u.cleanUp()}}:null;return{group:"model",className:t,title:n,action:{dragstart:s,click:a,hover:c}}}function g(e){return function(r,i){n.splitLane(i,e),t.open(i,!0)}}if(Ai(h,["bpmn:Lane","bpmn:Participant"])&&Yi(e)){var y=Hu(e);z(d,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:p("Add lane above"),action:{click:function(e,t){n.addLane(t,"top")}}}}),y.length<2&&(e.height>=120&&z(d,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:p("Divide into two lanes"),action:{click:g(2)}}}),e.height>=180&&z(d,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:p("Divide into three lanes"),action:{click:g(3)}}})),z(d,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:p("Add lane below"),action:{click:function(e,t){n.addLane(t,"bottom")}}}})}Mi(h,"bpmn:FlowNode")&&(Mi(h,"bpmn:EventBasedGateway")?z(d,{"append.receive-task":m("bpmn:ReceiveTask","bpmn-icon-receive-task",p("Append receive task")),"append.message-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",p("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",p("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",p("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",p("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):Yy(h,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?z(d,{"append.compensation-activity":m("bpmn:Task","bpmn-icon-task",p("Append compensation activity"),{isForCompensation:!0})}):Mi(h,"bpmn:EndEvent")||h.isForCompensation||Yy(h,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")||Ji(h)||z(d,{"append.end-event":m("bpmn:EndEvent","bpmn-icon-end-event-none",p("Append end event")),"append.gateway":m("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",p("Append gateway")),"append.append-task":m("bpmn:Task","bpmn-icon-task",p("Append task")),"append.intermediate-event":m("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",p("Append intermediate/boundary event"))})),s.isEmpty(e,"bpmn-replace")||z(d,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:p("Change type"),action:{click:function(e,n){var r=z(function(e){var n=t.getPad(e).html.getBoundingClientRect();return{x:n.left,y:n.bottom+5}}(n),{cursor:{x:e.x,y:e.y}});s.open(n,"bpmn-replace",r,{title:p("Change element"),width:300,search:!0})}}}}),Mi(h,"bpmn:SequenceFlow")&&z(d,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",p("Append text annotation"))}),Ai(h,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&z(d,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",p("Append text annotation")),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:p("Connect using "+(h.isForCompensation?"":"sequence/message flow or ")+"association"),action:{click:f,dragstart:f}}}),Mi(h,"bpmn:TextAnnotation")&&z(d,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:p("Connect using association"),action:{click:f,dragstart:f}}}),Ai(h,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&z(d,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:p("Connect using data input association"),action:{click:f,dragstart:f}}}),Mi(h,"bpmn:Group")&&z(d,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",p("Append text annotation"))});var v=a.allowed("elements.delete",{elements:[e]});return c(v)&&(v=v[0]===e),v&&z(d,{delete:{group:"edit",className:"bpmn-icon-trash",title:p("Remove"),action:{click:function(e,t){n.removeElements([t])}}}}),d};var Ky={__depends__:[_y,Ty,Ka,ps,Kp,kf,Gy],__init__:["contextPadProvider"],contextPadProvider:["type",Qy]},Zy={horizontal:["x","width"],vertical:["y","height"]};function Jy(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:[]}))}Jy.$inject=["modeling","rules"],Jy.prototype.registerFilter=function(e){if("function"!=typeof e)throw new Error("the filter has to be a function");this._filters.push(e)},Jy.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},Jy.prototype._filterElements=function(e){var t=this._filters,n=this._axis,r=this._dimension,i=[].concat(e);return t.length?(b(t,(function(e){i=e(i,n,r)})),i):e},Jy.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 b(A(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},Jy.prototype._setOrientation=function(e){var t=Zy[e];this._axis=t[0],this._dimension=t[1]},Jy.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)},Jy.prototype._findRange=function(e){var t=e[this._axis];return{min:t+5,max:t+e[this._dimension]-5}};var ev={__init__:["distributeElements"],distributeElements:["type",Jy]};function tv(e){fc.call(this,e)}tv.$inject=["eventBus"],e(tv,fc),tv.prototype.init=function(){this.addRule("elements.distribute",(function(e){var t=e.elements;return!((t=vt(t=v(t,(function(e){var t=Ai(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 nv={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 rv(e,t,n,r){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=r,e.registerProvider("align-elements",900,this)}rv.$inject=["popupMenu","distributeElements","translate","rules"],rv.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&z(t,this._getEntries(e)),t},rv.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},rv.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:nv.horizontal,action:function(n,i){t.trigger(e,"horizontal"),r.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:nv.vertical,action:function(n,i){t.trigger(e,"vertical"),r.close()}}}};var iv={__depends__:[cc,ev],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",tv],distributeElementsMenuProvider:["type",rv]},ov="is not a registered action";function sv(e,t){this._actions={};var n=this;e.on("diagram.init",(function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})}))}function av(e,t){return new Error(e+" "+t)}sv.$inject=["eventBus","injector"],sv.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)}))},sv.prototype.trigger=function(e,t){if(!this._actions[e])throw av(e,ov);return this._actions[e](t)},sv.prototype.register=function(e,t){var n=this;if("string"==typeof e)return this._registerAction(e,t);b(e,(function(e,t){n._registerAction(t,e)}))},sv.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw av(e,"is already registered");this._actions[e]=t},sv.prototype.unregister=function(e){if(!this.isRegistered(e))throw av(e,ov);this._actions[e]=void 0},sv.prototype.getActions=function(){return Object.keys(this._actions)},sv.prototype.isRegistered=function(e){return!!this._actions[e]};var lv={__init__:["editorActions"],editorActions:["type",sv]};function cv(e){e.invoke(sv,this)}e(cv,sv),cv.$inject=["injector"],cv.prototype._registerDefaultActions=function(e){sv.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=v(t,(function(e){return!Mi(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=kt(r=Mi(i,"bpmn:Collaboration")?n.filter((function(e){return Mi(e.parent,"bpmn:Collaboration")})):n.filter((function(e){return e!==i&&!Mi(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 pv={__depends__:[lv],editorActions:["type",cv]};function uv(e){e.on(["create.init","shape.move.init"],(function(e){var t=e.context;Ai(e.shape,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(t.gridSnappingContext||(t.gridSnappingContext={}),t.gridSnappingContext.snapLocation="top-left")}))}uv.$inject=["eventBus"];var dv=10;function hv(e,t,n){return n||(n="round"),Math[n](e/t)*t}function fv(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&&Gs(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)||(mv(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&&(mv(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&&(mv(t)?yv(a)?s.x.max=l.left:s.x.min=l.right:gv(a)?s.y.max=l.top:s.y.min=l.bottom);c&&(mv(t)?yv(a)?s.x.min=c.left:s.x.max=c.right:gv(a)?s.y.min=c.top:s.y.max=c.bottom);return s[t]}(t,n);s&&z(r,s),zp(t,n)||i.snapEvent(t,n,r)}))}}))}function mv(e){return"x"===e}function gv(e){return-1!==e.indexOf("n")}function yv(e){return-1!==e.indexOf("w")}function vv(e,t){ws.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)}}))}fv.prototype.snapEvent=function(e,t,n){Lp(e,t,this.snapValue(e[t],n))},fv.prototype.getGridSpacing=function(){return dv},fv.prototype.snapValue=function(e,t){var n,r,i=0;return t&&t.offset&&(i=t.offset),e=hv(e+=i,dv),t&&t.min&&u(n=t.min)&&(n=hv(n+i,dv,"ceil"),e=Math.max(e,n)),t&&t.max&&u(r=t.max)&&(r=hv(r+i,dv,"floor"),e=Math.min(e,r)),e-=i},fv.prototype.isActive=function(){return this.active},fv.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},fv.prototype.toggleActive=function(){this.setActive(!this.active)},fv.$inject=["elementRegistry","eventBus","config.gridSnapping"],vv.$inject=["eventBus","gridSnapping","modeling"],e(vv,ws),vv.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},vv.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},vv.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),z(e,o),e},vv.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),z(e,o),e};function bv(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))}))}bv.$inject=["eventBus","gridSnapping"];var wv={__depends__:[{__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",vv],gridSnappingSpaceToolBehavior:["type",bv]}],__init__:["gridSnapping"],gridSnapping:["type",fv]};function xv(e,t){e.on("autoPlace",2e3,(function(e){var n=e.source,r=On(n),i=e.shape,o=Tc(n,i);return["x","y"].forEach((function(e){var n={};o[e]!==r[e]&&(o[e]>r[e]?n.min=o[e]:n.max=o[e],Mi(i,"bpmn:TextAnnotation")&&(!function(e){return"x"===e}(e)?n.offset=-i.height/2:n.offset=-i.width/2),o[e]=t.snapValue(o[e],n))})),o}))}xv.$inject=["eventBus","gridSnapping"];function _v(e,t,n){t.on(["create.start","shape.move.start"],1750,(function(t){var r=t.context,i=r.shape,o=e.getRootElement();Mi(i,"bpmn:Participant")&&Mi(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})))}))}_v.$inject=["canvas","eventBus","gridSnapping"];function kv(e,t,n){ws.call(this,e),this._gridSnapping=t;var r=this;this.postExecuted(["connection.create","connection.layout"],3e3,(function(e){var t=e.context,i=t.connection,o=t.hints||{},s=i.waypoints;o.connectionStart||o.connectionEnd||!1===o.createElementsBehavior||function(e){return e.length>3}(s)&&n.updateWaypoints(i,r.snapMiddleSegments(s))}))}function Ev(e,t,n){var r=jt(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=z({},t,i),n=z({},n,i)),[t,n]}kv.$inject=["eventBus","gridSnapping","modeling"],e(kv,ws),kv.prototype.snapMiddleSegments=function(e){var t,n=this._gridSnapping;e=e.slice();for(var r=1;r<e.length-2;r++)t=Ev(n,e[r],e[r+1]),e[r]=t[0],e[r+1]=t[1];return e};var Ov={__depends__:[wv,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",xv],gridSnappingParticipantBehavior:["type",_v],gridSnappingLayoutConnectionBehavior:["type",kv]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",uv]};function Pv(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],(function(e){var t=e.element,r=e.gfx;return Mi(t,"bpmn:Lane")?n._createParticipantHit(t,r):Mi(t,"bpmn:Participant")?Yi(t)?n._createParticipantHit(t,r):n._createDefaultHit(t,r):Mi(t,"bpmn:SubProcess")?Yi(t)?n._createSubProcessHit(t,r):n._createDefaultHit(t,r):void 0}))}Pv.$inject=["eventBus","interactionEvents"],Pv.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},Pv.prototype._createParticipantHit=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:30,height:e.height}),!0},Pv.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 Sv={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",Pv]};function Cv(e){e.invoke(ra,this)}e(Cv,ra),Cv.$inject=["injector"],Cv.prototype.registerBindings=function(e,t){function n(n,r){t.isRegistered(n)&&e.addListener(r)}ra.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 Tv={__depends__:[ia],__init__:["keyboardBindings"],keyboardBindings:["type",Cv]},Mv={moveSpeed:1,moveSpeedAccelerated:10},Av="left",Dv="right",Nv="down",Rv={ArrowLeft:Av,Left:Av,ArrowUp:"up",Up:"up",ArrowRight:Dv,Right:Dv,ArrowDown:Nv,Down:Nv},jv={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 $v(e,t,n,r,i){var o=this;this._config=z({},Mv,e||{}),t.addListener(1500,(function(e){var n=e.keyEvent,r=Rv[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=jv[e](s);r.allowed("elements.move",{shapes:o})&&n.moveElements(o,a)}}}$v.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];var Bv={__depends__:[ia,ps],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",$v]};function Iv(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=_n(e);return kn({top:$u("top",n,t),right:$u("right",n,t),bottom:$u("bottom",n,t),left:$u("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:_n(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=wn(i)))return;n.resizeShape(t,i)}}(e.context)}))}function zv(e,t){var n=On(e),r=_n(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 Lv(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"}Iv.prototype.canResize=function(e){var t=this._rules,n=F(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},Iv.prototype.activate=function(e,t,n){var r,i,o=this._dragging;if("string"==typeof n&&(n={direction:n}),!(i=(r=z({shape:t},n)).direction))throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");o.init(e,zv(t,i),"resize",{autoActivate:!0,cursor:Lv(i),data:{shape:t,context:r}})},Iv.prototype.computeMinResizeBox=function(e){var t=e.shape;return function(e,t,n,r){var i=_n(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?_n(r):o;return kn({top:Nu(o.top,s.top),left:Nu(o.left,s.left),bottom:Du(o.bottom,s.bottom),right:Du(o.right,s.right)})}(e.direction,t,e.minDimensions||{width:10,height:10},zu(t,e.childrenBoxPadding))},Iv.$inject=["eventBus","rules","modeling","dragging"];var qv="djs-resizing",Fv="resize-not-ok";function Vv(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,qv)),o.width>5&&Te(s,{x:o.x,width:o.width}),o.height>5&&Te(s,{y:o.y,height:o.height}),r.canExecute?Ae(s).remove(Fv):Ae(s).add(Fv)})),e.on("resize.cleanup",(function(e){var n,r;n=e.context,r=n.shape,n.frame&&Ne(n.frame),t.removeMarker(r,qv)}))}Vv.$inject=["eventBus","canvas","previewSupport"];var Hv=-6,Uv="djs-resizer",Wv=["n","w","s","e","nw","ne","se","sw"];function Xv(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&&b(t,I(i.addResizer,i))})),e.on("shape.changed",(function(e){var t=e.element;n.isSelected(t)&&(i.removeResizers(),i.addResizer(t))}))}Xv.prototype.makeDraggable=function(e,t,n){var r=this._resize;function i(t){Qo(t)&&r.activate(t,e,n)}he.bind(t,"mousedown",i),he.bind(t,"touchstart",i)},Xv.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=Hv);-1!==e.indexOf("s")?t.y=6:-1!==e.indexOf("n")&&(t.y=Hv);return t}(r),s=ze("g");Ae(s).add(Uv),Ae(s).add(Uv+"-"+e.id),Ae(s).add(Uv+"-"+r),Oe(i,s);var a=ze("rect");Te(a,{x:-4+o.x,y:-4+o.y,width:8,height:8}),Ae(a).add(Uv+"-visual"),Oe(s,a);var l=ze("rect");return Te(l,{x:-10+o.x,y:-10+o.y,width:20,height:20}),Ae(l).add(Uv+"-hit"),Oe(s,l),tr(s,t,n),s},Xv.prototype.createResizer=function(e,t){var n=zv(e,t),r=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,r,t)},Xv.prototype.addResizer=function(e){var t=this;!vn(e)&&this._resize.canResize({shape:e})&&b(Wv,(function(n){t.createResizer(e,n)}))},Xv.prototype.removeResizers=function(){Re(this._getResizersParent())},Xv.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},Xv.$inject=["eventBus","canvas","selection","resize"];var Gv={__depends__:[Qc,Hc,ru],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Iv],resizePreview:["type",Vv],resizeHandles:["type",Xv]};function Qv(e,t,n,r,i,o,s){function a(e,t){(t||Ai(e,["bpmn:Task","bpmn:TextAnnotation","bpmn:Participant"])||Yv(e))&&r.activate(e)}this._bpmnFactory=t,this._canvas=n,this._modeling=i,this._textRenderer=s,r.registerProvider(this),e.on("element.dblclick",(function(e){a(e.element,!0)})),e.on(["autoPlace.start","canvas.viewbox.changing","drag.init","element.mousedown","popupMenu.open","root.set","selection.changed"],(function(){r.isActive()&&r.complete()})),e.on(["shape.remove","connection.remove"],2e3,(function(e){r.isActive(e.element)&&r.cancel()})),e.on(["commandStack.changed"],(function(e){r.isActive()&&r.cancel()})),e.on("directEditing.activate",(function(e){o.removeResizers()})),e.on("create.end",500,(function(e){var t=e.context,n=t.shape,r=e.context.canExecute;e.isTouch||r&&(t.hints&&!1===t.hints.createElementsBehavior||a(n))})),e.on("autoPlace.end",500,(function(e){a(e.shape)}))}function Yv(e){return Mi(e,"bpmn:SubProcess")&&!Yi(e)}Qv.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],Qv.prototype.activate=function(e){var t=lo(e);if(void 0!==t){var n={text:t};z(n,this.getEditingBBox(e));var r={};return(Ai(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||Yv(e))&&z(r,{centerVertically:!0}),ro(e)&&z(r,{autoResize:!0}),Mi(e,"bpmn:TextAnnotation")&&z(r,{resizable:!0,autoResize:!0}),z(n,{options:r}),n}},Qv.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,r=t.getAbsoluteBBox(n),i=r.x+r.width/2,o=r.y+r.height/2,s={x:r.x,y:r.y},a=t.zoom(),l=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),p=c.fontSize*a,u=c.lineHeight,d=l.fontSize*a,h=l.lineHeight,f={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(Mi(e,"bpmn:Lane")||function(e){return Mi(e,"bpmn:Participant")&&Yi(e)}(e)){var m=Ki(e);z(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}),z(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 Mi(e,"bpmn:Participant")&&!Yi(e)}(e)){var g=Ki(e);z(s,g?{width:r.width,height:r.height}:{width:r.height,height:r.width,x:i-r.height/2,y:o-r.width/2}),z(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)"})}(Ai(e,["bpmn:Task","bpmn:CallActivity"])||Yv(e))&&(z(s,{width:r.width,height:r.height}),z(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 Mi(e,"bpmn:SubProcess")&&Yi(e)}(e)&&(z(s,{width:r.width,x:r.x}),z(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&&(z(s,{width:y,height:r.height+v+b,x:i-y/2,y:r.y-v}),z(f,{fontSize:p+"px",lineHeight:u,paddingTop:v+"px",paddingBottom:b+"px"})),ro(n)&&!io(n)&&!bn(n)){var w=so(e),x=t.getAbsoluteBBox({x:w.x,y:w.y,width:0,height:0}),_=p+v+b;z(s,{width:y,height:_,x:x.x-y/2,y:x.y-_/2}),z(f,{fontSize:p+"px",lineHeight:u,paddingTop:v+"px",paddingBottom:b+"px"})}return Mi(e,"bpmn:TextAnnotation")&&(z(s,{width:r.width,height:r.height,minWidth:30*a,minHeight:10*a}),z(f,{textAlign:"left",paddingTop:5*a+"px",paddingBottom:7*a+"px",paddingLeft:7*a+"px",paddingRight:5*a+"px",fontSize:d+"px",lineHeight:h})),{bounds:s,style:f}},Qv.prototype.update=function(e,t,n,r){var i,o,s;Mi(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 Kv="djs-element-hidden",Zv="djs-label-hidden";function Jv(e,t,n){var r,i,o,s=this,a=t.getDefaultLayer();e.on("directEditing.activate",(function(e){var l=e.active;if(Mi(r=l.element.label||l.element,"bpmn:TextAnnotation")){i=t.getAbsoluteBBox(r),o=ze("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=ze("path");Te(p,{d:c,strokeWidth:2,stroke:eb(r)}),Oe(o,p),Oe(a,o),nr(o,r.x,r.y)}Mi(r,"bpmn:TextAnnotation")||r.labelTarget?t.addMarker(r,Kv):(Mi(r,"bpmn:Task")||Mi(r,"bpmn:CallActivity")||Mi(r,"bpmn:SubProcess")||Mi(r,"bpmn:Participant"))&&t.addMarker(r,Zv)})),e.on("directEditing.resize",(function(e){if(Mi(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}});Te(s.path,{d:l})}})),e.on(["directEditing.complete","directEditing.cancel"],(function(e){var n=e.active;n&&(t.removeMarker(n.element.label||n.element,Kv),t.removeMarker(r,Zv)),r=void 0,i=void 0,o&&(Ne(o),o=void 0)}))}function eb(e,t){return Ni(e).get("stroke")||t||"black"}Jv.$inject=["eventBus","canvas","pathMap"];var tb={__depends__:[bs,Gv,Ty],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Qv],labelEditingPreview:["type",Jv]},nb=new us("tt");function rb(e,t){e.style.display=!1===t?"none":""}var ib="djs-tooltip",ob="."+ib;function sb(e,t){var n,r;this._eventBus=e,this._canvas=t,this._ids=nb,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=(n=t.getContainer(),Z(r=we('<div class="djs-tooltip-container" />'),{position:"absolute",width:"0",height:"0"}),n.insertBefore(r,n.firstChild),r);var i=this;ge.bind(this._tooltipRoot,ob,"mousedown",(function(e){e.stopPropagation()})),ge.bind(this._tooltipRoot,ob,"mouseover",(function(e){i.trigger("mouseover",e)})),ge.bind(this._tooltipRoot,ob,"mouseout",(function(e){i.trigger("mouseout",e)})),this._init()}sb.$inject=["eventBus","canvas"],sb.prototype.add=function(e){if(!e.position)throw new Error("must specifiy tooltip position");if(!e.html)throw new Error("must specifiy tooltip html");var t=this._ids.next();return e=z({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},sb.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,r=this.get(J(n,"data-tooltip-id"));r&&("mouseover"===e&&r.timeout&&this.clearTimeout(r),"mouseout"===e&&r.timeout&&(r.timeout=1e3,this.setTimeout(r)))},sb.prototype.get=function(e){return"string"!=typeof e&&(e=e.id),this._tooltips[e]},sb.prototype.clearTimeout=function(e){if(e=this.get(e)){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},sb.prototype.setTimeout=function(e){if(e=this.get(e)){this.clearTimeout(e);var t=this;e.removeTimer=setTimeout((function(){t.remove(e)}),e.timeout)}},sb.prototype.remove=function(e){var t=this.get(e);t&&(ke(t.html),ke(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},sb.prototype.show=function(){rb(this._tooltipRoot)},sb.prototype.hide=function(){rb(this._tooltipRoot,!1)},sb.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},sb.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=we(r)),Z(t=we('<div data-tooltip-id="'+n+'" class="'+ib+'">'),{position:"absolute"}),t.appendChild(r),e.type&&te(t).add("djs-tooltip-"+e.type),e.className&&te(t).add(e.className),e.htmlContainer=t,i.appendChild(t),this._tooltips[n]=e,this._updateTooltip(e)},sb.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)},sb.prototype._updateTooltipVisibilty=function(e){b(this._tooltips,(function(t){var n=t.show,r=t.htmlContainer,i=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(i=!1),rb(r,i))}))},sb.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 ab={__init__:["tooltips"],tooltips:["type",sb]};function lb(e,t,n){e.on(["shape.move.rejected","create.rejected"],(function(e){var r,i,o,s=e.context,a=s.shape;Mi(s.target,"bpmn:Collaboration")&&Mi(a,"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:o||2e3,html:"<div>"+i+"</div>"}))}))}lb.$inject=["eventBus","tooltips","translate"];var cb={__depends__:[ab],__init__:["modelingFeedback"],modelingFeedback:["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&&!Ae(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=C(e,"id");return v(e,(function(e){for(;e=e.parent;)if(t[e.id])return!1;return!0}))}(i),z(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(Qo(e)){var t=Ho(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=v(e,(function(t){return!vn(t)||g(e,D({id:t.source.id}))&&g(e,D({id:t.target.id}))}));return t}(s(e));return t}function s(e){var t=_t(e,!0),n=E(t,(function(e){return(e.incoming||[]).concat(e.outgoing||[])}));return r(t.concat(n))}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=e.context,l=a.shapes,c=a.allDraggedElements,p=o(l);if(!a.dragGroup){var u=ze("g");Te(u,n.cls("djs-drag-group",["no-events"])),Oe(t.getActiveLayer(),u),a.dragGroup=u}p.forEach((function(e){i.addDragger(e,a.dragGroup)})),b(c=c?r([c,s(l)]):s(l),(function(e){t.addMarker(e,db)})),a.allDraggedElements=c,a.differentParents=1!==P(C(l,(function(e){return e.parent&&e.parent.id})))})),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&&r&&r.id!==i.id?a(r,mb):a(r,t.canExecute?hb:fb)),nr(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;b(r,(function(e){t.removeMarker(e,db)})),i&&Ne(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__:[ts,ps,rs,Qc,Hc,ru],__init__:["move","movePreview"],move:["type",ub],movePreview:["type",yb]};const bb={width:36,height:50},wb={width:50,height:50};function xb(e,t,n){return ze("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}function _b(e,t){this._styles=t,e.registerProvider(this)}function kb(e,t){var n;return"bpmn:DataObjectReference"===t?n=bb:"bpmn:DataStoreReference"===t&&(n=wb),e.width===n.width&&e.height===n.height}_b.$inject=["outline","styles"],_b.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(!bn(e))return Mi(e,"bpmn:Gateway")?(z((n=ze("rect")).style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),Te(n,z({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):Ai(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group"])?Te(n=ze("rect"),z({x:-5,y:-5,rx:14,width:e.width+10,height:e.height+10},t)):Mi(e,"bpmn:EndEvent")?Te(n=ze("circle"),z({cx:e.width/2,cy:e.height/2,r:e.width/2+5+1},t)):Mi(e,"bpmn:Event")?Te(n=ze("circle"),z({cx:e.width/2,cy:e.height/2,r:e.width/2+5},t)):Mi(e,"bpmn:DataObjectReference")&&kb(e,"bpmn:DataObjectReference")?n=xb("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):Mi(e,"bpmn:DataStoreReference")&&kb(e,"bpmn:DataStoreReference")&&(n=xb("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},_b.prototype.updateOutline=function(e,t){if(!bn(e))return Ai(e,["bpmn:SubProcess","bpmn:Group"])?(Te(t,{width:e.width+10,height:e.height+10}),!0):!!Ai(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};var Eb={__depends__:[rs],__init__:["outlineProvider"],outlineProvider:["type",_b]},Ob=".djs-palette-toggle",Pb=".entry",Sb=Ob+", "+Pb,Cb="djs-palette-",Tb="open",Mb="two-column";function Ab(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 Db(e,t){var n=t.getPaletteEntries();return d(n)?n(e):(b(n,(function(t,n){e[n]=t})),e)}Ab.$inject=["eventBus","canvas"],Ab.prototype.registerProvider=function(e,t){t||(t=e,e=1e3),this._eventBus.on("palette.getProviders",e,(function(e){e.providers.push(t)})),this._rebuild()},Ab.prototype.getEntries=function(){return this._getProviders().reduce(Db,{})},Ab.prototype._rebuild=function(){this._diagramInitialized&&(this._getProviders().length&&(this._container||this._init(),this._update()))},Ab.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),r=this._container=we(Ab.HTML_MARKUP);n.appendChild(r),te(n).add(Cb+"shown"),ge.bind(r,Sb,"click",(function(t){if(ie(t.delegateTarget,Ob))return e.toggle();e.trigger("click",t)})),he.bind(r,"mousedown",(function(e){e.stopPropagation()})),ge.bind(r,Pb,"dragstart",(function(t){e.trigger("dragstart",t)})),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:r})},Ab.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},Ab.prototype._toggleState=function(e){e=e||{};var t,n=this._getParentContainer(),r=this._container,i=this._eventBus,o=te(r),s=te(n);t="twoColumn"in e?e.twoColumn:this._needsCollapse(n.clientHeight,this._entries||{}),o.toggle(Mb,t),s.toggle(Cb+Mb,t),"open"in e&&(o.toggle(Tb,e.open),s.toggle(Cb+Tb,e.open)),i.fire("palette.changed",{twoColumn:t,open:this.isOpen()})},Ab.prototype._update=function(){var e=xe(".djs-palette-entries",this._container),t=this._entries=this.getEntries();re(e),b(t,(function(t,n){var r=t.group||"default",i=xe("[data-group="+Es(r)+"]",e);i||(J(i=we('<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=we(o);if(i.appendChild(s),!t.separator&&(J(s,"data-action",n),t.title&&J(s,"title",t.title),t.className&&function(e,t){var n=te(e),r=c(t)?t:t.split(/\s+/g);r.forEach((function(e){n.add(e)}))}(s,t.className),t.imageUrl)){var a=we("<img>");J(a,"src",t.imageUrl),s.appendChild(a)}})),this.open()},Ab.prototype.trigger=function(e,t,n){var r,i,o=t.delegateTarget||t.target;return o?(r=J(o,"data-action"),i=t.originalEvent||t,this.triggerEntry(r,e,i,n)):t.preventDefault()},Ab.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()}},Ab.prototype._layoutChanged=function(){this._toggleState({})},Ab.prototype._needsCollapse=function(e,t){return e<46*Object.keys(t).length+50},Ab.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},Ab.prototype.open=function(){this._toggleState({open:!0})},Ab.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Ab.prototype.isActiveTool=function(e){return e&&this._activeTool===e},Ab.prototype.updateToolHighlight=function(e){var t;this._toolsContainer||(t=xe(".djs-palette-entries",this._container),this._toolsContainer=xe("[data-group=tools]",t)),b(this._toolsContainer.children,(function(t){var n=t.getAttribute("data-action");if(n){var r=te(t);n=n.replace("-tool",""),r.contains("entry")&&n===e?r.add("highlighted-entry"):r.remove("highlighted-entry")}}))},Ab.prototype.isOpen=function(){return te(this._container).has(Tb)},Ab.prototype._getParentContainer=function(){return this._canvas.getContainer()},Ab.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';var Nb={__init__:["palette"],palette:["type",Ab]},Rb="crosshair";function jb(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();Te(n=e.frame=ze("rect"),{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),Oe(r,n)},c=function(e){var t=e.frame,n=e.bbox;Te(t,{x:n.x,y:n.y,width:n.width,height:n.height})},p=function(e){e.frame&&Ne(e.frame)};o.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",(function(t){var n=t.originalEvent.target;(t.hover||n instanceof SVGElement)&&e.once("lasso.selection.ended",(function(){a.activateLasso(t.originalEvent,!0)}))})),e.on("lasso.end",(function(e){var t=$b(e),n=r.filter((function(e){return e}));a.select(n,t)})),e.on("lasso.start",(function(e){var t=e.context;t.bbox=$b(e),l(t)})),e.on("lasso.move",(function(e){var t=e.context;t.bbox=$b(e),c(t)})),e.on("lasso.cleanup",(function(e){var t=e.context;p(t)})),e.on("element.mousedown",1500,(function(e){if(Ko(e))return a.activateLasso(e.originalEvent),!0}))}function $b(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}}jb.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],jb.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:Rb,data:{context:{}}})},jb.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:Rb,data:{context:{}}})},jb.prototype.select=function(e,t){var n=function(e,t){var n={};return b(e,(function(e){var r=e;r.waypoints&&(r=kt(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(S(n))},jb.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},jb.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};var Bb={__depends__:[Wf,Of],__init__:["lassoTool"],lassoTool:["type",jb]},Ib=1500,zb="grab";function Lb(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",Ib,(function(e){if(Yo(e))return s.activateMove(e.originalEvent,!0),!1})),a&&a.addListener(Ib,(function(e){if(qb(e.keyEvent)&&!s.isActive()){var t=s._mouse.getLastMoveEvent();s.activateMove(t,!!t)}}),"keyboard.keydown"),a&&a.addListener(Ib,(function(e){qb(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!Yo(t)&&n&&e.once("hand.move.ended",(function(e){s.activateHand(e.originalEvent,!0,!0)})),!1}))}function qb(e){return Qs("Space",e)}Lb.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Lb.prototype.activateMove=function(e,t,n){"object"==typeof t&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:zb,data:{context:n||{}}})},Lb.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:zb,data:{context:{reactivate:n}}})},Lb.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Lb.prototype.isActive=function(){var e=this._dragging.context();return!!e&&/^(hand|hand\.move)$/.test(e.prefix)};var Fb={__depends__:[Wf,Of],__init__:["handTool"],handTool:["type",Lb]},Vb="connect-ok",Hb="connect-not-ok";function Ub(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?Vb:Hb))})),e.on(["global-connect.out","global-connect.cleanup"],(function(e){var t=e.context.startTarget,n=e.context.canStartConnect;t&&r.removeMarker(t,n?Vb:Hb)})),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}))}Ub.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],Ub.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},Ub.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},Ub.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Ub.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};var Wb={__depends__:[Kp,Qc,Hc,Wf,Of],globalConnect:["type",Ub]};function Xb(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)}Xb.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],Xb.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(z({type:e},s));s&&(Ni(i).isExpanded=s.isExpanded);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 z(e,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:a("Activate hand tool"),action:{click:function(e){o.activateHand(e)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:a("Activate lasso tool"),action:{click:function(e){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 Gb={__depends__:[Nb,kf,dm,Bb,Fb,Wb,Bo],__init__:["paletteProvider"],paletteProvider:["type",Xb]};function Qb(e,t,n,r,i){ws.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){b(e.canExecute.replacements,(function(o){var s=o.oldElementId,a={type:o.newElementType};if(!e.visualReplacements[s]){var l=t.get(s);z(a,{x:l.x,y:l.y});var c=n.createShape(a);r.addShape(c,l.parent);var p=xe('[data-element-id="'+Es(l.id)+'"]',e.dragGroup);p&&Te(p,{display:"none"});var u=i.addDragger(c,e.dragGroup);e.visualReplacements[s]=u,r.removeShape(c)}}))}(o):function(e){var t=e.visualReplacements;b(t,(function(n,r){var i=xe('[data-element-id="'+Es(r)+'"]',e.dragGroup);i&&Te(i,{display:"inline"}),n.remove(),t[r]&&delete t[r]}))}(o)}))}Qb.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],e(Qb,ws);var Yb={__depends__:[ru],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",Qb]},Kb=40,Zb=20,Jb=10,ew=20,tw=["x","y"],nw=Math.abs;function rw(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&&Gs(e.originalEvent)||(t.initialConnectionStart||(t.initialConnectionStart=t.connectionStart),n&&i&&function(e,t,n){tw.forEach((function(r){var i=sw(r,t);e[r]<t[r]+n?Lp(e,r,t[r]+n):e[r]>t[r]+i-n&&Lp(e,r,t[r]+i-n)}))}(e,i,function(e){return Mi(e,"bpmn:Task")?Jb:Zb}(i)),i&&function(e,t){return k(t,(function(t){return ow(e,t)}))}(n,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(t.connectionStart=Ip(r),Ai(i,["bpmn:Event","bpmn:Gateway"])&&iw(e,Ip(i)),Ai(i,["bpmn:Task","bpmn:SubProcess"])&&function(e,t){var n=Ip(t);tw.forEach((function(r){(function(e,t,n){return e[n]>t[n]+ew&&e[n]<t[n]+sw(n,t)-ew})(e,t,r)&&Lp(e,r,n[r])}))}(e,i),Mi(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=Ip(n),o=Pn(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];nw(r-i[t])<Kb&&(n=r>i[t]?i[t]+Kb:i[t]-Kb,Lp(e,t,n))}))}(e)):ow(n,"bpmn:MessageFlow")?(Mi(r,"bpmn:Event")&&(t.connectionStart=Ip(r)),Mi(i,"bpmn:Event")&&iw(e,Ip(i))):t.connectionStart=t.initialConnectionStart)}))}function iw(e,t){Lp(e,"x",t.x),Lp(e,"y",t.y)}function ow(e,t){return e&&e.type===t}function sw(e,t){return"x"===e?t.width:t.height}function aw(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}function lw(){this._snapValues={}}rw.$inject=["eventBus"],aw.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},aw.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,-1===this._snapLocations.indexOf(e)&&this._snapLocations.push(e)},aw.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},aw.prototype.getSnapLocations=function(){return this._snapLocations},aw.prototype.setSnapLocations=function(e){this._snapLocations=e},aw.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new lw).initDefaults(this._defaultSnaps),n},lw.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)},lw.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],Rp(i-e)<=n)return i}(e[n],i[n],r)},lw.prototype.initDefaults=function(e){var t=this;b(e||{},(function(e,n){b(e,(function(e){t.add(n,e)}))}))};var cw=1250;function pw(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"],cw,(function(e){var t=e.context,i=t.shape,o=t.snapContext,s=t.target;if((!e.originalEvent||!Gs(e.originalEvent))&&!zp(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()}))}pw.$inject=["elementRegistry","eventBus","snapping"],pw.prototype.initSnap=function(e){var t,n=this._elementRegistry,r=e.context,i=r.shape,o=r.snapContext;o||(o=r.snapContext=new aw);var s=(t=n.get(i.id)?Ip(i,e):{x:e.x+Ip(i).x,y:e.y+Ip(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}),bn(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},pw.prototype.addSnapTargetPoints=function(e,t,n){return b(this.getSnapTargets(t,n),(function(n){if(bn(n))bn(t)&&e.add("mid",Ip(n));else if(vn(n)){if(n.waypoints.length<3)return;b(n.waypoints.slice(1,-1),(function(t){e.add("mid",t)}))}else e.add("mid",Ip(n))})),u(t.x)&&u(t.y)?(this._elementRegistry.get(t.id)&&e.add("mid",Ip(t)),e):e},pw.prototype.getSnapTargets=function(e,t){return qp(t).filter((function(e){return!e.hidden}))};function uw(e,t){t.invoke(pw,this),e.on(["create.move","create.end"],1500,dw),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)&&!zp(e)&&function(e,t){var n,r=_n(t),i=Ph(e,t),o=e.context,s=o.shape;n=s.parent?{x:0,y:0}:On(s);/top/.test(i)?Lp(e,"y",r.top-n.y):/bottom/.test(i)&&Lp(e,"y",r.bottom-n.y);/left/.test(i)?Lp(e,"x",r.left-n.x):/right/.test(i)&&Lp(e,"x",r.right-n.x)}(e,r)}))}function dw(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)&&Lp(e,"x",e.x),(n&&n>=e.y||i&&i<=e.y)&&Lp(e,"y",e.y)}}function hw(e,t){return-1!==e.indexOf(t)}function fw(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}e(uw,pw),uw.$inject=["eventBus","injector"],uw.prototype.initSnap=function(e){var t=pw.prototype.initSnap.call(this,e),n=e.shape,r=!!this._elementRegistry.get(n.id);return b(n.outgoing,(function(n){var i=n.waypoints[0];i=i.original||i,t.setSnapOrigin(n.id+"-docking",fw(i,r,e))})),b(n.incoming,(function(n){var i=n.waypoints[n.waypoints.length-1];i=i.original||i,t.setSnapOrigin(n.id+"-docking",fw(i,r,e))})),Mi(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},uw.prototype.addSnapTargetPoints=function(e,t,n){pw.prototype.addSnapTargetPoints.call(this,e,t,n);var r=this.getSnapTargets(t,n);b(r,(function(n){var r;(function(e){if(Mi(e,"bpmn:SubProcess")&&Yi(e))return!0;return Mi(e,"bpmn:Participant")}(n)||(r="bpmn:TextAnnotation",[t,n].every((function(e){return Mi(e,r)}))))&&(e.add("top-left",$p(n)),e.add("bottom-right",Bp(n)))}));var i=this._elementRegistry;return b(t.incoming,(function(n){if(i.get(t.id)){hw(r,n.source)||e.add("mid",On(n.source));var o=n.waypoints[0];e.add(n.id+"-docking",o.original||o)}})),b(t.outgoing,(function(n){if(i.get(t.id)){hw(r,n.target)||e.add("mid",On(n.target));var o=n.waypoints[n.waypoints.length-1];e.add(n.id+"-docking",o.original||o)}})),Mi(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},uw.prototype.getSnapTargets=function(e,t){return pw.prototype.getSnapTargets.call(this,e,t).filter((function(e){return!Mi(e,"bpmn:Lane")}))};function mw(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&&Gs(e.originalEvent)||zp(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)&&Lp(e,"x",e.x),function(e){return"e"===e||"w"===e}(s)&&Lp(e,"y",e.y),t.snap(e,l)}})),e.on(["resize.cleanup"],(function(){t.hide()}))}function gw(e,t){var n=On(e),r=_n(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}mw.prototype.initSnap=function(e){var t=e.context,n=t.shape,r=t.direction,i=t.snapContext;i||(i=t.snapContext=new aw);var o=gw(n,r);return i.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),i},mw.prototype.addSnapTargetPoints=function(e,t,n,r){return b(this.getSnapTargets(t,n),(function(t){e.add("corner",Bp(t)),e.add("corner",$p(t))})),e.add("corner",gw(t,r)),e},mw.$inject=["eventBus","snapping"],mw.prototype.getSnapTargets=function(e,t){return qp(t).filter((function(t){return!(n=t,r=e,n.host===r||vn(t)||function(e){return!!e.hidden}(t)||bn(t));var n,r}))};function yw(e){this._canvas=e,this._asyncHide=B(I(this.hide,this),1e3)}yw.$inject=["canvas"],yw.prototype.snap=function(e,t){var n=e.context.snapContext,r=n.getSnapLocations(),i={x:zp(e,"x"),y:zp(e,"y")};b(r,(function(r){var o=n.getSnapOrigin(r),s={x:e.x+o.x,y:e.y+o.y};if(b(["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),b(["x","y"],(function(t){var n=i[t];p(n)&&Lp(e,t,n.originValue)}))},yw.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=ze("path");return Te(n,{d:"M0,0 L0,0"}),Ae(n).add("djs-snap-line"),Oe(t,n),{update:function(t){u(t)?Te(n,"horizontal"===e?{d:"M-100000,"+t+" L+100000,"+t,display:""}:{d:"M "+t+",-100000 L "+t+", +100000",display:""}):Te(n,{display:"none"})}}},yw.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},yw.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},yw.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},yw.prototype.hide=function(){b(this._snapLines,(function(e){e.update()}))};var vw={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",pw],resizeSnapping:["type",mw],snapping:["type",yw]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",rw],createMoveSnapping:["type",uw]};function bw(e,t,n,r){this._open=!1,this._results=[],this._eventMaps=[],this._canvas=e,this._eventBus=t,this._overlays=n,this._selection=r,this._container=we(bw.BOX_HTML),this._searchInput=xe(bw.INPUT_SELECTOR,this._container),this._resultsContainer=xe(bw.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy"],this.close,this)}function ww(e,t,n){var r=function(e){var t="";return e.forEach((function(e){e.matched?t+='<strong class="'+bw.RESULT_HIGHLIGHT_CLASS+'">'+Ps(e.matched)+"</strong>":t+=Ps(e.normal)})),""!==t?t:null}(t),i=we(n);i.innerHTML=r,e.appendChild(i)}bw.$inject=["canvas","eventBus","overlays","selection"],bw.prototype._bindEvents=function(){var e=this;function t(t,n,r,i){e._eventMaps.push({el:t,type:r,listener:ge.bind(t,n,r,i)})}t(document,"html","click",(function(t){e.close()})),t(this._container,bw.INPUT_SELECTOR,"click",(function(e){e.stopPropagation(),e.delegateTarget.focus()})),t(this._container,bw.RESULT_SELECTOR,"mouseover",(function(t){t.stopPropagation(),e._scrollToNode(t.delegateTarget),e._preselect(t.delegateTarget)})),t(this._container,bw.RESULT_SELECTOR,"click",(function(t){t.stopPropagation(),e._select(t.delegateTarget)})),t(this._container,bw.INPUT_SELECTOR,"keydown",(function(e){Qs("ArrowUp",e)&&e.preventDefault(),Qs("ArrowDown",e)&&e.preventDefault()})),t(this._container,bw.INPUT_SELECTOR,"keyup",(function(t){if(Qs("Escape",t))return e.close();if(Qs("Enter",t)){var n=e._getCurrentResult();return n?e._select(n):e.close()}return Qs("ArrowUp",t)?e._scrollToDirection(!0):Qs("ArrowDown",t)?e._scrollToDirection():void(Qs(["ArrowLeft","ArrowRight"],t)||e._search(t.delegateTarget.value))}))},bw.prototype._unbindEvents=function(){this._eventMaps.forEach((function(e){ge.unbind(e.el,e.type,e.listener)}))},bw.prototype._search=function(e){var t=this;if(this._clearResults(),e&&""!==e){var n=this._searchProvider.find(e);if(n.length){n.forEach((function(e){var n=e.element.id,r=t._createResultNode(e,n);t._results[n]={element:e.element,node:r}}));var r=xe(bw.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(r),this._preselect(r)}}},bw.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},bw.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)}},bw.prototype._clearResults=function(){re(this._resultsContainer),this._results=[],this._resetOverlay(),this._eventBus.fire("searchPad.cleared")},bw.prototype._getCurrentResult=function(){return xe(bw.RESULT_SELECTED_SELECTOR,this._resultsContainer)},bw.prototype._createResultNode=function(e,t){var n=we(bw.RESULT_HTML);return e.primaryTokens.length>0&&ww(n,e.primaryTokens,bw.RESULT_PRIMARY_HTML),ww(n,e.secondaryTokens,bw.RESULT_SECONDARY_HTML),J(n,bw.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},bw.prototype.registerProvider=function(e){this._searchProvider=e},bw.prototype.open=function(){if(!this._searchProvider)throw new Error("no search provider registered");this.isOpen()||(this._bindEvents(),this._open=!0,te(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},bw.prototype.close=function(){this.isOpen()&&(this._unbindEvents(),this._open=!1,te(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._resetOverlay(),this._eventBus.fire("searchPad.closed"))},bw.prototype.toggle=function(){this.isOpen()?this.close():this.open()},bw.prototype.isOpen=function(){return this._open},bw.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&te(t).remove(bw.RESULT_SELECTED_CLASS);var n=J(e,bw.RESULT_ID_ATTRIBUTE),r=this._results[n].element;te(e).add(bw.RESULT_SELECTED_CLASS),this._resetOverlay(r),this._canvas.scrollToElement(r,{top:400}),this._selection.select(r),this._eventBus.fire("searchPad.preselected",r)}},bw.prototype._select=function(e){var t=J(e,bw.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this.close(),this._resetOverlay(),this._canvas.scrollToElement(n,{top:400}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},bw.prototype._resetOverlay=function(e){if(this._overlayId&&this._overlays.remove(this._overlayId),e){var t=function(e){var t=6,n=e.width+2*t,r=e.height+2*t,i={width:n+"px",height:r+"px"},o=we('<div class="'+bw.OVERLAY_CLASS+'"></div>');return Z(o,i),{position:{bottom:r-t,right:n-t},show:!0,html:o}}(kt(e));this._overlayId=this._overlays.add(e,t)}},bw.CONTAINER_SELECTOR=".djs-search-container",bw.INPUT_SELECTOR=".djs-search-input input",bw.RESULTS_CONTAINER_SELECTOR=".djs-search-results",bw.RESULT_SELECTOR=".djs-search-result",bw.RESULT_SELECTED_CLASS="djs-search-result-selected",bw.RESULT_SELECTED_SELECTOR="."+bw.RESULT_SELECTED_CLASS,bw.RESULT_ID_ATTRIBUTE="data-result-id",bw.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",bw.OVERLAY_CLASS="djs-search-overlay",bw.BOX_HTML='<div class="djs-search-container djs-draggable djs-scrollable"><div class="djs-search-input"><input type="text"/></div><div class="djs-search-results"></div></div>',bw.RESULT_HTML='<div class="djs-search-result"></div>',bw.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',bw.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';var xw={__depends__:[ys,ps],searchPad:["type",bw]};function _w(e,t,n){this._elementRegistry=e,this._canvas=n,t.registerProvider(this)}function kw(e){return v(e,(function(e){return!!e.matched})).length>0}function Ew(e,t){var n=[],r=e;if(!e)return n;e=e.toLowerCase(),t=t.toLowerCase();var i=e.indexOf(t);return i>-1?(0!==i&&n.push({normal:r.substr(0,i)}),n.push({matched:r.substr(i,t.length)}),t.length+i<e.length&&n.push({normal:r.substr(t.length+i,e.length)})):n.push({normal:r}),n}_w.$inject=["elementRegistry","searchPad","canvas"],_w.prototype.find=function(e){var t=this._canvas.getRootElement(),n=this._elementRegistry.filter((function(e){return!e.labelTarget}));return n=v(n,(function(e){return e!==t})),n=A(n=v(n=E(n,(function(t){return{primaryTokens:Ew(lo(t),e),secondaryTokens:Ew(t.id,e),element:t}})),(function(e){return kw(e.primaryTokens)||kw(e.secondaryTokens)})),(function(e){return lo(e.element)+e.element.id}))};var Ow={__depends__:[xw],__init__:["bpmnSearch"],bpmnSearch:["type",_w]};function Pw(e){Qi.call(this,e)}e(Pw,Qi),Pw.Viewer=Vs,Pw.NavigatedViewer=ka,Pw.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>')},Pw.prototype._interactionModules=[aa,ga,ja,_a],Pw.prototype._modelingModules=[gc,Dc,Xc,Bc,Up,Kp,Jp,Ky,jf,kf,iv,pv,Ov,Sv,Tv,Bv,tb,by,cb,vb,Eb,Gb,Yb,Gv,vw,Ow],Pw.prototype._modules=[].concat(Vs.prototype._modules,Pw.prototype._interactionModules,Pw.prototype._modelingModules);var Sw={min:.2,max:4};function Cw(e,t,n,r,i){var o=this;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._init();var s=new Ca.Manager(document);s.add(new Ca.Pan),s.on("panmove",u),s.on("panend",d);var a=new Ca.Manager(this._svg);a.add(new Ca.Pan),a.on("panstart",p(!0)),a.add(new Ca.Tap),a.on("tap",(function(e){c(Iw(e))}));var l=new Ca.Manager(this._viewportDom);function c(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 p(e){return function(t){var n=Iw(t);o._state._svgClientRect&&!Nw(o._state._svgClientRect)||(o._state._svgClientRect=o._svg.getBoundingClientRect()),e&&c(n);var i=Tw({x:n.x-o._state._svgClientRect.left,y:n.y-o._state._svgClientRect.top},o._svg,o._lastViewbox),s=r.viewbox(),a=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,s),l=o._viewportDom.getBoundingClientRect(),p={x:n.x-l.left+1,y:n.y-l.top+1};z(o._state,{cachedViewbox:s,initialDragPosition:{x:n.x,y:n.y},isDragging:!0,offsetViewport:a,offsetViewportDom:p,viewportClientRect:o._viewport.getBoundingClientRect(),parentClientRect:o._parent.getBoundingClientRect()}),he.bind(document,"mousemove",u),he.bind(document,"mouseup",d)}}function u(e){var t=Iw(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;z(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});z(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 d(e){var t=Iw(e);o._state.isDragging&&(o._state.initialDragPosition.x===t.x&&o._state.initialDragPosition.y===t.y&&c(e),o._update(),z(o._state,{cachedViewbox:null,initialDragPosition:null,isDragging:!1,offsetViewport:null,offsetViewportDom:null}),he.unbind(document,"mousemove",u),he.unbind(document,"mouseup",d))}l.add(new Ca.Pan),l.on("panstart",p(!1)),this.toggle(e&&e.open||!1),he.bind(this._viewportDom,"mousedown",p(!1)),he.bind(this._svg,"mousedown",p(!0)),he.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()}}})),he.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=z({},{x:e.x,y:e.y,width:e.width,height:e.height});if(n>t){var i=r.width*(1/t);z(r,{y:r.y-(i-r.height)/2,height:i})}else if(n<t){var o=r.height*t;z(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=xe(".children",e);t||Oe(e,t=ze("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");te(t).add("djs-minimap"),e.appendChild(t);var n=this._toggle=document.createElement("div");te(n).add("toggle"),t.appendChild(n);var r=this._map=document.createElement("div");te(r).add("map"),t.appendChild(r);var i=this._svg=ze("svg");Te(i,{width:"100%",height:"100%"}),Oe(r,i),Oe(i,this._elementsGroup=ze("g"));var o=this._viewportGroup=ze("g");Oe(i,o);var s=this._viewport=ze("rect");Ae(s).add("viewport"),Oe(o,s),he.bind(t,"mousedown",(function(e){e.stopPropagation()}));var a=this._viewportDom=document.createElement("div");te(a).add("viewport-dom"),this._parent.appendChild(a);var l=this._overlay=document.createElement("div");te(l).add("overlay"),this._parent.appendChild(l)},Cw.prototype._update=function(){var e=this._canvas.viewbox(),t=e.inner,n=e.outer;if(Bw(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},Te(this._svg,{viewBox:r+", "+i+", "+o+", "+s}),Te(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};z(this._viewportDom.style,{top:u.top+"px",left:u.left+"px",width:u.width+"px",height:u.height+"px"});var d=jw(c,u);z(this._overlay.style,{clipPath:d})}},Cw.prototype.open=function(){z(this._state,{isOpen:!0}),te(this._parent).add("open");var e=this._injector.get("translate",!1)||function(e){return e};J(this._toggle,"title",e("Close minimap")),this._update(),this._eventBus.fire("minimap.toggle",{open:!0})},Cw.prototype.close=function(){z(this._state,{isOpen:!1}),te(this._parent).remove("open");var e=this._injector.get("translate",!1)||function(e){return e};J(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=xe("#"+Es(e.id),this._elementsGroup);n&&(n.id=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=xe("#"+Es(e.parent.id),this._elementsGroup);if(o){var a=function(e,t){var n=xe(".djs-children",t.parentNode);if(!n)return;var r=[].slice.call(n.childNodes),i=-1;return r.forEach((function(t,n){xe(".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),Te(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),Te(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(e.id);t&&Ne(t)},Cw.prototype._createElement=function(e){var t,n=this._elementRegistry.getGraphics(e);if(n&&(t=er(n))){var r=je(t);return Te(r,{id:e.id}),r}},Cw.prototype._clear=function(){Re(this._elementsGroup)};var Rw=Math.sign||function(e){return e>=0?1:-1};function jw(e,t){return"polygon("+[$w(t.left,t.top),$w(t.left+t.width,t.top),$w(t.left+t.width,t.top+t.height),$w(t.left,t.top+t.height),$w(t.left,e.height),$w(e.width,e.height),$w(e.width,0),$w(0,0),$w(0,e.height),$w(t.left,e.height)].join(", ")+")"}function $w(e,t){return e+"px "+t+"px"}function Bw(e){return _(e,(function(e){return p(e)?Bw(e):u(e)&&isFinite(e)}))}function Iw(e){return e.center?e.center:{x:e.clientX,y:e.clientY}}var zw={__init__:["minimap"],minimap:["type",Cw]},Lw=1e5,qw=1e5;function Fw(e,t){this._canvas=e,this._visible=!1;var n=this;t.on("diagram.init",(function(){n._init()})),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=xe("defs",this._canvas._svg);e||(e=ze("defs"),Oe(this._canvas._svg,e));var t=this._pattern=ze("pattern"),n="djs-grid-pattern-"+Math.trunc(1e6*Math.random());Te(t,{id:n,width:dv,height:dv,patternUnits:"userSpaceOnUse"});var r=this._circle=ze("circle");Te(r,{cx:.5,cy:.5,r:.5,fill:"#ccc"}),Oe(t,r),Oe(e,t),Te(this._gfx=ze("rect"),{x:-Lw/2,y:-qw/2,width:Lw,height:qw,fill:`url(#${n})`})},Fw.prototype._centerGridAroundViewbox=function(e){e||(e=this._canvas.viewbox());var t=On(e);Te(this._gfx,{x:-Lw/2+hv(t.x,dv),y:-qw/2+hv(t.y,dv)})},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?Oe(t,this._gfx):Re(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;Oe(t.getLayer("djs-origin",-1),n=Xw("g",{"pointer-events":"none"})),!1!==e.showBorder&&Oe(n,Xw("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"})),Oe(n,Xw("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=Xw("text",{x:-40,y:-10,fill:o,class:Ww("label")})).textContent="(0, 0)",Oe(n,r)}function Uw(e){return e.join(" ")}function Ww(e){return"djs-origin-"+e}function Xw(e,t){var n=ze(e);return Te(n,t),n}Hw.$inject=["config.origin","canvas"];var Gw={__init__:[Hw]},Qw={offset:{x:150,y:75},tolerance:50,alignOnSave:!0};function Yw(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=z({},Qw,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}Yw.$inject=["config.alignToOrigin","injector","eventBus","commandStack","canvas","modeling"];var Kw={__init__:["alignToOrigin"],alignToOrigin:["type",Yw]};function Zw(e){function t(e){if(!e.labelTarget){var t=Di(e);Mi(t,"bpmn:Participant")&&(t=t.processRef),Mi(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)}))}))}Zw.$inject=["eventBus"];var Jw,ex,tx,nx,rx,ix,ox,sx,ax={__init__:[Zw]},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])&&0==(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&&0==(131072&l.__u)?1:0))for(;s>=0||a<t.length;){if(s>=0){if((l=t[s])&&0==(131072&l.__u)&&i==l.key&&o===l.type)return s;s--}if(a<t.length){if((l=t[a])&&0==(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 $x(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 Bx,Ix,zx,Lx,qx=0,Fx=[],Vx=[],Hx=ex.__b,Ux=ex.__r,Wx=ex.diffed,Xx=ex.__c,Gx=ex.unmount;function Qx(e,t){ex.__h&&ex.__h(Ix,e,qx||t),qx=0;var n=Ix.__H||(Ix.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:Vx}),n.__[e]}function Yx(e){return qx=1,Kx(p_,e)}function Kx(e,t,n){var r=Qx(Bx++,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=Ix,!Ix.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))};Ix.u=!0;var o=Ix.shouldComponentUpdate,s=Ix.componentWillUpdate;Ix.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)},Ix.shouldComponentUpdate=i}return r.__N||r.__}function Zx(e,t){var n=Qx(Bx++,3);!ex.__s&&c_(n.__H,t)&&(n.__=e,n.i=t,Ix.__H.__h.push(n))}function Jx(e,t){var n=Qx(Bx++,4);!ex.__s&&c_(n.__H,t)&&(n.__=e,n.i=t,Ix.__h.push(n))}function e_(e){return qx=5,t_((function(){return{current:e}}),[])}function t_(e,t){var n=Qx(Bx++,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=Ix.context[e.__c],n=Qx(Bx++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub(Ix)),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){Ix=null,Hx&&Hx(e)},ex.__r=function(e){Ux&&Ux(e),Bx=0;var t=(Ix=e.__c).__H;t&&(zx===Ix?(t.__h=[],Ix.__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=[],Bx=0)),zx=Ix},ex.diffed=function(e){Wx&&Wx(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==Fx.push(t)&&Lx===ex.requestAnimationFrame||((Lx=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}))),zx=Ix=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)}})),Xx&&Xx(e,t)},ex.unmount=function(e){Gx&&Gx(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=Ix,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),Ix=t}function l_(e){var t=Ix;e.__c=e.__(),Ix=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 $_(){return this.cancelBubble}function B_(){return this.defaultPrevented}ex.event=function(e){return R_&&(e=R_(e)),e.persist=j_,e.isPropagationStopped=$_,e.isDefaultPrevented=B_,e.nativeEvent=e};var I_={enumerable:!1,configurable:!0,get:function(){return this.class}},z_=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",I_)):(t.className&&!t.class||t.class&&t.className)&&(r.class=r.className=t.className),e.props=r}(e),e.$$typeof=C_,z_&&z_(e)};var L_=ex.__r;ex.__r=function(e){L_&&L_(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_={exports:{}};
164
164
  /*!
165
165
  Copyright (c) 2018 Jed Watson.
166
166
  Licensed under the MIT License (MIT), see