@g1cloud/bpmn-modeler-next 5.0.0-alpha.83 → 5.0.0-alpha.84
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
`),A=Math.max(...R.map(L=>po(L,Gw))),O=Math.max(100,Math.min(zL,Math.ceil(A)+Vw)),$=R.reduce((L,N)=>L+Math.max(1,Math.ceil((po(N,Gw)+Vw)/O)),0);return{width:O,height:Math.max(30,$*HL+10)}};for(const _ of C){const R=_.association,A=((f0=_.placement)==null?void 0:f0.anchor)??(R?R.source===_.annotation.id?R.target:R.source:void 0),O=A?f(A):void 0,$=O?zw(O):void 0,L=GL(_.annotation.text??"");let N;if($&&_.placement){const[ae,_e]=Ds[_.placement.side],re=_.placement.offset??50;N={x:$.x+$.width/2+ae*($.width/2+L.width/2+re),y:$.y+$.height/2+_e*($.height/2+L.height/2+re)}}else $?(N={x:$.x+$.width/2+180+ls%3*260,y:$.y-110-ls%2*95},ls++):(N={x:300+ls*260,y:60},ls++);const j=O?d(O)??u():u(),H=j;$&&typeof H.x=="number"&&typeof H.width=="number"&&H.type==="bpmn:Participant"&&(N=Su(o,$,L,H,_.placement?{placement:_.placement}:{from:N}));const Y=n.createShape({type:"bpmn:TextAnnotation",width:L.width,height:L.height,businessObject:i.create("bpmn:TextAnnotation",{id:_.annotation.id,text:_.annotation.text})},N,j);if(R){const ae=_e=>_e===_.annotation.id?Y:p(_e);n.connect(ae(R.source),ae(R.target),R.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:R.id})}:{type:"bpmn:Association"})}_.placement&&P(Y,"bwl:Placement",B(_.placement))}for(const _ of en(e,"association.add")){const R=_.association;n.connect(p(R.source),p(R.target),R.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:R.id})}:{type:"bpmn:Association"})}for(const _ of en(e,"node.update")){let R=p(_.id);if(_.type&&Os(_.type)!==R.type&&(R=c.replaceElement(R,{type:Os(_.type)})),_.name!==void 0&&n.updateProperties(R,{name:_.name??void 0}),_.lane||_.band!==void 0){_.band!==void 0&&n.updateProperties(R,{"bwl:band":_.band});const A=R.y+R.height/2,O=d(R),$=_.lane?p(_.lane):((O==null?void 0:O.children)??[]).find(N=>N.type==="bpmn:Lane"&&A>=N.y&&A<=N.y+N.height);_.band!==void 0&&st($==null?void 0:$.id,_.band,O);const L=$?$.y+(_.band===void 0?$.height/2:Math.min($.height/2,ye)+w($.id,_.band)*I):_.band!==void 0&&O?O.y+oe+w(`pool:${O.id}`,_.band)*I:void 0;if(L!==void 0){const N=L-A;N!==0&&n.moveElements([R],{x:0,y:N})}}}for(const _ of en(e,"sequenceFlow.update")){const R=p(_.id);if(_.source!==void 0||_.target!==void 0){const A=R,O=_.source!==void 0?p(_.source):A.source,$=_.target!==void 0?p(_.target):A.target,L=N=>({x:N.x+N.width/2,y:N.y+N.height/2});n.reconnect(A,O,$,[L(O),L($)])}_.name!==void 0&&n.updateProperties(R,{name:_.name??void 0}),_.condition!==void 0&&n.updateProperties(R,{name:((d0=_.condition)==null?void 0:d0.label)??void 0})}for(const _ of en(e,"messageFlow.update"))_.name!==void 0&&n.updateProperties(p(_.id),{name:_.name??void 0});for(const _ of en(e,"dataStore.update"))_.name!==void 0&&n.updateProperties(p(_.id),{name:_.name??void 0});for(const _ of en(e,"annotation.update")){const R=p(_.id);if(_.text!==void 0&&n.updateProperties(R,{text:_.text}),_.placement===null)P(R,"bwl:Placement",null);else if(_.placement){const A=p(_.placement.anchor),O=zw(A),$=d(A)??u(),L=typeof $.x=="number"&&typeof $.width=="number"&&$.type==="bpmn:Participant",[N,j]=Ds[_.placement.side],H=_.placement.offset??50,Y={x:O.x+O.width/2+N*(O.width/2+R.width/2+H),y:O.y+O.height/2+j*(O.height/2+R.height/2+H)},ae=L?Su(o,O,{width:R.width,height:R.height},$,{placement:_.placement,selfId:_.id}):Y;n.moveElements([R],{x:ae.x-(R.x+R.width/2),y:ae.y-(R.y+R.height/2)}),P(R,"bwl:Placement",B(_.placement))}}for(const _ of en(e,"group.update")){const R=p(_.id);if(_.name!==void 0&&n.updateLabel(R,_.name??""),_.members){const A=_.members.map(f).filter(O=>!!O);A.length&&n.resizeShape(R,Cd(A,_.id)),P(R,"bwl:Members",{refs:_.members.join(" ")})}}}function Ru(e){switch(e.kind){case"annotation-over-label":return[e.annotation];case"edge-crosses-shape":return[e.shape];case"shape-outside-container":return[e.shape];case"shape-overlap":return e.shapes;default:return[]}}function iS(e,t,n){var u,f;const{elementRegistry:i}=e,r=e.modeling,o=p=>At(p).filter(d=>!t.has(Rt(d))),a=p=>{var d;return((d=i.get(p))==null?void 0:d.type)==="bpmn:TextAnnotation"},s=nt(i),c=o(s),l=[...new Set(c.flatMap(Ru))].filter(p=>n.has(p)&&a(p));if(l.length)for(const p of l){const d=i.get(p);if(!d||typeof d.x!="number"||typeof d.width!="number")continue;let m=d.parent,h;for(;m;){if(m.type==="bpmn:Participant"){h=m;break}m=m.parent}if(!h){const ye=d.x+d.width/2,Ve=d.y+d.height/2;h=i.getAll().find(He=>{if(He.type!=="bpmn:Participant")return!1;const it=He;return typeof it.x=="number"&&typeof it.width=="number"&&ye>=it.x&&ye<=it.x+it.width&&Ve>=it.y&&Ve<=it.y+it.height})}if(!h||typeof h.x!="number"||typeof h.width!="number")continue;const v=(((u=d.businessObject.extensionElements)==null?void 0:u.values)??[]).find(ye=>ye.$type==="bwl:Placement"),g=[...d.incoming??[],...d.outgoing??[]].find(ye=>ye.type==="bpmn:Association"),b=(v!=null&&v.anchor?i.get(v.anchor):void 0)??(g?((f=g.source)==null?void 0:f.id)===p?g.target:g.source:void 0);if(!b)continue;const x=b.waypoints,C=x!=null&&x.length?{x:x[Math.floor((x.length-1)/2)].x,y:x[Math.floor((x.length-1)/2)].y,width:0,height:0}:{x:b.x,y:b.y,width:b.width,height:b.height},M={width:d.width,height:d.height},k={x:d.x+d.width/2,y:d.y+d.height/2},P=v==null?void 0:v.side,B=[];P&&P in Ds&&B.push(Su(i,C,M,h,{placement:{side:P,offset:(v==null?void 0:v.offset)??null},selfId:p}));for(const[ye,Ve]of[[-1,0],[1,0],[0,-1],[0,1]])for(let He=1;He<=nS;He++)B.push({x:k.x+ye*em*He,y:k.y+Ve*em*He});const D={...s,edges:s.edges.filter(ye=>ye.id!==(g==null?void 0:g.id))},I=o(D),z=I.filter(ye=>Ru(ye).includes(p)).length;if(!z)continue;let oe;for(const ye of B){const Ve=ye.x-k.x,He=ye.y-k.y;if(!Ve&&!He||ye.x-M.width/2<h.x||ye.x+M.width/2>h.x+h.width||ye.y-M.height/2<h.y||ye.y+M.height/2>h.y+h.height)continue;const it={...D,shapes:D.shapes.map(xe=>xe.id===p?{...xe,x:xe.x+Ve,y:xe.y+He}:xe)},K=o(it),Z=K.filter(xe=>Ru(xe).includes(p)).length;if(Z>=z||K.length>I.length)continue;const se=Math.abs(Ve)+Math.abs(He);if((!oe||Z<oe.mine||Z===oe.mine&&(K.length<oe.all||K.length===oe.all&&se<oe.dist))&&(oe={x:ye.x,y:ye.y,mine:Z,all:K.length,dist:se}),oe.mine===0&&oe.all<I.length)break}oe&&r.moveElements([d],{x:oe.x-k.x,y:oe.y-k.y})}}const rS=60;function oS(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=u=>At(u).filter(f=>!t.has(Rt(f))),a=u=>u.filter(f=>f.kind==="pool-overlap"),s=new Map(n.shapes.map(u=>[u.id,u])),c=(u,f)=>f.x>=u.x&&f.y>=u.y&&f.x+f.width<=u.x+u.width&&f.y+f.height<=u.y+u.height,l=u=>{if(!s.get(u))return[u];const p=new Set,d=new Set([u]);for(let h=0;h<4;h++){let y=!1;for(const v of n.shapes)v.type!=="bpmn:Group"||p.has(v.id)||[...d].some(g=>{const b=s.get(g);return b&&c(v,b)})&&(p.add(v.id),y=!0);for(const v of n.shapes)v.type!=="bpmn:Participant"||d.has(v.id)||[...p].some(g=>{const b=s.get(g);return b&&c(b,v)})&&(d.add(v.id),y=!0);if(!y)break}const m=n.shapes.filter(h=>!h.parent&&!d.has(h.id)&&!p.has(h.id)&&h.type!=="bpmn:Group"&&h.type!=="bpmn:Participant").filter(h=>[...p].some(y=>{const v=s.get(y);return v&&c(v,h)})).map(h=>h.id);return[...d,...p,...m]};for(let u=0;u<6;u++){const f=nt(i),p=o(f),d=a(p);if(!d.length)return;const m=new Map(f.shapes.map(x=>[x.id,x]));let h=null;for(const x of d){if(x.kind!=="pool-overlap")continue;const[C,M]=x.pools,k=m.get(C),P=m.get(M);if(!k||!P)continue;const[B,D]=k.x<=P.x?[k,P]:[P,k];if(x.contained)continue;const I=s.get(B.id),z=s.get(D.id),oe=I&&z?Math.max(z.x-(I.x+I.width),0):rS,ye=B.x+B.width+oe-D.x;if(ye<=0)continue;const Ve=l(D.id).filter(He=>i.get(He));Ve.length&&(!h||ye>h.dx)&&(h={movers:Ve,dx:ye})}if(!h)return;const y=h.movers.map(x=>i.get(x)).filter(x=>!!x&&typeof x.x=="number");if(!y.length)return;const v=p.length,g=d.length;r.moveElements(y,{x:h.dx,y:0});const b=o(nt(i));if(!(a(b).length<g&&b.length<=v)){r.moveElements(y,{x:-h.dx,y:0});return}}}function aS(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=l=>At(l).filter(u=>!t.has(Rt(u))),a=(l,u)=>u.x>=l.x&&u.y>=l.y&&u.x+u.width<=l.x+l.width&&u.y+u.height<=l.y+l.height,s=l=>({l:Math.min(...l.map(u=>u.x)),t:Math.min(...l.map(u=>u.y)),r:Math.max(...l.map(u=>u.x+u.width)),b:Math.max(...l.map(u=>u.y+u.height))}),c=n.shapes.filter(l=>{var u;return l.type==="bpmn:Group"&&!((u=l.members)!=null&&u.length)});if(c.length)for(const l of c){const u=i.get(l.id);if(!u||typeof u.x!="number")continue;const f=n.shapes.filter(M=>M.id!==l.id&&M.type!=="bpmn:Group"&&a(l,M));if(!f.length)continue;const p=f.map(M=>i.get(M.id)).filter(M=>!!M&&typeof M.x=="number");if(p.length!==f.length)continue;const d=s(f),m=s(p),h=m.l+(l.x-d.l),y=m.t+(l.y-d.t),v=m.r+(l.x+l.width-d.r),g=m.b+(l.y+l.height-d.b),b={x:h,y,width:v-h,height:g-y};if(b.width<=0||b.height<=0||Math.abs(b.x-u.x)<1&&Math.abs(b.y-u.y)<1&&Math.abs(b.width-u.width)<1&&Math.abs(b.height-u.height)<1)continue;const x=o(nt(i)).length,C={x:u.x,y:u.y,width:u.width,height:u.height};r.resizeShape(u,b),o(nt(i)).length>x&&r.resizeShape(u,C)}}function nm(e,t,n=tm){const i=Qh(e),r=Zh(t,Eh(i.elementRegistry)),o={edgeCrossings:{before:0,after:0,pairs:[],solidPairs:0,dashedPairs:0,mixedPairs:0,crossPoolMessages:0}};if(r.length)return{ok:!1,issues:r,findings:[],stats:o};const a=nt(i.elementRegistry),s=new Set(At(a).map(Rt)),c=new Set(a.edges.map(g=>g.id)),l=new Set(a.shapes.map(g=>g.id)),u=Rs(a),f=u.length,p=new Set(u.map(([g,b])=>`${g}|${b}`)),d=new Map;for(const g of i.elementRegistry.filter(b=>"waypoints"in b&&!!b.waypoints))g.label&&d.set(g.id,{wps:g.waypoints.map(b=>({x:b.x,y:b.y})),label:{x:g.label.x,y:g.label.y}});const m=e.get("commandStack");try{Od(m,()=>{n(t,i),oS(i,s,a),aS(i,s,a),Th(i,c);const g=bu(i,s);Ah(i,p,c),jh(i,s,c),Dh(i,c),V1(i,c),Bh(i,s,c),q1(i,s,c),Wh(i,s,c),Vh(i,c),Yh(i,l),iS(i,s,l),bu(i,s,g),qh(i,s),Gh(i,d)})}catch(g){return{ok:!1,issues:[{kind:"lower-failed",message:g instanceof Error?g.message:String(g)}],findings:[],stats:o}}const h=nt(i.elementRegistry),y=At(h).filter(g=>!s.has(Rt(g))),v=mh(h);return{ok:!0,issues:[],findings:y,stats:{edgeCrossings:{before:f,after:v.pairs.length,pairs:v.pairs,solidPairs:v.solidPairs,dashedPairs:v.dashedPairs,mixedPairs:v.mixedPairs,crossPoolMessages:v.crossPoolMessages}}}}function sS(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function im(e,t){return typeof e.get=="function"?e.get(t):e[t]}function rm(e,t){const n=im(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function om(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(r=>(r==null?void 0:r.$type)===t)}function cS(e){return typeof e=="string"&&Yl.includes(e)}function ui(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function am(e){const t=e.rootElements??[],n=t.find(K=>K.$type==="bpmn:Collaboration"),i=new Map(t.filter(K=>K.$type==="bpmn:Process").map(K=>[K.id,K])),r=[],o=[],a=[],s=[],c=[],l=[],u={poolOrders:{},bands:{},placements:{},afterColumns:{}},f=[],p=[],d=[],m=[],h=[],y=[],v=[],g=new Set,b=new Set,x=K=>{K&&g.add(K)},C=K=>{g.add(K),b.add(K)},M=K=>{const Z=om(K,"bwl:Placement");if(!Z)return;const se=typeof Z.anchor=="string"?Z.anchor:void 0;if(!se||!cS(Z.side))return;const xe=typeof Z.offset=="number"?Z.offset:void 0;h.push({owner:K.id,anchor:se,side:Z.side,...xe!==void 0?{offset:xe}:{}})},k=K=>{const Z=om(K,"bwl:Members"),se=typeof(Z==null?void 0:Z.refs)=="string"?Z.refs.split(/\s+/).filter(Boolean):[];se.length&&v.push({owner:K.id,refs:se})},P=K=>{var Z;for(const se of K)switch(x(se.id),se.$type){case"bpmn:TextAnnotation":C(se.id),s.push({id:se.id,text:typeof se.text=="string"?se.text:""}),M(se);break;case"bpmn:Association":d.push({id:se.id,type:se.$type,source:ui(se.sourceRef),target:ui(se.targetRef)});break;case"bpmn:Group":{C(se.id);const xe=(Z=se.categoryValueRef)==null?void 0:Z.value;c.push({id:se.id,...typeof xe=="string"&&xe?{name:xe}:{}}),k(se);break}default:l.push({id:se.id,type:se.$type,reason:"type-outside-mvp"})}},B=K=>{for(const Z of K.flowElements??[])x(Z.id),l.push({id:Z.id,type:Z.$type,reason:"inside-container"}),(Z.flowElements??[]).length&&B(Z);for(const Z of K.artifacts??[])x(Z.id),l.push({id:Z.id,type:Z.$type,reason:"inside-container"})},D=(K,Z)=>{const se=K.flowElements??[],xe=(K.laneSets??[]).flatMap(V=>V.lanes??[]),q=new Map;for(const V of xe){x(V.id);for(const ne of V.flowNodeRef??[]){const Te=ui(ne);Te&&q.set(Te,V.id)}}for(const V of se){if(x(V.id),V.$type==="bpmn:SequenceFlow"){f.push({id:V.id,source:ui(V.sourceRef),target:ui(V.targetRef),...typeof V.name=="string"&&V.name?{name:V.name}:{}});continue}if(V.$type==="bpmn:DataStoreReference"){C(V.id),a.push({id:V.id,...V.name?{name:V.name}:{}});continue}const ne=sS(V.$type);if(!Ad(ne)){l.push({id:V.id,type:V.$type,reason:"type-outside-mvp"});continue}C(V.id);const Te=ne==="boundaryEvent"?ui(V.attachedToRef):void 0;o.push({id:V.id,type:ne,...V.name?{name:V.name}:{},...Z?{participant:Z}:{},...q.has(V.id)?{lane:q.get(V.id)}:{},...Te?{attachedTo:Te}:{}}),ne==="subProcess"&&B(V);const yt=rm(V,"bwl:band");yt!==void 0&&(u.bands[V.id]=yt);const T=im(V,"bwl:afterColumn");typeof T=="string"&&T!==""&&y.push([V.id,T]);for(const w of V.dataOutputAssociations??[])x(w.id),m.push({id:w.id,type:w.$type,source:V.id,target:ui(w.targetRef)});for(const w of V.dataInputAssociations??[])x(w.id),m.push({id:w.id,type:w.$type,source:ui((w.sourceRef??[])[0]),target:V.id})}P(K.artifacts??[])};if(n){const K=new Set;for(const Z of n.participants??[]){C(Z.id);const se=ui(Z.processRef);se&&K.add(se);const xe=se?i.get(se):void 0,q=((xe==null?void 0:xe.laneSets)??[]).flatMap(yt=>yt.lanes??[]),V=q.map(yt=>({id:yt.id,...yt.name?{name:yt.name}:{}}));for(const yt of V)C(yt.id);const ne=!xe||(xe.flowElements??[]).length===0&&q.length===0&&(xe.artifacts??[]).length===0;r.push({id:Z.id,...Z.name?{name:Z.name}:{},...ne?{blackBox:!0}:{},...V.length?{lanes:V}:{}});const Te=rm(Z,"bwl:poolOrder");Te!==void 0&&(u.poolOrders[Z.id]=Te),xe&&D(xe,Z.id)}for(const Z of n.messageFlows??[])x(Z.id),p.push({id:Z.id,source:ui(Z.sourceRef),target:ui(Z.targetRef),...typeof Z.name=="string"&&Z.name?{name:Z.name}:{}});P(n.artifacts??[]);for(const[Z,se]of i)!K.has(Z)&&(se.flowElements??[]).length>0&&l.push({id:Z,type:se.$type,reason:"unreachable-process"})}else for(const K of i.values())D(K);const I=[],z=[],oe=[],ye=[],Ve=(K,Z)=>!!K&&!!Z&&b.has(K)&&b.has(Z);for(const K of f){if(!Ve(K.source,K.target)){l.push({id:K.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}I.push({id:K.id,source:K.source,target:K.target,...K.name?{name:K.name}:{}}),b.add(K.id)}for(const K of p){if(!Ve(K.source,K.target)){l.push({id:K.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}z.push({id:K.id,source:K.source,target:K.target,...K.name?{name:K.name}:{}}),b.add(K.id)}for(const K of m){if(!Ve(K.source,K.target)){l.push({id:K.id??"",type:K.type,reason:"endpoint-outside-mvp"});continue}ye.push({...K.id?{id:K.id}:{},source:K.source,target:K.target}),K.id&&b.add(K.id)}for(const K of d){if(!Ve(K.source,K.target)){l.push({id:K.id??"",type:K.type,reason:"endpoint-outside-mvp"});continue}oe.push({...K.id?{id:K.id}:{},source:K.source,target:K.target})}const He=new Map(c.map(K=>[K.id,K]));for(const{owner:K,refs:Z}of v){const se=Z.filter(q=>g.has(q)),xe=He.get(K);xe&&se.length&&(xe.members=se)}for(const K of h)g.has(K.anchor)&&(u.placements[K.owner]={anchor:K.anchor,side:K.side,...K.offset!==void 0?{offset:K.offset}:{}});for(const[K,Z]of y)g.has(Z)&&(u.afterColumns[K]=Z);return{definition:{...r.length?{participants:r}:{},nodes:o,sequenceFlows:I,...z.length?{messageFlows:z}:{},...a.length?{dataStores:a}:{},...ye.length?{dataAssociations:ye}:{},...s.length?{annotations:s}:{},...oe.length?{associations:oe}:{},...c.length?{groups:c}:{}},hints:u,omitted:l}}async function lS(e){const{definitions:t,warnings:n}=await lo(e);return{...am(t),warnings:n}}const uS=new Set(["bpmn:ExclusiveGateway","bpmn:ParallelGateway","bpmn:InclusiveGateway","bpmn:EventBasedGateway","bpmn:ComplexGateway"]);function Cu(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function pS(e){return Cu(e.processRef)!==void 0}function fS(e){const t=new Set,n=r=>{const o=Cu(r);o&&t.add(o)},i=r=>{for(const o of r.flowElements??[]){n(o.sourceRef),n(o.targetRef),o.attachedToRef&&(n(o.attachedToRef),t.add(o.id));for(const a of o.dataOutputAssociations??[])t.add(o.id),n(a.targetRef);for(const a of o.dataInputAssociations??[]){t.add(o.id);for(const s of a.sourceRef??[])n(s)}(o.flowElements??[]).length&&i(o)}for(const o of r.artifacts??[])n(o.sourceRef),n(o.targetRef)};for(const r of e.rootElements??[])if(r.$type==="bpmn:Process")i(r);else if(r.$type==="bpmn:Collaboration"){for(const o of r.messageFlows??[])n(o.sourceRef),n(o.targetRef);for(const o of r.artifacts??[])n(o.sourceRef),n(o.targetRef)}return t}function dS(e){const t=[],n=i=>{for(const r of i.flowElements??[])uS.has(r.$type)&&t.push(r),(r.flowElements??[]).length&&n(r)};for(const i of e.rootElements??[])i.$type==="bpmn:Process"&&n(i);return t}function hS(e){if(!e)return!0;const t=(e.laneSets??[]).flatMap(n=>n.lanes??[]);return(e.flowElements??[]).length===0&&t.length===0&&(e.artifacts??[]).length===0}function Au(e){const t=[],n=e.rootElements??[],i=fS(e);for(const o of dS(e))i.has(o.id)||t.push({ruleId:"CHK-FLOW-1",severity:"warning",targetKind:"flowNode",targetRefs:[o.id],params:{type:o.$type}});const r=n.find(o=>o.$type==="bpmn:Collaboration");if(r){const o=new Map(n.filter(s=>s.$type==="bpmn:Process").map(s=>[s.id,s])),a=[];for(const s of r.participants??[])pS(s)&&hS(o.get(Cu(s.processRef)))&&a.push(s.id);a.length&&t.push({ruleId:"CHK-POOL-1",severity:"info",targetKind:"participant",targetRefs:a,params:{count:a.length}})}return t}async function mS(e){const{definitions:t,warnings:n}=await lo(e);return{issues:Au(t),warnings:n}}const gS=.5,yS=8,vS=new Set(["bpmn:Definitions","bpmn:Collaboration","bpmn:Process","bpmn:LaneSet","bpmn:ExtensionElements","bpmn:Documentation","bpmn:Relationship","bpmn:Property","bpmn:Category","bpmn:CategoryValue"]),vo=e=>typeof e=="number"?e:Number(e??NaN),Is=e=>{if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:""};function bS(e){const t=e,n=[],i=typeof t.name=="string"?t.name:typeof t.text=="string"?t.text:"";n.push(`n=${i.replace(/\s+/g," ").trim()}`);for(const o of["sourceRef","targetRef","attachedToRef","processRef","default"])t[o]!==void 0&&n.push(`${o}=${Is(t[o])}`);if(String(e.$type)==="bpmn:Group"){const o=t.categoryValueRef,a=Array.isArray(o)?o:o==null?[]:[o];n.push(`cat=[${a.map(s=>`${Is(s)}:${typeof(s==null?void 0:s.value)=="string"?s.value:""}`).sort().join(",")}]`)}Array.isArray(t.flowNodeRef)&&n.push(`lane=[${t.flowNodeRef.map(Is).sort().join(",")}]`);const r=t.conditionExpression;return r&&typeof r.body=="string"&&n.push(`cond=${r.body}`),n.join("|")}function xS(e){const t=new Map,n=new Map,i=(a,s)=>{a&&t.set(a,[...t.get(a)??[],...s])},r=a=>{const s=a;return s?[vo(s.x),vo(s.y),vo(s.width),vo(s.height)]:[]},o=a=>{if(Array.isArray(a))return a.forEach(o);if(!a||typeof a!="object")return;const s=a,c=String(s.$type??"");if(c==="bpmndi:BPMNShape"||c==="bpmndi:BPMNEdge"){const l=Is(s.bpmnElement);if(c==="bpmndi:BPMNShape")i(l,r(s.bounds));else{const f=Array.isArray(s.waypoint)?s.waypoint:[];i(l,f.flatMap(p=>[vo(p.x),vo(p.y)]))}const u=s.label;u!=null&&u.bounds&&l&&n.set(l,r(u.bounds).slice(0,2));return}for(const l of Object.values(s))(Array.isArray(l)||l&&typeof l=="object"&&"$type"in l)&&o(l)};return o(e.diagrams),{body:t,labels:n}}function sm(e){const t=xS(e),n=new Map,i=new Set,r=o=>{if(Array.isArray(o))return o.forEach(r);if(!o||typeof o!="object"||i.has(o))return;i.add(o);const a=o,s=String(a.$type??"");if(s.startsWith("bpmndi:")||s.startsWith("dc:")||s.startsWith("di:"))return;const c=typeof a.id=="string"?a.id:"";c&&s.startsWith("bpmn:")&&!vS.has(s)&&n.set(c,{type:s,props:bS(a),geometry:(t.body.get(c)??[]).join(","),label:(t.labels.get(c)??[]).join(",")});for(const l of Object.values(a))(Array.isArray(l)||l&&typeof l=="object")&&r(l)};return r(e),n}function cm(e,t,n){if(e===t)return!1;const i=e===""?[]:e.split(",").map(Number),r=t===""?[]:t.split(",").map(Number);return i.length!==r.length?!0:i.some((o,a)=>Math.abs(o-r[a])>n)}function lm(e,t,n={}){const i=n.moveTolerance??gS,r=sm(e),o=sm(t),a=[],s=[],c=[];for(const[l,u]of o){const f=r.get(l);if(!f){a.push(l);continue}(f.type!==u.type||f.props!==u.props||cm(f.geometry,u.geometry,i)||cm(f.label,u.label,n.labelTolerance??yS))&&c.push(l)}for(const l of r.keys())o.has(l)||s.push(l);return{added:a.sort(),removed:s.sort(),modified:c.sort()}}async function _S(e,t,n={}){const[i,r]=await Promise.all([lo(e),lo(t)]);return{...lm(i.definitions,r.definitions,n),warnings:[...i.warnings,...r.warnings]}}function wS(e){return new Set([...e.added,...e.modified])}function ES(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function um(e,t,{currentVersion:n}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const i=nm(e,t.ops);if(!i.ok)return{status:"rejected",issues:i.issues};const{xml:r}=await e.saveXML({format:!0});return{status:"applied",version:n+1,xml:r??"",findings:i.findings,stats:i.stats}}const SS=Symbol("bpmn-editor"),Pu={geometry:[],semantic:[]};function RS(){const e=ge.ref(!1),t=ge.ref(!0),n=ge.ref(!1),i=ge.shallowRef(Pu),r=ge.shallowRef(void 0);let o,a;const s=()=>{if(!o){i.value=Pu;return}const p=At(nt(o.get("elementRegistry"))),d=o.getDefinitions();i.value={geometry:p,semantic:d?Au(d):[]}},c=()=>{e.value=!0,s()};function l(p,d){p.get("canvas").getContainer().style.pointerEvents=d?"":"none";const m=p.get("keyboard");d?(a&&m.bind(a),a=void 0):a||(a=m.getBinding(),m.unbind())}function u(){if(!o)throw new Error("modeler not attached — 뷰 @ready 후 attach() 필요");return o}function f(){return o==null?void 0:o.get("commandStack")}return{dirty:e,editable:t,agentBusy:n,issues:i,revalidate:s,changeScope:r,setChangeScope(p){r.value=p===void 0?void 0:new Set(p)},requestFocus(p){if(!o)return;const d=o.get("elementRegistry").get(p);d&&(o.get("canvas").scrollToElement(d,180),o.get("selection").select(d))},describeElement(p){const d=o==null?void 0:o.get("elementRegistry").get(p),m=d==null?void 0:d.businessObject;if(!m)return;const h=typeof m.name=="string"&&m.name.trim()!==""?m.name:m.text;return{name:typeof h=="string"&&h.trim()!==""?h.trim():void 0,type:typeof m.$type=="string"?m.$type:""}},attach(p){o&&this.detach(),o=p,o.get("eventBus").on("commandStack.changed",c),t.value||l(o,!1),s()},detach(){o==null||o.get("eventBus").off("commandStack.changed",c),o&&!t.value&&l(o,!0),a=void 0,o=void 0,i.value=Pu,r.value=void 0},setEditable(p){t.value=p,o&&l(o,p)},async applyAgentBatch(p,d){const m=u();n.value=!0;try{const h=await um(m,p,{currentVersion:d});return h.status==="applied"&&(e.value=!1),h}finally{n.value=!1}},async importXml(p){const{warnings:d}=await u().importXML(p);return e.value=!1,r.value=void 0,s(),{warnings:uu(d)}},async saveXml(){const{xml:p}=await u().saveXML({format:!0});return e.value=!1,p??""},undo:()=>{var p;return(p=f())==null?void 0:p.undo()},redo:()=>{var p;return(p=f())==null?void 0:p.redo()},canUndo:()=>{var p;return((p=f())==null?void 0:p.canUndo())??!1},canRedo:()=>{var p;return((p=f())==null?void 0:p.canRedo())??!1}}}function Ee(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function CS(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Mu={exports:{}},pm;function AS(){if(pm)return Mu.exports;pm=1;var e=Mu.exports=function(t,n){if(n||(n=16),t===void 0&&(t=128),t<=0)return"0";for(var i=Math.log(Math.pow(2,t))/Math.log(n),r=2;i===1/0;r*=2)i=Math.log(Math.pow(2,t/r))/Math.log(n)*r;for(var o=i-Math.floor(i),a="",r=0;r<Math.floor(i);r++){var s=Math.floor(Math.random()*n).toString(n);a=s+a}if(o){var c=Math.pow(n,o),s=Math.floor(Math.random()*c).toString(n);a=s+a}var l=parseInt(a,n);return l!==1/0&&l>=Math.pow(2,t)?e(t,n):a};return e.rack=function(t,n,i){var r=function(a){var s=0;do{if(s++>10)if(i)t+=i;else throw new Error("too many ID collisions, use more bits");var c=e(t,n)}while(Object.hasOwnProperty.call(o,c));return o[c]=a,c},o=r.hats={};return r.get=function(a){return r.hats[a]},r.set=function(a,s){return r.hats[a]=s,r},r.bits=t||128,r.base=n||16,r},Mu.exports}var PS=AS(),MS=CS(PS);function yi(e){if(!(this instanceof yi))return new yi(e);e=e||[128,36,1],this._seed=e.length?MS.rack(e[0],e[1],e[2]):e}yi.prototype.next=function(e){return this._seed(e||!0)},yi.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},yi.prototype.claim=function(e,t){this._seed.set(e,t||!0)},yi.prototype.assigned=function(e){return this._seed.get(e)||!1},yi.prototype.unclaim=function(e){delete this._seed.hats[e]},yi.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const qt={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};qt.td=qt.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],qt.option=qt.optgroup=[1,'<select multiple="multiple">',"</select>"],qt.thead=qt.tbody=qt.colgroup=qt.caption=qt.tfoot=[1,"<table>","</table>"],qt.polyline=qt.ellipse=qt.polygon=qt.circle=qt.text=qt.line=qt.path=qt.rect=qt.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function wt(e,t=globalThis.document){var l;if(typeof e!="string")throw new TypeError("String expected");const n=/^<!--(.*?)-->$/s.exec(e);if(n)return t.createComment(n[1]);const i=(l=/<([\w:]+)/.exec(e))==null?void 0:l[1];if(!i)return t.createTextNode(e);if(e=e.trim(),i==="body"){const u=t.createElement("html");u.innerHTML=e;const{lastChild:f}=u;return f.remove(),f}let[r,o,a]=Object.hasOwn(qt,i)?qt[i]:qt._default,s=t.createElement("div");for(s.innerHTML=o+e+a;r--;)s=s.lastChild;if(s.firstChild===s.lastChild){const{firstChild:u}=s;return u.remove(),u}const c=t.createDocumentFragment();return c.append(...s.childNodes),c}function TS(e,t){return t.forEach(function(n){n&&typeof n!="string"&&!Array.isArray(n)&&Object.keys(n).forEach(function(i){if(i!=="default"&&!(i in e)){var r=Object.getOwnPropertyDescriptor(n,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:function(){return n[i]}})}})}),Object.freeze(e)}function wn(e,...t){const n=e.style;return F(t,function(i){i&&F(i,function(r,o){n[o]=r})}),e}function gn(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const kS=Object.prototype.toString;function Ct(e){return new er(e)}function er(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}er.prototype.add=function(e){return this.list.add(e),this},er.prototype.remove=function(e){return kS.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},er.prototype.removeMatching=function(e){const t=this.array();for(let n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},er.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},er.prototype.array=function(){return Array.from(this.list)},er.prototype.has=er.prototype.contains=function(e){return this.list.contains(e)};function Ls(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Lr(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function OS(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Bs={},fm;function DS(){if(fm)return Bs;fm=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return Bs.bind=function(r,o,a,s){return e||i(),r[e](n+o,a,s||!1),a},Bs.unbind=function(r,o,a,s){return t||i(),r[t](n+o,a,s||!1),a},Bs}var dm=DS(),IS=OS(dm),je=TS({__proto__:null,default:IS},[dm]),hm=["focus","blur"];function LS(e,t,n,i,r){return hm.indexOf(n)!==-1&&(r=!0),je.bind(e,n,function(o){var a=o.target||o.srcElement;o.delegateTarget=Lr(a,t,!0),o.delegateTarget&&i.call(e,o)},r)}function BS(e,t,n,i){return hm.indexOf(t)!==-1&&(i=!0),je.unbind(e,t,n,i)}var On={bind:LS,unbind:BS};function Tu(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function ft(e,t){return t=t||document,t.querySelector(e)}function Ns(e,t){return t=t||document,t.querySelectorAll(e)}function vi(e){e.parentNode&&e.parentNode.removeChild(e)}function NS(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function $S(e,t){return t.appendChild(NS(e,t))}function ze(e,t){return $S(t,e),e}var ku=2,mm={"alignment-baseline":1,"baseline-shift":1,clip:1,"clip-path":1,"clip-rule":1,color:1,"color-interpolation":1,"color-interpolation-filters":1,"color-profile":1,"color-rendering":1,cursor:1,direction:1,display:1,"dominant-baseline":1,"enable-background":1,fill:1,"fill-opacity":1,"fill-rule":1,filter:1,"flood-color":1,"flood-opacity":1,font:1,"font-family":1,"font-size":ku,"font-size-adjust":1,"font-stretch":1,"font-style":1,"font-variant":1,"font-weight":1,"glyph-orientation-horizontal":1,"glyph-orientation-vertical":1,"image-rendering":1,kerning:1,"letter-spacing":1,"lighting-color":1,marker:1,"marker-end":1,"marker-mid":1,"marker-start":1,mask:1,opacity:1,overflow:1,"pointer-events":1,"shape-rendering":1,"stop-color":1,"stop-opacity":1,stroke:1,"stroke-dasharray":1,"stroke-dashoffset":1,"stroke-linecap":1,"stroke-linejoin":1,"stroke-miterlimit":1,"stroke-opacity":1,"stroke-width":ku,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function FS(e,t){return mm[t]?e.style[t]:e.getAttributeNS(null,t)}function gm(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=mm[i];r?(r===ku&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function jS(e,t){var n=Object.keys(t),i,r;for(i=0,r;r=n[i];i++)gm(e,r,t[r])}function Se(e,t,n){if(typeof t=="string")if(n!==void 0)gm(e,t,n);else return FS(e,t);else jS(e,t);return e}const HS=Object.prototype.toString;function et(e){return new tr(e)}function tr(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}tr.prototype.add=function(e){return this.list.add(e),this},tr.prototype.remove=function(e){return HS.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},tr.prototype.removeMatching=function(e){const t=this.array();for(let n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},tr.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},tr.prototype.array=function(){return Array.from(this.list)},tr.prototype.has=tr.prototype.contains=function(e){return this.list.contains(e)};function $s(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function ym(e){return e.cloneNode(!0)}var Ou={svg:"http://www.w3.org/2000/svg"},vm='<svg xmlns="'+Ou.svg+'"';function zS(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(Ou.svg)===-1&&(e=vm+e.substring(4)):(e=vm+">"+e+"</svg>",t=!0);var n=GS(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function GS(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function Oe(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=zS(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(Ou.svg,e),t&&Se(n,t),n}var Du=null;function bm(){return Du===null&&(Du=Oe("svg")),Du}function xm(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function VS(e,t,n,i,r,o){var a=bm().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return xm(a,e);case 6:return xm(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}function sa(e){return bm().createSVGTransform()}var _m=/([&<>]{1})/g,WS=/([&<>\n\r"]{1})/g,US={"&":"&","<":"<",">":">",'"':"'"};function Iu(e,t){function n(i,r){return US[r]||r}return e.replace(t,n)}function wm(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(Iu(e.textContent,_m));break;case 1:if(t.push("<",e.tagName),e.hasAttributes())for(r=e.attributes,n=0,i=r.length;n<i;++n)o=r.item(n),t.push(" ",o.name,'="',Iu(o.value,WS),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)wm(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",Iu(e.nodeValue,_m),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function YS(e){for(var t=e.firstChild,n=[];t;)wm(t,n),t=t.nextSibling;return n.join("")}function Em(e,t){return YS(e)}function Kt(e){var t=e.parentNode;return t&&t.removeChild(e),e}function qS(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function KS(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(qS(e,i))}function ca(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),KS(n,t)),n.consolidate()}const XS=/^class[ {]/;function ZS(e){return XS.test(e.toString())}function Lu(e){return Array.isArray(e)}function Bu(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Fs(...e){e.length===1&&Lu(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const QS=/constructor\s*[^(]*\(\s*([^)]*)\)/m,JS=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,eR=/\/\*([^*]*)\*\//m;function tR(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(ZS(e)?QS:JS);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const r=i.match(eR);return(r&&r[1]||i).trim()})||[]}function Sm(e,t){const n=t||{get:function(b,x){if(i.push(b),x===!1)return null;throw s(`No provider for "${b}"!`)}},i=[],r=this._providers=Object.create(n._providers||null),o=this._instances=Object.create(null),a=o.injector=this,s=function(b){const x=i.join(" -> ");return i.length=0,new Error(x?`${b} (Resolving: ${x})`:b)};function c(b,x){if(!r[b]&&b.includes(".")){const C=b.split(".");let M=c(C.shift());for(;C.length;)M=M[C.shift()];return M}if(Bu(o,b))return o[b];if(Bu(r,b)){if(i.indexOf(b)!==-1)throw i.push(b),s("Cannot resolve circular dependency!");return i.push(b),o[b]=r[b][0](r[b][1]),i.pop(),o[b]}return n.get(b,x)}function l(b,x){if(typeof x>"u"&&(x={}),typeof b!="function")if(Lu(b))b=Fs(b.slice());else throw s(`Cannot invoke "${b}". Expected a function!`);const M=(b.$inject||tR(b)).map(k=>Bu(x,k)?x[k]:c(k));return{fn:b,dependencies:M}}function u(b){const{fn:x,dependencies:C}=l(b),M=Function.prototype.bind.call(x,null,...C);return new M}function f(b,x,C){const{fn:M,dependencies:k}=l(b,C);return M.apply(x,k)}function p(b){return Fs(x=>b.get(x))}function d(b,x){if(x&&x.length){const C=Object.create(null),M=Object.create(null),k=[],P=[],B=[];let D,I,z,oe;for(let ye in r)D=r[ye],x.indexOf(ye)!==-1&&(D[2]==="private"?(I=k.indexOf(D[3]),I===-1?(z=D[3].createChild([],x),oe=p(z),k.push(D[3]),P.push(z),B.push(oe),C[ye]=[oe,ye,"private",z]):C[ye]=[B[I],ye,"private",P[I]]):C[ye]=[D[2],D[1]],M[ye]=!0),(D[2]==="factory"||D[2]==="type")&&D[1].$scope&&x.forEach(Ve=>{D[1].$scope.indexOf(Ve)!==-1&&(C[ye]=[D[2],D[1]],M[Ve]=!0)});x.forEach(ye=>{if(!M[ye])throw new Error('No provider for "'+ye+'". Cannot use provider from the parent!')}),b.unshift(C)}return new Sm(b,a)}const m={factory:f,type:u,value:function(b){return b}};function h(b,x){const C=b.__init__||[];return function(){C.forEach(M=>{typeof M=="string"?x.get(M):x.invoke(M)})}}function y(b){const x=b.__exports__;if(x){const C=b.__modules__,M=Object.keys(b).reduce((I,z)=>(z!=="__exports__"&&z!=="__modules__"&&z!=="__init__"&&z!=="__depends__"&&(I[z]=b[z]),I),Object.create(null)),k=(C||[]).concat(M),P=d(k),B=Fs(function(I){return P.get(I)});x.forEach(function(I){r[I]=[B,I,"private",P]});const D=(b.__init__||[]).slice();return D.unshift(function(){P.init()}),b=Object.assign({},b,{__init__:D}),h(b,P)}return Object.keys(b).forEach(function(C){if(C==="__init__"||C==="__depends__")return;const M=b[C];if(M[2]==="private"){r[C]=M;return}const k=M[0],P=M[1];r[C]=[m[k],nR(k,P),k]}),h(b,a)}function v(b,x){return b.indexOf(x)!==-1||(b=(x.__depends__||[]).reduce(v,b),b.indexOf(x)!==-1)?b:b.concat(x)}function g(b){const x=b.reduce(v,[]).map(y);let C=!1;return function(){C||(C=!0,x.forEach(M=>M()))}}this.get=c,this.invoke=f,this.instantiate=u,this.createChild=d,this.init=g(e)}function nR(e,t){return e!=="value"&&Lu(t)&&(t=Fs(t.slice())),t}var iR=1e3;function Ii(e,t){var n=this;t=t||iR,e.on(["render.shape","render.connection"],t,function(i,r){var o=i.type,a=r.element,s=r.gfx,c=r.attrs;if(n.canRender(a))return o==="render.shape"?n.drawShape(s,a,c):n.drawConnection(s,a,c)}),e.on(["render.getShapePath","render.getConnectionPath"],t,function(i,r){if(n.canRender(r))return i.type==="render.getShapePath"?n.getShapePath(r):n.getConnectionPath(r)})}Ii.prototype.canRender=function(e){},Ii.prototype.drawShape=function(e,t){},Ii.prototype.drawConnection=function(e,t){},Ii.prototype.getShapePath=function(e){},Ii.prototype.getConnectionPath=function(e){};function Br(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function rR(e){return["M",e.x,e.y]}function Nu(e){return["L",e.x,e.y]}function oR(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function aR(e,t){const n=e.length,i=[rR(e[0])];for(let r=1;r<n;r++){const o=e[r-1],a=e[r],s=e[r+1];if(!s||!t){i.push(Nu(a));continue}const c=Math.min(t,$u(a.x-o.x,a.y-o.y),$u(s.x-a.x,s.y-a.y));if(!c){i.push(Nu(a));continue}const l=js(a,o,c),u=js(a,o,c*.5),f=js(a,s,c),p=js(a,s,c*.5);i.push(Nu(l)),i.push(oR(u,p,f))}return i}function js(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=$u(i,r),a=n/o;return{x:e.x+i*a,y:e.y+r*a}}function $u(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function la(e,t,n){Fe(t)&&(n=t,t=null),t||(t={});const i=Oe("path",t);return Fe(n)&&(i.dataset.cornerRadius=String(n)),Fu(i,e)}function Fu(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return Se(e,{d:Br(aR(t,n))}),e}function Hs(e){var t=new Set(e);return Ke(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function Nr(e,t,n){n=n||0,Be(e)||(e=[e]),F(e,function(i,r){var o=t(i,r,n);Be(o)&&o.length&&Nr(o,t,n+1)})}function ju(e,t,n){var i=new Set,r=new Set;return Nr(e,function(o,a,s){i.add(o);var c=o.children;if(c&&!r.has(c))return r.add(c),c}),Array.from(i)}function ua(e,t){return ju(e)}function sR(e,t,n){Tr(t)&&(t=!0),Qt(t)&&(n=t,t=!0),n=n||{};var i=pa(n.allShapes),r=pa(n.allConnections),o=pa(n.enclosedElements),a=pa(n.enclosedConnections),s=pa(n.topLevel,t&&oo(e,function(u){return u.id}));function c(u){s[u.source.id]&&s[u.target.id]&&(s[u.id]=[u]),i[u.source.id]&&i[u.target.id]&&(a[u.id]=o[u.id]=u),r[u.id]=u}function l(u){if(o[u.id]=u,u.waypoints)a[u.id]=r[u.id]=u;else return i[u.id]=u,F(u.incoming,c),F(u.outgoing,c),u.children}return Nr(e,l),{allShapes:i,allConnections:r,topLevel:s,enclosedConnections:a,enclosedElements:o}}function Ft(e,t){t=!!t,Be(e)||(e=[e]);var n,i,r,o;return F(e,function(a){var s=a;a.waypoints&&!t&&(s=Ft(a.waypoints,!0));var c=s.x,l=s.y,u=s.height||0,f=s.width||0;(c<n||n===void 0)&&(n=c),(l<i||i===void 0)&&(i=l),(c+f>r||r===void 0)&&(r=c+f),(l+u>o||o===void 0)&&(o=l+u)}),{x:n,y:i,height:o-i,width:r-n}}function bo(e,t){var n={};return F(e,function(i){var r=i;r.waypoints&&(r=Ft(r)),!Fe(t.y)&&r.x>t.x&&(n[i.id]=i),!Fe(t.x)&&r.y>t.y&&(n[i.id]=i),r.x>t.x&&r.y>t.y&&(Fe(t.width)&&Fe(t.height)&&r.width+r.x<t.width+t.x&&r.height+r.y<t.height+t.y||!Fe(t.width)||!Fe(t.height))&&(n[i.id]=i)}),n}function Rm(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function Cm(e){return!!(e&&e.isFrame)}function pa(e,t){return W({},e||{},t||{})}var cR=1;function nr(e,t){Ii.call(this,e,cR),this.CONNECTION_STYLE=t.style(["no-fill"],{strokeWidth:5,stroke:"fuchsia"}),this.SHAPE_STYLE=t.style({fill:"white",stroke:"fuchsia",strokeWidth:2}),this.FRAME_STYLE=t.style(["no-fill"],{stroke:"fuchsia",strokeDasharray:4,strokeWidth:2})}Ee(nr,Ii),nr.prototype.canRender=function(){return!0},nr.prototype.drawShape=function(t,n,i){var r=Oe("rect");return Se(r,{x:0,y:0,width:n.width||0,height:n.height||0}),Cm(n)?Se(r,W({},this.FRAME_STYLE,i||{})):Se(r,W({},this.SHAPE_STYLE,i||{})),ze(t,r),r},nr.prototype.drawConnection=function(t,n,i){var r=la(n.waypoints,W({},this.CONNECTION_STYLE,i||{}));return ze(t,r),r},nr.prototype.getShapePath=function(t){var n=t.x,i=t.y,r=t.width,o=t.height,a=[["M",n,i],["l",r,0],["l",0,o],["l",-r,0],["z"]];return Br(a)},nr.prototype.getConnectionPath=function(t){var n=t.waypoints,i,r,o=[];for(i=0;r=n[i];i++)r=r.original||r,o.push([i===0?"M":"L",r.x,r.y]);return Br(o)},nr.$inject=["eventBus","styles"];function lR(){var e={"no-fill":{fill:"none"},"no-border":{strokeOpacity:0},"no-events":{pointerEvents:"none"}},t=this;this.cls=function(n,i,r){var o=this.style(i,r);return W(o,{class:n})},this.style=function(n,i){!Be(n)&&!i&&(i=n,n=[]);var r=Tn(n,function(o,a){return W(o,e[a]||{})},{});return i?W(r,i):r},this.computeStyle=function(n,i,r){return Be(i)||(r=i,i=[]),t.style(i||[],W({},r,n||{}))}}const uR={__init__:["defaultRenderer"],defaultRenderer:["type",nr],styles:["type",lR]};function Lt(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function Bt(e,t,n){if(!(!e||!t)){typeof n!="number"&&(n=-1);var i=e.indexOf(t);if(i!==-1){if(i===n)return;if(n!==-1)e.splice(i,1);else return}n!==-1?e.splice(n,0,t):e.push(t)}}function Hu(e,t){return!e||!t?-1:e.indexOf(t)}function fa(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function zu(e,t,n,i){if(typeof i>"u"&&(i=5),!e||!t||!n)return!1;var r=(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),o=fa(e,t);return Math.abs(r/o)<=i}var pR=2;function Li(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[r,o]of Object.entries(i))if(fR(r,n))return o;return!1}function fR(e,t){const n=t[0];return kr(t,function(i){return Math.abs(n[e]-i[e])<=pR})}function Am(e,t,n){return n=n||0,e.x>t.x-n&&e.y>t.y-n&&e.x<t.x+t.width+n&&e.y<t.y+t.height+n}function Gu(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var dR=/,?([a-z]),?/gi,Pm=parseFloat,jt=Math,ir=jt.PI,bi=jt.min,xi=jt.max,Mm=jt.pow,rr=jt.abs,hR=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,mR=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,Tm=Array.isArray||function(e){return e instanceof Array};function gR(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function yR(e,t){for(var n=0,i=e.length;n<i;n++)if(e[n]===t)return e.push(e.splice(n,1)[0])}function vR(e){function t(){var n=Array.prototype.slice.call(arguments,0),i=n.join("␀"),r=t.cache=t.cache||{},o=t.count=t.count||[];return gR(r,i)?(yR(o,i),r[i]):(o.length>=1e3&&delete r[o.shift()],o.push(i),r[i]=e(...arguments),r[i])}return t}function bR(e){if(!e)return null;var t={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},n=[];return String(e).replace(hR,function(i,r,o){var a=[],s=r.toLowerCase();for(o.replace(mR,function(c,l){l&&a.push(+l)}),s=="m"&&a.length>2&&(n.push([r,...a.splice(0,2)]),s="l",r=r=="m"?"l":"L");a.length>=t[s]&&(n.push([r,...a.splice(0,t[s])]),!!t[s]););}),n.toString=Wu,n}function xR(e){for(var t=0,n=e.length;t<n;t++){var i=e[t][0];if(typeof i=="string"&&i!==i.toUpperCase())return!1}return!0}function _R(e){for(var t=0,n=e.length;t<n;t++){var i=e[t][0];if(i!=="M"&&i!=="C")return!1}return!0}function Vu(e,t,n,i){return arguments.length===1&&(t=e.y,n=e.width,i=e.height,e=e.x),{x:e,y:t,width:n,height:i,x2:e+n,y2:t+i}}function Wu(){return this.join(",").replace(dR,"$1")}function wR(e){for(var t=new Array(e.length),n=0,i=e.length;n<i;n++)for(var r=e[n],o=t[n]=new Array(r.length),a=0,s=r.length;a<s;a++)o[a]=r[a];return t.toString=Wu,t}function km(e,t,n,i,r,o,a,s,c){var l=1-c,u=Mm(l,3),f=Mm(l,2),p=c*c,d=p*c,m=u*e+f*3*c*n+l*3*c*c*r+d*a,h=u*t+f*3*c*i+l*3*c*c*o+d*s;return{x:zs(m),y:zs(h)}}function Om(e){var t=PR(...e);return Vu(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function or(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function ER(e,t){return e=Vu(e),t=Vu(t),or(t,e.x,e.y)||or(t,e.x2,e.y)||or(t,e.x,e.y2)||or(t,e.x2,e.y2)||or(e,t.x,t.y)||or(e,t.x2,t.y)||or(e,t.x,t.y2)||or(e,t.x2,t.y2)||(e.x<t.x2&&e.x>t.x||t.x<e.x2&&t.x>e.x)&&(e.y<t.y2&&e.y>t.y||t.y<e.y2&&t.y>e.y)}function Dm(e,t,n,i,r){var o=-3*t+9*n-9*i+3*r,a=e*o+6*t-12*n+6*i;return e*a-3*t+3*n}function Im(e,t,n,i,r,o,a,s,c){c==null&&(c=1),c=c>1?1:c<0?0:c;for(var l=c/2,u=12,f=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],p=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],d=0,m=0;m<u;m++){var h=l*f[m]+l,y=Dm(h,e,n,r,a),v=Dm(h,t,i,o,s),g=y*y+v*v;d+=p[m]*jt.sqrt(g)}return l*d}function SR(e,t,n,i,r,o,a,s){if(!(xi(e,n)<bi(r,a)||bi(e,n)>xi(r,a)||xi(t,i)<bi(o,s)||bi(t,i)>xi(o,s))){var c=(e*i-t*n)*(r-a)-(e-n)*(r*s-o*a),l=(e*i-t*n)*(o-s)-(t-i)*(r*s-o*a),u=(e-n)*(o-s)-(t-i)*(r-a);if(u){var f=zs(c/u),p=zs(l/u),d=+f.toFixed(2),m=+p.toFixed(2);if(!(d<+bi(e,n).toFixed(2)||d>+xi(e,n).toFixed(2)||d<+bi(r,a).toFixed(2)||d>+xi(r,a).toFixed(2)||m<+bi(t,i).toFixed(2)||m>+xi(t,i).toFixed(2)||m<+bi(o,s).toFixed(2)||m>+xi(o,s).toFixed(2)))return{x:f,y:p}}}}function zs(e){return Math.round(e*1e11)/1e11}function RR(e,t,n){var i=Om(e),r=Om(t);if(!ER(i,r))return[];var o=Im(...e),a=Im(...t),s=Bm(e)?1:~~(o/5)||1,c=Bm(t)?1:~~(a/5)||1,l=new Array(s+1),u=new Array(c+1),f={},p=[],d,m;for(d=0;d<s+1;d++){var h=km(...e,d/s);l[d]={x:h.x,y:h.y,t:d/s}}for(d=0;d<c+1;d++)h=km(...t,d/c),u[d]={x:h.x,y:h.y,t:d/c};for(d=0;d<s;d++)for(m=0;m<c;m++){var y=l[d],v=l[d+1],g=u[m],b=u[m+1],x=rr(v.x-y.x)<.01?"y":"x",C=rr(b.x-g.x)<.01?"y":"x",M=SR(y.x,y.y,v.x,v.y,g.x,g.y,b.x,b.y),k;if(M){if(k=M.x.toFixed(9)+"#"+M.y.toFixed(9),f[k])continue;f[k]=!0;var P=y.t+rr((M[x]-y[x])/(v[x]-y[x]))*(v.t-y.t),B=g.t+rr((M[C]-g[C])/(b[C]-g[C]))*(b.t-g.t);P>=0&&P<=1&&B>=0&&B<=1&&p.push({x:M.x,y:M.y,t1:P,t2:B})}}return p}function Lm(e,t,n){e=Fm(e),t=Fm(t);for(var i,r,o,a,s,c,l,u,f,p,d=n?0:[],m=0,h=e.length;m<h;m++){var y=e[m];if(y[0]=="M")i=s=y[1],r=c=y[2];else{y[0]=="C"?(f=[i,r,...y.slice(1)],i=f[6],r=f[7]):(f=[i,r,i,r,s,c,s,c],i=s,r=c);for(var v=0,g=t.length;v<g;v++){var b=t[v];if(b[0]=="M")o=l=b[1],a=u=b[2];else{b[0]=="C"?(p=[o,a,...b.slice(1)],o=p[6],a=p[7]):(p=[o,a,o,a,l,u,l,u],o=l,a=u);var x=RR(f,p);{for(var C=0,M=x.length;C<M;C++)x[C].segment1=m,x[C].segment2=v,x[C].bez1=f,x[C].bez2=p;d=d.concat(x)}}}}}return d}function CR(e){return Tm(e)&&Tm(e[0])}function AR(e){if(xR(e))return e;var t=new Array(e.length),n=0,i=0,r=0,o=0,a=0,s;e[0][0]=="M"&&(n=+e[0][1],i=+e[0][2],r=n,o=i,a++,t[0]=["M",n,i]);for(var c,l,u=a,f=e.length;u<f;u++){if(l=e[u],s=l[0],t[u]=c=new Array(l.length),s!=s.toUpperCase())switch(c[0]=s.toUpperCase(),c[0]){case"A":c[1]=l[1],c[2]=l[2],c[3]=l[3],c[4]=l[4],c[5]=l[5],c[6]=+l[6]+n,c[7]=+l[7]+i;break;case"V":c[1]=+l[1]+i;break;case"H":c[1]=+l[1]+n;break;case"M":r=+l[1]+n,o=+l[2]+i;default:for(var p=1,d=l.length;p<d;p++)c[p]=+l[p]+(p%2?n:i)}else for(var m=0,h=l.length;m<h;m++)c[m]=l[m];switch(s=s.toUpperCase(),c[0]){case"Z":n=+r,i=+o;break;case"H":n=c[1];break;case"V":i=c[1];break;case"M":r=c[c.length-2],o=c[c.length-1];default:n=c[c.length-2],i=c[c.length-1]}}return t.toString=Wu,t}function Bm(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function Gs(e,t,n,i){return[e,t,n,i,n,i]}function Nm(e,t,n,i,r,o){var a=.3333333333333333,s=2/3;return[a*e+s*n,a*t+s*i,a*r+s*n,a*o+s*i,r,o]}function $m(e,t,n,i,r,o,a,s,c,l){var u=ir*120/180,f=ir/180*(+r||0),p=[],d,m=vR(function(T,w,E){var G=T*jt.cos(E)-w*jt.sin(E),U=T*jt.sin(E)+w*jt.cos(E);return{x:G,y:U}});if(l)k=l[0],P=l[1],C=l[2],M=l[3];else{d=m(e,t,-f),e=d.x,t=d.y,d=m(s,c,-f),s=d.x,c=d.y;var h=(e-s)/2,y=(t-c)/2,v=h*h/(n*n)+y*y/(i*i);v>1&&(v=jt.sqrt(v),n=v*n,i=v*i);var g=n*n,b=i*i,x=(o==a?-1:1)*jt.sqrt(rr((g*b-g*y*y-b*h*h)/(g*y*y+b*h*h))),C=x*n*y/i+(e+s)/2,M=x*-i*h/n+(t+c)/2,k=jt.asin(((t-M)/i).toFixed(9)),P=jt.asin(((c-M)/i).toFixed(9));k=e<C?ir-k:k,P=s<C?ir-P:P,k<0&&(k=ir*2+k),P<0&&(P=ir*2+P),a&&k>P&&(k=k-ir*2),!a&&P>k&&(P=P-ir*2)}var B=P-k;if(rr(B)>u){var D=P,I=s,z=c;P=k+u*(a&&P>k?1:-1),s=C+n*jt.cos(P),c=M+i*jt.sin(P),p=$m(s,c,n,i,r,0,a,I,z,[P,D,C,M])}B=P-k;var oe=jt.cos(k),ye=jt.sin(k),Ve=jt.cos(P),He=jt.sin(P),it=jt.tan(B/4),K=4/3*n*it,Z=4/3*i*it,se=[e,t],xe=[e+K*ye,t-Z*oe],q=[s+K*He,c-Z*Ve],V=[s,c];if(xe[0]=2*se[0]-xe[0],xe[1]=2*se[1]-xe[1],l)return[xe,q,V].concat(p);p=[xe,q,V].concat(p).join().split(",");for(var ne=[],Te=0,yt=p.length;Te<yt;Te++)ne[Te]=Te%2?m(p[Te-1],p[Te],f).y:m(p[Te],p[Te+1],f).x;return ne}function PR(e,t,n,i,r,o,a,s){for(var c=[],l=[[],[]],u,f,p,d,m,h,y,v,g=0;g<2;++g){if(g==0?(f=6*e-12*n+6*r,u=-3*e+9*n-9*r+3*a,p=3*n-3*e):(f=6*t-12*i+6*o,u=-3*t+9*i-9*o+3*s,p=3*i-3*t),rr(u)<1e-12){if(rr(f)<1e-12)continue;d=-p/f,0<d&&d<1&&c.push(d);continue}y=f*f-4*p*u,v=jt.sqrt(y),!(y<0)&&(m=(-f+v)/(2*u),0<m&&m<1&&c.push(m),h=(-f-v)/(2*u),0<h&&h<1&&c.push(h))}for(var b=c.length,x=b,C;b--;)d=c[b],C=1-d,l[0][b]=C*C*C*e+3*C*C*d*n+3*C*d*d*r+d*d*d*a,l[1][b]=C*C*C*t+3*C*C*d*i+3*C*d*d*o+d*d*d*s;return l[0][x]=e,l[1][x]=t,l[0][x+1]=a,l[1][x+1]=s,l[0].length=l[1].length=x+2,{x0:bi(...l[0]),y0:bi(...l[1]),x1:xi(...l[0]),y1:xi(...l[1])}}function Fm(e){if(CR(e)||(e=bR(e)),_R(e))return e;for(var t=wR(AR(e)),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i=function(p,d,m){var h,y;if(!p)return["C",d.x,d.y,d.x,d.y,d.x,d.y];switch(!(p[0]in{T:1,Q:1})&&(d.qx=d.qy=null),p[0]){case"M":d.X=p[1],d.Y=p[2];break;case"A":p=["C",...$m(d.x,d.y,...p.slice(1))];break;case"S":m=="C"||m=="S"?(h=d.x*2-d.bx,y=d.y*2-d.by):(h=d.x,y=d.y),p=["C",h,y,...p.slice(1)];break;case"T":m=="Q"||m=="T"?(d.qx=d.x*2-d.qx,d.qy=d.y*2-d.qy):(d.qx=d.x,d.qy=d.y),p=["C",...Nm(d.x,d.y,d.qx,d.qy,p[1],p[2])];break;case"Q":d.qx=p[1],d.qy=p[2],p=["C",...Nm(d.x,d.y,p[1],p[2],p[3],p[4])];break;case"L":p=["C",...Gs(d.x,d.y,p[1],p[2])];break;case"H":p=["C",...Gs(d.x,d.y,p[1],d.y)];break;case"V":p=["C",...Gs(d.x,d.y,d.x,p[1])];break;case"Z":p=["C",...Gs(d.x,d.y,d.X,d.Y)];break}return p},r=function(p,d){if(p[d].length>7){p[d].shift();for(var m=p[d];m.length;)o[d]="A",p.splice(d++,0,["C",...m.splice(0,6)]);p.splice(d,1),l=t.length}},o=[],a="",s="",c=0,l=t.length;c<l;c++){t[c]&&(a=t[c][0]),a!="C"&&(o[c]=a,c&&(s=o[c-1])),t[c]=i(t[c],n,s),o[c]!="A"&&a=="C"&&(o[c]="C"),r(t,c);var u=t[c],f=u.length;n.x=u[f-2],n.y=u[f-1],n.bx=Pm(u[f-4])||n.x,n.by=Pm(u[f-3])||n.y}return t}function ht(e){return Qt(e)&&Mn(e,"waypoints")}function Ye(e){return Qt(e)&&Mn(e,"labelTarget")}function MR(e){return Qt(e)&&io(e.parent)}function jm(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function Bi(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function Ie(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function Vs(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function TR(e){return Bi({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function kR(e){for(var t=e.waypoints,n=t.reduce(function(l,u,f){var p=t[f-1];if(p){var d=l[l.length-1],m=d&&d.endLength||0,h=IR(p,u);l.push({start:p,end:u,startLength:m,endLength:m+h,length:h})}return l},[]),i=n.reduce(function(l,u){return l+u.length},0),r=i/2,o=0,a=n[o];a.endLength<r;)a=n[++o];var s=(r-a.startLength)/a.length,c={x:a.start.x+(a.end.x-a.start.x)*s,y:a.start.y+(a.end.y-a.start.y)*s};return c}function Ne(e){return ht(e)?kR(e):TR(e)}function cn(e,t,n){n=n||0,Qt(n)||(n={x:n,y:n});var i=Ie(e),r=Ie(t),o=i.bottom+n.y<=r.top,a=i.left-n.x>=r.right,s=i.top-n.y>=r.bottom,c=i.right+n.x<=r.left,l=o?"top":s?"bottom":null,u=c?"left":a?"right":null;return u&&l?l+"-"+u:u||l||"intersect"}function da(e,t,n){var i=OR(e,t);return i.length===1||i.length===2&&fa(i[0],i[1])<1?Bi(i[0]):i.length>1?(i=di(i,function(r){var o=Math.floor(r.t2*100)||1;return o=100-o,o=(o<10?"0":"")+o,r.segment2+"#"+o}),Bi(i[n?0:i.length-1])):null}function OR(e,t){return Lm(e,t)}function DR(e){e=e.slice();for(var t=0,n,i,r;e[t];)n=e[t],i=e[t-1],r=e[t+1],fa(n,r)===0||zu(i,r,n)?e.splice(t,1):t++;return e}function IR(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Ws(e,t){return Math.round(e*t)/t}function Hm(e){return Fe(e)?e+"px":e}function LR(e){for(;e.parent;)e=e.parent;return e}function BR(e){e=W({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),wn(n,{position:"relative",overflow:"hidden",width:Hm(e.width),height:Hm(e.height)}),t.appendChild(n),n}function zm(e,t,n){const i=Oe("g");et(i).add(t);const r=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}const NR="base",Gm=0,$R=1,FR={shape:["x","y","width","height"],connection:["waypoints"]};function $e(e,t,n,i){this._eventBus=t,this._elementRegistry=i,this._graphicsFactory=n,this._rootsIdx=0,this._layers={},this._planes=[],this._rootElement=null,this._focused=!1,this._init(e||{})}$e.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],$e.prototype._init=function(e){const t=this._eventBus,n=this._container=BR(e),i=this._svg=Oe("svg");Se(i,{width:"100%",height:"100%"}),gn(i,"tabindex",0),e.autoFocus&&t.on("element.hover",()=>{this.restoreFocus()}),t.on("element.mousedown",500,o=>{this.focus()}),i.addEventListener("focusin",()=>{this._setFocused(!0)}),i.addEventListener("focusout",()=>{this._setFocused(!1)}),i.addEventListener("mouseover",()=>{this._eventBus.fire("canvas.mouseover")}),i.addEventListener("mouseout",()=>{this._eventBus.fire("canvas.mouseout")}),ze(n,i);const r=this._viewport=zm(i,"viewport");e.deferUpdate&&(this._viewboxChanged=Zl(this._viewboxChanged,300)),this._restoreFocus=Zl(this._restoreFocus,0),t.on("diagram.init",()=>{t.fire("canvas.init",{svg:i,viewport:r})}),t.on(["shape.added","connection.added","shape.removed","connection.removed","elements.changed","root.set"],()=>{delete this._cachedViewbox}),t.on("diagram.destroy",500,this._destroy,this),t.on("diagram.clear",500,this._clear,this)},$e.prototype._destroy=function(){this._restoreFocus.cancel(),this._eventBus.fire("canvas.destroy",{svg:this._svg,viewport:this._viewport});const e=this._container.parentNode;e&&e.removeChild(this._container),delete this._svg,delete this._container,delete this._layers,delete this._planes,delete this._rootElement,delete this._viewport},$e.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},$e.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=Rm(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},$e.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},$e.prototype.restoreFocus=function(){this._restoreFocus()},$e.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},$e.prototype.isFocused=function(){return this._focused},$e.prototype.getDefaultLayer=function(){return this.getLayer(NR,Gm)},$e.prototype.getLayer=function(e,t){if(!e)throw new Error("must specify a name");let n=this._layers[e];if(n||(n=this._layers[e]=this._createLayer(e,t)),typeof t<"u"&&n.index!==t)throw new Error("layer <"+e+"> already created at index <"+t+">");return n.group},$e.prototype._getChildIndex=function(e){return Tn(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},$e.prototype._createLayer=function(e,t){typeof t>"u"&&(t=$R);const n=this._getChildIndex(t);return{group:zm(this._viewport,"layer-"+e,n),index:t,visible:!0}},$e.prototype.showLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const n=this._viewport,i=t.group,r=t.index;if(t.visible)return i;const o=this._getChildIndex(r);return n.insertBefore(i,n.childNodes[o]||null),t.visible=!0,i},$e.prototype.hideLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const n=t.group;return t.visible&&(Kt(n),t.visible=!1),n},$e.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],Kt(t.group))},$e.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},$e.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const r=this._findPlaneForRoot(LR(i));if(!r||n&&r.rootElement!==n)return;n=r.rootElement}return n},$e.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},$e.prototype._findPlaneForRoot=function(e){return vt(this._planes,function(t){return t.rootElement===e})},$e.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},$e.prototype._resolveElements=function(e){return Be(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},$e.prototype.getContainer=function(){return this._container},$e.prototype._updateMarker=function(e,t,n){let i;e=this._resolveElement(e),e.markers=e.markers||new Set,i=this._elementRegistry._elements[e.id],i&&(F([i.gfx,i.secondaryGfx],function(r){r&&(n?(e.markers.add(t),et(r).add(t)):(e.markers.delete(t),et(r).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},$e.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},$e.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},$e.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},$e.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},$e.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},$e.prototype.addRootElement=function(e){const t=this._rootsIdx++;e||(e={id:"__implicitroot_"+t,children:[],isImplicit:!0});const n=e.layer="root-"+t;this._ensureValid("root",e);const i=this.getLayer(n,Gm);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},$e.prototype.removeRootElement=function(e){if(e=this._resolveElement(e),!!this._findPlaneForRoot(e))return this._removeRoot(e),this._removeLayer(e.layer),this._planes=this._planes.filter(function(n){return n.rootElement!==e}),this._rootElement===e&&(this._rootElement=null),e},$e.prototype.setRootElement=function(e){if(e===this._rootElement)return e;let t;if(!e)throw new Error("rootElement required");return t=this._findPlaneForRoot(e),t||(e=this.addRootElement(e)),this._setRoot(e),e},$e.prototype._removeRoot=function(e){const t=this._elementRegistry,n=this._eventBus;n.fire("root.remove",{element:e}),n.fire("root.removed",{element:e}),t.remove(e)},$e.prototype._addRoot=function(e,t){const n=this._elementRegistry,i=this._eventBus;i.fire("root.add",{element:e}),n.add(e,t),i.fire("root.added",{element:e,gfx:t})},$e.prototype._setRoot=function(e,t){const n=this._rootElement;n&&(this._elementRegistry.updateGraphics(n,null,!0),this.hideLayer(n.layer)),e&&(t||(t=this._findPlaneForRoot(e).layer),this._elementRegistry.updateGraphics(e,this._svg,!0),this.showLayer(e.layer)),this._rootElement=e,this._eventBus.fire("root.set",{element:e})},$e.prototype._ensureValid=function(e,t){if(!t.id)throw new Error("element must have an id");if(this._elementRegistry.get(t.id))throw new Error("element <"+t.id+"> already exists");const n=FR[e];if(!kr(n,function(r){return typeof t[r]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},$e.prototype._setParent=function(e,t,n){Bt(t.children,e,n),e.parent=t},$e.prototype._addElement=function(e,t,n,i){n=n||this.getRootElement();const r=this._eventBus,o=this._graphicsFactory;this._ensureValid(e,t),r.fire(e+".add",{element:t,parent:n}),this._setParent(t,n,i);const a=o.create(e,t,i);return this._elementRegistry.add(t,a),o.update(e,t,a),r.fire(e+".added",{element:t,gfx:a}),t},$e.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},$e.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},$e.prototype._removeElement=function(e,t){const n=this._elementRegistry,i=this._graphicsFactory,r=this._eventBus;if(e=n.get(e.id||e),!!e)return r.fire(t+".remove",{element:e}),i.remove(e),Lt(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},$e.prototype.removeShape=function(e){return this._removeElement(e,"shape")},$e.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},$e.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},$e.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},$e.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},$e.prototype.viewbox=function(e){if(e===void 0&&this._cachedViewbox)return structuredClone(this._cachedViewbox);const t=this._viewport,n=this.getSize();let i,r,o,a,s,c,l;if(e)this._changeViewbox(function(){s=Math.min(n.width/e.width,n.height/e.height);const u=this._svg.createSVGMatrix().scale(s).translate(-e.x,-e.y);ca(t,u)});else return o=this._rootElement?this.getActiveLayer():null,i=o&&o.getBBox()||{},a=ca(t),r=a?a.matrix:VS(),s=Ws(r.a,1e3),c=Ws(-r.e||0,1e3),l=Ws(-r.f||0,1e3),e=this._cachedViewbox={x:c?c/s:0,y:l?l/s:0,width:n.width/s,height:n.height/s,scale:s,inner:{width:i.width||0,height:i.height||0,x:i.x||0,y:i.y||0},outer:n},e;return e},$e.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=W({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),Vm(t,n)}),{x:n.e,y:n.f}},$e.prototype.scrollToElement=function(e,t){let n=100;const i=this._resolveElements(e);if(!i.length)return;const r=this.findRoot(i);if(!r)return;r!==this.getRootElement()&&this.setRootElement(r);const o=i.filter(m=>m!=r);if(!o.length)return;t||(t={}),typeof t=="number"&&(n=t),t={top:t.top||n,right:t.right||n,bottom:t.bottom||n,left:t.left||n};const a=Ft(o),s=Ie(a),c=this.viewbox(),l=this.zoom();let u,f;c.y+=t.top/l,c.x+=t.left/l,c.width-=(t.right+t.left)/l,c.height-=(t.bottom+t.top)/l;const p=Ie(c);if(!(a.width<c.width&&a.height<c.height))u=a.x-c.x,f=a.y-c.y;else{const m=Math.max(0,s.right-p.right),h=Math.min(0,s.left-p.left),y=Math.max(0,s.bottom-p.bottom),v=Math.min(0,s.top-p.top);u=m||h,f=y||v}this.scroll({dx:-u*l,dy:-f*l})},$e.prototype.zoom=function(e,t){if(!e)return this.viewbox(e).scale;if(e==="fit-viewport")return this._fitViewport(t);let n,i;return this._changeViewbox(function(){typeof t!="object"&&(n=this.viewbox().outer,t={x:n.width/2,y:n.height/2}),i=this._setZoom(e,t)}),Ws(i.a,1e3)};function Vm(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}$e.prototype._fitViewport=function(e){const t=this.viewbox(),n=t.outer,i=t.inner;let r,o;return i.x>=0&&i.y>=0&&i.x+i.width<=n.width&&i.y+i.height<=n.height&&!e?o={x:0,y:0,width:Math.max(i.width+i.x,n.width),height:Math.max(i.height+i.y,n.height)}:(r=Math.min(1,n.width/i.width,n.height/i.height),o={x:i.x+(e?i.width/2-n.width/r/2:0),y:i.y+(e?i.height/2-n.height/r/2:0),width:n.width/r,height:n.height/r}),this.viewbox(o),this.viewbox(!1).scale},$e.prototype._setZoom=function(e,t){const n=this._svg,i=this._viewport,r=n.createSVGMatrix(),o=n.createSVGPoint();let a,s,c,l,u;c=i.getCTM();const f=c.a;return t?(a=W(o,t),s=a.matrixTransform(c.inverse()),l=r.translate(s.x,s.y).scale(1/f*e).translate(-s.x,-s.y),u=c.multiply(l)):u=r.scale(e),Vm(this._viewport,u),u},$e.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},$e.prototype.getAbsoluteBBox=function(e){const t=this.viewbox();let n;e.waypoints?n=this.getGraphics(e).getBBox():n=e;const i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale,o=n.width*t.scale,a=n.height*t.scale;return{x:i,y:r,width:o,height:a}},$e.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var xo="data-element-id";function Un(e){this._elements={},this._eventBus=e}Un.$inject=["eventBus"],Un.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),Se(t,xo,i),n&&Se(n,xo,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},Un.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(Se(i.gfx,xo,""),i.secondaryGfx&&Se(i.secondaryGfx,xo,""),delete t[n])},Un.prototype.updateId=function(e,t){this._validateId(t),typeof e=="string"&&(e=this.get(e)),this._eventBus.fire("element.updateId",{element:e,newId:t});var n=this.getGraphics(e),i=this.getGraphics(e,!0);this.remove(e),e.id=t,this.add(e,n,i)},Un.prototype.updateGraphics=function(e,t,n){var i=e.id||e,r=this._elements[i];return n?r.secondaryGfx=t:r.gfx=t,t&&Se(t,xo,i),t},Un.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&Se(e,xo);var n=this._elements[t];return n&&n.element},Un.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},Un.prototype.find=function(e){for(var t=this._elements,n=Object.keys(t),i=0;i<n.length;i++){var r=n[i],o=t[r],a=o.element,s=o.gfx;if(e(a,s))return a}},Un.prototype.getAll=function(){return this.filter(function(e){return e})},Un.prototype.forEach=function(e){var t=this._elements;Object.keys(t).forEach(function(n){var i=t[n],r=i.element,o=i.gfx;return e(r,o)})},Un.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},Un.prototype._validateId=function(e){if(!e)throw new Error("element must have an id");if(this._elements[e])throw new Error("element with id "+e+" already added")};function jR(e,t,n,i){var r=n.inverse;return Object.defineProperty(e,"remove",{value:function(o){var a=this.indexOf(o);return a!==-1&&(this.splice(a,1),t.unset(o,r,i)),o}}),Object.defineProperty(e,"contains",{value:function(o){return this.indexOf(o)!==-1}}),Object.defineProperty(e,"add",{value:function(o,a){var s=this.indexOf(o);if(typeof a>"u"){if(s!==-1)return;a=this.length}s!==-1&&this.splice(s,1),this.splice(a,0,o),s===-1&&t.set(o,r,i)}}),Object.defineProperty(e,"__refs_collection",{value:!0}),e}function HR(e){return e.__refs_collection===!0}function zR(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function Wm(e,t,n){var i=jR(n[t.name]||[],e,t,n);Object.defineProperty(n,t.name,{enumerable:t.enumerable,value:i}),i.length&&i.forEach(function(r){e.set(r,t.inverse,n)})}function GR(e,t,n){var i=t.inverse,r=n[t.name];Object.defineProperty(n,t.name,{configurable:t.configurable,enumerable:t.enumerable,get:function(){return r},set:function(o){if(o!==r){var a=r;r=null,a&&e.unset(a,i,n),r=o,e.set(r,i,n)}}})}function Zn(e,t){if(!(this instanceof Zn))return new Zn(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}Zn.prototype.bind=function(e,t){if(typeof t=="string"){if(!this.props[t])throw new Error("no property <"+t+"> in ref");t=this.props[t]}t.collection?Wm(this,t,e):GR(this,t,e)},Zn.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return HR(n)||Wm(this,t,e),n},Zn.prototype.ensureBound=function(e,t){zR(e,t)||this.bind(e,t)},Zn.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},Zn.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var Uu=new Zn({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Um=new Zn({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Ym=new Zn({name:"attachers",collection:!0},{name:"host"}),qm=new Zn({name:"outgoing",collection:!0},{name:"source"}),Km=new Zn({name:"incoming",collection:!0},{name:"target"});function _o(){Object.defineProperty(this,"businessObject",{writable:!0}),Object.defineProperty(this,"label",{get:function(){return this.labels[0]},set:function(e){var t=this.label,n=this.labels;!e&&t?n.remove(t):n.add(e,0)}}),Uu.bind(this,"parent"),Um.bind(this,"labels"),qm.bind(this,"outgoing"),Km.bind(this,"incoming")}function ha(){_o.call(this),Uu.bind(this,"children"),Ym.bind(this,"host"),Ym.bind(this,"attachers")}Ee(ha,_o);function Xm(){_o.call(this),Uu.bind(this,"children")}Ee(Xm,ha);function Zm(){ha.call(this),Um.bind(this,"labelTarget")}Ee(Zm,ha);function Qm(){_o.call(this),qm.bind(this,"source"),Km.bind(this,"target")}Ee(Qm,_o);var VR={connection:Qm,shape:ha,label:Zm,root:Xm};function WR(e,t){var n=VR[e];if(!n)throw new Error("unknown type: <"+e+">");return W(new n,t)}function UR(e){return e instanceof _o}function Ni(){this._uid=12}Ni.prototype.createRoot=function(e){return this.create("root",e)},Ni.prototype.createLabel=function(e){return this.create("label",e)},Ni.prototype.createShape=function(e){return this.create("shape",e)},Ni.prototype.createConnection=function(e){return this.create("connection",e)},Ni.prototype.create=function(e,t){return t=W({},t||{}),t.id||(t.id=e+"_"+this._uid++),WR(e,t)};var Us="__fn",Jm=1e3,YR=Array.prototype.slice;function Dn(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}Dn.prototype.on=function(e,t,n,i){if(e=Be(e)?e:[e],Jt(t)&&(i=n,n=t,t=Jm),!Fe(t))throw new Error("priority must be a number");var r=n;i&&(r=Rn(n,i),r[Us]=n[Us]||n);var o=this;e.forEach(function(a){o._addListener(a,{priority:t,callback:r,next:null})})},Dn.prototype.once=function(e,t,n,i){var r=this;if(Jt(t)&&(i=n,n=t,t=Jm),!Fe(t))throw new Error("priority must be a number");function o(){o.__isTomb=!0;var a=n.apply(i,arguments);return r.off(e,o),a}o[Us]=n,this.on(e,t,o)},Dn.prototype.off=function(e,t){e=Be(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},Dn.prototype.createEvent=function(e){var t=new ma;return t.init(e),t},Dn.prototype.fire=function(e,t){var n,i,r,o;if(o=YR.call(arguments),typeof e=="object"&&(t=e,e=t.type),!e)throw new Error("no event type specified");if(i=this._listeners[e],!!i){t instanceof ma?n=t:n=this.createEvent(t),o[0]=n;var a=n.type;e!==a&&(n.type=e);try{r=this._invokeListeners(n,o,i)}finally{e!==a&&(n.type=a)}return r===void 0&&n.defaultPrevented&&(r=!1),r}},Dn.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},Dn.prototype._destroy=function(){this._listeners={}},Dn.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},Dn.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=qR(n.callback,t),i!==void 0&&(e.returnValue=i,e.stopPropagation()),i===!1&&e.preventDefault()}catch(r){if(!this.handleError(r))throw console.error("unhandled error in event listener",r),r}return i},Dn.prototype._addListener=function(e,t){var n=this._getListeners(e),i;if(!n){this._setListeners(e,t);return}for(;n;){if(n.priority<t.priority){t.next=n,i?i.next=t:this._setListeners(e,t);return}i=n,n=n.next}i.next=t},Dn.prototype._getListeners=function(e){return this._listeners[e]},Dn.prototype._setListeners=function(e,t){this._listeners[e]=t},Dn.prototype._removeListener=function(e,t){var n=this._getListeners(e),i,r,o;if(!t){this._setListeners(e,null);return}for(;n;)i=n.next,o=n.callback,(o===t||o[Us]===t)&&(r?r.next=i:this._setListeners(e,i)),r=n,n=i};function ma(){}ma.prototype.stopPropagation=function(){this.cancelBubble=!0},ma.prototype.preventDefault=function(){this.defaultPrevented=!0},ma.prototype.init=function(e){W(this,e||{})};function qR(e,t){return e.apply(null,t)}function $r(e){return e.childNodes[0]}function KR(e){return e.parentNode.childNodes[1]}function Ys(e,t,n,i,r){var o=sa();o.setTranslate(t,n);var a=sa();a.setRotate(i||0,0,0);var s=sa();s.setScale(1,1),ca(e,[o,a,s])}function ln(e,t,n){var i=sa();i.setTranslate(t,n),ca(e,i)}function eg(e,t){var n=sa();n.setRotate(t,0,0),ca(e,n)}function Yn(e,t){this._eventBus=e,this._elementRegistry=t}Yn.$inject=["eventBus","elementRegistry"],Yn.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=KR(t),n||(n=Oe("g"),et(n).add("djs-children"),ze(t.parentNode,n))):n=t,n},Yn.prototype._clear=function(e){var t=$r(e);return Ls(t),t},Yn.prototype._createContainer=function(e,t,n,i){var r=Oe("g");et(r).add("djs-group"),typeof n<"u"?XR(r,t,t.childNodes[n]):ze(t,r);var o=Oe("g");et(o).add("djs-element"),et(o).add("djs-"+e),i&&et(o).add("djs-frame"),ze(r,o);var a=Oe("g");return et(a).add("djs-visual"),ze(o,a),o},Yn.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,Cm(t))},Yn.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=Tn(e,function(r,o){return o.parent&&(r[o.parent.id]=o.parent),r},{}),F(i,function(r){var o=r.children;if(o){var a=t._getChildrenContainer(r),s=a.firstChild;F(o,function(c){var l=n.getGraphics(c).parentNode;l===s?s=s.nextSibling:a.insertBefore(l,s)})}})},Yn.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},Yn.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},Yn.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},Yn.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},Yn.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),ln(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?Se(n,"display","none"):Se(n,"display","block")}},Yn.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);Kt(t.parentNode)};function XR(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const ZR={__depends__:[uR],__init__:["canvas"],canvas:["type",$e],elementRegistry:["type",Un],elementFactory:["type",Ni],eventBus:["type",Dn],graphicsFactory:["type",Yn]};function QR(e){var t=new Sm(e);return t.init(),t}function JR(e){e=e||{};var t={config:["value",e]},n=[t,ZR].concat(e.modules||[]);return QR(n)}function ar(e,t){this._injector=t||JR(e),this.get("eventBus").fire("diagram.init")}ar.prototype.get=function(e,t){return this._injector.get(e,t)},ar.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},ar.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},ar.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function yn(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function Cn(e,t){return e.$instanceOf(t)}function eC(e){return vt(e.rootElements,function(t){return Cn(t,"bpmn:Process")||Cn(t,"bpmn:Collaboration")})}function tC(e){var t={},n=[],i={};function r(q,V){return function(ne){q(ne,V)}}function o(q){t[q.id]=q}function a(q){return t[q.id]}function s(q,V){var ne=q.gfx;if(ne)throw new Error(`already rendered ${yn(q)}`);return e.element(q,i[q.id],V)}function c(q,V){return e.root(q,i[q.id],V)}function l(q,V){try{var ne=i[q.id]&&s(q,V);return o(q),ne}catch(Te){u(Te.message,{element:q,error:Te}),console.error(`failed to import ${yn(q)}`,Te)}}function u(q,V){e.error(q,V)}var f=this.registerDi=function(V){var ne=V.bpmnElement;ne?i[ne.id]?u(`multiple DI elements defined for ${yn(ne)}`,{element:ne}):i[ne.id]=V:u(`no bpmnElement referenced in ${yn(V)}`,{element:V})};function p(q){d(q.plane)}function d(q){f(q),F(q.planeElement,m)}function m(q){f(q)}this.handleDefinitions=function(V,ne){var Te=V.diagrams;if(ne&&Te.indexOf(ne)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!ne&&Te&&Te.length&&(ne=Te[0]),!ne)throw new Error("no diagram to display");i={},p(ne);var yt=ne.plane;if(!yt)throw new Error(`no plane for ${yn(ne)}`);var T=yt.bpmnElement;if(!T)if(T=eC(V),T)u(`correcting missing bpmnElement on ${yn(yt)} to ${yn(T)}`),yt.bpmnElement=T,f(yt);else throw new Error("no process or collaboration to display");var w=c(T,yt);if(Cn(T,"bpmn:Process")||Cn(T,"bpmn:SubProcess"))y(T,w);else if(Cn(T,"bpmn:Collaboration"))se(T,w),v(V.rootElements,w);else throw new Error(`unsupported bpmnElement for ${yn(yt)}: ${yn(T)}`);h(n)};var h=this.handleDeferred=function(){for(var V;n.length;)V=n.shift(),V()};function y(q,V){it(q,V),B(q.ioSpecification,V),P(q.artifacts,V),o(q)}function v(q,V){var ne=Ke(q,function(Te){return!a(Te)&&Cn(Te,"bpmn:Process")&&Te.laneSets});ne.forEach(r(y,V))}function g(q,V){l(q,V)}function b(q,V){F(q,r(g,V))}function x(q,V){l(q,V)}function C(q,V){l(q,V)}function M(q,V){l(q,V)}function k(q,V){l(q,V)}function P(q,V){F(q,function(ne){Cn(ne,"bpmn:Association")?n.push(function(){k(ne,V)}):k(ne,V)})}function B(q,V){q&&(F(q.dataInputs,r(C,V)),F(q.dataOutputs,r(M,V)))}var D=this.handleSubProcess=function(V,ne){it(V,ne),P(V.artifacts,ne)};function I(q,V){var ne=l(q,V);Cn(q,"bpmn:SubProcess")&&D(q,ne||V),Cn(q,"bpmn:Activity")&&B(q.ioSpecification,V),n.push(function(){F(q.dataInputAssociations,r(x,V)),F(q.dataOutputAssociations,r(x,V))})}function z(q,V){l(q,V)}function oe(q,V){l(q,V)}function ye(q,V){n.push(function(){var ne=l(q,V);q.childLaneSet&&Ve(q.childLaneSet,ne||V),xe(q)})}function Ve(q,V){F(q.lanes,r(ye,V))}function He(q,V){F(q,r(Ve,V))}function it(q,V){K(q.flowElements,V),q.laneSets&&He(q.laneSets,V)}function K(q,V){F(q,function(ne){Cn(ne,"bpmn:SequenceFlow")?n.push(function(){z(ne,V)}):Cn(ne,"bpmn:BoundaryEvent")?n.unshift(function(){I(ne,V)}):Cn(ne,"bpmn:FlowNode")?I(ne,V):Cn(ne,"bpmn:DataObject")||(Cn(ne,"bpmn:DataStoreReference")||Cn(ne,"bpmn:DataObjectReference")?oe(ne,V):u(`unrecognized flowElement ${yn(ne)} in context ${yn(V&&V.businessObject)}`,{element:ne,context:V}))})}function Z(q,V){var ne=l(q,V),Te=q.processRef;Te&&y(Te,ne||V)}function se(q,V){F(q.participants,r(Z,V)),n.push(function(){b(q.messageFlows,V)}),P(q.artifacts,V)}function xe(q){F(q.flowNodeRef,function(V){var ne=V.get("lanes");ne&&ne.push(q)})}}function S(e,t){var n=ie(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function qe(e,t){return Xi(t,function(n){return S(e,n)})}function ie(e){return e&&e.businessObject||e}function ot(e){return e&&e.di}function nC(e,t,n){var i,r,o,a,s=[];function c(l,u){var f={root:function(h,y){return i.add(h,y)},element:function(h,y,v){return i.add(h,y,v)},error:function(h,y){s.push({message:h,context:y})}},p=new tC(f);u=u||l.diagrams&&l.diagrams[0];var d=iC(l,u);if(!d)throw new Error("no diagram to display");F(d,function(h){p.handleDefinitions(l,h)});var m=u.plane.bpmnElement.id;o.setRootElement(o.findRoot(m+"_plane")||o.findRoot(m))}return new Promise(function(l,u){try{return i=e.get("bpmnImporter"),r=e.get("eventBus"),o=e.get("canvas"),r.fire("import.render.start",{definitions:t}),c(t,n),r.fire("import.render.complete",{error:a,warnings:s}),l({warnings:s})}catch(f){return f.warnings=s,u(f)}})}function iC(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!S(n,"bpmn:Process")&&!S(n,"bpmn:Collaboration")&&(i=rC(n));var r;S(i,"bpmn:Collaboration")?r=i:r=vt(e.rootElements,function(l){if(S(l,"bpmn:Collaboration"))return vt(l.participants,function(u){return u.processRef===i})});var o=[i];r&&(o=hn(r.participants,function(l){return l.processRef}),o.push(r));var a=tg(o),s=[t],c=[n];return F(e.diagrams,function(l){if(l.plane){var u=l.plane.bpmnElement;a.indexOf(u)!==-1&&c.indexOf(u)===-1&&(s.push(l),c.push(u))}}),s}}function tg(e){var t=[];return F(e,function(n){n&&(t.push(n),t=t.concat(tg(n.flowElements)))}),t}function rC(e){for(var t=e;t;){if(S(t,"bpmn:Process"))return t;t=t.$parent}}var oC='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.02 5.57" width="53" height="21"><path fill="currentColor" d="M1.88.92v.14c0 .41-.13.68-.4.8.33.14.46.44.46.86v.33c0 .61-.33.95-.95.95H0V0h.95c.65 0 .93.3.93.92zM.63.57v1.06h.24c.24 0 .38-.1.38-.43V.98c0-.28-.1-.4-.32-.4zm0 1.63v1.22h.36c.2 0 .32-.1.32-.39v-.35c0-.37-.12-.48-.4-.48H.63zM4.18.99v.52c0 .64-.31.98-.94.98h-.3V4h-.62V0h.92c.63 0 .94.35.94.99zM2.94.57v1.35h.3c.2 0 .3-.09.3-.37v-.6c0-.29-.1-.38-.3-.38h-.3zm2.89 2.27L6.25 0h.88v4h-.6V1.12L6.1 3.99h-.6l-.46-2.82v2.82h-.55V0h.87zM8.14 1.1V4h-.56V0h.79L9 2.4V0h.56v4h-.64zm2.49 2.29v.6h-.6v-.6zM12.12 1c0-.63.33-1 .95-1 .61 0 .95.37.95 1v2.04c0 .64-.34 1-.95 1-.62 0-.95-.37-.95-1zm.62 2.08c0 .28.13.39.33.39s.32-.1.32-.4V.98c0-.29-.12-.4-.32-.4s-.33.11-.33.4z"/><path fill="currentColor" d="M0 4.53h14.02v1.04H0zM11.08 0h.63v.62h-.63zm.63 4V1h-.63v2.98z"/></svg>',ng=oC,ig={verticalAlign:"middle"},rg={color:"#404040"},aC={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},sC={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},cC={position:"absolute",left:"50%",top:"40%",transform:"translate(-50%)",width:"260px",padding:"10px",background:"white",boxShadow:"0 1px 4px rgba(0,0,0,0.3)",fontFamily:"Helvetica, Arial, sans-serif",fontSize:"14px",display:"flex",lineHeight:"1.3"},lC='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+ng+'</a><span>Web-based tooling for BPMN, DMN and forms powered by <a href="https://bpmn.io" target="_blank" rel="noopener">bpmn.io</a>.</span></div></div>',_i;function uC(){_i=wt(lC),wn(_i,aC),wn(ft("svg",_i),ig),wn(ft(".backdrop",_i),sC),wn(ft(".notice",_i),cC),wn(ft(".link",_i),rg,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function pC(){_i||(uC(),On.bind(_i,".backdrop","click",function(e){document.body.removeChild(_i)})),document.body.appendChild(_i)}const qs=5,og="djs-outline-hidden";function Pt(e){e=W({},dC,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),mC(this._container)}Ee(Pt,ar),Pt.prototype.importXML=async function(t,n){const i=this;function r(a){return i.get("eventBus").createEvent(a)}let o=[];try{t=this._emit("import.parse.start",{xml:t})||t;let a;try{a=await this._moddle.fromXML(t,"bpmn:Definitions")}catch(p){throw this._emit("import.parse.complete",{error:p}),p}let s=a.rootElement;const c=a.references,l=a.warnings,u=a.elementsById;o=o.concat(l),s=this._emit("import.parse.complete",r({error:null,definitions:s,elementsById:u,references:c,warnings:o}))||s;const f=await this.importDefinitions(s,n);return o=o.concat(f.warnings),this._emit("import.done",{error:null,warnings:o}),{warnings:o}}catch(a){let s=a;throw o=o.concat(s.warnings||[]),Ks(s,o),s=fC(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},Pt.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},Pt.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const o=new Error("no XML imported");throw Ks(o,[]),o}if(typeof t=="string"&&(i=hC(n,t),!i)){const o=new Error("BPMNDiagram <"+t+"> not found");throw Ks(o,[]),o}try{this.clear()}catch(o){throw Ks(o,[]),o}const{warnings:r}=await nC(this,n,i);return{warnings:r}},Pt.prototype.saveXML=async function(t){t=t||{};let n=this._definitions,i,r;try{if(!n)throw new Error("no definitions loaded");n=this._emit("saveXML.start",{definitions:n})||n,r=(await this._moddle.toXML(n,t)).xml,r=this._emit("saveXML.serialized",{xml:r})||r}catch(a){i=a}const o=i?{error:i}:{xml:r};if(this._emit("saveXML.done",o),i)throw i;return o},Pt.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),r=i.getActiveLayer(),o=ft(":scope > defs",i._svg),a=Em(r),s=o?"<defs>"+Em(o)+"</defs>":"",c=i.getContainer();Ct(c).add(og);let l;try{l=r.getBBox()}finally{Ct(c).remove(og)}const u=l.x-qs,f=l.y-qs,p=l.width+qs*2,d=l.height+qs*2;t=`<?xml version="1.0" encoding="utf-8"?>
|
|
8
8
|
<!-- created with bpmn-js / http://bpmn.io -->
|
|
9
9
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
|
10
|
-
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="`+p+'" height="'+d+'" viewBox="'+u+" "+f+" "+p+" "+d+'" version="1.1">'+s+a+"</svg>"}catch(i){n=i}if(this._emit("saveSVG.done",{error:n,svg:t}),n)throw n;return{svg:t}},Pt.prototype._setDefinitions=function(e){this._definitions=e},Pt.prototype.getModules=function(){return this._modules},Pt.prototype.clear=function(){this.getDefinitions()&&ar.prototype.clear.call(this)},Pt.prototype.destroy=function(){ar.prototype.destroy.call(this),vi(this._container)},Pt.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},Pt.prototype.off=function(e,t){this.get("eventBus").off(e,t)},Pt.prototype.attachTo=function(e){if(!e)throw new Error("parentNode required");this.detach(),e.get&&e.constructor.prototype.jquery&&(e=e.get(0)),typeof e=="string"&&(e=ft(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},Pt.prototype.getDefinitions=function(){return this._definitions},Pt.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},Pt.prototype._init=function(e,t,n){const i=n.modules||this.getModules(n),r=n.additionalModules||[],o=[{bpmnjs:["value",this],moddle:["value",t]}],a=[].concat(o,i,r),s=W(hi(n,["additionalModules"]),{canvas:W({},n.canvas,{container:e}),modules:a});ar.call(this,s),n&&n.container&&this.attachTo(n.container)},Pt.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},Pt.prototype._createContainer=function(e){const t=wt('<div class="bjs-container"></div>');return wn(t,{width:ag(e.width),height:ag(e.height),position:e.position}),t},Pt.prototype._createModdle=function(e){const t=W({},this._moddleExtensions,e.moddleExtensions);return new eh(t)},Pt.prototype._modules=[];function Ks(e,t){return e.warnings=t,e}function fC(e){const n=/unparsable content <([^>]+)> detected([\s\S]*)$/.exec(e.message);return n&&(e.message="unparsable content <"+n[1]+"> detected; this may indicate an invalid BPMN 2.0 diagram file"+n[2]),e}const dC={width:"100%",height:"100%",position:"relative"};function ag(e){return e+(Fe(e)?"px":"")}function hC(e,t){return t&&vt(e.diagrams,function(n){return n.id===t})||null}function mC(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+ng+"</a>",i=wt(n);wn(ft("svg",i),ig),wn(i,rg,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),je.bind(i,"click",function(r){pC(),r.preventDefault()})}function wo(e){Pt.call(this,e),this.on("import.parse.complete",function(t){t.error||this._collectIds(t.definitions,t.elementsById)},this),this.on("diagram.destroy",function(){this.get("moddle").ids.clear()},this)}Ee(wo,Pt),wo.prototype._createModdle=function(e){var t=Pt.prototype._createModdle.call(this,e);return t.ids=new yi([32,36,1]),t},wo.prototype._collectIds=function(e,t){var n=e.$model,i=n.ids,r;i.clear();for(r in t)i.claim(r,t[r])};function Qe(e,t){return S(e,"bpmn:CallActivity")?!1:S(e,"bpmn:SubProcess")?(t=t||ot(e),t&&S(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):S(e,"bpmn:Participant")?!!ie(e).processRef:!0}function tn(e){if(!(!S(e,"bpmn:Participant")&&!S(e,"bpmn:Lane"))){var t=ot(e).isHorizontal;return t===void 0?!0:t}}function gC(e){return e&&ie(e).isInterrupting!==!1}function vn(e){return e&&!!ie(e).triggeredByEvent}function Eo(e,t){var n=ie(e).eventDefinitions;return Xi(n,function(i){return S(i,t)})}function yC(e){return Eo(e,"bpmn:ErrorEventDefinition")}function vC(e){return Eo(e,"bpmn:EscalationEventDefinition")}function bC(e){return Eo(e,"bpmn:CompensateEventDefinition")}var Fr={width:90,height:20},sg=15;function sr(e){return S(e,"bpmn:Event")||S(e,"bpmn:Gateway")||S(e,"bpmn:DataStoreReference")||S(e,"bpmn:DataObjectReference")||S(e,"bpmn:DataInput")||S(e,"bpmn:DataOutput")||S(e,"bpmn:SequenceFlow")||S(e,"bpmn:MessageFlow")||S(e,"bpmn:Group")}function Xs(e){return Ye(e.label)}function xC(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=_C(e),o=Math.atan((i.y-n.y)/(i.x-n.x)),a=r.x,s=r.y;return Math.abs(o)<Math.PI/2?s-=sg:a+=sg,{x:a,y:s}}function _C(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)];return{x:n.x+(i.x-n.x)/2,y:n.y+(i.y-n.y)/2}}function Yu(e){return e.waypoints?xC(e.waypoints):S(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+Fr.height/2}:{x:e.x+e.width/2,y:e.y+e.height+Fr.height/2}}function wC(e,t){var n,i,r,o=e.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(Fr.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=Yu(t),i=Fr),W({x:n.x-i.width/2,y:n.y-i.height/2},i)}function cg(e){if(S(e,"bpmn:FlowElement")||S(e,"bpmn:Participant")||S(e,"bpmn:Lane")||S(e,"bpmn:SequenceFlow")||S(e,"bpmn:MessageFlow")||S(e,"bpmn:DataInput")||S(e,"bpmn:DataOutput"))return"name";if(S(e,"bpmn:TextAnnotation"))return"text";if(S(e,"bpmn:Group"))return"categoryValueRef"}function EC(e){var t=e.categoryValueRef;return t&&t.value||""}function qn(e){var t=e.businessObject,n=cg(t);if(n)return n==="categoryValueRef"?EC(t):t[n]||""}function SC(e,t){var n=e.businessObject,i=cg(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function RC(e){return Ye(e)&&sr(e.labelTarget)}var So=7;function lg(e){let t=[];return F(e.incoming,n=>{S(n,"bpmn:Association")&&S(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),F(e.outgoing,n=>{S(n,"bpmn:Association")&&S(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function ga(e){const t=new Map;return F(ju(e),n=>{F(lg(n),i=>{t.has(i.annotation)||t.set(i.annotation,{annotation:i.annotation,associations:[]}),t.get(i.annotation).associations.push(i.association)})}),[...t.values()]}var qu="hsl(225, 10%, 15%)",CC="white";function wi(e,t){return Xi(e.eventDefinitions,function(n){return n.$type===t})}function AC(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function PC(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function Ze(e,t,n){var i=ot(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||CC}function be(e,t,n){var i=ot(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||qu}function ya(e,t,n,i){var r=ot(e),o=r.get("label");return i||o&&o.get("color:color")||t||be(e,n)}function ug(e){var t=e.x+e.width/2,n=e.y+e.height/2,i=e.width/2,r=[["M",t,n],["m",0,-i],["a",i,i,0,1,1,0,2*i],["a",i,i,0,1,1,0,-2*i],["z"]];return Br(r)}function Ku(e,t){var n=e.x,i=e.y,r=e.width,o=e.height,a=[["M",n+t,i],["l",r-t*2,0],["a",t,t,0,0,1,t,t],["l",0,o-t*2],["a",t,t,0,0,1,-t,t],["l",t*2-r,0],["a",t,t,0,0,1,-t,-t],["l",0,t*2-o],["a",t,t,0,0,1,t,-t],["z"]];return Br(a)}function MC(e){var t=e.width,n=e.height,i=e.x,r=e.y,o=t/2,a=n/2,s=[["M",i+o,r],["l",o,a],["l",-o,a],["l",-o,-a],["z"]];return Br(s)}function TC(e){var t=e.x,n=e.y,i=e.width,r=e.height,o=[["M",t,n],["l",i,0],["l",0,r],["l",-i,0],["z"]];return Br(o)}function va(e,t={}){return{width:Qn(e,t),height:In(e,t)}}function Qn(e,t={}){return Mn(t,"width")?t.width:e.width}function In(e,t={}){return Mn(t,"height")?t.height:e.height}var kC=new yi,OC=10,Zs=3,DC=1.5,Qs=10,IC=4,Ro=.95,LC=1,BC=.25;function jr(e,t,n,i,r,o,a){Ii.call(this,t,a);var s=e&&e.defaultFillColor,c=e&&e.defaultStrokeColor,l=e&&e.defaultLabelColor;function u(T){return n.computeStyle(T,{strokeLinecap:"round",strokeLinejoin:"round",stroke:qu,strokeWidth:2,fill:"white"})}function f(T){return n.computeStyle(T,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:qu,strokeWidth:2})}function p(T,w){var{ref:E={x:0,y:0},scale:G=1,element:U,parentGfx:X=r._svg}=w,Ce=Oe("marker",{id:T,viewBox:"0 0 20 20",refX:E.x,refY:E.y,markerWidth:20*G,markerHeight:20*G,orient:"auto"});ze(Ce,U);var Ue=ft(":scope > defs",X);Ue||(Ue=Oe("defs"),ze(X,Ue)),ze(Ue,Ce)}function d(T,w,E,G){var U=kC.nextPrefixed("marker-");return m(T,U,w,E,G),"url(#"+U+")"}function m(T,w,E,G,U){if(E==="sequenceflow-end"){var X=Oe("path",{d:"M 1 5 L 11 10 L 1 15 Z",...u({fill:U,stroke:U,strokeWidth:1})});p(w,{element:X,ref:{x:11,y:10},scale:.5,parentGfx:T})}if(E==="messageflow-start"){var Ce=Oe("circle",{cx:6,cy:6,r:3.5,...u({fill:G,stroke:U,strokeWidth:1,strokeDasharray:[1e4,1]})});p(w,{element:Ce,ref:{x:6,y:6},parentGfx:T})}if(E==="messageflow-end"){var Ue=Oe("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...u({fill:G,stroke:U,strokeWidth:1,strokeDasharray:[1e4,1]})});p(w,{element:Ue,ref:{x:8.5,y:5},parentGfx:T})}if(E==="association-start"){var st=Oe("path",{d:"M 11 5 L 1 10 L 11 15",...f({fill:"none",stroke:U,strokeWidth:1.5,strokeDasharray:[1e4,1]})});p(w,{element:st,ref:{x:1,y:10},scale:.5,parentGfx:T})}if(E==="association-end"){var Ot=Oe("path",{d:"M 1 5 L 11 10 L 1 15",...f({fill:"none",stroke:U,strokeWidth:1.5,strokeDasharray:[1e4,1]})});p(w,{element:Ot,ref:{x:11,y:10},scale:.5,parentGfx:T})}if(E==="conditional-flow-marker"){var pt=Oe("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...u({fill:G,stroke:U})});p(w,{element:pt,ref:{x:-1,y:10},scale:.5,parentGfx:T})}if(E==="conditional-default-flow-marker"){var Wt=Oe("path",{d:"M 6 4 L 10 16",...u({stroke:U,fill:"none"})});p(w,{element:Wt,ref:{x:0,y:10},scale:.5,parentGfx:T})}}function h(T,w,E,G,U={}){Qt(G)&&(U=G,G=0),G=G||0,U=u(U);var X=w/2,Ce=E/2,Ue=Oe("circle",{cx:X,cy:Ce,r:Math.round((w+E)/4-G),...U});return ze(T,Ue),Ue}function y(T,w,E,G,U,X){Qt(U)&&(X=U,U=0),U=U||0,X=u(X);var Ce=Oe("rect",{x:U,y:U,width:w-U*2,height:E-U*2,rx:G,ry:G,...X});return ze(T,Ce),Ce}function v(T,w,E,G){var U=w/2,X=E/2,Ce=[{x:U,y:0},{x:w,y:X},{x:U,y:E},{x:0,y:X}],Ue=Ce.map(function(Ot){return Ot.x+","+Ot.y}).join(" ");G=u(G);var st=Oe("polygon",{...G,points:Ue});return ze(T,st),st}function g(T,w,E,G){E=f(E);var U=la(w,E,G);return ze(T,U),U}function b(T,w,E){return g(T,w,E,5)}function x(T,w,E){E=f(E);var G=Oe("path",{...E,d:w});return ze(T,G),G}function C(T,w,E,G){return x(w,E,W({"data-marker":T},G))}function M(T){return yt[T]}function k(T){return function(w,E,G){return M(T)(w,E,G)}}var P={"bpmn:MessageEventDefinition":function(T,w,E={},G){var U=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:E.width||w.width,containerHeight:E.height||w.height,position:{mx:.235,my:.315}}),X=G?be(w,c,E.stroke):Ze(w,s,E.fill),Ce=G?Ze(w,s,E.fill):be(w,c,E.stroke),Ue=x(T,U,{fill:X,stroke:Ce,strokeWidth:1});return Ue},"bpmn:TimerEventDefinition":function(T,w,E={}){var G=E.width||w.width,U=E.height||w.height,X=E.width?1:2,Ce=h(T,G,U,.2*U,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:X}),Ue=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:G,containerHeight:U,position:{mx:.5,my:.5}});x(T,Ue,{stroke:be(w,c,E.stroke),strokeWidth:X});for(var st=0;st<12;st++){var Ot=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:G,containerHeight:U,position:{mx:.5,my:.5}}),pt=G/2,Wt=U/2;x(T,Ot,{strokeWidth:1,stroke:be(w,c,E.stroke),transform:"rotate("+st*30+","+Wt+","+pt+")"})}return Ce},"bpmn:EscalationEventDefinition":function(T,w,E={},G){var U=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width||w.width,containerHeight:E.height||w.height,position:{mx:.5,my:.2}}),X=G?be(w,c,E.stroke):Ze(w,s,E.fill);return x(T,U,{fill:X,stroke:be(w,c,E.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(T,w,E={}){var G=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width||w.width,containerHeight:E.height||w.height,position:{mx:.5,my:.222}});return x(T,G,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(T,w,E={},G){var U=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width,containerHeight:w.height,position:{mx:.57,my:.263}}),X=G?be(w,c,E.stroke):Ze(w,s,E.fill);return x(T,U,{fill:X,stroke:be(w,c,E.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(T,w,E={},G){var U=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:E.width||w.width,containerHeight:E.height||w.height,position:{mx:.2,my:.722}}),X=G?be(w,c,E.stroke):Ze(w,s,E.fill);return x(T,U,{fill:X,stroke:be(w,c,E.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(T,w,E={},G){var U=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width,containerHeight:w.height,position:{mx:.638,my:-.055}}),X=G?be(w,c,E.stroke):"none",Ce=x(T,U,{fill:X,stroke:be(w,c,E.stroke),strokeWidth:1});return eg(Ce,45),Ce},"bpmn:CompensateEventDefinition":function(T,w,E={},G){var U=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width||w.width,containerHeight:E.height||w.height,position:{mx:.22,my:.5}}),X=G?be(w,c,E.stroke):Ze(w,s,E.fill);return x(T,U,{fill:X,stroke:be(w,c,E.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(T,w,E={},G){var U=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:E.width||w.width,containerHeight:E.height||w.height,position:{mx:.5,my:.2}}),X=G?be(w,c,E.stroke):Ze(w,s,E.fill);return x(T,U,{strokeWidth:1,fill:X,stroke:be(w,c,E.stroke)})},"bpmn:MultipleEventDefinition":function(T,w,E={},G){var U=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:E.width||w.width,containerHeight:E.height||w.height,position:{mx:.211,my:.36}}),X=G?be(w,c,E.stroke):Ze(w,s,E.fill);return x(T,U,{fill:X,stroke:be(w,c,E.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(T,w,E={}){var G=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:E.width||w.width,containerHeight:E.height||w.height,position:{mx:.458,my:.194}});return x(T,G,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(T,w,E={}){var G=h(T,w.width,w.height,8,{fill:be(w,c,E.stroke),stroke:be(w,c,E.stroke),strokeWidth:4});return G}};function B(T,w,E={},G){var U=ie(T),X=AC(U),Ce=G||T;return U.get("eventDefinitions")&&U.get("eventDefinitions").length>1?U.get("parallelMultiple")?P["bpmn:ParallelMultipleEventDefinition"](w,Ce,E,X):P["bpmn:MultipleEventDefinition"](w,Ce,E,X):wi(U,"bpmn:MessageEventDefinition")?P["bpmn:MessageEventDefinition"](w,Ce,E,X):wi(U,"bpmn:TimerEventDefinition")?P["bpmn:TimerEventDefinition"](w,Ce,E,X):wi(U,"bpmn:ConditionalEventDefinition")?P["bpmn:ConditionalEventDefinition"](w,Ce,E,X):wi(U,"bpmn:SignalEventDefinition")?P["bpmn:SignalEventDefinition"](w,Ce,E,X):wi(U,"bpmn:EscalationEventDefinition")?P["bpmn:EscalationEventDefinition"](w,Ce,E,X):wi(U,"bpmn:LinkEventDefinition")?P["bpmn:LinkEventDefinition"](w,Ce,E,X):wi(U,"bpmn:ErrorEventDefinition")?P["bpmn:ErrorEventDefinition"](w,Ce,E,X):wi(U,"bpmn:CancelEventDefinition")?P["bpmn:CancelEventDefinition"](w,Ce,E,X):wi(U,"bpmn:CompensateEventDefinition")?P["bpmn:CompensateEventDefinition"](w,Ce,E,X):wi(U,"bpmn:TerminateEventDefinition")?P["bpmn:TerminateEventDefinition"](w,Ce,E,X):null}var D={ParticipantMultiplicityMarker:function(T,w,E={}){var G=Qn(w,E),U=In(w,E),X=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:U,position:{mx:(G/2-6)/G,my:(U-15)/U}});C("participant-multiplicity",T,X,{strokeWidth:2,fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke)})},SubProcessMarker:function(T,w,E={}){var G=y(T,14,14,0,{strokeWidth:1,fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke)});ln(G,w.width/2-7.5,w.height-20);var U=i.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:w.width,containerHeight:w.height,position:{mx:(w.width/2-7.5)/w.width,my:(w.height-20)/w.height}});C("sub-process",T,U,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke)})},ParallelMarker:function(T,w,E){var G=Qn(w,E),U=In(w,E),X=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:U,position:{mx:(G/2+E.parallel)/G,my:(U-20)/U}});C("parallel",T,X,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke)})},SequentialMarker:function(T,w,E){var G=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width,containerHeight:w.height,position:{mx:(w.width/2+E.seq)/w.width,my:(w.height-19)/w.height}});C("sequential",T,G,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke)})},CompensationMarker:function(T,w,E){var G=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width,containerHeight:w.height,position:{mx:(w.width/2+E.compensation)/w.width,my:(w.height-13)/w.height}});C("compensation",T,G,{strokeWidth:1,fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke)})},LoopMarker:function(T,w,E){var G=Qn(w,E),U=In(w,E),X=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:U,position:{mx:(G/2+E.loop)/G,my:(U-7)/U}});C("loop",T,X,{strokeWidth:1.5,fill:"none",stroke:be(w,c,E.stroke),strokeMiterlimit:.5})},AdhocMarker:function(T,w,E){var G=Qn(w,E),U=In(w,E),X=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:U,position:{mx:(G/2+E.adhoc)/G,my:(U-15)/U}});C("adhoc",T,X,{strokeWidth:1,fill:be(w,c,E.stroke),stroke:be(w,c,E.stroke)})}};function I(T,w,E,G){D[T](w,E,G)}function z(T,w,E=[],G={}){G={fill:G.fill,stroke:G.stroke,width:Qn(w,G),height:In(w,G)};var U=ie(w),X=E.includes("SubProcessMarker");X?G={...G,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:G={...G,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},U.get("isForCompensation")&&E.push("CompensationMarker"),S(U,"bpmn:AdHocSubProcess")&&(E.push("AdhocMarker"),X||W(G,{compensation:G.compensation-18}));var Ce=U.get("loopCharacteristics"),Ue=Ce&&Ce.get("isSequential");Ce&&(W(G,{compensation:G.compensation-18}),E.includes("AdhocMarker")&&W(G,{seq:-23,loop:-18,parallel:-24}),Ue===void 0&&E.push("LoopMarker"),Ue===!1&&E.push("ParallelMarker"),Ue===!0&&E.push("SequentialMarker")),E.includes("CompensationMarker")&&E.length===1&&W(G,{compensation:-8}),F(E,function(st){I(st,T,w,G)})}function oe(T,w,E={}){E=W({size:{width:100}},E);var G=o.createText(w||"",E);return et(G).add("djs-label"),ze(T,G),G}function ye(T,w,E,G={}){var U=ie(w),X=va({x:w.x,y:w.y,width:w.width,height:w.height},G);return oe(T,U.name,{align:E,box:X,padding:7,style:{fill:ya(w,l,c,G.stroke)}})}function Ve(T,w,E={}){var G={width:w.width,height:w.height,x:w.width/2+w.x,y:w.height/2+w.y};return oe(T,qn(w),{box:G,style:W({},o.getExternalStyle(),{fill:ya(w,l,c,E.stroke)})})}function He(T,w,E,G={}){var U=tn(E),X=oe(T,w,{box:{height:30,width:U?In(E,G):Qn(E,G)},align:"center-middle",style:{fill:ya(E,l,c,G.stroke)}});if(U){var Ce=-1*In(E,G);Ys(X,0,-Ce,270)}}function it(T,w,E={}){var{width:G,height:U}=va(w,E);return y(T,G,U,Qs,{...E,fill:Ze(w,s,E.fill),fillOpacity:Ro,stroke:be(w,c,E.stroke)})}function K(T,w,E={}){var G=ie(w),U=Ze(w,s,E.fill),X=be(w,c,E.stroke);return(G.get("associationDirection")==="One"||G.get("associationDirection")==="Both")&&(E.markerEnd=d(T,"association-end",U,X)),G.get("associationDirection")==="Both"&&(E.markerStart=d(T,"association-start",U,X)),E=at(E,["markerStart","markerEnd"]),b(T,w.waypoints,{...E,stroke:X,strokeDasharray:"0, 5"})}function Z(T,w,E={}){var G=Ze(w,s,E.fill),U=be(w,c,E.stroke),X=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width,containerHeight:w.height,position:{mx:.474,my:.296}}),Ce=x(T,X,{fill:G,fillOpacity:Ro,stroke:U}),Ue=ie(w);if(PC(Ue)){var st=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width,containerHeight:w.height,position:{mx:.33,my:(w.height-18)/w.height}});x(T,st,{strokeWidth:2,fill:G,stroke:U})}return Ce}function se(T,w,E={}){return h(T,w.width,w.height,{fillOpacity:Ro,...E,fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke)})}function xe(T,w,E={}){return v(T,w.width,w.height,{fill:Ze(w,s,E.fill),fillOpacity:Ro,stroke:be(w,c,E.stroke)})}function q(T,w,E={}){var G=y(T,Qn(w,E),In(w,E),0,{fill:Ze(w,s,E.fill),fillOpacity:E.fillOpacity||Ro,stroke:be(w,c,E.stroke),strokeWidth:1.5}),U=ie(w);if(S(U,"bpmn:Lane")){var X=U.get("name");He(T,X,w,E)}return G}function V(T,w,E={}){var G=it(T,w,E),U=Qe(w);if(vn(w)&&(Se(G,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!U)){var X=ie(w).flowElements||[],Ce=X.filter(Ue=>S(Ue,"bpmn:StartEvent"));Ce.length===1&&ne(Ce[0],T,E,w)}return ye(T,w,U?"center-top":"center-middle",E),U?z(T,w,void 0,E):z(T,w,["SubProcessMarker"],E),G}function ne(T,w,E,G){var U=22,X={fill:Ze(G,s,E.fill),stroke:be(G,c,E.stroke),width:U,height:U},Ce=ie(T).isInterrupting,Ue=Ce?0:3,st=Ce?1:1.2,Ot=20,pt=(U-Ot)/2,Wt="translate("+pt+","+pt+")";h(w,Ot,Ot,{fill:X.fill,stroke:X.stroke,strokeWidth:st,strokeDasharray:Ue,transform:Wt}),B(T,w,X,G)}function Te(T,w,E={}){var G=it(T,w,E);return ye(T,w,"center-middle",E),z(T,w,void 0,E),G}var yt=this.handlers={"bpmn:AdHocSubProcess":function(T,w,E={}){return Qe(w)?E=at(E,["fill","stroke","width","height"]):E=at(E,["fill","stroke"]),V(T,w,E)},"bpmn:Association":function(T,w,E={}){return E=at(E,["fill","stroke"]),K(T,w,E)},"bpmn:BoundaryEvent":function(T,w,E={}){var{renderIcon:G=!0}=E;E=at(E,["fill","stroke"]);var U=ie(w),X=U.get("cancelActivity");E={strokeWidth:1.5,fill:Ze(w,s,E.fill),fillOpacity:LC,stroke:be(w,c,E.stroke)},X||(E.strokeDasharray="6");var Ce=se(T,w,E);return h(T,w.width,w.height,Zs,{...E,fill:"none"}),G&&B(w,T,E),Ce},"bpmn:BusinessRuleTask":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=Te(T,w,E),U=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),X=x(T,U);Se(X,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:1});var Ce=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),Ue=x(T,Ce);return Se(Ue,{fill:be(w,c,E.stroke),stroke:be(w,c,E.stroke),strokeWidth:1}),G},"bpmn:CallActivity":function(T,w,E={}){return E=at(E,["fill","stroke"]),V(T,w,{strokeWidth:5,...E})},"bpmn:ComplexGateway":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=xe(T,w,E),U=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:w.width,containerHeight:w.height,position:{mx:.46,my:.26}});return x(T,U,{fill:be(w,c,E.stroke),stroke:be(w,c,E.stroke),strokeWidth:1}),G},"bpmn:DataInput":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=i.getRawPath("DATA_ARROW"),U=Z(T,w,E);return x(T,G,{fill:"none",stroke:be(w,c,E.stroke),strokeWidth:1}),U},"bpmn:DataInputAssociation":function(T,w,E={}){return E=at(E,["fill","stroke"]),K(T,w,{...E,markerEnd:d(T,"association-end",Ze(w,s,E.fill),be(w,c,E.stroke))})},"bpmn:DataObject":function(T,w,E={}){return E=at(E,["fill","stroke"]),Z(T,w,E)},"bpmn:DataObjectReference":k("bpmn:DataObject"),"bpmn:DataOutput":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=i.getRawPath("DATA_ARROW"),U=Z(T,w,E);return x(T,G,{strokeWidth:1,fill:be(w,c,E.stroke),stroke:be(w,c,E.stroke)}),U},"bpmn:DataOutputAssociation":function(T,w,E={}){return E=at(E,["fill","stroke"]),K(T,w,{...E,markerEnd:d(T,"association-end",Ze(w,s,E.fill),be(w,c,E.stroke))})},"bpmn:DataStoreReference":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width,containerHeight:w.height,position:{mx:0,my:.133}});return x(T,G,{fill:Ze(w,s,E.fill),fillOpacity:Ro,stroke:be(w,c,E.stroke),strokeWidth:2})},"bpmn:EndEvent":function(T,w,E={}){var{renderIcon:G=!0}=E;E=at(E,["fill","stroke"]);var U=se(T,w,{...E,strokeWidth:4});return G&&B(w,T,E),U},"bpmn:EventBasedGateway":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=ie(w),U=xe(T,w,E);h(T,w.width,w.height,w.height*.2,{fill:Ze(w,"none",E.fill),stroke:be(w,c,E.stroke),strokeWidth:1});var X=G.get("eventGatewayType"),Ce=!!G.get("instantiate");function Ue(){var Ot=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:w.width,containerHeight:w.height,position:{mx:.36,my:.44}});x(T,Ot,{fill:"none",stroke:be(w,c,E.stroke),strokeWidth:2})}if(X==="Parallel"){var st=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:w.width,containerHeight:w.height,position:{mx:.474,my:.296}});x(T,st,{fill:"none",stroke:be(w,c,E.stroke),strokeWidth:1})}else X==="Exclusive"&&(Ce||h(T,w.width,w.height,w.height*.26,{fill:"none",stroke:be(w,c,E.stroke),strokeWidth:1}),Ue());return U},"bpmn:ExclusiveGateway":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=xe(T,w,E),U=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:w.width,containerHeight:w.height,position:{mx:.32,my:.3}}),X=ot(w);return X.get("isMarkerVisible")&&x(T,U,{fill:be(w,c,E.stroke),stroke:be(w,c,E.stroke),strokeWidth:1}),G},"bpmn:Gateway":function(T,w,E={}){return E=at(E,["fill","stroke"]),xe(T,w,E)},"bpmn:Group":function(T,w,E={}){return E=at(E,["fill","stroke","width","height"]),y(T,w.width,w.height,Qs,{stroke:be(w,c,E.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:Qn(w,E),height:In(w,E)})},"bpmn:InclusiveGateway":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=xe(T,w,E);return h(T,w.width,w.height,w.height*.24,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:2.5}),G},"bpmn:IntermediateEvent":function(T,w,E={}){var{renderIcon:G=!0}=E;E=at(E,["fill","stroke"]);var U=se(T,w,{...E,strokeWidth:1.5});return h(T,w.width,w.height,Zs,{fill:"none",stroke:be(w,c,E.stroke),strokeWidth:1.5}),G&&B(w,T,E),U},"bpmn:IntermediateCatchEvent":k("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":k("bpmn:IntermediateEvent"),"bpmn:Lane":function(T,w,E={}){return E=at(E,["fill","stroke","width","height"]),q(T,w,{...E,fillOpacity:BC})},"bpmn:ManualTask":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=Te(T,w,E),U=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return x(T,U,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:.5}),G},"bpmn:MessageFlow":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=ie(w),U=ot(w),X=Ze(w,s,E.fill),Ce=be(w,c,E.stroke),Ue=b(T,w.waypoints,{markerEnd:d(T,"messageflow-end",X,Ce),markerStart:d(T,"messageflow-start",X,Ce),stroke:Ce,strokeDasharray:"10, 11",strokeWidth:1.5});if(G.get("messageRef")){var st=Ue.getPointAtLength(Ue.getTotalLength()/2),Ot=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:st.x,y:st.y}}),pt={strokeWidth:1};U.get("messageVisibleKind")==="initiating"?(pt.fill=X,pt.stroke=Ce):(pt.fill=Ce,pt.stroke=X);var Wt=x(T,Ot,pt),nn=G.get("messageRef"),rn=nn.get("name"),xt=oe(T,rn,{align:"center-top",fitBox:!0,style:{fill:Ce}}),Dt=Wt.getBBox(),bn=xt.getBBox(),Pr=st.x-bn.width/2,jn=st.y+Dt.height/2+OC;Ys(xt,Pr,jn,0)}return Ue},"bpmn:ParallelGateway":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=xe(T,w,E),U=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:w.width,containerHeight:w.height,position:{mx:.46,my:.2}});return x(T,U,{fill:be(w,c,E.stroke),stroke:be(w,c,E.stroke),strokeWidth:1}),G},"bpmn:Participant":function(T,w,E={}){E=at(E,["fill","stroke","width","height"]);var G=q(T,w,E),U=Qe(w),X=tn(w),Ce=ie(w),Ue=Ce.get("name");if(U){var st=X?[{x:30,y:0},{x:30,y:In(w,E)}]:[{x:0,y:30},{x:Qn(w,E),y:30}];g(T,st,{stroke:be(w,c,E.stroke),strokeWidth:DC}),He(T,Ue,w,E)}else{var Ot=va(w,E);X||(Ot.height=Qn(w,E),Ot.width=In(w,E));var pt=oe(T,Ue,{box:Ot,align:"center-middle",style:{fill:ya(w,l,c,E.stroke)}});if(!X){var Wt=-1*In(w,E);Ys(pt,0,-Wt,270)}}return Ce.get("participantMultiplicity")&&I("ParticipantMultiplicityMarker",T,w,E),G},"bpmn:ReceiveTask":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=ie(w),U=Te(T,w,E),X;return G.get("instantiate")?(h(T,28,28,20*.22,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:1}),X=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):X=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),x(T,X,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:1}),U},"bpmn:ScriptTask":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=Te(T,w,E),U=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return x(T,U,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:1}),G},"bpmn:SendTask":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=Te(T,w,E),U=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return x(T,U,{fill:be(w,c,E.stroke),stroke:Ze(w,s,E.fill),strokeWidth:1}),G},"bpmn:SequenceFlow":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=Ze(w,s,E.fill),U=be(w,c,E.stroke),X=b(T,w.waypoints,{markerEnd:d(T,"sequenceflow-end",G,U),stroke:U}),Ce=ie(w),{source:Ue}=w;if(Ue){var st=ie(Ue);Ce.get("conditionExpression")&&S(st,"bpmn:Activity")&&Se(X,{markerStart:d(T,"conditional-flow-marker",G,U)}),st.get("default")&&(S(st,"bpmn:Gateway")||S(st,"bpmn:Activity"))&&st.get("default")===Ce&&Se(X,{markerStart:d(T,"conditional-default-flow-marker",G,U)})}return X},"bpmn:ServiceTask":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=Te(T,w,E);h(T,10,10,{fill:Ze(w,s,E.fill),stroke:"none",transform:"translate(6, 6)"});var U=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});x(T,U,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:1}),h(T,10,10,{fill:Ze(w,s,E.fill),stroke:"none",transform:"translate(11, 10)"});var X=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return x(T,X,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:1}),G},"bpmn:StartEvent":function(T,w,E={}){var{renderIcon:G=!0}=E;E=at(E,["fill","stroke"]);var U=ie(w);U.get("isInterrupting")||(E={...E,strokeDasharray:"6"});var X=se(T,w,E);return G&&B(w,T,E),X},"bpmn:SubProcess":function(T,w,E={}){return Qe(w)?E=at(E,["fill","stroke","width","height"]):E=at(E,["fill","stroke"]),V(T,w,E)},"bpmn:Task":function(T,w,E={}){return E=at(E,["fill","stroke"]),Te(T,w,E)},"bpmn:TextAnnotation":function(T,w,E={}){E=at(E,["fill","stroke"]);var{width:G,height:U}=va(w,E),X=y(T,G,U,0,0,{fill:"none",stroke:"none"}),Ce=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:U,position:{mx:0,my:0}});x(T,Ce,{stroke:be(w,c,E.stroke)});var Ue=ie(w),st=Ue.get("text")||"";return oe(T,st,{align:"left-top",box:va(w,E),padding:So,style:{fill:ya(w,l,c,E.stroke)}}),X},"bpmn:Transaction":function(T,w,E={}){Qe(w)?E=at(E,["fill","stroke","width","height"]):E=at(E,["fill","stroke"]);var G=V(T,w,{strokeWidth:1.5,...E}),U=n.style(["no-fill","no-events"],{stroke:be(w,c,E.stroke),strokeWidth:1.5}),X=Qe(w);return X||(E={}),y(T,Qn(w,E),In(w,E),Qs-Zs,Zs,U),G},"bpmn:UserTask":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=Te(T,w,E),U=15,X=12,Ce=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:U,y:X}});x(T,Ce,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:.5});var Ue=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:U,y:X}});x(T,Ue,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:.5});var st=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:U,y:X}});return x(T,st,{fill:be(w,c,E.stroke),stroke:be(w,c,E.stroke),strokeWidth:.5}),G},label:function(T,w,E={}){return Ve(T,w,E)}};this._drawPath=x,this._renderer=M}Ee(jr,Ii),jr.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],jr.prototype.canRender=function(e){return S(e,"bpmn:BaseElement")},jr.prototype.drawShape=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},jr.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},jr.prototype.getShapePath=function(e){return Ye(e)?Ku(e,IC):S(e,"bpmn:Event")?ug(e):S(e,"bpmn:Activity")?Ku(e,Qs):S(e,"bpmn:Gateway")?MC(e):TC(e)};function at(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var NC=0,$C={width:150,height:50};function FC(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function jC(e){return Qt(e)?W({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var Xu=null;function HC(){return Xu||(Xu=document.createElement("canvas").getContext("2d")),Xu}function zC(e){var t=[];return e.fontStyle&&t.push(e.fontStyle),e.fontVariant&&t.push(e.fontVariant),e.fontWeight&&t.push(e.fontWeight),e.fontStretch&&t.push(e.fontStretch),t.push(pg(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function pg(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function GC(e,t){var n=HC();if(!n)return{width:0,height:0};n.font=zC(t),"letterSpacing"in n&&(n.letterSpacing=pg(t.letterSpacing)||"0px");var i=e==="",r=i?"dummy":e.replace(/\s+$/,""),o=n.measureText(r);return{width:i?0:o.width,height:"fontBoundingBoxAscent"in o?o.fontBoundingBoxAscent+o.fontBoundingBoxDescent:o.actualBoundingBoxAscent+o.actualBoundingBoxDescent}}function VC(e,t,n){for(var i=e.shift(),r=i,o;;){if(o=GC(r,n),o.width=r?o.width:0,r===" "||r===""||o.width<Math.round(t)||r.length<2)return WC(e,r,i,o);r=YC(r,o.width,t)}}function WC(e,t,n,i){if(t.length<n.length){var r=n.slice(t.length).trim();e.unshift(r)}return{width:i.width,height:i.height,text:t}}var fg="";function UC(e,t){var n=e.split(/(\s|-|\u00AD)/g),i,r=[],o=0;if(n.length>1)for(;i=n.shift();)if(i.length+o<t)r.push(i),o+=i.length;else{(i==="-"||i===fg)&&r.pop();break}var a=r[r.length-1];return a&&a===fg&&(r[r.length-1]="-"),r.join("")}function YC(e,t,n){var i=Math.max(e.length*(n/t),1),r=UC(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function Js(e){this._config=W({},{size:$C,padding:NC,style:{},align:"center-top"},e||{})}Js.prototype.createText=function(e,t){return this.layoutText(e,t).element},Js.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Js.prototype.layoutText=function(e,t){for(var n=W({},this._config.size,t.box),i=W({},this._config.style,t.style),r=FC(t.align||this._config.align),o=jC(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=qC(i),c=e.split(/\u00AD?\r?\n/),l=[],u=n.width-o.left-o.right;c.length;)l.push(VC(c,u,i));r.vertical==="middle"&&(o.top=o.bottom=0);var f=Tn(l,function(y,v,g){return y+(s||v.height)},0)+o.top+o.bottom,p=Tn(l,function(y,v,g){return v.width>y?v.width:y},0),d=o.top;r.vertical==="middle"&&(d+=(n.height-f)/2),d-=(s||l[0].height)/4;var m=Oe("text");Se(m,i),F(l,function(y){var v;switch(d+=s||y.height,r.horizontal){case"left":v=o.left;break;case"right":v=(a?p:u)-o.right-y.width;break;default:v=Math.max(((a?p:u)-y.width)/2+o.left,0)}var g=Oe("tspan");Se(g,{x:v,y:d}),g.textContent=y.text,ze(m,g)});var h={width:p,height:f};return{dimensions:h,element:m}};function qC(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var KC=12,XC=1.2,ZC=40;function dg(e){var t=W({fontFamily:"Arial, sans-serif",fontSize:KC,fontWeight:"normal",lineHeight:XC},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=W({},t,{fontSize:n},e&&e.externalStyle||{}),r=new Js({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,Fr.width),height:30},l=o(s,c,{style:i});return{x:Math.round(a.x+a.width/2-l.width/2),y:a.y,width:Math.ceil(l.width),height:Math.ceil(l.height)}},this.getTextAnnotationBounds=function(a,s){var c=o(s,a,{style:t,align:"left-top",padding:So});return{x:a.x,y:a.y,width:a.width,height:Math.max(ZC,Math.round(c.height))}},this.getDimensions=function(a,s){return r.getDimensions(a,s||{})};function o(a,s,c){return r.getDimensions(a,W({box:s},c))}this.createText=function(a,s){return r.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}dg.$inject=["config.textRenderer"];function QC(){this.pathMap={EVENT_MESSAGE:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:36,width:36,heightElements:[6,14],widthElements:[10.5,21]},EVENT_SIGNAL:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x1},0 Z",height:36,width:36,heightElements:[18],widthElements:[10,20]},EVENT_ESCALATION:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x0},-{e.y1} l -{e.x0},{e.y1} Z",height:36,width:36,heightElements:[20,7],widthElements:[8]},EVENT_CONDITIONAL:{d:"M {e.x0},{e.y0} l {e.x1},0 l 0,{e.y2} l -{e.x1},0 Z M {e.x2},{e.y3} l {e.x0},0 M {e.x2},{e.y4} l {e.x0},0 M {e.x2},{e.y5} l {e.x0},0 M {e.x2},{e.y6} l {e.x0},0 M {e.x2},{e.y7} l {e.x0},0 M {e.x2},{e.y8} l {e.x0},0 ",height:36,width:36,heightElements:[8.5,14.5,18,11.5,14.5,17.5,20.5,23.5,26.5],widthElements:[10.5,14.5,12.5]},EVENT_LINK:{d:"m {mx},{my} 0,{e.y0} -{e.x1},0 0,{e.y1} {e.x1},0 0,{e.y0} {e.x0},-{e.y2} -{e.x0},-{e.y2} z",height:36,width:36,heightElements:[4.4375,6.75,7.8125],widthElements:[9.84375,13.5]},EVENT_ERROR:{d:"m {mx},{my} {e.x0},-{e.y0} {e.x1},-{e.y1} {e.x2},{e.y2} {e.x3},-{e.y3} -{e.x4},{e.y4} -{e.x5},-{e.y5} z",height:36,width:36,heightElements:[.023,8.737,8.151,16.564,10.591,8.714],widthElements:[.085,6.672,6.97,4.273,5.337,6.636]},EVENT_CANCEL_45:{d:"m {mx},{my} -{e.x1},0 0,{e.x0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:36,width:36,heightElements:[4.75,8.5],widthElements:[4.75,8.5]},EVENT_COMPENSATION:{d:"m {mx},{my} {e.x0},-{e.y0} 0,{e.y1} z m {e.x1},-{e.y2} {e.x2},-{e.y3} 0,{e.y1} -{e.x2},-{e.y3} z",height:36,width:36,heightElements:[6.5,13,.4,6.1],widthElements:[9,9.3,8.7]},EVENT_TIMER_WH:{d:"M {mx},{my} l {e.x0},-{e.y0} m -{e.x0},{e.y0} l {e.x1},{e.y1} ",height:36,width:36,heightElements:[10,2],widthElements:[3,7]},EVENT_TIMER_LINE:{d:"M {mx},{my} m {e.x0},{e.y0} l -{e.x1},{e.y1} ",height:36,width:36,heightElements:[10,3],widthElements:[0,0]},EVENT_MULTIPLE:{d:"m {mx},{my} {e.x1},-{e.y0} {e.x1},{e.y0} -{e.x0},{e.y1} -{e.x2},0 z",height:36,width:36,heightElements:[6.28099,12.56199],widthElements:[3.1405,9.42149,12.56198]},EVENT_PARALLEL_MULTIPLE:{d:"m {mx},{my} {e.x0},0 0,{e.y1} {e.x1},0 0,{e.y0} -{e.x1},0 0,{e.y1} -{e.x0},0 0,-{e.y1} -{e.x1},0 0,-{e.y0} {e.x1},0 z",height:36,width:36,heightElements:[2.56228,7.68683],widthElements:[2.56228,7.68683]},GATEWAY_EXCLUSIVE:{d:"m {mx},{my} {e.x0},{e.y0} {e.x1},{e.y0} {e.x2},0 {e.x4},{e.y2} {e.x4},{e.y1} {e.x2},0 {e.x1},{e.y3} {e.x0},{e.y3} {e.x3},0 {e.x5},{e.y1} {e.x5},{e.y2} {e.x3},0 z",height:17.5,width:17.5,heightElements:[8.5,6.5312,-6.5312,-8.5],widthElements:[6.5,-6.5,3,-3,5,-5]},GATEWAY_PARALLEL:{d:"m {mx},{my} 0,{e.y1} -{e.x1},0 0,{e.y0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:30,width:30,heightElements:[5,12.5],widthElements:[5,12.5]},GATEWAY_EVENT_BASED:{d:"m {mx},{my} {e.x0},{e.y0} {e.x0},{e.y1} {e.x1},{e.y2} {e.x2},0 z",height:11,width:11,heightElements:[-6,6,12,-12],widthElements:[9,-3,-12]},GATEWAY_COMPLEX:{d:"m {mx},{my} 0,{e.y0} -{e.x0},-{e.y1} -{e.x1},{e.y2} {e.x0},{e.y1} -{e.x2},0 0,{e.y3} {e.x2},0 -{e.x0},{e.y1} l {e.x1},{e.y2} {e.x0},-{e.y1} 0,{e.y0} {e.x3},0 0,-{e.y0} {e.x0},{e.y1} {e.x1},-{e.y2} -{e.x0},-{e.y1} {e.x2},0 0,-{e.y3} -{e.x2},0 {e.x0},-{e.y1} -{e.x1},-{e.y2} -{e.x0},{e.y1} 0,-{e.y0} -{e.x3},0 z",height:17.125,width:17.125,heightElements:[4.875,3.4375,2.125,3],widthElements:[3.4375,2.125,4.875,3]},DATA_OBJECT_PATH:{d:"m 0,0 {e.x1},0 {e.x0},{e.y0} 0,{e.y1} -{e.x2},0 0,-{e.y2} {e.x1},0 0,{e.y0} {e.x0},0",height:61,width:51,heightElements:[10,50,60],widthElements:[10,40,50,60]},DATA_OBJECT_COLLECTION_PATH:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},DATA_ARROW:{d:"m 5,9 9,0 0,-3 5,5 -5,5 0,-3 -9,0 z",height:61,width:51,heightElements:[],widthElements:[]},DATA_STORE:{d:"m {mx},{my} l 0,{e.y2} c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 l 0,-{e.y2} c -{e.x0},-{e.y1} -{e.x1},-{e.y1} -{e.x2},0c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0",height:61,width:61,heightElements:[7,10,45],widthElements:[2,58,60]},TEXT_ANNOTATION:{d:"m {mx}, {my} m 10,0 l -10,0 l 0,{e.y0} l 10,0",height:30,width:10,heightElements:[30],widthElements:[10]},MARKER_SUB_PROCESS:{d:"m{mx},{my} m 7,2 l 0,10 m -5,-5 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_PARALLEL:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},MARKER_SEQUENTIAL:{d:"m{mx},{my} m 0,3 l 10,0 m -10,3 l 10,0 m -10,3 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_COMPENSATION:{d:"m {mx},{my} 7,-5 0,10 z m 7.1,-0.3 6.9,-4.7 0,10 -6.9,-4.7 z",height:10,width:21,heightElements:[],widthElements:[]},MARKER_LOOP:{d:"m {mx},{my} c 3.526979,0 6.386161,-2.829858 6.386161,-6.320661 0,-3.490806 -2.859182,-6.320661 -6.386161,-6.320661 -3.526978,0 -6.38616,2.829855 -6.38616,6.320661 0,1.745402 0.714797,3.325567 1.870463,4.469381 0.577834,0.571908 1.265885,1.034728 2.029916,1.35457 l -0.718163,-3.909793 m 0.718163,3.909793 -3.885211,0.802902",height:13.9,width:13.7,heightElements:[],widthElements:[]},MARKER_ADHOC:{d:"m {mx},{my} m 0.84461,2.64411 c 1.05533,-1.23780996 2.64337,-2.07882 4.29653,-1.97997996 2.05163,0.0805 3.85579,1.15803 5.76082,1.79107 1.06385,0.34139996 2.24454,0.1438 3.18759,-0.43767 0.61743,-0.33642 1.2775,-0.64078 1.7542,-1.17511 0,0.56023 0,1.12046 0,1.6807 -0.98706,0.96237996 -2.29792,1.62393996 -3.6918,1.66181996 -1.24459,0.0927 -2.46671,-0.2491 -3.59505,-0.74812 -1.35789,-0.55965 -2.75133,-1.33436996 -4.27027,-1.18121996 -1.37741,0.14601 -2.41842,1.13685996 -3.44288,1.96782996 z",height:4,width:15,heightElements:[],widthElements:[]},TASK_TYPE_SEND:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:14,width:21,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_SCRIPT:{d:"m {mx},{my} c 9.966553,-6.27276 -8.000926,-7.91932 2.968968,-14.938 l -8.802728,0 c -10.969894,7.01868 6.997585,8.66524 -2.968967,14.938 z m -7,-12 l 5,0 m -4.5,3 l 4.5,0 m -3,3 l 5,0m -4,3 l 5,0",height:15,width:12.6,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_USER_1:{d:"m {mx},{my} c 0.909,-0.845 1.594,-2.049 1.594,-3.385 0,-2.554 -1.805,-4.62199999 -4.357,-4.62199999 -2.55199998,0 -4.28799998,2.06799999 -4.28799998,4.62199999 0,1.348 0.974,2.562 1.89599998,3.405 -0.52899998,0.187 -5.669,2.097 -5.794,4.7560005 v 6.718 h 17 v -6.718 c 0,-2.2980005 -5.5279996,-4.5950005 -6.0509996,-4.7760005 zm -8,6 l 0,5.5 m 11,0 l 0,-5"},TASK_TYPE_USER_2:{d:"m {mx},{my} m 2.162,1.009 c 0,2.4470005 -2.158,4.4310005 -4.821,4.4310005 -2.66499998,0 -4.822,-1.981 -4.822,-4.4310005 "},TASK_TYPE_USER_3:{d:"m {mx},{my} m -6.9,-3.80 c 0,0 2.25099998,-2.358 4.27399998,-1.177 2.024,1.181 4.221,1.537 4.124,0.965 -0.098,-0.57 -0.117,-3.79099999 -4.191,-4.13599999 -3.57499998,0.001 -4.20799998,3.36699999 -4.20699998,4.34799999 z"},TASK_TYPE_MANUAL:{d:"m {mx},{my} c 0.234,-0.01 5.604,0.008 8.029,0.004 0.808,0 1.271,-0.172 1.417,-0.752 0.227,-0.898 -0.334,-1.314 -1.338,-1.316 -2.467,-0.01 -7.886,-0.004 -8.108,-0.004 -0.014,-0.079 0.016,-0.533 0,-0.61 0.195,-0.042 8.507,0.006 9.616,0.002 0.877,-0.007 1.35,-0.438 1.353,-1.208 0.003,-0.768 -0.479,-1.09 -1.35,-1.091 -2.968,-0.002 -9.619,-0.013 -9.619,-0.013 v -0.591 c 0,0 5.052,-0.016 7.225,-0.016 0.888,-0.002 1.354,-0.416 1.351,-1.193 -0.006,-0.761 -0.492,-1.196 -1.361,-1.196 -3.473,-0.005 -10.86,-0.003 -11.0829995,-0.003 -0.022,-0.047 -0.045,-0.094 -0.069,-0.139 0.3939995,-0.319 2.0409995,-1.626 2.4149995,-2.017 0.469,-0.4870005 0.519,-1.1650005 0.162,-1.6040005 -0.414,-0.511 -0.973,-0.5 -1.48,-0.236 -1.4609995,0.764 -6.5999995,3.6430005 -7.7329995,4.2710005 -0.9,0.499 -1.516,1.253 -1.882,2.19 -0.37000002,0.95 -0.17,2.01 -0.166,2.979 0.004,0.718 -0.27300002,1.345 -0.055,2.063 0.629,2.087 2.425,3.312 4.859,3.318 4.6179995,0.014 9.2379995,-0.139 13.8569995,-0.158 0.755,-0.004 1.171,-0.301 1.182,-1.033 0.012,-0.754 -0.423,-0.969 -1.183,-0.973 -1.778,-0.01 -5.824,-0.004 -6.04,-0.004 10e-4,-0.084 0.003,-0.586 10e-4,-0.67 z"},TASK_TYPE_INSTANTIATING_SEND:{d:"m {mx},{my} l 0,8.4 l 12.6,0 l 0,-8.4 z l 6.3,3.6 l 6.3,-3.6"},TASK_TYPE_SERVICE:{d:"m {mx},{my} v -1.71335 c 0.352326,-0.0705 0.703932,-0.17838 1.047628,-0.32133 0.344416,-0.14465 0.665822,-0.32133 0.966377,-0.52145 l 1.19431,1.18005 1.567487,-1.57688 -1.195028,-1.18014 c 0.403376,-0.61394 0.683079,-1.29908 0.825447,-2.01824 l 1.622133,-0.01 v -2.2196 l -1.636514,0.01 c -0.07333,-0.35153 -0.178319,-0.70024 -0.323564,-1.04372 -0.145244,-0.34406 -0.321407,-0.6644 -0.522735,-0.96217 l 1.131035,-1.13631 -1.583305,-1.56293 -1.129598,1.13589 c -0.614052,-0.40108 -1.302883,-0.68093 -2.022633,-0.82247 l 0.0093,-1.61852 h -2.241173 l 0.0042,1.63124 c -0.353763,0.0736 -0.705369,0.17977 -1.049785,0.32371 -0.344415,0.14437 -0.665102,0.32092 -0.9635006,0.52046 l -1.1698628,-1.15823 -1.5667691,1.5792 1.1684265,1.15669 c -0.4026573,0.61283 -0.68308,1.29797 -0.8247287,2.01713 l -1.6588041,0.003 v 2.22174 l 1.6724648,-0.006 c 0.073327,0.35077 0.1797598,0.70243 0.3242851,1.04472 0.1452428,0.34448 0.3214064,0.6644 0.5227339,0.96066 l -1.1993431,1.19723 1.5840256,1.56011 1.1964668,-1.19348 c 0.6140517,0.40346 1.3028827,0.68232 2.0233517,0.82331 l 7.19e-4,1.69892 h 2.226848 z m 0.221462,-3.9957 c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_SERVICE_FILL:{d:"m {mx},{my} c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_BUSINESS_RULE_HEADER:{d:"m {mx},{my} 0,4 20,0 0,-4 z"},TASK_TYPE_BUSINESS_RULE_MAIN:{d:"m {mx},{my} 0,12 20,0 0,-12 zm 0,8 l 20,0 m -13,-4 l 0,8"},MESSAGE_FLOW_MARKER:{d:"m {mx},{my} m -10.5 ,-7 l 0,14 l 21,0 l 0,-14 z l 10.5,6 l 10.5,-6"}},this.getRawPath=function(t){return this.pathMap[t].d},this.getScaledPath=function(t,n){var i=this.pathMap[t],r,o;n.abspos?(r=n.abspos.x,o=n.abspos.y):(r=n.containerWidth*n.position.mx,o=n.containerHeight*n.position.my);var a={};if(n.position){for(var s=n.containerHeight/i.height*n.yScaleFactor,c=n.containerWidth/i.width*n.xScaleFactor,l=0;l<i.heightElements.length;l++)a["y"+l]=i.heightElements[l]*s;for(var u=0;u<i.widthElements.length;u++)a["x"+u]=i.widthElements[u]*c}var f=nA(i.d,{mx:r,my:o,e:a});return f}}var JC=/\{([^{}]+)\}/g,eA=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function tA(e,t,n){var i=n;return t.replace(eA,function(r,o,a,s,c){o=o||s,i&&(o in i&&(i=i[o]),typeof i=="function"&&c&&(i=i()))}),i=(i==null||i==n?e:i)+"",i}function nA(e,t){return String(e).replace(JC,function(n,i){return tA(n,i,t)})}const iA={__init__:["bpmnRenderer"],bpmnRenderer:["type",jr],textRenderer:["type",dg],pathMap:["type",QC]};function rA(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const ba={translate:["value",rA]};function ec(e,t,n){return W({id:e.id,type:e.$type,businessObject:e,di:t},n)}function oA(e,t,n){var i=e.waypoint;return!i||i.length<2?[Ne(t),Ne(n)]:i.map(function(r){return{x:r.x,y:r.y}})}function hg(e,t,n){return new Error(`element ${yn(t)} referenced by ${yn(e)}#${n} not yet drawn`)}function $i(e,t,n,i,r){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=r}$i.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],$i.prototype.add=function(e,t,n){var i,r,o;if(S(t,"bpmndi:BPMNPlane")){var a=S(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(ec(e,t,a)),this._canvas.addRootElement(i)}else if(S(t,"bpmndi:BPMNShape")){var s=!Qe(e,t),c=sA(e);r=n&&(n.hidden||n.collapsed);var l=t.bounds;i=this._elementFactory.createShape(ec(e,t,{collapsed:s,hidden:r,x:Math.round(l.x),y:Math.round(l.y),width:Math.round(l.width),height:Math.round(l.height),isFrame:c})),S(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),S(e,"bpmn:Lane")&&(o=0),S(e,"bpmn:DataStoreReference")&&(aA(n,Ne(l))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,o)}else if(S(t,"bpmndi:BPMNEdge")){var u=this._getSource(e),f=this._getTarget(e);r=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(ec(e,t,{hidden:r,source:u,target:f,waypoints:oA(t,u,f)})),S(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,o)}else throw new Error(`unknown di ${yn(t)} for element ${yn(e)}`);return sr(e)&&qn(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},$i.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${yn(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),r=i&&i.attachers;if(!i)throw hg(e,n,"attachedToRef");t.host=i,r||(i.attachers=r=[]),r.indexOf(t)===-1&&r.push(t)},$i.prototype.addLabel=function(e,t,n){var i,r,o;return i=wC(t,n),r=qn(n),r&&(i=this._textRenderer.getExternalLabelBounds(i,r)),o=this._elementFactory.createLabel(ec(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!qn(n),x:Math.round(i.x),y:Math.round(i.y),width:Math.round(i.width),height:Math.round(i.height)})),this._canvas.addShape(o,n.parent)},$i.prototype._getConnectedElement=function(e,t){var n,i,r=e.$type;if(i=e[t+"Ref"],t==="source"&&r==="bpmn:DataInputAssociation"&&(i=i&&i[0]),(t==="source"&&r==="bpmn:DataOutputAssociation"||t==="target"&&r==="bpmn:DataInputAssociation")&&(i=e.$parent),n=i&&this._getElement(i),n)return n;throw i?hg(e,i,t+"Ref"):new Error(`${yn(e)}#${t} Ref not specified`)},$i.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},$i.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},$i.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function aA(e,t){var n=t.x,i=t.y;return n>=e.x&&n<=e.x+e.width&&i>=e.y&&i<=e.y+e.height}function sA(e){return S(e,"bpmn:Group")}const mg={__depends__:[iA,{__depends__:[ba],bpmnImporter:["type",$i]}]};function xa(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function pi(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Zu(e){return Math.log(e)/Math.log(10)}var cA=1e3;function te(e){this._eventBus=e}te.$inject=["eventBus"];function lA(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}te.prototype.on=function(e,t,n,i,r,o){if((Jt(t)||Fe(t))&&(o=r,r=i,i=n,n=t,t=null),Jt(n)&&(o=r,r=i,i=n,n=cA),Qt(r)&&(o=r,r=!1),!Jt(i))throw new Error("handlerFn must be a function");Be(e)||(e=[e]);var a=this._eventBus;F(e,function(s){var c=["commandStack",s,t].filter(function(l){return l}).join(".");a.on(c,n,r?lA(i,o):i,o)})},te.prototype.canExecute=Fi("canExecute"),te.prototype.preExecute=Fi("preExecute"),te.prototype.preExecuted=Fi("preExecuted"),te.prototype.execute=Fi("execute"),te.prototype.executed=Fi("executed"),te.prototype.postExecute=Fi("postExecute"),te.prototype.postExecuted=Fi("postExecuted"),te.prototype.revert=Fi("revert"),te.prototype.reverted=Fi("reverted");function Fi(e){return function(n,i,r,o,a){(Jt(n)||Fe(n))&&(a=o,o=r,r=i,i=n,n=null),this.on(n,e,i,r,o,a)}}var Qu=["top","bottom","left","right"],tc=10;function Ju(e,t){te.call(this,e),this.postExecuted(["connection.create","connection.layout","connection.updateWaypoints"],function(r){var o=r.context,a=o.connection,s=a.source,c=a.target,l=o.hints||{};l.createElementsBehavior!==!1&&(n(s),n(c))}),this.postExecuted(["label.create"],function(r){var o=r.context,a=o.shape,s=o.hints||{};s.createElementsBehavior!==!1&&n(a.labelTarget)}),this.postExecuted(["elements.create"],function(r){var o=r.context,a=o.elements,s=o.hints||{};s.createElementsBehavior!==!1&&a.forEach(function(c){n(c)})});function n(r){if(Xs(r)&&!ht(r)){var o=fA(r);o&&i(r,o)}}function i(r,o){var a=Ne(r),s=r.label,c=Ne(s);if(s.parent){var l=Ie(r),u;switch(o){case"top":u={x:a.x,y:l.top-tc-s.height/2};break;case"left":u={x:l.left-tc-s.width/2,y:a.y};break;case"bottom":u={x:a.x,y:l.bottom+tc+s.height/2};break;case"right":u={x:l.right+tc+s.width/2,y:a.y};break}var f=pi(u,c);t.moveShape(s,f)}}}Ee(Ju,te),Ju.$inject=["eventBus","modeling"];function uA(e){var t=e.host,n=Ne(e),i=cn(n,t),r;i.indexOf("-")>=0?r=i.split("-"):r=[i];var o=Qu.filter(function(a){return r.indexOf(a)===-1});return o}function pA(e){var t=Ne(e),n=[].concat(e.incoming.map(function(i){return i.waypoints[i.waypoints.length-2]}),e.outgoing.map(function(i){return i.waypoints[1]})).map(function(i){return gg(t,i)});return n}function fA(e){var t=Ne(e.label),n=Ne(e),i=gg(n,t);if(dA(i)){var r=pA(e);if(e.host){var o=uA(e);r=r.concat(o)}var a=Qu.filter(function(s){return r.indexOf(s)===-1});return a.indexOf(i)!==-1?cn(e.label,e)!=="intersect"?void 0:i:a[0]}}function gg(e,t){return cn(t,e,5)}function dA(e){return Qu.indexOf(e)!==-1}function ep(e){te.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,i=t.shape;t.position||(S(i,"bpmn:TextAnnotation")?t.position={x:n.x+n.width/2+75,y:n.y-50-i.height/2}:t.position={x:n.x+n.width+80+i.width/2,y:n.y+n.height/2})},!0)}Ee(ep,te),ep.$inject=["eventBus"];var hA=1500;function tp(e,t,n){e.invoke(te,this),this.preExecute("elements.delete",hA,function(r){var o=r.context,a=o.elements,s=i(a);s.length&&(o.elements=a.concat(s))}),t.on("shape.move.start",function(r){var o=r.context.shapes,a=i(o);a.length&&(r.context.shapes=o.concat(a))});function i(r){var o=Ke(r,l=>S(l,"bpmn:Participant")||S(l,"bpmn:SubProcess"));if(!o.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(l=>S(l,"bpmn:Artifact"))),c=new Set;return F(o,l=>{const u=new Set(ro(bo(Array.from(s),Ft(l))));c=c.union(u),s=s.difference(u)}),Array.from(c)}}Ee(tp,te),tp.$inject=["injector","eventBus","canvas"];function np(e,t){e.invoke(te,this),this.postExecute("shape.move",function(n){var i=n.newParent,r=n.shape,o=Ke(r.incoming.concat(r.outgoing),function(a){return S(a,"bpmn:Association")});F(o,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}Ee(np,te),np.$inject=["injector","modeling"];function Co(e,t){for(Pn(t)&&(t=[t]);e=e.parent;)if(qe(e,t))return e;return null}function yg(e,t){var n=Co(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=Co(e,i),n)return tn(n);if(qe(e,i))return tn(e);var r;for(r=ie(e);r&&!S(r,"bpmn:Process");r=r.$parent);if(!t)return!0;var o=t.find(function(a){var s=ie(a);return s&&s.get("processRef")===r});return o?tn(o):!0}var vg=500;function nc(e,t){t.invoke(te,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",vg,function(i){var r=i.elements;r=r.filter(function(o){var a=o.host;return bg(o,a)}),r.length===1&&r.map(function(o){return r.indexOf(o)}).forEach(function(o){var a=r[o];i.elements[o]=n._replaceShape(r[o],a)})},!0),this.preExecute("elements.move",vg,function(i){var r=i.shapes,o=i.newHost;if(r.length===1){var a=r[0];bg(a,o)&&(i.shapes=[n._replaceShape(a,o)])}},!0)}nc.$inject=["bpmnReplace","injector"],Ee(nc,te),nc.prototype._replaceShape=function(e,t){var n=mA(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function mA(e){var t=ie(e),n=t.eventDefinitions;return n&&n[0]}function bg(e,t){return!Ye(e)&&qe(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function ip(e,t){te.call(this,e);function n(i){return Ke(i.attachers,function(r){return S(r,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var r=i.context.source,o=i.context.target,a=n(o);S(r,"bpmn:EventBasedGateway")&&S(o,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var r=i.context.oldSource,o=i.context.newSource;S(r,"bpmn:Gateway")&&S(o,"bpmn:EventBasedGateway")&&F(o.outgoing,function(a){var s=a.target,c=n(s);S(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}ip.$inject=["eventBus","modeling"],Ee(ip,te);function xg(e){return e.create("bpmn:Category")}function gA(e){return e.create("bpmn:CategoryValue")}function _g(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=gA(e)),n.$parent||(n.$parent=xg(e)),n}function yA(e,t,n){return Bt(t.get("categoryValue"),e),e.$parent=t,Bt(n.get("rootElements"),t),t.$parent=n,e}function vA(e){var t=e.$parent;return t&&(Lt(t.get("categoryValue"),e),e.$parent=null),e}function bA(e){var t=e.$parent;return t&&(Lt(t.get("rootElements"),e),e.$parent=null),e}var xA=500;function rp(e,t,n){n.invoke(te,this);function i(c){return t.filter(function(l){return S(l,"bpmn:Group")&&!l.labelTarget}).map(ie).filter(function(l){return l!==c})}function r(c,l){return i(l).some(function(u){return u.get("categoryValueRef")===c})}function o(c,l){return i(l).some(function(u){var f=u.get("categoryValueRef");return f&&f.$parent===c})}function a(c,l){c&&l&&yA(c,l,e.getDefinitions())}function s(c,l,u){l&&!o(l,u)&&bA(l),c&&!r(c,u)&&vA(c)}this.executed(["shape.create","label.create"],function(c){var l=c.labelTarget||c.shape;!S(l,"bpmn:Group")||l.labelTarget||a(c.categoryValue,c.category)},!0),this.reverted(["shape.create","label.create"],function(c){var l=c.labelTarget||c.shape;!S(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,ie(l))},!0),this.executed(["shape.move","shape.resize"],xA,function(c){a(c.categoryValue,c.category)},!0),this.reverted(["shape.move","shape.resize"],function(c){var l=c.shape;c.categoryValue&&s(c.categoryValue,c.category,ie(l))},!0),this.executed("group.updateRefs",function(c){wg(c).forEach(function(l){a(l.categoryValue,l.category)})},!0),this.reverted("group.updateRefs",function(c){wg(c).forEach(function(l){s(l.categoryValue,l.category,ie(l.groupShape))})},!0),this.executed("shape.delete",function(c){var l=c.shape;!S(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,ie(l))},!0),this.reverted("shape.delete",function(c){var l=c.shape;!S(l,"bpmn:Group")||l.labelTarget||a(c.categoryValue,c.category)},!0)}rp.$inject=["bpmnjs","elementRegistry","injector"],Ee(rp,te);function wg(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function op(e,t,n){te.call(this,e),this.preExecute("shape.replace",s,!0),this.postExecuted("shape.replace",c,!0),this.preExecute("connection.create",r,!0),this.postExecuted("connection.delete",i,!0),this.postExecuted("connection.reconnect",o,!0),this.postExecuted("element.updateProperties",a,!0);function i(y){const v=y.source,g=y.target;Ao(v)&&_a(g)&&u(g)}function r(y){const v=y.connection,g=y.source,b=y.target;Ao(g)&&ic(b)&&(l(b),p(g,[v]))}function o(y){const v=y.newTarget,g=y.oldSource,b=y.oldTarget;if(b!==v){const x=g;_a(b)&&u(b),Ao(x)&&ic(v)&&l(v)}}function a(y){const{element:v}=y;_a(v)?(f(v),d(v)):ic(v)&&m(v)}function s(y){const{newData:v,oldShape:g}=y;if(Ao(y.oldShape)&&v.eventDefinitionType!=="bpmn:CompensateEventDefinition"||v.type!=="bpmn:BoundaryEvent"){const b=g.outgoing.find(({target:x})=>_a(x));b&&b.target&&(y._connectionTarget=b.target)}else if(!Ao(y.oldShape)&&v.eventDefinitionType==="bpmn:CompensateEventDefinition"&&v.type==="bpmn:BoundaryEvent"){const b=g.outgoing.find(({target:x})=>ic(x));b&&b.target&&(y._connectionTarget=b.target),h(g)}}function c(y){const{_connectionTarget:v,newShape:g}=y;v&&t.connect(g,v)}function l(y){t.updateProperties(y,{isForCompensation:!0})}function u(y){t.updateProperties(y,{isForCompensation:void 0})}function f(y){for(const v of y.incoming)n.canConnect(v.source,y)||t.removeConnection(v);for(const v of y.outgoing)n.canConnect(y,v.target)||t.removeConnection(v)}function p(y,v){y.outgoing.filter(x=>S(x,"bpmn:Association")).filter(x=>_a(x.target)&&!v.includes(x)).forEach(x=>t.removeConnection(x))}function d(y){const v=y.attachers.slice();v.length&&t.removeElements(v)}function m(y){const v=y.incoming.filter(g=>Ao(g.source));t.removeElements(v)}function h(y){const v=y.outgoing.filter(g=>S(g,"bpmn:SequenceFlow"));t.removeElements(v)}}Ee(op,te),op.$inject=["eventBus","modeling","bpmnRules"];function _a(e){const t=ie(e);return t&&t.get("isForCompensation")}function Ao(e){return e&&S(e,"bpmn:BoundaryEvent")&&Eo(e,"bpmn:CompensateEventDefinition")}function ic(e){return e&&S(e,"bpmn:Activity")&&!vn(e)}function ap(e){e.invoke(te,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,r=n.shape;S(i,"bpmn:Lane")&&!S(r,"bpmn:Lane")&&(n.parent=Co(i,"bpmn:Participant"))})}ap.$inject=["injector"],Ee(ap,te);function sp(e,t){te.call(this,e),this.preExecute("shape.create",function(n){var a;var i=n.context,r=i.shape;if(S(r,"bpmn:DataObjectReference")&&r.type!=="label"){var o=t.create("bpmn:DataObject");o.isCollection=((a=r.businessObject.dataObjectRef)==null?void 0:a.isCollection)||!1,r.businessObject.dataObjectRef=o}})}sp.$inject=["eventBus","bpmnFactory"],Ee(sp,te);var cp=20,lp=20,Eg=30,rc=2e3;function up(e,t,n){te.call(this,t),t.on(["create.start","shape.move.start"],rc,function(r){var o=r.context,a=o.shape,s=e.getRootElement();if(!(!S(a,"bpmn:Participant")||!S(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(f){return!S(f,"bpmn:Group")&&!Ye(f)&&!ht(f)});if(c.length){var l=Ft(c),u=_A(a,l);W(a,u),o.createConstraints=wA(a,l)}}}),t.on("create.start",rc,function(r){var o=r.context,a=o.shape,s=e.getRootElement(),c=e.getGraphics(s);function l(u){u.element=s,u.gfx=c}S(a,"bpmn:Participant")&&S(s,"bpmn:Process")&&(t.on("element.hover",rc,l),t.once("create.cleanup",function(){t.off("element.hover",l)}))});function i(){var r=e.getRootElement();return S(r,"bpmn:Collaboration")?r:n.makeCollaboration()}this.preExecute("elements.create",rc,function(r){var o=r.elements,a=r.parent,s=EA(o),c;s&&S(a,"bpmn:Process")&&(r.parent=i(),c=r.hints=r.hints||{},c.participant=s,c.process=a,c.processRef=ie(s).get("processRef"))},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;S(a,"bpmn:Participant")&&S(o,"bpmn:Process")&&(r.parent=i(),r.process=o,r.processRef=ie(a).get("processRef"))},!0),this.execute("shape.create",function(r){var o=r.hints||{},a=r.process||o.process,s=r.shape,c=o.participant;a&&(!c||s===c)&&ie(s).set("processRef",ie(a))},!0),this.revert("shape.create",function(r){var o=r.hints||{},a=r.process||o.process,s=r.processRef||o.processRef,c=r.shape,l=o.participant;a&&(!l||c===l)&&ie(c).set("processRef",s)},!0),this.postExecute("shape.create",function(r){var o=r.hints||{},a=r.process||r.hints.process,s=r.shape,c=o.participant;if(a){var l=a.children.slice();c?s===c&&n.moveElements(l,{x:0,y:0},c):n.moveElements(l,{x:0,y:0},s)}},!0)}up.$inject=["canvas","eventBus","modeling"],Ee(up,te);function _A(e,t){t={width:t.width+cp*2+Eg,height:t.height+lp*2};var n=Math.max(e.width,t.width),i=Math.max(e.height,t.height);return{x:-n/2,y:-i/2,width:n,height:i}}function wA(e,t){return t=Ie(t),{bottom:t.top+e.height/2-lp,left:t.right-e.width/2+cp,top:t.bottom-e.height/2+lp,right:t.left+e.width/2-cp-Eg}}function EA(e){return vt(e,function(t){return S(t,"bpmn:Participant")})}var Sg="__targetRef_placeholder";function pp(e,t){te.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],Rg(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],Rg(o));function n(a,s,c){var l=a.get("dataInputAssociations");return vt(l,function(u){return u!==c&&u.targetRef===s})}function i(a,s){var c=a.get("properties"),l=vt(c,function(u){return u.name===Sg});return!l&&s&&(l=t.create("bpmn:Property",{name:Sg}),Bt(c,l)),l}function r(a,s){var c=i(a);c&&(n(a,c,s)||Lt(a.get("properties"),c))}function o(a){var s=a.context,c=s.connection,l=c.businessObject,u=c.target,f=u&&u.businessObject,p=s.newTarget,d=p&&p.businessObject,m=s.oldTarget||s.target,h=m&&m.businessObject,y=c.businessObject,v;h&&h!==f&&r(h,l),d&&d!==f&&r(d,l),f?(v=i(f,!0),y.targetRef=v):y.targetRef=null}}pp.$inject=["eventBus","bpmnFactory"],Ee(pp,te);function Rg(e){return function(t){var n=t.context,i=n.connection;if(S(i,"bpmn:DataInputAssociation"))return e(t)}}function oc(e){this._bpmnUpdater=e}oc.$inject=["bpmnUpdater"],oc.prototype.execute=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.newSemanticParent,r=e.newDiParent;return e.oldSemanticParent=t.$parent,e.oldDiParent=n.$parent,this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,r),[]},oc.prototype.revert=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.oldSemanticParent,r=e.oldDiParent;return this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,r),[]};function fp(e,t,n,i){te.call(this,i),t.registerHandler("dataStore.updateContainment",oc);function r(){return n.filter(function(s){return S(s,"bpmn:Participant")&&ie(s).processRef})[0]}function o(s){return s.children.filter(function(c){return S(c,"bpmn:DataStoreReference")&&!c.labelTarget})}function a(s,c){var l=s.businessObject||s;if(c=c||r(),c){var u=c.businessObject||c;t.execute("dataStore.updateContainment",{dataStoreBo:l,dataStoreDi:ot(s),newSemanticParent:u.processRef||u,newDiParent:ot(c)})}}this.preExecute("shape.create",function(s){var c=s.context,l=c.shape;S(l,"bpmn:DataStoreReference")&&l.type!=="label"&&(c.hints||(c.hints={}),c.hints.autoResize=!1)}),this.preExecute("elements.move",function(s){var c=s.context,l=c.shapes,u=l.filter(function(f){return S(f,"bpmn:DataStoreReference")});u.length&&(c.hints||(c.hints={}),c.hints.autoResize=l.filter(function(f){return!S(f,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,l=c.shape,u=l.parent;S(l,"bpmn:DataStoreReference")&&l.type!=="label"&&S(u,"bpmn:Collaboration")&&a(l)}),this.postExecute("shape.move",function(s){var c=s.context,l=c.shape,u=c.oldParent,f=l.parent;if(!S(u,"bpmn:Collaboration")&&S(l,"bpmn:DataStoreReference")&&l.type!=="label"&&S(f,"bpmn:Collaboration")){var p=S(u,"bpmn:Participant")?u:RA(u,"bpmn:Participant");a(l,p)}}),this.postExecute("shape.delete",function(s){var c=s.context,l=c.shape,u=e.getRootElement();qe(l,["bpmn:Participant","bpmn:SubProcess"])&&S(u,"bpmn:Collaboration")&&o(u).filter(function(f){return SA(f,l)}).forEach(function(f){a(f)})}),this.postExecute("canvas.updateRoot",function(s){var c=s.context,l=c.oldRoot,u=c.newRoot,f=o(l);f.forEach(function(p){S(u,"bpmn:Process")&&a(p,u)})})}fp.$inject=["canvas","commandStack","elementRegistry","eventBus"],Ee(fp,te);function SA(e,t){for(var n=e.businessObject||e,i=t.businessObject||t;n.$parent;){if(n.$parent===i.processRef||i)return!0;n=n.$parent}return!1}function RA(e,t){for(;e.parent;){if(S(e.parent,t))return e.parent;e=e.parent}}var ac=Math.max,sc=Math.min,CA=20;function Cg(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function AA(e,t,n){var i=n.x,r=n.y,o={x:e.x,y:e.y,width:e.width,height:e.height};return t.indexOf("n")!==-1?(o.y=e.y+r,o.height=e.height-r):t.indexOf("s")!==-1&&(o.height=e.height+r),t.indexOf("e")!==-1?o.width=e.width+i:t.indexOf("w")!==-1&&(o.x=e.x+i,o.width=e.width-i),o}function PA(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 cc(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return Fe(r)&&(i=(/top|left/.test(e)?sc:ac)(i,r)),Fe(o)&&(i=(/top|left/.test(e)?ac:sc)(i,o)),i}function MA(e,t){if(!t)return e;var n=Ie(e);return Vs({top:cc("top",n,t),right:cc("right",n,t),bottom:cc("bottom",n,t),left:cc("left",n,t)})}function TA(e,t,n,i){var r=Ie(t),o={top:/n/.test(e)?r.bottom-n.height:r.top,left:/w/.test(e)?r.right-n.width:r.left,bottom:/s/.test(e)?r.top+n.height:r.bottom,right:/e/.test(e)?r.left+n.width:r.right},a=i?Ie(i):o,s={top:sc(o.top,a.top),left:sc(o.left,a.left),bottom:ac(o.bottom,a.bottom),right:ac(o.right,a.right)};return Vs(s)}function wa(e,t){return typeof e<"u"?e:CA}function kA(e,t){var n,i,r,o;return typeof t=="object"?(n=wa(t.left),i=wa(t.right),r=wa(t.top),o=wa(t.bottom)):n=i=r=o=wa(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function OA(e){return!(e.waypoints||e.type==="label")}function Ag(e,t){var n;if(e.length===void 0?n=Ke(e.children,OA):n=e,n.length)return kA(Ft(n),t)}var cr=Math.abs;function DA(e,t){return Cg(Ie(t),Ie(e))}var IA=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Jn=30;function lc(e,t){return t=t||[],e.children.filter(function(n){S(n,"bpmn:Lane")&&(lc(n,t),t.push(n))}),t}function lr(e){return e.children.filter(function(t){return S(t,"bpmn:Lane")})}function ei(e){return Co(e,IA)||e}function LA(e,t){var n=ei(e),i=S(n,"bpmn:Process")?[]:[n],r=lc(n,i),o=Ie(e),a=Ie(t),s=DA(e,t),c=[],l=tn(e);return r.forEach(function(u){if(u!==e){var f=l?0:s.top,p=l?s.right:0,d=l?0:s.bottom,m=l?s.left:0,h=Ie(u);s.top&&(cr(h.bottom-o.top)<10&&(d=a.top-h.bottom),cr(h.top-o.top)<5&&(f=a.top-h.top)),s.left&&(cr(h.right-o.left)<10&&(p=a.left-h.right),cr(h.left-o.left)<5&&(m=a.left-h.left)),s.bottom&&(cr(h.top-o.bottom)<10&&(f=a.bottom-h.top),cr(h.bottom-o.bottom)<5&&(d=a.bottom-h.bottom)),s.right&&(cr(h.left-o.right)<10&&(m=a.right-h.left),cr(h.right-o.right)<5&&(p=a.right-h.right)),(f||p||d||m)&&c.push({shape:u,newBounds:PA(u,{top:f,right:p,bottom:d,left:m})})}}),c}var BA=500;function dp(e,t){te.call(this,e);function n(i,r){var o=tn(i),a=lr(r),s=[],c=[],l=[],u=[];if(Nr(a,function(y){return o?y.y>i.y?c.push(y):s.push(y):y.x>i.x?u.push(y):l.push(y),y.children}),!!a.length){var f;o?c.length&&s.length?f=i.height/2:f=i.height:u.length&&l.length?f=i.width/2:f=i.width;var p,d,m,h;s.length&&(p=t.calculateAdjustments(s,"y",f,i.y-10),t.makeSpace(p.movingShapes,p.resizingShapes,{x:0,y:f},"s")),c.length&&(d=t.calculateAdjustments(c,"y",-f,i.y+i.height+10),t.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:-f},"n")),l.length&&(m=t.calculateAdjustments(l,"x",f,i.x-10),t.makeSpace(m.movingShapes,m.resizingShapes,{x:f,y:0},"e")),u.length&&(h=t.calculateAdjustments(u,"x",-f,i.x+i.width+10),t.makeSpace(h.movingShapes,h.resizingShapes,{x:-f,y:0},"w"))}}this.postExecuted("shape.delete",BA,function(i){var r=i.context,o=r.hints,a=r.shape,s=r.oldParent;S(a,"bpmn:Lane")&&(o&&o.nested||n(a,s))})}dp.$inject=["eventBus","spaceTool"],Ee(dp,te);var Pg=500;function uc(e,t){t.invoke(te,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Pg,function(i){var r=i.elements;r.filter(function(o){var a=o.host;return Mg(o,a)}).map(function(o){return r.indexOf(o)}).forEach(function(o){i.elements[o]=n._replaceShape(r[o])})},!0),this.preExecute("elements.move",Pg,function(i){var r=i.shapes,o=i.newHost;r.forEach(function(a,s){var c=a.host;Mg(a,$A(r,c)?c:o)&&(r[s]=n._replaceShape(a))})},!0)}uc.$inject=["bpmnReplace","injector"],Ee(uc,te),uc.prototype._replaceShape=function(e){var t=NA(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function NA(e){var t=ie(e),n=t.eventDefinitions;return n&&n[0]}function Mg(e,t){return!Ye(e)&&S(e,"bpmn:BoundaryEvent")&&!t}function $A(e,t){return e.indexOf(t)!==-1}var pc=Math.round,FA=Math.max;function jA(e,t){var n=e.x,i=e.y;return[["M",n,i],["m",0,-t],["a",t,t,0,1,1,0,2*t],["a",t,t,0,1,1,0,-2*t],["z"]]}function HA(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var Tg=10;function zA(e,t){var n,i;for(n=0;i=e[n];n++)if(fa(i,t)<=Tg)return{point:e[n],bendpoint:!0,index:n};return null}function GA(e,t){var n=Lm(jA(t,Tg),HA(e)),i=n[0],r=n[n.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=FA(i.segment2,r.segment2)-1,{point:e[o],bendpoint:!0,index:o}):{point:{x:pc(i.x+r.x)/2,y:pc(i.y+r.y)/2},index:i.segment2}:{point:{x:pc(i.x),y:pc(i.y)},index:i.segment2}:null}function hp(e,t){return zA(e,t)||GA(e,t)}function mp(e,t,n){te.call(this,e);function i(r,o,a){var s=o.waypoints,c,l,u,f,p,d,m,h=r.outgoing.slice(),y=r.incoming.slice(),v;Fe(a.width)?v=Ne(a):v=a;var g=hp(s,v);if(g){if(c=s.slice(0,g.index),l=s.slice(g.index+(g.bendpoint?1:0)),!c.length||!l.length)return;u=g.bendpoint?s[g.index]:v,(c.length===1||!kg(r,c[c.length-1]))&&c.push(Og(u)),(l.length===1||!kg(r,l[0]))&&l.unshift(Og(u))}f=o.source,p=o.target,t.canConnect(f,r,o)&&(n.reconnectEnd(o,r,c||v),d=o),t.canConnect(r,p,o)&&(d?m=n.connect(r,p,{type:o.type,waypoints:l}):(n.reconnectStart(o,r,l||v),m=o));var b=[].concat(d&&Ke(y,function(x){return x.source===d.source})||[],m&&Ke(h,function(x){return x.target===m.target})||[]);b.length&&n.removeElements(b)}this.preExecute("elements.move",function(r){var o=r.newParent,a=r.shapes,s=r.delta,c=a[0];if(!(!c||!o)){o&&o.waypoints&&(r.newParent=o=o.parent);var l=Ne(c),u={x:l.x+s.x,y:l.y+s.y},f=vt(o.children,function(p){var d=t.canInsert(a,p);return d&&hp(p.waypoints,u)});f&&(r.targetFlow=f,r.position=u)}},!0),this.postExecuted("elements.move",function(r){var o=r.shapes,a=r.targetFlow,s=r.position;a&&i(o[0],a,s)},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;t.canInsert(a,o)&&(r.targetFlow=o,r.parent=o.parent)},!0),this.postExecuted("shape.create",function(r){var o=r.shape,a=r.targetFlow,s=r.position;a&&i(o,a,s)},!0)}Ee(mp,te),mp.$inject=["eventBus","bpmnRules","modeling"];function kg(e,t){var n=t.x,i=t.y;return n>=e.x&&n<=e.x+e.width&&i>=e.y&&i<=e.y+e.height}function Og(e){return W({},e)}function gp(e,t){te.call(this,e),this.preExecuted("connection.create",function(n){var i=n.context,r=i.connection,o=i.source,a=i.target,s=i.hints;if(!(s&&s.createElementsBehavior===!1)&&Po(r)){var c=[];S(o,"bpmn:EventBasedGateway")?c=a.incoming.filter(l=>l!==r&&Po(l)):c=a.incoming.filter(l=>l!==r&&Po(l)&&S(l.source,"bpmn:EventBasedGateway")),c.forEach(function(l){t.removeConnection(l)})}}),this.preExecuted("shape.replace",function(n){var i=n.context,r=i.newShape;if(S(r,"bpmn:EventBasedGateway")){var o=r.outgoing.filter(Po).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);o.forEach(function(a){a.incoming.filter(Po).forEach(function(s){const c=a.incoming.filter(Po).filter(function(l){return l.source===r});(s.source!==r||c.length>1)&&t.removeConnection(s)})})}})}gp.$inject=["eventBus","modeling"],Ee(gp,te);function Po(e){return S(e,"bpmn:SequenceFlow")}var fc=1500,Dg=2e3;function Ig(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"],fc,function(i){var r=i.context,o=r.shape||i.shape,a=i.hover;S(a,"bpmn:Lane")&&!qe(o,["bpmn:Lane","bpmn:Participant"])&&(i.hover=ei(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(o.labelTarget||qe(o,["bpmn:Group","bpmn:TextAnnotation"]))&&(i.hover=s,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.hover","connect.out","connect.end","connect.cleanup","global-connect.hover","global-connect.out","global-connect.end","global-connect.cleanup"],fc,function(i){var r=i.hover;S(r,"bpmn:Lane")&&(i.hover=ei(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],fc,function(i){var r=i.context,o=i.hover,a=r.type;S(o,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=ei(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],fc,function(i){var r=i.context,o=r.start;S(o,"bpmn:Lane")&&(r.start=ei(o)||o)}),t.on("shape.move.start",Dg,function(i){var r=i.shape;S(r,"bpmn:Lane")&&(i.shape=ei(r)||r)}),t.on("spaceTool.move",Dg,function(i){var r=i.hover;r&&S(r,"bpmn:Lane")&&(i.hover=ei(r))})}Ig.$inject=["elementRegistry","eventBus","canvas"];var Lg=770;function yp(e,t,n,i){n.invoke(te,this);function r(s,c){var l=ie(s),u=c.categoryValue||l.categoryValueRef;u||(u=_g(e,l));var f=c.category||u.$parent||xg(e);l.categoryValueRef=u,u.$parent=f,c.categoryValue=u,c.category=f}function o(s,c){var l=ie(s),u=c.categoryValue||l.categoryValueRef,f=c.category||u&&u.$parent;u&&(c.categoryValue=u,c.category=f,l.categoryValueRef=null)}this.execute("label.create",function(s){var c=s.context,l=c.labelTarget;S(l,"bpmn:Group")&&r(l,c)}),this.revert("label.create",function(s){var c=s.context,l=c.labelTarget;S(l,"bpmn:Group")&&o(l,c)}),this.execute("shape.delete",function(s){var c=s.context,l=c.shape,u=ie(l);if(!(!S(l,"bpmn:Group")||l.labelTarget)){var f=c.categoryValue=u.categoryValueRef;f&&(c.category=f.$parent,u.categoryValueRef=null)}}),this.reverted("shape.delete",function(s){var c=s.context,l=c.shape;if(!(!S(l,"bpmn:Group")||l.labelTarget)){var u=c.category,f=c.categoryValue,p=ie(l);f&&(p.categoryValueRef=f,f.$parent=u)}}),this.execute("shape.create",function(s){var c=s.context,l=c.shape,u=c.hints||{};!S(l,"bpmn:Group")||l.labelTarget||u.createElementsBehavior===!1&&!ie(l).categoryValueRef&&!c.categoryValue||r(l,c)}),this.reverted("shape.create",function(s){var c=s.context,l=c.shape,u=c.hints||{};!S(l,"bpmn:Group")||l.labelTarget||u.createElementsBehavior===!1&&!ie(l).categoryValueRef&&!c.categoryValue||o(l,c)}),this.executed(["shape.move","shape.resize"],function(s){var c=s.context,l=c.shape;!S(l,"bpmn:Group")||l.labelTarget||ie(l).categoryValueRef||r(l,c)}),this.reverted(["shape.move","shape.resize"],function(s){var c=s.context,l=c.shape;!S(l,"bpmn:Group")||l.labelTarget||!c.categoryValue||o(l,c)});function a(s,c){var l=e.create(s.$type);return i.copyElement(s,l,null,c)}t.on("copyPaste.copyElement",Lg,function(s){var c=s.descriptor,l=s.element;if(!(!S(l,"bpmn:Group")||l.labelTarget)){var u=ie(l);if(u.categoryValueRef){var f=u.categoryValueRef;c.categoryValue=a(f,!0),f.$parent&&(c.category=a(f.$parent,!0))}}}),t.on("copyPaste.pasteElement",Lg,function(s){var c=s.descriptor,l=c.businessObject,u=c.categoryValue,f=c.category;u&&(u=l.categoryValueRef=a(u)),f&&(u.$parent=a(f)),delete c.category,delete c.categoryValue})}yp.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],Ee(yp,te);function vp(e,t,n,i){var r,o,a,s,c;return r=(i.y-n.y)*(t.x-e.x)-(i.x-n.x)*(t.y-e.y),r==0?null:(o=e.y-n.y,a=e.x-n.x,c=(i.x-n.x)*o-(i.y-n.y)*a,s=c/r,{x:Math.round(e.x+s*(t.x-e.x)),y:Math.round(e.y+s*(t.y-e.y))})}function Bg(e){function t(i,r,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=vp(i,r,o,a),l=vp(i,r,o,s),u;c&&l?Ng(c,o)>Ng(l,o)?u=l:u=c:u=c||l,i.original=u}function n(i){var r=i.waypoints;t(r[0],r[1],Ne(i.source)),t(r[r.length-1],r[r.length-2],Ne(i.target))}e.on("bpmnElement.added",function(i){var r=i.element;r.waypoints&&n(r)})}Bg.$inject=["eventBus"];function Ng(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function bp(e){te.call(this,e);var t=["bpmn:Participant","bpmn:Lane"];this.executed(["shape.move","shape.create","shape.resize"],function(n){var i=n.context.shape,r=ie(i),o=ot(i);if(qe(r,t)){var a=o.get("isHorizontal");a===void 0&&(a=!0),o.set("isHorizontal",a)}})}bp.$inject=["eventBus"],Ee(bp,te);function $g(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Fg(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function VA(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 WA(e,t,n){var i=[{n:e[0]-n[0],lambda:t[0]},{n:e[1]-n[1],lambda:t[1]}],r=i[0].n*t[0]+i[1].n*t[1],o=i[0].lambda*t[0]+i[1].lambda*t[1];return-r/o}function xp(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=WA([n.x,n.y],[r.x,r.y],[e.x,e.y]);return{x:n.x+o*r.x,y:n.y+o*r.y}}function jg(e,t){var n=xp(e,t),i={x:n.x-e.x,y:n.y-e.y};return $g(i)}function Ea(e,t){return $g({x:e.x-t.x,y:e.y-t.y})}var Hg=Math.sqrt,zg=Math.min,UA=Math.max,Gg=Math.abs;function Vg(e){return Math.pow(e,2)}function Sa(e,t){return Hg(Vg(e.x-t.x)+Vg(e.y-t.y))}function YA(e,t){var n=0,i,r,o,a,s,c,l,u,f,p,d;for(n=0;n<t.length-1;n++){if(i=t[n],r=t[n+1],Ug(i,r)?l=[i]:(o=Sa(e,i),a=Sa(e,r),c=zg(o,a),l=qA(i,r,e,c)),l.length<1)throw new Error("expected between [1, 2] circle -> line intersections");l.length===1&&(u={type:"bendpoint",position:l[0],segmentIndex:n,bendpointIndex:Ug(i,l[0])?n:n+1}),l.length===2&&(s=XA(l[0],l[1]),u={type:"segment",position:s,segmentIndex:n,relativeLocation:Sa(i,s)/Sa(i,r)}),f=Sa(u.position,e),(!d||p>f)&&(d=u,p=f)}return d}function qA(e,t,n,i){var r=t.x-e.x,o=t.y-e.y,a=n.x-e.x,s=n.y-e.y,c=r*r+o*o,l=r*a+o*s,u=a*a+s*s-i*i,f=l/c,p=u/c,d=f*f-p;if(d<0&&d>-1e-6&&(d=0),d<0)return[];var m=Hg(d),h=-f+m,y=-f-m,v={x:e.x-r*h,y:e.y-o*h};if(d===0)return[v];var g={x:e.x-r*y,y:e.y-o*y};return[v,g].filter(function(b){return KA(b,e,t)})}function KA(e,t,n){return Wg(e.x,t.x,n.x)&&Wg(e.y,t.y,n.y)}function Wg(e,t,n){return e>=zg(t,n)-dc&&e<=UA(t,n)+dc}function XA(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var dc=.1;function Ug(e,t){return Gg(e.x-t.x)<=dc&&Gg(e.y-t.y)<=dc}function ZA(e,t,n,i){var r=n.segmentIndex,o=t.length-e.length;if(i.segmentMove){var a=i.segmentMove.segmentStartIndex,s=i.segmentMove.newSegmentStartIndex;return r===a?s:r>=s?r+o<s?s:r+o:r}if(i.bendpointMove){var c=i.bendpointMove.insert,l=i.bendpointMove.bendpointIndex,u;if(o===0)return r;if(r>=l&&(u=c?r+1:r-1),r<l&&(u=r,c&&n.type!=="bendpoint"&&l-1===r)){var f=qg(t,l);f<n.relativeLocation&&u++}return u}return o===0?r:i.connectionStart&&r===0?0:i.connectionEnd&&r===e.length-2?t.length-2:Math.floor((t.length-2)/2)}function Yg(e,t,n,i){var r=0,o=0,a={point:e,delta:{x:0,y:0}},s=YA(e,n),c=s.segmentIndex,l=ZA(n,t,s,i);if(l<0||l>t.length-2||l===null)return a;var u=Kg(n,c),f=Kg(t,l),p=s.position,d=JA(u,p),m=QA(u,f);if(s.type==="bendpoint"){var h=t.length-n.length,y=s.bendpointIndex,v=n[y];if(t.indexOf(v)!==-1)return a;if(h===0){var g=t[y];return r=g.x-s.position.x,o=g.y-s.position.y,{delta:{x:r,y:o},point:{x:e.x+r,y:e.y+o}}}h<0&&y!==0&&y<n.length-1&&(d=qg(n,y))}var b={x:(f[1].x-f[0].x)*d+f[0].x,y:(f[1].y-f[0].y)*d+f[0].y},x=VA({x:e.x-p.x,y:e.y-p.y},m);return r=b.x+x.x-e.x,o=b.y+x.y-e.y,{point:Bi(b),delta:Bi({x:r,y:o})}}function qg(e,t){var n=Ea(e[t-1],e[t]),i=Ea(e[t],e[t+1]),r=n/(n+i);return r}function QA(e,t){var n=Fg(e),i=Fg(t);return i-n}function Kg(e,t){return[e[t],e[t+1]]}function JA(e,t){var n=Ea(e[0],e[1]),i=Ea(e[0],t);return n===0?0:i/n}function eP(e,t,n,i){var r=Ne(e);return Yg(r,t,n,i).delta}function Ra(e,t,n){var i=xa(t),r=xa(n),o=pi(e,i),a={x:o.x*(n.width/t.width),y:o.y*(n.height/t.height)};return Bi({x:r.x+a.x,y:r.y+a.y})}function Xg(e,t,n){var i=xa(e),r=xa(t),o=xa(n),a=pi(e,i),s=pi(i,r),c=tP(i,t,n);if(c)return c;var l={x:s.x*(n.width/t.width),y:s.y*(n.height/t.height)},u={x:o.x+l.x,y:o.y+l.y};return Bi({x:u.x+a.x-e.x,y:u.y+a.y-e.y})}function tP(e,t,n){var i=Ie(t),r=Ie(n);if(nP(i,r))return null;var o=cn(t,e),a,s,c;if(o==="top")a={x:0,y:r.bottom-i.bottom};else if(o==="bottom")a={x:0,y:r.top-i.top};else if(o==="right")a={x:r.left-i.left,y:0};else if(o==="left")a={x:r.right-i.right,y:0};else return null;return s={x:e.x+a.x,y:e.y+a.y},c=cn(n,s),c!==o?null:a}function nP(e,t){return iP(e,t)||rP(e,t)}function iP(e,t){return e.right!==t.right&&e.left!==t.left}function rP(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var Zg="name",Qg="text";function _p(e,t,n,i){te.call(this,e),this.postExecute("element.updateProperties",r),this.postExecute("element.updateModdleProperties",a=>{ie(a.context.element)===a.context.moddleElement&&r(a)});function r(a){var s=a.context,c=s.element,l=s.properties;if(Zg in l&&t.updateLabel(c,l[Zg]),Qg in l&&S(c,"bpmn:TextAnnotation")){var u=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},l[Qg]||"");t.updateLabel(c,l.text,u)}}this.postExecute(["shape.create","connection.create"],function(a){var s=a.context,c=s.hints||{};if(c.createElementsBehavior!==!1){var l=s.shape||s.connection;Ye(l)||!sr(l)||qn(l)&&t.updateLabel(l,qn(l))}}),this.postExecute("shape.delete",function(a){var s=a.context,c=s.labelTarget,l=s.hints||{};c&&l.unsetLabel!==!1&&t.updateLabel(c,null,null,{removeShape:!1})});function o(a){var s=a.context,c=s.connection,l=c.label,u=W({},s.hints),f=s.newWaypoints||c.waypoints,p=s.oldWaypoints;return typeof u.startChanged>"u"&&(u.startChanged=!!u.connectionStart),typeof u.endChanged>"u"&&(u.endChanged=!!u.connectionEnd),eP(l,f,p,u)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(a){var s=a.context,c=s.hints||{};if(c.labelBehavior!==!1){var l=s.connection,u=l.label,f;!u||!u.parent||(f=o(a),t.moveShape(u,f))}}),this.postExecute(["shape.replace"],function(a){var s=a.context,c=s.newShape,l=s.oldShape,u=ie(c);u&&sr(u)&&l.label&&c.label&&(c.label.x=l.label.x,c.label.y=l.label.y)}),this.preExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.hints||{};if(!(!Ye(c)||l.autoResize)){var u=s.newBounds,f=i.getDimensions(qn(c)||"",{box:u,style:i.getExternalStyle()}),p=Math.ceil(f.height),d=u.y!==c.y,m=c.y+c.height;s.newBounds={width:u.width,height:p,x:u.x,y:d?m-p:u.y}}}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.newBounds,u=s.oldBounds;if(Xs(c)){var f=c.label,p=Ne(f),d=sP(u),m=aP(p,d),h=oP(m,u,l);t.moveShape(f,h)}})}Ee(_p,te),_p.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function oP(e,t,n){var i=Ra(e,t,n);return Bi(pi(i,e))}function aP(e,t){if(t.length){var n=cP(e,t);return xp(e,n)}}function sP(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 cP(e,t){var n=t.map(function(r){return{line:r,distance:jg(e,r)}}),i=di(n,"distance");return i[0].line}function lP(e,t,n,i){return Yg(e,t,n,i).point}function wp(e,t){te.call(this,e);function n(i,r){var o=i.context,a=o.connection,s=W({},o.hints),c=o.newWaypoints||a.waypoints,l=o.oldWaypoints;return typeof s.startChanged>"u"&&(s.startChanged=!!s.connectionStart),typeof s.endChanged>"u"&&(s.endChanged=!!s.connectionEnd),lP(r,c,l,s)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(i){var r=i.context,o=r.connection,a=o.outgoing,s=o.incoming;s.forEach(function(c){var l=c.waypoints[c.waypoints.length-1],u=n(i,l),f=[].concat(c.waypoints.slice(0,-1),[u]);t.updateWaypoints(c,f)}),a.forEach(function(c){var l=c.waypoints[0],u=n(i,l),f=[].concat([u],c.waypoints.slice(1));t.updateWaypoints(c,f)})}),this.postExecute(["connection.move"],function(i){var r=i.context,o=r.connection,a=o.outgoing,s=o.incoming,c=r.delta;s.forEach(function(l){var u=l.waypoints[l.waypoints.length-1],f={x:u.x+c.x,y:u.y+c.y},p=[].concat(l.waypoints.slice(0,-1),[f]);t.updateWaypoints(l,p)}),a.forEach(function(l){var u=l.waypoints[0],f={x:u.x+c.x,y:u.y+c.y},p=[].concat([f],l.waypoints.slice(1));t.updateWaypoints(l,p)})})}Ee(wp,te),wp.$inject=["eventBus","modeling"];function hc(e,t,n){var i=gc(e),r=ey(i,t),o=i[0];return r.length?r[r.length-1]:Ra(o.original||o,n,t)}function mc(e,t,n){var i=gc(e),r=ey(i,t),o=i[i.length-1];return r.length?r[0]:Ra(o.original||o,n,t)}function Ep(e,t,n){var i=gc(e),r=Jg(t,n),o=i[0];return Ra(o.original||o,r,t)}function Sp(e,t,n){var i=gc(e),r=Jg(t,n),o=i[i.length-1];return Ra(o.original||o,r,t)}function Jg(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function gc(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function ey(e,t){var n=hn(e,pP);return Ke(n,function(i){return uP(i,t)})}function uP(e,t){return cn(t,e,1)==="intersect"}function pP(e){return e.original||e}function Rp(e,t){te.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,r=n.newShape;if(fP(i,r)){var o=dP(i);o.incoming.forEach(function(a){var s=mc(a,r,i);t.reconnectEnd(a,r,s)}),o.outgoing.forEach(function(a){var s=hc(a,r,i);t.reconnectStart(a,r,s)})}},!0)}Rp.$inject=["eventBus","modeling"],Ee(Rp,te);function fP(e,t){return S(e,"bpmn:Participant")&&Qe(e)&&S(t,"bpmn:Participant")&&!Qe(t)}function dP(e){var t=ua([e]),n=[],i=[];return t.forEach(function(r){r!==e&&(r.incoming.forEach(function(o){S(o,"bpmn:MessageFlow")&&n.push(o)}),r.outgoing.forEach(function(o){S(o,"bpmn:MessageFlow")&&i.push(o)}))},[]),{incoming:n,outgoing:i}}const hP=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function ty(e){const t=ie(e);if(!S(t,"bpmn:BoundaryEvent")&&!(S(t,"bpmn:StartEvent")&&vn(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:hP.some(i=>S(n[0],i))}function ny(e){return S(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function Cp(e,t){e.invoke(te,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,r=n.context.newShape,o=n.context.hints;if(!ty(r))return;const a=ny(r);if(o.targetElement&&o.targetElement[a]!==void 0)return;const c=ie(i).get(a),l=ie(r).get(a);c!==l&&t.updateProperties(r,{[a]:c})})}Cp.$inject=["injector","modeling"],Ee(Cp,te);function Ap(e,t){te.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,r=ot(i),o=r&&r.get("label"),a=o&&o.get("bounds");a&&t.updateModdleProperties(i,o,{bounds:void 0})},!0)}Ee(Ap,te),Ap.$inject=["eventBus","modeling"];function Pp(e,t,n){te.call(this,e),this.preExecute("shape.delete",function(i){var r=i.context.shape;if(!(r.incoming.length!==1||r.outgoing.length!==1)){var o=r.incoming[0],a=r.outgoing[0];if(!(!S(o,"bpmn:SequenceFlow")||!S(a,"bpmn:SequenceFlow"))&&t.canConnect(o.source,a.target,o)){var s=mP(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}Ee(Pp,te),Pp.$inject=["eventBus","bpmnRules","modeling"];function Mo(e){return e.original||e}function mP(e,t){var n=vp(Mo(e[e.length-2]),Mo(e[e.length-1]),Mo(t[1]),Mo(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[Mo(e[0]),Mo(t[t.length-1])]}function Mp(e,t){te.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,r=i.parent;S(i,"bpmn:Participant")&&(n.collaborationRoot=r)},!0),this.postExecute("shape.delete",function(n){var i=n.collaborationRoot;if(i&&!i.businessObject.participants.length){var r=t.makeProcess(),o=i.children.slice();t.moveElements(o,{x:0,y:0},r)}},!0)}Mp.$inject=["eventBus","modeling"],Ee(Mp,te);function Tp(e,t,n,i){te.call(this,e);var r=i.get("dragging",!1);function o(c){var l=c.source,u=c.target,f=c.parent;if(f){var p,d;S(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(l,u)||(d=!0),n.canConnectMessageFlow(l,u)&&(p="bpmn:MessageFlow")),S(c,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(l,u)||(d=!0),n.canConnectSequenceFlow(l,u)&&(p="bpmn:SequenceFlow")),d&&t.removeConnection(c),p&&t.connect(l,u,{type:p,waypoints:c.waypoints.slice()})}}function a(c){var l=c.context,u=l.connection,f=l.newSource||u.source,p=l.newTarget||u.target,d,m;d=n.canConnect(f,p),!(!d||d.type===u.type)&&(m=t.connect(f,p,{type:d.type,associationDirection:d.associationDirection,waypoints:u.waypoints.slice()}),u.parent&&t.removeConnection(u),l.connection=m,r&&s(u,m))}function s(c,l){var u=r.context(),f=u&&u.payload.previousSelection,p;!f||!f.length||(p=f.indexOf(c),p!==-1&&f.splice(p,1,l))}this.postExecuted("elements.move",function(c){var l=c.closure,u=l.allConnections;F(u,o)},!0),this.preExecute("connection.reconnect",a),this.postExecuted("element.updateProperties",function(c){var l=c.context,u=l.properties,f=l.element,p=f.businessObject,d;u.default&&(d=vt(f.outgoing,ao({id:f.businessObject.default.id})),d&&t.updateProperties(d,{conditionExpression:void 0})),u.conditionExpression&&p.sourceRef.default===p&&t.updateProperties(f.source,{default:void 0})})}Ee(Tp,te),Tp.$inject=["eventBus","modeling","bpmnRules","injector"];function yc(e,t,n,i,r,o){i.invoke(te,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=o,this.postExecuted(["elements.create"],500,function(a){var s=a.context,c=s.parent,l=s.elements,u=Tn(l,function(f,p){var d=t.canReplace([p],p.host||p.parent||c);return d?f.concat(d.replacements):f},[]);u.length&&this._replaceElements(l,u)},this),this.postExecuted(["elements.move"],500,function(a){var s=a.context,c=s.newParent,l=s.newHost,u=[];F(s.closure.topLevel,function(p){vn(p)?u=u.concat(p.children):u=u.concat(p)}),u.length===1&&l&&(c=l);var f=t.canReplace(u,c);f&&this._replaceElements(u,f.replacements,l)},this),this.postExecute(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,l=s.newShape,u=c.attachers,f;u&&u.length&&(f=t.canReplace(u,l),this._replaceElements(u,f.replacements))},this),this.postExecuted(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,l=s.newShape;r.unclaimId(c.businessObject.id,c.businessObject),r.updateProperties(l,{id:c.id})})}Ee(yc,te),yc.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,r=this._selection;F(t,function(o){var a={type:o.newElementType},s=n.get(o.oldElementId),c=e.indexOf(s);e[c]=i.replaceElement(s,a,{select:!1})}),t&&r.select(e)},yc.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var gP=1500,yP={width:140,height:120},kp={width:300,height:60},Op={width:60,height:300},vc={width:300,height:150},bc={width:150,height:300},iy={width:140,height:120},ry={width:100,height:40};function oy(e){e.on("resize.start",gP,function(t){var n=t.context,i=n.shape,r=n.direction,o=n.balanced;(S(i,"bpmn:Lane")||S(i,"bpmn:Participant"))&&(n.resizeConstraints=wP(i,r,o)),S(i,"bpmn:SubProcess")&&Qe(i)&&(n.minDimensions=iy),S(i,"bpmn:TextAnnotation")&&(n.minDimensions=ry)})}oy.$inject=["eventBus"];var ur=Math.abs,vP=Math.min,bP=Math.max;function ay(e,t,n,i){var r=e[t];e[t]=r===void 0?n:i(n,r)}function To(e,t,n){return ay(e,t,n,vP)}function ko(e,t,n){return ay(e,t,n,bP)}var xP={top:20,left:50,right:20,bottom:20},_P={top:50,left:20,right:20,bottom:20};function wP(e,t,n){var i=ei(e),r=!0,o=!0,a=lc(i,[i]),s=Ie(e),c={},l={},u=tn(e),f=u?kp:Op;/n/.test(t)?l.top=s.bottom-f.height:/e/.test(t)?l.right=s.left+f.width:/s/.test(t)?l.bottom=s.top+f.height:/w/.test(t)&&(l.left=s.right-f.width),a.forEach(function(m){var h=Ie(m);u?(h.top<s.top-10&&(r=!1),h.bottom>s.bottom+10&&(o=!1)):(h.left<s.left-10&&(r=!1),h.right>s.right+10&&(o=!1)),/n/.test(t)&&(n&&ur(s.top-h.bottom)<10&&ko(c,"top",h.top+f.height),ur(s.top-h.top)<5&&To(l,"top",h.bottom-f.height)),/e/.test(t)&&(n&&ur(s.right-h.left)<10&&To(c,"right",h.right-f.width),ur(s.right-h.right)<5&&ko(l,"right",h.left+f.width)),/s/.test(t)&&(n&&ur(s.bottom-h.top)<10&&To(c,"bottom",h.bottom-f.height),ur(s.bottom-h.bottom)<5&&ko(l,"bottom",h.top+f.height)),/w/.test(t)&&(n&&ur(s.left-h.right)<10&&ko(c,"left",h.left+f.width),ur(s.left-h.left)<5&&To(l,"left",h.right-f.width))});var p=i.children.filter(function(m){return!m.hidden&&!m.waypoints&&(S(m,"bpmn:FlowElement")||S(m,"bpmn:Artifact"))}),d=u?xP:_P;return p.forEach(function(m){var h=Ie(m);/n/.test(t)&&(!u||r)&&To(l,"top",h.top-d.top),/e/.test(t)&&(u||o)&&ko(l,"right",h.right+d.right),/s/.test(t)&&(!u||o)&&ko(l,"bottom",h.bottom+d.bottom),/w/.test(t)&&(u||r)&&To(l,"left",h.left-d.left)}),{min:l,max:c}}function sy(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function Oo(e){return e.originalEvent||e.srcEvent}function Dp(e){sy(e),sy(Oo(e))}function Hr(e){return e.pointers&&e.pointers.length&&(e=e.pointers[0]),e.touches&&e.touches.length&&(e=e.touches[0]),e?{x:e.clientX,y:e.clientY}:null}function cy(){return/mac/i.test(navigator.platform)}function ly(e,t){return(Oo(e)||e).button===t}function pr(e){return ly(e,0)}function EP(e){return ly(e,1)}function Ca(e){var t=Oo(e)||e;return pr(e)?cy()?t.metaKey:t.ctrlKey:!1}function xc(e){var t=Oo(e)||e;return pr(e)&&t.shiftKey}var uy=1001;function py(e,t){e.on("resize.start",uy+500,function(n){var i=n.context,r=i.shape;(S(r,"bpmn:Lane")||S(r,"bpmn:Participant"))&&(i.balanced=!Ca(n))}),e.on("resize.end",uy,function(n){var i=n.context,r=i.shape,o=i.canExecute,a=i.newBounds;if(S(r,"bpmn:Lane")||S(r,"bpmn:Participant"))return o&&(a=jm(a),t.resizeLane(r,a,i.balanced)),!1})}py.$inject=["eventBus","modeling"];var SP=500;function Ip(e,t,n,i,r){n.invoke(te,this);function o(u){return qe(u,["bpmn:ReceiveTask","bpmn:SendTask"])||RP(u,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(u){var f=e.getDefinitions(),p=f.get("rootElements");return!!vt(p,ao({id:u.id}))}function s(u){if(S(u,"bpmn:ErrorEventDefinition"))return"errorRef";if(S(u,"bpmn:EscalationEventDefinition"))return"escalationRef";if(S(u,"bpmn:MessageEventDefinition"))return"messageRef";if(S(u,"bpmn:SignalEventDefinition"))return"signalRef"}function c(u){if(qe(u,["bpmn:ReceiveTask","bpmn:SendTask"]))return u.get("messageRef");var f=u.get("eventDefinitions"),p=f[0];return p.get(s(p))}function l(u,f){if(qe(u,["bpmn:ReceiveTask","bpmn:SendTask"]))return u.set("messageRef",f);var p=u.get("eventDefinitions"),d=p[0];return d.set(s(d),f)}this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],function(u){var f=u.shape||u.element;if(o(f)){var p=ie(f),d=c(p),m;d&&!a(d)&&(m=e.getDefinitions().get("rootElements"),Bt(m,d),u.addedRootElement=d)}},!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],function(u){var f=u.addedRootElement;if(f){var p=e.getDefinitions().get("rootElements");Lt(p,f)}},!0),t.on("copyPaste.copyElement",function(u){var f=u.descriptor,p=u.element;if(!(p.labelTarget||!o(p))){var d=ie(p),m=c(d);m&&(f.referencedRootElement=m)}}),t.on("copyPaste.pasteElement",SP,function(u){var f=u.descriptor,p=f.businessObject,d=f.referencedRootElement;d&&(a(d)||(d=i.copyElement(d,r.create(d.$type))),l(p,d),delete f.referencedRootElement)})}Ip.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],Ee(Ip,te);function RP(e,t){return Be(t)||(t=[t]),Xi(t,function(n){return Eo(e,n)})}var fy=Math.max;function dy(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,r=t.start,o={};return F(n,function(a){var s=a.id;S(a,"bpmn:Participant")&&(o[s]=AP(a,i,r)),S(a,"bpmn:Lane")&&(o[s]=tn(a)?kp:Op),S(a,"bpmn:SubProcess")&&Qe(a)&&(o[s]=iy),S(a,"bpmn:TextAnnotation")&&(o[s]=ry),S(a,"bpmn:Group")&&(o[s]=yP)}),o})}dy.$inject=["eventBus"];function CP(e){return e==="x"}function AP(e,t,n){var i=tn(e);if(!TP(e))return i?vc:bc;var r=CP(t),o={};return r?i?o=vc:o={width:MP(e,n,r),height:bc.height}:i?o={width:vc.width,height:PP(e,n,r)}:o=bc,o}function PP(e,t,n){var i;return i=kP(e,t,n),fy(vc.height,i)}function MP(e,t,n){var i;return i=OP(e,t,n),fy(bc.width,i)}function TP(e){return!!lr(e).length}function kP(e,t,n){var i=lr(e),r;return r=Lp(i,t,n),e.height-r.height+kp.height}function OP(e,t,n){var i=lr(e),r;return r=Lp(i,t,n),e.width-r.width+Op.width}function Lp(e,t,n){var i,r,o;for(i=0;i<e.length;i++)if(r=e[i],!n&&t>=r.y&&t<=r.y+r.height||n&&t>=r.x&&t<=r.x+r.width)return o=lr(r),o.length?Lp(o,t,n):r}var hy="_plane";function my(e){var t=e.id;return DP(t)}function Ei(e){var t=e.id;return S(e,"bpmn:SubProcess")?gy(t):t}function zr(e){return gy(e)}function _c(e){var t=ot(e);return S(t,"bpmndi:BPMNPlane")}function gy(e){return e+hy}function DP(e){return e.replace(new RegExp(hy+"$"),"")}var yy=400,IP=600,vy={x:180,y:160};function ji(e,t,n,i,r,o,a){te.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=i,this._bpmnFactory=r,this._bpmnjs=o,this._elementRegistry=a;var s=this;function c(f){return S(f,"bpmn:SubProcess")&&!Qe(f)}function l(f){var p=f.shape,d=f.newRootElement,m=ie(p);d=s._addDiagram(d||m),f.newRootElement=e.addRootElement(d)}function u(f){var p=f.shape,d=ie(p);s._removeDiagram(d);var m=f.newRootElement=a.get(Ei(d));e.removeRootElement(m)}this.executed("shape.create",function(f){var p=f.shape;c(p)&&l(f)},!0),this.postExecuted("elements.create",function(f){var p=f.elements;F(p,function(d){if(c(d)){var m=a.get(Ei(d));if(!(!m||!d.children||!d.children.length)){var h=by(d);s._showRecursively(h),s._moveChildrenToShape(h,m)}}})},!0),this.reverted("shape.create",function(f){var p=f.shape;c(p)&&u(f)},!0),this.preExecute("shape.delete",function(f){var p=f.shape;!S(p,"bpmn:SubProcess")||!Qe(p)||F(ga([p]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(f){var p=f.shape;if(c(p)){var d=a.get(Ei(p));d&&n.removeElements(d.children.slice())}},!0),this.executed("shape.delete",function(f){var p=f.shape;c(p)&&u(f)},!0),this.reverted("shape.delete",function(f){var p=f.shape;c(p)&&l(f)},!0),this.preExecuted("shape.replace",function(f){var p=f.oldShape,d=f.newShape;!c(p)||!c(d)||(f.oldRoot=e.removeRootElement(Ei(p)))},!0),this.postExecuted("shape.replace",function(f){var p=f.newShape,d=f.oldRoot,m=e.findRoot(Ei(p));if(!(!d||!m)){var h=d.children;n.moveElements(h,{x:0,y:0},m)}},!0),this.executed("element.updateProperties",function(f){var p=f.element;if(S(p,"bpmn:SubProcess")){var d=f.properties,m=f.oldProperties,h=m.id,y=d.id;if(h!==y){if(_c(p)){a.updateId(p,zr(y)),a.updateId(h,y);return}var v=a.get(zr(h));v&&a.updateId(zr(h),zr(y))}}},!0),this.reverted("element.updateProperties",function(f){var p=f.element;if(S(p,"bpmn:SubProcess")){var d=f.properties,m=f.oldProperties,h=m.id,y=d.id;if(h!==y){if(_c(p)){a.updateId(p,zr(h)),a.updateId(y,h);return}var v=a.get(zr(y));v&&a.updateId(v,zr(h))}}},!0),t.on("element.changed",function(f){var p=f.element;if(_c(p)){var d=p,m=a.get(my(d));!m||m===d||t.fire("element.changed",{element:m})}}),this.executed("shape.toggleCollapse",yy,function(f){var p=f.shape;S(p,"bpmn:SubProcess")&&(Qe(p)?u(f):(l(f),s._showRecursively(p.children)))},!0),this.reverted("shape.toggleCollapse",yy,function(f){var p=f.shape;S(p,"bpmn:SubProcess")&&(Qe(p)?u(f):(l(f),s._showRecursively(p.children)))},!0),this.postExecuted("shape.toggleCollapse",IP,function(f){var p=f.shape;if(S(p,"bpmn:SubProcess")){var d=f.newRootElement;if(d)if(Qe(p))s._moveChildrenToShape(d.children.slice(),p),F(ga(p.children),h=>{n.moveShape(h.annotation,{x:0,y:0},p.parent),F(h.associations,y=>{n.moveConnection(y,{x:0,y:0},p.parent)})});else{s._disconnectSharedAnnotations(p);var m=by(p);s._moveChildrenToShape(m,d)}}},!0),t.on("copyPaste.createTree",function(f){var p=f.element,d=f.children;if(c(p)){var m=Ei(p),h=a.get(m);h&&d.push.apply(d,h.children)}}),t.on("copyPaste.copyElement",function(f){var p=f.descriptor,d=f.element,m=f.elements,h=d.parent,y=S(ot(h),"bpmndi:BPMNPlane");if(y){var v=my(h),g=vt(m,function(b){return b.id===v});g&&(p.parent=g.id)}}),t.on("copyPaste.pasteElement",function(f){var p=f.descriptor;p.parent&&(c(p.parent)||p.parent.hidden)&&(p.hidden=!0)})}Ee(ji,te),ji.prototype._moveChildrenToShape=function(e,t){var n=this._modeling;if(e.length){var i=e.filter(function(c){return!c.hidden});if(!i.length){n.moveElements(e,{x:0,y:0},t,{autoResize:!1});return}var r=Ft(i),o;if(!t.x)o={x:vy.x-r.x,y:vy.y-r.y};else{var a=Ne(t),s=Ne(r);o={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,o,t,{autoResize:!1})}},ji.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(lg(e).map(i=>i.annotation));n.size&&F(ga(e.children),i=>{n.has(i.annotation)&&F(i.associations,r=>{t.removeConnection(r)})})},ji.prototype._showRecursively=function(e,t){var n=this,i=[];return e.forEach(function(r){r.hidden=!!t,i=i.concat(r),r.children&&(i=i.concat(n._showRecursively(r.children,r.collapsed||t)))}),i},ji.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},ji.prototype._createNewDiagram=function(e){var t=this._bpmnFactory,n=this._elementFactory,i=t.create("bpmndi:BPMNPlane",{bpmnElement:e}),r=t.create("bpmndi:BPMNDiagram",{plane:i});i.$parent=r;var o=n.createRoot({id:Ei(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return o},ji.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=vt(n,function(r){return r.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},ji.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function LP(e){var t=[];return F(ga(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function by(e){return e.children.slice().concat(LP(e.children)).concat(BP(e))}function BP(e){return ju(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function Bp(e,t){e.invoke(te,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,r=n.context.newShape;if(!(!S(r,"bpmn:SubProcess")||S(r,"bpmn:AdHocSubProcess")||!(S(i,"bpmn:Task")||S(i,"bpmn:CallActivity"))||!Qe(r))){var o=NP(r);t.createShape({type:"bpmn:StartEvent"},o,r)}})}Bp.$inject=["injector","modeling"],Ee(Bp,te);function NP(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function Np(e,t){te.call(this,e),this.preExecute("connection.create",function(n){const{target:i}=n;S(i,"bpmn:TextAnnotation")&&(n.parent=i.parent)},!0),this.preExecute(["shape.create","shape.resize","elements.move"],function(n){const i=n.shapes||[n.shape];i.length===1&&S(i[0],"bpmn:TextAnnotation")&&(n.hints=n.hints||{},n.hints.autoResize=!1)},!0),this.preExecute("shape.resize",function(n){var i=n.context,r=i.shape,o=i.hints||{};if(!(!S(r,"bpmn:TextAnnotation")||o.autoResize)){var a=i.newBounds,s=t.getTextAnnotationBounds(a,qn(r)||""),c=a.y!==r.y&&Math.abs(a.y+a.height-(r.y+r.height))<=1,l=r.y+r.height;i.newBounds={width:a.width,height:s.height,x:a.x,y:c?l-s.height:a.y}}})}Ee(Np,te),Np.$inject=["eventBus","textRenderer"];function $p(e,t){te.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(Qe(i))return;var r=ua(i);r.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();F(s,function(l){o(l,!0)}),F(c,function(l){o(l,!1)})});function o(a,s){r.indexOf(a.source)!==-1&&r.indexOf(a.target)!==-1||S(a,"bpmn:Association")&&(S(a.source,"bpmn:TextAnnotation")||S(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,i,Ne(i)):t.reconnectStart(a,i,Ne(i)))}},!0)}Ee($p,te),$p.$inject=["eventBus","modeling"];var Fp=500;function jp(e,t,n){te.call(this,e);function i(a){a.length&&a.forEach(function(s){s.type==="label"&&!s.businessObject.name&&(s.hidden=!0)})}function r(a,s){var c=a.children,l=s,u,f;return u=$P(c).concat([a]),f=Ag(u),f?(l.width=Math.max(f.width,l.width),l.height=Math.max(f.height,l.height),l.x=f.x+(f.width-l.width)/2,l.y=f.y+(f.height-l.height)/2):(l.x=a.x+(a.width-l.width)/2,l.y=a.y+(a.height-l.height)/2),l}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"],Fp,function(a){var s=a.context,c=s.shape;S(c,"bpmn:SubProcess")&&(c.collapsed?ot(c).isExpanded=!1:(i(c.children),ot(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],Fp,function(a){var s=a.context,c=s.shape;c.collapsed?ot(c).isExpanded=!1:ot(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],Fp,function(a){var s=a.context.shape,c=t.getDefaultSize(s),l;s.collapsed?l=o(s,c):l=r(s,c),n.resizeShape(s,l,null,{autoResize:s.collapsed?!1:"nwse"})})}Ee(jp,te),jp.$inject=["eventBus","elementFactory","modeling"];function $P(e){return e.filter(function(t){return!t.hidden})}function Hp(e,t,n,i){t.invoke(te,this),this.preExecute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.businessObject;Ye(a)||(S(a,"bpmn:Participant")&&Qe(a)&&n.ids.unclaim(s.processRef.id),i.unclaimId(s.id,s))}),this.preExecute("connection.delete",function(r){var o=r.context,a=o.connection,s=a.businessObject;i.unclaimId(s.id,s)}),this.preExecute("canvas.updateRoot",function(){var r=e.getRootElement(),o=r.businessObject;S(r,"bpmn:Collaboration")&&n.ids.unclaim(o.id)})}Ee(Hp,te),Hp.$inject=["canvas","injector","moddle","modeling"];function zp(e,t){te.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,r=i.connection,o=r.source;FP(r,o)&&t.updateProperties(o,{default:null})})}Ee(zp,te),zp.$inject=["eventBus","modeling"];function FP(e,t){if(!S(e,"bpmn:SequenceFlow"))return!1;var n=ie(t),i=ie(e);return n.get("default")===i}var jP=500,HP=5e3,xy=["shape.create","shape.delete","shape.move","shape.resize"],_y=[...xy,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function Gp(e,t){te.call(this,e);var n;function i(){return n=n||new zP,n.enter(),n}function r(){if(!n)throw new Error("out of bounds release");return n}function o(){if(!n)throw new Error("out of bounds release");var a=n.leave();return a&&(t.updateLaneRefs(n.flowNodes,n.lanes),n=null),a}this.preExecute(_y,HP,function(){i()}),this.postExecuted(_y,jP,function(){o()}),this.preExecute(xy,function(a){var s=a.context,c=s.shape,l=r();!c||c.labelTarget||(S(c,"bpmn:Lane")&&l.addLane(c),S(c,"bpmn:FlowNode")&&l.addFlowNode(c))})}Gp.$inject=["eventBus","modeling"],Ee(Gp,te);function zP(){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}}var GP=500,VP=5e3,wy=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],Ey=[...wy,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function Vp(e,t){te.call(this,e);var n;function i(){return n=n||new WP,n.enter(),n}function r(){if(!n)throw new Error("out of bounds release");return n}function o(){if(!n)throw new Error("out of bounds release");var a=n.leave();return a&&(t.updateCategoryValueRefs(Array.from(n.affectedFlowElements),Array.from(n.affectedGroupEntries.values())),n=null),a}this.preExecute(Ey,VP,function(){i()}),this.postExecuted(Ey,GP,function(){o()}),this.preExecute(wy,function(a){var s=a.context.connection||a.context.shape,c=r();!s||s.labelTarget||(S(s,"bpmn:FlowElement")&&c.addFlowElement(s),S(s,"bpmn:Group")&&c.addGroup(s))}),this.preExecute("label.create",function(a){var s=a.context.labelTarget;S(s,"bpmn:Group")&&r().addGroup(s)})}Vp.$inject=["eventBus","modeling"],Ee(Vp,te);function WP(){this.affectedFlowElements=new Set,this.affectedGroupEntries=new Map,this.counter=0,this.addFlowElement=function(e){this.affectedFlowElements.add(e)},this.addGroup=function(e){this.affectedGroupEntries.has(e)||this.affectedGroupEntries.set(e,{categoryValue:e.businessObject.categoryValueRef,groupShape:e})},this.enter=function(){this.counter++},this.leave=function(){return this.counter--,!this.counter}}function Wp(e,t){te.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,r=i.elements;for(const o of r)UP(o)&&!qP(o)&&t.updateProperties(o,{isForCompensation:void 0})})}Ee(Wp,te),Wp.$inject=["eventBus","modeling"];function UP(e){const t=ie(e);return t&&t.isForCompensation}function YP(e){return e&&S(e,"bpmn:BoundaryEvent")&&Eo(e,"bpmn:CompensateEventDefinition")}function qP(e){return e.incoming.filter(n=>YP(n.source)).length>0}const KP={__init__:["adaptiveLabelPositioningBehavior","appendBehavior","artifactBehavior","associationBehavior","attachEventBehavior","boundaryEventBehavior","categoryRootElementReferenceBehavior","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","updateCategoryValueRefsBehavior","unsetDefaultFlowBehavior","setCompensationActivityAfterPasteBehavior"],adaptiveLabelPositioningBehavior:["type",Ju],appendBehavior:["type",ep],associationBehavior:["type",np],attachEventBehavior:["type",nc],artifactBehavior:["type",tp],boundaryEventBehavior:["type",ip],categoryRootElementReferenceBehavior:["type",rp],compensateBoundaryEventBehaviour:["type",op],createBehavior:["type",ap],createDataObjectBehavior:["type",sp],createParticipantBehavior:["type",up],dataInputAssociationBehavior:["type",pp],dataStoreBehavior:["type",fp],deleteLaneBehavior:["type",dp],detachEventBehavior:["type",uc],dropOnFlowBehavior:["type",mp],eventBasedGatewayBehavior:["type",gp],fixHoverBehavior:["type",Ig],groupBehavior:["type",yp],importDockingFix:["type",Bg],isHorizontalFix:["type",bp],labelBehavior:["type",_p],layoutConnectionBehavior:["type",wp],messageFlowBehavior:["type",Rp],nonInterruptingBehavior:["type",Cp],removeElementBehavior:["type",Pp],removeEmbeddedLabelBoundsBehavior:["type",Ap],removeParticipantBehavior:["type",Mp],replaceConnectionBehavior:["type",Tp],replaceElementBehaviour:["type",yc],resizeBehavior:["type",oy],resizeLaneBehavior:["type",py],rootElementReferenceBehavior:["type",Ip],spaceToolBehavior:["type",dy],subProcessPlaneBehavior:["type",ji],subProcessStartEventBehavior:["type",Bp],textAnnotationBehavior:["type",Np],toggleCollapseConnectionBehaviour:["type",$p],toggleElementCollapseBehaviour:["type",jp],unclaimIdBehavior:["type",Hp],unsetDefaultFlowBehavior:["type",zp],updateFlowNodeRefsBehavior:["type",Gp],updateCategoryValueRefsBehavior:["type",Vp],setCompensationActivityAfterPasteBehavior:["type",Wp]};function Up(e){this._commandStack=e.get("commandStack",!1)}Up.$inject=["injector"],Up.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const Si={__init__:["rules"],rules:["type",Up]};function ti(e){te.call(this,e),this.init()}ti.$inject=["eventBus"],Ee(ti,te),ti.prototype.addRule=function(e,t,n){var i=this;typeof e=="string"&&(e=[e]),e.forEach(function(r){i.canExecute(r,t,function(o,a,s){return n(o)},!0)})},ti.prototype.init=function(){};function Sy(e,t){var n=cn(e,t,-15);return n!=="intersect"?n:null}function un(e){ti.call(this,e)}Ee(un,ti),un.$inject=["eventBus"],un.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return XP(t)}),this.addRule("connection.create",function(e){var t=e.source,n=e.target,i=e.hints||{},r=i.targetParent,o=i.targetAttach;if(o)return!1;r&&(n.parent=r);try{return Ec(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return Ec(n,i,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,i=e.direction;return Ny(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return ht(i)&&!Sc(t,i)?!1:kr(t,function(r){return ht(r)?Ec(r.source,r.target,r):r.host?Aa(r,r.host,null,n):Xp(r,i)})}),this.addRule("elements.move",function(e){var t=e.target,n=e.shapes,i=e.position,r=e.hints;return r!=null&&r.keyboardMove&&n.some(function(a){return ky(a)&&!n.includes(a.host)})?!1:Aa(n,t,null,i)||Ly(n,t,i)||By(n,t)||Sc(n,t)}),this.addRule("shape.create",function(e){return Xp(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return Aa(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return zy(n,t)})},un.prototype.canConnectMessageFlow=jy,un.prototype.canConnectSequenceFlow=Hy,un.prototype.canConnectDataAssociation=Zp,un.prototype.canConnectAssociation=$y,un.prototype.canConnectCompensationAssociation=Fy,un.prototype.canMove=By,un.prototype.canAttach=Aa,un.prototype.canReplace=Ly,un.prototype.canDrop=Do,un.prototype.canInsert=Sc,un.prototype.canCreate=Xp,un.prototype.canConnect=Ec,un.prototype.canResize=Ny,un.prototype.canCopy=zy;function XP(e){return Yp(e)?null:qe(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function Yp(e){return!e||Ye(e)}function Ry(e){do{if(S(e,"bpmn:Process"))return ie(e);if(S(e,"bpmn:Participant"))return ie(e).processRef||ie(e)}while(e=e.parent)}function qp(e){return S(e,"bpmn:TextAnnotation")}function Kp(e){return S(e,"bpmn:Group")&&!e.labelTarget}function Cy(e){return S(e,"bpmn:BoundaryEvent")&&Ri(e,"bpmn:CompensateEventDefinition")}function wc(e){return ie(e).isForCompensation}function ZP(e,t){var n=Ry(e),i=Ry(t);return n===i}function QP(e){return S(e,"bpmn:InteractionNode")&&!S(e,"bpmn:BoundaryEvent")&&(!S(e,"bpmn:Event")||S(e,"bpmn:ThrowEvent")&&My(e,"bpmn:MessageEventDefinition"))}function JP(e){return S(e,"bpmn:InteractionNode")&&!wc(e)&&(!S(e,"bpmn:Event")||S(e,"bpmn:CatchEvent")&&My(e,"bpmn:MessageEventDefinition"))&&!(S(e,"bpmn:BoundaryEvent")&&!Ri(e,"bpmn:MessageEventDefinition"))}function Ay(e){for(var t=e;t=t.parent;){if(S(t,"bpmn:FlowElementsContainer"))return ie(t);if(S(t,"bpmn:Participant"))return ie(t).processRef}return null}function Py(e,t){var n=Ay(e),i=Ay(t);return n===i}function Ri(e,t){var n=ie(e);return!!vt(n.eventDefinitions||[],function(i){return S(i,t)})}function My(e,t){var n=ie(e);return(n.eventDefinitions||[]).every(function(i){return S(i,t)})}function eM(e){return S(e,"bpmn:FlowNode")&&!S(e,"bpmn:EndEvent")&&!vn(e)&&!(S(e,"bpmn:IntermediateThrowEvent")&&Ri(e,"bpmn:LinkEventDefinition"))&&!Cy(e)&&!wc(e)}function tM(e){return S(e,"bpmn:FlowNode")&&!S(e,"bpmn:StartEvent")&&!S(e,"bpmn:BoundaryEvent")&&!vn(e)&&!(S(e,"bpmn:IntermediateCatchEvent")&&Ri(e,"bpmn:LinkEventDefinition"))&&!wc(e)}function nM(e){return S(e,"bpmn:ReceiveTask")||S(e,"bpmn:IntermediateCatchEvent")&&(Ri(e,"bpmn:MessageEventDefinition")||Ri(e,"bpmn:TimerEventDefinition")||Ri(e,"bpmn:ConditionalEventDefinition")||Ri(e,"bpmn:SignalEventDefinition"))}function iM(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function Ty(e,t){var n=iM(t);return n.indexOf(e)!==-1}function Ec(e,t,n){if(Yp(e)||Yp(t))return null;if(!S(n,"bpmn:DataAssociation")){if(jy(e,t))return{type:"bpmn:MessageFlow"};if(Hy(e,t))return{type:"bpmn:SequenceFlow"}}var i=Zp(e,t);return i||(Fy(e,t)?{type:"bpmn:Association",associationDirection:"One"}:$y(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function Do(e,t){return Ye(e)||Kp(e)?!0:S(t,"bpmn:Participant")&&!Qe(t)?!1:S(e,"bpmn:Participant")?S(t,"bpmn:Process")||S(t,"bpmn:Collaboration"):qe(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:S(e,"bpmn:Lane")?S(t,"bpmn:Participant")||S(t,"bpmn:Lane"):S(e,"bpmn:BoundaryEvent")&&!rM(e)?!1:S(e,"bpmn:FlowElement")&&!S(e,"bpmn:DataStoreReference")?S(t,"bpmn:FlowElementsContainer")?Qe(t):qe(t,["bpmn:Participant","bpmn:Lane"]):S(e,"bpmn:DataStoreReference")&&S(t,"bpmn:Collaboration")?Xi(ie(t).get("participants"),function(n){return!!n.get("processRef")}):qe(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?qe(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):S(e,"bpmn:MessageFlow")?S(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function rM(e){return ie(e).cancelActivity&&(Oy(e)||Dy(e))}function ky(e){return!Ye(e)&&S(e,"bpmn:BoundaryEvent")}function oM(e){return S(e,"bpmn:Lane")}function aM(e){return ky(e)||S(e,"bpmn:IntermediateThrowEvent")&&Oy(e)?!0:S(e,"bpmn:IntermediateCatchEvent")&&Dy(e)}function Oy(e){var t=ie(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function Dy(e){return Iy(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function Iy(e,t){return t.some(function(n){return Ri(e,n)})}function sM(e){return S(e,"bpmn:ReceiveTask")&&vt(e.incoming,function(t){return S(t.source,"bpmn:EventBasedGateway")})}function Aa(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var r=e[0];return Ye(r)||!aM(r)||vn(t)||!S(t,"bpmn:Activity")||wc(t)||i&&!Sy(i,t)||sM(t)?!1:"attach"}function Ly(e,t,n){if(!t)return!1;var i={replacements:[]};return F(e,function(r){vn(t)||S(r,"bpmn:StartEvent")&&r.type!=="label"&&Do(r,t)&&(gC(r)||i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),(yC(r)||vC(r)||bC(r))&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),Iy(r,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&S(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"})),S(t,"bpmn:Transaction")||Ri(r,"bpmn:CancelEventDefinition")&&r.type!=="label"&&(S(r,"bpmn:EndEvent")&&Do(r,t)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:EndEvent"}),S(r,"bpmn:BoundaryEvent")&&Aa(r,t,null,n)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function By(e,t){return Xi(e,oM)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return Do(n,t)})}function Xp(e,t,n,i){return t?Ye(e)||Kp(e)?!0:Do(e,t)||Sc(e,t):!1}function Ny(e,t,n){return S(e,"bpmn:SubProcess")?Qe(e)&&(!t||t.width>=100&&t.height>=80):S(e,"bpmn:Lane")||S(e,"bpmn:Participant")?!0:qp(e)?n?n==="e"||n==="w":!0:Kp(e)?!0:Ye(e)?n?n==="e"||n==="w":!0:!1}function cM(e,t){var n=qp(e),i=qp(t);return(n||i)&&n!==i}function $y(e,t){return Ty(t,e)||Ty(e,t)?!1:cM(e,t)?!0:!!Zp(e,t)}function Fy(e,t){return Py(e,t)&&Cy(e)&&S(t,"bpmn:Activity")&&!uM(t,e)&&!vn(t)}function jy(e,t){return Vy(e)&&!Vy(t)?!1:QP(e)&&JP(t)&&!ZP(e,t)}function Hy(e,t){return eM(e)&&tM(t)&&Py(e,t)&&!(S(e,"bpmn:EventBasedGateway")&&!nM(t))}function Zp(e,t){return qe(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&qe(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:qe(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&qe(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function Sc(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:qe(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!Ye(t)&&S(e,"bpmn:FlowNode")&&!S(e,"bpmn:BoundaryEvent")&&Do(e,t.parent)}function Qp(e,t){return e&&t&&e.indexOf(t)!==-1}function zy(e,t){return Ye(t)?!0:!(S(t,"bpmn:Lane")&&!Qp(e,t.parent)||S(t,"bpmn:MessageFlow")&&!lM(e,t))}function lM(e,t){var n=Gy(t.source),i=Gy(t.target);return Qp(e,n)&&Qp(e,i)}function Gy(e){for(;e;e=e.parent)if(S(e,"bpmn:Participant"))return e;return null}function Vy(e){return Co(e,"bpmn:Process")||Co(e,"bpmn:Collaboration")}function uM(e,t){return e.attachers.includes(t)}const pM={__depends__:[Si],__init__:["bpmnRules"],bpmnRules:["type",un]};var fM=2e3;function Wy(e,t){e.on("saveXML.start",fM,n);function n(){var i=t.getRootElements();F(i,function(r){var o=ot(r),a,s;a=ua([r]),a=Ke(a,function(c){return c!==r&&!c.labelTarget}),s=hn(a,ot),o.set("planeElement",s)})}}Wy.$inject=["eventBus","canvas"];const dM={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",Wy]};function Rc(e){te.call(this,e);var t=this;this.preExecute(["shape.create","connection.create"],function(n){var i=n.context,r=i.shape||i.connection,o=i.parent,a=t.getOrdering(r,o);a&&(a.parent!==void 0&&(i.parent=a.parent),i.parentIndex=a.index)}),this.preExecute(["shape.move","connection.move"],function(n){var i=n.context,r=i.shape||i.connection,o=i.newParent||r.parent,a=t.getOrdering(r,o);a&&(a.parent!==void 0&&(i.newParent=a.parent),i.newParentIndex=a.index)})}Rc.prototype.getOrdering=function(e,t){return null},Ee(Rc,te);function Jp(e,t){Rc.call(this,e);var n=[{type:"bpmn:SubProcess",order:{level:6}},{type:"bpmn:SequenceFlow",order:{level:9,containers:["bpmn:Participant","bpmn:FlowElementsContainer"]}},{type:"bpmn:DataAssociation",order:{level:9,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:TextAnnotation",order:{level:9}},{type:"bpmn:MessageFlow",order:{level:9,containers:["bpmn:Collaboration"]}},{type:"bpmn:Association",order:{level:6,containers:["bpmn:Participant","bpmn:FlowElementsContainer","bpmn:Collaboration"]}},{type:"bpmn:BoundaryEvent",order:{level:8}},{type:"bpmn:Group",order:{level:10,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:FlowElement",order:{level:5}},{type:"bpmn:Participant",order:{level:-2}},{type:"bpmn:Lane",order:{level:-1}}];function i(a){if(a.labelTarget)return{level:10};var s=vt(n,function(c){return qe(a,[c.type])});return s&&s.order||{level:1}}function r(a){var s=a.order;if(s||(a.order=s=i(a)),!s)throw new Error(`no order for <${a.id}>`);return s}function o(a,s,c){for(var l=s;l&&!qe(l,c);)l=l.parent;if(!l)throw new Error(`no parent for <${a.id}> in <${s&&s.id}>`);return l}this.getOrdering=function(a,s){if(a.labelTarget||S(a,"bpmn:TextAnnotation"))return{parent:t.findRoot(s)||t.getRootElement(),index:-1};var c=r(a);c.containers&&(s=o(a,s,c.containers));var l=s.children.indexOf(a),u=Ld(s.children,function(f){return!a.labelTarget&&f.labelTarget?!1:c.level<r(f).level});return u!==-1&&l!==-1&&l<u&&(u-=1),{index:u,parent:s}}}Jp.$inject=["eventBus","canvas"],Ee(Jp,Rc);const hM={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",Jp]};function Pa(){}Pa.prototype.get=function(){return this._data},Pa.prototype.set=function(e){this._data=e},Pa.prototype.clear=function(){var e=this._data;return delete this._data,e},Pa.prototype.isEmpty=function(){return!this._data};const mM={clipboard:["type",Pa]};var Uy=1500;function Yy(e,t,n){var i=this,r=n.get("dragging",!1);function o(a){if(!a.hover){var s=a.originalEvent,c=i._findTargetGfx(s),l=c&&e.get(c);c&&l&&(a.stopPropagation(),r.hover({element:l,gfx:c}),r.move(s))}}r&&t.on("drag.start",function(a){t.once("drag.move",Uy,function(s){o(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",Uy,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=Hr(a),c=document.elementFromPoint(s.x,s.y),gM(c)}}Yy.$inject=["elementRegistry","eventBus","injector"];function gM(e){return Lr(e,"svg, .djs-element",!0)}const yM={__init__:["hoverFix"],hoverFix:["type",Yy]};function vM(e){return!0}function Cc(e){return pr(e)||EP(e)}var qy=500;function Ky(e,t,n){var i=this;function r(P,B,D){if(!s(P,B)){var I,z,oe;D?z=t.getGraphics(D):(I=B.delegateTarget||B.target,I&&(z=I,D=t.get(z))),!(!z||!D)&&(oe=e.fire(P,{element:D,gfx:z,originalEvent:B}),oe===!1&&(B.stopPropagation(),B.preventDefault()))}}var o={};function a(P){return o[P]}function s(P,B){var D=l[P]||pr;return!D(B)}var c={click:"element.click",contextmenu:"element.contextmenu",dblclick:"element.dblclick",mousedown:"element.mousedown",mousemove:"element.mousemove",mouseover:"element.hover",mouseout:"element.out",mouseup:"element.mouseup"},l={"element.contextmenu":vM,"element.mousedown":Cc,"element.mouseup":Cc,"element.click":Cc,"element.dblclick":Cc};function u(P,B,D){var I=c[P];if(!I)throw new Error("unmapped DOM event name <"+P+">");return r(I,B,D)}var f="svg, .djs-element";function p(P,B,D,I){var z=o[D]=function(oe){r(D,oe)};I&&(l[D]=I),z.$delegate=On.bind(P,f,B,z)}function d(P,B,D){var I=a(D);I&&On.unbind(P,B,I.$delegate)}function m(P){F(c,function(B,D){p(P,D,B)})}function h(P){F(c,function(B,D){d(P,D,B)})}e.on("canvas.destroy",function(P){h(P.svg)}),e.on("canvas.init",function(P){m(P.svg)}),e.on(["shape.added","connection.added"],function(P){var B=P.element,D=P.gfx;e.fire("interactionEvents.createHit",{element:B,gfx:D})}),e.on(["shape.changed","connection.changed"],qy,function(P){var B=P.element,D=P.gfx;e.fire("interactionEvents.updateHit",{element:B,gfx:D})}),e.on("interactionEvents.createHit",qy,function(P){var B=P.element,D=P.gfx;i.createDefaultHit(B,D)}),e.on("interactionEvents.updateHit",function(P){var B=P.element,D=P.gfx;i.updateDefaultHit(B,D)});var y=C("djs-hit djs-hit-stroke"),v=C("djs-hit djs-hit-click-stroke"),g=C("djs-hit djs-hit-all"),b=C("djs-hit djs-hit-no-move"),x={all:g,"click-stroke":v,stroke:y,"no-move":b};function C(P,B){return B=W({stroke:"white",strokeWidth:15},B||{}),n.cls(P,["no-fill","no-border"],B)}function M(P,B){var D=x[B];if(!D)throw new Error("invalid hit type <"+B+">");return Se(P,D),P}function k(P,B){ze(P,B)}this.removeHits=function(P){var B=Ns(".djs-hit",P);F(B,Kt)},this.createDefaultHit=function(P,B){var D=P.waypoints,I=P.isFrame,z;return D?this.createWaypointsHit(B,D):(z=I?"stroke":"all",this.createBoxHit(B,z,{width:P.width,height:P.height}))},this.createWaypointsHit=function(P,B){var D=la(B);return M(D,"stroke"),k(P,D),D},this.createBoxHit=function(P,B,D){D=W({x:0,y:0},D);var I=Oe("rect");return M(I,B),Se(I,D),k(P,I),I},this.updateDefaultHit=function(P,B){var D=ft(".djs-hit",B);if(D)return P.waypoints?Fu(D,P.waypoints):Se(D,{width:P.width,height:P.height}),D},this.fire=r,this.triggerMouseEvent=u,this.mouseHandler=a,this.registerEvent=p,this.unregisterEvent=d}Ky.$inject=["eventBus","elementRegistry","styles"];const Ac={__init__:["interactionEvents"],interactionEvents:["type",Ky]};function Io(e,t){this._eventBus=e,this._canvas=t,this._selectedElements=new Set;var n=this;e.on(["shape.remove","connection.remove"],function(i){var r=i.element;n.deselect(r)}),e.on(["diagram.clear","root.set"],function(i){n.select(null)})}Io.$inject=["eventBus","canvas"],Io.prototype.deselect=function(e){if(this._selectedElements.has(e)){var t=this.get();this._selectedElements.delete(e),this._eventBus.fire("selection.changed",{oldSelection:t,newSelection:this.get()})}},Io.prototype.get=function(){return Array.from(this._selectedElements)},Io.prototype.isSelected=function(e){return this._selectedElements.has(e)},Io.prototype.select=function(e,t){var n=this.get();Be(e)||(e=e?[e]:[]);var i=this._canvas,r=i.getRootElement();e=e.filter(function(o){var a=i.findRoot(o);return r===a}),t?F(e,o=>{this._selectedElements.add(o)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var Xy="hover",Zy="selected";function Qy(e,t){this._canvas=e;function n(r,o){e.addMarker(r,o)}function i(r,o){e.removeMarker(r,o)}t.on("element.hover",function(r){n(r.element,Xy)}),t.on("element.out",function(r){i(r.element,Xy)}),t.on("selection.changed",function(r){function o(l){i(l,Zy)}function a(l){n(l,Zy)}var s=new Set(r.oldSelection),c=new Set(r.newSelection);for(let l of s)c.has(l)||o(l);for(let l of c)s.has(l)||a(l)})}Qy.$inject=["canvas","eventBus"];function Jy(e,t,n,i){e.on("create.end",500,function(r){var o=r.context,a=o.canExecute,s=o.elements,c=o.hints||{},l=c.autoSelect;if(a){if(l===!1)return;Be(l)?t.select(l):t.select(s.filter(bM))}}),e.on("connect.end",500,function(r){var o=r.context,a=o.connection;a&&t.select(a)}),e.on("shape.move.end",500,function(r){var o=r.previousSelection||[],a=i.get(r.context.shape.id),s=vt(o,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(r){if(pr(r)){var o=r.element;o===n.getRootElement()&&(o=null);var a=t.isSelected(o),s=t.get().length>1,c=xc(r);if(a&&s)return c?t.deselect(o):t.select(o);a?t.deselect(o):t.select(o,c)}})}Jy.$inject=["eventBus","selection","canvas","elementRegistry"];function bM(e){return!e.hidden}const ni={__init__:["selectionVisuals","selectionBehavior"],__depends__:[Ac],selection:["type",Io],selectionVisuals:["type",Qy],selectionBehavior:["type",Jy]};var xM=/^djs-cursor-.*$/;function Pc(e){var t=Ct(document.body);t.removeMatching(xM),e&&t.add("djs-cursor-"+e)}function ev(){Pc(null)}var _M=5e3;function tv(e,t){t=t||"element.click";function n(){return!1}return e.once(t,_M,n),function(){e.off(t,n)}}var wM=["c","C"],EM=["v","V"],SM=["d","D"],RM=["x","X"],CM=["y","Y"],nv=["z","Z"];function AM(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Ln(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function Xt(e,t){return e=Be(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function ef(e){return e.shiftKey}function PM(e){return Ln(e)&&Xt(wM,e)}function MM(e){return Ln(e)&&Xt(EM,e)}function TM(e){return Ln(e)&&Xt(SM,e)}function kM(e){return Ln(e)&&Xt(RM,e)}function OM(e){return Ln(e)&&!ef(e)&&Xt(nv,e)}function DM(e){return Ln(e)&&(Xt(CM,e)||Xt(nv,e)&&ef(e))}var Lo=Math.round,iv="djs-drag-active";function Gr(e){e.preventDefault()}function IM(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function LM(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function rv(e,t,n,i){var r={threshold:5,trapClick:!0},o;function a(b){var x=t.viewbox(),C=t._container.getBoundingClientRect();return{x:x.x+(b.x-C.left)/x.scale,y:x.y+(b.y-C.top)/x.scale}}function s(b,x){x=x||o;var C=e.createEvent(W({},x.payload,x.data,{isTouch:x.isTouch}));return e.fire("drag."+b,C)===!1?!1:e.fire(x.prefix+"."+b,C)}function c(b){var x=b.filter(function(C){return i.get(C.id)});x.length&&n.select(x)}function l(b,x){var C=o.payload,M=o.displacement,k=o.globalStart,P=Hr(b),B=pi(P,k),D=o.localStart,I=a(P),z=pi(I,D);if(!o.active&&(x||LM(B)>o.threshold)){if(W(C,{x:Lo(D.x+M.x),y:Lo(D.y+M.y),dx:0,dy:0},{originalEvent:b}),s("start")===!1)return y();o.active=!0,o.keepSelection||(C.previousSelection=n.get(),n.select(null)),o.cursor&&Pc(o.cursor),t.addMarker(t.getRootElement(),iv)}Dp(b),o.active&&(W(C,{x:Lo(I.x+M.x),y:Lo(I.y+M.y),dx:Lo(z.x),dy:Lo(z.y)},{originalEvent:b}),s("move"))}function u(b){var x,C=!0;o.active&&(b&&(o.payload.originalEvent=b,Dp(b)),C=s("end")),C===!1&&s("rejected"),x=v(C!==!0),s("ended",x)}function f(b){Xt("Escape",b)&&(Gr(b),y())}function p(b){var x;o.active&&(x=tv(e),setTimeout(x,400),Gr(b)),u(b)}function d(b){l(b)}function m(b){var x=o.payload;x.hoverGfx=b.gfx,x.hover=b.element,s("hover")}function h(b){s("out");var x=o.payload;x.hoverGfx=null,x.hover=null}function y(b){var x;if(o){var C=o.active;C&&s("cancel"),x=v(b),C&&s("canceled",x)}}function v(b){var x,C;s("cleanup"),ev(),o.trapClick?C=p:C=u,je.unbind(document,"mousemove",l),je.unbind(document,"dragstart",Gr),je.unbind(document,"selectstart",Gr),je.unbind(document,"mousedown",C,!0),je.unbind(document,"mouseup",C,!0),je.unbind(document,"keyup",f),je.unbind(document,"touchstart",d,!0),je.unbind(document,"touchcancel",y,!0),je.unbind(document,"touchmove",l,!0),je.unbind(document,"touchend",u,!0),e.off("element.hover",m),e.off("element.out",h),t.removeMarker(t.getRootElement(),iv);var M=o.payload.previousSelection;return b!==!1&&M&&!n.get().length&&c(M),x=o,o=null,x}function g(b,x,C,M){o&&y(!1),typeof x=="string"&&(M=C,C=x,x=null),M=W({},r,M||{});var k=M.data||{},P,B,D,I,z;if(M.trapClick?I=p:I=u,b?(P=Oo(b)||b,B=Hr(b),Dp(b),P.type==="dragstart"&&Gr(P)):(P=null,B={x:0,y:0}),D=a(B),x||(x=D),z=IM(P),o=W({prefix:C,data:k,payload:{},globalStart:B,displacement:pi(x,D),localStart:D,isTouch:z},M),M.manual||(z?(je.bind(document,"touchstart",d,!0),je.bind(document,"touchcancel",y,!0),je.bind(document,"touchmove",l,!0),je.bind(document,"touchend",u,!0)):(je.bind(document,"mousemove",l),je.bind(document,"dragstart",Gr),je.bind(document,"selectstart",Gr),je.bind(document,"mousedown",I,!0),je.bind(document,"mouseup",I,!0)),je.bind(document,"keyup",f),e.on("element.hover",m),e.on("element.out",h)),s("init")===!1)return y(),!1;M.autoActivate&&l(b,!0)}e.on("diagram.destroy",y),this.init=g,this.move=l,this.hover=m,this.out=h,this.end=u,this.cancel=y,this.context=function(){return o},this.setOptions=function(b){W(r,b)}}rv.$inject=["eventBus","canvas","selection","elementRegistry"];const Hi={__depends__:[yM,ni],dragging:["type",rv]};function Bo(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}Bo.prototype.next=function(){return this._prefix+ ++this._counter};const BM=new Bo("ps");var NM=["marker-start","marker-mid","marker-end"],$M=["circle","ellipse","line","path","polygon","polyline","path","rect"];function fr(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}fr.$inject=["elementRegistry","eventBus","canvas","styles"],fr.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")},fr.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},fr.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var r=ym(n);return this._cloneMarkers($r(r),i),Se(r,this._styles.cls(i,[])),ze(t,r),Se(r,"data-preview-support-element-id",e.id),r},fr.prototype.addFrame=function(e,t){var n=Oe("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return ze(t,n),Se(n,"data-preview-support-element-id",e.id),n},fr.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(r=>{i._cloneMarkers(r,t,n)}),zM(e)&&NM.forEach(function(r){if(Se(e,r)){var o=FM(e,r,i._canvas.getContainer());o&&i._cloneMarker(n,e,o,r,t)}})},fr.prototype._cloneMarker=function(e,t,n,i,r="djs-dragger"){var o=[n.id,r,BM.next()].join("-"),a=ft("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||ym(n);s.id=o,et(s).add(r);var c=ft(":scope > defs",e);c||(c=Oe("defs"),ze(e,c)),ze(c,s);var l=HM(s.id);Se(t,i,l)};function FM(e,t,n){var i=jM(Se(e,t));return ft("marker#"+i,n||document)}function jM(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function HM(e){return"url(#"+e+")"}function zM(e){return $M.indexOf(e.nodeName)!==-1}const No={__init__:["previewSupport"],previewSupport:["type",fr]};var GM="drop-ok",ov="drop-not-ok",av="attach-ok",sv="new-parent",cv="create",VM=2e3;function lv(e,t,n,i,r){function o(c,l,u,f,p){if(!l)return!1;c=Ke(c,function(g){var b=g.labelTarget;return!g.parent&&!(Ye(g)&&c.indexOf(b)!==-1)});var d=vt(c,function(g){return!ht(g)}),m=!1,h=!1,y=!1;pv(c)&&(m=r.allowed("shape.attach",{position:u,shape:d,target:l})),m||(pv(c)?y=r.allowed("shape.create",{position:u,shape:d,source:f,target:l}):y=r.allowed("elements.create",{elements:c,position:u,target:l}));var v=p.connectionTarget;return y||m?(d&&f&&(h=r.allowed("connection.create",{source:v===f?d:f,target:v===f?f:d,hints:{targetParent:l,targetAttach:m}})),{attach:m,connect:h}):y===null||m===null?null:!1}function a(c,l){[av,GM,ov,sv].forEach(function(u){u===l?e.addMarker(c,u):e.removeMarker(c,u)})}n.on(["create.move","create.hover"],function(c){var l=c.context,u=l.elements,f=c.hover,p=l.source,d=l.hints||{};if(!f){l.canExecute=!1,l.target=null;return}uv(c);var m={x:c.x,y:c.y},h=l.canExecute=f&&o(u,f,m,p,d);f&&h!==null&&(l.target=f,h&&h.attach?a(f,av):a(f,h?sv:ov))}),n.on(["create.end","create.out","create.cleanup"],function(c){var l=c.hover;l&&a(l,null)}),n.on("create.end",function(c){var l=c.context,u=l.source,f=l.shape,p=l.elements,d=l.target,m=l.canExecute,h=m&&m.attach,y=m&&m.connect,v=l.hints||{};if(m===!1||!d)return!1;uv(c);var g={x:c.x,y:c.y};y?f=i.appendShape(u,f,g,d,{attach:h,connection:y===!0?{}:y,connectionTarget:v.connectionTarget}):(p=i.createElements(p,g,d,W({},v,{attach:h})),f=vt(p,function(b){return!ht(b)})),W(l,{elements:p,shape:f}),W(c,{elements:p,shape:f})});function s(){var c=t.context();c&&c.prefix===cv&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],VM,function(){n.off("elements.changed",s)})}),this.start=function(c,l,u){Be(l)||(l=[l]);var f=vt(l,function(m){return!ht(m)});if(f){u=W({elements:l,hints:{},shape:f},u||{}),F(l,function(m){Fe(m.x)||(m.x=0),Fe(m.y)||(m.y=0)});var p=Ke(l,function(m){return!m.hidden}),d=Ft(p);F(l,function(m){ht(m)&&(m.waypoints=hn(m.waypoints,function(h){return{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2}})),W(m,{x:m.x-d.x-d.width/2,y:m.y-d.y-d.height/2})}),t.init(c,cv,{cursor:"grabbing",autoActivate:!0,data:{shape:f,elements:l,context:u}})}}}lv.$inject=["canvas","dragging","eventBus","modeling","rules"];function uv(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 pv(e){return e&&e.length===1&&!ht(e[0])}var WM=750;function fv(e,t,n,i,r){function o(a){var s=Oe("g");Se(s,r.cls("djs-drag-group",["no-events"]));var c=Oe("g");return a.forEach(function(l){var u;l.hidden||(l.waypoints?(u=n._createContainer("connection",c),n.drawConnection($r(u),l)):(u=n._createContainer("shape",c),n.drawShape($r(u),l),ln(u,l.x,l.y)),i.addDragger(l,s,u))}),s}t.on("create.move",WM,function(a){var s=a.hover,c=a.context,l=c.elements,u=c.dragGroup;u||(u=c.dragGroup=o(l));var f;s?(u.parentNode||(f=e.getActiveLayer(),ze(f,u)),ln(u,a.x,a.y)):Kt(u)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&Kt(c)})}fv.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const Mc={__depends__:[Hi,No,Si,ni],__init__:["create","createPreview"],create:["type",lv],createPreview:["type",fv]};function tf(e){var t=this;this._lastMoveEvent=null;function n(i){t._lastMoveEvent=i}e.on("canvas.init",function(i){var r=t._svg=i.svg;r.addEventListener("mousemove",n)}),e.on("canvas.destroy",function(){t._lastMouseEvent=null,t._svg.removeEventListener("mousemove",n)})}tf.$inject=["eventBus"],tf.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||UM(0,0)};function UM(e,t){var n=document.createEvent("MouseEvent"),i=e,r=t,o=e,a=t;return n.initMouseEvent&&n.initMouseEvent("mousemove",!0,!0,window,0,i,r,o,a,!1,!1,!1,!1,0,null),n}const Ma={__init__:["mouse"],mouse:["type",tf]};var dv=2e3;function Bn(e,t,n,i,r,o,a,s){this._canvas=e,this._create=t,this._elementFactory=i,this._eventBus=r,this._modeling=o,this._mouse=a,this._rules=s,r.on("copyPaste.copyElement",function(c){var l=c.descriptor,u=c.element,f=c.elementsSet;l.priority=1,l.id=u.id,f.has(u.parent)&&(l.parent=u.parent.id),YM(u)&&(l.priority=2,l.host=u.host.id),ht(u)&&(l.priority=3,l.source=u.source.id,l.target=u.target.id,l.waypoints=qM(u)),Ye(u)&&(l.priority=4,l.labelTarget=u.labelTarget.id),F(["x","y","width","height"],function(p){Fe(u[p])&&(l[p]=u[p])}),l.hidden=u.hidden,l.collapsed=u.collapsed}),r.on("copyPaste.elementsCopied",dv,function(c){var l;((l=c.hints)==null?void 0:l.clip)!==!1&&n.set(c.tree)}),r.on("copyPaste.pasteElements",dv,function(c){c.tree||(c.tree=n.get())}),r.on("copyPaste.pasteElements",function(c){var l=c.hints;W(l,{createElementsBehavior:!1})})}Bn.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],Bn.prototype.copy=function(e,t={}){var n,i;return Be(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(Be(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},Bn.prototype.paste=function(e={}){var t=this._eventBus.createEvent({type:"copyPaste.pasteElements",hints:{},...e}),n=this._eventBus.fire(t);if(n!==!1){var i=t.tree;if(i){var r=t.hints,o=this._createElements(i);if(t.element&&t.point)return this._paste(o,t.element,t.point,r);this._create.start(this._mouse.getLastMoveEvent(),o,{hints:r})}}},Bn.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},Bn.prototype.cut=function(e){var t=this.copy(e),n=this._getElementIdsFromTree(t),i=e.filter(function(r){return n[r.id]});return i.length>0&&this._modeling.removeElements(i),t},Bn.prototype._getElementIdsFromTree=function(e){var t={};return F(e,function(n){F(n,function(i){i.id&&(t[i.id]=!0)})}),t},Bn.prototype._paste=function(e,t,n,i){F(e,function(o){Fe(o.x)||(o.x=0),Fe(o.y)||(o.y=0)});var r=Ft(e);return F(e,function(o){ht(o)&&(o.waypoints=hn(o.waypoints,function(a){return{x:a.x-r.x-r.width/2,y:a.y-r.y-r.height/2}})),W(o,{x:o.x-r.x-r.width/2,y:o.y-r.y-r.height/2})}),this._modeling.createElements(e,n,t,W({},i))},Bn.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return F(e,function(o,a){o=di(o,"priority"),F(o,function(s){var c=W({},hi(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var l;if(ht(c)){c.source=i[s.source],c.target=i[s.target],l=i[s.id]=t.createConnection(c),r.push(l);return}if(Ye(c)){c.labelTarget=i[c.labelTarget],l=i[s.id]=t.createLabel(c),r.push(l);return}c.host&&(c.host=i[c.host]),l=i[s.id]=t.createShape(c),r.push(l)})}),r},Bn.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(hi(e,["id"]));return t},Bn.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(hi(e,["id"]));return t},Bn.prototype.createShape=function(e){var t=this._elementFactory.createShape(hi(e,["id"]));return t},Bn.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(ht(e)&&(!n.has(e.source)||!n.has(e.target))||Ye(e)&&!n.has(e.labelTarget))},Bn.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[],o=new Map,a=Hs(e);function s(f,p){return t.allowed("element.copy",{element:f,elements:p})}function c(f,p){var d=o.get(f);if(!d){var m={element:f,depth:p};r.push(m),o.set(f,m);return}if(d.depth<p){r=l(d,r);var h={element:d.element,depth:p};r.push(h),o.set(f,h)}}function l(f,p){var d=p.indexOf(f);return d!==-1&&p.splice(d,1),p}Nr(a,function(f,p,d){if(Ye(f))return;F(f.labels,function(y){c(y,d)});function m(y){y&&y.length&&F(y,function(v){F(v.labels,function(g){c(g,d)}),c(v,d)})}F([f.attachers,f.incoming,f.outgoing],m),c(f,d);var h=[];return f.children&&(h=f.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:f,children:h}),h}),e=hn(r,function(f){return f.element});var u=new Set(e);return r=hn(r,function(f){return f.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:f.descriptor,element:f.element,elements:e,elementsSet:u}),f}),r=di(r,function(f){return f.descriptor.priority}),e=hn(r,function(f){return f.element}),F(r,function(f){var p=f.depth;if(!n.hasRelations(f.element,e,u)){mv(f.element,e),u.delete(f.element);return}if(!s(f.element,e)){mv(f.element,e),u.delete(f.element);return}i[p]||(i[p]=[]),i[p].push(f.descriptor)}),i};function YM(e){return!!e.host}function qM(e){return hn(e.waypoints,function(t){return t=hv(t),t.original&&(t.original=hv(t.original)),t})}function hv(e){return W({},e)}function mv(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const KM={__depends__:[mM,Mc,Ma,Si],__init__:["copyPaste"],copyPaste:["type",Bn]};function nf(e,t,n){Be(n)||(n=[n]),F(n,function(i){Tr(e[i])||(t[i]=e[i])})}var rf=750;function gv(e,t,n){function i(c,l){var u=e.create(c.$type);return n.copyElement(c,u,null,l)}t.on("copyPaste.copyElement",rf,function(c){var l=c.descriptor,u=c.element,f=ie(u);if(Ye(u))return l;var p=l.businessObject=i(f,!0),d=l.di=i(ot(u),!0);d.bpmnElement=p,nf(p,l,"name"),nf(d,l,"isExpanded"),f.default&&(l.default=f.default.id)});var r="-bpmn-js-refs";function o(c){return c[r]=c[r]||{}}function a(c,l){c[r]=l}function s(c,l,u){var f=ie(c);return c.default&&(u[c.default]={element:f,property:"default"}),c.host&&(ie(c).attachedToRef=ie(l[c.host])),hi(u,Tn(u,function(p,d,m){var h=d.element,y=d.property;return m===c.id&&(h.set(y,f),p.push(c.id)),p},[]))}t.on("copyPaste.pasteElement",function(c){var l=c.cache,u=c.descriptor,f=u.businessObject,p=u.di;if(Ye(u)){u.businessObject=ie(l[u.labelTarget]),u.di=ot(l[u.labelTarget]);return}f=u.businessObject=i(f),p=u.di=i(p),p.bpmnElement=f,nf(u,f,["isExpanded","name"]),u.type=f.$type}),t.on("copyPaste.copyElement",rf,function(c){var l=c.descriptor,u=c.element;if(S(u,"bpmn:Participant")){var f=ie(u);f.processRef&&(l.processRef=i(f.processRef,!0))}}),t.on("copyPaste.pasteElement",function(c){var l=c.descriptor,u=l.processRef;u&&(l.processRef=i(u))}),t.on("copyPaste.createTree",function(c){var l=c.element,u=c.children;S(l,"bpmn:SubProcess")&&F(ga(u),f=>{u.push(f.annotation)})}),t.on("copyPaste.pasteElement",rf,function(c){var l=c.cache,u=c.descriptor;a(l,s(u,l,o(l)))})}gv.$inject=["bpmnFactory","eventBus","moddleCopy"];const XM=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],ZM=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function Ta(e,t,n){this._bpmnFactory=t,this._eventBus=e,this._moddle=n,e.on("moddleCopy.canCopyProperties",i=>{const{propertyNames:r}=i;if(!(!r||!r.length))return di(r,o=>o==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:r,property:o,propertyName:a}=i,s=Qt(r)&&r.$descriptor;if(a&&ZM.includes(a))return o;if(a&&XM.includes(a)||a&&s&&!vt(s.properties,ao({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",i=>{const{property:r}=i;if(S(r,"bpmn:ExtensionElements")&&(!r.values||!r.values.length))return!1})}Ta.$inject=["eventBus","bpmnFactory","moddle"],Ta.prototype.copyElement=function(e,t,n,i=!1){n&&!Be(n)&&(n=[n]),n=n||of(e.$descriptor);const r=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return r===!1||(Be(r)&&(n=r),F(n,o=>{let a;Mn(e,o)&&(a=e.get(o));const s=this.copyProperty(a,t,o,i);!Yt(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:o})===!1||t.set(o,s)})),t},Ta.prototype.copyProperty=function(e,t,n,i=!1){let r=this._eventBus.fire("moddleCopy.canCopyProperty",{parent:t,property:e,propertyName:n,clone:i});if(r===!1)return;if(r)return Qt(r)&&r.$type&&!r.$parent&&(r.$parent=t),r;const o=this._moddle.getPropertyDescriptor(t,n);if(!o.isReference)return o.isId?e&&this._copyId(e,t,i):Be(e)?Tn(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):Qt(e)&&e.$type?this._moddle.getElementDescriptor(e).isGeneric?void 0:(r=this._bpmnFactory.create(e.$type),r.$parent=t,r=this.copyElement(e,r,null,i),r):e},Ta.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 of(e,t){return Tn(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const yv={__depends__:[KM],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",gv],moddleCopy:["type",Ta]};var vv=Math.round;function af(e,t){this._modeling=e,this._eventBus=t}af.$inject=["modeling","eventBus"],af.prototype.replaceElement=function(e,t,n){if(e.waypoints)return null;var i=this._modeling,r=this._eventBus;r.fire("replace.start",{element:e,attrs:t,hints:n});var o=t.width||e.width,a=t.height||e.height,s=t.x||e.x,c=t.y||e.y,l=vv(s+o/2),u=vv(c+a/2),f=i.replaceShape(e,W({},t,{x:l,y:u,width:o,height:a}),n);return r.fire("replace.end",{element:e,newElement:f,hints:n}),f};function bv(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:r={}}=n;r.select!==!1&&e.select(i)})}bv.$inject=["selection","eventBus"];const QM={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",bv],replace:["type",af]};function JM(e,t,n){Be(n)||(n=[n]),F(n,function(i){Tr(e[i])||(t[i]=e[i])})}var eT=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function tT(e,t){var n=e&&Mn(e,"collapsed")?e.collapsed:!Qe(e),i;return t&&(Mn(t,"collapsed")||Mn(t,"isExpanded"))?i=Mn(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function xv(e,t,n,i,r,o){function a(s,c,l){l=l||{};var u=c.type,f=s.businessObject;if(Tc(f)&&(u==="bpmn:SubProcess"||u==="bpmn:AdHocSubProcess")&&tT(s,c))return i.toggleCollapse(s),s;var p=e.create(u),d={type:u,businessObject:p};d.di={},u==="bpmn:ExclusiveGateway"&&(d.di.isMarkerVisible=!0),JM(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var m=of(f.$descriptor),h=of(p.$descriptor,!0),y=nT(m,h);W(p,li(c,eT));var v=Ke(y,function(x){return x==="eventDefinitions"?_v(s,c.eventDefinitionType):x==="loopCharacteristics"?!vn(p):Mn(p,x)||x==="processRef"&&c.isExpanded===!1||x==="triggeredByEvent"?!1:x==="isForCompensation"?!vn(p):!0});if(p=n.copyElement(f,p,v),c.eventDefinitionType&&(_v(p,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),S(f,"bpmn:Activity")){if(Tc(f))d.isExpanded=Qe(s);else if(c&&Mn(c,"isExpanded")){d.isExpanded=c.isExpanded;var g=t.getDefaultSize(p,{isExpanded:d.isExpanded});d.width=g.width,d.height=g.height,d.x=s.x-(d.width-s.width)/2,d.y=s.y-(d.height-s.height)/2}Qe(s)&&!S(f,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(Tc(f)&&!Tc(p)&&(l.moveChildren=!1),S(f,"bpmn:Participant")){c.isExpanded===!0?p.processRef=e.create("bpmn:Process"):l.moveChildren=!1;var b=tn(s);ot(s).isHorizontal||(ot(d).isHorizontal=b),d.width=b?s.width:t.getDefaultSize(d).width,d.height=b?t.getDefaultSize(d).height:s.height}return o.allowed("shape.resize",{shape:p})||(d.height=t.getDefaultSize(d).height,d.width=t.getDefaultSize(d).width),p.name=f.name,qe(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&qe(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(p.default=f.default),c.host&&!S(f,"bpmn:BoundaryEvent")&&S(p,"bpmn:BoundaryEvent")&&(d.host=c.host),(d.type==="bpmn:DataStoreReference"||d.type==="bpmn:DataObjectReference")&&(d.x=s.x+(s.width-d.width)/2),r.replaceElement(s,d,{...l,targetElement:c})}this.replaceElement=a}xv.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function Tc(e){return S(e,"bpmn:SubProcess")}function _v(e,t){var n=ie(e);return t&&n.get("eventDefinitions").some(function(i){return S(i,t)})}function nT(e,t){return e.filter(function(n){return t.includes(n)})}const wv={__depends__:[yv,QM,ni],bpmnReplace:["type",xv]};var iT=250;function Vr(e){this._eventBus=e,this._tools=[],this._active=null}Vr.$inject=["eventBus"],Vr.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)},Vr.prototype.isActive=function(e){return e&&this._active===e},Vr.prototype.length=function(e){return this._tools.length},Vr.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Vr.prototype.bindEvents=function(e,t){var n=this._eventBus,i=[];n.on(t.tool+".init",function(r){var o=r.context;if(!o.reactivate&&this.isActive(e)){this.setActive(null);return}this.setActive(e)},this),F(t,function(r){i.push(r+".ended"),i.push(r+".canceled")}),n.on(i,iT,function(r){this._active&&(rT(r)||this.setActive(null))},this)};function rT(e){var t=e.originalEvent&&e.originalEvent.target;return t&&Lr(t,'.group[data-group="tools"]')}const kc={__depends__:[Hi],__init__:["toolManager"],toolManager:["type",Vr]};function oT(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 aT(e,t){var n=[],i=new Set(e);F(t,function(o){i.add(o)});var r=new Set;return i.forEach(function(o){var a=o.incoming,s=o.outgoing;F(a.concat(s),function(c){var l=c.source,u=c.target;(i.has(l)||i.has(u))&&(r.has(c)||(r.add(c),n.push(c)))})}),n}function sT(e,t,n){var i=e.x,r=e.y,o=e.width,a=e.height,s=n.x,c=n.y;switch(t){case"n":return{x:i,y:r+c,width:o,height:a-c};case"s":return{x:i,y:r,width:o,height:a+c};case"w":return{x:i+s,y:r,width:o-s,height:a};case"e":return{x:i,y:r,width:o+s,height:a};default:throw new Error("unknown direction: "+t)}}var sf=Math.abs,cT=Math.round,zi={x:"width",y:"height"},Ev="crosshair",dr={n:"top",w:"left",s:"bottom",e:"right"},lT=1500,Oc={n:"s",w:"e",s:"n",e:"w"},Dc=20;function ii(e,t,n,i,r,o,a){this._canvas=e,this._dragging=t,this._eventBus=n,this._modeling=i,this._rules=r,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",lT,function(c){var l=c.context,u=l.initialized;u||(u=l.initialized=s.init(c,l)),u&&Rv(c)}),n.on("spaceTool.end",function(c){var l=c.context,u=l.axis,f=l.direction,p=l.movingShapes,d=l.resizingShapes,m=l.start;if(l.initialized){Rv(c);var h={x:0,y:0};h[u]=cT(c["d"+u]),s.makeSpace(p,d,h,f,m),n.once("spaceTool.ended",function(y){s.activateSelection(y.originalEvent,!0,!0)})}})}ii.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],ii.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:Ev,data:{context:{reactivate:n}},trapClick:!1})},ii.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:Ev,data:{context:{}}})},ii.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},ii.prototype.init=function(e,t){var n=sf(e.dx)>sf(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(sf(i)<5)return!1;i<0&&(i*=-1),Ca(e)&&(i*=-1);var o=oT(n,i),a=this._canvas.getRootElement();!xc(e)&&e.hover&&(a=e.hover);var s=[...ua(a),...a.attachers||[]],c=this.calculateAdjustments(s,n,i,r),l=this._eventBus.fire("spaceTool.getMinDimensions",{axis:n,direction:o,shapes:c.resizingShapes,start:r}),u=uT(c,n,o,r,l);return W(t,c,{axis:n,direction:o,spaceToolConstraints:u,start:r}),Pc("resize-"+(n==="x"?"ew":"ns")),!0},ii.prototype.calculateAdjustments=function(e,t,n,i){var r=this._rules,o=[],a=[],s=new Set,c=new Set,l=[],u=[];function f(d){s.has(d)||(s.add(d),o.push(d));var m=d.label;m&&!s.has(m)&&(s.add(m),o.push(m))}function p(d){c.has(d)||(c.add(d),a.push(d))}return F(e,function(d){if(!(!d.parent||Ye(d))){if(ht(d)){u.push(d);return}var m=d[t],h=m+d[zi[t]];if(pT(d)&&(n>0&&Ne(d)[t]>i||n<0&&Ne(d)[t]<i)){l.push(d);return}if(n>0&&m>i||n<0&&h<i){f(d);return}if(m<i&&h>i&&r.allowed("shape.resize",{shape:d})){p(d);return}}}),F(o,function(d){var m=d.attachers;m&&F(m,function(h){f(h)})}),F(l,function(d){var m=d.host;(s.has(m)||c.has(m))&&f(d)}),F(u,function(d){var m=d.source,h=d.target,y=d.label;(s.has(m)||c.has(m))&&(s.has(h)||c.has(h))&&y&&f(y)}),{movingShapes:o,resizingShapes:a}},ii.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},ii.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function Sv(e){return{top:e.top-Dc,right:e.right+Dc,bottom:e.bottom+Dc,left:e.left-Dc}}function Rv(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,r;Fe(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),Fe(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),Fe(n.top)&&(r=Math.max(e.y,n.top),e.dy=e.dy+r-e.y,e.y=r),Fe(n.bottom)&&(r=Math.min(e.y,n.bottom),e.dy=e.dy+r-e.y,e.y=r)}}function uT(e,t,n,i,r){var o=e.movingShapes,a=e.resizingShapes;if(a.length){var s={},c,l,u=new Set(o),f=new Set(a);return F(a,function(p){var d=p.attachers,m=p.children,h=Ie(p),y=Ke(m,function(z){return!ht(z)&&!Ye(z)&&!u.has(z)&&!f.has(z)}),v=Ke(m,function(z){return!ht(z)&&!Ye(z)&&u.has(z)}),g,b,x,C=[],M=[],k,P,B,D;y.length&&(b=Sv(Ie(Ft(y))),g=i-h[dr[n]]+b[dr[n]],n==="n"?s.bottom=l=Fe(l)?Math.min(l,g):g:n==="w"?s.right=l=Fe(l)?Math.min(l,g):g:n==="s"?s.top=c=Fe(c)?Math.max(c,g):g:n==="e"&&(s.left=c=Fe(c)?Math.max(c,g):g)),v.length&&(x=Sv(Ie(Ft(v))),g=i-x[dr[Oc[n]]]+h[dr[Oc[n]]],n==="n"?s.bottom=l=Fe(l)?Math.min(l,g):g:n==="w"?s.right=l=Fe(l)?Math.min(l,g):g:n==="s"?s.top=c=Fe(c)?Math.max(c,g):g:n==="e"&&(s.left=c=Fe(c)?Math.max(c,g):g)),d&&d.length&&(d.forEach(function(z){u.has(z)?C.push(z):M.push(z)}),C.length&&(k=Ie(Ft(C.map(Ne))),P=h[dr[Oc[n]]]-(k[dr[Oc[n]]]-i)),M.length&&(B=Ie(Ft(M.map(Ne))),D=B[dr[n]]-(h[dr[n]]-i)),n==="n"?(g=Math.min(P||1/0,D||1/0),s.bottom=l=Fe(l)?Math.min(l,g):g):n==="w"?(g=Math.min(P||1/0,D||1/0),s.right=l=Fe(l)?Math.min(l,g):g):n==="s"?(g=Math.max(P||-1/0,D||-1/0),s.top=c=Fe(c)?Math.max(c,g):g):n==="e"&&(g=Math.max(P||-1/0,D||-1/0),s.left=c=Fe(c)?Math.max(c,g):g));var I=r&&r[p.id];I&&(n==="n"?(g=i+p[zi[t]]-I[zi[t]],s.bottom=l=Fe(l)?Math.min(l,g):g):n==="w"?(g=i+p[zi[t]]-I[zi[t]],s.right=l=Fe(l)?Math.min(l,g):g):n==="s"?(g=i-p[zi[t]]+I[zi[t]],s.top=c=Fe(c)?Math.max(c,g):g):n==="e"&&(g=i-p[zi[t]]+I[zi[t]],s.left=c=Fe(c)?Math.max(c,g):g))}),s}}function pT(e){return!!e.host}var cf="djs-dragging",Cv="djs-resizing",fT=250,Ic=Math.max;function Av(e,t,n,i,r){function o(a,s){F(a,function(c){r.addDragger(c,s),n.addMarker(c,cf)})}e.on("spaceTool.selection.start",function(a){var s=n.getLayer("space"),c=a.context,l={x:"M 0,-10000 L 0,10000",y:"M -10000,0 L 10000,0"},u=Oe("g");Se(u,i.cls("djs-crosshair-group",["no-events"])),ze(s,u);var f=Oe("path");Se(f,"d",l.x),et(f).add("djs-crosshair"),ze(u,f);var p=Oe("path");Se(p,"d",l.y),et(p).add("djs-crosshair"),ze(u,p),c.crosshairGroup=u}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;ln(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&Kt(c)}),e.on("spaceTool.move",fT,function(a){var s=a.context,c=s.line,l=s.axis,u=s.movingShapes,f=s.resizingShapes;if(s.initialized){if(!s.dragGroup){var p=n.getLayer("space");c=Oe("path"),Se(c,"d","M0,0 L0,0"),et(c).add("djs-crosshair"),ze(p,c),s.line=c;var d=Oe("g");Se(d,i.cls("djs-drag-group",["no-events"])),ze(n.getActiveLayer(),d),o(u,d);var m=new Set(u);F(f,function(M){m.add(M)});var h=new Set,y=s.movingConnections=[];m.forEach(function(M){F(M.outgoing,function(k){h.has(k)||!ht(k)||!m.has(k.target)||(h.add(k),y.push(k))})}),o(y,d),s.dragGroup=d}if(!s.frameGroup){var v=Oe("g");Se(v,i.cls("djs-frame-group",["no-events"])),ze(n.getActiveLayer(),v);var g=[];F(f,function(M){var k=r.addFrame(M,v),P=k.getBBox();g.push({element:k,initialBounds:P}),n.addMarker(M,Cv)}),s.frameGroup=v,s.frames=g}var b={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};Se(c,{d:b[l]});var x={x:"y",y:"x"},C={x:a.dx,y:a.dy};C[x[s.axis]]=0,ln(s.dragGroup,C.x,C.y),F(s.frames,function(M){var k=M.element,P=M.initialBounds,B,D;s.direction==="e"?Se(k,{width:Ic(P.width+C.x,5)}):(B=Ic(P.width-C.x,5),Se(k,{width:B,x:P.x+P.width-B})),s.direction==="s"?Se(k,{height:Ic(P.height+C.y,5)}):(D=Ic(P.height-C.y,5),Se(k,{height:D,y:P.y+P.height-D}))})}}),e.on("spaceTool.cleanup",function(a){var s=a.context,c=s.movingShapes,l=s.movingConnections,u=s.resizingShapes,f=s.line,p=s.dragGroup,d=s.frameGroup;F(c,function(m){n.removeMarker(m,cf)}),F(l,function(m){n.removeMarker(m,cf)}),p&&(Kt(f),Kt(p)),F(u,function(m){n.removeMarker(m,Cv)}),d&&Kt(d)})}Av.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const dT={__init__:["spaceToolPreview"],__depends__:[Hi,Si,kc,No,Ma],spaceTool:["type",ii],spaceToolPreview:["type",Av]};function Lc(e,t){e.invoke(ii,this),this._canvas=t}Lc.$inject=["injector","canvas"],Ee(Lc,ii),Lc.prototype.calculateAdjustments=function(e,t,n,i){var r=this._canvas.getRootElement(),o=e[0]===r?null:e[0],a=[];o&&(a=ro(bo(r.children.filter(l=>S(l,"bpmn:Artifact")),Ft(o))));const s=[...e,...a];var c=ii.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(l){return!(S(l,"bpmn:TextAnnotation")||hT(l)&&(t==="y"&&tn(l)||t==="x"&&!tn(l)))}),c};function hT(e){return S(e,"bpmn:Participant")&&!ie(e).processRef}const Pv={__depends__:[dT],spaceTool:["type",Lc]};function Mt(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)}Mt.$inject=["eventBus","injector"],Mt.prototype.execute=function(e,t){if(!e)throw new Error("command required");this._currentExecution.trigger="execute";const n={command:e,context:t};this._pushAction(n),this._internalExecute(n),this._popAction()},Mt.prototype.canExecute=function(e,t){const n={command:e,context:t},i=this._getHandler(e);let r=this._fire(e,"canExecute",n);if(r===void 0){if(!i)return!1;i.canExecute&&(r=i.canExecute(t))}return r},Mt.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},Mt.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()}},Mt.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()}},Mt.prototype.register=function(e,t){this._setHandler(e,t)},Mt.prototype.registerHandler=function(e,t){if(!e||!t)throw new Error("command and handlerCls must be defined");const n=this._injector.instantiate(t);this.register(e,n)},Mt.prototype.canUndo=function(){return!!this._getUndoAction()},Mt.prototype.canRedo=function(){return!!this._getRedoAction()},Mt.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},Mt.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},Mt.prototype._internalUndo=function(e){const t=e.command,n=e.context,i=this._getHandler(t);this._atomicDo(()=>{this._fire(t,"revert",e),i.revert&&this._markDirty(i.revert(n)),this._revertedAction(e),this._fire(t,"reverted",e)})},Mt.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);const i=t?[e+"."+t,t]:[e];let r;n=this._eventBus.createEvent(n);for(const o of i)if(r=this._eventBus.fire("commandStack."+o,n),n.cancelBubble)break;return r},Mt.prototype._createId=function(){return this._uid++},Mt.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},Mt.prototype._internalExecute=function(e,t){const n=e.command,i=e.context,r=this._getHandler(n);if(!r)throw new Error("no command handler registered for <"+n+">");this._pushAction(e),t||(this._fire(n,"preExecute",e),r.preExecute&&r.preExecute(i),this._fire(n,"preExecuted",e)),this._atomicDo(()=>{this._fire(n,"execute",e),r.execute&&this._markDirty(r.execute(i)),this._executedAction(e,t),this._fire(n,"executed",e)}),t||(this._fire(n,"postExecute",e),r.postExecute&&r.postExecute(i),this._fire(n,"postExecuted",e)),this._popAction()},Mt.prototype._pushAction=function(e){const t=this._currentExecution,n=t.actions,i=n[0];if(t.atomic)throw new Error("illegal invocation in <execute> or <revert> phase (action: "+e.command+")");e.id||(e.id=i&&i.id||this._createId()),n.push(e)},Mt.prototype._popAction=function(){const e=this._currentExecution,t=e.trigger,n=e.actions,i=e.dirty;n.pop(),n.length||(this._eventBus.fire("elements.changed",{elements:Bd("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},Mt.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=Be(e)?e:[e],t.dirty=t.dirty.concat(e))},Mt.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},Mt.prototype._revertedAction=function(e){this._stackIdx--},Mt.prototype._getHandler=function(e){return this._handlerMap[e]},Mt.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};const mT={commandStack:["type",Mt]};function hr(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 gT=250,Mv=1400;function lf(e,t,n){te.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",Mv,function(r){var o=r.context,a=o.shapes,s=o.validatedShapes;o.shapes=Tv(a),o.validatedShapes=Tv(s)}),i&&t.on("shape.move.start",gT,function(r){var o=r.context,a=new Set(o.shapes),s=new Set;for(const c of a)for(const l of c.labels)!l.hidden&&!a.has(l)&&s.add(l),c.labelTarget&&s.add(c);for(const c of s)i.makeDraggable(o,c,!0)}),this.preExecuted("elements.move",Mv,function(r){var o=r.context,a=o.closure,s=a.enclosedElements,c=[];F(s,function(l){F(l.labels,function(u){s[u.id]||c.push(u)})}),a.addAll(c)}),this.preExecute(["connection.delete","shape.delete"],function(r){var o=r.context,a=o.connection||o.shape;hr(a.labels,function(s){n.removeShape(s,{nested:!0})})}),this.execute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.labelTarget;s&&(o.labelTargetIndex=Hu(s.labels,a),o.labelTarget=s,a.labelTarget=null)}),this.revert("shape.delete",function(r){var o=r.context,a=o.shape,s=o.labelTarget,c=o.labelTargetIndex;s&&(Bt(s.labels,a,c),a.labelTarget=s)})}Ee(lf,te),lf.$inject=["injector","eventBus","modeling"];function Tv(e){var t=new Set(e);return Ke(e,function(n){return!t.has(n.labelTarget)})}const yT={__init__:["labelSupport"],labelSupport:["type",lf]};var vT=251,kv=1401,Ov="attach-ok";function uf(e,t,n,i,r){te.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",kv,function(a){var s=a.context,c=s.shapes,l=s.validatedShapes;s.shapes=bT(c),s.validatedShapes=xT(l)}),o&&t.on("shape.move.start",vT,function(a){var s=a.context,c=s.shapes,l=pf(c);F(l,function(u){o.makeDraggable(s,u,!0),F(u.labels,function(f){o.makeDraggable(s,f,!0)})})}),o&&t.on("shape.move.start",function(a){var s=a.context,c=s.shapes;if(c.length===1){var l=c[0],u=l.host;u&&(n.addMarker(u,Ov),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(u,Ov)}))}}),this.preExecuted("elements.move",kv,function(a){var s=a.context,c=s.closure,l=s.shapes,u=pf(l);F(u,function(f){c.add(f,c.topLevel[f.host.id])})}),this.postExecuted("elements.move",function(a){var s=a.context,c=s.shapes,l=s.newHost,u;l&&c.length!==1||(l?u=c:u=Ke(c,function(f){var p=f.host;return _T(f)&&!wT(c,p)}),F(u,function(f){r.updateAttachment(f,l)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;F(s,function(c){F(c.attachers,function(l){F(l.outgoing.slice(),function(u){var f=i.allowed("connection.reconnect",{connection:u,source:u.source,target:u.target});f||r.removeConnection(u)}),F(l.incoming.slice(),function(u){var f=i.allowed("connection.reconnect",{connection:u,source:u.source,target:u.target});f||r.removeConnection(u)})})})}),this.postExecute("shape.create",function(a){var s=a.context,c=s.shape,l=s.host;l&&r.updateAttachment(c,l)}),this.postExecute("shape.replace",function(a){var s=a.context,c=s.oldShape,l=s.newShape;hr(c.attachers,function(u){var f=i.allowed("elements.move",{target:l,shapes:[u]});f==="attach"?r.updateAttachment(u,l):r.removeShape(u)}),l.attachers.length&&F(l.attachers,function(u){var f=Xg(u,c,l);r.moveShape(u,f,u.parent)})}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.oldBounds,u=s.newBounds,f=c.attachers,p=s.hints||{};p.attachSupport!==!1&&F(f,function(d){var m=Xg(d,l,u);r.moveShape(d,m,d.parent),F(d.labels,function(h){r.moveShape(h,m,h.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;hr(s.attachers,function(c){r.removeShape(c)}),s.host&&r.updateAttachment(s,null)})}Ee(uf,te),uf.$inject=["injector","eventBus","canvas","rules","modeling"];function pf(e){return Kl(hn(e,function(t){return t.attachers||[]}))}function bT(e){var t=pf(e);return I0("id",e,t)}function xT(e){var t=oo(e,"id");return Ke(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function _T(e){return!!e.host}function wT(e,t){return e.indexOf(t)!==-1}const ET={__depends__:[Si],__init__:["attachSupport"],attachSupport:["type",uf]};function Dv(e,t,n,i){e.on("element.changed",function(r){var o=r.element;(o.parent||o===t.getRootElement())&&(r.gfx=n.getGraphics(o)),r.gfx&&e.fire(Rm(o)+".changed",r)}),e.on("elements.changed",function(r){var o=r.elements;o.forEach(function(a){e.fire("element.changed",{element:a})}),i.updateContainments(o)}),e.on("shape.changed",function(r){i.update("shape",r.element,r.gfx)}),e.on("connection.changed",function(r){i.update("connection",r.element,r.gfx)})}Dv.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const ff={__init__:["changeSupport"],changeSupport:["type",Dv]};function ri(e){this._model=e}ri.$inject=["moddle"],ri.prototype._needsId=function(e){return qe(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"])},ri.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;S(e,"bpmn:Activity")?t="Activity":S(e,"bpmn:Event")?t="Event":S(e,"bpmn:Gateway")?t="Gateway":qe(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))},ri.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},ri.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},ri.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",W({bpmnElement:e,bounds:this.createDiBounds()},t))},ri.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},ri.prototype.createDiWaypoints=function(e){var t=this;return hn(e,function(n){return t.createDiWaypoint(n)})},ri.prototype.createDiWaypoint=function(e){return this.create("dc:Point",li(e,["x","y"]))},ri.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",W({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},ri.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",W({bpmnElement:e},t))};function Nn(e,t,n){te.call(this,e),this._bpmnFactory=t;var i=this;function r(d){var m=d.context,h=m.hints||{},y;!m.cropped&&h.createElementsBehavior!==!1&&(y=m.connection,y.waypoints=n.getCroppedWaypoints(y),m.cropped=!0)}this.executed(["connection.layout","connection.create"],r),this.reverted(["connection.layout"],function(d){delete d.context.cropped});function o(d){var m=d.context;i.updateParent(m.shape||m.connection,m.oldParent)}function a(d){var m=d.context,h=m.shape||m.connection,y=m.parent||m.newParent;i.updateParent(h,y)}this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],$n(o)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],$n(a));function s(d){var m=d.context,h=m.oldRoot,y=h.children;F(y,function(v){S(v,"bpmn:BaseElement")&&i.updateParent(v)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(d){var m=d.context.shape;S(m,"bpmn:BaseElement")&&i.updateBounds(m)}this.executed(["shape.move","shape.create","shape.resize"],$n(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],$n(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 l(d){i.updateConnection(d.context)}this.executed(["connection.create","connection.move","connection.delete","connection.reconnect"],$n(l)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],$n(l));function u(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],$n(u)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],$n(u)),this.executed("connection.reconnect",$n(function(d){var m=d.context,h=m.connection,y=m.oldSource,v=m.newSource,g=ie(h),b=ie(y),x=ie(v);g.conditionExpression&&!qe(x,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(m.oldConditionExpression=g.conditionExpression,delete g.conditionExpression),y!==v&&b.default===g&&(m.oldDefault=b.default,delete b.default)})),this.reverted("connection.reconnect",$n(function(d){var m=d.context,h=m.connection,y=m.oldSource,v=m.newSource,g=ie(h),b=ie(y),x=ie(v);m.oldConditionExpression&&(g.conditionExpression=m.oldConditionExpression),m.oldDefault&&(b.default=m.oldDefault,delete x.default)}));function f(d){i.updateAttachment(d.context)}this.executed(["element.updateAttachment"],$n(f)),this.reverted(["element.updateAttachment"],$n(f)),this.executed("element.updateLabel",$n(p)),this.reverted("element.updateLabel",$n(p));function p(d){const{element:m}=d.context,h=qn(m),y=ot(m),v=y&&y.get("label");sr(m)||_c(m)||(h&&!v?y.set("label",t.create("bpmndi:BPMNLabel")):!h&&v&&y.set("label",void 0))}}Ee(Nn,te),Nn.$inject=["eventBus","bpmnFactory","connectionDocking"],Nn.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},Nn.prototype.updateParent=function(e,t){if(!Ye(e)&&!(S(e,"bpmn:DataStoreReference")&&e.parent&&S(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=ot(e),o=n&&n.businessObject,a=ot(n);S(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,o,t&&t.businessObject),S(e,"bpmn:DataOutputAssociation")&&(e.source?o=e.source.businessObject:o=null),S(e,"bpmn:DataInputAssociation")&&(e.target?o=e.target.businessObject:o=null),this.updateSemanticParent(i,o),S(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,o),this.updateDiParent(r,a)}},Nn.prototype.updateBounds=function(e){var t=ot(e),n=RT(e);if(n){var i=pi(n,t.get("bounds"));W(n,{x:e.x+i.x,y:e.y+i.y})}var r=Ye(e)?this._getLabel(t):t,o=r.bounds;o||(o=this._bpmnFactory.createDiBounds(),r.set("bounds",o)),W(o,{x:e.x,y:e.y,width:e.width,height:e.height})},Nn.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,r;S(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),Lt(i,e)),S(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),Bt(r,e))}},Nn.prototype.updateDiConnection=function(e,t,n){var i=ot(e),r=ot(t),o=ot(n);i.sourceElement&&i.sourceElement.bpmnElement!==ie(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==ie(n)&&(i.targetElement=n&&o)},Nn.prototype.updateDiParent=function(e,t){if(t&&!S(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(Lt(n,e),e.$parent=null)}};function ST(e){for(;e&&!S(e,"bpmn:Definitions");)e=e.$parent;return e}Nn.prototype.getLaneSet=function(e){var t,n;return S(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(S(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)},Nn.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&!((S(e,"bpmn:DataInput")||S(e,"bpmn:DataOutput"))&&(S(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(S(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(S(e,"bpmn:FlowElement")){if(t){if(S(t,"bpmn:Participant"))t=t.processRef;else if(S(t,"bpmn:Lane"))do t=t.$parent.$parent;while(S(t,"bpmn:Lane"))}i="flowElements"}else if(S(e,"bpmn:Artifact")){for(;t&&!S(t,"bpmn:Process")&&!S(t,"bpmn:SubProcess")&&!S(t,"bpmn:Collaboration");)if(S(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;i="artifacts"}else if(S(e,"bpmn:MessageFlow"))i="messageFlows";else if(S(e,"bpmn:Participant")){i="participants";var r=e.processRef,o;r&&(o=ST(e.$parent||t),e.$parent&&(Lt(o.get("rootElements"),r),r.$parent=null),t&&(Bt(o.get("rootElements"),r),r.$parent=o))}else S(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":S(e,"bpmn:DataInputAssociation")&&(i="dataInputAssociations");if(!i)throw new Error(`no parent for <${e.id}> in <${t.id}>`);var a;if(e.$parent&&(a=e.$parent.get(i),Lt(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);Lt(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},Nn.prototype.updateConnectionWaypoints=function(e){var t=ot(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},Nn.prototype.updateConnection=function(e){var t=e.connection,n=ie(t),i=t.source,r=ie(i),o=t.target,a=ie(t.target),s;if(S(n,"bpmn:DataAssociation"))S(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=r,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):S(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||r,this.updateSemanticParent(n,r,s),n.targetRef=a);else{var c=S(n,"bpmn:SequenceFlow");n.sourceRef!==r&&(c&&(Lt(n.sourceRef&&n.sourceRef.get("outgoing"),n),r&&r.get("outgoing")&&r.get("outgoing").push(n)),n.sourceRef=r),n.targetRef!==a&&(c&&(Lt(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,i,o)},Nn.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function $n(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;S(i,"bpmn:BaseElement")&&e(t)}}function RT(e){if(S(e,"bpmn:Activity")){var t=ot(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function mr(e,t){Ni.call(this),this._bpmnFactory=e,this._moddle=t}Ee(mr,Ni),mr.$inject=["bpmnFactory","moddle"],mr.prototype._baseCreate=Ni.prototype.create,mr.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,W({type:"label",di:n},Fr,t))}return this.createElement(e,t)},mr.prototype.createElement=function(e,t){t=W({},t||{});var n,i=t.businessObject,r=t.di;if(!i){if(!t.type)throw new Error("no shape type specified");i=this._bpmnFactory.create(t.type)}if(!AT(r)){var o=W({},r||{},{id:i.id+"_di"});e==="root"?r=this._bpmnFactory.createDiPlane(i,o):e==="connection"?r=this._bpmnFactory.createDiEdge(i,o):r=this._bpmnFactory.createDiShape(i,o)}S(i,"bpmn:Group")&&(t=W({isFrame:!0},t)),t=CT(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=df(r,t,"isExpanded")),qe(i,["bpmn:Lane","bpmn:Participant"])&&(t=df(r,t,"isHorizontal")),S(i,"bpmn:SubProcess")&&(t.collapsed=!Qe(i,r)),S(i,"bpmn:ExclusiveGateway")&&(Mn(r,"isMarkerVisible")?r.isMarkerVisible===void 0&&(r.isMarkerVisible=!1):r.isMarkerVisible=!0),Yt(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),Yt(t.cancelActivity)&&(i.cancelActivity=t.cancelActivity,delete t.cancelActivity);var a,s;return t.eventDefinitionType&&(a=i.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=i,i.eventDefinitions=a,delete t.eventDefinitionType),n=this.getDefaultSize(i,r),t=W({id:i.id},n,t,{businessObject:i,di:r}),this._baseCreate(e,t)},mr.prototype.getDefaultSize=function(e,t){var n=ie(e);if(t=t||ot(e),S(n,"bpmn:SubProcess"))return Qe(n,t)?{width:350,height:200}:{width:100,height:80};if(S(n,"bpmn:Task"))return{width:100,height:80};if(S(n,"bpmn:Gateway"))return{width:50,height:50};if(S(n,"bpmn:Event"))return{width:36,height:36};if(S(n,"bpmn:Participant")){var i=t.isHorizontal===void 0||t.isHorizontal===!0;return Qe(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return S(n,"bpmn:Lane")?{width:400,height:100}:S(n,"bpmn:DataObjectReference")?{width:36,height:50}:S(n,"bpmn:DataStoreReference")?{width:50,height:50}:S(n,"bpmn:TextAnnotation")?{width:100,height:40}:S(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},mr.prototype.createParticipantShape=function(e){return Qt(e)||(e={isExpanded:e}),e=W({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function CT(e,t,n){return F(n,function(i){t=df(e,t,i)}),t}function df(e,t,n){return t[n]===void 0?t:(e[n]=t[n],hi(t,[n]))}function AT(e){return qe(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function Bc(e,t){this._modeling=e,this._canvas=t}Bc.$inject=["modeling","canvas"],Bc.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;F(n,function(r){var o={x:0,y:0};Yt(i.left)?o.x=i.left-r.x:Yt(i.right)?o.x=i.right-r.width-r.x:Yt(i.center)?o.x=i.center-Math.round(r.width/2)-r.x:Yt(i.top)?o.y=i.top-r.y:Yt(i.bottom)?o.y=i.bottom-r.height-r.y:Yt(i.middle)&&(o.y=i.middle-Math.round(r.height/2)-r.y),t.moveElements([r],o,r.parent)})},Bc.prototype.postExecute=function(e){};function Nc(e){this._modeling=e}Nc.$inject=["modeling"],Nc.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var n=e.target||t.parent,i=e.shape,r=e.hints||{};i=e.shape=this._modeling.createShape(i,e.position,n,{attach:r.attach}),e.shape=i},Nc.prototype.postExecute=function(e){var t=e.hints||{};PT(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 PT(e,t){return Xi(e.outgoing,function(n){return n.target===t})}function $c(e,t){this._canvas=e,this._layouter=t}$c.$inject=["canvas","layouter"],$c.prototype.execute=function(e){var t=e.connection,n=e.source,i=e.target,r=e.parent,o=e.parentIndex,a=e.hints;if(!n||!i)throw new Error("source and target required");if(!r)throw new Error("parent required");return t.source=n,t.target=i,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,a)),this._canvas.addConnection(t,r,o),t},$c.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var Fc=Math.round;function hf(e){this._modeling=e}hf.$inject=["modeling"],hf.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,r=e.position,o=e.hints,a=this._modeling;F(t,function(f){Fe(f.x)||(f.x=0),Fe(f.y)||(f.y=0)});var s=Ke(t,function(f){return!f.hidden}),c=Ft(s);F(t,function(f){ht(f)&&(f.waypoints=hn(f.waypoints,function(p){return{x:Fc(p.x-c.x-c.width/2+r.x),y:Fc(p.y-c.y-c.height/2+r.y)}})),W(f,{x:Fc(f.x-c.x-c.width/2+r.x),y:Fc(f.y-c.y-c.height/2+r.y)})});var l=new Set(Hs(t)),u={};F(t,function(f){if(ht(f)){u[f.id]=Fe(i)?a.createConnection(u[f.source.id],u[f.target.id],i,f,f.parent||n,o):a.createConnection(u[f.source.id],u[f.target.id],f,f.parent||n,o);return}var p=W({},o);l.has(f)||(p.autoResize=!1),Ye(f)&&(p=hi(p,["attach"])),u[f.id]=Fe(i)?a.createShape(f,li(f,["x","y","width","height"]),f.parent||n,i,p):a.createShape(f,li(f,["x","y","width","height"]),f.parent||n,p)}),e.elements=ro(u)};var Iv=Math.round;function gr(e){this._canvas=e}gr.$inject=["canvas"],gr.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,r=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return n.width!==void 0?W(t,n):W(t,{x:n.x-Iv(t.width/2),y:n.y-Iv(t.height/2)}),this._canvas.addShape(t,i,r),t},gr.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function ka(e){gr.call(this,e)}Ee(ka,gr),ka.$inject=["canvas"];var MT=gr.prototype.execute;ka.prototype.execute=function(e){var t=e.shape;return kT(t),t.labelTarget=e.labelTarget,MT.call(this,e)};var TT=gr.prototype.revert;ka.prototype.revert=function(e){return e.shape.labelTarget=null,TT.call(this,e)};function kT(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function Oa(e,t){this._canvas=e,this._modeling=t}Oa.$inject=["canvas","modeling"],Oa.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;hr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),hr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},Oa.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=Hu(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},Oa.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,Bt(n.children,t,i),this._canvas.addConnection(t,n),t};function mf(e,t){this._modeling=e,this._elementRegistry=t}mf.$inject=["modeling","elementRegistry"],mf.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;F(i,function(r){n.get(r.id)&&(r.waypoints?t.removeConnection(r):t.removeShape(r))})};function Da(e,t){this._canvas=e,this._modeling=t}Da.$inject=["canvas","modeling"],Da.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;hr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),hr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),hr(n.children,function(i){ht(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},Da.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=Hu(i.children,n),t.removeShape(n),n},Da.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return Bt(i.children,n,r),t.addShape(n,i),n};function jc(e){this._modeling=e}jc.$inject=["modeling"];var Lv={x:"y",y:"x"};jc.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(y,v){y.range.min=Math.min(v[i],y.range.min),y.range.max=Math.max(v[i]+v[r],y.range.max)}function a(y){return y[i]+y[r]/2}function s(y){return y.length-1}function c(y){return y.max-y.min}function l(y,v){var g={y:0};g[i]=y-a(v),g[i]&&(g[Lv[i]]=0,t.moveElements([v],g,v.parent))}var u=n[0],f=s(n),p=n[f],d,m,h=0;F(n,function(y,v){var g,b,x;if(y.elements.length<2){v&&v!==n.length-1&&(o(y,y.elements[0]),h+=c(y.range));return}g=di(y.elements,i),b=g[0],v===f&&(b=g[s(g)]),x=a(b),y.range=null,F(g,function(C){if(l(x,C),y.range===null){y.range={min:C[i],max:C[i]+C[r]};return}o(y,C)}),v&&v!==n.length-1&&(h+=c(y.range))}),m=Math.abs(p.range.min-u.range.max),d=Math.round((m-h)/(n.length-1)),!(d<n.length-1)&&F(n,function(y,v){var g={},b;y===u||y===p||(b=n[v-1],y.range.max=0,F(y.elements,function(x,C){g[Lv[i]]=0,g[i]=b.range.max-x[i]+d,y.range.min!==x[i]&&(g[i]+=x[i]-y.range.min),g[i]&&t.moveElements([x],g,x.parent),y.range.max=Math.max(x[i]+x[r],C?y.range.max:0)}))})},jc.prototype.postExecute=function(e){};function Hc(e,t){this._layouter=e,this._canvas=t}Hc.$inject=["layouter","canvas"],Hc.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return W(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},Hc.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function gf(){}gf.prototype.execute=function(e){var t=e.connection,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldParent=o,e.oldParentIndex=Lt(o.children,t),Bt(i.children,t,r),t.parent=i,F(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},gf.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return Lt(n.children,t),Bt(i.children,t,r),t.parent=i,F(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};function yf(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}yf.prototype.add=function(e,t){return this.addAll([e],t)},yf.prototype.addAll=function(e,t){var n=sR(e,!!t,this);return W(this,n),this};function Ia(e){this._modeling=e}Ia.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},Ia.prototype.moveClosure=function(e,t,n,i,r){var o=this._modeling,a=e.allShapes,s=e.allConnections,c=e.enclosedConnections,l=e.topLevel,u=!1;r&&r.parent===n&&(u=!0),F(a,function(f){o.moveShape(f,t,l[f.id]&&!u&&n,{recurse:!1,layout:!1})}),F(s,function(f){var p=!!a[f.source.id],d=!!a[f.target.id];c[f.id]&&p&&d?o.moveConnection(f,t,l[f.id]&&!u&&n):o.layoutConnection(f,{connectionStart:p&&Ep(f,f.source,t),connectionEnd:d&&Sp(f,f.target,t)})})},Ia.prototype.getClosure=function(e){return new yf().addAll(e,!0)};function zc(e){this._helper=new Ia(e)}zc.$inject=["modeling"],zc.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},zc.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)};function Wr(e){this._modeling=e,this._helper=new Ia(e)}Wr.$inject=["modeling"],Wr.prototype.execute=function(e){var t=e.shape,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldBounds=li(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=Lt(o.children,t),Bt(i.children,t,r),W(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},Wr.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,r=this._modeling;i.layout!==!1&&(F(t.incoming,function(o){r.layoutConnection(o,{connectionEnd:Sp(o,t,n)})}),F(t.outgoing,function(o){r.layoutConnection(o,{connectionStart:Ep(o,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},Wr.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return Bt(n.children,t,i),W(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},Wr.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},Wr.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function La(e){this._modeling=e}La.$inject=["modeling"],La.prototype.execute=function(e){var t=e.newSource,n=e.newTarget,i=e.connection,r=e.dockingOrPoints;if(!t&&!n)throw new Error("newSource or newTarget required");return Be(r)&&(e.oldWaypoints=i.waypoints,i.waypoints=r),t&&(e.oldSource=i.source,i.source=t),n&&(e.oldTarget=i.target,i.target=n),i},La.prototype.postExecute=function(e){var t=e.connection,n=e.newSource,i=e.newTarget,r=e.dockingOrPoints,o=e.hints||{},a={};o.connectionStart&&(a.connectionStart=o.connectionStart),o.connectionEnd&&(a.connectionEnd=o.connectionEnd),o.layoutConnection!==!1&&(n&&(!i||o.docking==="source")&&(a.connectionStart=a.connectionStart||Bv(Be(r)?r[0]:r)),i&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||Bv(Be(r)?r[r.length-1]:r)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},La.prototype.revert=function(e){var t=e.oldSource,n=e.oldTarget,i=e.oldWaypoints,r=e.connection;return t&&(r.source=t),n&&(r.target=n),i&&(r.waypoints=i),r};function Bv(e){return e.original||e}function Gi(e,t){this._modeling=e,this._rules=t}Gi.$inject=["modeling","rules"],Gi.prototype.preExecute=function(e){var t=this,n=this._modeling,i=this._rules,r=e.oldShape,o=e.newData,a=e.hints||{},s;function c(m,h,y){return i.allowed("connection.reconnect",{connection:y,source:m,target:h})}var l={x:o.x,y:o.y},u={x:r.x,y:r.y,width:r.width,height:r.height};s=e.newShape=e.newShape||t.createShape(o,l,r.parent,a),r.host&&n.updateAttachment(s,r.host);var f;a.moveChildren!==!1&&(f=r.children.slice(),n.moveElements(f,{x:0,y:0},s,a));var p=r.incoming.slice(),d=r.outgoing.slice();F(p,function(m){var h=m.source,y=c(h,s,m);y&&t.reconnectEnd(m,s,mc(m,s,u),a)}),F(d,function(m){var h=m.target,y=c(s,h,m);y&&t.reconnectStart(m,s,hc(m,s,u),a)})},Gi.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},Gi.prototype.execute=function(e){},Gi.prototype.revert=function(e){},Gi.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},Gi.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},Gi.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function Ba(e){this._modeling=e}Ba.$inject=["modeling"],Ba.prototype.execute=function(e){var t=e.shape,n=e.newBounds,i=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(i&&(n.width<i.width||n.height<i.height))throw new Error("width and height cannot be less than minimum height and width");if(!i&&n.width<10||n.height<10)throw new Error("width and height cannot be less than 10px");return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},W(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Ba.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,r=e.hints||{};r.layout!==!1&&(F(n.incoming,function(o){t.layoutConnection(o,{connectionEnd:mc(o,n,i)})}),F(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:hc(o,n,i)})}))},Ba.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return W(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function yr(e){this._modeling=e}yr.$inject=["modeling"],yr.prototype.preExecute=function(e){var t=e.delta,n=e.direction,i=e.movingShapes,r=e.resizingShapes,o=e.start,a={};this.moveShapes(i,t),F(r,function(s){a[s.id]=DT(s)}),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(aT(i,r),t,n,o,i,r,a)},yr.prototype.execute=function(){},yr.prototype.revert=function(){},yr.prototype.moveShapes=function(e,t){var n=this;F(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},yr.prototype.resizeShapes=function(e,t,n){var i=this;F(e,function(r){var o=sT(r,n,t);i._modeling.resizeShape(r,o,null,{attachSupport:!1,autoResize:!1,layout:!1})})},yr.prototype.updateConnectionWaypoints=function(e,t,n,i,r,o,a){var s=this,c=new Set(r),l=new Set(o);F(e,function(u){var f=u.source,p=u.target,d=OT(u),m=$v(n),h={},y=c.has(f)||l.has(f),v=c.has(p)||l.has(p);y&&v?(d=hn(d,function(g){return Fv(g,i,n)&&(g[m]=g[m]+t[m]),g.original&&Fv(g.original,i,n)&&(g.original[m]=g.original[m]+t[m]),g}),s._modeling.updateWaypoints(u,d,{labelBehavior:!1})):(y||v)&&(c.has(f)?h.connectionStart=Ep(u,f,t):c.has(p)?h.connectionEnd=Sp(u,p,t):l.has(f)?h.connectionStart=hc(u,f,a[f.id]):l.has(p)&&(h.connectionEnd=mc(u,p,a[p.id])),s._modeling.layoutConnection(u,h))})};function Nv(e){return W({},e)}function OT(e){return hn(e.waypoints,function(t){return t=Nv(t),t.original&&(t.original=Nv(t.original)),t})}function $v(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function Fv(e,t,n){var i=$v(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function DT(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function Gc(e){this._modeling=e}Gc.$inject=["modeling"],Gc.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=jv(n),t.collapsed=!t.collapsed;var i=Hv(n,t.collapsed);return[t].concat(i)},Gc.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,r=zv(i,n);return t.collapsed=!t.collapsed,[t].concat(r)};function jv(e){var t={};return F(e,function(n){t[n.id]=n.hidden,n.children&&(t=W({},t,jv(n.children)))}),t}function Hv(e,t){var n=[];return F(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(Hv(i.children,i.collapsed||t)))}),n}function zv(e,t){var n=[];return F(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(zv(i.children,t)))}),n}function Vc(e){this._modeling=e}Vc.$inject=["modeling"],Vc.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=Gv(i,t),Vv(n,t),t.host=n,t},Vc.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,Gv(n,t),Vv(i,t,r),t};function Gv(e,t){return Lt(e&&e.attachers,t)}function Vv(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),Bt(i,t,n)}}function vf(){}vf.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},vf.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function mt(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}mt.$inject=["eventBus","elementFactory","commandStack"],mt.prototype.getHandlers=function(){return{"shape.append":Nc,"shape.create":gr,"shape.delete":Da,"shape.move":Wr,"shape.resize":Ba,"shape.replace":Gi,"shape.toggleCollapse":Gc,spaceTool:yr,"label.create":ka,"connection.create":$c,"connection.delete":Oa,"connection.move":gf,"connection.layout":Hc,"connection.updateWaypoints":vf,"connection.reconnect":La,"elements.create":hf,"elements.move":zc,"elements.delete":mf,"elements.distribute":jc,"elements.align":Bc,"element.updateAttachment":Vc}},mt.prototype.registerHandlers=function(e){F(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},mt.prototype.moveShape=function(e,t,n,i,r){typeof i=="object"&&(r=i,i=null);var o={shape:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("shape.move",o)},mt.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},mt.prototype.moveElements=function(e,t,n,i){i=i||{};var r=i.attach,o=n,a;r===!0?(a=n,o=n.parent):r===!1&&(a=null);var s={shapes:e,delta:t,newParent:o,newHost:a,hints:i};this._commandStack.execute("elements.move",s)},mt.prototype.moveConnection=function(e,t,n,i,r){typeof i=="object"&&(r=i,i=void 0);var o={connection:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("connection.move",o)},mt.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},mt.prototype.createConnection=function(e,t,n,i,r,o){typeof n=="object"&&(o=r,r=i,i=n,n=void 0),i=this._create("connection",i);var a={source:e,target:t,parent:r,parentIndex:n,connection:i,hints:o};return this._commandStack.execute("connection.create",a),a.connection},mt.prototype.createShape=function(e,t,n,i,r){typeof i!="number"&&(r=i,i=void 0),r=r||{};var o=r.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:i,host:s,hints:r};return this._commandStack.execute("shape.create",c),c.shape},mt.prototype.createElements=function(e,t,n,i,r){Be(e)||(e=[e]),typeof i!="number"&&(r=i,i=void 0),r=r||{};var o={position:t,elements:e,parent:n,parentIndex:i,hints:r};return this._commandStack.execute("elements.create",o),o.elements},mt.prototype.createLabel=function(e,t,n,i){n=this._create("label",n);var r={labelTarget:e,position:t,parent:i||e.parent,shape:n};return this._commandStack.execute("label.create",r),r.shape},mt.prototype.appendShape=function(e,t,n,i,r){r=r||{},t=this._create("shape",t);var o={source:e,position:n,target:i,shape:t,connection:r.connection,connectionParent:r.connectionParent,hints:r};return this._commandStack.execute("shape.append",o),o.shape},mt.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},mt.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},mt.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},mt.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},mt.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},mt.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},mt.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},mt.prototype.createSpace=function(e,t,n,i,r){var o={delta:n,direction:i,movingShapes:e,resizingShapes:t,start:r};this._commandStack.execute("spaceTool",o)},mt.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},mt.prototype.reconnect=function(e,t,n,i,r){var o={connection:e,newSource:t,newTarget:n,dockingOrPoints:i,hints:r||{}};this._commandStack.execute("connection.reconnect",o)},mt.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,W(i,{docking:"source"}))},mt.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,W(i,{docking:"target"}))},mt.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},mt.prototype._create=function(e,t){return UR(t)?t:this._elementFactory.create(e,t)},mt.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function Na(e){this._elementRegistry=e}Na.$inject=["elementRegistry"],Na.prototype.execute=function(e){var t=e.element,n=e.moddleElement,i=e.properties;if(!n)throw new Error("<moddleElement> required");var r=e.changed||this._getVisualReferences(n).concat(t),o=e.oldProperties||IT(n,ds(i));return Wv(n,i),e.oldProperties=o,e.changed=r,r},Na.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return Wv(n,t),i},Na.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return S(e,"bpmn:DataObject")?LT(e,t):[]};function IT(e,t){return Tn(t,function(n,i){return n[i]=e.get(i),n},{})}function Wv(e,t){F(t,function(n,i){e.set(i,n)})}function LT(e,t){return t.filter(function(n){return S(n,"bpmn:DataObjectReference")&&ie(n).dataObjectRef===e})}var $a="default",Vi="id",Uv="di",BT={width:0,height:0};function Fa(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}Fa.$inject=["elementRegistry","moddle","modeling","textRenderer"],Fa.prototype.execute=function(e){var t=e.element,n=[t];if(!t)throw new Error("element required");var i=this._elementRegistry,r=this._moddle.ids,o=t.businessObject,a=HT(e.properties),s=e.oldProperties||NT(t,a);return Yv(a,o)&&(r.unclaim(o[Vi]),i.updateId(t,a[Vi]),r.claim(a[Vi],o)),$a in a&&(a[$a]&&n.push(i.get(a[$a].id)),o[$a]&&n.push(i.get(o[$a].id))),qv(t,a),e.oldProperties=s,e.changed=n,n},Fa.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&ie(n).name;if(i){var r=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,r,BT)}},Fa.prototype.revert=function(e){var t=e.element,n=e.properties,i=e.oldProperties,r=t.businessObject,o=this._elementRegistry,a=this._moddle.ids;return qv(t,i),Yv(n,r)&&(a.unclaim(n[Vi]),o.updateId(t,i[Vi]),a.claim(i[Vi],r)),e.changed};function Yv(e,t){return Vi in e&&e[Vi]!==t[Vi]}function NT(e,t){var n=ds(t),i=e.businessObject,r=ot(e);return Tn(n,function(o,a){return a!==Uv?o[a]=i.get(a):o[a]=$T(r,ds(t.di)),o},{})}function $T(e,t){return Tn(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function qv(e,t){var n=e.businessObject,i=ot(e);F(t,function(r,o){o!==Uv?n.set(o,r):i&&FT(i,r)})}function FT(e,t){F(t,function(n,i){e.set(i,n)})}var jT=["default"];function HT(e){var t=W({},e);return jT.forEach(function(n){n in e&&(t[n]=ie(t[n]))}),t}function Wc(e,t){this._canvas=e,this._modeling=t}Wc.$inject=["canvas","modeling"],Wc.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=ot(r);return t.setRootElement(n),t.removeRootElement(r),Bt(a.rootElements,i),i.$parent=a,Lt(a.rootElements,o),o.$parent=null,r.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=r,[]},Wc.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,a=i.$parent,s=ot(n);return t.setRootElement(r),t.removeRootElement(n),Lt(a.rootElements,i),i.$parent=null,Bt(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,r.di=s,[]};function bf(e,t){this._modeling=e,this._spaceTool=t}bf.$inject=["modeling","spaceTool"],bf.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=ei(i),a=o===i,s=a?i:i.parent,c=lr(s),l=tn(i);if(l?r==="left"?r="top":r==="right"&&(r="bottom"):r==="top"?r="left":r==="bottom"&&(r="right"),!c.length){var u=l?{x:i.x+Jn,y:i.y,width:i.width-Jn,height:i.height}:{x:i.x,y:i.y+Jn,width:i.width,height:i.height-Jn};n.createShape({type:"bpmn:Lane",isHorizontal:l},u,s)}var f=[];Nr(o,function(x){return f.push(x),x.label&&f.push(x.label),x===i?[]:Ke(x.children,function(C){return C!==i})});var p,d,m,h,y;r==="top"?(p=-120,d=i.y,m=d+10,h="n",y="y"):r==="left"?(p=-120,d=i.x,m=d+10,h="w",y="x"):r==="bottom"?(p=120,d=i.y+i.height,m=d-10,h="s",y="y"):r==="right"&&(p=120,d=i.x+i.width,m=d-10,h="e",y="x");var v=t.calculateAdjustments(f,y,p,m),g=l?{x:0,y:p}:{x:p,y:0};t.makeSpace(v.movingShapes,v.resizingShapes,g,h,m);var b=l?{x:i.x+(a?Jn:0),y:d-(r==="top"?120:0),width:i.width-(a?Jn:0),height:120}:{x:d-(r==="left"?120:0),y:i.y+(a?Jn:0),width:120,height:i.height-(a?Jn:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:l},b,s)};function xf(e){this._modeling=e}xf.$inject=["modeling"],xf.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=lr(n),o=r.length;if(o>i)throw new Error(`more than <${i}> child lanes`);var a=tn(n),s=a?n.height:n.width,c=Math.round(s/i),l,u,f,p;for(p=0;p<i;p++)p===i-1?l=s-c*p:l=c,u=a?{x:n.x+Jn,y:n.y+p*c,width:n.width-Jn,height:l}:{x:n.x+p*c,y:n.y+Jn,width:l,height:n.height-Jn},p<o?t.resizeShape(r[p],u):(f={type:"bpmn:Lane",isHorizontal:a},t.createShape(f,u,n))};function ja(e,t){this._modeling=e,this._spaceTool=t}ja.$inject=["modeling","spaceTool"],ja.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},ja.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=LA(e,t);n.resizeShape(e,t),i.forEach(function(r){n.resizeShape(r.shape,r.newBounds)})},ja.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=Ie(e),r=Ie(t),o=Cg(r,i),a=ei(e),s=[],c=[];Nr(a,function(m){return s.push(m),(S(m,"bpmn:Lane")||S(m,"bpmn:Participant"))&&c.push(m),m.children});var l,u,f,p,d;(o.bottom||o.top)&&(l=o.bottom||o.top,u=e.y+(o.bottom?e.height:0)+(o.bottom?-10:10),f=o.bottom?"s":"n",p=o.top>0||o.bottom<0?-l:l,d=n.calculateAdjustments(s,"y",p,u),n.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:l},f)),(o.left||o.right)&&(l=o.right||o.left,u=e.x+(o.right?e.width:0)+(o.right?-10:100),f=o.right?"e":"w",p=o.left>0||o.right<0?-l:l,d=n.calculateAdjustments(c,"x",p,u),n.makeSpace(d.movingShapes,d.resizingShapes,{x:l,y:0},f))};var Ha="flowNodeRef",_f="lanes";function Uc(){}Uc.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},o=[];function a(u,f){var p=Ie(f),d={x:u.x+u.width/2,y:u.y+u.height/2};return d.x>p.left&&d.x<p.right&&d.y>p.top&&d.y<p.bottom}function s(u){n.indexOf(u)===-1&&(o.push(u),n.push(u))}function c(u){var f=ei(u);return r[f.id]||(r[f.id]=lc(f)),r[f.id]}function l(u){if(!u.parent)return[];var f=c(u);return f.filter(function(p){return a(u,p)}).map(function(p){return p.businessObject})}return t.forEach(function(u){var f=ei(u);if(!(!f||n.indexOf(f)!==-1)){var p=f.children.filter(function(d){return S(d,"bpmn:FlowNode")});p.forEach(s),n.push(f)}}),e.forEach(s),o.forEach(function(u){var f=u.businessObject,p=f.get(_f),d=p.slice(),m=l(u);i.push({flowNode:f,remove:d,add:m})}),t.forEach(function(u){var f=u.businessObject;u.parent||f.get(Ha).forEach(function(p){i.push({flowNode:p,remove:[f],add:[]})})}),i},Uc.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.flowNodeShapes,e.laneShapes)),t.forEach(function(n){var i=n.flowNode,r=i.get(_f);n.remove.forEach(function(o){Lt(r,o),Lt(o.get(Ha),i)}),n.add.forEach(function(o){Bt(r,o),Bt(o.get(Ha),i)})}),[]},Uc.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,r=i.get(_f);n.add.forEach(function(o){Lt(r,o),Lt(o.get(Ha),i)}),n.remove.forEach(function(o){Bt(r,o),Bt(o.get(Ha),i)})}),[]};var wf="categoryValueRef";function za(e,t){this._bpmnFactory=e,this._elementRegistry=t}za.$inject=["bpmnFactory","elementRegistry"],za.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,r=new Map,o=[],a=new Map;function s(g,b,x){if(b){var C=a.get(g);C||(C={},a.set(g,C)),!(x&&C.present)&&(!x&&C.past||(x?C.present={categoryValue:b,root:Ef(g)}:C.past={categoryValue:b}))}}function c(g){r.set(g,ie(g))}function l(){n.filter(function(g){return S(g,"bpmn:FlowElement")&&!Ye(g)&&g.parent}).forEach(c)}function u(g){var b=ie(g),x=b.get("categoryValueRef");return x||(x=_g(i,b),o.push(zT(g,x))),x}function f(g){return g.reduce(function(b,x){var C=Ef(x),M=b.get(C);return M||(M=[],b.set(C,M)),M.push(x),b},new Map)}e=Array.from(e||[]);var p=f(e);t.length&&l(),e.forEach(c),n.filter(function(g){return S(g,"bpmn:Group")&&!Ye(g)&&g.parent}).forEach(function(g){var b=ie(g).get("categoryValueRef");if(!b){var x=Ef(g),C=p.get(x)||[],M=bo(C,g),k=Object.keys(M).length>0;k&&(b=u(g))}s(g,b,!0)}),t.forEach(function(g){s(g.groupShape,g.categoryValue,!1)}),o.length&&l();var d=Array.from(r.keys()),m=Array.from(a.values()).reduce(function(g,b){return b.present&&g.add(b.present.categoryValue),b.past&&g.add(b.past.categoryValue),g},new Set),h=new Map,y=f(d);a.forEach(function(g,b){var x=g.present;if(x){var C=y.get(x.root)||[],M=bo(C,b);C.forEach(function(k){if(M[k.id]){var P=h.get(k);P||(P=new Set,h.set(k,P)),P.add(x.categoryValue)}})}});var v=d.reduce(function(g,b){var x=r.get(b),C=x.get(wf),M=new Set(C),k=h.get(b)||new Set,P=Array.from(k).filter(function(D){return!M.has(D)}),B=C.filter(function(D){return m.has(D)&&!k.has(D)});return(P.length||B.length)&&g.push({businessObject:x,categoryValuesToAdd:P,categoryValuesToRemove:B}),g},[]);return{flowElements:v,groups:o}},za.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),GT(t.groups),WT(t.flowElements),[]},za.prototype.revert=function(e){var t=e.updates;return UT(t.flowElements),VT(t.groups),[]};function zT(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function GT(e){e.forEach(function(t){ie(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function VT(e){e.forEach(function(t){ie(t.groupShape).categoryValueRef=null})}function WT(e){e.forEach(function(t){var n=t.businessObject,i=n.get(wf);t.categoryValuesToRemove.forEach(function(r){Lt(i,r)}),t.categoryValuesToAdd.forEach(function(r){Bt(i,r,!0)})})}function UT(e){e.forEach(function(t){var n=t.businessObject,i=n.get(wf);t.categoryValuesToAdd.forEach(function(r){Lt(i,r)}),t.categoryValuesToRemove.forEach(function(r){Bt(i,r,!0)})})}function Ef(e){for(;e.parent;)e=e.parent;return e}function Yc(e){this._moddle=e}Yc.$inject=["moddle"],Yc.prototype.execute=function(e){var t=this._moddle.ids,n=e.id,i=e.element,r=e.claiming;return r?t.claim(n,i):t.unclaim(n),[]},Yc.prototype.revert=function(e){var t=this._moddle.ids,n=e.id,i=e.element,r=e.claiming;return r?t.unclaim(n):t.claim(n,i),[]};var YT={fill:void 0,stroke:void 0};function Sf(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(Pn(t)){var n=qT(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}Sf.$inject=["commandStack"],Sf.prototype.postExecute=function(e){var t=e.elements,n=e.colors||YT,i=this,r={};"fill"in n&&W(r,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&W(r,{"border-color":this._normalizeColor(n.stroke)}),F(t,function(o){var a=ht(o)?li(r,["border-color"]):r,s=ot(o);if(KT(a),Ye(o)){if(!s||!S(s.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:o,moddleElement:s.label,properties:{color:r["border-color"]}})}else{if(!qe(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:o,properties:{di:a}})}})};function qT(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 KT(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var XT={width:0,height:0};function Kv(e,t,n){function i(c,l){var u=c.label||c,f=c.labelTarget||c;return SC(u,l),[u,f]}function r(c){var l=c.element,u=l.businessObject,f=c.newLabel;if(!Ye(l)&&sr(l)&&!Xs(l)&&!Xv(f)){var p=7,d=Yu(l);d={x:d.x,y:d.y+p},e.createLabel(l,d,{id:u.id+"_label",businessObject:u,di:l.di})}}function o(c){return c.oldLabel=qn(c.element),i(c.element,c.newLabel)}function a(c){return i(c.element,c.oldLabel)}function s(c){var l=c.element,u=l.label||l,f=c.newLabel,p=c.newBounds,d=c.hints||{};if(!(!Ye(u)&&!S(u,"bpmn:TextAnnotation"))){if(Ye(u)&&Xv(f)){d.removeShape!==!1&&e.removeShape(u,{unsetLabel:!1});return}var m=qn(l);typeof p>"u"&&(p=t.getExternalLabelBounds(u,m)),p&&e.resizeShape(u,p,XT)}}this.preExecute=r,this.execute=o,this.revert=a,this.postExecute=s}Kv.$inject=["modeling","textRenderer","bpmnFactory"];function Xv(e){return!e||!e.trim()}function pn(e,t,n,i){mt.call(this,e,t,n),this._bpmnRules=i}Ee(pn,mt),pn.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],pn.prototype.getHandlers=function(){var e=mt.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=Na,e["element.updateProperties"]=Fa,e["canvas.updateRoot"]=Wc,e["lane.add"]=bf,e["lane.resize"]=ja,e["lane.split"]=xf,e["lane.updateRefs"]=Uc,e["group.updateRefs"]=za,e["id.updateClaim"]=Yc,e["element.setColor"]=Sf,e["element.updateLabel"]=Kv,e},pn.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},pn.prototype.connect=function(e,t,n,i){var r=this._bpmnRules;if(n||(n=r.canConnect(e,t)),!!n)return this.createConnection(e,t,n,e.parent,i)},pn.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},pn.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},pn.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},pn.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},pn.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},pn.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},pn.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},pn.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},pn.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},pn.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},pn.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},pn.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function Zv(){}Zv.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||Ne(t.source||e.source),t.connectionEnd||Ne(t.target||e.target)]};var qc=20,ZT=5,Kc=Math.round,Qv=20,QT={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function JT(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function e2(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function Jv(e,t,n){var i=cn(t,e,ZT),r=n.split(":")[0],o=Kc((t.x-e.x)/2+e.x),a=Kc((t.y-e.y)/2+e.y),s,c,l=e2(r,i),u=/h|r|l/.test(r),f=!1,p=!1;return l?(s=u?{x:o,y:e.y}:{x:e.x,y:a},c=u?"h:h":"v:v"):(f=JT(i,r),c=u?"h:v":"v:h",f?u?(p=a===e.y,s={x:e.x+qc*(/l/.test(r)?-1:1),y:p?a+qc:a}):(p=o===e.x,s={x:p?o+qc:o,y:e.y+qc*(/t/.test(r)?-1:1)}):s={x:o,y:a}),{waypoints:Rf(e,s,c).concat(s),directions:c,turnNextDirections:p}}function t2(e,t,n){return Jv(e,t,n)}function n2(e,t,n){var i=Jv(t,e,eb(n));return{waypoints:i.waypoints.slice().reverse(),directions:eb(i.directions),turnNextDirections:i.turnNextDirections}}function i2(e,t){var n=e.directions.split(":")[1],i=t.directions.split(":")[0];e.turnNextDirections&&(n=n=="h"?"v":"h"),t.turnNextDirections&&(i=i=="h"?"v":"h");var r=n+":"+i,o=Rf(e.waypoints[e.waypoints.length-1],t.waypoints[0],r);return{waypoints:o,directions:r}}function eb(e){return e.split(":").reverse().join(":")}function r2(e,t,n){var i=Kc((t.x-e.x)/2+e.x),r=Kc((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:i,y:e.y},{x:i,y:t.y}];if(n==="v:v")return[{x:e.x,y:r},{x:t.x,y:r}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}function Rf(e,t,n){if(n=n||"h:h",!d2(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(nb(n)){var i=t2(e,t,n),r=n2(e,t,n),o=i2(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return r2(e,t,n)}function o2(e,t,n){var i=Rf(e,t,n);return i.unshift(e),i.push(t),rb(i)}function a2(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=O0(o,"straight")[0]||"h:h",s=QT[a]||0,c=cn(e,t,s),l=f2(c,a);n=n||Ne(e),i=i||Ne(t);var u=l.split(":"),f=ib(n,e,u[0],h2(c)),p=ib(i,t,u[1],c);return o2(f,p,l)}function s2(e,t,n,i,r,o){Be(n)&&(r=n,o=i,n=Ne(e),i=Ne(t)),o=W({preferredLayouts:[]},o),r=r||[];var a=o.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&l2(e,t,n,i,o),c||(c=o.connectionEnd&&p2(t,e,i,r),c)||(c=o.connectionStart&&u2(e,t,n,r),c)?c:!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:a2(e,t,n,i,o)}function c2(e,t,n){return e>=t&&e<=n}function tb(e,t,n){var i={x:"width",y:"height"};return c2(t[e],n[e],n[e]+n[i[e]])}function l2(e,t,n,i,r){var o={},a,s;return s=cn(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),r.preserveDocking==="target"?tb(a,i,e)?(o[a]=i[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:i.x,y:i.y}]):null:tb(a,n,t)?(o[a]=n[a],[{x:n.x,y:n.y},{x:o.x!==void 0?o.x:i.x,y:o.y!==void 0?o.y:i.y,original:{x:o.x!==void 0?o.x:i.x,y:o.y!==void 0?o.y:i.y}}]):null):null}function u2(e,t,n,i){return Cf(e,t,n,i)}function p2(e,t,n,i){var r=i.slice().reverse();return r=Cf(e,t,n,r),r?r.reverse():null}function Cf(e,t,n,i){function r(u){return u.length<3?!0:u.length>4?!1:!!vt(u,function(f,p){var d=u[p-1];return d&&fa(f,d)<3})}function o(u,f,p){var d=Li(f,u);switch(d){case"v":return{x:p.x,y:u.y};case"h":return{x:u.x,y:p.y}}return{x:u.x,y:u.y}}function a(u,f,p){var d;for(d=u.length-2;d!==0;d--)if(Am(u[d],f,Qv)||Am(u[d],p,Qv))return u.slice(d);return u}if(r(i))return null;var s=i[0],c=i.slice(),l;return c[0]=n,c[1]=o(c[1],s,n),l=a(c,e,t),l!==c&&(c=Cf(e,t,n,l)),c&&Li(c)?null:c}function f2(e,t){if(nb(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 d2(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function nb(e){return e&&/t|r|b|l/.test(e)}function h2(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 ib(e,t,n,i){if(n==="h"&&(n=/left/.test(i)?"l":"r"),n==="v"&&(n=/top/.test(i)?"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 rb(e){return e.reduce(function(t,n,i){var r=t[t.length-1],o=e[i+1];return zu(r,o,n,0)||t.push(n),t},[])}var m2=-10,g2=40,y2={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},v2={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},Af={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},Ga={top:"t",right:"r",bottom:"b",left:"l"};function Xc(e){this._elementRegistry=e}Ee(Xc,Zv),Xc.prototype.layoutConnection=function(e,t){t||(t={});var n=t.source||e.source,i=t.target||e.target,r=t.waypoints||e.waypoints,o=t.connectionStart,a=t.connectionEnd,s=this._elementRegistry,c,l;if(o||(o=ob(r&&r[0],n)),a||(a=ob(r&&r[r.length-1],i)),(S(e,"bpmn:Association")||S(e,"bpmn:DataAssociation"))&&r&&!ab(n,i))return[].concat([o],r.slice(1,-1),[a]);var u=yg(n,s)?y2:v2;return S(e,"bpmn:MessageFlow")?c=x2(n,i,u):(S(e,"bpmn:SequenceFlow")||ab(n,i))&&(n===i?c={preferredLayouts:C2(n,e,u)}:S(n,"bpmn:BoundaryEvent")?c={preferredLayouts:A2(n,i,a,u)}:Va(n)||Va(i)?c={preferredLayouts:u.subProcess,preserveDocking:w2(n)}:S(n,"bpmn:Gateway")?c={preferredLayouts:u.fromGateway}:S(i,"bpmn:Gateway")?c={preferredLayouts:u.toGateway}:c={preferredLayouts:u.default}),c&&(c=W(c,t),l=rb(s2(n,i,o,a,r,c))),l||[o,a]};function b2(e){var t=e.host;return cn(Ne(e),t,m2)}function x2(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:_2(e,t)}}function _2(e,t){return S(t,"bpmn:Participant")?"source":S(e,"bpmn:Participant")?"target":Va(t)?"source":Va(e)||S(t,"bpmn:Event")?"target":S(e,"bpmn:Event")?"source":null}function w2(e){return Va(e)?"target":"source"}function ob(e,t){return e?e.original||e:Ne(t)}function ab(e,t){return S(t,"bpmn:Activity")&&S(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function Va(e){return S(e,"bpmn:SubProcess")&&Qe(e)}function Ur(e,t){return e===t}function E2(e,t){return t.indexOf(e)!==-1}function $o(e){var t=/right|left/.exec(e);return t&&t[0]}function Fo(e){var t=/top|bottom/.exec(e);return t&&t[0]}function sb(e,t){return Af[e]===t}function S2(e,t){var n=$o(e),i=Af[n];return t.indexOf(i)!==-1}function R2(e,t){var n=Fo(e),i=Af[n];return t.indexOf(i)!==-1}function cb(e){return e==="right"||e==="left"}function C2(e,t,n){var i=t.waypoints,r=i&&i.length&&cn(i[0],e);return r==="top"?n.loop.fromTop:r==="right"?n.loop.fromRight:r==="left"?n.loop.fromLeft:n.loop.fromBottom}function A2(e,t,n,i){var r=Ne(e),o=Ne(t),a=b2(e),s,c,l=Ur(e.host,t),u=E2(a,["top","right","bottom","left"]),f=cn(o,r,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return l?P2(a,u,e,t,n,i):(s=M2(a,f,u,i.isHorizontal),c=T2(a,f,u,i.isHorizontal),[s+":"+c])}function P2(e,t,n,i,r,o){var a=t?e:o.isHorizontal?Fo(e):$o(e),s=Ga[a],c;return t?cb(e)?c=lb("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:c=lb("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function lb(e,t,n,i){var r=g2;return!(Pf(e,i,n,r)||Pf(e,i,{x:n.x+n.width,y:n.y+n.height},r)||Pf(e,i,Ne(t),r))}function Pf(e,t,n,i){return Math.abs(t[e]-n[e])<i}function M2(e,t,n,i){if(n)return Ga[e];var r=Fo(e),o=$o(e),a=Fo(t),s=$o(t);if(i){if(Ur(r,a)||sb(o,s))return Ga[r]}else if(Ur(o,s)||sb(r,a))return Ga[o];return Ga[i?o:r]}function T2(e,t,n,i){if(n)return cb(e)?S2(e,t)||Ur(e,t)?"h":"v":R2(e,t)||Ur(e,t)?"v":"h";var r=Fo(e),o=$o(e),a=Fo(t),s=$o(t);return a&&!s?"v":s&&!a?"h":i?Ur(r,a)?"h":"v":Ur(o,s)?"v":"h"}Xc.$inject=["elementRegistry"];function ub(e){return W({original:e.point.original||e.point},e.actual)}function vr(e,t){this._elementRegistry=e,this._graphicsFactory=t}vr.$inject=["elementRegistry","graphicsFactory"],vr.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var i=this.getDockingPoint(e,t,!0),r=this.getDockingPoint(e,n),o=e.waypoints.slice(i.idx+1,r.idx);return o.unshift(ub(i)),o.push(ub(r)),o},vr.prototype.getDockingPoint=function(e,t,n){var i=e.waypoints,r,o,a;return r=n?0:i.length-1,o=i[r],a=this._getIntersection(t,e,n),{point:o,actual:a||o,idx:r}},vr.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return da(i,r,n)},vr.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},vr.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},vr.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const Mf={__init__:["modeling","bpmnUpdater"],__depends__:[KP,pM,dM,hM,wv,mT,yT,ET,ni,ff,Pv],bpmnFactory:["type",ri],bpmnUpdater:["type",Nn],elementFactory:["type",mr],modeling:["type",pn],layouter:["type",Xc],connectionDocking:["type",vr]};var k2=10,pb=50,O2=250;function Tf(e,t,n,i){for(var r;r=D2(e,n,t);)n=i(t,n,r);return n}function kf(e){return function(t,n,i){var r={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,l=a.minDistance;c<0?r[o]=Math.min(i[o]+c-t[s]/2,n[o]-l+c):r[o]=Math.max(i[o]+i[s]+c+t[s]/2,n[o]+l+c)}}),r}}function D2(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=L2(e);return vt(r,function(o){if(o===n)return!1;var a=cn(o,i,k2);return a==="intersect"})}function I2(e,t){t||(t={});function n(m){return m.source===e?1:-1}var i=t.defaultDistance||pb,r=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||O2,c=t.reference||"start";o||(o=$2);function l(m,h){return r==="n"?c==="start"?Ie(m).top-Ie(h).bottom:c==="center"?Ie(m).top-Ne(h).y:Ie(m).top-Ie(h).top:r==="w"?c==="start"?Ie(m).left-Ie(h).right:c==="center"?Ie(m).left-Ne(h).x:Ie(m).left-Ie(h).left:r==="s"?c==="start"?Ie(h).top-Ie(m).bottom:c==="center"?Ne(h).y-Ie(m).bottom:Ie(h).bottom-Ie(m).bottom:c==="start"?Ie(h).left-Ie(m).right:c==="center"?Ne(h).x-Ie(m).right:Ie(h).right-Ie(m).right}var u=e.incoming.filter(o).map(function(m){var h=a(m),y=h<0?l(m.source,e):l(e,m.source);return{id:m.source.id,distance:y,weight:h}}),f=e.outgoing.filter(o).map(function(m){var h=a(m),y=h>0?l(e,m.target):l(m.target,e);return{id:m.target.id,distance:y,weight:h}}),p=u.concat(f).reduce(function(m,h){return m[h.id+"__weight_"+h.weight]=h,m},{}),d=Tn(p,function(m,h){var y=h.distance,v=h.weight;return y<0||y>s||(m[String(y)]||(m[String(y)]=0),m[String(y)]+=1*v,(!m.distance||m[m.distance]<m[String(y)])&&(m.distance=y)),m},{});return d.distance||i}function L2(e){var t=Of(e);return e.host&&(t=t.concat(Of(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(Of(i))},[]))),t}function Of(e){return N2(e).concat(B2(e))}function B2(e){return e.incoming.map(function(t){return t.source})}function N2(e){return e.outgoing.map(function(t){return t.target})}function $2(){return!0}var F2=100;function fb(e,t,n){e.on("autoPlace",F2,function(i){var r=i.shape,o=i.source;return j2(o,r)}),e.on("autoPlace.end",function(i){n.scrollToElement(i.shape)}),this.append=function(i,r,o){e.fire("autoPlace.start",{source:i,shape:r});var a=e.fire("autoPlace",{source:i,shape:r}),s=t.appendShape(i,r,a,i.parent,o);return e.fire("autoPlace.end",{source:i,shape:s}),s}}fb.$inject=["eventBus","modeling","canvas"];function j2(e,t,n){n||(n={});var i=n.defaultDistance||pb,r=Ne(e),o=Ie(e);return{x:o.right+i+t.width/2,y:r.y}}function db(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}db.$inject=["eventBus","selection"];const H2={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",fb],autoPlaceSelectionBehavior:["type",db]};function hb(e,t,n){var i=yg(e,n);if(S(t,"bpmn:TextAnnotation"))return G2(e,t,i);if(qe(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return V2(e,t,i);if(S(t,"bpmn:FlowNode"))return z2(e,t,i)}function z2(e,t,n){var i=Ie(e),r=Ne(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=I2(e,{filter:function(d){return S(d,"bpmn:SequenceFlow")},direction:o.directionHint}),s=30,c=o.minDistance,l=o.baseOrientation;S(e,"bpmn:BoundaryEvent")&&(l=cn(e,e.host,-25),l.indexOf(o.boundaryOrientation)!==-1&&(s*=-1));var u=n?{x:i.right+a+t.width/2,y:r.y+mb(l,c,o)}:{x:r.x+mb(l,c,o),y:i.bottom+a+t.height/2},f={margin:s,minDistance:c},p=n?{y:f}:{x:f};return Tf(e,t,u,kf(p))}function mb(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function G2(e,t,n){var i=Ie(e),r=n?{x:i.right+t.width/2,y:i.top-50-t.height/2}:{x:i.right+50+t.width/2,y:i.bottom+t.height/2};ht(e)&&(r=Ne(e),n?(r.x+=100,r.y-=50):(r.x+=100,r.y+=50));var o={margin:n?-30:30,minDistance:20},a=n?{y:o}:{x:o};return Tf(e,t,r,kf(a))}function V2(e,t,n){var i=Ie(e),r=n?{x:i.right-10+t.width/2,y:i.bottom+40+t.width/2}:{x:i.left-40-t.width/2,y:i.bottom-10+t.height/2},o={margin:30,minDistance:30},a=n?{x:o}:{y:o};return Tf(e,t,r,kf(a))}function gb(e,t){e.on("autoPlace",function(n){var i=n.shape,r=n.source;return hb(r,i,t)})}gb.$inject=["eventBus","elementRegistry"];const Zc={__depends__:[H2],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",gb]},yb=[mg,ba,Mf,Zc];function W2(e={}){rh(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new wo({container:t,moddleExtensions:e.moddleExtensions??xs,additionalModules:[...yb,...e.additionalModules??[]]})}const vb={"edge-crosses-shape":"연결","edge-crosses-subprocess":"연결","edge-endpoint-detached":"연결","edge-overlap-opposite":"겹침","edge-overlap-mixed":"겹침","edge-overlap-unrelated":"겹침","shape-overlap":"겹침","shape-outside-container":"소속","label-on-shared-segment":"라벨","label-over-line":"라벨","annotation-over-label":"라벨","pool-name-over-label":"라벨","group-overlap-unintended":"그룹","group-overlap-unreadable":"그룹","group-stack-unreadable":"그룹","group-on-container-boundary":"그룹","group-on-group-boundary":"그룹","group-cuts-shape":"그룹","pool-overlap":"풀","CHK-FLOW-1":"구조","CHK-POOL-1":"풀"},U2={이:["이","가"],을:["을","를"],와:["과","와"]};function Y2(e,t){const[n,i]=U2[t],r=e.at(-1)??"",o=r.charCodeAt(0);return o>=44032&&o<=55203?e+((o-44032)%28===0?i:n):r>="0"&&r<="9"?e+("013678".includes(r)?n:i):e+`${n}(${i})`}const q2={"bpmn:StartEvent":"시작 이벤트","bpmn:EndEvent":"종료 이벤트","bpmn:IntermediateCatchEvent":"중간 이벤트","bpmn:IntermediateThrowEvent":"중간 이벤트","bpmn:BoundaryEvent":"경계 이벤트","bpmn:Task":"작업","bpmn:UserTask":"작업","bpmn:ServiceTask":"작업","bpmn:SendTask":"작업","bpmn:ReceiveTask":"작업","bpmn:ManualTask":"작업","bpmn:ScriptTask":"작업","bpmn:BusinessRuleTask":"작업","bpmn:CallActivity":"작업","bpmn:SubProcess":"서브프로세스","bpmn:ExclusiveGateway":"게이트웨이","bpmn:ParallelGateway":"게이트웨이","bpmn:InclusiveGateway":"게이트웨이","bpmn:EventBasedGateway":"게이트웨이","bpmn:ComplexGateway":"게이트웨이","bpmn:Participant":"풀","bpmn:Lane":"레인","bpmn:TextAnnotation":"주석","bpmn:Group":"그룹","bpmn:DataStoreReference":"데이터 저장소","bpmn:DataObjectReference":"데이터 객체","bpmn:SequenceFlow":"연결선","bpmn:MessageFlow":"메시지 연결선","bpmn:Association":"연관선"},K2="요소";function Df(e){return(e&&q2[e.type])??K2}const bb=20;function X2(e){const t=e.replace(/\s+/g," ").trim();return t.length>bb?`${t.slice(0,bb)}…`:t}function Qc(e,t,n,i=""){const r=e(t),o=(r==null?void 0:r.name)===void 0?void 0:X2(r.name),a=o===void 0?i+Df(r):o,s=o===void 0?a:`「${o}」`;return n?s+Y2(a,n).slice(a.length):s}function Z2(e,t,n,i,r){const[o,a]=[e(t),e(n)],s=(o==null?void 0:o.name)===void 0&&(a==null?void 0:a.name)===void 0&&Df(o)===Df(a);return[Qc(e,t,i),Qc(e,n,r,s?"다른 ":"")]}function Q2(e){switch(e.kind){case"shape-overlap":return e.identical?"error":"warning";case"shape-outside-container":return"error";case"edge-endpoint-detached":return"error";case"pool-overlap":return e.contained?"error":"warning";case"group-cuts-shape":return"error";default:return"warning"}}function J2(e){switch(e.kind){case"edge-crosses-shape":return[e.edge,e.shape];case"edge-crosses-subprocess":return[e.edge,e.subProcess];case"edge-endpoint-detached":return[e.edge,e.shape];case"shape-overlap":return[...e.shapes];case"shape-outside-container":return[e.shape,e.container];case"edge-overlap-opposite":case"edge-overlap-mixed":case"edge-overlap-unrelated":return[...e.edges];case"label-on-shared-segment":return[e.edge,e.other];case"label-over-line":return[e.edge,e.line];case"annotation-over-label":return[e.annotation,e.label];case"group-overlap-unintended":return e.container?[e.container,...e.groups.filter(t=>t!==e.container)]:[...e.groups];case"group-overlap-unreadable":return e.reason==="orphan"?[...e.groups,...e.shapes]:[e.group,...e.shapes];case"group-stack-unreadable":return[...e.groups,...e.shapes];case"group-on-container-boundary":return[e.group,e.container];case"group-on-group-boundary":return[...e.groups];case"group-cuts-shape":return[e.group,e.shape];case"pool-name-over-label":return[e.pool,e.label];case"pool-overlap":return[...e.pools]}}const xb={top:"위",bottom:"아래",left:"왼쪽",right:"오른쪽"};function ek(e,t){const n=(r,o)=>Qc(t,r,o),i=(r,o,a,s)=>Z2(t,r,o,a,s);switch(e.kind){case"edge-crosses-shape":return`${n(e.edge,"이")} ${n(e.shape,"을")} 가로지릅니다.`;case"edge-crosses-subprocess":return`${n(e.edge,"이")} 서브프로세스 ${n(e.subProcess)} 안을 지나갑니다.`;case"edge-endpoint-detached":return`${n(e.edge)}의 끝이 ${n(e.shape)}에서 ${Math.round(e.distance)}px 떨어져 연결이 끊겨 보입니다.`;case"shape-overlap":{const[r,o]=i(e.shapes[0],e.shapes[1],"와","이");return e.identical?`${r} ${o} 완전히 같은 자리에 겹쳐 하나가 가려집니다.`:`${r} ${o} 겹칩니다.`}case"shape-outside-container":return`${n(e.shape,"이")} ${n(e.container)} 경계 밖에 놓여 다른 소속으로 읽힙니다.`;case"edge-overlap-opposite":{const[r,o]=i(e.edges[0],e.edges[1],"와","이");return`${r} ${o} 같은 선 위를 ${Math.round(e.length)}px 서로 반대 방향으로 흐릅니다.`}case"edge-overlap-mixed":{const[r,o]=i(e.edges[0],e.edges[1],"와","이");return`${r} ${o} 종류가 다른 선인데 ${Math.round(e.length)}px 겹쳐 흐릅니다.`}case"edge-overlap-unrelated":{const[r,o]=i(e.edges[0],e.edges[1],"와","이");return`${r} ${o} ${Math.round(e.length)}px 한 선처럼 겹쳐 흐르는데 만나는 지점이 없습니다.`}case"label-on-shared-segment":{const[r,o]=i(e.edge,e.other,void 0,"와");return`${r}의 라벨이 ${o} 공유하는 구간 위에 있어 어느 선의 것인지 모호합니다.`}case"label-over-line":return`${n(e.edge)}의 라벨을 선이 가로지릅니다.`;case"annotation-over-label":return`주석 ${n(e.annotation,"이")} ${n(e.label)}의 이름 라벨을 덮습니다.`;case"group-overlap-unintended":{if(e.container)return`${n(e.container,"이")} 다른 그룹을 통째로 덮습니다.`;const[r,o]=i(e.groups[0],e.groups[1],"와","이");return`${r} ${o} 공유 멤버 없이 겹쳐 의도인지 알 수 없습니다.`}case"group-overlap-unreadable":switch(e.reason){case"orphan":{const[r,o]=i(e.groups[0],e.groups[1],"와");return`${r} ${o}의 겹친 영역에 어느 그룹에도 속하지 않은 요소가 ${e.shapes.length}개 있습니다.`}case"minority":return`${n(e.group)} 상자 안에서 자기 멤버가 과반이 아닙니다(다른 요소 ${e.shapes.length}개).`;case"throughpass":return`${n(e.group)} 상자를 자기 멤버가 아닌 요소 ${e.shapes.length}개가 지나갑니다.`}case"group-stack-unreadable":return`그룹 ${e.groups.length}개가 겹쳐 쌓여 요소 ${e.shapes.length}개가 어느 단계인지 읽히지 않습니다.`;case"group-on-container-boundary":return`${n(e.group)} 테두리가 ${n(e.container)}의 ${xb[e.side]} 경계선과 겹쳐 흐릅니다.`;case"group-on-group-boundary":{const[r,o]=i(e.groups[0],e.groups[1],"와");return`${r} ${o}의 테두리가 같은 선 위에 겹칩니다.`}case"group-cuts-shape":return`${n(e.group)} 테두리가 ${n(e.shape)}의 ${xb[e.side]}을(를) ${Math.round(e.depth)}px 가릅니다.`;case"pool-name-over-label":return`${n(e.pool)}의 이름 밴드가 ${n(e.label)}의 라벨을 덮습니다.`;case"pool-overlap":{const[r,o]=i(e.pools[0],e.pools[1],"와","이");return e.contained?`${r} ${o} 중 하나가 다른 하나 안에 들어가 있습니다.`:`${r} ${o} 겹칩니다.`}}}function tk(e,t){switch(e.ruleId){case"CHK-FLOW-1":return`${Qc(t,e.targetRefs[0])}에 연결된 선이 하나도 없습니다 — 분기·합류가 없는 게이트웨이는 의미가 정해지지 않습니다.`;case"CHK-POOL-1":return`이 문서에 내용이 없는 풀 ${e.targetRefs.length}개가 펼친 형태로 그려져 있습니다 — 본체가 다른 문서에 있더라도 이 문서에서는 접힌 형태(블랙박스)가 의미에 맞습니다.`;default:return e.ruleId}}const _b="기타",If={error:0,warning:1,info:2};function wb(e,t){const n=[];for(const i of e.geometry)n.push({key:`g:${Rt(i)}`,source:"geometry",code:i.kind,severity:Q2(i),targetRefs:J2(i),category:vb[i.kind]??_b,message:ek(i,t)});for(const i of e.semantic)n.push({key:`s:${i.ruleId}|${i.targetRefs.join(",")}`,source:"semantic",code:i.ruleId,severity:i.severity,targetRefs:[...i.targetRefs],category:vb[i.ruleId]??_b,message:tk(i,t)});return n}function Eb(e){const t={error:0,warning:0,info:0};for(const n of e)t[n.severity]++;return t}function jo(e,t){return t!==void 0&&e.targetRefs.some(n=>t.has(n))}function Lf(e,t){if(t===void 0||e.length===0)return!1;const n=jo(e[0],t);return e.some(i=>jo(i,t)!==n)}function Sb(e,t){const n=Lf(e,t);return e.slice().sort((i,r)=>(n?Number(jo(r,t))-Number(jo(i,t)):0)||If[i.severity]-If[r.severity])}var nk=new Bo("ov"),ik=500;function on(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=nk,this._overlayDefaults=W({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=rk(n.getContainer()),this._init()}on.$inject=["config.overlays","eventBus","canvas","elementRegistry"],on.prototype.get=function(e){if(Pn(e)&&(e={id:e}),Pn(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?Ke(t.overlays,ao({type:e.type})):t.overlays.slice():[]}else return e.type?Ke(this._overlays,ao({type:e.type})):e.id?this._overlays[e.id]:null},on.prototype.add=function(e,t,n){if(Qt(t)&&(n=t,t=null),e.id||(e=this._elementRegistry.get(e)),!n.position)throw new Error("must specifiy overlay position");if(!n.html)throw new Error("must specifiy overlay html");if(!e)throw new Error("invalid element specified");var i=this._ids.next();return n=W({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},on.prototype.remove=function(e){var t=this.get(e)||[];Be(t)||(t=[t]);var n=this;F(t,function(i){var r=n._getOverlayContainer(i.element,!0);if(i&&(vi(i.html),vi(i.htmlContainer),delete i.htmlContainer,delete i.element,delete n._overlays[i.id]),r){var o=r.overlays.indexOf(i);o!==-1&&r.overlays.splice(o,1)}})},on.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},on.prototype.show=function(){Jc(this._overlayRoot)},on.prototype.hide=function(){Jc(this._overlayRoot,!1)},on.prototype.clear=function(){this._overlays={},this._overlayContainers=[],Ls(this._overlayRoot)},on.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=Ft(t);i=o.x,r=o.y}Rb(n,i,r),gn(e.html,"data-container-id",t.id)},on.prototype._updateOverlay=function(e){var t=e.position,n=e.htmlContainer,i=e.element,r=t.left,o=t.top;if(t.right!==void 0){var a;i.waypoints?a=Ft(i).width:a=i.width,r=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=Ft(i).height:s=i.height,o=t.bottom*-1+s}Rb(n,r||0,o||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},on.prototype._createOverlayContainer=function(e){var t=wt('<div class="djs-overlays" />');wn(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},on.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";Cb(this._overlayRoot,n)},on.prototype._getOverlayContainer=function(e,t){var n=vt(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},on.prototype._addOverlay=function(e){var t=e.id,n=e.element,i=e.html,r,o;i.get&&i.constructor.prototype.jquery&&(i=i.get(0)),Pn(i)&&(i=wt(i)),o=this._getOverlayContainer(n),r=wt('<div class="djs-overlay" data-overlay-id="'+t+'">'),wn(r,{position:"absolute"}),r.appendChild(i),e.type&&Ct(r).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();Jc(r,a===s),e.htmlContainer=r,o.overlays.push(e),o.html.appendChild(r),this._overlays[t]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},on.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,i=this._canvas.findRoot(e.element),r=n&&n.minZoom,o=n&&n.maxZoom,a=e.htmlContainer,s=this._canvas.getRootElement(),c=!0;(i!==s||n&&(Yt(r)&&r>t.scale||Yt(o)&&o<t.scale))&&(c=!1),Jc(a,c),this._updateOverlayScale(e,t)},on.prototype._updateOverlayScale=function(e,t){var n=e.scale,i,r,o=e.htmlContainer,a,s="";n!==!0&&(n===!1?(i=1,r=1):(i=n.min,r=n.max),Yt(i)&&t.scale<i&&(a=(1/t.scale||1)*i),Yt(r)&&t.scale>r&&(a=(1/t.scale||1)*r)),Yt(a)&&(s="scale("+a+","+a+")"),Cb(o,s)},on.prototype._updateOverlaysVisibilty=function(e){var t=this;F(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},on.prototype._init=function(){var e=this._eventBus,t=this;function n(i){t._updateRoot(i),t._updateOverlaysVisibilty(i),t.show()}e.on("canvas.viewbox.changing",function(i){t.hide()}),e.on("canvas.viewbox.changed",function(i){n(i.viewbox)}),e.on(["shape.remove","connection.remove"],function(i){var r=i.element,o=t.get({element:r});F(o,function(c){t.remove(c.id)});var a=t._getOverlayContainer(r);if(a){vi(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",ik,function(i){var r=i.element,o=t._getOverlayContainer(r,!0);o&&(F(o.overlays,function(a){t._updateOverlay(a)}),t._updateOverlayContainer(o))}),e.on("element.marker.update",function(i){var r=t._getOverlayContainer(i.element,!0);r&&Ct(r.html)[i.add?"add":"remove"](i.marker)}),e.on("root.set",function(){t._updateOverlaysVisibilty(t._canvas.viewbox())}),e.on("diagram.clear",this.clear,this)};function rk(e){var t=wt('<div class="djs-overlay-container" />');return wn(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function Rb(e,t,n){wn(e,{left:t+"px",top:n+"px"})}function Jc(e,t){e.style.display=t===!1?"none":""}function Cb(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const el={__init__:["overlays"],overlays:["type",on]};function Bf(e,t){t.invoke(te,this),this.executed(function(n){var i=n.context;i.rootElement?e.setRootElement(i.rootElement):i.rootElement=e.getRootElement()}),this.revert(function(n){var i=n.context;i.rootElement&&e.setRootElement(i.rootElement)})}Ee(Bf,te),Bf.$inject=["canvas","injector"];const ok={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",Bf]};function Wa(e){return CSS.escape(e)}var ak={"&":"&","<":"<",">":">",'"':""","'":"'"};function Ab(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return ak[t]})}var sk="bjs-breadcrumbs-shown";function Pb(e,t,n){var i=wt('<ul class="bjs-breadcrumbs"></ul>'),r=n.getContainer(),o=Ct(r);r.appendChild(i);var a=[];e.on("element.changed",function(c){var l=c.element,u=ie(l),f=vt(a,function(p){return p===u});f&&s()});function s(c){c&&(a=ck(c));var l=a.flatMap(function(f){var p=n.findRoot(Ei(f))||n.findRoot(f.id);if(!p&&S(f,"bpmn:Process")){var d=t.find(function(y){var v=ie(y);return v&&v.get("processRef")===f});p=d&&n.findRoot(d.id)}if(!p)return[];var m=Ab(f.name||f.id),h=wt('<li><span class="bjs-crumb"><a title="'+m+'">'+m+"</a></span></li>");return h.addEventListener("click",function(){n.setRootElement(p)}),h});i.innerHTML="";var u=l.length>1;o.toggle(sk,u),l.forEach(function(f){i.appendChild(f)})}e.on("root.set",function(c){s(c.element)})}Pb.$inject=["eventBus","elementRegistry","canvas"];function ck(e){for(var t=ie(e),n=[],i=t;i;i=i.$parent)(S(i,"bpmn:SubProcess")||S(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function Mb(e,t){var n=null,i=new lk;e.on("root.set",function(r){var o=r.element,a=t.viewbox(),s=i.get(o);if(i.set(n,{x:a.x,y:a.y,zoom:a.scale}),n=o,!(!S(o,"bpmn:SubProcess")&&!s)){s=s||{x:0,y:0,zoom:1};var c=(a.x-s.x)*a.scale,l=(a.y-s.y)*a.scale;(c!==0||l!==0)&&t.scroll({dx:c,dy:l}),s.zoom!==a.scale&&t.zoom(s.zoom,{x:0,y:0})}}),e.on("diagram.clear",function(){i.clear(),n=null})}Mb.$inject=["eventBus","canvas"];function lk(){this._entries=[],this.set=function(e,t){var n=!1;for(var i in this._entries)if(this._entries[i][0]===e){this._entries[i][1]=t,n=!0;break}n||this._entries.push([e,t])},this.get=function(e){for(var t in this._entries)if(this._entries[t][0]===e)return this._entries[t][1];return null},this.clear=function(){this._entries.length=0},this.remove=function(e){var t=-1;for(var n in this._entries)if(this._entries[n][0]===e){t=n;break}t!==-1&&this._entries.splice(t,1)}}var Tb={x:180,y:160};function Yr(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,r){n._handleImport(r.definitions)})}Yr.prototype._handleImport=function(e){if(e.diagrams){var t=this;this._definitions=e,this._processToDiagramMap={},e.diagrams.forEach(function(i){!i.plane||!i.plane.bpmnElement||(t._processToDiagramMap[i.plane.bpmnElement.id]=i)});var n=e.diagrams.filter(i=>i.plane).flatMap(i=>t._createNewDiagrams(i.plane));n.forEach(function(i){t._movePlaneElementsToOrigin(i.plane)})}},Yr.prototype._createNewDiagrams=function(e){var t=this,n=[],i=[];e.get("planeElement").forEach(function(o){var a=o.bpmnElement;if(a){var s=a.$parent;S(a,"bpmn:SubProcess")&&!o.isExpanded&&n.push(a),pk(a,e)&&i.push({diElement:o,parent:s})}});var r=[];return n.forEach(function(o){if(!t._processToDiagramMap[o.id]){var a=t._createDiagram(o);t._processToDiagramMap[o.id]=a,r.push(a)}}),i.forEach(function(o){for(var a=o.diElement,s=o.parent;s&&n.indexOf(s)===-1;)s=s.$parent;if(s){var c=t._processToDiagramMap[s.id];t._moveToDiPlane(a,c.plane)}}),r},Yr.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=uk(e),i={x:n.x-Tb.x,y:n.y-Tb.y};t.forEach(function(r){r.waypoint?r.waypoint.forEach(function(o){o.x=o.x-i.x,o.y=o.y-i.y}):r.bounds&&(r.bounds.x=r.bounds.x-i.x,r.bounds.y=r.bounds.y-i.y)})},Yr.prototype._moveToDiPlane=function(e,t){var n=kb(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},Yr.prototype._createDiagram=function(e){var t=this._moddle.create("bpmndi:BPMNPlane",{bpmnElement:e}),n=this._moddle.create("bpmndi:BPMNDiagram",{plane:t});return t.$parent=n,t.bpmnElement=e,n.$parent=this._definitions,this._definitions.diagrams.push(n),n},Yr.$inject=["eventBus","moddle"];function kb(e){return S(e,"bpmndi:BPMNDiagram")?e:kb(e.$parent)}function uk(e){var t={top:1/0,right:-1/0,bottom:-1/0,left:1/0};return e.planeElement.forEach(function(n){if(n.bounds){var i=Ie(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),Vs(t)}function pk(e,t){var n=e.$parent;return!(!S(n,"bpmn:SubProcess")||n===t.bpmnElement||qe(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var tl=250,fk='<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M4.81801948,3.50735931 L10.4996894,9.1896894 L10.5,4 L12,4 L12,12 L4,12 L4,10.5 L9.6896894,10.4996894 L3.75735931,4.56801948 C3.46446609,4.27512627 3.46446609,3.80025253 3.75735931,3.50735931 C4.05025253,3.21446609 4.52512627,3.21446609 4.81801948,3.50735931 Z"/></svg>',dk="bjs-drilldown-empty";function br(e,t,n,i,r){te.call(this,t),this._canvas=e,this._eventBus=t,this._elementRegistry=n,this._overlays=i,this._translate=r;var o=this;this.executed("shape.toggleCollapse",tl,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",tl,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],tl,function(a){var s=a.oldParent,c=a.newParent||a.parent,l=a.shape;o._canDrillDown(l)&&o._addOverlay(l),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(l)},!0),this.reverted(["shape.create","shape.move","shape.delete"],tl,function(a){var s=a.oldParent,c=a.newParent||a.parent,l=a.shape;o._canDrillDown(l)&&o._addOverlay(l),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(l)},!0),t.on("import.render.complete",function(){n.filter(function(a){return o._canDrillDown(a)}).map(function(a){o._addOverlay(a)})})}Ee(br,te),br.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},br.prototype._canDrillDown=function(e){var t=this._canvas;return S(e,"bpmn:SubProcess")&&t.findRoot(Ei(e))},br.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=ie(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var r=n&&n.get("flowElements")&&n.get("flowElements").length;Ct(i.html).toggle(dk,!r)}},br.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=ie(e),r=n.get({element:e,type:"drilldown"});r.length&&this._removeOverlay(e);var o=wt('<button type="button" class="bjs-drilldown">'+fk+"</button>"),a=i.get("name")||i.get("id"),s=this._translate("Open {element}",{element:a});o.setAttribute("title",s),o.addEventListener("click",function(){t.setRootElement(t.findRoot(Ei(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:o}),this._updateOverlayVisibility(e)},br.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},br.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const hk={__depends__:[el,ff,ok],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",Pb],drilldownCentering:["type",Mb],drilldownOverlayBehavior:["type",br],subprocessCompatibility:["type",Yr]};function xr(e){Pt.call(this,e)}Ee(xr,Pt),xr.prototype._modules=[mg,hk,el,ni,ba],xr.prototype._moddleExtensions={};var nl="keyboard.keydown",mk="keyboard.keyup",gk=1e3,Ob="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 En(e,t){var n=this;this._config=e=e||{},this._eventBus=t,this._keydownHandler=this._keydownHandler.bind(this),this._keyupHandler=this._keyupHandler.bind(this),t.on("diagram.destroy",function(){n._fire("destroy"),n.unbind()}),e.bindTo&&console.error("unsupported configuration <keyboard.bindTo>",new Error(Ob));var i=e&&e.bind!==!1;t.on("canvas.init",function(r){n._target=r.svg,i&&n.bind(),n._fire("init")})}En.$inject=["config.keyboard","eventBus"],En.prototype._keydownHandler=function(e){this._keyHandler(e,nl)},En.prototype._keyupHandler=function(e){this._keyHandler(e,mk)},En.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||nl,i),n&&e.preventDefault()}},En.prototype._isEventIgnored=function(e){return!1},En.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(Ob)),this.unbind(),e=this._node=this._target,je.bind(e,"keydown",this._keydownHandler),je.bind(e,"keyup",this._keyupHandler),this._fire("bind")},En.prototype.getBinding=function(){return this._node},En.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),je.unbind(e,"keydown",this._keydownHandler),je.unbind(e,"keyup",this._keyupHandler)),this._node=null},En.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},En.prototype.addListener=function(e,t,n){Jt(e)&&(n=t,t=e,e=gk),this._eventBus.on(n||nl,e,t)},En.prototype.removeListener=function(e,t){this._eventBus.off(t||nl,e)},En.prototype.hasModifier=AM,En.prototype.isCmd=Ln,En.prototype.isShift=ef,En.prototype.isKey=Xt;var yk=500;function Ho(e,t){var n=this;e.on("editorActions.init",yk,function(i){var r=i.editorActions;n.registerBindings(t,r)})}Ho.$inject=["eventBus","keyboard"],Ho.prototype.registerBindings=function(e,t){function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("undo",function(i){var r=i.keyEvent;if(OM(r))return t.trigger("undo"),!0}),n("redo",function(i){var r=i.keyEvent;if(DM(r))return t.trigger("redo"),!0}),n("copy",function(i){var r=i.keyEvent;if(PM(r))return t.trigger("copy"),!0}),n("paste",function(i){var r=i.keyEvent;if(MM(r))return t.trigger("paste"),!0}),n("duplicate",function(i){var r=i.keyEvent;if(TM(r))return t.trigger("duplicate"),!0}),n("cut",function(i){var r=i.keyEvent;if(kM(r))return t.trigger("cut"),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(Xt(["+","Add","="],r)&&Ln(r))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(Xt(["-","Subtract"],r)&&Ln(r))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var r=i.keyEvent;if(Xt("0",r)&&Ln(r))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var r=i.keyEvent;if(Xt(["Backspace","Delete","Del"],r))return t.trigger("removeSelection"),!0})};const Nf={__init__:["keyboard","keyboardBindings"],keyboard:["type",En],keyboardBindings:["type",Ho]};var vk={moveSpeed:50,moveSpeedAccelerated:200};function Db(e,t,n){var i=this;this._config=W({},vk,e||{}),t.addListener(r);function r(o){var a=o.keyEvent,s=i._config;if(t.isCmd(a)&&t.isKey(["ArrowLeft","Left","ArrowUp","Up","ArrowDown","Down","ArrowRight","Right"],a)){var c=t.isShift(a)?s.moveSpeedAccelerated:s.moveSpeed,l;switch(a.key){case"ArrowLeft":case"Left":l="left";break;case"ArrowUp":case"Up":l="up";break;case"ArrowRight":case"Right":l="right";break;case"ArrowDown":case"Down":l="down";break}return i.moveCanvas({speed:c,direction:l}),!0}}this.moveCanvas=function(o){var a=0,s=0,c=o.speed,l=c/Math.min(Math.sqrt(n.viewbox().scale),1);switch(o.direction){case"left":a=l;break;case"up":s=l;break;case"right":a=-l;break;case"down":s=-l;break}n.scroll({dx:a,dy:s})}}Db.$inject=["config.keyboardMove","keyboard","canvas"];const Ib={__depends__:[Nf],__init__:["keyboardMove"],keyboardMove:["type",Db]};var bk=15;function Lb(e,t){var n;function i(s){return a(s.originalEvent)}e.on("canvas.focus.changed",function(s){s.focused?e.on("element.mousedown",500,i):e.off("element.mousedown",i)});function r(s){var c=n.start,l=n.button,u=Hr(s),f=pi(u,c);if(!n.dragging&&xk(f)>bk&&(n.dragging=!0,l===0&&tv(e),Pc("grab")),n.dragging){var p=n.last||n.start;f=pi(u,p),t.scroll({dx:f.x,dy:f.y}),n.last=u}s.preventDefault()}function o(s){je.unbind(document,"mousemove",r),je.unbind(document,"mouseup",o),n=null,ev()}function a(s){if(!Lr(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:Hr(s)},je.bind(document,"mousemove",r),je.bind(document,"mouseup",o),!0}}this.isActive=function(){return!!n}}Lb.$inject=["eventBus","canvas"];function xk(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const Bb={__init__:["moveCanvas"],moveCanvas:["type",Lb]};function Nb(e,t){var n=Zu(e.min),i=Zu(e.max),r=Math.abs(n)+Math.abs(i);return r/t}function _k(e,t){return Math.max(e.min,Math.min(e.max,t))}var wk=Math.sign||function(e){return e>=0?1:-1},$f={min:.2,max:4},$b=10,Ek=.1,Sk=.75;function Ci(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=Rn(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||Sk;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}Ci.$inject=["config.zoomScroll","eventBus","canvas"],Ci.prototype.scroll=function(t){this._canvas.scroll(t)},Ci.prototype.reset=function(){this._canvas.zoom("fit-viewport")},Ci.prototype.zoom=function(t,n){var i=Nb($f,$b*2);this._totalDelta+=t,Math.abs(this._totalDelta)>Ek&&(this._zoom(t,n,i),this._totalDelta=0)},Ci.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||cy()&&t.metaKey,r=t.shiftKey,o=-1*this._scale,a;if(i?o*=t.deltaMode===0?.02:.32:o*=t.deltaMode===0?1:16,i){var s=n.getBoundingClientRect(),c={x:t.clientX-s.left,y:t.clientY-s.top};a=Math.sqrt(Math.pow(t.deltaY,2)+Math.pow(t.deltaX,2))*wk(t.deltaY)*o,this.zoom(a,c)}else r?a={dx:o*t.deltaY,dy:0}:a={dx:o*t.deltaX,dy:o*t.deltaY},this.scroll(a)}},Ci.prototype.stepZoom=function(t,n){var i=Nb($f,$b);this._zoom(t,n,i)},Ci.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=Zu(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(_k($f,s),t)},Ci.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,r=this._enabled;return typeof t>"u"&&(t=!r),r!==t&&je[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},Ci.prototype._init=function(e){this.toggle(e)};const Fb={__init__:["zoomScroll"],zoomScroll:["type",Ci]};function Ua(e){xr.call(this,e)}Ee(Ua,xr),Ua.prototype._navigationModules=[Ib,Bb,Fb],Ua.prototype._modules=[].concat(xr.prototype._modules,Ua.prototype._navigationModules);function Ff(e){return e&&e[e.length-1]}function jb(e){return e.y}function Hb(e){return e.x}var Rk={left:Hb,center:Hb,right:function(e){return e.x+e.width},top:jb,middle:jb,bottom:function(e){return e.y+e.height}};function zo(e,t){this._modeling=e,this._rules=t}zo.$inject=["modeling","rules"],zo.prototype._getOrientationDetails=function(e){var t=["top","bottom","middle"],n="x",i="width";return t.indexOf(e)!==-1&&(n="y",i="height"),{axis:n,dimension:i}},zo.prototype._isType=function(e,t){return t.indexOf(e)!==-1},zo.prototype._alignmentPosition=function(e,t){var n=this._getOrientationDetails(e),i=n.axis,r=n.dimension,o={},a={},s=!1,c,l,u;function f(p,d){return Math.round((p[i]+d[i]+d[r])/2)}if(this._isType(e,["left","top"]))o[e]=t[0][i];else if(this._isType(e,["right","bottom"]))u=Ff(t),o[e]=u[i]+u[r];else if(this._isType(e,["center","middle"])){if(F(t,function(p){var d=p[i]+Math.round(p[r]/2);a[d]?a[d].elements.push(p):a[d]={elements:[p],center:d}}),c=di(a,function(p){return p.elements.length>1&&(s=!0),p.elements.length}),s)return o[e]=Ff(c).center,o;l=t[0],t=di(t,function(p){return p[i]+p[r]}),u=Ff(t),o[e]=f(l,u)}return o},zo.prototype.trigger=function(e,t){var n=this._modeling,i,r=Ke(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:r}),Be(i)&&(r=i),!(r.length<2||!i)){var o=Rk[t],a=di(r,o),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const Ck={__init__:["alignElements"],alignElements:["type",zo]},Ak=new Bo;function Go(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}Go.$inject=["eventBus"],Go.prototype.schedule=function(e,t=Ak.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},Go.prototype._schedule=function(e,t){const n=Pk();return{executionId:setTimeout(()=>{try{this._scheduled[t]=null;try{n.resolve(e())}catch(r){n.reject(r)}}catch(r){console.error("Scheduler#_schedule execution failed",r)}}),promise:n.promise}},Go.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},Go.prototype._cancel=function(e){clearTimeout(e.executionId)};function Pk(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const Mk={scheduler:["type",Go]};var Tk="djs-element-hidden",il=".entry",kk=1e3,zb=8,Ok=300;function Ht(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}Ht.$inject=["canvas","elementRegistry","eventBus","scheduler"],Ht.prototype._init=function(){var e=this;this._eventBus.on("selection.changed",function(t){var n=t.newSelection,i=n.length?n.length===1?n[0]:n:null;i?e.open(i,!0):e.close()}),this._eventBus.on("elements.changed",function(t){var n=t.elements,i=e._current;if(i){var r=i.target,o=Be(r)?r:[r],a=o.filter(function(c){return n.includes(c)});if(a.length){e.close();var s=o.filter(function(c){return e._elementRegistry.get(c.id)});s.length&&e._updateAndOpen(s.length>1?s:s[0])}}}),this._eventBus.on("canvas.viewbox.changed",function(){e._updatePosition()}),this._eventBus.on("element.marker.update",function(t){if(e.isOpen()){var n=t.element,i=e._current,r=Be(i.target)?i.target:[i.target];r.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},Ht.prototype._createContainer=function(){var e=wt('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},Ht.prototype.registerProvider=function(e,t){t||(t=e,e=kk),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},Ht.prototype.getEntries=function(e){var t=this._getProviders(),n=Be(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return F(t,function(r){if(Jt(r[n])){var o=r[n](e);Jt(o)?i=o(i):F(o,function(a,s){i[s]=a})}}),i},Ht.prototype.trigger=function(e,t,n){var i=this,r,o,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(r=gn(a,"data-action"),o=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(r,"hover",o,n)},Ok);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(r,e,o,n)},Ht.prototype.triggerEntry=function(e,t,n,i){if(this.isShown()){var r=this._current.target,o=this._current.entries,a=o[e];if(a){var s=a.action;if(this._eventBus.fire("contextPad.trigger",{entry:a,event:n})!==!1){if(Jt(s)){if(t==="click")return s(n,r,i)}else if(s[t])return s[t](n,r,i);n.preventDefault()}}}},Ht.prototype.open=function(e,t){if(!(!t&&this.isOpen(e))){var n=this._eventBus.fire("contextPad.open.allowed",{target:e});n!==!1&&(this.close(),this._updateAndOpen(e))}},Ht.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Ht.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),i;F(t,function(r,o){var a=r.group||"default",s=wt(r.html||'<div class="entry" draggable="true"></div>'),c;gn(s,"data-action",o),c=ft("[data-group="+Wa(a)+"]",n),c||(c=wt('<div class="group"></div>'),gn(c,"data-group",a),n.appendChild(c)),c.appendChild(s),r.className&&Dk(s,r.className),r.title&&gn(s,"title",r.title),r.imageUrl&&(i=wt("<img>"),gn(i,"src",r.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),Ct(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},Ht.prototype._createHtml=function(e){var t=this,n=wt('<div class="djs-context-pad"></div>');return On.bind(n,il,"click",function(i){t.trigger("click",i)}),On.bind(n,il,"dragstart",function(i){t.trigger("dragstart",i)}),On.bind(n,il,"mouseover",function(i){t.trigger("mouseover",i)}),On.bind(n,il,"mouseout",function(i){t.trigger("mouseout",i)}),je.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},Ht.prototype.getPad=function(e){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 t;return this.isOpen()&&Lk(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},Ht.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},Ht.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return Be(e)!==Be(n)?!1:Be(e)?e.length===n.length&&kr(e,function(i){return n.includes(i)}):n===e},Ht.prototype.isShown=function(){return this.isOpen()&&Ct(this._current.html).has("open")},Ht.prototype.show=function(){this.isOpen()&&(Ct(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},Ht.prototype.hide=function(){this.isOpen()&&(Ct(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},Ht.prototype._getPosition=function(e){if(!Be(e)&&ht(e)){var t=this._canvas.viewbox(),n=Ik(e),i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale;return{left:i+zb*this._canvas.zoom(),top:r}}var o=this._canvas.getContainer(),a=o.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+zb*this._canvas.zoom(),top:s.top-a.top}},Ht.prototype._updatePosition=function(){const e=()=>{if(this.isOpen()){var t=this._current.html,n=this._getPosition(this._current.target);"x"in n&&"y"in n?(t.style.left=n.x+"px",t.style.top=n.y+"px"):["top","right","bottom","left"].forEach(function(i){i in n&&(t.style[i]=n[i]+"px")})}};this._scheduler.schedule(e,"ContextPad#_updatePosition")},Ht.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=Be(n)?n:[n],r=i.some(function(o){return t._canvas.hasMarker(o,Tk)});r?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},Ht.prototype._getTargetBounds=function(e){var t=this,n=Be(e)?e:[e],i=n.map(function(r){return t._canvas.getGraphics(r)});return i.reduce(function(r,o){const a=o.getBoundingClientRect();return r.top=Math.min(r.top,a.top),r.right=Math.max(r.right,a.right),r.bottom=Math.max(r.bottom,a.bottom),r.left=Math.min(r.left,a.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 Dk(e,t){var n=Ct(e);t=Be(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function Ik(e){return e.waypoints[e.waypoints.length-1]}function Lk(e,t){return e=Be(e)?e:[e],t=Be(t)?t:[t],e.length===t.length&&kr(e,function(n){return t.includes(n)})}const Gb={__depends__:[Ac,Mk,el],contextPad:["type",Ht]};var rl,Tt,Vb,_r,Wb,Ub,Yb,jf,ol,Ya,qb,Hf,zf,Gf,al={},sl=[],Bk=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,cl=Array.isArray;function Wi(e,t){for(var n in t)e[n]=t[n];return e}function Vf(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Kb(e,t,n){var i,r,o,a={};for(o in t)o=="key"?i=t[o]:o=="ref"?r=t[o]:a[o]=t[o];if(arguments.length>2&&(a.children=arguments.length>3?rl.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(o in e.defaultProps)a[o]===void 0&&(a[o]=e.defaultProps[o]);return ll(e,a,i,r,null)}function ll(e,t,n,i,r){var o={type:e,props:t,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r??++Vb,__i:-1,__u:0};return r==null&&Tt.vnode!=null&&Tt.vnode(o),o}function ul(e){return e.children}function pl(e,t){this.props=e,this.context=t}function qr(e,t){if(t==null)return e.__?qr(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?qr(e):null}function Nk(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],r=[],o=Wi({},t);o.__v=t.__v+1,Tt.vnode&&Tt.vnode(o),Wf(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??qr(t),!!(32&t.__u),r),o.__v=t.__v,o.__.__k[o.__i]=o,ix(i,o,r),t.__e=t.__=null,o.__e!=n&&Xb(o)}}function Xb(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),Xb(e)}function Zb(e){(!e.__d&&(e.__d=!0)&&_r.push(e)&&!fl.__r++||Wb!=Tt.debounceRendering)&&((Wb=Tt.debounceRendering)||Ub)(fl)}function fl(){try{for(var e,t=1;_r.length;)_r.length>t&&_r.sort(Yb),e=_r.shift(),t=_r.length,Nk(e)}finally{_r.length=fl.__r=0}}function Qb(e,t,n,i,r,o,a,s,c,l,u){var f,p,d,m,h,y,v=i&&i.__k||sl,g=t.length;for(c=$k(n,t,v,c,g),f=0;f<g;f++)(d=n.__k[f])!=null&&(p=d.__i!=-1&&v[d.__i]||al,d.__i=f,y=Wf(e,d,p,r,o,a,s,c,l,u),m=d.__e,d.ref&&p.ref!=d.ref&&(p.ref&&Uf(p.ref,null,d),u.push(d.ref,d.__c||m,d)),h==null&&m!=null&&(h=m),4&d.__u?(c=Jb(d,c,e),p.__e&&(p.__e=null)):typeof d.type=="function"&&y!==void 0?c=y:m&&(c=m.nextSibling),d.__u&=-7);return n.__e=h,c}function $k(e,t,n,i,r){var o,a,s,c,l,u=n.length,f=u,p=0;for(e.__k=new Array(r),o=0;o<r;o++)(a=t[o])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?a=e.__k[o]=ll(null,a,null,null,null):cl(a)?a=e.__k[o]=ll(ul,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=ll(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[o]=a,c=o+p,a.__=e,a.__b=e.__b+1,s=null,(l=a.__i=Fk(a,n,c,f))!=-1&&(f--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(r>u?p--:r<u&&p++),typeof a.type!="function"&&(a.__u|=4)):l!=c&&(l==c-1?p--:l==c+1?p++:(l>c?p--:p++,a.__u|=4))):e.__k[o]=null;if(f)for(o=0;o<u;o++)(s=n[o])!=null&&(2&s.__u)==0&&(s.__e==i&&(i=qr(s)),ox(s,s));return i}function Jb(e,t,n){var i,r;if(typeof e.type=="function"){for(i=e.__k,r=0;i&&r<i.length;r++)i[r]&&(i[r].__=e,t=Jb(i[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=qr(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function Fk(e,t,n,i){var r,o,a,s=e.key,c=e.type,l=t[n],u=l!=null&&(2&l.__u)==0;if(l===null&&s==null||u&&s==l.key&&c==l.type)return n;if(i>(u?1:0)){for(r=n-1,o=n+1;r>=0||o<t.length;)if((l=t[a=r>=0?r--:o++])!=null&&(2&l.__u)==0&&s==l.key&&c==l.type)return a}return-1}function ex(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||Bk.test(t)?n:n+"px"}function dl(e,t,n,i,r){var o,a;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof i=="string"&&(e.style.cssText=i=""),i)for(t in i)n&&t in n||ex(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||ex(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(qb,"$1")),a=t.toLowerCase(),t=a in e||t=="onFocusOut"||t=="onFocusIn"?a.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?i?n[Ya]=i[Ya]:(n[Ya]=Hf,e.addEventListener(t,o?Gf:zf,o)):e.removeEventListener(t,o?Gf:zf,o);else{if(r=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function tx(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[ol]==null)t[ol]=Hf++;else if(t[ol]<n[Ya])return;return n(Tt.event?Tt.event(t):t)}}}function Wf(e,t,n,i,r,o,a,s,c,l){var u,f,p,d,m,h,y,v,g,b,x,C,M,k,P,B,D=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[s=t.__e=n.__e]),(u=Tt.__b)&&u(t);e:if(typeof D=="function"){f=a.length;try{if(g=t.props,b=D.prototype&&D.prototype.render,x=(u=D.contextType)&&i[u.__c],C=u?x?x.props.value:u.__:i,n.__c?v=(p=t.__c=n.__c).__=p.__E:(b?t.__c=p=new D(g,C):(t.__c=p=new pl(g,C),p.constructor=D,p.render=Hk),x&&x.sub(p),p.state||(p.state={}),p.__n=i,d=p.__d=!0,p.__h=[],p._sb=[]),b&&p.__s==null&&(p.__s=p.state),b&&D.getDerivedStateFromProps!=null&&(p.__s==p.state&&(p.__s=Wi({},p.__s)),Wi(p.__s,D.getDerivedStateFromProps(g,p.__s))),m=p.props,h=p.state,p.__v=t,d)b&&D.getDerivedStateFromProps==null&&p.componentWillMount!=null&&p.componentWillMount(),b&&p.componentDidMount!=null&&p.__h.push(p.componentDidMount);else{if(b&&D.getDerivedStateFromProps==null&&g!==m&&p.componentWillReceiveProps!=null&&p.componentWillReceiveProps(g,C),t.__v==n.__v||!p.__e&&p.shouldComponentUpdate!=null&&p.shouldComponentUpdate(g,p.__s,C)===!1){t.__v!=n.__v&&(p.props=g,p.state=p.__s,p.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(I){I&&(I.__=t)}),sl.push.apply(p.__h,p._sb),p._sb=[],p.__h.length&&a.push(p),s=qr(n);break e}p.componentWillUpdate!=null&&p.componentWillUpdate(g,p.__s,C),b&&p.componentDidUpdate!=null&&p.__h.push(function(){p.componentDidUpdate(m,h,y)})}if(p.context=C,p.props=g,p.__P=e,p.__e=!1,M=Tt.__r,k=0,b)p.state=p.__s,p.__d=!1,M&&M(t),u=p.render(p.props,p.state,p.context),sl.push.apply(p.__h,p._sb),p._sb=[];else do p.__d=!1,M&&M(t),u=p.render(p.props,p.state,p.context),p.state=p.__s;while(p.__d&&++k<25);p.state=p.__s,p.getChildContext!=null&&(i=Wi(Wi({},i),p.getChildContext())),b&&!d&&p.getSnapshotBeforeUpdate!=null&&(y=p.getSnapshotBeforeUpdate(m,h)),P=u!=null&&u.type===ul&&u.key==null?rx(u.props.children):u,s=Qb(e,cl(P)?P:[P],t,n,i,r,o,a,s,c,l),p.base=t.__e,t.__u&=-161,p.__h.length&&a.push(p),v&&(p.__E=p.__=null)}catch(I){if(a.length=f,t.__v=null,c||o!=null){if(I.then){for(t.__u|=c?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;o!=null&&(o[o.indexOf(s)]=null),t.__e=s}else if(o!=null)for(B=o.length;B--;)Vf(o[B])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),I.then||nx(t),Tt.__e(I,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=jk(n.__e,t,n,i,r,o,a,c,l);return(u=Tt.diffed)&&u(t),128&t.__u?void 0:s}function nx(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(nx))}function ix(e,t,n){for(var i=0;i<n.length;i++)Uf(n[i],n[++i],n[++i]);Tt.__c&&Tt.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){Tt.__e(o,r.__v)}})}function rx(e){return typeof e!="object"||e==null||e.__b>0?e:cl(e)?e.map(rx):e.constructor!==void 0?null:Wi({},e)}function jk(e,t,n,i,r,o,a,s,c){var l,u,f,p,d,m,h,y=n.props||al,v=t.props,g=t.type;if(g=="svg"?r="http://www.w3.org/2000/svg":g=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),o!=null){for(l=0;l<o.length;l++)if((d=o[l])&&"setAttribute"in d==!!g&&(g?d.localName==g:d.nodeType==3)){e=d,o[l]=null;break}}if(e==null){if(g==null)return document.createTextNode(v);e=document.createElementNS(r,g,v.is&&v),s&&(Tt.__m&&Tt.__m(t,o),s=!1),o=null}if(g==null)y===v||s&&e.data==v||(e.data=v);else{if(o=g=="textarea"&&v.defaultValue!=null?null:o&&rl.call(e.childNodes),!s&&o!=null)for(y={},l=0;l<e.attributes.length;l++)y[(d=e.attributes[l]).name]=d.value;for(l in y)d=y[l],l=="dangerouslySetInnerHTML"?f=d:l=="children"||l in v||l=="value"&&"defaultValue"in v||l=="checked"&&"defaultChecked"in v||dl(e,l,null,d,r);for(l in v)d=v[l],l=="children"?p=d:l=="dangerouslySetInnerHTML"?u=d:l=="value"?m=d:l=="checked"?h=d:s&&typeof d!="function"||y[l]===d||dl(e,l,d,y[l],r);if(u)s||f&&(u.__html==f.__html||u.__html==e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(f&&(e.innerHTML=""),Qb(t.type=="template"?e.content:e,cl(p)?p:[p],t,n,i,g=="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,a,o?o[0]:n.__k&&qr(n,0),s,c),o!=null)for(l=o.length;l--;)Vf(o[l]);s&&g!="textarea"||(l="value",g=="progress"&&m==null?e.removeAttribute("value"):m!=null&&(m!==e[l]||g=="progress"&&!m||g=="option"&&m!=y[l])&&dl(e,l,m,y[l],r),l="checked",h!=null&&h!=e[l]&&dl(e,l,h,y[l],r))}return e}function Uf(e,t,n){try{if(typeof e=="function"){var i=typeof e.__u=="function";i&&e.__u(),i&&t==null||(e.__u=e(t))}else e.current=t}catch(r){Tt.__e(r,n)}}function ox(e,t,n){var i,r;if(Tt.unmount&&Tt.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||Uf(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){Tt.__e(o,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&ox(i[r],t,n||typeof e.type!="function");n||Vf(e.__e),e.__c=e.__=e.__e=void 0}function Hk(e,t,n){return this.constructor(e,n)}function ax(e,t,n){var i,r,o,a;t==document&&(t=document.documentElement),Tt.__&&Tt.__(e,t),r=(i=!1)?null:t.__k,o=[],a=[],Wf(t,e=t.__k=Kb(ul,null,[e]),r||al,al,t.namespaceURI,r?null:t.firstChild?rl.call(t.childNodes):null,o,r?r.__e:t.firstChild,i,a),ix(o,e,a),e.props.children=null}rl=sl.slice,Tt={__e:function(e,t,n,i){for(var r,o,a;t=t.__;)if((r=t.__c)&&!r.__)try{if((o=r.constructor)&&o.getDerivedStateFromError!=null&&(r.setState(o.getDerivedStateFromError(e)),a=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(e,i||{}),a=r.__d),a)return r.__E=r}catch(s){e=s}throw e}},Vb=0,pl.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Wi({},this.state),typeof e=="function"&&(e=e(Wi({},n),this.props)),e&&Wi(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Zb(this))},pl.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Zb(this))},pl.prototype.render=ul,_r=[],Ub=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Yb=function(e,t){return e.__v.__b-t.__v.__b},fl.__r=0,jf=Math.random().toString(8),ol="__d"+jf,Ya="__a"+jf,qb=/(PointerCapture)$|Capture$/i,Hf=0,zf=tx(!1),Gf=tx(!0);var sx=function(e,t,n,i){var r;t[0]=0;for(var o=1;o<t.length;o++){var a=t[o++],s=t[o]?(t[0]|=a?1:2,n[t[o++]]):t[++o];a===3?i[0]=s:a===4?i[1]=Object.assign(i[1]||{},s):a===5?(i[1]=i[1]||{})[t[++o]]=s:a===6?i[1][t[++o]]+=s+"":a?(r=e.apply(s,sx(e,s,n,["",null])),i.push(r),s[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(s)}return i},cx=new Map;function zk(e){var t=cx.get(this);return t||(t=new Map,cx.set(this,t)),(t=sx(this,t.get(e)||(t.set(e,t=(function(n){for(var i,r,o=1,a="",s="",c=[0],l=function(p){o===1&&(p||(a=a.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?c.push(0,p,a):o===3&&(p||a)?(c.push(3,p,a),o=2):o===2&&a==="..."&&p?c.push(4,p,0):o===2&&a&&!p?c.push(5,0,!0,a):o>=5&&((a||!p&&o===5)&&(c.push(o,0,a,r),o=6),p&&(c.push(o,p,0,r),o=6)),a=""},u=0;u<n.length;u++){u&&(o===1&&l(),l(u));for(var f=0;f<n[u].length;f++)i=n[u][f],o===1?i==="<"?(l(),c=[c],o=3):a+=i:o===4?a==="--"&&i===">"?(o=1,a=""):a=i+a[0]:s?i===s?s="":a+=i:i==='"'||i==="'"?s=i:i===">"?(l(),o=1):o&&(i==="="?(o=5,r=a,a=""):i==="/"&&(o<5||n[u][f+1]===">")?(l(),o===3&&(c=c[0]),o=c,(c=c[0]).push(2,0,o),o=0):i===" "||i===" "||i===`
|
|
10
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="`+p+'" height="'+d+'" viewBox="'+u+" "+f+" "+p+" "+d+'" version="1.1">'+s+a+"</svg>"}catch(i){n=i}if(this._emit("saveSVG.done",{error:n,svg:t}),n)throw n;return{svg:t}},Pt.prototype._setDefinitions=function(e){this._definitions=e},Pt.prototype.getModules=function(){return this._modules},Pt.prototype.clear=function(){this.getDefinitions()&&ar.prototype.clear.call(this)},Pt.prototype.destroy=function(){ar.prototype.destroy.call(this),vi(this._container)},Pt.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},Pt.prototype.off=function(e,t){this.get("eventBus").off(e,t)},Pt.prototype.attachTo=function(e){if(!e)throw new Error("parentNode required");this.detach(),e.get&&e.constructor.prototype.jquery&&(e=e.get(0)),typeof e=="string"&&(e=ft(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},Pt.prototype.getDefinitions=function(){return this._definitions},Pt.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},Pt.prototype._init=function(e,t,n){const i=n.modules||this.getModules(n),r=n.additionalModules||[],o=[{bpmnjs:["value",this],moddle:["value",t]}],a=[].concat(o,i,r),s=W(hi(n,["additionalModules"]),{canvas:W({},n.canvas,{container:e}),modules:a});ar.call(this,s),n&&n.container&&this.attachTo(n.container)},Pt.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},Pt.prototype._createContainer=function(e){const t=wt('<div class="bjs-container"></div>');return wn(t,{width:ag(e.width),height:ag(e.height),position:e.position}),t},Pt.prototype._createModdle=function(e){const t=W({},this._moddleExtensions,e.moddleExtensions);return new eh(t)},Pt.prototype._modules=[];function Ks(e,t){return e.warnings=t,e}function fC(e){const n=/unparsable content <([^>]+)> detected([\s\S]*)$/.exec(e.message);return n&&(e.message="unparsable content <"+n[1]+"> detected; this may indicate an invalid BPMN 2.0 diagram file"+n[2]),e}const dC={width:"100%",height:"100%",position:"relative"};function ag(e){return e+(Fe(e)?"px":"")}function hC(e,t){return t&&vt(e.diagrams,function(n){return n.id===t})||null}function mC(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+ng+"</a>",i=wt(n);wn(ft("svg",i),ig),wn(i,rg,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),je.bind(i,"click",function(r){pC(),r.preventDefault()})}function wo(e){Pt.call(this,e),this.on("import.parse.complete",function(t){t.error||this._collectIds(t.definitions,t.elementsById)},this),this.on("diagram.destroy",function(){this.get("moddle").ids.clear()},this)}Ee(wo,Pt),wo.prototype._createModdle=function(e){var t=Pt.prototype._createModdle.call(this,e);return t.ids=new yi([32,36,1]),t},wo.prototype._collectIds=function(e,t){var n=e.$model,i=n.ids,r;i.clear();for(r in t)i.claim(r,t[r])};function Qe(e,t){return S(e,"bpmn:CallActivity")?!1:S(e,"bpmn:SubProcess")?(t=t||ot(e),t&&S(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):S(e,"bpmn:Participant")?!!ie(e).processRef:!0}function tn(e){if(!(!S(e,"bpmn:Participant")&&!S(e,"bpmn:Lane"))){var t=ot(e).isHorizontal;return t===void 0?!0:t}}function gC(e){return e&&ie(e).isInterrupting!==!1}function vn(e){return e&&!!ie(e).triggeredByEvent}function Eo(e,t){var n=ie(e).eventDefinitions;return Xi(n,function(i){return S(i,t)})}function yC(e){return Eo(e,"bpmn:ErrorEventDefinition")}function vC(e){return Eo(e,"bpmn:EscalationEventDefinition")}function bC(e){return Eo(e,"bpmn:CompensateEventDefinition")}var Fr={width:90,height:20},sg=15;function sr(e){return S(e,"bpmn:Event")||S(e,"bpmn:Gateway")||S(e,"bpmn:DataStoreReference")||S(e,"bpmn:DataObjectReference")||S(e,"bpmn:DataInput")||S(e,"bpmn:DataOutput")||S(e,"bpmn:SequenceFlow")||S(e,"bpmn:MessageFlow")||S(e,"bpmn:Group")}function Xs(e){return Ye(e.label)}function xC(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=_C(e),o=Math.atan((i.y-n.y)/(i.x-n.x)),a=r.x,s=r.y;return Math.abs(o)<Math.PI/2?s-=sg:a+=sg,{x:a,y:s}}function _C(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)];return{x:n.x+(i.x-n.x)/2,y:n.y+(i.y-n.y)/2}}function Yu(e){return e.waypoints?xC(e.waypoints):S(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+Fr.height/2}:{x:e.x+e.width/2,y:e.y+e.height+Fr.height/2}}function wC(e,t){var n,i,r,o=e.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(Fr.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=Yu(t),i=Fr),W({x:n.x-i.width/2,y:n.y-i.height/2},i)}function cg(e){if(S(e,"bpmn:FlowElement")||S(e,"bpmn:Participant")||S(e,"bpmn:Lane")||S(e,"bpmn:SequenceFlow")||S(e,"bpmn:MessageFlow")||S(e,"bpmn:DataInput")||S(e,"bpmn:DataOutput"))return"name";if(S(e,"bpmn:TextAnnotation"))return"text";if(S(e,"bpmn:Group"))return"categoryValueRef"}function EC(e){var t=e.categoryValueRef;return t&&t.value||""}function qn(e){var t=e.businessObject,n=cg(t);if(n)return n==="categoryValueRef"?EC(t):t[n]||""}function SC(e,t){var n=e.businessObject,i=cg(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function RC(e){return Ye(e)&&sr(e.labelTarget)}var So=7;function lg(e){let t=[];return F(e.incoming,n=>{S(n,"bpmn:Association")&&S(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),F(e.outgoing,n=>{S(n,"bpmn:Association")&&S(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function ga(e){const t=new Map;return F(ju(e),n=>{F(lg(n),i=>{t.has(i.annotation)||t.set(i.annotation,{annotation:i.annotation,associations:[]}),t.get(i.annotation).associations.push(i.association)})}),[...t.values()]}var qu="hsl(225, 10%, 15%)",CC="white";function wi(e,t){return Xi(e.eventDefinitions,function(n){return n.$type===t})}function AC(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function PC(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function Ze(e,t,n){var i=ot(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||CC}function be(e,t,n){var i=ot(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||qu}function ya(e,t,n,i){var r=ot(e),o=r.get("label");return i||o&&o.get("color:color")||t||be(e,n)}function ug(e){var t=e.x+e.width/2,n=e.y+e.height/2,i=e.width/2,r=[["M",t,n],["m",0,-i],["a",i,i,0,1,1,0,2*i],["a",i,i,0,1,1,0,-2*i],["z"]];return Br(r)}function Ku(e,t){var n=e.x,i=e.y,r=e.width,o=e.height,a=[["M",n+t,i],["l",r-t*2,0],["a",t,t,0,0,1,t,t],["l",0,o-t*2],["a",t,t,0,0,1,-t,t],["l",t*2-r,0],["a",t,t,0,0,1,-t,-t],["l",0,t*2-o],["a",t,t,0,0,1,t,-t],["z"]];return Br(a)}function MC(e){var t=e.width,n=e.height,i=e.x,r=e.y,o=t/2,a=n/2,s=[["M",i+o,r],["l",o,a],["l",-o,a],["l",-o,-a],["z"]];return Br(s)}function TC(e){var t=e.x,n=e.y,i=e.width,r=e.height,o=[["M",t,n],["l",i,0],["l",0,r],["l",-i,0],["z"]];return Br(o)}function va(e,t={}){return{width:Qn(e,t),height:In(e,t)}}function Qn(e,t={}){return Mn(t,"width")?t.width:e.width}function In(e,t={}){return Mn(t,"height")?t.height:e.height}var kC=new yi,OC=10,Zs=3,DC=1.5,Qs=10,IC=4,Ro=.95,LC=1,BC=.25;function jr(e,t,n,i,r,o,a){Ii.call(this,t,a);var s=e&&e.defaultFillColor,c=e&&e.defaultStrokeColor,l=e&&e.defaultLabelColor;function u(T){return n.computeStyle(T,{strokeLinecap:"round",strokeLinejoin:"round",stroke:qu,strokeWidth:2,fill:"white"})}function f(T){return n.computeStyle(T,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:qu,strokeWidth:2})}function p(T,w){var{ref:E={x:0,y:0},scale:G=1,element:U,parentGfx:X=r._svg}=w,Ce=Oe("marker",{id:T,viewBox:"0 0 20 20",refX:E.x,refY:E.y,markerWidth:20*G,markerHeight:20*G,orient:"auto"});ze(Ce,U);var Ue=ft(":scope > defs",X);Ue||(Ue=Oe("defs"),ze(X,Ue)),ze(Ue,Ce)}function d(T,w,E,G){var U=kC.nextPrefixed("marker-");return m(T,U,w,E,G),"url(#"+U+")"}function m(T,w,E,G,U){if(E==="sequenceflow-end"){var X=Oe("path",{d:"M 1 5 L 11 10 L 1 15 Z",...u({fill:U,stroke:U,strokeWidth:1})});p(w,{element:X,ref:{x:11,y:10},scale:.5,parentGfx:T})}if(E==="messageflow-start"){var Ce=Oe("circle",{cx:6,cy:6,r:3.5,...u({fill:G,stroke:U,strokeWidth:1,strokeDasharray:[1e4,1]})});p(w,{element:Ce,ref:{x:6,y:6},parentGfx:T})}if(E==="messageflow-end"){var Ue=Oe("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...u({fill:G,stroke:U,strokeWidth:1,strokeDasharray:[1e4,1]})});p(w,{element:Ue,ref:{x:8.5,y:5},parentGfx:T})}if(E==="association-start"){var st=Oe("path",{d:"M 11 5 L 1 10 L 11 15",...f({fill:"none",stroke:U,strokeWidth:1.5,strokeDasharray:[1e4,1]})});p(w,{element:st,ref:{x:1,y:10},scale:.5,parentGfx:T})}if(E==="association-end"){var Ot=Oe("path",{d:"M 1 5 L 11 10 L 1 15",...f({fill:"none",stroke:U,strokeWidth:1.5,strokeDasharray:[1e4,1]})});p(w,{element:Ot,ref:{x:11,y:10},scale:.5,parentGfx:T})}if(E==="conditional-flow-marker"){var pt=Oe("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...u({fill:G,stroke:U})});p(w,{element:pt,ref:{x:-1,y:10},scale:.5,parentGfx:T})}if(E==="conditional-default-flow-marker"){var Wt=Oe("path",{d:"M 6 4 L 10 16",...u({stroke:U,fill:"none"})});p(w,{element:Wt,ref:{x:0,y:10},scale:.5,parentGfx:T})}}function h(T,w,E,G,U={}){Qt(G)&&(U=G,G=0),G=G||0,U=u(U);var X=w/2,Ce=E/2,Ue=Oe("circle",{cx:X,cy:Ce,r:Math.round((w+E)/4-G),...U});return ze(T,Ue),Ue}function y(T,w,E,G,U,X){Qt(U)&&(X=U,U=0),U=U||0,X=u(X);var Ce=Oe("rect",{x:U,y:U,width:w-U*2,height:E-U*2,rx:G,ry:G,...X});return ze(T,Ce),Ce}function v(T,w,E,G){var U=w/2,X=E/2,Ce=[{x:U,y:0},{x:w,y:X},{x:U,y:E},{x:0,y:X}],Ue=Ce.map(function(Ot){return Ot.x+","+Ot.y}).join(" ");G=u(G);var st=Oe("polygon",{...G,points:Ue});return ze(T,st),st}function g(T,w,E,G){E=f(E);var U=la(w,E,G);return ze(T,U),U}function b(T,w,E){return g(T,w,E,5)}function x(T,w,E){E=f(E);var G=Oe("path",{...E,d:w});return ze(T,G),G}function C(T,w,E,G){return x(w,E,W({"data-marker":T},G))}function M(T){return yt[T]}function k(T){return function(w,E,G){return M(T)(w,E,G)}}var P={"bpmn:MessageEventDefinition":function(T,w,E={},G){var U=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:E.width||w.width,containerHeight:E.height||w.height,position:{mx:.235,my:.315}}),X=G?be(w,c,E.stroke):Ze(w,s,E.fill),Ce=G?Ze(w,s,E.fill):be(w,c,E.stroke),Ue=x(T,U,{fill:X,stroke:Ce,strokeWidth:1});return Ue},"bpmn:TimerEventDefinition":function(T,w,E={}){var G=E.width||w.width,U=E.height||w.height,X=E.width?1:2,Ce=h(T,G,U,.2*U,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:X}),Ue=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:G,containerHeight:U,position:{mx:.5,my:.5}});x(T,Ue,{stroke:be(w,c,E.stroke),strokeWidth:X});for(var st=0;st<12;st++){var Ot=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:G,containerHeight:U,position:{mx:.5,my:.5}}),pt=G/2,Wt=U/2;x(T,Ot,{strokeWidth:1,stroke:be(w,c,E.stroke),transform:"rotate("+st*30+","+Wt+","+pt+")"})}return Ce},"bpmn:EscalationEventDefinition":function(T,w,E={},G){var U=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width||w.width,containerHeight:E.height||w.height,position:{mx:.5,my:.2}}),X=G?be(w,c,E.stroke):Ze(w,s,E.fill);return x(T,U,{fill:X,stroke:be(w,c,E.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(T,w,E={}){var G=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width||w.width,containerHeight:E.height||w.height,position:{mx:.5,my:.222}});return x(T,G,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(T,w,E={},G){var U=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width,containerHeight:w.height,position:{mx:.57,my:.263}}),X=G?be(w,c,E.stroke):Ze(w,s,E.fill);return x(T,U,{fill:X,stroke:be(w,c,E.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(T,w,E={},G){var U=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:E.width||w.width,containerHeight:E.height||w.height,position:{mx:.2,my:.722}}),X=G?be(w,c,E.stroke):Ze(w,s,E.fill);return x(T,U,{fill:X,stroke:be(w,c,E.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(T,w,E={},G){var U=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width,containerHeight:w.height,position:{mx:.638,my:-.055}}),X=G?be(w,c,E.stroke):"none",Ce=x(T,U,{fill:X,stroke:be(w,c,E.stroke),strokeWidth:1});return eg(Ce,45),Ce},"bpmn:CompensateEventDefinition":function(T,w,E={},G){var U=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width||w.width,containerHeight:E.height||w.height,position:{mx:.22,my:.5}}),X=G?be(w,c,E.stroke):Ze(w,s,E.fill);return x(T,U,{fill:X,stroke:be(w,c,E.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(T,w,E={},G){var U=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:E.width||w.width,containerHeight:E.height||w.height,position:{mx:.5,my:.2}}),X=G?be(w,c,E.stroke):Ze(w,s,E.fill);return x(T,U,{strokeWidth:1,fill:X,stroke:be(w,c,E.stroke)})},"bpmn:MultipleEventDefinition":function(T,w,E={},G){var U=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:E.width||w.width,containerHeight:E.height||w.height,position:{mx:.211,my:.36}}),X=G?be(w,c,E.stroke):Ze(w,s,E.fill);return x(T,U,{fill:X,stroke:be(w,c,E.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(T,w,E={}){var G=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:E.width||w.width,containerHeight:E.height||w.height,position:{mx:.458,my:.194}});return x(T,G,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(T,w,E={}){var G=h(T,w.width,w.height,8,{fill:be(w,c,E.stroke),stroke:be(w,c,E.stroke),strokeWidth:4});return G}};function B(T,w,E={},G){var U=ie(T),X=AC(U),Ce=G||T;return U.get("eventDefinitions")&&U.get("eventDefinitions").length>1?U.get("parallelMultiple")?P["bpmn:ParallelMultipleEventDefinition"](w,Ce,E,X):P["bpmn:MultipleEventDefinition"](w,Ce,E,X):wi(U,"bpmn:MessageEventDefinition")?P["bpmn:MessageEventDefinition"](w,Ce,E,X):wi(U,"bpmn:TimerEventDefinition")?P["bpmn:TimerEventDefinition"](w,Ce,E,X):wi(U,"bpmn:ConditionalEventDefinition")?P["bpmn:ConditionalEventDefinition"](w,Ce,E,X):wi(U,"bpmn:SignalEventDefinition")?P["bpmn:SignalEventDefinition"](w,Ce,E,X):wi(U,"bpmn:EscalationEventDefinition")?P["bpmn:EscalationEventDefinition"](w,Ce,E,X):wi(U,"bpmn:LinkEventDefinition")?P["bpmn:LinkEventDefinition"](w,Ce,E,X):wi(U,"bpmn:ErrorEventDefinition")?P["bpmn:ErrorEventDefinition"](w,Ce,E,X):wi(U,"bpmn:CancelEventDefinition")?P["bpmn:CancelEventDefinition"](w,Ce,E,X):wi(U,"bpmn:CompensateEventDefinition")?P["bpmn:CompensateEventDefinition"](w,Ce,E,X):wi(U,"bpmn:TerminateEventDefinition")?P["bpmn:TerminateEventDefinition"](w,Ce,E,X):null}var D={ParticipantMultiplicityMarker:function(T,w,E={}){var G=Qn(w,E),U=In(w,E),X=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:U,position:{mx:(G/2-6)/G,my:(U-15)/U}});C("participant-multiplicity",T,X,{strokeWidth:2,fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke)})},SubProcessMarker:function(T,w,E={}){var G=y(T,14,14,0,{strokeWidth:1,fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke)});ln(G,w.width/2-7.5,w.height-20);var U=i.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:w.width,containerHeight:w.height,position:{mx:(w.width/2-7.5)/w.width,my:(w.height-20)/w.height}});C("sub-process",T,U,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke)})},ParallelMarker:function(T,w,E){var G=Qn(w,E),U=In(w,E),X=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:U,position:{mx:(G/2+E.parallel)/G,my:(U-20)/U}});C("parallel",T,X,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke)})},SequentialMarker:function(T,w,E){var G=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width,containerHeight:w.height,position:{mx:(w.width/2+E.seq)/w.width,my:(w.height-19)/w.height}});C("sequential",T,G,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke)})},CompensationMarker:function(T,w,E){var G=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width,containerHeight:w.height,position:{mx:(w.width/2+E.compensation)/w.width,my:(w.height-13)/w.height}});C("compensation",T,G,{strokeWidth:1,fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke)})},LoopMarker:function(T,w,E){var G=Qn(w,E),U=In(w,E),X=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:U,position:{mx:(G/2+E.loop)/G,my:(U-7)/U}});C("loop",T,X,{strokeWidth:1.5,fill:"none",stroke:be(w,c,E.stroke),strokeMiterlimit:.5})},AdhocMarker:function(T,w,E){var G=Qn(w,E),U=In(w,E),X=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:U,position:{mx:(G/2+E.adhoc)/G,my:(U-15)/U}});C("adhoc",T,X,{strokeWidth:1,fill:be(w,c,E.stroke),stroke:be(w,c,E.stroke)})}};function I(T,w,E,G){D[T](w,E,G)}function z(T,w,E=[],G={}){G={fill:G.fill,stroke:G.stroke,width:Qn(w,G),height:In(w,G)};var U=ie(w),X=E.includes("SubProcessMarker");X?G={...G,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:G={...G,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},U.get("isForCompensation")&&E.push("CompensationMarker"),S(U,"bpmn:AdHocSubProcess")&&(E.push("AdhocMarker"),X||W(G,{compensation:G.compensation-18}));var Ce=U.get("loopCharacteristics"),Ue=Ce&&Ce.get("isSequential");Ce&&(W(G,{compensation:G.compensation-18}),E.includes("AdhocMarker")&&W(G,{seq:-23,loop:-18,parallel:-24}),Ue===void 0&&E.push("LoopMarker"),Ue===!1&&E.push("ParallelMarker"),Ue===!0&&E.push("SequentialMarker")),E.includes("CompensationMarker")&&E.length===1&&W(G,{compensation:-8}),F(E,function(st){I(st,T,w,G)})}function oe(T,w,E={}){E=W({size:{width:100}},E);var G=o.createText(w||"",E);return et(G).add("djs-label"),ze(T,G),G}function ye(T,w,E,G={}){var U=ie(w),X=va({x:w.x,y:w.y,width:w.width,height:w.height},G);return oe(T,U.name,{align:E,box:X,padding:7,style:{fill:ya(w,l,c,G.stroke)}})}function Ve(T,w,E={}){var G={width:w.width,height:w.height,x:w.width/2+w.x,y:w.height/2+w.y};return oe(T,qn(w),{box:G,style:W({},o.getExternalStyle(),{fill:ya(w,l,c,E.stroke)})})}function He(T,w,E,G={}){var U=tn(E),X=oe(T,w,{box:{height:30,width:U?In(E,G):Qn(E,G)},align:"center-middle",style:{fill:ya(E,l,c,G.stroke)}});if(U){var Ce=-1*In(E,G);Ys(X,0,-Ce,270)}}function it(T,w,E={}){var{width:G,height:U}=va(w,E);return y(T,G,U,Qs,{...E,fill:Ze(w,s,E.fill),fillOpacity:Ro,stroke:be(w,c,E.stroke)})}function K(T,w,E={}){var G=ie(w),U=Ze(w,s,E.fill),X=be(w,c,E.stroke);return(G.get("associationDirection")==="One"||G.get("associationDirection")==="Both")&&(E.markerEnd=d(T,"association-end",U,X)),G.get("associationDirection")==="Both"&&(E.markerStart=d(T,"association-start",U,X)),E=at(E,["markerStart","markerEnd"]),b(T,w.waypoints,{...E,stroke:X,strokeDasharray:"0, 5"})}function Z(T,w,E={}){var G=Ze(w,s,E.fill),U=be(w,c,E.stroke),X=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width,containerHeight:w.height,position:{mx:.474,my:.296}}),Ce=x(T,X,{fill:G,fillOpacity:Ro,stroke:U}),Ue=ie(w);if(PC(Ue)){var st=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width,containerHeight:w.height,position:{mx:.33,my:(w.height-18)/w.height}});x(T,st,{strokeWidth:2,fill:G,stroke:U})}return Ce}function se(T,w,E={}){return h(T,w.width,w.height,{fillOpacity:Ro,...E,fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke)})}function xe(T,w,E={}){return v(T,w.width,w.height,{fill:Ze(w,s,E.fill),fillOpacity:Ro,stroke:be(w,c,E.stroke)})}function q(T,w,E={}){var G=y(T,Qn(w,E),In(w,E),0,{fill:Ze(w,s,E.fill),fillOpacity:E.fillOpacity||Ro,stroke:be(w,c,E.stroke),strokeWidth:1.5}),U=ie(w);if(S(U,"bpmn:Lane")){var X=U.get("name");He(T,X,w,E)}return G}function V(T,w,E={}){var G=it(T,w,E),U=Qe(w);if(vn(w)&&(Se(G,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!U)){var X=ie(w).flowElements||[],Ce=X.filter(Ue=>S(Ue,"bpmn:StartEvent"));Ce.length===1&&ne(Ce[0],T,E,w)}return ye(T,w,U?"center-top":"center-middle",E),U?z(T,w,void 0,E):z(T,w,["SubProcessMarker"],E),G}function ne(T,w,E,G){var U=22,X={fill:Ze(G,s,E.fill),stroke:be(G,c,E.stroke),width:U,height:U},Ce=ie(T).isInterrupting,Ue=Ce?0:3,st=Ce?1:1.2,Ot=20,pt=(U-Ot)/2,Wt="translate("+pt+","+pt+")";h(w,Ot,Ot,{fill:X.fill,stroke:X.stroke,strokeWidth:st,strokeDasharray:Ue,transform:Wt}),B(T,w,X,G)}function Te(T,w,E={}){var G=it(T,w,E);return ye(T,w,"center-middle",E),z(T,w,void 0,E),G}var yt=this.handlers={"bpmn:AdHocSubProcess":function(T,w,E={}){return Qe(w)?E=at(E,["fill","stroke","width","height"]):E=at(E,["fill","stroke"]),V(T,w,E)},"bpmn:Association":function(T,w,E={}){return E=at(E,["fill","stroke"]),K(T,w,E)},"bpmn:BoundaryEvent":function(T,w,E={}){var{renderIcon:G=!0}=E;E=at(E,["fill","stroke"]);var U=ie(w),X=U.get("cancelActivity");E={strokeWidth:1.5,fill:Ze(w,s,E.fill),fillOpacity:LC,stroke:be(w,c,E.stroke)},X||(E.strokeDasharray="6");var Ce=se(T,w,E);return h(T,w.width,w.height,Zs,{...E,fill:"none"}),G&&B(w,T,E),Ce},"bpmn:BusinessRuleTask":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=Te(T,w,E),U=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),X=x(T,U);Se(X,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:1});var Ce=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),Ue=x(T,Ce);return Se(Ue,{fill:be(w,c,E.stroke),stroke:be(w,c,E.stroke),strokeWidth:1}),G},"bpmn:CallActivity":function(T,w,E={}){return E=at(E,["fill","stroke"]),V(T,w,{strokeWidth:5,...E})},"bpmn:ComplexGateway":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=xe(T,w,E),U=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:w.width,containerHeight:w.height,position:{mx:.46,my:.26}});return x(T,U,{fill:be(w,c,E.stroke),stroke:be(w,c,E.stroke),strokeWidth:1}),G},"bpmn:DataInput":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=i.getRawPath("DATA_ARROW"),U=Z(T,w,E);return x(T,G,{fill:"none",stroke:be(w,c,E.stroke),strokeWidth:1}),U},"bpmn:DataInputAssociation":function(T,w,E={}){return E=at(E,["fill","stroke"]),K(T,w,{...E,markerEnd:d(T,"association-end",Ze(w,s,E.fill),be(w,c,E.stroke))})},"bpmn:DataObject":function(T,w,E={}){return E=at(E,["fill","stroke"]),Z(T,w,E)},"bpmn:DataObjectReference":k("bpmn:DataObject"),"bpmn:DataOutput":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=i.getRawPath("DATA_ARROW"),U=Z(T,w,E);return x(T,G,{strokeWidth:1,fill:be(w,c,E.stroke),stroke:be(w,c,E.stroke)}),U},"bpmn:DataOutputAssociation":function(T,w,E={}){return E=at(E,["fill","stroke"]),K(T,w,{...E,markerEnd:d(T,"association-end",Ze(w,s,E.fill),be(w,c,E.stroke))})},"bpmn:DataStoreReference":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width,containerHeight:w.height,position:{mx:0,my:.133}});return x(T,G,{fill:Ze(w,s,E.fill),fillOpacity:Ro,stroke:be(w,c,E.stroke),strokeWidth:2})},"bpmn:EndEvent":function(T,w,E={}){var{renderIcon:G=!0}=E;E=at(E,["fill","stroke"]);var U=se(T,w,{...E,strokeWidth:4});return G&&B(w,T,E),U},"bpmn:EventBasedGateway":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=ie(w),U=xe(T,w,E);h(T,w.width,w.height,w.height*.2,{fill:Ze(w,"none",E.fill),stroke:be(w,c,E.stroke),strokeWidth:1});var X=G.get("eventGatewayType"),Ce=!!G.get("instantiate");function Ue(){var Ot=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:w.width,containerHeight:w.height,position:{mx:.36,my:.44}});x(T,Ot,{fill:"none",stroke:be(w,c,E.stroke),strokeWidth:2})}if(X==="Parallel"){var st=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:w.width,containerHeight:w.height,position:{mx:.474,my:.296}});x(T,st,{fill:"none",stroke:be(w,c,E.stroke),strokeWidth:1})}else X==="Exclusive"&&(Ce||h(T,w.width,w.height,w.height*.26,{fill:"none",stroke:be(w,c,E.stroke),strokeWidth:1}),Ue());return U},"bpmn:ExclusiveGateway":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=xe(T,w,E),U=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:w.width,containerHeight:w.height,position:{mx:.32,my:.3}}),X=ot(w);return X.get("isMarkerVisible")&&x(T,U,{fill:be(w,c,E.stroke),stroke:be(w,c,E.stroke),strokeWidth:1}),G},"bpmn:Gateway":function(T,w,E={}){return E=at(E,["fill","stroke"]),xe(T,w,E)},"bpmn:Group":function(T,w,E={}){return E=at(E,["fill","stroke","width","height"]),y(T,w.width,w.height,Qs,{stroke:be(w,c,E.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:Qn(w,E),height:In(w,E)})},"bpmn:InclusiveGateway":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=xe(T,w,E);return h(T,w.width,w.height,w.height*.24,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:2.5}),G},"bpmn:IntermediateEvent":function(T,w,E={}){var{renderIcon:G=!0}=E;E=at(E,["fill","stroke"]);var U=se(T,w,{...E,strokeWidth:1.5});return h(T,w.width,w.height,Zs,{fill:"none",stroke:be(w,c,E.stroke),strokeWidth:1.5}),G&&B(w,T,E),U},"bpmn:IntermediateCatchEvent":k("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":k("bpmn:IntermediateEvent"),"bpmn:Lane":function(T,w,E={}){return E=at(E,["fill","stroke","width","height"]),q(T,w,{...E,fillOpacity:BC})},"bpmn:ManualTask":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=Te(T,w,E),U=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return x(T,U,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:.5}),G},"bpmn:MessageFlow":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=ie(w),U=ot(w),X=Ze(w,s,E.fill),Ce=be(w,c,E.stroke),Ue=b(T,w.waypoints,{markerEnd:d(T,"messageflow-end",X,Ce),markerStart:d(T,"messageflow-start",X,Ce),stroke:Ce,strokeDasharray:"10, 11",strokeWidth:1.5});if(G.get("messageRef")){var st=Ue.getPointAtLength(Ue.getTotalLength()/2),Ot=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:st.x,y:st.y}}),pt={strokeWidth:1};U.get("messageVisibleKind")==="initiating"?(pt.fill=X,pt.stroke=Ce):(pt.fill=Ce,pt.stroke=X);var Wt=x(T,Ot,pt),nn=G.get("messageRef"),rn=nn.get("name"),xt=oe(T,rn,{align:"center-top",fitBox:!0,style:{fill:Ce}}),Dt=Wt.getBBox(),bn=xt.getBBox(),Pr=st.x-bn.width/2,jn=st.y+Dt.height/2+OC;Ys(xt,Pr,jn,0)}return Ue},"bpmn:ParallelGateway":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=xe(T,w,E),U=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:w.width,containerHeight:w.height,position:{mx:.46,my:.2}});return x(T,U,{fill:be(w,c,E.stroke),stroke:be(w,c,E.stroke),strokeWidth:1}),G},"bpmn:Participant":function(T,w,E={}){E=at(E,["fill","stroke","width","height"]);var G=q(T,w,E),U=Qe(w),X=tn(w),Ce=ie(w),Ue=Ce.get("name");if(U){var st=X?[{x:30,y:0},{x:30,y:In(w,E)}]:[{x:0,y:30},{x:Qn(w,E),y:30}];g(T,st,{stroke:be(w,c,E.stroke),strokeWidth:DC}),He(T,Ue,w,E)}else{var Ot=va(w,E);X||(Ot.height=Qn(w,E),Ot.width=In(w,E));var pt=oe(T,Ue,{box:Ot,align:"center-middle",style:{fill:ya(w,l,c,E.stroke)}});if(!X){var Wt=-1*In(w,E);Ys(pt,0,-Wt,270)}}return Ce.get("participantMultiplicity")&&I("ParticipantMultiplicityMarker",T,w,E),G},"bpmn:ReceiveTask":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=ie(w),U=Te(T,w,E),X;return G.get("instantiate")?(h(T,28,28,20*.22,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:1}),X=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):X=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),x(T,X,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:1}),U},"bpmn:ScriptTask":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=Te(T,w,E),U=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return x(T,U,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:1}),G},"bpmn:SendTask":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=Te(T,w,E),U=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return x(T,U,{fill:be(w,c,E.stroke),stroke:Ze(w,s,E.fill),strokeWidth:1}),G},"bpmn:SequenceFlow":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=Ze(w,s,E.fill),U=be(w,c,E.stroke),X=b(T,w.waypoints,{markerEnd:d(T,"sequenceflow-end",G,U),stroke:U}),Ce=ie(w),{source:Ue}=w;if(Ue){var st=ie(Ue);Ce.get("conditionExpression")&&S(st,"bpmn:Activity")&&Se(X,{markerStart:d(T,"conditional-flow-marker",G,U)}),st.get("default")&&(S(st,"bpmn:Gateway")||S(st,"bpmn:Activity"))&&st.get("default")===Ce&&Se(X,{markerStart:d(T,"conditional-default-flow-marker",G,U)})}return X},"bpmn:ServiceTask":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=Te(T,w,E);h(T,10,10,{fill:Ze(w,s,E.fill),stroke:"none",transform:"translate(6, 6)"});var U=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});x(T,U,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:1}),h(T,10,10,{fill:Ze(w,s,E.fill),stroke:"none",transform:"translate(11, 10)"});var X=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return x(T,X,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:1}),G},"bpmn:StartEvent":function(T,w,E={}){var{renderIcon:G=!0}=E;E=at(E,["fill","stroke"]);var U=ie(w);U.get("isInterrupting")||(E={...E,strokeDasharray:"6"});var X=se(T,w,E);return G&&B(w,T,E),X},"bpmn:SubProcess":function(T,w,E={}){return Qe(w)?E=at(E,["fill","stroke","width","height"]):E=at(E,["fill","stroke"]),V(T,w,E)},"bpmn:Task":function(T,w,E={}){return E=at(E,["fill","stroke"]),Te(T,w,E)},"bpmn:TextAnnotation":function(T,w,E={}){E=at(E,["fill","stroke"]);var{width:G,height:U}=va(w,E),X=y(T,G,U,0,0,{fill:"none",stroke:"none"}),Ce=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:U,position:{mx:0,my:0}});x(T,Ce,{stroke:be(w,c,E.stroke)});var Ue=ie(w),st=Ue.get("text")||"";return oe(T,st,{align:"left-top",box:va(w,E),padding:So,style:{fill:ya(w,l,c,E.stroke)}}),X},"bpmn:Transaction":function(T,w,E={}){Qe(w)?E=at(E,["fill","stroke","width","height"]):E=at(E,["fill","stroke"]);var G=V(T,w,{strokeWidth:1.5,...E}),U=n.style(["no-fill","no-events"],{stroke:be(w,c,E.stroke),strokeWidth:1.5}),X=Qe(w);return X||(E={}),y(T,Qn(w,E),In(w,E),Qs-Zs,Zs,U),G},"bpmn:UserTask":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=Te(T,w,E),U=15,X=12,Ce=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:U,y:X}});x(T,Ce,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:.5});var Ue=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:U,y:X}});x(T,Ue,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:.5});var st=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:U,y:X}});return x(T,st,{fill:be(w,c,E.stroke),stroke:be(w,c,E.stroke),strokeWidth:.5}),G},label:function(T,w,E={}){return Ve(T,w,E)}};this._drawPath=x,this._renderer=M}Ee(jr,Ii),jr.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],jr.prototype.canRender=function(e){return S(e,"bpmn:BaseElement")},jr.prototype.drawShape=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},jr.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},jr.prototype.getShapePath=function(e){return Ye(e)?Ku(e,IC):S(e,"bpmn:Event")?ug(e):S(e,"bpmn:Activity")?Ku(e,Qs):S(e,"bpmn:Gateway")?MC(e):TC(e)};function at(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var NC=0,$C={width:150,height:50};function FC(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function jC(e){return Qt(e)?W({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var Xu=null;function HC(){return Xu||(Xu=document.createElement("canvas").getContext("2d")),Xu}function zC(e){var t=[];return e.fontStyle&&t.push(e.fontStyle),e.fontVariant&&t.push(e.fontVariant),e.fontWeight&&t.push(e.fontWeight),e.fontStretch&&t.push(e.fontStretch),t.push(pg(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function pg(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function GC(e,t){var n=HC();if(!n)return{width:0,height:0};n.font=zC(t),"letterSpacing"in n&&(n.letterSpacing=pg(t.letterSpacing)||"0px");var i=e==="",r=i?"dummy":e.replace(/\s+$/,""),o=n.measureText(r);return{width:i?0:o.width,height:"fontBoundingBoxAscent"in o?o.fontBoundingBoxAscent+o.fontBoundingBoxDescent:o.actualBoundingBoxAscent+o.actualBoundingBoxDescent}}function VC(e,t,n){for(var i=e.shift(),r=i,o;;){if(o=GC(r,n),o.width=r?o.width:0,r===" "||r===""||o.width<Math.round(t)||r.length<2)return WC(e,r,i,o);r=YC(r,o.width,t)}}function WC(e,t,n,i){if(t.length<n.length){var r=n.slice(t.length).trim();e.unshift(r)}return{width:i.width,height:i.height,text:t}}var fg="";function UC(e,t){var n=e.split(/(\s|-|\u00AD)/g),i,r=[],o=0;if(n.length>1)for(;i=n.shift();)if(i.length+o<t)r.push(i),o+=i.length;else{(i==="-"||i===fg)&&r.pop();break}var a=r[r.length-1];return a&&a===fg&&(r[r.length-1]="-"),r.join("")}function YC(e,t,n){var i=Math.max(e.length*(n/t),1),r=UC(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function Js(e){this._config=W({},{size:$C,padding:NC,style:{},align:"center-top"},e||{})}Js.prototype.createText=function(e,t){return this.layoutText(e,t).element},Js.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Js.prototype.layoutText=function(e,t){for(var n=W({},this._config.size,t.box),i=W({},this._config.style,t.style),r=FC(t.align||this._config.align),o=jC(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=qC(i),c=e.split(/\u00AD?\r?\n/),l=[],u=n.width-o.left-o.right;c.length;)l.push(VC(c,u,i));r.vertical==="middle"&&(o.top=o.bottom=0);var f=Tn(l,function(y,v,g){return y+(s||v.height)},0)+o.top+o.bottom,p=Tn(l,function(y,v,g){return v.width>y?v.width:y},0),d=o.top;r.vertical==="middle"&&(d+=(n.height-f)/2),d-=(s||l[0].height)/4;var m=Oe("text");Se(m,i),F(l,function(y){var v;switch(d+=s||y.height,r.horizontal){case"left":v=o.left;break;case"right":v=(a?p:u)-o.right-y.width;break;default:v=Math.max(((a?p:u)-y.width)/2+o.left,0)}var g=Oe("tspan");Se(g,{x:v,y:d}),g.textContent=y.text,ze(m,g)});var h={width:p,height:f};return{dimensions:h,element:m}};function qC(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var KC=12,XC=1.2,ZC=40;function dg(e){var t=W({fontFamily:"Arial, sans-serif",fontSize:KC,fontWeight:"normal",lineHeight:XC},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=W({},t,{fontSize:n},e&&e.externalStyle||{}),r=new Js({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,Fr.width),height:30},l=o(s,c,{style:i});return{x:Math.round(a.x+a.width/2-l.width/2),y:a.y,width:Math.ceil(l.width),height:Math.ceil(l.height)}},this.getTextAnnotationBounds=function(a,s){var c=o(s,a,{style:t,align:"left-top",padding:So});return{x:a.x,y:a.y,width:a.width,height:Math.max(ZC,Math.round(c.height))}},this.getDimensions=function(a,s){return r.getDimensions(a,s||{})};function o(a,s,c){return r.getDimensions(a,W({box:s},c))}this.createText=function(a,s){return r.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}dg.$inject=["config.textRenderer"];function QC(){this.pathMap={EVENT_MESSAGE:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:36,width:36,heightElements:[6,14],widthElements:[10.5,21]},EVENT_SIGNAL:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x1},0 Z",height:36,width:36,heightElements:[18],widthElements:[10,20]},EVENT_ESCALATION:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x0},-{e.y1} l -{e.x0},{e.y1} Z",height:36,width:36,heightElements:[20,7],widthElements:[8]},EVENT_CONDITIONAL:{d:"M {e.x0},{e.y0} l {e.x1},0 l 0,{e.y2} l -{e.x1},0 Z M {e.x2},{e.y3} l {e.x0},0 M {e.x2},{e.y4} l {e.x0},0 M {e.x2},{e.y5} l {e.x0},0 M {e.x2},{e.y6} l {e.x0},0 M {e.x2},{e.y7} l {e.x0},0 M {e.x2},{e.y8} l {e.x0},0 ",height:36,width:36,heightElements:[8.5,14.5,18,11.5,14.5,17.5,20.5,23.5,26.5],widthElements:[10.5,14.5,12.5]},EVENT_LINK:{d:"m {mx},{my} 0,{e.y0} -{e.x1},0 0,{e.y1} {e.x1},0 0,{e.y0} {e.x0},-{e.y2} -{e.x0},-{e.y2} z",height:36,width:36,heightElements:[4.4375,6.75,7.8125],widthElements:[9.84375,13.5]},EVENT_ERROR:{d:"m {mx},{my} {e.x0},-{e.y0} {e.x1},-{e.y1} {e.x2},{e.y2} {e.x3},-{e.y3} -{e.x4},{e.y4} -{e.x5},-{e.y5} z",height:36,width:36,heightElements:[.023,8.737,8.151,16.564,10.591,8.714],widthElements:[.085,6.672,6.97,4.273,5.337,6.636]},EVENT_CANCEL_45:{d:"m {mx},{my} -{e.x1},0 0,{e.x0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:36,width:36,heightElements:[4.75,8.5],widthElements:[4.75,8.5]},EVENT_COMPENSATION:{d:"m {mx},{my} {e.x0},-{e.y0} 0,{e.y1} z m {e.x1},-{e.y2} {e.x2},-{e.y3} 0,{e.y1} -{e.x2},-{e.y3} z",height:36,width:36,heightElements:[6.5,13,.4,6.1],widthElements:[9,9.3,8.7]},EVENT_TIMER_WH:{d:"M {mx},{my} l {e.x0},-{e.y0} m -{e.x0},{e.y0} l {e.x1},{e.y1} ",height:36,width:36,heightElements:[10,2],widthElements:[3,7]},EVENT_TIMER_LINE:{d:"M {mx},{my} m {e.x0},{e.y0} l -{e.x1},{e.y1} ",height:36,width:36,heightElements:[10,3],widthElements:[0,0]},EVENT_MULTIPLE:{d:"m {mx},{my} {e.x1},-{e.y0} {e.x1},{e.y0} -{e.x0},{e.y1} -{e.x2},0 z",height:36,width:36,heightElements:[6.28099,12.56199],widthElements:[3.1405,9.42149,12.56198]},EVENT_PARALLEL_MULTIPLE:{d:"m {mx},{my} {e.x0},0 0,{e.y1} {e.x1},0 0,{e.y0} -{e.x1},0 0,{e.y1} -{e.x0},0 0,-{e.y1} -{e.x1},0 0,-{e.y0} {e.x1},0 z",height:36,width:36,heightElements:[2.56228,7.68683],widthElements:[2.56228,7.68683]},GATEWAY_EXCLUSIVE:{d:"m {mx},{my} {e.x0},{e.y0} {e.x1},{e.y0} {e.x2},0 {e.x4},{e.y2} {e.x4},{e.y1} {e.x2},0 {e.x1},{e.y3} {e.x0},{e.y3} {e.x3},0 {e.x5},{e.y1} {e.x5},{e.y2} {e.x3},0 z",height:17.5,width:17.5,heightElements:[8.5,6.5312,-6.5312,-8.5],widthElements:[6.5,-6.5,3,-3,5,-5]},GATEWAY_PARALLEL:{d:"m {mx},{my} 0,{e.y1} -{e.x1},0 0,{e.y0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:30,width:30,heightElements:[5,12.5],widthElements:[5,12.5]},GATEWAY_EVENT_BASED:{d:"m {mx},{my} {e.x0},{e.y0} {e.x0},{e.y1} {e.x1},{e.y2} {e.x2},0 z",height:11,width:11,heightElements:[-6,6,12,-12],widthElements:[9,-3,-12]},GATEWAY_COMPLEX:{d:"m {mx},{my} 0,{e.y0} -{e.x0},-{e.y1} -{e.x1},{e.y2} {e.x0},{e.y1} -{e.x2},0 0,{e.y3} {e.x2},0 -{e.x0},{e.y1} l {e.x1},{e.y2} {e.x0},-{e.y1} 0,{e.y0} {e.x3},0 0,-{e.y0} {e.x0},{e.y1} {e.x1},-{e.y2} -{e.x0},-{e.y1} {e.x2},0 0,-{e.y3} -{e.x2},0 {e.x0},-{e.y1} -{e.x1},-{e.y2} -{e.x0},{e.y1} 0,-{e.y0} -{e.x3},0 z",height:17.125,width:17.125,heightElements:[4.875,3.4375,2.125,3],widthElements:[3.4375,2.125,4.875,3]},DATA_OBJECT_PATH:{d:"m 0,0 {e.x1},0 {e.x0},{e.y0} 0,{e.y1} -{e.x2},0 0,-{e.y2} {e.x1},0 0,{e.y0} {e.x0},0",height:61,width:51,heightElements:[10,50,60],widthElements:[10,40,50,60]},DATA_OBJECT_COLLECTION_PATH:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},DATA_ARROW:{d:"m 5,9 9,0 0,-3 5,5 -5,5 0,-3 -9,0 z",height:61,width:51,heightElements:[],widthElements:[]},DATA_STORE:{d:"m {mx},{my} l 0,{e.y2} c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 l 0,-{e.y2} c -{e.x0},-{e.y1} -{e.x1},-{e.y1} -{e.x2},0c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0",height:61,width:61,heightElements:[7,10,45],widthElements:[2,58,60]},TEXT_ANNOTATION:{d:"m {mx}, {my} m 10,0 l -10,0 l 0,{e.y0} l 10,0",height:30,width:10,heightElements:[30],widthElements:[10]},MARKER_SUB_PROCESS:{d:"m{mx},{my} m 7,2 l 0,10 m -5,-5 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_PARALLEL:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},MARKER_SEQUENTIAL:{d:"m{mx},{my} m 0,3 l 10,0 m -10,3 l 10,0 m -10,3 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_COMPENSATION:{d:"m {mx},{my} 7,-5 0,10 z m 7.1,-0.3 6.9,-4.7 0,10 -6.9,-4.7 z",height:10,width:21,heightElements:[],widthElements:[]},MARKER_LOOP:{d:"m {mx},{my} c 3.526979,0 6.386161,-2.829858 6.386161,-6.320661 0,-3.490806 -2.859182,-6.320661 -6.386161,-6.320661 -3.526978,0 -6.38616,2.829855 -6.38616,6.320661 0,1.745402 0.714797,3.325567 1.870463,4.469381 0.577834,0.571908 1.265885,1.034728 2.029916,1.35457 l -0.718163,-3.909793 m 0.718163,3.909793 -3.885211,0.802902",height:13.9,width:13.7,heightElements:[],widthElements:[]},MARKER_ADHOC:{d:"m {mx},{my} m 0.84461,2.64411 c 1.05533,-1.23780996 2.64337,-2.07882 4.29653,-1.97997996 2.05163,0.0805 3.85579,1.15803 5.76082,1.79107 1.06385,0.34139996 2.24454,0.1438 3.18759,-0.43767 0.61743,-0.33642 1.2775,-0.64078 1.7542,-1.17511 0,0.56023 0,1.12046 0,1.6807 -0.98706,0.96237996 -2.29792,1.62393996 -3.6918,1.66181996 -1.24459,0.0927 -2.46671,-0.2491 -3.59505,-0.74812 -1.35789,-0.55965 -2.75133,-1.33436996 -4.27027,-1.18121996 -1.37741,0.14601 -2.41842,1.13685996 -3.44288,1.96782996 z",height:4,width:15,heightElements:[],widthElements:[]},TASK_TYPE_SEND:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:14,width:21,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_SCRIPT:{d:"m {mx},{my} c 9.966553,-6.27276 -8.000926,-7.91932 2.968968,-14.938 l -8.802728,0 c -10.969894,7.01868 6.997585,8.66524 -2.968967,14.938 z m -7,-12 l 5,0 m -4.5,3 l 4.5,0 m -3,3 l 5,0m -4,3 l 5,0",height:15,width:12.6,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_USER_1:{d:"m {mx},{my} c 0.909,-0.845 1.594,-2.049 1.594,-3.385 0,-2.554 -1.805,-4.62199999 -4.357,-4.62199999 -2.55199998,0 -4.28799998,2.06799999 -4.28799998,4.62199999 0,1.348 0.974,2.562 1.89599998,3.405 -0.52899998,0.187 -5.669,2.097 -5.794,4.7560005 v 6.718 h 17 v -6.718 c 0,-2.2980005 -5.5279996,-4.5950005 -6.0509996,-4.7760005 zm -8,6 l 0,5.5 m 11,0 l 0,-5"},TASK_TYPE_USER_2:{d:"m {mx},{my} m 2.162,1.009 c 0,2.4470005 -2.158,4.4310005 -4.821,4.4310005 -2.66499998,0 -4.822,-1.981 -4.822,-4.4310005 "},TASK_TYPE_USER_3:{d:"m {mx},{my} m -6.9,-3.80 c 0,0 2.25099998,-2.358 4.27399998,-1.177 2.024,1.181 4.221,1.537 4.124,0.965 -0.098,-0.57 -0.117,-3.79099999 -4.191,-4.13599999 -3.57499998,0.001 -4.20799998,3.36699999 -4.20699998,4.34799999 z"},TASK_TYPE_MANUAL:{d:"m {mx},{my} c 0.234,-0.01 5.604,0.008 8.029,0.004 0.808,0 1.271,-0.172 1.417,-0.752 0.227,-0.898 -0.334,-1.314 -1.338,-1.316 -2.467,-0.01 -7.886,-0.004 -8.108,-0.004 -0.014,-0.079 0.016,-0.533 0,-0.61 0.195,-0.042 8.507,0.006 9.616,0.002 0.877,-0.007 1.35,-0.438 1.353,-1.208 0.003,-0.768 -0.479,-1.09 -1.35,-1.091 -2.968,-0.002 -9.619,-0.013 -9.619,-0.013 v -0.591 c 0,0 5.052,-0.016 7.225,-0.016 0.888,-0.002 1.354,-0.416 1.351,-1.193 -0.006,-0.761 -0.492,-1.196 -1.361,-1.196 -3.473,-0.005 -10.86,-0.003 -11.0829995,-0.003 -0.022,-0.047 -0.045,-0.094 -0.069,-0.139 0.3939995,-0.319 2.0409995,-1.626 2.4149995,-2.017 0.469,-0.4870005 0.519,-1.1650005 0.162,-1.6040005 -0.414,-0.511 -0.973,-0.5 -1.48,-0.236 -1.4609995,0.764 -6.5999995,3.6430005 -7.7329995,4.2710005 -0.9,0.499 -1.516,1.253 -1.882,2.19 -0.37000002,0.95 -0.17,2.01 -0.166,2.979 0.004,0.718 -0.27300002,1.345 -0.055,2.063 0.629,2.087 2.425,3.312 4.859,3.318 4.6179995,0.014 9.2379995,-0.139 13.8569995,-0.158 0.755,-0.004 1.171,-0.301 1.182,-1.033 0.012,-0.754 -0.423,-0.969 -1.183,-0.973 -1.778,-0.01 -5.824,-0.004 -6.04,-0.004 10e-4,-0.084 0.003,-0.586 10e-4,-0.67 z"},TASK_TYPE_INSTANTIATING_SEND:{d:"m {mx},{my} l 0,8.4 l 12.6,0 l 0,-8.4 z l 6.3,3.6 l 6.3,-3.6"},TASK_TYPE_SERVICE:{d:"m {mx},{my} v -1.71335 c 0.352326,-0.0705 0.703932,-0.17838 1.047628,-0.32133 0.344416,-0.14465 0.665822,-0.32133 0.966377,-0.52145 l 1.19431,1.18005 1.567487,-1.57688 -1.195028,-1.18014 c 0.403376,-0.61394 0.683079,-1.29908 0.825447,-2.01824 l 1.622133,-0.01 v -2.2196 l -1.636514,0.01 c -0.07333,-0.35153 -0.178319,-0.70024 -0.323564,-1.04372 -0.145244,-0.34406 -0.321407,-0.6644 -0.522735,-0.96217 l 1.131035,-1.13631 -1.583305,-1.56293 -1.129598,1.13589 c -0.614052,-0.40108 -1.302883,-0.68093 -2.022633,-0.82247 l 0.0093,-1.61852 h -2.241173 l 0.0042,1.63124 c -0.353763,0.0736 -0.705369,0.17977 -1.049785,0.32371 -0.344415,0.14437 -0.665102,0.32092 -0.9635006,0.52046 l -1.1698628,-1.15823 -1.5667691,1.5792 1.1684265,1.15669 c -0.4026573,0.61283 -0.68308,1.29797 -0.8247287,2.01713 l -1.6588041,0.003 v 2.22174 l 1.6724648,-0.006 c 0.073327,0.35077 0.1797598,0.70243 0.3242851,1.04472 0.1452428,0.34448 0.3214064,0.6644 0.5227339,0.96066 l -1.1993431,1.19723 1.5840256,1.56011 1.1964668,-1.19348 c 0.6140517,0.40346 1.3028827,0.68232 2.0233517,0.82331 l 7.19e-4,1.69892 h 2.226848 z m 0.221462,-3.9957 c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_SERVICE_FILL:{d:"m {mx},{my} c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_BUSINESS_RULE_HEADER:{d:"m {mx},{my} 0,4 20,0 0,-4 z"},TASK_TYPE_BUSINESS_RULE_MAIN:{d:"m {mx},{my} 0,12 20,0 0,-12 zm 0,8 l 20,0 m -13,-4 l 0,8"},MESSAGE_FLOW_MARKER:{d:"m {mx},{my} m -10.5 ,-7 l 0,14 l 21,0 l 0,-14 z l 10.5,6 l 10.5,-6"}},this.getRawPath=function(t){return this.pathMap[t].d},this.getScaledPath=function(t,n){var i=this.pathMap[t],r,o;n.abspos?(r=n.abspos.x,o=n.abspos.y):(r=n.containerWidth*n.position.mx,o=n.containerHeight*n.position.my);var a={};if(n.position){for(var s=n.containerHeight/i.height*n.yScaleFactor,c=n.containerWidth/i.width*n.xScaleFactor,l=0;l<i.heightElements.length;l++)a["y"+l]=i.heightElements[l]*s;for(var u=0;u<i.widthElements.length;u++)a["x"+u]=i.widthElements[u]*c}var f=nA(i.d,{mx:r,my:o,e:a});return f}}var JC=/\{([^{}]+)\}/g,eA=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function tA(e,t,n){var i=n;return t.replace(eA,function(r,o,a,s,c){o=o||s,i&&(o in i&&(i=i[o]),typeof i=="function"&&c&&(i=i()))}),i=(i==null||i==n?e:i)+"",i}function nA(e,t){return String(e).replace(JC,function(n,i){return tA(n,i,t)})}const iA={__init__:["bpmnRenderer"],bpmnRenderer:["type",jr],textRenderer:["type",dg],pathMap:["type",QC]};function rA(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const ba={translate:["value",rA]};function ec(e,t,n){return W({id:e.id,type:e.$type,businessObject:e,di:t},n)}function oA(e,t,n){var i=e.waypoint;return!i||i.length<2?[Ne(t),Ne(n)]:i.map(function(r){return{x:r.x,y:r.y}})}function hg(e,t,n){return new Error(`element ${yn(t)} referenced by ${yn(e)}#${n} not yet drawn`)}function $i(e,t,n,i,r){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=r}$i.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],$i.prototype.add=function(e,t,n){var i,r,o;if(S(t,"bpmndi:BPMNPlane")){var a=S(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(ec(e,t,a)),this._canvas.addRootElement(i)}else if(S(t,"bpmndi:BPMNShape")){var s=!Qe(e,t),c=sA(e);r=n&&(n.hidden||n.collapsed);var l=t.bounds;i=this._elementFactory.createShape(ec(e,t,{collapsed:s,hidden:r,x:Math.round(l.x),y:Math.round(l.y),width:Math.round(l.width),height:Math.round(l.height),isFrame:c})),S(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),S(e,"bpmn:Lane")&&(o=0),S(e,"bpmn:DataStoreReference")&&(aA(n,Ne(l))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,o)}else if(S(t,"bpmndi:BPMNEdge")){var u=this._getSource(e),f=this._getTarget(e);r=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(ec(e,t,{hidden:r,source:u,target:f,waypoints:oA(t,u,f)})),S(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,o)}else throw new Error(`unknown di ${yn(t)} for element ${yn(e)}`);return sr(e)&&qn(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},$i.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${yn(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),r=i&&i.attachers;if(!i)throw hg(e,n,"attachedToRef");t.host=i,r||(i.attachers=r=[]),r.indexOf(t)===-1&&r.push(t)},$i.prototype.addLabel=function(e,t,n){var i,r,o;return i=wC(t,n),r=qn(n),r&&(i=this._textRenderer.getExternalLabelBounds(i,r)),o=this._elementFactory.createLabel(ec(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!qn(n),x:Math.round(i.x),y:Math.round(i.y),width:Math.round(i.width),height:Math.round(i.height)})),this._canvas.addShape(o,n.parent)},$i.prototype._getConnectedElement=function(e,t){var n,i,r=e.$type;if(i=e[t+"Ref"],t==="source"&&r==="bpmn:DataInputAssociation"&&(i=i&&i[0]),(t==="source"&&r==="bpmn:DataOutputAssociation"||t==="target"&&r==="bpmn:DataInputAssociation")&&(i=e.$parent),n=i&&this._getElement(i),n)return n;throw i?hg(e,i,t+"Ref"):new Error(`${yn(e)}#${t} Ref not specified`)},$i.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},$i.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},$i.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function aA(e,t){var n=t.x,i=t.y;return n>=e.x&&n<=e.x+e.width&&i>=e.y&&i<=e.y+e.height}function sA(e){return S(e,"bpmn:Group")}const mg={__depends__:[iA,{__depends__:[ba],bpmnImporter:["type",$i]}]};function xa(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function pi(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Zu(e){return Math.log(e)/Math.log(10)}var cA=1e3;function te(e){this._eventBus=e}te.$inject=["eventBus"];function lA(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}te.prototype.on=function(e,t,n,i,r,o){if((Jt(t)||Fe(t))&&(o=r,r=i,i=n,n=t,t=null),Jt(n)&&(o=r,r=i,i=n,n=cA),Qt(r)&&(o=r,r=!1),!Jt(i))throw new Error("handlerFn must be a function");Be(e)||(e=[e]);var a=this._eventBus;F(e,function(s){var c=["commandStack",s,t].filter(function(l){return l}).join(".");a.on(c,n,r?lA(i,o):i,o)})},te.prototype.canExecute=Fi("canExecute"),te.prototype.preExecute=Fi("preExecute"),te.prototype.preExecuted=Fi("preExecuted"),te.prototype.execute=Fi("execute"),te.prototype.executed=Fi("executed"),te.prototype.postExecute=Fi("postExecute"),te.prototype.postExecuted=Fi("postExecuted"),te.prototype.revert=Fi("revert"),te.prototype.reverted=Fi("reverted");function Fi(e){return function(n,i,r,o,a){(Jt(n)||Fe(n))&&(a=o,o=r,r=i,i=n,n=null),this.on(n,e,i,r,o,a)}}var Qu=["top","bottom","left","right"],tc=10;function Ju(e,t){te.call(this,e),this.postExecuted(["connection.create","connection.layout","connection.updateWaypoints"],function(r){var o=r.context,a=o.connection,s=a.source,c=a.target,l=o.hints||{};l.createElementsBehavior!==!1&&(n(s),n(c))}),this.postExecuted(["label.create"],function(r){var o=r.context,a=o.shape,s=o.hints||{};s.createElementsBehavior!==!1&&n(a.labelTarget)}),this.postExecuted(["elements.create"],function(r){var o=r.context,a=o.elements,s=o.hints||{};s.createElementsBehavior!==!1&&a.forEach(function(c){n(c)})});function n(r){if(Xs(r)&&!ht(r)){var o=fA(r);o&&i(r,o)}}function i(r,o){var a=Ne(r),s=r.label,c=Ne(s);if(s.parent){var l=Ie(r),u;switch(o){case"top":u={x:a.x,y:l.top-tc-s.height/2};break;case"left":u={x:l.left-tc-s.width/2,y:a.y};break;case"bottom":u={x:a.x,y:l.bottom+tc+s.height/2};break;case"right":u={x:l.right+tc+s.width/2,y:a.y};break}var f=pi(u,c);t.moveShape(s,f)}}}Ee(Ju,te),Ju.$inject=["eventBus","modeling"];function uA(e){var t=e.host,n=Ne(e),i=cn(n,t),r;i.indexOf("-")>=0?r=i.split("-"):r=[i];var o=Qu.filter(function(a){return r.indexOf(a)===-1});return o}function pA(e){var t=Ne(e),n=[].concat(e.incoming.map(function(i){return i.waypoints[i.waypoints.length-2]}),e.outgoing.map(function(i){return i.waypoints[1]})).map(function(i){return gg(t,i)});return n}function fA(e){var t=Ne(e.label),n=Ne(e),i=gg(n,t);if(dA(i)){var r=pA(e);if(e.host){var o=uA(e);r=r.concat(o)}var a=Qu.filter(function(s){return r.indexOf(s)===-1});return a.indexOf(i)!==-1?cn(e.label,e)!=="intersect"?void 0:i:a[0]}}function gg(e,t){return cn(t,e,5)}function dA(e){return Qu.indexOf(e)!==-1}function ep(e){te.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,i=t.shape;t.position||(S(i,"bpmn:TextAnnotation")?t.position={x:n.x+n.width/2+75,y:n.y-50-i.height/2}:t.position={x:n.x+n.width+80+i.width/2,y:n.y+n.height/2})},!0)}Ee(ep,te),ep.$inject=["eventBus"];var hA=1500;function tp(e,t,n){e.invoke(te,this),this.preExecute("elements.delete",hA,function(r){var o=r.context,a=o.elements,s=i(a);s.length&&(o.elements=a.concat(s))}),t.on("shape.move.start",function(r){var o=r.context.shapes,a=i(o);a.length&&(r.context.shapes=o.concat(a))});function i(r){var o=Ke(r,l=>S(l,"bpmn:Participant")||S(l,"bpmn:SubProcess"));if(!o.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(l=>S(l,"bpmn:Artifact"))),c=new Set;return F(o,l=>{const u=new Set(ro(bo(Array.from(s),Ft(l))));c=c.union(u),s=s.difference(u)}),Array.from(c)}}Ee(tp,te),tp.$inject=["injector","eventBus","canvas"];function np(e,t){e.invoke(te,this),this.postExecute("shape.move",function(n){var i=n.newParent,r=n.shape,o=Ke(r.incoming.concat(r.outgoing),function(a){return S(a,"bpmn:Association")});F(o,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}Ee(np,te),np.$inject=["injector","modeling"];function Co(e,t){for(Pn(t)&&(t=[t]);e=e.parent;)if(qe(e,t))return e;return null}function yg(e,t){var n=Co(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=Co(e,i),n)return tn(n);if(qe(e,i))return tn(e);var r;for(r=ie(e);r&&!S(r,"bpmn:Process");r=r.$parent);if(!t)return!0;var o=t.find(function(a){var s=ie(a);return s&&s.get("processRef")===r});return o?tn(o):!0}var vg=500;function nc(e,t){t.invoke(te,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",vg,function(i){var r=i.elements;r=r.filter(function(o){var a=o.host;return bg(o,a)}),r.length===1&&r.map(function(o){return r.indexOf(o)}).forEach(function(o){var a=r[o];i.elements[o]=n._replaceShape(r[o],a)})},!0),this.preExecute("elements.move",vg,function(i){var r=i.shapes,o=i.newHost;if(r.length===1){var a=r[0];bg(a,o)&&(i.shapes=[n._replaceShape(a,o)])}},!0)}nc.$inject=["bpmnReplace","injector"],Ee(nc,te),nc.prototype._replaceShape=function(e,t){var n=mA(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function mA(e){var t=ie(e),n=t.eventDefinitions;return n&&n[0]}function bg(e,t){return!Ye(e)&&qe(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function ip(e,t){te.call(this,e);function n(i){return Ke(i.attachers,function(r){return S(r,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var r=i.context.source,o=i.context.target,a=n(o);S(r,"bpmn:EventBasedGateway")&&S(o,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var r=i.context.oldSource,o=i.context.newSource;S(r,"bpmn:Gateway")&&S(o,"bpmn:EventBasedGateway")&&F(o.outgoing,function(a){var s=a.target,c=n(s);S(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}ip.$inject=["eventBus","modeling"],Ee(ip,te);function xg(e){return e.create("bpmn:Category")}function gA(e){return e.create("bpmn:CategoryValue")}function _g(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=gA(e)),n.$parent||(n.$parent=xg(e)),n}function yA(e,t,n){return Bt(t.get("categoryValue"),e),e.$parent=t,Bt(n.get("rootElements"),t),t.$parent=n,e}function vA(e){var t=e.$parent;return t&&(Lt(t.get("categoryValue"),e),e.$parent=null),e}function bA(e){var t=e.$parent;return t&&(Lt(t.get("rootElements"),e),e.$parent=null),e}var xA=500;function rp(e,t,n){n.invoke(te,this);function i(c){return t.filter(function(l){return S(l,"bpmn:Group")&&!l.labelTarget}).map(ie).filter(function(l){return l!==c})}function r(c,l){return i(l).some(function(u){return u.get("categoryValueRef")===c})}function o(c,l){return i(l).some(function(u){var f=u.get("categoryValueRef");return f&&f.$parent===c})}function a(c,l){c&&l&&yA(c,l,e.getDefinitions())}function s(c,l,u){l&&!o(l,u)&&bA(l),c&&!r(c,u)&&vA(c)}this.executed(["shape.create","label.create"],function(c){var l=c.labelTarget||c.shape;!S(l,"bpmn:Group")||l.labelTarget||a(c.categoryValue,c.category)},!0),this.reverted(["shape.create","label.create"],function(c){var l=c.labelTarget||c.shape;!S(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,ie(l))},!0),this.executed(["shape.move","shape.resize"],xA,function(c){a(c.categoryValue,c.category)},!0),this.reverted(["shape.move","shape.resize"],function(c){var l=c.shape;c.categoryValue&&s(c.categoryValue,c.category,ie(l))},!0),this.executed("group.updateRefs",function(c){wg(c).forEach(function(l){a(l.categoryValue,l.category)})},!0),this.reverted("group.updateRefs",function(c){wg(c).forEach(function(l){s(l.categoryValue,l.category,ie(l.groupShape))})},!0),this.executed("shape.delete",function(c){var l=c.shape;!S(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,ie(l))},!0),this.reverted("shape.delete",function(c){var l=c.shape;!S(l,"bpmn:Group")||l.labelTarget||a(c.categoryValue,c.category)},!0)}rp.$inject=["bpmnjs","elementRegistry","injector"],Ee(rp,te);function wg(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function op(e,t,n){te.call(this,e),this.preExecute("shape.replace",s,!0),this.postExecuted("shape.replace",c,!0),this.preExecute("connection.create",r,!0),this.postExecuted("connection.delete",i,!0),this.postExecuted("connection.reconnect",o,!0),this.postExecuted("element.updateProperties",a,!0);function i(y){const v=y.source,g=y.target;Ao(v)&&_a(g)&&u(g)}function r(y){const v=y.connection,g=y.source,b=y.target;Ao(g)&&ic(b)&&(l(b),p(g,[v]))}function o(y){const v=y.newTarget,g=y.oldSource,b=y.oldTarget;if(b!==v){const x=g;_a(b)&&u(b),Ao(x)&&ic(v)&&l(v)}}function a(y){const{element:v}=y;_a(v)?(f(v),d(v)):ic(v)&&m(v)}function s(y){const{newData:v,oldShape:g}=y;if(Ao(y.oldShape)&&v.eventDefinitionType!=="bpmn:CompensateEventDefinition"||v.type!=="bpmn:BoundaryEvent"){const b=g.outgoing.find(({target:x})=>_a(x));b&&b.target&&(y._connectionTarget=b.target)}else if(!Ao(y.oldShape)&&v.eventDefinitionType==="bpmn:CompensateEventDefinition"&&v.type==="bpmn:BoundaryEvent"){const b=g.outgoing.find(({target:x})=>ic(x));b&&b.target&&(y._connectionTarget=b.target),h(g)}}function c(y){const{_connectionTarget:v,newShape:g}=y;v&&t.connect(g,v)}function l(y){t.updateProperties(y,{isForCompensation:!0})}function u(y){t.updateProperties(y,{isForCompensation:void 0})}function f(y){for(const v of y.incoming)n.canConnect(v.source,y)||t.removeConnection(v);for(const v of y.outgoing)n.canConnect(y,v.target)||t.removeConnection(v)}function p(y,v){y.outgoing.filter(x=>S(x,"bpmn:Association")).filter(x=>_a(x.target)&&!v.includes(x)).forEach(x=>t.removeConnection(x))}function d(y){const v=y.attachers.slice();v.length&&t.removeElements(v)}function m(y){const v=y.incoming.filter(g=>Ao(g.source));t.removeElements(v)}function h(y){const v=y.outgoing.filter(g=>S(g,"bpmn:SequenceFlow"));t.removeElements(v)}}Ee(op,te),op.$inject=["eventBus","modeling","bpmnRules"];function _a(e){const t=ie(e);return t&&t.get("isForCompensation")}function Ao(e){return e&&S(e,"bpmn:BoundaryEvent")&&Eo(e,"bpmn:CompensateEventDefinition")}function ic(e){return e&&S(e,"bpmn:Activity")&&!vn(e)}function ap(e){e.invoke(te,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,r=n.shape;S(i,"bpmn:Lane")&&!S(r,"bpmn:Lane")&&(n.parent=Co(i,"bpmn:Participant"))})}ap.$inject=["injector"],Ee(ap,te);function sp(e,t){te.call(this,e),this.preExecute("shape.create",function(n){var a;var i=n.context,r=i.shape;if(S(r,"bpmn:DataObjectReference")&&r.type!=="label"){var o=t.create("bpmn:DataObject");o.isCollection=((a=r.businessObject.dataObjectRef)==null?void 0:a.isCollection)||!1,r.businessObject.dataObjectRef=o}})}sp.$inject=["eventBus","bpmnFactory"],Ee(sp,te);var cp=20,lp=20,Eg=30,rc=2e3;function up(e,t,n){te.call(this,t),t.on(["create.start","shape.move.start"],rc,function(r){var o=r.context,a=o.shape,s=e.getRootElement();if(!(!S(a,"bpmn:Participant")||!S(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(f){return!S(f,"bpmn:Group")&&!Ye(f)&&!ht(f)});if(c.length){var l=Ft(c),u=_A(a,l);W(a,u),o.createConstraints=wA(a,l)}}}),t.on("create.start",rc,function(r){var o=r.context,a=o.shape,s=e.getRootElement(),c=e.getGraphics(s);function l(u){u.element=s,u.gfx=c}S(a,"bpmn:Participant")&&S(s,"bpmn:Process")&&(t.on("element.hover",rc,l),t.once("create.cleanup",function(){t.off("element.hover",l)}))});function i(){var r=e.getRootElement();return S(r,"bpmn:Collaboration")?r:n.makeCollaboration()}this.preExecute("elements.create",rc,function(r){var o=r.elements,a=r.parent,s=EA(o),c;s&&S(a,"bpmn:Process")&&(r.parent=i(),c=r.hints=r.hints||{},c.participant=s,c.process=a,c.processRef=ie(s).get("processRef"))},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;S(a,"bpmn:Participant")&&S(o,"bpmn:Process")&&(r.parent=i(),r.process=o,r.processRef=ie(a).get("processRef"))},!0),this.execute("shape.create",function(r){var o=r.hints||{},a=r.process||o.process,s=r.shape,c=o.participant;a&&(!c||s===c)&&ie(s).set("processRef",ie(a))},!0),this.revert("shape.create",function(r){var o=r.hints||{},a=r.process||o.process,s=r.processRef||o.processRef,c=r.shape,l=o.participant;a&&(!l||c===l)&&ie(c).set("processRef",s)},!0),this.postExecute("shape.create",function(r){var o=r.hints||{},a=r.process||r.hints.process,s=r.shape,c=o.participant;if(a){var l=a.children.slice();c?s===c&&n.moveElements(l,{x:0,y:0},c):n.moveElements(l,{x:0,y:0},s)}},!0)}up.$inject=["canvas","eventBus","modeling"],Ee(up,te);function _A(e,t){t={width:t.width+cp*2+Eg,height:t.height+lp*2};var n=Math.max(e.width,t.width),i=Math.max(e.height,t.height);return{x:-n/2,y:-i/2,width:n,height:i}}function wA(e,t){return t=Ie(t),{bottom:t.top+e.height/2-lp,left:t.right-e.width/2+cp,top:t.bottom-e.height/2+lp,right:t.left+e.width/2-cp-Eg}}function EA(e){return vt(e,function(t){return S(t,"bpmn:Participant")})}var Sg="__targetRef_placeholder";function pp(e,t){te.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],Rg(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],Rg(o));function n(a,s,c){var l=a.get("dataInputAssociations");return vt(l,function(u){return u!==c&&u.targetRef===s})}function i(a,s){var c=a.get("properties"),l=vt(c,function(u){return u.name===Sg});return!l&&s&&(l=t.create("bpmn:Property",{name:Sg}),Bt(c,l)),l}function r(a,s){var c=i(a);c&&(n(a,c,s)||Lt(a.get("properties"),c))}function o(a){var s=a.context,c=s.connection,l=c.businessObject,u=c.target,f=u&&u.businessObject,p=s.newTarget,d=p&&p.businessObject,m=s.oldTarget||s.target,h=m&&m.businessObject,y=c.businessObject,v;h&&h!==f&&r(h,l),d&&d!==f&&r(d,l),f?(v=i(f,!0),y.targetRef=v):y.targetRef=null}}pp.$inject=["eventBus","bpmnFactory"],Ee(pp,te);function Rg(e){return function(t){var n=t.context,i=n.connection;if(S(i,"bpmn:DataInputAssociation"))return e(t)}}function oc(e){this._bpmnUpdater=e}oc.$inject=["bpmnUpdater"],oc.prototype.execute=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.newSemanticParent,r=e.newDiParent;return e.oldSemanticParent=t.$parent,e.oldDiParent=n.$parent,this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,r),[]},oc.prototype.revert=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.oldSemanticParent,r=e.oldDiParent;return this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,r),[]};function fp(e,t,n,i){te.call(this,i),t.registerHandler("dataStore.updateContainment",oc);function r(){return n.filter(function(s){return S(s,"bpmn:Participant")&&ie(s).processRef})[0]}function o(s){return s.children.filter(function(c){return S(c,"bpmn:DataStoreReference")&&!c.labelTarget})}function a(s,c){var l=s.businessObject||s;if(c=c||r(),c){var u=c.businessObject||c;t.execute("dataStore.updateContainment",{dataStoreBo:l,dataStoreDi:ot(s),newSemanticParent:u.processRef||u,newDiParent:ot(c)})}}this.preExecute("shape.create",function(s){var c=s.context,l=c.shape;S(l,"bpmn:DataStoreReference")&&l.type!=="label"&&(c.hints||(c.hints={}),c.hints.autoResize=!1)}),this.preExecute("elements.move",function(s){var c=s.context,l=c.shapes,u=l.filter(function(f){return S(f,"bpmn:DataStoreReference")});u.length&&(c.hints||(c.hints={}),c.hints.autoResize=l.filter(function(f){return!S(f,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,l=c.shape,u=l.parent;S(l,"bpmn:DataStoreReference")&&l.type!=="label"&&S(u,"bpmn:Collaboration")&&a(l)}),this.postExecute("shape.move",function(s){var c=s.context,l=c.shape,u=c.oldParent,f=l.parent;if(!S(u,"bpmn:Collaboration")&&S(l,"bpmn:DataStoreReference")&&l.type!=="label"&&S(f,"bpmn:Collaboration")){var p=S(u,"bpmn:Participant")?u:RA(u,"bpmn:Participant");a(l,p)}}),this.postExecute("shape.delete",function(s){var c=s.context,l=c.shape,u=e.getRootElement();qe(l,["bpmn:Participant","bpmn:SubProcess"])&&S(u,"bpmn:Collaboration")&&o(u).filter(function(f){return SA(f,l)}).forEach(function(f){a(f)})}),this.postExecute("canvas.updateRoot",function(s){var c=s.context,l=c.oldRoot,u=c.newRoot,f=o(l);f.forEach(function(p){S(u,"bpmn:Process")&&a(p,u)})})}fp.$inject=["canvas","commandStack","elementRegistry","eventBus"],Ee(fp,te);function SA(e,t){for(var n=e.businessObject||e,i=t.businessObject||t;n.$parent;){if(n.$parent===i.processRef||i)return!0;n=n.$parent}return!1}function RA(e,t){for(;e.parent;){if(S(e.parent,t))return e.parent;e=e.parent}}var ac=Math.max,sc=Math.min,CA=20;function Cg(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function AA(e,t,n){var i=n.x,r=n.y,o={x:e.x,y:e.y,width:e.width,height:e.height};return t.indexOf("n")!==-1?(o.y=e.y+r,o.height=e.height-r):t.indexOf("s")!==-1&&(o.height=e.height+r),t.indexOf("e")!==-1?o.width=e.width+i:t.indexOf("w")!==-1&&(o.x=e.x+i,o.width=e.width-i),o}function PA(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 cc(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return Fe(r)&&(i=(/top|left/.test(e)?sc:ac)(i,r)),Fe(o)&&(i=(/top|left/.test(e)?ac:sc)(i,o)),i}function MA(e,t){if(!t)return e;var n=Ie(e);return Vs({top:cc("top",n,t),right:cc("right",n,t),bottom:cc("bottom",n,t),left:cc("left",n,t)})}function TA(e,t,n,i){var r=Ie(t),o={top:/n/.test(e)?r.bottom-n.height:r.top,left:/w/.test(e)?r.right-n.width:r.left,bottom:/s/.test(e)?r.top+n.height:r.bottom,right:/e/.test(e)?r.left+n.width:r.right},a=i?Ie(i):o,s={top:sc(o.top,a.top),left:sc(o.left,a.left),bottom:ac(o.bottom,a.bottom),right:ac(o.right,a.right)};return Vs(s)}function wa(e,t){return typeof e<"u"?e:CA}function kA(e,t){var n,i,r,o;return typeof t=="object"?(n=wa(t.left),i=wa(t.right),r=wa(t.top),o=wa(t.bottom)):n=i=r=o=wa(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function OA(e){return!(e.waypoints||e.type==="label")}function Ag(e,t){var n;if(e.length===void 0?n=Ke(e.children,OA):n=e,n.length)return kA(Ft(n),t)}var cr=Math.abs;function DA(e,t){return Cg(Ie(t),Ie(e))}var IA=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Jn=30;function lc(e,t){return t=t||[],e.children.filter(function(n){S(n,"bpmn:Lane")&&(lc(n,t),t.push(n))}),t}function lr(e){return e.children.filter(function(t){return S(t,"bpmn:Lane")})}function ei(e){return Co(e,IA)||e}function LA(e,t){var n=ei(e),i=S(n,"bpmn:Process")?[]:[n],r=lc(n,i),o=Ie(e),a=Ie(t),s=DA(e,t),c=[],l=tn(e);return r.forEach(function(u){if(u!==e){var f=l?0:s.top,p=l?s.right:0,d=l?0:s.bottom,m=l?s.left:0,h=Ie(u);s.top&&(cr(h.bottom-o.top)<10&&(d=a.top-h.bottom),cr(h.top-o.top)<5&&(f=a.top-h.top)),s.left&&(cr(h.right-o.left)<10&&(p=a.left-h.right),cr(h.left-o.left)<5&&(m=a.left-h.left)),s.bottom&&(cr(h.top-o.bottom)<10&&(f=a.bottom-h.top),cr(h.bottom-o.bottom)<5&&(d=a.bottom-h.bottom)),s.right&&(cr(h.left-o.right)<10&&(m=a.right-h.left),cr(h.right-o.right)<5&&(p=a.right-h.right)),(f||p||d||m)&&c.push({shape:u,newBounds:PA(u,{top:f,right:p,bottom:d,left:m})})}}),c}var BA=500;function dp(e,t){te.call(this,e);function n(i,r){var o=tn(i),a=lr(r),s=[],c=[],l=[],u=[];if(Nr(a,function(y){return o?y.y>i.y?c.push(y):s.push(y):y.x>i.x?u.push(y):l.push(y),y.children}),!!a.length){var f;o?c.length&&s.length?f=i.height/2:f=i.height:u.length&&l.length?f=i.width/2:f=i.width;var p,d,m,h;s.length&&(p=t.calculateAdjustments(s,"y",f,i.y-10),t.makeSpace(p.movingShapes,p.resizingShapes,{x:0,y:f},"s")),c.length&&(d=t.calculateAdjustments(c,"y",-f,i.y+i.height+10),t.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:-f},"n")),l.length&&(m=t.calculateAdjustments(l,"x",f,i.x-10),t.makeSpace(m.movingShapes,m.resizingShapes,{x:f,y:0},"e")),u.length&&(h=t.calculateAdjustments(u,"x",-f,i.x+i.width+10),t.makeSpace(h.movingShapes,h.resizingShapes,{x:-f,y:0},"w"))}}this.postExecuted("shape.delete",BA,function(i){var r=i.context,o=r.hints,a=r.shape,s=r.oldParent;S(a,"bpmn:Lane")&&(o&&o.nested||n(a,s))})}dp.$inject=["eventBus","spaceTool"],Ee(dp,te);var Pg=500;function uc(e,t){t.invoke(te,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Pg,function(i){var r=i.elements;r.filter(function(o){var a=o.host;return Mg(o,a)}).map(function(o){return r.indexOf(o)}).forEach(function(o){i.elements[o]=n._replaceShape(r[o])})},!0),this.preExecute("elements.move",Pg,function(i){var r=i.shapes,o=i.newHost;r.forEach(function(a,s){var c=a.host;Mg(a,$A(r,c)?c:o)&&(r[s]=n._replaceShape(a))})},!0)}uc.$inject=["bpmnReplace","injector"],Ee(uc,te),uc.prototype._replaceShape=function(e){var t=NA(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function NA(e){var t=ie(e),n=t.eventDefinitions;return n&&n[0]}function Mg(e,t){return!Ye(e)&&S(e,"bpmn:BoundaryEvent")&&!t}function $A(e,t){return e.indexOf(t)!==-1}var pc=Math.round,FA=Math.max;function jA(e,t){var n=e.x,i=e.y;return[["M",n,i],["m",0,-t],["a",t,t,0,1,1,0,2*t],["a",t,t,0,1,1,0,-2*t],["z"]]}function HA(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var Tg=10;function zA(e,t){var n,i;for(n=0;i=e[n];n++)if(fa(i,t)<=Tg)return{point:e[n],bendpoint:!0,index:n};return null}function GA(e,t){var n=Lm(jA(t,Tg),HA(e)),i=n[0],r=n[n.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=FA(i.segment2,r.segment2)-1,{point:e[o],bendpoint:!0,index:o}):{point:{x:pc(i.x+r.x)/2,y:pc(i.y+r.y)/2},index:i.segment2}:{point:{x:pc(i.x),y:pc(i.y)},index:i.segment2}:null}function hp(e,t){return zA(e,t)||GA(e,t)}function mp(e,t,n){te.call(this,e);function i(r,o,a){var s=o.waypoints,c,l,u,f,p,d,m,h=r.outgoing.slice(),y=r.incoming.slice(),v;Fe(a.width)?v=Ne(a):v=a;var g=hp(s,v);if(g){if(c=s.slice(0,g.index),l=s.slice(g.index+(g.bendpoint?1:0)),!c.length||!l.length)return;u=g.bendpoint?s[g.index]:v,(c.length===1||!kg(r,c[c.length-1]))&&c.push(Og(u)),(l.length===1||!kg(r,l[0]))&&l.unshift(Og(u))}f=o.source,p=o.target,t.canConnect(f,r,o)&&(n.reconnectEnd(o,r,c||v),d=o),t.canConnect(r,p,o)&&(d?m=n.connect(r,p,{type:o.type,waypoints:l}):(n.reconnectStart(o,r,l||v),m=o));var b=[].concat(d&&Ke(y,function(x){return x.source===d.source})||[],m&&Ke(h,function(x){return x.target===m.target})||[]);b.length&&n.removeElements(b)}this.preExecute("elements.move",function(r){var o=r.newParent,a=r.shapes,s=r.delta,c=a[0];if(!(!c||!o)){o&&o.waypoints&&(r.newParent=o=o.parent);var l=Ne(c),u={x:l.x+s.x,y:l.y+s.y},f=vt(o.children,function(p){var d=t.canInsert(a,p);return d&&hp(p.waypoints,u)});f&&(r.targetFlow=f,r.position=u)}},!0),this.postExecuted("elements.move",function(r){var o=r.shapes,a=r.targetFlow,s=r.position;a&&i(o[0],a,s)},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;t.canInsert(a,o)&&(r.targetFlow=o,r.parent=o.parent)},!0),this.postExecuted("shape.create",function(r){var o=r.shape,a=r.targetFlow,s=r.position;a&&i(o,a,s)},!0)}Ee(mp,te),mp.$inject=["eventBus","bpmnRules","modeling"];function kg(e,t){var n=t.x,i=t.y;return n>=e.x&&n<=e.x+e.width&&i>=e.y&&i<=e.y+e.height}function Og(e){return W({},e)}function gp(e,t){te.call(this,e),this.preExecuted("connection.create",function(n){var i=n.context,r=i.connection,o=i.source,a=i.target,s=i.hints;if(!(s&&s.createElementsBehavior===!1)&&Po(r)){var c=[];S(o,"bpmn:EventBasedGateway")?c=a.incoming.filter(l=>l!==r&&Po(l)):c=a.incoming.filter(l=>l!==r&&Po(l)&&S(l.source,"bpmn:EventBasedGateway")),c.forEach(function(l){t.removeConnection(l)})}}),this.preExecuted("shape.replace",function(n){var i=n.context,r=i.newShape;if(S(r,"bpmn:EventBasedGateway")){var o=r.outgoing.filter(Po).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);o.forEach(function(a){a.incoming.filter(Po).forEach(function(s){const c=a.incoming.filter(Po).filter(function(l){return l.source===r});(s.source!==r||c.length>1)&&t.removeConnection(s)})})}})}gp.$inject=["eventBus","modeling"],Ee(gp,te);function Po(e){return S(e,"bpmn:SequenceFlow")}var fc=1500,Dg=2e3;function Ig(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"],fc,function(i){var r=i.context,o=r.shape||i.shape,a=i.hover;S(a,"bpmn:Lane")&&!qe(o,["bpmn:Lane","bpmn:Participant"])&&(i.hover=ei(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(o.labelTarget||qe(o,["bpmn:Group","bpmn:TextAnnotation"]))&&(i.hover=s,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.hover","connect.out","connect.end","connect.cleanup","global-connect.hover","global-connect.out","global-connect.end","global-connect.cleanup"],fc,function(i){var r=i.hover;S(r,"bpmn:Lane")&&(i.hover=ei(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],fc,function(i){var r=i.context,o=i.hover,a=r.type;S(o,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=ei(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],fc,function(i){var r=i.context,o=r.start;S(o,"bpmn:Lane")&&(r.start=ei(o)||o)}),t.on("shape.move.start",Dg,function(i){var r=i.shape;S(r,"bpmn:Lane")&&(i.shape=ei(r)||r)}),t.on("spaceTool.move",Dg,function(i){var r=i.hover;r&&S(r,"bpmn:Lane")&&(i.hover=ei(r))})}Ig.$inject=["elementRegistry","eventBus","canvas"];var Lg=770;function yp(e,t,n,i){n.invoke(te,this);function r(s,c){var l=ie(s),u=c.categoryValue||l.categoryValueRef;u||(u=_g(e,l));var f=c.category||u.$parent||xg(e);l.categoryValueRef=u,u.$parent=f,c.categoryValue=u,c.category=f}function o(s,c){var l=ie(s),u=c.categoryValue||l.categoryValueRef,f=c.category||u&&u.$parent;u&&(c.categoryValue=u,c.category=f,l.categoryValueRef=null)}this.execute("label.create",function(s){var c=s.context,l=c.labelTarget;S(l,"bpmn:Group")&&r(l,c)}),this.revert("label.create",function(s){var c=s.context,l=c.labelTarget;S(l,"bpmn:Group")&&o(l,c)}),this.execute("shape.delete",function(s){var c=s.context,l=c.shape,u=ie(l);if(!(!S(l,"bpmn:Group")||l.labelTarget)){var f=c.categoryValue=u.categoryValueRef;f&&(c.category=f.$parent,u.categoryValueRef=null)}}),this.reverted("shape.delete",function(s){var c=s.context,l=c.shape;if(!(!S(l,"bpmn:Group")||l.labelTarget)){var u=c.category,f=c.categoryValue,p=ie(l);f&&(p.categoryValueRef=f,f.$parent=u)}}),this.execute("shape.create",function(s){var c=s.context,l=c.shape,u=c.hints||{};!S(l,"bpmn:Group")||l.labelTarget||u.createElementsBehavior===!1&&!ie(l).categoryValueRef&&!c.categoryValue||r(l,c)}),this.reverted("shape.create",function(s){var c=s.context,l=c.shape,u=c.hints||{};!S(l,"bpmn:Group")||l.labelTarget||u.createElementsBehavior===!1&&!ie(l).categoryValueRef&&!c.categoryValue||o(l,c)}),this.executed(["shape.move","shape.resize"],function(s){var c=s.context,l=c.shape;!S(l,"bpmn:Group")||l.labelTarget||ie(l).categoryValueRef||r(l,c)}),this.reverted(["shape.move","shape.resize"],function(s){var c=s.context,l=c.shape;!S(l,"bpmn:Group")||l.labelTarget||!c.categoryValue||o(l,c)});function a(s,c){var l=e.create(s.$type);return i.copyElement(s,l,null,c)}t.on("copyPaste.copyElement",Lg,function(s){var c=s.descriptor,l=s.element;if(!(!S(l,"bpmn:Group")||l.labelTarget)){var u=ie(l);if(u.categoryValueRef){var f=u.categoryValueRef;c.categoryValue=a(f,!0),f.$parent&&(c.category=a(f.$parent,!0))}}}),t.on("copyPaste.pasteElement",Lg,function(s){var c=s.descriptor,l=c.businessObject,u=c.categoryValue,f=c.category;u&&(u=l.categoryValueRef=a(u)),f&&(u.$parent=a(f)),delete c.category,delete c.categoryValue})}yp.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],Ee(yp,te);function vp(e,t,n,i){var r,o,a,s,c;return r=(i.y-n.y)*(t.x-e.x)-(i.x-n.x)*(t.y-e.y),r==0?null:(o=e.y-n.y,a=e.x-n.x,c=(i.x-n.x)*o-(i.y-n.y)*a,s=c/r,{x:Math.round(e.x+s*(t.x-e.x)),y:Math.round(e.y+s*(t.y-e.y))})}function Bg(e){function t(i,r,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=vp(i,r,o,a),l=vp(i,r,o,s),u;c&&l?Ng(c,o)>Ng(l,o)?u=l:u=c:u=c||l,i.original=u}function n(i){var r=i.waypoints;t(r[0],r[1],Ne(i.source)),t(r[r.length-1],r[r.length-2],Ne(i.target))}e.on("bpmnElement.added",function(i){var r=i.element;r.waypoints&&n(r)})}Bg.$inject=["eventBus"];function Ng(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function bp(e){te.call(this,e);var t=["bpmn:Participant","bpmn:Lane"];this.executed(["shape.move","shape.create","shape.resize"],function(n){var i=n.context.shape,r=ie(i),o=ot(i);if(qe(r,t)){var a=o.get("isHorizontal");a===void 0&&(a=!0),o.set("isHorizontal",a)}})}bp.$inject=["eventBus"],Ee(bp,te);function $g(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Fg(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function VA(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 WA(e,t,n){var i=[{n:e[0]-n[0],lambda:t[0]},{n:e[1]-n[1],lambda:t[1]}],r=i[0].n*t[0]+i[1].n*t[1],o=i[0].lambda*t[0]+i[1].lambda*t[1];return-r/o}function xp(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=WA([n.x,n.y],[r.x,r.y],[e.x,e.y]);return{x:n.x+o*r.x,y:n.y+o*r.y}}function jg(e,t){var n=xp(e,t),i={x:n.x-e.x,y:n.y-e.y};return $g(i)}function Ea(e,t){return $g({x:e.x-t.x,y:e.y-t.y})}var Hg=Math.sqrt,zg=Math.min,UA=Math.max,Gg=Math.abs;function Vg(e){return Math.pow(e,2)}function Sa(e,t){return Hg(Vg(e.x-t.x)+Vg(e.y-t.y))}function YA(e,t){var n=0,i,r,o,a,s,c,l,u,f,p,d;for(n=0;n<t.length-1;n++){if(i=t[n],r=t[n+1],Ug(i,r)?l=[i]:(o=Sa(e,i),a=Sa(e,r),c=zg(o,a),l=qA(i,r,e,c)),l.length<1)throw new Error("expected between [1, 2] circle -> line intersections");l.length===1&&(u={type:"bendpoint",position:l[0],segmentIndex:n,bendpointIndex:Ug(i,l[0])?n:n+1}),l.length===2&&(s=XA(l[0],l[1]),u={type:"segment",position:s,segmentIndex:n,relativeLocation:Sa(i,s)/Sa(i,r)}),f=Sa(u.position,e),(!d||p>f)&&(d=u,p=f)}return d}function qA(e,t,n,i){var r=t.x-e.x,o=t.y-e.y,a=n.x-e.x,s=n.y-e.y,c=r*r+o*o,l=r*a+o*s,u=a*a+s*s-i*i,f=l/c,p=u/c,d=f*f-p;if(d<0&&d>-1e-6&&(d=0),d<0)return[];var m=Hg(d),h=-f+m,y=-f-m,v={x:e.x-r*h,y:e.y-o*h};if(d===0)return[v];var g={x:e.x-r*y,y:e.y-o*y};return[v,g].filter(function(b){return KA(b,e,t)})}function KA(e,t,n){return Wg(e.x,t.x,n.x)&&Wg(e.y,t.y,n.y)}function Wg(e,t,n){return e>=zg(t,n)-dc&&e<=UA(t,n)+dc}function XA(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var dc=.1;function Ug(e,t){return Gg(e.x-t.x)<=dc&&Gg(e.y-t.y)<=dc}function ZA(e,t,n,i){var r=n.segmentIndex,o=t.length-e.length;if(i.segmentMove){var a=i.segmentMove.segmentStartIndex,s=i.segmentMove.newSegmentStartIndex;return r===a?s:r>=s?r+o<s?s:r+o:r}if(i.bendpointMove){var c=i.bendpointMove.insert,l=i.bendpointMove.bendpointIndex,u;if(o===0)return r;if(r>=l&&(u=c?r+1:r-1),r<l&&(u=r,c&&n.type!=="bendpoint"&&l-1===r)){var f=qg(t,l);f<n.relativeLocation&&u++}return u}return o===0?r:i.connectionStart&&r===0?0:i.connectionEnd&&r===e.length-2?t.length-2:Math.floor((t.length-2)/2)}function Yg(e,t,n,i){var r=0,o=0,a={point:e,delta:{x:0,y:0}},s=YA(e,n),c=s.segmentIndex,l=ZA(n,t,s,i);if(l<0||l>t.length-2||l===null)return a;var u=Kg(n,c),f=Kg(t,l),p=s.position,d=JA(u,p),m=QA(u,f);if(s.type==="bendpoint"){var h=t.length-n.length,y=s.bendpointIndex,v=n[y];if(t.indexOf(v)!==-1)return a;if(h===0){var g=t[y];return r=g.x-s.position.x,o=g.y-s.position.y,{delta:{x:r,y:o},point:{x:e.x+r,y:e.y+o}}}h<0&&y!==0&&y<n.length-1&&(d=qg(n,y))}var b={x:(f[1].x-f[0].x)*d+f[0].x,y:(f[1].y-f[0].y)*d+f[0].y},x=VA({x:e.x-p.x,y:e.y-p.y},m);return r=b.x+x.x-e.x,o=b.y+x.y-e.y,{point:Bi(b),delta:Bi({x:r,y:o})}}function qg(e,t){var n=Ea(e[t-1],e[t]),i=Ea(e[t],e[t+1]),r=n/(n+i);return r}function QA(e,t){var n=Fg(e),i=Fg(t);return i-n}function Kg(e,t){return[e[t],e[t+1]]}function JA(e,t){var n=Ea(e[0],e[1]),i=Ea(e[0],t);return n===0?0:i/n}function eP(e,t,n,i){var r=Ne(e);return Yg(r,t,n,i).delta}function Ra(e,t,n){var i=xa(t),r=xa(n),o=pi(e,i),a={x:o.x*(n.width/t.width),y:o.y*(n.height/t.height)};return Bi({x:r.x+a.x,y:r.y+a.y})}function Xg(e,t,n){var i=xa(e),r=xa(t),o=xa(n),a=pi(e,i),s=pi(i,r),c=tP(i,t,n);if(c)return c;var l={x:s.x*(n.width/t.width),y:s.y*(n.height/t.height)},u={x:o.x+l.x,y:o.y+l.y};return Bi({x:u.x+a.x-e.x,y:u.y+a.y-e.y})}function tP(e,t,n){var i=Ie(t),r=Ie(n);if(nP(i,r))return null;var o=cn(t,e),a,s,c;if(o==="top")a={x:0,y:r.bottom-i.bottom};else if(o==="bottom")a={x:0,y:r.top-i.top};else if(o==="right")a={x:r.left-i.left,y:0};else if(o==="left")a={x:r.right-i.right,y:0};else return null;return s={x:e.x+a.x,y:e.y+a.y},c=cn(n,s),c!==o?null:a}function nP(e,t){return iP(e,t)||rP(e,t)}function iP(e,t){return e.right!==t.right&&e.left!==t.left}function rP(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var Zg="name",Qg="text";function _p(e,t,n,i){te.call(this,e),this.postExecute("element.updateProperties",r),this.postExecute("element.updateModdleProperties",a=>{ie(a.context.element)===a.context.moddleElement&&r(a)});function r(a){var s=a.context,c=s.element,l=s.properties;if(Zg in l&&t.updateLabel(c,l[Zg]),Qg in l&&S(c,"bpmn:TextAnnotation")){var u=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},l[Qg]||"");t.updateLabel(c,l.text,u)}}this.postExecute(["shape.create","connection.create"],function(a){var s=a.context,c=s.hints||{};if(c.createElementsBehavior!==!1){var l=s.shape||s.connection;Ye(l)||!sr(l)||qn(l)&&t.updateLabel(l,qn(l))}}),this.postExecute("shape.delete",function(a){var s=a.context,c=s.labelTarget,l=s.hints||{};c&&l.unsetLabel!==!1&&t.updateLabel(c,null,null,{removeShape:!1})});function o(a){var s=a.context,c=s.connection,l=c.label,u=W({},s.hints),f=s.newWaypoints||c.waypoints,p=s.oldWaypoints;return typeof u.startChanged>"u"&&(u.startChanged=!!u.connectionStart),typeof u.endChanged>"u"&&(u.endChanged=!!u.connectionEnd),eP(l,f,p,u)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(a){var s=a.context,c=s.hints||{};if(c.labelBehavior!==!1){var l=s.connection,u=l.label,f;!u||!u.parent||(f=o(a),t.moveShape(u,f))}}),this.postExecute(["shape.replace"],function(a){var s=a.context,c=s.newShape,l=s.oldShape,u=ie(c);u&&sr(u)&&l.label&&c.label&&(c.label.x=l.label.x,c.label.y=l.label.y)}),this.preExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.hints||{};if(!(!Ye(c)||l.autoResize)){var u=s.newBounds,f=i.getDimensions(qn(c)||"",{box:u,style:i.getExternalStyle()}),p=Math.ceil(f.height),d=u.y!==c.y,m=c.y+c.height;s.newBounds={width:u.width,height:p,x:u.x,y:d?m-p:u.y}}}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.newBounds,u=s.oldBounds;if(Xs(c)){var f=c.label,p=Ne(f),d=sP(u),m=aP(p,d),h=oP(m,u,l);t.moveShape(f,h)}})}Ee(_p,te),_p.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function oP(e,t,n){var i=Ra(e,t,n);return Bi(pi(i,e))}function aP(e,t){if(t.length){var n=cP(e,t);return xp(e,n)}}function sP(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 cP(e,t){var n=t.map(function(r){return{line:r,distance:jg(e,r)}}),i=di(n,"distance");return i[0].line}function lP(e,t,n,i){return Yg(e,t,n,i).point}function wp(e,t){te.call(this,e);function n(i,r){var o=i.context,a=o.connection,s=W({},o.hints),c=o.newWaypoints||a.waypoints,l=o.oldWaypoints;return typeof s.startChanged>"u"&&(s.startChanged=!!s.connectionStart),typeof s.endChanged>"u"&&(s.endChanged=!!s.connectionEnd),lP(r,c,l,s)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(i){var r=i.context,o=r.connection,a=o.outgoing,s=o.incoming;s.forEach(function(c){var l=c.waypoints[c.waypoints.length-1],u=n(i,l),f=[].concat(c.waypoints.slice(0,-1),[u]);t.updateWaypoints(c,f)}),a.forEach(function(c){var l=c.waypoints[0],u=n(i,l),f=[].concat([u],c.waypoints.slice(1));t.updateWaypoints(c,f)})}),this.postExecute(["connection.move"],function(i){var r=i.context,o=r.connection,a=o.outgoing,s=o.incoming,c=r.delta;s.forEach(function(l){var u=l.waypoints[l.waypoints.length-1],f={x:u.x+c.x,y:u.y+c.y},p=[].concat(l.waypoints.slice(0,-1),[f]);t.updateWaypoints(l,p)}),a.forEach(function(l){var u=l.waypoints[0],f={x:u.x+c.x,y:u.y+c.y},p=[].concat([f],l.waypoints.slice(1));t.updateWaypoints(l,p)})})}Ee(wp,te),wp.$inject=["eventBus","modeling"];function hc(e,t,n){var i=gc(e),r=ey(i,t),o=i[0];return r.length?r[r.length-1]:Ra(o.original||o,n,t)}function mc(e,t,n){var i=gc(e),r=ey(i,t),o=i[i.length-1];return r.length?r[0]:Ra(o.original||o,n,t)}function Ep(e,t,n){var i=gc(e),r=Jg(t,n),o=i[0];return Ra(o.original||o,r,t)}function Sp(e,t,n){var i=gc(e),r=Jg(t,n),o=i[i.length-1];return Ra(o.original||o,r,t)}function Jg(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function gc(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function ey(e,t){var n=hn(e,pP);return Ke(n,function(i){return uP(i,t)})}function uP(e,t){return cn(t,e,1)==="intersect"}function pP(e){return e.original||e}function Rp(e,t){te.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,r=n.newShape;if(fP(i,r)){var o=dP(i);o.incoming.forEach(function(a){var s=mc(a,r,i);t.reconnectEnd(a,r,s)}),o.outgoing.forEach(function(a){var s=hc(a,r,i);t.reconnectStart(a,r,s)})}},!0)}Rp.$inject=["eventBus","modeling"],Ee(Rp,te);function fP(e,t){return S(e,"bpmn:Participant")&&Qe(e)&&S(t,"bpmn:Participant")&&!Qe(t)}function dP(e){var t=ua([e]),n=[],i=[];return t.forEach(function(r){r!==e&&(r.incoming.forEach(function(o){S(o,"bpmn:MessageFlow")&&n.push(o)}),r.outgoing.forEach(function(o){S(o,"bpmn:MessageFlow")&&i.push(o)}))},[]),{incoming:n,outgoing:i}}const hP=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function ty(e){const t=ie(e);if(!S(t,"bpmn:BoundaryEvent")&&!(S(t,"bpmn:StartEvent")&&vn(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:hP.some(i=>S(n[0],i))}function ny(e){return S(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function Cp(e,t){e.invoke(te,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,r=n.context.newShape,o=n.context.hints;if(!ty(r))return;const a=ny(r);if(o.targetElement&&o.targetElement[a]!==void 0)return;const c=ie(i).get(a),l=ie(r).get(a);c!==l&&t.updateProperties(r,{[a]:c})})}Cp.$inject=["injector","modeling"],Ee(Cp,te);function Ap(e,t){te.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,r=ot(i),o=r&&r.get("label"),a=o&&o.get("bounds");a&&t.updateModdleProperties(i,o,{bounds:void 0})},!0)}Ee(Ap,te),Ap.$inject=["eventBus","modeling"];function Pp(e,t,n){te.call(this,e),this.preExecute("shape.delete",function(i){var r=i.context.shape;if(!(r.incoming.length!==1||r.outgoing.length!==1)){var o=r.incoming[0],a=r.outgoing[0];if(!(!S(o,"bpmn:SequenceFlow")||!S(a,"bpmn:SequenceFlow"))&&t.canConnect(o.source,a.target,o)){var s=mP(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}Ee(Pp,te),Pp.$inject=["eventBus","bpmnRules","modeling"];function Mo(e){return e.original||e}function mP(e,t){var n=vp(Mo(e[e.length-2]),Mo(e[e.length-1]),Mo(t[1]),Mo(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[Mo(e[0]),Mo(t[t.length-1])]}function Mp(e,t){te.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,r=i.parent;S(i,"bpmn:Participant")&&(n.collaborationRoot=r)},!0),this.postExecute("shape.delete",function(n){var i=n.collaborationRoot;if(i&&!i.businessObject.participants.length){var r=t.makeProcess(),o=i.children.slice();t.moveElements(o,{x:0,y:0},r)}},!0)}Mp.$inject=["eventBus","modeling"],Ee(Mp,te);function Tp(e,t,n,i){te.call(this,e);var r=i.get("dragging",!1);function o(c){var l=c.source,u=c.target,f=c.parent;if(f){var p,d;S(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(l,u)||(d=!0),n.canConnectMessageFlow(l,u)&&(p="bpmn:MessageFlow")),S(c,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(l,u)||(d=!0),n.canConnectSequenceFlow(l,u)&&(p="bpmn:SequenceFlow")),d&&t.removeConnection(c),p&&t.connect(l,u,{type:p,waypoints:c.waypoints.slice()})}}function a(c){var l=c.context,u=l.connection,f=l.newSource||u.source,p=l.newTarget||u.target,d,m;d=n.canConnect(f,p),!(!d||d.type===u.type)&&(m=t.connect(f,p,{type:d.type,associationDirection:d.associationDirection,waypoints:u.waypoints.slice()}),u.parent&&t.removeConnection(u),l.connection=m,r&&s(u,m))}function s(c,l){var u=r.context(),f=u&&u.payload.previousSelection,p;!f||!f.length||(p=f.indexOf(c),p!==-1&&f.splice(p,1,l))}this.postExecuted("elements.move",function(c){var l=c.closure,u=l.allConnections;F(u,o)},!0),this.preExecute("connection.reconnect",a),this.postExecuted("element.updateProperties",function(c){var l=c.context,u=l.properties,f=l.element,p=f.businessObject,d;u.default&&(d=vt(f.outgoing,ao({id:f.businessObject.default.id})),d&&t.updateProperties(d,{conditionExpression:void 0})),u.conditionExpression&&p.sourceRef.default===p&&t.updateProperties(f.source,{default:void 0})})}Ee(Tp,te),Tp.$inject=["eventBus","modeling","bpmnRules","injector"];function yc(e,t,n,i,r,o){i.invoke(te,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=o,this.postExecuted(["elements.create"],500,function(a){var s=a.context,c=s.parent,l=s.elements,u=Tn(l,function(f,p){var d=t.canReplace([p],p.host||p.parent||c);return d?f.concat(d.replacements):f},[]);u.length&&this._replaceElements(l,u)},this),this.postExecuted(["elements.move"],500,function(a){var s=a.context,c=s.newParent,l=s.newHost,u=[];F(s.closure.topLevel,function(p){vn(p)?u=u.concat(p.children):u=u.concat(p)}),u.length===1&&l&&(c=l);var f=t.canReplace(u,c);f&&this._replaceElements(u,f.replacements,l)},this),this.postExecute(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,l=s.newShape,u=c.attachers,f;u&&u.length&&(f=t.canReplace(u,l),this._replaceElements(u,f.replacements))},this),this.postExecuted(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,l=s.newShape;r.unclaimId(c.businessObject.id,c.businessObject),r.updateProperties(l,{id:c.id})})}Ee(yc,te),yc.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,r=this._selection;F(t,function(o){var a={type:o.newElementType},s=n.get(o.oldElementId),c=e.indexOf(s);e[c]=i.replaceElement(s,a,{select:!1})}),t&&r.select(e)},yc.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var gP=1500,yP={width:140,height:120},kp={width:300,height:60},Op={width:60,height:300},vc={width:300,height:150},bc={width:150,height:300},iy={width:140,height:120},ry={width:100,height:40};function oy(e){e.on("resize.start",gP,function(t){var n=t.context,i=n.shape,r=n.direction,o=n.balanced;(S(i,"bpmn:Lane")||S(i,"bpmn:Participant"))&&(n.resizeConstraints=wP(i,r,o)),S(i,"bpmn:SubProcess")&&Qe(i)&&(n.minDimensions=iy),S(i,"bpmn:TextAnnotation")&&(n.minDimensions=ry)})}oy.$inject=["eventBus"];var ur=Math.abs,vP=Math.min,bP=Math.max;function ay(e,t,n,i){var r=e[t];e[t]=r===void 0?n:i(n,r)}function To(e,t,n){return ay(e,t,n,vP)}function ko(e,t,n){return ay(e,t,n,bP)}var xP={top:20,left:50,right:20,bottom:20},_P={top:50,left:20,right:20,bottom:20};function wP(e,t,n){var i=ei(e),r=!0,o=!0,a=lc(i,[i]),s=Ie(e),c={},l={},u=tn(e),f=u?kp:Op;/n/.test(t)?l.top=s.bottom-f.height:/e/.test(t)?l.right=s.left+f.width:/s/.test(t)?l.bottom=s.top+f.height:/w/.test(t)&&(l.left=s.right-f.width),a.forEach(function(m){var h=Ie(m);u?(h.top<s.top-10&&(r=!1),h.bottom>s.bottom+10&&(o=!1)):(h.left<s.left-10&&(r=!1),h.right>s.right+10&&(o=!1)),/n/.test(t)&&(n&&ur(s.top-h.bottom)<10&&ko(c,"top",h.top+f.height),ur(s.top-h.top)<5&&To(l,"top",h.bottom-f.height)),/e/.test(t)&&(n&&ur(s.right-h.left)<10&&To(c,"right",h.right-f.width),ur(s.right-h.right)<5&&ko(l,"right",h.left+f.width)),/s/.test(t)&&(n&&ur(s.bottom-h.top)<10&&To(c,"bottom",h.bottom-f.height),ur(s.bottom-h.bottom)<5&&ko(l,"bottom",h.top+f.height)),/w/.test(t)&&(n&&ur(s.left-h.right)<10&&ko(c,"left",h.left+f.width),ur(s.left-h.left)<5&&To(l,"left",h.right-f.width))});var p=i.children.filter(function(m){return!m.hidden&&!m.waypoints&&(S(m,"bpmn:FlowElement")||S(m,"bpmn:Artifact"))}),d=u?xP:_P;return p.forEach(function(m){var h=Ie(m);/n/.test(t)&&(!u||r)&&To(l,"top",h.top-d.top),/e/.test(t)&&(u||o)&&ko(l,"right",h.right+d.right),/s/.test(t)&&(!u||o)&&ko(l,"bottom",h.bottom+d.bottom),/w/.test(t)&&(u||r)&&To(l,"left",h.left-d.left)}),{min:l,max:c}}function sy(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function Oo(e){return e.originalEvent||e.srcEvent}function Dp(e){sy(e),sy(Oo(e))}function Hr(e){return e.pointers&&e.pointers.length&&(e=e.pointers[0]),e.touches&&e.touches.length&&(e=e.touches[0]),e?{x:e.clientX,y:e.clientY}:null}function cy(){return/mac/i.test(navigator.platform)}function ly(e,t){return(Oo(e)||e).button===t}function pr(e){return ly(e,0)}function EP(e){return ly(e,1)}function Ca(e){var t=Oo(e)||e;return pr(e)?cy()?t.metaKey:t.ctrlKey:!1}function xc(e){var t=Oo(e)||e;return pr(e)&&t.shiftKey}var uy=1001;function py(e,t){e.on("resize.start",uy+500,function(n){var i=n.context,r=i.shape;(S(r,"bpmn:Lane")||S(r,"bpmn:Participant"))&&(i.balanced=!Ca(n))}),e.on("resize.end",uy,function(n){var i=n.context,r=i.shape,o=i.canExecute,a=i.newBounds;if(S(r,"bpmn:Lane")||S(r,"bpmn:Participant"))return o&&(a=jm(a),t.resizeLane(r,a,i.balanced)),!1})}py.$inject=["eventBus","modeling"];var SP=500;function Ip(e,t,n,i,r){n.invoke(te,this);function o(u){return qe(u,["bpmn:ReceiveTask","bpmn:SendTask"])||RP(u,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(u){var f=e.getDefinitions(),p=f.get("rootElements");return!!vt(p,ao({id:u.id}))}function s(u){if(S(u,"bpmn:ErrorEventDefinition"))return"errorRef";if(S(u,"bpmn:EscalationEventDefinition"))return"escalationRef";if(S(u,"bpmn:MessageEventDefinition"))return"messageRef";if(S(u,"bpmn:SignalEventDefinition"))return"signalRef"}function c(u){if(qe(u,["bpmn:ReceiveTask","bpmn:SendTask"]))return u.get("messageRef");var f=u.get("eventDefinitions"),p=f[0];return p.get(s(p))}function l(u,f){if(qe(u,["bpmn:ReceiveTask","bpmn:SendTask"]))return u.set("messageRef",f);var p=u.get("eventDefinitions"),d=p[0];return d.set(s(d),f)}this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],function(u){var f=u.shape||u.element;if(o(f)){var p=ie(f),d=c(p),m;d&&!a(d)&&(m=e.getDefinitions().get("rootElements"),Bt(m,d),u.addedRootElement=d)}},!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],function(u){var f=u.addedRootElement;if(f){var p=e.getDefinitions().get("rootElements");Lt(p,f)}},!0),t.on("copyPaste.copyElement",function(u){var f=u.descriptor,p=u.element;if(!(p.labelTarget||!o(p))){var d=ie(p),m=c(d);m&&(f.referencedRootElement=m)}}),t.on("copyPaste.pasteElement",SP,function(u){var f=u.descriptor,p=f.businessObject,d=f.referencedRootElement;d&&(a(d)||(d=i.copyElement(d,r.create(d.$type))),l(p,d),delete f.referencedRootElement)})}Ip.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],Ee(Ip,te);function RP(e,t){return Be(t)||(t=[t]),Xi(t,function(n){return Eo(e,n)})}var fy=Math.max;function dy(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,r=t.start,o={};return F(n,function(a){var s=a.id;S(a,"bpmn:Participant")&&(o[s]=AP(a,i,r)),S(a,"bpmn:Lane")&&(o[s]=tn(a)?kp:Op),S(a,"bpmn:SubProcess")&&Qe(a)&&(o[s]=iy),S(a,"bpmn:TextAnnotation")&&(o[s]=ry),S(a,"bpmn:Group")&&(o[s]=yP)}),o})}dy.$inject=["eventBus"];function CP(e){return e==="x"}function AP(e,t,n){var i=tn(e);if(!TP(e))return i?vc:bc;var r=CP(t),o={};return r?i?o=vc:o={width:MP(e,n,r),height:bc.height}:i?o={width:vc.width,height:PP(e,n,r)}:o=bc,o}function PP(e,t,n){var i;return i=kP(e,t,n),fy(vc.height,i)}function MP(e,t,n){var i;return i=OP(e,t,n),fy(bc.width,i)}function TP(e){return!!lr(e).length}function kP(e,t,n){var i=lr(e),r;return r=Lp(i,t,n),e.height-r.height+kp.height}function OP(e,t,n){var i=lr(e),r;return r=Lp(i,t,n),e.width-r.width+Op.width}function Lp(e,t,n){var i,r,o;for(i=0;i<e.length;i++)if(r=e[i],!n&&t>=r.y&&t<=r.y+r.height||n&&t>=r.x&&t<=r.x+r.width)return o=lr(r),o.length?Lp(o,t,n):r}var hy="_plane";function my(e){var t=e.id;return DP(t)}function Ei(e){var t=e.id;return S(e,"bpmn:SubProcess")?gy(t):t}function zr(e){return gy(e)}function _c(e){var t=ot(e);return S(t,"bpmndi:BPMNPlane")}function gy(e){return e+hy}function DP(e){return e.replace(new RegExp(hy+"$"),"")}var yy=400,IP=600,vy={x:180,y:160};function ji(e,t,n,i,r,o,a){te.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=i,this._bpmnFactory=r,this._bpmnjs=o,this._elementRegistry=a;var s=this;function c(f){return S(f,"bpmn:SubProcess")&&!Qe(f)}function l(f){var p=f.shape,d=f.newRootElement,m=ie(p);d=s._addDiagram(d||m),f.newRootElement=e.addRootElement(d)}function u(f){var p=f.shape,d=ie(p);s._removeDiagram(d);var m=f.newRootElement=a.get(Ei(d));e.removeRootElement(m)}this.executed("shape.create",function(f){var p=f.shape;c(p)&&l(f)},!0),this.postExecuted("elements.create",function(f){var p=f.elements;F(p,function(d){if(c(d)){var m=a.get(Ei(d));if(!(!m||!d.children||!d.children.length)){var h=by(d);s._showRecursively(h),s._moveChildrenToShape(h,m)}}})},!0),this.reverted("shape.create",function(f){var p=f.shape;c(p)&&u(f)},!0),this.preExecute("shape.delete",function(f){var p=f.shape;!S(p,"bpmn:SubProcess")||!Qe(p)||F(ga([p]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(f){var p=f.shape;if(c(p)){var d=a.get(Ei(p));d&&n.removeElements(d.children.slice())}},!0),this.executed("shape.delete",function(f){var p=f.shape;c(p)&&u(f)},!0),this.reverted("shape.delete",function(f){var p=f.shape;c(p)&&l(f)},!0),this.preExecuted("shape.replace",function(f){var p=f.oldShape,d=f.newShape;!c(p)||!c(d)||(f.oldRoot=e.removeRootElement(Ei(p)))},!0),this.postExecuted("shape.replace",function(f){var p=f.newShape,d=f.oldRoot,m=e.findRoot(Ei(p));if(!(!d||!m)){var h=d.children;n.moveElements(h,{x:0,y:0},m)}},!0),this.executed("element.updateProperties",function(f){var p=f.element;if(S(p,"bpmn:SubProcess")){var d=f.properties,m=f.oldProperties,h=m.id,y=d.id;if(h!==y){if(_c(p)){a.updateId(p,zr(y)),a.updateId(h,y);return}var v=a.get(zr(h));v&&a.updateId(zr(h),zr(y))}}},!0),this.reverted("element.updateProperties",function(f){var p=f.element;if(S(p,"bpmn:SubProcess")){var d=f.properties,m=f.oldProperties,h=m.id,y=d.id;if(h!==y){if(_c(p)){a.updateId(p,zr(h)),a.updateId(y,h);return}var v=a.get(zr(y));v&&a.updateId(v,zr(h))}}},!0),t.on("element.changed",function(f){var p=f.element;if(_c(p)){var d=p,m=a.get(my(d));!m||m===d||t.fire("element.changed",{element:m})}}),this.executed("shape.toggleCollapse",yy,function(f){var p=f.shape;S(p,"bpmn:SubProcess")&&(Qe(p)?u(f):(l(f),s._showRecursively(p.children)))},!0),this.reverted("shape.toggleCollapse",yy,function(f){var p=f.shape;S(p,"bpmn:SubProcess")&&(Qe(p)?u(f):(l(f),s._showRecursively(p.children)))},!0),this.postExecuted("shape.toggleCollapse",IP,function(f){var p=f.shape;if(S(p,"bpmn:SubProcess")){var d=f.newRootElement;if(d)if(Qe(p))s._moveChildrenToShape(d.children.slice(),p),F(ga(p.children),h=>{n.moveShape(h.annotation,{x:0,y:0},p.parent),F(h.associations,y=>{n.moveConnection(y,{x:0,y:0},p.parent)})});else{s._disconnectSharedAnnotations(p);var m=by(p);s._moveChildrenToShape(m,d)}}},!0),t.on("copyPaste.createTree",function(f){var p=f.element,d=f.children;if(c(p)){var m=Ei(p),h=a.get(m);h&&d.push.apply(d,h.children)}}),t.on("copyPaste.copyElement",function(f){var p=f.descriptor,d=f.element,m=f.elements,h=d.parent,y=S(ot(h),"bpmndi:BPMNPlane");if(y){var v=my(h),g=vt(m,function(b){return b.id===v});g&&(p.parent=g.id)}}),t.on("copyPaste.pasteElement",function(f){var p=f.descriptor;p.parent&&(c(p.parent)||p.parent.hidden)&&(p.hidden=!0)})}Ee(ji,te),ji.prototype._moveChildrenToShape=function(e,t){var n=this._modeling;if(e.length){var i=e.filter(function(c){return!c.hidden});if(!i.length){n.moveElements(e,{x:0,y:0},t,{autoResize:!1});return}var r=Ft(i),o;if(!t.x)o={x:vy.x-r.x,y:vy.y-r.y};else{var a=Ne(t),s=Ne(r);o={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,o,t,{autoResize:!1})}},ji.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(lg(e).map(i=>i.annotation));n.size&&F(ga(e.children),i=>{n.has(i.annotation)&&F(i.associations,r=>{t.removeConnection(r)})})},ji.prototype._showRecursively=function(e,t){var n=this,i=[];return e.forEach(function(r){r.hidden=!!t,i=i.concat(r),r.children&&(i=i.concat(n._showRecursively(r.children,r.collapsed||t)))}),i},ji.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},ji.prototype._createNewDiagram=function(e){var t=this._bpmnFactory,n=this._elementFactory,i=t.create("bpmndi:BPMNPlane",{bpmnElement:e}),r=t.create("bpmndi:BPMNDiagram",{plane:i});i.$parent=r;var o=n.createRoot({id:Ei(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return o},ji.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=vt(n,function(r){return r.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},ji.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function LP(e){var t=[];return F(ga(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function by(e){return e.children.slice().concat(LP(e.children)).concat(BP(e))}function BP(e){return ju(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function Bp(e,t){e.invoke(te,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,r=n.context.newShape;if(!(!S(r,"bpmn:SubProcess")||S(r,"bpmn:AdHocSubProcess")||!(S(i,"bpmn:Task")||S(i,"bpmn:CallActivity"))||!Qe(r))){var o=NP(r);t.createShape({type:"bpmn:StartEvent"},o,r)}})}Bp.$inject=["injector","modeling"],Ee(Bp,te);function NP(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function Np(e,t){te.call(this,e),this.preExecute("connection.create",function(n){const{target:i}=n;S(i,"bpmn:TextAnnotation")&&(n.parent=i.parent)},!0),this.preExecute(["shape.create","shape.resize","elements.move"],function(n){const i=n.shapes||[n.shape];i.length===1&&S(i[0],"bpmn:TextAnnotation")&&(n.hints=n.hints||{},n.hints.autoResize=!1)},!0),this.preExecute("shape.resize",function(n){var i=n.context,r=i.shape,o=i.hints||{};if(!(!S(r,"bpmn:TextAnnotation")||o.autoResize)){var a=i.newBounds,s=t.getTextAnnotationBounds(a,qn(r)||""),c=a.y!==r.y&&Math.abs(a.y+a.height-(r.y+r.height))<=1,l=r.y+r.height;i.newBounds={width:a.width,height:s.height,x:a.x,y:c?l-s.height:a.y}}})}Ee(Np,te),Np.$inject=["eventBus","textRenderer"];function $p(e,t){te.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(Qe(i))return;var r=ua(i);r.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();F(s,function(l){o(l,!0)}),F(c,function(l){o(l,!1)})});function o(a,s){r.indexOf(a.source)!==-1&&r.indexOf(a.target)!==-1||S(a,"bpmn:Association")&&(S(a.source,"bpmn:TextAnnotation")||S(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,i,Ne(i)):t.reconnectStart(a,i,Ne(i)))}},!0)}Ee($p,te),$p.$inject=["eventBus","modeling"];var Fp=500;function jp(e,t,n){te.call(this,e);function i(a){a.length&&a.forEach(function(s){s.type==="label"&&!s.businessObject.name&&(s.hidden=!0)})}function r(a,s){var c=a.children,l=s,u,f;return u=$P(c).concat([a]),f=Ag(u),f?(l.width=Math.max(f.width,l.width),l.height=Math.max(f.height,l.height),l.x=f.x+(f.width-l.width)/2,l.y=f.y+(f.height-l.height)/2):(l.x=a.x+(a.width-l.width)/2,l.y=a.y+(a.height-l.height)/2),l}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"],Fp,function(a){var s=a.context,c=s.shape;S(c,"bpmn:SubProcess")&&(c.collapsed?ot(c).isExpanded=!1:(i(c.children),ot(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],Fp,function(a){var s=a.context,c=s.shape;c.collapsed?ot(c).isExpanded=!1:ot(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],Fp,function(a){var s=a.context.shape,c=t.getDefaultSize(s),l;s.collapsed?l=o(s,c):l=r(s,c),n.resizeShape(s,l,null,{autoResize:s.collapsed?!1:"nwse"})})}Ee(jp,te),jp.$inject=["eventBus","elementFactory","modeling"];function $P(e){return e.filter(function(t){return!t.hidden})}function Hp(e,t,n,i){t.invoke(te,this),this.preExecute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.businessObject;Ye(a)||(S(a,"bpmn:Participant")&&Qe(a)&&n.ids.unclaim(s.processRef.id),i.unclaimId(s.id,s))}),this.preExecute("connection.delete",function(r){var o=r.context,a=o.connection,s=a.businessObject;i.unclaimId(s.id,s)}),this.preExecute("canvas.updateRoot",function(){var r=e.getRootElement(),o=r.businessObject;S(r,"bpmn:Collaboration")&&n.ids.unclaim(o.id)})}Ee(Hp,te),Hp.$inject=["canvas","injector","moddle","modeling"];function zp(e,t){te.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,r=i.connection,o=r.source;FP(r,o)&&t.updateProperties(o,{default:null})})}Ee(zp,te),zp.$inject=["eventBus","modeling"];function FP(e,t){if(!S(e,"bpmn:SequenceFlow"))return!1;var n=ie(t),i=ie(e);return n.get("default")===i}var jP=500,HP=5e3,xy=["shape.create","shape.delete","shape.move","shape.resize"],_y=[...xy,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function Gp(e,t){te.call(this,e);var n;function i(){return n=n||new zP,n.enter(),n}function r(){if(!n)throw new Error("out of bounds release");return n}function o(){if(!n)throw new Error("out of bounds release");var a=n.leave();return a&&(t.updateLaneRefs(n.flowNodes,n.lanes),n=null),a}this.preExecute(_y,HP,function(){i()}),this.postExecuted(_y,jP,function(){o()}),this.preExecute(xy,function(a){var s=a.context,c=s.shape,l=r();!c||c.labelTarget||(S(c,"bpmn:Lane")&&l.addLane(c),S(c,"bpmn:FlowNode")&&l.addFlowNode(c))})}Gp.$inject=["eventBus","modeling"],Ee(Gp,te);function zP(){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}}var GP=500,VP=5e3,wy=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],Ey=[...wy,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function Vp(e,t){te.call(this,e);var n;function i(){return n=n||new WP,n.enter(),n}function r(){if(!n)throw new Error("out of bounds release");return n}function o(){if(!n)throw new Error("out of bounds release");var a=n.leave();return a&&(t.updateCategoryValueRefs(Array.from(n.affectedFlowElements),Array.from(n.affectedGroupEntries.values())),n=null),a}this.preExecute(Ey,VP,function(){i()}),this.postExecuted(Ey,GP,function(){o()}),this.preExecute(wy,function(a){var s=a.context.connection||a.context.shape,c=r();!s||s.labelTarget||(S(s,"bpmn:FlowElement")&&c.addFlowElement(s),S(s,"bpmn:Group")&&c.addGroup(s))}),this.preExecute("label.create",function(a){var s=a.context.labelTarget;S(s,"bpmn:Group")&&r().addGroup(s)})}Vp.$inject=["eventBus","modeling"],Ee(Vp,te);function WP(){this.affectedFlowElements=new Set,this.affectedGroupEntries=new Map,this.counter=0,this.addFlowElement=function(e){this.affectedFlowElements.add(e)},this.addGroup=function(e){this.affectedGroupEntries.has(e)||this.affectedGroupEntries.set(e,{categoryValue:e.businessObject.categoryValueRef,groupShape:e})},this.enter=function(){this.counter++},this.leave=function(){return this.counter--,!this.counter}}function Wp(e,t){te.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,r=i.elements;for(const o of r)UP(o)&&!qP(o)&&t.updateProperties(o,{isForCompensation:void 0})})}Ee(Wp,te),Wp.$inject=["eventBus","modeling"];function UP(e){const t=ie(e);return t&&t.isForCompensation}function YP(e){return e&&S(e,"bpmn:BoundaryEvent")&&Eo(e,"bpmn:CompensateEventDefinition")}function qP(e){return e.incoming.filter(n=>YP(n.source)).length>0}const KP={__init__:["adaptiveLabelPositioningBehavior","appendBehavior","artifactBehavior","associationBehavior","attachEventBehavior","boundaryEventBehavior","categoryRootElementReferenceBehavior","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","updateCategoryValueRefsBehavior","unsetDefaultFlowBehavior","setCompensationActivityAfterPasteBehavior"],adaptiveLabelPositioningBehavior:["type",Ju],appendBehavior:["type",ep],associationBehavior:["type",np],attachEventBehavior:["type",nc],artifactBehavior:["type",tp],boundaryEventBehavior:["type",ip],categoryRootElementReferenceBehavior:["type",rp],compensateBoundaryEventBehaviour:["type",op],createBehavior:["type",ap],createDataObjectBehavior:["type",sp],createParticipantBehavior:["type",up],dataInputAssociationBehavior:["type",pp],dataStoreBehavior:["type",fp],deleteLaneBehavior:["type",dp],detachEventBehavior:["type",uc],dropOnFlowBehavior:["type",mp],eventBasedGatewayBehavior:["type",gp],fixHoverBehavior:["type",Ig],groupBehavior:["type",yp],importDockingFix:["type",Bg],isHorizontalFix:["type",bp],labelBehavior:["type",_p],layoutConnectionBehavior:["type",wp],messageFlowBehavior:["type",Rp],nonInterruptingBehavior:["type",Cp],removeElementBehavior:["type",Pp],removeEmbeddedLabelBoundsBehavior:["type",Ap],removeParticipantBehavior:["type",Mp],replaceConnectionBehavior:["type",Tp],replaceElementBehaviour:["type",yc],resizeBehavior:["type",oy],resizeLaneBehavior:["type",py],rootElementReferenceBehavior:["type",Ip],spaceToolBehavior:["type",dy],subProcessPlaneBehavior:["type",ji],subProcessStartEventBehavior:["type",Bp],textAnnotationBehavior:["type",Np],toggleCollapseConnectionBehaviour:["type",$p],toggleElementCollapseBehaviour:["type",jp],unclaimIdBehavior:["type",Hp],unsetDefaultFlowBehavior:["type",zp],updateFlowNodeRefsBehavior:["type",Gp],updateCategoryValueRefsBehavior:["type",Vp],setCompensationActivityAfterPasteBehavior:["type",Wp]};function Up(e){this._commandStack=e.get("commandStack",!1)}Up.$inject=["injector"],Up.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const Si={__init__:["rules"],rules:["type",Up]};function ti(e){te.call(this,e),this.init()}ti.$inject=["eventBus"],Ee(ti,te),ti.prototype.addRule=function(e,t,n){var i=this;typeof e=="string"&&(e=[e]),e.forEach(function(r){i.canExecute(r,t,function(o,a,s){return n(o)},!0)})},ti.prototype.init=function(){};function Sy(e,t){var n=cn(e,t,-15);return n!=="intersect"?n:null}function un(e){ti.call(this,e)}Ee(un,ti),un.$inject=["eventBus"],un.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return XP(t)}),this.addRule("connection.create",function(e){var t=e.source,n=e.target,i=e.hints||{},r=i.targetParent,o=i.targetAttach;if(o)return!1;r&&(n.parent=r);try{return Ec(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return Ec(n,i,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,i=e.direction;return Ny(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return ht(i)&&!Sc(t,i)?!1:kr(t,function(r){return ht(r)?Ec(r.source,r.target,r):r.host?Aa(r,r.host,null,n):Xp(r,i)})}),this.addRule("elements.move",function(e){var t=e.target,n=e.shapes,i=e.position,r=e.hints;return r!=null&&r.keyboardMove&&n.some(function(a){return ky(a)&&!n.includes(a.host)})?!1:Aa(n,t,null,i)||Ly(n,t,i)||By(n,t)||Sc(n,t)}),this.addRule("shape.create",function(e){return Xp(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return Aa(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return zy(n,t)})},un.prototype.canConnectMessageFlow=jy,un.prototype.canConnectSequenceFlow=Hy,un.prototype.canConnectDataAssociation=Zp,un.prototype.canConnectAssociation=$y,un.prototype.canConnectCompensationAssociation=Fy,un.prototype.canMove=By,un.prototype.canAttach=Aa,un.prototype.canReplace=Ly,un.prototype.canDrop=Do,un.prototype.canInsert=Sc,un.prototype.canCreate=Xp,un.prototype.canConnect=Ec,un.prototype.canResize=Ny,un.prototype.canCopy=zy;function XP(e){return Yp(e)?null:qe(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function Yp(e){return!e||Ye(e)}function Ry(e){do{if(S(e,"bpmn:Process"))return ie(e);if(S(e,"bpmn:Participant"))return ie(e).processRef||ie(e)}while(e=e.parent)}function qp(e){return S(e,"bpmn:TextAnnotation")}function Kp(e){return S(e,"bpmn:Group")&&!e.labelTarget}function Cy(e){return S(e,"bpmn:BoundaryEvent")&&Ri(e,"bpmn:CompensateEventDefinition")}function wc(e){return ie(e).isForCompensation}function ZP(e,t){var n=Ry(e),i=Ry(t);return n===i}function QP(e){return S(e,"bpmn:InteractionNode")&&!S(e,"bpmn:BoundaryEvent")&&(!S(e,"bpmn:Event")||S(e,"bpmn:ThrowEvent")&&My(e,"bpmn:MessageEventDefinition"))}function JP(e){return S(e,"bpmn:InteractionNode")&&!wc(e)&&(!S(e,"bpmn:Event")||S(e,"bpmn:CatchEvent")&&My(e,"bpmn:MessageEventDefinition"))&&!(S(e,"bpmn:BoundaryEvent")&&!Ri(e,"bpmn:MessageEventDefinition"))}function Ay(e){for(var t=e;t=t.parent;){if(S(t,"bpmn:FlowElementsContainer"))return ie(t);if(S(t,"bpmn:Participant"))return ie(t).processRef}return null}function Py(e,t){var n=Ay(e),i=Ay(t);return n===i}function Ri(e,t){var n=ie(e);return!!vt(n.eventDefinitions||[],function(i){return S(i,t)})}function My(e,t){var n=ie(e);return(n.eventDefinitions||[]).every(function(i){return S(i,t)})}function eM(e){return S(e,"bpmn:FlowNode")&&!S(e,"bpmn:EndEvent")&&!vn(e)&&!(S(e,"bpmn:IntermediateThrowEvent")&&Ri(e,"bpmn:LinkEventDefinition"))&&!Cy(e)&&!wc(e)}function tM(e){return S(e,"bpmn:FlowNode")&&!S(e,"bpmn:StartEvent")&&!S(e,"bpmn:BoundaryEvent")&&!vn(e)&&!(S(e,"bpmn:IntermediateCatchEvent")&&Ri(e,"bpmn:LinkEventDefinition"))&&!wc(e)}function nM(e){return S(e,"bpmn:ReceiveTask")||S(e,"bpmn:IntermediateCatchEvent")&&(Ri(e,"bpmn:MessageEventDefinition")||Ri(e,"bpmn:TimerEventDefinition")||Ri(e,"bpmn:ConditionalEventDefinition")||Ri(e,"bpmn:SignalEventDefinition"))}function iM(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function Ty(e,t){var n=iM(t);return n.indexOf(e)!==-1}function Ec(e,t,n){if(Yp(e)||Yp(t))return null;if(!S(n,"bpmn:DataAssociation")){if(jy(e,t))return{type:"bpmn:MessageFlow"};if(Hy(e,t))return{type:"bpmn:SequenceFlow"}}var i=Zp(e,t);return i||(Fy(e,t)?{type:"bpmn:Association",associationDirection:"One"}:$y(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function Do(e,t){return Ye(e)||Kp(e)?!0:S(t,"bpmn:Participant")&&!Qe(t)?!1:S(e,"bpmn:Participant")?S(t,"bpmn:Process")||S(t,"bpmn:Collaboration"):qe(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:S(e,"bpmn:Lane")?S(t,"bpmn:Participant")||S(t,"bpmn:Lane"):S(e,"bpmn:BoundaryEvent")&&!rM(e)?!1:S(e,"bpmn:FlowElement")&&!S(e,"bpmn:DataStoreReference")?S(t,"bpmn:FlowElementsContainer")?Qe(t):qe(t,["bpmn:Participant","bpmn:Lane"]):S(e,"bpmn:DataStoreReference")&&S(t,"bpmn:Collaboration")?Xi(ie(t).get("participants"),function(n){return!!n.get("processRef")}):qe(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?qe(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):S(e,"bpmn:MessageFlow")?S(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function rM(e){return ie(e).cancelActivity&&(Oy(e)||Dy(e))}function ky(e){return!Ye(e)&&S(e,"bpmn:BoundaryEvent")}function oM(e){return S(e,"bpmn:Lane")}function aM(e){return ky(e)||S(e,"bpmn:IntermediateThrowEvent")&&Oy(e)?!0:S(e,"bpmn:IntermediateCatchEvent")&&Dy(e)}function Oy(e){var t=ie(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function Dy(e){return Iy(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function Iy(e,t){return t.some(function(n){return Ri(e,n)})}function sM(e){return S(e,"bpmn:ReceiveTask")&&vt(e.incoming,function(t){return S(t.source,"bpmn:EventBasedGateway")})}function Aa(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var r=e[0];return Ye(r)||!aM(r)||vn(t)||!S(t,"bpmn:Activity")||wc(t)||i&&!Sy(i,t)||sM(t)?!1:"attach"}function Ly(e,t,n){if(!t)return!1;var i={replacements:[]};return F(e,function(r){vn(t)||S(r,"bpmn:StartEvent")&&r.type!=="label"&&Do(r,t)&&(gC(r)||i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),(yC(r)||vC(r)||bC(r))&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),Iy(r,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&S(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"})),S(t,"bpmn:Transaction")||Ri(r,"bpmn:CancelEventDefinition")&&r.type!=="label"&&(S(r,"bpmn:EndEvent")&&Do(r,t)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:EndEvent"}),S(r,"bpmn:BoundaryEvent")&&Aa(r,t,null,n)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function By(e,t){return Xi(e,oM)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return Do(n,t)})}function Xp(e,t,n,i){return t?Ye(e)||Kp(e)?!0:Do(e,t)||Sc(e,t):!1}function Ny(e,t,n){return S(e,"bpmn:SubProcess")?Qe(e)&&(!t||t.width>=100&&t.height>=80):S(e,"bpmn:Lane")||S(e,"bpmn:Participant")?!0:qp(e)?n?n==="e"||n==="w":!0:Kp(e)?!0:Ye(e)?n?n==="e"||n==="w":!0:!1}function cM(e,t){var n=qp(e),i=qp(t);return(n||i)&&n!==i}function $y(e,t){return Ty(t,e)||Ty(e,t)?!1:cM(e,t)?!0:!!Zp(e,t)}function Fy(e,t){return Py(e,t)&&Cy(e)&&S(t,"bpmn:Activity")&&!uM(t,e)&&!vn(t)}function jy(e,t){return Vy(e)&&!Vy(t)?!1:QP(e)&&JP(t)&&!ZP(e,t)}function Hy(e,t){return eM(e)&&tM(t)&&Py(e,t)&&!(S(e,"bpmn:EventBasedGateway")&&!nM(t))}function Zp(e,t){return qe(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&qe(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:qe(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&qe(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function Sc(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:qe(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!Ye(t)&&S(e,"bpmn:FlowNode")&&!S(e,"bpmn:BoundaryEvent")&&Do(e,t.parent)}function Qp(e,t){return e&&t&&e.indexOf(t)!==-1}function zy(e,t){return Ye(t)?!0:!(S(t,"bpmn:Lane")&&!Qp(e,t.parent)||S(t,"bpmn:MessageFlow")&&!lM(e,t))}function lM(e,t){var n=Gy(t.source),i=Gy(t.target);return Qp(e,n)&&Qp(e,i)}function Gy(e){for(;e;e=e.parent)if(S(e,"bpmn:Participant"))return e;return null}function Vy(e){return Co(e,"bpmn:Process")||Co(e,"bpmn:Collaboration")}function uM(e,t){return e.attachers.includes(t)}const pM={__depends__:[Si],__init__:["bpmnRules"],bpmnRules:["type",un]};var fM=2e3;function Wy(e,t){e.on("saveXML.start",fM,n);function n(){var i=t.getRootElements();F(i,function(r){var o=ot(r),a,s;a=ua([r]),a=Ke(a,function(c){return c!==r&&!c.labelTarget}),s=hn(a,ot),o.set("planeElement",s)})}}Wy.$inject=["eventBus","canvas"];const dM={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",Wy]};function Rc(e){te.call(this,e);var t=this;this.preExecute(["shape.create","connection.create"],function(n){var i=n.context,r=i.shape||i.connection,o=i.parent,a=t.getOrdering(r,o);a&&(a.parent!==void 0&&(i.parent=a.parent),i.parentIndex=a.index)}),this.preExecute(["shape.move","connection.move"],function(n){var i=n.context,r=i.shape||i.connection,o=i.newParent||r.parent,a=t.getOrdering(r,o);a&&(a.parent!==void 0&&(i.newParent=a.parent),i.newParentIndex=a.index)})}Rc.prototype.getOrdering=function(e,t){return null},Ee(Rc,te);function Jp(e,t){Rc.call(this,e);var n=[{type:"bpmn:SubProcess",order:{level:6}},{type:"bpmn:SequenceFlow",order:{level:9,containers:["bpmn:Participant","bpmn:FlowElementsContainer"]}},{type:"bpmn:DataAssociation",order:{level:9,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:TextAnnotation",order:{level:9}},{type:"bpmn:MessageFlow",order:{level:9,containers:["bpmn:Collaboration"]}},{type:"bpmn:Association",order:{level:6,containers:["bpmn:Participant","bpmn:FlowElementsContainer","bpmn:Collaboration"]}},{type:"bpmn:BoundaryEvent",order:{level:8}},{type:"bpmn:Group",order:{level:10,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:FlowElement",order:{level:5}},{type:"bpmn:Participant",order:{level:-2}},{type:"bpmn:Lane",order:{level:-1}}];function i(a){if(a.labelTarget)return{level:10};var s=vt(n,function(c){return qe(a,[c.type])});return s&&s.order||{level:1}}function r(a){var s=a.order;if(s||(a.order=s=i(a)),!s)throw new Error(`no order for <${a.id}>`);return s}function o(a,s,c){for(var l=s;l&&!qe(l,c);)l=l.parent;if(!l)throw new Error(`no parent for <${a.id}> in <${s&&s.id}>`);return l}this.getOrdering=function(a,s){if(a.labelTarget||S(a,"bpmn:TextAnnotation"))return{parent:t.findRoot(s)||t.getRootElement(),index:-1};var c=r(a);c.containers&&(s=o(a,s,c.containers));var l=s.children.indexOf(a),u=Ld(s.children,function(f){return!a.labelTarget&&f.labelTarget?!1:c.level<r(f).level});return u!==-1&&l!==-1&&l<u&&(u-=1),{index:u,parent:s}}}Jp.$inject=["eventBus","canvas"],Ee(Jp,Rc);const hM={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",Jp]};function Pa(){}Pa.prototype.get=function(){return this._data},Pa.prototype.set=function(e){this._data=e},Pa.prototype.clear=function(){var e=this._data;return delete this._data,e},Pa.prototype.isEmpty=function(){return!this._data};const mM={clipboard:["type",Pa]};var Uy=1500;function Yy(e,t,n){var i=this,r=n.get("dragging",!1);function o(a){if(!a.hover){var s=a.originalEvent,c=i._findTargetGfx(s),l=c&&e.get(c);c&&l&&(a.stopPropagation(),r.hover({element:l,gfx:c}),r.move(s))}}r&&t.on("drag.start",function(a){t.once("drag.move",Uy,function(s){o(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",Uy,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=Hr(a),c=document.elementFromPoint(s.x,s.y),gM(c)}}Yy.$inject=["elementRegistry","eventBus","injector"];function gM(e){return Lr(e,"svg, .djs-element",!0)}const yM={__init__:["hoverFix"],hoverFix:["type",Yy]};function vM(e){return!0}function Cc(e){return pr(e)||EP(e)}var qy=500;function Ky(e,t,n){var i=this;function r(P,B,D){if(!s(P,B)){var I,z,oe;D?z=t.getGraphics(D):(I=B.delegateTarget||B.target,I&&(z=I,D=t.get(z))),!(!z||!D)&&(oe=e.fire(P,{element:D,gfx:z,originalEvent:B}),oe===!1&&(B.stopPropagation(),B.preventDefault()))}}var o={};function a(P){return o[P]}function s(P,B){var D=l[P]||pr;return!D(B)}var c={click:"element.click",contextmenu:"element.contextmenu",dblclick:"element.dblclick",mousedown:"element.mousedown",mousemove:"element.mousemove",mouseover:"element.hover",mouseout:"element.out",mouseup:"element.mouseup"},l={"element.contextmenu":vM,"element.mousedown":Cc,"element.mouseup":Cc,"element.click":Cc,"element.dblclick":Cc};function u(P,B,D){var I=c[P];if(!I)throw new Error("unmapped DOM event name <"+P+">");return r(I,B,D)}var f="svg, .djs-element";function p(P,B,D,I){var z=o[D]=function(oe){r(D,oe)};I&&(l[D]=I),z.$delegate=On.bind(P,f,B,z)}function d(P,B,D){var I=a(D);I&&On.unbind(P,B,I.$delegate)}function m(P){F(c,function(B,D){p(P,D,B)})}function h(P){F(c,function(B,D){d(P,D,B)})}e.on("canvas.destroy",function(P){h(P.svg)}),e.on("canvas.init",function(P){m(P.svg)}),e.on(["shape.added","connection.added"],function(P){var B=P.element,D=P.gfx;e.fire("interactionEvents.createHit",{element:B,gfx:D})}),e.on(["shape.changed","connection.changed"],qy,function(P){var B=P.element,D=P.gfx;e.fire("interactionEvents.updateHit",{element:B,gfx:D})}),e.on("interactionEvents.createHit",qy,function(P){var B=P.element,D=P.gfx;i.createDefaultHit(B,D)}),e.on("interactionEvents.updateHit",function(P){var B=P.element,D=P.gfx;i.updateDefaultHit(B,D)});var y=C("djs-hit djs-hit-stroke"),v=C("djs-hit djs-hit-click-stroke"),g=C("djs-hit djs-hit-all"),b=C("djs-hit djs-hit-no-move"),x={all:g,"click-stroke":v,stroke:y,"no-move":b};function C(P,B){return B=W({stroke:"white",strokeWidth:15},B||{}),n.cls(P,["no-fill","no-border"],B)}function M(P,B){var D=x[B];if(!D)throw new Error("invalid hit type <"+B+">");return Se(P,D),P}function k(P,B){ze(P,B)}this.removeHits=function(P){var B=Ns(".djs-hit",P);F(B,Kt)},this.createDefaultHit=function(P,B){var D=P.waypoints,I=P.isFrame,z;return D?this.createWaypointsHit(B,D):(z=I?"stroke":"all",this.createBoxHit(B,z,{width:P.width,height:P.height}))},this.createWaypointsHit=function(P,B){var D=la(B);return M(D,"stroke"),k(P,D),D},this.createBoxHit=function(P,B,D){D=W({x:0,y:0},D);var I=Oe("rect");return M(I,B),Se(I,D),k(P,I),I},this.updateDefaultHit=function(P,B){var D=ft(".djs-hit",B);if(D)return P.waypoints?Fu(D,P.waypoints):Se(D,{width:P.width,height:P.height}),D},this.fire=r,this.triggerMouseEvent=u,this.mouseHandler=a,this.registerEvent=p,this.unregisterEvent=d}Ky.$inject=["eventBus","elementRegistry","styles"];const Ac={__init__:["interactionEvents"],interactionEvents:["type",Ky]};function Io(e,t){this._eventBus=e,this._canvas=t,this._selectedElements=new Set;var n=this;e.on(["shape.remove","connection.remove"],function(i){var r=i.element;n.deselect(r)}),e.on(["diagram.clear","root.set"],function(i){n.select(null)})}Io.$inject=["eventBus","canvas"],Io.prototype.deselect=function(e){if(this._selectedElements.has(e)){var t=this.get();this._selectedElements.delete(e),this._eventBus.fire("selection.changed",{oldSelection:t,newSelection:this.get()})}},Io.prototype.get=function(){return Array.from(this._selectedElements)},Io.prototype.isSelected=function(e){return this._selectedElements.has(e)},Io.prototype.select=function(e,t){var n=this.get();Be(e)||(e=e?[e]:[]);var i=this._canvas,r=i.getRootElement();e=e.filter(function(o){var a=i.findRoot(o);return r===a}),t?F(e,o=>{this._selectedElements.add(o)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var Xy="hover",Zy="selected";function Qy(e,t){this._canvas=e;function n(r,o){e.addMarker(r,o)}function i(r,o){e.removeMarker(r,o)}t.on("element.hover",function(r){n(r.element,Xy)}),t.on("element.out",function(r){i(r.element,Xy)}),t.on("selection.changed",function(r){function o(l){i(l,Zy)}function a(l){n(l,Zy)}var s=new Set(r.oldSelection),c=new Set(r.newSelection);for(let l of s)c.has(l)||o(l);for(let l of c)s.has(l)||a(l)})}Qy.$inject=["canvas","eventBus"];function Jy(e,t,n,i){e.on("create.end",500,function(r){var o=r.context,a=o.canExecute,s=o.elements,c=o.hints||{},l=c.autoSelect;if(a){if(l===!1)return;Be(l)?t.select(l):t.select(s.filter(bM))}}),e.on("connect.end",500,function(r){var o=r.context,a=o.connection;a&&t.select(a)}),e.on("shape.move.end",500,function(r){var o=r.previousSelection||[],a=i.get(r.context.shape.id),s=vt(o,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(r){if(pr(r)){var o=r.element;o===n.getRootElement()&&(o=null);var a=t.isSelected(o),s=t.get().length>1,c=xc(r);if(a&&s)return c?t.deselect(o):t.select(o);a?t.deselect(o):t.select(o,c)}})}Jy.$inject=["eventBus","selection","canvas","elementRegistry"];function bM(e){return!e.hidden}const ni={__init__:["selectionVisuals","selectionBehavior"],__depends__:[Ac],selection:["type",Io],selectionVisuals:["type",Qy],selectionBehavior:["type",Jy]};var xM=/^djs-cursor-.*$/;function Pc(e){var t=Ct(document.body);t.removeMatching(xM),e&&t.add("djs-cursor-"+e)}function ev(){Pc(null)}var _M=5e3;function tv(e,t){t=t||"element.click";function n(){return!1}return e.once(t,_M,n),function(){e.off(t,n)}}var wM=["c","C"],EM=["v","V"],SM=["d","D"],RM=["x","X"],CM=["y","Y"],nv=["z","Z"];function AM(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Ln(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function Xt(e,t){return e=Be(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function ef(e){return e.shiftKey}function PM(e){return Ln(e)&&Xt(wM,e)}function MM(e){return Ln(e)&&Xt(EM,e)}function TM(e){return Ln(e)&&Xt(SM,e)}function kM(e){return Ln(e)&&Xt(RM,e)}function OM(e){return Ln(e)&&!ef(e)&&Xt(nv,e)}function DM(e){return Ln(e)&&(Xt(CM,e)||Xt(nv,e)&&ef(e))}var Lo=Math.round,iv="djs-drag-active";function Gr(e){e.preventDefault()}function IM(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function LM(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function rv(e,t,n,i){var r={threshold:5,trapClick:!0},o;function a(b){var x=t.viewbox(),C=t._container.getBoundingClientRect();return{x:x.x+(b.x-C.left)/x.scale,y:x.y+(b.y-C.top)/x.scale}}function s(b,x){x=x||o;var C=e.createEvent(W({},x.payload,x.data,{isTouch:x.isTouch}));return e.fire("drag."+b,C)===!1?!1:e.fire(x.prefix+"."+b,C)}function c(b){var x=b.filter(function(C){return i.get(C.id)});x.length&&n.select(x)}function l(b,x){var C=o.payload,M=o.displacement,k=o.globalStart,P=Hr(b),B=pi(P,k),D=o.localStart,I=a(P),z=pi(I,D);if(!o.active&&(x||LM(B)>o.threshold)){if(W(C,{x:Lo(D.x+M.x),y:Lo(D.y+M.y),dx:0,dy:0},{originalEvent:b}),s("start")===!1)return y();o.active=!0,o.keepSelection||(C.previousSelection=n.get(),n.select(null)),o.cursor&&Pc(o.cursor),t.addMarker(t.getRootElement(),iv)}Dp(b),o.active&&(W(C,{x:Lo(I.x+M.x),y:Lo(I.y+M.y),dx:Lo(z.x),dy:Lo(z.y)},{originalEvent:b}),s("move"))}function u(b){var x,C=!0;o.active&&(b&&(o.payload.originalEvent=b,Dp(b)),C=s("end")),C===!1&&s("rejected"),x=v(C!==!0),s("ended",x)}function f(b){Xt("Escape",b)&&(Gr(b),y())}function p(b){var x;o.active&&(x=tv(e),setTimeout(x,400),Gr(b)),u(b)}function d(b){l(b)}function m(b){var x=o.payload;x.hoverGfx=b.gfx,x.hover=b.element,s("hover")}function h(b){s("out");var x=o.payload;x.hoverGfx=null,x.hover=null}function y(b){var x;if(o){var C=o.active;C&&s("cancel"),x=v(b),C&&s("canceled",x)}}function v(b){var x,C;s("cleanup"),ev(),o.trapClick?C=p:C=u,je.unbind(document,"mousemove",l),je.unbind(document,"dragstart",Gr),je.unbind(document,"selectstart",Gr),je.unbind(document,"mousedown",C,!0),je.unbind(document,"mouseup",C,!0),je.unbind(document,"keyup",f),je.unbind(document,"touchstart",d,!0),je.unbind(document,"touchcancel",y,!0),je.unbind(document,"touchmove",l,!0),je.unbind(document,"touchend",u,!0),e.off("element.hover",m),e.off("element.out",h),t.removeMarker(t.getRootElement(),iv);var M=o.payload.previousSelection;return b!==!1&&M&&!n.get().length&&c(M),x=o,o=null,x}function g(b,x,C,M){o&&y(!1),typeof x=="string"&&(M=C,C=x,x=null),M=W({},r,M||{});var k=M.data||{},P,B,D,I,z;if(M.trapClick?I=p:I=u,b?(P=Oo(b)||b,B=Hr(b),Dp(b),P.type==="dragstart"&&Gr(P)):(P=null,B={x:0,y:0}),D=a(B),x||(x=D),z=IM(P),o=W({prefix:C,data:k,payload:{},globalStart:B,displacement:pi(x,D),localStart:D,isTouch:z},M),M.manual||(z?(je.bind(document,"touchstart",d,!0),je.bind(document,"touchcancel",y,!0),je.bind(document,"touchmove",l,!0),je.bind(document,"touchend",u,!0)):(je.bind(document,"mousemove",l),je.bind(document,"dragstart",Gr),je.bind(document,"selectstart",Gr),je.bind(document,"mousedown",I,!0),je.bind(document,"mouseup",I,!0)),je.bind(document,"keyup",f),e.on("element.hover",m),e.on("element.out",h)),s("init")===!1)return y(),!1;M.autoActivate&&l(b,!0)}e.on("diagram.destroy",y),this.init=g,this.move=l,this.hover=m,this.out=h,this.end=u,this.cancel=y,this.context=function(){return o},this.setOptions=function(b){W(r,b)}}rv.$inject=["eventBus","canvas","selection","elementRegistry"];const Hi={__depends__:[yM,ni],dragging:["type",rv]};function Bo(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}Bo.prototype.next=function(){return this._prefix+ ++this._counter};const BM=new Bo("ps");var NM=["marker-start","marker-mid","marker-end"],$M=["circle","ellipse","line","path","polygon","polyline","path","rect"];function fr(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}fr.$inject=["elementRegistry","eventBus","canvas","styles"],fr.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")},fr.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},fr.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var r=ym(n);return this._cloneMarkers($r(r),i),Se(r,this._styles.cls(i,[])),ze(t,r),Se(r,"data-preview-support-element-id",e.id),r},fr.prototype.addFrame=function(e,t){var n=Oe("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return ze(t,n),Se(n,"data-preview-support-element-id",e.id),n},fr.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(r=>{i._cloneMarkers(r,t,n)}),zM(e)&&NM.forEach(function(r){if(Se(e,r)){var o=FM(e,r,i._canvas.getContainer());o&&i._cloneMarker(n,e,o,r,t)}})},fr.prototype._cloneMarker=function(e,t,n,i,r="djs-dragger"){var o=[n.id,r,BM.next()].join("-"),a=ft("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||ym(n);s.id=o,et(s).add(r);var c=ft(":scope > defs",e);c||(c=Oe("defs"),ze(e,c)),ze(c,s);var l=HM(s.id);Se(t,i,l)};function FM(e,t,n){var i=jM(Se(e,t));return ft("marker#"+i,n||document)}function jM(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function HM(e){return"url(#"+e+")"}function zM(e){return $M.indexOf(e.nodeName)!==-1}const No={__init__:["previewSupport"],previewSupport:["type",fr]};var GM="drop-ok",ov="drop-not-ok",av="attach-ok",sv="new-parent",cv="create",VM=2e3;function lv(e,t,n,i,r){function o(c,l,u,f,p){if(!l)return!1;c=Ke(c,function(g){var b=g.labelTarget;return!g.parent&&!(Ye(g)&&c.indexOf(b)!==-1)});var d=vt(c,function(g){return!ht(g)}),m=!1,h=!1,y=!1;pv(c)&&(m=r.allowed("shape.attach",{position:u,shape:d,target:l})),m||(pv(c)?y=r.allowed("shape.create",{position:u,shape:d,source:f,target:l}):y=r.allowed("elements.create",{elements:c,position:u,target:l}));var v=p.connectionTarget;return y||m?(d&&f&&(h=r.allowed("connection.create",{source:v===f?d:f,target:v===f?f:d,hints:{targetParent:l,targetAttach:m}})),{attach:m,connect:h}):y===null||m===null?null:!1}function a(c,l){[av,GM,ov,sv].forEach(function(u){u===l?e.addMarker(c,u):e.removeMarker(c,u)})}n.on(["create.move","create.hover"],function(c){var l=c.context,u=l.elements,f=c.hover,p=l.source,d=l.hints||{};if(!f){l.canExecute=!1,l.target=null;return}uv(c);var m={x:c.x,y:c.y},h=l.canExecute=f&&o(u,f,m,p,d);f&&h!==null&&(l.target=f,h&&h.attach?a(f,av):a(f,h?sv:ov))}),n.on(["create.end","create.out","create.cleanup"],function(c){var l=c.hover;l&&a(l,null)}),n.on("create.end",function(c){var l=c.context,u=l.source,f=l.shape,p=l.elements,d=l.target,m=l.canExecute,h=m&&m.attach,y=m&&m.connect,v=l.hints||{};if(m===!1||!d)return!1;uv(c);var g={x:c.x,y:c.y};y?f=i.appendShape(u,f,g,d,{attach:h,connection:y===!0?{}:y,connectionTarget:v.connectionTarget}):(p=i.createElements(p,g,d,W({},v,{attach:h})),f=vt(p,function(b){return!ht(b)})),W(l,{elements:p,shape:f}),W(c,{elements:p,shape:f})});function s(){var c=t.context();c&&c.prefix===cv&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],VM,function(){n.off("elements.changed",s)})}),this.start=function(c,l,u){Be(l)||(l=[l]);var f=vt(l,function(m){return!ht(m)});if(f){u=W({elements:l,hints:{},shape:f},u||{}),F(l,function(m){Fe(m.x)||(m.x=0),Fe(m.y)||(m.y=0)});var p=Ke(l,function(m){return!m.hidden}),d=Ft(p);F(l,function(m){ht(m)&&(m.waypoints=hn(m.waypoints,function(h){return{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2}})),W(m,{x:m.x-d.x-d.width/2,y:m.y-d.y-d.height/2})}),t.init(c,cv,{cursor:"grabbing",autoActivate:!0,data:{shape:f,elements:l,context:u}})}}}lv.$inject=["canvas","dragging","eventBus","modeling","rules"];function uv(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 pv(e){return e&&e.length===1&&!ht(e[0])}var WM=750;function fv(e,t,n,i,r){function o(a){var s=Oe("g");Se(s,r.cls("djs-drag-group",["no-events"]));var c=Oe("g");return a.forEach(function(l){var u;l.hidden||(l.waypoints?(u=n._createContainer("connection",c),n.drawConnection($r(u),l)):(u=n._createContainer("shape",c),n.drawShape($r(u),l),ln(u,l.x,l.y)),i.addDragger(l,s,u))}),s}t.on("create.move",WM,function(a){var s=a.hover,c=a.context,l=c.elements,u=c.dragGroup;u||(u=c.dragGroup=o(l));var f;s?(u.parentNode||(f=e.getActiveLayer(),ze(f,u)),ln(u,a.x,a.y)):Kt(u)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&Kt(c)})}fv.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const Mc={__depends__:[Hi,No,Si,ni],__init__:["create","createPreview"],create:["type",lv],createPreview:["type",fv]};function tf(e){var t=this;this._lastMoveEvent=null;function n(i){t._lastMoveEvent=i}e.on("canvas.init",function(i){var r=t._svg=i.svg;r.addEventListener("mousemove",n)}),e.on("canvas.destroy",function(){t._lastMouseEvent=null,t._svg.removeEventListener("mousemove",n)})}tf.$inject=["eventBus"],tf.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||UM(0,0)};function UM(e,t){var n=document.createEvent("MouseEvent"),i=e,r=t,o=e,a=t;return n.initMouseEvent&&n.initMouseEvent("mousemove",!0,!0,window,0,i,r,o,a,!1,!1,!1,!1,0,null),n}const Ma={__init__:["mouse"],mouse:["type",tf]};var dv=2e3;function Bn(e,t,n,i,r,o,a,s){this._canvas=e,this._create=t,this._elementFactory=i,this._eventBus=r,this._modeling=o,this._mouse=a,this._rules=s,r.on("copyPaste.copyElement",function(c){var l=c.descriptor,u=c.element,f=c.elementsSet;l.priority=1,l.id=u.id,f.has(u.parent)&&(l.parent=u.parent.id),YM(u)&&(l.priority=2,l.host=u.host.id),ht(u)&&(l.priority=3,l.source=u.source.id,l.target=u.target.id,l.waypoints=qM(u)),Ye(u)&&(l.priority=4,l.labelTarget=u.labelTarget.id),F(["x","y","width","height"],function(p){Fe(u[p])&&(l[p]=u[p])}),l.hidden=u.hidden,l.collapsed=u.collapsed}),r.on("copyPaste.elementsCopied",dv,function(c){var l;((l=c.hints)==null?void 0:l.clip)!==!1&&n.set(c.tree)}),r.on("copyPaste.pasteElements",dv,function(c){c.tree||(c.tree=n.get())}),r.on("copyPaste.pasteElements",function(c){var l=c.hints;W(l,{createElementsBehavior:!1})})}Bn.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],Bn.prototype.copy=function(e,t={}){var n,i;return Be(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(Be(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},Bn.prototype.paste=function(e={}){var t=this._eventBus.createEvent({type:"copyPaste.pasteElements",hints:{},...e}),n=this._eventBus.fire(t);if(n!==!1){var i=t.tree;if(i){var r=t.hints,o=this._createElements(i);if(t.element&&t.point)return this._paste(o,t.element,t.point,r);this._create.start(this._mouse.getLastMoveEvent(),o,{hints:r})}}},Bn.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},Bn.prototype.cut=function(e){var t=this.copy(e),n=this._getElementIdsFromTree(t),i=e.filter(function(r){return n[r.id]});return i.length>0&&this._modeling.removeElements(i),t},Bn.prototype._getElementIdsFromTree=function(e){var t={};return F(e,function(n){F(n,function(i){i.id&&(t[i.id]=!0)})}),t},Bn.prototype._paste=function(e,t,n,i){F(e,function(o){Fe(o.x)||(o.x=0),Fe(o.y)||(o.y=0)});var r=Ft(e);return F(e,function(o){ht(o)&&(o.waypoints=hn(o.waypoints,function(a){return{x:a.x-r.x-r.width/2,y:a.y-r.y-r.height/2}})),W(o,{x:o.x-r.x-r.width/2,y:o.y-r.y-r.height/2})}),this._modeling.createElements(e,n,t,W({},i))},Bn.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return F(e,function(o,a){o=di(o,"priority"),F(o,function(s){var c=W({},hi(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var l;if(ht(c)){c.source=i[s.source],c.target=i[s.target],l=i[s.id]=t.createConnection(c),r.push(l);return}if(Ye(c)){c.labelTarget=i[c.labelTarget],l=i[s.id]=t.createLabel(c),r.push(l);return}c.host&&(c.host=i[c.host]),l=i[s.id]=t.createShape(c),r.push(l)})}),r},Bn.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(hi(e,["id"]));return t},Bn.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(hi(e,["id"]));return t},Bn.prototype.createShape=function(e){var t=this._elementFactory.createShape(hi(e,["id"]));return t},Bn.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(ht(e)&&(!n.has(e.source)||!n.has(e.target))||Ye(e)&&!n.has(e.labelTarget))},Bn.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[],o=new Map,a=Hs(e);function s(f,p){return t.allowed("element.copy",{element:f,elements:p})}function c(f,p){var d=o.get(f);if(!d){var m={element:f,depth:p};r.push(m),o.set(f,m);return}if(d.depth<p){r=l(d,r);var h={element:d.element,depth:p};r.push(h),o.set(f,h)}}function l(f,p){var d=p.indexOf(f);return d!==-1&&p.splice(d,1),p}Nr(a,function(f,p,d){if(Ye(f))return;F(f.labels,function(y){c(y,d)});function m(y){y&&y.length&&F(y,function(v){F(v.labels,function(g){c(g,d)}),c(v,d)})}F([f.attachers,f.incoming,f.outgoing],m),c(f,d);var h=[];return f.children&&(h=f.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:f,children:h}),h}),e=hn(r,function(f){return f.element});var u=new Set(e);return r=hn(r,function(f){return f.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:f.descriptor,element:f.element,elements:e,elementsSet:u}),f}),r=di(r,function(f){return f.descriptor.priority}),e=hn(r,function(f){return f.element}),F(r,function(f){var p=f.depth;if(!n.hasRelations(f.element,e,u)){mv(f.element,e),u.delete(f.element);return}if(!s(f.element,e)){mv(f.element,e),u.delete(f.element);return}i[p]||(i[p]=[]),i[p].push(f.descriptor)}),i};function YM(e){return!!e.host}function qM(e){return hn(e.waypoints,function(t){return t=hv(t),t.original&&(t.original=hv(t.original)),t})}function hv(e){return W({},e)}function mv(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const KM={__depends__:[mM,Mc,Ma,Si],__init__:["copyPaste"],copyPaste:["type",Bn]};function nf(e,t,n){Be(n)||(n=[n]),F(n,function(i){Tr(e[i])||(t[i]=e[i])})}var rf=750;function gv(e,t,n){function i(c,l){var u=e.create(c.$type);return n.copyElement(c,u,null,l)}t.on("copyPaste.copyElement",rf,function(c){var l=c.descriptor,u=c.element,f=ie(u);if(Ye(u))return l;var p=l.businessObject=i(f,!0),d=l.di=i(ot(u),!0);d.bpmnElement=p,nf(p,l,"name"),nf(d,l,"isExpanded"),f.default&&(l.default=f.default.id)});var r="-bpmn-js-refs";function o(c){return c[r]=c[r]||{}}function a(c,l){c[r]=l}function s(c,l,u){var f=ie(c);return c.default&&(u[c.default]={element:f,property:"default"}),c.host&&(ie(c).attachedToRef=ie(l[c.host])),hi(u,Tn(u,function(p,d,m){var h=d.element,y=d.property;return m===c.id&&(h.set(y,f),p.push(c.id)),p},[]))}t.on("copyPaste.pasteElement",function(c){var l=c.cache,u=c.descriptor,f=u.businessObject,p=u.di;if(Ye(u)){u.businessObject=ie(l[u.labelTarget]),u.di=ot(l[u.labelTarget]);return}f=u.businessObject=i(f),p=u.di=i(p),p.bpmnElement=f,nf(u,f,["isExpanded","name"]),u.type=f.$type}),t.on("copyPaste.copyElement",rf,function(c){var l=c.descriptor,u=c.element;if(S(u,"bpmn:Participant")){var f=ie(u);f.processRef&&(l.processRef=i(f.processRef,!0))}}),t.on("copyPaste.pasteElement",function(c){var l=c.descriptor,u=l.processRef;u&&(l.processRef=i(u))}),t.on("copyPaste.createTree",function(c){var l=c.element,u=c.children;S(l,"bpmn:SubProcess")&&F(ga(u),f=>{u.push(f.annotation)})}),t.on("copyPaste.pasteElement",rf,function(c){var l=c.cache,u=c.descriptor;a(l,s(u,l,o(l)))})}gv.$inject=["bpmnFactory","eventBus","moddleCopy"];const XM=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],ZM=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function Ta(e,t,n){this._bpmnFactory=t,this._eventBus=e,this._moddle=n,e.on("moddleCopy.canCopyProperties",i=>{const{propertyNames:r}=i;if(!(!r||!r.length))return di(r,o=>o==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:r,property:o,propertyName:a}=i,s=Qt(r)&&r.$descriptor;if(a&&ZM.includes(a))return o;if(a&&XM.includes(a)||a&&s&&!vt(s.properties,ao({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",i=>{const{property:r}=i;if(S(r,"bpmn:ExtensionElements")&&(!r.values||!r.values.length))return!1})}Ta.$inject=["eventBus","bpmnFactory","moddle"],Ta.prototype.copyElement=function(e,t,n,i=!1){n&&!Be(n)&&(n=[n]),n=n||of(e.$descriptor);const r=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return r===!1||(Be(r)&&(n=r),F(n,o=>{let a;Mn(e,o)&&(a=e.get(o));const s=this.copyProperty(a,t,o,i);!Yt(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:o})===!1||t.set(o,s)})),t},Ta.prototype.copyProperty=function(e,t,n,i=!1){let r=this._eventBus.fire("moddleCopy.canCopyProperty",{parent:t,property:e,propertyName:n,clone:i});if(r===!1)return;if(r)return Qt(r)&&r.$type&&!r.$parent&&(r.$parent=t),r;const o=this._moddle.getPropertyDescriptor(t,n);if(!o.isReference)return o.isId?e&&this._copyId(e,t,i):Be(e)?Tn(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):Qt(e)&&e.$type?this._moddle.getElementDescriptor(e).isGeneric?void 0:(r=this._bpmnFactory.create(e.$type),r.$parent=t,r=this.copyElement(e,r,null,i),r):e},Ta.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 of(e,t){return Tn(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const yv={__depends__:[KM],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",gv],moddleCopy:["type",Ta]};var vv=Math.round;function af(e,t){this._modeling=e,this._eventBus=t}af.$inject=["modeling","eventBus"],af.prototype.replaceElement=function(e,t,n){if(e.waypoints)return null;var i=this._modeling,r=this._eventBus;r.fire("replace.start",{element:e,attrs:t,hints:n});var o=t.width||e.width,a=t.height||e.height,s=t.x||e.x,c=t.y||e.y,l=vv(s+o/2),u=vv(c+a/2),f=i.replaceShape(e,W({},t,{x:l,y:u,width:o,height:a}),n);return r.fire("replace.end",{element:e,newElement:f,hints:n}),f};function bv(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:r={}}=n;r.select!==!1&&e.select(i)})}bv.$inject=["selection","eventBus"];const QM={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",bv],replace:["type",af]};function JM(e,t,n){Be(n)||(n=[n]),F(n,function(i){Tr(e[i])||(t[i]=e[i])})}var eT=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function tT(e,t){var n=e&&Mn(e,"collapsed")?e.collapsed:!Qe(e),i;return t&&(Mn(t,"collapsed")||Mn(t,"isExpanded"))?i=Mn(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function xv(e,t,n,i,r,o){function a(s,c,l){l=l||{};var u=c.type,f=s.businessObject;if(Tc(f)&&(u==="bpmn:SubProcess"||u==="bpmn:AdHocSubProcess")&&tT(s,c))return i.toggleCollapse(s),s;var p=e.create(u),d={type:u,businessObject:p};d.di={},u==="bpmn:ExclusiveGateway"&&(d.di.isMarkerVisible=!0),JM(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var m=of(f.$descriptor),h=of(p.$descriptor,!0),y=nT(m,h);W(p,li(c,eT));var v=Ke(y,function(x){return x==="eventDefinitions"?_v(s,c.eventDefinitionType):x==="loopCharacteristics"?!vn(p):Mn(p,x)||x==="processRef"&&c.isExpanded===!1||x==="triggeredByEvent"?!1:x==="isForCompensation"?!vn(p):!0});if(p=n.copyElement(f,p,v),c.eventDefinitionType&&(_v(p,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),S(f,"bpmn:Activity")){if(Tc(f))d.isExpanded=Qe(s);else if(c&&Mn(c,"isExpanded")){d.isExpanded=c.isExpanded;var g=t.getDefaultSize(p,{isExpanded:d.isExpanded});d.width=g.width,d.height=g.height,d.x=s.x-(d.width-s.width)/2,d.y=s.y-(d.height-s.height)/2}Qe(s)&&!S(f,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(Tc(f)&&!Tc(p)&&(l.moveChildren=!1),S(f,"bpmn:Participant")){c.isExpanded===!0?p.processRef=e.create("bpmn:Process"):l.moveChildren=!1;var b=tn(s);ot(s).isHorizontal||(ot(d).isHorizontal=b),d.width=b?s.width:t.getDefaultSize(d).width,d.height=b?t.getDefaultSize(d).height:s.height}return o.allowed("shape.resize",{shape:p})||(d.height=t.getDefaultSize(d).height,d.width=t.getDefaultSize(d).width),p.name=f.name,qe(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&qe(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(p.default=f.default),c.host&&!S(f,"bpmn:BoundaryEvent")&&S(p,"bpmn:BoundaryEvent")&&(d.host=c.host),(d.type==="bpmn:DataStoreReference"||d.type==="bpmn:DataObjectReference")&&(d.x=s.x+(s.width-d.width)/2),r.replaceElement(s,d,{...l,targetElement:c})}this.replaceElement=a}xv.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function Tc(e){return S(e,"bpmn:SubProcess")}function _v(e,t){var n=ie(e);return t&&n.get("eventDefinitions").some(function(i){return S(i,t)})}function nT(e,t){return e.filter(function(n){return t.includes(n)})}const wv={__depends__:[yv,QM,ni],bpmnReplace:["type",xv]};var iT=250;function Vr(e){this._eventBus=e,this._tools=[],this._active=null}Vr.$inject=["eventBus"],Vr.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)},Vr.prototype.isActive=function(e){return e&&this._active===e},Vr.prototype.length=function(e){return this._tools.length},Vr.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Vr.prototype.bindEvents=function(e,t){var n=this._eventBus,i=[];n.on(t.tool+".init",function(r){var o=r.context;if(!o.reactivate&&this.isActive(e)){this.setActive(null);return}this.setActive(e)},this),F(t,function(r){i.push(r+".ended"),i.push(r+".canceled")}),n.on(i,iT,function(r){this._active&&(rT(r)||this.setActive(null))},this)};function rT(e){var t=e.originalEvent&&e.originalEvent.target;return t&&Lr(t,'.group[data-group="tools"]')}const kc={__depends__:[Hi],__init__:["toolManager"],toolManager:["type",Vr]};function oT(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 aT(e,t){var n=[],i=new Set(e);F(t,function(o){i.add(o)});var r=new Set;return i.forEach(function(o){var a=o.incoming,s=o.outgoing;F(a.concat(s),function(c){var l=c.source,u=c.target;(i.has(l)||i.has(u))&&(r.has(c)||(r.add(c),n.push(c)))})}),n}function sT(e,t,n){var i=e.x,r=e.y,o=e.width,a=e.height,s=n.x,c=n.y;switch(t){case"n":return{x:i,y:r+c,width:o,height:a-c};case"s":return{x:i,y:r,width:o,height:a+c};case"w":return{x:i+s,y:r,width:o-s,height:a};case"e":return{x:i,y:r,width:o+s,height:a};default:throw new Error("unknown direction: "+t)}}var sf=Math.abs,cT=Math.round,zi={x:"width",y:"height"},Ev="crosshair",dr={n:"top",w:"left",s:"bottom",e:"right"},lT=1500,Oc={n:"s",w:"e",s:"n",e:"w"},Dc=20;function ii(e,t,n,i,r,o,a){this._canvas=e,this._dragging=t,this._eventBus=n,this._modeling=i,this._rules=r,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",lT,function(c){var l=c.context,u=l.initialized;u||(u=l.initialized=s.init(c,l)),u&&Rv(c)}),n.on("spaceTool.end",function(c){var l=c.context,u=l.axis,f=l.direction,p=l.movingShapes,d=l.resizingShapes,m=l.start;if(l.initialized){Rv(c);var h={x:0,y:0};h[u]=cT(c["d"+u]),s.makeSpace(p,d,h,f,m),n.once("spaceTool.ended",function(y){s.activateSelection(y.originalEvent,!0,!0)})}})}ii.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],ii.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:Ev,data:{context:{reactivate:n}},trapClick:!1})},ii.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:Ev,data:{context:{}}})},ii.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},ii.prototype.init=function(e,t){var n=sf(e.dx)>sf(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(sf(i)<5)return!1;i<0&&(i*=-1),Ca(e)&&(i*=-1);var o=oT(n,i),a=this._canvas.getRootElement();!xc(e)&&e.hover&&(a=e.hover);var s=[...ua(a),...a.attachers||[]],c=this.calculateAdjustments(s,n,i,r),l=this._eventBus.fire("spaceTool.getMinDimensions",{axis:n,direction:o,shapes:c.resizingShapes,start:r}),u=uT(c,n,o,r,l);return W(t,c,{axis:n,direction:o,spaceToolConstraints:u,start:r}),Pc("resize-"+(n==="x"?"ew":"ns")),!0},ii.prototype.calculateAdjustments=function(e,t,n,i){var r=this._rules,o=[],a=[],s=new Set,c=new Set,l=[],u=[];function f(d){s.has(d)||(s.add(d),o.push(d));var m=d.label;m&&!s.has(m)&&(s.add(m),o.push(m))}function p(d){c.has(d)||(c.add(d),a.push(d))}return F(e,function(d){if(!(!d.parent||Ye(d))){if(ht(d)){u.push(d);return}var m=d[t],h=m+d[zi[t]];if(pT(d)&&(n>0&&Ne(d)[t]>i||n<0&&Ne(d)[t]<i)){l.push(d);return}if(n>0&&m>i||n<0&&h<i){f(d);return}if(m<i&&h>i&&r.allowed("shape.resize",{shape:d})){p(d);return}}}),F(o,function(d){var m=d.attachers;m&&F(m,function(h){f(h)})}),F(l,function(d){var m=d.host;(s.has(m)||c.has(m))&&f(d)}),F(u,function(d){var m=d.source,h=d.target,y=d.label;(s.has(m)||c.has(m))&&(s.has(h)||c.has(h))&&y&&f(y)}),{movingShapes:o,resizingShapes:a}},ii.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},ii.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function Sv(e){return{top:e.top-Dc,right:e.right+Dc,bottom:e.bottom+Dc,left:e.left-Dc}}function Rv(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,r;Fe(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),Fe(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),Fe(n.top)&&(r=Math.max(e.y,n.top),e.dy=e.dy+r-e.y,e.y=r),Fe(n.bottom)&&(r=Math.min(e.y,n.bottom),e.dy=e.dy+r-e.y,e.y=r)}}function uT(e,t,n,i,r){var o=e.movingShapes,a=e.resizingShapes;if(a.length){var s={},c,l,u=new Set(o),f=new Set(a);return F(a,function(p){var d=p.attachers,m=p.children,h=Ie(p),y=Ke(m,function(z){return!ht(z)&&!Ye(z)&&!u.has(z)&&!f.has(z)}),v=Ke(m,function(z){return!ht(z)&&!Ye(z)&&u.has(z)}),g,b,x,C=[],M=[],k,P,B,D;y.length&&(b=Sv(Ie(Ft(y))),g=i-h[dr[n]]+b[dr[n]],n==="n"?s.bottom=l=Fe(l)?Math.min(l,g):g:n==="w"?s.right=l=Fe(l)?Math.min(l,g):g:n==="s"?s.top=c=Fe(c)?Math.max(c,g):g:n==="e"&&(s.left=c=Fe(c)?Math.max(c,g):g)),v.length&&(x=Sv(Ie(Ft(v))),g=i-x[dr[Oc[n]]]+h[dr[Oc[n]]],n==="n"?s.bottom=l=Fe(l)?Math.min(l,g):g:n==="w"?s.right=l=Fe(l)?Math.min(l,g):g:n==="s"?s.top=c=Fe(c)?Math.max(c,g):g:n==="e"&&(s.left=c=Fe(c)?Math.max(c,g):g)),d&&d.length&&(d.forEach(function(z){u.has(z)?C.push(z):M.push(z)}),C.length&&(k=Ie(Ft(C.map(Ne))),P=h[dr[Oc[n]]]-(k[dr[Oc[n]]]-i)),M.length&&(B=Ie(Ft(M.map(Ne))),D=B[dr[n]]-(h[dr[n]]-i)),n==="n"?(g=Math.min(P||1/0,D||1/0),s.bottom=l=Fe(l)?Math.min(l,g):g):n==="w"?(g=Math.min(P||1/0,D||1/0),s.right=l=Fe(l)?Math.min(l,g):g):n==="s"?(g=Math.max(P||-1/0,D||-1/0),s.top=c=Fe(c)?Math.max(c,g):g):n==="e"&&(g=Math.max(P||-1/0,D||-1/0),s.left=c=Fe(c)?Math.max(c,g):g));var I=r&&r[p.id];I&&(n==="n"?(g=i+p[zi[t]]-I[zi[t]],s.bottom=l=Fe(l)?Math.min(l,g):g):n==="w"?(g=i+p[zi[t]]-I[zi[t]],s.right=l=Fe(l)?Math.min(l,g):g):n==="s"?(g=i-p[zi[t]]+I[zi[t]],s.top=c=Fe(c)?Math.max(c,g):g):n==="e"&&(g=i-p[zi[t]]+I[zi[t]],s.left=c=Fe(c)?Math.max(c,g):g))}),s}}function pT(e){return!!e.host}var cf="djs-dragging",Cv="djs-resizing",fT=250,Ic=Math.max;function Av(e,t,n,i,r){function o(a,s){F(a,function(c){r.addDragger(c,s),n.addMarker(c,cf)})}e.on("spaceTool.selection.start",function(a){var s=n.getLayer("space"),c=a.context,l={x:"M 0,-10000 L 0,10000",y:"M -10000,0 L 10000,0"},u=Oe("g");Se(u,i.cls("djs-crosshair-group",["no-events"])),ze(s,u);var f=Oe("path");Se(f,"d",l.x),et(f).add("djs-crosshair"),ze(u,f);var p=Oe("path");Se(p,"d",l.y),et(p).add("djs-crosshair"),ze(u,p),c.crosshairGroup=u}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;ln(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&Kt(c)}),e.on("spaceTool.move",fT,function(a){var s=a.context,c=s.line,l=s.axis,u=s.movingShapes,f=s.resizingShapes;if(s.initialized){if(!s.dragGroup){var p=n.getLayer("space");c=Oe("path"),Se(c,"d","M0,0 L0,0"),et(c).add("djs-crosshair"),ze(p,c),s.line=c;var d=Oe("g");Se(d,i.cls("djs-drag-group",["no-events"])),ze(n.getActiveLayer(),d),o(u,d);var m=new Set(u);F(f,function(M){m.add(M)});var h=new Set,y=s.movingConnections=[];m.forEach(function(M){F(M.outgoing,function(k){h.has(k)||!ht(k)||!m.has(k.target)||(h.add(k),y.push(k))})}),o(y,d),s.dragGroup=d}if(!s.frameGroup){var v=Oe("g");Se(v,i.cls("djs-frame-group",["no-events"])),ze(n.getActiveLayer(),v);var g=[];F(f,function(M){var k=r.addFrame(M,v),P=k.getBBox();g.push({element:k,initialBounds:P}),n.addMarker(M,Cv)}),s.frameGroup=v,s.frames=g}var b={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};Se(c,{d:b[l]});var x={x:"y",y:"x"},C={x:a.dx,y:a.dy};C[x[s.axis]]=0,ln(s.dragGroup,C.x,C.y),F(s.frames,function(M){var k=M.element,P=M.initialBounds,B,D;s.direction==="e"?Se(k,{width:Ic(P.width+C.x,5)}):(B=Ic(P.width-C.x,5),Se(k,{width:B,x:P.x+P.width-B})),s.direction==="s"?Se(k,{height:Ic(P.height+C.y,5)}):(D=Ic(P.height-C.y,5),Se(k,{height:D,y:P.y+P.height-D}))})}}),e.on("spaceTool.cleanup",function(a){var s=a.context,c=s.movingShapes,l=s.movingConnections,u=s.resizingShapes,f=s.line,p=s.dragGroup,d=s.frameGroup;F(c,function(m){n.removeMarker(m,cf)}),F(l,function(m){n.removeMarker(m,cf)}),p&&(Kt(f),Kt(p)),F(u,function(m){n.removeMarker(m,Cv)}),d&&Kt(d)})}Av.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const dT={__init__:["spaceToolPreview"],__depends__:[Hi,Si,kc,No,Ma],spaceTool:["type",ii],spaceToolPreview:["type",Av]};function Lc(e,t){e.invoke(ii,this),this._canvas=t}Lc.$inject=["injector","canvas"],Ee(Lc,ii),Lc.prototype.calculateAdjustments=function(e,t,n,i){var r=this._canvas.getRootElement(),o=e[0]===r?null:e[0],a=[];o&&(a=ro(bo(r.children.filter(l=>S(l,"bpmn:Artifact")),Ft(o))));const s=[...e,...a];var c=ii.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(l){return!(S(l,"bpmn:TextAnnotation")||hT(l)&&(t==="y"&&tn(l)||t==="x"&&!tn(l)))}),c};function hT(e){return S(e,"bpmn:Participant")&&!ie(e).processRef}const Pv={__depends__:[dT],spaceTool:["type",Lc]};function Mt(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)}Mt.$inject=["eventBus","injector"],Mt.prototype.execute=function(e,t){if(!e)throw new Error("command required");this._currentExecution.trigger="execute";const n={command:e,context:t};this._pushAction(n),this._internalExecute(n),this._popAction()},Mt.prototype.canExecute=function(e,t){const n={command:e,context:t},i=this._getHandler(e);let r=this._fire(e,"canExecute",n);if(r===void 0){if(!i)return!1;i.canExecute&&(r=i.canExecute(t))}return r},Mt.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},Mt.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()}},Mt.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()}},Mt.prototype.register=function(e,t){this._setHandler(e,t)},Mt.prototype.registerHandler=function(e,t){if(!e||!t)throw new Error("command and handlerCls must be defined");const n=this._injector.instantiate(t);this.register(e,n)},Mt.prototype.canUndo=function(){return!!this._getUndoAction()},Mt.prototype.canRedo=function(){return!!this._getRedoAction()},Mt.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},Mt.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},Mt.prototype._internalUndo=function(e){const t=e.command,n=e.context,i=this._getHandler(t);this._atomicDo(()=>{this._fire(t,"revert",e),i.revert&&this._markDirty(i.revert(n)),this._revertedAction(e),this._fire(t,"reverted",e)})},Mt.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);const i=t?[e+"."+t,t]:[e];let r;n=this._eventBus.createEvent(n);for(const o of i)if(r=this._eventBus.fire("commandStack."+o,n),n.cancelBubble)break;return r},Mt.prototype._createId=function(){return this._uid++},Mt.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},Mt.prototype._internalExecute=function(e,t){const n=e.command,i=e.context,r=this._getHandler(n);if(!r)throw new Error("no command handler registered for <"+n+">");this._pushAction(e),t||(this._fire(n,"preExecute",e),r.preExecute&&r.preExecute(i),this._fire(n,"preExecuted",e)),this._atomicDo(()=>{this._fire(n,"execute",e),r.execute&&this._markDirty(r.execute(i)),this._executedAction(e,t),this._fire(n,"executed",e)}),t||(this._fire(n,"postExecute",e),r.postExecute&&r.postExecute(i),this._fire(n,"postExecuted",e)),this._popAction()},Mt.prototype._pushAction=function(e){const t=this._currentExecution,n=t.actions,i=n[0];if(t.atomic)throw new Error("illegal invocation in <execute> or <revert> phase (action: "+e.command+")");e.id||(e.id=i&&i.id||this._createId()),n.push(e)},Mt.prototype._popAction=function(){const e=this._currentExecution,t=e.trigger,n=e.actions,i=e.dirty;n.pop(),n.length||(this._eventBus.fire("elements.changed",{elements:Bd("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},Mt.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=Be(e)?e:[e],t.dirty=t.dirty.concat(e))},Mt.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},Mt.prototype._revertedAction=function(e){this._stackIdx--},Mt.prototype._getHandler=function(e){return this._handlerMap[e]},Mt.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};const mT={commandStack:["type",Mt]};function hr(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 gT=250,Mv=1400;function lf(e,t,n){te.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",Mv,function(r){var o=r.context,a=o.shapes,s=o.validatedShapes;o.shapes=Tv(a),o.validatedShapes=Tv(s)}),i&&t.on("shape.move.start",gT,function(r){var o=r.context,a=new Set(o.shapes),s=new Set;for(const c of a)for(const l of c.labels)!l.hidden&&!a.has(l)&&s.add(l),c.labelTarget&&s.add(c);for(const c of s)i.makeDraggable(o,c,!0)}),this.preExecuted("elements.move",Mv,function(r){var o=r.context,a=o.closure,s=a.enclosedElements,c=[];F(s,function(l){F(l.labels,function(u){s[u.id]||c.push(u)})}),a.addAll(c)}),this.preExecute(["connection.delete","shape.delete"],function(r){var o=r.context,a=o.connection||o.shape;hr(a.labels,function(s){n.removeShape(s,{nested:!0})})}),this.execute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.labelTarget;s&&(o.labelTargetIndex=Hu(s.labels,a),o.labelTarget=s,a.labelTarget=null)}),this.revert("shape.delete",function(r){var o=r.context,a=o.shape,s=o.labelTarget,c=o.labelTargetIndex;s&&(Bt(s.labels,a,c),a.labelTarget=s)})}Ee(lf,te),lf.$inject=["injector","eventBus","modeling"];function Tv(e){var t=new Set(e);return Ke(e,function(n){return!t.has(n.labelTarget)})}const yT={__init__:["labelSupport"],labelSupport:["type",lf]};var vT=251,kv=1401,Ov="attach-ok";function uf(e,t,n,i,r){te.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",kv,function(a){var s=a.context,c=s.shapes,l=s.validatedShapes;s.shapes=bT(c),s.validatedShapes=xT(l)}),o&&t.on("shape.move.start",vT,function(a){var s=a.context,c=s.shapes,l=pf(c);F(l,function(u){o.makeDraggable(s,u,!0),F(u.labels,function(f){o.makeDraggable(s,f,!0)})})}),o&&t.on("shape.move.start",function(a){var s=a.context,c=s.shapes;if(c.length===1){var l=c[0],u=l.host;u&&(n.addMarker(u,Ov),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(u,Ov)}))}}),this.preExecuted("elements.move",kv,function(a){var s=a.context,c=s.closure,l=s.shapes,u=pf(l);F(u,function(f){c.add(f,c.topLevel[f.host.id])})}),this.postExecuted("elements.move",function(a){var s=a.context,c=s.shapes,l=s.newHost,u;l&&c.length!==1||(l?u=c:u=Ke(c,function(f){var p=f.host;return _T(f)&&!wT(c,p)}),F(u,function(f){r.updateAttachment(f,l)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;F(s,function(c){F(c.attachers,function(l){F(l.outgoing.slice(),function(u){var f=i.allowed("connection.reconnect",{connection:u,source:u.source,target:u.target});f||r.removeConnection(u)}),F(l.incoming.slice(),function(u){var f=i.allowed("connection.reconnect",{connection:u,source:u.source,target:u.target});f||r.removeConnection(u)})})})}),this.postExecute("shape.create",function(a){var s=a.context,c=s.shape,l=s.host;l&&r.updateAttachment(c,l)}),this.postExecute("shape.replace",function(a){var s=a.context,c=s.oldShape,l=s.newShape;hr(c.attachers,function(u){var f=i.allowed("elements.move",{target:l,shapes:[u]});f==="attach"?r.updateAttachment(u,l):r.removeShape(u)}),l.attachers.length&&F(l.attachers,function(u){var f=Xg(u,c,l);r.moveShape(u,f,u.parent)})}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.oldBounds,u=s.newBounds,f=c.attachers,p=s.hints||{};p.attachSupport!==!1&&F(f,function(d){var m=Xg(d,l,u);r.moveShape(d,m,d.parent),F(d.labels,function(h){r.moveShape(h,m,h.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;hr(s.attachers,function(c){r.removeShape(c)}),s.host&&r.updateAttachment(s,null)})}Ee(uf,te),uf.$inject=["injector","eventBus","canvas","rules","modeling"];function pf(e){return Kl(hn(e,function(t){return t.attachers||[]}))}function bT(e){var t=pf(e);return I0("id",e,t)}function xT(e){var t=oo(e,"id");return Ke(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function _T(e){return!!e.host}function wT(e,t){return e.indexOf(t)!==-1}const ET={__depends__:[Si],__init__:["attachSupport"],attachSupport:["type",uf]};function Dv(e,t,n,i){e.on("element.changed",function(r){var o=r.element;(o.parent||o===t.getRootElement())&&(r.gfx=n.getGraphics(o)),r.gfx&&e.fire(Rm(o)+".changed",r)}),e.on("elements.changed",function(r){var o=r.elements;o.forEach(function(a){e.fire("element.changed",{element:a})}),i.updateContainments(o)}),e.on("shape.changed",function(r){i.update("shape",r.element,r.gfx)}),e.on("connection.changed",function(r){i.update("connection",r.element,r.gfx)})}Dv.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const ff={__init__:["changeSupport"],changeSupport:["type",Dv]};function ri(e){this._model=e}ri.$inject=["moddle"],ri.prototype._needsId=function(e){return qe(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"])},ri.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;S(e,"bpmn:Activity")?t="Activity":S(e,"bpmn:Event")?t="Event":S(e,"bpmn:Gateway")?t="Gateway":qe(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))},ri.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},ri.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},ri.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",W({bpmnElement:e,bounds:this.createDiBounds()},t))},ri.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},ri.prototype.createDiWaypoints=function(e){var t=this;return hn(e,function(n){return t.createDiWaypoint(n)})},ri.prototype.createDiWaypoint=function(e){return this.create("dc:Point",li(e,["x","y"]))},ri.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",W({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},ri.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",W({bpmnElement:e},t))};function Nn(e,t,n){te.call(this,e),this._bpmnFactory=t;var i=this;function r(d){var m=d.context,h=m.hints||{},y;!m.cropped&&h.createElementsBehavior!==!1&&(y=m.connection,y.waypoints=n.getCroppedWaypoints(y),m.cropped=!0)}this.executed(["connection.layout","connection.create"],r),this.reverted(["connection.layout"],function(d){delete d.context.cropped});function o(d){var m=d.context;i.updateParent(m.shape||m.connection,m.oldParent)}function a(d){var m=d.context,h=m.shape||m.connection,y=m.parent||m.newParent;i.updateParent(h,y)}this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],$n(o)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],$n(a));function s(d){var m=d.context,h=m.oldRoot,y=h.children;F(y,function(v){S(v,"bpmn:BaseElement")&&i.updateParent(v)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(d){var m=d.context.shape;S(m,"bpmn:BaseElement")&&i.updateBounds(m)}this.executed(["shape.move","shape.create","shape.resize"],$n(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],$n(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 l(d){i.updateConnection(d.context)}this.executed(["connection.create","connection.move","connection.delete","connection.reconnect"],$n(l)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],$n(l));function u(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],$n(u)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],$n(u)),this.executed("connection.reconnect",$n(function(d){var m=d.context,h=m.connection,y=m.oldSource,v=m.newSource,g=ie(h),b=ie(y),x=ie(v);g.conditionExpression&&!qe(x,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(m.oldConditionExpression=g.conditionExpression,delete g.conditionExpression),y!==v&&b.default===g&&(m.oldDefault=b.default,delete b.default)})),this.reverted("connection.reconnect",$n(function(d){var m=d.context,h=m.connection,y=m.oldSource,v=m.newSource,g=ie(h),b=ie(y),x=ie(v);m.oldConditionExpression&&(g.conditionExpression=m.oldConditionExpression),m.oldDefault&&(b.default=m.oldDefault,delete x.default)}));function f(d){i.updateAttachment(d.context)}this.executed(["element.updateAttachment"],$n(f)),this.reverted(["element.updateAttachment"],$n(f)),this.executed("element.updateLabel",$n(p)),this.reverted("element.updateLabel",$n(p));function p(d){const{element:m}=d.context,h=qn(m),y=ot(m),v=y&&y.get("label");sr(m)||_c(m)||(h&&!v?y.set("label",t.create("bpmndi:BPMNLabel")):!h&&v&&y.set("label",void 0))}}Ee(Nn,te),Nn.$inject=["eventBus","bpmnFactory","connectionDocking"],Nn.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},Nn.prototype.updateParent=function(e,t){if(!Ye(e)&&!(S(e,"bpmn:DataStoreReference")&&e.parent&&S(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=ot(e),o=n&&n.businessObject,a=ot(n);S(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,o,t&&t.businessObject),S(e,"bpmn:DataOutputAssociation")&&(e.source?o=e.source.businessObject:o=null),S(e,"bpmn:DataInputAssociation")&&(e.target?o=e.target.businessObject:o=null),this.updateSemanticParent(i,o),S(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,o),this.updateDiParent(r,a)}},Nn.prototype.updateBounds=function(e){var t=ot(e),n=RT(e);if(n){var i=pi(n,t.get("bounds"));W(n,{x:e.x+i.x,y:e.y+i.y})}var r=Ye(e)?this._getLabel(t):t,o=r.bounds;o||(o=this._bpmnFactory.createDiBounds(),r.set("bounds",o)),W(o,{x:e.x,y:e.y,width:e.width,height:e.height})},Nn.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,r;S(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),Lt(i,e)),S(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),Bt(r,e))}},Nn.prototype.updateDiConnection=function(e,t,n){var i=ot(e),r=ot(t),o=ot(n);i.sourceElement&&i.sourceElement.bpmnElement!==ie(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==ie(n)&&(i.targetElement=n&&o)},Nn.prototype.updateDiParent=function(e,t){if(t&&!S(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(Lt(n,e),e.$parent=null)}};function ST(e){for(;e&&!S(e,"bpmn:Definitions");)e=e.$parent;return e}Nn.prototype.getLaneSet=function(e){var t,n;return S(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(S(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)},Nn.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&!((S(e,"bpmn:DataInput")||S(e,"bpmn:DataOutput"))&&(S(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(S(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(S(e,"bpmn:FlowElement")){if(t){if(S(t,"bpmn:Participant"))t=t.processRef;else if(S(t,"bpmn:Lane"))do t=t.$parent.$parent;while(S(t,"bpmn:Lane"))}i="flowElements"}else if(S(e,"bpmn:Artifact")){for(;t&&!S(t,"bpmn:Process")&&!S(t,"bpmn:SubProcess")&&!S(t,"bpmn:Collaboration");)if(S(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;i="artifacts"}else if(S(e,"bpmn:MessageFlow"))i="messageFlows";else if(S(e,"bpmn:Participant")){i="participants";var r=e.processRef,o;r&&(o=ST(e.$parent||t),e.$parent&&(Lt(o.get("rootElements"),r),r.$parent=null),t&&(Bt(o.get("rootElements"),r),r.$parent=o))}else S(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":S(e,"bpmn:DataInputAssociation")&&(i="dataInputAssociations");if(!i)throw new Error(`no parent for <${e.id}> in <${t.id}>`);var a;if(e.$parent&&(a=e.$parent.get(i),Lt(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);Lt(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},Nn.prototype.updateConnectionWaypoints=function(e){var t=ot(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},Nn.prototype.updateConnection=function(e){var t=e.connection,n=ie(t),i=t.source,r=ie(i),o=t.target,a=ie(t.target),s;if(S(n,"bpmn:DataAssociation"))S(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=r,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):S(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||r,this.updateSemanticParent(n,r,s),n.targetRef=a);else{var c=S(n,"bpmn:SequenceFlow");n.sourceRef!==r&&(c&&(Lt(n.sourceRef&&n.sourceRef.get("outgoing"),n),r&&r.get("outgoing")&&r.get("outgoing").push(n)),n.sourceRef=r),n.targetRef!==a&&(c&&(Lt(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,i,o)},Nn.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function $n(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;S(i,"bpmn:BaseElement")&&e(t)}}function RT(e){if(S(e,"bpmn:Activity")){var t=ot(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function mr(e,t){Ni.call(this),this._bpmnFactory=e,this._moddle=t}Ee(mr,Ni),mr.$inject=["bpmnFactory","moddle"],mr.prototype._baseCreate=Ni.prototype.create,mr.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,W({type:"label",di:n},Fr,t))}return this.createElement(e,t)},mr.prototype.createElement=function(e,t){t=W({},t||{});var n,i=t.businessObject,r=t.di;if(!i){if(!t.type)throw new Error("no shape type specified");i=this._bpmnFactory.create(t.type)}if(!AT(r)){var o=W({},r||{},{id:i.id+"_di"});e==="root"?r=this._bpmnFactory.createDiPlane(i,o):e==="connection"?r=this._bpmnFactory.createDiEdge(i,o):r=this._bpmnFactory.createDiShape(i,o)}S(i,"bpmn:Group")&&(t=W({isFrame:!0},t)),t=CT(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=df(r,t,"isExpanded")),qe(i,["bpmn:Lane","bpmn:Participant"])&&(t=df(r,t,"isHorizontal")),S(i,"bpmn:SubProcess")&&(t.collapsed=!Qe(i,r)),S(i,"bpmn:ExclusiveGateway")&&(Mn(r,"isMarkerVisible")?r.isMarkerVisible===void 0&&(r.isMarkerVisible=!1):r.isMarkerVisible=!0),Yt(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),Yt(t.cancelActivity)&&(i.cancelActivity=t.cancelActivity,delete t.cancelActivity);var a,s;return t.eventDefinitionType&&(a=i.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=i,i.eventDefinitions=a,delete t.eventDefinitionType),n=this.getDefaultSize(i,r),t=W({id:i.id},n,t,{businessObject:i,di:r}),this._baseCreate(e,t)},mr.prototype.getDefaultSize=function(e,t){var n=ie(e);if(t=t||ot(e),S(n,"bpmn:SubProcess"))return Qe(n,t)?{width:350,height:200}:{width:100,height:80};if(S(n,"bpmn:Task"))return{width:100,height:80};if(S(n,"bpmn:Gateway"))return{width:50,height:50};if(S(n,"bpmn:Event"))return{width:36,height:36};if(S(n,"bpmn:Participant")){var i=t.isHorizontal===void 0||t.isHorizontal===!0;return Qe(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return S(n,"bpmn:Lane")?{width:400,height:100}:S(n,"bpmn:DataObjectReference")?{width:36,height:50}:S(n,"bpmn:DataStoreReference")?{width:50,height:50}:S(n,"bpmn:TextAnnotation")?{width:100,height:40}:S(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},mr.prototype.createParticipantShape=function(e){return Qt(e)||(e={isExpanded:e}),e=W({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function CT(e,t,n){return F(n,function(i){t=df(e,t,i)}),t}function df(e,t,n){return t[n]===void 0?t:(e[n]=t[n],hi(t,[n]))}function AT(e){return qe(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function Bc(e,t){this._modeling=e,this._canvas=t}Bc.$inject=["modeling","canvas"],Bc.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;F(n,function(r){var o={x:0,y:0};Yt(i.left)?o.x=i.left-r.x:Yt(i.right)?o.x=i.right-r.width-r.x:Yt(i.center)?o.x=i.center-Math.round(r.width/2)-r.x:Yt(i.top)?o.y=i.top-r.y:Yt(i.bottom)?o.y=i.bottom-r.height-r.y:Yt(i.middle)&&(o.y=i.middle-Math.round(r.height/2)-r.y),t.moveElements([r],o,r.parent)})},Bc.prototype.postExecute=function(e){};function Nc(e){this._modeling=e}Nc.$inject=["modeling"],Nc.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var n=e.target||t.parent,i=e.shape,r=e.hints||{};i=e.shape=this._modeling.createShape(i,e.position,n,{attach:r.attach}),e.shape=i},Nc.prototype.postExecute=function(e){var t=e.hints||{};PT(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 PT(e,t){return Xi(e.outgoing,function(n){return n.target===t})}function $c(e,t){this._canvas=e,this._layouter=t}$c.$inject=["canvas","layouter"],$c.prototype.execute=function(e){var t=e.connection,n=e.source,i=e.target,r=e.parent,o=e.parentIndex,a=e.hints;if(!n||!i)throw new Error("source and target required");if(!r)throw new Error("parent required");return t.source=n,t.target=i,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,a)),this._canvas.addConnection(t,r,o),t},$c.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var Fc=Math.round;function hf(e){this._modeling=e}hf.$inject=["modeling"],hf.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,r=e.position,o=e.hints,a=this._modeling;F(t,function(f){Fe(f.x)||(f.x=0),Fe(f.y)||(f.y=0)});var s=Ke(t,function(f){return!f.hidden}),c=Ft(s);F(t,function(f){ht(f)&&(f.waypoints=hn(f.waypoints,function(p){return{x:Fc(p.x-c.x-c.width/2+r.x),y:Fc(p.y-c.y-c.height/2+r.y)}})),W(f,{x:Fc(f.x-c.x-c.width/2+r.x),y:Fc(f.y-c.y-c.height/2+r.y)})});var l=new Set(Hs(t)),u={};F(t,function(f){if(ht(f)){u[f.id]=Fe(i)?a.createConnection(u[f.source.id],u[f.target.id],i,f,f.parent||n,o):a.createConnection(u[f.source.id],u[f.target.id],f,f.parent||n,o);return}var p=W({},o);l.has(f)||(p.autoResize=!1),Ye(f)&&(p=hi(p,["attach"])),u[f.id]=Fe(i)?a.createShape(f,li(f,["x","y","width","height"]),f.parent||n,i,p):a.createShape(f,li(f,["x","y","width","height"]),f.parent||n,p)}),e.elements=ro(u)};var Iv=Math.round;function gr(e){this._canvas=e}gr.$inject=["canvas"],gr.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,r=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return n.width!==void 0?W(t,n):W(t,{x:n.x-Iv(t.width/2),y:n.y-Iv(t.height/2)}),this._canvas.addShape(t,i,r),t},gr.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function ka(e){gr.call(this,e)}Ee(ka,gr),ka.$inject=["canvas"];var MT=gr.prototype.execute;ka.prototype.execute=function(e){var t=e.shape;return kT(t),t.labelTarget=e.labelTarget,MT.call(this,e)};var TT=gr.prototype.revert;ka.prototype.revert=function(e){return e.shape.labelTarget=null,TT.call(this,e)};function kT(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function Oa(e,t){this._canvas=e,this._modeling=t}Oa.$inject=["canvas","modeling"],Oa.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;hr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),hr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},Oa.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=Hu(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},Oa.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,Bt(n.children,t,i),this._canvas.addConnection(t,n),t};function mf(e,t){this._modeling=e,this._elementRegistry=t}mf.$inject=["modeling","elementRegistry"],mf.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;F(i,function(r){n.get(r.id)&&(r.waypoints?t.removeConnection(r):t.removeShape(r))})};function Da(e,t){this._canvas=e,this._modeling=t}Da.$inject=["canvas","modeling"],Da.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;hr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),hr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),hr(n.children,function(i){ht(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},Da.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=Hu(i.children,n),t.removeShape(n),n},Da.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return Bt(i.children,n,r),t.addShape(n,i),n};function jc(e){this._modeling=e}jc.$inject=["modeling"];var Lv={x:"y",y:"x"};jc.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(y,v){y.range.min=Math.min(v[i],y.range.min),y.range.max=Math.max(v[i]+v[r],y.range.max)}function a(y){return y[i]+y[r]/2}function s(y){return y.length-1}function c(y){return y.max-y.min}function l(y,v){var g={y:0};g[i]=y-a(v),g[i]&&(g[Lv[i]]=0,t.moveElements([v],g,v.parent))}var u=n[0],f=s(n),p=n[f],d,m,h=0;F(n,function(y,v){var g,b,x;if(y.elements.length<2){v&&v!==n.length-1&&(o(y,y.elements[0]),h+=c(y.range));return}g=di(y.elements,i),b=g[0],v===f&&(b=g[s(g)]),x=a(b),y.range=null,F(g,function(C){if(l(x,C),y.range===null){y.range={min:C[i],max:C[i]+C[r]};return}o(y,C)}),v&&v!==n.length-1&&(h+=c(y.range))}),m=Math.abs(p.range.min-u.range.max),d=Math.round((m-h)/(n.length-1)),!(d<n.length-1)&&F(n,function(y,v){var g={},b;y===u||y===p||(b=n[v-1],y.range.max=0,F(y.elements,function(x,C){g[Lv[i]]=0,g[i]=b.range.max-x[i]+d,y.range.min!==x[i]&&(g[i]+=x[i]-y.range.min),g[i]&&t.moveElements([x],g,x.parent),y.range.max=Math.max(x[i]+x[r],C?y.range.max:0)}))})},jc.prototype.postExecute=function(e){};function Hc(e,t){this._layouter=e,this._canvas=t}Hc.$inject=["layouter","canvas"],Hc.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return W(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},Hc.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function gf(){}gf.prototype.execute=function(e){var t=e.connection,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldParent=o,e.oldParentIndex=Lt(o.children,t),Bt(i.children,t,r),t.parent=i,F(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},gf.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return Lt(n.children,t),Bt(i.children,t,r),t.parent=i,F(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};function yf(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}yf.prototype.add=function(e,t){return this.addAll([e],t)},yf.prototype.addAll=function(e,t){var n=sR(e,!!t,this);return W(this,n),this};function Ia(e){this._modeling=e}Ia.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},Ia.prototype.moveClosure=function(e,t,n,i,r){var o=this._modeling,a=e.allShapes,s=e.allConnections,c=e.enclosedConnections,l=e.topLevel,u=!1;r&&r.parent===n&&(u=!0),F(a,function(f){o.moveShape(f,t,l[f.id]&&!u&&n,{recurse:!1,layout:!1})}),F(s,function(f){var p=!!a[f.source.id],d=!!a[f.target.id];c[f.id]&&p&&d?o.moveConnection(f,t,l[f.id]&&!u&&n):o.layoutConnection(f,{connectionStart:p&&Ep(f,f.source,t),connectionEnd:d&&Sp(f,f.target,t)})})},Ia.prototype.getClosure=function(e){return new yf().addAll(e,!0)};function zc(e){this._helper=new Ia(e)}zc.$inject=["modeling"],zc.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},zc.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)};function Wr(e){this._modeling=e,this._helper=new Ia(e)}Wr.$inject=["modeling"],Wr.prototype.execute=function(e){var t=e.shape,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldBounds=li(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=Lt(o.children,t),Bt(i.children,t,r),W(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},Wr.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,r=this._modeling;i.layout!==!1&&(F(t.incoming,function(o){r.layoutConnection(o,{connectionEnd:Sp(o,t,n)})}),F(t.outgoing,function(o){r.layoutConnection(o,{connectionStart:Ep(o,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},Wr.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return Bt(n.children,t,i),W(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},Wr.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},Wr.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function La(e){this._modeling=e}La.$inject=["modeling"],La.prototype.execute=function(e){var t=e.newSource,n=e.newTarget,i=e.connection,r=e.dockingOrPoints;if(!t&&!n)throw new Error("newSource or newTarget required");return Be(r)&&(e.oldWaypoints=i.waypoints,i.waypoints=r),t&&(e.oldSource=i.source,i.source=t),n&&(e.oldTarget=i.target,i.target=n),i},La.prototype.postExecute=function(e){var t=e.connection,n=e.newSource,i=e.newTarget,r=e.dockingOrPoints,o=e.hints||{},a={};o.connectionStart&&(a.connectionStart=o.connectionStart),o.connectionEnd&&(a.connectionEnd=o.connectionEnd),o.layoutConnection!==!1&&(n&&(!i||o.docking==="source")&&(a.connectionStart=a.connectionStart||Bv(Be(r)?r[0]:r)),i&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||Bv(Be(r)?r[r.length-1]:r)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},La.prototype.revert=function(e){var t=e.oldSource,n=e.oldTarget,i=e.oldWaypoints,r=e.connection;return t&&(r.source=t),n&&(r.target=n),i&&(r.waypoints=i),r};function Bv(e){return e.original||e}function Gi(e,t){this._modeling=e,this._rules=t}Gi.$inject=["modeling","rules"],Gi.prototype.preExecute=function(e){var t=this,n=this._modeling,i=this._rules,r=e.oldShape,o=e.newData,a=e.hints||{},s;function c(m,h,y){return i.allowed("connection.reconnect",{connection:y,source:m,target:h})}var l={x:o.x,y:o.y},u={x:r.x,y:r.y,width:r.width,height:r.height};s=e.newShape=e.newShape||t.createShape(o,l,r.parent,a),r.host&&n.updateAttachment(s,r.host);var f;a.moveChildren!==!1&&(f=r.children.slice(),n.moveElements(f,{x:0,y:0},s,a));var p=r.incoming.slice(),d=r.outgoing.slice();F(p,function(m){var h=m.source,y=c(h,s,m);y&&t.reconnectEnd(m,s,mc(m,s,u),a)}),F(d,function(m){var h=m.target,y=c(s,h,m);y&&t.reconnectStart(m,s,hc(m,s,u),a)})},Gi.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},Gi.prototype.execute=function(e){},Gi.prototype.revert=function(e){},Gi.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},Gi.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},Gi.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function Ba(e){this._modeling=e}Ba.$inject=["modeling"],Ba.prototype.execute=function(e){var t=e.shape,n=e.newBounds,i=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(i&&(n.width<i.width||n.height<i.height))throw new Error("width and height cannot be less than minimum height and width");if(!i&&n.width<10||n.height<10)throw new Error("width and height cannot be less than 10px");return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},W(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Ba.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,r=e.hints||{};r.layout!==!1&&(F(n.incoming,function(o){t.layoutConnection(o,{connectionEnd:mc(o,n,i)})}),F(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:hc(o,n,i)})}))},Ba.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return W(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function yr(e){this._modeling=e}yr.$inject=["modeling"],yr.prototype.preExecute=function(e){var t=e.delta,n=e.direction,i=e.movingShapes,r=e.resizingShapes,o=e.start,a={};this.moveShapes(i,t),F(r,function(s){a[s.id]=DT(s)}),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(aT(i,r),t,n,o,i,r,a)},yr.prototype.execute=function(){},yr.prototype.revert=function(){},yr.prototype.moveShapes=function(e,t){var n=this;F(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},yr.prototype.resizeShapes=function(e,t,n){var i=this;F(e,function(r){var o=sT(r,n,t);i._modeling.resizeShape(r,o,null,{attachSupport:!1,autoResize:!1,layout:!1})})},yr.prototype.updateConnectionWaypoints=function(e,t,n,i,r,o,a){var s=this,c=new Set(r),l=new Set(o);F(e,function(u){var f=u.source,p=u.target,d=OT(u),m=$v(n),h={},y=c.has(f)||l.has(f),v=c.has(p)||l.has(p);y&&v?(d=hn(d,function(g){return Fv(g,i,n)&&(g[m]=g[m]+t[m]),g.original&&Fv(g.original,i,n)&&(g.original[m]=g.original[m]+t[m]),g}),s._modeling.updateWaypoints(u,d,{labelBehavior:!1})):(y||v)&&(c.has(f)?h.connectionStart=Ep(u,f,t):c.has(p)?h.connectionEnd=Sp(u,p,t):l.has(f)?h.connectionStart=hc(u,f,a[f.id]):l.has(p)&&(h.connectionEnd=mc(u,p,a[p.id])),s._modeling.layoutConnection(u,h))})};function Nv(e){return W({},e)}function OT(e){return hn(e.waypoints,function(t){return t=Nv(t),t.original&&(t.original=Nv(t.original)),t})}function $v(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function Fv(e,t,n){var i=$v(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function DT(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function Gc(e){this._modeling=e}Gc.$inject=["modeling"],Gc.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=jv(n),t.collapsed=!t.collapsed;var i=Hv(n,t.collapsed);return[t].concat(i)},Gc.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,r=zv(i,n);return t.collapsed=!t.collapsed,[t].concat(r)};function jv(e){var t={};return F(e,function(n){t[n.id]=n.hidden,n.children&&(t=W({},t,jv(n.children)))}),t}function Hv(e,t){var n=[];return F(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(Hv(i.children,i.collapsed||t)))}),n}function zv(e,t){var n=[];return F(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(zv(i.children,t)))}),n}function Vc(e){this._modeling=e}Vc.$inject=["modeling"],Vc.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=Gv(i,t),Vv(n,t),t.host=n,t},Vc.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,Gv(n,t),Vv(i,t,r),t};function Gv(e,t){return Lt(e&&e.attachers,t)}function Vv(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),Bt(i,t,n)}}function vf(){}vf.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},vf.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function mt(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}mt.$inject=["eventBus","elementFactory","commandStack"],mt.prototype.getHandlers=function(){return{"shape.append":Nc,"shape.create":gr,"shape.delete":Da,"shape.move":Wr,"shape.resize":Ba,"shape.replace":Gi,"shape.toggleCollapse":Gc,spaceTool:yr,"label.create":ka,"connection.create":$c,"connection.delete":Oa,"connection.move":gf,"connection.layout":Hc,"connection.updateWaypoints":vf,"connection.reconnect":La,"elements.create":hf,"elements.move":zc,"elements.delete":mf,"elements.distribute":jc,"elements.align":Bc,"element.updateAttachment":Vc}},mt.prototype.registerHandlers=function(e){F(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},mt.prototype.moveShape=function(e,t,n,i,r){typeof i=="object"&&(r=i,i=null);var o={shape:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("shape.move",o)},mt.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},mt.prototype.moveElements=function(e,t,n,i){i=i||{};var r=i.attach,o=n,a;r===!0?(a=n,o=n.parent):r===!1&&(a=null);var s={shapes:e,delta:t,newParent:o,newHost:a,hints:i};this._commandStack.execute("elements.move",s)},mt.prototype.moveConnection=function(e,t,n,i,r){typeof i=="object"&&(r=i,i=void 0);var o={connection:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("connection.move",o)},mt.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},mt.prototype.createConnection=function(e,t,n,i,r,o){typeof n=="object"&&(o=r,r=i,i=n,n=void 0),i=this._create("connection",i);var a={source:e,target:t,parent:r,parentIndex:n,connection:i,hints:o};return this._commandStack.execute("connection.create",a),a.connection},mt.prototype.createShape=function(e,t,n,i,r){typeof i!="number"&&(r=i,i=void 0),r=r||{};var o=r.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:i,host:s,hints:r};return this._commandStack.execute("shape.create",c),c.shape},mt.prototype.createElements=function(e,t,n,i,r){Be(e)||(e=[e]),typeof i!="number"&&(r=i,i=void 0),r=r||{};var o={position:t,elements:e,parent:n,parentIndex:i,hints:r};return this._commandStack.execute("elements.create",o),o.elements},mt.prototype.createLabel=function(e,t,n,i){n=this._create("label",n);var r={labelTarget:e,position:t,parent:i||e.parent,shape:n};return this._commandStack.execute("label.create",r),r.shape},mt.prototype.appendShape=function(e,t,n,i,r){r=r||{},t=this._create("shape",t);var o={source:e,position:n,target:i,shape:t,connection:r.connection,connectionParent:r.connectionParent,hints:r};return this._commandStack.execute("shape.append",o),o.shape},mt.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},mt.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},mt.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},mt.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},mt.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},mt.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},mt.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},mt.prototype.createSpace=function(e,t,n,i,r){var o={delta:n,direction:i,movingShapes:e,resizingShapes:t,start:r};this._commandStack.execute("spaceTool",o)},mt.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},mt.prototype.reconnect=function(e,t,n,i,r){var o={connection:e,newSource:t,newTarget:n,dockingOrPoints:i,hints:r||{}};this._commandStack.execute("connection.reconnect",o)},mt.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,W(i,{docking:"source"}))},mt.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,W(i,{docking:"target"}))},mt.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},mt.prototype._create=function(e,t){return UR(t)?t:this._elementFactory.create(e,t)},mt.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function Na(e){this._elementRegistry=e}Na.$inject=["elementRegistry"],Na.prototype.execute=function(e){var t=e.element,n=e.moddleElement,i=e.properties;if(!n)throw new Error("<moddleElement> required");var r=e.changed||this._getVisualReferences(n).concat(t),o=e.oldProperties||IT(n,ds(i));return Wv(n,i),e.oldProperties=o,e.changed=r,r},Na.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return Wv(n,t),i},Na.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return S(e,"bpmn:DataObject")?LT(e,t):[]};function IT(e,t){return Tn(t,function(n,i){return n[i]=e.get(i),n},{})}function Wv(e,t){F(t,function(n,i){e.set(i,n)})}function LT(e,t){return t.filter(function(n){return S(n,"bpmn:DataObjectReference")&&ie(n).dataObjectRef===e})}var $a="default",Vi="id",Uv="di",BT={width:0,height:0};function Fa(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}Fa.$inject=["elementRegistry","moddle","modeling","textRenderer"],Fa.prototype.execute=function(e){var t=e.element,n=[t];if(!t)throw new Error("element required");var i=this._elementRegistry,r=this._moddle.ids,o=t.businessObject,a=HT(e.properties),s=e.oldProperties||NT(t,a);return Yv(a,o)&&(r.unclaim(o[Vi]),i.updateId(t,a[Vi]),r.claim(a[Vi],o)),$a in a&&(a[$a]&&n.push(i.get(a[$a].id)),o[$a]&&n.push(i.get(o[$a].id))),qv(t,a),e.oldProperties=s,e.changed=n,n},Fa.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&ie(n).name;if(i){var r=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,r,BT)}},Fa.prototype.revert=function(e){var t=e.element,n=e.properties,i=e.oldProperties,r=t.businessObject,o=this._elementRegistry,a=this._moddle.ids;return qv(t,i),Yv(n,r)&&(a.unclaim(n[Vi]),o.updateId(t,i[Vi]),a.claim(i[Vi],r)),e.changed};function Yv(e,t){return Vi in e&&e[Vi]!==t[Vi]}function NT(e,t){var n=ds(t),i=e.businessObject,r=ot(e);return Tn(n,function(o,a){return a!==Uv?o[a]=i.get(a):o[a]=$T(r,ds(t.di)),o},{})}function $T(e,t){return Tn(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function qv(e,t){var n=e.businessObject,i=ot(e);F(t,function(r,o){o!==Uv?n.set(o,r):i&&FT(i,r)})}function FT(e,t){F(t,function(n,i){e.set(i,n)})}var jT=["default"];function HT(e){var t=W({},e);return jT.forEach(function(n){n in e&&(t[n]=ie(t[n]))}),t}function Wc(e,t){this._canvas=e,this._modeling=t}Wc.$inject=["canvas","modeling"],Wc.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=ot(r);return t.setRootElement(n),t.removeRootElement(r),Bt(a.rootElements,i),i.$parent=a,Lt(a.rootElements,o),o.$parent=null,r.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=r,[]},Wc.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,a=i.$parent,s=ot(n);return t.setRootElement(r),t.removeRootElement(n),Lt(a.rootElements,i),i.$parent=null,Bt(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,r.di=s,[]};function bf(e,t){this._modeling=e,this._spaceTool=t}bf.$inject=["modeling","spaceTool"],bf.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=ei(i),a=o===i,s=a?i:i.parent,c=lr(s),l=tn(i);if(l?r==="left"?r="top":r==="right"&&(r="bottom"):r==="top"?r="left":r==="bottom"&&(r="right"),!c.length){var u=l?{x:i.x+Jn,y:i.y,width:i.width-Jn,height:i.height}:{x:i.x,y:i.y+Jn,width:i.width,height:i.height-Jn};n.createShape({type:"bpmn:Lane",isHorizontal:l},u,s)}var f=[];Nr(o,function(x){return f.push(x),x.label&&f.push(x.label),x===i?[]:Ke(x.children,function(C){return C!==i})});var p,d,m,h,y;r==="top"?(p=-120,d=i.y,m=d+10,h="n",y="y"):r==="left"?(p=-120,d=i.x,m=d+10,h="w",y="x"):r==="bottom"?(p=120,d=i.y+i.height,m=d-10,h="s",y="y"):r==="right"&&(p=120,d=i.x+i.width,m=d-10,h="e",y="x");var v=t.calculateAdjustments(f,y,p,m),g=l?{x:0,y:p}:{x:p,y:0};t.makeSpace(v.movingShapes,v.resizingShapes,g,h,m);var b=l?{x:i.x+(a?Jn:0),y:d-(r==="top"?120:0),width:i.width-(a?Jn:0),height:120}:{x:d-(r==="left"?120:0),y:i.y+(a?Jn:0),width:120,height:i.height-(a?Jn:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:l},b,s)};function xf(e){this._modeling=e}xf.$inject=["modeling"],xf.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=lr(n),o=r.length;if(o>i)throw new Error(`more than <${i}> child lanes`);var a=tn(n),s=a?n.height:n.width,c=Math.round(s/i),l,u,f,p;for(p=0;p<i;p++)p===i-1?l=s-c*p:l=c,u=a?{x:n.x+Jn,y:n.y+p*c,width:n.width-Jn,height:l}:{x:n.x+p*c,y:n.y+Jn,width:l,height:n.height-Jn},p<o?t.resizeShape(r[p],u):(f={type:"bpmn:Lane",isHorizontal:a},t.createShape(f,u,n))};function ja(e,t){this._modeling=e,this._spaceTool=t}ja.$inject=["modeling","spaceTool"],ja.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},ja.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=LA(e,t);n.resizeShape(e,t),i.forEach(function(r){n.resizeShape(r.shape,r.newBounds)})},ja.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=Ie(e),r=Ie(t),o=Cg(r,i),a=ei(e),s=[],c=[];Nr(a,function(m){return s.push(m),(S(m,"bpmn:Lane")||S(m,"bpmn:Participant"))&&c.push(m),m.children});var l,u,f,p,d;(o.bottom||o.top)&&(l=o.bottom||o.top,u=e.y+(o.bottom?e.height:0)+(o.bottom?-10:10),f=o.bottom?"s":"n",p=o.top>0||o.bottom<0?-l:l,d=n.calculateAdjustments(s,"y",p,u),n.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:l},f)),(o.left||o.right)&&(l=o.right||o.left,u=e.x+(o.right?e.width:0)+(o.right?-10:100),f=o.right?"e":"w",p=o.left>0||o.right<0?-l:l,d=n.calculateAdjustments(c,"x",p,u),n.makeSpace(d.movingShapes,d.resizingShapes,{x:l,y:0},f))};var Ha="flowNodeRef",_f="lanes";function Uc(){}Uc.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},o=[];function a(u,f){var p=Ie(f),d={x:u.x+u.width/2,y:u.y+u.height/2};return d.x>p.left&&d.x<p.right&&d.y>p.top&&d.y<p.bottom}function s(u){n.indexOf(u)===-1&&(o.push(u),n.push(u))}function c(u){var f=ei(u);return r[f.id]||(r[f.id]=lc(f)),r[f.id]}function l(u){if(!u.parent)return[];var f=c(u);return f.filter(function(p){return a(u,p)}).map(function(p){return p.businessObject})}return t.forEach(function(u){var f=ei(u);if(!(!f||n.indexOf(f)!==-1)){var p=f.children.filter(function(d){return S(d,"bpmn:FlowNode")});p.forEach(s),n.push(f)}}),e.forEach(s),o.forEach(function(u){var f=u.businessObject,p=f.get(_f),d=p.slice(),m=l(u);i.push({flowNode:f,remove:d,add:m})}),t.forEach(function(u){var f=u.businessObject;u.parent||f.get(Ha).forEach(function(p){i.push({flowNode:p,remove:[f],add:[]})})}),i},Uc.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.flowNodeShapes,e.laneShapes)),t.forEach(function(n){var i=n.flowNode,r=i.get(_f);n.remove.forEach(function(o){Lt(r,o),Lt(o.get(Ha),i)}),n.add.forEach(function(o){Bt(r,o),Bt(o.get(Ha),i)})}),[]},Uc.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,r=i.get(_f);n.add.forEach(function(o){Lt(r,o),Lt(o.get(Ha),i)}),n.remove.forEach(function(o){Bt(r,o),Bt(o.get(Ha),i)})}),[]};var wf="categoryValueRef";function za(e,t){this._bpmnFactory=e,this._elementRegistry=t}za.$inject=["bpmnFactory","elementRegistry"],za.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,r=new Map,o=[],a=new Map;function s(g,b,x){if(b){var C=a.get(g);C||(C={},a.set(g,C)),!(x&&C.present)&&(!x&&C.past||(x?C.present={categoryValue:b,root:Ef(g)}:C.past={categoryValue:b}))}}function c(g){r.set(g,ie(g))}function l(){n.filter(function(g){return S(g,"bpmn:FlowElement")&&!Ye(g)&&g.parent}).forEach(c)}function u(g){var b=ie(g),x=b.get("categoryValueRef");return x||(x=_g(i,b),o.push(zT(g,x))),x}function f(g){return g.reduce(function(b,x){var C=Ef(x),M=b.get(C);return M||(M=[],b.set(C,M)),M.push(x),b},new Map)}e=Array.from(e||[]);var p=f(e);t.length&&l(),e.forEach(c),n.filter(function(g){return S(g,"bpmn:Group")&&!Ye(g)&&g.parent}).forEach(function(g){var b=ie(g).get("categoryValueRef");if(!b){var x=Ef(g),C=p.get(x)||[],M=bo(C,g),k=Object.keys(M).length>0;k&&(b=u(g))}s(g,b,!0)}),t.forEach(function(g){s(g.groupShape,g.categoryValue,!1)}),o.length&&l();var d=Array.from(r.keys()),m=Array.from(a.values()).reduce(function(g,b){return b.present&&g.add(b.present.categoryValue),b.past&&g.add(b.past.categoryValue),g},new Set),h=new Map,y=f(d);a.forEach(function(g,b){var x=g.present;if(x){var C=y.get(x.root)||[],M=bo(C,b);C.forEach(function(k){if(M[k.id]){var P=h.get(k);P||(P=new Set,h.set(k,P)),P.add(x.categoryValue)}})}});var v=d.reduce(function(g,b){var x=r.get(b),C=x.get(wf),M=new Set(C),k=h.get(b)||new Set,P=Array.from(k).filter(function(D){return!M.has(D)}),B=C.filter(function(D){return m.has(D)&&!k.has(D)});return(P.length||B.length)&&g.push({businessObject:x,categoryValuesToAdd:P,categoryValuesToRemove:B}),g},[]);return{flowElements:v,groups:o}},za.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),GT(t.groups),WT(t.flowElements),[]},za.prototype.revert=function(e){var t=e.updates;return UT(t.flowElements),VT(t.groups),[]};function zT(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function GT(e){e.forEach(function(t){ie(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function VT(e){e.forEach(function(t){ie(t.groupShape).categoryValueRef=null})}function WT(e){e.forEach(function(t){var n=t.businessObject,i=n.get(wf);t.categoryValuesToRemove.forEach(function(r){Lt(i,r)}),t.categoryValuesToAdd.forEach(function(r){Bt(i,r,!0)})})}function UT(e){e.forEach(function(t){var n=t.businessObject,i=n.get(wf);t.categoryValuesToAdd.forEach(function(r){Lt(i,r)}),t.categoryValuesToRemove.forEach(function(r){Bt(i,r,!0)})})}function Ef(e){for(;e.parent;)e=e.parent;return e}function Yc(e){this._moddle=e}Yc.$inject=["moddle"],Yc.prototype.execute=function(e){var t=this._moddle.ids,n=e.id,i=e.element,r=e.claiming;return r?t.claim(n,i):t.unclaim(n),[]},Yc.prototype.revert=function(e){var t=this._moddle.ids,n=e.id,i=e.element,r=e.claiming;return r?t.unclaim(n):t.claim(n,i),[]};var YT={fill:void 0,stroke:void 0};function Sf(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(Pn(t)){var n=qT(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}Sf.$inject=["commandStack"],Sf.prototype.postExecute=function(e){var t=e.elements,n=e.colors||YT,i=this,r={};"fill"in n&&W(r,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&W(r,{"border-color":this._normalizeColor(n.stroke)}),F(t,function(o){var a=ht(o)?li(r,["border-color"]):r,s=ot(o);if(KT(a),Ye(o)){if(!s||!S(s.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:o,moddleElement:s.label,properties:{color:r["border-color"]}})}else{if(!qe(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:o,properties:{di:a}})}})};function qT(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 KT(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var XT={width:0,height:0};function Kv(e,t,n){function i(c,l){var u=c.label||c,f=c.labelTarget||c;return SC(u,l),[u,f]}function r(c){var l=c.element,u=l.businessObject,f=c.newLabel;if(!Ye(l)&&sr(l)&&!Xs(l)&&!Xv(f)){var p=7,d=Yu(l);d={x:d.x,y:d.y+p},e.createLabel(l,d,{id:u.id+"_label",businessObject:u,di:l.di})}}function o(c){return c.oldLabel=qn(c.element),i(c.element,c.newLabel)}function a(c){return i(c.element,c.oldLabel)}function s(c){var l=c.element,u=l.label||l,f=c.newLabel,p=c.newBounds,d=c.hints||{};if(!(!Ye(u)&&!S(u,"bpmn:TextAnnotation"))){if(Ye(u)&&Xv(f)){d.removeShape!==!1&&e.removeShape(u,{unsetLabel:!1});return}var m=qn(l);typeof p>"u"&&(p=t.getExternalLabelBounds(u,m)),p&&e.resizeShape(u,p,XT)}}this.preExecute=r,this.execute=o,this.revert=a,this.postExecute=s}Kv.$inject=["modeling","textRenderer","bpmnFactory"];function Xv(e){return!e||!e.trim()}function pn(e,t,n,i){mt.call(this,e,t,n),this._bpmnRules=i}Ee(pn,mt),pn.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],pn.prototype.getHandlers=function(){var e=mt.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=Na,e["element.updateProperties"]=Fa,e["canvas.updateRoot"]=Wc,e["lane.add"]=bf,e["lane.resize"]=ja,e["lane.split"]=xf,e["lane.updateRefs"]=Uc,e["group.updateRefs"]=za,e["id.updateClaim"]=Yc,e["element.setColor"]=Sf,e["element.updateLabel"]=Kv,e},pn.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},pn.prototype.connect=function(e,t,n,i){var r=this._bpmnRules;if(n||(n=r.canConnect(e,t)),!!n)return this.createConnection(e,t,n,e.parent,i)},pn.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},pn.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},pn.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},pn.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},pn.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},pn.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},pn.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},pn.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},pn.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},pn.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},pn.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},pn.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function Zv(){}Zv.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||Ne(t.source||e.source),t.connectionEnd||Ne(t.target||e.target)]};var qc=20,ZT=5,Kc=Math.round,Qv=20,QT={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function JT(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function e2(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function Jv(e,t,n){var i=cn(t,e,ZT),r=n.split(":")[0],o=Kc((t.x-e.x)/2+e.x),a=Kc((t.y-e.y)/2+e.y),s,c,l=e2(r,i),u=/h|r|l/.test(r),f=!1,p=!1;return l?(s=u?{x:o,y:e.y}:{x:e.x,y:a},c=u?"h:h":"v:v"):(f=JT(i,r),c=u?"h:v":"v:h",f?u?(p=a===e.y,s={x:e.x+qc*(/l/.test(r)?-1:1),y:p?a+qc:a}):(p=o===e.x,s={x:p?o+qc:o,y:e.y+qc*(/t/.test(r)?-1:1)}):s={x:o,y:a}),{waypoints:Rf(e,s,c).concat(s),directions:c,turnNextDirections:p}}function t2(e,t,n){return Jv(e,t,n)}function n2(e,t,n){var i=Jv(t,e,eb(n));return{waypoints:i.waypoints.slice().reverse(),directions:eb(i.directions),turnNextDirections:i.turnNextDirections}}function i2(e,t){var n=e.directions.split(":")[1],i=t.directions.split(":")[0];e.turnNextDirections&&(n=n=="h"?"v":"h"),t.turnNextDirections&&(i=i=="h"?"v":"h");var r=n+":"+i,o=Rf(e.waypoints[e.waypoints.length-1],t.waypoints[0],r);return{waypoints:o,directions:r}}function eb(e){return e.split(":").reverse().join(":")}function r2(e,t,n){var i=Kc((t.x-e.x)/2+e.x),r=Kc((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:i,y:e.y},{x:i,y:t.y}];if(n==="v:v")return[{x:e.x,y:r},{x:t.x,y:r}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}function Rf(e,t,n){if(n=n||"h:h",!d2(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(nb(n)){var i=t2(e,t,n),r=n2(e,t,n),o=i2(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return r2(e,t,n)}function o2(e,t,n){var i=Rf(e,t,n);return i.unshift(e),i.push(t),rb(i)}function a2(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=O0(o,"straight")[0]||"h:h",s=QT[a]||0,c=cn(e,t,s),l=f2(c,a);n=n||Ne(e),i=i||Ne(t);var u=l.split(":"),f=ib(n,e,u[0],h2(c)),p=ib(i,t,u[1],c);return o2(f,p,l)}function s2(e,t,n,i,r,o){Be(n)&&(r=n,o=i,n=Ne(e),i=Ne(t)),o=W({preferredLayouts:[]},o),r=r||[];var a=o.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&l2(e,t,n,i,o),c||(c=o.connectionEnd&&p2(t,e,i,r),c)||(c=o.connectionStart&&u2(e,t,n,r),c)?c:!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:a2(e,t,n,i,o)}function c2(e,t,n){return e>=t&&e<=n}function tb(e,t,n){var i={x:"width",y:"height"};return c2(t[e],n[e],n[e]+n[i[e]])}function l2(e,t,n,i,r){var o={},a,s;return s=cn(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),r.preserveDocking==="target"?tb(a,i,e)?(o[a]=i[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:i.x,y:i.y}]):null:tb(a,n,t)?(o[a]=n[a],[{x:n.x,y:n.y},{x:o.x!==void 0?o.x:i.x,y:o.y!==void 0?o.y:i.y,original:{x:o.x!==void 0?o.x:i.x,y:o.y!==void 0?o.y:i.y}}]):null):null}function u2(e,t,n,i){return Cf(e,t,n,i)}function p2(e,t,n,i){var r=i.slice().reverse();return r=Cf(e,t,n,r),r?r.reverse():null}function Cf(e,t,n,i){function r(u){return u.length<3?!0:u.length>4?!1:!!vt(u,function(f,p){var d=u[p-1];return d&&fa(f,d)<3})}function o(u,f,p){var d=Li(f,u);switch(d){case"v":return{x:p.x,y:u.y};case"h":return{x:u.x,y:p.y}}return{x:u.x,y:u.y}}function a(u,f,p){var d;for(d=u.length-2;d!==0;d--)if(Am(u[d],f,Qv)||Am(u[d],p,Qv))return u.slice(d);return u}if(r(i))return null;var s=i[0],c=i.slice(),l;return c[0]=n,c[1]=o(c[1],s,n),l=a(c,e,t),l!==c&&(c=Cf(e,t,n,l)),c&&Li(c)?null:c}function f2(e,t){if(nb(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 d2(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function nb(e){return e&&/t|r|b|l/.test(e)}function h2(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 ib(e,t,n,i){if(n==="h"&&(n=/left/.test(i)?"l":"r"),n==="v"&&(n=/top/.test(i)?"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 rb(e){return e.reduce(function(t,n,i){var r=t[t.length-1],o=e[i+1];return zu(r,o,n,0)||t.push(n),t},[])}var m2=-10,g2=40,y2={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},v2={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},Af={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},Ga={top:"t",right:"r",bottom:"b",left:"l"};function Xc(e){this._elementRegistry=e}Ee(Xc,Zv),Xc.prototype.layoutConnection=function(e,t){t||(t={});var n=t.source||e.source,i=t.target||e.target,r=t.waypoints||e.waypoints,o=t.connectionStart,a=t.connectionEnd,s=this._elementRegistry,c,l;if(o||(o=ob(r&&r[0],n)),a||(a=ob(r&&r[r.length-1],i)),(S(e,"bpmn:Association")||S(e,"bpmn:DataAssociation"))&&r&&!ab(n,i))return[].concat([o],r.slice(1,-1),[a]);var u=yg(n,s)?y2:v2;return S(e,"bpmn:MessageFlow")?c=x2(n,i,u):(S(e,"bpmn:SequenceFlow")||ab(n,i))&&(n===i?c={preferredLayouts:C2(n,e,u)}:S(n,"bpmn:BoundaryEvent")?c={preferredLayouts:A2(n,i,a,u)}:Va(n)||Va(i)?c={preferredLayouts:u.subProcess,preserveDocking:w2(n)}:S(n,"bpmn:Gateway")?c={preferredLayouts:u.fromGateway}:S(i,"bpmn:Gateway")?c={preferredLayouts:u.toGateway}:c={preferredLayouts:u.default}),c&&(c=W(c,t),l=rb(s2(n,i,o,a,r,c))),l||[o,a]};function b2(e){var t=e.host;return cn(Ne(e),t,m2)}function x2(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:_2(e,t)}}function _2(e,t){return S(t,"bpmn:Participant")?"source":S(e,"bpmn:Participant")?"target":Va(t)?"source":Va(e)||S(t,"bpmn:Event")?"target":S(e,"bpmn:Event")?"source":null}function w2(e){return Va(e)?"target":"source"}function ob(e,t){return e?e.original||e:Ne(t)}function ab(e,t){return S(t,"bpmn:Activity")&&S(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function Va(e){return S(e,"bpmn:SubProcess")&&Qe(e)}function Ur(e,t){return e===t}function E2(e,t){return t.indexOf(e)!==-1}function $o(e){var t=/right|left/.exec(e);return t&&t[0]}function Fo(e){var t=/top|bottom/.exec(e);return t&&t[0]}function sb(e,t){return Af[e]===t}function S2(e,t){var n=$o(e),i=Af[n];return t.indexOf(i)!==-1}function R2(e,t){var n=Fo(e),i=Af[n];return t.indexOf(i)!==-1}function cb(e){return e==="right"||e==="left"}function C2(e,t,n){var i=t.waypoints,r=i&&i.length&&cn(i[0],e);return r==="top"?n.loop.fromTop:r==="right"?n.loop.fromRight:r==="left"?n.loop.fromLeft:n.loop.fromBottom}function A2(e,t,n,i){var r=Ne(e),o=Ne(t),a=b2(e),s,c,l=Ur(e.host,t),u=E2(a,["top","right","bottom","left"]),f=cn(o,r,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return l?P2(a,u,e,t,n,i):(s=M2(a,f,u,i.isHorizontal),c=T2(a,f,u,i.isHorizontal),[s+":"+c])}function P2(e,t,n,i,r,o){var a=t?e:o.isHorizontal?Fo(e):$o(e),s=Ga[a],c;return t?cb(e)?c=lb("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:c=lb("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function lb(e,t,n,i){var r=g2;return!(Pf(e,i,n,r)||Pf(e,i,{x:n.x+n.width,y:n.y+n.height},r)||Pf(e,i,Ne(t),r))}function Pf(e,t,n,i){return Math.abs(t[e]-n[e])<i}function M2(e,t,n,i){if(n)return Ga[e];var r=Fo(e),o=$o(e),a=Fo(t),s=$o(t);if(i){if(Ur(r,a)||sb(o,s))return Ga[r]}else if(Ur(o,s)||sb(r,a))return Ga[o];return Ga[i?o:r]}function T2(e,t,n,i){if(n)return cb(e)?S2(e,t)||Ur(e,t)?"h":"v":R2(e,t)||Ur(e,t)?"v":"h";var r=Fo(e),o=$o(e),a=Fo(t),s=$o(t);return a&&!s?"v":s&&!a?"h":i?Ur(r,a)?"h":"v":Ur(o,s)?"v":"h"}Xc.$inject=["elementRegistry"];function ub(e){return W({original:e.point.original||e.point},e.actual)}function vr(e,t){this._elementRegistry=e,this._graphicsFactory=t}vr.$inject=["elementRegistry","graphicsFactory"],vr.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var i=this.getDockingPoint(e,t,!0),r=this.getDockingPoint(e,n),o=e.waypoints.slice(i.idx+1,r.idx);return o.unshift(ub(i)),o.push(ub(r)),o},vr.prototype.getDockingPoint=function(e,t,n){var i=e.waypoints,r,o,a;return r=n?0:i.length-1,o=i[r],a=this._getIntersection(t,e,n),{point:o,actual:a||o,idx:r}},vr.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return da(i,r,n)},vr.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},vr.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},vr.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const Mf={__init__:["modeling","bpmnUpdater"],__depends__:[KP,pM,dM,hM,wv,mT,yT,ET,ni,ff,Pv],bpmnFactory:["type",ri],bpmnUpdater:["type",Nn],elementFactory:["type",mr],modeling:["type",pn],layouter:["type",Xc],connectionDocking:["type",vr]};var k2=10,pb=50,O2=250;function Tf(e,t,n,i){for(var r;r=D2(e,n,t);)n=i(t,n,r);return n}function kf(e){return function(t,n,i){var r={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,l=a.minDistance;c<0?r[o]=Math.min(i[o]+c-t[s]/2,n[o]-l+c):r[o]=Math.max(i[o]+i[s]+c+t[s]/2,n[o]+l+c)}}),r}}function D2(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=L2(e);return vt(r,function(o){if(o===n)return!1;var a=cn(o,i,k2);return a==="intersect"})}function I2(e,t){t||(t={});function n(m){return m.source===e?1:-1}var i=t.defaultDistance||pb,r=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||O2,c=t.reference||"start";o||(o=$2);function l(m,h){return r==="n"?c==="start"?Ie(m).top-Ie(h).bottom:c==="center"?Ie(m).top-Ne(h).y:Ie(m).top-Ie(h).top:r==="w"?c==="start"?Ie(m).left-Ie(h).right:c==="center"?Ie(m).left-Ne(h).x:Ie(m).left-Ie(h).left:r==="s"?c==="start"?Ie(h).top-Ie(m).bottom:c==="center"?Ne(h).y-Ie(m).bottom:Ie(h).bottom-Ie(m).bottom:c==="start"?Ie(h).left-Ie(m).right:c==="center"?Ne(h).x-Ie(m).right:Ie(h).right-Ie(m).right}var u=e.incoming.filter(o).map(function(m){var h=a(m),y=h<0?l(m.source,e):l(e,m.source);return{id:m.source.id,distance:y,weight:h}}),f=e.outgoing.filter(o).map(function(m){var h=a(m),y=h>0?l(e,m.target):l(m.target,e);return{id:m.target.id,distance:y,weight:h}}),p=u.concat(f).reduce(function(m,h){return m[h.id+"__weight_"+h.weight]=h,m},{}),d=Tn(p,function(m,h){var y=h.distance,v=h.weight;return y<0||y>s||(m[String(y)]||(m[String(y)]=0),m[String(y)]+=1*v,(!m.distance||m[m.distance]<m[String(y)])&&(m.distance=y)),m},{});return d.distance||i}function L2(e){var t=Of(e);return e.host&&(t=t.concat(Of(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(Of(i))},[]))),t}function Of(e){return N2(e).concat(B2(e))}function B2(e){return e.incoming.map(function(t){return t.source})}function N2(e){return e.outgoing.map(function(t){return t.target})}function $2(){return!0}var F2=100;function fb(e,t,n){e.on("autoPlace",F2,function(i){var r=i.shape,o=i.source;return j2(o,r)}),e.on("autoPlace.end",function(i){n.scrollToElement(i.shape)}),this.append=function(i,r,o){e.fire("autoPlace.start",{source:i,shape:r});var a=e.fire("autoPlace",{source:i,shape:r}),s=t.appendShape(i,r,a,i.parent,o);return e.fire("autoPlace.end",{source:i,shape:s}),s}}fb.$inject=["eventBus","modeling","canvas"];function j2(e,t,n){n||(n={});var i=n.defaultDistance||pb,r=Ne(e),o=Ie(e);return{x:o.right+i+t.width/2,y:r.y}}function db(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}db.$inject=["eventBus","selection"];const H2={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",fb],autoPlaceSelectionBehavior:["type",db]};function hb(e,t,n){var i=yg(e,n);if(S(t,"bpmn:TextAnnotation"))return G2(e,t,i);if(qe(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return V2(e,t,i);if(S(t,"bpmn:FlowNode"))return z2(e,t,i)}function z2(e,t,n){var i=Ie(e),r=Ne(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=I2(e,{filter:function(d){return S(d,"bpmn:SequenceFlow")},direction:o.directionHint}),s=30,c=o.minDistance,l=o.baseOrientation;S(e,"bpmn:BoundaryEvent")&&(l=cn(e,e.host,-25),l.indexOf(o.boundaryOrientation)!==-1&&(s*=-1));var u=n?{x:i.right+a+t.width/2,y:r.y+mb(l,c,o)}:{x:r.x+mb(l,c,o),y:i.bottom+a+t.height/2},f={margin:s,minDistance:c},p=n?{y:f}:{x:f};return Tf(e,t,u,kf(p))}function mb(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function G2(e,t,n){var i=Ie(e),r=n?{x:i.right+t.width/2,y:i.top-50-t.height/2}:{x:i.right+50+t.width/2,y:i.bottom+t.height/2};ht(e)&&(r=Ne(e),n?(r.x+=100,r.y-=50):(r.x+=100,r.y+=50));var o={margin:n?-30:30,minDistance:20},a=n?{y:o}:{x:o};return Tf(e,t,r,kf(a))}function V2(e,t,n){var i=Ie(e),r=n?{x:i.right-10+t.width/2,y:i.bottom+40+t.width/2}:{x:i.left-40-t.width/2,y:i.bottom-10+t.height/2},o={margin:30,minDistance:30},a=n?{x:o}:{y:o};return Tf(e,t,r,kf(a))}function gb(e,t){e.on("autoPlace",function(n){var i=n.shape,r=n.source;return hb(r,i,t)})}gb.$inject=["eventBus","elementRegistry"];const Zc={__depends__:[H2],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",gb]},yb=[mg,ba,Mf,Zc];function W2(e={}){rh(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new wo({container:t,moddleExtensions:e.moddleExtensions??xs,additionalModules:[...yb,...e.additionalModules??[]]})}const vb={"edge-crosses-shape":"연결","edge-crosses-subprocess":"연결","edge-endpoint-detached":"연결","edge-overlap-opposite":"겹침","edge-overlap-mixed":"겹침","edge-overlap-unrelated":"겹침","shape-overlap":"겹침","shape-outside-container":"소속","label-on-shared-segment":"라벨","label-over-line":"라벨","annotation-over-label":"라벨","pool-name-over-label":"라벨","group-overlap-unintended":"그룹","group-overlap-unreadable":"그룹","group-stack-unreadable":"그룹","group-on-container-boundary":"그룹","group-on-group-boundary":"그룹","group-cuts-shape":"그룹","pool-overlap":"풀","CHK-FLOW-1":"구조","CHK-POOL-1":"풀"},U2={이:["이","가"],을:["을","를"],와:["과","와"]};function Y2(e,t){const[n,i]=U2[t],r=e.at(-1)??"",o=r.charCodeAt(0);return o>=44032&&o<=55203?e+((o-44032)%28===0?i:n):r>="0"&&r<="9"?e+("013678".includes(r)?n:i):e+`${n}(${i})`}const q2={"bpmn:StartEvent":"시작 이벤트","bpmn:EndEvent":"종료 이벤트","bpmn:IntermediateCatchEvent":"중간 이벤트","bpmn:IntermediateThrowEvent":"중간 이벤트","bpmn:BoundaryEvent":"경계 이벤트","bpmn:Task":"작업","bpmn:UserTask":"작업","bpmn:ServiceTask":"작업","bpmn:SendTask":"작업","bpmn:ReceiveTask":"작업","bpmn:ManualTask":"작업","bpmn:ScriptTask":"작업","bpmn:BusinessRuleTask":"작업","bpmn:CallActivity":"작업","bpmn:SubProcess":"서브프로세스","bpmn:ExclusiveGateway":"게이트웨이","bpmn:ParallelGateway":"게이트웨이","bpmn:InclusiveGateway":"게이트웨이","bpmn:EventBasedGateway":"게이트웨이","bpmn:ComplexGateway":"게이트웨이","bpmn:Participant":"풀","bpmn:Lane":"레인","bpmn:TextAnnotation":"주석","bpmn:Group":"그룹","bpmn:DataStoreReference":"데이터 저장소","bpmn:DataObjectReference":"데이터 객체","bpmn:SequenceFlow":"연결선","bpmn:MessageFlow":"메시지 연결선","bpmn:Association":"연관선"},K2="요소";function Df(e){return(e&&q2[e.type])??K2}const bb=20;function X2(e){const t=e.replace(/\s+/g," ").trim();return t.length>bb?`${t.slice(0,bb)}…`:t}function Qc(e,t,n,i=""){const r=e(t),o=(r==null?void 0:r.name)===void 0?void 0:X2(r.name),a=o===void 0?i+Df(r):o,s=o===void 0?a:`「${o}」`;return n?s+Y2(a,n).slice(a.length):s}function Z2(e,t,n,i,r){const[o,a]=[e(t),e(n)],s=(o==null?void 0:o.name)===void 0&&(a==null?void 0:a.name)===void 0&&Df(o)===Df(a);return[Qc(e,t,i),Qc(e,n,r,s?"다른 ":"")]}function Q2(e){switch(e.kind){case"shape-overlap":return e.identical?"error":"warning";case"shape-outside-container":return"error";case"edge-endpoint-detached":return"error";case"pool-overlap":return e.contained?"error":"warning";case"group-cuts-shape":return"error";default:return"warning"}}function J2(e){switch(e.kind){case"edge-crosses-shape":return[e.edge,e.shape];case"edge-crosses-subprocess":return[e.edge,e.subProcess];case"edge-endpoint-detached":return[e.edge,e.shape];case"shape-overlap":return[...e.shapes];case"shape-outside-container":return[e.shape,e.container];case"edge-overlap-opposite":case"edge-overlap-mixed":case"edge-overlap-unrelated":return[...e.edges];case"label-on-shared-segment":return[e.edge,e.other];case"label-over-line":return[e.edge,e.line];case"annotation-over-label":return[e.annotation,e.label];case"group-overlap-unintended":return e.container?[e.container,...e.groups.filter(t=>t!==e.container)]:[...e.groups];case"group-overlap-unreadable":return e.reason==="orphan"?[...e.groups,...e.shapes]:[e.group,...e.shapes];case"group-stack-unreadable":return[...e.groups,...e.shapes];case"group-on-container-boundary":return[e.group,e.container];case"group-on-group-boundary":return[...e.groups];case"group-cuts-shape":return[e.group,e.shape];case"pool-name-over-label":return[e.pool,e.label];case"pool-overlap":return[...e.pools]}}const xb={top:"위",bottom:"아래",left:"왼쪽",right:"오른쪽"};function ek(e,t){const n=(r,o)=>Qc(t,r,o),i=(r,o,a,s)=>Z2(t,r,o,a,s);switch(e.kind){case"edge-crosses-shape":return`${n(e.edge,"이")} ${n(e.shape,"을")} 가로지릅니다.`;case"edge-crosses-subprocess":return`${n(e.edge,"이")} 서브프로세스 ${n(e.subProcess)} 안을 지나갑니다.`;case"edge-endpoint-detached":return`${n(e.edge)}의 끝이 ${n(e.shape)}에서 ${Math.round(e.distance)}px 떨어져 연결이 끊겨 보입니다.`;case"shape-overlap":{const[r,o]=i(e.shapes[0],e.shapes[1],"와","이");return e.identical?`${r} ${o} 완전히 같은 자리에 겹쳐 하나가 가려집니다.`:`${r} ${o} 겹칩니다.`}case"shape-outside-container":return`${n(e.shape,"이")} ${n(e.container)} 경계 밖에 놓여 다른 소속으로 읽힙니다.`;case"edge-overlap-opposite":{const[r,o]=i(e.edges[0],e.edges[1],"와","이");return`${r} ${o} 같은 선 위를 ${Math.round(e.length)}px 서로 반대 방향으로 흐릅니다.`}case"edge-overlap-mixed":{const[r,o]=i(e.edges[0],e.edges[1],"와","이");return`${r} ${o} 종류가 다른 선인데 ${Math.round(e.length)}px 겹쳐 흐릅니다.`}case"edge-overlap-unrelated":{const[r,o]=i(e.edges[0],e.edges[1],"와","이");return`${r} ${o} ${Math.round(e.length)}px 한 선처럼 겹쳐 흐르는데 만나는 지점이 없습니다.`}case"label-on-shared-segment":{const[r,o]=i(e.edge,e.other,void 0,"와");return`${r}의 라벨이 ${o} 공유하는 구간 위에 있어 어느 선의 것인지 모호합니다.`}case"label-over-line":return`${n(e.edge)}의 라벨을 선이 가로지릅니다.`;case"annotation-over-label":return`주석 ${n(e.annotation,"이")} ${n(e.label)}의 이름 라벨을 덮습니다.`;case"group-overlap-unintended":{if(e.container)return`${n(e.container,"이")} 다른 그룹을 통째로 덮습니다.`;const[r,o]=i(e.groups[0],e.groups[1],"와","이");return`${r} ${o} 공유 멤버 없이 겹쳐 의도인지 알 수 없습니다.`}case"group-overlap-unreadable":switch(e.reason){case"orphan":{const[r,o]=i(e.groups[0],e.groups[1],"와");return`${r} ${o}의 겹친 영역에 어느 그룹에도 속하지 않은 요소가 ${e.shapes.length}개 있습니다.`}case"minority":return`${n(e.group)} 상자 안에서 자기 멤버가 과반이 아닙니다(다른 요소 ${e.shapes.length}개).`;case"throughpass":return`${n(e.group)} 상자를 자기 멤버가 아닌 요소 ${e.shapes.length}개가 지나갑니다.`}case"group-stack-unreadable":return`그룹 ${e.groups.length}개가 겹쳐 쌓여 요소 ${e.shapes.length}개가 어느 단계인지 읽히지 않습니다.`;case"group-on-container-boundary":return`${n(e.group)} 테두리가 ${n(e.container)}의 ${xb[e.side]} 경계선과 겹쳐 흐릅니다.`;case"group-on-group-boundary":{const[r,o]=i(e.groups[0],e.groups[1],"와");return`${r} ${o}의 테두리가 같은 선 위에 겹칩니다.`}case"group-cuts-shape":return`${n(e.group)} 테두리가 ${n(e.shape)}의 ${xb[e.side]}을(를) ${Math.round(e.depth)}px 가릅니다.`;case"pool-name-over-label":return`${n(e.pool)}의 이름 밴드가 ${n(e.label)}의 라벨을 덮습니다.`;case"pool-overlap":{const[r,o]=i(e.pools[0],e.pools[1],"와","이");return e.contained?`${r} ${o} 중 하나가 다른 하나 안에 들어가 있습니다.`:`${r} ${o} 겹칩니다.`}}}function tk(e,t){switch(e.ruleId){case"CHK-FLOW-1":return`${Qc(t,e.targetRefs[0])}에 연결된 선이 하나도 없습니다 — 분기·합류가 없는 게이트웨이는 의미가 정해지지 않습니다.`;case"CHK-POOL-1":return`이 문서에 내용이 없는 풀 ${e.targetRefs.length}개가 펼친 형태로 그려져 있습니다 — 이 문서에서 내용을 그리지 않는 풀은 접힌 형태(블랙박스)가 의미에 맞습니다.`;default:return e.ruleId}}const _b="기타",If={error:0,warning:1,info:2};function wb(e,t){const n=[];for(const i of e.geometry)n.push({key:`g:${Rt(i)}`,source:"geometry",code:i.kind,severity:Q2(i),targetRefs:J2(i),category:vb[i.kind]??_b,message:ek(i,t)});for(const i of e.semantic)n.push({key:`s:${i.ruleId}|${i.targetRefs.join(",")}`,source:"semantic",code:i.ruleId,severity:i.severity,targetRefs:[...i.targetRefs],category:vb[i.ruleId]??_b,message:tk(i,t)});return n}function Eb(e){const t={error:0,warning:0,info:0};for(const n of e)t[n.severity]++;return t}function jo(e,t){return t!==void 0&&e.targetRefs.some(n=>t.has(n))}function Lf(e,t){if(t===void 0||e.length===0)return!1;const n=jo(e[0],t);return e.some(i=>jo(i,t)!==n)}function Sb(e,t){const n=Lf(e,t);return e.slice().sort((i,r)=>(n?Number(jo(r,t))-Number(jo(i,t)):0)||If[i.severity]-If[r.severity])}var nk=new Bo("ov"),ik=500;function on(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=nk,this._overlayDefaults=W({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=rk(n.getContainer()),this._init()}on.$inject=["config.overlays","eventBus","canvas","elementRegistry"],on.prototype.get=function(e){if(Pn(e)&&(e={id:e}),Pn(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?Ke(t.overlays,ao({type:e.type})):t.overlays.slice():[]}else return e.type?Ke(this._overlays,ao({type:e.type})):e.id?this._overlays[e.id]:null},on.prototype.add=function(e,t,n){if(Qt(t)&&(n=t,t=null),e.id||(e=this._elementRegistry.get(e)),!n.position)throw new Error("must specifiy overlay position");if(!n.html)throw new Error("must specifiy overlay html");if(!e)throw new Error("invalid element specified");var i=this._ids.next();return n=W({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},on.prototype.remove=function(e){var t=this.get(e)||[];Be(t)||(t=[t]);var n=this;F(t,function(i){var r=n._getOverlayContainer(i.element,!0);if(i&&(vi(i.html),vi(i.htmlContainer),delete i.htmlContainer,delete i.element,delete n._overlays[i.id]),r){var o=r.overlays.indexOf(i);o!==-1&&r.overlays.splice(o,1)}})},on.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},on.prototype.show=function(){Jc(this._overlayRoot)},on.prototype.hide=function(){Jc(this._overlayRoot,!1)},on.prototype.clear=function(){this._overlays={},this._overlayContainers=[],Ls(this._overlayRoot)},on.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=Ft(t);i=o.x,r=o.y}Rb(n,i,r),gn(e.html,"data-container-id",t.id)},on.prototype._updateOverlay=function(e){var t=e.position,n=e.htmlContainer,i=e.element,r=t.left,o=t.top;if(t.right!==void 0){var a;i.waypoints?a=Ft(i).width:a=i.width,r=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=Ft(i).height:s=i.height,o=t.bottom*-1+s}Rb(n,r||0,o||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},on.prototype._createOverlayContainer=function(e){var t=wt('<div class="djs-overlays" />');wn(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},on.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";Cb(this._overlayRoot,n)},on.prototype._getOverlayContainer=function(e,t){var n=vt(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},on.prototype._addOverlay=function(e){var t=e.id,n=e.element,i=e.html,r,o;i.get&&i.constructor.prototype.jquery&&(i=i.get(0)),Pn(i)&&(i=wt(i)),o=this._getOverlayContainer(n),r=wt('<div class="djs-overlay" data-overlay-id="'+t+'">'),wn(r,{position:"absolute"}),r.appendChild(i),e.type&&Ct(r).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();Jc(r,a===s),e.htmlContainer=r,o.overlays.push(e),o.html.appendChild(r),this._overlays[t]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},on.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,i=this._canvas.findRoot(e.element),r=n&&n.minZoom,o=n&&n.maxZoom,a=e.htmlContainer,s=this._canvas.getRootElement(),c=!0;(i!==s||n&&(Yt(r)&&r>t.scale||Yt(o)&&o<t.scale))&&(c=!1),Jc(a,c),this._updateOverlayScale(e,t)},on.prototype._updateOverlayScale=function(e,t){var n=e.scale,i,r,o=e.htmlContainer,a,s="";n!==!0&&(n===!1?(i=1,r=1):(i=n.min,r=n.max),Yt(i)&&t.scale<i&&(a=(1/t.scale||1)*i),Yt(r)&&t.scale>r&&(a=(1/t.scale||1)*r)),Yt(a)&&(s="scale("+a+","+a+")"),Cb(o,s)},on.prototype._updateOverlaysVisibilty=function(e){var t=this;F(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},on.prototype._init=function(){var e=this._eventBus,t=this;function n(i){t._updateRoot(i),t._updateOverlaysVisibilty(i),t.show()}e.on("canvas.viewbox.changing",function(i){t.hide()}),e.on("canvas.viewbox.changed",function(i){n(i.viewbox)}),e.on(["shape.remove","connection.remove"],function(i){var r=i.element,o=t.get({element:r});F(o,function(c){t.remove(c.id)});var a=t._getOverlayContainer(r);if(a){vi(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",ik,function(i){var r=i.element,o=t._getOverlayContainer(r,!0);o&&(F(o.overlays,function(a){t._updateOverlay(a)}),t._updateOverlayContainer(o))}),e.on("element.marker.update",function(i){var r=t._getOverlayContainer(i.element,!0);r&&Ct(r.html)[i.add?"add":"remove"](i.marker)}),e.on("root.set",function(){t._updateOverlaysVisibilty(t._canvas.viewbox())}),e.on("diagram.clear",this.clear,this)};function rk(e){var t=wt('<div class="djs-overlay-container" />');return wn(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function Rb(e,t,n){wn(e,{left:t+"px",top:n+"px"})}function Jc(e,t){e.style.display=t===!1?"none":""}function Cb(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const el={__init__:["overlays"],overlays:["type",on]};function Bf(e,t){t.invoke(te,this),this.executed(function(n){var i=n.context;i.rootElement?e.setRootElement(i.rootElement):i.rootElement=e.getRootElement()}),this.revert(function(n){var i=n.context;i.rootElement&&e.setRootElement(i.rootElement)})}Ee(Bf,te),Bf.$inject=["canvas","injector"];const ok={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",Bf]};function Wa(e){return CSS.escape(e)}var ak={"&":"&","<":"<",">":">",'"':""","'":"'"};function Ab(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return ak[t]})}var sk="bjs-breadcrumbs-shown";function Pb(e,t,n){var i=wt('<ul class="bjs-breadcrumbs"></ul>'),r=n.getContainer(),o=Ct(r);r.appendChild(i);var a=[];e.on("element.changed",function(c){var l=c.element,u=ie(l),f=vt(a,function(p){return p===u});f&&s()});function s(c){c&&(a=ck(c));var l=a.flatMap(function(f){var p=n.findRoot(Ei(f))||n.findRoot(f.id);if(!p&&S(f,"bpmn:Process")){var d=t.find(function(y){var v=ie(y);return v&&v.get("processRef")===f});p=d&&n.findRoot(d.id)}if(!p)return[];var m=Ab(f.name||f.id),h=wt('<li><span class="bjs-crumb"><a title="'+m+'">'+m+"</a></span></li>");return h.addEventListener("click",function(){n.setRootElement(p)}),h});i.innerHTML="";var u=l.length>1;o.toggle(sk,u),l.forEach(function(f){i.appendChild(f)})}e.on("root.set",function(c){s(c.element)})}Pb.$inject=["eventBus","elementRegistry","canvas"];function ck(e){for(var t=ie(e),n=[],i=t;i;i=i.$parent)(S(i,"bpmn:SubProcess")||S(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function Mb(e,t){var n=null,i=new lk;e.on("root.set",function(r){var o=r.element,a=t.viewbox(),s=i.get(o);if(i.set(n,{x:a.x,y:a.y,zoom:a.scale}),n=o,!(!S(o,"bpmn:SubProcess")&&!s)){s=s||{x:0,y:0,zoom:1};var c=(a.x-s.x)*a.scale,l=(a.y-s.y)*a.scale;(c!==0||l!==0)&&t.scroll({dx:c,dy:l}),s.zoom!==a.scale&&t.zoom(s.zoom,{x:0,y:0})}}),e.on("diagram.clear",function(){i.clear(),n=null})}Mb.$inject=["eventBus","canvas"];function lk(){this._entries=[],this.set=function(e,t){var n=!1;for(var i in this._entries)if(this._entries[i][0]===e){this._entries[i][1]=t,n=!0;break}n||this._entries.push([e,t])},this.get=function(e){for(var t in this._entries)if(this._entries[t][0]===e)return this._entries[t][1];return null},this.clear=function(){this._entries.length=0},this.remove=function(e){var t=-1;for(var n in this._entries)if(this._entries[n][0]===e){t=n;break}t!==-1&&this._entries.splice(t,1)}}var Tb={x:180,y:160};function Yr(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,r){n._handleImport(r.definitions)})}Yr.prototype._handleImport=function(e){if(e.diagrams){var t=this;this._definitions=e,this._processToDiagramMap={},e.diagrams.forEach(function(i){!i.plane||!i.plane.bpmnElement||(t._processToDiagramMap[i.plane.bpmnElement.id]=i)});var n=e.diagrams.filter(i=>i.plane).flatMap(i=>t._createNewDiagrams(i.plane));n.forEach(function(i){t._movePlaneElementsToOrigin(i.plane)})}},Yr.prototype._createNewDiagrams=function(e){var t=this,n=[],i=[];e.get("planeElement").forEach(function(o){var a=o.bpmnElement;if(a){var s=a.$parent;S(a,"bpmn:SubProcess")&&!o.isExpanded&&n.push(a),pk(a,e)&&i.push({diElement:o,parent:s})}});var r=[];return n.forEach(function(o){if(!t._processToDiagramMap[o.id]){var a=t._createDiagram(o);t._processToDiagramMap[o.id]=a,r.push(a)}}),i.forEach(function(o){for(var a=o.diElement,s=o.parent;s&&n.indexOf(s)===-1;)s=s.$parent;if(s){var c=t._processToDiagramMap[s.id];t._moveToDiPlane(a,c.plane)}}),r},Yr.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=uk(e),i={x:n.x-Tb.x,y:n.y-Tb.y};t.forEach(function(r){r.waypoint?r.waypoint.forEach(function(o){o.x=o.x-i.x,o.y=o.y-i.y}):r.bounds&&(r.bounds.x=r.bounds.x-i.x,r.bounds.y=r.bounds.y-i.y)})},Yr.prototype._moveToDiPlane=function(e,t){var n=kb(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},Yr.prototype._createDiagram=function(e){var t=this._moddle.create("bpmndi:BPMNPlane",{bpmnElement:e}),n=this._moddle.create("bpmndi:BPMNDiagram",{plane:t});return t.$parent=n,t.bpmnElement=e,n.$parent=this._definitions,this._definitions.diagrams.push(n),n},Yr.$inject=["eventBus","moddle"];function kb(e){return S(e,"bpmndi:BPMNDiagram")?e:kb(e.$parent)}function uk(e){var t={top:1/0,right:-1/0,bottom:-1/0,left:1/0};return e.planeElement.forEach(function(n){if(n.bounds){var i=Ie(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),Vs(t)}function pk(e,t){var n=e.$parent;return!(!S(n,"bpmn:SubProcess")||n===t.bpmnElement||qe(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var tl=250,fk='<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M4.81801948,3.50735931 L10.4996894,9.1896894 L10.5,4 L12,4 L12,12 L4,12 L4,10.5 L9.6896894,10.4996894 L3.75735931,4.56801948 C3.46446609,4.27512627 3.46446609,3.80025253 3.75735931,3.50735931 C4.05025253,3.21446609 4.52512627,3.21446609 4.81801948,3.50735931 Z"/></svg>',dk="bjs-drilldown-empty";function br(e,t,n,i,r){te.call(this,t),this._canvas=e,this._eventBus=t,this._elementRegistry=n,this._overlays=i,this._translate=r;var o=this;this.executed("shape.toggleCollapse",tl,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",tl,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],tl,function(a){var s=a.oldParent,c=a.newParent||a.parent,l=a.shape;o._canDrillDown(l)&&o._addOverlay(l),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(l)},!0),this.reverted(["shape.create","shape.move","shape.delete"],tl,function(a){var s=a.oldParent,c=a.newParent||a.parent,l=a.shape;o._canDrillDown(l)&&o._addOverlay(l),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(l)},!0),t.on("import.render.complete",function(){n.filter(function(a){return o._canDrillDown(a)}).map(function(a){o._addOverlay(a)})})}Ee(br,te),br.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},br.prototype._canDrillDown=function(e){var t=this._canvas;return S(e,"bpmn:SubProcess")&&t.findRoot(Ei(e))},br.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=ie(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var r=n&&n.get("flowElements")&&n.get("flowElements").length;Ct(i.html).toggle(dk,!r)}},br.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=ie(e),r=n.get({element:e,type:"drilldown"});r.length&&this._removeOverlay(e);var o=wt('<button type="button" class="bjs-drilldown">'+fk+"</button>"),a=i.get("name")||i.get("id"),s=this._translate("Open {element}",{element:a});o.setAttribute("title",s),o.addEventListener("click",function(){t.setRootElement(t.findRoot(Ei(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:o}),this._updateOverlayVisibility(e)},br.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},br.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const hk={__depends__:[el,ff,ok],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",Pb],drilldownCentering:["type",Mb],drilldownOverlayBehavior:["type",br],subprocessCompatibility:["type",Yr]};function xr(e){Pt.call(this,e)}Ee(xr,Pt),xr.prototype._modules=[mg,hk,el,ni,ba],xr.prototype._moddleExtensions={};var nl="keyboard.keydown",mk="keyboard.keyup",gk=1e3,Ob="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 En(e,t){var n=this;this._config=e=e||{},this._eventBus=t,this._keydownHandler=this._keydownHandler.bind(this),this._keyupHandler=this._keyupHandler.bind(this),t.on("diagram.destroy",function(){n._fire("destroy"),n.unbind()}),e.bindTo&&console.error("unsupported configuration <keyboard.bindTo>",new Error(Ob));var i=e&&e.bind!==!1;t.on("canvas.init",function(r){n._target=r.svg,i&&n.bind(),n._fire("init")})}En.$inject=["config.keyboard","eventBus"],En.prototype._keydownHandler=function(e){this._keyHandler(e,nl)},En.prototype._keyupHandler=function(e){this._keyHandler(e,mk)},En.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||nl,i),n&&e.preventDefault()}},En.prototype._isEventIgnored=function(e){return!1},En.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(Ob)),this.unbind(),e=this._node=this._target,je.bind(e,"keydown",this._keydownHandler),je.bind(e,"keyup",this._keyupHandler),this._fire("bind")},En.prototype.getBinding=function(){return this._node},En.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),je.unbind(e,"keydown",this._keydownHandler),je.unbind(e,"keyup",this._keyupHandler)),this._node=null},En.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},En.prototype.addListener=function(e,t,n){Jt(e)&&(n=t,t=e,e=gk),this._eventBus.on(n||nl,e,t)},En.prototype.removeListener=function(e,t){this._eventBus.off(t||nl,e)},En.prototype.hasModifier=AM,En.prototype.isCmd=Ln,En.prototype.isShift=ef,En.prototype.isKey=Xt;var yk=500;function Ho(e,t){var n=this;e.on("editorActions.init",yk,function(i){var r=i.editorActions;n.registerBindings(t,r)})}Ho.$inject=["eventBus","keyboard"],Ho.prototype.registerBindings=function(e,t){function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("undo",function(i){var r=i.keyEvent;if(OM(r))return t.trigger("undo"),!0}),n("redo",function(i){var r=i.keyEvent;if(DM(r))return t.trigger("redo"),!0}),n("copy",function(i){var r=i.keyEvent;if(PM(r))return t.trigger("copy"),!0}),n("paste",function(i){var r=i.keyEvent;if(MM(r))return t.trigger("paste"),!0}),n("duplicate",function(i){var r=i.keyEvent;if(TM(r))return t.trigger("duplicate"),!0}),n("cut",function(i){var r=i.keyEvent;if(kM(r))return t.trigger("cut"),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(Xt(["+","Add","="],r)&&Ln(r))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(Xt(["-","Subtract"],r)&&Ln(r))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var r=i.keyEvent;if(Xt("0",r)&&Ln(r))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var r=i.keyEvent;if(Xt(["Backspace","Delete","Del"],r))return t.trigger("removeSelection"),!0})};const Nf={__init__:["keyboard","keyboardBindings"],keyboard:["type",En],keyboardBindings:["type",Ho]};var vk={moveSpeed:50,moveSpeedAccelerated:200};function Db(e,t,n){var i=this;this._config=W({},vk,e||{}),t.addListener(r);function r(o){var a=o.keyEvent,s=i._config;if(t.isCmd(a)&&t.isKey(["ArrowLeft","Left","ArrowUp","Up","ArrowDown","Down","ArrowRight","Right"],a)){var c=t.isShift(a)?s.moveSpeedAccelerated:s.moveSpeed,l;switch(a.key){case"ArrowLeft":case"Left":l="left";break;case"ArrowUp":case"Up":l="up";break;case"ArrowRight":case"Right":l="right";break;case"ArrowDown":case"Down":l="down";break}return i.moveCanvas({speed:c,direction:l}),!0}}this.moveCanvas=function(o){var a=0,s=0,c=o.speed,l=c/Math.min(Math.sqrt(n.viewbox().scale),1);switch(o.direction){case"left":a=l;break;case"up":s=l;break;case"right":a=-l;break;case"down":s=-l;break}n.scroll({dx:a,dy:s})}}Db.$inject=["config.keyboardMove","keyboard","canvas"];const Ib={__depends__:[Nf],__init__:["keyboardMove"],keyboardMove:["type",Db]};var bk=15;function Lb(e,t){var n;function i(s){return a(s.originalEvent)}e.on("canvas.focus.changed",function(s){s.focused?e.on("element.mousedown",500,i):e.off("element.mousedown",i)});function r(s){var c=n.start,l=n.button,u=Hr(s),f=pi(u,c);if(!n.dragging&&xk(f)>bk&&(n.dragging=!0,l===0&&tv(e),Pc("grab")),n.dragging){var p=n.last||n.start;f=pi(u,p),t.scroll({dx:f.x,dy:f.y}),n.last=u}s.preventDefault()}function o(s){je.unbind(document,"mousemove",r),je.unbind(document,"mouseup",o),n=null,ev()}function a(s){if(!Lr(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:Hr(s)},je.bind(document,"mousemove",r),je.bind(document,"mouseup",o),!0}}this.isActive=function(){return!!n}}Lb.$inject=["eventBus","canvas"];function xk(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const Bb={__init__:["moveCanvas"],moveCanvas:["type",Lb]};function Nb(e,t){var n=Zu(e.min),i=Zu(e.max),r=Math.abs(n)+Math.abs(i);return r/t}function _k(e,t){return Math.max(e.min,Math.min(e.max,t))}var wk=Math.sign||function(e){return e>=0?1:-1},$f={min:.2,max:4},$b=10,Ek=.1,Sk=.75;function Ci(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=Rn(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||Sk;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}Ci.$inject=["config.zoomScroll","eventBus","canvas"],Ci.prototype.scroll=function(t){this._canvas.scroll(t)},Ci.prototype.reset=function(){this._canvas.zoom("fit-viewport")},Ci.prototype.zoom=function(t,n){var i=Nb($f,$b*2);this._totalDelta+=t,Math.abs(this._totalDelta)>Ek&&(this._zoom(t,n,i),this._totalDelta=0)},Ci.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||cy()&&t.metaKey,r=t.shiftKey,o=-1*this._scale,a;if(i?o*=t.deltaMode===0?.02:.32:o*=t.deltaMode===0?1:16,i){var s=n.getBoundingClientRect(),c={x:t.clientX-s.left,y:t.clientY-s.top};a=Math.sqrt(Math.pow(t.deltaY,2)+Math.pow(t.deltaX,2))*wk(t.deltaY)*o,this.zoom(a,c)}else r?a={dx:o*t.deltaY,dy:0}:a={dx:o*t.deltaX,dy:o*t.deltaY},this.scroll(a)}},Ci.prototype.stepZoom=function(t,n){var i=Nb($f,$b);this._zoom(t,n,i)},Ci.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=Zu(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(_k($f,s),t)},Ci.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,r=this._enabled;return typeof t>"u"&&(t=!r),r!==t&&je[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},Ci.prototype._init=function(e){this.toggle(e)};const Fb={__init__:["zoomScroll"],zoomScroll:["type",Ci]};function Ua(e){xr.call(this,e)}Ee(Ua,xr),Ua.prototype._navigationModules=[Ib,Bb,Fb],Ua.prototype._modules=[].concat(xr.prototype._modules,Ua.prototype._navigationModules);function Ff(e){return e&&e[e.length-1]}function jb(e){return e.y}function Hb(e){return e.x}var Rk={left:Hb,center:Hb,right:function(e){return e.x+e.width},top:jb,middle:jb,bottom:function(e){return e.y+e.height}};function zo(e,t){this._modeling=e,this._rules=t}zo.$inject=["modeling","rules"],zo.prototype._getOrientationDetails=function(e){var t=["top","bottom","middle"],n="x",i="width";return t.indexOf(e)!==-1&&(n="y",i="height"),{axis:n,dimension:i}},zo.prototype._isType=function(e,t){return t.indexOf(e)!==-1},zo.prototype._alignmentPosition=function(e,t){var n=this._getOrientationDetails(e),i=n.axis,r=n.dimension,o={},a={},s=!1,c,l,u;function f(p,d){return Math.round((p[i]+d[i]+d[r])/2)}if(this._isType(e,["left","top"]))o[e]=t[0][i];else if(this._isType(e,["right","bottom"]))u=Ff(t),o[e]=u[i]+u[r];else if(this._isType(e,["center","middle"])){if(F(t,function(p){var d=p[i]+Math.round(p[r]/2);a[d]?a[d].elements.push(p):a[d]={elements:[p],center:d}}),c=di(a,function(p){return p.elements.length>1&&(s=!0),p.elements.length}),s)return o[e]=Ff(c).center,o;l=t[0],t=di(t,function(p){return p[i]+p[r]}),u=Ff(t),o[e]=f(l,u)}return o},zo.prototype.trigger=function(e,t){var n=this._modeling,i,r=Ke(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:r}),Be(i)&&(r=i),!(r.length<2||!i)){var o=Rk[t],a=di(r,o),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const Ck={__init__:["alignElements"],alignElements:["type",zo]},Ak=new Bo;function Go(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}Go.$inject=["eventBus"],Go.prototype.schedule=function(e,t=Ak.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},Go.prototype._schedule=function(e,t){const n=Pk();return{executionId:setTimeout(()=>{try{this._scheduled[t]=null;try{n.resolve(e())}catch(r){n.reject(r)}}catch(r){console.error("Scheduler#_schedule execution failed",r)}}),promise:n.promise}},Go.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},Go.prototype._cancel=function(e){clearTimeout(e.executionId)};function Pk(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const Mk={scheduler:["type",Go]};var Tk="djs-element-hidden",il=".entry",kk=1e3,zb=8,Ok=300;function Ht(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}Ht.$inject=["canvas","elementRegistry","eventBus","scheduler"],Ht.prototype._init=function(){var e=this;this._eventBus.on("selection.changed",function(t){var n=t.newSelection,i=n.length?n.length===1?n[0]:n:null;i?e.open(i,!0):e.close()}),this._eventBus.on("elements.changed",function(t){var n=t.elements,i=e._current;if(i){var r=i.target,o=Be(r)?r:[r],a=o.filter(function(c){return n.includes(c)});if(a.length){e.close();var s=o.filter(function(c){return e._elementRegistry.get(c.id)});s.length&&e._updateAndOpen(s.length>1?s:s[0])}}}),this._eventBus.on("canvas.viewbox.changed",function(){e._updatePosition()}),this._eventBus.on("element.marker.update",function(t){if(e.isOpen()){var n=t.element,i=e._current,r=Be(i.target)?i.target:[i.target];r.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},Ht.prototype._createContainer=function(){var e=wt('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},Ht.prototype.registerProvider=function(e,t){t||(t=e,e=kk),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},Ht.prototype.getEntries=function(e){var t=this._getProviders(),n=Be(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return F(t,function(r){if(Jt(r[n])){var o=r[n](e);Jt(o)?i=o(i):F(o,function(a,s){i[s]=a})}}),i},Ht.prototype.trigger=function(e,t,n){var i=this,r,o,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(r=gn(a,"data-action"),o=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(r,"hover",o,n)},Ok);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(r,e,o,n)},Ht.prototype.triggerEntry=function(e,t,n,i){if(this.isShown()){var r=this._current.target,o=this._current.entries,a=o[e];if(a){var s=a.action;if(this._eventBus.fire("contextPad.trigger",{entry:a,event:n})!==!1){if(Jt(s)){if(t==="click")return s(n,r,i)}else if(s[t])return s[t](n,r,i);n.preventDefault()}}}},Ht.prototype.open=function(e,t){if(!(!t&&this.isOpen(e))){var n=this._eventBus.fire("contextPad.open.allowed",{target:e});n!==!1&&(this.close(),this._updateAndOpen(e))}},Ht.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Ht.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),i;F(t,function(r,o){var a=r.group||"default",s=wt(r.html||'<div class="entry" draggable="true"></div>'),c;gn(s,"data-action",o),c=ft("[data-group="+Wa(a)+"]",n),c||(c=wt('<div class="group"></div>'),gn(c,"data-group",a),n.appendChild(c)),c.appendChild(s),r.className&&Dk(s,r.className),r.title&&gn(s,"title",r.title),r.imageUrl&&(i=wt("<img>"),gn(i,"src",r.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),Ct(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},Ht.prototype._createHtml=function(e){var t=this,n=wt('<div class="djs-context-pad"></div>');return On.bind(n,il,"click",function(i){t.trigger("click",i)}),On.bind(n,il,"dragstart",function(i){t.trigger("dragstart",i)}),On.bind(n,il,"mouseover",function(i){t.trigger("mouseover",i)}),On.bind(n,il,"mouseout",function(i){t.trigger("mouseout",i)}),je.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},Ht.prototype.getPad=function(e){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 t;return this.isOpen()&&Lk(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},Ht.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},Ht.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return Be(e)!==Be(n)?!1:Be(e)?e.length===n.length&&kr(e,function(i){return n.includes(i)}):n===e},Ht.prototype.isShown=function(){return this.isOpen()&&Ct(this._current.html).has("open")},Ht.prototype.show=function(){this.isOpen()&&(Ct(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},Ht.prototype.hide=function(){this.isOpen()&&(Ct(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},Ht.prototype._getPosition=function(e){if(!Be(e)&&ht(e)){var t=this._canvas.viewbox(),n=Ik(e),i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale;return{left:i+zb*this._canvas.zoom(),top:r}}var o=this._canvas.getContainer(),a=o.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+zb*this._canvas.zoom(),top:s.top-a.top}},Ht.prototype._updatePosition=function(){const e=()=>{if(this.isOpen()){var t=this._current.html,n=this._getPosition(this._current.target);"x"in n&&"y"in n?(t.style.left=n.x+"px",t.style.top=n.y+"px"):["top","right","bottom","left"].forEach(function(i){i in n&&(t.style[i]=n[i]+"px")})}};this._scheduler.schedule(e,"ContextPad#_updatePosition")},Ht.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=Be(n)?n:[n],r=i.some(function(o){return t._canvas.hasMarker(o,Tk)});r?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},Ht.prototype._getTargetBounds=function(e){var t=this,n=Be(e)?e:[e],i=n.map(function(r){return t._canvas.getGraphics(r)});return i.reduce(function(r,o){const a=o.getBoundingClientRect();return r.top=Math.min(r.top,a.top),r.right=Math.max(r.right,a.right),r.bottom=Math.max(r.bottom,a.bottom),r.left=Math.min(r.left,a.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 Dk(e,t){var n=Ct(e);t=Be(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function Ik(e){return e.waypoints[e.waypoints.length-1]}function Lk(e,t){return e=Be(e)?e:[e],t=Be(t)?t:[t],e.length===t.length&&kr(e,function(n){return t.includes(n)})}const Gb={__depends__:[Ac,Mk,el],contextPad:["type",Ht]};var rl,Tt,Vb,_r,Wb,Ub,Yb,jf,ol,Ya,qb,Hf,zf,Gf,al={},sl=[],Bk=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,cl=Array.isArray;function Wi(e,t){for(var n in t)e[n]=t[n];return e}function Vf(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Kb(e,t,n){var i,r,o,a={};for(o in t)o=="key"?i=t[o]:o=="ref"?r=t[o]:a[o]=t[o];if(arguments.length>2&&(a.children=arguments.length>3?rl.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(o in e.defaultProps)a[o]===void 0&&(a[o]=e.defaultProps[o]);return ll(e,a,i,r,null)}function ll(e,t,n,i,r){var o={type:e,props:t,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r??++Vb,__i:-1,__u:0};return r==null&&Tt.vnode!=null&&Tt.vnode(o),o}function ul(e){return e.children}function pl(e,t){this.props=e,this.context=t}function qr(e,t){if(t==null)return e.__?qr(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?qr(e):null}function Nk(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],r=[],o=Wi({},t);o.__v=t.__v+1,Tt.vnode&&Tt.vnode(o),Wf(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??qr(t),!!(32&t.__u),r),o.__v=t.__v,o.__.__k[o.__i]=o,ix(i,o,r),t.__e=t.__=null,o.__e!=n&&Xb(o)}}function Xb(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),Xb(e)}function Zb(e){(!e.__d&&(e.__d=!0)&&_r.push(e)&&!fl.__r++||Wb!=Tt.debounceRendering)&&((Wb=Tt.debounceRendering)||Ub)(fl)}function fl(){try{for(var e,t=1;_r.length;)_r.length>t&&_r.sort(Yb),e=_r.shift(),t=_r.length,Nk(e)}finally{_r.length=fl.__r=0}}function Qb(e,t,n,i,r,o,a,s,c,l,u){var f,p,d,m,h,y,v=i&&i.__k||sl,g=t.length;for(c=$k(n,t,v,c,g),f=0;f<g;f++)(d=n.__k[f])!=null&&(p=d.__i!=-1&&v[d.__i]||al,d.__i=f,y=Wf(e,d,p,r,o,a,s,c,l,u),m=d.__e,d.ref&&p.ref!=d.ref&&(p.ref&&Uf(p.ref,null,d),u.push(d.ref,d.__c||m,d)),h==null&&m!=null&&(h=m),4&d.__u?(c=Jb(d,c,e),p.__e&&(p.__e=null)):typeof d.type=="function"&&y!==void 0?c=y:m&&(c=m.nextSibling),d.__u&=-7);return n.__e=h,c}function $k(e,t,n,i,r){var o,a,s,c,l,u=n.length,f=u,p=0;for(e.__k=new Array(r),o=0;o<r;o++)(a=t[o])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?a=e.__k[o]=ll(null,a,null,null,null):cl(a)?a=e.__k[o]=ll(ul,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=ll(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[o]=a,c=o+p,a.__=e,a.__b=e.__b+1,s=null,(l=a.__i=Fk(a,n,c,f))!=-1&&(f--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(r>u?p--:r<u&&p++),typeof a.type!="function"&&(a.__u|=4)):l!=c&&(l==c-1?p--:l==c+1?p++:(l>c?p--:p++,a.__u|=4))):e.__k[o]=null;if(f)for(o=0;o<u;o++)(s=n[o])!=null&&(2&s.__u)==0&&(s.__e==i&&(i=qr(s)),ox(s,s));return i}function Jb(e,t,n){var i,r;if(typeof e.type=="function"){for(i=e.__k,r=0;i&&r<i.length;r++)i[r]&&(i[r].__=e,t=Jb(i[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=qr(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function Fk(e,t,n,i){var r,o,a,s=e.key,c=e.type,l=t[n],u=l!=null&&(2&l.__u)==0;if(l===null&&s==null||u&&s==l.key&&c==l.type)return n;if(i>(u?1:0)){for(r=n-1,o=n+1;r>=0||o<t.length;)if((l=t[a=r>=0?r--:o++])!=null&&(2&l.__u)==0&&s==l.key&&c==l.type)return a}return-1}function ex(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||Bk.test(t)?n:n+"px"}function dl(e,t,n,i,r){var o,a;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof i=="string"&&(e.style.cssText=i=""),i)for(t in i)n&&t in n||ex(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||ex(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(qb,"$1")),a=t.toLowerCase(),t=a in e||t=="onFocusOut"||t=="onFocusIn"?a.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?i?n[Ya]=i[Ya]:(n[Ya]=Hf,e.addEventListener(t,o?Gf:zf,o)):e.removeEventListener(t,o?Gf:zf,o);else{if(r=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function tx(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[ol]==null)t[ol]=Hf++;else if(t[ol]<n[Ya])return;return n(Tt.event?Tt.event(t):t)}}}function Wf(e,t,n,i,r,o,a,s,c,l){var u,f,p,d,m,h,y,v,g,b,x,C,M,k,P,B,D=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[s=t.__e=n.__e]),(u=Tt.__b)&&u(t);e:if(typeof D=="function"){f=a.length;try{if(g=t.props,b=D.prototype&&D.prototype.render,x=(u=D.contextType)&&i[u.__c],C=u?x?x.props.value:u.__:i,n.__c?v=(p=t.__c=n.__c).__=p.__E:(b?t.__c=p=new D(g,C):(t.__c=p=new pl(g,C),p.constructor=D,p.render=Hk),x&&x.sub(p),p.state||(p.state={}),p.__n=i,d=p.__d=!0,p.__h=[],p._sb=[]),b&&p.__s==null&&(p.__s=p.state),b&&D.getDerivedStateFromProps!=null&&(p.__s==p.state&&(p.__s=Wi({},p.__s)),Wi(p.__s,D.getDerivedStateFromProps(g,p.__s))),m=p.props,h=p.state,p.__v=t,d)b&&D.getDerivedStateFromProps==null&&p.componentWillMount!=null&&p.componentWillMount(),b&&p.componentDidMount!=null&&p.__h.push(p.componentDidMount);else{if(b&&D.getDerivedStateFromProps==null&&g!==m&&p.componentWillReceiveProps!=null&&p.componentWillReceiveProps(g,C),t.__v==n.__v||!p.__e&&p.shouldComponentUpdate!=null&&p.shouldComponentUpdate(g,p.__s,C)===!1){t.__v!=n.__v&&(p.props=g,p.state=p.__s,p.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(I){I&&(I.__=t)}),sl.push.apply(p.__h,p._sb),p._sb=[],p.__h.length&&a.push(p),s=qr(n);break e}p.componentWillUpdate!=null&&p.componentWillUpdate(g,p.__s,C),b&&p.componentDidUpdate!=null&&p.__h.push(function(){p.componentDidUpdate(m,h,y)})}if(p.context=C,p.props=g,p.__P=e,p.__e=!1,M=Tt.__r,k=0,b)p.state=p.__s,p.__d=!1,M&&M(t),u=p.render(p.props,p.state,p.context),sl.push.apply(p.__h,p._sb),p._sb=[];else do p.__d=!1,M&&M(t),u=p.render(p.props,p.state,p.context),p.state=p.__s;while(p.__d&&++k<25);p.state=p.__s,p.getChildContext!=null&&(i=Wi(Wi({},i),p.getChildContext())),b&&!d&&p.getSnapshotBeforeUpdate!=null&&(y=p.getSnapshotBeforeUpdate(m,h)),P=u!=null&&u.type===ul&&u.key==null?rx(u.props.children):u,s=Qb(e,cl(P)?P:[P],t,n,i,r,o,a,s,c,l),p.base=t.__e,t.__u&=-161,p.__h.length&&a.push(p),v&&(p.__E=p.__=null)}catch(I){if(a.length=f,t.__v=null,c||o!=null){if(I.then){for(t.__u|=c?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;o!=null&&(o[o.indexOf(s)]=null),t.__e=s}else if(o!=null)for(B=o.length;B--;)Vf(o[B])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),I.then||nx(t),Tt.__e(I,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=jk(n.__e,t,n,i,r,o,a,c,l);return(u=Tt.diffed)&&u(t),128&t.__u?void 0:s}function nx(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(nx))}function ix(e,t,n){for(var i=0;i<n.length;i++)Uf(n[i],n[++i],n[++i]);Tt.__c&&Tt.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){Tt.__e(o,r.__v)}})}function rx(e){return typeof e!="object"||e==null||e.__b>0?e:cl(e)?e.map(rx):e.constructor!==void 0?null:Wi({},e)}function jk(e,t,n,i,r,o,a,s,c){var l,u,f,p,d,m,h,y=n.props||al,v=t.props,g=t.type;if(g=="svg"?r="http://www.w3.org/2000/svg":g=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),o!=null){for(l=0;l<o.length;l++)if((d=o[l])&&"setAttribute"in d==!!g&&(g?d.localName==g:d.nodeType==3)){e=d,o[l]=null;break}}if(e==null){if(g==null)return document.createTextNode(v);e=document.createElementNS(r,g,v.is&&v),s&&(Tt.__m&&Tt.__m(t,o),s=!1),o=null}if(g==null)y===v||s&&e.data==v||(e.data=v);else{if(o=g=="textarea"&&v.defaultValue!=null?null:o&&rl.call(e.childNodes),!s&&o!=null)for(y={},l=0;l<e.attributes.length;l++)y[(d=e.attributes[l]).name]=d.value;for(l in y)d=y[l],l=="dangerouslySetInnerHTML"?f=d:l=="children"||l in v||l=="value"&&"defaultValue"in v||l=="checked"&&"defaultChecked"in v||dl(e,l,null,d,r);for(l in v)d=v[l],l=="children"?p=d:l=="dangerouslySetInnerHTML"?u=d:l=="value"?m=d:l=="checked"?h=d:s&&typeof d!="function"||y[l]===d||dl(e,l,d,y[l],r);if(u)s||f&&(u.__html==f.__html||u.__html==e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(f&&(e.innerHTML=""),Qb(t.type=="template"?e.content:e,cl(p)?p:[p],t,n,i,g=="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,a,o?o[0]:n.__k&&qr(n,0),s,c),o!=null)for(l=o.length;l--;)Vf(o[l]);s&&g!="textarea"||(l="value",g=="progress"&&m==null?e.removeAttribute("value"):m!=null&&(m!==e[l]||g=="progress"&&!m||g=="option"&&m!=y[l])&&dl(e,l,m,y[l],r),l="checked",h!=null&&h!=e[l]&&dl(e,l,h,y[l],r))}return e}function Uf(e,t,n){try{if(typeof e=="function"){var i=typeof e.__u=="function";i&&e.__u(),i&&t==null||(e.__u=e(t))}else e.current=t}catch(r){Tt.__e(r,n)}}function ox(e,t,n){var i,r;if(Tt.unmount&&Tt.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||Uf(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){Tt.__e(o,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&ox(i[r],t,n||typeof e.type!="function");n||Vf(e.__e),e.__c=e.__=e.__e=void 0}function Hk(e,t,n){return this.constructor(e,n)}function ax(e,t,n){var i,r,o,a;t==document&&(t=document.documentElement),Tt.__&&Tt.__(e,t),r=(i=!1)?null:t.__k,o=[],a=[],Wf(t,e=t.__k=Kb(ul,null,[e]),r||al,al,t.namespaceURI,r?null:t.firstChild?rl.call(t.childNodes):null,o,r?r.__e:t.firstChild,i,a),ix(o,e,a),e.props.children=null}rl=sl.slice,Tt={__e:function(e,t,n,i){for(var r,o,a;t=t.__;)if((r=t.__c)&&!r.__)try{if((o=r.constructor)&&o.getDerivedStateFromError!=null&&(r.setState(o.getDerivedStateFromError(e)),a=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(e,i||{}),a=r.__d),a)return r.__E=r}catch(s){e=s}throw e}},Vb=0,pl.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Wi({},this.state),typeof e=="function"&&(e=e(Wi({},n),this.props)),e&&Wi(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Zb(this))},pl.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Zb(this))},pl.prototype.render=ul,_r=[],Ub=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Yb=function(e,t){return e.__v.__b-t.__v.__b},fl.__r=0,jf=Math.random().toString(8),ol="__d"+jf,Ya="__a"+jf,qb=/(PointerCapture)$|Capture$/i,Hf=0,zf=tx(!1),Gf=tx(!0);var sx=function(e,t,n,i){var r;t[0]=0;for(var o=1;o<t.length;o++){var a=t[o++],s=t[o]?(t[0]|=a?1:2,n[t[o++]]):t[++o];a===3?i[0]=s:a===4?i[1]=Object.assign(i[1]||{},s):a===5?(i[1]=i[1]||{})[t[++o]]=s:a===6?i[1][t[++o]]+=s+"":a?(r=e.apply(s,sx(e,s,n,["",null])),i.push(r),s[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(s)}return i},cx=new Map;function zk(e){var t=cx.get(this);return t||(t=new Map,cx.set(this,t)),(t=sx(this,t.get(e)||(t.set(e,t=(function(n){for(var i,r,o=1,a="",s="",c=[0],l=function(p){o===1&&(p||(a=a.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?c.push(0,p,a):o===3&&(p||a)?(c.push(3,p,a),o=2):o===2&&a==="..."&&p?c.push(4,p,0):o===2&&a&&!p?c.push(5,0,!0,a):o>=5&&((a||!p&&o===5)&&(c.push(o,0,a,r),o=6),p&&(c.push(o,p,0,r),o=6)),a=""},u=0;u<n.length;u++){u&&(o===1&&l(),l(u));for(var f=0;f<n[u].length;f++)i=n[u][f],o===1?i==="<"?(l(),c=[c],o=3):a+=i:o===4?a==="--"&&i===">"?(o=1,a=""):a=i+a[0]:s?i===s?s="":a+=i:i==='"'||i==="'"?s=i:i===">"?(l(),o=1):o&&(i==="="?(o=5,r=a,a=""):i==="/"&&(o<5||n[u][f+1]===">")?(l(),o===3&&(c=c[0]),o=c,(c=c[0]).push(2,0,o),o=0):i===" "||i===" "||i===`
|
|
11
11
|
`||i==="\r"?(l(),o=2):a+=i),o===3&&a==="!--"&&(o=4,c=c[0])}return l(),c})(e)),t),arguments,[])).length>1?t:t[0]}var gt=zk.bind(Kb),Vo,zt,Yf,lx,qa=0,ux=[],Zt=Tt,px=Zt.__b,fx=Zt.__r,dx=Zt.diffed,hx=Zt.__c,mx=Zt.unmount,gx=Zt.__;function hl(e,t){Zt.__h&&Zt.__h(zt,e,qa||t),qa=0;var n=zt.__H||(zt.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function qf(e){return qa=1,Gk(vx,e)}function Gk(e,t,n){var i=hl(Vo++,2);if(i.t=e,!i.__c&&(i.__=[vx(void 0,t),function(s){var c=i.__N?i.__N[0]:i.__[0],l=i.t(c,s);c!==l&&(i.__N=[l,i.__[1]],i.__c.setState({}))}],i.__c=zt,!zt.__f)){var r=function(s,c,l){if(!i.__c.__H)return!0;var u=!1,f=i.__c.props!==s;if(i.__c.__H.__.some(function(d){if(d.__N){u=!0;var m=d.__[0];d.__=d.__N,d.__N=void 0,m!==d.__[0]&&(f=!0)}}),o){var p=o.call(this,s,c,l);return u?p||f:p}return!u||f};zt.__f=!0;var o=zt.shouldComponentUpdate,a=zt.componentWillUpdate;zt.componentWillUpdate=function(s,c,l){if(this.__e){var u=o;o=void 0,r(s,c,l),o=u}a&&a.call(this,s,c,l)},zt.shouldComponentUpdate=r}return i.__N||i.__}function ml(e,t){var n=hl(Vo++,3);!Zt.__s&&Zf(n.__H,t)&&(n.__=e,n.u=t,zt.__H.__h.push(n))}function Kf(e,t){var n=hl(Vo++,4);!Zt.__s&&Zf(n.__H,t)&&(n.__=e,n.u=t,zt.__h.push(n))}function gl(e){return qa=5,Ui(function(){return{current:e}},[])}function Ui(e,t){var n=hl(Vo++,7);return Zf(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Ka(e,t){return qa=8,Ui(function(){return e},t)}function Vk(){for(var e;e=ux.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(yl),t.__h.some(Xf),t.__h=[]}catch(n){t.__h=[],Zt.__e(n,e.__v)}}}Zt.__b=function(e){zt=null,px&&px(e)},Zt.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),gx&&gx(e,t)},Zt.__r=function(e){fx&&fx(e),Vo=0;var t=(zt=e.__c).__H;t&&(Yf===zt?(t.__h=[],zt.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(yl),t.__h.some(Xf),t.__h=[],Vo=0)),Yf=zt},Zt.diffed=function(e){dx&&dx(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(ux.push(t)!==1&&lx===Zt.requestAnimationFrame||((lx=Zt.requestAnimationFrame)||Wk)(Vk)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),Yf=zt=null},Zt.__c=function(e,t){t.some(function(n){try{n.__h.some(yl),n.__h=n.__h.filter(function(i){return!i.__||Xf(i)})}catch(i){t.some(function(r){r.__h&&(r.__h=[])}),t=[],Zt.__e(i,n.__v)}}),hx&&hx(e,t)},Zt.unmount=function(e){mx&&mx(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{yl(i)}catch(r){t=r}}),n.__H=void 0,t&&Zt.__e(t,n.__v))};var yx=typeof requestAnimationFrame=="function";function Wk(e){var t,n=function(){clearTimeout(i),yx&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);yx&&(t=requestAnimationFrame(n))}function yl(e){var t=zt,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),zt=t}function Xf(e){var t=zt;e.__c=e.__(),zt=t}function Zf(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function vx(e,t){return typeof t=="function"?t(e):t}function Uk(e){const{navigationStack:t,setNavigationStack:n}=e,i=Ui(()=>t.length<=1?[]:t.slice(0,-1).map((a,s)=>({label:a.label,onClick:()=>n(c=>c.slice(0,s+1))})),[t,n]),r=t.length>0?()=>n([]):null,o=t.length>0?t[t.length-1].label:null;return gt`
|
|
12
12
|
<div class="djs-popup-breadcrumbs">
|
|
13
13
|
${r&>`
|