Home
last modified time | relevance | path

Searched refs:createConstraints (Results 1 – 5 of 5) sorted by relevance

/plugin/bpmnioeditor/vendor/bpmnio-js/
Dbpmn-modeler.development.js32013 createConstraints = context.createConstraints;
32015 if (!createConstraints) {
32019 if (createConstraints.left) {
32020 event.x = Math.max(event.x, createConstraints.left);
32023 if (createConstraints.right) {
32024 event.x = Math.min(event.x, createConstraints.right);
32027 if (createConstraints.top) {
32028 event.y = Math.max(event.y, createConstraints.top);
32031 if (createConstraints.bottom) {
32032 event.y = Math.min(event.y, createConstraints.bottom);
[all …]
Dbpmn-modeler.production.min.js34createConstraints;t&&(t.left&&(e.x=Math.max(e.x,t.left)),t.right&&(e.x=Math.min(e.x,t.right)),t.to… function
/plugin/diagramsnet/lib/plugins/webcola/
Dcola.min.js3createConstraints(e),f&&c&&void 0!==c.groups){a.forEach(function(a){if(!a.width||!a.height)return …
/plugin/bpmnio/vendor/bpmn-js/dist/
H A Dbpmn-modeler.production.min.js262 </svg>`},Eu=HC;var $C=900;function oi(e,t,n,r){e.registerProvider($C,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=r}oi.$inject=["contextPad","popupMenu","translate","canvas"];oi.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&C(t,this._getEntries(e)),t};oi.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")};oi.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${Eu.align}</div>`,action:{click:function(t,n){var r=e._getMenuPosition(n);C(r,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",r)}}}}};oi.prototype._getMenuPosition=function(e){var t=5,n=this._contextPad.getPad(e).html,r=n.getBoundingClientRect(),i={x:r.left,y:r.bottom+t};return i};N();var zC=["left","center","right","top","middle","bottom"];function Oi(e,t,n,r){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=r,e.registerProvider("align-elements",this)}Oi.$inject=["popupMenu","alignElements","translate","rules"];Oi.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&C(t,this._getEntries(e)),t};Oi.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})};Oi.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,r=this._popupMenu,i={};return E(zC,function(o){i["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:Eu[o],action:function(){t.trigger(e,o),r.close()}}}),i};function Ot(e){k.call(this,e),this.init()}Ot.$inject=["eventBus"];B(Ot,k);Ot.prototype.addRule=function(e,t,n){var r=this;typeof e=="string"&&(e=[e]),e.forEach(function(i){r.canExecute(i,t,function(o,a,s){return n(o)},!0)})};Ot.prototype.init=function(){};N();function ko(e){Ot.call(this,e)}ko.$inject=["eventBus"];B(ko,Ot);ko.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=Q(t,function(r){return!(r.waypoints||r.host||r.labelTarget)});return n=zr(n),n.length<2?!1:n})};var Yv={__depends__:[uv,su,Do],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",oi],alignElementsMenuProvider:["type",Oi],bpmnAlignElements:["type",ko]};N();var GC=10,Pf=50,VC=250;function wu(e,t,n,r){for(var i;i=WC(e,n,t);)n=r(t,n,i);return n}function Su(e){return function(t,n,r){var i={x:n.x,y:n.y};return["x","y"].forEach(function(o){var a=e[o];if(a){var s=o==="x"?"width":"height",c=a.margin,u=a.minDistance;c<0?i[o]=Math.min(r[o]+c-t[s]/2,n[o]-u+c):i[o]=Math.max(r[o]+r[s]+c+t[s]/2,n[o]+u+c)}}),i}}function WC(e,t,n){var r={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},i=UC(e);return re(i,function(o){if(o===n)return!1;var a=He(o,r,GC);return a==="intersect"})}function Xv(e,t){t||(t={});function n(m){return m.source===e?1:-1}var r=t.defaultDistance||Pf,i=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||VC,c=t.reference||"start";o||(o=YC);function u(m,g){return i==="n"?c==="start"?Z(m).top-Z(g).bottom:c==="center"?Z(m).top-X(g).y:Z(m).top-Z(g).top:i==="w"?c==="start"?Z(m).left-Z(g).right:c==="center"?Z(m).left-X(g).x:Z(m).left-Z(g).left:i==="s"?c==="start"?Z(g).top-Z(m).bottom:c==="center"?X(g).y-Z(m).bottom:Z(g).bottom-Z(m).bottom:c==="start"?Z(g).left-Z(m).right:c==="center"?X(g).x-Z(m).right:Z(g).right-Z(m).right}var p=e.incoming.filter(o).map(function(m){var g=a(m),v=g<0?u(m.source,e):u(e,m.source);return{id:m.source.id,distance:v,weight:g}}),l=e.outgoing.filter(o).map(function(m){var g=a(m),v=g>0?u(e,m.target):u(m.target,e);return{id:m.target.id,distance:v,weight:g}}),f=p.concat(l).reduce(function(m,g){return m[g.id+"__weight_"+g.weight]=g,m},{}),d=Ge(f,function(m,g){var v=g.distance,w=g.weight;return v<0||v>s||(m[String(v)]||(m[String(v)]=0),m[String(v)]+=1*w,(!m.distance||m[m.distance]<m[String(v)])&&(m.distance=v)),m},{});return d.distance||r}function UC(e){var t=Rf(e);return e.host&&(t=t.concat(Rf(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,r){return n.concat(Rf(r))},[]))),t}function Rf(e){return KC(e).concat(qC(e))}function qC(e){return e.incoming.map(function(t){return t.source})}function KC(e){return e.outgoing.map(function(t){return t.target})}function YC(){return!0}var XC=100;function Cu(e,t,n){e.on("autoPlace",XC,function(r){var i=r.shape,o=r.source;return ZC(o,i)}),e.on("autoPlace.end",function(r){n.scrollToElement(r.shape)}),this.append=function(r,i,o){e.fire("autoPlace.start",{source:r,shape:i});var a=e.fire("autoPlace",{source:r,shape:i}),s=t.appendShape(r,i,a,r.parent,o);return e.fire("autoPlace.end",{source:r,shape:s}),s}}Cu.$inject=["eventBus","modeling","canvas"];function ZC(e,t,n){n||(n={});var r=n.defaultDistance||Pf,i=X(e),o=Z(e);return{x:o.right+r+t.width/2,y:i.y}}function Ru(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}Ru.$inject=["eventBus","selection"];var Zv={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",Cu],autoPlaceSelectionBehavior:["type",Ru]};N();function kr(e,t){for(st(t)&&(t=[t]);e=e.parent;)if(te(e,t))return e;return null}function Pu(e,t){var n=kr(e,"bpmn:Process");if(n)return!0;var r=["bpmn:Participant","bpmn:Lane"];if(n=kr(e,r),n)return Me(n);if(te(e,r))return Me(e);var i;for(i=j(e);i&&!h(i,"bpmn:Process");i=i.$parent);if(!t)return!0;var o=t.find(function(a){var s=j(a);return s&&s.get("processRef")===i});return o?Me(o):!0}function Au(e,t,n){var r=Pu(e,n);if(h(t,"bpmn:TextAnnotation"))return JC(e,t,r);if(te(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return eR(e,t,r);if(h(t,"bpmn:FlowNode"))return QC(e,t,r)}function QC(e,t,n){var r=Z(e),i=X(e),o=n?{directionHint:"e",minDistance:80,baseOrientation:"left",boundaryOrientation:"top",start:"top",end:"bottom"}:{directionHint:"s",minDistance:90,baseOrientation:"top",boundaryOrientation:"left",start:"left",end:"right"},a=Xv(e,{filter:function(d){return h(d,"bpmn:SequenceFlow")},direction:o.directionHint}),s=30,c=o.minDistance,u=o.baseOrientation;h(e,"bpmn:BoundaryEvent")&&(u=He(e,e.host,-25),u.indexOf(o.boundaryOrientation)!==-1&&(s*=-1));var p=n?{x:r.right+a+t.width/2,y:i.y+Qv(u,c,o)}:{x:i.x+Qv(u,c,o),y:r.bottom+a+t.height/2},l={margin:s,minDistance:c},f=n?{y:l}:{x:l};return wu(e,t,p,Su(f))}function Qv(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function JC(e,t,n){var r=Z(e),i=n?{x:r.right+t.width/2,y:r.top-50-t.height/2}:{x:r.right+50+t.width/2,y:r.bottom+t.height/2};de(e)&&(i=X(e),n?(i.x+=100,i.y-=50):(i.x+=100,i.y+=50));var o={margin:n?-30:30,minDistance:20},a=n?{y:o}:{x:o};return wu(e,t,i,Su(a))}function eR(e,t,n){var r=Z(e),i=n?{x:r.right-10+t.width/2,y:r.bottom+40+t.width/2}:{x:r.left-40-t.width/2,y:r.bottom-10+t.height/2},o={margin:30,minDistance:30},a=n?{x:o}:{y:o};return wu(e,t,i,Su(a))}function Tu(e,t){e.on("autoPlace",function(n){var r=n.shape,i=n.source;return Au(i,r,t)})}Tu.$inject=["eventBus","elementRegistry"];var No={__depends__:[Zv],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",Tu]};N();function $n(e,t,n,r){k.call(this,e),this._elementRegistry=t,this._modeling=n,this._rules=r;var i=this;this.postExecuted(["shape.create"],function(o){var a=o.context,s=a.hints||{},c=a.shape,u=a.parent||a.newParent;s.autoResize!==!1&&i._expand([c],u)}),this.postExecuted(["elements.move"],function(o){var a=o.context,s=_i(Sn(a.closure.topLevel)),c=a.hints,u=c?c.autoResize:!0;if(u!==!1){var p=Vt(s,function(l){return l.parent.id});E(p,function(l,f){q(u)&&(l=l.filter(function(d){return re(u,Ct({id:d.id}))})),i._expand(l,f)})}}),this.postExecuted(["shape.toggleCollapse"],function(o){var a=o.context,s=a.hints,c=a.shape;s&&s.autoResize===!1||c.collapsed||i._expand(c.children||[],c)}),this.postExecuted(["shape.resize"],function(o){var a=o.context,s=a.hints,c=a.shape,u=c.parent;s&&s.autoResize===!1||u&&i._expand([c],u)})}$n.$inject=["eventBus","elementRegistry","modeling","rules"];B($n,k);$n.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),r=this.getPadding(t),i=Z(Ce(e)),o=Z(t),a={};return i.top-o.top<r.top&&(a.top=i.top-n.top),i.left-o.left<r.left&&(a.left=i.left-n.left),o.right-i.right<r.right&&(a.right=i.right+n.right),o.bottom-i.bottom<r.bottom&&(a.bottom=i.bottom+n.bottom),Si(C({},o,a))};$n.prototype._expand=function(e,t){typeof t=="string"&&(t=this._elementRegistry.get(t));var n=this._rules.allowed("element.autoResize",{elements:e,target:t});if(n){var r=this._getOptimalBounds(e,t);if(tR(r,t)){var i=nR(mt(t,["x","y","width","height"]),r);this.resize(t,r,{autoResize:i});var o=t.parent;o&&this._expand([t],o)}}};$n.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}};$n.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}};$n.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function tR(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function nR(e,t){var n="";return e=Z(e),t=Z(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")),n}function Oo(e){e.invoke($n,this)}Oo.$inject=["injector"];B(Oo,$n);Oo.prototype.resize=function(e,t,n){h(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};N();function Bi(e){Ot.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}Bi.$inject=["eventBus"];B(Bi,Ot);Bi.prototype.canResize=function(e,t){return!1};function Bo(e,t){Bi.call(this,e),this._modeling=t}B(Bo,Bi);Bo.$inject=["eventBus","modeling"];Bo.prototype.canResize=function(e,t){if(h(t.di,"bpmndi:BPMNPlane")||!h(t,"bpmn:Participant")&&!h(t,"bpmn:Lane")&&!h(t,"bpmn:SubProcess"))return!1;var n=!0;return E(e,function(r){if(h(r,"bpmn:Lane")||ee(r)){n=!1;return}}),n};var Jv={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",Oo],bpmnAutoResizeProvider:["type",Bo]};var eg=1500;function Mu(e,t,n){var r=this,i=n.get("dragging",!1);function o(a){if(!a.hover){var s=a.originalEvent,c=r._findTargetGfx(s),u=c&&e.get(c);c&&u&&(a.stopPropagation(),i.hover({element:u,gfx:c}),i.move(s))}}i&&t.on("drag.start",function(a){t.once("drag.move",eg,function(s){o(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",eg,function(c){s&&t.fire("element.out",{element:s,gfx:a})}),t.on("element.out",function(){a=null,s=null})})(),this._findTargetGfx=function(a){var s,c;if(a instanceof MouseEvent)return s=An(a),c=document.elementFromPoint(s.x,s.y),rR(c)}}Mu.$inject=["elementRegistry","eventBus","injector"];function rR(e){return Bn(e,"svg, .djs-element",!0)}var tg={__init__:["hoverFix"],hoverFix:["type",Mu]};N();var Io=Math.round,ng="djs-drag-active";function Ii(e){e.preventDefault()}function iR(e){return typeof TouchEvent!="undefined"&&e instanceof TouchEvent}function oR(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Du(e,t,n,r){var i={threshold:5,trapClick:!0},o;function a(x){var b=t.viewbox(),R=t._container.getBoundingClientRect();return{x:b.x+(x.x-R.left)/b.scale,y:b.y+(x.y-R.top)/b.scale}}function s(x,b){b=b||o;var R=e.createEvent(C({},b.payload,b.data,{isTouch:b.isTouch}));return e.fire("drag."+x,R)===!1?!1:e.fire(b.prefix+"."+x,R)}function c(x){var b=x.filter(function(R){return r.get(R.id)});b.length&&n.select(b)}function u(x,b){var R=o.payload,A=o.displacement,O=o.globalStart,T=An(x),I=Dt(T,O),L=o.localStart,W=a(T),z=Dt(W,L);if(!o.active&&(b||oR(I)>o.threshold)){if(C(R,{x:Io(L.x+A.x),y:Io(L.y+A.y),dx:0,dy:0},{originalEvent:x}),s("start")===!1)return v();o.active=!0,o.keepSelection||(R.previousSelection=n.get(),n.select(null)),o.cursor&&Di(o.cursor),t.addMarker(t.getRootElement(),ng)}Wc(x),o.active&&(C(R,{x:Io(W.x+A.x),y:Io(W.y+A.y),dx:Io(z.x),dy:Io(z.y)},{originalEvent:x}),s("move"))}function p(x){var b,R=!0;o.active&&(x&&(o.payload.originalEvent=x,Wc(x)),R=s("end")),R===!1&&s("rejected"),b=w(R!==!0),s("ended",b)}function l(x){Ke("Escape",x)&&(Ii(x),v())}function f(x){var b;o.active&&(b=nu(e),setTimeout(b,400),Ii(x)),p(x)}function d(x){u(x)}function m(x){var b=o.payload;b.hoverGfx=x.gfx,b.hover=x.element,s("hover")}function g(x){s("out");var b=o.payload;b.hoverGfx=null,b.hover=null}function v(x){var b;if(o){var R=o.active;R&&s("cancel"),b=w(x),R&&s("canceled",b)}}function w(x){var b,R;s("cleanup"),tu(),o.trapClick?R=f:R=p,se.unbind(document,"mousemove",u),se.unbind(document,"dragstart",Ii),se.unbind(document,"selectstart",Ii),se.unbind(document,"mousedown",R,!0),se.unbind(document,"mouseup",R,!0),se.unbind(document,"keyup",l),se.unbind(document,"touchstart",d,!0),se.unbind(document,"touchcancel",v,!0),se.unbind(document,"touchmove",u,!0),se.unbind(document,"touchend",p,!0),e.off("element.hover",m),e.off("element.out",g),t.removeMarker(t.getRootElement(),ng);var A=o.payload.previousSelection;return x!==!1&&A&&!n.get().length&&c(A),b=o,o=null,b}function S(x,b,R,A){o&&v(!1),typeof b=="string"&&(A=R,R=b,b=null),A=C({},i,A||{});var O=A.data||{},T,I,L,W,z;if(A.trapClick?W=f:W=p,x?(T=Ar(x)||x,I=An(x),Wc(x),T.type==="dragstart"&&Ii(T)):(T=null,I={x:0,y:0}),L=a(I),b||(b=L),z=iR(T),o=C({prefix:R,data:O,payload:{},globalStart:I,displacement:Dt(b,L),localStart:L,isTouch:z},A),A.manual||(z?(se.bind(document,"touchstart",d,!0),se.bind(document,"touchcancel",v,!0),se.bind(document,"touchmove",u,!0),se.bind(document,"touchend",p,!0)):(se.bind(document,"mousemove",u),se.bind(document,"dragstart",Ii),se.bind(document,"selectstart",Ii),se.bind(document,"mousedown",W,!0),se.bind(document,"mouseup",W,!0)),se.bind(document,"keyup",l),e.on("element.hover",m),e.on("element.out",g)),s("init")===!1)return v(),!1;A.autoActivate&&u(x,!0)}e.on("diagram.destroy",v),this.init=S,this.move=u,this.hover=m,this.out=g,this.end=p,this.cancel=v,this.context=function(){return o},this.setOptions=function(x){C(i,x)}}Du.$inject=["eventBus","canvas","selection","elementRegistry"];var kt={__depends__:[tg,rt],dragging:["type",Du]};N();function ai(e,t,n){this._canvas=n,this._opts=C({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var r=this;t.on("drag.move",function(i){var o=r._toBorderPoint(i);r.startScroll(o)}),t.on(["drag.cleanup"],function(){r.stopScroll()})}ai.$inject=["config.autoScroll","eventBus","canvas"];ai.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 a=0,s=0,c=0;c<4;c++)aR(o[c],n.scrollThresholdOut[c],n.scrollThresholdIn[c])&&(c===0?a=n.scrollStep:c==1?s=n.scrollStep:c==2?a=-n.scrollStep:c==3&&(s=-n.scrollStep));(a!==0||s!==0)&&(t.scroll({dx:a,dy:s}),this._scrolling=setTimeout(function(){r.startScroll(e)},n.scrollRepeatTimeout))};function aR(e,t,n){return t<e&&e<n}ai.prototype.stopScroll=function(){clearTimeout(this._scrolling)};ai.prototype.setOptions=function(e){this._opts=C({},this._opts,e)};ai.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=An(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};var rg={__depends__:[kt],__init__:["autoScroll"],autoScroll:["type",ai]};function Wa(e){this._commandStack=e.get("commandStack",!1)}Wa.$inject=["injector"];Wa.prototype.allowed=function(e,t){var n=!0,r=this._commandStack;return r&&(n=r.canExecute(e,t)),n===void 0?!0:n};var Et={__init__:["rules"],rules:["type",Wa]};N();var ku=Math.round,sR=Math.max;function cR(e,t){var n=e.x,r=e.y;return[["M",n,r],["m",0,-t],["a",t,t,0,1,1,0,2*t],["a",t,t,0,1,1,0,-2*t],["z"]]}function uR(e){var t=[];return e.forEach(function(n,r){t.push([r===0?"M":"L",n.x,n.y])}),t}var ig=10;function pR(e,t){var n,r;for(n=0;r=e[n];n++)if(Gr(r,t)<=ig)return{point:e[n],bendpoint:!0,index:n};return null}function lR(e,t){var n=Da(cR(t,ig),uR(e)),r=n[0],i=n[n.length-1],o;return r?r!==i?r.segment2!==i.segment2?(o=sR(r.segment2,i.segment2)-1,{point:e[o],bendpoint:!0,index:o}):{point:{x:ku(r.x+i.x)/2,y:ku(r.y+i.y)/2},index:r.segment2}:{point:{x:ku(r.x),y:ku(r.y)},index:r.segment2}:null}function Ua(e,t){return pR(e,t)||lR(e,t)}function og(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Af(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function ag(e,t){return t?{x:Math.cos(t)*e.x-Math.sin(t)*e.y,y:Math.sin(t)*e.x+Math.cos(t)*e.y}:e}function fR(e,t,n){var r=[{n:e[0]-n[0],lambda:t[0]},{n:e[1]-n[1],lambda:t[1]}],i=r[0].n*t[0]+r[1].n*t[1],o=r[0].lambda*t[0]+r[1].lambda*t[1];return-i/o}function qa(e,t){var n=t[0],r=t[1],i={x:r.x-n.x,y:r.y-n.y},o=fR([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 Nu(e,t){var n=qa(e,t),r={x:n.x-e.x,y:n.y-e.y};return og(r)}function Li(e,t){return og({x:e.x-t.x,y:e.y-t.y})}var Tf="djs-bendpoint",Mf="djs-segment-dragger";function dR(e,t){var n=An(t),r=e._container.getBoundingClientRect(),i;i={x:r.left,y:r.top};var o=e.viewbox();return{x:o.x+(n.x-i.x)/o.scale,y:o.y+(n.y-i.y)/o.scale}}function Ka(e,t,n){var r=dR(e,n),i=Ua(t,r);return i}function Ya(e,t){var n=U("g");pe(n).add(Tf),J(e,n);var r=U("circle");$(r,{cx:0,cy:0,r:4}),pe(r).add("djs-visual"),J(n,r);var i=U("circle");return $(i,{cx:0,cy:0,r:10}),pe(i).add("djs-hit"),J(n,i),t&&pe(n).add(t),n}function mR(e,t,n,r){var i=U("g");J(e,i);var o=18,a=6,s=11,c=hR(t,n,r),u=a+s,p=U("rect");$(p,{x:-o/2,y:-a/2,width:o,height:a}),pe(p).add("djs-visual"),J(i,p);var l=U("rect");return $(l,{x:-c/2,y:-u/2,width:c,height:u}),pe(l).add("djs-hit"),J(i,l),Rc(i,r==="v"?90:0,0,0),i}function Bu(e,t,n){var r=U("g"),i=Ma(t,n),o=en(t,n);return J(e,r),mR(r,t,n,o),pe(r).add(Mf),pe(r).add(o==="h"?"horizontal":"vertical"),Fe(r,i.x,i.y),r}function Ou(e){return Math.abs(Math.round(e*2/3))}function sg(e,t){var n=vR(e,t);return qa(e,n)}function hR(e,t,n){var r=t.x-e.x,i=t.y-e.y;return Ou(n==="h"?r:i)}function vR(e,t){for(var n=t.waypoints,r=1/0,i,o=0;o<n.length-1;o++){var a=n[o],s=n[o+1],c=Nu(e,[a,s]);c<r&&(r=c,i=o)}return[n[i],n[i+1]]}function Iu(e,t,n,r,i){function o(x,b,R){var A=x.index,O=x.point,T,I,L,W,z,K;return A<=0||x.bendpoint?!1:(T=b[A-1],I=b[A],L=Ma(T,I),W=en(T,I),z=Math.abs(O.x-L.x),K=Math.abs(O.y-L.y),W&&z<=R&&K<=R)}function a(x,b){var R=x.waypoints,A,O,T,I;return b.index<=0||b.bendpoint||(A={start:R[b.index-1],end:R[b.index]},O=en(A.start,A.end),!O)?null:(O==="h"?T=A.end.x-A.start.x:T=A.end.y-A.start.y,I=Ou(T)/2,I)}function s(x,b){var R=b.waypoints,A=Ka(t,R,x),O;if(A){O=a(b,A);var T;if(o(A,R,O)?T=i.start(x,b,A.index):T=r.start(x,b,A.index,!A.bendpoint),T!==!1)return!0}}function c(x,b,R){se.bind(x,b,function(A){n.triggerMouseEvent(b,A,R),A.stopPropagation()})}function u(x,b){var R=t.getLayer("overlays"),A=_e('.djs-bendpoints[data-element-id="'+Rr(x.id)+'"]',R);return!A&&b&&(A=U("g"),$(A,{"data-element-id":x.id}),pe(A).add("djs-bendpoints"),J(R,A),c(A,"mousedown",x),c(A,"click",x),c(A,"dblclick",x)),A}function p(x,b){return _e('.djs-segment-dragger[data-segment-idx="'+x+'"]',b)}function l(x,b){b.waypoints.forEach(function(R,A){var O=Ya(x);J(x,O),Fe(O,R.x,R.y)}),Ya(x,"floating")}function f(x,b){for(var R=b.waypoints,A,O,T,I=1;I<R.length;I++)A=R[I-1],O=R[I],en(A,O)&&(T=Bu(x,A,O),$(T,{"data-segment-idx":I}),c(T,"mousemove",b))}function d(x){E(xi("."+Tf,x),function(b){Pe(b)})}function m(x){E(xi("."+Mf,x),function(b){Pe(b)})}function g(x){var b=u(x);return b||(b=u(x,!0),l(b,x),f(b,x)),b}function v(x){var b=u(x);b&&(m(b),d(b),f(b,x),l(b,x))}function w(x,b){var R=_e(".floating",x),A=b.point;R&&Fe(R,A.x,A.y)}function S(x,b,R){var A=p(b.index,x),O=R[b.index-1],T=R[b.index],I=b.point,L=Ma(O,T),W=en(O,T),z,K;A&&(z=gR(A),K={x:I.x-L.x,y:I.y-L.y},W==="v"&&(K={x:K.y,y:K.x}),Fe(z,K.x,K.y))}e.on("connection.changed",function(x){v(x.element)}),e.on("connection.remove",function(x){var b=u(x.element);b&&Pe(b)}),e.on("element.marker.update",function(x){var b=x.element,R;b.waypoints&&(R=g(b),x.add?pe(R).add(x.marker):pe(R).remove(x.marker))}),e.on("element.mousemove",function(x){var b=x.element,R=b.waypoints,A,O;if(R){if(A=u(b,!0),O=Ka(t,R,x.originalEvent),!O)return;w(A,O),O.bendpoint||S(A,O,R)}}),e.on("element.mousedown",function(x){if(gn(x)){var b=x.originalEvent,R=x.element;if(R.waypoints)return s(b,R)}}),e.on("selection.changed",function(x){var b=x.newSelection,R=b[0];R&&R.waypoints&&g(R)}),e.on("element.hover",function(x){var b=x.element;b.waypoints&&g(b)}),e.on("element.updateId",function(x){var b=x.element,R=x.newId;if(b.waypoints){var A=u(b);A&&$(A,{"data-element-id":R})}}),this.addHandles=g,this.updateHandles=v,this.getBendpointsContainer=u,this.getSegmentDragger=p}Iu.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function gR(e){return _e(".djs-visual",e)}var cg=Math.round,ji="reconnectStart",Fi="reconnectEnd",Xa="updateWaypoints";function Qa(e,t,n,r,i,o){this._injector=e,this.start=function(a,s,c,u){var p=n.getGraphics(s),l=s.source,f=s.target,d=s.waypoints,m;!u&&c===0?m=ji:!u&&c===d.length-1?m=Fi:m=Xa;var g=m===Xa?"connection.updateWaypoints":"connection.reconnect",v=i.allowed(g,{connection:s,source:l,target:f});if(v===!1&&(v=i.allowed(g,{connection:s,source:f,target:l})),v!==!1)return r.init(a,"bendpoint.move",{data:{connection:s,connectionGfx:p,context:{allowed:v,bendpointIndex:c,connection:s,source:l,target:f,insert:u,type:m}}})},t.on("bendpoint.move.hover",function(a){var s=a.context,c=s.connection,u=c.source,p=c.target,l=a.hover,f=s.type;s.hover=l;var d;if(l){var m=f===Xa?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=i.allowed(m,{connection:c,source:f===ji?l:u,target:f===Fi?l:p}),d){s.source=f===ji?l:u,s.target=f===Fi?l:p;return}d===!1&&(d=s.allowed=i.allowed(m,{connection:c,source:f===Fi?l:p,target:f===ji?l:u})),d&&(s.source=f===Fi?l:p,s.target=f===ji?l:u)}}),t.on(["bendpoint.move.out","bendpoint.move.cleanup"],function(a){var s=a.context,c=s.type;s.hover=null,s.source=null,s.target=null,c!==Xa&&(s.allowed=!1)}),t.on("bendpoint.move.end",function(a){var s=a.context,c=s.allowed,u=s.bendpointIndex,p=s.connection,l=s.insert,f=p.waypoints.slice(),d=s.source,m=s.target,g=s.type,v=s.hints||{},w={x:cg(a.x),y:cg(a.y)};if(!c)return!1;g===Xa?(l?f.splice(u,0,w):f[u]=w,v.bendpointMove={insert:l,bendpointIndex:u},f=this.cropWaypoints(p,f),o.updateWaypoints(p,Am(f),v)):(g===ji?(v.docking="source",Za(s)&&(v.docking="target",v.newWaypoints=f.reverse())):g===Fi&&(v.docking="target",Za(s)&&(v.docking="source",v.newWaypoints=f.reverse())),o.reconnect(p,d,m,w,v))},this)}Qa.$inject=["injector","eventBus","canvas","dragging","rules","modeling"];Qa.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};function Za(e){var t=e.hover,n=e.source,r=e.target,i=e.type;if(i===ji)return t&&r&&t===r&&n!==r;if(i===Fi)return t&&n&&t===n&&n!==r}var yR="reconnectStart",_R="reconnectEnd",ug="updateWaypoints",Ja="connect-ok",Lu="connect-not-ok",pg="connect-hover",lg="djs-updating",fg="djs-dragging",dg=1100;function ju(e,t,n,r){this._injector=t;var i=t.get("connectionPreview",!1);n.on("bendpoint.move.start",function(o){var a=o.context,s=a.bendpointIndex,c=a.connection,u=a.insert,p=c.waypoints,l=p.slice();a.waypoints=p,u&&l.splice(s,0,{x:o.x,y:o.y}),c.waypoints=l;var f=a.draggerGfx=Ya(r.getLayer("overlays"));pe(f).add("djs-dragging"),r.addMarker(c,fg),r.addMarker(c,lg)}),n.on("bendpoint.move.hover",function(o){var a=o.context,s=a.allowed,c=a.hover,u=a.type;if(c){if(r.addMarker(c,pg),u===ug)return;s?(r.removeMarker(c,Lu),r.addMarker(c,Ja)):s===!1&&(r.removeMarker(c,Ja),r.addMarker(c,Lu))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],dg,function(o){var a=o.context,s=a.hover,c=a.target;s&&(r.removeMarker(s,pg),r.removeMarker(s,c?Ja:Lu))}),n.on("bendpoint.move.move",function(o){var a=o.context,s=a.allowed,c=a.bendpointIndex,u=a.draggerGfx,p=a.hover,l=a.type,f=a.connection,d=f.source,m=f.target,g=f.waypoints.slice(),v={x:o.x,y:o.y},w=a.hints||{},S={};i&&(w.connectionStart&&(S.connectionStart=w.connectionStart),w.connectionEnd&&(S.connectionEnd=w.connectionEnd),l===yR?Za(a)?(S.connectionEnd=S.connectionEnd||v,S.source=m,S.target=p||d,g=g.reverse()):(S.connectionStart=S.connectionStart||v,S.source=p||d,S.target=m):l===_R?Za(a)?(S.connectionStart=S.connectionStart||v,S.source=p||m,S.target=d,g=g.reverse()):(S.connectionEnd=S.connectionEnd||v,S.source=d,S.target=p||m):(S.noCropping=!0,S.noLayout=!0,g[c]=v),l===ug&&(g=e.cropWaypoints(f,g)),S.waypoints=g,i.drawPreview(a,s,S)),Fe(u,o.x,o.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],dg,function(o){var a=o.context,s=a.connection,c=a.draggerGfx,u=a.hover,p=a.target,l=a.waypoints;s.waypoints=l,Pe(c),r.removeMarker(s,lg),r.removeMarker(s,fg),u&&(r.removeMarker(u,Ja),r.removeMarker(u,p?Ja:Lu)),i&&i.cleanUp(a)})}ju.$inject=["bendpointMove","injector","eventBus","canvas"];var mg="connect-hover",hg="djs-updating";function vg(e,t,n){return Df(e,t,e[t]+n)}function Df(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function bR(e,t,n,r){var i=Math.max(t[r],n[r]),o=Math.min(t[r],n[r]),a=20,s=Math.min(Math.max(o+a,e[r]),i-a);return Df(t,r,s)}function yg(e){return e==="x"?"y":"x"}function gg(e,t,n){var r,i;return e.original?e.original:(r=X(t),i=yg(n),Df(e,i,r[i]))}function Fu(e,t,n,r,i,o){var a=e.get("connectionDocking",!1);this.start=function(l,f,d){var m,g=n.getGraphics(f),v=d-1,w=d,S=f.waypoints,x=S[v],b=S[w],R=Ka(n,S,l),A,O,T;if(A=en(x,b),!!A)return O=A==="v"?"x":"y",v===0&&(x=gg(x,f.source,O)),w===S.length-1&&(b=gg(b,f.target,O)),R?T=R.point:T={x:(x.x+b.x)/2,y:(x.y+b.y)/2},m={connection:f,segmentStartIndex:v,segmentEndIndex:w,segmentStart:x,segmentEnd:b,axis:O,dragPosition:T},r.init(l,T,"connectionSegment.move",{cursor:O==="x"?"resize-ew":"resize-ns",data:{connection:f,connectionGfx:g,context:m}})};function s(l,f){if(!a)return f;var d=l.waypoints,m;return l.waypoints=f,m=a.getCroppedWaypoints(l),l.waypoints=d,m}function c(l){i.update("connection",l.connection,l.connectionGfx)}function u(l,f,d){var m=l.newWaypoints,g=l.segmentStartIndex+f,v=m[g],w=l.segmentEndIndex+f,S=m[w],x=yg(l.axis),b=bR(d,v,S,x);Fe(l.draggerGfx,b.x,b.y)}function p(l,f){var d=0,m=l.filter(function(g,v){return uo(l[v-1],l[v+1],g)?(d=v<=f?d-1:d,!1):!0});return{waypoints:m,segmentOffset:d}}t.on("connectionSegment.move.start",function(l){var f=l.context,d=l.connection,m=n.getLayer("overlays");f.originalWaypoints=d.waypoints.slice(),f.draggerGfx=Bu(m,f.segmentStart,f.segmentEnd),pe(f.draggerGfx).add("djs-dragging"),n.addMarker(d,hg)}),t.on("connectionSegment.move.move",function(l){var f=l.context,d=f.connection,m=f.segmentStartIndex,g=f.segmentEndIndex,v=f.segmentStart,w=f.segmentEnd,S=f.axis,x=f.originalWaypoints.slice(),b=vg(v,S,l["d"+S]),R=vg(w,S,l["d"+S]),A=x.length,O=0;x[m]=b,x[g]=R;var T,I;m<2&&(T=He(d.source,b),m===1?T==="intersect"&&(x.shift(),x[0]=b,O--):T!=="intersect"&&(x.unshift(v),O++)),g>A-3&&(I=He(d.target,R),g===A-2?I==="intersect"&&(x.pop(),x[x.length-1]=R):I!=="intersect"&&x.push(w)),f.newWaypoints=d.waypoints=s(d,x),u(f,O,l),f.newSegmentStartIndex=m+O,c(l)}),t.on("connectionSegment.move.hover",function(l){l.context.hover=l.hover,n.addMarker(l.hover,mg)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(l){var f=l.context.hover;f&&n.removeMarker(f,mg)}),t.on("connectionSegment.move.cleanup",function(l){var f=l.context,d=f.connection;f.draggerGfx&&Pe(f.draggerGfx),n.removeMarker(d,hg)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(l){var f=l.context,d=f.connection;d.waypoints=f.originalWaypoints,c(l)}),t.on("connectionSegment.move.end",function(l){var f=l.context,d=f.connection,m=f.newWaypoints,g=f.newSegmentStartIndex;m=m.map(function(R){return{original:R.original,x:Math.round(R.x),y:Math.round(R.y)}});var v=p(m,g),w=v.waypoints,S=s(d,w),x=v.segmentOffset,b={segmentMove:{segmentStartIndex:f.segmentStartIndex,newSegmentStartIndex:g+x}};o.updateWaypoints(d,S,b)})}Fu.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];N();var xR=Math.abs,_g=Math.round;function bg(e,t,n){n=n===void 0?10:n;var r,i;for(r=0;r<t.length;r++)if(i=t[r],xR(i-e)<=n)return i}function Hu(e){return{x:e.x,y:e.y}}function $u(e){return{x:e.x+e.width,y:e.y+e.height}}function rn(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:_g(e.x+e.width/2),y:_g(e.y+e.height/2)}}function zn(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function ze(e,t,n){if(typeof t!="string")throw new Error("axis must be in [x, y]");if(typeof n!="number"&&n!==!1)throw new Error("value must be Number or false");var r,i=e[t],o=e.snapped=e.snapped||{};return n===!1?o[t]=!1:(o[t]=!0,r=n-i,e[t]+=r,e["d"+t]+=r),i}function zu(e){return e.children||[]}var ER=Math.abs,xg=Math.round,kf=10;function Gu(e){function t(o,a){if(q(o)){for(var s=o.length;s--;)if(ER(o[s]-a)<=kf)return o[s]}else{o=+o;var c=a%o;if(c<kf)return a-c;if(c>o-kf)return a-c+o}return a}function n(o,a){if(o.waypoints)return sg(a,o);if(o.width)return{x:xg(o.width/2+o.x),y:xg(o.height/2+o.y)}}function r(o){var a=o.context,s=a.snapPoints,c=a.connection,u=c.waypoints,p=a.segmentStart,l=a.segmentStartIndex,f=a.segmentEnd,d=a.segmentEndIndex,m=a.axis;if(s)return s;var g=[u[l-1],p,f,u[d+1]];return l<2&&g.unshift(n(c.source,o)),d>u.length-3&&g.unshift(n(c.target,o)),a.snapPoints=s={horizontal:[],vertical:[]},E(g,function(v){v&&(v=v.original||v,m==="y"&&s.horizontal.push(v.y),m==="x"&&s.vertical.push(v.x))}),s}e.on("connectionSegment.move.move",1500,function(o){var a=r(o),s=o.x,c=o.y,u,p;if(a){u=t(a.vertical,s),p=t(a.horizontal,c);var l=s-u,f=c-p;C(o,{dx:o.dx-l,dy:o.dy-f,x:u,y:p}),(l||a.vertical.indexOf(s)!==-1)&&ze(o,"x",u),(f||a.horizontal.indexOf(c)!==-1)&&ze(o,"y",p)}});function i(o){var a=o.snapPoints,s=o.connection.waypoints,c=o.bendpointIndex;if(a)return a;var u=[s[c-1],s[c+1]];return o.snapPoints=a={horizontal:[],vertical:[]},E(u,function(p){p&&(p=p.original||p,a.horizontal.push(p.y),a.vertical.push(p.x))}),a}e.on(["connect.hover","connect.move","connect.end"],1500,function(o){var a=o.context,s=a.hover,c=s&&n(s,o);!de(s)||!c||!c.x||!c.y||(ze(o,"x",c.x),ze(o,"y",c.y))}),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(o){var a=o.context,s=i(a),c=a.hover,u=c&&n(c,o),p=o.x,l=o.y,f,d;if(s){f=t(u?s.vertical.concat([u.x]):s.vertical,p),d=t(u?s.horizontal.concat([u.y]):s.horizontal,l);var m=p-f,g=l-d;C(o,{dx:o.dx-m,dy:o.dy-g,x:o.x-m,y:o.y-g}),(m||s.vertical.indexOf(p)!==-1)&&ze(o,"x",f),(g||s.horizontal.indexOf(l)!==-1)&&ze(o,"y",d)}})}Gu.$inject=["eventBus"];var Eg={__depends__:[kt,Et],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",Iu],bendpointMove:["type",Qa],bendpointMovePreview:["type",ju],connectionSegmentMove:["type",Fu],bendpointSnapping:["type",Gu]};N();function Wu(e,t,n,r){function i(a,s){return r.allowed("connection.create",{source:a,target:s})}function o(a,s){return i(s,a)}e.on("connect.hover",function(a){var s=a.context,c=s.start,u=a.hover,p;if(s.hover=u,p=s.canExecute=i(c,u),!Yn(p)){if(p!==!1){s.source=c,s.target=u;return}p=s.canExecute=o(c,u),!Yn(p)&&p!==!1&&(s.source=u,s.target=c)}}),e.on(["connect.out","connect.cleanup"],function(a){var s=a.context;s.hover=null,s.source=null,s.target=null,s.canExecute=!1}),e.on("connect.end",function(a){var s=a.context,c=s.canExecute,u=s.connectionStart,p={x:a.x,y:a.y},l=s.source,f=s.target;if(!c)return!1;var d=null,m={connectionStart:Vu(s)?p:u,connectionEnd:Vu(s)?u:p};Se(c)&&(d=c),s.connection=n.connect(l,f,d,m)}),this.start=function(a,s,c,u){Se(c)||(u=c,c=X(s)),t.init(a,"connect",{autoActivate:u,data:{shape:s,context:{start:s,connectionStart:c}}})}}Wu.$inject=["eventBus","dragging","modeling","rules"];function Vu(e){var t=e.hover,n=e.source,r=e.target;return t&&n&&t===n&&n!==r}var wR=1100,SR=900,wg="connect-ok",Sg="connect-not-ok";function Uu(e,t,n){var r=e.get("connectionPreview",!1);r&&t.on("connect.move",function(i){var o=i.context,a=o.canExecute,s=o.hover,c=o.source,u=o.start,p=o.startPosition,l=o.target,f=o.connectionStart||p,d=o.connectionEnd||{x:i.x,y:i.y},m=f,g=d;Vu(o)&&(m=d,g=f),r.drawPreview(o,a,{source:c||u,target:l||s,connectionStart:m,connectionEnd:g})}),t.on("connect.hover",SR,function(i){var o=i.context,a=i.hover,s=o.canExecute;s!==null&&n.addMarker(a,s?wg:Sg)}),t.on(["connect.out","connect.cleanup"],wR,function(i){var o=i.hover;o&&(n.removeMarker(o,wg),n.removeMarker(o,Sg))}),r&&t.on("connect.cleanup",function(i){r.cleanUp(i.context)})}Uu.$inject=["injector","eventBus","canvas"];var Lo={__depends__:[rt,Et,kt],__init__:["connectPreview"],connect:["type",Wu],connectPreview:["type",Uu]};N();var CR="djs-dragger";function Gn(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)}Gn.$inject=["injector","canvas","graphicsFactory","elementFactory"];Gn.prototype.drawPreview=function(e,t,n){n=n||{};var r=e.connectionPreviewGfx,i=e.getConnection,o=n.source,a=n.target,s=n.waypoints,c=n.connectionStart,u=n.connectionEnd,p=n.noLayout,l=n.noCropping,f=n.noNoop,d,m=this;if(r||(r=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),_r(r),i||(i=e.getConnection=RR(function(g,v,w){return m.getConnection(g,v,w)})),t&&(d=i(t,o,a)),!d){!f&&this.drawNoopPreview(r,n);return}d.waypoints=s||[],this._layouter&&!p&&(d.waypoints=this._layouter.layoutConnection(d,{source:o,target:a,connectionStart:c,connectionEnd:u,waypoints:n.waypoints||d.waypoints})),(!d.waypoints||!d.waypoints.length)&&(d.waypoints=[o?X(o):c,a?X(a):u]),this._connectionDocking&&(o||a)&&!l&&(d.waypoints=this._connectionDocking.getCroppedWaypoints(d,o,a)),this._graphicsFactory.drawConnection(r,d,{stroke:"var(--element-dragger-color)"})};Gn.prototype.drawNoopPreview=function(e,t){var n=t.source,r=t.target,i=t.connectionStart||X(n),o=t.connectionEnd||X(r),a=this.cropWaypoints(i,o,n,r),s=this.createNoopConnection(a[0],a[1]);J(e,s)};Gn.prototype.cropWaypoints=function(e,t,n,r){var i=this._graphicsFactory,o=n&&i.getShapePath(n),a=r&&i.getShapePath(r),s=i.getConnectionPath({waypoints:[e,t]});return e=n&&qr(o,s,!0)||e,t=r&&qr(a,s,!1)||t,[e,t]};Gn.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&Pe(e.connectionPreviewGfx)};Gn.prototype.getConnection=function(e){var t=PR(e);return this._elementFactory.createConnection(t)};Gn.prototype.createConnectionPreviewGfx=function(){var e=U("g");return $(e,{pointerEvents:"none"}),pe(e).add(CR),J(this._canvas.getActiveLayer(),e),e};Gn.prototype.createNoopConnection=function(e,t){return Xn([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function RR(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 PR(e){return Se(e)?e:{}}var Cg={__init__:["connectionPreview"],connectionPreview:["type",Gn]};var AR=new or("ps"),TR=["marker-start","marker-mid","marker-end"],MR=["circle","ellipse","line","path","polygon","polyline","path","rect"];function cr(e,t,n,r){this._elementRegistry=e,this._canvas=n,this._styles=r}cr.$inject=["elementRegistry","eventBus","canvas","styles"];cr.prototype.cleanUp=function(){console.warn("PreviewSupport#cleanUp is deprecated and will be removed in future versions. You do not need to manually clean up previews anymore. cf. https://github.com/bpmn-io/diagram-js/pull/906")};cr.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)};cr.prototype.addDragger=function(e,t,n,r="djs-dragger"){n=n||this.getGfx(e);var i=Sl(n),o=n.getBoundingClientRect();return this._cloneMarkers(Ln(i),r),$(i,this._styles.cls(r,[],{x:o.top,y:o.left})),J(t,i),$(i,"data-preview-support-element-id",e.id),i};cr.prototype.addFrame=function(e,t){var n=U("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return J(t,n),$(n,"data-preview-support-element-id",e.id),n};cr.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var r=this;e.childNodes&&e.childNodes.forEach(i=>{r._cloneMarkers(i,t,n)}),OR(e)&&TR.forEach(function(i){if($(e,i)){var o=DR(e,i,r._canvas.getContainer());o&&r._cloneMarker(n,e,o,i,t)}})};cr.prototype._cloneMarker=function(e,t,n,r,i="djs-dragger"){var o=[n.id,i,AR.next()].join("-"),a=_e("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||Sl(n);s.id=o,pe(s).add(i);var c=_e(":scope > defs",e);c||(c=U("defs"),J(e,c)),J(c,s);var u=NR(s.id);$(t,r,u)};function DR(e,t,n){var r=kR($(e,t));return _e("marker#"+r,n||document)}function kR(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function NR(e){return"url(#"+e+")"}function OR(e){return MR.indexOf(e.nodeName)!==-1}var Dn={__init__:["previewSupport"],previewSupport:["type",cr]};var qu="complex-preview",jo=class{constructor(t,n,r){this._canvas=t,this._graphicsFactory=n,this._previewSupport=r,this._markers=[]}create(t){this.cleanUp();let{created:n=[],moved:r=[],removed:i=[],resized:o=[]}=t,a=this._canvas.getLayer(qu);n.filter(s=>!BR(s)).forEach(s=>{let c;de(s)?(c=this._graphicsFactory._createContainer("connection",U("g")),this._graphicsFactory.drawConnection(Ln(c),s)):(c=this._graphicsFactory._createContainer("shape",U("g")),this._graphicsFactory.drawShape(Ln(c),s),Fe(c,s.x,s.y)),this._previewSupport.addDragger(s,a,c)}),r.forEach(({element:s,delta:c})=>{this._previewSupport.addDragger(s,a,void 0,"djs-dragging"),this._canvas.addMarker(s,"djs-element-hidden"),this._markers.push([s,"djs-element-hidden"]);let u=this._previewSupport.addDragger(s,a);de(s)?Fe(u,c.x,c.y):Fe(u,s.x+c.x,s.y+c.y)}),i.forEach(s=>{this._previewSupport.addDragger(s,a,void 0,"djs-dragging"),this._canvas.addMarker(s,"djs-element-hidden"),this._markers.push([s,"djs-element-hidden"])}),o.forEach(({shape:s,bounds:c})=>{this._canvas.addMarker(s,"djs-hidden"),this._markers.push([s,"djs-hidden"]),this._previewSupport.addDragger(s,a,void 0,"djs-dragging");let u=this._graphicsFactory._createContainer("shape",U("g"));this._graphicsFactory.drawShape(Ln(u),s,{width:c.width,height:c.height}),Fe(u,c.x,c.y),this._previewSupport.addDragger(s,a,u)})}cleanUp(){_r(this._canvas.getLayer(qu)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(qu)}hide(){this._canvas.hideLayer(qu)}};jo.$inject=["canvas","graphicsFactory","previewSupport"];function BR(e){return e.hidden}var Rg={__depends__:[Dn],__init__:["complexPreview"],complexPreview:["type",jo]};var Nf=["top","bottom","left","right"],Ku=10;function es(e,t){k.call(this,e),this.postExecuted(["connection.create","connection.layout","connection.updateWaypoints"],function(i){var o=i.context,a=o.connection,s=a.source,c=a.target,u=o.hints||{};u.createElementsBehavior!==!1&&(n(s),n(c))}),this.postExecuted(["label.create"],function(i){var o=i.context,a=o.shape,s=o.hints||{};s.createElementsBehavior!==!1&&n(a.labelTarget)}),this.postExecuted(["elements.create"],function(i){var o=i.context,a=o.elements,s=o.hints||{};s.createElementsBehavior!==!1&&a.forEach(function(c){n(c)})});function n(i){if(Xr(i)&&!de(i)){var o=jR(i);o&&r(i,o)}}function r(i,o){var a=X(i),s=i.label,c=X(s);if(s.parent){var u=Z(i),p;switch(o){case"top":p={x:a.x,y:u.top-Ku-s.height/2};break;case"left":p={x:u.left-Ku-s.width/2,y:a.y};break;case"bottom":p={x:a.x,y:u.bottom+Ku+s.height/2};break;case"right":p={x:u.right+Ku+s.width/2,y:a.y};break}var l=Dt(p,c);t.moveShape(s,l)}}}B(es,k);es.$inject=["eventBus","modeling"];function IR(e){var t=e.host,n=X(e),r=He(n,t),i;r.indexOf("-")>=0?i=r.split("-"):i=[r];var o=Nf.filter(function(a){return i.indexOf(a)===-1});return o}function LR(e){var t=X(e),n=[].concat(e.incoming.map(function(r){return r.waypoints[r.waypoints.length-2]}),e.outgoing.map(function(r){return r.waypoints[1]})).map(function(r){return Pg(t,r)});return n}function jR(e){var t=X(e.label),n=X(e),r=Pg(n,t);if(FR(r)){var i=LR(e);if(e.host){var o=IR(e);i=i.concat(o)}var a=Nf.filter(function(s){return i.indexOf(s)===-1});return a.indexOf(r)!==-1?He(e.label,e)!=="intersect"?void 0:r:a[0]}}function Pg(e,t){return He(t,e,5)}function FR(e){return Nf.indexOf(e)!==-1}function ts(e){k.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,r=t.shape;t.position||(h(r,"bpmn:TextAnnotation")?t.position={x:n.x+n.width/2+75,y:n.y-50-r.height/2}:t.position={x:n.x+n.width+80+r.width/2,y:n.y+n.height/2})},!0)}B(ts,k);ts.$inject=["eventBus"];N();var HR=1500;function ns(e,t,n){e.invoke(k,this),this.preExecute("elements.delete",HR,function(i){var o=i.context,a=o.elements,s=r(a);s.length&&(o.elements=a.concat(s))}),t.on("shape.move.start",function(i){var o=i.context.shapes,a=r(o);a.length&&(i.context.shapes=o.concat(a))});function r(i){var o=Q(i,u=>h(u,"bpmn:Participant")||h(u,"bpmn:SubProcess"));if(!o.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(u=>h(u,"bpmn:Artifact"))),c=new Set;return E(o,u=>{let p=new Set(Sn(wi(Array.from(s),Ce(u))));c=c.union(p),s=s.difference(p)}),Array.from(c)}}B(ns,k);ns.$inject=["injector","eventBus","canvas"];N();function rs(e,t){e.invoke(k,this),this.postExecute("shape.move",function(n){var r=n.newParent,i=n.shape,o=Q(i.incoming.concat(i.outgoing),function(a){return h(a,"bpmn:Association")});E(o,function(a){t.moveConnection(a,{x:0,y:0},r)})},!0)}B(rs,k);rs.$inject=["injector","modeling"];var Ag=500;function Fo(e,t){t.invoke(k,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Ag,function(r){var i=r.elements;i=i.filter(function(o){var a=o.host;return Tg(o,a)}),i.length===1&&i.map(function(o){return i.indexOf(o)}).forEach(function(o){var a=i[o];r.elements[o]=n._replaceShape(i[o],a)})},!0),this.preExecute("elements.move",Ag,function(r){var i=r.shapes,o=r.newHost;if(i.length===1){var a=i[0];Tg(a,o)&&(r.shapes=[n._replaceShape(a,o)])}},!0)}Fo.$inject=["bpmnReplace","injector"];B(Fo,k);Fo.prototype._replaceShape=function(e,t){var n=$R(e),r={type:"bpmn:BoundaryEvent",host:t};return n&&(r.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,r,{layoutConnection:!1})};function $R(e){var t=j(e),n=t.eventDefinitions;return n&&n[0]}function Tg(e,t){return!ee(e)&&te(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}N();function is(e,t){k.call(this,e);function n(r){return Q(r.attachers,function(i){return h(i,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(r){var i=r.context.source,o=r.context.target,a=n(o);h(i,"bpmn:EventBasedGateway")&&h(o,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(r){var i=r.context.oldSource,o=r.context.newSource;h(i,"bpmn:Gateway")&&h(o,"bpmn:EventBasedGateway")&&E(o.outgoing,function(a){var s=a.target,c=n(s);h(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}is.$inject=["eventBus","modeling"];B(is,k);function as(e,t,n){k.call(this,e),this.preExecute("shape.replace",s,!0),this.postExecuted("shape.replace",c,!0),this.preExecute("connection.create",i,!0),this.postExecuted("connection.delete",r,!0),this.postExecuted("connection.reconnect",o,!0),this.postExecuted("element.updateProperties",a,!0);function r(v){let w=v.source,S=v.target;Ho(w)&&os(S)&&p(S)}function i(v){let w=v.connection,S=v.source,x=v.target;Ho(S)&&Yu(x)&&(u(x),f(S,[w]))}function o(v){let w=v.newTarget,S=v.oldSource,x=v.oldTarget;if(x!==w){let b=S;os(x)&&p(x),Ho(b)&&Yu(w)&&u(w)}}function a(v){let{element:w}=v;os(w)?(l(w),d(w)):Yu(w)&&m(w)}function s(v){let{newData:w,oldShape:S}=v;if(Ho(v.oldShape)&&w.eventDefinitionType!=="bpmn:CompensateEventDefinition"||w.type!=="bpmn:BoundaryEvent"){let x=S.outgoing.find(({target:b})=>os(b));x&&x.target&&(v._connectionTarget=x.target)}else if(!Ho(v.oldShape)&&w.eventDefinitionType==="bpmn:CompensateEventDefinition"&&w.type==="bpmn:BoundaryEvent"){let x=S.outgoing.find(({target:b})=>Yu(b));x&&x.target&&(v._connectionTarget=x.target),g(S)}}function c(v){let{_connectionTarget:w,newShape:S}=v;w&&t.connect(S,w)}function u(v){t.updateProperties(v,{isForCompensation:!0})}function p(v){t.updateProperties(v,{isForCompensation:void 0})}function l(v){for(let w of v.incoming)n.canConnect(w.source,v)||t.removeConnection(w);for(let w of v.outgoing)n.canConnect(v,w.target)||t.removeConnection(w)}function f(v,w){v.outgoing.filter(b=>h(b,"bpmn:Association")).filter(b=>os(b.target)&&!w.includes(b)).forEach(b=>t.removeConnection(b))}function d(v){let w=v.attachers.slice();w.length&&t.removeElements(w)}function m(v){let w=v.incoming.filter(S=>Ho(S.source));t.removeElements(w)}function g(v){let w=v.outgoing.filter(S=>h(S,"bpmn:SequenceFlow"));t.removeElements(w)}}B(as,k);as.$inject=["eventBus","modeling","bpmnRules"];function os(e){let t=j(e);return t&&t.get("isForCompensation")}function Ho(e){return e&&h(e,"bpmn:BoundaryEvent")&&Er(e,"bpmn:CompensateEventDefinition")}function Yu(e){return e&&h(e,"bpmn:Activity")&&!Qe(e)}function ss(e){e.invoke(k,this),this.preExecute("shape.create",1500,function(t){var n=t.context,r=n.parent,i=n.shape;h(r,"bpmn:Lane")&&!h(i,"bpmn:Lane")&&(n.parent=kr(r,"bpmn:Participant"))})}ss.$inject=["injector"];B(ss,k);function cs(e,t){k.call(this,e),this.preExecute("shape.create",function(n){var a;var r=n.context,i=r.shape;if(h(i,"bpmn:DataObjectReference")&&i.type!=="label"){var o=t.create("bpmn:DataObject");o.isCollection=((a=i.businessObject.dataObjectRef)==null?void 0:a.isCollection)||!1,i.businessObject.dataObjectRef=o}})}cs.$inject=["eventBus","bpmnFactory"];B(cs,k);N();var Of=20,Bf=20,Mg=30,Xu=2e3;function us(e,t,n){k.call(this,t),t.on(["create.start","shape.move.start"],Xu,function(i){var o=i.context,a=o.shape,s=e.getRootElement();if(!(!h(a,"bpmn:Participant")||!h(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(l){return!h(l,"bpmn:Group")&&!ee(l)&&!de(l)});if(c.length){var u=Ce(c),p=zR(a,u);C(a,p),o.createConstraints=GR(a,u)}}}),t.on("create.start",Xu,function(i){var o=i.context,a=o.shape,s=e.getRootElement(),c=e.getGraphics(s);function u(p){p.element=s,p.gfx=c}h(a,"bpmn:Participant")&&h(s,"bpmn:Process")&&(t.on("element.hover",Xu,u),t.once("create.cleanup",function(){t.off("element.hover",u)}))});function r(){var i=e.getRootElement();return h(i,"bpmn:Collaboration")?i:n.makeCollaboration()}this.preExecute("elements.create",Xu,function(i){var o=i.elements,a=i.parent,s=VR(o),c;s&&h(a,"bpmn:Process")&&(i.parent=r(),c=i.hints=i.hints||{},c.participant=s,c.process=a,c.processRef=j(s).get("processRef"))},!0),this.preExecute("shape.create",function(i){var o=i.parent,a=i.shape;h(a,"bpmn:Participant")&&h(o,"bpmn:Process")&&(i.parent=r(),i.process=o,i.processRef=j(a).get("processRef"))},!0),this.execute("shape.create",function(i){var o=i.hints||{},a=i.process||o.process,s=i.shape,c=o.participant;a&&(!c||s===c)&&j(s).set("processRef",j(a))},!0),this.revert("shape.create",function(i){var o=i.hints||{},a=i.process||o.process,s=i.processRef||o.processRef,c=i.shape,u=o.participant;a&&(!u||c===u)&&j(c).set("processRef",s)},!0),this.postExecute("shape.create",function(i){var o=i.hints||{},a=i.process||i.hints.process,s=i.shape,c=o.participant;if(a){var u=a.children.slice();c?s===c&&n.moveElements(u,{x:0,y:0},c):n.moveElements(u,{x:0,y:0},s)}},!0)}us.$inject=["canvas","eventBus","modeling"];B(us,k);function zR(e,t){t={width:t.width+Of*2+Mg,height:t.height+Bf*2};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}}function GR(e,t){return t=Z(t),{bottom:t.top+e.height/2-Bf,left:t.right-e.width/2+Of,top:t.bottom-e.height/2+Bf,right:t.left+e.width/2-Of-Mg}}function VR(e){return re(e,function(t){return h(t,"bpmn:Participant")})}N();var Dg="__targetRef_placeholder";function ps(e,t){k.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],kg(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],kg(o));function n(a,s,c){var u=a.get("dataInputAssociations");return re(u,function(p){return p!==c&&p.targetRef===s})}function r(a,s){var c=a.get("properties"),u=re(c,function(p){return p.name===Dg});return!u&&s&&(u=t.create("bpmn:Property",{name:Dg}),Ae(c,u)),u}function i(a,s){var c=r(a);c&&(n(a,c,s)||Oe(a.get("properties"),c))}function o(a){var s=a.context,c=s.connection,u=c.businessObject,p=c.target,l=p&&p.businessObject,f=s.newTarget,d=f&&f.businessObject,m=s.oldTarget||s.target,g=m&&m.businessObject,v=c.businessObject,w;g&&g!==l&&i(g,u),d&&d!==l&&i(d,u),l?(w=r(l,!0),v.targetRef=w):v.targetRef=null}}ps.$inject=["eventBus","bpmnFactory"];B(ps,k);function kg(e){return function(t){var n=t.context,r=n.connection;if(h(r,"bpmn:DataInputAssociation"))return e(t)}}function $o(e){this._bpmnUpdater=e}$o.$inject=["bpmnUpdater"];$o.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),[]};$o.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),[]};function ls(e,t,n,r){k.call(this,r),t.registerHandler("dataStore.updateContainment",$o);function i(){return n.filter(function(s){return h(s,"bpmn:Participant")&&j(s).processRef})[0]}function o(s){return s.children.filter(function(c){return h(c,"bpmn:DataStoreReference")&&!c.labelTarget})}function a(s,c){var u=s.businessObject||s;if(c=c||i(),c){var p=c.businessObject||c;t.execute("dataStore.updateContainment",{dataStoreBo:u,dataStoreDi:ce(s),newSemanticParent:p.processRef||p,newDiParent:ce(c)})}}this.preExecute("shape.create",function(s){var c=s.context,u=c.shape;h(u,"bpmn:DataStoreReference")&&u.type!=="label"&&(c.hints||(c.hints={}),c.hints.autoResize=!1)}),this.preExecute("elements.move",function(s){var c=s.context,u=c.shapes,p=u.filter(function(l){return h(l,"bpmn:DataStoreReference")});p.length&&(c.hints||(c.hints={}),c.hints.autoResize=u.filter(function(l){return!h(l,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,u=c.shape,p=u.parent;h(u,"bpmn:DataStoreReference")&&u.type!=="label"&&h(p,"bpmn:Collaboration")&&a(u)}),this.postExecute("shape.move",function(s){var c=s.context,u=c.shape,p=c.oldParent,l=u.parent;if(!h(p,"bpmn:Collaboration")&&h(u,"bpmn:DataStoreReference")&&u.type!=="label"&&h(l,"bpmn:Collaboration")){var f=h(p,"bpmn:Participant")?p:UR(p,"bpmn:Participant");a(u,f)}}),this.postExecute("shape.delete",function(s){var c=s.context,u=c.shape,p=e.getRootElement();te(u,["bpmn:Participant","bpmn:SubProcess"])&&h(p,"bpmn:Collaboration")&&o(p).filter(function(l){return WR(l,u)}).forEach(function(l){a(l)})}),this.postExecute("canvas.updateRoot",function(s){var c=s.context,u=c.oldRoot,p=c.newRoot,l=o(u);l.forEach(function(f){h(p,"bpmn:Process")&&a(f,p)})})}ls.$inject=["canvas","commandStack","elementRegistry","eventBus"];B(ls,k);function WR(e,t){for(var n=e.businessObject||e,r=t.businessObject||t;n.$parent;){if(n.$parent===r.processRef||r)return!0;n=n.$parent}return!1}function UR(e,t){for(;e.parent;){if(h(e.parent,t))return e.parent;e=e.parent}}N();var Qu=Math.max,Ju=Math.min,qR=20;function ep(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function Ng(e,t,n){var r=n.x,i=n.y,o={x:e.x,y:e.y,width:e.width,height:e.height};return t.indexOf("n")!==-1?(o.y=e.y+i,o.height=e.height-i):t.indexOf("s")!==-1&&(o.height=e.height+i),t.indexOf("e")!==-1?o.width=e.width+r:t.indexOf("w")!==-1&&(o.x=e.x+r,o.width=e.width-r),o}function Og(e,t){return{x:e.x+(t.left||0),y:e.y+(t.top||0),width:e.width-(t.left||0)+(t.right||0),height:e.height-(t.top||0)+(t.bottom||0)}}function Zu(e,t,n){var r=t[e],i=n.min&&n.min[e],o=n.max&&n.max[e];return ne(i)&&(r=(/top|left/.test(e)?Ju:Qu)(r,i)),ne(o)&&(r=(/top|left/.test(e)?Qu:Ju)(r,o)),r}function Bg(e,t){if(!t)return e;var n=Z(e);return Si({top:Zu("top",n,t),right:Zu("right",n,t),bottom:Zu("bottom",n,t),left:Zu("left",n,t)})}function Ig(e,t,n,r){var i=Z(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},a=r?Z(r):o,s={top:Ju(o.top,a.top),left:Ju(o.left,a.left),bottom:Qu(o.bottom,a.bottom),right:Qu(o.right,a.right)};return Si(s)}function fs(e,t){return typeof e!="undefined"?e:qR}function KR(e,t){var n,r,i,o;return typeof t=="object"?(n=fs(t.left),r=fs(t.right),i=fs(t.top),o=fs(t.bottom)):n=r=i=o=fs(t),{x:e.x-n,y:e.y-i,width:e.width+n+r,height:e.height+i+o}}function YR(e){return!(e.waypoints||e.type==="label")}function tp(e,t){var n;if(e.length===void 0?n=Q(e.children,YR):n=e,n.length)return KR(Ce(n),t)}var si=Math.abs;function XR(e,t){return ep(Z(t),Z(e))}var ZR=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],on=30;function zo(e,t){return t=t||[],e.children.filter(function(n){h(n,"bpmn:Lane")&&(zo(n,t),t.push(n))}),t}function yn(e){return e.children.filter(function(t){return h(t,"bpmn:Lane")})}function Bt(e){return kr(e,ZR)||e}function Lg(e,t){var n=Bt(e),r=h(n,"bpmn:Process")?[]:[n],i=zo(n,r),o=Z(e),a=Z(t),s=XR(e,t),c=[],u=Me(e);return i.forEach(function(p){if(p!==e){var l=u?0:s.top,f=u?s.right:0,d=u?0:s.bottom,m=u?s.left:0,g=Z(p);s.top&&(si(g.bottom-o.top)<10&&(d=a.top-g.bottom),si(g.top-o.top)<5&&(l=a.top-g.top)),s.left&&(si(g.right-o.left)<10&&(f=a.left-g.right),si(g.left-o.left)<5&&(m=a.left-g.left)),s.bottom&&(si(g.top-o.bottom)<10&&(l=a.bottom-g.top),si(g.bottom-o.bottom)<5&&(d=a.bottom-g.bottom)),s.right&&(si(g.left-o.right)<10&&(m=a.right-g.left),si(g.right-o.right)<5&&(f=a.right-g.right)),(l||f||d||m)&&c.push({shape:p,newBounds:Og(p,{top:l,right:f,bottom:d,left:m})})}}),c}var QR=500;function ds(e,t){k.call(this,e);function n(r,i){var o=Me(r),a=yn(i),s=[],c=[],u=[],p=[];if(In(a,function(v){return o?v.y>r.y?c.push(v):s.push(v):v.x>r.x?p.push(v):u.push(v),v.children}),!!a.length){var l;o?c.length&&s.length?l=r.height/2:l=r.height:p.length&&u.length?l=r.width/2:l=r.width;var f,d,m,g;s.length&&(f=t.calculateAdjustments(s,"y",l,r.y-10),t.makeSpace(f.movingShapes,f.resizingShapes,{x:0,y:l},"s")),c.length&&(d=t.calculateAdjustments(c,"y",-l,r.y+r.height+10),t.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:-l},"n")),u.length&&(m=t.calculateAdjustments(u,"x",l,r.x-10),t.makeSpace(m.movingShapes,m.resizingShapes,{x:l,y:0},"e")),p.length&&(g=t.calculateAdjustments(p,"x",-l,r.x+r.width+10),t.makeSpace(g.movingShapes,g.resizingShapes,{x:-l,y:0},"w"))}}this.postExecuted("shape.delete",QR,function(r){var i=r.context,o=i.hints,a=i.shape,s=i.oldParent;h(a,"bpmn:Lane")&&(o&&o.nested||n(a,s))})}ds.$inject=["eventBus","spaceTool"];B(ds,k);var jg=500;function Go(e,t){t.invoke(k,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",jg,function(r){var i=r.elements;i.filter(function(o){var a=o.host;return Fg(o,a)}).map(function(o){return i.indexOf(o)}).forEach(function(o){r.elements[o]=n._replaceShape(i[o])})},!0),this.preExecute("elements.move",jg,function(r){var i=r.shapes,o=r.newHost;i.forEach(function(a,s){var c=a.host;Fg(a,eP(i,c)?c:o)&&(i[s]=n._replaceShape(a))})},!0)}Go.$inject=["bpmnReplace","injector"];B(Go,k);Go.prototype._replaceShape=function(e){var t=JR(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function JR(e){var t=j(e),n=t.eventDefinitions;return n&&n[0]}function Fg(e,t){return!ee(e)&&h(e,"bpmn:BoundaryEvent")&&!t}function eP(e,t){return e.indexOf(t)!==-1}N();function ms(e,t,n){k.call(this,e);function r(i,o,a){var s=o.waypoints,c,u,p,l,f,d,m,g=i.outgoing.slice(),v=i.incoming.slice(),w;ne(a.width)?w=X(a):w=a;var S=Ua(s,w);if(S){if(c=s.slice(0,S.index),u=s.slice(S.index+(S.bendpoint?1:0)),!c.length||!u.length)return;p=S.bendpoint?s[S.index]:w,(c.length===1||!Hg(i,c[c.length-1]))&&c.push($g(p)),(u.length===1||!Hg(i,u[0]))&&u.unshift($g(p))}l=o.source,f=o.target,t.canConnect(l,i,o)&&(n.reconnectEnd(o,i,c||w),d=o),t.canConnect(i,f,o)&&(d?m=n.connect(i,f,{type:o.type,waypoints:u}):(n.reconnectStart(o,i,u||w),m=o));var x=[].concat(d&&Q(v,function(b){return b.source===d.source})||[],m&&Q(g,function(b){return b.target===m.target})||[]);x.length&&n.removeElements(x)}this.preExecute("elements.move",function(i){var o=i.newParent,a=i.shapes,s=i.delta,c=a[0];if(!(!c||!o)){o&&o.waypoints&&(i.newParent=o=o.parent);var u=X(c),p={x:u.x+s.x,y:u.y+s.y},l=re(o.children,function(f){var d=t.canInsert(a,f);return d&&Ua(f.waypoints,p)});l&&(i.targetFlow=l,i.position=p)}},!0),this.postExecuted("elements.move",function(i){var o=i.shapes,a=i.targetFlow,s=i.position;a&&r(o[0],a,s)},!0),this.preExecute("shape.create",function(i){var o=i.parent,a=i.shape;t.canInsert(a,o)&&(i.targetFlow=o,i.parent=o.parent)},!0),this.postExecuted("shape.create",function(i){var o=i.shape,a=i.targetFlow,s=i.position;a&&r(o,a,s)},!0)}B(ms,k);ms.$inject=["eventBus","bpmnRules","modeling"];function Hg(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 $g(e){return C({},e)}function hs(e,t){k.call(this,e),this.preExecuted("connection.create",function(n){var r=n.context,i=r.connection,o=r.source,a=r.target,s=r.hints;if(!(s&&s.createElementsBehavior===!1)&&Vo(i)){var c=[];h(o,"bpmn:EventBasedGateway")?c=a.incoming.filter(u=>u!==i&&Vo(u)):c=a.incoming.filter(u=>u!==i&&Vo(u)&&h(u.source,"bpmn:EventBasedGateway")),c.forEach(function(u){t.removeConnection(u)})}}),this.preExecuted("shape.replace",function(n){var r=n.context,i=r.newShape;if(h(i,"bpmn:EventBasedGateway")){var o=i.outgoing.filter(Vo).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);o.forEach(function(a){a.incoming.filter(Vo).forEach(function(s){let c=a.incoming.filter(Vo).filter(function(u){return u.source===i});(s.source!==i||c.length>1)&&t.removeConnection(s)})})}})}hs.$inject=["eventBus","modeling"];B(hs,k);function Vo(e){return h(e,"bpmn:SequenceFlow")}var np=1500,zg=2e3;function rp(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"],np,function(r){var i=r.context,o=i.shape||r.shape,a=r.hover;h(a,"bpmn:Lane")&&!te(o,["bpmn:Lane","bpmn:Participant"])&&(r.hover=Bt(a),r.hoverGfx=e.getGraphics(r.hover));var s=n.getRootElement();a!==s&&(o.labelTarget||te(o,["bpmn:Group","bpmn:TextAnnotation"]))&&(r.hover=s,r.hoverGfx=e.getGraphics(r.hover))}),t.on(["connect.hover","connect.out","connect.end","connect.cleanup","global-connect.hover","global-connect.out","global-connect.end","global-connect.cleanup"],np,function(r){var i=r.hover;h(i,"bpmn:Lane")&&(r.hover=Bt(i)||i,r.hoverGfx=e.getGraphics(r.hover))}),t.on(["bendpoint.move.hover"],np,function(r){var i=r.context,o=r.hover,a=i.type;h(o,"bpmn:Lane")&&/reconnect/.test(a)&&(r.hover=Bt(o)||o,r.hoverGfx=e.getGraphics(r.hover))}),t.on(["connect.start"],np,function(r){var i=r.context,o=i.start;h(o,"bpmn:Lane")&&(i.start=Bt(o)||o)}),t.on("shape.move.start",zg,function(r){var i=r.shape;h(i,"bpmn:Lane")&&(r.shape=Bt(i)||i)}),t.on("spaceTool.move",zg,function(r){var i=r.hover;i&&h(i,"bpmn:Lane")&&(r.hover=Bt(i))})}rp.$inject=["elementRegistry","eventBus","canvas"];function Gg(e){return e.create("bpmn:Category")}function Vg(e){return e.create("bpmn:CategoryValue")}function Wg(e,t,n){return Ae(t.get("categoryValue"),e),e.$parent=t,Ae(n.get("rootElements"),t),t.$parent=n,e}function Ug(e){var t=e.$parent;return t&&(Oe(t.get("categoryValue"),e),e.$parent=null),e}function qg(e){var t=e.$parent;return t&&(Oe(t.get("rootElements"),e),e.$parent=null),e}var Kg=770;function vs(e,t,n,r,i,o){i.invoke(k,this);function a(){return n.filter(function(m){return h(m,"bpmn:Group")})}function s(m,g){return m.some(function(v){var w=j(v),S=w.categoryValueRef&&w.categoryValueRef.$parent;return S===g})}function c(m,g){return m.some(function(v){var w=j(v);return w.categoryValueRef===g})}function u(m,g,v){var w=a().filter(function(S){return S.businessObject!==v});g&&!s(w,g)&&qg(g),m&&!c(w,m)&&Ug(m)}function p(m,g){return Wg(m,g,t.getDefinitions())}function l(m,g){var v=j(m),w=v.categoryValueRef;w||(w=v.categoryValueRef=g.categoryValue=g.categoryValue||Vg(e));var S=w.$parent;S||(S=w.$parent=g.category=g.category||Gg(e)),p(w,S,t.getDefinitions())}function f(m,g){var v=g.category,w=g.categoryValue,S=j(m);w?(S.categoryValueRef=null,u(w,v,S)):u(null,S.categoryValueRef.$parent,S)}this.execute("label.create",function(m){var g=m.context,v=g.labelTarget;h(v,"bpmn:Group")&&l(v,g)}),this.revert("label.create",function(m){var g=m.context,v=g.labelTarget;h(v,"bpmn:Group")&&f(v,g)}),this.execute("shape.delete",function(m){var g=m.context,v=g.shape,w=j(v);if(!(!h(v,"bpmn:Group")||v.labelTarget)){var S=g.categoryValue=w.categoryValueRef,x;S&&(x=g.category=S.$parent,u(S,x,w),w.categoryValueRef=null)}}),this.reverted("shape.delete",function(m){var g=m.context,v=g.shape;if(!(!h(v,"bpmn:Group")||v.labelTarget)){var w=g.category,S=g.categoryValue,x=j(v);S&&(x.categoryValueRef=S,p(S,w))}}),this.execute("shape.create",function(m){var g=m.context,v=g.shape;!h(v,"bpmn:Group")||v.labelTarget||j(v).categoryValueRef&&l(v,g)}),this.reverted("shape.create",function(m){var g=m.context,v=g.shape;!h(v,"bpmn:Group")||v.labelTarget||j(v).categoryValueRef&&f(v,g)});function d(m,g){var v=e.create(m.$type);return o.copyElement(m,v,null,g)}r.on("copyPaste.copyElement",Kg,function(m){var g=m.descriptor,v=m.element;if(!(!h(v,"bpmn:Group")||v.labelTarget)){var w=j(v);if(w.categoryValueRef){var S=w.categoryValueRef;g.categoryValue=d(S,!0),S.$parent&&(g.category=d(S.$parent,!0))}}}),r.on("copyPaste.pasteElement",Kg,function(m){var g=m.descriptor,v=g.businessObject,w=g.categoryValue,S=g.category;w&&(w=v.categoryValueRef=d(w)),S&&(w.$parent=d(S)),delete g.category,delete g.categoryValue})}vs.$inject=["bpmnFactory","bpmnjs","elementRegistry","eventBus","injector","moddleCopy"];B(vs,k);function Wo(e,t,n,r){var i,o,a,s,c;return i=(r.y-n.y)*(t.x-e.x)-(r.x-n.x)*(t.y-e.y),i==0?null:(o=e.y-n.y,a=e.x-n.x,c=(r.x-n.x)*o-(r.y-n.y)*a,s=c/i,{x:Math.round(e.x+s*(t.x-e.x)),y:Math.round(e.y+s*(t.y-e.y))})}function ip(e){function t(r,i,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=Wo(r,i,o,a),u=Wo(r,i,o,s),p;c&&u?Yg(c,o)>Yg(u,o)?p=u:p=c:p=c||u,r.original=p}function n(r){var i=r.waypoints;t(i[0],i[1],X(r.source)),t(i[i.length-1],i[i.length-2],X(r.target))}e.on("bpmnElement.added",function(r){var i=r.element;i.waypoints&&n(i)})}ip.$inject=["eventBus"];function Yg(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function gs(e){k.call(this,e);var t=["bpmn:Participant","bpmn:Lane"];this.executed(["shape.move","shape.create","shape.resize"],function(n){var r=n.context.shape,i=j(r),o=ce(r);if(te(i,t)){var a=o.get("isHorizontal");a===void 0&&(a=!0),o.set("isHorizontal",a)}})}gs.$inject=["eventBus"];B(gs,k);N();var ey=Math.sqrt,ty=Math.min,tP=Math.max,Xg=Math.abs;function Zg(e){return Math.pow(e,2)}function ys(e,t){return ey(Zg(e.x-t.x)+Zg(e.y-t.y))}function ny(e,t){var n=0,r,i,o,a,s,c,u,p,l,f,d;for(n=0;n<t.length-1;n++){if(r=t[n],i=t[n+1],Jg(r,i)?u=[r]:(o=ys(e,r),a=ys(e,i),c=ty(o,a),u=nP(r,i,e,c)),u.length<1)throw new Error("expected between [1, 2] circle -> line intersections");u.length===1&&(p={type:"bendpoint",position:u[0],segmentIndex:n,bendpointIndex:Jg(r,u[0])?n:n+1}),u.length===2&&(s=iP(u[0],u[1]),p={type:"segment",position:s,segmentIndex:n,relativeLocation:ys(r,s)/ys(r,i)}),l=ys(p.position,e),(!d||f>l)&&(d=p,f=l)}return d}function nP(e,t,n,r){var i=t.x-e.x,o=t.y-e.y,a=n.x-e.x,s=n.y-e.y,c=i*i+o*o,u=i*a+o*s,p=a*a+s*s-r*r,l=u/c,f=p/c,d=l*l-f;if(d<0&&d>-1e-6&&(d=0),d<0)return[];var m=ey(d),g=-l+m,v=-l-m,w={x:e.x-i*g,y:e.y-o*g};if(d===0)return[w];var S={x:e.x-i*v,y:e.y-o*v};return[w,S].filter(function(x){return rP(x,e,t)})}function rP(e,t,n){return Qg(e.x,t.x,n.x)&&Qg(e.y,t.y,n.y)}function Qg(e,t,n){return e>=ty(t,n)-op&&e<=tP(t,n)+op}function iP(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var op=.1;function Jg(e,t){return Xg(e.x-t.x)<=op&&Xg(e.y-t.y)<=op}function iy(e,t,n,r){var i=n.segmentIndex,o=t.length-e.length;if(r.segmentMove){var a=r.segmentMove.segmentStartIndex,s=r.segmentMove.newSegmentStartIndex;return i===a?s:i>=s?i+o<s?s:i+o:i}if(r.bendpointMove){var c=r.bendpointMove.insert,u=r.bendpointMove.bendpointIndex,p;if(o===0)return i;if(i>=u&&(p=c?i+1:i-1),i<u&&(p=i,c&&n.type!=="bendpoint"&&u-1===i)){var l=oy(t,u);l<n.relativeLocation&&p++}return p}return o===0?i:r.connectionStart&&i===0?0:r.connectionEnd&&i===e.length-2?t.length-2:Math.floor((t.length-2)/2)}function ap(e,t,n,r){var i=0,o=0,a={point:e,delta:{x:0,y:0}},s=ny(e,n),c=s.segmentIndex,u=iy(n,t,s,r);if(u<0||u>t.length-2||u===null)return a;var p=ry(n,c),l=ry(t,u),f=s.position,d=aP(p,f),m=oP(p,l);if(s.type==="bendpoint"){var g=t.length-n.length,v=s.bendpointIndex,w=n[v];if(t.indexOf(w)!==-1)return a;if(g===0){var S=t[v];return i=S.x-s.position.x,o=S.y-s.position.y,{delta:{x:i,y:o},point:{x:e.x+i,y:e.y+o}}}g<0&&v!==0&&v<n.length-1&&(d=oy(n,v))}var x={x:(l[1].x-l[0].x)*d+l[0].x,y:(l[1].y-l[0].y)*d+l[0].y},b=ag({x:e.x-f.x,y:e.y-f.y},m);return i=x.x+b.x-e.x,o=x.y+b.y-e.y,{point:Rn(x),delta:Rn({x:i,y:o})}}function oy(e,t){var n=Li(e[t-1],e[t]),r=Li(e[t],e[t+1]),i=n/(n+r);return i}function oP(e,t){var n=Af(e),r=Af(t);return r-n}function ry(e,t){return[e[t],e[t+1]]}function aP(e,t){var n=Li(e[0],e[1]),r=Li(e[0],t);return n===0?0:r/n}function ay(e,t,n,r){var i=X(e);return ap(i,t,n,r).delta}function Hi(e,t,n){var r=So(t),i=So(n),o=Dt(e,r),a={x:o.x*(n.width/t.width),y:o.y*(n.height/t.height)};return Rn({x:i.x+a.x,y:i.y+a.y})}function If(e,t,n){var r=So(e),i=So(t),o=So(n),a=Dt(e,r),s=Dt(r,i),c=sP(r,t,n);if(c)return c;var u={x:s.x*(n.width/t.width),y:s.y*(n.height/t.height)},p={x:o.x+u.x,y:o.y+u.y};return Rn({x:p.x+a.x-e.x,y:p.y+a.y-e.y})}function sP(e,t,n){var r=Z(t),i=Z(n);if(cP(r,i))return null;var o=He(t,e),a,s,c;if(o==="top")a={x:0,y:i.bottom-r.bottom};else if(o==="bottom")a={x:0,y:i.top-r.top};else if(o==="right")a={x:i.left-r.left,y:0};else if(o==="left")a={x:i.right-r.right,y:0};else return null;return s={x:e.x+a.x,y:e.y+a.y},c=He(n,s),c!==o?null:a}function cP(e,t){return uP(e,t)||pP(e,t)}function uP(e,t){return e.right!==t.right&&e.left!==t.left}function pP(e,t){return e.top!==t.top&&e.bottom!==t.bottom}N();var sy="name",cy="text";function _s(e,t,n,r){k.call(this,e),this.postExecute("element.updateProperties",i),this.postExecute("element.updateModdleProperties",a=>{j(a.context.element)===a.context.moddleElement&&i(a)});function i(a){var s=a.context,c=s.element,u=s.properties;if(sy in u&&t.updateLabel(c,u[sy]),cy in u&&h(c,"bpmn:TextAnnotation")){var p=r.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},u[cy]||"");t.updateLabel(c,u.text,p)}}this.postExecute(["shape.create","connection.create"],function(a){var s=a.context,c=s.hints||{};if(c.createElementsBehavior!==!1){var u=s.shape||s.connection;ee(u)||!mn(u)||gt(u)&&t.updateLabel(u,gt(u))}}),this.postExecute("shape.delete",function(a){var s=a.context,c=s.labelTarget,u=s.hints||{};c&&u.unsetLabel!==!1&&t.updateLabel(c,null,null,{removeShape:!1})});function o(a){var s=a.context,c=s.connection,u=c.label,p=C({},s.hints),l=s.newWaypoints||c.waypoints,f=s.oldWaypoints;return typeof p.startChanged=="undefined"&&(p.startChanged=!!p.connectionStart),typeof p.endChanged=="undefined"&&(p.endChanged=!!p.connectionEnd),ay(u,l,f,p)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(a){var s=a.context,c=s.hints||{};if(c.labelBehavior!==!1){var u=s.connection,p=u.label,l;!p||!p.parent||(l=o(a),t.moveShape(p,l))}}),this.postExecute(["shape.replace"],function(a){var s=a.context,c=s.newShape,u=s.oldShape,p=j(c);p&&mn(p)&&u.label&&c.label&&(c.label.x=u.label.x,c.label.y=u.label.y)}),this.preExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.hints||{};if(!(!ee(c)||u.autoResize)){var p=s.newBounds,l=r.getDimensions(gt(c)||"",{box:p,style:r.getExternalStyle()}),f=Math.ceil(l.height),d=p.y!==c.y,m=c.y+c.height;s.newBounds={width:p.width,height:f,x:p.x,y:d?m-f:p.y}}}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.newBounds,p=s.oldBounds;if(Xr(c)){var l=c.label,f=X(l),d=dP(p),m=fP(f,d),g=lP(m,p,u);t.moveShape(l,g)}})}B(_s,k);_s.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function lP(e,t,n){var r=Hi(e,t,n);return Rn(Dt(r,e))}function fP(e,t){if(t.length){var n=mP(e,t);return qa(e,n)}}function dP(e){return[[{x:e.x,y:e.y},{x:e.x+(e.width||0),y:e.y}],[{x:e.x+(e.width||0),y:e.y},{x:e.x+(e.width||0),y:e.y+(e.height||0)}],[{x:e.x,y:e.y+(e.height||0)},{x:e.x+(e.width||0),y:e.y+(e.height||0)}],[{x:e.x,y:e.y},{x:e.x,y:e.y+(e.height||0)}]]}function mP(e,t){var n=t.map(function(i){return{line:i,distance:Nu(e,i)}}),r=At(n,"distance");return r[0].line}N();function uy(e,t,n,r){return ap(e,t,n,r).point}function bs(e,t){k.call(this,e);function n(r,i){var o=r.context,a=o.connection,s=C({},o.hints),c=o.newWaypoints||a.waypoints,u=o.oldWaypoints;return typeof s.startChanged=="undefined"&&(s.startChanged=!!s.connectionStart),typeof s.endChanged=="undefined"&&(s.endChanged=!!s.connectionEnd),uy(i,c,u,s)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(r){var i=r.context,o=i.connection,a=o.outgoing,s=o.incoming;s.forEach(function(c){var u=c.waypoints[c.waypoints.length-1],p=n(r,u),l=[].concat(c.waypoints.slice(0,-1),[p]);t.updateWaypoints(c,l)}),a.forEach(function(c){var u=c.waypoints[0],p=n(r,u),l=[].concat([p],c.waypoints.slice(1));t.updateWaypoints(c,l)})}),this.postExecute(["connection.move"],function(r){var i=r.context,o=i.connection,a=o.outgoing,s=o.incoming,c=i.delta;s.forEach(function(u){var p=u.waypoints[u.waypoints.length-1],l={x:p.x+c.x,y:p.y+c.y},f=[].concat(u.waypoints.slice(0,-1),[l]);t.updateWaypoints(u,f)}),a.forEach(function(u){var p=u.waypoints[0],l={x:p.x+c.x,y:p.y+c.y},f=[].concat([l],u.waypoints.slice(1));t.updateWaypoints(u,f)})})}B(bs,k);bs.$inject=["eventBus","modeling"];N();function ci(e,t,n){var r=sp(e),i=ly(r,t),o=r[0];return i.length?i[i.length-1]:Hi(o.original||o,n,t)}function ui(e,t,n){var r=sp(e),i=ly(r,t),o=r[r.length-1];return i.length?i[0]:Hi(o.original||o,n,t)}function Uo(e,t,n){var r=sp(e),i=py(t,n),o=r[0];return Hi(o.original||o,i,t)}function qo(e,t,n){var r=sp(e),i=py(t,n),o=r[r.length-1];return Hi(o.original||o,i,t)}function py(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function sp(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function ly(e,t){var n=je(e,vP);return Q(n,function(r){return hP(r,t)})}function hP(e,t){return He(t,e,1)==="intersect"}function vP(e){return e.original||e}function xs(e,t){k.call(this,e),this.postExecute("shape.replace",function(n){var r=n.oldShape,i=n.newShape;if(gP(r,i)){var o=yP(r);o.incoming.forEach(function(a){var s=ui(a,i,r);t.reconnectEnd(a,i,s)}),o.outgoing.forEach(function(a){var s=ci(a,i,r);t.reconnectStart(a,i,s)})}},!0)}xs.$inject=["eventBus","modeling"];B(xs,k);function gP(e,t){return h(e,"bpmn:Participant")&&ie(e)&&h(t,"bpmn:Participant")&&!ie(t)}function yP(e){var t=Zn([e],!1),n=[],r=[];return t.forEach(function(i){i!==e&&(i.incoming.forEach(function(o){h(o,"bpmn:MessageFlow")&&n.push(o)}),i.outgoing.forEach(function(o){h(o,"bpmn:MessageFlow")&&r.push(o)}))},[]),{incoming:n,outgoing:r}}var _P=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function cp(e){let t=j(e);if(!h(t,"bpmn:BoundaryEvent")&&!(h(t,"bpmn:StartEvent")&&Qe(t.$parent)))return!1;let n=t.get("eventDefinitions");return!n||!n.length?!1:_P.some(r=>h(n[0],r))}function up(e){return h(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function Es(e,t){e.invoke(k,this),this.postExecuted("shape.replace",function(n){let r=n.context.oldShape,i=n.context.newShape,o=n.context.hints;if(!cp(i))return;let a=up(i);if(o.targetElement&&o.targetElement[a]!==void 0)return;let c=j(r).get(a),u=j(i).get(a);c!==u&&t.updateProperties(i,{[a]:c})})}Es.$inject=["injector","modeling"];B(Es,k);function ws(e,t){k.call(this,e),this.preExecute("shape.resize",function(n){var r=n.shape,i=ce(r),o=i&&i.get("label"),a=o&&o.get("bounds");a&&t.updateModdleProperties(r,o,{bounds:void 0})},!0)}B(ws,k);ws.$inject=["eventBus","modeling"];function Ss(e,t,n){k.call(this,e),this.preExecute("shape.delete",function(r){var i=r.context.shape;if(!(i.incoming.length!==1||i.outgoing.length!==1)){var o=i.incoming[0],a=i.outgoing[0];if(!(!h(o,"bpmn:SequenceFlow")||!h(a,"bpmn:SequenceFlow"))&&t.canConnect(o.source,a.target,o)){var s=bP(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}B(Ss,k);Ss.$inject=["eventBus","bpmnRules","modeling"];function Ko(e){return e.original||e}function bP(e,t){var n=Wo(Ko(e[e.length-2]),Ko(e[e.length-1]),Ko(t[1]),Ko(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[Ko(e[0]),Ko(t[t.length-1])]}function Cs(e,t){k.call(this,e),this.preExecute("shape.delete",function(n){var r=n.shape,i=r.parent;h(r,"bpmn:Participant")&&(n.collaborationRoot=i)},!0),this.postExecute("shape.delete",function(n){var r=n.collaborationRoot;if(r&&!r.businessObject.participants.length){var i=t.makeProcess(),o=r.children.slice();t.moveElements(o,{x:0,y:0},i)}},!0)}Cs.$inject=["eventBus","modeling"];B(Cs,k);N();function Rs(e,t,n,r){k.call(this,e);var i=r.get("dragging",!1);function o(c){var u=c.source,p=c.target,l=c.parent;if(l){var f,d;h(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(u,p)||(d=!0),n.canConnectMessageFlow(u,p)&&(f="bpmn:MessageFlow")),h(c,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(u,p)||(d=!0),n.canConnectSequenceFlow(u,p)&&(f="bpmn:SequenceFlow")),d&&t.removeConnection(c),f&&t.connect(u,p,{type:f,waypoints:c.waypoints.slice()})}}function a(c){var u=c.context,p=u.connection,l=u.newSource||p.source,f=u.newTarget||p.target,d,m;d=n.canConnect(l,f),!(!d||d.type===p.type)&&(m=t.connect(l,f,{type:d.type,associationDirection:d.associationDirection,waypoints:p.waypoints.slice()}),p.parent&&t.removeConnection(p),u.connection=m,i&&s(p,m))}function s(c,u){var p=i.context(),l=p&&p.payload.previousSelection,f;!l||!l.length||(f=l.indexOf(c),f!==-1&&l.splice(f,1,u))}this.postExecuted("elements.move",function(c){var u=c.closure,p=u.allConnections;E(p,o)},!0),this.preExecute("connection.reconnect",a),this.postExecuted("element.updateProperties",function(c){var u=c.context,p=u.properties,l=u.element,f=l.businessObject,d;p.default&&(d=re(l.outgoing,Ct({id:l.businessObject.default.id})),d&&t.updateProperties(d,{conditionExpression:void 0})),p.conditionExpression&&f.sourceRef.default===f&&t.updateProperties(l.source,{default:void 0})})}B(Rs,k);Rs.$inject=["eventBus","modeling","bpmnRules","injector"];N();function Yo(e,t,n,r,i,o){r.invoke(k,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=o,this.postExecuted(["elements.create"],500,function(a){var s=a.context,c=s.parent,u=s.elements,p=Ge(u,function(l,f){var d=t.canReplace([f],f.host||f.parent||c);return d?l.concat(d.replacements):l},[]);p.length&&this._replaceElements(u,p)},this),this.postExecuted(["elements.move"],500,function(a){var s=a.context,c=s.newParent,u=s.newHost,p=[];E(s.closure.topLevel,function(f){Qe(f)?p=p.concat(f.children):p=p.concat(f)}),p.length===1&&u&&(c=u);var l=t.canReplace(p,c);l&&this._replaceElements(p,l.replacements,u)},this),this.postExecute(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,u=s.newShape,p=c.attachers,l;p&&p.length&&(l=t.canReplace(p,u),this._replaceElements(p,l.replacements))},this),this.postExecuted(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,u=s.newShape;i.unclaimId(c.businessObject.id,c.businessObject),i.updateProperties(u,{id:c.id})})}B(Yo,k);Yo.prototype._replaceElements=function(e,t){var n=this._elementRegistry,r=this._bpmnReplace,i=this._selection;E(t,function(o){var a={type:o.newElementType},s=n.get(o.oldElementId),c=e.indexOf(s);e[c]=r.replaceElement(s,a,{select:!1})}),t&&i.select(e)};Yo.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var xP=1500,fy={width:140,height:120},pp={width:300,height:60},lp={width:60,height:300},Ps={width:300,height:150},As={width:150,height:300},Lf={width:140,height:120},jf={width:100,height:40};function fp(e){e.on("resize.start",xP,function(t){var n=t.context,r=n.shape,i=n.direction,o=n.balanced;(h(r,"bpmn:Lane")||h(r,"bpmn:Participant"))&&(n.resizeConstraints=RP(r,i,o)),h(r,"bpmn:SubProcess")&&ie(r)&&(n.minDimensions=Lf),h(r,"bpmn:TextAnnotation")&&(n.minDimensions=jf)})}fp.$inject=["eventBus"];var pi=Math.abs,EP=Math.min,wP=Math.max;function dy(e,t,n,r){var i=e[t];e[t]=i===void 0?n:r(n,i)}function Xo(e,t,n){return dy(e,t,n,EP)}function Zo(e,t,n){return dy(e,t,n,wP)}var SP={top:20,left:50,right:20,bottom:20},CP={top:50,left:20,right:20,bottom:20};function RP(e,t,n){var r=Bt(e),i=!0,o=!0,a=zo(r,[r]),s=Z(e),c={},u={},p=Me(e),l=p?pp:lp;/n/.test(t)?u.top=s.bottom-l.height:/e/.test(t)?u.right=s.left+l.width:/s/.test(t)?u.bottom=s.top+l.height:/w/.test(t)&&(u.left=s.right-l.width),a.forEach(function(m){var g=Z(m);p?(g.top<s.top-10&&(i=!1),g.bottom>s.bottom+10&&(o=!1)):(g.left<s.left-10&&(i=!1),g.right>s.right+10&&(o=!1)),/n/.test(t)&&(n&&pi(s.top-g.bottom)<10&&Zo(c,"top",g.top+l.height),pi(s.top-g.top)<5&&Xo(u,"top",g.bottom-l.height)),/e/.test(t)&&(n&&pi(s.right-g.left)<10&&Xo(c,"right",g.right-l.width),pi(s.right-g.right)<5&&Zo(u,"right",g.left+l.width)),/s/.test(t)&&(n&&pi(s.bottom-g.top)<10&&Xo(c,"bottom",g.bottom-l.height),pi(s.bottom-g.bottom)<5&&Zo(u,"bottom",g.top+l.height)),/w/.test(t)&&(n&&pi(s.left-g.right)<10&&Zo(c,"left",g.left+l.width),pi(s.left-g.left)<5&&Xo(u,"left",g.right-l.width))});var f=r.children.filter(function(m){return!m.hidden&&!m.waypoints&&(h(m,"bpmn:FlowElement")||h(m,"bpmn:Artifact"))}),d=p?SP:CP;return f.forEach(function(m){var g=Z(m);/n/.test(t)&&(!p||i)&&Xo(u,"top",g.top-d.top),/e/.test(t)&&(p||o)&&Zo(u,"right",g.right+d.right),/s/.test(t)&&(!p||o)&&Zo(u,"bottom",g.bottom+d.bottom),/w/.test(t)&&(p||i)&&Xo(u,"left",g.left-d.left)}),{min:u,max:c}}var my=1001;function dp(e,t){e.on("resize.start",my+500,function(n){var r=n.context,i=r.shape;(h(i,"bpmn:Lane")||h(i,"bpmn:Participant"))&&(r.balanced=!Tr(n))}),e.on("resize.end",my,function(n){var r=n.context,i=r.shape,o=r.canExecute,a=r.newBounds;if(h(i,"bpmn:Lane")||h(i,"bpmn:Participant"))return o&&(a=wc(a),t.resizeLane(i,a,r.balanced)),!1})}dp.$inject=["eventBus","modeling"];N();var PP=500;function Ts(e,t,n,r,i){n.invoke(k,this);function o(p){return te(p,["bpmn:ReceiveTask","bpmn:SendTask"])||AP(p,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(p){var l=e.getDefinitions(),f=l.get("rootElements");return!!re(f,Ct({id:p.id}))}function s(p){if(h(p,"bpmn:ErrorEventDefinition"))return"errorRef";if(h(p,"bpmn:EscalationEventDefinition"))return"escalationRef";if(h(p,"bpmn:MessageEventDefinition"))return"messageRef";if(h(p,"bpmn:SignalEventDefinition"))return"signalRef"}function c(p){if(te(p,["bpmn:ReceiveTask","bpmn:SendTask"]))return p.get("messageRef");var l=p.get("eventDefinitions"),f=l[0];return f.get(s(f))}function u(p,l){if(te(p,["bpmn:ReceiveTask","bpmn:SendTask"]))return p.set("messageRef",l);var f=p.get("eventDefinitions"),d=f[0];return d.set(s(d),l)}this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],function(p){var l=p.shape||p.element;if(o(l)){var f=j(l),d=c(f),m;d&&!a(d)&&(m=e.getDefinitions().get("rootElements"),Ae(m,d),p.addedRootElement=d)}},!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],function(p){var l=p.addedRootElement;if(l){var f=e.getDefinitions().get("rootElements");Oe(f,l)}},!0),t.on("copyPaste.copyElement",function(p){var l=p.descriptor,f=p.element;if(!(f.labelTarget||!o(f))){var d=j(f),m=c(d);m&&(l.referencedRootElement=m)}}),t.on("copyPaste.pasteElement",PP,function(p){var l=p.descriptor,f=l.businessObject,d=l.referencedRootElement;d&&(a(d)||(d=r.copyElement(d,i.create(d.$type))),u(f,d),delete l.referencedRootElement)})}Ts.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"];B(Ts,k);function AP(e,t){return q(t)||(t=[t]),Lt(t,function(n){return Er(e,n)})}N();var hy=Math.max;function mp(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,r=t.axis,i=t.start,o={};return E(n,function(a){var s=a.id;h(a,"bpmn:Participant")&&(o[s]=MP(a,r,i)),h(a,"bpmn:Lane")&&(o[s]=Me(a)?pp:lp),h(a,"bpmn:SubProcess")&&ie(a)&&(o[s]=Lf),h(a,"bpmn:TextAnnotation")&&(o[s]=jf),h(a,"bpmn:Group")&&(o[s]=fy)}),o})}mp.$inject=["eventBus"];function TP(e){return e==="x"}function MP(e,t,n){var r=Me(e);if(!NP(e))return r?Ps:As;var i=TP(t),o={};return i?r?o=Ps:o={width:kP(e,n,i),height:As.height}:r?o={width:Ps.width,height:DP(e,n,i)}:o=As,o}function DP(e,t,n){var r;return r=OP(e,t,n),hy(Ps.height,r)}function kP(e,t,n){var r;return r=BP(e,t,n),hy(As.width,r)}function NP(e){return!!yn(e).length}function OP(e,t,n){var r=yn(e),i;return i=Ff(r,t,n),e.height-i.height+pp.height}function BP(e,t,n){var r=yn(e),i;return i=Ff(r,t,n),e.width-i.width+lp.width}function Ff(e,t,n){var r,i,o;for(r=0;r<e.length;r++)if(i=e[r],!n&&t>=i.y&&t<=i.y+i.height||n&&t>=i.x&&t<=i.x+i.width)return o=yn(i),o.length?Ff(o,t,n):i}N();var vy=400,IP=600,gy={x:180,y:160};function Vn(e,t,n,r,i,o,a){k.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=r,this._bpmnFactory=i,this._bpmnjs=o,this._elementRegistry=a;var s=this;function c(l){return h(l,"bpmn:SubProcess")&&!ie(l)}function u(l){var f=l.shape,d=l.newRootElement,m=j(f);d=s._addDiagram(d||m),l.newRootElement=e.addRootElement(d)}function p(l){var f=l.shape,d=j(f);s._removeDiagram(d);var m=l.newRootElement=a.get(vn(d));e.removeRootElement(m)}this.executed("shape.create",function(l){var f=l.shape;c(f)&&u(l)},!0),this.postExecuted("elements.create",function(l){var f=l.elements;E(f,function(d){if(c(d)){var m=a.get(vn(d));if(!(!m||!d.children||!d.children.length)){var g=yy(d);s._showRecursively(g),s._moveChildrenToShape(g,m)}}})},!0),this.reverted("shape.create",function(l){var f=l.shape;c(f)&&p(l)},!0),this.preExecute("shape.delete",function(l){var f=l.shape;!h(f,"bpmn:SubProcess")||!ie(f)||E(Ti([f]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(l){var f=l.shape;if(c(f)){var d=a.get(vn(f));d&&n.removeElements(d.children.slice())}},!0),this.executed("shape.delete",function(l){var f=l.shape;c(f)&&p(l)},!0),this.reverted("shape.delete",function(l){var f=l.shape;c(f)&&u(l)},!0),this.preExecuted("shape.replace",function(l){var f=l.oldShape,d=l.newShape;!c(f)||!c(d)||(l.oldRoot=e.removeRootElement(vn(f)))},!0),this.postExecuted("shape.replace",function(l){var f=l.newShape,d=l.oldRoot,m=e.findRoot(vn(f));if(!(!d||!m)){var g=d.children;n.moveElements(g,{x:0,y:0},m)}},!0),this.executed("element.updateProperties",function(l){var f=l.element;if(h(f,"bpmn:SubProcess")){var d=l.properties,m=l.oldProperties,g=m.id,v=d.id;if(g!==v){if(Eo(f)){a.updateId(f,Jr(v)),a.updateId(g,v);return}var w=a.get(Jr(g));w&&a.updateId(Jr(g),Jr(v))}}},!0),this.reverted("element.updateProperties",function(l){var f=l.element;if(h(f,"bpmn:SubProcess")){var d=l.properties,m=l.oldProperties,g=m.id,v=d.id;if(g!==v){if(Eo(f)){a.updateId(f,Jr(g)),a.updateId(v,g);return}var w=a.get(Jr(v));w&&a.updateId(w,Jr(g))}}},!0),t.on("element.changed",function(l){var f=l.element;if(Eo(f)){var d=f,m=a.get(rf(d));!m||m===d||t.fire("element.changed",{element:m})}}),this.executed("shape.toggleCollapse",vy,function(l){var f=l.shape;h(f,"bpmn:SubProcess")&&(ie(f)?p(l):(u(l),s._showRecursively(f.children)))},!0),this.reverted("shape.toggleCollapse",vy,function(l){var f=l.shape;h(f,"bpmn:SubProcess")&&(ie(f)?p(l):(u(l),s._showRecursively(f.children)))},!0),this.postExecuted("shape.toggleCollapse",IP,function(l){var f=l.shape;if(h(f,"bpmn:SubProcess")){var d=l.newRootElement;if(d)if(ie(f))s._moveChildrenToShape(d.children.slice(),f),E(Ti(f.children),g=>{n.moveShape(g.annotation,{x:0,y:0},f.parent),E(g.associations,v=>{n.moveConnection(v,{x:0,y:0},f.parent)})});else{s._disconnectSharedAnnotations(f);var m=yy(f);s._moveChildrenToShape(m,d)}}},!0),t.on("copyPaste.createTree",function(l){var f=l.element,d=l.children;if(c(f)){var m=vn(f),g=a.get(m);g&&d.push.apply(d,g.children)}}),t.on("copyPaste.copyElement",function(l){var f=l.descriptor,d=l.element,m=l.elements,g=d.parent,v=h(ce(g),"bpmndi:BPMNPlane");if(v){var w=rf(g),S=re(m,function(x){return x.id===w});S&&(f.parent=S.id)}}),t.on("copyPaste.pasteElement",function(l){var f=l.descriptor;f.parent&&(c(f.parent)||f.parent.hidden)&&(f.hidden=!0)})}B(Vn,k);Vn.prototype._moveChildrenToShape=function(e,t){var n=this._modeling;if(e.length){var r=e.filter(function(c){return!c.hidden});if(!r.length){n.moveElements(e,{x:0,y:0},t,{autoResize:!1});return}var i=Ce(r),o;if(!t.x)o={x:gy.x-i.x,y:gy.y-i.y};else{var a=X(t),s=X(i);o={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,o,t,{autoResize:!1})}};Vn.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(Jl(e).map(r=>r.annotation));n.size&&E(Ti(e.children),r=>{n.has(r.annotation)&&E(r.associations,i=>{t.removeConnection(i)})})};Vn.prototype._showRecursively=function(e,t){var n=this,r=[];return e.forEach(function(i){i.hidden=!!t,r=r.concat(i),i.children&&(r=r.concat(n._showRecursively(i.children,i.collapsed||t)))}),r};Vn.prototype._addDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams;return e.businessObject||(e=this._createNewDiagram(e)),n.push(e.di.$parent),e};Vn.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});r.$parent=i;var o=n.createRoot({id:vn(e),type:e.$type,di:r,businessObject:e,collapsed:!0});return o};Vn.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,r=re(n,function(i){return i.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(r),1),r};Vn.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function LP(e){var t=[];return E(Ti(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function yy(e){return e.children.slice().concat(LP(e.children)).concat(jP(e))}function jP(e){return Ta(e.children||[],!0,-1).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function Ms(e,t){e.invoke(k,this),this.postExecuted("shape.replace",function(n){var r=n.context.oldShape,i=n.context.newShape;if(!(!h(i,"bpmn:SubProcess")||h(i,"bpmn:AdHocSubProcess")||!(h(r,"bpmn:Task")||h(r,"bpmn:CallActivity"))||!ie(i))){var o=FP(i);t.createShape({type:"bpmn:StartEvent"},o,i)}})}Ms.$inject=["injector","modeling"];B(Ms,k);function FP(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function Ds(e,t){k.call(this,e),this.preExecute("connection.create",function(n){let{target:r}=n;h(r,"bpmn:TextAnnotation")&&(n.parent=r.parent)},!0),this.preExecute(["shape.create","shape.resize","elements.move"],function(n){let r=n.shapes||[n.shape];r.length===1&&h(r[0],"bpmn:TextAnnotation")&&(n.hints=n.hints||{},n.hints.autoResize=!1)},!0),this.preExecute("shape.resize",function(n){var r=n.context,i=r.shape,o=r.hints||{};if(!(!h(i,"bpmn:TextAnnotation")||o.autoResize)){var a=r.newBounds,s=t.getTextAnnotationBounds(a,gt(i)||""),c=a.y!==i.y&&Math.abs(a.y+a.height-(i.y+i.height))<=1,u=i.y+i.height;r.newBounds={width:a.width,height:s.height,x:a.x,y:c?u-s.height:a.y}}})}B(Ds,k);Ds.$inject=["eventBus","textRenderer"];N();function ks(e,t){k.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var r=n.shape;if(ie(r))return;var i=Zn(r);i.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();E(s,function(u){o(u,!0)}),E(c,function(u){o(u,!1)})});function o(a,s){i.indexOf(a.source)!==-1&&i.indexOf(a.target)!==-1||h(a,"bpmn:Association")&&(h(a.source,"bpmn:TextAnnotation")||h(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,r,X(r)):t.reconnectStart(a,r,X(r)))}},!0)}B(ks,k);ks.$inject=["eventBus","modeling"];var Hf=500;function Ns(e,t,n){k.call(this,e);function r(a){a.length&&a.forEach(function(s){s.type==="label"&&!s.businessObject.name&&(s.hidden=!0)})}function i(a,s){var c=a.children,u=s,p,l;return p=HP(c).concat([a]),l=tp(p),l?(u.width=Math.max(l.width,u.width),u.height=Math.max(l.height,u.height),u.x=l.x+(l.width-u.width)/2,u.y=l.y+(l.height-u.height)/2):(u.x=a.x+(a.width-u.width)/2,u.y=a.y+(a.height-u.height)/2),u}function o(a,s){return{x:a.x+(a.width-s.width)/2,y:a.y+(a.height-s.height)/2,width:s.width,height:s.height}}this.executed(["shape.toggleCollapse"],Hf,function(a){var s=a.context,c=s.shape;h(c,"bpmn:SubProcess")&&(c.collapsed?ce(c).isExpanded=!1:(r(c.children),ce(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],Hf,function(a){var s=a.context,c=s.shape;c.collapsed?ce(c).isExpanded=!1:ce(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],Hf,function(a){var s=a.context.shape,c=t.getDefaultSize(s),u;s.collapsed?u=o(s,c):u=i(s,c),n.resizeShape(s,u,null,{autoResize:s.collapsed?!1:"nwse"})})}B(Ns,k);Ns.$inject=["eventBus","elementFactory","modeling"];function HP(e){return e.filter(function(t){return!t.hidden})}function Os(e,t,n,r){t.invoke(k,this),this.preExecute("shape.delete",function(i){var o=i.context,a=o.shape,s=a.businessObject;ee(a)||(h(a,"bpmn:Participant")&&ie(a)&&n.ids.unclaim(s.processRef.id),r.unclaimId(s.id,s))}),this.preExecute("connection.delete",function(i){var o=i.context,a=o.connection,s=a.businessObject;r.unclaimId(s.id,s)}),this.preExecute("canvas.updateRoot",function(){var i=e.getRootElement(),o=i.businessObject;h(i,"bpmn:Collaboration")&&n.ids.unclaim(o.id)})}B(Os,k);Os.$inject=["canvas","injector","moddle","modeling"];function Bs(e,t){k.call(this,e),this.preExecute("connection.delete",function(n){var r=n.context,i=r.connection,o=i.source;$P(i,o)&&t.updateProperties(o,{default:null})})}B(Bs,k);Bs.$inject=["eventBus","modeling"];function $P(e,t){if(!h(e,"bpmn:SequenceFlow"))return!1;var n=j(t),r=j(e);return n.get("default")===r}var zP=500,GP=5e3;function Is(e,t){k.call(this,e);var n;function r(){return n=n||new VP,n.enter(),n}function i(){if(!n)throw new Error("out of bounds release");return n}function o(){if(!n)throw new Error("out of bounds release");var s=n.leave();return s&&(t.updateLaneRefs(n.flowNodes,n.lanes),n=null),s}var a=["spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move","shape.create","shape.delete","shape.move","shape.resize"];this.preExecute(a,GP,function(s){r()}),this.postExecuted(a,zP,function(s){o()}),this.preExecute(["shape.create","shape.move","shape.delete","shape.resize"],function(s){var c=s.context,u=c.shape,p=i();u.labelTarget||(h(u,"bpmn:Lane")&&p.addLane(u),h(u,"bpmn:FlowNode")&&p.addFlowNode(u))})}Is.$inject=["eventBus","modeling"];B(Is,k);function VP(){this.flowNodes=[],this.lanes=[],this.counter=0,this.addLane=function(e){this.lanes.push(e)},this.addFlowNode=function(e){this.flowNodes.push(e)},this.enter=function(){this.counter++},this.leave=function(){return this.counter--,!this.counter}}function Ls(e,t){k.call(this,e),this.postExecuted("elements.create",function(n){let r=n.context,i=r.elements;for(let o of i)WP(o)&&!qP(o)&&t.updateProperties(o,{isForCompensation:void 0})})}B(Ls,k);Ls.$inject=["eventBus","modeling"];function WP(e){let t=j(e);return t&&t.isForCompensation}function UP(e){return e&&h(e,"bpmn:BoundaryEvent")&&Er(e,"bpmn:CompensateEventDefinition")}function qP(e){return e.incoming.filter(n=>UP(n.source)).length>0}var _y={__init__:["adaptiveLabelPositioningBehavior","appendBehavior","artifactBehavior","associationBehavior","attachEventBehavior","boundaryEventBehavior","compensateBoundaryEventBehaviour","createBehavior","createDataObjectBehavior","createParticipantBehavior","dataInputAssociationBehavior","dataStoreBehavior","deleteLaneBehavior","detachEventBehavior","dropOnFlowBehavior","eventBasedGatewayBehavior","fixHoverBehavior","groupBehavior","importDockingFix","isHorizontalFix","labelBehavior","layoutConnectionBehavior","messageFlowBehavior","nonInterruptingBehavior","removeElementBehavior","removeEmbeddedLabelBoundsBehavior","removeParticipantBehavior","replaceConnectionBehavior","replaceElementBehaviour","resizeBehavior","resizeLaneBehavior","rootElementReferenceBehavior","spaceToolBehavior","subProcessPlaneBehavior","subProcessStartEventBehavior","textAnnotationBehavior","toggleCollapseConnectionBehaviour","toggleElementCollapseBehaviour","unclaimIdBehavior","updateFlowNodeRefsBehavior","unsetDefaultFlowBehavior","setCompensationActivityAfterPasteBehavior"],adaptiveLabelPositioningBehavior:["type",es],appendBehavior:["type",ts],associationBehavior:["type",rs],attachEventBehavior:["type",Fo],artifactBehavior:["type",ns],boundaryEventBehavior:["type",is],compensateBoundaryEventBehaviour:["type",as],createBehavior:["type",ss],createDataObjectBehavior:["type",cs],createParticipantBehavior:["type",us],dataInputAssociationBehavior:["type",ps],dataStoreBehavior:["type",ls],deleteLaneBehavior:["type",ds],detachEventBehavior:["type",Go],dropOnFlowBehavior:["type",ms],eventBasedGatewayBehavior:["type",hs],fixHoverBehavior:["type",rp],groupBehavior:["type",vs],importDockingFix:["type",ip],isHorizontalFix:["type",gs],labelBehavior:["type",_s],layoutConnectionBehavior:["type",bs],messageFlowBehavior:["type",xs],nonInterruptingBehavior:["type",Es],removeElementBehavior:["type",Ss],removeEmbeddedLabelBoundsBehavior:["type",ws],removeParticipantBehavior:["type",Cs],replaceConnectionBehavior:["type",Rs],replaceElementBehaviour:["type",Yo],resizeBehavior:["type",fp],resizeLaneBehavior:["type",dp],rootElementReferenceBehavior:["type",Ts],spaceToolBehavior:["type",mp],subProcessPlaneBehavior:["type",Vn],subProcessStartEventBehavior:["type",Ms],textAnnotationBehavior:["type",Ds],toggleCollapseConnectionBehaviour:["type",ks],toggleElementCollapseBehaviour:["type",Ns],unclaimIdBehavior:["type",Os],unsetDefaultFlowBehavior:["type",Bs],updateFlowNodeRefsBehavior:["type",Is],setCompensationActivityAfterPasteBehavior:["type",Ls]};N();function hp(e,t){var n=He(e,t,-15);return n!=="intersect"?n:null}function wt(e){Ot.call(this,e)}B(wt,Ot);wt.$inject=["eventBus"];wt.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return KP(t)}),this.addRule("connection.create",function(e){var t=e.source,n=e.target,r=e.hints||{},i=r.targetParent,o=r.targetAttach;if(o)return!1;i&&(n.parent=i);try{return vp(t,n)}finally{i&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,r=e.target;return vp(n,r,t)}),this.addRule("connection.updateWaypoints",function(e){return{type:e.connection.type}}),this.addRule("shape.resize",function(e){var t=e.shape,n=e.newBounds,r=e.direction;return Ny(t,n,r)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,r=e.target;return de(r)&&!gp(t,r,n)?!1:ln(t,function(i){return de(i)?vp(i.source,i.target,i):i.host?js(i,i.host,null,n):Gf(i,r,null,n)})}),this.addRule("elements.move",function(e){var t=e.target,n=e.shapes,r=e.position,i=e.hints;return i!=null&&i.keyboardMove&&n.some(function(a){return Py(a)&&!n.includes(a.host)})?!1:js(n,t,null,r)||Dy(n,t,r)||ky(n,t,r)||gp(n,t,r)}),this.addRule("shape.create",function(e){return Gf(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return js(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return jy(n,t)})};wt.prototype.canConnectMessageFlow=Iy;wt.prototype.canConnectSequenceFlow=Ly;wt.prototype.canConnectDataAssociation=Wf;wt.prototype.canConnectAssociation=Oy;wt.prototype.canConnectCompensationAssociation=By;wt.prototype.canMove=ky;wt.prototype.canAttach=js;wt.prototype.canReplace=Dy;wt.prototype.canDrop=Qo;wt.prototype.canInsert=gp;wt.prototype.canCreate=Gf;wt.prototype.canConnect=vp;wt.prototype.canResize=Ny;wt.prototype.canCopy=jy;function KP(e){return $f(e)?null:te(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function $f(e){return!e||ee(e)}function by(e){do{if(h(e,"bpmn:Process"))return j(e);if(h(e,"bpmn:Participant"))return j(e).processRef||j(e)}while(e=e.parent)}function zf(e){return h(e,"bpmn:TextAnnotation")}function Vf(e){return h(e,"bpmn:Group")&&!e.labelTarget}function Sy(e){return h(e,"bpmn:BoundaryEvent")&&ur(e,"bpmn:CompensateEventDefinition")}function yp(e){return j(e).isForCompensation}function YP(e,t){var n=by(e),r=by(t);return n===r}function XP(e){return h(e,"bpmn:InteractionNode")&&!h(e,"bpmn:BoundaryEvent")&&(!h(e,"bpmn:Event")||h(e,"bpmn:ThrowEvent")&&Ry(e,"bpmn:MessageEventDefinition"))}function ZP(e){return h(e,"bpmn:InteractionNode")&&!yp(e)&&(!h(e,"bpmn:Event")||h(e,"bpmn:CatchEvent")&&Ry(e,"bpmn:MessageEventDefinition"))&&!(h(e,"bpmn:BoundaryEvent")&&!ur(e,"bpmn:MessageEventDefinition"))}function xy(e){for(var t=e;t=t.parent;){if(h(t,"bpmn:FlowElementsContainer"))return j(t);if(h(t,"bpmn:Participant"))return j(t).processRef}return null}function Cy(e,t){var n=xy(e),r=xy(t);return n===r}function ur(e,t){var n=j(e);return!!re(n.eventDefinitions||[],function(r){return h(r,t)})}function Ry(e,t){var n=j(e);return(n.eventDefinitions||[]).every(function(r){return h(r,t)})}function QP(e){return h(e,"bpmn:FlowNode")&&!h(e,"bpmn:EndEvent")&&!Qe(e)&&!(h(e,"bpmn:IntermediateThrowEvent")&&ur(e,"bpmn:LinkEventDefinition"))&&!Sy(e)&&!yp(e)}function JP(e){return h(e,"bpmn:FlowNode")&&!h(e,"bpmn:StartEvent")&&!h(e,"bpmn:BoundaryEvent")&&!Qe(e)&&!(h(e,"bpmn:IntermediateCatchEvent")&&ur(e,"bpmn:LinkEventDefinition"))&&!yp(e)}function eA(e){return h(e,"bpmn:ReceiveTask")||h(e,"bpmn:IntermediateCatchEvent")&&(ur(e,"bpmn:MessageEventDefinition")||ur(e,"bpmn:TimerEventDefinition")||ur(e,"bpmn:ConditionalEventDefinition")||ur(e,"bpmn:SignalEventDefinition"))}function tA(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function Ey(e,t){var n=tA(t);return n.indexOf(e)!==-1}function vp(e,t,n){if($f(e)||$f(t))return null;if(!h(n,"bpmn:DataAssociation")){if(Iy(e,t))return{type:"bpmn:MessageFlow"};if(Ly(e,t))return{type:"bpmn:SequenceFlow"}}var r=Wf(e,t);return r||(By(e,t)?{type:"bpmn:Association",associationDirection:"One"}:Oy(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function Qo(e,t){return ee(e)||Vf(e)?!0:h(t,"bpmn:Participant")&&!ie(t)?!1:h(e,"bpmn:Participant")?h(t,"bpmn:Process")||h(t,"bpmn:Collaboration"):te(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:h(e,"bpmn:Lane")?h(t,"bpmn:Participant")||h(t,"bpmn:Lane"):h(e,"bpmn:BoundaryEvent")&&!nA(e)?!1:h(e,"bpmn:FlowElement")&&!h(e,"bpmn:DataStoreReference")?h(t,"bpmn:FlowElementsContainer")?ie(t):te(t,["bpmn:Participant","bpmn:Lane"]):h(e,"bpmn:DataStoreReference")&&h(t,"bpmn:Collaboration")?Lt(j(t).get("participants"),function(n){return!!n.get("processRef")}):te(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?te(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):h(e,"bpmn:MessageFlow")?h(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function nA(e){return j(e).cancelActivity&&(Ay(e)||Ty(e))}function Py(e){return!ee(e)&&h(e,"bpmn:BoundaryEvent")}function rA(e){return h(e,"bpmn:Lane")}function iA(e){return Py(e)||h(e,"bpmn:IntermediateThrowEvent")&&Ay(e)?!0:h(e,"bpmn:IntermediateCatchEvent")&&Ty(e)}function Ay(e){var t=j(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function Ty(e){return My(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function My(e,t){return t.some(function(n){return ur(e,n)})}function oA(e){return h(e,"bpmn:ReceiveTask")&&re(e.incoming,function(t){return h(t.source,"bpmn:EventBasedGateway")})}function js(e,t,n,r){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var i=e[0];return ee(i)||!iA(i)||Qe(t)||!h(t,"bpmn:Activity")||yp(t)||r&&!hp(r,t)||oA(t)?!1:"attach"}function Dy(e,t,n){if(!t)return!1;var r={replacements:[]};return E(e,function(i){Qe(t)||h(i,"bpmn:StartEvent")&&i.type!=="label"&&Qo(i,t)&&(hh(i)||r.replacements.push({oldElementId:i.id,newElementType:"bpmn:StartEvent"}),(vh(i)||gh(i)||yh(i))&&r.replacements.push({oldElementId:i.id,newElementType:"bpmn:StartEvent"}),My(i,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&h(t,"bpmn:SubProcess")&&r.replacements.push({oldElementId:i.id,newElementType:"bpmn:StartEvent"})),h(t,"bpmn:Transaction")||ur(i,"bpmn:CancelEventDefinition")&&i.type!=="label"&&(h(i,"bpmn:EndEvent")&&Qo(i,t)&&r.replacements.push({oldElementId:i.id,newElementType:"bpmn:EndEvent"}),h(i,"bpmn:BoundaryEvent")&&js(i,t,null,n)&&r.replacements.push({oldElementId:i.id,newElementType:"bpmn:BoundaryEvent"}))}),r.replacements.length?r:!1}function ky(e,t){return Lt(e,rA)?!1:t?e.every(function(n){return Qo(n,t)}):!0}function Gf(e,t,n,r){return t?ee(e)||Vf(e)?!0:Qo(e,t,r)||gp(e,t,r):!1}function Ny(e,t,n){return h(e,"bpmn:SubProcess")?ie(e)&&(!t||t.width>=100&&t.height>=80):h(e,"bpmn:Lane")||h(e,"bpmn:Participant")?!0:zf(e)?n?n==="e"||n==="w":!0:Vf(e)?!0:ee(e)?n?n==="e"||n==="w":!0:!1}function aA(e,t){var n=zf(e),r=zf(t);return(n||r)&&n!==r}function Oy(e,t){return Ey(t,e)||Ey(e,t)?!1:aA(e,t)?!0:!!Wf(e,t)}function By(e,t){return Cy(e,t)&&Sy(e)&&h(t,"bpmn:Activity")&&!cA(t,e)&&!Qe(t)}function Iy(e,t){return wy(e)&&!wy(t)?!1:XP(e)&&ZP(t)&&!YP(e,t)}function Ly(e,t){return QP(e)&&JP(t)&&Cy(e,t)&&!(h(e,"bpmn:EventBasedGateway")&&!eA(t))}function Wf(e,t){return te(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&te(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:te(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&te(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function gp(e,t,n){if(!t)return!1;if(Array.isArray(e)){if(e.length!==1)return!1;e=e[0]}return t.source===e||t.target===e?!1:te(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!ee(t)&&h(e,"bpmn:FlowNode")&&!h(e,"bpmn:BoundaryEvent")&&Qo(e,t.parent,n)}function sA(e,t){return e&&t&&e.indexOf(t)!==-1}function jy(e,t){return ee(t)?!0:!(h(t,"bpmn:Lane")&&!sA(e,t.parent))}function wy(e){return kr(e,"bpmn:Process")||kr(e,"bpmn:Collaboration")}function cA(e,t){return e.attachers.includes(t)}var Fy={__depends__:[Et],__init__:["bpmnRules"],bpmnRules:["type",wt]};N();var uA=2e3;function _p(e,t){e.on("saveXML.start",uA,n);function n(){var r=t.getRootElements();E(r,function(i){var o=ce(i),a,s;a=Zn([i],!1),a=Q(a,function(c){return c!==i&&!c.labelTarget}),s=je(a,ce),o.set("planeElement",s)})}}_p.$inject=["eventBus","canvas"];var Hy={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",_p]};function Jo(e){k.call(this,e);var t=this;this.preExecute(["shape.create","connection.create"],function(n){var r=n.context,i=r.shape||r.connection,o=r.parent,a=t.getOrdering(i,o);a&&(a.parent!==void 0&&(r.parent=a.parent),r.parentIndex=a.index)}),this.preExecute(["shape.move","connection.move"],function(n){var r=n.context,i=r.shape||r.connection,o=r.newParent||i.parent,a=t.getOrdering(i,o);a&&(a.parent!==void 0&&(r.newParent=a.parent),r.newParentIndex=a.index)})}Jo.prototype.getOrdering=function(e,t){return null};B(Jo,k);N();function Fs(e,t){Jo.call(this,e);var n=[{type:"bpmn:SubProcess",order:{level:6}},{type:"bpmn:SequenceFlow",order:{level:9,containers:["bpmn:Participant","bpmn:FlowElementsContainer"]}},{type:"bpmn:DataAssociation",order:{level:9,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:TextAnnotation",order:{level:9}},{type:"bpmn:MessageFlow",order:{level:9,containers:["bpmn:Collaboration"]}},{type:"bpmn:Association",order:{level:6,containers:["bpmn:Participant","bpmn:FlowElementsContainer","bpmn:Collaboration"]}},{type:"bpmn:BoundaryEvent",order:{level:8}},{type:"bpmn:Group",order:{level:10,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:FlowElement",order:{level:5}},{type:"bpmn:Participant",order:{level:-2}},{type:"bpmn:Lane",order:{level:-1}}];function r(a){if(a.labelTarget)return{level:10};var s=re(n,function(c){return te(a,[c.type])});return s&&s.order||{level:1}}function i(a){var s=a.order;if(s||(a.order=s=r(a)),!s)throw new Error(`no order for <${a.id}>`);return s}function o(a,s,c){for(var u=s;u&&!te(u,c);)u=u.parent;if(!u)throw new Error(`no parent for <${a.id}> in <${s&&s.id}>`);return u}this.getOrdering=function(a,s){if(a.labelTarget||h(a,"bpmn:TextAnnotation"))return{parent:t.findRoot(s)||t.getRootElement(),index:-1};var c=i(a);c.containers&&(s=o(a,s,c.containers));var u=s.children.indexOf(a),p=Sa(s.children,function(l){return!a.labelTarget&&l.labelTarget?!1:c.level<i(l).level});return p!==-1&&u!==-1&&u<p&&(p-=1),{index:p,parent:s}}}Fs.$inject=["eventBus","canvas"];B(Fs,Jo);var $y={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",Fs]};function $i(){}$i.prototype.get=function(){return this._data};$i.prototype.set=function(e){this._data=e};$i.prototype.clear=function(){var e=this._data;return delete this._data,e};$i.prototype.isEmpty=function(){return!this._data};var zy={clipboard:["type",$i]};N();var pA="drop-ok",Gy="drop-not-ok",Vy="attach-ok",Wy="new-parent",Uy="create",lA=2e3;function bp(e,t,n,r,i){function o(c,u,p,l,f){if(!u)return!1;c=Q(c,function(S){var x=S.labelTarget;return!S.parent&&!(ee(S)&&c.indexOf(x)!==-1)});var d=re(c,function(S){return!de(S)}),m=!1,g=!1,v=!1;Ky(c)&&(m=i.allowed("shape.attach",{position:p,shape:d,target:u})),m||(Ky(c)?v=i.allowed("shape.create",{position:p,shape:d,source:l,target:u}):v=i.allowed("elements.create",{elements:c,position:p,target:u}));var w=f.connectionTarget;return v||m?(d&&l&&(g=i.allowed("connection.create",{source:w===l?d:l,target:w===l?l:d,hints:{targetParent:u,targetAttach:m}})),{attach:m,connect:g}):v===null||m===null?null:!1}function a(c,u){[Vy,pA,Gy,Wy].forEach(function(p){p===u?e.addMarker(c,p):e.removeMarker(c,p)})}n.on(["create.move","create.hover"],function(c){var u=c.context,p=u.elements,l=c.hover,f=u.source,d=u.hints||{};if(!l){u.canExecute=!1,u.target=null;return}qy(c);var m={x:c.x,y:c.y},g=u.canExecute=l&&o(p,l,m,f,d);l&&g!==null&&(u.target=l,g&&g.attach?a(l,Vy):a(l,g?Wy:Gy))}),n.on(["create.end","create.out","create.cleanup"],function(c){var u=c.hover;u&&a(u,null)}),n.on("create.end",function(c){var u=c.context,p=u.source,l=u.shape,f=u.elements,d=u.target,m=u.canExecute,g=m&&m.attach,v=m&&m.connect,w=u.hints||{};if(m===!1||!d)return!1;qy(c);var S={x:c.x,y:c.y};v?l=r.appendShape(p,l,S,d,{attach:g,connection:v===!0?{}:v,connectionTarget:w.connectionTarget}):(f=r.createElements(f,S,d,C({},w,{attach:g})),l=re(f,function(x){return!de(x)})),C(u,{elements:f,shape:l}),C(c,{elements:f,shape:l})});function s(){var c=t.context();c&&c.prefix===Uy&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],lA,function(){n.off("elements.changed",s)})}),this.start=function(c,u,p){q(u)||(u=[u]);var l=re(u,function(m){return!de(m)});if(l){p=C({elements:u,hints:{},shape:l},p||{}),E(u,function(m){ne(m.x)||(m.x=0),ne(m.y)||(m.y=0)});var f=Q(u,function(m){return!m.hidden}),d=Ce(f);E(u,function(m){de(m)&&(m.waypoints=je(m.waypoints,function(g){return{x:g.x-d.x-d.width/2,y:g.y-d.y-d.height/2}})),C(m,{x:m.x-d.x-d.width/2,y:m.y-d.y-d.height/2})}),t.init(c,Uy,{cursor:"grabbing",autoActivate:!0,data:{shape:l,elements:u,context:p}})}}}bp.$inject=["canvas","dragging","eventBus","modeling","rules"];function qy(e){var t=e.context,n=t.createConstraints;n&&(n.left&&(e.x=Math.max(e.x,n.left)),n.right&&(e.x=Math.min(e.x,n.right)),n.top&&(e.y=Math.max(e.y,n.top)),n.bottom&&(e.y=Math.min(e.y,n.bottom)))}function Ky(e){return e&&e.length===1&&!de(e[0])}var fA=750;function xp(e,t,n,r,i){function o(a){var s=U("g");$(s,i.cls("djs-drag-group",["no-events"]));var c=U("g");return a.forEach(function(u){var p;u.hidden||(u.waypoints?(p=n._createContainer("connection",c),n.drawConnection(Ln(p),u)):(p=n._createContainer("shape",c),n.drawShape(Ln(p),u),Fe(p,u.x,u.y)),r.addDragger(u,s,p))}),s}t.on("create.move",fA,function(a){var s=a.hover,c=a.context,u=c.elements,p=c.dragGroup;p||(p=c.dragGroup=o(u));var l;s?(p.parentNode||(l=e.getActiveLayer(),J(l,p)),Fe(p,a.x,a.y)):Pe(p)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&Pe(c)})}xp.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];var li={__depends__:[kt,Dn,Et,rt],__init__:["create","createPreview"],create:["type",bp],createPreview:["type",xp]};function Hs(e){var t=this;this._lastMoveEvent=null;function n(r){t._lastMoveEvent=r}e.on("canvas.init",function(r){var i=t._svg=r.svg;i.addEventListener("mousemove",n)}),e.on("canvas.destroy",function(){t._lastMouseEvent=null,t._svg.removeEventListener("mousemove",n)})}Hs.$inject=["eventBus"];Hs.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||dA(0,0)};function dA(e,t){var n=document.createEvent("MouseEvent"),r=e,i=t,o=e,a=t;return n.initMouseEvent&&n.initMouseEvent("mousemove",!0,!0,window,0,r,i,o,a,!1,!1,!1,!1,0,null),n}var pr={__init__:["mouse"],mouse:["type",Hs]};N();var Yy=2e3;function Ht(e,t,n,r,i,o,a,s){this._canvas=e,this._create=t,this._elementFactory=r,this._eventBus=i,this._modeling=o,this._mouse=a,this._rules=s,i.on("copyPaste.copyElement",function(c){var u=c.descriptor,p=c.element,l=c.elements;u.priority=1,u.id=p.id;var f=re(l,function(d){return d===p.parent});f&&(u.parent=p.parent.id),mA(p)&&(u.priority=2,u.host=p.host.id),de(p)&&(u.priority=3,u.source=p.source.id,u.target=p.target.id,u.waypoints=hA(p)),ee(p)&&(u.priority=4,u.labelTarget=p.labelTarget.id),E(["x","y","width","height"],function(d){ne(p[d])&&(u[d]=p[d])}),u.hidden=p.hidden,u.collapsed=p.collapsed}),i.on("copyPaste.elementsCopied",Yy,function(c){var u;((u=c.hints)==null?void 0:u.clip)!==!1&&n.set(c.tree)}),i.on("copyPaste.pasteElements",Yy,function(c){c.tree||(c.tree=n.get())}),i.on("copyPaste.pasteElements",function(c){var u=c.hints;C(u,{createElementsBehavior:!1})})}Ht.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"];Ht.prototype.copy=function(e,t={}){var n,r;return q(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?r={}:r=this.createTree(q(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:r,hints:t}),r};Ht.prototype.paste=function(e={}){var t=this._eventBus.createEvent({type:"copyPaste.pasteElements",hints:{},...e}),n=this._eventBus.fire(t);if(n!==!1){var r=t.tree;if(r){var i=t.hints,o=this._createElements(r);if(t.element&&t.point)return this._paste(o,t.element,t.point,i);this._create.start(this._mouse.getLastMoveEvent(),o,{hints:i})}}};Ht.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})};Ht.prototype.cut=function(e){var t=this.copy(e),n=this._getElementIdsFromTree(t),r=e.filter(function(i){return n[i.id]});return r.length>0&&this._modeling.removeElements(r),t};Ht.prototype._getElementIdsFromTree=function(e){var t={};return E(e,function(n){E(n,function(r){r.id&&(t[r.id]=!0)})}),t};Ht.prototype._paste=function(e,t,n,r){E(e,function(o){ne(o.x)||(o.x=0),ne(o.y)||(o.y=0)});var i=Ce(e);return E(e,function(o){de(o)&&(o.waypoints=je(o.waypoints,function(a){return{x:a.x-i.x-i.width/2,y:a.y-i.y-i.height/2}})),C(o,{x:o.x-i.x-i.width/2,y:o.y-i.y-i.height/2})}),this._modeling.createElements(e,n,t,C({},r))};Ht.prototype._createElements=function(e){var t=this,n=this._eventBus,r={},i=[];return E(e,function(o,a){a=parseInt(a,10),o=At(o,"priority"),E(o,function(s){var c=C({},Nt(s,["priority"]));r[s.parent]?c.parent=r[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:r,descriptor:c});var u;if(de(c)){c.source=r[s.source],c.target=r[s.target],u=r[s.id]=t.createConnection(c),i.push(u);return}if(ee(c)){c.labelTarget=r[c.labelTarget],u=r[s.id]=t.createLabel(c),i.push(u);return}c.host&&(c.host=r[c.host]),u=r[s.id]=t.createShape(c),i.push(u)})}),i};Ht.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(Nt(e,["id"]));return t};Ht.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(Nt(e,["id"]));return t};Ht.prototype.createShape=function(e){var t=this._elementFactory.createShape(Nt(e,["id"]));return t};Ht.prototype.hasRelations=function(e,t){var n,r,i;return!(de(e)&&(r=re(t,Ct({id:e.source.id})),i=re(t,Ct({id:e.target.id})),!r||!i)||ee(e)&&(n=re(t,Ct({id:e.labelTarget.id})),!n))};Ht.prototype.createTree=function(e){var t=this._rules,n=this,r={},i=[],o=zr(e);function a(u,p){return t.allowed("element.copy",{element:u,elements:p})}function s(u,p){var l=re(i,function(f){return u===f.element});if(!l){i.push({element:u,depth:p});return}l.depth<p&&(i=c(l,i),i.push({element:l.element,depth:p}))}function c(u,p){var l=p.indexOf(u);return l!==-1&&p.splice(l,1),p}return In(o,function(u,p,l){if(ee(u))return;E(u.labels,function(m){s(m,l)});function f(m){m&&m.length&&E(m,function(g){E(g.labels,function(v){s(v,l)}),s(g,l)})}E([u.attachers,u.incoming,u.outgoing],f),s(u,l);var d=[];return u.children&&(d=u.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:u,children:d}),d}),e=je(i,function(u){return u.element}),i=je(i,function(u){return u.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:u.descriptor,element:u.element,elements:e}),u}),i=At(i,function(u){return u.descriptor.priority}),e=je(i,function(u){return u.element}),E(i,function(u){var p=u.depth;if(!n.hasRelations(u.element,e)){Zy(u.element,e);return}if(!a(u.element,e)){Zy(u.element,e);return}r[p]||(r[p]=[]),r[p].push(u.descriptor)}),r};function mA(e){return!!e.host}function hA(e){return je(e.waypoints,function(t){return t=Xy(t),t.original&&(t.original=Xy(t.original)),t})}function Xy(e){return C({},e)}function Zy(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}var Qy={__depends__:[zy,li,pr,Et],__init__:["copyPaste"],copyPaste:["type",Ht]};N();function Uf(e,t,n){q(n)||(n=[n]),E(n,function(r){wn(e[r])||(t[r]=e[r])})}var qf=750;function Ep(e,t,n){function r(c,u){var p=e.create(c.$type);return n.copyElement(c,p,null,u)}t.on("copyPaste.copyElement",qf,function(c){var u=c.descriptor,p=c.element,l=j(p);if(ee(p))return u;var f=u.businessObject=r(l,!0),d=u.di=r(ce(p),!0);d.bpmnElement=f,Uf(f,u,"name"),Uf(d,u,"isExpanded"),l.default&&(u.default=l.default.id)});var i="-bpmn-js-refs";function o(c){return c[i]=c[i]||{}}function a(c,u){c[i]=u}function s(c,u,p){var l=j(c);return c.default&&(p[c.default]={element:l,property:"default"}),c.host&&(j(c).attachedToRef=j(u[c.host])),Nt(p,Ge(p,function(f,d,m){var g=d.element,v=d.property;return m===c.id&&(g.set(v,l),f.push(c.id)),f},[]))}t.on("copyPaste.pasteElement",function(c){var u=c.cache,p=c.descriptor,l=p.businessObject,f=p.di;if(ee(p)){p.businessObject=j(u[p.labelTarget]),p.di=ce(u[p.labelTarget]);return}l=p.businessObject=r(l),f=p.di=r(f),f.bpmnElement=l,Uf(p,l,["isExpanded","name"]),p.type=l.$type}),t.on("copyPaste.copyElement",qf,function(c){var u=c.descriptor,p=c.element;if(h(p,"bpmn:Participant")){var l=j(p);l.processRef&&(u.processRef=r(l.processRef,!0))}}),t.on("copyPaste.pasteElement",function(c){var u=c.descriptor,p=u.processRef;p&&(u.processRef=r(p))}),t.on("copyPaste.createTree",function(c){var u=c.element,p=c.children;h(u,"bpmn:SubProcess")&&E(Ti(p),l=>{p.push(l.annotation)})}),t.on("copyPaste.pasteElement",qf,function(c){var u=c.cache,p=c.descriptor;a(u,s(p,u,o(u)))})}Ep.$inject=["bpmnFactory","eventBus","moddleCopy"];N();var vA=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],gA=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function zi(e,t,n){this._bpmnFactory=t,this._eventBus=e,this._moddle=n,e.on("moddleCopy.canCopyProperties",r=>{let{propertyNames:i}=r;if(!(!i||!i.length))return At(i,o=>o==="extensionElements")}),e.on("moddleCopy.canCopyProperty",r=>{let{parent:i,property:o,propertyName:a}=r,s=Se(i)&&i.$descriptor;if(a&&gA.includes(a))return o;if(a&&vA.includes(a)||a&&s&&!re(s.properties,Ct({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",r=>{let{property:i}=r;if(h(i,"bpmn:ExtensionElements")&&(!i.values||!i.values.length))return!1})}zi.$inject=["eventBus","bpmnFactory","moddle"];zi.prototype.copyElement=function(e,t,n,r=!1){n&&!q(n)&&(n=[n]),n=n||wp(e.$descriptor);let i=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:r});return i===!1||(q(i)&&(n=i),E(n,o=>{let a;dt(e,o)&&(a=e.get(o));let s=this.copyProperty(a,t,o,r);!Ue(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:o})===!1||t.set(o,s)})),t};zi.prototype.copyProperty=function(e,t,n,r=!1){let i=this._eventBus.fire("moddleCopy.canCopyProperty",{parent:t,property:e,propertyName:n,clone:r});if(i===!1)return;if(i)return Se(i)&&i.$type&&!i.$parent&&(i.$parent=t),i;let o=this._moddle.getPropertyDescriptor(t,n);if(!o.isReference)return o.isId?e&&this._copyId(e,t,r):q(e)?Ge(e,(a,s)=>{let c=this.copyProperty(s,t,n,r);return c?a.concat(c):a},[]):Se(e)&&e.$type?this._moddle.getElementDescriptor(e).isGeneric?void 0:(i=this._bpmnFactory.create(e.$type),i.$parent=t,i=this.copyElement(e,i,null,r),i):e};zi.prototype._copyId=function(e,t,n=!1){if(n)return e;if(!this._moddle.ids.assigned(e))return this._moddle.ids.claim(e,t),e};function wp(e,t){return Ge(e.properties,(n,r)=>t&&r.default?n:n.concat(r.name),[])}var Sp={__depends__:[Qy],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",Ep],moddleCopy:["type",zi]};N();var Jy=Math.round;function $s(e,t){this._modeling=e,this._eventBus=t}$s.$inject=["modeling","eventBus"];$s.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,a=t.height||e.height,s=t.x||e.x,c=t.y||e.y,u=Jy(s+o/2),p=Jy(c+a/2),l=r.replaceShape(e,C({},t,{x:u,y:p,width:o,height:a}),n);return i.fire("replace.end",{element:e,newElement:l,hints:n}),l};function Cp(e,t){t.on("replace.end",500,function(n){let{newElement:r,hints:i={}}=n;i.select!==!1&&e.select(r)})}Cp.$inject=["selection","eventBus"];var e_={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",Cp],replace:["type",$s]};N();function yA(e,t,n){q(n)||(n=[n]),E(n,function(r){wn(e[r])||(t[r]=e[r])})}var _A=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function bA(e,t){var n=e&&dt(e,"collapsed")?e.collapsed:!ie(e),r;return t&&(dt(t,"collapsed")||dt(t,"isExpanded"))?r=dt(t,"collapsed")?t.collapsed:!t.isExpanded:r=n,n!==r}function Pp(e,t,n,r,i,o){function a(s,c,u){u=u||{};var p=c.type,l=s.businessObject;if(Rp(l)&&(p==="bpmn:SubProcess"||p==="bpmn:AdHocSubProcess")&&bA(s,c))return r.toggleCollapse(s),s;var f=e.create(p),d={type:p,businessObject:f};d.di={},p==="bpmn:ExclusiveGateway"&&(d.di.isMarkerVisible=!0),yA(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var m=wp(l.$descriptor),g=wp(f.$descriptor,!0),v=xA(m,g);C(f,mt(c,_A));var w=Q(v,function(b){return b==="eventDefinitions"?t_(s,c.eventDefinitionType):b==="loopCharacteristics"?!Qe(f):dt(f,b)||b==="processRef"&&c.isExpanded===!1||b==="triggeredByEvent"?!1:b==="isForCompensation"?!Qe(f):!0});if(f=n.copyElement(l,f,w),c.eventDefinitionType&&(t_(f,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),h(l,"bpmn:Activity")){if(Rp(l))d.isExpanded=ie(s);else if(c&&dt(c,"isExpanded")){d.isExpanded=c.isExpanded;var S=t.getDefaultSize(f,{isExpanded:d.isExpanded});d.width=S.width,d.height=S.height,d.x=s.x-(d.width-s.width)/2,d.y=s.y-(d.height-s.height)/2}ie(s)&&!h(l,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(Rp(l)&&!Rp(f)&&(u.moveChildren=!1),h(l,"bpmn:Participant")){c.isExpanded===!0?f.processRef=e.create("bpmn:Process"):u.moveChildren=!1;var x=Me(s);ce(s).isHorizontal||(ce(d).isHorizontal=x),d.width=x?s.width:t.getDefaultSize(d).width,d.height=x?t.getDefaultSize(d).height:s.height}return o.allowed("shape.resize",{shape:f})||(d.height=t.getDefaultSize(d).height,d.width=t.getDefaultSize(d).width),f.name=l.name,te(l,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&te(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(f.default=l.default),c.host&&!h(l,"bpmn:BoundaryEvent")&&h(f,"bpmn:BoundaryEvent")&&(d.host=c.host),(d.type==="bpmn:DataStoreReference"||d.type==="bpmn:DataObjectReference")&&(d.x=s.x+(s.width-d.width)/2),i.replaceElement(s,d,{...u,targetElement:c})}this.replaceElement=a}Pp.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function Rp(e){return h(e,"bpmn:SubProcess")}function t_(e,t){var n=j(e);return t&&n.get("eventDefinitions").some(function(r){return h(r,t)})}function xA(e,t){return e.filter(function(n){return t.includes(n)})}var Ap={__depends__:[Sp,e_,rt],bpmnReplace:["type",Pp]};N();var EA=250;function Nr(e){this._eventBus=e,this._tools=[],this._active=null}Nr.$inject=["eventBus"];Nr.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)};Nr.prototype.isActive=function(e){return e&&this._active===e};Nr.prototype.length=function(e){return this._tools.length};Nr.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))};Nr.prototype.bindEvents=function(e,t){var n=this._eventBus,r=[];n.on(t.tool+".init",function(i){var o=i.context;if(!o.reactivate&&this.isActive(e)){this.setActive(null);return}this.setActive(e)},this),E(t,function(i){r.push(i+".ended"),r.push(i+".canceled")}),n.on(r,EA,function(i){this._active&&(wA(i)||this.setActive(null))},this)};function wA(e){var t=e.originalEvent&&e.originalEvent.target;return t&&Bn(t,'.group[data-group="tools"]')}var fi={__depends__:[kt],__init__:["toolManager"],toolManager:["type",Nr]};N();N();function n_(e,t){if(e==="x"){if(t>0)return"e";if(t<0)return"w"}if(e==="y"){if(t>0)return"s";if(t<0)return"n"}return null}function r_(e,t){var n=[];return E(e.concat(t),function(r){var i=r.incoming,o=r.outgoing;E(i.concat(o),function(a){var s=a.source,c=a.target;(zs(e,s)||zs(e,c)||zs(t,s)||zs(t,c))&&(zs(n,a)||n.push(a))})}),n}function zs(e,t){return e.indexOf(t)!==-1}function i_(e,t,n){var r=e.x,i=e.y,o=e.width,a=e.height,s=n.x,c=n.y;switch(t){case"n":return{x:r,y:i+c,width:o,height:a-c};case"s":return{x:r,y:i,width:o,height:a+c};case"w":return{x:r+s,y:i,width:o-s,height:a};case"e":return{x:r,y:i,width:o+s,height:a};default:throw new Error("unknown direction: "+t)}}var Kf=Math.abs,SA=Math.round,Or={x:"width",y:"height"},s_="crosshair",di={n:"top",w:"left",s:"bottom",e:"right"},CA=1500,Tp={n:"s",w:"e",s:"n",e:"w"},Mp=20;function Xt(e,t,n,r,i,o,a){this._canvas=e,this._dragging=t,this._eventBus=n,this._modeling=r,this._rules=i,this._toolManager=o,this._mouse=a;var s=this;o.registerTool("space",{tool:"spaceTool.selection",dragging:"spaceTool"}),n.on("spaceTool.selection.end",function(c){n.once("spaceTool.selection.ended",function(){s.activateMakeSpace(c.originalEvent)})}),n.on("spaceTool.move",CA,function(c){var u=c.context,p=u.initialized;p||(p=u.initialized=s.init(c,u)),p&&a_(c)}),n.on("spaceTool.end",function(c){var u=c.context,p=u.axis,l=u.direction,f=u.movingShapes,d=u.resizingShapes,m=u.start;if(u.initialized){a_(c);var g={x:0,y:0};g[p]=SA(c["d"+p]),s.makeSpace(f,d,g,l,m),n.once("spaceTool.ended",function(v){s.activateSelection(v.originalEvent,!0,!0)})}})}Xt.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"];Xt.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:s_,data:{context:{reactivate:n}},trapClick:!1})};Xt.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:s_,data:{context:{}}})};Xt.prototype.makeSpace=function(e,t,n,r,i){return this._modeling.createSpace(e,t,n,r,i)};Xt.prototype.init=function(e,t){var n=Kf(e.dx)>Kf(e.dy)?"x":"y",r=e["d"+n],i=e[n]-r;if(Kf(r)<5)return!1;r<0&&(r*=-1),Tr(e)&&(r*=-1);var o=n_(n,r),a=this._canvas.getRootElement();!Mi(e)&&e.hover&&(a=e.hover);var s=[...Zn(a,!0),...a.attachers||[]],c=this.calculateAdjustments(s,n,r,i),u=this._eventBus.fire("spaceTool.getMinDimensions",{axis:n,direction:o,shapes:c.resizingShapes,start:i}),p=RA(c,n,o,i,u);return C(t,c,{axis:n,direction:o,spaceToolConstraints:p,start:i}),Di("resize-"+(n==="x"?"ew":"ns")),!0};Xt.prototype.calculateAdjustments=function(e,t,n,r){var i=this._rules,o=[],a=[],s=[],c=[];function u(f){o.includes(f)||o.push(f);var d=f.label;d&&!o.includes(d)&&o.push(d)}function p(f){a.includes(f)||a.push(f)}E(e,function(f){if(!(!f.parent||ee(f))){if(de(f)){c.push(f);return}var d=f[t],m=d+f[Or[t]];if(PA(f)&&(n>0&&X(f)[t]>r||n<0&&X(f)[t]<r)){s.push(f);return}if(n>0&&d>r||n<0&&m<r){u(f);return}if(d<r&&m>r&&i.allowed("shape.resize",{shape:f})){p(f);return}}}),E(o,function(f){var d=f.attachers;d&&E(d,function(m){u(m)})});var l=o.concat(a);return E(s,function(f){var d=f.host;Gi(l,d)&&u(f)}),l=o.concat(a),E(c,function(f){var d=f.source,m=f.target,g=f.label;Gi(l,d)&&Gi(l,m)&&g&&u(g)}),{movingShapes:o,resizingShapes:a}};Xt.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)};Xt.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function o_(e){return{top:e.top-Mp,right:e.right+Mp,bottom:e.bottom+Mp,left:e.left-Mp}}function a_(e){var t=e.context,n=t.spaceToolConstraints;if(n){var r,i;ne(n.left)&&(r=Math.max(e.x,n.left),e.dx=e.dx+r-e.x,e.x=r),ne(n.right)&&(r=Math.min(e.x,n.right),e.dx=e.dx+r-e.x,e.x=r),ne(n.top)&&(i=Math.max(e.y,n.top),e.dy=e.dy+i-e.y,e.y=i),ne(n.bottom)&&(i=Math.min(e.y,n.bottom),e.dy=e.dy+i-e.y,e.y=i)}}function RA(e,t,n,r,i){var o=e.movingShapes,a=e.resizingShapes;if(a.length){var s={},c,u;return E(a,function(p){var l=p.attachers,f=p.children,d=Z(p),m=Q(f,function(L){return!de(L)&&!ee(L)&&!Gi(o,L)&&!Gi(a,L)}),g=Q(f,function(L){return!de(L)&&!ee(L)&&Gi(o,L)}),v,w,S,x=[],b=[],R,A,O,T;m.length&&(w=o_(Z(Ce(m))),v=r-d[di[n]]+w[di[n]],n==="n"?s.bottom=u=ne(u)?Math.min(u,v):v:n==="w"?s.right=u=ne(u)?Math.min(u,v):v:n==="s"?s.top=c=ne(c)?Math.max(c,v):v:n==="e"&&(s.left=c=ne(c)?Math.max(c,v):v)),g.length&&(S=o_(Z(Ce(g))),v=r-S[di[Tp[n]]]+d[di[Tp[n]]],n==="n"?s.bottom=u=ne(u)?Math.min(u,v):v:n==="w"?s.right=u=ne(u)?Math.min(u,v):v:n==="s"?s.top=c=ne(c)?Math.max(c,v):v:n==="e"&&(s.left=c=ne(c)?Math.max(c,v):v)),l&&l.length&&(l.forEach(function(L){Gi(o,L)?x.push(L):b.push(L)}),x.length&&(R=Z(Ce(x.map(X))),A=d[di[Tp[n]]]-(R[di[Tp[n]]]-r)),b.length&&(O=Z(Ce(b.map(X))),T=O[di[n]]-(d[di[n]]-r)),n==="n"?(v=Math.min(A||1/0,T||1/0),s.bottom=u=ne(u)?Math.min(u,v):v):n==="w"?(v=Math.min(A||1/0,T||1/0),s.right=u=ne(u)?Math.min(u,v):v):n==="s"?(v=Math.max(A||-1/0,T||-1/0),s.top=c=ne(c)?Math.max(c,v):v):n==="e"&&(v=Math.max(A||-1/0,T||-1/0),s.left=c=ne(c)?Math.max(c,v):v));var I=i&&i[p.id];I&&(n==="n"?(v=r+p[Or[t]]-I[Or[t]],s.bottom=u=ne(u)?Math.min(u,v):v):n==="w"?(v=r+p[Or[t]]-I[Or[t]],s.right=u=ne(u)?Math.min(u,v):v):n==="s"?(v=r-p[Or[t]]+I[Or[t]],s.top=c=ne(c)?Math.max(c,v):v):n==="e"&&(v=r-p[Or[t]]+I[Or[t]],s.left=c=ne(c)?Math.max(c,v):v))}),s}}function Gi(e,t){return e.indexOf(t)!==-1}function PA(e){return!!e.host}N();var Yf="djs-dragging",c_="djs-resizing",AA=250,Dp=Math.max;function kp(e,t,n,r,i){function o(a,s){E(a,function(c){i.addDragger(c,s),n.addMarker(c,Yf)})}e.on("spaceTool.selection.start",function(a){var s=n.getLayer("space"),c=a.context,u={x:"M 0,-10000 L 0,10000",y:"M -10000,0 L 10000,0"},p=U("g");$(p,r.cls("djs-crosshair-group",["no-events"])),J(s,p);var l=U("path");$(l,"d",u.x),pe(l).add("djs-crosshair"),J(p,l);var f=U("path");$(f,"d",u.y),pe(f).add("djs-crosshair"),J(p,f),c.crosshairGroup=p}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;Fe(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&Pe(c)}),e.on("spaceTool.move",AA,function(a){var s=a.context,c=s.line,u=s.axis,p=s.movingShapes,l=s.resizingShapes;if(s.initialized){if(!s.dragGroup){var f=n.getLayer("space");c=U("path"),$(c,"d","M0,0 L0,0"),pe(c).add("djs-crosshair"),J(f,c),s.line=c;var d=U("g");$(d,r.cls("djs-drag-group",["no-events"])),J(n.getActiveLayer(),d),o(p,d);var m=s.movingConnections=t.filter(function(b){var R=!1;E(p,function(I){E(I.outgoing,function(L){b===L&&(R=!0)})});var A=!1;E(p,function(I){E(I.incoming,function(L){b===L&&(A=!0)})});var O=!1;E(l,function(I){E(I.outgoing,function(L){b===L&&(O=!0)})});var T=!1;return E(l,function(I){E(I.incoming,function(L){b===L&&(T=!0)})}),de(b)&&(R||O)&&(A||T)});o(m,d),s.dragGroup=d}if(!s.frameGroup){var g=U("g");$(g,r.cls("djs-frame-group",["no-events"])),J(n.getActiveLayer(),g);var v=[];E(l,function(b){var R=i.addFrame(b,g),A=R.getBBox();v.push({element:R,initialBounds:A}),n.addMarker(b,c_)}),s.frameGroup=g,s.frames=v}var w={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};$(c,{d:w[u]});var S={x:"y",y:"x"},x={x:a.dx,y:a.dy};x[S[s.axis]]=0,Fe(s.dragGroup,x.x,x.y),E(s.frames,function(b){var R=b.element,A=b.initialBounds,O,T;s.direction==="e"?$(R,{width:Dp(A.width+x.x,5)}):(O=Dp(A.width-x.x,5),$(R,{width:O,x:A.x+A.width-O})),s.direction==="s"?$(R,{height:Dp(A.height+x.y,5)}):(T=Dp(A.height-x.y,5),$(R,{height:T,y:A.y+A.height-T}))})}}),e.on("spaceTool.cleanup",function(a){var s=a.context,c=s.movingShapes,u=s.movingConnections,p=s.resizingShapes,l=s.line,f=s.dragGroup,d=s.frameGroup;E(c,function(m){n.removeMarker(m,Yf)}),E(u,function(m){n.removeMarker(m,Yf)}),f&&(Pe(l),Pe(f)),E(p,function(m){n.removeMarker(m,c_)}),d&&Pe(d)})}kp.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];var u_={__init__:["spaceToolPreview"],__depends__:[kt,Et,fi,Dn,pr],spaceTool:["type",Xt],spaceToolPreview:["type",kp]};N();function ea(e,t){e.invoke(Xt,this),this._canvas=t}ea.$inject=["injector","canvas"];B(ea,Xt);ea.prototype.calculateAdjustments=function(e,t,n,r){var i=this._canvas.getRootElement(),o=e[0]===i?null:e[0],a=[];o&&(a=Sn(wi(i.children.filter(u=>h(u,"bpmn:Artifact")),Ce(o))));let s=[...e,...a];var c=Xt.prototype.calculateAdjustments.call(this,s,t,n,r);return c.resizingShapes=c.resizingShapes.filter(function(u){return!(h(u,"bpmn:TextAnnotation")||TA(u)&&(t==="y"&&Me(u)||t==="x"&&!Me(u)))}),c};function TA(e){return h(e,"bpmn:Participant")&&!j(e).processRef}var Np={__depends__:[u_],spaceTool:["type",ea]};N();function We(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)}We.$inject=["eventBus","injector"];We.prototype.execute=function(e,t){if(!e)throw new Error("command required");this._currentExecution.trigger="execute";let n={command:e,context:t};this._pushAction(n),this._internalExecute(n),this._popAction()};We.prototype.canExecute=function(e,t){let n={command:e,context:t},r=this._getHandler(e),i=this._fire(e,"canExecute",n);if(i===void 0){if(!r)return!1;r.canExecute&&(i=r.canExecute(t))}return i};We.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})};We.prototype.undo=function(){let e=this._getUndoAction(),t;if(e){for(this._currentExecution.trigger="undo",this._pushAction(e);e&&(this._internalUndo(e),t=this._getUndoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}};We.prototype.redo=function(){let e=this._getRedoAction(),t;if(e){for(this._currentExecution.trigger="redo",this._pushAction(e);e&&(this._internalExecute(e,!0),t=this._getRedoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}};We.prototype.register=function(e,t){this._setHandler(e,t)};We.prototype.registerHandler=function(e,t){if(!e||!t)throw new Error("command and handlerCls must be defined");let n=this._injector.instantiate(t);this.register(e,n)};We.prototype.canUndo=function(){return!!this._getUndoAction()};We.prototype.canRedo=function(){return!!this._getRedoAction()};We.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]};We.prototype._getUndoAction=function(){return this._stack[this._stackIdx]};We.prototype._internalUndo=function(e){let 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)})};We.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);let r=t?[e+"."+t,t]:[e],i;n=this._eventBus.createEvent(n);for(let o of r)if(i=this._eventBus.fire("commandStack."+o,n),n.cancelBubble)break;return i};We.prototype._createId=function(){return this._uid++};We.prototype._atomicDo=function(e){let t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}};We.prototype._internalExecute=function(e,t){let 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()};We.prototype._pushAction=function(e){let 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)};We.prototype._popAction=function(){let e=this._currentExecution,t=e.trigger,n=e.actions,r=e.dirty;n.pop(),n.length||(this._eventBus.fire("elements.changed",{elements:mc("id",r.reverse())}),r.length=0,this._fire("changed",{trigger:t}),e.trigger=null)};We.prototype._markDirty=function(e){let t=this._currentExecution;e&&(e=q(e)?e:[e],t.dirty=t.dirty.concat(e))};We.prototype._executedAction=function(e,t){let n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)};We.prototype._revertedAction=function(e){this._stackIdx--};We.prototype._getHandler=function(e){return this._handlerMap[e]};We.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 p_={commandStack:["type",We]};N();function kn(e,t){if(typeof t!="function")throw new Error("removeFn iterator must be a function");if(!e)return[];for(var n;n=e[0];)t(n);return e}var MA=250,l_=1400;function Gs(e,t,n){k.call(this,t);var r=e.get("movePreview",!1);t.on("shape.move.start",l_,function(i){var o=i.context,a=o.shapes,s=o.validatedShapes;o.shapes=f_(a),o.validatedShapes=f_(s)}),r&&t.on("shape.move.start",MA,function(i){var o=i.context,a=o.shapes,s=[];E(a,function(c){E(c.labels,function(u){!u.hidden&&o.shapes.indexOf(u)===-1&&s.push(u),c.labelTarget&&s.push(c)})}),E(s,function(c){r.makeDraggable(o,c,!0)})}),this.preExecuted("elements.move",l_,function(i){var o=i.context,a=o.closure,s=a.enclosedElements,c=[];E(s,function(u){E(u.labels,function(p){s[p.id]||c.push(p)})}),a.addAll(c)}),this.preExecute(["connection.delete","shape.delete"],function(i){var o=i.context,a=o.connection||o.shape;kn(a.labels,function(s){n.removeShape(s,{nested:!0})})}),this.execute("shape.delete",function(i){var o=i.context,a=o.shape,s=a.labelTarget;s&&(o.labelTargetIndex=co(s.labels,a),o.labelTarget=s,a.labelTarget=null)}),this.revert("shape.delete",function(i){var o=i.context,a=o.shape,s=o.labelTarget,c=o.labelTargetIndex;s&&(Ae(s.labels,a,c),a.labelTarget=s)})}B(Gs,k);Gs.$inject=["injector","eventBus","modeling"];function f_(e){return Q(e,function(t){return e.indexOf(t.labelTarget)===-1})}var d_={__init__:["labelSupport"],labelSupport:["type",Gs]};N();var DA=251,m_=1401,h_="attach-ok";function Vs(e,t,n,r,i){k.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",m_,function(a){var s=a.context,c=s.shapes,u=s.validatedShapes;s.shapes=kA(c),s.validatedShapes=NA(u)}),o&&t.on("shape.move.start",DA,function(a){var s=a.context,c=s.shapes,u=Xf(c);E(u,function(p){o.makeDraggable(s,p,!0),E(p.labels,function(l){o.makeDraggable(s,l,!0)})})}),o&&t.on("shape.move.start",function(a){var s=a.context,c=s.shapes;if(c.length===1){var u=c[0],p=u.host;p&&(n.addMarker(p,h_),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(p,h_)}))}}),this.preExecuted("elements.move",m_,function(a){var s=a.context,c=s.closure,u=s.shapes,p=Xf(u);E(p,function(l){c.add(l,c.topLevel[l.host.id])})}),this.postExecuted("elements.move",function(a){var s=a.context,c=s.shapes,u=s.newHost,p;u&&c.length!==1||(u?p=c:p=Q(c,function(l){var f=l.host;return OA(l)&&!BA(c,f)}),E(p,function(l){i.updateAttachment(l,u)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;E(s,function(c){E(c.attachers,function(u){E(u.outgoing.slice(),function(p){var l=r.allowed("connection.reconnect",{connection:p,source:p.source,target:p.target});l||i.removeConnection(p)}),E(u.incoming.slice(),function(p){var l=r.allowed("connection.reconnect",{connection:p,source:p.source,target:p.target});l||i.removeConnection(p)})})})}),this.postExecute("shape.create",function(a){var s=a.context,c=s.shape,u=s.host;u&&i.updateAttachment(c,u)}),this.postExecute("shape.replace",function(a){var s=a.context,c=s.oldShape,u=s.newShape;kn(c.attachers,function(p){var l=r.allowed("elements.move",{target:u,shapes:[p]});l==="attach"?i.updateAttachment(p,u):i.removeShape(p)}),u.attachers.length&&E(u.attachers,function(p){var l=If(p,c,u);i.moveShape(p,l,p.parent)})}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.oldBounds,p=s.newBounds,l=c.attachers,f=s.hints||{};f.attachSupport!==!1&&E(l,function(d){var m=If(d,u,p);i.moveShape(d,m,d.parent),E(d.labels,function(g){i.moveShape(g,m,g.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;kn(s.attachers,function(c){i.removeShape(c)}),s.host&&i.updateAttachment(s,null)})}B(Vs,k);Vs.$inject=["injector","eventBus","canvas","rules","modeling"];function Xf(e){return _i(je(e,function(t){return t.attachers||[]}))}function kA(e){var t=Xf(e);return gl("id",e,t)}function NA(e){var t=Vt(e,"id");return Q(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function OA(e){return!!e.host}function BA(e,t){return e.indexOf(t)!==-1}var v_={__depends__:[Et],__init__:["attachSupport"],attachSupport:["type",Vs]};N();function an(e){this._model=e}an.$inject=["moddle"];an.prototype._needsId=function(e){return te(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"])};an.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;h(e,"bpmn:Activity")?t="Activity":h(e,"bpmn:Event")?t="Event":h(e,"bpmn:Gateway")?t="Gateway":te(e,["bpmn:SequenceFlow","bpmn:MessageFlow"])?t="Flow":t=(e.$type||"").replace(/^[^:]*:/g,""),t+="_",!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e))};an.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n};an.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})};an.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",C({bpmnElement:e,bounds:this.createDiBounds()},t))};an.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)};an.prototype.createDiWaypoints=function(e){var t=this;return je(e,function(n){return t.createDiWaypoint(n)})};an.prototype.createDiWaypoint=function(e){return this.create("dc:Point",mt(e,["x","y"]))};an.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",C({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))};an.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",C({bpmnElement:e},t))};N();function $t(e,t,n){k.call(this,e),this._bpmnFactory=t;var r=this;function i(d){var m=d.context,g=m.hints||{},v;!m.cropped&&g.createElementsBehavior!==!1&&(v=m.connection,v.waypoints=n.getCroppedWaypoints(v),m.cropped=!0)}this.executed(["connection.layout","connection.create"],i),this.reverted(["connection.layout"],function(d){delete d.context.cropped});function o(d){var m=d.context;r.updateParent(m.shape||m.connection,m.oldParent)}function a(d){var m=d.context,g=m.shape||m.connection,v=m.parent||m.newParent;r.updateParent(g,v)}this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],sn(o)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],sn(a));function s(d){var m=d.context,g=m.oldRoot,v=g.children;E(v,function(w){h(w,"bpmn:BaseElement")&&r.updateParent(w)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(d){var m=d.context.shape;h(m,"bpmn:BaseElement")&&r.updateBounds(m)}this.executed(["shape.move","shape.create","shape.resize"],sn(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],sn(function(d){d.context.shape.type!=="label"&&c(d)})),e.on("shape.changed",function(d){d.element.type==="label"&&c({context:{shape:d.element}})});function u(d){r.updateConnection(d.context)}this.executed(["connection.create","connection.move","connection.delete","connection.reconnect"],sn(u)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],sn(u));function p(d){r.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],sn(p)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],sn(p)),this.executed("connection.reconnect",sn(function(d){var m=d.context,g=m.connection,v=m.oldSource,w=m.newSource,S=j(g),x=j(v),b=j(w);S.conditionExpression&&!te(b,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(m.oldConditionExpression=S.conditionExpression,delete S.conditionExpression),v!==w&&x.default===S&&(m.oldDefault=x.default,delete x.default)})),this.reverted("connection.reconnect",sn(function(d){var m=d.context,g=m.connection,v=m.oldSource,w=m.newSource,S=j(g),x=j(v),b=j(w);m.oldConditionExpression&&(S.conditionExpression=m.oldConditionExpression),m.oldDefault&&(x.default=m.oldDefault,delete b.default)}));function l(d){r.updateAttachment(d.context)}this.executed(["element.updateAttachment"],sn(l)),this.reverted(["element.updateAttachment"],sn(l)),this.executed("element.updateLabel",sn(f)),this.reverted("element.updateLabel",sn(f));function f(d){let{element:m}=d.context,g=gt(m),v=ce(m),w=v&&v.get("label");mn(m)||Eo(m)||(g&&!w?v.set("label",t.create("bpmndi:BPMNLabel")):!g&&w&&v.set("label",void 0))}}B($t,k);$t.$inject=["eventBus","bpmnFactory","connectionDocking"];$t.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,r=t.host;n.attachedToRef=r&&r.businessObject};$t.prototype.updateParent=function(e,t){if(!ee(e)&&!(h(e,"bpmn:DataStoreReference")&&e.parent&&h(e.parent,"bpmn:Collaboration"))){var n=e.parent,r=e.businessObject,i=ce(e),o=n&&n.businessObject,a=ce(n);h(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(r,o,t&&t.businessObject),h(e,"bpmn:DataOutputAssociation")&&(e.source?o=e.source.businessObject:o=null),h(e,"bpmn:DataInputAssociation")&&(e.target?o=e.target.businessObject:o=null),this.updateSemanticParent(r,o),h(e,"bpmn:DataObjectReference")&&r.dataObjectRef&&this.updateSemanticParent(r.dataObjectRef,o),this.updateDiParent(i,a)}};$t.prototype.updateBounds=function(e){var t=ce(e),n=LA(e);if(n){var r=Dt(n,t.get("bounds"));C(n,{x:e.x+r.x,y:e.y+r.y})}var i=ee(e)?this._getLabel(t):t,o=i.bounds;o||(o=this._bpmnFactory.createDiBounds(),i.set("bounds",o)),C(o,{x:e.x,y:e.y,width:e.width,height:e.height})};$t.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var r,i;h(n,"bpmn:Lane")&&(r=n.get("flowNodeRef"),Oe(r,e)),h(t,"bpmn:Lane")&&(i=t.get("flowNodeRef"),Ae(i,e))}};$t.prototype.updateDiConnection=function(e,t,n){var r=ce(e),i=ce(t),o=ce(n);r.sourceElement&&r.sourceElement.bpmnElement!==j(t)&&(r.sourceElement=t&&i),r.targetElement&&r.targetElement.bpmnElement!==j(n)&&(r.targetElement=n&&o)};$t.prototype.updateDiParent=function(e,t){if(t&&!h(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(Oe(n,e),e.$parent=null)}};function IA(e){for(;e&&!h(e,"bpmn:Definitions");)e=e.$parent;return e}$t.prototype.getLaneSet=function(e){var t,n;return h(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(h(e,"bpmn:Participant")&&(e=e.processRef),n=e.get("laneSets"),t=n[0],t||(t=this._bpmnFactory.create("bpmn:LaneSet"),t.$parent=e,n.push(t)),t)};$t.prototype.updateSemanticParent=function(e,t,n){var r;if(e.$parent!==t&&!((h(e,"bpmn:DataInput")||h(e,"bpmn:DataOutput"))&&(h(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(h(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),r="lanes";else if(h(e,"bpmn:FlowElement")){if(t){if(h(t,"bpmn:Participant"))t=t.processRef;else if(h(t,"bpmn:Lane"))do t=t.$parent.$parent;while(h(t,"bpmn:Lane"))}r="flowElements"}else if(h(e,"bpmn:Artifact")){for(;t&&!h(t,"bpmn:Process")&&!h(t,"bpmn:SubProcess")&&!h(t,"bpmn:Collaboration");)if(h(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;r="artifacts"}else if(h(e,"bpmn:MessageFlow"))r="messageFlows";else if(h(e,"bpmn:Participant")){r="participants";var i=e.processRef,o;i&&(o=IA(e.$parent||t),e.$parent&&(Oe(o.get("rootElements"),i),i.$parent=null),t&&(Ae(o.get("rootElements"),i),i.$parent=o))}else h(e,"bpmn:DataOutputAssociation")?r="dataOutputAssociations":h(e,"bpmn:DataInputAssociation")&&(r="dataInputAssociations");if(!r)throw new Error(`no parent for <${e.id}> in <${t.id}>`);var a;if(e.$parent&&(a=e.$parent.get(r),Oe(a,e)),t?(a=t.get(r),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(r);Oe(a,e),t&&(s||(s=[],t.set(r,s)),s.push(e))}}};$t.prototype.updateConnectionWaypoints=function(e){var t=ce(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))};$t.prototype.updateConnection=function(e){var t=e.connection,n=j(t),r=t.source,i=j(r),o=t.target,a=j(t.target),s;if(h(n,"bpmn:DataAssociation"))h(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=i,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):h(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||i,this.updateSemanticParent(n,i,s),n.targetRef=a);else{var c=h(n,"bpmn:SequenceFlow");n.sourceRef!==i&&(c&&(Oe(n.sourceRef&&n.sourceRef.get("outgoing"),n),i&&i.get("outgoing")&&i.get("outgoing").push(n)),n.sourceRef=i),n.targetRef!==a&&(c&&(Oe(n.targetRef&&n.targetRef.get("incoming"),n),a&&a.get("incoming")&&a.get("incoming").push(n)),n.targetRef=a)}this.updateConnectionWaypoints(t),this.updateDiConnection(t,r,o)};$t.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function sn(e){return function(t){var n=t.context,r=n.shape||n.connection||n.element;h(r,"bpmn:BaseElement")&&e(t)}}function LA(e){if(h(e,"bpmn:Activity")){var t=ce(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}N();function lr(e,t){Pn.call(this),this._bpmnFactory=e,this._moddle=t}B(lr,Pn);lr.$inject=["bpmnFactory","moddle"];lr.prototype._baseCreate=Pn.prototype.create;lr.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,C({type:"label",di:n},ir,t))}return this.createElement(e,t)};lr.prototype.createElement=function(e,t){t=C({},t||{});var n,r=t.businessObject,i=t.di;if(!r){if(!t.type)throw new Error("no shape type specified");r=this._bpmnFactory.create(t.type)}if(!FA(i)){var o=C({},i||{},{id:r.id+"_di"});e==="root"?i=this._bpmnFactory.createDiPlane(r,o):e==="connection"?i=this._bpmnFactory.createDiEdge(r,o):i=this._bpmnFactory.createDiShape(r,o)}h(r,"bpmn:Group")&&(t=C({isFrame:!0},t)),t=jA(r,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=Zf(i,t,"isExpanded")),te(r,["bpmn:Lane","bpmn:Participant"])&&(t=Zf(i,t,"isHorizontal")),h(r,"bpmn:SubProcess")&&(t.collapsed=!ie(r,i)),h(r,"bpmn:ExclusiveGateway")&&(dt(i,"isMarkerVisible")?i.isMarkerVisible===void 0&&(i.isMarkerVisible=!1):i.isMarkerVisible=!0),Ue(t.triggeredByEvent)&&(r.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),Ue(t.cancelActivity)&&(r.cancelActivity=t.cancelActivity,delete t.cancelActivity);var a,s;return t.eventDefinitionType&&(a=r.get("eventDefinitions")||[],s=this._bpmnFactory.create(t.eventDefinitionType,t.eventDefinitionAttrs),t.eventDefinitionType==="bpmn:ConditionalEventDefinition"&&(s.condition=this._bpmnFactory.create("bpmn:FormalExpression")),a.push(s),s.$parent=r,r.eventDefinitions=a,delete t.eventDefinitionType),n=this.getDefaultSize(r,i),t=C({id:r.id},n,t,{businessObject:r,di:i}),this._baseCreate(e,t)};lr.prototype.getDefaultSize=function(e,t){var n=j(e);if(t=t||ce(e),h(n,"bpmn:SubProcess"))return ie(n,t)?{width:350,height:200}:{width:100,height:80};if(h(n,"bpmn:Task"))return{width:100,height:80};if(h(n,"bpmn:Gateway"))return{width:50,height:50};if(h(n,"bpmn:Event"))return{width:36,height:36};if(h(n,"bpmn:Participant")){var r=t.isHorizontal===void 0||t.isHorizontal===!0;return ie(n,t)?r?{width:600,height:250}:{width:250,height:600}:r?{width:400,height:60}:{width:60,height:400}}return h(n,"bpmn:Lane")?{width:400,height:100}:h(n,"bpmn:DataObjectReference")?{width:36,height:50}:h(n,"bpmn:DataStoreReference")?{width:50,height:50}:h(n,"bpmn:TextAnnotation")?{width:100,height:40}:h(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}};lr.prototype.createParticipantShape=function(e){return Se(e)||(e={isExpanded:e}),e=C({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function jA(e,t,n){return E(n,function(r){t=Zf(e,t,r)}),t}function Zf(e,t,n){return t[n]===void 0?t:(e[n]=t[n],Nt(t,[n]))}function FA(e){return te(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}N();N();function ta(e,t){this._modeling=e,this._canvas=t}ta.$inject=["modeling","canvas"];ta.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,r=e.alignment;E(n,function(i){var o={x:0,y:0};Ue(r.left)?o.x=r.left-i.x:Ue(r.right)?o.x=r.right-i.width-i.x:Ue(r.center)?o.x=r.center-Math.round(i.width/2)-i.x:Ue(r.top)?o.y=r.top-i.y:Ue(r.bottom)?o.y=r.bottom-i.height-i.y:Ue(r.middle)&&(o.y=r.middle-Math.round(i.height/2)-i.y),t.moveElements([i],o,i.parent)})};ta.prototype.postExecute=function(e){};N();function na(e){this._modeling=e}na.$inject=["modeling"];na.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};na.prototype.postExecute=function(e){var t=e.hints||{};HA(e.source,e.shape)||(t.connectionTarget===e.source?this._modeling.connect(e.shape,e.source,e.connection):this._modeling.connect(e.source,e.shape,e.connection))};function HA(e,t){return Lt(e.outgoing,function(n){return n.target===t})}function ra(e,t){this._canvas=e,this._layouter=t}ra.$inject=["canvas","layouter"];ra.prototype.execute=function(e){var t=e.connection,n=e.source,r=e.target,i=e.parent,o=e.parentIndex,a=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,a)),this._canvas.addConnection(t,i,o),t};ra.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};N();var Op=Math.round;function Ws(e){this._modeling=e}Ws.$inject=["modeling"];Ws.prototype.preExecute=function(e){var t=e.elements,n=e.parent,r=e.parentIndex,i=e.position,o=e.hints,a=this._modeling;E(t,function(l){ne(l.x)||(l.x=0),ne(l.y)||(l.y=0)});var s=Q(t,function(l){return!l.hidden}),c=Ce(s);E(t,function(l){de(l)&&(l.waypoints=je(l.waypoints,function(f){return{x:Op(f.x-c.x-c.width/2+i.x),y:Op(f.y-c.y-c.height/2+i.y)}})),C(l,{x:Op(l.x-c.x-c.width/2+i.x),y:Op(l.y-c.y-c.height/2+i.y)})});var u=zr(t),p={};E(t,function(l){if(de(l)){p[l.id]=ne(r)?a.createConnection(p[l.source.id],p[l.target.id],r,l,l.parent||n,o):a.createConnection(p[l.source.id],p[l.target.id],l,l.parent||n,o);return}var f=C({},o);u.indexOf(l)===-1&&(f.autoResize=!1),ee(l)&&(f=Nt(f,["attach"])),p[l.id]=ne(r)?a.createShape(l,mt(l,["x","y","width","height"]),l.parent||n,r,f):a.createShape(l,mt(l,["x","y","width","height"]),l.parent||n,f)}),e.elements=Sn(p)};N();var g_=Math.round;function Wn(e){this._canvas=e}Wn.$inject=["canvas"];Wn.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 n.width!==void 0?C(t,n):C(t,{x:n.x-g_(t.width/2),y:n.y-g_(t.height/2)}),this._canvas.addShape(t,r,i),t};Wn.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function Vi(e){Wn.call(this,e)}B(Vi,Wn);Vi.$inject=["canvas"];var $A=Wn.prototype.execute;Vi.prototype.execute=function(e){var t=e.shape;return GA(t),t.labelTarget=e.labelTarget,$A.call(this,e)};var zA=Wn.prototype.revert;Vi.prototype.revert=function(e){return e.shape.labelTarget=null,zA.call(this,e)};function GA(e){["width","height"].forEach(function(t){typeof e[t]=="undefined"&&(e[t]=0)})}function Wi(e,t){this._canvas=e,this._modeling=t}Wi.$inject=["canvas","modeling"];Wi.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;kn(n.incoming,function(r){t.removeConnection(r,{nested:!0})}),kn(n.outgoing,function(r){t.removeConnection(r,{nested:!0})})};Wi.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=co(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t};Wi.prototype.revert=function(e){var t=e.connection,n=e.parent,r=e.parentIndex;return t.source=e.source,t.target=e.target,Ae(n.children,t,r),this._canvas.addConnection(t,n),t};N();function Us(e,t){this._modeling=e,this._elementRegistry=t}Us.$inject=["modeling","elementRegistry"];Us.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,r=e.elements;E(r,function(i){n.get(i.id)&&(i.waypoints?t.removeConnection(i):t.removeShape(i))})};function Ui(e,t){this._canvas=e,this._modeling=t}Ui.$inject=["canvas","modeling"];Ui.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;kn(n.incoming,function(r){t.removeConnection(r,{nested:!0})}),kn(n.outgoing,function(r){t.removeConnection(r,{nested:!0})}),kn(n.children,function(r){de(r)?t.removeConnection(r,{nested:!0}):t.removeShape(r,{nested:!0})})};Ui.prototype.execute=function(e){var t=this._canvas,n=e.shape,r=n.parent;return e.oldParent=r,e.oldParentIndex=co(r.children,n),t.removeShape(n),n};Ui.prototype.revert=function(e){var t=this._canvas,n=e.shape,r=e.oldParent,i=e.oldParentIndex;return Ae(r.children,n,i),t.addShape(n,r),n};N();function ia(e){this._modeling=e}ia.$inject=["modeling"];var y_={x:"y",y:"x"};ia.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,r=e.axis,i=e.dimension;function o(v,w){v.range.min=Math.min(w[r],v.range.min),v.range.max=Math.max(w[r]+w[i],v.range.max)}function a(v){return v[r]+v[i]/2}function s(v){return v.length-1}function c(v){return v.max-v.min}function u(v,w){var S={y:0};S[r]=v-a(w),S[r]&&(S[y_[r]]=0,t.moveElements([w],S,w.parent))}var p=n[0],l=s(n),f=n[l],d,m,g=0;E(n,function(v,w){var S,x,b;if(v.elements.length<2){w&&w!==n.length-1&&(o(v,v.elements[0]),g+=c(v.range));return}S=At(v.elements,r),x=S[0],w===l&&(x=S[s(S)]),b=a(x),v.range=null,E(S,function(R){if(u(b,R),v.range===null){v.range={min:R[r],max:R[r]+R[i]};return}o(v,R)}),w&&w!==n.length-1&&(g+=c(v.range))}),m=Math.abs(f.range.min-p.range.max),d=Math.round((m-g)/(n.length-1)),!(d<n.length-1)&&E(n,function(v,w){var S={},x;v===p||v===f||(x=n[w-1],v.range.max=0,E(v.elements,function(b,R){S[y_[r]]=0,S[r]=x.range.max-b[r]+d,v.range.min!==b[r]&&(S[r]+=b[r]-v.range.min),S[r]&&t.moveElements([b],S,b.parent),v.range.max=Math.max(b[r]+b[i],R?v.range.max:0)}))})};ia.prototype.postExecute=function(e){};N();function oa(e,t){this._layouter=e,this._canvas=t}oa.$inject=["layouter","canvas"];oa.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return C(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t};oa.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};N();function qs(){}qs.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=Oe(o.children,t),Ae(r.children,t,i),t.parent=r,E(t.waypoints,function(a){a.x+=n.x,a.y+=n.y,a.original&&(a.original.x+=n.x,a.original.y+=n.y)}),t};qs.prototype.revert=function(e){var t=e.connection,n=t.parent,r=e.oldParent,i=e.oldParentIndex,o=e.delta;return Oe(n.children,t),Ae(r.children,t,i),t.parent=r,E(t.waypoints,function(a){a.x-=o.x,a.y-=o.y,a.original&&(a.original.x-=o.x,a.original.y-=o.y)}),t};N();N();function Ks(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}Ks.prototype.add=function(e,t){return this.addAll([e],t)};Ks.prototype.addAll=function(e,t){var n=hm(e,!!t,this);return C(this,n),this};function mi(e){this._modeling=e}mi.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]};mi.prototype.moveClosure=function(e,t,n,r,i){var o=this._modeling,a=e.allShapes,s=e.allConnections,c=e.enclosedConnections,u=e.topLevel,p=!1;i&&i.parent===n&&(p=!0),E(a,function(l){o.moveShape(l,t,u[l.id]&&!p&&n,{recurse:!1,layout:!1})}),E(s,function(l){var f=!!a[l.source.id],d=!!a[l.target.id];c[l.id]&&f&&d?o.moveConnection(l,t,u[l.id]&&!p&&n):o.layoutConnection(l,{connectionStart:f&&Uo(l,l.source,t),connectionEnd:d&&qo(l,l.target,t)})})};mi.prototype.getClosure=function(e){return new Ks().addAll(e,!0)};function aa(e){this._helper=new mi(e)}aa.$inject=["modeling"];aa.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)};aa.prototype.postExecute=function(e){var t=e.hints,n;t&&t.primaryShape&&(n=t.primaryShape,t.oldParent=n.parent),this._helper.moveClosure(e.closure,e.delta,e.newParent,e.newHost,n)};N();function Br(e){this._modeling=e,this._helper=new mi(e)}Br.$inject=["modeling"];Br.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=mt(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=Oe(o.children,t),Ae(r.children,t,i),C(t,{parent:r,x:t.x+n.x,y:t.y+n.y}),t};Br.prototype.postExecute=function(e){var t=e.shape,n=e.delta,r=e.hints,i=this._modeling;r.layout!==!1&&(E(t.incoming,function(o){i.layoutConnection(o,{connectionEnd:qo(o,t,n)})}),E(t.outgoing,function(o){i.layoutConnection(o,{connectionStart:Uo(o,t,n)})})),r.recurse!==!1&&this.moveChildren(e)};Br.prototype.revert=function(e){var t=e.shape,n=e.oldParent,r=e.oldParentIndex,i=e.delta;return Ae(n.children,t,r),C(t,{parent:n,x:t.x-i.x,y:t.y-i.y}),t};Br.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)};Br.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};N();function qi(e){this._modeling=e}qi.$inject=["modeling"];qi.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 q(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};qi.prototype.postExecute=function(e){var t=e.connection,n=e.newSource,r=e.newTarget,i=e.dockingOrPoints,o=e.hints||{},a={};o.connectionStart&&(a.connectionStart=o.connectionStart),o.connectionEnd&&(a.connectionEnd=o.connectionEnd),o.layoutConnection!==!1&&(n&&(!r||o.docking==="source")&&(a.connectionStart=a.connectionStart||__(q(i)?i[0]:i)),r&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||__(q(i)?i[i.length-1]:i)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))};qi.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};function __(e){return e.original||e}N();function Un(e,t){this._modeling=e,this._rules=t}Un.$inject=["modeling","rules"];Un.prototype.preExecute=function(e){var t=this,n=this._modeling,r=this._rules,i=e.oldShape,o=e.newData,a=e.hints||{},s;function c(m,g,v){return r.allowed("connection.reconnect",{connection:v,source:m,target:g})}var u={x:o.x,y:o.y},p={x:i.x,y:i.y,width:i.width,height:i.height};s=e.newShape=e.newShape||t.createShape(o,u,i.parent,a),i.host&&n.updateAttachment(s,i.host);var l;a.moveChildren!==!1&&(l=i.children.slice(),n.moveElements(l,{x:0,y:0},s,a));var f=i.incoming.slice(),d=i.outgoing.slice();E(f,function(m){var g=m.source,v=c(g,s,m);v&&t.reconnectEnd(m,s,ui(m,s,p),a)}),E(d,function(m){var g=m.target,v=c(s,g,m);v&&t.reconnectStart(m,s,ci(m,s,p),a)})};Un.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)};Un.prototype.execute=function(e){};Un.prototype.revert=function(e){};Un.prototype.createShape=function(e,t,n,r){return this._modeling.createShape(e,t,n,r)};Un.prototype.reconnectStart=function(e,t,n,r){this._modeling.reconnectStart(e,t,n,r)};Un.prototype.reconnectEnd=function(e,t,n,r){this._modeling.reconnectEnd(e,t,n,r)};N();function Ki(e){this._modeling=e}Ki.$inject=["modeling"];Ki.prototype.execute=function(e){var t=e.shape,n=e.newBounds,r=e.minBounds;if(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)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},C(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};Ki.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,r=e.oldBounds,i=e.hints||{};i.layout!==!1&&(E(n.incoming,function(o){t.layoutConnection(o,{connectionEnd:ui(o,n,r)})}),E(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:ci(o,n,r)})}))};Ki.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return C(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};N();function fr(e){this._modeling=e}fr.$inject=["modeling"];fr.prototype.preExecute=function(e){var t=e.delta,n=e.direction,r=e.movingShapes,i=e.resizingShapes,o=e.start,a={};this.moveShapes(r,t),E(i,function(s){a[s.id]=WA(s)}),this.resizeShapes(i,t,n),this.updateConnectionWaypoints(r_(r,i),t,n,o,r,i,a)};fr.prototype.execute=function(){};fr.prototype.revert=function(){};fr.prototype.moveShapes=function(e,t){var n=this;E(e,function(r){n._modeling.moveShape(r,t,null,{autoResize:!1,layout:!1,recurse:!1})})};fr.prototype.resizeShapes=function(e,t,n){var r=this;E(e,function(i){var o=i_(i,n,t);r._modeling.resizeShape(i,o,null,{attachSupport:!1,autoResize:!1,layout:!1})})};fr.prototype.updateConnectionWaypoints=function(e,t,n,r,i,o,a){var s=this,c=i.concat(o);E(e,function(u){var p=u.source,l=u.target,f=VA(u),d=E_(n),m={};hi(c,p)&&hi(c,l)?(f=je(f,function(g){return x_(g,r,n)&&(g[d]=g[d]+t[d]),g.original&&x_(g.original,r,n)&&(g.original[d]=g.original[d]+t[d]),g}),s._modeling.updateWaypoints(u,f,{labelBehavior:!1})):(hi(c,p)||hi(c,l))&&(hi(i,p)?m.connectionStart=Uo(u,p,t):hi(i,l)?m.connectionEnd=qo(u,l,t):hi(o,p)?m.connectionStart=ci(u,p,a[p.id]):hi(o,l)&&(m.connectionEnd=ui(u,l,a[l.id])),s._modeling.layoutConnection(u,m))})};function b_(e){return C({},e)}function VA(e){return je(e.waypoints,function(t){return t=b_(t),t.original&&(t.original=b_(t.original)),t})}function E_(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function x_(e,t,n){var r=E_(n);if(/e|s/.test(n))return e[r]>t;if(/n|w/.test(n))return e[r]<t}function hi(e,t){return e.indexOf(t)!==-1}function WA(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}N();function sa(e){this._modeling=e}sa.$inject=["modeling"];sa.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=w_(n),t.collapsed=!t.collapsed;var r=S_(n,t.collapsed);return[t].concat(r)};sa.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,r=t.children,i=C_(r,n);return t.collapsed=!t.collapsed,[t].concat(i)};function w_(e){var t={};return E(e,function(n){t[n.id]=n.hidden,n.children&&(t=C({},t,w_(n.children)))}),t}function S_(e,t){var n=[];return E(e,function(r){r.hidden=t,n=n.concat(r),r.children&&(n=n.concat(S_(r.children,r.collapsed||t)))}),n}function C_(e,t){var n=[];return E(e,function(r){r.hidden=t[r.id],n=n.concat(r),r.children&&(n=n.concat(C_(r.children,t)))}),n}function ca(e){this._modeling=e}ca.$inject=["modeling"];ca.prototype.execute=function(e){var t=e.shape,n=e.newHost,r=t.host;return e.oldHost=r,e.attacherIdx=R_(r,t),P_(n,t),t.host=n,t};ca.prototype.revert=function(e){var t=e.shape,n=e.newHost,r=e.oldHost,i=e.attacherIdx;return t.host=r,R_(n,t),P_(r,t,i),t};function R_(e,t){return Oe(e&&e.attachers,t)}function P_(e,t,n){if(e){var r=e.attachers;r||(e.attachers=r=[]),Ae(r,t,n)}}function Ys(){}Ys.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t};Ys.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function De(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var r=this;e.on("diagram.init",function(){r.registerHandlers(n)})}De.$inject=["eventBus","elementFactory","commandStack"];De.prototype.getHandlers=function(){return{"shape.append":na,"shape.create":Wn,"shape.delete":Ui,"shape.move":Br,"shape.resize":Ki,"shape.replace":Un,"shape.toggleCollapse":sa,spaceTool:fr,"label.create":Vi,"connection.create":ra,"connection.delete":Wi,"connection.move":qs,"connection.layout":oa,"connection.updateWaypoints":Ys,"connection.reconnect":qi,"elements.create":Ws,"elements.move":aa,"elements.delete":Us,"elements.distribute":ia,"elements.align":ta,"element.updateAttachment":ca}};De.prototype.registerHandlers=function(e){E(this.getHandlers(),function(t,n){e.registerHandler(n,t)})};De.prototype.moveShape=function(e,t,n,r,i){typeof r=="object"&&(i=r,r=null);var o={shape:e,delta:t,newParent:n,newParentIndex:r,hints:i||{}};this._commandStack.execute("shape.move",o)};De.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)};De.prototype.moveElements=function(e,t,n,r){r=r||{};var i=r.attach,o=n,a;i===!0?(a=n,o=n.parent):i===!1&&(a=null);var s={shapes:e,delta:t,newParent:o,newHost:a,hints:r};this._commandStack.execute("elements.move",s)};De.prototype.moveConnection=function(e,t,n,r,i){typeof r=="object"&&(i=r,r=void 0);var o={connection:e,delta:t,newParent:n,newParentIndex:r,hints:i||{}};this._commandStack.execute("connection.move",o)};De.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)};De.prototype.createConnection=function(e,t,n,r,i,o){typeof n=="object"&&(o=i,i=r,r=n,n=void 0),r=this._create("connection",r);var a={source:e,target:t,parent:i,parentIndex:n,connection:r,hints:o};return this._commandStack.execute("connection.create",a),a.connection};De.prototype.createShape=function(e,t,n,r,i){typeof r!="number"&&(i=r,r=void 0),i=i||{};var o=i.attach,a,s;e=this._create("shape",e),o?(a=n.parent,s=n):a=n;var c={position:t,shape:e,parent:a,parentIndex:r,host:s,hints:i};return this._commandStack.execute("shape.create",c),c.shape};De.prototype.createElements=function(e,t,n,r,i){q(e)||(e=[e]),typeof r!="number"&&(i=r,r=void 0),i=i||{};var o={position:t,elements:e,parent:n,parentIndex:r,hints:i};return this._commandStack.execute("elements.create",o),o.elements};De.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};De.prototype.appendShape=function(e,t,n,r,i){i=i||{},t=this._create("shape",t);var o={source:e,position:n,target:r,shape:t,connection:i.connection,connectionParent:i.connectionParent,hints:i};return this._commandStack.execute("shape.append",o),o.shape};De.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)};De.prototype.distributeElements=function(e,t,n){var r={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",r)};De.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)};De.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)};De.prototype.replaceShape=function(e,t,n){var r={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",r),r.newShape};De.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)};De.prototype.resizeShape=function(e,t,n,r){var i={shape:e,newBounds:t,minBounds:n,hints:r};this._commandStack.execute("shape.resize",i)};De.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)};De.prototype.updateWaypoints=function(e,t,n){var r={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",r)};De.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)};De.prototype.reconnectStart=function(e,t,n,r){r||(r={}),this.reconnect(e,t,e.target,n,C(r,{docking:"source"}))};De.prototype.reconnectEnd=function(e,t,n,r){r||(r={}),this.reconnect(e,e.source,t,n,C(r,{docking:"target"}))};De.prototype.connect=function(e,t,n,r){return this.createConnection(e,t,n||{},e.parent,r)};De.prototype._create=function(e,t){return zm(t)?t:this._elementFactory.create(e,t)};De.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};N();function Yi(e){this._elementRegistry=e}Yi.$inject=["elementRegistry"];Yi.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||UA(n,bi(r));return A_(n,r),e.oldProperties=o,e.changed=i,i};Yi.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,r=e.changed;return A_(n,t),r};Yi.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return h(e,"bpmn:DataObject")?qA(e,t):[]};function UA(e,t){return Ge(t,function(n,r){return n[r]=e.get(r),n},{})}function A_(e,t){E(t,function(n,r){e.set(r,n)})}function qA(e,t){return t.filter(function(n){return h(n,"bpmn:DataObjectReference")&&j(n).dataObjectRef===e})}N();var Xs="default",Ir="id",T_="di",KA={width:0,height:0};function Xi(e,t,n,r){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=r}Xi.$inject=["elementRegistry","moddle","modeling","textRenderer"];Xi.prototype.execute=function(e){var t=e.element,n=[t];if(!t)throw new Error("element required");var r=this._elementRegistry,i=this._moddle.ids,o=t.businessObject,a=JA(e.properties),s=e.oldProperties||YA(t,a);return M_(a,o)&&(i.unclaim(o[Ir]),r.updateId(t,a[Ir]),i.claim(a[Ir],o)),Xs in a&&(a[Xs]&&n.push(r.get(a[Xs].id)),o[Xs]&&n.push(r.get(o[Xs].id))),D_(t,a),e.oldProperties=s,e.changed=n,n};Xi.prototype.postExecute=function(e){var t=e.element,n=t.label,r=n&&j(n).name;if(r){var i=this._textRenderer.getExternalLabelBounds(n,r);this._modeling.resizeShape(n,i,KA)}};Xi.prototype.revert=function(e){var t=e.element,n=e.properties,r=e.oldProperties,i=t.businessObject,o=this._elementRegistry,a=this._moddle.ids;return D_(t,r),M_(n,i)&&(a.unclaim(n[Ir]),o.updateId(t,r[Ir]),a.claim(r[Ir],i)),e.changed};function M_(e,t){return Ir in e&&e[Ir]!==t[Ir]}function YA(e,t){var n=bi(t),r=e.businessObject,i=ce(e);return Ge(n,function(o,a){return a!==T_?o[a]=r.get(a):o[a]=XA(i,bi(t.di)),o},{})}function XA(e,t){return Ge(t,function(n,r){return n[r]=e&&e.get(r),n},{})}function D_(e,t){var n=e.businessObject,r=ce(e);E(t,function(i,o){o!==T_?n.set(o,i):r&&ZA(r,i)})}function ZA(e,t){E(t,function(n,r){e.set(r,n)})}var QA=["default"];function JA(e){var t=C({},e);return QA.forEach(function(n){n in e&&(t[n]=j(t[n]))}),t}function ua(e,t){this._canvas=e,this._modeling=t}ua.$inject=["canvas","modeling"];ua.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,r=n.businessObject,i=t.getRootElement(),o=i.businessObject,a=o.$parent,s=ce(i);return t.setRootElement(n),t.removeRootElement(i),Ae(a.rootElements,r),r.$parent=a,Oe(a.rootElements,o),o.$parent=null,i.di=null,s.bpmnElement=r,n.di=s,e.oldRoot=i,[]};ua.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,r=n.businessObject,i=e.oldRoot,o=i.businessObject,a=r.$parent,s=ce(n);return t.setRootElement(i),t.removeRootElement(n),Oe(a.rootElements,r),r.$parent=null,Ae(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,i.di=s,[]};N();function Zs(e,t){this._modeling=e,this._spaceTool=t}Zs.$inject=["modeling","spaceTool"];Zs.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,r=e.shape,i=e.location,o=Bt(r),a=o===r,s=a?r:r.parent,c=yn(s),u=Me(r);if(u?i==="left"?i="top":i==="right"&&(i="bottom"):i==="top"?i="left":i==="bottom"&&(i="right"),!c.length){var p=u?{x:r.x+on,y:r.y,width:r.width-on,height:r.height}:{x:r.x,y:r.y+on,width:r.width,height:r.height-on};n.createShape({type:"bpmn:Lane",isHorizontal:u},p,s)}var l=[];In(o,function(b){return l.push(b),b.label&&l.push(b.label),b===r?[]:Q(b.children,function(R){return R!==r})});var f,d,m,g,v;i==="top"?(f=-120,d=r.y,m=d+10,g="n",v="y"):i==="left"?(f=-120,d=r.x,m=d+10,g="w",v="x"):i==="bottom"?(f=120,d=r.y+r.height,m=d-10,g="s",v="y"):i==="right"&&(f=120,d=r.x+r.width,m=d-10,g="e",v="x");var w=t.calculateAdjustments(l,v,f,m),S=u?{x:0,y:f}:{x:f,y:0};t.makeSpace(w.movingShapes,w.resizingShapes,S,g,m);var x=u?{x:r.x+(a?on:0),y:d-(i==="top"?120:0),width:r.width-(a?on:0),height:120}:{x:d-(i==="left"?120:0),y:r.y+(a?on:0),width:120,height:r.height-(a?on:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:u},x,s)};function Qs(e){this._modeling=e}Qs.$inject=["modeling"];Qs.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,r=e.count,i=yn(n),o=i.length;if(o>r)throw new Error(`more than <${r}> child lanes`);var a=Me(n),s=a?n.height:n.width,c=Math.round(s/r),u,p,l,f;for(f=0;f<r;f++)f===r-1?u=s-c*f:u=c,p=a?{x:n.x+on,y:n.y+f*c,width:n.width-on,height:u}:{x:n.x+f*c,y:n.y+on,width:u,height:n.height-on},f<o?t.resizeShape(i[f],p):(l={type:"bpmn:Lane",isHorizontal:a},t.createShape(l,p,n))};function Zi(e,t){this._modeling=e,this._spaceTool=t}Zi.$inject=["modeling","spaceTool"];Zi.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,r=e.balanced;r!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)};Zi.prototype.resizeBalanced=function(e,t){var n=this._modeling,r=Lg(e,t);n.resizeShape(e,t),r.forEach(function(i){n.resizeShape(i.shape,i.newBounds)})};Zi.prototype.resizeSpace=function(e,t){var n=this._spaceTool,r=Z(e),i=Z(t),o=ep(i,r),a=Bt(e),s=[],c=[];In(a,function(m){return s.push(m),(h(m,"bpmn:Lane")||h(m,"bpmn:Participant"))&&c.push(m),m.children});var u,p,l,f,d;(o.bottom||o.top)&&(u=o.bottom||o.top,p=e.y+(o.bottom?e.height:0)+(o.bottom?-10:10),l=o.bottom?"s":"n",f=o.top>0||o.bottom<0?-u:u,d=n.calculateAdjustments(s,"y",f,p),n.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:u},l)),(o.left||o.right)&&(u=o.right||o.left,p=e.x+(o.right?e.width:0)+(o.right?-10:100),l=o.right?"e":"w",f=o.left>0||o.right<0?-u:u,d=n.calculateAdjustments(c,"x",f,p),n.makeSpace(d.movingShapes,d.resizingShapes,{x:u,y:0},l))};var Js="flowNodeRef",Qf="lanes";function Qi(e){this._elementRegistry=e}Qi.$inject=["elementRegistry"];Qi.prototype._computeUpdates=function(e,t){var n=[],r=[],i={},o=[];function a(p,l){var f=Z(l),d={x:p.x+p.width/2,y:p.y+p.height/2};return d.x>f.left&&d.x<f.right&&d.y>f.top&&d.y<f.bottom}function s(p){n.indexOf(p)===-1&&(o.push(p),n.push(p))}function c(p){var l=Bt(p);return i[l.id]||(i[l.id]=zo(l)),i[l.id]}function u(p){if(!p.parent)return[];var l=c(p);return l.filter(function(f){return a(p,f)}).map(function(f){return f.businessObject})}return t.forEach(function(p){var l=Bt(p);if(!(!l||n.indexOf(l)!==-1)){var f=l.children.filter(function(d){return h(d,"bpmn:FlowNode")});f.forEach(s),n.push(l)}}),e.forEach(s),o.forEach(function(p){var l=p.businessObject,f=l.get(Qf),d=f.slice(),m=u(p);r.push({flowNode:l,remove:d,add:m})}),t.forEach(function(p){var l=p.businessObject;p.parent||l.get(Js).forEach(function(f){r.push({flowNode:f,remove:[l],add:[]})})}),r};Qi.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.flowNodeShapes,e.laneShapes)),t.forEach(function(n){var r=n.flowNode,i=r.get(Qf);n.remove.forEach(function(o){Oe(i,o),Oe(o.get(Js),r)}),n.add.forEach(function(o){Ae(i,o),Ae(o.get(Js),r)})}),[]};Qi.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var r=n.flowNode,i=r.get(Qf);n.add.forEach(function(o){Oe(i,o),Oe(o.get(Js),r)}),n.remove.forEach(function(o){Ae(i,o),Ae(o.get(Js),r)})}),[]};function pa(e){this._moddle=e}pa.$inject=["moddle"];pa.prototype.execute=function(e){var t=this._moddle.ids,n=e.id,r=e.element,i=e.claiming;return i?t.claim(n,r):t.unclaim(n),[]};pa.prototype.revert=function(e){var t=this._moddle.ids,n=e.id,r=e.element,i=e.claiming;return i?t.unclaim(n):t.claim(n,r),[]};N();var eT={fill:void 0,stroke:void 0};function ec(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(st(t)){var n=tT(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}ec.$inject=["commandStack"];ec.prototype.postExecute=function(e){var t=e.elements,n=e.colors||eT,r=this,i={};"fill"in n&&C(i,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&C(i,{"border-color":this._normalizeColor(n.stroke)}),E(t,function(o){var a=de(o)?mt(i,["border-color"]):i,s=ce(o);if(nT(a),ee(o)){if(!s||!h(s.label,"bpmndi:BPMNLabel"))return;r._commandStack.execute("element.updateModdleProperties",{element:o,moddleElement:s.label,properties:{color:i["border-color"]}})}else{if(!te(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;r._commandStack.execute("element.updateProperties",{element:o,properties:{di:a}})}})};function tT(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}function nT(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var rT={width:0,height:0};function Bp(e,t,n){function r(c,u){var p=c.label||c,l=c.labelTarget||c;return Eh(p,u,l!==p),[p,l]}function i(c){var u=c.element,p=u.businessObject,l=c.newLabel;if(!ee(u)&&mn(u)&&!Xr(u)&&!k_(l)){var f=7,d=La(u);d={x:d.x,y:d.y+f},e.createLabel(u,d,{id:p.id+"_label",businessObject:p,di:u.di})}}function o(c){return c.oldLabel=gt(c.element),r(c.element,c.newLabel)}function a(c){return r(c.element,c.oldLabel)}function s(c){var u=c.element,p=u.label||u,l=c.newLabel,f=c.newBounds,d=c.hints||{};if(!(!ee(p)&&!h(p,"bpmn:TextAnnotation"))){if(ee(p)&&k_(l)){d.removeShape!==!1&&e.removeShape(p,{unsetLabel:!1});return}var m=gt(u);typeof f=="undefined"&&(f=t.getExternalLabelBounds(p,m)),f&&e.resizeShape(p,f,rT)}}this.preExecute=i,this.execute=o,this.revert=a,this.postExecute=s}Bp.$inject=["modeling","textRenderer","bpmnFactory"];function k_(e){return!e||!e.trim()}function Pt(e,t,n,r){De.call(this,e,t,n),this._bpmnRules=r}B(Pt,De);Pt.$inject=["eventBus","elementFactory","commandStack","bpmnRules"];Pt.prototype.getHandlers=function(){var e=De.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=Yi,e["element.updateProperties"]=Xi,e["canvas.updateRoot"]=ua,e["lane.add"]=Zs,e["lane.resize"]=Zi,e["lane.split"]=Qs,e["lane.updateRefs"]=Qi,e["id.updateClaim"]=pa,e["element.setColor"]=ec,e["element.updateLabel"]=Bp,e};Pt.prototype.updateLabel=function(e,t,n,r){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:r||{}})};Pt.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)};Pt.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})};Pt.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})};Pt.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})};Pt.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane};Pt.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})};Pt.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e};Pt.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e};Pt.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})};Pt.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})};Pt.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})};Pt.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};N();function Ip(){}Ip.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||X(t.source||e.source),t.connectionEnd||X(t.target||e.target)]};N();var Lp=20,iT=5,jp=Math.round,N_=20,oT={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function aT(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function sT(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function L_(e,t,n){var r=He(t,e,iT),i=n.split(":")[0],o=jp((t.x-e.x)/2+e.x),a=jp((t.y-e.y)/2+e.y),s,c,u=sT(i,r),p=/h|r|l/.test(i),l=!1,f=!1;return u?(s=p?{x:o,y:e.y}:{x:e.x,y:a},c=p?"h:h":"v:v"):(l=aT(r,i),c=p?"h:v":"v:h",l?p?(f=a===e.y,s={x:e.x+Lp*(/l/.test(i)?-1:1),y:f?a+Lp:a}):(f=o===e.x,s={x:f?o+Lp:o,y:e.y+Lp*(/t/.test(i)?-1:1)}):s={x:o,y:a}),{waypoints:Jf(e,s,c).concat(s),directions:c,turnNextDirections:f}}function cT(e,t,n){return L_(e,t,n)}function uT(e,t,n){var r=L_(t,e,O_(n));return{waypoints:r.waypoints.slice().reverse(),directions:O_(r.directions),turnNextDirections:r.turnNextDirections}}function pT(e,t){var n=e.directions.split(":")[1],r=t.directions.split(":")[0];e.turnNextDirections&&(n=n=="h"?"v":"h"),t.turnNextDirections&&(r=r=="h"?"v":"h");var i=n+":"+r,o=Jf(e.waypoints[e.waypoints.length-1],t.waypoints[0],i);return{waypoints:o,directions:i}}function O_(e){return e.split(":").reverse().join(":")}function lT(e,t,n){var r=jp((t.x-e.x)/2+e.x),i=jp((t.y-e.y)/2+e.y);if(n==="h:v")return[{x:t.x,y:e.y}];if(n==="v:h")return[{x:e.x,y:t.y}];if(n==="h:h")return[{x:r,y:e.y},{x:r,y:t.y}];if(n==="v:v")return[{x:e.x,y:i},{x:t.x,y:i}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}function Jf(e,t,n){if(n=n||"h:h",!_T(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(F_(n)){var r=cT(e,t,n),i=uT(e,t,n),o=pT(r,i);return[].concat(r.waypoints,o.waypoints,i.waypoints)}return lT(e,t,n)}function fT(e,t,n){var r=Jf(e,t,n);return r.unshift(e),r.push(t),td(r)}function dT(e,t,n,r,i){var o=i&&i.preferredLayouts||[],a=hl(o,"straight")[0]||"h:h",s=oT[a]||0,c=He(e,t,s),u=yT(c,a);n=n||X(e),r=r||X(t);var p=u.split(":"),l=I_(n,e,p[0],bT(c)),f=I_(r,t,p[1],c);return fT(l,f,u)}function j_(e,t,n,r,i,o){q(n)&&(i=n,o=r,n=X(e),r=X(t)),o=C({preferredLayouts:[]},o),i=i||[];var a=o.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&hT(e,t,n,r,o),c||(c=o.connectionEnd&&gT(t,e,r,i),c)||(c=o.connectionStart&&vT(e,t,n,i),c)?c:!o.connectionStart&&!o.connectionEnd&&i&&i.length?i:dT(e,t,n,r,o)}function mT(e,t,n){return e>=t&&e<=n}function B_(e,t,n){var r={x:"width",y:"height"};return mT(t[e],n[e],n[e]+n[r[e]])}function hT(e,t,n,r,i){var o={},a,s;return s=He(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),i.preserveDocking==="target"?B_(a,r,e)?(o[a]=r[a],[{x:o.x!==void 0?o.x:n.x,y:o.y!==void 0?o.y:n.y,original:{x:o.x!==void 0?o.x:n.x,y:o.y!==void 0?o.y:n.y}},{x:r.x,y:r.y}]):null:B_(a,n,t)?(o[a]=n[a],[{x:n.x,y:n.y},{x:o.x!==void 0?o.x:r.x,y:o.y!==void 0?o.y:r.y,original:{x:o.x!==void 0?o.x:r.x,y:o.y!==void 0?o.y:r.y}}]):null):null}function vT(e,t,n,r){return ed(e,t,n,r)}function gT(e,t,n,r){var i=r.slice().reverse();return i=ed(e,t,n,i),i?i.reverse():null}function ed(e,t,n,r){function i(p){return p.length<3?!0:p.length>4?!1:!!re(p,function(l,f){var d=p[f-1];return d&&Gr(l,d)<3})}function o(p,l,f){var d=en(l,p);switch(d){case"v":return{x:f.x,y:p.y};case"h":return{x:p.x,y:f.y}}return{x:p.x,y:p.y}}function a(p,l,f){var d;for(d=p.length-2;d!==0;d--)if(Nl(p[d],l,N_)||Nl(p[d],f,N_))return p.slice(d);return p}if(i(r))return null;var s=r[0],c=r.slice(),u;return c[0]=n,c[1]=o(c[1],s,n),u=a(c,e,t),u!==c&&(c=ed(e,t,n,u)),c&&en(c)?null:c}function yT(e,t){if(F_(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}}function _T(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function F_(e){return e&&/t|r|b|l/.test(e)}function bT(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]}function I_(e,t,n,r){if(n==="h"&&(n=/left/.test(r)?"l":"r"),n==="v"&&(n=/top/.test(r)?"t":"b"),n==="t")return{original:e,x:e.x,y:t.y};if(n==="r")return{original:e,x:t.x+t.width,y:e.y};if(n==="b")return{original:e,x:e.x,y:t.y+t.height};if(n==="l")return{original:e,x:t.x,y:e.y};throw new Error("unexpected dockingDirection: <"+n+">")}function td(e){return e.reduce(function(t,n,r){var i=t[t.length-1],o=e[r+1];return uo(i,o,n,0)||t.push(n),t},[])}var xT=-10,ET=40,wT={default:["h:h"],fromGateway:["v:h"],toGateway:["h:v"],loop:{fromTop:["t:r"],fromRight:["r:b"],fromLeft:["l:t"],fromBottom:["b:l"]},boundaryLoop:{alternateHorizontalSide:"b",alternateVerticalSide:"l",default:"v"},messageFlow:["straight","v:v"],subProcess:["straight","h:h"],isHorizontal:!0},ST={default:["v:v"],fromGateway:["h:v"],toGateway:["v:h"],loop:{fromTop:["t:l"],fromRight:["r:t"],fromLeft:["l:b"],fromBottom:["b:r"]},boundaryLoop:{alternateHorizontalSide:"t",alternateVerticalSide:"r",default:"h"},messageFlow:["straight","h:h"],subProcess:["straight","v:v"],isHorizontal:!1},rd={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},tc={top:"t",right:"r",bottom:"b",left:"l"};function da(e){this._elementRegistry=e}B(da,Ip);da.prototype.layoutConnection=function(e,t){t||(t={});var n=t.source||e.source,r=t.target||e.target,i=t.waypoints||e.waypoints,o=t.connectionStart,a=t.connectionEnd,s=this._elementRegistry,c,u;if(o||(o=H_(i&&i[0],n)),a||(a=H_(i&&i[i.length-1],r)),(h(e,"bpmn:Association")||h(e,"bpmn:DataAssociation"))&&i&&!$_(n,r))return[].concat([o],i.slice(1,-1),[a]);var p=Pu(n,s)?wT:ST;return h(e,"bpmn:MessageFlow")?c=RT(n,r,p):(h(e,"bpmn:SequenceFlow")||$_(n,r))&&(n===r?c={preferredLayouts:kT(n,e,p)}:h(n,"bpmn:BoundaryEvent")?c={preferredLayouts:NT(n,r,a,p)}:nc(n)||nc(r)?c={preferredLayouts:p.subProcess,preserveDocking:AT(n)}:h(n,"bpmn:Gateway")?c={preferredLayouts:p.fromGateway}:h(r,"bpmn:Gateway")?c={preferredLayouts:p.toGateway}:c={preferredLayouts:p.default}),c&&(c=C(c,t),u=td(j_(n,r,o,a,i,c))),u||[o,a]};function CT(e){var t=e.host;return He(X(e),t,xT)}function RT(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:PT(e,t)}}function PT(e,t){return h(t,"bpmn:Participant")?"source":h(e,"bpmn:Participant")?"target":nc(t)?"source":nc(e)||h(t,"bpmn:Event")?"target":h(e,"bpmn:Event")?"source":null}function AT(e){return nc(e)?"target":"source"}function H_(e,t){return e?e.original||e:X(t)}function $_(e,t){return h(t,"bpmn:Activity")&&h(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function nc(e){return h(e,"bpmn:SubProcess")&&ie(e)}function Ji(e,t){return e===t}function TT(e,t){return t.indexOf(e)!==-1}function la(e){var t=/right|left/.exec(e);return t&&t[0]}function fa(e){var t=/top|bottom/.exec(e);return t&&t[0]}function z_(e,t){return rd[e]===t}function MT(e,t){var n=la(e),r=rd[n];return t.indexOf(r)!==-1}function DT(e,t){var n=fa(e),r=rd[n];return t.indexOf(r)!==-1}function V_(e){return e==="right"||e==="left"}function kT(e,t,n){var r=t.waypoints,i=r&&r.length&&He(r[0],e);return i==="top"?n.loop.fromTop:i==="right"?n.loop.fromRight:i==="left"?n.loop.fromLeft:n.loop.fromBottom}function NT(e,t,n,r){var i=X(e),o=X(t),a=CT(e),s,c,u=Ji(e.host,t),p=TT(a,["top","right","bottom","left"]),l=He(o,i,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return u?OT(a,p,e,t,n,r):(s=BT(a,l,p,r.isHorizontal),c=IT(a,l,p,r.isHorizontal),[s+":"+c])}function OT(e,t,n,r,i,o){var a=t?e:o.isHorizontal?fa(e):la(e),s=tc[a],c;return t?V_(e)?c=G_("y",n,r,i)?"h":o.boundaryLoop.alternateHorizontalSide:c=G_("x",n,r,i)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function G_(e,t,n,r){var i=ET;return!(nd(e,r,n,i)||nd(e,r,{x:n.x+n.width,y:n.y+n.height},i)||nd(e,r,X(t),i))}function nd(e,t,n,r){return Math.abs(t[e]-n[e])<r}function BT(e,t,n,r){if(n)return tc[e];var i=fa(e),o=la(e),a=fa(t),s=la(t);if(r){if(Ji(i,a)||z_(o,s))return tc[i]}else if(Ji(o,s)||z_(i,a))return tc[o];return tc[r?o:i]}function IT(e,t,n,r){if(n)return V_(e)?MT(e,t)||Ji(e,t)?"h":"v":DT(e,t)||Ji(e,t)?"v":"h";var i=fa(e),o=la(e),a=fa(t),s=la(t);return a&&!s?"v":s&&!a?"h":r?Ji(i,a)?"h":"v":Ji(o,s)?"v":"h"}da.$inject=["elementRegistry"];N();function W_(e){return C({original:e.point.original||e.point},e.actual)}function dr(e,t){this._elementRegistry=e,this._graphicsFactory=t}dr.$inject=["elementRegistry","graphicsFactory"];dr.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(W_(r)),o.push(W_(i)),o};dr.prototype.getDockingPoint=function(e,t,n){var r=e.waypoints,i,o,a;return i=n?0:r.length-1,o=r[i],a=this._getIntersection(t,e,n),{point:o,actual:a||o,idx:i}};dr.prototype._getIntersection=function(e,t,n){var r=this._getShapePath(e),i=this._getConnectionPath(t);return qr(r,i,n)};dr.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)};dr.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)};dr.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};var Fp={__init__:["modeling","bpmnUpdater"],__depends__:[_y,Fy,Hy,$y,Ap,p_,d_,v_,rt,xo,Np],bpmnFactory:["type",an],bpmnUpdater:["type",$t],elementFactory:["type",lr],modeling:["type",Pt],layouter:["type",da],connectionDocking:["type",dr]};N();var U_=Math.round;function ma(e,t,n,r,i,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=r,this._layouter=i,this._rules=o}ma.prototype.create=function(e,t,n){let r=this._complexPreview,i=this._connectionDocking,o=this._elementFactory,a=this._eventBus,s=this._layouter,c=this._rules,u=o.createShape(C({type:t},n)),p=a.fire("autoPlace",{source:e,shape:u});if(!p)return;C(u,{x:p.x-U_(u.width/2),y:p.y-U_(u.height/2)});let l=c.allowed("connection.create",{source:e,target:u,hints:{targetParent:e.parent}}),f=null;l&&(f=o.createConnection(l),f.waypoints=s.layoutConnection(f,{source:e,target:u}),f.waypoints=i.getCroppedWaypoints(f,e,u)),r.create({created:[u,f].filter(d=>!Yn(d))})};ma.prototype.cleanUp=function(){this._complexPreview.cleanUp()};ma.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];var q_={__depends__:[No,Rg,Fp],__init__:["appendPreview"],appendPreview:["type",ma]};N();N();var K_=Math.min,Y_=Math.max;function id(e){e.preventDefault()}function rc(e){e.stopPropagation()}function LT(e){return e.nodeType===Node.TEXT_NODE}function jT(e){return[].slice.call(e)}function _n(e){this.container=e.container,this.parent=ue('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=_e("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.autoResize=tt(this.autoResize,this),this.handlePaste=tt(this.handlePaste,this)}_n.prototype.create=function(e,t,n,r){var i=this,o=this.parent,a=this.content,s=this.container;r=this.options=r||{},t=this.style=t||{};var c=mt(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);C(o.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"},c);var u=mt(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return C(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},u),r.centerVertically&&C(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},u),a.innerText=n,se.bind(a,"keydown",this.keyHandler),se.bind(a,"mousedown",rc),se.bind(a,"paste",i.handlePaste),r.autoResize&&se.bind(a,"input",this.autoResize),r.resizable&&this.resizable(t),s.appendChild(o),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),o};_n.prototype.handlePaste=function(e){var t=this.options,n=this.style;e.preventDefault();var r;if(e.clipboardData?r=e.clipboardData.getData("text/plain"):r=window.clipboardData.getData("Text"),this.insertText(r),t.autoResize){var i=this.autoResize(n);i&&this.resizeHandler(i)}};_n.prototype.insertText=function(e){e=FT(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)};_n.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,r=t.endContainer,i=t.startOffset,o=t.endOffset,a=t.commonAncestorContainer,s=jT(a.childNodes),c,u;if(LT(a)){var p=n.textContent;n.textContent=p.substring(0,i)+e+p.substring(o),c=n,u=i+e.length}else if(n===this.content&&r===this.content){var l=document.createTextNode(e);this.content.insertBefore(l,s[i]),c=l,u=l.textContent.length}else{var f=s.indexOf(n),d=s.indexOf(r);s.forEach(function(m,g){g===f?m.textContent=n.textContent.substring(0,i)+e+r.textContent.substring(o):g>f&&g<=d&&Wt(m)}),c=n,u=i+e.length}c&&u!==void 0&&setTimeout(function(){self.setSelection(c,u)})};_n.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})}};_n.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,a=parseInt(this.style.maxHeight)||1/0;if(!n){n=this.resizeHandle=ue('<div class="djs-direct-editing-resize-handle"></div>');var s,c,u,p,l=function(m){id(m),rc(m),s=m.clientX,c=m.clientY;var g=t.getBoundingClientRect();u=g.width,p=g.height,se.bind(document,"mousemove",f),se.bind(document,"mouseup",d)},f=function(m){id(m),rc(m);var g=K_(Y_(u+m.clientX-s,r),o),v=K_(Y_(p+m.clientY-c,i),a);t.style.width=g+"px",t.style.height=v+"px",e.resizeHandler({width:u,height:p,dx:m.clientX-s,dy:m.clientY-c})},d=function(m){id(m),rc(m),se.unbind(document,"mousemove",f,!1),se.unbind(document,"mouseup",d,!1)};se.bind(n,"mousedown",l)}C(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)};_n.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),se.unbind(t,"keydown",this.keyHandler),se.unbind(t,"mousedown",rc),se.unbind(t,"input",this.autoResize),se.unbind(t,"paste",this.handlePaste),n&&(n.removeAttribute("style"),Wt(n)),Wt(e)};_n.prototype.getValue=function(){return this.content.innerText.trim()};_n.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t};_n.prototype.setSelection=function(e,t){var n=document.createRange();e===null?n.selectNodeContents(this.content):(n.setStart(e,t),n.setEnd(e,t));var r=window.getSelection();r.removeAllRanges(),r.addRange(n)};function FT(e){return e.replace(/\r\n|\r|\n/g,`
282 </svg>`},cd=zT;N();var GT=900;function to(e,t,n,r){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=r,e.registerProvider("align-elements",GT,this)}to.$inject=["popupMenu","distributeElements","translate","rules"];to.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&C(t,this._getEntries(e)),t};to.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})};to.prototype._getEntries=function(e){var t=this._distributeElements,n=this._translate,r=this._popupMenu,i={"distribute-elements-horizontal":{group:"distribute",title:n("Distribute elements horizontally"),className:"bjs-align-elements-menu-entry",imageHtml:cd.horizontal,action:function(o,a){t.trigger(e,"horizontal"),r.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:cd.vertical,action:function(o,a){t.trigger(e,"vertical"),r.close()}}};return i};var gb={__depends__:[Do,vb],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",ha],distributeElementsMenuProvider:["type",to]};N();var yb="is not a registered action",VT="is already registered";function Zt(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}Zt.$inject=["eventBus","injector"];Zt.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),a=e.get("canvas",!1),s=e.get("rules",!1),c=e.get("keyboardMove",!1),u=e.get("keyboardMoveSelection",!1);t&&(this.register("undo",function(){t.undo()}),this.register("redo",function(){t.redo()})),o&&r&&this.register("copy",function(){var p=r.get();if(p.length)return o.copy(p)}),o&&r&&this.register("duplicate",function(){var p=r.get();if(p.length)return o.duplicate(p)}),o&&this.register("paste",function(){o.paste()}),o&&r&&s&&this.register("cut",function(){var p=r.get();if(p.length){var l=s.allowed("elements.delete",{elements:p});if(l!==!1){var f=q(l)?l:p;return o.cut(f.slice())}}}),i&&this.register("stepZoom",function(p){i.stepZoom(p.value)}),a&&this.register("zoom",function(p){a.zoom(p.value)}),n&&r&&s&&this.register("removeSelection",function(){var p=r.get();if(p.length){var l=s.allowed("elements.delete",{elements:p}),f;l!==!1&&(q(l)?f=l:f=p,f.length&&n.removeElements(f.slice()))}}),c&&this.register("moveCanvas",function(p){c.moveCanvas(p)}),u&&this.register("moveSelection",function(p){u.moveSelection(p.direction,p.accelerated)})};Zt.prototype.trigger=function(e,t){if(!this._actions[e])throw ud(e,yb);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)};Zt.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);E(e,function(r,i){n._registerAction(i,r)})};Zt.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw ud(e,VT);this._actions[e]=t};Zt.prototype.unregister=function(e){if(!this.isRegistered(e))throw ud(e,yb);this._actions[e]=void 0};Zt.prototype.getActions=function(){return Object.keys(this._actions)};Zt.prototype.isRegistered=function(e){return!!this._actions[e]};function ud(e,t){return new Error(e+" "+t)}var _b={__init__:["editorActions"],editorActions:["type",Zt]};N();function va(e){e.invoke(Zt,this)}B(va,Zt);va.$inject=["injector"];va.prototype._registerDefaultActions=function(e){Zt.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),a=e.get("handTool",!1),s=e.get("globalConnect",!1),c=e.get("distributeElements",!1),u=e.get("alignElements",!1),p=e.get("directEditing",!1),l=e.get("searchPad",!1),f=e.get("modeling",!1),d=e.get("contextPad",!1);t&&n&&r&&this._registerAction("selectElements",function(){var m=t.getRootElement(),g=n.filter(function(v){return v!==m});return r.select(g),g}),i&&this._registerAction("spaceTool",function(){i.toggle()}),o&&this._registerAction("lassoTool",function(){o.toggle()}),a&&this._registerAction("handTool",function(){a.toggle()}),s&&this._registerAction("globalConnectTool",function(){s.toggle()}),r&&c&&this._registerAction("distributeElements",function(m){var g=r.get(),v=m.type;g.length&&c.trigger(g,v)}),r&&u&&this._registerAction("alignElements",function(m){var g=r.get(),v=[],w=m.type;g.length&&(v=Q(g,function(S){return!h(S,"bpmn:Lane")}),u.trigger(v,w))}),r&&f&&this._registerAction("setColor",function(m){var g=r.get();g.length&&f.setColor(g,m)}),r&&p&&this._registerAction("directEditing",function(){var m=r.get();m.length&&p.activate(m[0])}),l&&this._registerAction("find",function(){l.toggle()}),t&&f&&this._registerAction("moveToOrigin",function(){var m=t.getRootElement(),g,v;h(m,"bpmn:Collaboration")?v=n.filter(function(w){return h(w.parent,"bpmn:Collaboration")}):v=n.filter(function(w){return w!==m&&!h(w.parent,"bpmn:SubProcess")}),g=Ce(v),f.moveElements(v,{x:-g.x,y:-g.y},m)}),r&&d&&this._registerAction("replaceElement",function(m){d.triggerEntry("replace","click",m)})};var bb={__depends__:[_b],editorActions:["type",va]};function $p(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,r=t.shape;te(r,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}$p.$inject=["eventBus"];N();function Lr(e,t){k.call(this,e),this._gridSnapping=t;var n=this;this.preExecute("shape.resize",function(r){var i=r.context,o=i.hints||{},a=o.autoResize;if(a){var s=i.shape,c=i.newBounds;st(a)?i.newBounds=n.snapComplex(c,a):i.newBounds=n.snapSimple(s,c)}})}Lr.$inject=["eventBus","gridSnapping","modeling"];B(Lr,k);Lr.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};Lr.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};Lr.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),C(e,o),e};Lr.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),C(e,o),e};var WT=2e3;function zp(e,t){e.on(["spaceTool.move","spaceTool.end"],WT,function(n){var r=n.context;if(r.initialized){var i=r.axis,o;i==="x"?(o=t.snapValue(n.dx),n.x=n.x+o-n.dx,n.dx=o):(o=t.snapValue(n.dy),n.y=n.y+o-n.dy,n.dy=o)}})}zp.$inject=["eventBus","gridSnapping"];var xb={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",Lr],gridSnappingSpaceToolBehavior:["type",zp]};N();var ic=10;function Gp(e,t,n){return n||(n="round"),Math[n](e/t)*t}var UT=1200,qT=800;function mr(e,t,n){var r=!n||n.active!==!1;this._eventBus=t;var i=this;t.on("diagram.init",qT,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"],UT,function(o){var a=o.originalEvent;if(!(!i.active||a&&xt(a))){var s=o.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(u){var p={},l=YT(o,u,e);l&&(p.offset=l);var f=KT(o,u);f&&C(p,f),zn(o,u)||i.snapEvent(o,u,p)})}})}mr.prototype.snapEvent=function(e,t,n){var r=this.snapValue(e[t],n);ze(e,t,r)};mr.prototype.getGridSpacing=function(){return ic};mr.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=Gp(e,ic);var r,i;return t&&t.min&&(r=t.min,ne(r)&&(r=Gp(r+n,ic,"ceil"),e=Math.max(e,r))),t&&t.max&&(i=t.max,ne(i)&&(i=Gp(i+n,ic,"floor"),e=Math.min(e,i))),e-=n,e};mr.prototype.isActive=function(){return this.active};mr.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})};mr.prototype.toggleActive=function(){this.setActive(!this.active)};mr.$inject=["elementRegistry","eventBus","config.gridSnapping"];function KT(e,t){var n=e.context,r=n.createConstraints,i=n.resizeConstraints||{},o=n.gridSnappingContext,a=o.snapConstraints;if(a&&a[t])return a[t];a||(a=o.snapConstraints={}),a[t]||(a[t]={});var s=n.direction;r&&(Vp(t)?(a.x.min=r.left,a.x.max=r.right):(a.y.min=r.top,a.y.max=r.bottom));var c=i.min,u=i.max;return c&&(Vp(t)?wb(s)?a.x.max=c.left:a.x.min=c.right:Eb(s)?a.y.max=c.top:a.y.min=c.bottom),u&&(Vp(t)?wb(s)?a.x.min=u.left:a.x.max=u.right:Eb(s)?a.y.min=u.top:a.y.max=u.bottom),a[t]}function YT(e,t,n){var r=e.context,i=e.shape,o=r.gridSnappingContext,a=o.snapLocation,s=o.snapOffset;return s&&ne(s[t])||(s||(s=o.snapOffset={}),ne(s[t])||(s[t]=0),!i)||(n.get(i.id)||(Vp(t)?s[t]+=i[t]+i.width/2:s[t]+=i[t]+i.height/2),!a)||(t==="x"?/left/.test(a)?s[t]-=i.width/2:/right/.test(a)&&(s[t]+=i.width/2):/top/.test(a)?s[t]-=i.height/2:/bottom/.test(a)&&(s[t]+=i.height/2)),s[t]}function Vp(e){return e==="x"}function Eb(e){return e.indexOf("n")!==-1}function wb(e){return e.indexOf("w")!==-1}var Sb={__depends__:[xb],__init__:["gridSnapping"],gridSnapping:["type",mr]};var XT=2e3;function Wp(e,t,n){e.on("autoPlace",XT,function(r){var i=r.source,o=X(i),a=r.shape,s=Au(i,a,n);return["x","y"].forEach(function(c){var u={};s[c]!==o[c]&&(s[c]>o[c]?u.min=s[c]:u.max=s[c],h(a,"bpmn:TextAnnotation")&&(ZT(c)?u.offset=-a.width/2:u.offset=-a.height/2),s[c]=t.snapValue(s[c],u))}),s})}Wp.$inject=["eventBus","gridSnapping","elementRegistry"];function ZT(e){return e==="x"}var QT=1750;function Up(e,t,n){t.on(["create.start","shape.move.start"],QT,function(r){var i=r.context,o=i.shape,a=e.getRootElement();if(!(!h(o,"bpmn:Participant")||!h(a,"bpmn:Process")||!a.children.length)){var s=i.createConstraints;s&&(o.width=n.snapValue(o.width,{min:o.width}),o.height=n.snapValue(o.height,{min:o.height}))}})}Up.$inject=["canvas","eventBus","gridSnapping"];N();var JT=3e3;function ga(e,t,n){k.call(this,e),this._gridSnapping=t;var r=this;this.postExecuted(["connection.create","connection.layout"],JT,function(i){var o=i.context,a=o.connection,s=o.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||eM(c)&&n.updateWaypoints(a,r.snapMiddleSegments(c))})}ga.$inject=["eventBus","gridSnapping","modeling"];B(ga,k);ga.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var r=1;r<e.length-2;r++)n=rM(t,e[r],e[r+1]),e[r]=n[0],e[r+1]=n[1];return e};function eM(e){return e.length>3}function tM(e){return e==="h"}function nM(e){return e==="v"}function rM(e,t,n){var r=en(t,n),i={};return tM(r)&&(i.y=e.snapValue(t.y)),nM(r)&&(i.x=e.snapValue(t.x)),("x"in i||"y"in i)&&(t=C({},t,i),n=C({},n,i)),[t,n]}var Cb={__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",Wp],gridSnappingParticipantBehavior:["type",Up],gridSnappingLayoutConnectionBehavior:["type",ga]};var Rb={__depends__:[Sb,Cb],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",$p]};var iM=30,Pb=30;function no(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(r){var i=r.element,o=r.gfx;if(h(i,"bpmn:Lane"))return n._createParticipantHit(i,o);if(h(i,"bpmn:Participant"))return ie(i)?n._createParticipantHit(i,o):n._createDefaultHit(i,o);if(h(i,"bpmn:SubProcess"))return ie(i)?n._createSubProcessHit(i,o):n._createDefaultHit(i,o)})}no.$inject=["eventBus","interactionEvents"];no.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0};no.prototype._createParticipantHit=function(e,t){this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"no-move",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height});var n=Me(e)?{width:iM,height:e.height}:{width:e.width,height:Pb};return this._interactionEvents.createBoxHit(t,"all",n),!0};no.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:Pb}),!0};var Ab={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",no]};function ya(e){e.invoke(Mr,this)}B(ya,Mr);ya.$inject=["injector"];ya.prototype.registerBindings=function(e,t){Mr.prototype.registerBindings.call(this,e,t);function n(r,i){t.isRegistered(r)&&e.addListener(i)}n("selectElements",function(r){var i=r.keyEvent;if(e.isKey(["a","A"],i)&&e.isCmd(i))return t.trigger("selectElements"),!0}),n("find",function(r){var i=r.keyEvent;if(e.isKey(["f","F"],i)&&e.isCmd(i))return t.trigger("find"),!0}),n("spaceTool",function(r){var i=r.keyEvent;if(!e.hasModifier(i)&&e.isKey(["s","S"],i))return t.trigger("spaceTool"),!0}),n("lassoTool",function(r){var i=r.keyEvent;if(!e.hasModifier(i)&&e.isKey(["l","L"],i))return t.trigger("lassoTool"),!0}),n("handTool",function(r){var i=r.keyEvent;if(!e.hasModifier(i)&&e.isKey(["h","H"],i))return t.trigger("handTool"),!0}),n("globalConnectTool",function(r){var i=r.keyEvent;if(!e.hasModifier(i)&&e.isKey(["c","C"],i))return t.trigger("globalConnectTool"),!0}),n("directEditing",function(r){var i=r.keyEvent;if(!e.hasModifier(i)&&e.isKey(["e","E"],i))return t.trigger("directEditing"),!0}),n("replaceElement",function(r){var i=r.keyEvent;if(!e.hasModifier(i)&&e.isKey(["r","R"],i))return t.trigger("replaceElement",i),!0})};var Tb={__depends__:[wo],__init__:["keyboardBindings"],keyboardBindings:["type",ya]};N();var oM={moveSpeed:1,moveSpeedAccelerated:10},aM=1500,Mb="left",Db="up",kb="right",Nb="down",sM={ArrowLeft:Mb,Left:Mb,ArrowUp:Db,Up:Db,ArrowRight:kb,Right:kb,ArrowDown:Nb,Down:Nb},cM={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 qp(e,t,n,r,i){var o=this;this._config=C({},oM,e||{}),t.addListener(aM,function(a){var s=a.keyEvent,c=sM[s.key];if(c&&!t.isCmd(s)){var u=t.isShift(s);return o.moveSelection(c,u),!0}}),this.moveSelection=function(a,s){var c=i.get();if(c.length){var u=this._config[s?"moveSpeedAccelerated":"moveSpeed"],p=cM[a](u),l=r.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});l&&n.moveElements(c,p)}}}qp.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];var Ob={__depends__:[wo,rt],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",qp]};N();var Bb=10;function ro(e,t,n,r){this._dragging=r,this._rules=t;var i=this;function o(c,u){var p=c.shape,l=c.direction,f=c.resizeConstraints,d;c.delta=u,d=Ng(p,l,u),c.newBounds=Bg(d,f),c.canExecute=i.canResize(c)}function a(c){var u=c.resizeConstraints,p=c.minBounds;u===void 0&&(p===void 0&&(p=i.computeMinResizeBox(c)),c.resizeConstraints={min:Z(p)})}function s(c){var u=c.shape,p=c.canExecute,l=c.newBounds;if(p){if(l=wc(l),!uM(u,l))return;n.resizeShape(u,l)}}e.on("resize.start",function(c){a(c.context)}),e.on("resize.move",function(c){var u={x:c.dx,y:c.dy};o(c.context,u)}),e.on("resize.end",function(c){s(c.context)})}ro.prototype.canResize=function(e){var t=this._rules,n=mt(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)};ro.prototype.activate=function(e,t,n){var r=this._dragging,i,o;if(typeof n=="string"&&(n={direction:n}),i=C({shape:t},n),o=i.direction,!o)throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");r.init(e,pd(t,o),"resize",{autoActivate:!0,cursor:pM(o),data:{shape:t,context:i}})};ro.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,r,i;return r=e.minDimensions||{width:Bb,height:Bb},i=tp(t,e.childrenBoxPadding),Ig(n,t,r,i)};ro.$inject=["eventBus","rules","modeling","dragging"];function uM(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function pd(e,t){var n=X(e),r=Z(e),i={x:n.x,y:n.y};return t.indexOf("n")!==-1?i.y=r.top:t.indexOf("s")!==-1&&(i.y=r.bottom),t.indexOf("e")!==-1?i.x=r.right:t.indexOf("w")!==-1&&(i.x=r.left),i}function pM(e){var t="resize-";return e==="n"||e==="s"?t+"ns":e==="e"||e==="w"?t+"ew":e==="nw"||e==="se"?t+"nwse":t+"nesw"}var Ib="djs-resizing",Lb="resize-not-ok",lM=500;function Kp(e,t,n){function r(o){var a=o.shape,s=o.newBounds,c=o.frame;c||(c=o.frame=n.addFrame(a,t.getActiveLayer()),t.addMarker(a,Ib)),s.width>5&&$(c,{x:s.x,width:s.width}),s.height>5&&$(c,{y:s.y,height:s.height}),o.canExecute?pe(c).remove(Lb):pe(c).add(Lb)}function i(o){var a=o.shape,s=o.frame;s&&Pe(o.frame),t.removeMarker(a,Ib)}e.on("resize.move",lM,function(o){r(o.context)}),e.on("resize.cleanup",function(o){i(o.context)})}Kp.$inject=["eventBus","canvas","previewSupport"];N();var Yp=-6,Xp=8,Zp=20,oc="djs-resizer",fM=["n","w","s","e","nw","ne","se","sw"];function hr(e,t,n,r){this._resize=r,this._canvas=t;var i=this;e.on("selection.changed",function(o){var a=o.newSelection;i.removeResizers(),a.length===1&&E(a,tt(i.addResizer,i))}),e.on("shape.changed",function(o){var a=o.element;n.isSelected(a)&&(i.removeResizers(),i.addResizer(a))})}hr.prototype.makeDraggable=function(e,t,n){var r=this._resize;function i(o){gn(o)&&r.activate(o,e,n)}se.bind(t,"mousedown",i),se.bind(t,"touchstart",i)};hr.prototype._createResizer=function(e,t,n,r){var i=this._getResizersParent(),o=dM(r),a=U("g");pe(a).add(oc),pe(a).add(oc+"-"+e.id),pe(a).add(oc+"-"+r),J(i,a);var s=U("rect");$(s,{x:-Xp/2+o.x,y:-Xp/2+o.y,width:Xp,height:Xp}),pe(s).add(oc+"-visual"),J(a,s);var c=U("rect");return $(c,{x:-Zp/2+o.x,y:-Zp/2+o.y,width:Zp,height:Zp}),pe(c).add(oc+"-hit"),J(a,c),fo(a,t,n),a};hr.prototype.createResizer=function(e,t){var n=pd(e,t),r=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,r,t)};hr.prototype.addResizer=function(e){var t=this;de(e)||E(fM,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})};hr.prototype.removeResizers=function(){var e=this._getResizersParent();_r(e)};hr.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")};hr.$inject=["eventBus","canvas","selection","resize"];function dM(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-Yp:e.indexOf("w")!==-1&&(t.x=Yp),e.indexOf("s")!==-1?t.y=-Yp:e.indexOf("n")!==-1&&(t.y=Yp),t}var Qp={__depends__:[Et,kt,Dn],__init__:["resize","resizePreview","resizeHandles"],resize:["type",ro],resizePreview:["type",Kp],resizeHandles:["type",hr]};N();var mM=2e3;function io(e,t,n,r,i,o,a){this._bpmnFactory=t,this._canvas=n,this._modeling=i,this._textRenderer=a,r.registerProvider(this),e.on("element.dblclick",function(c){s(c.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"],mM,function(c){r.isActive(c.element)&&r.cancel()}),e.on(["commandStack.changed"],function(c){r.isActive()&&r.cancel()}),e.on("directEditing.activate",function(c){o.removeResizers()}),e.on("create.end",500,function(c){var u=c.context,p=u.shape,l=c.context.canExecute,f=c.isTouch;f||l&&(u.hints&&u.hints.createElementsBehavior===!1||s(p))}),e.on("autoPlace.end",500,function(c){s(c.shape)});function s(c,u){(u||te(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&r.activate(c)}}io.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"];io.prototype.activate=function(e){var t=gt(e);if(t!==void 0){var n={text:t},r=this.getEditingBBox(e);C(n,r);var i={},o=n.style||{};return C(o,{backgroundColor:null,border:null}),(te(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||jb(e))&&C(i,{centerVertically:!0}),mn(e)&&(C(i,{resizable:!0,autoResize:!0}),C(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),h(e,"bpmn:TextAnnotation")&&(C(i,{resizable:!0,autoResize:!0}),C(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),C(n,{options:i,style:o}),n}};io.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,r=t.getAbsoluteBBox(n),i={x:r.x+r.width/2,y:r.y+r.height/2},o={x:r.x,y:r.y},a=t.zoom(),s=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),u=c.fontSize*a,p=c.lineHeight,l=s.fontSize*a,f=s.lineHeight,d={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(h(e,"bpmn:Lane")||gM(e)){var m=Me(e),g=m?{width:r.height,height:30*a,x:r.x-r.height/2+15*a,y:i.y-30*a/2}:{width:r.width,height:30*a};C(o,g),C(d,{fontSize:l+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:m?"rotate(-90deg)":null})}if(vM(e)){var v=Me(e),w=v?{width:r.width,height:r.height}:{width:r.height,height:r.width,x:i.x-r.height/2,y:i.y-r.width/2};C(o,w),C(d,{fontSize:l+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:v?null:"rotate(-90deg)"})}(te(e,["bpmn:Task","bpmn:CallActivity"])||jb(e))&&(C(o,{width:r.width,height:r.height}),C(d,{fontSize:l+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),hM(e)&&(C(o,{width:r.width,x:r.x}),C(d,{fontSize:l+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var S=1,x=r.width+2*S;if(n.labelTarget&&(C(o,{width:x,height:r.height+2*S,x:r.x-S,y:r.y-S}),C(d,{fontSize:u+"px",lineHeight:p})),mn(n)&&!Xr(n)&&!ee(n)){var b=La(e),R=t.getAbsoluteBBox({x:b.x,y:b.y,width:0,height:0}),A=u,O=ir.width*a+2*S;C(o,{width:O,height:A+2*S,x:R.x-O/2,y:R.y-A/2-S}),C(d,{fontSize:u+"px",lineHeight:p})}return h(e,"bpmn:TextAnnotation")&&(C(o,{width:r.width+2*S,height:r.height+2*S,x:r.x-S,y:r.y-S,minWidth:30*a,minHeight:10*a}),C(d,{textAlign:"left",paddingTop:wr*a+"px",paddingBottom:wr*a+"px",paddingLeft:wr*a+"px",paddingRight:wr*a+"px",fontSize:l+"px",lineHeight:f})),{bounds:o,style:d}};io.prototype.update=function(e,t,n,r){var i,o;h(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}),yM(t)&&(t=null),this._modeling.updateLabel(e,t,i)};function jb(e){return h(e,"bpmn:SubProcess")&&!ie(e)}function hM(e){return h(e,"bpmn:SubProcess")&&ie(e)}function vM(e){return h(e,"bpmn:Participant")&&!ie(e)}function gM(e){return h(e,"bpmn:Participant")&&ie(e)}function yM(e){return!e||!e.trim()}var Fb="djs-element-hidden",Hb="djs-label-hidden";function Jp(e,t,n){var r=this,i=t.getDefaultLayer(),o,a,s;e.on("directEditing.activate",function(c){var u=c.active;if(o=u.element.label||u.element,h(o,"bpmn:TextAnnotation")){a=t.getAbsoluteBBox(o),s=U("g");var p=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:o.height,position:{mx:0,my:0}}),l=r.path=U("path");$(l,{d:p,strokeWidth:2,stroke:_M(o)}),J(s,l),J(i,s),Fe(s,o.x,o.y)}h(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,Fb):(h(o,"bpmn:Task")||h(o,"bpmn:CallActivity")||h(o,"bpmn:SubProcess")||h(o,"bpmn:Participant")||h(o,"bpmn:Lane"))&&t.addMarker(o,Hb)}),e.on("directEditing.resize",function(c){if(h(o,"bpmn:TextAnnotation")){var u=c.height,p=c.dy,l=Math.max(o.height/a.height*(u+p),0),f=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:l,position:{mx:0,my:0}});$(r.path,{d:f})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var u=c.active;u&&(t.removeMarker(u.element.label||u.element,Fb),t.removeMarker(o,Hb)),o=void 0,a=void 0,s&&(Pe(s),s=void 0)})}Jp.$inject=["eventBus","canvas","pathMap"];function _M(e,t){var n=ce(e);return n.get("stroke")||t||"black"}var $b={__depends__:[xo,Qp,Hp],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",io],labelEditingPreview:["type",Jp]};N();var bM=500,xM=1e3;function jr(e,t){this._eventBus=e,this.offset=5;var n=t.cls("djs-outline",["no-fill"]),r=this;function i(o){var a=U("rect");return $(a,C({x:0,y:0,rx:4,width:100,height:100},n)),a}e.on(["shape.added","shape.changed"],bM,function(o){var a=o.element,s=o.gfx,c=_e(".djs-outline",s);c||(c=r.getOutline(a)||i(s),J(s,c)),r.updateShapeOutline(c,a)}),e.on(["connection.added","connection.changed"],function(o){var a=o.element,s=o.gfx,c=_e(".djs-outline",s);c||(c=i(s),J(s,c)),r.updateConnectionOutline(c,a)})}jr.prototype.updateShapeOutline=function(e,t){var n=!1,r=this._getProviders();r.length&&E(r,function(i){n=n||i.updateOutline(t,e)}),n||$(e,{x:-this.offset,y:-this.offset,width:t.width+this.offset*2,height:t.height+this.offset*2})};jr.prototype.updateConnectionOutline=function(e,t){var n=Ce(t);$(e,{x:n.x-this.offset,y:n.y-this.offset,width:n.width+this.offset*2,height:n.height+this.offset*2})};jr.prototype.registerProvider=function(e,t){t||(t=e,e=xM),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})};jr.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers};jr.prototype.getOutline=function(e){var t,n=this._getProviders();return E(n,function(r){Le(r.getOutline)&&(t=t||r.getOutline(e))}),t};jr.$inject=["eventBus","styles","elementRegistry"];N();var el=6;function ac(e,t,n){this._canvas=t;var r=this;e.on("element.changed",function(i){n.isSelected(i.element)&&r._updateMultiSelectionOutline(n.get())}),e.on("selection.changed",function(i){var o=i.newSelection;r._updateMultiSelectionOutline(o)})}ac.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");_r(t);var n=e.length>1,r=this._canvas.getContainer();if(pe(r)[n?"add":"remove"]("djs-multi-select"),!!n){var i=EM(Ce(e)),o=U("rect");$(o,C({rx:3},i)),pe(o).add("djs-selection-outline"),J(t,o)}};ac.$inject=["eventBus","canvas","selection"];function EM(e){return{x:e.x-el,y:e.y-el,width:e.width+el*2,height:e.height+el*2}}var _a={__depends__:[rt],__init__:["outline","multiSelectionOutline"],outline:["type",jr],multiSelectionOutline:["type",ac]};var zb=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],Gb={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},wM=15,tl=2;function nl(e,t,n,r,i){let o=t.getLayer("overlays");e.on(["selection.changed","shape.changed"],function(){s()}),e.on("selection.changed",function({newSelection:l}){var d;let f=l.filter(m=>te(m,zb));if(f.length===1){let m=f[0];ee(m)?a(m,m.labelTarget,l):(d=m.labels)!=null&&d.length&&a(m.labels[0],m,l)}if(f.length===2){let m=f.find(ee),g=f.find(v=>{var w;return(w=v.labels)==null?void 0:w.includes(m)});m&&g&&a(m,g,l)}}),e.on("shape.changed",function({element:l}){var f;!te(l,zb)||!p(l)||(ee(l)?a(l,l.labelTarget,i.get()):(f=l.labels)!=null&&f.length&&a(l.labels[0],l,i.get()))});function a(l,f,d=[]){let m=Xn([X(f),X(l)],Gb),g=m.getAttribute("d"),w=d.includes(l)?c(l):u(l),S=qr(w,g);if(!S)return;let b=d.includes(f)?c(f):u(f),R=qr(b,g)||X(f);Li(R,S)<wM||(Pa(m,[R,S]),J(o,m))}function s(){xi(`.${Gb.class}`,o).forEach(Pe)}function c(l){let f=r.getOutline(l),d=r.offset;if(!f)return u(l);if(f.x){let m={x:l.x+oo(f,"x")-tl,y:l.y+oo(f,"y")-tl,width:oo(f,"width")+tl*2,height:oo(f,"height")+tl*2};return ja(m,oo(f,"rx"))}if(f.cx){let m={x:l.x-d,y:l.y-d,width:oo(f,"r")*2,height:oo(f,"r")*2};return Bc(m)}}function u(l){return n.getShapePath(l)}function p(l){return i.get().includes(l)}}nl.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function oo(e,t){return parseFloat($(e,t)||0)}var Vb={__depends__:[rt,_a],__init__:["labelLink"],labelLink:["type",nl]};N();var SM=new or("tt");function CM(e){var t=ue('<div class="djs-tooltip-container" />');return vt(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function RM(e,t,n){vt(e,{left:t+"px",top:n+"px"})}function fd(e,t){e.style.display=t===!1?"none":""}var Wb="djs-tooltip",ld="."+Wb;function It(e,t){this._eventBus=e,this._canvas=t,this._ids=SM,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=CM(t.getContainer());var n=this;bt.bind(this._tooltipRoot,ld,"mousedown",function(r){r.stopPropagation()}),bt.bind(this._tooltipRoot,ld,"mouseover",function(r){n.trigger("mouseover",r)}),bt.bind(this._tooltipRoot,ld,"mouseout",function(r){n.trigger("mouseout",r)}),this._init()}It.$inject=["eventBus","canvas"];It.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=C({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t};It.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,r=this.get(nt(n,"data-tooltip-id"));r&&(e==="mouseover"&&r.timeout&&this.clearTimeout(r),e==="mouseout"&&r.timeout&&(r.timeout=1e3,this.setTimeout(r)))};It.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]};It.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}};It.prototype.setTimeout=function(e){if(e=this.get(e),!!e){this.clearTimeout(e);var t=this;e.removeTimer=setTimeout(function(){t.remove(e)},e.timeout)}};It.prototype.remove=function(e){var t=this.get(e);t&&(Wt(t.html),Wt(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])};It.prototype.show=function(){fd(this._tooltipRoot)};It.prototype.hide=function(){fd(this._tooltipRoot,!1)};It.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};It.prototype._addTooltip=function(e){var t=e.id,n=e.html,r,i=this._tooltipRoot;n.get&&n.constructor.prototype.jquery&&(n=n.get(0)),st(n)&&(n=ue(n)),r=ue('<div data-tooltip-id="'+t+'" class="'+Wb+'">'),vt(r,{position:"absolute"}),r.appendChild(n),e.type&&Ne(r).add("djs-tooltip-"+e.type),e.className&&Ne(r).add(e.className),e.htmlContainer=r,i.appendChild(r),this._tooltips[t]=e,this._updateTooltip(e)};It.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;RM(n,t.x,t.y)};It.prototype._updateTooltipVisibilty=function(e){E(this._tooltips,function(t){var n=t.show,r=t.htmlContainer,i=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(i=!1),fd(r,i))})};It.prototype._init=function(){var e=this;function t(n){e._updateRoot(n),e._updateTooltipVisibilty(n),e.show()}this._eventBus.on("canvas.viewbox.changing",function(n){e.hide()}),this._eventBus.on("canvas.viewbox.changed",function(n){t(n.viewbox)})};var Ub={__init__:["tooltips"],tooltips:["type",It]};var PM="flow elements must be children of pools/participants",AM="Data object must be placed within a pool/participant.";function rl(e,t,n){function r(i,o,a){t.add({position:{x:i.x+5,y:i.y+5},type:"error",timeout:a||2e3,html:"<div>"+o+"</div>"})}e.on(["shape.move.rejected","create.rejected"],function(i){var o=i.context,a=o.shape,s=o.target;h(s,"bpmn:Collaboration")&&(h(a,"bpmn:FlowNode")?r(i,n(PM)):h(a,"bpmn:DataObjectReference")&&r(i,n(AM)))})}rl.$inject=["eventBus","tooltips","translate"];var qb={__depends__:[Ub],__init__:["modelingFeedback"],modelingFeedback:["type",rl]};N();var TM=500,MM=1250,DM=1500,il=Math.round;function kM(e){return{x:e.x+il(e.width/2),y:e.y+il(e.height/2)}}function ol(e,t,n,r,i){function o(s,c,u,p){return i.allowed("elements.move",{shapes:s,delta:c,position:u,target:p})}e.on("shape.move.start",DM,function(s){var c=s.context,u=s.shape,p=r.get().slice();p.indexOf(u)===-1&&(p=[u]),p=NM(p),C(c,{shapes:p,validatedShapes:p,shape:u})}),e.on("shape.move.start",MM,function(s){var c=s.context,u=c.validatedShapes,p;if(p=c.canExecute=o(u),!p)return!1}),e.on("shape.move.move",TM,function(s){var c=s.context,u=c.validatedShapes,p=s.hover,l={x:s.dx,y:s.dy},f={x:s.x,y:s.y},d;if(d=o(u,l,f,p),c.delta=l,c.canExecute=d,d===null){c.target=null;return}c.target=p}),e.on("shape.move.end",function(s){var c=s.context,u=c.delta,p=c.canExecute,l=p==="attach",f=c.shapes;if(p===!1)return!1;u.x=il(u.x),u.y=il(u.y),!(u.x===0&&u.y===0)&&n.moveElements(f,u,c.target,{primaryShape:c.shape,attach:l})}),e.on("element.mousedown",function(s){if(gn(s)){var c=Ar(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,u,p){if(Se(u)&&(p=u,u=!1),!(c.waypoints||!c.parent)&&!pe(s.target).has("djs-hit-no-move")){var l=kM(c),f=t.init(s,l,"shape.move",{cursor:"grabbing",autoActivate:u,data:{shape:c,context:p||{}}});if(f!==!1)return!0}}this.start=a}ol.$inject=["eventBus","dragging","modeling","selection","rules"];function NM(e){var t=Vt(e,"id");return Q(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}N();var Kb=499,dd="djs-dragging",Yb="drop-ok",Xb="drop-not-ok",Zb="new-parent",Qb="attach-ok";function al(e,t,n,r){function i(c){var u=o(c),p=OM(u);return p}function o(c){var u=Zn(c,!0),p=u.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),l=u.concat(p),f=[...new Set(l)];return f}function a(c,u){[Qb,Yb,Xb,Zb].forEach(function(p){p===u?t.addMarker(c,p):t.removeMarker(c,p)})}function s(c,u,p){r.addDragger(u,c.dragGroup),p&&t.addMarker(u,dd),c.allDraggedElements?c.allDraggedElements.push(u):c.allDraggedElements=[u]}e.on("shape.move.start",Kb,function(c){var u=c.context,p=u.shapes,l=u.allDraggedElements,f=i(p);if(!u.dragGroup){var d=U("g");$(d,n.cls("djs-drag-group",["no-events"]));var m=t.getActiveLayer();J(m,d),u.dragGroup=d}f.forEach(function(g){r.addDragger(g,u.dragGroup)}),l?l=_i([l,o(p)]):l=o(p),E(l,function(g){t.addMarker(g,dd)}),u.allDraggedElements=l,u.differentParents=BM(p)}),e.on("shape.move.move",Kb,function(c){var u=c.context,p=u.dragGroup,l=u.target,f=u.shape.parent,d=u.canExecute;l&&(d==="attach"?a(l,Qb):u.canExecute&&f&&l.id!==f.id?a(l,Zb):a(l,u.canExecute?Yb:Xb)),Fe(p,c.dx,c.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(c){var u=c.context,p=u.target;p&&a(p,null)}),e.on("shape.move.cleanup",function(c){var u=c.context,p=u.allDraggedElements,l=u.dragGroup;E(p,function(f){t.removeMarker(f,dd)}),l&&Pe(l)}),this.makeDraggable=s}al.$inject=["eventBus","canvas","styles","previewSupport"];function OM(e){var t=Q(e,function(n){return de(n)?re(e,Ct({id:n.source.id}))&&re(e,Ct({id:n.target.id})):!0});return t}function BM(e){return vl(Vt(e,function(t){return t.parent&&t.parent.id}))!==1}var Jb={__depends__:[ei,rt,_a,Et,kt,Dn],__init__:["move","movePreview"],move:["type",ol],movePreview:["type",al]};N();var tx=".djs-palette-toggle",nx=".entry",IM=tx+", "+nx,md="djs-palette-",LM="shown",hd="open",ex="two-column",jM=1e3;function ot(e,t){this._eventBus=e,this._canvas=t;var n=this;e.on("tool-manager.update",function(r){var i=r.tool;n.updateToolHighlight(i)}),e.on("i18n.changed",function(){n._update()}),e.on("diagram.init",function(){n._diagramInitialized=!0,n._rebuild()})}ot.$inject=["eventBus","canvas"];ot.prototype.registerProvider=function(e,t){t||(t=e,e=jM),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()};ot.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(HM,{})};ot.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}};ot.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),r=this._container=ue(ot.HTML_MARKUP);n.appendChild(r),Ne(n).add(md+LM),bt.bind(r,IM,"click",function(i){var o=i.delegateTarget;if(Ra(o,tx))return e.toggle();e.trigger("click",i)}),se.bind(r,"mousedown",function(i){i.stopPropagation()}),bt.bind(r,nx,"dragstart",function(i){e.trigger("dragstart",i)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:r})};ot.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers};ot.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,r=this._eventBus,i,o=Ne(n),a=Ne(t);"twoColumn"in e?i=e.twoColumn:i=this._needsCollapse(t.clientHeight,this._entries||{}),o.toggle(ex,i),a.toggle(md+ex,i),"open"in e&&(o.toggle(hd,e.open),a.toggle(md+hd,e.open)),r.fire("palette.changed",{twoColumn:i,open:this.isOpen()})};ot.prototype._update=function(){var e=_e(".djs-palette-entries",this._container),t=this._entries=this.getEntries();Hr(e),E(t,function(n,r){var i=n.group||"default",o=_e("[data-group="+Rr(i)+"]",e);o||(o=ue('<div class="group"></div>'),nt(o,"data-group",i),e.appendChild(o));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=ue(a);if(o.appendChild(s),!n.separator&&(nt(s,"data-action",r),n.title&&nt(s,"title",n.title),n.className&&FM(s,n.className),n.imageUrl)){var c=ue("<img>");nt(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()};ot.prototype.trigger=function(e,t,n){var r,i,o=t.delegateTarget||t.target;return o?(r=nt(o,"data-action"),i=t.originalEvent||t,this.triggerEntry(r,e,i,n)):t.preventDefault()};ot.prototype.triggerEntry=function(e,t,n,r){var i=this._entries,o,a;if(o=i[e],!!o&&(a=o.action,this._eventBus.fire("palette.trigger",{entry:o,event:n})!==!1)){if(Le(a)){if(t==="click")return a(n,r)}else if(a[t])return a[t](n,r);n.preventDefault()}};ot.prototype._layoutChanged=function(){this._toggleState({})};ot.prototype._needsCollapse=function(e,t){var n=50,r=Object.keys(t).length*46;return e<r+n};ot.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})};ot.prototype.open=function(){this._toggleState({open:!0})};ot.prototype.toggle=function(){this.isOpen()?this.close():this.open()};ot.prototype.isActiveTool=function(e){return e&&this._activeTool===e};ot.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=_e(".djs-palette-entries",this._container),this._toolsContainer=_e("[data-group=tools]",t)),n=this._toolsContainer,E(n.children,function(r){var i=r.getAttribute("data-action");if(i){var o=Ne(r);i=i.replace("-tool",""),o.contains("entry")&&i===e?o.add("highlighted-entry"):o.remove("highlighted-entry")}})};ot.prototype.isOpen=function(){return Ne(this._container).has(hd)};ot.prototype._getParentContainer=function(){return this._canvas.getContainer()};ot.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function FM(e,t){var n=Ne(e),r=q(t)?t:t.split(/\s+/g);r.forEach(function(i){n.add(i)})}function HM(e,t){var n=t.getPaletteEntries();return Le(n)?n(e):(E(n,function(r,i){e[i]=r}),e)}var rx={__init__:["palette"],palette:["type",ot]};N();var ax="crosshair",ix="selected",$M="djs-dragging-active-lasso";function vr(e,t,n,r,i,o,a){this._selection=i,this._dragging=n,this._mouse=a;var s=this,c={create:function(l){var f=t.getActiveLayer(),d=l.frame=U("rect");$(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),J(f,d),u(!0),this.update(l)},update:function(l){var f=l.frame,d=l.bbox;f&&d&&$(f,{x:d.x,y:d.y,width:d.width,height:d.height});var m=l.marked,g=l.lastMarked;if(m&&g){for(let v of g)m.has(v)||t.removeMarker(v,ix);for(let v of m)g.has(v)||t.addMarker(v,ix)}},remove:function(l){this.update(l),l.frame&&Pe(l.frame),u(!1)}};function u(l){pe(t.getContainer()).toggle($M,l)}function p(l){var f=r.getAll();return new Set(Sn(wi(f,l)))}o.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",function(l){var f=l.originalEvent.target;!l.hover&&!(f instanceof SVGElement)||e.once("lasso.selection.ended",function(){s.activateLasso(l.originalEvent,!0)})}),e.on("lasso.end",0,function(l){var f=l.context;s._select(Array.from(f.marked))}),e.on("lasso.start",function(l){var f=l.context;f.bbox=ox(l),f.add=Mi(l),f.lastMarked=new Set(i.get()),f.add?f.marked=f.lastMarked:f.marked=new Set,f.initialMarked=f.marked,c.create(f)}),e.on("lasso.move",function(l){var f=l.context,d=f.bbox=ox(l),m=p(d),g=f.initialMarked.union(m);f.lastMarked=f.marked,f.marked=g,c.update(f)}),e.on("lasso.cleanup",function(l){var f=l.context;f.lastMarked=f.marked,f.marked=new Set(i.get()),c.remove(l.context)}),e.on("element.mousedown",1500,function(l){if(Mi(l))return s.activateLasso(l.originalEvent),!0})}vr.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"];vr.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:ax,data:{context:{}},keepSelection:!0})};vr.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:ax,data:{context:{}},keepSelection:!0})};vr.prototype._select=function(e){this._selection.select(e)};vr.prototype.select=function(e,t,n=[]){var r=Sn(wi(e,t));this._select([...n,...r])};vr.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)};vr.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function ox(e){var t={x:e.x-e.dx,y:e.y-e.dy},n={x:e.x,y:e.y},r;return t.x<=n.x&&t.y<n.y||t.x<n.x&&t.y<=n.y?r={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?r={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?r={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?r={x:n.x,y:n.y,width:t.x-n.x,height:t.y-n.y}:r={x:n.x,y:n.y,width:0,height:0},r}var sx={__depends__:[fi,pr],__init__:["lassoTool"],lassoTool:["type",vr]};var vd=1500,ux="grab";function vi(e,t,n,r,i,o){this._dragging=n,this._mouse=o;var a=this,s=r.get("keyboard",!1);i.registerTool("hand",{tool:"hand",dragging:"hand.move"}),e.on("element.mousedown",vd,function(c){if(Tr(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(vd,function(c){if(!(!cx(c.keyEvent)||a.isActive())){var u=a._mouse.getLastMoveEvent();a.activateMove(u,!!u)}},"keyboard.keydown"),s&&s.addListener(vd,function(c){!cx(c.keyEvent)||!a.isActive()||a.toggle()},"keyboard.keyup"),e.on("hand.end",function(c){var u=c.originalEvent.target;if(!c.hover&&!(u instanceof SVGElement))return!1;e.once("hand.ended",function(){a.activateMove(c.originalEvent,{reactivate:!0})})}),e.on("hand.move.move",function(c){var u=t.viewbox().scale;t.scroll({dx:c.dx*u,dy:c.dy*u})}),e.on("hand.move.end",function(c){var u=c.context,p=u.reactivate;return!Tr(c)&&p&&e.once("hand.move.ended",function(l){a.activateHand(l.originalEvent,!0,!0)}),!1})}vi.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"];vi.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:ux,data:{context:n||{}}})};vi.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:ux,data:{context:{reactivate:n}}})};vi.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)};vi.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function cx(e){return Ke("Space",e)}var px={__depends__:[fi,pr],__init__:["handTool"],handTool:["type",vi]};var lx="connect-ok",fx="connect-not-ok";function gi(e,t,n,r,i,o,a){var s=this;this._dragging=t,this._rules=o,this._mouse=a,i.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),e.on("global-connect.hover",function(c){var u=c.context,p=c.hover,l=u.canStartConnect=s.canStartConnect(p);l!==null&&(u.startTarget=p,r.addMarker(p,l?lx:fx))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var u=c.context.startTarget,p=c.context.canStartConnect;u&&r.removeMarker(u,p?lx:fx)}),e.on(["global-connect.ended"],function(c){var u=c.context,p=u.startTarget,l={x:c.x,y:c.y},f=s.canStartConnect(p);if(f)return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),n.start(null,p,l)}),!1})}gi.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"];gi.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})};gi.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)};gi.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)};gi.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};var dx={__depends__:[Lo,Et,kt,fi,pr],globalConnect:["type",gi]};N();function sc(e,t,n,r,i,o,a,s){this._palette=e,this._create=t,this._elementFactory=n,this._spaceTool=r,this._lassoTool=i,this._handTool=o,this._globalConnect=a,this._translate=s,e.registerProvider(this)}sc.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"];sc.prototype.getPaletteEntries=function(){var e={},t=this._create,n=this._elementFactory,r=this._spaceTool,i=this._lassoTool,o=this._handTool,a=this._globalConnect,s=this._translate;function c(l,f,d,m,g){function v(w){var S=n.createShape(C({type:l},g));t.start(w,S)}return{group:f,className:d,title:m,action:{dragstart:v,click:v}}}function u(l){var f=n.createShape({type:"bpmn:SubProcess",x:0,y:0,isExpanded:!0}),d=n.createShape({type:"bpmn:StartEvent",x:40,y:82,parent:f});t.start(l,[f,d],{hints:{autoSelect:[f]}})}function p(l){t.start(l,n.createParticipantShape())}return C(e,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:s("Activate hand tool"),action:{click:function(l){o.activateHand(l)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:s("Activate lasso tool"),action:{click:function(l){i.activateSelection(l)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:s("Activate create/remove space tool"),action:{click:function(l){r.activateSelection(l)}}},"global-connect-tool":{group:"tools",className:"bpmn-icon-connection-multi",title:s("Activate global connect tool"),action:{click:function(l){a.start(l)}}},"tool-separator":{group:"tools",separator:!0},"create.start-event":c("bpmn:StartEvent","event","bpmn-icon-start-event-none",s("Create start event")),"create.intermediate-event":c("bpmn:IntermediateThrowEvent","event","bpmn-icon-intermediate-event-none",s("Create intermediate/boundary event")),"create.end-event":c("bpmn:EndEvent","event","bpmn-icon-end-event-none",s("Create end event")),"create.exclusive-gateway":c("bpmn:ExclusiveGateway","gateway","bpmn-icon-gateway-none",s("Create gateway")),"create.task":c("bpmn:Task","activity","bpmn-icon-task",s("Create task")),"create.data-object":c("bpmn:DataObjectReference","data-object","bpmn-icon-data-object",s("Create data object reference")),"create.data-store":c("bpmn:DataStoreReference","data-store","bpmn-icon-data-store",s("Create data store reference")),"create.subprocess-expanded":{group:"activity",className:"bpmn-icon-subprocess-expanded",title:s("Create expanded sub-process"),action:{dragstart:u,click:u}},"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:s("Create pool/participant"),action:{dragstart:p,click:p}},"create.group":c("bpmn:Group","artifact","bpmn-icon-group",s("Create group"))}),e};var mx={__depends__:[rx,li,Np,sx,px,dx,Zr],__init__:["paletteProvider"],paletteProvider:["type",sc]};N();var zM=250;function cc(e,t,n,r,i){k.call(this,e);function o(s){var c=s.canExecute.replacements;E(c,function(u){var p=u.oldElementId,l={type:u.newElementType};if(!s.visualReplacements[p]){var f=t.get(p);C(l,{x:f.x,y:f.y});var d=n.createShape(l);r.addShape(d,f.parent);var m=_e('[data-element-id="'+Rr(f.id)+'"]',s.dragGroup);m&&$(m,{display:"none"});var g=i.addDragger(d,s.dragGroup);s.visualReplacements[p]=g,r.removeShape(d)}})}function a(s){var c=s.visualReplacements;E(c,function(u,p){var l=_e('[data-element-id="'+Rr(p)+'"]',s.dragGroup);l&&$(l,{display:"inline"}),u.remove(),c[p]&&delete c[p]})}e.on("shape.move.move",zM,function(s){var c=s.context,u=c.canExecute;c.visualReplacements||(c.visualReplacements={}),u&&u.replacements?o(c):a(c)})}cc.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"];B(cc,k);var hx={__depends__:[Dn],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",cc]};N();var GM=1250,gd=40,VM=20,WM=10,vx=20,yx=["x","y"],UM=Math.abs;function sl(e){e.on(["connect.hover","connect.move","connect.end"],GM,function(t){var n=t.context,r=n.canExecute,i=n.start,o=n.hover,a=n.source,s=n.target;t.originalEvent&&xt(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),r&&o&&qM(t,o,ZM(o)),o&&XM(r,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=rn(i),te(o,["bpmn:Event","bpmn:Gateway"])&&gx(t,rn(o)),te(o,["bpmn:Task","bpmn:SubProcess"])&&KM(t,o),h(a,"bpmn:BoundaryEvent")&&s===a.host&&YM(t)):_x(r,"bpmn:MessageFlow")?(h(i,"bpmn:Event")&&(n.connectionStart=rn(i)),h(o,"bpmn:Event")&&gx(t,rn(o))):n.connectionStart=n.initialConnectionStart)})}sl.$inject=["eventBus"];function qM(e,t,n){yx.forEach(function(r){var i=bx(r,t);e[r]<t[r]+n?ze(e,r,t[r]+n):e[r]>t[r]+i-n&&ze(e,r,t[r]+i-n)})}function KM(e,t){var n=rn(t);yx.forEach(function(r){QM(e,t,r)&&ze(e,r,n[r])})}function YM(e){var t=e.context,n=t.source,r=t.target;if(!JM(t)){var i=rn(n),o=He(i,r,-10),a=[];/top|bottom/.test(o)&&a.push("x"),/left|right/.test(o)&&a.push("y"),a.forEach(function(s){var c=e[s],u;UM(c-i[s])<gd&&(c>i[s]?u=i[s]+gd:u=i[s]-gd,ze(e,s,u))})}}function gx(e,t){ze(e,"x",t.x),ze(e,"y",t.y)}function _x(e,t){return e&&e.type===t}function XM(e,t){return Lt(t,function(n){return _x(e,n)})}function bx(e,t){return e==="x"?t.width:t.height}function ZM(e){return h(e,"bpmn:Task")?WM:VM}function QM(e,t,n){return e[n]>t[n]+vx&&e[n]<t[n]+bx(n,t)-vx}function JM(e){var t=e.hover,n=e.source;return t&&n&&t===n}N();function Kn(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}Kn.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]};Kn.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)};Kn.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)};Kn.prototype.getSnapLocations=function(){return this._snapLocations};Kn.prototype.setSnapLocations=function(e){this._snapLocations=e};Kn.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new cl,n.initDefaults(this._defaultSnaps)),n};function cl(){this._snapValues={}}cl.prototype.add=function(e,t){var n=this._snapValues[e];n||(n=this._snapValues[e]={x:[],y:[]}),n.x.indexOf(t.x)===-1&&n.x.push(t.x),n.y.indexOf(t.y)===-1&&n.y.push(t.y)};cl.prototype.snap=function(e,t,n,r){var i=this._snapValues[t];return i&&bg(e[n],i[n],r)};cl.prototype.initDefaults=function(e){var t=this;E(e||{},function(n,r){E(n,function(i){t.add(r,i)})})};N();var eD=1250;function bn(e,t,n){var r=this;this._elementRegistry=e,t.on(["create.start","shape.move.start"],function(i){r.initSnap(i)}),t.on(["create.move","create.end","shape.move.move","shape.move.end"],eD,function(i){var o=i.context,a=o.shape,s=o.snapContext,c=o.target;if(!(i.originalEvent&&xt(i.originalEvent))&&!(zn(i)||!c)){var u=s.pointsForTarget(c);u.initialized||(u=r.addSnapTargetPoints(u,a,c),u.initialized=!0),n.snap(i,u)}}),t.on(["create.cleanup","shape.move.cleanup"],function(){n.hide()})}bn.$inject=["elementRegistry","eventBus","snapping"];bn.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,r=n.shape,i=n.snapContext;i||(i=n.snapContext=new Kn);var o;t.get(r.id)?o=rn(r,e):o={x:e.x+rn(r).x,y:e.y+rn(r).y};var a={x:o.x-r.width/2,y:o.y-r.height/2},s={x:o.x+r.width/2,y:o.y+r.height/2};return i.setSnapOrigin("mid",{x:o.x-e.x,y:o.y-e.y}),ee(r)||(i.setSnapOrigin("top-left",{x:a.x-e.x,y:a.y-e.y}),i.setSnapOrigin("bottom-right",{x:s.x-e.x,y:s.y-e.y})),i};bn.prototype.addSnapTargetPoints=function(e,t,n){var r=this.getSnapTargets(t,n);return E(r,function(i){if(ee(i)){ee(t)&&e.add("mid",rn(i));return}if(de(i)){if(i.waypoints.length<3)return;var o=i.waypoints.slice(1,-1);E(o,function(a){e.add("mid",a)});return}e.add("mid",rn(i))}),!ne(t.x)||!ne(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",rn(t)),e};bn.prototype.getSnapTargets=function(e,t){return zu(t).filter(function(n){return!tD(n)})};function tD(e){return!!e.hidden}N();var xx=1500;function yi(e,t){t.invoke(bn,this),e.on(["create.move","create.end"],xx,oD),e.on(["create.move","create.end","shape.move.move","shape.move.end"],xx,function(n){var r=n.context,i=r.canExecute,o=r.target,a=i&&(i==="attach"||i.attach);a&&!zn(n)&&nD(n,o)})}B(yi,bn);yi.$inject=["eventBus","injector"];yi.prototype.initSnap=function(e){var t=bn.prototype.initSnap.call(this,e),n=e.shape,r=!!this._elementRegistry.get(n.id);return E(n.outgoing,function(i){var o=i.waypoints[0];o=o.original||o,t.setSnapOrigin(i.id+"-docking",wx(o,r,e))}),E(n.incoming,function(i){var o=i.waypoints[i.waypoints.length-1];o=o.original||o,t.setSnapOrigin(i.id+"-docking",wx(o,r,e))}),h(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t};yi.prototype.addSnapTargetPoints=function(e,t,n){bn.prototype.addSnapTargetPoints.call(this,e,t,n);var r=this.getSnapTargets(t,n);E(r,function(o){(iD(o)||rD([t,o],"bpmn:TextAnnotation"))&&(e.add("top-left",Hu(o)),e.add("bottom-right",$u(o)))});var i=this._elementRegistry;return E(t.incoming,function(o){if(i.get(t.id)){Ex(r,o.source)||e.add("mid",X(o.source));var a=o.waypoints[0];e.add(o.id+"-docking",a.original||a)}}),E(t.outgoing,function(o){if(i.get(t.id)){Ex(r,o.target)||e.add("mid",X(o.target));var a=o.waypoints[o.waypoints.length-1];e.add(o.id+"-docking",a.original||a)}}),h(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e};yi.prototype.getSnapTargets=function(e,t){return bn.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!h(n,"bpmn:Lane")})};function nD(e,t){var n=Z(t),r=hp(e,t),i=e.context,o=i.shape,a;o.parent?a={x:0,y:0}:a=X(o),/top/.test(r)?ze(e,"y",n.top-a.y):/bottom/.test(r)&&ze(e,"y",n.bottom-a.y),/left/.test(r)?ze(e,"x",n.left-a.x):/right/.test(r)&&ze(e,"x",n.right-a.x)}function rD(e,t){return e.every(function(n){return h(n,t)})}function iD(e){return h(e,"bpmn:SubProcess")&&ie(e)?!0:h(e,"bpmn:Participant")}function oD(e){var t=e.context,n=t.createConstraints;if(n){var r=n.top,i=n.right,o=n.bottom,a=n.left;(a&&a>=e.x||i&&i<=e.x)&&ze(e,"x",e.x),(r&&r>=e.y||o&&o<=e.y)&&ze(e,"y",e.y)}}function Ex(e,t){return e.indexOf(t)!==-1}function wx(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}N();var aD=1250;function ao(e,t){var n=this;e.on(["resize.start"],function(r){n.initSnap(r)}),e.on(["resize.move","resize.end"],aD,function(r){var i=r.context,o=i.shape,a=o.parent,s=i.direction,c=i.snapContext;if(!(r.originalEvent&&xt(r.originalEvent))&&!zn(r)){var u=c.pointsForTarget(a);u.initialized||(u=n.addSnapTargetPoints(u,o,a,s),u.initialized=!0),uD(s)&&ze(r,"x",r.x),pD(s)&&ze(r,"y",r.y),t.snap(r,u)}}),e.on(["resize.cleanup"],function(){t.hide()})}ao.prototype.initSnap=function(e){var t=e.context,n=t.shape,r=t.direction,i=t.snapContext;i||(i=t.snapContext=new Kn);var o=Sx(n,r);return i.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),i};ao.prototype.addSnapTargetPoints=function(e,t,n,r){var i=this.getSnapTargets(t,n);return E(i,function(o){e.add("corner",$u(o)),e.add("corner",Hu(o))}),e.add("corner",Sx(t,r)),e};ao.$inject=["eventBus","snapping"];ao.prototype.getSnapTargets=function(e,t){return zu(t).filter(function(n){return!sD(n,e)&&!de(n)&&!cD(n)&&!ee(n)})};function Sx(e,t){var n=X(e),r=Z(e),i={x:n.x,y:n.y};return t.indexOf("n")!==-1?i.y=r.top:t.indexOf("s")!==-1&&(i.y=r.bottom),t.indexOf("e")!==-1?i.x=r.right:t.indexOf("w")!==-1&&(i.x=r.left),i}function sD(e,t){return e.host===t}function cD(e){return!!e.hidden}function uD(e){return e==="n"||e==="s"}function pD(e){return e==="e"||e==="w"}N();var lD=7,fD=1e3;function gr(e){this._canvas=e,this._asyncHide=Ca(tt(this.hide,this),fD)}gr.$inject=["canvas"];gr.prototype.snap=function(e,t){var n=e.context,r=n.snapContext,i=r.getSnapLocations(),o={x:zn(e,"x"),y:zn(e,"y")};E(i,function(a){var s=r.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(E(["x","y"],function(u){var p;o[u]||(p=t.snap(c,a,u,lD),p!==void 0&&(o[u]={value:p,originValue:p-s[u]}))}),o.x&&o.y)return!1}),this.showSnapLine("vertical",o.x&&o.x.value),this.showSnapLine("horizontal",o.y&&o.y.value),E(["x","y"],function(a){var s=o[a];Se(s)&&ze(e,a,s.originValue)})};gr.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=U("path");return $(n,{d:"M0,0 L0,0"}),pe(n).add("djs-snap-line"),J(t,n),{update:function(r){ne(r)?e==="horizontal"?$(n,{d:"M-100000,"+r+" L+100000,"+r,display:""}):$(n,{d:"M "+r+",-100000 L "+r+", +100000",display:""}):$(n,{display:"none"})}}};gr.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}};gr.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()};gr.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]};gr.prototype.hide=function(){E(this._snapLines,function(e){e.update()})};var Cx={__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",bn],resizeSnapping:["type",ao],snapping:["type",gr]};var Rx={__depends__:[Cx],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",sl],createMoveSnapping:["type",yi]};var Ax=300;function fe(e,t,n,r){this._open=!1,this._results={},this._eventMaps=[],this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._canvas=e,this._eventBus=t,this._selection=n,this._translate=r,this._container=this._getBoxHtml(),this._searchInput=_e(fe.INPUT_SELECTOR,this._container),this._resultsContainer=_e(fe.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}fe.$inject=["canvas","eventBus","selection","translate"];fe.prototype._bindEvents=function(){var e=this;function t(n,r,i,o){e._eventMaps.push({el:n,type:i,listener:bt.bind(n,r,i,o)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,fe.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,fe.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,fe.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,fe.INPUT_SELECTOR,"keydown",function(n){Ke("ArrowUp",n)&&n.preventDefault(),Ke("ArrowDown",n)&&n.preventDefault()}),t(this._container,fe.INPUT_SELECTOR,"keyup",function(n){if(Ke("Escape",n))return e.close();if(Ke("Enter",n)){var r=e._getCurrentResult();return r?e._select(r):e.close(!1)}if(Ke("ArrowUp",n))return e._scrollToDirection(!0);if(Ke("ArrowDown",n))return e._scrollToDirection();Ke(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})};fe.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){bt.unbind(e.el,e.type,e.listener)})};fe.prototype._search=function(e){var t=this;if(this._clearResults(),!!e.trim()){var n=this._searchProvider.find(e);if(n=n.filter(function(i){return!t._canvas.getRootElements().includes(i.element)}),!n.length){this._selection.select(null);return}n.forEach(function(i){var o=i.element.id,a=t._createResultNode(i,o);t._results[o]={element:i.element,node:a}});var r=_e(fe.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(r),this._preselect(r)}};fe.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}};fe.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)}};fe.prototype._clearResults=function(){Hr(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")};fe.prototype._getCurrentResult=function(){return _e(fe.RESULT_SELECTED_SELECTOR,this._resultsContainer)};fe.prototype._createResultNode=function(e,t){var n=ue(fe.RESULT_HTML);return e.primaryTokens.length>0&&Px(n,e.primaryTokens,fe.RESULT_PRIMARY_HTML),Px(n,e.secondaryTokens,fe.RESULT_SECONDARY_HTML),nt(n,fe.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n};fe.prototype.registerProvider=function(e){this._searchProvider=e};fe.prototype.open=function(){if(!this._searchProvider)throw new Error("no search provider registered");this.isOpen()||(this._cachedRootElement=this._canvas.getRootElement(),this._cachedSelection=this._selection.get(),this._cachedViewbox=this._canvas.viewbox(),this._selection.select(null),this._bindEvents(),this._open=!0,Ne(this._canvas.getContainer()).add("djs-search-open"),Ne(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))};fe.prototype.close=function(e=!0){this.isOpen()&&(e&&(this._cachedRootElement&&this._canvas.setRootElement(this._cachedRootElement),this._cachedSelection&&this._selection.select(this._cachedSelection),this._cachedViewbox&&this._canvas.viewbox(this._cachedViewbox),this._eventBus.fire("searchPad.restored")),this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._unbindEvents(),this._open=!1,Ne(this._canvas.getContainer()).remove("djs-search-open"),Ne(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())};fe.prototype.toggle=function(){this.isOpen()?this.close():this.open()};fe.prototype.isOpen=function(){return this._open};fe.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&Ne(t).remove(fe.RESULT_SELECTED_CLASS);var n=nt(e,fe.RESULT_ID_ATTRIBUTE),r=this._results[n].element;Ne(e).add(fe.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(r,{top:Ax}),this._selection.select(r),this._eventBus.fire("searchPad.preselected",r)}};fe.prototype._select=function(e){var t=nt(e,fe.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:Ax}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)};fe.prototype._getBoxHtml=function(){let e=ue(fe.BOX_HTML),t=_e(fe.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function Px(e,t,n){var r=dD(t),i=ue(n);i.innerHTML=r,e.appendChild(i)}function dD(e){var t="";return e.forEach(function(n){var r=Hn(n.value||n.matched||n.normal),i=n.match||n.matched;i?t+='<b class="'+fe.RESULT_HIGHLIGHT_CLASS+'">'+r+"</b>":t+=r}),t!==""?t:null}fe.CONTAINER_SELECTOR=".djs-search-container";fe.INPUT_SELECTOR=".djs-search-input input";fe.RESULTS_CONTAINER_SELECTOR=".djs-search-results";fe.RESULT_SELECTOR=".djs-search-result";fe.RESULT_SELECTED_CLASS="djs-search-result-selected";fe.RESULT_SELECTED_SELECTOR="."+fe.RESULT_SELECTED_CLASS;fe.RESULT_ID_ATTRIBUTE="data-result-id";fe.RESULT_HIGHLIGHT_CLASS="djs-search-highlight";fe.BOX_HTML=`<div class="djs-search-container djs-scrollable">
/plugin/bpmnio/vendor/dmn-js/dist/
H A Ddmn-modeler.production.min.js24 </div>`;J.RESULT_HTML='<div class="djs-search-result"></div>';J.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>';J.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';var mE={__depends__:[qe,mo,ht],searchPad:["type",J]};function gE(n){if(O(n,"dmn:Decision")||O(n,"dmn:BusinessKnowledgeModel")||O(n,"dmn:InputData")||O(n,"dmn:KnowledgeSource"))return"name";if(O(n,"dmn:TextAnnotation"))return"text"}function fs(n){var e=n.businessObject,t=gE(e);if(t)return e[t]||""}function yE(n,e,t){var i=n.businessObject,r=gE(i);return r&&(i[r]=e),t&&(n.hidden=!e),n}function gf(n,e,t){this._elementRegistry=n,this._canvas=t,e.registerProvider(this)}gf.$inject=["elementRegistry","searchPad","canvas"];gf.prototype.find=function(n){let e=this._canvas.getRootElement(),t=this._elementRegistry.filter(function(i){return!i.labelTarget});return t=Ee(t,function(i){return i!==e}),t=Vt(t,function(i){return{primaryTokens:xE(fs(i),n),secondaryTokens:xE(i.id,n),element:i}}),t=Ee(t,function(i){return vE(i.primaryTokens)||vE(i.secondaryTokens)}),t=Fn(t,function(i){return fs(i.element)+i.element.id}),t};function vE(n){return Ee(n,function(t){return!!t.matched}).length>0}function xE(n,e){let t=[],i=n;if(!n)return t;n=n.toLowerCase(),e=e.toLowerCase();let r=n.indexOf(e);return r>-1?(r!==0&&t.push({normal:i.substr(0,r)}),t.push({matched:i.substr(r,e.length)}),e.length+r<n.length&&t.push({normal:i.substr(e.length+r,n.length)})):t.push({normal:i}),t}var bE={__depends__:[mE],__init__:["dmnSearch"],dmnSearch:["type",gf]};function br(n){Et.call(this,n)}fe(br,Et);br.prototype._navigationModules=[nE,iE,bE];br.prototype._modules=[].concat(br.prototype._modules,br.prototype._navigationModules);function tx(n){return n&&n[n.length-1]}function _E(n){return n.y}function wE(n){return n.x}var f$={left:wE,center:wE,right:function(n){return n.x+n.width},top:_E,middle:_E,bottom:function(n){return n.y+n.height}};function go(n,e){this._modeling=n,this._rules=e}go.$inject=["modeling","rules"];go.prototype._getOrientationDetails=function(n){var e=["top","bottom","middle"],t="x",i="width";return e.indexOf(n)!==-1&&(t="y",i="height"),{axis:t,dimension:i}};go.prototype._isType=function(n,e){return e.indexOf(n)!==-1};go.prototype._alignmentPosition=function(n,e){var t=this._getOrientationDetails(n),i=t.axis,r=t.dimension,o={},s={},a=!1,l,c,u;function f(h,d){return Math.round((h[i]+d[i]+d[r])/2)}if(this._isType(n,["left","top"]))o[n]=e[0][i];else if(this._isType(n,["right","bottom"]))u=tx(e),o[n]=u[i]+u[r];else if(this._isType(n,["center","middle"])){if(k(e,function(h){var d=h[i]+Math.round(h[r]/2);s[d]?s[d].elements.push(h):s[d]={elements:[h],center:d}}),l=Fn(s,function(h){return h.elements.length>1&&(a=!0),h.elements.length}),a)return o[n]=tx(l).center,o;c=e[0],e=Fn(e,function(h){return h[i]+h[r]}),u=tx(e),o[n]=f(c,u)}return o};go.prototype.trigger=function(n,e){var t=this._modeling,i,r=Ee(n,function(l){return!(l.waypoints||l.host||l.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:r}),F(i)&&(r=i),!(r.length<2||!i)){var o=f$[e],s=Fn(r,o),a=this._alignmentPosition(e,s);t.alignElements(s,a)}};var CE={__init__:["alignElements"],alignElements:["type",go]};var h$=10,ix=50,d$=250;function rx(n,e,t,i){for(var r;r=p$(n,t,e);)t=i(e,t,r);return t}function EE(n){return function(e,t,i){var r={x:t.x,y:t.y};return["x","y"].forEach(function(o){var s=n[o];if(s){var a=o==="x"?"width":"height",l=s.margin,c=s.minDistance;l<0?r[o]=Math.min(i[o]+l-e[a]/2,t[o]-c+l):r[o]=Math.max(i[o]+i[a]+l+e[a]/2,t[o]+c+l)}}),r}}function p$(n,e,t){var i={x:e.x-t.width/2,y:e.y-t.height/2,width:t.width,height:t.height},r=m$(n);return ye(r,function(o){if(o===t)return!1;var s=vt(o,i,h$);return s==="intersect"})}function SE(n,e){e||(e={});function t(p){return p.source===n?1:-1}var i=e.defaultDistance||ix,r=e.direction||"e",o=e.filter,s=e.getWeight||t,a=e.maxDistance||d$,l=e.reference||"start";o||(o=v$);function c(p,m){return r==="n"?l==="start"?G(p).top-G(m).bottom:l==="center"?G(p).top-le(m).y:G(p).top-G(m).top:r==="w"?l==="start"?G(p).left-G(m).right:l==="center"?G(p).left-le(m).x:G(p).left-G(m).left:r==="s"?l==="start"?G(m).top-G(p).bottom:l==="center"?le(m).y-G(p).bottom:G(m).bottom-G(p).bottom:l==="start"?G(m).left-G(p).right:l==="center"?le(m).x-G(p).right:G(m).right-G(p).right}var u=n.incoming.filter(o).map(function(p){var m=s(p),g=m<0?c(p.source,n):c(n,p.source);return{id:p.source.id,distance:g,weight:m}}),f=n.outgoing.filter(o).map(function(p){var m=s(p),g=m>0?c(n,p.target):c(p.target,n);return{id:p.target.id,distance:g,weight:m}}),h=u.concat(f).reduce(function(p,m){return p[m.id+"__weight_"+m.weight]=m,p},{}),d=st(h,function(p,m){var g=m.distance,b=m.weight;return g<0||g>a||(p[String(g)]||(p[String(g)]=0),p[String(g)]+=1*b,(!p.distance||p[p.distance]<p[String(g)])&&(p.distance=g)),p},{});return d.distance||i}function m$(n){var e=nx(n);return n.host&&(e=e.concat(nx(n.host))),n.attachers&&(e=e.concat(n.attachers.reduce(function(t,i){return t.concat(nx(i))},[]))),e}function nx(n){return y$(n).concat(g$(n))}function g$(n){return n.incoming.map(function(e){return e.source})}function y$(n){return n.outgoing.map(function(e){return e.target})}function v$(){return!0}var x$=100;function Mp(n,e,t){n.on("autoPlace",x$,function(i){var r=i.shape,o=i.source;return b$(o,r)}),n.on("autoPlace.end",function(i){t.scrollToElement(i.shape)}),this.append=function(i,r,o){n.fire("autoPlace.start",{source:i,shape:r});var s=n.fire("autoPlace",{source:i,shape:r}),a=e.appendShape(i,r,s,i.parent,o);return n.fire("autoPlace.end",{source:i,shape:a}),a}}Mp.$inject=["eventBus","modeling","canvas"];function b$(n,e,t){t||(t={});var i=t.defaultDistance||ix,r=le(n),o=G(n);return{x:o.right+i+e.width/2,y:r.y}}function Pp(n,e){n.on("autoPlace.end",500,function(t){e.select(t.shape)})}Pp.$inject=["eventBus","selection"];var OE={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",Mp],autoPlaceSelectionBehavior:["type",Pp]};var _$={width:135,height:46},ox={width:180,height:80},w$={width:125,height:45},C$={width:100,height:63};function _r(n){Hn.call(this),this._drdFactory=n}fe(_r,Hn);_r.$inject=["drdFactory"];_r.prototype.baseCreate=Hn.prototype.create;_r.prototype.create=function(n,e){return this.createDrdElement(n,e)};_r.prototype.createDrdElement=function(n,e){var t=this._drdFactory,i;e=e||{};var r=e.businessObject;if(!r){if(!e.type)throw new Error("no shape type specified");r=t.create(e.type)}return r.di||(n==="connection"?r.di=t.createDiEdge(r,[]):n==="shape"&&(r.di=t.createDiShape(r,{}))),i=this._getDefaultSize(r),e=T({businessObject:r,id:r.id},i,e),this.baseCreate(n,e)};_r.prototype._getDefaultSize=function(n){return O(n,"dmn:BusinessKnowledgeModel")?_$:O(n,"dmn:Decision")?ox:O(n,"dmn:InputData")?w$:O(n,"dmn:KnowledgeSource")?C$:{width:100,height:80}};var sx="left",kE="right",Dp=60,RE=ox.width;function AE(n,e){if(O(e,"dmn:TextAnnotation"))return E$(n,e);if(O(e,"dmn:DRGElement"))return S$(n,e)}function E$(n,e){var t=G(n),i={x:t.right+e.width/2,y:t.top-50-e.height/2},r={y:{margin:-30,minDistance:20}};return rx(n,e,i,EE(r))}function S$(n,e){var t=G(n),i=le(n);function r(a){return a.target===n?1:-1}var o=SE(n,{defaultDistance:180,direction:"s",getWeight:r,filter:O$,reference:"center"}),s={x:i.x,y:t.bottom+o};return rx(n,e,s,k$(n))}function O$(n){return!O(n,"dmn:Association")}function TE(n,e){return Math.abs(e.x-n.x)}function k$(n){var e=le(n),t,i;return function(r,o,s){var a;return t?(o.x<e.x?t=s:i=s,TE(e,le(t))<TE(e,le(i))?a=sx:a=kE):(t=s,i=s,le(s).x-e.x>0?a=sx:a=kE),a===sx?{x:Math.min(le(t).x-RE-Dp,G(t).left-Dp-r.width/2),y:o.y}:{x:Math.max(le(i).x+RE+Dp,G(i).right+Dp+r.width/2),y:o.y}}}function Ip(n){n.on("autoPlace",function(e){var t=e.shape,i=e.source;return AE(i,t)})}Ip.$inject=["eventBus"];var ME={__depends__:[OE],__init__:["dmnAutoPlace"],dmnAutoPlace:["type",Ip]};var PE=1500;function Lp(n,e,t){var i=this,r=t.get("dragging",!1);function o(s){if(!s.hover){var a=s.originalEvent,l=i._findTargetGfx(a),c=l&&n.get(l);l&&c&&(s.stopPropagation(),r.hover({element:c,gfx:l}),r.move(a))}}r&&e.on("drag.start",function(s){e.once("drag.move",PE,function(a){o(a)})}),(function(){var s,a;e.on("element.hover",function(l){s=l.gfx,a=l.element}),e.on("element.hover",PE,function(l){a&&e.fire("element.out",{element:a,gfx:s})}),e.on("element.out",function(){s=null,a=null})})(),this._findTargetGfx=function(s){var a,l;if(s instanceof MouseEvent)return a=Un(s),l=document.elementFromPoint(a.x,a.y),R$(l)}}Lp.$inject=["elementRegistry","eventBus","injector"];function R$(n){return De(n,"svg, .djs-element",!0)}var DE={__init__:["hoverFix"],hoverFix:["type",Lp]};var Oa=Math.round,IE="djs-drag-active";function hs(n){n.preventDefault()}function T$(n){return typeof TouchEvent!="undefined"&&n instanceof TouchEvent}function A$(n){return Math.sqrt(Math.pow(n.x,2)+Math.pow(n.y,2))}function Bp(n,e,t,i){var r={threshold:5,trapClick:!0},o;function s(v){var x=e.viewbox(),C=e._container.getBoundingClientRect();return{x:x.x+(v.x-C.left)/x.scale,y:x.y+(v.y-C.top)/x.scale}}function a(v,x){x=x||o;var C=n.createEvent(T({},x.payload,x.data,{isTouch:x.isTouch}));return n.fire("drag."+v,C)===!1?!1:n.fire(x.prefix+"."+v,C)}function l(v){var x=v.filter(function(C){return i.get(C.id)});x.length&&t.select(x)}function c(v,x){var C=o.payload,E=o.displacement,S=o.globalStart,w=Un(v),R=xr(w,S),A=o.localStart,I=s(w),D=xr(I,A);if(!o.active&&(x||A$(R)>o.threshold)){if(T(C,{x:Oa(A.x+E.x),y:Oa(A.y+E.y),dx:0,dy:0},{originalEvent:v}),a("start")===!1)return g();o.active=!0,o.keepSelection||(C.previousSelection=t.get(),t.select(null)),o.cursor&&mf(o.cursor),e.addMarker(e.getRootElement(),IE)}vp(v),o.active&&(T(C,{x:Oa(I.x+E.x),y:Oa(I.y+E.y),dx:Oa(D.x),dy:Oa(D.y)},{originalEvent:v}),a("move"))}function u(v){var x,C=!0;o.active&&(v&&(o.payload.originalEvent=v,vp(v)),C=a("end")),C===!1&&a("rejected"),x=b(C!==!0),a("ended",x)}function f(v){Ve("Escape",v)&&(hs(v),g())}function h(v){var x;o.active&&(x=Op(n),setTimeout(x,400),hs(v)),u(v)}function d(v){c(v)}function p(v){var x=o.payload;x.hoverGfx=v.gfx,x.hover=v.element,a("hover")}function m(v){a("out");var x=o.payload;x.hoverGfx=null,x.hover=null}function g(v){var x;if(o){var C=o.active;C&&a("cancel"),x=b(v),C&&a("canceled",x)}}function b(v){var x,C;a("cleanup"),Sp(),o.trapClick?C=h:C=u,q.unbind(document,"mousemove",c),q.unbind(document,"dragstart",hs),q.unbind(document,"selectstart",hs),q.unbind(document,"mousedown",C,!0),q.unbind(document,"mouseup",C,!0),q.unbind(document,"keyup",f),q.unbind(document,"touchstart",d,!0),q.unbind(document,"touchcancel",g,!0),q.unbind(document,"touchmove",c,!0),q.unbind(document,"touchend",u,!0),n.off("element.hover",p),n.off("element.out",m),e.removeMarker(e.getRootElement(),IE);var E=o.payload.previousSelection;return v!==!1&&E&&!t.get().length&&l(E),x=o,o=null,x}function _(v,x,C,E){o&&g(!1),typeof x=="string"&&(E=C,C=x,x=null),E=T({},r,E||{});var S=E.data||{},w,R,A,I,D;if(E.trapClick?I=h:I=u,v?(w=vr(v)||v,R=Un(v),vp(v),w.type==="dragstart"&&hs(w)):(w=null,R={x:0,y:0}),A=s(R),x||(x=A),D=T$(w),o=T({prefix:C,data:S,payload:{},globalStart:R,displacement:xr(x,A),localStart:A,isTouch:D},E),E.manual||(D?(q.bind(document,"touchstart",d,!0),q.bind(document,"touchcancel",g,!0),q.bind(document,"touchmove",c,!0),q.bind(document,"touchend",u,!0)):(q.bind(document,"mousemove",c),q.bind(document,"dragstart",hs),q.bind(document,"selectstart",hs),q.bind(document,"mousedown",I,!0),q.bind(document,"mouseup",I,!0)),q.bind(document,"keyup",f),n.on("element.hover",p),n.on("element.out",m)),a("init")===!1)return g(),!1;E.autoActivate&&c(v,!0)}n.on("diagram.destroy",g),this.init=_,this.move=c,this.hover=p,this.out=m,this.end=u,this.cancel=g,this.context=function(){return o},this.setOptions=function(v){T(r,v)}}Bp.$inject=["eventBus","canvas","selection","elementRegistry"];var gn={__depends__:[DE,ht],dragging:["type",Bp]};function yo(n,e,t){this._canvas=t,this._opts=T({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},n);var i=this;e.on("drag.move",function(r){var o=i._toBorderPoint(r);i.startScroll(o)}),e.on(["drag.cleanup"],function(){i.stopScroll()})}yo.$inject=["config.autoScroll","eventBus","canvas"];yo.prototype.startScroll=function(n){var e=this._canvas,t=this._opts,i=this,r=e.getContainer().getBoundingClientRect(),o=[n.x,n.y,r.width-n.x,r.height-n.y];this.stopScroll();for(var s=0,a=0,l=0;l<4;l++)M$(o[l],t.scrollThresholdOut[l],t.scrollThresholdIn[l])&&(l===0?s=t.scrollStep:l==1?a=t.scrollStep:l==2?s=-t.scrollStep:l==3&&(a=-t.scrollStep));(s!==0||a!==0)&&(e.scroll({dx:s,dy:a}),this._scrolling=setTimeout(function(){i.startScroll(n)},t.scrollRepeatTimeout))};function M$(n,e,t){return e<n&&n<t}yo.prototype.stopScroll=function(){clearTimeout(this._scrolling)};yo.prototype.setOptions=function(n){this._opts=T({},this._opts,n)};yo.prototype._toBorderPoint=function(n){var e=this._canvas._container.getBoundingClientRect(),t=Un(n.originalEvent);return{x:t.x-e.left,y:t.y-e.top}};var LE={__depends__:[gn],__init__:["autoScroll"],autoScroll:["type",yo]};function yf(n){this._commandStack=n.get("commandStack",!1)}yf.$inject=["injector"];yf.prototype.allowed=function(n,e){var t=!0,i=this._commandStack;return i&&(t=i.canExecute(n,e)),t===void 0?!0:t};var yn={__init__:["rules"],rules:["type",yf]};var Np=Math.round,P$=Math.max;function D$(n,e){var t=n.x,i=n.y;return[["M",t,i],["m",0,-e],["a",e,e,0,1,1,0,2*e],["a",e,e,0,1,1,0,-2*e],["z"]]}function I$(n){var e=[];return n.forEach(function(t,i){e.push([i===0?"M":"L",t.x,t.y])}),e}var BE=10;function L$(n,e){var t,i;for(t=0;i=n[t];t++)if(pa(i,e)<=BE)return{point:n[t],bendpoint:!0,index:t};return null}function B$(n,e){var t=ef(D$(e,BE),I$(n)),i=t[0],r=t[t.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=P$(i.segment2,r.segment2)-1,{point:n[o],bendpoint:!0,index:o}):{point:{x:Np(i.x+r.x)/2,y:Np(i.y+r.y)/2},index:i.segment2}:{point:{x:Np(i.x),y:Np(i.y)},index:i.segment2}:null}function NE(n,e){return L$(n,e)||B$(n,e)}function N$(n){return Math.sqrt(Math.pow(n.x,2)+Math.pow(n.y,2))}function $$(n,e,t){var i=[{n:n[0]-t[0],lambda:e[0]},{n:n[1]-t[1],lambda:e[1]}],r=i[0].n*e[0]+i[1].n*e[1],o=i[0].lambda*e[0]+i[1].lambda*e[1];return-r/o}function ax(n,e){var t=e[0],i=e[1],r={x:i.x-t.x,y:i.y-t.y},o=$$([t.x,t.y],[r.x,r.y],[n.x,n.y]);return{x:t.x+o*r.x,y:t.y+o*r.y}}function $E(n,e){var t=ax(n,e),i={x:t.x-n.x,y:t.y-n.y};return N$(i)}var lx="djs-bendpoint",cx="djs-segment-dragger";function j$(n,e){var t=Un(e),i=n._container.getBoundingClientRect(),r;r={x:i.left,y:i.top};var o=n.viewbox();return{x:o.x+(t.x-r.x)/o.scale,y:o.y+(t.y-r.y)/o.scale}}function vf(n,e,t){var i=j$(n,t),r=NE(e,i);return r}function xf(n,e){var t=Q("g");ne(t).add(lx),K(n,t);var i=Q("circle");j(i,{cx:0,cy:0,r:4}),ne(i).add("djs-visual"),K(t,i);var r=Q("circle");return j(r,{cx:0,cy:0,r:10}),ne(r).add("djs-hit"),K(t,r),e&&ne(t).add(e),t}function F$(n,e,t,i){var r=Q("g");K(n,r);var o=18,s=6,a=11,l=q$(e,t,i),c=s+a,u=Q("rect");j(u,{x:-o/2,y:-s/2,width:o,height:s}),ne(u).add("djs-visual"),K(r,u);var f=Q("rect");return j(f,{x:-l/2,y:-c/2,width:l,height:c}),ne(f).add("djs-hit"),K(r,f),rC(r,i==="v"?90:0,0,0),r}function jp(n,e,t){var i=Q("g"),r=Ju(e,t),o=pr(e,t);return K(n,i),F$(i,e,t,o),ne(i).add(cx),ne(i).add(o==="h"?"horizontal":"vertical"),jt(i,r.x,r.y),i}function $p(n){return Math.abs(Math.round(n*2/3))}function jE(n,e){var t=V$(n,e);return ax(n,t)}function q$(n,e,t){var i=e.x-n.x,r=e.y-n.y;return $p(t==="h"?i:r)}function V$(n,e){for(var t=e.waypoints,i=1/0,r,o=0;o<t.length-1;o++){var s=t[o],a=t[o+1],l=$E(n,[s,a]);l<i&&(i=l,r=o)}return[t[r],t[r+1]]}function Fp(n,e,t,i,r){function o(v,x,C){var E=v.index,S=v.point,w,R,A,I,D,N;return E<=0||v.bendpoint?!1:(w=x[E-1],R=x[E],A=Ju(w,R),I=pr(w,R),D=Math.abs(S.x-A.x),N=Math.abs(S.y-A.y),I&&D<=C&&N<=C)}function s(v,x){var C=v.waypoints,E,S,w,R;return x.index<=0||x.bendpoint||(E={start:C[x.index-1],end:C[x.index]},S=pr(E.start,E.end),!S)?null:(S==="h"?w=E.end.x-E.start.x:w=E.end.y-E.start.y,R=$p(w)/2,R)}function a(v,x){var C=x.waypoints,E=vf(e,C,v),S;if(E){S=s(x,E);var w;if(o(E,C,S)?w=r.start(v,x,E.index):w=i.start(v,x,E.index,!E.bendpoint),w!==!1)return!0}}function l(v,x,C){q.bind(v,x,function(E){t.triggerMouseEvent(x,E,C),E.stopPropagation()})}function c(v,x){var C=e.getLayer("overlays"),E=X('.djs-bendpoints[data-element-id="'+Sa(v.id)+'"]',C);return!E&&x&&(E=Q("g"),j(E,{"data-element-id":v.id}),ne(E).add("djs-bendpoints"),K(C,E),l(E,"mousedown",v),l(E,"click",v),l(E,"dblclick",v)),E}function u(v,x){return X('.djs-segment-dragger[data-segment-idx="'+v+'"]',x)}function f(v,x){x.waypoints.forEach(function(C,E){var S=xf(v);K(v,S),jt(S,C.x,C.y)}),xf(v,"floating")}function h(v,x){for(var C=x.waypoints,E,S,w,R=1;R<C.length;R++)E=C[R-1],S=C[R],pr(E,S)&&(w=jp(v,E,S),j(w,{"data-segment-idx":R}),l(w,"mousemove",x))}function d(v){k(pn("."+lx,v),function(x){Fe(x)})}function p(v){k(pn("."+cx,v),function(x){Fe(x)})}function m(v){var x=c(v);return x||(x=c(v,!0),f(x,v),h(x,v)),x}function g(v){var x=c(v);x&&(p(x),d(x),h(x,v),f(x,v))}function b(v,x){var C=X(".floating",v),E=x.point;C&&jt(C,E.x,E.y)}function _(v,x,C){var E=u(x.index,v),S=C[x.index-1],w=C[x.index],R=x.point,A=Ju(S,w),I=pr(S,w),D,N;E&&(D=H$(E),N={x:R.x-A.x,y:R.y-A.y},I==="v"&&(N={x:N.y,y:N.x}),jt(D,N.x,N.y))}n.on("connection.changed",function(v){g(v.element)}),n.on("connection.remove",function(v){var x=c(v.element);x&&Fe(x)}),n.on("element.marker.update",function(v){var x=v.element,C;x.waypoints&&(C=m(x),v.add?ne(C).add(v.marker):ne(C).remove(v.marker))}),n.on("element.mousemove",function(v){var x=v.element,C=x.waypoints,E,S;if(C){if(E=c(x,!0),S=vf(e,C,v.originalEvent),!S)return;b(E,S),S.bendpoint||_(E,S,C)}}),n.on("element.mousedown",function(v){if(Sn(v)){var x=v.originalEvent,C=v.element;if(C.waypoints)return a(x,C)}}),n.on("selection.changed",function(v){var x=v.newSelection,C=x[0];C&&C.waypoints&&m(C)}),n.on("element.hover",function(v){var x=v.element;x.waypoints&&m(x)}),n.on("element.updateId",function(v){var x=v.element,C=v.newId;if(x.waypoints){var E=c(x);E&&j(E,{"data-element-id":C})}}),this.addHandles=m,this.updateHandles=g,this.getBendpointsContainer=c,this.getSegmentDragger=u}Fp.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function H$(n){return X(".djs-visual",n)}var FE=Math.round,ds="reconnectStart",ps="reconnectEnd",bf="updateWaypoints";function wf(n,e,t,i,r,o){this._injector=n,this.start=function(s,a,l,c){var u=t.getGraphics(a),f=a.source,h=a.target,d=a.waypoints,p;!c&&l===0?p=ds:!c&&l===d.length-1?p=ps:p=bf;var m=p===bf?"connection.updateWaypoints":"connection.reconnect",g=r.allowed(m,{connection:a,source:f,target:h});if(g===!1&&(g=r.allowed(m,{connection:a,source:h,target:f})),g!==!1)return i.init(s,"bendpoint.move",{data:{connection:a,connectionGfx:u,context:{allowed:g,bendpointIndex:l,connection:a,source:f,target:h,insert:c,type:p}}})},e.on("bendpoint.move.hover",function(s){var a=s.context,l=a.connection,c=l.source,u=l.target,f=s.hover,h=a.type;a.hover=f;var d;if(f){var p=h===bf?"connection.updateWaypoints":"connection.reconnect";if(d=a.allowed=r.allowed(p,{connection:l,source:h===ds?f:c,target:h===ps?f:u}),d){a.source=h===ds?f:c,a.target=h===ps?f:u;return}d===!1&&(d=a.allowed=r.allowed(p,{connection:l,source:h===ps?f:u,target:h===ds?f:c})),d&&(a.source=h===ps?f:u,a.target=h===ds?f:c)}}),e.on(["bendpoint.move.out","bendpoint.move.cleanup"],function(s){var a=s.context,l=a.type;a.hover=null,a.source=null,a.target=null,l!==bf&&(a.allowed=!1)}),e.on("bendpoint.move.end",function(s){var a=s.context,l=a.allowed,c=a.bendpointIndex,u=a.connection,f=a.insert,h=u.waypoints.slice(),d=a.source,p=a.target,m=a.type,g=a.hints||{},b={x:FE(s.x),y:FE(s.y)};if(!l)return!1;m===bf?(f?h.splice(c,0,b):h[c]=b,g.bendpointMove={insert:f,bendpointIndex:c},h=this.cropWaypoints(u,h),o.updateWaypoints(u,q1(h),g)):(m===ds?(g.docking="source",_f(a)&&(g.docking="target",g.newWaypoints=h.reverse())):m===ps&&(g.docking="target",_f(a)&&(g.docking="source",g.newWaypoints=h.reverse())),o.reconnect(u,d,p,b,g))},this)}wf.$inject=["injector","eventBus","canvas","dragging","rules","modeling"];wf.prototype.cropWaypoints=function(n,e){var t=this._injector.get("connectionDocking",!1);if(!t)return e;var i=n.waypoints;return n.waypoints=e,n.waypoints=t.getCroppedWaypoints(n),e=n.waypoints,n.waypoints=i,e};function _f(n){var e=n.hover,t=n.source,i=n.target,r=n.type;if(r===ds)return e&&i&&e===i&&t!==i;if(r===ps)return e&&t&&e===t&&t!==i}var z$="reconnectStart",W$="reconnectEnd",qE="updateWaypoints",Cf="connect-ok",qp="connect-not-ok",VE="connect-hover",HE="djs-updating",zE="djs-dragging",WE=1100;function Vp(n,e,t,i){this._injector=e;var r=e.get("connectionPreview",!1);t.on("bendpoint.move.start",function(o){var s=o.context,a=s.bendpointIndex,l=s.connection,c=s.insert,u=l.waypoints,f=u.slice();s.waypoints=u,c&&f.splice(a,0,{x:o.x,y:o.y}),l.waypoints=f;var h=s.draggerGfx=xf(i.getLayer("overlays"));ne(h).add("djs-dragging"),i.addMarker(l,zE),i.addMarker(l,HE)}),t.on("bendpoint.move.hover",function(o){var s=o.context,a=s.allowed,l=s.hover,c=s.type;if(l){if(i.addMarker(l,VE),c===qE)return;a?(i.removeMarker(l,qp),i.addMarker(l,Cf)):a===!1&&(i.removeMarker(l,Cf),i.addMarker(l,qp))}}),t.on(["bendpoint.move.out","bendpoint.move.cleanup"],WE,function(o){var s=o.context,a=s.hover,l=s.target;a&&(i.removeMarker(a,VE),i.removeMarker(a,l?Cf:qp))}),t.on("bendpoint.move.move",function(o){var s=o.context,a=s.allowed,l=s.bendpointIndex,c=s.draggerGfx,u=s.hover,f=s.type,h=s.connection,d=h.source,p=h.target,m=h.waypoints.slice(),g={x:o.x,y:o.y},b=s.hints||{},_={};r&&(b.connectionStart&&(_.connectionStart=b.connectionStart),b.connectionEnd&&(_.connectionEnd=b.connectionEnd),f===z$?_f(s)?(_.connectionEnd=_.connectionEnd||g,_.source=p,_.target=u||d,m=m.reverse()):(_.connectionStart=_.connectionStart||g,_.source=u||d,_.target=p):f===W$?_f(s)?(_.connectionStart=_.connectionStart||g,_.source=u||p,_.target=d,m=m.reverse()):(_.connectionEnd=_.connectionEnd||g,_.source=d,_.target=u||p):(_.noCropping=!0,_.noLayout=!0,m[l]=g),f===qE&&(m=n.cropWaypoints(h,m)),_.waypoints=m,r.drawPreview(s,a,_)),jt(c,o.x,o.y)},this),t.on(["bendpoint.move.end","bendpoint.move.cancel"],WE,function(o){var s=o.context,a=s.connection,l=s.draggerGfx,c=s.hover,u=s.target,f=s.waypoints;a.waypoints=f,Fe(l),i.removeMarker(a,HE),i.removeMarker(a,zE),c&&(i.removeMarker(c,Cf),i.removeMarker(c,u?Cf:qp)),r&&r.cleanUp(s)})}Vp.$inject=["bendpointMove","injector","eventBus","canvas"];var UE="connect-hover",QE="djs-updating";function KE(n,e,t){return ux(n,e,n[e]+t)}function ux(n,e,t){return{x:e==="x"?t:n.x,y:e==="y"?t:n.y}}function U$(n,e,t,i){var r=Math.max(e[i],t[i]),o=Math.min(e[i],t[i]),s=20,a=Math.min(Math.max(o+s,n[i]),r-s);return ux(e,i,a)}function XE(n){return n==="x"?"y":"x"}function GE(n,e,t){var i,r;return n.original?n.original:(i=le(e),r=XE(t),ux(n,r,i[r]))}function Hp(n,e,t,i,r,o){var s=n.get("connectionDocking",!1);this.start=function(f,h,d){var p,m=t.getGraphics(h),g=d-1,b=d,_=h.waypoints,v=_[g],x=_[b],C=vf(t,_,f),E,S,w;if(E=pr(v,x),!!E)return S=E==="v"?"x":"y",g===0&&(v=GE(v,h.source,S)),b===_.length-1&&(x=GE(x,h.target,S)),C?w=C.point:w={x:(v.x+x.x)/2,y:(v.y+x.y)/2},p={connection:h,segmentStartIndex:g,segmentEndIndex:b,segmentStart:v,segmentEnd:x,axis:S,dragPosition:w},i.init(f,w,"connectionSegment.move",{cursor:S==="x"?"resize-ew":"resize-ns",data:{connection:h,connectionGfx:m,context:p}})};function a(f,h){if(!s)return h;var d=f.waypoints,p;return f.waypoints=h,p=s.getCroppedWaypoints(f),f.waypoints=d,p}function l(f){r.update("connection",f.connection,f.connectionGfx)}function c(f,h,d){var p=f.newWaypoints,m=f.segmentStartIndex+h,g=p[m],b=f.segmentEndIndex+h,_=p[b],v=XE(f.axis),x=U$(d,g,_,v);jt(f.draggerGfx,x.x,x.y)}function u(f,h){var d=0,p=f.filter(function(m,g){return sp(f[g-1],f[g+1],m)?(d=g<=h?d-1:d,!1):!0});return{waypoints:p,segmentOffset:d}}e.on("connectionSegment.move.start",function(f){var h=f.context,d=f.connection,p=t.getLayer("overlays");h.originalWaypoints=d.waypoints.slice(),h.draggerGfx=jp(p,h.segmentStart,h.segmentEnd),ne(h.draggerGfx).add("djs-dragging"),t.addMarker(d,QE)}),e.on("connectionSegment.move.move",function(f){var h=f.context,d=h.connection,p=h.segmentStartIndex,m=h.segmentEndIndex,g=h.segmentStart,b=h.segmentEnd,_=h.axis,v=h.originalWaypoints.slice(),x=KE(g,_,f["d"+_]),C=KE(b,_,f["d"+_]),E=v.length,S=0;v[p]=x,v[m]=C;var w,R;p<2&&(w=vt(d.source,x),p===1?w==="intersect"&&(v.shift(),v[0]=x,S--):w!=="intersect"&&(v.unshift(g),S++)),m>E-3&&(R=vt(d.target,C),m===E-2?R==="intersect"&&(v.pop(),v[v.length-1]=C):R!=="intersect"&&v.push(b)),h.newWaypoints=d.waypoints=a(d,v),c(h,S,f),h.newSegmentStartIndex=p+S,l(f)}),e.on("connectionSegment.move.hover",function(f){f.context.hover=f.hover,t.addMarker(f.hover,UE)}),e.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(f){var h=f.context.hover;h&&t.removeMarker(h,UE)}),e.on("connectionSegment.move.cleanup",function(f){var h=f.context,d=h.connection;h.draggerGfx&&Fe(h.draggerGfx),t.removeMarker(d,QE)}),e.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(f){var h=f.context,d=h.connection;d.waypoints=h.originalWaypoints,l(f)}),e.on("connectionSegment.move.end",function(f){var h=f.context,d=h.connection,p=h.newWaypoints,m=h.newSegmentStartIndex;p=p.map(function(C){return{original:C.original,x:Math.round(C.x),y:Math.round(C.y)}});var g=u(p,m),b=g.waypoints,_=a(d,b),v=g.segmentOffset,x={segmentMove:{segmentStartIndex:h.segmentStartIndex,newSegmentStartIndex:m+v}};o.updateWaypoints(d,_,x)})}Hp.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var Q$=Math.abs,YE=Math.round;function ZE(n,e,t){t=t===void 0?10:t;var i,r;for(i=0;i<e.length;i++)if(r=e[i],Q$(r-n)<=t)return r}function JE(n){return{x:n.x,y:n.y}}function eS(n){return{x:n.x+n.width,y:n.y+n.height}}function ms(n,e){return!n||isNaN(n.x)||isNaN(n.y)?e:{x:YE(n.x+n.width/2),y:YE(n.y+n.height/2)}}function wr(n,e){var t=n.snapped;return t?typeof e=="string"?t[e]:t.x&&t.y:!1}function vn(n,e,t){if(typeof e!="string")throw new Error("axis must be in [x, y]");if(typeof t!="number"&&t!==!1)throw new Error("value must be Number or false");var i,r=n[e],o=n.snapped=n.snapped||{};return t===!1?o[e]=!1:(o[e]=!0,i=t-r,n[e]+=i,n["d"+e]+=i),r}function zp(n){return n.children||[]}var K$=Math.abs,tS=Math.round,fx=10;function Wp(n){function e(o,s){if(F(o)){for(var a=o.length;a--;)if(K$(o[a]-s)<=fx)return o[a]}else{o=+o;var l=s%o;if(l<fx)return s-l;if(l>o-fx)return s-l+o}return s}function t(o,s){if(o.waypoints)return jE(s,o);if(o.width)return{x:tS(o.width/2+o.x),y:tS(o.height/2+o.y)}}function i(o){var s=o.context,a=s.snapPoints,l=s.connection,c=l.waypoints,u=s.segmentStart,f=s.segmentStartIndex,h=s.segmentEnd,d=s.segmentEndIndex,p=s.axis;if(a)return a;var m=[c[f-1],u,h,c[d+1]];return f<2&&m.unshift(t(l.source,o)),d>c.length-3&&m.unshift(t(l.target,o)),s.snapPoints=a={horizontal:[],vertical:[]},k(m,function(g){g&&(g=g.original||g,p==="y"&&a.horizontal.push(g.y),p==="x"&&a.vertical.push(g.x))}),a}n.on("connectionSegment.move.move",1500,function(o){var s=i(o),a=o.x,l=o.y,c,u;if(s){c=e(s.vertical,a),u=e(s.horizontal,l);var f=a-c,h=l-u;T(o,{dx:o.dx-f,dy:o.dy-h,x:c,y:u}),(f||s.vertical.indexOf(a)!==-1)&&vn(o,"x",c),(h||s.horizontal.indexOf(l)!==-1)&&vn(o,"y",u)}});function r(o){var s=o.snapPoints,a=o.connection.waypoints,l=o.bendpointIndex;if(s)return s;var c=[a[l-1],a[l+1]];return o.snapPoints=s={horizontal:[],vertical:[]},k(c,function(u){u&&(u=u.original||u,s.horizontal.push(u.y),s.vertical.push(u.x))}),s}n.on(["connect.hover","connect.move","connect.end"],1500,function(o){var s=o.context,a=s.hover,l=a&&t(a,o);!Xe(a)||!l||!l.x||!l.y||(vn(o,"x",l.x),vn(o,"y",l.y))}),n.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(o){var s=o.context,a=r(s),l=s.hover,c=l&&t(l,o),u=o.x,f=o.y,h,d;if(a){h=e(c?a.vertical.concat([c.x]):a.vertical,u),d=e(c?a.horizontal.concat([c.y]):a.horizontal,f);var p=u-h,m=f-d;T(o,{dx:o.dx-p,dy:o.dy-m,x:o.x-p,y:o.y-m}),(p||a.vertical.indexOf(u)!==-1)&&vn(o,"x",h),(m||a.horizontal.indexOf(f)!==-1)&&vn(o,"y",d)}})}Wp.$inject=["eventBus"];var nS={__depends__:[gn,yn],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",Fp],bendpointMove:["type",wf],bendpointMovePreview:["type",Vp],connectionSegmentMove:["type",Hp],bendpointSnapping:["type",Wp]};var G$=new po;function vo(n){this._scheduled={},n.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(e=>{this.cancel(e)})})}vo.$inject=["eventBus"];vo.prototype.schedule=function(n,e=G$.next()){this.cancel(e);let t=this._schedule(n,e);return this._scheduled[e]=t,t.promise};vo.prototype._schedule=function(n,e){let t=X$();return{executionId:setTimeout(()=>{try{this._scheduled[e]=null;try{t.resolve(n())}catch(r){t.reject(r)}}catch(r){console.error("Scheduler#_schedule execution failed",r)}}),promise:t.promise}};vo.prototype.cancel=function(n){let e=this._scheduled[n];e&&(this._cancel(e),this._scheduled[n]=null)};vo.prototype._cancel=function(n){clearTimeout(n.executionId)};function X$(){let n={};return n.promise=new Promise((e,t)=>{n.resolve=e,n.reject=t}),n}var iS={scheduler:["type",vo]};var Y$="djs-element-hidden",Up=".entry",Z$=1e3,rS=8,J$=300;function tt(n,e,t,i){this._canvas=n,this._elementRegistry=e,this._eventBus=t,this._scheduler=i,this._current=null,this._init()}tt.$inject=["canvas","elementRegistry","eventBus","scheduler"];tt.prototype._init=function(){var n=this;this._eventBus.on("selection.changed",function(e){var t=e.newSelection,i=t.length?t.length===1?t[0]:t:null;i?n.open(i,!0):n.close()}),this._eventBus.on("elements.changed",function(e){var t=e.elements,i=n._current;if(i){var r=i.target,o=F(r)?r:[r],s=o.filter(function(l){return t.includes(l)});if(s.length){n.close();var a=o.filter(function(l){return n._elementRegistry.get(l.id)});a.length&&n._updateAndOpen(a.length>1?a:a[0])}}}),this._eventBus.on("canvas.viewbox.changed",function(){n._updatePosition()}),this._eventBus.on("element.marker.update",function(e){if(n.isOpen()){var t=e.element,i=n._current,r=F(i.target)?i.target:[i.target];r.includes(t)&&n._updateVisibility()}}),this._container=this._createContainer()};tt.prototype._createContainer=function(){var n=te('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(n),n};tt.prototype.registerProvider=function(n,e){e||(e=n,n=Z$),this._eventBus.on("contextPad.getProviders",n,function(t){t.providers.push(e)})};tt.prototype.getEntries=function(n){var e=this._getProviders(),t=F(n)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return k(e,function(r){if(ge(r[t])){var o=r[t](n);ge(o)?i=o(i):k(o,function(s,a){i[a]=s})}}),i};tt.prototype.trigger=function(n,e,t){var i=this,r,o,s=e.delegateTarget||e.target;if(!s)return e.preventDefault();if(r=et(s,"data-action"),o=e.originalEvent||e,n==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(r,"hover",o,t)},J$);return}else if(n==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(r,n,o,t)};tt.prototype.triggerEntry=function(n,e,t,i){if(this.isShown()){var r=this._current.target,o=this._current.entries,s=o[n];if(s){var a=s.action;if(this._eventBus.fire("contextPad.trigger",{entry:s,event:t})!==!1){if(ge(a)){if(e==="click")return a(t,r,i)}else if(a[e])return a[e](t,r,i);t.preventDefault()}}}};tt.prototype.open=function(n,e){if(!(!e&&this.isOpen(n))){var t=this._eventBus.fire("contextPad.open.allowed",{target:n});t!==!1&&(this.close(),this._updateAndOpen(n))}};tt.prototype._getProviders=function(){var n=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(n),n.providers};tt.prototype._updateAndOpen=function(n){var e=this.getEntries(n),t=this._createHtml(n),i;k(e,function(r,o){var s=r.group||"default",a=te(r.html||'<div class="entry" draggable="true"></div>'),l;et(a,"data-action",o),l=X("[data-group="+Sa(s)+"]",t),l||(l=te('<div class="group"></div>'),et(l,"data-group",s),t.appendChild(l)),l.appendChild(a),r.className&&ej(a,r.className),r.title&&et(a,"title",r.title),r.imageUrl&&(i=te("<img>"),et(i,"src",r.imageUrl),i.style.width="100%",i.style.height="100%",a.appendChild(i))}),ee(t).add("open"),this._current={entries:e,html:t,target:n},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})};tt.prototype._createHtml=function(n){var e=this,t=te('<div class="djs-context-pad"></div>');return _t.bind(t,Up,"click",function(i){e.trigger("click",i)}),_t.bind(t,Up,"dragstart",function(i){e.trigger("dragstart",i)}),_t.bind(t,Up,"mouseover",function(i){e.trigger("mouseover",i)}),_t.bind(t,Up,"mouseout",function(i){e.trigger("mouseout",i)}),q.bind(t,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(t),this._eventBus.fire("contextPad.create",{target:n,pad:t}),t};tt.prototype.getPad=function(n){console.warn(new Error("ContextPad#getPad is deprecated and will be removed in future library versions, cf. https://github.com/bpmn-io/diagram-js/pull/888"));let e;return this.isOpen()&&nj(this._current.target,n)?e=this._current.html:e=this._createHtml(n),{html:e}};tt.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)};tt.prototype.isOpen=function(n){var e=this._current;if(!e)return!1;if(!n)return!0;var t=e.target;return F(n)!==F(t)?!1:F(n)?n.length===t.length&&kt(n,function(i){return t.includes(i)}):t===n};tt.prototype.isShown=function(){return this.isOpen()&&ee(this._current.html).has("open")};tt.prototype.show=function(){this.isOpen()&&(ee(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))};tt.prototype.hide=function(){this.isOpen()&&(ee(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))};tt.prototype._getPosition=function(n){if(!F(n)&&Xe(n)){var e=this._canvas.viewbox(),t=tj(n),i=t.x*e.scale-e.x*e.scale,r=t.y*e.scale-e.y*e.scale;return{left:i+rS*this._canvas.zoom(),top:r}}var o=this._canvas.getContainer(),s=o.getBoundingClientRect(),a=this._getTargetBounds(n);return{left:a.right-s.left+rS*this._canvas.zoom(),top:a.top-s.top}};tt.prototype._updatePosition=function(){let n=()=>{if(this.isOpen()){var e=this._current.html,t=this._getPosition(this._current.target);"x"in t&&"y"in t?(e.style.left=t.x+"px",e.style.top=t.y+"px"):["top","right","bottom","left"].forEach(function(i){i in t&&(e.style[i]=t[i]+"px")})}};this._scheduler.schedule(n,"ContextPad#_updatePosition")};tt.prototype._updateVisibility=function(){let n=()=>{if(this.isOpen()){var e=this,t=this._current.target,i=F(t)?t:[t],r=i.some(function(o){return e._canvas.hasMarker(o,Y$)});r?e.hide():e.show()}};this._scheduler.schedule(n,"ContextPad#_updateVisibility")};tt.prototype._getTargetBounds=function(n){var e=this,t=F(n)?n:[n],i=t.map(function(r){return e._canvas.getGraphics(r)});return i.reduce(function(r,o){let s=o.getBoundingClientRect();return r.top=Math.min(r.top,s.top),r.right=Math.max(r.right,s.right),r.bottom=Math.max(r.bottom,s.bottom),r.left=Math.min(r.left,s.left),r.x=r.left,r.y=r.top,r.width=r.right-r.left,r.height=r.bottom-r.top,r},{top:1/0,right:-1/0,bottom:-1/0,left:1/0})};function ej(n,e){var t=ee(n);e=F(e)?e:e.split(/\s+/g),e.forEach(function(i){t.add(i)})}function tj(n){return n.waypoints[n.waypoints.length-1]}function nj(n,e){return n=F(n)?n:[n],e=F(e)?e:[e],n.length===e.length&&kt(n,function(t){return e.includes(t)})}var oS={__depends__:[fo,iS,mo],contextPad:["type",tt]};function Kp(n,e,t,i){function r(s,a){return i.allowed("connection.create",{source:s,target:a})}function o(s,a){return r(a,s)}n.on("connect.hover",function(s){var a=s.context,l=a.start,c=s.hover,u;if(a.hover=c,u=a.canExecute=r(l,c),!Yr(u)){if(u!==!1){a.source=l,a.target=c;return}u=a.canExecute=o(l,c),!Yr(u)&&u!==!1&&(a.source=c,a.target=l)}}),n.on(["connect.out","connect.cleanup"],function(s){var a=s.context;a.hover=null,a.source=null,a.target=null,a.canExecute=!1}),n.on("connect.end",function(s){var a=s.context,l=a.canExecute,c=a.connectionStart,u={x:s.x,y:s.y},f=a.source,h=a.target;if(!l)return!1;var d=null,p={connectionStart:Qp(a)?u:c,connectionEnd:Qp(a)?c:u};Pe(l)&&(d=l),a.connection=t.connect(f,h,d,p)}),this.start=function(s,a,l,c){Pe(l)||(c=l,l=le(a)),e.init(s,"connect",{autoActivate:c,data:{shape:a,context:{start:a,connectionStart:l}}})}}Kp.$inject=["eventBus","dragging","modeling","rules"];function Qp(n){var e=n.hover,t=n.source,i=n.target;return e&&t&&e===t&&t!==i}var ij=1100,rj=900,sS="connect-ok",aS="connect-not-ok";function Gp(n,e,t){var i=n.get("connectionPreview",!1);i&&e.on("connect.move",function(r){var o=r.context,s=o.canExecute,a=o.hover,l=o.source,c=o.start,u=o.startPosition,f=o.target,h=o.connectionStart||u,d=o.connectionEnd||{x:r.x,y:r.y},p=h,m=d;Qp(o)&&(p=d,m=h),i.drawPreview(o,s,{source:l||c,target:f||a,connectionStart:p,connectionEnd:m})}),e.on("connect.hover",rj,function(r){var o=r.context,s=r.hover,a=o.canExecute;a!==null&&t.addMarker(s,a?sS:aS)}),e.on(["connect.out","connect.cleanup"],ij,function(r){var o=r.hover;o&&(t.removeMarker(o,sS),t.removeMarker(o,aS))}),i&&e.on("connect.cleanup",function(r){i.cleanUp(r.context)})}Gp.$inject=["injector","eventBus","canvas"];var lS={__depends__:[ht,yn,gn],__init__:["connectPreview"],connect:["type",Kp],connectPreview:["type",Gp]};var oj=new po("ps"),sj=["marker-start","marker-mid","marker-end"],aj=["circle","ellipse","line","path","polygon","polyline","path","rect"];function ji(n,e,t,i){this._elementRegistry=n,this._canvas=t,this._styles=i}ji.$inject=["elementRegistry","eventBus","canvas","styles"];ji.prototype.cleanUp=function(){console.warn("PreviewSupport#cleanUp is deprecated and will be removed in future versions. You do not need to manually clean up previews anymore. cf. https://github.com/bpmn-io/diagram-js/pull/906")};ji.prototype.getGfx=function(n){return this._elementRegistry.getGraphics(n)};ji.prototype.addDragger=function(n,e,t,i="djs-dragger"){t=t||this.getGfx(n);var r=gv(t),o=t.getBoundingClientRect();return this._cloneMarkers(ls(r),i),j(r,this._styles.cls(i,[],{x:o.top,y:o.left})),K(e,r),j(r,"data-preview-support-element-id",n.id),r};ji.prototype.addFrame=function(n,e){var t=Q("rect",{class:"djs-resize-overlay",width:n.width,height:n.height,x:n.x,y:n.y});return K(e,t),j(t,"data-preview-support-element-id",n.id),t};ji.prototype._cloneMarkers=function(n,e="djs-dragger",t=n){var i=this;n.childNodes&&n.childNodes.forEach(r=>{i._cloneMarkers(r,e,t)}),fj(n)&&sj.forEach(function(r){if(j(n,r)){var o=lj(n,r,i._canvas.getContainer());o&&i._cloneMarker(t,n,o,r,e)}})};ji.prototype._cloneMarker=function(n,e,t,i,r="djs-dragger"){var o=[t.id,r,oj.next()].join("-"),s=X("marker#"+t.id,n);n=n||this._canvas._svg;var a=s||gv(t);a.id=o,ne(a).add(r);var l=X(":scope > defs",n);l||(l=Q("defs"),K(n,l)),K(l,a);var c=uj(a.id);j(e,i,c)};function lj(n,e,t){var i=cj(j(n,e));return X("marker#"+i,t||document)}function cj(n){return n.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function uj(n){return"url(#"+n+")"}function fj(n){return aj.indexOf(n.nodeName)!==-1}var ka={__init__:["previewSupport"],previewSupport:["type",ji]};var hj="drop-ok",cS="drop-not-ok",uS="attach-ok",fS="new-parent",hS="create",dj=2e3;function Xp(n,e,t,i,r){function o(l,c,u,f,h){if(!c)return!1;l=Ee(l,function(_){var v=_.labelTarget;return!_.parent&&!(Bi(_)&&l.indexOf(v)!==-1)});var d=ye(l,function(_){return!Xe(_)}),p=!1,m=!1,g=!1;pS(l)&&(p=r.allowed("shape.attach",{position:u,shape:d,target:c})),p||(pS(l)?g=r.allowed("shape.create",{position:u,shape:d,source:f,target:c}):g=r.allowed("elements.create",{elements:l,position:u,target:c}));var b=h.connectionTarget;return g||p?(d&&f&&(m=r.allowed("connection.create",{source:b===f?d:f,target:b===f?f:d,hints:{targetParent:c,targetAttach:p}})),{attach:p,connect:m}):g===null||p===null?null:!1}function s(l,c){[uS,hj,cS,fS].forEach(function(u){u===c?n.addMarker(l,u):n.removeMarker(l,u)})}t.on(["create.move","create.hover"],function(l){var c=l.context,u=c.elements,f=l.hover,h=c.source,d=c.hints||{};if(!f){c.canExecute=!1,c.target=null;return}dS(l);var p={x:l.x,y:l.y},m=c.canExecute=f&&o(u,f,p,h,d);f&&m!==null&&(c.target=f,m&&m.attach?s(f,uS):s(f,m?fS:cS))}),t.on(["create.end","create.out","create.cleanup"],function(l){var c=l.hover;c&&s(c,null)}),t.on("create.end",function(l){var c=l.context,u=c.source,f=c.shape,h=c.elements,d=c.target,p=c.canExecute,m=p&&p.attach,g=p&&p.connect,b=c.hints||{};if(p===!1||!d)return!1;dS(l);var _={x:l.x,y:l.y};g?f=i.appendShape(u,f,_,d,{attach:m,connection:g===!0?{}:g,connectionTarget:b.connectionTarget}):(h=i.createElements(h,_,d,T({},b,{attach:m})),f=ye(h,function(v){return!Xe(v)})),T(c,{elements:h,shape:f}),T(l,{elements:h,shape:f})});function a(){var l=e.context();l&&l.prefix===hS&&e.cancel()}t.on("create.init",function(){t.on("elements.changed",a),t.once(["create.cancel","create.end"],dj,function(){t.off("elements.changed",a)})}),this.start=function(l,c,u){F(c)||(c=[c]);var f=ye(c,function(p){return!Xe(p)});if(f){u=T({elements:c,hints:{},shape:f},u||{}),k(c,function(p){se(p.x)||(p.x=0),se(p.y)||(p.y=0)});var h=Ee(c,function(p){return!p.hidden}),d=Tt(h);k(c,function(p){Xe(p)&&(p.waypoints=Vt(p.waypoints,function(m){return{x:m.x-d.x-d.width/2,y:m.y-d.y-d.height/2}})),T(p,{x:p.x-d.x-d.width/2,y:p.y-d.y-d.height/2})}),e.init(l,hS,{cursor:"grabbing",autoActivate:!0,data:{shape:f,elements:c,context:u}})}}}Xp.$inject=["canvas","dragging","eventBus","modeling","rules"];function dS(n){var e=n.context,t=e.createConstraints;t&&(t.left&&(n.x=Math.max(n.x,t.left)),t.right&&(n.x=Math.min(n.x,t.right)),t.top&&(n.y=Math.max(n.y,t.top)),t.bottom&&(n.y=Math.min(n.y,t.bottom)))}function pS(n){return n&&n.length===1&&!Xe(n[0])}var pj=750;function Yp(n,e,t,i,r){function o(s){var a=Q("g");j(a,r.cls("djs-drag-group",["no-events"]));var l=Q("g");return s.forEach(function(c){var u;c.hidden||(c.waypoints?(u=t._createContainer("connection",l),t.drawConnection(ls(u),c)):(u=t._createContainer("shape",l),t.drawShape(ls(u),c),jt(u,c.x,c.y)),i.addDragger(c,a,u))}),a}e.on("create.move",pj,function(s){var a=s.hover,l=s.context,c=l.elements,u=l.dragGroup;u||(u=l.dragGroup=o(c));var f;a?(u.parentNode||(f=n.getActiveLayer(),K(f,u)),jt(u,s.x,s.y)):Fe(u)}),e.on("create.cleanup",function(s){var a=s.context,l=a.dragGroup;l&&Fe(l)})}Yp.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];var Zp={__depends__:[gn,ka,yn,ht],__init__:["create","createPreview"],create:["type",Xp],createPreview:["type",Yp]};var om,He,xS,mj,xo,mS,bS,_S,hx,em,Ef,wS,gx,dx,px,gj,nm={},im=[],yj=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,sm=Array.isArray;function Cr(n,e){for(var t in e)n[t]=e[t];return n}function yx(n){n&&n.parentNode&&n.parentNode.removeChild(n)}function am(n,e,t){var i,r,o,s={};for(o in e)o=="key"?i=e[o]:o=="ref"?r=e[o]:s[o]=e[o];if(arguments.length>2&&(s.children=arguments.length>3?om.call(arguments,2):t),typeof n=="function"&&n.defaultProps!=null)for(o in n.defaultProps)s[o]===void 0&&(s[o]=n.defaultProps[o]);return tm(n,s,i,r,null)}function tm(n,e,t,i,r){var o={type:n,props:e,key:t,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r==null?++xS:r,__i:-1,__u:0};return r==null&&He.vnode!=null&&He.vnode(o),o}function lm(n){return n.children}function Sf(n,e){this.props=n,this.context=e}function Ra(n,e){if(e==null)return n.__?Ra(n.__,n.__i+1):null;for(var t;e<n.__k.length;e++)if((t=n.__k[e])!=null&&t.__e!=null)return t.__e;return typeof n.type=="function"?Ra(n):null}function vj(n){if(n.__P&&n.__d){var e=n.__v,t=e.__e,i=[],r=[],o=Cr({},e);o.__v=e.__v+1,He.vnode&&He.vnode(o),vx(n.__P,o,e,n.__n,n.__P.namespaceURI,32&e.__u?[t]:null,i,t==null?Ra(e):t,!!(32&e.__u),r),o.__v=e.__v,o.__.__k[o.__i]=o,OS(i,o,r),e.__e=e.__=null,o.__e!=t&&CS(o)}}function CS(n){if((n=n.__)!=null&&n.__c!=null)return n.__e=n.__c.base=null,n.__k.some(function(e){if(e!=null&&e.__e!=null)return n.__e=n.__c.base=e.__e}),CS(n)}function gS(n){(!n.__d&&(n.__d=!0)&&xo.push(n)&&!rm.__r++||mS!=He.debounceRendering)&&((mS=He.debounceRendering)||bS)(rm)}function rm(){try{for(var n,e=1;xo.length;)xo.length>e&&xo.sort(_S),n=xo.shift(),e=xo.length,vj(n)}finally{xo.length=rm.__r=0}}function ES(n,e,t,i,r,o,s,a,l,c,u){var f,h,d,p,m,g,b,_=i&&i.__k||im,v=e.length;for(l=xj(t,e,_,l,v),f=0;f<v;f++)(d=t.__k[f])!=null&&(h=d.__i!=-1&&_[d.__i]||nm,d.__i=f,g=vx(n,d,h,r,o,s,a,l,c,u),p=d.__e,d.ref&&h.ref!=d.ref&&(h.ref&&xx(h.ref,null,d),u.push(d.ref,d.__c||p,d)),m==null&&p!=null&&(m=p),(b=!!(4&d.__u))||h.__k===d.__k?(l=SS(d,l,n,b),b&&h.__e&&(h.__e=null)):typeof d.type=="function"&&g!==void 0?l=g:p&&(l=p.nextSibling),d.__u&=-7);return t.__e=m,l}function xj(n,e,t,i,r){var o,s,a,l,c,u=t.length,f=u,h=0;for(n.__k=new Array(r),o=0;o<r;o++)(s=e[o])!=null&&typeof s!="boolean"&&typeof s!="function"?(typeof s=="string"||typeof s=="number"||typeof s=="bigint"||s.constructor==String?s=n.__k[o]=tm(null,s,null,null,null):sm(s)?s=n.__k[o]=tm(lm,{children:s},null,null,null):s.constructor===void 0&&s.__b>0?s=n.__k[o]=tm(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):n.__k[o]=s,l=o+h,s.__=n,s.__b=n.__b+1,a=null,(c=s.__i=bj(s,t,l,f))!=-1&&(f--,(a=t[c])&&(a.__u|=2)),a==null||a.__v==null?(c==-1&&(r>u?h--:r<u&&h++),typeof s.type!="function"&&(s.__u|=4)):c!=l&&(c==l-1?h--:c==l+1?h++:(c>l?h--:h++,s.__u|=4))):n.__k[o]=null;if(f)for(o=0;o<u;o++)(a=t[o])!=null&&(2&a.__u)==0&&(a.__e==i&&(i=Ra(a)),RS(a,a));return i}function SS(n,e,t,i){var r,o;if(typeof n.type=="function"){for(r=n.__k,o=0;r&&o<r.length;o++)r[o]&&(r[o].__=n,e=SS(r[o],e,t,i));return e}n.__e!=e&&(i&&(e&&n.type&&!e.parentNode&&(e=Ra(n)),t.insertBefore(n.__e,e||null)),e=n.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function bj(n,e,t,i){var r,o,s,a=n.key,l=n.type,c=e[t],u=c!=null&&(2&c.__u)==0;if(c===null&&a==null||u&&a==c.key&&l==c.type)return t;if(i>(u?1:0)){for(r=t-1,o=t+1;r>=0||o<e.length;)if((c=e[s=r>=0?r--:o++])!=null&&(2&c.__u)==0&&a==c.key&&l==c.type)return s}return-1}function yS(n,e,t){e[0]=="-"?n.setProperty(e,t==null?"":t):n[e]=t==null?"":typeof t!="number"||yj.test(e)?t:t+"px"}function Jp(n,e,t,i,r){var o,s;e:if(e=="style")if(typeof t=="string")n.style.cssText=t;else{if(typeof i=="string"&&(n.style.cssText=i=""),i)for(e in i)t&&e in t||yS(n.style,e,"");if(t)for(e in t)i&&t[e]==i[e]||yS(n.style,e,t[e])}else if(e[0]=="o"&&e[1]=="n")o=e!=(e=e.replace(wS,"$1")),s=e.toLowerCase(),e=s in n||e=="onFocusOut"||e=="onFocusIn"?s.slice(2):e.slice(2),n.l||(n.l={}),n.l[e+o]=t,t?i?t[Ef]=i[Ef]:(t[Ef]=gx,n.addEventListener(e,o?px:dx,o)):n.removeEventListener(e,o?px:dx,o);else{if(r=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in n)try{n[e]=t==null?"":t;break e}catch{}typeof t=="function"||(t==null||t===!1&&e[4]!="-"?n.removeAttribute(e):n.setAttribute(e,e=="popover"&&t==1?"":t))}}function vS(n){return function(e){if(this.l){var t=this.l[e.type+n];if(e[em]==null)e[em]=gx++;else if(e[em]<t[Ef])return;return t(He.event?He.event(e):e)}}}function vx(n,e,t,i,r,o,s,a,l,c){var u,f,h,d,p,m,g,b,_,v,x,C,E,S,w,R=e.type;if(e.constructor!==void 0)return null;128&t.__u&&(l=!!(32&t.__u),o=[a=e.__e=t.__e]),(u=He.__b)&&u(e);e:if(typeof R=="function")try{if(b=e.props,_=R.prototype&&R.prototype.render,v=(u=R.contextType)&&i[u.__c],x=u?v?v.props.value:u.__:i,t.__c?g=(f=e.__c=t.__c).__=f.__E:(_?e.__c=f=new R(b,x):(e.__c=f=new Sf(b,x),f.constructor=R,f.render=wj),v&&v.sub(f),f.state||(f.state={}),f.__n=i,h=f.__d=!0,f.__h=[],f._sb=[]),_&&f.__s==null&&(f.__s=f.state),_&&R.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=Cr({},f.__s)),Cr(f.__s,R.getDerivedStateFromProps(b,f.__s))),d=f.props,p=f.state,f.__v=e,h)_&&R.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),_&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(_&&R.getDerivedStateFromProps==null&&b!==d&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(b,x),e.__v==t.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(b,f.__s,x)===!1){e.__v!=t.__v&&(f.props=b,f.state=f.__s,f.__d=!1),e.__e=t.__e,e.__k=t.__k,e.__k.some(function(A){A&&(A.__=e)}),im.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&s.push(f);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(b,f.__s,x),_&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(d,p,m)})}if(f.context=x,f.props=b,f.__P=n,f.__e=!1,C=He.__r,E=0,_)f.state=f.__s,f.__d=!1,C&&C(e),u=f.render(f.props,f.state,f.context),im.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,C&&C(e),u=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++E<25);f.state=f.__s,f.getChildContext!=null&&(i=Cr(Cr({},i),f.getChildContext())),_&&!h&&f.getSnapshotBeforeUpdate!=null&&(m=f.getSnapshotBeforeUpdate(d,p)),S=u!=null&&u.type===lm&&u.key==null?kS(u.props.children):u,a=ES(n,sm(S)?S:[S],e,t,i,r,o,s,a,l,c),f.base=e.__e,e.__u&=-161,f.__h.length&&s.push(f),g&&(f.__E=f.__=null)}catch(A){if(e.__v=null,l||o!=null)if(A.then){for(e.__u|=l?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;o[o.indexOf(a)]=null,e.__e=a}else{for(w=o.length;w--;)yx(o[w]);mx(e)}else e.__e=t.__e,e.__k=t.__k,A.then||mx(e);He.__e(A,e,t)}else o==null&&e.__v==t.__v?(e.__k=t.__k,e.__e=t.__e):a=e.__e=_j(t.__e,e,t,i,r,o,s,l,c);return(u=He.diffed)&&u(e),128&e.__u?void 0:a}function mx(n){n&&(n.__c&&(n.__c.__e=!0),n.__k&&n.__k.some(mx))}function OS(n,e,t){for(var i=0;i<t.length;i++)xx(t[i],t[++i],t[++i]);He.__c&&He.__c(e,n),n.some(function(r){try{n=r.__h,r.__h=[],n.some(function(o){o.call(r)})}catch(o){He.__e(o,r.__v)}})}function kS(n){return typeof n!="object"||n==null||n.__b>0?n:sm(n)?n.map(kS):n.constructor!==void 0?null:Cr({},n)}function _j(n,e,t,i,r,o,s,a,l){var c,u,f,h,d,p,m,g=t.props||nm,b=e.props,_=e.type;if(_=="svg"?r="http://www.w3.org/2000/svg":_=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),o!=null){for(c=0;c<o.length;c++)if((d=o[c])&&"setAttribute"in d==!!_&&(_?d.localName==_:d.nodeType==3)){n=d,o[c]=null;break}}if(n==null){if(_==null)return document.createTextNode(b);n=document.createElementNS(r,_,b.is&&b),a&&(He.__m&&He.__m(e,o),a=!1),o=null}if(_==null)g===b||a&&n.data==b||(n.data=b);else{if(o=_=="textarea"&&b.defaultValue!=null?null:o&&om.call(n.childNodes),!a&&o!=null)for(g={},c=0;c<n.attributes.length;c++)g[(d=n.attributes[c]).name]=d.value;for(c in g)d=g[c],c=="dangerouslySetInnerHTML"?f=d:c=="children"||c in b||c=="value"&&"defaultValue"in b||c=="checked"&&"defaultChecked"in b||Jp(n,c,null,d,r);for(c in b)d=b[c],c=="children"?h=d:c=="dangerouslySetInnerHTML"?u=d:c=="value"?p=d:c=="checked"?m=d:a&&typeof d!="function"||g[c]===d||Jp(n,c,d,g[c],r);if(u)a||f&&(u.__html==f.__html||u.__html==n.innerHTML)||(n.innerHTML=u.__html),e.__k=[];else if(f&&(n.innerHTML=""),ES(e.type=="template"?n.content:n,sm(h)?h:[h],e,t,i,_=="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,s,o?o[0]:t.__k&&Ra(t,0),a,l),o!=null)for(c=o.length;c--;)yx(o[c]);a&&_!="textarea"||(c="value",_=="progress"&&p==null?n.removeAttribute("value"):p!=null&&(p!==n[c]||_=="progress"&&!p||_=="option"&&p!=g[c])&&Jp(n,c,p,g[c],r),c="checked",m!=null&&m!=n[c]&&Jp(n,c,m,g[c],r))}return n}function xx(n,e,t){try{if(typeof n=="function"){var i=typeof n.__u=="function";i&&n.__u(),i&&e==null||(n.__u=n(e))}else n.current=e}catch(r){He.__e(r,t)}}function RS(n,e,t){var i,r;if(He.unmount&&He.unmount(n),(i=n.ref)&&(i.current&&i.current!=n.__e||xx(i,null,e)),(i=n.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){He.__e(o,e)}i.base=i.__P=null}if(i=n.__k)for(r=0;r<i.length;r++)i[r]&&RS(i[r],e,t||typeof n.type!="function");t||yx(n.__e),n.__c=n.__=n.__e=void 0}function wj(n,e,t){return this.constructor(n,t)}function cm(n,e,t){var i,r,o,s;e==document&&(e=document.documentElement),He.__&&He.__(n,e),r=(i=typeof t=="function")?null:t&&t.__k||e.__k,o=[],s=[],vx(e,n=(!i&&t||e).__k=am(lm,null,[n]),r||nm,nm,e.namespaceURI,!i&&t?[t]:r?null:e.firstChild?om.call(e.childNodes):null,o,!i&&t?t:r?r.__e:e.firstChild,i,s),OS(o,n,s)}om=im.slice,He={__e:function(n,e,t,i){for(var r,o,s;e=e.__;)if((r=e.__c)&&!r.__)try{if((o=r.constructor)&&o.getDerivedStateFromError!=null&&(r.setState(o.getDerivedStateFromError(n)),s=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(n,i||{}),s=r.__d),s)return r.__E=r}catch(a){n=a}throw n}},xS=0,mj=function(n){return n!=null&&n.constructor===void 0},Sf.prototype.setState=function(n,e){var t;t=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Cr({},this.state),typeof n=="function"&&(n=n(Cr({},t),this.props)),n&&Cr(t,n),n!=null&&this.__v&&(e&&this._sb.push(e),gS(this))},Sf.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),gS(this))},Sf.prototype.render=lm,xo=[],bS=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,_S=function(n,e){return n.__v.__b-e.__v.__b},rm.__r=0,hx=Math.random().toString(8),em="__d"+hx,Ef="__a"+hx,wS=/(PointerCapture)$|Capture$/i,gx=0,dx=vS(!1),px=vS(!0),gj=0;var AS=function(n,e,t,i){var r;e[0]=0;for(var o=1;o<e.length;o++){var s=e[o++],a=e[o]?(e[0]|=s?1:2,t[e[o++]]):e[++o];s===3?i[0]=a:s===4?i[1]=Object.assign(i[1]||{},a):s===5?(i[1]=i[1]||{})[e[++o]]=a:s===6?i[1][e[++o]]+=a+"":s?(r=n.apply(a,AS(n,a,t,["",null])),i.push(r),a[0]?e[0]|=2:(e[o-2]=0,e[o]=r)):i.push(a)}return i},TS=new Map;function MS(n){var e=TS.get(this);return e||(e=new Map,TS.set(this,e)),(e=AS(this,e.get(n)||(e.set(n,e=(function(t){for(var i,r,o=1,s="",a="",l=[0],c=function(h){o===1&&(h||(s=s.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?l.push(0,h,s):o===3&&(h||s)?(l.push(3,h,s),o=2):o===2&&s==="..."&&h?l.push(4,h,0):o===2&&s&&!h?l.push(5,0,!0,s):o>=5&&((s||!h&&o===5)&&(l.push(o,0,s,r),o=6),h&&(l.push(o,h,0,r),o=6)),s=""},u=0;u<t.length;u++){u&&(o===1&&c(),c(u));for(var f=0;f<t[u].length;f++)i=t[u][f],o===1?i==="<"?(c(),l=[l],o=3):s+=i:o===4?s==="--"&&i===">"?(o=1,s=""):s=i+s[0]:a?i===a?a="":s+=i:i==='"'||i==="'"?a=i:i===">"?(c(),o=1):o&&(i==="="?(o=5,r=s,s=""):i==="/"&&(o<5||t[u][f+1]===">")?(c(),o===3&&(l=l[0]),o=l,(l=l[0]).push(2,0,o),o=0):i===" "||i===" "||i===`
248 `,this._current.container)};Le.prototype.open=function(n,e,t,i){if(!n)throw new Error("target is missing");if(!e)throw new Error("providers for <"+e+"> not found");if(!t)throw new Error("position is missing");var r=this._eventBus.fire("popupMenu.open.allowed",{target:n,providerId:e});if(r===!1)return;this.isOpen()&&this.close();let{entries:o,headerEntries:s,emptyPlaceholder:a}=this._getContext(n,e);this._current={position:t,providerId:e,target:n,entries:o,headerEntries:s,emptyPlaceholder:a,container:this._createContainer({provider:e}),options:i},this._emit("open"),this._bindAutoClose(),this._render()};Le.prototype.refresh=function(){if(!this.isOpen())return;let{target:n,providerId:e}=this._current,{entries:t,headerEntries:i,emptyPlaceholder:r}=this._getContext(n,e);this._current={...this._current,entries:t,headerEntries:i,emptyPlaceholder:r},this._emit("refresh"),this._render()};Le.prototype._getContext=function(n,e){let t=this._getProviders(e);if(!t||!t.length)throw new Error("provider for <"+e+"> not found");let i=this._getEntries(n,t),r=this._getHeaderEntries(n,t),o=this._getEmptyPlaceholder(t);return{entries:i,headerEntries:r,emptyPlaceholder:o,empty:!(Object.keys(i).length||Object.keys(r).length)}};Le.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)};Le.prototype.reset=function(){let n=this._current.container;cm(null,n),Qe(n)};Le.prototype._emit=function(n,e){this._eventBus.fire(`popupMenu.${n}`,e)};Le.prototype._onOpened=function(){this._emit("opened")};Le.prototype._onClosed=function(){this._emit("closed")};Le.prototype._createContainer=function(n){var e=this._canvas,t=e.getContainer();let i=te(`<div class="djs-popup-parent djs-scrollable" data-popup=${n.provider}></div>`);return t.appendChild(i),i};Le.prototype._bindAutoClose=function(){this._eventBus.once(WS,this.close,this)};Le.prototype._unbindAutoClose=function(){this._eventBus.off(WS,this.close,this)};Le.prototype._updateScale=function(){var n=this._canvas.zoom(),e=this._config.scale,t,i,r=n;return e!==!0&&(e===!1?(t=1,i=1):(t=e.min,i=e.max),Me(t)&&n<t&&(r=t),Me(i)&&n>i&&(r=i)),r};Le.prototype._ensureVisible=function(n,e){var t=document.documentElement.getBoundingClientRect(),i=n.getBoundingClientRect(),r={},o=e.x,s=e.y;return e.x+i.width>t.width&&(r.x=!0),e.y+i.height>t.height&&(r.y=!0),r.x&&r.y?(o=e.x-i.width,s=e.y-i.height):r.x?(o=e.x-i.width,s=e.y):r.y&&e.y<i.height?(o=e.x,s=10):r.y&&(o=e.x,s=e.y-i.height),e.y<t.top&&(s=e.y+i.height),{x:o,y:s}};Le.prototype.isEmpty=function(n,e){if(!n)throw new Error("target is missing");if(!e)throw new Error("provider ID is missing");let t=this._getProviders(e);return!t||!t.length?!0:this._getContext(n,e).empty};Le.prototype.registerProvider=function(n,e,t){t||(t=e,e=Ij),this._eventBus.on("popupMenu.getProviders."+n,e,function(i){i.providers.push(t)})};Le.prototype._getProviders=function(n){var e=this._eventBus.createEvent({type:"popupMenu.getProviders."+n,providers:[]});return this._eventBus.fire(e),e.providers};Le.prototype._getEntries=function(n,e){var t={};return k(e,function(i){if(!i.getPopupMenuEntries){k(i.getEntries(n),function(o){var s=o.id;if(!s)throw new Error("entry ID is missing");t[s]=Uu(o,["id"])});return}var r=i.getPopupMenuEntries(n);ge(r)?t=r(t):k(r,function(o,s){t[s]=o})}),t};Le.prototype._getHeaderEntries=function(n,e){var t={};return k(e,function(i){if(!i.getPopupMenuHeaderEntries){if(!i.getHeaderEntries)return;k(i.getHeaderEntries(n),function(o){var s=o.id;if(!s)throw new Error("entry ID is missing");t[s]=Uu(o,["id"])});return}var r=i.getPopupMenuHeaderEntries(n);ge(r)?t=r(t):k(r,function(o,s){t[s]=o})}),t};Le.prototype._getEmptyPlaceholder=function(n){let e=n.find(t=>ge(t.getEmptyPlaceholder));return e&&e.getEmptyPlaceholder()};Le.prototype.isOpen=function(){return!!this._current};Le.prototype.trigger=function(n,e,t="click"){if(n.preventDefault(),!e){let r=De(n.delegateTarget||n.target,".entry",!0),o=et(r,Dj);e={id:o,...this._getEntry(o)}}let i=e.action;if(this._emit("trigger",{entry:e,event:n})!==!1){if(ge(i)){if(t==="click")return i(n,e)}else if(i[t])return i[t](n,e)}};Le.prototype._getEntry=function(n){var e=this._current.entries[n]||this._current.headerEntries[n];if(!e)throw new Error("entry not found");return e};function US(n){return Object.entries(n).map(([e,t])=>{let i={id:e,...t};return i.entries&&(i.entries=US(i.entries)),i})}function Rx(n,e,t){let{keys:i}=t;if(e=e.trim().toLowerCase(),!e)throw new Error("<pattern> must not be empty");let r=e.trim().toLowerCase().split(/\s+/);return n.flatMap(o=>{let s=Lj(o,r,i);return s?{item:o,tokens:s}:[]}).sort(Bj(i))}function Lj(n,e,t){let{matchedWords:i,tokens:r}=t.reduce((o,s)=>{let a=n[s],{tokens:l,matchedWords:c}=F(a)?a.reduce((u,f)=>{let{tokens:h,matchedWords:d}=XS(f,e);return{tokens:[...u.tokens,h],matchedWords:{...u.matchedWords,...d}}},{matchedWords:{},tokens:[]}):XS(a,e);return{tokens:{...o.tokens,[s]:l},matchedWords:{...o.matchedWords,...c}}},{matchedWords:{},tokens:{}});return Object.keys(i).length!==e.length?null:r}function Bj(n){return(e,t)=>{let i=0,r=1;for(let o of n){let s=Nj(e.tokens[o],t.tokens[o]);if(s!==0){i+=s*r,r*=QS;continue}let a=$j(e.item[o],t.item[o]);if(a!==0){i+=a*r,r*=QS;continue}}return i}}function Nj(n,e){return KS(e)-KS(n)}var QS=.5,Da={FULL:131.9,START_FULL_WORD:8,START_WORD_PART:7.87,WORD_START:2.19,WORD_PART:1,NO_MATCH:-.07};function KS(n){let e=n.reduce((a,l)=>a+YS(l),0),t=n.flat(),i=t.reduce((a,l)=>a+l.value.length,0),r=t.reduce((a,l)=>a+(l.match?l.value.length:0),0),o=i?r/i:0;return e*(1+o)}function YS(n){if(F(n))return Math.max(...n.map(YS));let e=Math.log(n.value.length);return n.match?(n.start?n.end?Da.FULL:n.wordEnd?Da.START_FULL_WORD:Da.START_WORD_PART:n.wordStart?Da.WORD_START:Da.WORD_PART)*e:Da.NO_MATCH*e}function GS(n=""){return F(n)?n.join(", "):n}function $j(n,e){return GS(n).localeCompare(GS(e))}function XS(n,e){var c;if(!n)return{tokens:[],matchedWords:{}};let t=[],i={},r=e.map(jj),o=[`(?<all>${r.join("\\s+")})`,...r].join("|"),s=new RegExp(o,"ig"),a,l=0;for(;a=s.exec(n);){let[u]=a,f=a.index,h=a.index+u.length,d=f===0,p=h===n.length,m=!!((c=a.groups)!=null&&c.all),g=d||/\s/.test(n.charAt(f-1)),b=p||/\s/.test(n.charAt(h));a.index>l&&t.push({value:n.slice(l,a.index),index:l}),t.push({value:u,index:a.index,match:!0,wordStart:g,wordEnd:b,start:d,end:p,all:m});let _=m?e:[u];for(let v of _)i[v.toLowerCase()]=!0;l=a.index+u.length}return l<n.length&&t.push({value:n.slice(l),index:l}),{tokens:t,matchedWords:i}}function jj(n){return n.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}var ZS={search:["value",Rx]};var JS={__depends__:[ZS],__init__:["popupMenu"],popupMenu:["type",Le]};var eO=Math.round;function Rf(n,e){this._modeling=n,this._eventBus=e}Rf.$inject=["modeling","eventBus"];Rf.prototype.replaceElement=function(n,e,t){if(n.waypoints)return null;var i=this._modeling,r=this._eventBus;r.fire("replace.start",{element:n,attrs:e,hints:t});var o=e.width||n.width,s=e.height||n.height,a=e.x||n.x,l=e.y||n.y,c=eO(a+o/2),u=eO(l+s/2),f=i.replaceShape(n,T({},e,{x:c,y:u,width:o,height:s}),t);return r.fire("replace.end",{element:n,newElement:f,hints:t}),f};function hm(n,e){e.on("replace.end",500,function(t){let{newElement:i,hints:r={}}=t;r.select!==!1&&n.select(i)})}hm.$inject=["selection","eventBus"];var tO={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",hm],replace:["type",Rf]};function dm(n,e,t,i){function r(o,s,a){a=a||{};var l=s.type,c=o.businessObject,u=n.create(l),f={type:l,businessObject:u};if(f.width=o.width,f.height=o.height,u.name=c.name,s.table){var h=n.create("dmn:DecisionTable");h.$parent=u;var d=n.create("dmn:OutputClause");d.typeRef="string",d.$parent=h,h.output=[d];var p=n.create("dmn:InputClause");p.$parent=h;var m=n.create("dmn:LiteralExpression",{typeRef:"string"});p.inputExpression=m,m.$parent=p,h.input=[p],nO(u,h,n)}if(s.expression){var g=n.create("dmn:LiteralExpression"),b=n.create("dmn:InformationItem",{name:c.name});nO(u,g,n,b)}return e.replaceElement(o,f,a)}this.replaceElement=r}dm.$inject=["drdFactory","replace","selection","modeling"];function nO(n,e,t,i){if(O(n,"dmn:Decision"))n.decisionLogic=e,e.$parent=n;else if(O(n,"dmn:BusinessKnowledgeModel")){var r=t.create("dmn:FunctionDefinition",{body:e});n.encapsulatedLogic=r,r.$parent=n,e.$parent=r}i&&(n.variable=i,i.$parent=n)}var iO={__depends__:[tO,ht],drdReplace:["type",dm]};var Tx={DECISION:[{label:"Empty",actionName:"replace-with-empty-decision",className:"dmn-icon-clear",target:{type:"dmn:Decision",table:!1,expression:!1}},{label:"Decision table",actionName:"replace-with-decision-table",className:"dmn-icon-decision-table",target:{type:"dmn:Decision",table:!0,expression:!1}},{label:"Literal expression",actionName:"replace-with-literal-expression",className:"dmn-icon-literal-expression",target:{type:"dmn:Decision",table:!1,expression:!0}}],BKM:[{label:"Empty",actionName:"replace-with-empty",className:"dmn-icon-clear",target:{type:"dmn:BusinessKnowledgeModel",table:!1,expression:!1}},{label:"Literal Expression",actionName:"replace-with-literal-expression",className:"dmn-icon-literal-expression",target:{type:"dmn:BusinessKnowledgeModel",table:!1,expression:!0}}]};function Er(n,e,t,i,r,o){this._popupMenu=n,this._modeling=e,this._moddle=t,this._drdReplace=i,this._rules=r,this._translate=o,this.register()}Er.$inject=["popupMenu","modeling","moddle","drdReplace","rules","translate"];Er.prototype.register=function(){this._popupMenu.registerProvider("dmn-replace",this)};Er.prototype.getEntries=function(n){var e=n.businessObject,t=this._rules,i,r;return t.allowed("shape.replace",{element:n})?O(e,"dmn:Decision")?(r=dr(e),i=Ee(Tx.DECISION,function(o){var s=o.actionName==="replace-with-empty-decision"&&r,a=o.actionName==="replace-with-decision-table"&&!O(r,"dmn:DecisionTable"),l=o.actionName==="replace-with-literal-expression"&&!O(r,"dmn:LiteralExpression");return s||a||l}),this._createEntries(n,i)):O(e,"dmn:BusinessKnowledgeModel")?(r=dr(e),i=Ee(Tx.BKM,function(o){var s=o.actionName==="replace-with-empty"&&r,a=o.actionName==="replace-with-decision-table"&&!O(r,"dmn:DecisionTable"),l=o.actionName==="replace-with-literal-expression"&&!O(r,"dmn:LiteralExpression");return s||a||l}),this._createEntries(n,i)):[]:[]};Er.prototype._createEntries=function(n,e){var t=[],i=this;return k(e,function(r){var o=i._createMenuEntry(r,n);t.push(o)}),t};Er.prototype._createMenuEntry=function(n,e,t){var i=this._drdReplace.replaceElement,r=this._translate,o=function(){return i(e,n.target)};t=t||o;var s={label:r(n.label),className:n.className,id:n.actionName,action:t};return s};Er.prototype.getHeaderEntries=function(n){return[]};var rO={__depends__:[qe,JS,iO],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Er]};function vs(n,e,t,i,r,o,s,a,l,c,u,f){u=u||{},e.registerProvider(this),this._contextPad=e,this._modeling=t,this._elementFactory=i,this._connect=r,this._create=o,this._rules=s,this._popupMenu=a,this._canvas=l,this._translate=c,u.autoPlace!==!1&&(this._autoPlace=f.get("autoPlace",!1)),n.on("create.end",250,function(h){var d=h.context.shape;if(hf(h)){var p=e.getEntries(d);p.replace&&p.replace.action.click(h,d)}})}vs.$inject=["eventBus","contextPad","modeling","elementFactory","connect","create","rules","popupMenu","canvas","translate","config.contextPad","injector"];vs.prototype.getContextPadEntries=function(n){var e=this._modeling,t=this._elementFactory,i=this._connect,r=this._create,o=this._popupMenu,s=this._contextPad,a=this._rules,l=this._translate,c=this._autoPlace,u={};if(n.type==="label")return u;var f=n.businessObject;function h(b,_,v){i.start(b,_,v)}function d(b){e.removeElements([n])}function p(b){var _=5,v=s.getPad(b).html,x=v.getBoundingClientRect(),C={x:x.left,y:x.bottom+_};return C}function m(b,_,v,x){function C(S,w){var R=t.createShape(T({type:b},x));r.start(S,R,{source:w,hints:{connectionTarget:w}})}var E=c?function(S,w){var R=t.createShape(T({type:b},x));c.append(w,R,{connectionTarget:w})}:C;return{group:"model",className:_,title:v,action:{dragstart:C,click:E}}}O(f,"dmn:Decision")&&T(u,{"append.decision":m("dmn:Decision","dmn-icon-decision",l("Append decision"))}),Ge(f,["dmn:BusinessKnowledgeModel","dmn:Decision","dmn:KnowledgeSource"])&&T(u,{"append.knowledge-source":m("dmn:KnowledgeSource","dmn-icon-knowledge-source",l("Append knowledge source"))}),Ge(f,["dmn:BusinessKnowledgeModel","dmn:Decision"])&&T(u,{"append.business-knowledge-model":m("dmn:BusinessKnowledgeModel","dmn-icon-business-knowledge",l("Append business knowledge model"))}),Ge(f,["dmn:Decision","dmn:KnowledgeSource"])&&T(u,{"append.input-data":m("dmn:InputData","dmn-icon-input-data",l("Append input data"))}),O(f,"dmn:DRGElement")&&T(u,{"append.text-annotation":m("dmn:TextAnnotation","dmn-icon-text-annotation",l("Add text annotation")),connect:{group:"connect",className:"dmn-icon-connection-multi",title:l("Connect to other element"),action:{click:h,dragstart:h}}}),O(f,"dmn:TextAnnotation")&&T(u,{connect:{group:"connect",className:"dmn-icon-connection-multi",title:l("Connect to other element"),action:{click:h,dragstart:h}}}),o.isEmpty(n,"dmn-replace")||T(u,{replace:{group:"edit",className:"dmn-icon-screw-wrench",title:l("Change type"),action:{click:function(b,_){var v=T(p(_),{cursor:{x:b.x,y:b.y}});o.open(_,"dmn-replace",v)}}}});var g=a.allowed("elements.delete",{elements:[n]});return F(g)&&(g=g[0]===n),g&&T(u,{delete:{group:"edit",className:"dmn-icon-trash",title:l("Delete"),action:{click:d}}}),u};vs.prototype.getMultiElementContextPadEntries=function(n){var e=this._modeling,t=this._translate,i={};return this._isDeleteAllowed(n)&&T(i,{delete:{group:"edit",className:"dmn-icon-trash",title:t("Delete"),action:{click:(r,o)=>e.removeElements(o.slice())}}}),i};vs.prototype._isDeleteAllowed=function(n){var e=this._rules.allowed("elements.delete",{elements:n});return F(e)?kt(n,t=>e.includes(t)):e};var oO={__depends__:[qe,oS,ht,lS,Zp,rO],__init__:["contextPadProvider"],contextPadProvider:["type",vs]};var Fj="djs-dragger";function pi(n,e,t,i){this._canvas=e,this._graphicsFactory=t,this._elementFactory=i,this._connectionDocking=n.get("connectionDocking",!1),this._layouter=n.get("layouter",!1)}pi.$inject=["injector","canvas","graphicsFactory","elementFactory"];pi.prototype.drawPreview=function(n,e,t){t=t||{};var i=n.connectionPreviewGfx,r=n.getConnection,o=t.source,s=t.target,a=t.waypoints,l=t.connectionStart,c=t.connectionEnd,u=t.noLayout,f=t.noCropping,h=t.noNoop,d,p=this;if(i||(i=n.connectionPreviewGfx=this.createConnectionPreviewGfx()),ss(i),r||(r=n.getConnection=qj(function(m,g,b){return p.getConnection(m,g,b)})),e&&(d=r(e,o,s)),!d){!h&&this.drawNoopPreview(i,t);return}d.waypoints=a||[],this._layouter&&!u&&(d.waypoints=this._layouter.layoutConnection(d,{source:o,target:s,connectionStart:l,connectionEnd:c,waypoints:t.waypoints||d.waypoints})),(!d.waypoints||!d.waypoints.length)&&(d.waypoints=[o?le(o):l,s?le(s):c]),this._connectionDocking&&(o||s)&&!f&&(d.waypoints=this._connectionDocking.getCroppedWaypoints(d,o,s)),this._graphicsFactory.drawConnection(i,d,{stroke:"var(--element-dragger-color)"})};pi.prototype.drawNoopPreview=function(n,e){var t=e.source,i=e.target,r=e.connectionStart||le(t),o=e.connectionEnd||le(i),s=this.cropWaypoints(r,o,t,i),a=this.createNoopConnection(s[0],s[1]);K(n,a)};pi.prototype.cropWaypoints=function(n,e,t,i){var r=this._graphicsFactory,o=t&&r.getShapePath(t),s=i&&r.getShapePath(i),a=r.getConnectionPath({waypoints:[n,e]});return n=t&&tf(o,a,!0)||n,e=i&&tf(s,a,!1)||e,[n,e]};pi.prototype.cleanUp=function(n){n&&n.connectionPreviewGfx&&Fe(n.connectionPreviewGfx)};pi.prototype.getConnection=function(n){var e=Vj(n);return this._elementFactory.createConnection(e)};pi.prototype.createConnectionPreviewGfx=function(){var n=Q("g");return j(n,{pointerEvents:"none"}),ne(n).add(Fj),K(this._canvas.getActiveLayer(),n),n};pi.prototype.createNoopConnection=function(n,e){return ro([n,e],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function qj(n){var e={};return function(t){var i=JSON.stringify(t),r=e[i];return r||(r=e[i]=n.apply(null,arguments)),r}}function Vj(n){return Pe(n)?n:{}}var sO={__init__:["connectionPreview"],connectionPreview:["type",pi]};var Hj=/\s/,zj=/^([a-z][\w-.]*:)?[a-z_][\w-.]*$/i,Wj=/^[a-z_][\w-.]*$/i,Uj=/\$\{([^}]*)\}/g;function aO(n,e){let t=n.$model.ids.assigned(e),i=t&&t!==n;return e?i?"Element must have unique ID.":Qj(e):"Element must have ID."}function Qj(n){if(n=Gj(n),Kj(n))return"Id must not contain spaces.";if(!Wj.test(n))return zj.test(n)?"Id must not contain prefix.":"Id must be a valid QName."}function Kj(n){return Hj.test(n)}function Gj(n){return n.replace(Uj,"$1")}var Xj=300;function bo(n,e,t,i,r){this._eventBus=n,this._modeling=e,this._canvas=t,this._definitionPropertiesView=i,this._translate=r,n.on("definitionIdView.create",function(o){this._container=o.html;var s=X(".dmn-definitions-name",this._container),a=X(".dmn-definitions-id",this._container);this._setup(s,"name"),this._setup(a,"id")},this)}bo.$inject=["eventBus","modeling","canvas","definitionPropertiesView","translate"];bo.prototype.update=function(n,e){var t=this._canvas.getRootElement(),i={};if(i[n]=e,n==="id"){var r=aO(Ke(t),e);if(r){this._addErrorMessage(r);return}this._clearErrorMessage()}this._modeling.updateProperties(t,i)};bo.prototype._setup=function(n,e){var t=this;n.setAttribute("contenteditable",!0),n.addEventListener("input",Mi(function(i){var r=i.target.value||i.target.textContent;t.update(e,r.trim())},Xj)),n.addEventListener("keydown",function(i){i.keyCode===13&&(n.blur(),window.getSelection().removeAllRanges())}),n.addEventListener("blur",function(){t._clearErrorMessage(),t._definitionPropertiesView.update()})};bo.prototype._addErrorMessage=function(n){let e='<span class="dmn-definitions-error-message">'+this._translate(n)+"</span>";var t=X(".dmn-definitions-id",this._container);this._clearErrorMessage(),ee(t).add("dmn-definitions-error"),t.parentElement.appendChild(te(e))};bo.prototype._clearErrorMessage=function(){var n=X(".dmn-definitions-id",this._container);if(ee(n).has("dmn-definitions-error")){ee(n).remove("dmn-definitions-error");let e=X(".dmn-definitions-error-message",this._container);n.parentNode.removeChild(e)}};var lO={__depends__:[Ca],__init__:["definitionPropertiesEdit","definitionPropertiesPaletteAdapter"],definitionPropertiesEdit:["type",bo],definitionPropertiesPaletteAdapter:["type",wa]};var Yj={horizontal:["x","width"],vertical:["y","height"]},cO=5;function mi(n,e){this._modeling=n,this._filters=[],this.registerFilter(function(t){var i=e.allowed("elements.distribute",{elements:t});return F(i)?i:i?t:[]})}mi.$inject=["modeling","rules"];mi.prototype.registerFilter=function(n){if(typeof n!="function")throw new Error("the filter has to be a function");this._filters.push(n)};mi.prototype.trigger=function(n,e){var t=this._modeling,i,r;if(!(n.length<3)&&(this._setOrientation(e),r=this._filterElements(n),i=this._createGroups(r),!(i.length<=2)))return t.distributeElements(i,this._axis,this._dimension),i};mi.prototype._filterElements=function(n){var e=this._filters,t=this._axis,i=this._dimension,r=[].concat(n);return e.length?(k(e,function(o){r=o(r,t,i)}),r):n};mi.prototype._createGroups=function(n){var e=[],t=this,i=this._axis,r=this._dimension;if(!i)throw new Error('must have a defined "axis" and "dimension"');var o=Fn(n,i);return k(o,function(s,a){var l=t._findRange(s,i,r),c,u=e[e.length-1];u&&t._hasIntersection(u.range,l)?e[e.length-1].elements.push(s):(c={range:l,elements:[s]},e.push(c))}),e};mi.prototype._setOrientation=function(n){var e=Yj[n];this._axis=e[0],this._dimension=e[1]};mi.prototype._hasIntersection=function(n,e){return Math.max(n.min,n.max)>=Math.min(e.min,e.max)&&Math.min(n.min,n.max)<=Math.max(e.min,e.max)};mi.prototype._findRange=function(n){var e=n[this._axis],t=n[this._dimension];return{min:e+cO,max:e+t-cO}};var uO={__init__:["distributeElements"],distributeElements:["type",mi]};function pm(n){n.registerFilter(function(e){return Ee(e,function(t){var i=Ge(t,["dmn:AuthorityRequirement","dmn:InformationRequirement","dmn:KnowledgeRequirement","dmn:Association","dmn:TextAnnotation"]);return!(t.labelTarget||i)})})}pm.$inject=["distributeElements"];var fO={__depends__:[uO],__init__:["drdDistributeElements"],drdDistributeElements:["type",pm]};var hO="is not a registered action",Zj="is already registered";function sn(n,e){this._eventBus=n,this._actions={};var t=this;n.on("diagram.init",function(){t._registerDefaultActions(e),n.fire("editorActions.init",{editorActions:t})})}sn.$inject=["eventBus","injector"];sn.prototype._registerDefaultActions=function(n){var e=n.get("commandStack",!1),t=n.get("modeling",!1),i=n.get("selection",!1),r=n.get("zoomScroll",!1),o=n.get("copyPaste",!1),s=n.get("canvas",!1),a=n.get("rules",!1),l=n.get("keyboardMove",!1),c=n.get("keyboardMoveSelection",!1);e&&(this.register("undo",function(){e.undo()}),this.register("redo",function(){e.redo()})),o&&i&&this.register("copy",function(){var u=i.get();if(u.length)return o.copy(u)}),o&&i&&this.register("duplicate",function(){var u=i.get();if(u.length)return o.duplicate(u)}),o&&this.register("paste",function(){o.paste()}),o&&i&&a&&this.register("cut",function(){var u=i.get();if(u.length){var f=a.allowed("elements.delete",{elements:u});if(f!==!1){var h=F(f)?f:u;return o.cut(h.slice())}}}),r&&this.register("stepZoom",function(u){r.stepZoom(u.value)}),s&&this.register("zoom",function(u){s.zoom(u.value)}),t&&i&&a&&this.register("removeSelection",function(){var u=i.get();if(u.length){var f=a.allowed("elements.delete",{elements:u}),h;f!==!1&&(F(f)?h=f:h=u,h.length&&t.removeElements(h.slice()))}}),l&&this.register("moveCanvas",function(u){l.moveCanvas(u)}),c&&this.register("moveSelection",function(u){c.moveSelection(u.direction,u.accelerated)})};sn.prototype.trigger=function(n,e){if(!this._actions[n])throw Ax(n,hO);var t=this._eventBus.fire("editorActions.allowed",{action:n,opts:e});if(t!==!1)return this._actions[n](e)};sn.prototype.register=function(n,e){var t=this;if(typeof n=="string")return this._registerAction(n,e);k(n,function(i,r){t._registerAction(r,i)})};sn.prototype._registerAction=function(n,e){if(this.isRegistered(n))throw Ax(n,Zj);this._actions[n]=e};sn.prototype.unregister=function(n){if(!this.isRegistered(n))throw Ax(n,hO);this._actions[n]=void 0};sn.prototype.getActions=function(){return Object.keys(this._actions)};sn.prototype.isRegistered=function(n){return!!this._actions[n]};function Ax(n,e){return new Error(n+" "+e)}var dO={__init__:["editorActions"],editorActions:["type",sn]};function Ia(n){n.invoke(sn,this)}fe(Ia,sn);Ia.$inject=["injector"];Ia.prototype._registerDefaultActions=function(n){sn.prototype._registerDefaultActions.call(this,n);let e=n.get("canvas",!1),t=n.get("elementRegistry",!1),i=n.get("selection",!1),r=n.get("lassoTool",!1),o=n.get("handTool",!1),s=n.get("directEditing",!1),a=n.get("distributeElements",!1),l=n.get("alignElements",!1),c=n.get("searchPad",!1);e&&t&&i&&this._registerAction("selectElements",function(){var u=e.getRootElement(),f=t.filter(function(h){return h!==u});return i.select(f),f}),i&&a&&this._registerAction("distributeElements",function(u){var f=i.get(),h=u.type;f.length>2&&a.trigger(f,h)}),i&&l&&this._registerAction("alignElements",function(u){var f=i.get(),h=u.type;f.length>1&&l.trigger(f,h)}),r&&this._registerAction("lassoTool",function(){r.toggle()}),o&&this._registerAction("handTool",function(){o.toggle()}),i&&s&&this._registerAction("directEditing",function(){var u=i.get();u.length&&s.activate(u[0])}),i&&c&&this._registerAction("find",function(){c.toggle()})};var pO={__depends__:[dO],editorActions:["type",Ia]};function La(n){return n.dmnDI&&n.dmnDI.diagrams&&n.dmnDI.diagrams[0]}function mm(n,e,t,i){function r(o){var s=o.dmnDI;s||(s=n.create("dmndi:DMNDI"),o.set("dmnDI",s));var a=n.create("dmndi:DMNDiagram");s.set("diagrams",[a]);var l=0;k(o.get("drgElement"),function(c){if(O(c,"dmn:Decision")){var u=e._getDefaultSize(c),f=n.createDiShape(c,{x:150+l*30,y:150+l*30,width:u.width,height:u.height});i.updateDiParent(f,a),l++}})}t.on("import.start",({definitions:o})=>{La(o)||r(o)})}mm.$inject=["drdFactory","elementFactory","eventBus","drdUpdater"];var mO={__init__:["diGenerator"],diGenerator:["type",mm]};var Jj=1e3;function ae(n){this._eventBus=n}ae.$inject=["eventBus"];function eF(n,e){return function(t){return n.call(e||null,t.context,t.command,t)}}ae.prototype.on=function(n,e,t,i,r,o){if((ge(e)||se(e))&&(o=r,r=i,i=t,t=e,e=null),ge(t)&&(o=r,r=i,i=t,t=Jj),Pe(r)&&(o=r,r=!1),!ge(i))throw new Error("handlerFn must be a function");F(n)||(n=[n]);var s=this._eventBus;k(n,function(a){var l=["commandStack",a,e].filter(function(c){return c}).join(".");s.on(l,t,r?eF(i,o):i,o)})};ae.prototype.canExecute=Sr("canExecute");ae.prototype.preExecute=Sr("preExecute");ae.prototype.preExecuted=Sr("preExecuted");ae.prototype.execute=Sr("execute");ae.prototype.executed=Sr("executed");ae.prototype.postExecute=Sr("postExecute");ae.prototype.postExecuted=Sr("postExecuted");ae.prototype.revert=Sr("revert");ae.prototype.reverted=Sr("reverted");function Sr(n){return function(t,i,r,o,s){(ge(t)||se(t))&&(s=o,o=r,r=i,i=t,t=null),this.on(t,n,i,r,o,s)}}function Or(n,e){ae.call(this,n),this._gridSnapping=e;var t=this;this.preExecute("shape.resize",function(i){var r=i.context,o=r.hints||{},s=o.autoResize;if(s){var a=r.shape,l=r.newBounds;Ie(s)?r.newBounds=t.snapComplex(l,s):r.newBounds=t.snapSimple(a,l)}})}Or.$inject=["eventBus","gridSnapping","modeling"];fe(Or,ae);Or.prototype.snapSimple=function(n,e){var t=this._gridSnapping;return e.width=t.snapValue(e.width,{min:e.width}),e.height=t.snapValue(e.height,{min:e.height}),e.x=n.x+n.width/2-e.width/2,e.y=n.y+n.height/2-e.height/2,e};Or.prototype.snapComplex=function(n,e){return/w|e/.test(e)&&(n=this.snapHorizontally(n,e)),/n|s/.test(e)&&(n=this.snapVertically(n,e)),n};Or.prototype.snapHorizontally=function(n,e){var t=this._gridSnapping,i=/w/.test(e),r=/e/.test(e),o={};return o.width=t.snapValue(n.width,{min:n.width}),r&&(i?(o.x=t.snapValue(n.x,{max:n.x}),o.width+=t.snapValue(n.x-o.x,{min:n.x-o.x})):n.x=n.x+n.width-o.width),T(n,o),n};Or.prototype.snapVertically=function(n,e){var t=this._gridSnapping,i=/n/.test(e),r=/s/.test(e),o={};return o.height=t.snapValue(n.height,{min:n.height}),i&&(r?(o.y=t.snapValue(n.y,{max:n.y}),o.height+=t.snapValue(n.y-o.y,{min:n.y-o.y})):n.y=n.y+n.height-o.height),T(n,o),n};var tF=2e3;function gm(n,e){n.on(["spaceTool.move","spaceTool.end"],tF,function(t){var i=t.context;if(i.initialized){var r=i.axis,o;r==="x"?(o=e.snapValue(t.dx),t.x=t.x+o-t.dx,t.dx=o):(o=e.snapValue(t.dy),t.y=t.y+o-t.dy,t.dy=o)}})}gm.$inject=["eventBus","gridSnapping"];var gO={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",Or],gridSnappingSpaceToolBehavior:["type",gm]};var Tf=10;function ym(n,e,t){return t||(t="round"),Math[t](n/e)*e}var nF=1200,iF=800;function Fi(n,e,t){var i=!t||t.active!==!1;this._eventBus=e;var r=this;e.on("diagram.init",iF,function(){r.setActive(i)}),e.on(["create.move","create.end","bendpoint.move.move","bendpoint.move.end","connect.move","connect.end","connectionSegment.move.move","connectionSegment.move.end","resize.move","resize.end","shape.move.move","shape.move.end"],nF,function(o){var s=o.originalEvent;if(!(!r.active||s&&Mt(s))){var a=o.context,l=a.gridSnappingContext;l||(l=a.gridSnappingContext={}),["x","y"].forEach(function(c){var u={},f=oF(o,c,n);f&&(u.offset=f);var h=rF(o,c);h&&T(u,h),wr(o,c)||r.snapEvent(o,c,u)})}})}Fi.prototype.snapEvent=function(n,e,t){var i=this.snapValue(n[e],t);vn(n,e,i)};Fi.prototype.getGridSpacing=function(){return Tf};Fi.prototype.snapValue=function(n,e){var t=0;e&&e.offset&&(t=e.offset),n+=t,n=ym(n,Tf);var i,r;return e&&e.min&&(i=e.min,se(i)&&(i=ym(i+t,Tf,"ceil"),n=Math.max(n,i))),e&&e.max&&(r=e.max,se(r)&&(r=ym(r+t,Tf,"floor"),n=Math.min(n,r))),n-=t,n};Fi.prototype.isActive=function(){return this.active};Fi.prototype.setActive=function(n){this.active=n,this._eventBus.fire("gridSnapping.toggle",{active:n})};Fi.prototype.toggleActive=function(){this.setActive(!this.active)};Fi.$inject=["elementRegistry","eventBus","config.gridSnapping"];function rF(n,e){var t=n.context,i=t.createConstraints,r=t.resizeConstraints||{},o=t.gridSnappingContext,s=o.snapConstraints;if(s&&s[e])return s[e];s||(s=o.snapConstraints={}),s[e]||(s[e]={});var a=t.direction;i&&(vm(e)?(s.x.min=i.left,s.x.max=i.right):(s.y.min=i.top,s.y.max=i.bottom));var l=r.min,c=r.max;return l&&(vm(e)?vO(a)?s.x.max=l.left:s.x.min=l.right:yO(a)?s.y.max=l.top:s.y.min=l.bottom),c&&(vm(e)?vO(a)?s.x.min=c.left:s.x.max=c.right:yO(a)?s.y.min=c.top:s.y.max=c.bottom),s[e]}function oF(n,e,t){var i=n.context,r=n.shape,o=i.gridSnappingContext,s=o.snapLocation,a=o.snapOffset;return a&&se(a[e])||(a||(a=o.snapOffset={}),se(a[e])||(a[e]=0),!r)||(t.get(r.id)||(vm(e)?a[e]+=r[e]+r.width/2:a[e]+=r[e]+r.height/2),!s)||(e==="x"?/left/.test(s)?a[e]-=r.width/2:/right/.test(s)&&(a[e]+=r.width/2):/top/.test(s)?a[e]-=r.height/2:/bottom/.test(s)&&(a[e]+=r.height/2)),a[e]}function vm(n){return n==="x"}function yO(n){return n.indexOf("n")!==-1}function vO(n){return n.indexOf("w")!==-1}var xO={__depends__:[gO],__init__:["gridSnapping"],gridSnapping:["type",Fi]};var xm="keyboard.keydown",sF="keyboard.keyup",aF=1e3,bO="Keyboard binding is now implicit; explicit binding to an element got removed. For more information, see https://github.com/bpmn-io/diagram-js/issues/661";function Pt(n,e){var t=this;this._config=n=n||{},this._eventBus=e,this._keydownHandler=this._keydownHandler.bind(this),this._keyupHandler=this._keyupHandler.bind(this),e.on("diagram.destroy",function(){t._fire("destroy"),t.unbind()}),n.bindTo&&console.error("unsupported configuration <keyboard.bindTo>",new Error(bO));var i=n&&n.bind!==!1;e.on("canvas.init",function(r){t._target=r.svg,i&&t.bind(),t._fire("init")})}Pt.$inject=["config.keyboard","eventBus"];Pt.prototype._keydownHandler=function(n){this._keyHandler(n,xm)};Pt.prototype._keyupHandler=function(n){this._keyHandler(n,sF)};Pt.prototype._keyHandler=function(n,e){var t;if(!this._isEventIgnored(n)){var i={keyEvent:n};t=this._eventBus.fire(e||xm,i),t&&n.preventDefault()}};Pt.prototype._isEventIgnored=function(n){return!1};Pt.prototype.bind=function(n){n&&console.error("unsupported argument <node>",new Error(bO)),this.unbind(),n=this._node=this._target,q.bind(n,"keydown",this._keydownHandler),q.bind(n,"keyup",this._keyupHandler),this._fire("bind")};Pt.prototype.getBinding=function(){return this._node};Pt.prototype.unbind=function(){var n=this._node;n&&(this._fire("unbind"),q.unbind(n,"keydown",this._keydownHandler),q.unbind(n,"keyup",this._keyupHandler)),this._node=null};Pt.prototype._fire=function(n){this._eventBus.fire("keyboard."+n,{node:this._node})};Pt.prototype.addListener=function(n,e,t){ge(n)&&(t=e,e=n,n=aF),this._eventBus.on(t||xm,n,e)};Pt.prototype.removeListener=function(n,e){this._eventBus.off(e||xm,n)};Pt.prototype.hasModifier=lE;Pt.prototype.isCmd=Mt;Pt.prototype.isShift=Rp;Pt.prototype.isKey=Ve;var lF=500;function kr(n,e){var t=this;n.on("editorActions.init",lF,function(i){var r=i.editorActions;t.registerBindings(e,r)})}kr.$inject=["eventBus","keyboard"];kr.prototype.registerBindings=function(n,e){function t(i,r){e.isRegistered(i)&&n.addListener(r)}t("undo",function(i){var r=i.keyEvent;if(Tp(r))return e.trigger("undo"),!0}),t("redo",function(i){var r=i.keyEvent;if(Ap(r))return e.trigger("redo"),!0}),t("copy",function(i){var r=i.keyEvent;if(cE(r))return e.trigger("copy"),!0}),t("paste",function(i){var r=i.keyEvent;if(uE(r))return e.trigger("paste"),!0}),t("duplicate",function(i){var r=i.keyEvent;if(fE(r))return e.trigger("duplicate"),!0}),t("cut",function(i){var r=i.keyEvent;if(hE(r))return e.trigger("cut"),!0}),t("stepZoom",function(i){var r=i.keyEvent;if(Ve(["+","Add","="],r)&&Mt(r))return e.trigger("stepZoom",{value:1}),!0}),t("stepZoom",function(i){var r=i.keyEvent;if(Ve(["-","Subtract"],r)&&Mt(r))return e.trigger("stepZoom",{value:-1}),!0}),t("zoom",function(i){var r=i.keyEvent;if(Ve("0",r)&&Mt(r))return e.trigger("zoom",{value:1}),!0}),t("removeSelection",function(i){var r=i.keyEvent;if(Ve(["Backspace","Delete","Del"],r))return e.trigger("removeSelection"),!0})};var _o={__init__:["keyboard","keyboardBindings"],keyboard:["type",Pt],keyboardBindings:["type",kr]};function Ba(n){n.invoke(kr,this)}fe(Ba,kr);Ba.$inject=["injector"];Ba.prototype.registerBindings=function(n,e){kr.prototype.registerBindings.call(this,n,e);function t(i,r){e.isRegistered(i)&&n.addListener(r)}t("selectElements",function(i){var r=i.keyEvent;if(n.isKey(["a","A"],r)&&n.isCmd(r))return e.trigger("selectElements"),!0}),t("lassoTool",function(i){var r=i.keyEvent;if(!n.hasModifier(r)&&n.isKey(["l","L"],r))return e.trigger("lassoTool"),!0}),t("handTool",function(i){var r=i.keyEvent;if(!n.hasModifier(r)&&n.isKey(["h","H"],r))return e.trigger("handTool"),!0}),t("directEditing",function(i){var r=i.keyEvent;if(!n.hasModifier(r)&&n.isKey(["e","E"],r))return e.trigger("directEditing"),!0}),t("find",function(i){var r=i.keyEvent;if(n.isKey(["f","F"],r)&&n.isCmd(r))return e.trigger("find"),!0})};var _O={__depends__:[_o],__init__:["keyboardBindings"],keyboardBindings:["type",Ba]};var cF={moveSpeed:50,moveSpeedAccelerated:200};function bm(n,e,t){var i=this;this._config=T({},cF,n||{}),e.addListener(r);function r(o){var s=o.keyEvent,a=i._config;if(e.isCmd(s)&&e.isKey(["ArrowLeft","Left","ArrowUp","Up","ArrowDown","Down","ArrowRight","Right"],s)){var l=e.isShift(s)?a.moveSpeedAccelerated:a.moveSpeed,c;switch(s.key){case"ArrowLeft":case"Left":c="left";break;case"ArrowUp":case"Up":c="up";break;case"ArrowRight":case"Right":c="right";break;case"ArrowDown":case"Down":c="down";break}return i.moveCanvas({speed:l,direction:c}),!0}}this.moveCanvas=function(o){var s=0,a=0,l=o.speed,c=l/Math.min(Math.sqrt(t.viewbox().scale),1);switch(o.direction){case"left":s=c;break;case"up":a=c;break;case"right":s=-c;break;case"down":a=-c;break}t.scroll({dx:s,dy:a})}}bm.$inject=["config.keyboardMove","keyboard","canvas"];var wO={__depends__:[_o],__init__:["keyboardMove"],keyboardMove:["type",bm]};var uF={moveSpeed:1,moveSpeedAccelerated:10},fF=1500,CO="left",EO="up",SO="right",OO="down",hF={ArrowLeft:CO,Left:CO,ArrowUp:EO,Up:EO,ArrowRight:SO,Right:SO,ArrowDown:OO,Down:OO},dF={left:function(n){return{x:-n,y:0}},up:function(n){return{x:0,y:-n}},right:function(n){return{x:n,y:0}},down:function(n){return{x:0,y:n}}};function _m(n,e,t,i,r){var o=this;this._config=T({},uF,n||{}),e.addListener(fF,function(s){var a=s.keyEvent,l=hF[a.key];if(l&&!e.isCmd(a)){var c=e.isShift(a);return o.moveSelection(l,c),!0}}),this.moveSelection=function(s,a){var l=r.get();if(l.length){var c=this._config[a?"moveSpeedAccelerated":"moveSpeed"],u=dF[s](c),f=i.allowed("elements.move",{shapes:l,hints:{keyboardMove:!0}});f&&t.moveElements(l,u)}}}_m.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];var kO={__depends__:[_o,ht],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",_m]};function ke(n,e){this._handlerMap={},this._stack=[],this._stackIdx=-1,this._currentExecution={actions:[],dirty:[],trigger:null},this._injector=e,this._eventBus=n,this._uid=1,n.on(["diagram.destroy","diagram.clear"],function(){this.clear(!1)},this)}ke.$inject=["eventBus","injector"];ke.prototype.execute=function(n,e){if(!n)throw new Error("command required");this._currentExecution.trigger="execute";let t={command:n,context:e};this._pushAction(t),this._internalExecute(t),this._popAction()};ke.prototype.canExecute=function(n,e){let t={command:n,context:e},i=this._getHandler(n),r=this._fire(n,"canExecute",t);if(r===void 0){if(!i)return!1;i.canExecute&&(r=i.canExecute(e))}return r};ke.prototype.clear=function(n){this._stack.length=0,this._stackIdx=-1,n!==!1&&this._fire("changed",{trigger:"clear"})};ke.prototype.undo=function(){let n=this._getUndoAction(),e;if(n){for(this._currentExecution.trigger="undo",this._pushAction(n);n&&(this._internalUndo(n),e=this._getUndoAction(),!(!e||e.id!==n.id));)n=e;this._popAction()}};ke.prototype.redo=function(){let n=this._getRedoAction(),e;if(n){for(this._currentExecution.trigger="redo",this._pushAction(n);n&&(this._internalExecute(n,!0),e=this._getRedoAction(),!(!e||e.id!==n.id));)n=e;this._popAction()}};ke.prototype.register=function(n,e){this._setHandler(n,e)};ke.prototype.registerHandler=function(n,e){if(!n||!e)throw new Error("command and handlerCls must be defined");let t=this._injector.instantiate(e);this.register(n,t)};ke.prototype.canUndo=function(){return!!this._getUndoAction()};ke.prototype.canRedo=function(){return!!this._getRedoAction()};ke.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]};ke.prototype._getUndoAction=function(){return this._stack[this._stackIdx]};ke.prototype._internalUndo=function(n){let e=n.command,t=n.context,i=this._getHandler(e);this._atomicDo(()=>{this._fire(e,"revert",n),i.revert&&this._markDirty(i.revert(t)),this._revertedAction(n),this._fire(e,"reverted",n)})};ke.prototype._fire=function(n,e,t){arguments.length<3&&(t=e,e=null);let i=e?[n+"."+e,e]:[n],r;t=this._eventBus.createEvent(t);for(let o of i)if(r=this._eventBus.fire("commandStack."+o,t),t.cancelBubble)break;return r};ke.prototype._createId=function(){return this._uid++};ke.prototype._atomicDo=function(n){let e=this._currentExecution;e.atomic=!0;try{n()}finally{e.atomic=!1}};ke.prototype._internalExecute=function(n,e){let t=n.command,i=n.context,r=this._getHandler(t);if(!r)throw new Error("no command handler registered for <"+t+">");this._pushAction(n),e||(this._fire(t,"preExecute",n),r.preExecute&&r.preExecute(i),this._fire(t,"preExecuted",n)),this._atomicDo(()=>{this._fire(t,"execute",n),r.execute&&this._markDirty(r.execute(i)),this._executedAction(n,e),this._fire(t,"executed",n)}),e||(this._fire(t,"postExecute",n),r.postExecute&&r.postExecute(i),this._fire(t,"postExecuted",n)),this._popAction()};ke.prototype._pushAction=function(n){let e=this._currentExecution,t=e.actions,i=t[0];if(e.atomic)throw new Error("illegal invocation in <execute> or <revert> phase (action: "+n.command+")");n.id||(n.id=i&&i.id||this._createId()),t.push(n)};ke.prototype._popAction=function(){let n=this._currentExecution,e=n.trigger,t=n.actions,i=n.dirty;t.pop(),t.length||(this._eventBus.fire("elements.changed",{elements:Bw("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:e}),n.trigger=null)};ke.prototype._markDirty=function(n){let e=this._currentExecution;n&&(n=F(n)?n:[n],e.dirty=e.dirty.concat(n))};ke.prototype._executedAction=function(n,e){let t=++this._stackIdx;e||this._stack.splice(t,this._stack.length,n)};ke.prototype._revertedAction=function(n){this._stackIdx--};ke.prototype._getHandler=function(n){return this._handlerMap[n]};ke.prototype._setHandler=function(n,e){if(!n||!e)throw new Error("command and handler required");if(this._handlerMap[n])throw new Error("overriding handler for command <"+n+">");this._handlerMap[n]=e};var xs={commandStack:["type",ke]};function wm(n,e,t,i){n.on("element.changed",function(r){var o=r.element;(o.parent||o===e.getRootElement())&&(r.gfx=t.getGraphics(o)),r.gfx&&n.fire(ip(o)+".changed",r)}),n.on("elements.changed",function(r){var o=r.elements;o.forEach(function(s){n.fire("element.changed",{element:s})}),i.updateContainments(o)}),n.on("shape.changed",function(r){i.update("shape",r.element,r.gfx)}),n.on("connection.changed",function(r){i.update("connection",r.element,r.gfx)})}wm.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];var Cm={__init__:["changeSupport"],changeSupport:["type",wm]};var RO=Math.min,TO=Math.max;function Mx(n){n.preventDefault()}function Af(n){n.stopPropagation()}function pF(n){return n.nodeType===Node.TEXT_NODE}function mF(n){return[].slice.call(n)}function On(n){this.container=n.container,this.parent=te('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=X("[contenteditable]",this.parent),this.keyHandler=n.keyHandler||function(){},this.resizeHandler=n.resizeHandler||function(){},this.autoResize=at(this.autoResize,this),this.handlePaste=at(this.handlePaste,this)}On.prototype.create=function(n,e,t,i){var r=this,o=this.parent,s=this.content,a=this.container;i=this.options=i||{},e=this.style=e||{};var l=hn(e,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);T(o.style,{width:n.width+"px",height:n.height+"px",maxWidth:n.maxWidth+"px",maxHeight:n.maxHeight+"px",minWidth:n.minWidth+"px",minHeight:n.minHeight+"px",left:n.x+"px",top:n.y+"px",backgroundColor:"#ffffff",position:"absolute",overflow:"visible",border:"1px solid #ccc",boxSizing:"border-box",wordWrap:"normal",textAlign:"center",outline:"none"},l);var c=hn(e,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return T(s.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},c),i.centerVertically&&T(s.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},c),s.innerText=t,q.bind(s,"keydown",this.keyHandler),q.bind(s,"mousedown",Af),q.bind(s,"paste",r.handlePaste),i.autoResize&&q.bind(s,"input",this.autoResize),i.resizable&&this.resizable(e),a.appendChild(o),this.setSelection(s.lastChild,s.lastChild&&s.lastChild.length),o};On.prototype.handlePaste=function(n){var e=this.options,t=this.style;n.preventDefault();var i;if(n.clipboardData?i=n.clipboardData.getData("text/plain"):i=window.clipboardData.getData("Text"),this.insertText(i),e.autoResize){var r=this.autoResize(t);r&&this.resizeHandler(r)}};On.prototype.insertText=function(n){n=gF(n);var e=document.execCommand("insertText",!1,n);e||this._insertTextIE(n)};On.prototype._insertTextIE=function(n){var e=this.getSelection(),t=e.startContainer,i=e.endContainer,r=e.startOffset,o=e.endOffset,s=e.commonAncestorContainer,a=mF(s.childNodes),l,c;if(pF(s)){var u=t.textContent;t.textContent=u.substring(0,r)+n+u.substring(o),l=t,c=r+n.length}else if(t===this.content&&i===this.content){var f=document.createTextNode(n);this.content.insertBefore(f,a[r]),l=f,c=f.textContent.length}else{var h=a.indexOf(t),d=a.indexOf(i);a.forEach(function(p,m){m===h?p.textContent=t.textContent.substring(0,r)+n+i.textContent.substring(o):m>h&&m<=d&&Qe(p)}),l=t,c=r+n.length}l&&c!==void 0&&setTimeout(function(){self.setSelection(l,c)})};On.prototype.autoResize=function(){var n=this.parent,e=this.content,t=parseInt(this.style.fontSize)||12;if(e.scrollHeight>n.offsetHeight||e.scrollHeight<n.offsetHeight-t){var i=n.getBoundingClientRect(),r=e.scrollHeight;n.style.height=r+"px",this.resizeHandler({width:i.width,height:i.height,dx:0,dy:r-i.height})}};On.prototype.resizable=function(){var n=this,e=this.parent,t=this.resizeHandle,i=parseInt(this.style.minWidth)||0,r=parseInt(this.style.minHeight)||0,o=parseInt(this.style.maxWidth)||1/0,s=parseInt(this.style.maxHeight)||1/0;if(!t){t=this.resizeHandle=te('<div class="djs-direct-editing-resize-handle"></div>');var a,l,c,u,f=function(p){Mx(p),Af(p),a=p.clientX,l=p.clientY;var m=e.getBoundingClientRect();c=m.width,u=m.height,q.bind(document,"mousemove",h),q.bind(document,"mouseup",d)},h=function(p){Mx(p),Af(p);var m=RO(TO(c+p.clientX-a,i),o),g=RO(TO(u+p.clientY-l,r),s);e.style.width=m+"px",e.style.height=g+"px",n.resizeHandler({width:c,height:u,dx:p.clientX-a,dy:p.clientY-l})},d=function(p){Mx(p),Af(p),q.unbind(document,"mousemove",h,!1),q.unbind(document,"mouseup",d,!1)};q.bind(t,"mousedown",f)}T(t.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"}),e.appendChild(t)};On.prototype.destroy=function(){var n=this.parent,e=this.content,t=this.resizeHandle;e.innerText="",n.removeAttribute("style"),e.removeAttribute("style"),q.unbind(e,"keydown",this.keyHandler),q.unbind(e,"mousedown",Af),q.unbind(e,"input",this.autoResize),q.unbind(e,"paste",this.handlePaste),t&&(t.removeAttribute("style"),Qe(t)),Qe(n)};On.prototype.getValue=function(){return this.content.innerText.trim()};On.prototype.getSelection=function(){var n=window.getSelection(),e=n.getRangeAt(0);return e};On.prototype.setSelection=function(n,e){var t=document.createRange();n===null?t.selectNodeContents(this.content):(t.setStart(n,e),t.setEnd(n,e));var i=window.getSelection();i.removeAllRanges(),i.addRange(t)};function gF(n){return n.replace(/\r\n|\r|\n/g,`
[all...]