@g1cloud/bpmn-modeler-next 5.0.0-alpha.2 → 5.0.0-alpha.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent/agentBatch.d.ts +12 -2
- package/dist/agent/geometryAudit.d.ts +255 -0
- package/dist/agent/resolver/documentIndex.d.ts +9 -0
- package/dist/agent/resolver/index.d.ts +22 -0
- package/dist/agent/resolver/issues.d.ts +16 -1
- package/dist/agent/resolver/routeRepair.d.ts +130 -0
- package/dist/agent/symbolicOp.d.ts +13 -1
- package/dist/bpmn-modeler-next.css +1 -1
- package/dist/bpmn-modeler.js +11501 -9984
- package/dist/bpmn-modeler.umd.cjs +97 -96
- package/dist/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
(function(me,We){typeof exports=="object"&&typeof module<"u"?We(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],We):(me=typeof globalThis<"u"?globalThis:me||self,We(me.BpmnModeler={},me.Vue))})(this,(function(me,We){"use strict";var YM=Object.defineProperty;var KM=(me,We,Tn)=>We in me?YM(me,We,{enumerable:!0,configurable:!0,writable:!0,value:Tn}):me[We]=Tn;var qi=(me,We,Tn)=>KM(me,typeof We!="symbol"?We+"":We,Tn);const Tn=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway"];function cp(e){return Tn.includes(e)}const up="http://g1project.net/spec/bpmn/bwl/1.0",Js="bwl",ec=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],lp={name:"bwl-hints",uri:up,prefix:Js,xml:{tagAlias:"lowerCase"},types:[{name:"Placement",superClass:["Element"],properties:[{name:"anchor",isAttr:!0,type:"String"},{name:"side",isAttr:!0,type:"String"},{name:"offset",isAttr:!0,type:"Real"}]},{name:"Members",superClass:["Element"],properties:[{name:"refs",isAttr:!0,type:"String"}]},{name:"BandHint",extends:["bpmn:FlowNode"],properties:[{name:"band",isAttr:!0,type:"Integer"}]},{name:"PoolOrderHint",extends:["bpmn:Participant"],properties:[{name:"poolOrder",isAttr:!0,type:"Integer"}]}]},tc="bwl.undoEpisode",pp=new WeakSet;function r_(e){pp.has(e)||(e.register(tc,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),pp.add(e))}function fp(e,t){r_(e);const n={run:t};if(e.execute(tc,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}const dp=["participant.add","participant.update","node.add","node.update","sequenceFlow.add","sequenceFlow.update","messageFlow.add","messageFlow.update","dataStore.add","dataStore.update","dataAssociation.add","association.add","annotation.add","annotation.update","group.add","group.update","element.remove"],o_={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},a_={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},s_={type:"object",description:"풀(participant). 레인은 여기 선언하고 노드가 lane 인자로 배정된다 — 별도 레인 op 없음.",properties:{id:{type:"string",description:"문서 내 유일, XML NCName(공백 없이 문자/밑줄로 시작)."},name:{type:"string"},blackBox:{type:"boolean",description:"true = 내부 프로세스 없는 블랙박스 풀."},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"],additionalProperties:!1},c_={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다.",properties:{id:{type:"string"},type:{type:"string",enum:[...Tn]},name:{type:"string"},participant:{type:"string",description:"소속 풀 id(협업 문서)."},lane:{type:"string",description:"소속 레인 id(풀 정의에 선언된 것)."}},required:["id","type"],additionalProperties:!1},u_={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},l_={type:"object",description:"시퀀스 플로우(같은 풀 안 노드 간).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"},condition:{$ref:"#/$defs/irFlowCondition"}},required:["id","source","target"],additionalProperties:!1},p_={type:"object",description:"메시지 플로우(풀 경계를 넘는 연결 — 노드 또는 블랙박스 풀 자체가 끝점).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"}},required:["id","source","target"],additionalProperties:!1},f_={type:"object",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},d_={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},h_={type:"object",properties:{id:{type:"string"},text:{type:"string"}},required:["id","text"],additionalProperties:!1},m_={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},g_={type:"object",description:"그룹 — members(요소 id 목록)가 bwl:members 힌트로 기록되고 바운즈는 멤버 bbox 로 산출된다.",properties:{id:{type:"string"},name:{type:"string"},members:{type:"array",items:{type:"string"}}},required:["id"],additionalProperties:!1},v_={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...ec]},offset:{type:"number"}},required:["anchor","side"],additionalProperties:!1};function mt(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const y_={"participant.add":mt("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트(생략 시 op 순서가 곧 배치 순서).",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":mt("participant.update",{description:"풀 이름/레인 갱신. lanes 는 전체 재선언(생략 = 보존) — 기존 레인을 유지하려면 함께 다시 나열한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"]}),"node.add":mt("node.add",{description:"플로우 노드 추가. band = 프로세스 내부 가로 밴드 순번 힌트(주 흐름 0, 보조 스트랜드 1…).",properties:{node:{$ref:"#/$defs/irNode"},band:{type:"integer"}},required:["node"]}),"node.update":mt("node.update",{description:"노드 이름/레인/타입 갱신. lane = 레인 재배정(이동), type = 태스크·이벤트 타입 전환.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lane:{type:"string"},type:{type:"string",enum:[...Tn]}},required:["id"]}),"sequenceFlow.add":mt("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":mt("sequenceFlow.update",{description:"시퀀스 플로우 이름/조건 갱신. condition: null = 조건 제거.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},condition:{description:"생략 = 보존, null = 제거.",anyOf:[{$ref:"#/$defs/irFlowCondition"},{type:"null"}]}},required:["id"]}),"messageFlow.add":mt("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":mt("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataStore.add":mt("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":mt("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataAssociation.add":mt("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":mt("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":mt("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":mt("annotation.update",{description:"주석 본문/방위 힌트 갱신. placement: null = 힌트 제거(휴리스틱 복귀). 주석 삭제는 element.remove.",properties:{id:{type:"string"},text:{type:"string"},placement:{description:"생략 = 보존, null = 힌트 제거.",anyOf:[{$ref:"#/$defs/bwlPlacement"},{type:"null"}]}},required:["id"]}),"group.add":mt("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":mt("group.update",{description:"그룹 이름/멤버 갱신. members 는 전체 재선언(생략 = 보존).",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},members:{type:"array",items:{type:"string"}}},required:["id"]}),"element.remove":mt("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},hp={anyOf:dp.map(e=>y_[e])},__={type:"object",description:"BPMN 문서에 요소를 추가·수정·삭제할 때 호출한다. 기존 요소는 describeProcess 가 노출하는 id 로 지정하고, 신규 요소 id 는 문서 내 유일한 XML NCName(공백 없이 문자/밑줄 시작)으로 짓는다. 좌표는 지정하지 않는다 — 배치는 서버가 결정하며, 필요하면 힌트(placement/band/order)로 의도만 전달하라.",properties:{ops:{type:"array",items:{$ref:"#/$defs/symbolicOp"}}},required:["ops"],additionalProperties:!1,$defs:{irLane:a_,irParticipant:s_,irNode:c_,irFlowCondition:u_,irSequenceFlow:l_,irMessageFlow:p_,irDataStore:f_,irDataAssociation:d_,irTextAnnotation:h_,irAssociation:m_,irGroup:g_,bwlPlacement:v_,nullableString:o_,symbolicOp:hp}},b_={"bpmn:Participant":"participant","bpmn:Lane":"lane","bpmn:SequenceFlow":"sequenceFlow","bpmn:MessageFlow":"messageFlow","bpmn:DataStoreReference":"dataStore","bpmn:DataInputAssociation":"dataAssociation","bpmn:DataOutputAssociation":"dataAssociation","bpmn:TextAnnotation":"annotation","bpmn:Association":"association","bpmn:Group":"group"};function E_(e,t){const n=b_[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function mp(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function gp(e){const t=()=>e.getAll().filter(n=>n.type!=="label"&&!("labelTarget"in n&&n.labelTarget));return{isCollaboration:()=>t().some(n=>n.type==="bpmn:Participant"),categoryOf:n=>{const i=e.get(n);if(!(!i||i.type==="label"))return E_(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&mp(i)===n).sort((i,r)=>i.y-r.y).map(i=>i.id),participantOf:n=>{const i=e.get(n);return i?mp(i):void 0}}}const x_=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,vp=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]);function yp(e,t){const n=[],i=new Map,r=new Map;function o(l,f,d){if(!x_.test(f)){n.push({kind:"id-invalid",opIndex:l,id:f});return}if(t.categoryOf(f)!==void 0||i.has(f)){n.push({kind:"id-duplicate",opIndex:l,id:f});return}i.set(f,{...d,opIndex:l})}e.forEach((l,f)=>{var d;switch(l.kind){case"participant.add":o(f,l.participant.id,{category:"participant",lanes:(l.participant.lanes??[]).map(h=>h.id)});for(const h of l.participant.lanes??[])o(f,h.id,{category:"lane"});break;case"node.add":o(f,l.node.id,{category:"flowNode",participant:l.node.participant});break;case"sequenceFlow.add":o(f,l.flow.id,{category:"sequenceFlow"});break;case"messageFlow.add":o(f,l.flow.id,{category:"messageFlow"});break;case"dataStore.add":o(f,l.dataStore.id,{category:"dataStore"});for(const h of l.associations??[])h.id&&o(f,h.id,{category:"dataAssociation"});break;case"dataAssociation.add":l.association.id&&o(f,l.association.id,{category:"dataAssociation"});break;case"association.add":l.association.id&&o(f,l.association.id,{category:"association"});break;case"annotation.add":o(f,l.annotation.id,{category:"annotation"}),(d=l.association)!=null&&d.id&&o(f,l.association.id,{category:"association"});break;case"group.add":o(f,l.group.id,{category:"group"});break;case"participant.update":if(l.lanes){r.set(l.id,l.lanes.map(h=>h.id));for(const h of l.lanes)t.categoryOf(h.id)===void 0&&o(f,h.id,{category:"lane"})}break}});const a=l=>{var f;return((f=i.get(l))==null?void 0:f.category)??t.categoryOf(l)},s=l=>{const f=i.get(l);return f?f.category==="participant"?l:f.participant:t.categoryOf(l)==="participant"?l:t.participantOf(l)};function c(l,f,d,h){const v=a(f);if(v===void 0){n.push({kind:"ref-missing",opIndex:l,ref:f,role:d});return}if(h&&!h.includes(v)){n.push({kind:"ref-category",opIndex:l,ref:f,role:d,expected:h.join("|"),actual:v});return}return v}const u=t.isCollaboration()||e.some(l=>l.kind==="participant.add");return e.forEach((l,f)=>{var d;switch(l.kind){case"participant.add":break;case"node.add":{const{participant:h,lane:v}=l.node;if(h===void 0){(u||v!==void 0)&&n.push({kind:"participant-required",opIndex:f,id:l.node.id});break}if(c(f,h,"participant",["participant"])===void 0)break;v!==void 0&&((((d=i.get(h))==null?void 0:d.lanes)??r.get(h)??t.lanesOf(h)).includes(v)||n.push({kind:"lane-unknown",opIndex:f,lane:v,participant:h}));break}case"sequenceFlow.add":{const{id:h,source:v,target:_,name:S,condition:w}=l.flow,E=c(f,v,"source",["flowNode"]),b=c(f,_,"target",["flowNode"]);E&&b&&s(v)!==s(_)&&n.push({kind:"flow-cross-pool",opIndex:f,id:h}),S!==void 0&&w!==void 0&&n.push({kind:"condition-name-conflict",opIndex:f,id:h});break}case"messageFlow.add":{const{id:h,source:v,target:_}=l.flow,S=c(f,v,"source",["flowNode","participant"]),w=c(f,_,"target",["flowNode","participant"]);if(S&&w){const E=s(v),b=s(_);E!==void 0&&E===b&&n.push({kind:"message-flow-same-pool",opIndex:f,id:h})}break}case"dataStore.add":{for(const h of l.associations??[]){if([h.source,h.target].filter(S=>S===l.dataStore.id).length!==1){n.push({kind:"data-association-ends",opIndex:f,source:h.source,target:h.target});continue}const _=h.source===l.dataStore.id?h.target:h.source;c(f,_,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:h,target:v}=l.association,_=c(f,h,"source"),S=c(f,v,"target");if(_&&S){const w=new Set([_,S]);w.has("dataStore")&&w.has("flowNode")||n.push({kind:"data-association-ends",opIndex:f,source:h,target:v})}break}case"association.add":{const{id:h,source:v,target:_}=l.association,S=c(f,v,"source"),w=c(f,_,"target");S&&w&&S!=="annotation"&&w!=="annotation"&&n.push({kind:"association-detached",opIndex:f,annotation:h??`${v}->${_}`});break}case"annotation.add":{if(l.association){const{source:h,target:v}=l.association;if(h!==l.annotation.id&&v!==l.annotation.id)n.push({kind:"association-detached",opIndex:f,annotation:l.annotation.id});else{const _=h===l.annotation.id?v:h;c(f,_,"association")}}l.placement&&c(f,l.placement.anchor,"anchor");break}case"group.add":{for(const h of l.group.members??[]){const v=c(f,h,"member");v&&vp.has(v)&&n.push({kind:"ref-category",opIndex:f,ref:h,role:"member",expected:"shape",actual:v})}break}case"participant.update":{if(p(f,l.id,"participant")===void 0)break;if(l.lanes){const h=t.lanesOf(l.id),v=l.lanes.map(S=>S.id);for(const S of h)v.includes(S)||n.push({kind:"lane-shrink-unsupported",opIndex:f,participant:l.id,lane:S});for(const S of v)t.categoryOf(S)!==void 0&&!h.includes(S)&&n.push({kind:"id-duplicate",opIndex:f,id:S});const _=v.filter(S=>h.includes(S));_.length===h.length&&_.some((S,w)=>S!==h[w])&&n.push({kind:"lane-reorder-unsupported",opIndex:f,participant:l.id})}break}case"node.update":{if(p(f,l.id,"flowNode")===void 0)break;if(l.lane!==void 0){const h=t.participantOf(l.id);(h?r.get(h)??t.lanesOf(h):[]).includes(l.lane)||n.push({kind:"lane-unknown",opIndex:f,lane:l.lane,participant:h??""})}break}case"sequenceFlow.update":{if(p(f,l.id,"sequenceFlow")===void 0)break;l.name!==void 0&&l.condition!==void 0&&n.push({kind:"condition-name-conflict",opIndex:f,id:l.id});break}case"messageFlow.update":p(f,l.id,"messageFlow");break;case"dataStore.update":p(f,l.id,"dataStore");break;case"annotation.update":{if(p(f,l.id,"annotation")===void 0)break;l.placement&&c(f,l.placement.anchor,"anchor");break}case"group.update":{if(p(f,l.id,"group")===void 0)break;for(const h of l.members??[]){const v=c(f,h,"member");v&&vp.has(v)&&n.push({kind:"ref-category",opIndex:f,ref:h,role:"member",expected:"shape",actual:v})}break}case"element.remove":{p(f,l.id)==="lane"&&n.push({kind:"ref-category",opIndex:f,ref:l.id,role:"target",expected:"removable",actual:"lane"});break}}}),n;function p(l,f,d){if(i.has(f)){n.push({kind:"target-added-in-batch",opIndex:l,id:f});return}const h=t.categoryOf(f);if(h===void 0){n.push({kind:"ref-missing",opIndex:l,ref:f,role:"target"});return}if(d&&h!==d){n.push({kind:"ref-category",opIndex:l,ref:f,role:"target",expected:d,actual:h});return}return h}}function _p(e){return{modeling:e.get("modeling"),bpmnFactory:e.get("bpmnFactory"),elementFactory:e.get("elementFactory"),elementRegistry:e.get("elementRegistry"),canvas:e.get("canvas"),autoPlace:e.get("autoPlace"),bpmnReplace:e.get("bpmnReplace")}}function Fo(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const bp={"top-left":[-1,-1],top:[0,-1],"top-right":[1,-1],right:[1,0],"bottom-right":[1,1],bottom:[0,1],"bottom-left":[-1,1],left:[-1,0]};function gt(e,t){return e.filter(n=>n.kind===t)}function Ep(e,t){var Y,B,L,H;const{modeling:n,bpmnFactory:i,elementFactory:r,elementRegistry:o,canvas:a,autoPlace:s,bpmnReplace:c}=t,u=()=>a.getRootElement(),p=M=>o.get(M),l=M=>{const $=p(M);if(!$)throw new Error(`하강 참조 해소 실패: ${M}`);return $},f=M=>{let $=M.parent;for(;$;){if($.type==="bpmn:Participant")return $;$=$.parent}},d=gt(e,"participant.add"),h=gt(e,"node.add"),v=gt(e,"sequenceFlow.add"),_=gt(e,"messageFlow.add"),S=gt(e,"dataStore.add"),w=gt(e,"dataAssociation.add"),E=gt(e,"annotation.add"),b=gt(e,"group.add"),R=new Map(h.map(M=>[M.node.id,M])),T=(M,$,x)=>{var j;const g=M.businessObject,m=(((j=g.extensionElements)==null?void 0:j.values)??[]).filter(q=>q.$type!==$),P=x?[...m,i.create($,x)]:m;if(!P.length){g.extensionElements&&n.updateProperties(M,{extensionElements:void 0});return}const k=i.create("bpmn:ExtensionElements",{values:P});P.forEach(q=>{q.$parent=k}),n.updateProperties(M,{extensionElements:k})},O=M=>({anchor:M.anchor,side:M.side,...M.offset!==void 0?{offset:M.offset}:{}});for(const M of gt(e,"element.remove")){const $=p(M.id);$&&n.removeElements([$])}const C=M=>o.filter($=>{var x;return $.type==="bpmn:Lane"&&((x=f($))==null?void 0:x.id)===M}).sort(($,x)=>$.y-x.y);for(const M of gt(e,"participant.update")){const $=l(M.id);if(M.name!==void 0&&n.updateProperties($,{name:M.name??void 0}),!M.lanes)continue;const x=C(M.id);if(!x.length){M.lanes.length>=2?n.splitLane($,M.lanes.length):n.addLane($,"bottom"),C(M.id).forEach((m,P)=>{const k=M.lanes[P];k&&n.updateProperties(m,{id:k.id,name:k.name})});continue}const g=new Set(x.map(m=>m.id));M.lanes.forEach((m,P)=>{if(g.has(m.id)){n.updateProperties(l(m.id),{name:m.name});return}const k=P===0?n.addLane(C(M.id)[0],"top"):n.addLane(l(M.lanes[P-1].id),"bottom");n.updateProperties(k,{id:m.id,name:m.name})})}const F=d.map((M,$)=>({op:M,declared:$}));F.sort((M,$)=>{const x=M.op.order??Number.POSITIVE_INFINITY,g=$.op.order??Number.POSITIVE_INFINITY;return x!==g?x-g:M.declared-$.declared});let N=80;for(const M of o.getAll())M.parent===u()&&"height"in M&&typeof M.y=="number"&&(N=Math.max(N,M.y+M.height+60));for(const{op:M}of F){const $=M.participant,x=h.filter(J=>J.node.participant===$.id).length,g=((Y=$.lanes)==null?void 0:Y.length)??0,m=Math.max(1200,x*160+300),P=$.blackBox||x+g===0?120:Math.max(300,g*180),k=r.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:$.id,name:$.name,...M.order!==void 0?{"bwl:poolOrder":M.order}:{},...$.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:m,height:P,isExpanded:!0}),j=n.createShape(k,{x:100+m/2,y:N+P/2},u()),q=$.lanes??[];q.length>=2?n.splitLane(j,q.length):q.length===1&&n.addLane(j,"bottom"),q.length&&o.filter(ve=>{var de;return ve.type==="bpmn:Lane"&&((de=f(ve))==null?void 0:de.id)===$.id}).sort((ve,de)=>ve.y-de.y).forEach((ve,de)=>{const _e=q[de];_e&&n.updateProperties(ve,{id:_e.id,name:_e.name})}),N=j.y+j.height+60}const I=M=>{var g;const $=R.get(M);if($)return $.node.participant??"";const x=p(M);return x?x.type==="bpmn:Participant"?x.id:((g=f(x))==null?void 0:g.id)??"":""},W=new Map,re=M=>{let $=W.get(M);return $||W.set(M,$={nodes:[],flows:[]}),$};for(const M of h)re(M.node.participant??"").nodes.push(M);for(const M of v)re(I(M.flow.source)).flows.push(M);const Pe=M=>{var $;return i.create("bpmn:SequenceFlow",{id:M.id,name:M.name??(($=M.condition)==null?void 0:$.label)})},Qe=(M,$)=>r.createShape({type:Fo(M.type),businessObject:i.create(Fo(M.type),{id:M.id,name:M.name,...$!==void 0?{"bwl:band":$}:{}})});for(const[M,$]of W){const x=M?l(M):void 0,g=x?x.x+150:250;let m=x?x.y+80:120;const P=de=>{const _e=l(de);return _e.y+_e.height/2},k=(de,_e)=>de.node.lane?P(de.node.lane):de.band!==void 0&&x?x.y+80+de.band*150:_e,j=de=>de.participant?l(de.participant):u(),q=new Set($.flows.map(de=>de.flow.target));for(const de of $.nodes)q.has(de.node.id)||(n.createShape(Qe(de.node,de.band),{x:g,y:k(de,m)},j(de.node)),!de.node.lane&&de.band===void 0&&(m+=160));const J=new Set;let ve=0;for(;ve++<$.nodes.length+2;){for(let Ve=0;Ve<$.nodes.length+$.flows.length+2;Ve++){let dt=!1;for(const Rt of $.flows){const Re=Rt.flow;if(J.has(Re.id))continue;const Ne=p(Re.source);if(!Ne)continue;const ht=p(Re.target),cn=R.get(Re.target);if(!ht&&cn){const Gt=Qe(cn.node,cn.band);if(cn.node.lane){const Pn=n.createShape(Gt,{x:Ne.x+Ne.width+130,y:P(cn.node.lane)},j(cn.node));n.connect(Ne,Pn,{type:"bpmn:SequenceFlow",businessObject:Pe(Re)})}else s.append(Ne,Gt,{connection:{type:"bpmn:SequenceFlow",businessObject:Pe(Re)}})}else if(ht)n.connect(Ne,ht,{type:"bpmn:SequenceFlow",businessObject:Pe(Re)});else continue;J.add(Re.id),dt=!0}if(!dt)break}const de=$.nodes.filter(Ve=>!p(Ve.node.id));if(!de.length)break;const _e=de[0];n.createShape(Qe(_e.node,_e.band),{x:g,y:k(_e,m)},j(_e.node)),!_e.node.lane&&_e.band===void 0&&(m+=160)}}const U=(M,$)=>{const x=$.target===M,g=l($.source),m=l($.target),P=x?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(g,m,$.id?{type:P,businessObject:i.create(P,{id:$.id})}:{type:P})};for(const M of S){const $=M.associations??[],x=$.map(P=>P.source===M.dataStore.id?P.target:P.source).map(p).find(Boolean),g=x?f(x)??u():u(),m=x?{x:x.x+x.width/2,y:x.y+x.height+110}:{x:200,y:N+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:M.dataStore.id,name:M.dataStore.name})},m,g);for(const P of $)U(M.dataStore.id,P)}for(const M of w){const x=l(M.association.target).type==="bpmn:DataStoreReference"?M.association.target:M.association.source;U(x,M.association)}for(const M of _){const $=M.flow;n.connect(l($.source),l($.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:$.id,name:$.name})})}let ee=0;for(const M of b){const $=(M.group.members??[]).map(p).filter(P=>!!P),x=40;let g;if($.length){const P=Math.min(...$.map(J=>J.x))-x,k=Math.min(...$.map(J=>J.y))-x,j=Math.max(...$.map(J=>J.x+J.width))+x,q=Math.max(...$.map(J=>J.y+J.height))+x;g={x:P,y:k,width:j-P,height:q-k}}else g={x:300+ee*350,y:40,width:300,height:200},ee++;const m=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:M.group.id}),width:g.width,height:g.height},{x:g.x+g.width/2,y:g.y+g.height/2},u());M.group.name&&n.updateLabel(m,M.group.name),(B=M.group.members)!=null&&B.length&&T(m,"bwl:Members",{refs:M.group.members.join(" ")})}const oe=M=>{const $=M.waypoints;if($!=null&&$.length){const g=$[Math.floor(($.length-1)/2)];return{x:g.x,y:g.y,width:0,height:0}}const x=M;return{x:x.x,y:x.y,width:x.width,height:x.height}};let Q=0;const ne={width:100,height:30};for(const M of E){const $=M.association,x=((L=M.placement)==null?void 0:L.anchor)??($?$.source===M.annotation.id?$.target:$.source:void 0),g=x?p(x):void 0,m=g?oe(g):void 0;let P;if(m&&M.placement){const[q,J]=bp[M.placement.side],ve=M.placement.offset??50;P={x:m.x+m.width/2+q*(m.width/2+ne.width/2+ve),y:m.y+m.height/2+J*(m.height/2+ne.height/2+ve)}}else m?(P={x:m.x+m.width/2+180+Q%3*260,y:m.y-110-Q%2*95},Q++):(P={x:300+Q*260,y:60},Q++);const k=g?f(g)??u():u(),j=n.createShape({type:"bpmn:TextAnnotation",businessObject:i.create("bpmn:TextAnnotation",{id:M.annotation.id,text:M.annotation.text})},P,k);if($){const q=J=>J===M.annotation.id?j:l(J);n.connect(q($.source),q($.target),$.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:$.id})}:{type:"bpmn:Association"})}M.placement&&T(j,"bwl:Placement",O(M.placement))}for(const M of gt(e,"association.add")){const $=M.association;n.connect(l($.source),l($.target),$.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:$.id})}:{type:"bpmn:Association"})}for(const M of gt(e,"node.update")){let $=l(M.id);if(M.type&&Fo(M.type)!==$.type&&($=c.replaceElement($,{type:Fo(M.type)})),M.name!==void 0&&n.updateProperties($,{name:M.name??void 0}),M.lane){const x=l(M.lane),g=x.y+x.height/2-($.y+$.height/2);g!==0&&n.moveElements([$],{x:0,y:g})}}for(const M of gt(e,"sequenceFlow.update")){const $=l(M.id);M.name!==void 0&&n.updateProperties($,{name:M.name??void 0}),M.condition!==void 0&&n.updateProperties($,{name:((H=M.condition)==null?void 0:H.label)??void 0})}for(const M of gt(e,"messageFlow.update"))M.name!==void 0&&n.updateProperties(l(M.id),{name:M.name??void 0});for(const M of gt(e,"dataStore.update"))M.name!==void 0&&n.updateProperties(l(M.id),{name:M.name??void 0});for(const M of gt(e,"annotation.update")){const $=l(M.id);if(M.text!==void 0&&n.updateProperties($,{text:M.text}),M.placement===null)T($,"bwl:Placement",null);else if(M.placement){const x=oe(l(M.placement.anchor)),[g,m]=bp[M.placement.side],P=M.placement.offset??50,k=x.x+x.width/2+g*(x.width/2+$.width/2+P),j=x.y+x.height/2+m*(x.height/2+$.height/2+P);n.moveElements([$],{x:k-($.x+$.width/2),y:j-($.y+$.height/2)}),T($,"bwl:Placement",O(M.placement))}}for(const M of gt(e,"group.update")){const $=l(M.id);if(M.name!==void 0&&n.updateLabel($,M.name??""),M.members){const x=M.members.map(p).filter(g=>!!g);if(x.length){const m=Math.min(...x.map(q=>q.x))-40,P=Math.min(...x.map(q=>q.y))-40,k=Math.max(...x.map(q=>q.x+q.width))+40,j=Math.max(...x.map(q=>q.y+q.height))+40;n.resizeShape($,{x:m,y:P,width:k-m,height:j-P})}T($,"bwl:Members",{refs:M.members.join(" ")})}}}function xp(e,t,n=Ep){const i=_p(e),r=yp(t,gp(i.elementRegistry));if(r.length)return{ok:!1,issues:r};const o=e.get("commandStack");try{return fp(o,()=>n(t,i)),{ok:!0,issues:[]}}catch(a){return{ok:!1,issues:[{kind:"lower-failed",message:a instanceof Error?a.message:String(a)}]}}}function nc(e){return Array.prototype.concat.apply([],e)}const Or=Object.prototype.toString,w_=Object.prototype.hasOwnProperty;function Ri(e){return e===void 0}function Je(e){return e!==void 0}function Yi(e){return e==null}function ae(e){return Or.call(e)==="[object Array]"}function rt(e){return Or.call(e)==="[object Object]"}function ue(e){return Or.call(e)==="[object Number]"}function ot(e){const t=Or.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function Tt(e){return Or.call(e)==="[object String]"}function S_(e){if(!ae(e))throw new Error("must supply array")}function Mt(e,t){return!Yi(e)&&w_.call(e,t)}function Oe(e,t){const n=zo(t);let i;return A(e,function(r,o){if(n(r,o))return i=r,!1}),i}function wp(e,t){const n=zo(t);let i=ae(e)?-1:void 0;return A(e,function(r,o){if(n(r,o))return i=o,!1}),i}function ye(e,t){const n=zo(t);let i=[];return A(e,function(r,o){n(r,o)&&i.push(r)}),i}function A(e,t){let n,i;if(Ri(e))return;const r=ae(e)?T_:A_;for(let o in e)if(Mt(e,o)&&(n=e[o],i=t(n,r(o)),i===!1))return n}function R_(e,t){if(Ri(e))return[];S_(e);const n=zo(t);return e.filter(function(i,r){return!n(i,r)})}function kt(e,t,n){return A(e,function(i,r){n=t(n,i,r)}),n}function Ci(e,t){return!!kt(e,function(n,i,r){return n&&t(i,r)},!0)}function qn(e,t){return!!Oe(e,t)}function vt(e,t){let n=[];return A(e,function(i,r){n.push(t(i,r))}),n}function Ho(e){return e&&Object.keys(e)||[]}function C_(e){return Ho(e).length}function Ki(e){return vt(e,t=>t)}function Xi(e,t,n={}){return t=ic(t),A(e,function(i){let r=t(i)||"_",o=n[r];o||(o=n[r]=[]),o.push(i)}),n}function Sp(e,...t){e=ic(e);let n={};return A(t,r=>Xi(r,e,n)),vt(n,function(r,o){return r[0]})}const P_=Sp;function ln(e,t){t=ic(t);let n=[];return A(e,function(i,r){let o=t(i,r),a={d:o,v:i};for(var s=0;s<n.length;s++){let{d:c}=n[s];if(o<c){n.splice(s,0,a);return}}n.push(a)}),vt(n,i=>i.v)}function Zi(e){return function(t){return Ci(e,function(n,i){return t[i]===n})}}function ic(e){return ot(e)?e:t=>t[e]}function zo(e){return ot(e)?e:t=>t===e}function A_(e){return e}function T_(e){return Number(e)}function rc(e,t){let n,i,r,o;function a(l){let f=Date.now(),d=l?0:o+t-f;if(d>0)return s(d);e.apply(r,i),c()}function s(l){n=setTimeout(a,l)}function c(){n&&clearTimeout(n),n=o=i=r=void 0}function u(){n&&a(!0),c()}function p(...l){o=Date.now(),i=l,r=this,n||s(t)}return p.flush=u,p.cancel=c,p}function Ct(e,t){return e.bind(t)}function D(e,...t){return Object.assign(e,...t)}function M_(e,t,n){let i=e;return A(t,function(r,o){if(typeof r!="number"&&typeof r!="string")throw new Error("illegal key type: "+typeof r+". Key should be of type number or string.");if(r==="constructor")throw new Error("illegal key: constructor");if(r==="__proto__")throw new Error("illegal key: __proto__");let a=t[o+1],s=i[r];Je(a)&&Yi(s)&&(s=i[r]=isNaN(+a)?{}:[]),Ri(a)?Ri(n)?delete i[r]:i[r]=n:i=s}),e}function on(e,t){let n={},i=Object(e);return A(t,function(r){r in i&&(n[r]=e[r])}),n}function pn(e,t){let n={},i=Object(e);return A(i,function(r,o){t.indexOf(o)===-1&&(n[o]=r)}),n}function oc(){}oc.prototype.get=function(e){return this.$model.properties.get(this,e)},oc.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function Rp(e,t){this.model=e,this.properties=t}Rp.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(oc.prototype);A(e.properties,function(a){!a.isMany&&a.default!==void 0&&(i[a.name]=a.default)}),n.defineModel(i,t),n.defineDescriptor(i,e);var r=e.ns.name;function o(a){n.define(this,"$type",{value:r,enumerable:!0}),n.define(this,"$attrs",{value:{}}),n.define(this,"$parent",{writable:!0}),A(a,Ct(function(s,c){this.set(c,s)},this))}return o.prototype=i,o.hasType=i.$instanceOf=this.model.hasType,n.defineModel(o,t),n.defineDescriptor(o,e),o};var k_=D(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),Cp=D(Object.create(null),{String:function(e){return e},Boolean:function(e){return e==="true"},Integer:function(e){return parseInt(e,10)},Real:function(e){return parseFloat(e)}});function ac(e,t){var n=Cp[e];return n?n(t):t}function sc(e){return!!k_[e]}function Pp(e){return!!Cp[e]}function yt(e,t){var n=e.split(/:/),i,r;if(n.length===1)i=e,r=t;else if(n.length===2)i=n[1],r=n[0];else throw new Error("expected <prefix:localName> or <localName>, got "+e);return e=(r?r+":":"")+i,{name:e,prefix:r,localName:i}}function Ft(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}Ft.prototype.build=function(){return on(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},Ft.prototype.addProperty=function(e,t,n){typeof t=="boolean"&&(n=t,t=void 0),this.addNamedProperty(e,n!==!1);var i=this.properties;t!==void 0?i.splice(t,0,e):i.push(e)},Ft.prototype.replaceProperty=function(e,t,n){var i=e.ns,r=this.properties,o=this.propertiesByName,a=e.name!==t.name;if(e.isId){if(!t.isId)throw new Error("property <"+t.ns.name+"> must be id property to refine <"+e.ns.name+">");this.setIdProperty(t,!1)}if(e.isBody){if(!t.isBody)throw new Error("property <"+t.ns.name+"> must be body property to refine <"+e.ns.name+">");this.setBodyProperty(t,!1)}var s=r.indexOf(e);if(s===-1)throw new Error("property <"+i.name+"> not found in property list");r.splice(s,1),this.addProperty(t,n?void 0:s,a),o[i.name]=o[i.localName]=t},Ft.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=yt(r[0],i),a=yt(r[1],o.prefix).name,s=this.propertiesByName[a];if(s)this.replaceProperty(s,e,n);else throw new Error("refined property <"+a+"> not found");delete e.redefines},Ft.prototype.addNamedProperty=function(e,t){var n=e.ns,i=this.propertiesByName;t&&(this.assertNotDefined(e,n.name),this.assertNotDefined(e,n.localName)),i[n.name]=i[n.localName]=e},Ft.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},Ft.prototype.setBodyProperty=function(e,t){if(t&&this.bodyProperty)throw new Error("body property defined multiple times (<"+this.bodyProperty.ns.name+">, <"+e.ns.name+">)");this.bodyProperty=e},Ft.prototype.setIdProperty=function(e,t){if(t&&this.idProperty)throw new Error("id property defined multiple times (<"+this.idProperty.ns.name+">, <"+e.ns.name+">)");this.idProperty=e},Ft.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},Ft.prototype.assertNotDefined=function(e,t){var n=e.name,i=this.propertiesByName[n];if(i)throw new Error("property <"+n+"> already defined; override of <"+i.definedBy.ns.name+"#"+i.ns.name+"> by <"+e.definedBy.ns.name+"#"+e.ns.name+"> not allowed without redefines")},Ft.prototype.hasProperty=function(e){return this.propertiesByName[e]},Ft.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,r=e.name;r in n||(A(e.properties,Ct(function(o){o=D({},o,{name:o.ns.localName,inherited:t}),Object.defineProperty(o,"definedBy",{value:e});var a=o.replaces,s=o.redefines;a||s?this.redefineProperty(o,a||s,a):(o.isBody&&this.setBodyProperty(o),o.isId&&this.setIdProperty(o),this.addProperty(o))},this)),i.push(e),n[r]=e)};function Yn(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,A(e,Ct(this.registerPackage,this))}Yn.prototype.getPackage=function(e){return this.packageMap[e]},Yn.prototype.getPackages=function(){return this.packages},Yn.prototype.registerPackage=function(e){e=D({},e);var t=this.packageMap;Ap(t,e,"prefix"),Ap(t,e,"uri"),A(e.types,Ct(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},Yn.prototype.registerType=function(e,t){e=D({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:D({},e.meta||{})});var n=yt(e.name,t.prefix),i=n.name,r=Object.create(null);A(e.properties,Ct(function(o){var a=yt(o.name,n.prefix),s=a.name;sc(o.type)||(o.type=yt(o.type,a.prefix).name),D(o,{ns:a,name:s}),r[s]=o},this)),D(e,{ns:n,name:i,propertiesByName:r}),A(e.extends,Ct(function(o){var a=yt(o,n.prefix),s=this.typeMap[a.name];s.traits=s.traits||[],s.traits.push(i)},this)),this.definePackage(e,t),this.typeMap[i]=e},Yn.prototype.mapTypes=function(e,t,n){var i=sc(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(c,u){var p=yt(c,sc(c)?"":e.prefix);r.mapTypes(p,t,u)}function a(c){return o(c,!0)}function s(c){return o(c,!1)}if(!i)throw new Error("unknown type <"+e.name+">");A(i.superClass,n?a:s),t(i,!n),A(i.traits,a)},Yn.prototype.getEffectiveDescriptor=function(e){var t=yt(e),n=new Ft(t);this.mapTypes(t,function(r,o){n.addTrait(r,o)});var i=n.build();return this.definePackage(i,i.allTypes[i.allTypes.length-1].$pkg),i},Yn.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function Ap(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function Pi(e){this.model=e}Pi.prototype.set=function(e,t,n){if(!Tt(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),r=i&&i.name;D_(n)?i?delete e[r]:delete e.$attrs[cc(t)]:i?r in e?e[r]=n:Tp(e,i,n):e.$attrs[cc(t)]=n},Pi.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[cc(t)];var i=n.name;return!e[i]&&n.isMany&&Tp(e,n,[]),e[i]},Pi.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=D({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},Pi.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},Pi.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},Pi.prototype.getProperty=function(e,t){var n=this.model,i=n.getPropertyDescriptor(e,t);if(i)return i;if(t.includes(":"))return null;const r=n.config.strict;if(typeof r<"u"){const o=new TypeError(`unknown property <${t}> on <${e.$type}>`);if(r)throw o;typeof console<"u"&&console.warn(o)}return null};function D_(e){return typeof e>"u"}function Tp(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function cc(e){return e.replace(/^:/,"")}function Wt(e,t={}){this.properties=new Pi(this),this.factory=new Rp(this,this.properties),this.registry=new Yn(e,this.properties),this.typeCache=Object.create(null),this.config=t}Wt.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},Wt.prototype.getType=function(e){var t=this.typeCache,n=Tt(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},Wt.prototype.createAny=function(e,t,n){var i=yt(e),r={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){M_(this,[a],s)}},o={name:e,isGeneric:!0,ns:{prefix:i.prefix,localName:i.localName,uri:t}};return this.properties.defineDescriptor(r,o),this.properties.defineModel(r,this),this.properties.define(r,"get",{enumerable:!1,writable:!0}),this.properties.define(r,"set",{enumerable:!1,writable:!0}),this.properties.define(r,"$parent",{enumerable:!1,writable:!0}),this.properties.define(r,"$instanceOf",{enumerable:!1,writable:!0}),A(n,function(a,s){rt(a)&&a.value!==void 0?r[a.name]=a.value:r[s]=a}),r},Wt.prototype.getPackage=function(e){return this.registry.getPackage(e)},Wt.prototype.getPackages=function(){return this.registry.getPackages()},Wt.prototype.getElementDescriptor=function(e){return e.$descriptor},Wt.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},Wt.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},Wt.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var Mp=String.fromCharCode,O_=Object.prototype.hasOwnProperty,I_=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,Ir={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(Ir).forEach(function(e){Ir[e.toUpperCase()]=Ir[e]});function L_(e,t,n,i){return i?O_.call(Ir,i)?Ir[i]:"&"+i+";":Mp(t||parseInt(n,16))}function Ai(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(I_,L_):e}var kp="non-whitespace outside of root node";function Kn(e){return new Error(e)}function B_(e){return"missing namespace for prefix <"+e+">"}function Vo(e){return{get:e,enumerable:!0}}function N_(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var Dp=Symbol("nameCache");function uc(e){return e+"$uri"}function $_(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[uc(i)]=n;return t}function Go(){return{line:0,column:0}}function j_(e){throw e}function Op(e){if(!this)return new Op(e);var t=e&&e.proxy,n,i,r,o,a=j_,s,c,u,p,l=Go,f=!1,d=!1,h="",v=!1,_=!1,S=null,w=!1,E,b,R,T;function O(I){I instanceof Error||(I=Kn(I)),S=I,a(I,l)}function C(I){s&&(I instanceof Error||(I=Kn(I)),s(I,l))}this.on=function(I,W){if(typeof W!="function")throw Kn("required args <name, cb>");switch(I){case"openTag":i=W;break;case"text":n=W;break;case"closeTag":r=W;break;case"error":a=W;break;case"warn":s=W;break;case"cdata":o=W;break;case"attention":p=W;break;case"question":u=W;break;case"comment":c=W;break;default:throw Kn("unsupported event: "+I)}return this},this.ns=function(I){if(typeof I>"u"&&(I={}),typeof I!="object")throw Kn("required args <nsMap={}>");var W=Object.create(null),re;for(re in I)W[re]=I[re];return _=!0,T=W,this};function F(){E=_?[]:null,b=_?$_(T):null,R=[],l=Go,w=!1,S=null,d=!1,h=""}this.parse=function(I){if(typeof I!="string")throw Kn("required args <xml=string>");if(f)throw Kn("parse during stream; call end() first");return F(),N(I),l=Go,w=!1,S},this.write=function(I){if(typeof I!="string")throw Kn("required args <xml=string>");return f||(F(),f=!0),S||(h=N(h+I,!0)||""),this},this.end=function(){return f||F(),f=!1,S||N(h),h="",l=Go,w=!1,S},this.stop=function(){w=!0};function N(I,W=!1){var re=null,Pe=null,Qe,U=0,ee=!1,oe=!1,Q=0,ne=0,Y,B,L,H,M,$,x,g,m,P="",k=0,j;function q(_e,Ve){var dt=_e.indexOf(":");if(dt===-1)return _e;var Rt=b[_e.substring(0,dt)];return Rt?Ve===Rt?_e.substr(dt+1):Rt+_e.substr(dt):(C(B_(_e.substring(0,dt))),null)}function J(){if(j!==null)return j;var _e,Ve,dt=_&&b.xmlns,Rt=_&&v?[]:null,Re=k,Ne=P,ht=Ne.length,cn,Gt,Pn,An,ct,jo={},i_=new Set,un,Ce,De;e:for(;Re<ht;Re++)if(un=!1,Ce=Ne.charCodeAt(Re),!(Ce===32||Ce<14&&Ce>8)){for((Ce<65||Ce>122||Ce>90&&Ce<97)&&Ce!==95&&Ce!==58&&(C("illegal first char attribute name"),un=!0),De=Re+1;De<ht;De++)if(Ce=Ne.charCodeAt(De),!(Ce>96&&Ce<123||Ce>64&&Ce<91||Ce>47&&Ce<59||Ce===46||Ce===45||Ce===95)){if(Ce===32||Ce<14&&Ce>8){C("missing attribute value"),Re=De;continue e}if(Ce===61)break;C("illegal attribute name char"),un=!0}if(ct=Ne.substring(Re,De),ct==="xmlns:xmlns"&&(C("illegal declaration of xmlns"),un=!0),Ce=Ne.charCodeAt(De+1),Ce===34)De=Ne.indexOf('"',Re=De+2),De===-1&&(De=Ne.indexOf("'",Re),De!==-1&&(C("attribute value quote missmatch"),un=!0));else if(Ce===39)De=Ne.indexOf("'",Re=De+2),De===-1&&(De=Ne.indexOf('"',Re),De!==-1&&(C("attribute value quote missmatch"),un=!0));else for(C("missing attribute value quotes"),un=!0,De=De+1;De<ht&&(Ce=Ne.charCodeAt(De+1),!(Ce===32||Ce<14&&Ce>8));De++);for(De===-1&&(C("missing closing quotes"),De=ht,un=!0),un||(Pn=Ne.substring(Re,De)),Re=De;De+1<ht&&(Ce=Ne.charCodeAt(De+1),!(Ce===32||Ce<14&&Ce>8));De++)Re===De&&(C("illegal character after attribute end"),un=!0);if(Re=De+1,un)continue e;if(i_.has(ct)){C("attribute <"+ct+"> already defined");continue}if(i_.add(ct),!_){jo[ct]=Pn;continue}if(v){if(Gt=ct==="xmlns"?"xmlns":ct.charCodeAt(0)===120&&ct.substr(0,6)==="xmlns:"?ct.substr(6):null,Gt!==null){if(_e=Ai(Pn),Ve=uc(Gt),An=T[_e],!An){if(Gt==="xmlns"||Ve in b&&b[Ve]!==_e)do An="ns"+U++;while(typeof b[An]<"u");else An=Gt;T[_e]=An}b[Gt]!==An&&(cn||(b=N_(b),cn=!0),b[Gt]=An,Gt==="xmlns"&&(b[uc(An)]=_e,dt=An),b[Ve]=_e),jo[ct]=Pn;continue}Rt.push(ct,Pn);continue}ct=q(ct,dt),ct!==null&&(jo[ct]=Pn)}if(v)for(Re=0,ht=Rt.length;Re<ht;Re++)ct=q(Rt[Re++],dt),Pn=Rt[Re],ct!==null&&(jo[ct]=Pn);return j=jo}function ve(){for(var _e=/(\r\n|\r|\n)/g,Ve=0,dt=0,Rt=0,Re=ne,Ne,ht;Q>=Rt&&(Ne=_e.exec(I),!(!Ne||(Re=Ne[0].length+Ne.index,Re>Q)));)Ve+=1,Rt=Re;return Q==-1?(dt=Re,ht=I.substring(ne)):ne===0?ht=I.substring(ne,Q):(dt=Q-Rt,ht=ne==-1?I.substring(Q):I.substring(Q,ne+1)),{data:ht,line:Ve,column:dt}}for(l=ve,t&&(m=Object.create({},{name:Vo(function(){return x}),originalName:Vo(function(){return g}),attrs:Vo(J),ns:Vo(function(){return b})}));ne!==-1;){if(I.charCodeAt(ne)===60?Q=ne:Q=I.indexOf("<",ne),Q===-1){if(W)return I.substring(ne);if(R.length)return O("unexpected end of file");if(!d)return O("missing start tag");ne<I.length&&I.substring(ne).trim()&&C(kp);return}if(d||(d=!0),ne!==Q){if(R.length){if(n&&(n(I.substring(ne,Q),Ai,l),w))return}else if(I.substring(ne,Q).trim()&&(C(kp),w))return}if(H=I.charCodeAt(Q+1),H===33){if(L=I.charCodeAt(Q+2),L===91&&I.substr(Q+3,6)==="CDATA["){if(ne=I.indexOf("]]>",Q),ne===-1)return W?I.substring(Q):O("unclosed cdata");if(o&&(o(I.substring(Q+9,ne),l),w))return;ne+=3;continue}if(L===45&&I.charCodeAt(Q+3)===45){if(ne=I.indexOf("-->",Q),ne===-1)return W?I.substring(Q):O("unclosed comment");if(c&&(c(I.substring(Q+4,ne),Ai,l),w))return;ne+=3;continue}}if(H===63){if(ne=I.indexOf("?>",Q),ne===-1)return W?I.substring(Q):O("unclosed question");if(u&&(u(I.substring(Q,ne+2),l),w))return;ne+=2;continue}for(Y=Q+1;;Y++){if(M=I.charCodeAt(Y),isNaN(M))return W?I.substring(Q):(ne=-1,O("unclosed tag"));if(M===34)L=I.indexOf('"',Y+1),Y=L!==-1?L:Y;else if(M===39)L=I.indexOf("'",Y+1),Y=L!==-1?L:Y;else if(M===62){ne=Y;break}}if(H===33){if(p&&(p(I.substring(Q,ne+1),Ai,l),w))return;ne+=1;continue}if(j={},H===47){if(ee=!1,oe=!0,!R.length)return O("missing open tag");if(Y=x=R.pop(),L=Q+2+Y.length,I.substring(Q+2,L)!==Y)return O("closing tag mismatch");for(;L<ne;L++)if(H=I.charCodeAt(L),!(H===32||H>8&&H<14))return O("close tag")}else{if(I.charCodeAt(ne-1)===47?(Y=x=I.substring(Q+1,ne-1),ee=!0,oe=!0):(Y=x=I.substring(Q+1,ne),ee=!0,oe=!1),!(H>96&&H<123||H>64&&H<91||H===95||H===58))return O("illegal first char nodeName");for(L=1,B=Y.length;L<B;L++)if(H=Y.charCodeAt(L),!(H>96&&H<123||H>64&&H<91||H>47&&H<59||H===45||H===95||H==46)){if(H===32||H<14&&H>8){x=Y.substring(0,L),j=null;break}return O("invalid nodeName")}oe||R.push(x)}if(_){Qe=b,ee&&(oe||E.push(Qe),j===null&&(v=Y.indexOf("xmlns",L)!==-1)&&(k=L,P=Y,J(),v=!1)),g=x,Pe!==b&&(re=b[Dp],re===void 0&&(re=b[Dp]=Object.create(null)),Pe=b);var de=re[x];if(de!==void 0)x=de;else{if(H=x.indexOf(":"),H!==-1){if($=b[x.substring(0,H)],!$)return O("missing namespace on <"+g+">");x=x.substr(H+1)}else $=b.xmlns;$&&(x=$+":"+x),re[g]=x}}if(ee&&(k=L,P=Y,i&&(t?i(m,Ai,oe,l):i(x,J,Ai,oe,l),w)))return;if(oe){if(r&&(r(t?m:x,Ai,ee,l),w))return;_&&(ee?b=Qe:b=E.pop())}ne+=1}}}function Ip(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var lc={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},Lp="property";function Bp(e){return e.xml&&e.xml.serialize}function F_(e){const t=Bp(e);return t!==Lp&&(t||null)}function H_(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Np(e,t){return Ip(t)?e.prefix+":"+H_(e.localName):e.name}function z_(e,t){var n=e.name,i=e.localName,r=t&&t.xml&&t.xml.typePrefix;return r&&i.indexOf(r)===0?e.prefix+":"+i.slice(r.length):n}function V_(e,t,n){const i=yt(e,t.xmlns),r=`${t[i.prefix]||i.prefix}:${i.localName}`,o=yt(r);var a=n.getPackage(o.prefix);return z_(o,a)}function Xn(e){return new Error(e)}function Mn(e){return e.$descriptor}function G_(e){D(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw Xn("expected element");var n=this.elementsById,i=Mn(t),r=i.idProperty,o;if(r&&(o=t.get(r.name),o)){if(!/^([a-z][\w-.]*:)?[a-z_][\w-.]*$/i.test(o))throw new Error("illegal ID <"+o+">");if(n[o])throw Xn("duplicate ID <"+o+">");n[o]=t}},this.addWarning=function(t){this.warnings.push(t)}}function Lr(){}Lr.prototype.handleEnd=function(){},Lr.prototype.handleText=function(){},Lr.prototype.handleNode=function(){};function pc(){}pc.prototype=Object.create(Lr.prototype),pc.prototype.handleNode=function(){return this};function Qi(){}Qi.prototype=Object.create(Lr.prototype),Qi.prototype.handleText=function(e){this.body=(this.body||"")+e};function Br(e,t){this.property=e,this.context=t}Br.prototype=Object.create(Qi.prototype),Br.prototype.handleNode=function(e){if(this.element)throw Xn("expected no sub nodes");return this.element=this.createReference(e),this},Br.prototype.handleEnd=function(){this.element.id=this.body},Br.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function fc(e,t){this.element=t,this.propertyDesc=e}fc.prototype=Object.create(Qi.prototype),fc.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=ac(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function Wo(){}Wo.prototype=Object.create(Qi.prototype),Wo.prototype.handleNode=function(e){var t=this,n=this.element;return n?t=this.handleChild(e):(n=this.element=this.createElement(e),this.context.addElement(n)),t};function xt(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}xt.prototype=Object.create(Wo.prototype),xt.prototype.addReference=function(e){this.context.addReference(e)},xt.prototype.handleText=function(e){var t=this.element,n=Mn(t),i=n.bodyProperty;if(!i)throw Xn("unexpected body text <"+e+">");Qi.prototype.handleText.call(this,e)},xt.prototype.handleEnd=function(){var e=this.body,t=this.element,n=Mn(t),i=n.bodyProperty;i&&e!==void 0&&(e=ac(i.type,e),t.set(i.name,e))},xt.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=Mn(n),r=this.context,o=new n({}),a=this.model,s;return A(t,function(c,u){var p=i.propertiesByName[u],l;p&&p.isReference?p.isMany?(l=c.split(" "),A(l,function(f){r.addReference({element:o,property:p.ns.name,id:f})})):r.addReference({element:o,property:p.ns.name,id:c}):(p?c=ac(p.type,c):u==="xmlns"?u=":"+u:(s=yt(u,i.ns.prefix),a.getPackage(s.prefix)&&r.addWarning({message:"unknown attribute <"+u+">",element:o,property:u,value:c})),o.set(u,c))}),o},xt.prototype.getPropertyForNode=function(e){var t=e.name,n=yt(t),i=this.type,r=this.model,o=Mn(i),a=n.name,s=o.propertiesByName[a];if(s&&!s.isAttr){const u=F_(s);if(u){const p=e.attributes[u];if(p){const l=V_(p,e.ns,r),f=r.getType(l);return D({},s,{effectiveType:Mn(f).name})}}return s}var c=r.getPackage(n.prefix);if(c){const u=Np(n,c),p=r.getType(u);if(s=Oe(o.properties,function(l){return!l.isVirtual&&!l.isReference&&!l.isAttribute&&p.hasType(l.type)}),s)return D({},s,{effectiveType:Mn(p).name})}else if(s=Oe(o.properties,function(u){return!u.isReference&&!u.isAttribute&&u.type==="Element"}),s)return s;throw Xn("unrecognized element <"+n.name+">")},xt.prototype.toString=function(){return"ElementDescriptor["+Mn(this.type).name+"]"},xt.prototype.valueHandler=function(e,t){return new fc(e,t)},xt.prototype.referenceHandler=function(e){return new Br(e,this.context)},xt.prototype.handler=function(e){return e==="Element"?new Ji(this.model,e,this.context):new xt(this.model,e,this.context)},xt.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,Pp(n))return this.valueHandler(t,i);t.isReference?r=this.referenceHandler(t).handleNode(e):r=this.handler(n).handleNode(e);var o=r.element;return o!==void 0&&(t.isMany?i.get(t.name).push(o):i.set(t.name,o),t.isReference?(D(o,{element:i}),this.context.addReference(o)):o.$parent=i),r};function dc(e,t,n){xt.call(this,e,t,n)}dc.prototype=Object.create(xt.prototype),dc.prototype.createElement=function(e){var t=e.name,n=yt(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&Np(n,o)||t;if(!r.hasType(a))throw Xn("unexpected element <"+e.originalName+">");return xt.prototype.createElement.call(this,e)};function Ji(e,t,n){this.model=e,this.context=n}Ji.prototype=Object.create(Wo.prototype),Ji.prototype.createElement=function(e){var t=e.name,n=yt(t),i=n.prefix,r=e.ns[i+"$uri"],o=e.attributes;return this.model.createAny(t,r,o)},Ji.prototype.handleChild=function(e){var t=new Ji(this.model,"Element",this.context).handleNode(e),n=this.element,i=t.element,r;return i!==void 0&&(r=n.$children=n.$children||[],r.push(i),i.$parent=n),t},Ji.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function hc(e){e instanceof Wt&&(e={model:e}),D(this,{lax:!1},e)}hc.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof xt?(i=t,t={}):typeof t=="string"?(i=this.handler(t),t={}):typeof i=="string"&&(i=this.handler(i));var r=this.model,o=this.lax,a=new G_(D({},t,{rootHandler:i})),s=new Op({proxy:!0}),c=W_();i.context=a,c.push(i);function u(R,T,O){var C=T(),F=C.line,N=C.column,I=C.data;I.charAt(0)==="<"&&I.indexOf(" ")!==-1&&(I=I.slice(0,I.indexOf(" "))+">");var W="unparsable content "+(I?I+" ":"")+`detected
|
|
1
|
+
(function(Q,St){typeof exports=="object"&&typeof module<"u"?St(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],St):(Q=typeof globalThis<"u"?globalThis:Q||self,St(Q.BpmnModeler={},Q.Vue))})(this,(function(Q,St){"use strict";var LD=Object.defineProperty;var ID=(Q,St,Ei)=>St in Q?LD(Q,St,{enumerable:!0,configurable:!0,writable:!0,value:Ei}):Q[St]=Ei;var qr=(Q,St,Ei)=>ID(Q,typeof St!="symbol"?St+"":St,Ei);const Ei=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway"];function Lf(e){return Ei.includes(e)}const If="http://g1project.net/spec/bpmn/bwl/1.0",yu="bwl",vu=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],Nf={name:"bwl-hints",uri:If,prefix:yu,xml:{tagAlias:"lowerCase"},types:[{name:"Placement",superClass:["Element"],properties:[{name:"anchor",isAttr:!0,type:"String"},{name:"side",isAttr:!0,type:"String"},{name:"offset",isAttr:!0,type:"Real"}]},{name:"Members",superClass:["Element"],properties:[{name:"refs",isAttr:!0,type:"String"}]},{name:"BandHint",extends:["bpmn:FlowNode"],properties:[{name:"band",isAttr:!0,type:"Integer"}]},{name:"PoolOrderHint",extends:["bpmn:Participant"],properties:[{name:"poolOrder",isAttr:!0,type:"Integer"}]}]},_u="bwl.undoEpisode",Bf=new WeakSet;function gx(e){Bf.has(e)||(e.register(_u,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),Bf.add(e))}function $f(e,t){gx(e);const n={run:t};if(e.execute(_u,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}const jf=["participant.add","participant.update","node.add","node.update","sequenceFlow.add","sequenceFlow.update","messageFlow.add","messageFlow.update","dataStore.add","dataStore.update","dataAssociation.add","association.add","annotation.add","annotation.update","group.add","group.update","element.remove"],yx={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},vx={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},_x={type:"object",description:"풀(participant). 레인은 여기 선언하고 노드가 lane 인자로 배정된다 — 별도 레인 op 없음.",properties:{id:{type:"string",description:"문서 내 유일, XML NCName(공백 없이 문자/밑줄로 시작)."},name:{type:"string"},blackBox:{type:"boolean",description:"true = 내부 프로세스 없는 블랙박스 풀."},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"],additionalProperties:!1},bx={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다.",properties:{id:{type:"string"},type:{type:"string",enum:[...Ei]},name:{type:"string"},participant:{type:"string",description:"소속 풀 id(협업 문서)."},lane:{type:"string",description:"소속 레인 id(풀 정의에 선언된 것)."}},required:["id","type"],additionalProperties:!1},xx={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},Ex={type:"object",description:"시퀀스 플로우(같은 풀 안 노드 간).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"},condition:{$ref:"#/$defs/irFlowCondition"}},required:["id","source","target"],additionalProperties:!1},wx={type:"object",description:"메시지 플로우(풀 경계를 넘는 연결 — 노드 또는 블랙박스 풀 자체가 끝점).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"}},required:["id","source","target"],additionalProperties:!1},Sx={type:"object",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},Rx={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},Cx={type:"object",properties:{id:{type:"string"},text:{type:"string"}},required:["id","text"],additionalProperties:!1},Px={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},Ax={type:"object",description:"그룹 — members(요소 id 목록)가 bwl:members 힌트로 기록되고 바운즈는 멤버 bbox 로 산출된다.",properties:{id:{type:"string"},name:{type:"string"},members:{type:"array",items:{type:"string"}}},required:["id"],additionalProperties:!1},Tx={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...vu]},offset:{type:"number"}},required:["anchor","side"],additionalProperties:!1};function tn(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const Mx={"participant.add":tn("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트(생략 시 op 순서가 곧 배치 순서).",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":tn("participant.update",{description:"풀 이름/레인 갱신. lanes 는 전체 재선언(생략 = 보존) — 기존 레인을 유지하려면 함께 다시 나열한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"]}),"node.add":tn("node.add",{description:'플로우 노드 추가. band = 가로 밴드 순번 힌트(주 흐름 0, 갈래 1, 2…) — 위/아래가 아니라 "주 흐름에서 몇 번째 갈래"다. 행 배치(어느 갈래가 위/아래인지)는 호스트가 정한다(대칭·메시지 방향). 레인이 있으면 그 레인 안의 밴드다 — 한 레인 안에서 게이트웨이 출구를 갈라 놓을 때 쓴다. 컨테이너(풀·레인)는 밴드 수만큼 자란다.',properties:{node:{$ref:"#/$defs/irNode"},band:{type:"integer"}},required:["node"]}),"node.update":tn("node.update",{description:"노드 이름/레인/타입 갱신. lane = 레인 재배정(이동), type = 태스크·이벤트 타입 전환.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lane:{type:"string"},type:{type:"string",enum:[...Ei]}},required:["id"]}),"sequenceFlow.add":tn("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":tn("sequenceFlow.update",{description:"시퀀스 플로우 이름/조건/끝점 갱신. condition: null = 조건 제거. source/target = 끝점 재배선 — 중간 삽입은 기존 플로우를 지우지 말고 이것으로 한쪽 끝을 옮긴 뒤 새 플로우를 추가한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},condition:{description:"생략 = 보존, null = 제거.",anyOf:[{$ref:"#/$defs/irFlowCondition"},{type:"null"}]},source:{description:"새 출발 노드 id(생략 = 보존). 같은 배치에서 추가한 노드도 지목할 수 있다.",type:"string"},target:{description:"새 도착 노드 id(생략 = 보존). 같은 배치에서 추가한 노드도 지목할 수 있다.",type:"string"}},required:["id"]}),"messageFlow.add":tn("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":tn("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataStore.add":tn("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":tn("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataAssociation.add":tn("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":tn("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":tn("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":tn("annotation.update",{description:"주석 본문/방위 힌트 갱신. placement: null = 힌트 제거(휴리스틱 복귀). 주석 삭제는 element.remove.",properties:{id:{type:"string"},text:{type:"string"},placement:{description:"생략 = 보존, null = 힌트 제거.",anyOf:[{$ref:"#/$defs/bwlPlacement"},{type:"null"}]}},required:["id"]}),"group.add":tn("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":tn("group.update",{description:"그룹 이름/멤버 갱신. members 는 전체 재선언(생략 = 보존).",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},members:{type:"array",items:{type:"string"}}},required:["id"]}),"element.remove":tn("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},Ff={anyOf:jf.map(e=>Mx[e])},kx={type:"object",description:"BPMN 문서에 요소를 추가·수정·삭제할 때 호출한다. 기존 요소는 describeProcess 가 노출하는 id 로 지정하고, 신규 요소 id 는 문서 내 유일한 XML NCName(공백 없이 문자/밑줄 시작)으로 짓는다. 좌표는 지정하지 않는다 — 배치는 서버가 결정하며, 필요하면 힌트(placement/band/order)로 의도만 전달하라.",properties:{ops:{type:"array",items:{$ref:"#/$defs/symbolicOp"}}},required:["ops"],additionalProperties:!1,$defs:{irLane:vx,irParticipant:_x,irNode:bx,irFlowCondition:xx,irSequenceFlow:Ex,irMessageFlow:wx,irDataStore:Sx,irDataAssociation:Rx,irTextAnnotation:Cx,irAssociation:Px,irGroup:Ax,bwlPlacement:Tx,nullableString:yx,symbolicOp:Ff}};function bu(e){return Array.prototype.concat.apply([],e)}const Bo=Object.prototype.toString,Dx=Object.prototype.hasOwnProperty;function xr(e){return e===void 0}function Ot(e){return e!==void 0}function Yr(e){return e==null}function ge(e){return Bo.call(e)==="[object Array]"}function Ht(e){return Bo.call(e)==="[object Object]"}function xe(e){return Bo.call(e)==="[object Number]"}function zt(e){const t=Bo.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function vn(e){return Bo.call(e)==="[object String]"}function Ox(e){if(!ge(e))throw new Error("must supply array")}function _n(e,t){return!Yr(e)&&Dx.call(e,t)}function at(e,t){const n=Ya(t);let i;return M(e,function(r,o){if(n(r,o))return i=r,!1}),i}function Hf(e,t){const n=Ya(t);let i=ge(e)?-1:void 0;return M(e,function(r,o){if(n(r,o))return i=o,!1}),i}function Oe(e,t){const n=Ya(t);let i=[];return M(e,function(r,o){n(r,o)&&i.push(r)}),i}function M(e,t){let n,i;if(xr(e))return;const r=ge(e)?$x:Bx;for(let o in e)if(_n(e,o)&&(n=e[o],i=t(n,r(o)),i===!1))return n}function Lx(e,t){if(xr(e))return[];Ox(e);const n=Ya(t);return e.filter(function(i,r){return!n(i,r)})}function bn(e,t,n){return M(e,function(i,r){n=t(n,i,r)}),n}function Er(e,t){return!!bn(e,function(n,i,r){return n&&t(i,r)},!0)}function Fi(e,t){return!!at(e,t)}function nn(e,t){let n=[];return M(e,function(i,r){n.push(t(i,r))}),n}function qa(e){return e&&Object.keys(e)||[]}function Ix(e){return qa(e).length}function Kr(e){return nn(e,t=>t)}function Xr(e,t,n={}){return t=xu(t),M(e,function(i){let r=t(i)||"_",o=n[r];o||(o=n[r]=[]),o.push(i)}),n}function zf(e,...t){e=xu(e);let n={};return M(t,r=>Xr(r,e,n)),nn(n,function(r,o){return r[0]})}const Nx=zf;function ri(e,t){t=xu(t);let n=[];return M(e,function(i,r){let o=t(i,r),a={d:o,v:i};for(var s=0;s<n.length;s++){let{d:c}=n[s];if(o<c){n.splice(s,0,a);return}}n.push(a)}),nn(n,i=>i.v)}function Zr(e){return function(t){return Er(e,function(n,i){return t[i]===n})}}function xu(e){return zt(e)?e:t=>t[e]}function Ya(e){return zt(e)?e:t=>t===e}function Bx(e){return e}function $x(e){return Number(e)}function Eu(e,t){let n,i,r,o;function a(p){let f=Date.now(),d=p?0:o+t-f;if(d>0)return s(d);e.apply(r,i),c()}function s(p){n=setTimeout(a,p)}function c(){n&&clearTimeout(n),n=o=i=r=void 0}function u(){n&&a(!0),c()}function l(...p){o=Date.now(),i=p,r=this,n||s(t)}return l.flush=u,l.cancel=c,l}function mn(e,t){return e.bind(t)}function D(e,...t){return Object.assign(e,...t)}function jx(e,t,n){let i=e;return M(t,function(r,o){if(typeof r!="number"&&typeof r!="string")throw new Error("illegal key type: "+typeof r+". Key should be of type number or string.");if(r==="constructor")throw new Error("illegal key: constructor");if(r==="__proto__")throw new Error("illegal key: __proto__");let a=t[o+1],s=i[r];Ot(a)&&Yr(s)&&(s=i[r]=isNaN(+a)?{}:[]),xr(a)?xr(n)?delete i[r]:i[r]=n:i=s}),e}function Jn(e,t){let n={},i=Object(e);return M(t,function(r){r in i&&(n[r]=e[r])}),n}function oi(e,t){let n={},i=Object(e);return M(i,function(r,o){t.indexOf(o)===-1&&(n[o]=r)}),n}function wu(){}wu.prototype.get=function(e){return this.$model.properties.get(this,e)},wu.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function Vf(e,t){this.model=e,this.properties=t}Vf.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(wu.prototype);M(e.properties,function(a){!a.isMany&&a.default!==void 0&&(i[a.name]=a.default)}),n.defineModel(i,t),n.defineDescriptor(i,e);var r=e.ns.name;function o(a){n.define(this,"$type",{value:r,enumerable:!0}),n.define(this,"$attrs",{value:{}}),n.define(this,"$parent",{writable:!0}),M(a,mn(function(s,c){this.set(c,s)},this))}return o.prototype=i,o.hasType=i.$instanceOf=this.model.hasType,n.defineModel(o,t),n.defineDescriptor(o,e),o};var Fx=D(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),Gf=D(Object.create(null),{String:function(e){return e},Boolean:function(e){return e==="true"},Integer:function(e){return parseInt(e,10)},Real:function(e){return parseFloat(e)}});function Su(e,t){var n=Gf[e];return n?n(t):t}function Ru(e){return!!Fx[e]}function Wf(e){return!!Gf[e]}function rn(e,t){var n=e.split(/:/),i,r;if(n.length===1)i=e,r=t;else if(n.length===2)i=n[1],r=n[0];else throw new Error("expected <prefix:localName> or <localName>, got "+e);return e=(r?r+":":"")+i,{name:e,prefix:r,localName:i}}function Dn(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}Dn.prototype.build=function(){return Jn(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},Dn.prototype.addProperty=function(e,t,n){typeof t=="boolean"&&(n=t,t=void 0),this.addNamedProperty(e,n!==!1);var i=this.properties;t!==void 0?i.splice(t,0,e):i.push(e)},Dn.prototype.replaceProperty=function(e,t,n){var i=e.ns,r=this.properties,o=this.propertiesByName,a=e.name!==t.name;if(e.isId){if(!t.isId)throw new Error("property <"+t.ns.name+"> must be id property to refine <"+e.ns.name+">");this.setIdProperty(t,!1)}if(e.isBody){if(!t.isBody)throw new Error("property <"+t.ns.name+"> must be body property to refine <"+e.ns.name+">");this.setBodyProperty(t,!1)}var s=r.indexOf(e);if(s===-1)throw new Error("property <"+i.name+"> not found in property list");r.splice(s,1),this.addProperty(t,n?void 0:s,a),o[i.name]=o[i.localName]=t},Dn.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=rn(r[0],i),a=rn(r[1],o.prefix).name,s=this.propertiesByName[a];if(s)this.replaceProperty(s,e,n);else throw new Error("refined property <"+a+"> not found");delete e.redefines},Dn.prototype.addNamedProperty=function(e,t){var n=e.ns,i=this.propertiesByName;t&&(this.assertNotDefined(e,n.name),this.assertNotDefined(e,n.localName)),i[n.name]=i[n.localName]=e},Dn.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},Dn.prototype.setBodyProperty=function(e,t){if(t&&this.bodyProperty)throw new Error("body property defined multiple times (<"+this.bodyProperty.ns.name+">, <"+e.ns.name+">)");this.bodyProperty=e},Dn.prototype.setIdProperty=function(e,t){if(t&&this.idProperty)throw new Error("id property defined multiple times (<"+this.idProperty.ns.name+">, <"+e.ns.name+">)");this.idProperty=e},Dn.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},Dn.prototype.assertNotDefined=function(e,t){var n=e.name,i=this.propertiesByName[n];if(i)throw new Error("property <"+n+"> already defined; override of <"+i.definedBy.ns.name+"#"+i.ns.name+"> by <"+e.definedBy.ns.name+"#"+e.ns.name+"> not allowed without redefines")},Dn.prototype.hasProperty=function(e){return this.propertiesByName[e]},Dn.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,r=e.name;r in n||(M(e.properties,mn(function(o){o=D({},o,{name:o.ns.localName,inherited:t}),Object.defineProperty(o,"definedBy",{value:e});var a=o.replaces,s=o.redefines;a||s?this.redefineProperty(o,a||s,a):(o.isBody&&this.setBodyProperty(o),o.isId&&this.setIdProperty(o),this.addProperty(o))},this)),i.push(e),n[r]=e)};function Hi(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,M(e,mn(this.registerPackage,this))}Hi.prototype.getPackage=function(e){return this.packageMap[e]},Hi.prototype.getPackages=function(){return this.packages},Hi.prototype.registerPackage=function(e){e=D({},e);var t=this.packageMap;Uf(t,e,"prefix"),Uf(t,e,"uri"),M(e.types,mn(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},Hi.prototype.registerType=function(e,t){e=D({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:D({},e.meta||{})});var n=rn(e.name,t.prefix),i=n.name,r=Object.create(null);M(e.properties,mn(function(o){var a=rn(o.name,n.prefix),s=a.name;Ru(o.type)||(o.type=rn(o.type,a.prefix).name),D(o,{ns:a,name:s}),r[s]=o},this)),D(e,{ns:n,name:i,propertiesByName:r}),M(e.extends,mn(function(o){var a=rn(o,n.prefix),s=this.typeMap[a.name];s.traits=s.traits||[],s.traits.push(i)},this)),this.definePackage(e,t),this.typeMap[i]=e},Hi.prototype.mapTypes=function(e,t,n){var i=Ru(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(c,u){var l=rn(c,Ru(c)?"":e.prefix);r.mapTypes(l,t,u)}function a(c){return o(c,!0)}function s(c){return o(c,!1)}if(!i)throw new Error("unknown type <"+e.name+">");M(i.superClass,n?a:s),t(i,!n),M(i.traits,a)},Hi.prototype.getEffectiveDescriptor=function(e){var t=rn(e),n=new Dn(t);this.mapTypes(t,function(r,o){n.addTrait(r,o)});var i=n.build();return this.definePackage(i,i.allTypes[i.allTypes.length-1].$pkg),i},Hi.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function Uf(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function wr(e){this.model=e}wr.prototype.set=function(e,t,n){if(!vn(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),r=i&&i.name;Hx(n)?i?delete e[r]:delete e.$attrs[Cu(t)]:i?r in e?e[r]=n:qf(e,i,n):e.$attrs[Cu(t)]=n},wr.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[Cu(t)];var i=n.name;return!e[i]&&n.isMany&&qf(e,n,[]),e[i]},wr.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=D({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},wr.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},wr.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},wr.prototype.getProperty=function(e,t){var n=this.model,i=n.getPropertyDescriptor(e,t);if(i)return i;if(t.includes(":"))return null;const r=n.config.strict;if(typeof r<"u"){const o=new TypeError(`unknown property <${t}> on <${e.$type}>`);if(r)throw o;typeof console<"u"&&console.warn(o)}return null};function Hx(e){return typeof e>"u"}function qf(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function Cu(e){return e.replace(/^:/,"")}function $n(e,t={}){this.properties=new wr(this),this.factory=new Vf(this,this.properties),this.registry=new Hi(e,this.properties),this.typeCache=Object.create(null),this.config=t}$n.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},$n.prototype.getType=function(e){var t=this.typeCache,n=vn(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},$n.prototype.createAny=function(e,t,n){var i=rn(e),r={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){jx(this,[a],s)}},o={name:e,isGeneric:!0,ns:{prefix:i.prefix,localName:i.localName,uri:t}};return this.properties.defineDescriptor(r,o),this.properties.defineModel(r,this),this.properties.define(r,"get",{enumerable:!1,writable:!0}),this.properties.define(r,"set",{enumerable:!1,writable:!0}),this.properties.define(r,"$parent",{enumerable:!1,writable:!0}),this.properties.define(r,"$instanceOf",{enumerable:!1,writable:!0}),M(n,function(a,s){Ht(a)&&a.value!==void 0?r[a.name]=a.value:r[s]=a}),r},$n.prototype.getPackage=function(e){return this.registry.getPackage(e)},$n.prototype.getPackages=function(){return this.registry.getPackages()},$n.prototype.getElementDescriptor=function(e){return e.$descriptor},$n.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},$n.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},$n.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var Yf=String.fromCharCode,zx=Object.prototype.hasOwnProperty,Vx=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,$o={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys($o).forEach(function(e){$o[e.toUpperCase()]=$o[e]});function Gx(e,t,n,i){return i?zx.call($o,i)?$o[i]:"&"+i+";":Yf(t||parseInt(n,16))}function Sr(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(Vx,Gx):e}var Kf="non-whitespace outside of root node";function zi(e){return new Error(e)}function Wx(e){return"missing namespace for prefix <"+e+">"}function Ka(e){return{get:e,enumerable:!0}}function Ux(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var Xf=Symbol("nameCache");function Pu(e){return e+"$uri"}function qx(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[Pu(i)]=n;return t}function Xa(){return{line:0,column:0}}function Yx(e){throw e}function Zf(e){if(!this)return new Zf(e);var t=e&&e.proxy,n,i,r,o,a=Yx,s,c,u,l,p=Xa,f=!1,d=!1,h="",m=!1,g=!1,R=null,E=!1,x,b,w,T;function L(N){N instanceof Error||(N=zi(N)),R=N,a(N,p)}function A(N){s&&(N instanceof Error||(N=zi(N)),s(N,p))}this.on=function(N,z){if(typeof z!="function")throw zi("required args <name, cb>");switch(N){case"openTag":i=z;break;case"text":n=z;break;case"closeTag":r=z;break;case"error":a=z;break;case"warn":s=z;break;case"cdata":o=z;break;case"attention":l=z;break;case"question":u=z;break;case"comment":c=z;break;default:throw zi("unsupported event: "+N)}return this},this.ns=function(N){if(typeof N>"u"&&(N={}),typeof N!="object")throw zi("required args <nsMap={}>");var z=Object.create(null),ue;for(ue in N)z[ue]=N[ue];return g=!0,T=z,this};function F(){x=g?[]:null,b=g?qx(T):null,w=[],p=Xa,E=!1,R=null,d=!1,h=""}this.parse=function(N){if(typeof N!="string")throw zi("required args <xml=string>");if(f)throw zi("parse during stream; call end() first");return F(),H(N),p=Xa,E=!1,R},this.write=function(N){if(typeof N!="string")throw zi("required args <xml=string>");return f||(F(),f=!0),R||(h=H(h+N,!0)||""),this},this.end=function(){return f||F(),f=!1,R||H(h),h="",p=Xa,E=!1,R},this.stop=function(){E=!0};function H(N,z=!1){var ue=null,je=null,tt,X=0,se=!1,fe=!1,oe=0,de=0,ee,$,B,U,Ae,wt,C,_,y,k="",I=0,W;function ae(nt,kt){var Ut=nt.indexOf(":");if(Ut===-1)return nt;var cn=b[nt.substring(0,Ut)];return cn?kt===cn?nt.substr(Ut+1):cn+nt.substr(Ut):(A(Wx(nt.substring(0,Ut))),null)}function Te(){if(W!==null)return W;var nt,kt,Ut=g&&b.xmlns,cn=g&&m?[]:null,ct=I,$t=k,jt=$t.length,Wr,Mn,ni,Nn,Dt,ii={},No=new Set,kn,Ue,Ye;e:for(;ct<jt;ct++)if(kn=!1,Ue=$t.charCodeAt(ct),!(Ue===32||Ue<14&&Ue>8)){for((Ue<65||Ue>122||Ue>90&&Ue<97)&&Ue!==95&&Ue!==58&&(A("illegal first char attribute name"),kn=!0),Ye=ct+1;Ye<jt;Ye++)if(Ue=$t.charCodeAt(Ye),!(Ue>96&&Ue<123||Ue>64&&Ue<91||Ue>47&&Ue<59||Ue===46||Ue===45||Ue===95)){if(Ue===32||Ue<14&&Ue>8){A("missing attribute value"),ct=Ye;continue e}if(Ue===61)break;A("illegal attribute name char"),kn=!0}if(Dt=$t.substring(ct,Ye),Dt==="xmlns:xmlns"&&(A("illegal declaration of xmlns"),kn=!0),Ue=$t.charCodeAt(Ye+1),Ue===34)Ye=$t.indexOf('"',ct=Ye+2),Ye===-1&&(Ye=$t.indexOf("'",ct),Ye!==-1&&(A("attribute value quote missmatch"),kn=!0));else if(Ue===39)Ye=$t.indexOf("'",ct=Ye+2),Ye===-1&&(Ye=$t.indexOf('"',ct),Ye!==-1&&(A("attribute value quote missmatch"),kn=!0));else for(A("missing attribute value quotes"),kn=!0,Ye=Ye+1;Ye<jt&&(Ue=$t.charCodeAt(Ye+1),!(Ue===32||Ue<14&&Ue>8));Ye++);for(Ye===-1&&(A("missing closing quotes"),Ye=jt,kn=!0),kn||(ni=$t.substring(ct,Ye)),ct=Ye;Ye+1<jt&&(Ue=$t.charCodeAt(Ye+1),!(Ue===32||Ue<14&&Ue>8));Ye++)ct===Ye&&(A("illegal character after attribute end"),kn=!0);if(ct=Ye+1,kn)continue e;if(No.has(Dt)){A("attribute <"+Dt+"> already defined");continue}if(No.add(Dt),!g){ii[Dt]=ni;continue}if(m){if(Mn=Dt==="xmlns"?"xmlns":Dt.charCodeAt(0)===120&&Dt.substr(0,6)==="xmlns:"?Dt.substr(6):null,Mn!==null){if(nt=Sr(ni),kt=Pu(Mn),Nn=T[nt],!Nn){if(Mn==="xmlns"||kt in b&&b[kt]!==nt)do Nn="ns"+X++;while(typeof b[Nn]<"u");else Nn=Mn;T[nt]=Nn}b[Mn]!==Nn&&(Wr||(b=Ux(b),Wr=!0),b[Mn]=Nn,Mn==="xmlns"&&(b[Pu(Nn)]=nt,Ut=Nn),b[kt]=nt),ii[Dt]=ni;continue}cn.push(Dt,ni);continue}Dt=ae(Dt,Ut),Dt!==null&&(ii[Dt]=ni)}if(m)for(ct=0,jt=cn.length;ct<jt;ct++)Dt=ae(cn[ct++],Ut),ni=cn[ct],Dt!==null&&(ii[Dt]=ni);return W=ii}function He(){for(var nt=/(\r\n|\r|\n)/g,kt=0,Ut=0,cn=0,ct=de,$t,jt;oe>=cn&&($t=nt.exec(N),!(!$t||(ct=$t[0].length+$t.index,ct>oe)));)kt+=1,cn=ct;return oe==-1?(Ut=ct,jt=N.substring(de)):de===0?jt=N.substring(de,oe):(Ut=oe-cn,jt=de==-1?N.substring(oe):N.substring(oe,de+1)),{data:jt,line:kt,column:Ut}}for(p=He,t&&(y=Object.create({},{name:Ka(function(){return C}),originalName:Ka(function(){return _}),attrs:Ka(Te),ns:Ka(function(){return b})}));de!==-1;){if(N.charCodeAt(de)===60?oe=de:oe=N.indexOf("<",de),oe===-1){if(z)return N.substring(de);if(w.length)return L("unexpected end of file");if(!d)return L("missing start tag");de<N.length&&N.substring(de).trim()&&A(Kf);return}if(d||(d=!0),de!==oe){if(w.length){if(n&&(n(N.substring(de,oe),Sr,p),E))return}else if(N.substring(de,oe).trim()&&(A(Kf),E))return}if(U=N.charCodeAt(oe+1),U===33){if(B=N.charCodeAt(oe+2),B===91&&N.substr(oe+3,6)==="CDATA["){if(de=N.indexOf("]]>",oe),de===-1)return z?N.substring(oe):L("unclosed cdata");if(o&&(o(N.substring(oe+9,de),p),E))return;de+=3;continue}if(B===45&&N.charCodeAt(oe+3)===45){if(de=N.indexOf("-->",oe),de===-1)return z?N.substring(oe):L("unclosed comment");if(c&&(c(N.substring(oe+4,de),Sr,p),E))return;de+=3;continue}}if(U===63){if(de=N.indexOf("?>",oe),de===-1)return z?N.substring(oe):L("unclosed question");if(u&&(u(N.substring(oe,de+2),p),E))return;de+=2;continue}for(ee=oe+1;;ee++){if(Ae=N.charCodeAt(ee),isNaN(Ae))return z?N.substring(oe):(de=-1,L("unclosed tag"));if(Ae===34)B=N.indexOf('"',ee+1),ee=B!==-1?B:ee;else if(Ae===39)B=N.indexOf("'",ee+1),ee=B!==-1?B:ee;else if(Ae===62){de=ee;break}}if(U===33){if(l&&(l(N.substring(oe,de+1),Sr,p),E))return;de+=1;continue}if(W={},U===47){if(se=!1,fe=!0,!w.length)return L("missing open tag");if(ee=C=w.pop(),B=oe+2+ee.length,N.substring(oe+2,B)!==ee)return L("closing tag mismatch");for(;B<de;B++)if(U=N.charCodeAt(B),!(U===32||U>8&&U<14))return L("close tag")}else{if(N.charCodeAt(de-1)===47?(ee=C=N.substring(oe+1,de-1),se=!0,fe=!0):(ee=C=N.substring(oe+1,de),se=!0,fe=!1),!(U>96&&U<123||U>64&&U<91||U===95||U===58))return L("illegal first char nodeName");for(B=1,$=ee.length;B<$;B++)if(U=ee.charCodeAt(B),!(U>96&&U<123||U>64&&U<91||U>47&&U<59||U===45||U===95||U==46)){if(U===32||U<14&&U>8){C=ee.substring(0,B),W=null;break}return L("invalid nodeName")}fe||w.push(C)}if(g){tt=b,se&&(fe||x.push(tt),W===null&&(m=ee.indexOf("xmlns",B)!==-1)&&(I=B,k=ee,Te(),m=!1)),_=C,je!==b&&(ue=b[Xf],ue===void 0&&(ue=b[Xf]=Object.create(null)),je=b);var bt=ue[C];if(bt!==void 0)C=bt;else{if(U=C.indexOf(":"),U!==-1){if(wt=b[C.substring(0,U)],!wt)return L("missing namespace on <"+_+">");C=C.substr(U+1)}else wt=b.xmlns;wt&&(C=wt+":"+C),ue[_]=C}}if(se&&(I=B,k=ee,i&&(t?i(y,Sr,fe,p):i(C,Te,Sr,fe,p),E)))return;if(fe){if(r&&(r(t?y:C,Sr,se,p),E))return;g&&(se?b=tt:b=x.pop())}de+=1}}}function Qf(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var Au={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},Jf="property";function ed(e){return e.xml&&e.xml.serialize}function Kx(e){const t=ed(e);return t!==Jf&&(t||null)}function Xx(e){return e.charAt(0).toUpperCase()+e.slice(1)}function td(e,t){return Qf(t)?e.prefix+":"+Xx(e.localName):e.name}function Zx(e,t){var n=e.name,i=e.localName,r=t&&t.xml&&t.xml.typePrefix;return r&&i.indexOf(r)===0?e.prefix+":"+i.slice(r.length):n}function Qx(e,t,n){const i=rn(e,t.xmlns),r=`${t[i.prefix]||i.prefix}:${i.localName}`,o=rn(r);var a=n.getPackage(o.prefix);return Zx(o,a)}function Vi(e){return new Error(e)}function wi(e){return e.$descriptor}function Jx(e){D(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw Vi("expected element");var n=this.elementsById,i=wi(t),r=i.idProperty,o;if(r&&(o=t.get(r.name),o)){if(!/^([a-z][\w-.]*:)?[a-z_][\w-.]*$/i.test(o))throw new Error("illegal ID <"+o+">");if(n[o])throw Vi("duplicate ID <"+o+">");n[o]=t}},this.addWarning=function(t){this.warnings.push(t)}}function jo(){}jo.prototype.handleEnd=function(){},jo.prototype.handleText=function(){},jo.prototype.handleNode=function(){};function Tu(){}Tu.prototype=Object.create(jo.prototype),Tu.prototype.handleNode=function(){return this};function Qr(){}Qr.prototype=Object.create(jo.prototype),Qr.prototype.handleText=function(e){this.body=(this.body||"")+e};function Fo(e,t){this.property=e,this.context=t}Fo.prototype=Object.create(Qr.prototype),Fo.prototype.handleNode=function(e){if(this.element)throw Vi("expected no sub nodes");return this.element=this.createReference(e),this},Fo.prototype.handleEnd=function(){this.element.id=this.body},Fo.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function Mu(e,t){this.element=t,this.propertyDesc=e}Mu.prototype=Object.create(Qr.prototype),Mu.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=Su(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function Za(){}Za.prototype=Object.create(Qr.prototype),Za.prototype.handleNode=function(e){var t=this,n=this.element;return n?t=this.handleChild(e):(n=this.element=this.createElement(e),this.context.addElement(n)),t};function ln(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}ln.prototype=Object.create(Za.prototype),ln.prototype.addReference=function(e){this.context.addReference(e)},ln.prototype.handleText=function(e){var t=this.element,n=wi(t),i=n.bodyProperty;if(!i)throw Vi("unexpected body text <"+e+">");Qr.prototype.handleText.call(this,e)},ln.prototype.handleEnd=function(){var e=this.body,t=this.element,n=wi(t),i=n.bodyProperty;i&&e!==void 0&&(e=Su(i.type,e),t.set(i.name,e))},ln.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=wi(n),r=this.context,o=new n({}),a=this.model,s;return M(t,function(c,u){var l=i.propertiesByName[u],p;l&&l.isReference?l.isMany?(p=c.split(" "),M(p,function(f){r.addReference({element:o,property:l.ns.name,id:f})})):r.addReference({element:o,property:l.ns.name,id:c}):(l?c=Su(l.type,c):u==="xmlns"?u=":"+u:(s=rn(u,i.ns.prefix),a.getPackage(s.prefix)&&r.addWarning({message:"unknown attribute <"+u+">",element:o,property:u,value:c})),o.set(u,c))}),o},ln.prototype.getPropertyForNode=function(e){var t=e.name,n=rn(t),i=this.type,r=this.model,o=wi(i),a=n.name,s=o.propertiesByName[a];if(s&&!s.isAttr){const u=Kx(s);if(u){const l=e.attributes[u];if(l){const p=Qx(l,e.ns,r),f=r.getType(p);return D({},s,{effectiveType:wi(f).name})}}return s}var c=r.getPackage(n.prefix);if(c){const u=td(n,c),l=r.getType(u);if(s=at(o.properties,function(p){return!p.isVirtual&&!p.isReference&&!p.isAttribute&&l.hasType(p.type)}),s)return D({},s,{effectiveType:wi(l).name})}else if(s=at(o.properties,function(u){return!u.isReference&&!u.isAttribute&&u.type==="Element"}),s)return s;throw Vi("unrecognized element <"+n.name+">")},ln.prototype.toString=function(){return"ElementDescriptor["+wi(this.type).name+"]"},ln.prototype.valueHandler=function(e,t){return new Mu(e,t)},ln.prototype.referenceHandler=function(e){return new Fo(e,this.context)},ln.prototype.handler=function(e){return e==="Element"?new Jr(this.model,e,this.context):new ln(this.model,e,this.context)},ln.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,Wf(n))return this.valueHandler(t,i);t.isReference?r=this.referenceHandler(t).handleNode(e):r=this.handler(n).handleNode(e);var o=r.element;return o!==void 0&&(t.isMany?i.get(t.name).push(o):i.set(t.name,o),t.isReference?(D(o,{element:i}),this.context.addReference(o)):o.$parent=i),r};function ku(e,t,n){ln.call(this,e,t,n)}ku.prototype=Object.create(ln.prototype),ku.prototype.createElement=function(e){var t=e.name,n=rn(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&td(n,o)||t;if(!r.hasType(a))throw Vi("unexpected element <"+e.originalName+">");return ln.prototype.createElement.call(this,e)};function Jr(e,t,n){this.model=e,this.context=n}Jr.prototype=Object.create(Za.prototype),Jr.prototype.createElement=function(e){var t=e.name,n=rn(t),i=n.prefix,r=e.ns[i+"$uri"],o=e.attributes;return this.model.createAny(t,r,o)},Jr.prototype.handleChild=function(e){var t=new Jr(this.model,"Element",this.context).handleNode(e),n=this.element,i=t.element,r;return i!==void 0&&(r=n.$children=n.$children||[],r.push(i),i.$parent=n),t},Jr.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function Du(e){e instanceof $n&&(e={model:e}),D(this,{lax:!1},e)}Du.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof ln?(i=t,t={}):typeof t=="string"?(i=this.handler(t),t={}):typeof i=="string"&&(i=this.handler(i));var r=this.model,o=this.lax,a=new Jx(D({},t,{rootHandler:i})),s=new Zf({proxy:!0}),c=e0();i.context=a,c.push(i);function u(w,T,L){var A=T(),F=A.line,H=A.column,N=A.data;N.charAt(0)==="<"&&N.indexOf(" ")!==-1&&(N=N.slice(0,N.indexOf(" "))+">");var z="unparsable content "+(N?N+" ":"")+`detected
|
|
2
2
|
line: `+F+`
|
|
3
|
-
column: `+
|
|
4
|
-
nested error: `+
|
|
5
|
-
`,
|
|
6
|
-
`),this},this.appendIndent=function(){return t&&e.write(n.join(" ")),this},this.indent=function(){return n.push(""),this},this.unindent=function(){return n.pop(),this}}function cb(e){e=D({format:!1,preamble:!0},e||{});function t(n,i){var r=i||new ab,o=new sb(r,e.format);e.preamble&&o.append(U_);var a=new Le,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(ub(s)),a.build(n).serializeTo(o),!i)return r.value}return{toXML:t}}function ub(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in lc)n[i]=lc[i];for(const i in t){const r=t[i];n[r]=i}for(const i of e.getPackages())n[i.prefix]=i.uri;return n}function qo(e,t){Wt.call(this,e,t)}qo.prototype=Object.create(Wt.prototype),qo.prototype.fromXML=function(e,t,n){Tt(t)||(n=t,t="bpmn:Definitions");var i=new hc(D({model:this,lax:!0},n)),r=i.handler(t);return i.fromXML(e,r)},qo.prototype.toXML=function(e,t){var n=new cb(t);return new Promise(function(i,r){try{var o=n.toXML(e);return i({xml:o})}catch(a){return r(a)}})};var lb="BPMN20",pb="http://www.omg.org/spec/BPMN/20100524/MODEL",fb="bpmn",db=[],hb=[{name:"Interface",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"operations",type:"Operation",isMany:!0},{name:"implementationRef",isAttr:!0,type:"String"}]},{name:"Operation",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"inMessageRef",type:"Message",isReference:!0},{name:"outMessageRef",type:"Message",isReference:!0},{name:"errorRef",type:"Error",isMany:!0,isReference:!0},{name:"implementationRef",isAttr:!0,type:"String"}]},{name:"EndPoint",superClass:["RootElement"]},{name:"Auditing",superClass:["BaseElement"]},{name:"GlobalTask",superClass:["CallableElement"],properties:[{name:"resources",type:"ResourceRole",isMany:!0}]},{name:"Monitoring",superClass:["BaseElement"]},{name:"Performer",superClass:["ResourceRole"]},{name:"Process",superClass:["FlowElementsContainer","CallableElement"],properties:[{name:"processType",type:"ProcessType",isAttr:!0},{name:"isClosed",isAttr:!0,type:"Boolean"},{name:"auditing",type:"Auditing"},{name:"monitoring",type:"Monitoring"},{name:"properties",type:"Property",isMany:!0},{name:"laneSets",isMany:!0,replaces:"FlowElementsContainer#laneSets",type:"LaneSet"},{name:"flowElements",isMany:!0,replaces:"FlowElementsContainer#flowElements",type:"FlowElement"},{name:"artifacts",type:"Artifact",isMany:!0},{name:"resources",type:"ResourceRole",isMany:!0},{name:"correlationSubscriptions",type:"CorrelationSubscription",isMany:!0},{name:"supports",type:"Process",isMany:!0,isReference:!0},{name:"definitionalCollaborationRef",type:"Collaboration",isAttr:!0,isReference:!0},{name:"isExecutable",isAttr:!0,type:"Boolean"}]},{name:"LaneSet",superClass:["BaseElement"],properties:[{name:"lanes",type:"Lane",isMany:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Lane",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"partitionElementRef",type:"BaseElement",isAttr:!0,isReference:!0},{name:"partitionElement",type:"BaseElement"},{name:"flowNodeRef",type:"FlowNode",isMany:!0,isReference:!0},{name:"childLaneSet",type:"LaneSet",xml:{serialize:"xsi:type"}}]},{name:"GlobalManualTask",superClass:["GlobalTask"]},{name:"ManualTask",superClass:["Task"]},{name:"UserTask",superClass:["Task"],properties:[{name:"renderings",type:"Rendering",isMany:!0},{name:"implementation",isAttr:!0,type:"String"}]},{name:"Rendering",superClass:["BaseElement"]},{name:"HumanPerformer",superClass:["Performer"]},{name:"PotentialOwner",superClass:["HumanPerformer"]},{name:"GlobalUserTask",superClass:["GlobalTask"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"renderings",type:"Rendering",isMany:!0}]},{name:"Gateway",isAbstract:!0,superClass:["FlowNode"],properties:[{name:"gatewayDirection",type:"GatewayDirection",default:"Unspecified",isAttr:!0}]},{name:"EventBasedGateway",superClass:["Gateway"],properties:[{name:"instantiate",default:!1,isAttr:!0,type:"Boolean"},{name:"eventGatewayType",type:"EventBasedGatewayType",isAttr:!0,default:"Exclusive"}]},{name:"ComplexGateway",superClass:["Gateway"],properties:[{name:"activationCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0}]},{name:"ExclusiveGateway",superClass:["Gateway"],properties:[{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0}]},{name:"InclusiveGateway",superClass:["Gateway"],properties:[{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0}]},{name:"ParallelGateway",superClass:["Gateway"]},{name:"RootElement",isAbstract:!0,superClass:["BaseElement"]},{name:"Relationship",superClass:["BaseElement"],properties:[{name:"type",isAttr:!0,type:"String"},{name:"direction",type:"RelationshipDirection",isAttr:!0},{name:"source",isMany:!0,isReference:!0,type:"Element"},{name:"target",isMany:!0,isReference:!0,type:"Element"}]},{name:"BaseElement",isAbstract:!0,properties:[{name:"id",isAttr:!0,type:"String",isId:!0},{name:"documentation",type:"Documentation",isMany:!0},{name:"extensionDefinitions",type:"ExtensionDefinition",isMany:!0,isReference:!0},{name:"extensionElements",type:"ExtensionElements"}]},{name:"Extension",properties:[{name:"mustUnderstand",default:!1,isAttr:!0,type:"Boolean"},{name:"definition",type:"ExtensionDefinition",isAttr:!0,isReference:!0}]},{name:"ExtensionDefinition",properties:[{name:"name",isAttr:!0,type:"String"},{name:"extensionAttributeDefinitions",type:"ExtensionAttributeDefinition",isMany:!0}]},{name:"ExtensionAttributeDefinition",properties:[{name:"name",isAttr:!0,type:"String"},{name:"type",isAttr:!0,type:"String"},{name:"isReference",default:!1,isAttr:!0,type:"Boolean"},{name:"extensionDefinition",type:"ExtensionDefinition",isAttr:!0,isReference:!0}]},{name:"ExtensionElements",properties:[{name:"valueRef",isAttr:!0,isReference:!0,type:"Element"},{name:"values",type:"Element",isMany:!0},{name:"extensionAttributeDefinition",type:"ExtensionAttributeDefinition",isAttr:!0,isReference:!0}]},{name:"Documentation",superClass:["BaseElement"],properties:[{name:"text",type:"String",isBody:!0},{name:"textFormat",default:"text/plain",isAttr:!0,type:"String"}]},{name:"Event",isAbstract:!0,superClass:["FlowNode","InteractionNode"],properties:[{name:"properties",type:"Property",isMany:!0}]},{name:"IntermediateCatchEvent",superClass:["CatchEvent"]},{name:"IntermediateThrowEvent",superClass:["ThrowEvent"]},{name:"EndEvent",superClass:["ThrowEvent"]},{name:"StartEvent",superClass:["CatchEvent"],properties:[{name:"isInterrupting",default:!0,isAttr:!0,type:"Boolean"}]},{name:"ThrowEvent",isAbstract:!0,superClass:["Event"],properties:[{name:"dataInputs",type:"DataInput",isMany:!0},{name:"dataInputAssociations",type:"DataInputAssociation",isMany:!0},{name:"inputSet",type:"InputSet"},{name:"eventDefinitions",type:"EventDefinition",isMany:!0},{name:"eventDefinitionRef",type:"EventDefinition",isMany:!0,isReference:!0}]},{name:"CatchEvent",isAbstract:!0,superClass:["Event"],properties:[{name:"parallelMultiple",isAttr:!0,type:"Boolean",default:!1},{name:"dataOutputs",type:"DataOutput",isMany:!0},{name:"dataOutputAssociations",type:"DataOutputAssociation",isMany:!0},{name:"outputSet",type:"OutputSet"},{name:"eventDefinitions",type:"EventDefinition",isMany:!0},{name:"eventDefinitionRef",type:"EventDefinition",isMany:!0,isReference:!0}]},{name:"BoundaryEvent",superClass:["CatchEvent"],properties:[{name:"cancelActivity",default:!0,isAttr:!0,type:"Boolean"},{name:"attachedToRef",type:"Activity",isAttr:!0,isReference:!0}]},{name:"EventDefinition",isAbstract:!0,superClass:["RootElement"]},{name:"CancelEventDefinition",superClass:["EventDefinition"]},{name:"ErrorEventDefinition",superClass:["EventDefinition"],properties:[{name:"errorRef",type:"Error",isAttr:!0,isReference:!0}]},{name:"TerminateEventDefinition",superClass:["EventDefinition"]},{name:"EscalationEventDefinition",superClass:["EventDefinition"],properties:[{name:"escalationRef",type:"Escalation",isAttr:!0,isReference:!0}]},{name:"Escalation",properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"},{name:"escalationCode",isAttr:!0,type:"String"}],superClass:["RootElement"]},{name:"CompensateEventDefinition",superClass:["EventDefinition"],properties:[{name:"waitForCompletion",isAttr:!0,type:"Boolean",default:!0},{name:"activityRef",type:"Activity",isAttr:!0,isReference:!0}]},{name:"TimerEventDefinition",superClass:["EventDefinition"],properties:[{name:"timeDate",type:"Expression",xml:{serialize:"xsi:type"}},{name:"timeCycle",type:"Expression",xml:{serialize:"xsi:type"}},{name:"timeDuration",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"LinkEventDefinition",superClass:["EventDefinition"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"target",type:"LinkEventDefinition",isReference:!0},{name:"source",type:"LinkEventDefinition",isMany:!0,isReference:!0}]},{name:"MessageEventDefinition",superClass:["EventDefinition"],properties:[{name:"messageRef",type:"Message",isAttr:!0,isReference:!0},{name:"operationRef",type:"Operation",isReference:!0}]},{name:"ConditionalEventDefinition",superClass:["EventDefinition"],properties:[{name:"condition",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"SignalEventDefinition",superClass:["EventDefinition"],properties:[{name:"signalRef",type:"Signal",isAttr:!0,isReference:!0}]},{name:"Signal",superClass:["RootElement"],properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"ImplicitThrowEvent",superClass:["ThrowEvent"]},{name:"DataState",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"}]},{name:"ItemAwareElement",superClass:["BaseElement"],properties:[{name:"itemSubjectRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"dataState",type:"DataState"}]},{name:"DataAssociation",superClass:["BaseElement"],properties:[{name:"sourceRef",type:"ItemAwareElement",isMany:!0,isReference:!0},{name:"targetRef",type:"ItemAwareElement",isReference:!0},{name:"transformation",type:"FormalExpression",xml:{serialize:"property"}},{name:"assignment",type:"Assignment",isMany:!0}]},{name:"DataInput",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"inputSetRef",type:"InputSet",isMany:!0,isVirtual:!0,isReference:!0},{name:"inputSetWithOptional",type:"InputSet",isMany:!0,isVirtual:!0,isReference:!0},{name:"inputSetWithWhileExecuting",type:"InputSet",isMany:!0,isVirtual:!0,isReference:!0}]},{name:"DataOutput",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"outputSetRef",type:"OutputSet",isMany:!0,isVirtual:!0,isReference:!0},{name:"outputSetWithOptional",type:"OutputSet",isMany:!0,isVirtual:!0,isReference:!0},{name:"outputSetWithWhileExecuting",type:"OutputSet",isMany:!0,isVirtual:!0,isReference:!0}]},{name:"InputSet",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"dataInputRefs",type:"DataInput",isMany:!0,isReference:!0},{name:"optionalInputRefs",type:"DataInput",isMany:!0,isReference:!0},{name:"whileExecutingInputRefs",type:"DataInput",isMany:!0,isReference:!0},{name:"outputSetRefs",type:"OutputSet",isMany:!0,isReference:!0}]},{name:"OutputSet",superClass:["BaseElement"],properties:[{name:"dataOutputRefs",type:"DataOutput",isMany:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"},{name:"inputSetRefs",type:"InputSet",isMany:!0,isReference:!0},{name:"optionalOutputRefs",type:"DataOutput",isMany:!0,isReference:!0},{name:"whileExecutingOutputRefs",type:"DataOutput",isMany:!0,isReference:!0}]},{name:"Property",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"}]},{name:"DataInputAssociation",superClass:["DataAssociation"]},{name:"DataOutputAssociation",superClass:["DataAssociation"]},{name:"InputOutputSpecification",superClass:["BaseElement"],properties:[{name:"dataInputs",type:"DataInput",isMany:!0},{name:"dataOutputs",type:"DataOutput",isMany:!0},{name:"inputSets",type:"InputSet",isMany:!0},{name:"outputSets",type:"OutputSet",isMany:!0}]},{name:"DataObject",superClass:["FlowElement","ItemAwareElement"],properties:[{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"}]},{name:"InputOutputBinding",properties:[{name:"inputDataRef",type:"InputSet",isAttr:!0,isReference:!0},{name:"outputDataRef",type:"OutputSet",isAttr:!0,isReference:!0},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0}]},{name:"Assignment",superClass:["BaseElement"],properties:[{name:"from",type:"Expression",xml:{serialize:"xsi:type"}},{name:"to",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"DataStore",superClass:["RootElement","ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"capacity",isAttr:!0,type:"Integer"},{name:"isUnlimited",default:!0,isAttr:!0,type:"Boolean"}]},{name:"DataStoreReference",superClass:["ItemAwareElement","FlowElement"],properties:[{name:"dataStoreRef",type:"DataStore",isAttr:!0,isReference:!0}]},{name:"DataObjectReference",superClass:["ItemAwareElement","FlowElement"],properties:[{name:"dataObjectRef",type:"DataObject",isAttr:!0,isReference:!0}]},{name:"ConversationLink",superClass:["BaseElement"],properties:[{name:"sourceRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"ConversationAssociation",superClass:["BaseElement"],properties:[{name:"innerConversationNodeRef",type:"ConversationNode",isAttr:!0,isReference:!0},{name:"outerConversationNodeRef",type:"ConversationNode",isAttr:!0,isReference:!0}]},{name:"CallConversation",superClass:["ConversationNode"],properties:[{name:"calledCollaborationRef",type:"Collaboration",isAttr:!0,isReference:!0},{name:"participantAssociations",type:"ParticipantAssociation",isMany:!0}]},{name:"Conversation",superClass:["ConversationNode"]},{name:"SubConversation",superClass:["ConversationNode"],properties:[{name:"conversationNodes",type:"ConversationNode",isMany:!0}]},{name:"ConversationNode",isAbstract:!0,superClass:["InteractionNode","BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"participantRef",type:"Participant",isMany:!0,isReference:!0},{name:"messageFlowRefs",type:"MessageFlow",isMany:!0,isReference:!0},{name:"correlationKeys",type:"CorrelationKey",isMany:!0}]},{name:"GlobalConversation",superClass:["Collaboration"]},{name:"PartnerEntity",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"participantRef",type:"Participant",isMany:!0,isReference:!0}]},{name:"PartnerRole",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"participantRef",type:"Participant",isMany:!0,isReference:!0}]},{name:"CorrelationProperty",superClass:["RootElement"],properties:[{name:"correlationPropertyRetrievalExpression",type:"CorrelationPropertyRetrievalExpression",isMany:!0},{name:"name",isAttr:!0,type:"String"},{name:"type",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"Error",superClass:["RootElement"],properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"},{name:"errorCode",isAttr:!0,type:"String"}]},{name:"CorrelationKey",superClass:["BaseElement"],properties:[{name:"correlationPropertyRef",type:"CorrelationProperty",isMany:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Expression",superClass:["BaseElement"],isAbstract:!1,properties:[{name:"body",isBody:!0,type:"String"}]},{name:"FormalExpression",superClass:["Expression"],properties:[{name:"language",isAttr:!0,type:"String"},{name:"evaluatesToTypeRef",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"Message",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"itemRef",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"ItemDefinition",superClass:["RootElement"],properties:[{name:"itemKind",type:"ItemKind",isAttr:!0},{name:"structureRef",isAttr:!0,type:"String"},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"import",type:"Import",isAttr:!0,isReference:!0}]},{name:"FlowElement",isAbstract:!0,superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"auditing",type:"Auditing"},{name:"monitoring",type:"Monitoring"},{name:"categoryValueRef",type:"CategoryValue",isMany:!0,isReference:!0}]},{name:"SequenceFlow",superClass:["FlowElement"],properties:[{name:"isImmediate",isAttr:!0,type:"Boolean"},{name:"conditionExpression",type:"Expression",xml:{serialize:"xsi:type"}},{name:"sourceRef",type:"FlowNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"FlowNode",isAttr:!0,isReference:!0}]},{name:"FlowElementsContainer",isAbstract:!0,superClass:["BaseElement"],properties:[{name:"laneSets",type:"LaneSet",isMany:!0},{name:"flowElements",type:"FlowElement",isMany:!0}]},{name:"CallableElement",isAbstract:!0,superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"ioSpecification",type:"InputOutputSpecification",xml:{serialize:"property"}},{name:"supportedInterfaceRef",type:"Interface",isMany:!0,isReference:!0},{name:"ioBinding",type:"InputOutputBinding",isMany:!0,xml:{serialize:"property"}}]},{name:"FlowNode",isAbstract:!0,superClass:["FlowElement"],properties:[{name:"incoming",type:"SequenceFlow",isMany:!0,isReference:!0},{name:"outgoing",type:"SequenceFlow",isMany:!0,isReference:!0},{name:"lanes",type:"Lane",isMany:!0,isVirtual:!0,isReference:!0}]},{name:"CorrelationPropertyRetrievalExpression",superClass:["BaseElement"],properties:[{name:"messagePath",type:"FormalExpression"},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"CorrelationPropertyBinding",superClass:["BaseElement"],properties:[{name:"dataPath",type:"FormalExpression"},{name:"correlationPropertyRef",type:"CorrelationProperty",isAttr:!0,isReference:!0}]},{name:"Resource",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"resourceParameters",type:"ResourceParameter",isMany:!0}]},{name:"ResourceParameter",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isRequired",isAttr:!0,type:"Boolean"},{name:"type",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"CorrelationSubscription",superClass:["BaseElement"],properties:[{name:"correlationKeyRef",type:"CorrelationKey",isAttr:!0,isReference:!0},{name:"correlationPropertyBinding",type:"CorrelationPropertyBinding",isMany:!0}]},{name:"MessageFlow",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"sourceRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"MessageFlowAssociation",superClass:["BaseElement"],properties:[{name:"innerMessageFlowRef",type:"MessageFlow",isAttr:!0,isReference:!0},{name:"outerMessageFlowRef",type:"MessageFlow",isAttr:!0,isReference:!0}]},{name:"InteractionNode",isAbstract:!0,properties:[{name:"incomingConversationLinks",type:"ConversationLink",isMany:!0,isVirtual:!0,isReference:!0},{name:"outgoingConversationLinks",type:"ConversationLink",isMany:!0,isVirtual:!0,isReference:!0}]},{name:"Participant",superClass:["InteractionNode","BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"interfaceRef",type:"Interface",isMany:!0,isReference:!0},{name:"participantMultiplicity",type:"ParticipantMultiplicity"},{name:"endPointRefs",type:"EndPoint",isMany:!0,isReference:!0},{name:"processRef",type:"Process",isAttr:!0,isReference:!0}]},{name:"ParticipantAssociation",superClass:["BaseElement"],properties:[{name:"innerParticipantRef",type:"Participant",isAttr:!0,isReference:!0},{name:"outerParticipantRef",type:"Participant",isAttr:!0,isReference:!0}]},{name:"ParticipantMultiplicity",properties:[{name:"minimum",default:0,isAttr:!0,type:"Integer"},{name:"maximum",default:1,isAttr:!0,type:"Integer"}],superClass:["BaseElement"]},{name:"Collaboration",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isClosed",isAttr:!0,type:"Boolean"},{name:"participants",type:"Participant",isMany:!0},{name:"messageFlows",type:"MessageFlow",isMany:!0},{name:"artifacts",type:"Artifact",isMany:!0},{name:"conversations",type:"ConversationNode",isMany:!0},{name:"conversationAssociations",type:"ConversationAssociation"},{name:"participantAssociations",type:"ParticipantAssociation",isMany:!0},{name:"messageFlowAssociations",type:"MessageFlowAssociation",isMany:!0},{name:"correlationKeys",type:"CorrelationKey",isMany:!0},{name:"choreographyRef",type:"Choreography",isMany:!0,isReference:!0},{name:"conversationLinks",type:"ConversationLink",isMany:!0}]},{name:"ChoreographyActivity",isAbstract:!0,superClass:["FlowNode"],properties:[{name:"participantRef",type:"Participant",isMany:!0,isReference:!0},{name:"initiatingParticipantRef",type:"Participant",isAttr:!0,isReference:!0},{name:"correlationKeys",type:"CorrelationKey",isMany:!0},{name:"loopType",type:"ChoreographyLoopType",default:"None",isAttr:!0}]},{name:"CallChoreography",superClass:["ChoreographyActivity"],properties:[{name:"calledChoreographyRef",type:"Choreography",isAttr:!0,isReference:!0},{name:"participantAssociations",type:"ParticipantAssociation",isMany:!0}]},{name:"SubChoreography",superClass:["ChoreographyActivity","FlowElementsContainer"],properties:[{name:"artifacts",type:"Artifact",isMany:!0}]},{name:"ChoreographyTask",superClass:["ChoreographyActivity"],properties:[{name:"messageFlowRef",type:"MessageFlow",isMany:!0,isReference:!0}]},{name:"Choreography",superClass:["Collaboration","FlowElementsContainer"]},{name:"GlobalChoreographyTask",superClass:["Choreography"],properties:[{name:"initiatingParticipantRef",type:"Participant",isAttr:!0,isReference:!0}]},{name:"TextAnnotation",superClass:["Artifact"],properties:[{name:"text",type:"String"},{name:"textFormat",default:"text/plain",isAttr:!0,type:"String"}]},{name:"Group",superClass:["Artifact"],properties:[{name:"categoryValueRef",type:"CategoryValue",isAttr:!0,isReference:!0}]},{name:"Association",superClass:["Artifact"],properties:[{name:"associationDirection",type:"AssociationDirection",isAttr:!0},{name:"sourceRef",type:"BaseElement",isAttr:!0,isReference:!0},{name:"targetRef",type:"BaseElement",isAttr:!0,isReference:!0}]},{name:"Category",superClass:["RootElement"],properties:[{name:"categoryValue",type:"CategoryValue",isMany:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Artifact",isAbstract:!0,superClass:["BaseElement"]},{name:"CategoryValue",superClass:["BaseElement"],properties:[{name:"categorizedFlowElements",type:"FlowElement",isMany:!0,isVirtual:!0,isReference:!0},{name:"value",isAttr:!0,type:"String"}]},{name:"Activity",isAbstract:!0,superClass:["FlowNode"],properties:[{name:"isForCompensation",default:!1,isAttr:!0,type:"Boolean"},{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0},{name:"ioSpecification",type:"InputOutputSpecification",xml:{serialize:"property"}},{name:"boundaryEventRefs",type:"BoundaryEvent",isMany:!0,isReference:!0},{name:"properties",type:"Property",isMany:!0},{name:"dataInputAssociations",type:"DataInputAssociation",isMany:!0},{name:"dataOutputAssociations",type:"DataOutputAssociation",isMany:!0},{name:"startQuantity",default:1,isAttr:!0,type:"Integer"},{name:"resources",type:"ResourceRole",isMany:!0},{name:"completionQuantity",default:1,isAttr:!0,type:"Integer"},{name:"loopCharacteristics",type:"LoopCharacteristics"}]},{name:"ServiceTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0}]},{name:"SubProcess",superClass:["Activity","FlowElementsContainer","InteractionNode"],properties:[{name:"triggeredByEvent",default:!1,isAttr:!0,type:"Boolean"},{name:"artifacts",type:"Artifact",isMany:!0}]},{name:"LoopCharacteristics",isAbstract:!0,superClass:["BaseElement"]},{name:"MultiInstanceLoopCharacteristics",superClass:["LoopCharacteristics"],properties:[{name:"isSequential",default:!1,isAttr:!0,type:"Boolean"},{name:"behavior",type:"MultiInstanceBehavior",default:"All",isAttr:!0},{name:"loopCardinality",type:"Expression",xml:{serialize:"xsi:type"}},{name:"loopDataInputRef",type:"ItemAwareElement",isReference:!0},{name:"loopDataOutputRef",type:"ItemAwareElement",isReference:!0},{name:"inputDataItem",type:"DataInput",xml:{serialize:"property"}},{name:"outputDataItem",type:"DataOutput",xml:{serialize:"property"}},{name:"complexBehaviorDefinition",type:"ComplexBehaviorDefinition",isMany:!0},{name:"completionCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"oneBehaviorEventRef",type:"EventDefinition",isAttr:!0,isReference:!0},{name:"noneBehaviorEventRef",type:"EventDefinition",isAttr:!0,isReference:!0}]},{name:"StandardLoopCharacteristics",superClass:["LoopCharacteristics"],properties:[{name:"testBefore",default:!1,isAttr:!0,type:"Boolean"},{name:"loopCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"loopMaximum",type:"Integer",isAttr:!0}]},{name:"CallActivity",superClass:["Activity","InteractionNode"],properties:[{name:"calledElement",type:"String",isAttr:!0}]},{name:"Task",superClass:["Activity","InteractionNode"]},{name:"SendTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"ReceiveTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"instantiate",default:!1,isAttr:!0,type:"Boolean"},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"ScriptTask",superClass:["Task"],properties:[{name:"scriptFormat",isAttr:!0,type:"String"},{name:"script",type:"String"}]},{name:"BusinessRuleTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"}]},{name:"AdHocSubProcess",superClass:["SubProcess"],properties:[{name:"completionCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"ordering",type:"AdHocOrdering",isAttr:!0},{name:"cancelRemainingInstances",default:!0,isAttr:!0,type:"Boolean"}]},{name:"Transaction",superClass:["SubProcess"],properties:[{name:"protocol",isAttr:!0,type:"String"},{name:"method",isAttr:!0,type:"String"}]},{name:"GlobalScriptTask",superClass:["GlobalTask"],properties:[{name:"scriptLanguage",isAttr:!0,type:"String"},{name:"script",isAttr:!0,type:"String"}]},{name:"GlobalBusinessRuleTask",superClass:["GlobalTask"],properties:[{name:"implementation",isAttr:!0,type:"String"}]},{name:"ComplexBehaviorDefinition",superClass:["BaseElement"],properties:[{name:"condition",type:"FormalExpression"},{name:"event",type:"ImplicitThrowEvent"}]},{name:"ResourceRole",superClass:["BaseElement"],properties:[{name:"resourceRef",type:"Resource",isReference:!0},{name:"resourceParameterBindings",type:"ResourceParameterBinding",isMany:!0},{name:"resourceAssignmentExpression",type:"ResourceAssignmentExpression"},{name:"name",isAttr:!0,type:"String"}]},{name:"ResourceParameterBinding",properties:[{name:"expression",type:"Expression",xml:{serialize:"xsi:type"}},{name:"parameterRef",type:"ResourceParameter",isAttr:!0,isReference:!0}],superClass:["BaseElement"]},{name:"ResourceAssignmentExpression",properties:[{name:"expression",type:"Expression",xml:{serialize:"xsi:type"}}],superClass:["BaseElement"]},{name:"Import",properties:[{name:"importType",isAttr:!0,type:"String"},{name:"location",isAttr:!0,type:"String"},{name:"namespace",isAttr:!0,type:"String"}]},{name:"Definitions",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"targetNamespace",isAttr:!0,type:"String"},{name:"expressionLanguage",default:"http://www.w3.org/1999/XPath",isAttr:!0,type:"String"},{name:"typeLanguage",default:"http://www.w3.org/2001/XMLSchema",isAttr:!0,type:"String"},{name:"imports",type:"Import",isMany:!0},{name:"extensions",type:"Extension",isMany:!0},{name:"rootElements",type:"RootElement",isMany:!0},{name:"diagrams",isMany:!0,type:"bpmndi:BPMNDiagram"},{name:"exporter",isAttr:!0,type:"String"},{name:"relationships",type:"Relationship",isMany:!0},{name:"exporterVersion",isAttr:!0,type:"String"}]}],mb=[{name:"ProcessType",literalValues:[{name:"None"},{name:"Public"},{name:"Private"}]},{name:"GatewayDirection",literalValues:[{name:"Unspecified"},{name:"Converging"},{name:"Diverging"},{name:"Mixed"}]},{name:"EventBasedGatewayType",literalValues:[{name:"Parallel"},{name:"Exclusive"}]},{name:"RelationshipDirection",literalValues:[{name:"None"},{name:"Forward"},{name:"Backward"},{name:"Both"}]},{name:"ItemKind",literalValues:[{name:"Physical"},{name:"Information"}]},{name:"ChoreographyLoopType",literalValues:[{name:"None"},{name:"Standard"},{name:"MultiInstanceSequential"},{name:"MultiInstanceParallel"}]},{name:"AssociationDirection",literalValues:[{name:"None"},{name:"One"},{name:"Both"}]},{name:"MultiInstanceBehavior",literalValues:[{name:"None"},{name:"One"},{name:"All"},{name:"Complex"}]},{name:"AdHocOrdering",literalValues:[{name:"Parallel"},{name:"Sequential"}]}],gb={tagAlias:"lowerCase",typePrefix:"t"},vb={name:lb,uri:pb,prefix:fb,associations:db,types:hb,enumerations:mb,xml:gb},yb="BPMNDI",_b="http://www.omg.org/spec/BPMN/20100524/DI",bb="bpmndi",Eb=[{name:"BPMNDiagram",properties:[{name:"plane",type:"BPMNPlane",redefines:"di:Diagram#rootElement"},{name:"labelStyle",type:"BPMNLabelStyle",isMany:!0}],superClass:["di:Diagram"]},{name:"BPMNPlane",properties:[{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"}],superClass:["di:Plane"]},{name:"BPMNShape",properties:[{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"},{name:"isHorizontal",isAttr:!0,type:"Boolean"},{name:"isExpanded",isAttr:!0,type:"Boolean"},{name:"isMarkerVisible",isAttr:!0,type:"Boolean"},{name:"label",type:"BPMNLabel"},{name:"isMessageVisible",isAttr:!0,type:"Boolean"},{name:"participantBandKind",type:"ParticipantBandKind",isAttr:!0},{name:"choreographyActivityShape",type:"BPMNShape",isAttr:!0,isReference:!0}],superClass:["di:LabeledShape"]},{name:"BPMNEdge",properties:[{name:"label",type:"BPMNLabel"},{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"},{name:"sourceElement",isAttr:!0,isReference:!0,type:"di:DiagramElement",redefines:"di:Edge#source"},{name:"targetElement",isAttr:!0,isReference:!0,type:"di:DiagramElement",redefines:"di:Edge#target"},{name:"messageVisibleKind",type:"MessageVisibleKind",isAttr:!0,default:"initiating"}],superClass:["di:LabeledEdge"]},{name:"BPMNLabel",properties:[{name:"labelStyle",type:"BPMNLabelStyle",isAttr:!0,isReference:!0,redefines:"di:DiagramElement#style"}],superClass:["di:Label"]},{name:"BPMNLabelStyle",properties:[{name:"font",type:"dc:Font"}],superClass:["di:Style"]}],xb=[{name:"ParticipantBandKind",literalValues:[{name:"top_initiating"},{name:"middle_initiating"},{name:"bottom_initiating"},{name:"top_non_initiating"},{name:"middle_non_initiating"},{name:"bottom_non_initiating"}]},{name:"MessageVisibleKind",literalValues:[{name:"initiating"},{name:"non_initiating"}]}],wb=[],Sb={name:yb,uri:_b,prefix:bb,types:Eb,enumerations:xb,associations:wb},Rb="DC",Cb="http://www.omg.org/spec/DD/20100524/DC",Pb="dc",Ab=[{name:"Boolean"},{name:"Integer"},{name:"Real"},{name:"String"},{name:"Font",properties:[{name:"name",type:"String",isAttr:!0},{name:"size",type:"Real",isAttr:!0},{name:"isBold",type:"Boolean",isAttr:!0},{name:"isItalic",type:"Boolean",isAttr:!0},{name:"isUnderline",type:"Boolean",isAttr:!0},{name:"isStrikeThrough",type:"Boolean",isAttr:!0}]},{name:"Point",properties:[{name:"x",type:"Real",default:"0",isAttr:!0},{name:"y",type:"Real",default:"0",isAttr:!0}]},{name:"Bounds",properties:[{name:"x",type:"Real",default:"0",isAttr:!0},{name:"y",type:"Real",default:"0",isAttr:!0},{name:"width",type:"Real",isAttr:!0},{name:"height",type:"Real",isAttr:!0}]}],Tb=[],Mb={name:Rb,uri:Cb,prefix:Pb,types:Ab,associations:Tb},kb="DI",Db="http://www.omg.org/spec/DD/20100524/DI",Ob="di",Ib=[{name:"DiagramElement",isAbstract:!0,properties:[{name:"id",isAttr:!0,isId:!0,type:"String"},{name:"extension",type:"Extension"},{name:"owningDiagram",type:"Diagram",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"owningElement",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"modelElement",isReadOnly:!0,isVirtual:!0,isReference:!0,type:"Element"},{name:"style",type:"Style",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"ownedElement",type:"DiagramElement",isReadOnly:!0,isMany:!0,isVirtual:!0}]},{name:"Node",isAbstract:!0,superClass:["DiagramElement"]},{name:"Edge",isAbstract:!0,superClass:["DiagramElement"],properties:[{name:"source",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"target",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"waypoint",isUnique:!1,isMany:!0,type:"dc:Point",xml:{serialize:"xsi:type"}}]},{name:"Diagram",isAbstract:!0,properties:[{name:"id",isAttr:!0,isId:!0,type:"String"},{name:"rootElement",type:"DiagramElement",isReadOnly:!0,isVirtual:!0},{name:"name",isAttr:!0,type:"String"},{name:"documentation",isAttr:!0,type:"String"},{name:"resolution",isAttr:!0,type:"Real"},{name:"ownedStyle",type:"Style",isReadOnly:!0,isMany:!0,isVirtual:!0}]},{name:"Shape",isAbstract:!0,superClass:["Node"],properties:[{name:"bounds",type:"dc:Bounds"}]},{name:"Plane",isAbstract:!0,superClass:["Node"],properties:[{name:"planeElement",type:"DiagramElement",subsettedProperty:"DiagramElement-ownedElement",isMany:!0}]},{name:"LabeledEdge",isAbstract:!0,superClass:["Edge"],properties:[{name:"ownedLabel",type:"Label",isReadOnly:!0,subsettedProperty:"DiagramElement-ownedElement",isMany:!0,isVirtual:!0}]},{name:"LabeledShape",isAbstract:!0,superClass:["Shape"],properties:[{name:"ownedLabel",type:"Label",isReadOnly:!0,subsettedProperty:"DiagramElement-ownedElement",isMany:!0,isVirtual:!0}]},{name:"Label",isAbstract:!0,superClass:["Node"],properties:[{name:"bounds",type:"dc:Bounds"}]},{name:"Style",isAbstract:!0,properties:[{name:"id",isAttr:!0,isId:!0,type:"String"}]},{name:"Extension",properties:[{name:"values",isMany:!0,type:"Element"}]}],Lb=[],Bb={tagAlias:"lowerCase"},Nb={name:kb,uri:Db,prefix:Ob,types:Ib,associations:Lb,xml:Bb},$b="bpmn.io colors for BPMN",jb="http://bpmn.io/schema/bpmn/biocolor/1.0",Fb="bioc",Hb=[{name:"ColoredShape",extends:["bpmndi:BPMNShape"],properties:[{name:"stroke",isAttr:!0,type:"String"},{name:"fill",isAttr:!0,type:"String"}]},{name:"ColoredEdge",extends:["bpmndi:BPMNEdge"],properties:[{name:"stroke",isAttr:!0,type:"String"},{name:"fill",isAttr:!0,type:"String"}]}],zb=[],Vb=[],Gb={name:$b,uri:jb,prefix:Fb,types:Hb,enumerations:zb,associations:Vb},Wb="BPMN in Color",Ub="http://www.omg.org/spec/BPMN/non-normative/color/1.0",qb="color",Yb=[{name:"ColoredLabel",extends:["bpmndi:BPMNLabel"],properties:[{name:"color",isAttr:!0,type:"String"}]},{name:"ColoredShape",extends:["bpmndi:BPMNShape"],properties:[{name:"background-color",isAttr:!0,type:"String"},{name:"border-color",isAttr:!0,type:"String"}]},{name:"ColoredEdge",extends:["bpmndi:BPMNEdge"],properties:[{name:"border-color",isAttr:!0,type:"String"}]}],Kb=[],Xb=[],Zb={name:Wb,uri:Ub,prefix:qb,types:Yb,enumerations:Kb,associations:Xb};const Qb={bpmn:vb,bpmndi:Sb,dc:Mb,di:Nb,bioc:Gb,color:Zb};function zp(e,t){const n=D({},Qb,e);return new qo(n,t)}const Jb={name:"bpmn-i18n",uri:"http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",prefix:"i18n",types:[{name:"Translation",superClass:["Element"],properties:[{name:"id",isAttr:!0,isId:!0,type:"String"},{name:"body",isBody:!0,type:"String"},{name:"target",isAttr:!0,type:"String",default:"@name"},{name:"textFormat",isAttr:"true",type:"String",default:"text/plain"}]}],enumerations:[],associations:[],xml:{tagAlias:"lowerCase",typePrefix:"t"}},e0="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",Vp="i18n",Yo={[Vp]:Jb,[Js]:lp};function Gp(){return zp(Yo)}const Wp=Gp();async function Up(e){const{rootElement:t,warnings:n}=await Wp.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function t0(e){const{xml:t}=await Wp.toXML(e,{format:!0});return t}function vc(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}function n0(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function i0(e,t){return typeof e.get=="function"?e.get(t):e[t]}function qp(e,t){const n=i0(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function Yp(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(r=>(r==null?void 0:r.$type)===t)}function r0(e){return typeof e=="string"&&ec.includes(e)}function dn(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function Kp(e){const t=e.rootElements??[],n=t.find(U=>U.$type==="bpmn:Collaboration"),i=new Map(t.filter(U=>U.$type==="bpmn:Process").map(U=>[U.id,U])),r=[],o=[],a=[],s=[],c=[],u=[],p={poolOrders:{},bands:{},placements:{}},l=[],f=[],d=[],h=[],v=[],_=[],S=new Set,w=new Set,E=U=>{U&&S.add(U)},b=U=>{S.add(U),w.add(U)},R=U=>{const ee=Yp(U,"bwl:Placement");if(!ee)return;const oe=typeof ee.anchor=="string"?ee.anchor:void 0;if(!oe||!r0(ee.side))return;const Q=typeof ee.offset=="number"?ee.offset:void 0;v.push({owner:U.id,anchor:oe,side:ee.side,...Q!==void 0?{offset:Q}:{}})},T=U=>{const ee=Yp(U,"bwl:Members"),oe=typeof(ee==null?void 0:ee.refs)=="string"?ee.refs.split(/\s+/).filter(Boolean):[];oe.length&&_.push({owner:U.id,refs:oe})},O=U=>{var ee;for(const oe of U)switch(E(oe.id),oe.$type){case"bpmn:TextAnnotation":b(oe.id),s.push({id:oe.id,text:typeof oe.text=="string"?oe.text:""}),R(oe);break;case"bpmn:Association":d.push({id:oe.id,type:oe.$type,source:dn(oe.sourceRef),target:dn(oe.targetRef)});break;case"bpmn:Group":{b(oe.id);const Q=(ee=oe.categoryValueRef)==null?void 0:ee.value;c.push({id:oe.id,...typeof Q=="string"&&Q?{name:Q}:{}}),T(oe);break}default:u.push({id:oe.id,type:oe.$type,reason:"type-outside-mvp"})}},C=(U,ee)=>{const oe=U.flowElements??[],Q=(U.laneSets??[]).flatMap(Y=>Y.lanes??[]),ne=new Map;for(const Y of Q){E(Y.id);for(const B of Y.flowNodeRef??[]){const L=dn(B);L&&ne.set(L,Y.id)}}for(const Y of oe){if(E(Y.id),Y.$type==="bpmn:SequenceFlow"){l.push({id:Y.id,source:dn(Y.sourceRef),target:dn(Y.targetRef),...typeof Y.name=="string"&&Y.name?{name:Y.name}:{}});continue}if(Y.$type==="bpmn:DataStoreReference"){b(Y.id),a.push({id:Y.id,...Y.name?{name:Y.name}:{}});continue}const B=n0(Y.$type);if(!cp(B)){u.push({id:Y.id,type:Y.$type,reason:"type-outside-mvp"});continue}b(Y.id),o.push({id:Y.id,type:B,...Y.name?{name:Y.name}:{},...ee?{participant:ee}:{},...ne.has(Y.id)?{lane:ne.get(Y.id)}:{}});const L=qp(Y,"bwl:band");L!==void 0&&(p.bands[Y.id]=L);for(const H of Y.dataOutputAssociations??[])E(H.id),h.push({id:H.id,type:H.$type,source:Y.id,target:dn(H.targetRef)});for(const H of Y.dataInputAssociations??[])E(H.id),h.push({id:H.id,type:H.$type,source:dn((H.sourceRef??[])[0]),target:Y.id})}O(U.artifacts??[])};if(n){const U=new Set;for(const ee of n.participants??[]){b(ee.id);const oe=dn(ee.processRef);oe&&U.add(oe);const Q=oe?i.get(oe):void 0,ne=((Q==null?void 0:Q.laneSets)??[]).flatMap(H=>H.lanes??[]),Y=ne.map(H=>({id:H.id,...H.name?{name:H.name}:{}}));for(const H of Y)b(H.id);const B=!Q||(Q.flowElements??[]).length===0&&ne.length===0&&(Q.artifacts??[]).length===0;r.push({id:ee.id,...ee.name?{name:ee.name}:{},...B?{blackBox:!0}:{},...Y.length?{lanes:Y}:{}});const L=qp(ee,"bwl:poolOrder");L!==void 0&&(p.poolOrders[ee.id]=L),Q&&C(Q,ee.id)}for(const ee of n.messageFlows??[])E(ee.id),f.push({id:ee.id,source:dn(ee.sourceRef),target:dn(ee.targetRef),...typeof ee.name=="string"&&ee.name?{name:ee.name}:{}});O(n.artifacts??[]);for(const[ee,oe]of i)!U.has(ee)&&(oe.flowElements??[]).length>0&&u.push({id:ee,type:oe.$type,reason:"unreachable-process"})}else for(const U of i.values())C(U);const F=[],N=[],I=[],W=[],re=(U,ee)=>!!U&&!!ee&&w.has(U)&&w.has(ee);for(const U of l){if(!re(U.source,U.target)){u.push({id:U.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}F.push({id:U.id,source:U.source,target:U.target,...U.name?{name:U.name}:{}}),w.add(U.id)}for(const U of f){if(!re(U.source,U.target)){u.push({id:U.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}N.push({id:U.id,source:U.source,target:U.target,...U.name?{name:U.name}:{}}),w.add(U.id)}for(const U of h){if(!re(U.source,U.target)){u.push({id:U.id??"",type:U.type,reason:"endpoint-outside-mvp"});continue}W.push({...U.id?{id:U.id}:{},source:U.source,target:U.target}),U.id&&w.add(U.id)}for(const U of d){if(!re(U.source,U.target)){u.push({id:U.id??"",type:U.type,reason:"endpoint-outside-mvp"});continue}I.push({...U.id?{id:U.id}:{},source:U.source,target:U.target})}const Pe=new Map(c.map(U=>[U.id,U]));for(const{owner:U,refs:ee}of _){const oe=ee.filter(ne=>S.has(ne)),Q=Pe.get(U);Q&&oe.length&&(Q.members=oe)}for(const U of v)S.has(U.anchor)&&(p.placements[U.owner]={anchor:U.anchor,side:U.side,...U.offset!==void 0?{offset:U.offset}:{}});return{definition:{...r.length?{participants:r}:{},nodes:o,sequenceFlows:F,...N.length?{messageFlows:N}:{},...a.length?{dataStores:a}:{},...W.length?{dataAssociations:W}:{},...s.length?{annotations:s}:{},...I.length?{associations:I}:{},...c.length?{groups:c}:{}},hints:p,omitted:u}}async function o0(e){const{definitions:t,warnings:n}=await Up(e);return{...Kp(t),warnings:n}}function a0(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function Xp(e,t,{currentVersion:n}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const i=xp(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??""}}const s0=Symbol("bpmn-editor");function c0(){const e=We.ref(!1),t=We.ref(!0),n=We.ref(!1);let i,r;const o=()=>{e.value=!0};function a(u,p){u.get("canvas").getContainer().style.pointerEvents=p?"":"none";const l=u.get("keyboard");p?(r&&l.bind(r),r=void 0):r||(r=l.getBinding(),l.unbind())}function s(){if(!i)throw new Error("modeler not attached — 뷰 @ready 후 attach() 필요");return i}function c(){return i==null?void 0:i.get("commandStack")}return{dirty:e,editable:t,agentBusy:n,attach(u){i&&this.detach(),i=u,i.get("eventBus").on("commandStack.changed",o),t.value||a(i,!1)},detach(){i==null||i.get("eventBus").off("commandStack.changed",o),i&&!t.value&&a(i,!0),r=void 0,i=void 0},setEditable(u){t.value=u,i&&a(i,u)},async applyAgentBatch(u,p){const l=s();n.value=!0;try{const f=await Xp(l,u,{currentVersion:p});return f.status==="applied"&&(e.value=!1),f}finally{n.value=!1}},async importXml(u){const{warnings:p}=await s().importXML(u);return e.value=!1,{warnings:vc(p)}},async saveXml(){const{xml:u}=await s().saveXML({format:!0});return e.value=!1,u??""},undo:()=>{var u;return(u=c())==null?void 0:u.undo()},redo:()=>{var u;return(u=c())==null?void 0:u.redo()},canUndo:()=>{var u;return((u=c())==null?void 0:u.canUndo())??!1},canRedo:()=>{var u;return((u=c())==null?void 0:u.canRedo())??!1}}}function X(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function u0(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var yc={exports:{}},Zp;function l0(){if(Zp)return yc.exports;Zp=1;var e=yc.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 u=parseInt(a,n);return u!==1/0&&u>=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},yc.exports}var p0=l0(),f0=u0(p0);function hn(e){if(!(this instanceof hn))return new hn(e);e=e||[128,36,1],this._seed=e.length?f0.rack(e[0],e[1],e[2]):e}hn.prototype.next=function(e){return this._seed(e||!0)},hn.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},hn.prototype.claim=function(e,t){this._seed.set(e,t||!0)},hn.prototype.assigned=function(e){return this._seed.get(e)||!1},hn.prototype.unclaim=function(e){delete this._seed.hats[e]},hn.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const et={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};et.td=et.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],et.option=et.optgroup=[1,'<select multiple="multiple">',"</select>"],et.thead=et.tbody=et.colgroup=et.caption=et.tfoot=[1,"<table>","</table>"],et.polyline=et.ellipse=et.polygon=et.circle=et.text=et.line=et.path=et.rect=et.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function Ie(e,t=globalThis.document){var u;if(typeof e!="string")throw new TypeError("String expected");const n=/^<!--(.*?)-->$/s.exec(e);if(n)return t.createComment(n[1]);const i=(u=/<([\w:]+)/.exec(e))==null?void 0:u[1];if(!i)return t.createTextNode(e);if(e=e.trim(),i==="body"){const p=t.createElement("html");p.innerHTML=e;const{lastChild:l}=p;return l.remove(),l}let[r,o,a]=Object.hasOwn(et,i)?et[i]:et._default,s=t.createElement("div");for(s.innerHTML=o+e+a;r--;)s=s.lastChild;if(s.firstChild===s.lastChild){const{firstChild:p}=s;return p.remove(),p}const c=t.createDocumentFragment();return c.append(...s.childNodes),c}function d0(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 wt(e,...t){const n=e.style;return A(t,function(i){i&&A(i,function(r,o){n[o]=r})}),e}function _t(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const h0=Object.prototype.toString;function Be(e){return new Zn(e)}function Zn(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Zn.prototype.add=function(e){return this.list.add(e),this},Zn.prototype.remove=function(e){return h0.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Zn.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},Zn.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Zn.prototype.array=function(){return Array.from(this.list)},Zn.prototype.has=Zn.prototype.contains=function(e){return this.list.contains(e)};function Ko(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Mi(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function m0(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Xo={},Qp;function g0(){if(Qp)return Xo;Qp=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return Xo.bind=function(r,o,a,s){return e||i(),r[e](n+o,a,s||!1),a},Xo.unbind=function(r,o,a,s){return t||i(),r[t](n+o,a,s||!1),a},Xo}var Jp=g0(),v0=m0(Jp),le=d0({__proto__:null,default:v0},[Jp]),ef=["focus","blur"];function y0(e,t,n,i,r){return ef.indexOf(n)!==-1&&(r=!0),le.bind(e,n,function(o){var a=o.target||o.srcElement;o.delegateTarget=Mi(a,t,!0),o.delegateTarget&&i.call(e,o)},r)}function _0(e,t,n,i){return ef.indexOf(t)!==-1&&(i=!0),le.unbind(e,t,n,i)}var Dt={bind:y0,unbind:_0};function _c(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function Ae(e,t){return t=t||document,t.querySelector(e)}function Zo(e,t){return t=t||document,t.querySelectorAll(e)}function mn(e){e.parentNode&&e.parentNode.removeChild(e)}function b0(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function E0(e,t){return t.appendChild(b0(e,t))}function pe(e,t){return E0(t,e),e}var bc=2,tf={"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":bc,"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":bc,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function x0(e,t){return tf[t]?e.style[t]:e.getAttributeNS(null,t)}function nf(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=tf[i];r?(r===bc&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function w0(e,t){var n=Object.keys(t),i,r;for(i=0,r;r=n[i];i++)nf(e,r,t[r])}function Z(e,t,n){if(typeof t=="string")if(n!==void 0)nf(e,t,n);else return x0(e,t);else w0(e,t);return e}const S0=Object.prototype.toString;function xe(e){return new Qn(e)}function Qn(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Qn.prototype.add=function(e){return this.list.add(e),this},Qn.prototype.remove=function(e){return S0.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Qn.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},Qn.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Qn.prototype.array=function(){return Array.from(this.list)},Qn.prototype.has=Qn.prototype.contains=function(e){return this.list.contains(e)};function Qo(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function rf(e){return e.cloneNode(!0)}var Ec={svg:"http://www.w3.org/2000/svg"},of='<svg xmlns="'+Ec.svg+'"';function R0(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(Ec.svg)===-1&&(e=of+e.substring(4)):(e=of+">"+e+"</svg>",t=!0);var n=C0(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function C0(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function te(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=R0(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(Ec.svg,e),t&&Z(n,t),n}var xc=null;function af(){return xc===null&&(xc=te("svg")),xc}function sf(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function P0(e,t,n,i,r,o){var a=af().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return sf(a,e);case 6:return sf(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}function Nr(e){return af().createSVGTransform()}var cf=/([&<>]{1})/g,A0=/([&<>\n\r"]{1})/g,T0={"&":"&","<":"<",">":">",'"':"'"};function wc(e,t){function n(i,r){return T0[r]||r}return e.replace(t,n)}function uf(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(wc(e.textContent,cf));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,'="',wc(o.value,A0),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)uf(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",wc(e.nodeValue,cf),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function M0(e){for(var t=e.firstChild,n=[];t;)uf(t,n),t=t.nextSibling;return n.join("")}function lf(e,t){return M0(e)}function tt(e){var t=e.parentNode;return t&&t.removeChild(e),e}function k0(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function D0(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(k0(e,i))}function $r(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),D0(n,t)),n.consolidate()}const O0=/^class[ {]/;function I0(e){return O0.test(e.toString())}function Sc(e){return Array.isArray(e)}function Rc(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Jo(...e){e.length===1&&Sc(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const L0=/constructor\s*[^(]*\(\s*([^)]*)\)/m,B0=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,N0=/\/\*([^*]*)\*\//m;function $0(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(I0(e)?L0:B0);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const r=i.match(N0);return(r&&r[1]||i).trim()})||[]}function pf(e,t){const n=t||{get:function(E,b){if(i.push(E),b===!1)return null;throw s(`No provider for "${E}"!`)}},i=[],r=this._providers=Object.create(n._providers||null),o=this._instances=Object.create(null),a=o.injector=this,s=function(E){const b=i.join(" -> ");return i.length=0,new Error(b?`${E} (Resolving: ${b})`:E)};function c(E,b){if(!r[E]&&E.includes(".")){const R=E.split(".");let T=c(R.shift());for(;R.length;)T=T[R.shift()];return T}if(Rc(o,E))return o[E];if(Rc(r,E)){if(i.indexOf(E)!==-1)throw i.push(E),s("Cannot resolve circular dependency!");return i.push(E),o[E]=r[E][0](r[E][1]),i.pop(),o[E]}return n.get(E,b)}function u(E,b){if(typeof b>"u"&&(b={}),typeof E!="function")if(Sc(E))E=Jo(E.slice());else throw s(`Cannot invoke "${E}". Expected a function!`);const T=(E.$inject||$0(E)).map(O=>Rc(b,O)?b[O]:c(O));return{fn:E,dependencies:T}}function p(E){const{fn:b,dependencies:R}=u(E),T=Function.prototype.bind.call(b,null,...R);return new T}function l(E,b,R){const{fn:T,dependencies:O}=u(E,R);return T.apply(b,O)}function f(E){return Jo(b=>E.get(b))}function d(E,b){if(b&&b.length){const R=Object.create(null),T=Object.create(null),O=[],C=[],F=[];let N,I,W,re;for(let Pe in r)N=r[Pe],b.indexOf(Pe)!==-1&&(N[2]==="private"?(I=O.indexOf(N[3]),I===-1?(W=N[3].createChild([],b),re=f(W),O.push(N[3]),C.push(W),F.push(re),R[Pe]=[re,Pe,"private",W]):R[Pe]=[F[I],Pe,"private",C[I]]):R[Pe]=[N[2],N[1]],T[Pe]=!0),(N[2]==="factory"||N[2]==="type")&&N[1].$scope&&b.forEach(Qe=>{N[1].$scope.indexOf(Qe)!==-1&&(R[Pe]=[N[2],N[1]],T[Qe]=!0)});b.forEach(Pe=>{if(!T[Pe])throw new Error('No provider for "'+Pe+'". Cannot use provider from the parent!')}),E.unshift(R)}return new pf(E,a)}const h={factory:l,type:p,value:function(E){return E}};function v(E,b){const R=E.__init__||[];return function(){R.forEach(T=>{typeof T=="string"?b.get(T):b.invoke(T)})}}function _(E){const b=E.__exports__;if(b){const R=E.__modules__,T=Object.keys(E).reduce((I,W)=>(W!=="__exports__"&&W!=="__modules__"&&W!=="__init__"&&W!=="__depends__"&&(I[W]=E[W]),I),Object.create(null)),O=(R||[]).concat(T),C=d(O),F=Jo(function(I){return C.get(I)});b.forEach(function(I){r[I]=[F,I,"private",C]});const N=(E.__init__||[]).slice();return N.unshift(function(){C.init()}),E=Object.assign({},E,{__init__:N}),v(E,C)}return Object.keys(E).forEach(function(R){if(R==="__init__"||R==="__depends__")return;const T=E[R];if(T[2]==="private"){r[R]=T;return}const O=T[0],C=T[1];r[R]=[h[O],j0(O,C),O]}),v(E,a)}function S(E,b){return E.indexOf(b)!==-1||(E=(b.__depends__||[]).reduce(S,E),E.indexOf(b)!==-1)?E:E.concat(b)}function w(E){const b=E.reduce(S,[]).map(_);let R=!1;return function(){R||(R=!0,b.forEach(T=>T()))}}this.get=c,this.invoke=l,this.instantiate=p,this.createChild=d,this.init=w(e)}function j0(e,t){return e!=="value"&&Sc(t)&&(t=Jo(t.slice())),t}var F0=1e3;function kn(e,t){var n=this;t=t||F0,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)})}kn.prototype.canRender=function(e){},kn.prototype.drawShape=function(e,t){},kn.prototype.drawConnection=function(e,t){},kn.prototype.getShapePath=function(e){},kn.prototype.getConnectionPath=function(e){};function ki(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function H0(e){return["M",e.x,e.y]}function Cc(e){return["L",e.x,e.y]}function z0(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function V0(e,t){const n=e.length,i=[H0(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(Cc(a));continue}const c=Math.min(t,Pc(a.x-o.x,a.y-o.y),Pc(s.x-a.x,s.y-a.y));if(!c){i.push(Cc(a));continue}const u=ea(a,o,c),p=ea(a,o,c*.5),l=ea(a,s,c),f=ea(a,s,c*.5);i.push(Cc(u)),i.push(z0(p,f,l))}return i}function ea(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=Pc(i,r),a=n/o;return{x:e.x+i*a,y:e.y+r*a}}function Pc(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function jr(e,t,n){ue(t)&&(n=t,t=null),t||(t={});const i=te("path",t);return ue(n)&&(i.dataset.cornerRadius=String(n)),Ac(i,e)}function Ac(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return Z(e,{d:ki(V0(t,n))}),e}function ta(e){var t=new Set(e);return ye(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function Di(e,t,n){n=n||0,ae(e)||(e=[e]),A(e,function(i,r){var o=t(i,r,n);ae(o)&&o.length&&Di(o,t,n+1)})}function Tc(e,t,n){var i=new Set,r=new Set;return Di(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 Fr(e,t){return Tc(e)}function G0(e,t,n){Ri(t)&&(t=!0),rt(t)&&(n=t,t=!0),n=n||{};var i=Hr(n.allShapes),r=Hr(n.allConnections),o=Hr(n.enclosedElements),a=Hr(n.enclosedConnections),s=Hr(n.topLevel,t&&Xi(e,function(p){return p.id}));function c(p){s[p.source.id]&&s[p.target.id]&&(s[p.id]=[p]),i[p.source.id]&&i[p.target.id]&&(a[p.id]=o[p.id]=p),r[p.id]=p}function u(p){if(o[p.id]=p,p.waypoints)a[p.id]=r[p.id]=p;else return i[p.id]=p,A(p.incoming,c),A(p.outgoing,c),p.children}return Di(e,u),{allShapes:i,allConnections:r,topLevel:s,enclosedConnections:a,enclosedElements:o}}function Ue(e,t){t=!!t,ae(e)||(e=[e]);var n,i,r,o;return A(e,function(a){var s=a;a.waypoints&&!t&&(s=Ue(a.waypoints,!0));var c=s.x,u=s.y,p=s.height||0,l=s.width||0;(c<n||n===void 0)&&(n=c),(u<i||i===void 0)&&(i=u),(c+l>r||r===void 0)&&(r=c+l),(u+p>o||o===void 0)&&(o=u+p)}),{x:n,y:i,height:o-i,width:r-n}}function er(e,t){var n={};return A(e,function(i){var r=i;r.waypoints&&(r=Ue(r)),!ue(t.y)&&r.x>t.x&&(n[i.id]=i),!ue(t.x)&&r.y>t.y&&(n[i.id]=i),r.x>t.x&&r.y>t.y&&(ue(t.width)&&ue(t.height)&&r.width+r.x<t.width+t.x&&r.height+r.y<t.height+t.y||!ue(t.width)||!ue(t.height))&&(n[i.id]=i)}),n}function ff(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function df(e){return!!(e&&e.isFrame)}function Hr(e,t){return D({},e||{},t||{})}var W0=1;function Jn(e,t){kn.call(this,e,W0),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})}X(Jn,kn),Jn.prototype.canRender=function(){return!0},Jn.prototype.drawShape=function(t,n,i){var r=te("rect");return Z(r,{x:0,y:0,width:n.width||0,height:n.height||0}),df(n)?Z(r,D({},this.FRAME_STYLE,i||{})):Z(r,D({},this.SHAPE_STYLE,i||{})),pe(t,r),r},Jn.prototype.drawConnection=function(t,n,i){var r=jr(n.waypoints,D({},this.CONNECTION_STYLE,i||{}));return pe(t,r),r},Jn.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 ki(a)},Jn.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 ki(o)},Jn.$inject=["eventBus","styles"];function U0(){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 D(o,{class:n})},this.style=function(n,i){!ae(n)&&!i&&(i=n,n=[]);var r=kt(n,function(o,a){return D(o,e[a]||{})},{});return i?D(r,i):r},this.computeStyle=function(n,i,r){return ae(i)||(r=i,i=[]),t.style(i||[],D({},r,n||{}))}}const q0={__init__:["defaultRenderer"],defaultRenderer:["type",Jn],styles:["type",U0]};function ze(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function Ge(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 Mc(e,t){return!e||!t?-1:e.indexOf(t)}function zr(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function kc(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=zr(e,t);return Math.abs(r/o)<=i}var Y0=2;function Dn(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[r,o]of Object.entries(i))if(K0(r,n))return o;return!1}function K0(e,t){const n=t[0];return Ci(t,function(i){return Math.abs(n[e]-i[e])<=Y0})}function hf(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 Dc(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var X0=/,?([a-z]),?/gi,mf=parseFloat,qe=Math,ei=qe.PI,gn=qe.min,vn=qe.max,gf=qe.pow,ti=qe.abs,Z0=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,Q0=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,vf=Array.isArray||function(e){return e instanceof Array};function J0(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function eE(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 tE(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 J0(r,i)?(eE(o,i),r[i]):(o.length>=1e3&&delete r[o.shift()],o.push(i),r[i]=e(...arguments),r[i])}return t}function nE(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(Z0,function(i,r,o){var a=[],s=r.toLowerCase();for(o.replace(Q0,function(c,u){u&&a.push(+u)}),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=Ic,n}function iE(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 rE(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 Oc(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 Ic(){return this.join(",").replace(X0,"$1")}function oE(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=Ic,t}function yf(e,t,n,i,r,o,a,s,c){var u=1-c,p=gf(u,3),l=gf(u,2),f=c*c,d=f*c,h=p*e+l*3*c*n+u*3*c*c*r+d*a,v=p*t+l*3*c*i+u*3*c*c*o+d*s;return{x:na(h),y:na(v)}}function _f(e){var t=pE(...e);return Oc(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function ni(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function aE(e,t){return e=Oc(e),t=Oc(t),ni(t,e.x,e.y)||ni(t,e.x2,e.y)||ni(t,e.x,e.y2)||ni(t,e.x2,e.y2)||ni(e,t.x,t.y)||ni(e,t.x2,t.y)||ni(e,t.x,t.y2)||ni(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 bf(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 Ef(e,t,n,i,r,o,a,s,c){c==null&&(c=1),c=c>1?1:c<0?0:c;for(var u=c/2,p=12,l=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],f=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],d=0,h=0;h<p;h++){var v=u*l[h]+u,_=bf(v,e,n,r,a),S=bf(v,t,i,o,s),w=_*_+S*S;d+=f[h]*qe.sqrt(w)}return u*d}function sE(e,t,n,i,r,o,a,s){if(!(vn(e,n)<gn(r,a)||gn(e,n)>vn(r,a)||vn(t,i)<gn(o,s)||gn(t,i)>vn(o,s))){var c=(e*i-t*n)*(r-a)-(e-n)*(r*s-o*a),u=(e*i-t*n)*(o-s)-(t-i)*(r*s-o*a),p=(e-n)*(o-s)-(t-i)*(r-a);if(p){var l=na(c/p),f=na(u/p),d=+l.toFixed(2),h=+f.toFixed(2);if(!(d<+gn(e,n).toFixed(2)||d>+vn(e,n).toFixed(2)||d<+gn(r,a).toFixed(2)||d>+vn(r,a).toFixed(2)||h<+gn(t,i).toFixed(2)||h>+vn(t,i).toFixed(2)||h<+gn(o,s).toFixed(2)||h>+vn(o,s).toFixed(2)))return{x:l,y:f}}}}function na(e){return Math.round(e*1e11)/1e11}function cE(e,t,n){var i=_f(e),r=_f(t);if(!aE(i,r))return[];var o=Ef(...e),a=Ef(...t),s=wf(e)?1:~~(o/5)||1,c=wf(t)?1:~~(a/5)||1,u=new Array(s+1),p=new Array(c+1),l={},f=[],d,h;for(d=0;d<s+1;d++){var v=yf(...e,d/s);u[d]={x:v.x,y:v.y,t:d/s}}for(d=0;d<c+1;d++)v=yf(...t,d/c),p[d]={x:v.x,y:v.y,t:d/c};for(d=0;d<s;d++)for(h=0;h<c;h++){var _=u[d],S=u[d+1],w=p[h],E=p[h+1],b=ti(S.x-_.x)<.01?"y":"x",R=ti(E.x-w.x)<.01?"y":"x",T=sE(_.x,_.y,S.x,S.y,w.x,w.y,E.x,E.y),O;if(T){if(O=T.x.toFixed(9)+"#"+T.y.toFixed(9),l[O])continue;l[O]=!0;var C=_.t+ti((T[b]-_[b])/(S[b]-_[b]))*(S.t-_.t),F=w.t+ti((T[R]-w[R])/(E[R]-w[R]))*(E.t-w.t);C>=0&&C<=1&&F>=0&&F<=1&&f.push({x:T.x,y:T.y,t1:C,t2:F})}}return f}function xf(e,t,n){e=Cf(e),t=Cf(t);for(var i,r,o,a,s,c,u,p,l,f,d=n?0:[],h=0,v=e.length;h<v;h++){var _=e[h];if(_[0]=="M")i=s=_[1],r=c=_[2];else{_[0]=="C"?(l=[i,r,..._.slice(1)],i=l[6],r=l[7]):(l=[i,r,i,r,s,c,s,c],i=s,r=c);for(var S=0,w=t.length;S<w;S++){var E=t[S];if(E[0]=="M")o=u=E[1],a=p=E[2];else{E[0]=="C"?(f=[o,a,...E.slice(1)],o=f[6],a=f[7]):(f=[o,a,o,a,u,p,u,p],o=u,a=p);var b=cE(l,f);{for(var R=0,T=b.length;R<T;R++)b[R].segment1=h,b[R].segment2=S,b[R].bez1=l,b[R].bez2=f;d=d.concat(b)}}}}}return d}function uE(e){return vf(e)&&vf(e[0])}function lE(e){if(iE(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,u,p=a,l=e.length;p<l;p++){if(u=e[p],s=u[0],t[p]=c=new Array(u.length),s!=s.toUpperCase())switch(c[0]=s.toUpperCase(),c[0]){case"A":c[1]=u[1],c[2]=u[2],c[3]=u[3],c[4]=u[4],c[5]=u[5],c[6]=+u[6]+n,c[7]=+u[7]+i;break;case"V":c[1]=+u[1]+i;break;case"H":c[1]=+u[1]+n;break;case"M":r=+u[1]+n,o=+u[2]+i;default:for(var f=1,d=u.length;f<d;f++)c[f]=+u[f]+(f%2?n:i)}else for(var h=0,v=u.length;h<v;h++)c[h]=u[h];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=Ic,t}function wf(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function ia(e,t,n,i){return[e,t,n,i,n,i]}function Sf(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 Rf(e,t,n,i,r,o,a,s,c,u){var p=ei*120/180,l=ei/180*(+r||0),f=[],d,h=tE(function(x,g,m){var P=x*qe.cos(m)-g*qe.sin(m),k=x*qe.sin(m)+g*qe.cos(m);return{x:P,y:k}});if(u)O=u[0],C=u[1],R=u[2],T=u[3];else{d=h(e,t,-l),e=d.x,t=d.y,d=h(s,c,-l),s=d.x,c=d.y;var v=(e-s)/2,_=(t-c)/2,S=v*v/(n*n)+_*_/(i*i);S>1&&(S=qe.sqrt(S),n=S*n,i=S*i);var w=n*n,E=i*i,b=(o==a?-1:1)*qe.sqrt(ti((w*E-w*_*_-E*v*v)/(w*_*_+E*v*v))),R=b*n*_/i+(e+s)/2,T=b*-i*v/n+(t+c)/2,O=qe.asin(((t-T)/i).toFixed(9)),C=qe.asin(((c-T)/i).toFixed(9));O=e<R?ei-O:O,C=s<R?ei-C:C,O<0&&(O=ei*2+O),C<0&&(C=ei*2+C),a&&O>C&&(O=O-ei*2),!a&&C>O&&(C=C-ei*2)}var F=C-O;if(ti(F)>p){var N=C,I=s,W=c;C=O+p*(a&&C>O?1:-1),s=R+n*qe.cos(C),c=T+i*qe.sin(C),f=Rf(s,c,n,i,r,0,a,I,W,[C,N,R,T])}F=C-O;var re=qe.cos(O),Pe=qe.sin(O),Qe=qe.cos(C),U=qe.sin(C),ee=qe.tan(F/4),oe=4/3*n*ee,Q=4/3*i*ee,ne=[e,t],Y=[e+oe*Pe,t-Q*re],B=[s+oe*U,c-Q*Qe],L=[s,c];if(Y[0]=2*ne[0]-Y[0],Y[1]=2*ne[1]-Y[1],u)return[Y,B,L].concat(f);f=[Y,B,L].concat(f).join().split(",");for(var H=[],M=0,$=f.length;M<$;M++)H[M]=M%2?h(f[M-1],f[M],l).y:h(f[M],f[M+1],l).x;return H}function pE(e,t,n,i,r,o,a,s){for(var c=[],u=[[],[]],p,l,f,d,h,v,_,S,w=0;w<2;++w){if(w==0?(l=6*e-12*n+6*r,p=-3*e+9*n-9*r+3*a,f=3*n-3*e):(l=6*t-12*i+6*o,p=-3*t+9*i-9*o+3*s,f=3*i-3*t),ti(p)<1e-12){if(ti(l)<1e-12)continue;d=-f/l,0<d&&d<1&&c.push(d);continue}_=l*l-4*f*p,S=qe.sqrt(_),!(_<0)&&(h=(-l+S)/(2*p),0<h&&h<1&&c.push(h),v=(-l-S)/(2*p),0<v&&v<1&&c.push(v))}for(var E=c.length,b=E,R;E--;)d=c[E],R=1-d,u[0][E]=R*R*R*e+3*R*R*d*n+3*R*d*d*r+d*d*d*a,u[1][E]=R*R*R*t+3*R*R*d*i+3*R*d*d*o+d*d*d*s;return u[0][b]=e,u[1][b]=t,u[0][b+1]=a,u[1][b+1]=s,u[0].length=u[1].length=b+2,{x0:gn(...u[0]),y0:gn(...u[1]),x1:vn(...u[0]),y1:vn(...u[1])}}function Cf(e){if(uE(e)||(e=nE(e)),rE(e))return e;for(var t=oE(lE(e)),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i=function(f,d,h){var v,_;if(!f)return["C",d.x,d.y,d.x,d.y,d.x,d.y];switch(!(f[0]in{T:1,Q:1})&&(d.qx=d.qy=null),f[0]){case"M":d.X=f[1],d.Y=f[2];break;case"A":f=["C",...Rf(d.x,d.y,...f.slice(1))];break;case"S":h=="C"||h=="S"?(v=d.x*2-d.bx,_=d.y*2-d.by):(v=d.x,_=d.y),f=["C",v,_,...f.slice(1)];break;case"T":h=="Q"||h=="T"?(d.qx=d.x*2-d.qx,d.qy=d.y*2-d.qy):(d.qx=d.x,d.qy=d.y),f=["C",...Sf(d.x,d.y,d.qx,d.qy,f[1],f[2])];break;case"Q":d.qx=f[1],d.qy=f[2],f=["C",...Sf(d.x,d.y,f[1],f[2],f[3],f[4])];break;case"L":f=["C",...ia(d.x,d.y,f[1],f[2])];break;case"H":f=["C",...ia(d.x,d.y,f[1],d.y)];break;case"V":f=["C",...ia(d.x,d.y,d.x,f[1])];break;case"Z":f=["C",...ia(d.x,d.y,d.X,d.Y)];break}return f},r=function(f,d){if(f[d].length>7){f[d].shift();for(var h=f[d];h.length;)o[d]="A",f.splice(d++,0,["C",...h.splice(0,6)]);f.splice(d,1),u=t.length}},o=[],a="",s="",c=0,u=t.length;c<u;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 p=t[c],l=p.length;n.x=p[l-2],n.y=p[l-1],n.bx=mf(p[l-4])||n.x,n.by=mf(p[l-3])||n.y}return t}function Te(e){return rt(e)&&Mt(e,"waypoints")}function he(e){return rt(e)&&Mt(e,"labelTarget")}function fE(e){return rt(e)&&Yi(e.parent)}function Pf(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function On(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 ra(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function dE(e){return On({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function hE(e){for(var t=e.waypoints,n=t.reduce(function(u,p,l){var f=t[l-1];if(f){var d=u[u.length-1],h=d&&d.endLength||0,v=vE(f,p);u.push({start:f,end:p,startLength:h,endLength:h+v,length:v})}return u},[]),i=n.reduce(function(u,p){return u+p.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 se(e){return Te(e)?hE(e):dE(e)}function ut(e,t,n){n=n||0,rt(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,u=o?"top":s?"bottom":null,p=c?"left":a?"right":null;return p&&u?u+"-"+p:p||u||"intersect"}function Vr(e,t,n){var i=mE(e,t);return i.length===1||i.length===2&&zr(i[0],i[1])<1?On(i[0]):i.length>1?(i=ln(i,function(r){var o=Math.floor(r.t2*100)||1;return o=100-o,o=(o<10?"0":"")+o,r.segment2+"#"+o}),On(i[n?0:i.length-1])):null}function mE(e,t){return xf(e,t)}function gE(e){e=e.slice();for(var t=0,n,i,r;e[t];)n=e[t],i=e[t-1],r=e[t+1],zr(n,r)===0||kc(i,r,n)?e.splice(t,1):t++;return e}function vE(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function oa(e,t){return Math.round(e*t)/t}function Af(e){return ue(e)?e+"px":e}function yE(e){for(;e.parent;)e=e.parent;return e}function _E(e){e=D({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),wt(n,{position:"relative",overflow:"hidden",width:Af(e.width),height:Af(e.height)}),t.appendChild(n),n}function Tf(e,t,n){const i=te("g");xe(i).add(t);const r=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}const bE="base",Mf=0,EE=1,xE={shape:["x","y","width","height"],connection:["waypoints"]};function ce(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||{})}ce.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],ce.prototype._init=function(e){const t=this._eventBus,n=this._container=_E(e),i=this._svg=te("svg");Z(i,{width:"100%",height:"100%"}),_t(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")}),pe(n,i);const r=this._viewport=Tf(i,"viewport");e.deferUpdate&&(this._viewboxChanged=rc(this._viewboxChanged,300)),this._restoreFocus=rc(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)},ce.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},ce.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},ce.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=ff(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},ce.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},ce.prototype.restoreFocus=function(){this._restoreFocus()},ce.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},ce.prototype.isFocused=function(){return this._focused},ce.prototype.getDefaultLayer=function(){return this.getLayer(bE,Mf)},ce.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},ce.prototype._getChildIndex=function(e){return kt(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},ce.prototype._createLayer=function(e,t){typeof t>"u"&&(t=EE);const n=this._getChildIndex(t);return{group:Tf(this._viewport,"layer-"+e,n),index:t,visible:!0}},ce.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},ce.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&&(tt(n),t.visible=!1),n},ce.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],tt(t.group))},ce.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},ce.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const r=this._findPlaneForRoot(yE(i));if(!r||n&&r.rootElement!==n)return;n=r.rootElement}return n},ce.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},ce.prototype._findPlaneForRoot=function(e){return Oe(this._planes,function(t){return t.rootElement===e})},ce.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},ce.prototype._resolveElements=function(e){return ae(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},ce.prototype.getContainer=function(){return this._container},ce.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&&(A([i.gfx,i.secondaryGfx],function(r){r&&(n?(e.markers.add(t),xe(r).add(t)):(e.markers.delete(t),xe(r).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},ce.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},ce.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},ce.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},ce.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},ce.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},ce.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,Mf);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},ce.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},ce.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},ce.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)},ce.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})},ce.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})},ce.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=xE[e];if(!Ci(n,function(r){return typeof t[r]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},ce.prototype._setParent=function(e,t,n){Ge(t.children,e,n),e.parent=t},ce.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},ce.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},ce.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},ce.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),ze(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},ce.prototype.removeShape=function(e){return this._removeElement(e,"shape")},ce.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},ce.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},ce.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},ce.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},ce.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,u;if(e)this._changeViewbox(function(){s=Math.min(n.width/e.width,n.height/e.height);const p=this._svg.createSVGMatrix().scale(s).translate(-e.x,-e.y);$r(t,p)});else return o=this._rootElement?this.getActiveLayer():null,i=o&&o.getBBox()||{},a=$r(t),r=a?a.matrix:P0(),s=oa(r.a,1e3),c=oa(-r.e||0,1e3),u=oa(-r.f||0,1e3),e=this._cachedViewbox={x:c?c/s:0,y:u?u/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},ce.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=D({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),kf(t,n)}),{x:n.e,y:n.f}},ce.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(h=>h!=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=Ue(o),s=ie(a),c=this.viewbox(),u=this.zoom();let p,l;c.y+=t.top/u,c.x+=t.left/u,c.width-=(t.right+t.left)/u,c.height-=(t.bottom+t.top)/u;const f=ie(c);if(!(a.width<c.width&&a.height<c.height))p=a.x-c.x,l=a.y-c.y;else{const h=Math.max(0,s.right-f.right),v=Math.min(0,s.left-f.left),_=Math.max(0,s.bottom-f.bottom),S=Math.min(0,s.top-f.top);p=h||v,l=_||S}this.scroll({dx:-p*u,dy:-l*u})},ce.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)}),oa(i.a,1e3)};function kf(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}ce.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},ce.prototype._setZoom=function(e,t){const n=this._svg,i=this._viewport,r=n.createSVGMatrix(),o=n.createSVGPoint();let a,s,c,u,p;c=i.getCTM();const l=c.a;return t?(a=D(o,t),s=a.matrixTransform(c.inverse()),u=r.translate(s.x,s.y).scale(1/l*e).translate(-s.x,-s.y),p=c.multiply(u)):p=r.scale(e),kf(this._viewport,p),p},ce.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},ce.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}},ce.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var tr="data-element-id";function Ht(e){this._elements={},this._eventBus=e}Ht.$inject=["eventBus"],Ht.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),Z(t,tr,i),n&&Z(n,tr,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},Ht.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(Z(i.gfx,tr,""),i.secondaryGfx&&Z(i.secondaryGfx,tr,""),delete t[n])},Ht.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)},Ht.prototype.updateGraphics=function(e,t,n){var i=e.id||e,r=this._elements[i];return n?r.secondaryGfx=t:r.gfx=t,t&&Z(t,tr,i),t},Ht.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&Z(e,tr);var n=this._elements[t];return n&&n.element},Ht.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},Ht.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}},Ht.prototype.getAll=function(){return this.filter(function(e){return e})},Ht.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)})},Ht.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},Ht.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 wE(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 SE(e){return e.__refs_collection===!0}function RE(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function Df(e,t,n){var i=wE(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 CE(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 Ut(e,t){if(!(this instanceof Ut))return new Ut(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}Ut.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?Df(this,t,e):CE(this,t,e)},Ut.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return SE(n)||Df(this,t,e),n},Ut.prototype.ensureBound=function(e,t){RE(e,t)||this.bind(e,t)},Ut.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},Ut.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var Lc=new Ut({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Of=new Ut({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),If=new Ut({name:"attachers",collection:!0},{name:"host"}),Lf=new Ut({name:"outgoing",collection:!0},{name:"source"}),Bf=new Ut({name:"incoming",collection:!0},{name:"target"});function nr(){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)}}),Lc.bind(this,"parent"),Of.bind(this,"labels"),Lf.bind(this,"outgoing"),Bf.bind(this,"incoming")}function Gr(){nr.call(this),Lc.bind(this,"children"),If.bind(this,"host"),If.bind(this,"attachers")}X(Gr,nr);function Nf(){nr.call(this),Lc.bind(this,"children")}X(Nf,Gr);function $f(){Gr.call(this),Of.bind(this,"labelTarget")}X($f,Gr);function jf(){nr.call(this),Lf.bind(this,"source"),Bf.bind(this,"target")}X(jf,nr);var PE={connection:jf,shape:Gr,label:$f,root:Nf};function AE(e,t){var n=PE[e];if(!n)throw new Error("unknown type: <"+e+">");return D(new n,t)}function TE(e){return e instanceof nr}function In(){this._uid=12}In.prototype.createRoot=function(e){return this.create("root",e)},In.prototype.createLabel=function(e){return this.create("label",e)},In.prototype.createShape=function(e){return this.create("shape",e)},In.prototype.createConnection=function(e){return this.create("connection",e)},In.prototype.create=function(e,t){return t=D({},t||{}),t.id||(t.id=e+"_"+this._uid++),AE(e,t)};var aa="__fn",Ff=1e3,ME=Array.prototype.slice;function Ot(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}Ot.prototype.on=function(e,t,n,i){if(e=ae(e)?e:[e],ot(t)&&(i=n,n=t,t=Ff),!ue(t))throw new Error("priority must be a number");var r=n;i&&(r=Ct(n,i),r[aa]=n[aa]||n);var o=this;e.forEach(function(a){o._addListener(a,{priority:t,callback:r,next:null})})},Ot.prototype.once=function(e,t,n,i){var r=this;if(ot(t)&&(i=n,n=t,t=Ff),!ue(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[aa]=n,this.on(e,t,o)},Ot.prototype.off=function(e,t){e=ae(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},Ot.prototype.createEvent=function(e){var t=new Wr;return t.init(e),t},Ot.prototype.fire=function(e,t){var n,i,r,o;if(o=ME.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 Wr?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}},Ot.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},Ot.prototype._destroy=function(){this._listeners={}},Ot.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},Ot.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=kE(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},Ot.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},Ot.prototype._getListeners=function(e){return this._listeners[e]},Ot.prototype._setListeners=function(e,t){this._listeners[e]=t},Ot.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[aa]===t)&&(r?r.next=i:this._setListeners(e,i)),r=n,n=i};function Wr(){}Wr.prototype.stopPropagation=function(){this.cancelBubble=!0},Wr.prototype.preventDefault=function(){this.defaultPrevented=!0},Wr.prototype.init=function(e){D(this,e||{})};function kE(e,t){return e.apply(null,t)}function Oi(e){return e.childNodes[0]}function DE(e){return e.parentNode.childNodes[1]}function sa(e,t,n,i,r){var o=Nr();o.setTranslate(t,n);var a=Nr();a.setRotate(i||0,0,0);var s=Nr();s.setScale(1,1),$r(e,[o,a,s])}function lt(e,t,n){var i=Nr();i.setTranslate(t,n),$r(e,i)}function Hf(e,t){var n=Nr();n.setRotate(t,0,0),$r(e,n)}function zt(e,t){this._eventBus=e,this._elementRegistry=t}zt.$inject=["eventBus","elementRegistry"],zt.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=DE(t),n||(n=te("g"),xe(n).add("djs-children"),pe(t.parentNode,n))):n=t,n},zt.prototype._clear=function(e){var t=Oi(e);return Ko(t),t},zt.prototype._createContainer=function(e,t,n,i){var r=te("g");xe(r).add("djs-group"),typeof n<"u"?OE(r,t,t.childNodes[n]):pe(t,r);var o=te("g");xe(o).add("djs-element"),xe(o).add("djs-"+e),i&&xe(o).add("djs-frame"),pe(r,o);var a=te("g");return xe(a).add("djs-visual"),pe(o,a),o},zt.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,df(t))},zt.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=kt(e,function(r,o){return o.parent&&(r[o.parent.id]=o.parent),r},{}),A(i,function(r){var o=r.children;if(o){var a=t._getChildrenContainer(r),s=a.firstChild;A(o,function(c){var u=n.getGraphics(c).parentNode;u===s?s=s.nextSibling:a.insertBefore(u,s)})}})},zt.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},zt.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},zt.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},zt.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},zt.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),lt(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?Z(n,"display","none"):Z(n,"display","block")}},zt.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);tt(t.parentNode)};function OE(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const IE={__depends__:[q0],__init__:["canvas"],canvas:["type",ce],elementRegistry:["type",Ht],elementFactory:["type",In],eventBus:["type",Ot],graphicsFactory:["type",zt]};function LE(e){var t=new pf(e);return t.init(),t}function BE(e){e=e||{};var t={config:["value",e]},n=[t,IE].concat(e.modules||[]);return LE(n)}function ii(e,t){this._injector=t||BE(e),this.get("eventBus").fire("diagram.init")}ii.prototype.get=function(e,t){return this._injector.get(e,t)},ii.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},ii.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},ii.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function bt(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function Pt(e,t){return e.$instanceOf(t)}function NE(e){return Oe(e.rootElements,function(t){return Pt(t,"bpmn:Process")||Pt(t,"bpmn:Collaboration")})}function $E(e){var t={},n=[],i={};function r(B,L){return function(H){B(H,L)}}function o(B){t[B.id]=B}function a(B){return t[B.id]}function s(B,L){var H=B.gfx;if(H)throw new Error(`already rendered ${bt(B)}`);return e.element(B,i[B.id],L)}function c(B,L){return e.root(B,i[B.id],L)}function u(B,L){try{var H=i[B.id]&&s(B,L);return o(B),H}catch(M){p(M.message,{element:B,error:M}),console.error(`failed to import ${bt(B)}`,M)}}function p(B,L){e.error(B,L)}var l=this.registerDi=function(L){var H=L.bpmnElement;H?i[H.id]?p(`multiple DI elements defined for ${bt(H)}`,{element:H}):i[H.id]=L:p(`no bpmnElement referenced in ${bt(L)}`,{element:L})};function f(B){d(B.plane)}function d(B){l(B),A(B.planeElement,h)}function h(B){l(B)}this.handleDefinitions=function(L,H){var M=L.diagrams;if(H&&M.indexOf(H)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!H&&M&&M.length&&(H=M[0]),!H)throw new Error("no diagram to display");i={},f(H);var $=H.plane;if(!$)throw new Error(`no plane for ${bt(H)}`);var x=$.bpmnElement;if(!x)if(x=NE(L),x)p(`correcting missing bpmnElement on ${bt($)} to ${bt(x)}`),$.bpmnElement=x,l($);else throw new Error("no process or collaboration to display");var g=c(x,$);if(Pt(x,"bpmn:Process")||Pt(x,"bpmn:SubProcess"))_(x,g);else if(Pt(x,"bpmn:Collaboration"))ne(x,g),S(L.rootElements,g);else throw new Error(`unsupported bpmnElement for ${bt($)}: ${bt(x)}`);v(n)};var v=this.handleDeferred=function(){for(var L;n.length;)L=n.shift(),L()};function _(B,L){ee(B,L),F(B.ioSpecification,L),C(B.artifacts,L),o(B)}function S(B,L){var H=ye(B,function(M){return!a(M)&&Pt(M,"bpmn:Process")&&M.laneSets});H.forEach(r(_,L))}function w(B,L){u(B,L)}function E(B,L){A(B,r(w,L))}function b(B,L){u(B,L)}function R(B,L){u(B,L)}function T(B,L){u(B,L)}function O(B,L){u(B,L)}function C(B,L){A(B,function(H){Pt(H,"bpmn:Association")?n.push(function(){O(H,L)}):O(H,L)})}function F(B,L){B&&(A(B.dataInputs,r(R,L)),A(B.dataOutputs,r(T,L)))}var N=this.handleSubProcess=function(L,H){ee(L,H),C(L.artifacts,H)};function I(B,L){var H=u(B,L);Pt(B,"bpmn:SubProcess")&&N(B,H||L),Pt(B,"bpmn:Activity")&&F(B.ioSpecification,L),n.push(function(){A(B.dataInputAssociations,r(b,L)),A(B.dataOutputAssociations,r(b,L))})}function W(B,L){u(B,L)}function re(B,L){u(B,L)}function Pe(B,L){n.push(function(){var H=u(B,L);B.childLaneSet&&Qe(B.childLaneSet,H||L),Y(B)})}function Qe(B,L){A(B.lanes,r(Pe,L))}function U(B,L){A(B,r(Qe,L))}function ee(B,L){oe(B.flowElements,L),B.laneSets&&U(B.laneSets,L)}function oe(B,L){A(B,function(H){Pt(H,"bpmn:SequenceFlow")?n.push(function(){W(H,L)}):Pt(H,"bpmn:BoundaryEvent")?n.unshift(function(){I(H,L)}):Pt(H,"bpmn:FlowNode")?I(H,L):Pt(H,"bpmn:DataObject")||(Pt(H,"bpmn:DataStoreReference")||Pt(H,"bpmn:DataObjectReference")?re(H,L):p(`unrecognized flowElement ${bt(H)} in context ${bt(L&&L.businessObject)}`,{element:H,context:L}))})}function Q(B,L){var H=u(B,L),M=B.processRef;M&&_(M,H||L)}function ne(B,L){A(B.participants,r(Q,L)),n.push(function(){E(B.messageFlows,L)}),C(B.artifacts,L)}function Y(B){A(B.flowNodeRef,function(L){var H=L.get("lanes");H&&H.push(B)})}}function y(e,t){var n=G(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function ge(e,t){return qn(t,function(n){return y(e,n)})}function G(e){return e&&e.businessObject||e}function we(e){return e&&e.di}function jE(e,t,n){var i,r,o,a,s=[];function c(u,p){var l={root:function(v,_){return i.add(v,_)},element:function(v,_,S){return i.add(v,_,S)},error:function(v,_){s.push({message:v,context:_})}},f=new $E(l);p=p||u.diagrams&&u.diagrams[0];var d=FE(u,p);if(!d)throw new Error("no diagram to display");A(d,function(v){f.handleDefinitions(u,v)});var h=p.plane.bpmnElement.id;o.setRootElement(o.findRoot(h+"_plane")||o.findRoot(h))}return new Promise(function(u,p){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}),u({warnings:s})}catch(l){return l.warnings=s,p(l)}})}function FE(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!y(n,"bpmn:Process")&&!y(n,"bpmn:Collaboration")&&(i=HE(n));var r;y(i,"bpmn:Collaboration")?r=i:r=Oe(e.rootElements,function(u){if(y(u,"bpmn:Collaboration"))return Oe(u.participants,function(p){return p.processRef===i})});var o=[i];r&&(o=vt(r.participants,function(u){return u.processRef}),o.push(r));var a=zf(o),s=[t],c=[n];return A(e.diagrams,function(u){if(u.plane){var p=u.plane.bpmnElement;a.indexOf(p)!==-1&&c.indexOf(p)===-1&&(s.push(u),c.push(p))}}),s}}function zf(e){var t=[];return A(e,function(n){n&&(t.push(n),t=t.concat(zf(n.flowElements)))}),t}function HE(e){for(var t=e;t;){if(y(t,"bpmn:Process"))return t;t=t.$parent}}var zE='<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>',Vf=zE,Gf={verticalAlign:"middle"},Wf={color:"#404040"},VE={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},GE={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},WE={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"},UE='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+Vf+'</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>',yn;function qE(){yn=Ie(UE),wt(yn,VE),wt(Ae("svg",yn),Gf),wt(Ae(".backdrop",yn),GE),wt(Ae(".notice",yn),WE),wt(Ae(".link",yn),Wf,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function YE(){yn||(qE(),Dt.bind(yn,".backdrop","click",function(e){document.body.removeChild(yn)})),document.body.appendChild(yn)}const ca=5,Uf="djs-outline-hidden";function $e(e){e=D({},XE,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),QE(this._container)}X($e,ii),$e.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(f){throw this._emit("import.parse.complete",{error:f}),f}let s=a.rootElement;const c=a.references,u=a.warnings,p=a.elementsById;o=o.concat(u),s=this._emit("import.parse.complete",r({error:null,definitions:s,elementsById:p,references:c,warnings:o}))||s;const l=await this.importDefinitions(s,n);return o=o.concat(l.warnings),this._emit("import.done",{error:null,warnings:o}),{warnings:o}}catch(a){let s=a;throw o=o.concat(s.warnings||[]),ua(s,o),s=KE(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},$e.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},$e.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const o=new Error("no XML imported");throw ua(o,[]),o}if(typeof t=="string"&&(i=ZE(n,t),!i)){const o=new Error("BPMNDiagram <"+t+"> not found");throw ua(o,[]),o}try{this.clear()}catch(o){throw ua(o,[]),o}const{warnings:r}=await jE(this,n,i);return{warnings:r}},$e.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},$e.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),r=i.getActiveLayer(),o=Ae(":scope > defs",i._svg),a=lf(r),s=o?"<defs>"+lf(o)+"</defs>":"",c=i.getContainer();Be(c).add(Uf);let u;try{u=r.getBBox()}finally{Be(c).remove(Uf)}const p=u.x-ca,l=u.y-ca,f=u.width+ca*2,d=u.height+ca*2;t=`<?xml version="1.0" encoding="utf-8"?>
|
|
3
|
+
column: `+H+`
|
|
4
|
+
nested error: `+w.message;if(L)return a.addWarning({message:z,error:w}),!0;throw Vi(z)}function l(w,T){return u(w,T,!0)}function p(){var w=a.elementsById,T=a.references,L,A;for(L=0;A=T[L];L++){var F=A.element,H=w[A.id],N=wi(F).propertiesByName[A.property];if(H||a.addWarning({message:"unresolved reference <"+A.id+">",element:A.element,property:A.property,value:A.id}),N.isMany){var z=F.get(N.name),ue=z.indexOf(A);ue===-1&&(ue=z.length),H?z[ue]=H:z.splice(ue,1)}else F.set(N.name,H)}}function f(){c.pop().handleEnd()}var d=/^<\?xml /i,h=/ encoding="([^"]+)"/i,m=/^utf-8$/i;function g(w){if(d.test(w)){var T=h.exec(w),L=T&&T[1];!L||m.test(L)||a.addWarning({message:"unsupported document encoding <"+L+">, falling back to UTF-8"})}}function R(w,T){var L=c.peek();try{c.push(L.handleNode(w))}catch(A){u(A,T,o)&&c.push(new Tu)}}function E(w,T){try{c.peek().handleText(w)}catch(L){l(L,T)}}function x(w,T){w.trim()&&E(w,T)}var b=r.getPackages().reduce(function(w,T){return w[T.uri]=T.prefix,w},Object.entries(Au).reduce(function(w,[T,L]){return w[L]=T,w},r.config&&r.config.nsMap||{}));return s.ns(b).on("openTag",function(w,T,L,A){var F=w.attrs||{},H=Object.keys(F).reduce(function(z,ue){var je=T(F[ue]);return z[ue]=je,z},{}),N={name:w.name,originalName:w.originalName,attributes:H,ns:w.ns};R(N,A)}).on("question",g).on("closeTag",f).on("cdata",E).on("text",function(w,T,L){x(T(w),L)}).on("error",u).on("warn",l),new Promise(function(w,T){var L;try{s.parse(e),p()}catch(z){L=z}var A=i.element;!L&&!A&&(L=Vi("failed to parse document as <"+i.type.$descriptor.name+">"));var F=a.warnings,H=a.references,N=a.elementsById;return L?(L.warnings=F,T(L)):w({rootElement:A,elementsById:N,references:H,warnings:F})})},Du.prototype.handler=function(e){return new ku(this.model,e)};function e0(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var t0=`<?xml version="1.0" encoding="UTF-8"?>
|
|
5
|
+
`,n0=/<|>|'|"|&|\n\r|\n/g,nd=/<|>|&/g;function ai(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}ai.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},ai.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},ai.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},ai.prototype.add=function(e,t){this.uriMap[e.uri]=e,t?this.wellknown.push(e):this.custom.push(e),this.mapPrefix(e.prefix,e.uri)},ai.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},ai.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},ai.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri},ai.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},ai.prototype.getUsed=function(e){var t=[].concat(this.wellknown,this.custom);return t.filter(n=>{var i=this.getNSKey(n);return this.used[i]})};function i0(e){return e.charAt(0).toLowerCase()+e.slice(1)}function r0(e,t){return Qf(t)?i0(e):e}function id(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function rd(e){return vn(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function o0(e){return e.getUsed().filter(function(t){return t.prefix!=="xml"}).map(function(t){var n="xmlns"+(t.prefix?":"+t.prefix:"");return{name:n,value:t.uri}})}function a0(e,t){return t.isGeneric?D({localName:t.ns.localName},e):D({localName:r0(t.ns.localName,t.$pkg)},e)}function s0(e,t){return D({localName:t.ns.localName},e)}function c0(e){var t=e.$descriptor;return Oe(t.properties,function(n){var i=n.name;if(n.isVirtual||!_n(e,i))return!1;var r=e[i];return r===n.default||r===null?!1:n.isMany?r.length:!0})}var u0={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},l0={"<":"lt",">":"gt","&":"amp"};function od(e,t,n){return e=vn(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function p0(e){return od(e,n0,u0)}function f0(e){return od(e,nd,l0)}function d0(e){return Oe(e,function(t){return t.isAttr})}function h0(e){return Oe(e,function(t){return!t.isAttr})}function Ou(e){this.tagName=e}Ou.prototype.build=function(e){return this.element=e,this},Ou.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()};function Rr(){}Rr.prototype.serializeValue=Rr.prototype.serializeTo=function(e){e.append(this.escape?f0(this.value):this.value)},Rr.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(nd)!==-1&&(this.escape=!0),this};function Lu(e){this.tagName=e}id(Lu,Rr),Lu.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()};function pt(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}pt.prototype.build=function(e){this.element=e;var t=e.$descriptor,n=this.propertyDescriptor,i,r,o=t.isGeneric;return o?i=this.parseGenericNsAttributes(e):i=this.parseNsAttributes(e),n?this.ns=this.nsPropertyTagName(n):this.ns=this.nsTagName(t),this.tagName=this.addTagName(this.ns),o?this.parseGenericContainments(e):(r=c0(e),this.parseAttributes(d0(r)),this.parseContainments(h0(r))),this.parseGenericAttributes(e,i),this},pt.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return a0(t,e)},pt.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return s0(t,e)},pt.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},pt.prototype.nsAttributeName=function(e){var t;if(vn(e)?t=rn(e):t=e.ns,e.inherited)return{localName:t.localName};var n=this.logNamespaceUsed(t);return this.getNamespaces().logUsed(n),this.isLocalNs(n)?{localName:t.localName}:D({localName:t.localName},n)},pt.prototype.parseGenericNsAttributes=function(e){return Object.entries(e).filter(([t,n])=>!t.startsWith("$")&&this.parseNsAttribute(e,t,n)).map(([t,n])=>({name:t,value:n}))},pt.prototype.parseGenericContainments=function(e){var t=e.$body;t&&this.body.push(new Rr().build({type:"String"},t));var n=e.$children;n&&M(n,i=>{this.body.push(new pt(this).build(i))})},pt.prototype.parseNsAttribute=function(e,t,n){var i=e.$model,r=rn(t),o;if(r.prefix==="xmlns"&&(o={prefix:r.localName,uri:n}),!r.prefix&&r.localName==="xmlns"&&(o={uri:n}),!o)return{name:t,value:n};if(i&&i.getPackage(n))this.logNamespace(o,!0,!0);else{var a=this.logNamespaceUsed(o,!0);this.getNamespaces().logUsed(a)}},pt.prototype.parseNsAttributes=function(e){var t=this,n=e.$attrs,i=[];return M(n,function(r,o){var a=t.parseNsAttribute(e,o,r);a&&i.push(a)}),i},pt.prototype.parseGenericAttributes=function(e,t){var n=this;M(t,function(i){try{n.addAttribute(n.nsAttributeName(i.name),i.value)}catch(r){typeof console<"u"&&console.warn(`missing namespace information for <${i.name}=${i.value}> on`,e,r)}})},pt.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;M(e,function(r){var o=i.get(r.name),a=r.isReference,s=r.isMany;if(s||(o=[o]),r.isBody)n.push(new Rr().build(r,o[0]));else if(Wf(r.type))M(o,function(u){n.push(new Lu(t.addTagName(t.nsPropertyTagName(r))).build(r,u))});else if(a)M(o,function(u){n.push(new Ou(t.addTagName(t.nsPropertyTagName(r))).build(u))});else{var c=ed(r);M(o,function(u){var l;c?c===Jf?l=new pt(t,r):l=new Qa(t,r,c):l=new pt(t),n.push(l.build(u))})}})},pt.prototype.getNamespaces=function(e){var t=this.namespaces,n=this.parent,i;return t||(i=n&&n.getNamespaces(),e||!i?this.namespaces=t=new ai(i):t=i),t},pt.prototype.logNamespace=function(e,t,n){var i=this.getNamespaces(n),r=e.uri,o=e.prefix,a=i.byUri(r);return(!a||n)&&i.add(e,t),i.mapPrefix(o,r),e},pt.prototype.logNamespaceUsed=function(e,t){var n=this.getNamespaces(t),i=e.prefix,r=e.uri,o,a,s;if(!i&&!r)return{localName:e.localName};if(s=n.defaultUriByPrefix(i),r=r||s||n.uriByPrefix(i),!r)throw new Error("no namespace uri given for prefix <"+i+">");if(e=n.byUri(r),!e&&!i&&(e=this.logNamespace({uri:r},s===r,!0)),!e){for(o=i,a=1;n.uriByPrefix(o);)o=i+"_"+a++;e=this.logNamespace({prefix:o,uri:r},s===r)}return i&&n.mapPrefix(i,r),e},pt.prototype.parseAttributes=function(e){var t=this,n=this.element;M(e,function(i){var r=n.get(i.name);if(i.isReference)if(!i.isMany)r=r.id;else{var o=[];M(r,function(a){o.push(a.id)}),r=o.join(" ")}t.addAttribute(t.nsAttributeName(i),r)})},pt.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),rd(e)},pt.prototype.addAttribute=function(e,t){var n=this.attrs;vn(t)&&(t=p0(t));var i=Hf(n,function(o){return o.name.localName===e.localName&&o.name.uri===e.uri&&o.name.prefix===e.prefix}),r={name:e,value:t};i!==-1?n.splice(i,1,r):n.push(r)},pt.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=o0(n).concat(t)),M(t,function(i){e.append(" ").append(rd(i.name)).append('="').append(i.value).append('"')})},pt.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==Rr;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),M(this.body,function(i){i.serializeTo(e)}),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()};function Qa(e,t,n){pt.call(this,e,t),this.serialization=n}id(Qa,pt),Qa.prototype.parseNsAttributes=function(e){var t=pt.prototype.parseNsAttributes.call(this,e).filter(a=>a.name!==this.serialization),n=e.$descriptor;if(n.name===this.propertyDescriptor.type)return t;var i=this.typeNs=this.nsTagName(n);this.getNamespaces().logUsed(this.typeNs);var r=e.$model.getPackage(i.uri),o=r.xml&&r.xml.typePrefix||"";return this.addAttribute(this.nsAttributeName(this.serialization),(i.prefix?i.prefix+":":"")+o+n.ns.localName),t},Qa.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function m0(){this.value="",this.write=function(e){this.value+=e}}function g0(e,t){var n=[""];this.append=function(i){return e.write(i),this},this.appendNewLine=function(){return t&&e.write(`
|
|
6
|
+
`),this},this.appendIndent=function(){return t&&e.write(n.join(" ")),this},this.indent=function(){return n.push(""),this},this.unindent=function(){return n.pop(),this}}function y0(e){e=D({format:!1,preamble:!0},e||{});function t(n,i){var r=i||new m0,o=new g0(r,e.format);e.preamble&&o.append(t0);var a=new pt,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(v0(s)),a.build(n).serializeTo(o),!i)return r.value}return{toXML:t}}function v0(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in Au)n[i]=Au[i];for(const i in t){const r=t[i];n[r]=i}for(const i of e.getPackages())n[i.prefix]=i.uri;return n}function Ja(e,t){$n.call(this,e,t)}Ja.prototype=Object.create($n.prototype),Ja.prototype.fromXML=function(e,t,n){vn(t)||(n=t,t="bpmn:Definitions");var i=new Du(D({model:this,lax:!0},n)),r=i.handler(t);return i.fromXML(e,r)},Ja.prototype.toXML=function(e,t){var n=new y0(t);return new Promise(function(i,r){try{var o=n.toXML(e);return i({xml:o})}catch(a){return r(a)}})};var _0="BPMN20",b0="http://www.omg.org/spec/BPMN/20100524/MODEL",x0="bpmn",E0=[],w0=[{name:"Interface",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"operations",type:"Operation",isMany:!0},{name:"implementationRef",isAttr:!0,type:"String"}]},{name:"Operation",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"inMessageRef",type:"Message",isReference:!0},{name:"outMessageRef",type:"Message",isReference:!0},{name:"errorRef",type:"Error",isMany:!0,isReference:!0},{name:"implementationRef",isAttr:!0,type:"String"}]},{name:"EndPoint",superClass:["RootElement"]},{name:"Auditing",superClass:["BaseElement"]},{name:"GlobalTask",superClass:["CallableElement"],properties:[{name:"resources",type:"ResourceRole",isMany:!0}]},{name:"Monitoring",superClass:["BaseElement"]},{name:"Performer",superClass:["ResourceRole"]},{name:"Process",superClass:["FlowElementsContainer","CallableElement"],properties:[{name:"processType",type:"ProcessType",isAttr:!0},{name:"isClosed",isAttr:!0,type:"Boolean"},{name:"auditing",type:"Auditing"},{name:"monitoring",type:"Monitoring"},{name:"properties",type:"Property",isMany:!0},{name:"laneSets",isMany:!0,replaces:"FlowElementsContainer#laneSets",type:"LaneSet"},{name:"flowElements",isMany:!0,replaces:"FlowElementsContainer#flowElements",type:"FlowElement"},{name:"artifacts",type:"Artifact",isMany:!0},{name:"resources",type:"ResourceRole",isMany:!0},{name:"correlationSubscriptions",type:"CorrelationSubscription",isMany:!0},{name:"supports",type:"Process",isMany:!0,isReference:!0},{name:"definitionalCollaborationRef",type:"Collaboration",isAttr:!0,isReference:!0},{name:"isExecutable",isAttr:!0,type:"Boolean"}]},{name:"LaneSet",superClass:["BaseElement"],properties:[{name:"lanes",type:"Lane",isMany:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Lane",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"partitionElementRef",type:"BaseElement",isAttr:!0,isReference:!0},{name:"partitionElement",type:"BaseElement"},{name:"flowNodeRef",type:"FlowNode",isMany:!0,isReference:!0},{name:"childLaneSet",type:"LaneSet",xml:{serialize:"xsi:type"}}]},{name:"GlobalManualTask",superClass:["GlobalTask"]},{name:"ManualTask",superClass:["Task"]},{name:"UserTask",superClass:["Task"],properties:[{name:"renderings",type:"Rendering",isMany:!0},{name:"implementation",isAttr:!0,type:"String"}]},{name:"Rendering",superClass:["BaseElement"]},{name:"HumanPerformer",superClass:["Performer"]},{name:"PotentialOwner",superClass:["HumanPerformer"]},{name:"GlobalUserTask",superClass:["GlobalTask"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"renderings",type:"Rendering",isMany:!0}]},{name:"Gateway",isAbstract:!0,superClass:["FlowNode"],properties:[{name:"gatewayDirection",type:"GatewayDirection",default:"Unspecified",isAttr:!0}]},{name:"EventBasedGateway",superClass:["Gateway"],properties:[{name:"instantiate",default:!1,isAttr:!0,type:"Boolean"},{name:"eventGatewayType",type:"EventBasedGatewayType",isAttr:!0,default:"Exclusive"}]},{name:"ComplexGateway",superClass:["Gateway"],properties:[{name:"activationCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0}]},{name:"ExclusiveGateway",superClass:["Gateway"],properties:[{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0}]},{name:"InclusiveGateway",superClass:["Gateway"],properties:[{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0}]},{name:"ParallelGateway",superClass:["Gateway"]},{name:"RootElement",isAbstract:!0,superClass:["BaseElement"]},{name:"Relationship",superClass:["BaseElement"],properties:[{name:"type",isAttr:!0,type:"String"},{name:"direction",type:"RelationshipDirection",isAttr:!0},{name:"source",isMany:!0,isReference:!0,type:"Element"},{name:"target",isMany:!0,isReference:!0,type:"Element"}]},{name:"BaseElement",isAbstract:!0,properties:[{name:"id",isAttr:!0,type:"String",isId:!0},{name:"documentation",type:"Documentation",isMany:!0},{name:"extensionDefinitions",type:"ExtensionDefinition",isMany:!0,isReference:!0},{name:"extensionElements",type:"ExtensionElements"}]},{name:"Extension",properties:[{name:"mustUnderstand",default:!1,isAttr:!0,type:"Boolean"},{name:"definition",type:"ExtensionDefinition",isAttr:!0,isReference:!0}]},{name:"ExtensionDefinition",properties:[{name:"name",isAttr:!0,type:"String"},{name:"extensionAttributeDefinitions",type:"ExtensionAttributeDefinition",isMany:!0}]},{name:"ExtensionAttributeDefinition",properties:[{name:"name",isAttr:!0,type:"String"},{name:"type",isAttr:!0,type:"String"},{name:"isReference",default:!1,isAttr:!0,type:"Boolean"},{name:"extensionDefinition",type:"ExtensionDefinition",isAttr:!0,isReference:!0}]},{name:"ExtensionElements",properties:[{name:"valueRef",isAttr:!0,isReference:!0,type:"Element"},{name:"values",type:"Element",isMany:!0},{name:"extensionAttributeDefinition",type:"ExtensionAttributeDefinition",isAttr:!0,isReference:!0}]},{name:"Documentation",superClass:["BaseElement"],properties:[{name:"text",type:"String",isBody:!0},{name:"textFormat",default:"text/plain",isAttr:!0,type:"String"}]},{name:"Event",isAbstract:!0,superClass:["FlowNode","InteractionNode"],properties:[{name:"properties",type:"Property",isMany:!0}]},{name:"IntermediateCatchEvent",superClass:["CatchEvent"]},{name:"IntermediateThrowEvent",superClass:["ThrowEvent"]},{name:"EndEvent",superClass:["ThrowEvent"]},{name:"StartEvent",superClass:["CatchEvent"],properties:[{name:"isInterrupting",default:!0,isAttr:!0,type:"Boolean"}]},{name:"ThrowEvent",isAbstract:!0,superClass:["Event"],properties:[{name:"dataInputs",type:"DataInput",isMany:!0},{name:"dataInputAssociations",type:"DataInputAssociation",isMany:!0},{name:"inputSet",type:"InputSet"},{name:"eventDefinitions",type:"EventDefinition",isMany:!0},{name:"eventDefinitionRef",type:"EventDefinition",isMany:!0,isReference:!0}]},{name:"CatchEvent",isAbstract:!0,superClass:["Event"],properties:[{name:"parallelMultiple",isAttr:!0,type:"Boolean",default:!1},{name:"dataOutputs",type:"DataOutput",isMany:!0},{name:"dataOutputAssociations",type:"DataOutputAssociation",isMany:!0},{name:"outputSet",type:"OutputSet"},{name:"eventDefinitions",type:"EventDefinition",isMany:!0},{name:"eventDefinitionRef",type:"EventDefinition",isMany:!0,isReference:!0}]},{name:"BoundaryEvent",superClass:["CatchEvent"],properties:[{name:"cancelActivity",default:!0,isAttr:!0,type:"Boolean"},{name:"attachedToRef",type:"Activity",isAttr:!0,isReference:!0}]},{name:"EventDefinition",isAbstract:!0,superClass:["RootElement"]},{name:"CancelEventDefinition",superClass:["EventDefinition"]},{name:"ErrorEventDefinition",superClass:["EventDefinition"],properties:[{name:"errorRef",type:"Error",isAttr:!0,isReference:!0}]},{name:"TerminateEventDefinition",superClass:["EventDefinition"]},{name:"EscalationEventDefinition",superClass:["EventDefinition"],properties:[{name:"escalationRef",type:"Escalation",isAttr:!0,isReference:!0}]},{name:"Escalation",properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"},{name:"escalationCode",isAttr:!0,type:"String"}],superClass:["RootElement"]},{name:"CompensateEventDefinition",superClass:["EventDefinition"],properties:[{name:"waitForCompletion",isAttr:!0,type:"Boolean",default:!0},{name:"activityRef",type:"Activity",isAttr:!0,isReference:!0}]},{name:"TimerEventDefinition",superClass:["EventDefinition"],properties:[{name:"timeDate",type:"Expression",xml:{serialize:"xsi:type"}},{name:"timeCycle",type:"Expression",xml:{serialize:"xsi:type"}},{name:"timeDuration",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"LinkEventDefinition",superClass:["EventDefinition"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"target",type:"LinkEventDefinition",isReference:!0},{name:"source",type:"LinkEventDefinition",isMany:!0,isReference:!0}]},{name:"MessageEventDefinition",superClass:["EventDefinition"],properties:[{name:"messageRef",type:"Message",isAttr:!0,isReference:!0},{name:"operationRef",type:"Operation",isReference:!0}]},{name:"ConditionalEventDefinition",superClass:["EventDefinition"],properties:[{name:"condition",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"SignalEventDefinition",superClass:["EventDefinition"],properties:[{name:"signalRef",type:"Signal",isAttr:!0,isReference:!0}]},{name:"Signal",superClass:["RootElement"],properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"ImplicitThrowEvent",superClass:["ThrowEvent"]},{name:"DataState",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"}]},{name:"ItemAwareElement",superClass:["BaseElement"],properties:[{name:"itemSubjectRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"dataState",type:"DataState"}]},{name:"DataAssociation",superClass:["BaseElement"],properties:[{name:"sourceRef",type:"ItemAwareElement",isMany:!0,isReference:!0},{name:"targetRef",type:"ItemAwareElement",isReference:!0},{name:"transformation",type:"FormalExpression",xml:{serialize:"property"}},{name:"assignment",type:"Assignment",isMany:!0}]},{name:"DataInput",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"inputSetRef",type:"InputSet",isMany:!0,isVirtual:!0,isReference:!0},{name:"inputSetWithOptional",type:"InputSet",isMany:!0,isVirtual:!0,isReference:!0},{name:"inputSetWithWhileExecuting",type:"InputSet",isMany:!0,isVirtual:!0,isReference:!0}]},{name:"DataOutput",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"outputSetRef",type:"OutputSet",isMany:!0,isVirtual:!0,isReference:!0},{name:"outputSetWithOptional",type:"OutputSet",isMany:!0,isVirtual:!0,isReference:!0},{name:"outputSetWithWhileExecuting",type:"OutputSet",isMany:!0,isVirtual:!0,isReference:!0}]},{name:"InputSet",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"dataInputRefs",type:"DataInput",isMany:!0,isReference:!0},{name:"optionalInputRefs",type:"DataInput",isMany:!0,isReference:!0},{name:"whileExecutingInputRefs",type:"DataInput",isMany:!0,isReference:!0},{name:"outputSetRefs",type:"OutputSet",isMany:!0,isReference:!0}]},{name:"OutputSet",superClass:["BaseElement"],properties:[{name:"dataOutputRefs",type:"DataOutput",isMany:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"},{name:"inputSetRefs",type:"InputSet",isMany:!0,isReference:!0},{name:"optionalOutputRefs",type:"DataOutput",isMany:!0,isReference:!0},{name:"whileExecutingOutputRefs",type:"DataOutput",isMany:!0,isReference:!0}]},{name:"Property",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"}]},{name:"DataInputAssociation",superClass:["DataAssociation"]},{name:"DataOutputAssociation",superClass:["DataAssociation"]},{name:"InputOutputSpecification",superClass:["BaseElement"],properties:[{name:"dataInputs",type:"DataInput",isMany:!0},{name:"dataOutputs",type:"DataOutput",isMany:!0},{name:"inputSets",type:"InputSet",isMany:!0},{name:"outputSets",type:"OutputSet",isMany:!0}]},{name:"DataObject",superClass:["FlowElement","ItemAwareElement"],properties:[{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"}]},{name:"InputOutputBinding",properties:[{name:"inputDataRef",type:"InputSet",isAttr:!0,isReference:!0},{name:"outputDataRef",type:"OutputSet",isAttr:!0,isReference:!0},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0}]},{name:"Assignment",superClass:["BaseElement"],properties:[{name:"from",type:"Expression",xml:{serialize:"xsi:type"}},{name:"to",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"DataStore",superClass:["RootElement","ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"capacity",isAttr:!0,type:"Integer"},{name:"isUnlimited",default:!0,isAttr:!0,type:"Boolean"}]},{name:"DataStoreReference",superClass:["ItemAwareElement","FlowElement"],properties:[{name:"dataStoreRef",type:"DataStore",isAttr:!0,isReference:!0}]},{name:"DataObjectReference",superClass:["ItemAwareElement","FlowElement"],properties:[{name:"dataObjectRef",type:"DataObject",isAttr:!0,isReference:!0}]},{name:"ConversationLink",superClass:["BaseElement"],properties:[{name:"sourceRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"ConversationAssociation",superClass:["BaseElement"],properties:[{name:"innerConversationNodeRef",type:"ConversationNode",isAttr:!0,isReference:!0},{name:"outerConversationNodeRef",type:"ConversationNode",isAttr:!0,isReference:!0}]},{name:"CallConversation",superClass:["ConversationNode"],properties:[{name:"calledCollaborationRef",type:"Collaboration",isAttr:!0,isReference:!0},{name:"participantAssociations",type:"ParticipantAssociation",isMany:!0}]},{name:"Conversation",superClass:["ConversationNode"]},{name:"SubConversation",superClass:["ConversationNode"],properties:[{name:"conversationNodes",type:"ConversationNode",isMany:!0}]},{name:"ConversationNode",isAbstract:!0,superClass:["InteractionNode","BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"participantRef",type:"Participant",isMany:!0,isReference:!0},{name:"messageFlowRefs",type:"MessageFlow",isMany:!0,isReference:!0},{name:"correlationKeys",type:"CorrelationKey",isMany:!0}]},{name:"GlobalConversation",superClass:["Collaboration"]},{name:"PartnerEntity",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"participantRef",type:"Participant",isMany:!0,isReference:!0}]},{name:"PartnerRole",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"participantRef",type:"Participant",isMany:!0,isReference:!0}]},{name:"CorrelationProperty",superClass:["RootElement"],properties:[{name:"correlationPropertyRetrievalExpression",type:"CorrelationPropertyRetrievalExpression",isMany:!0},{name:"name",isAttr:!0,type:"String"},{name:"type",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"Error",superClass:["RootElement"],properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"},{name:"errorCode",isAttr:!0,type:"String"}]},{name:"CorrelationKey",superClass:["BaseElement"],properties:[{name:"correlationPropertyRef",type:"CorrelationProperty",isMany:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Expression",superClass:["BaseElement"],isAbstract:!1,properties:[{name:"body",isBody:!0,type:"String"}]},{name:"FormalExpression",superClass:["Expression"],properties:[{name:"language",isAttr:!0,type:"String"},{name:"evaluatesToTypeRef",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"Message",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"itemRef",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"ItemDefinition",superClass:["RootElement"],properties:[{name:"itemKind",type:"ItemKind",isAttr:!0},{name:"structureRef",isAttr:!0,type:"String"},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"import",type:"Import",isAttr:!0,isReference:!0}]},{name:"FlowElement",isAbstract:!0,superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"auditing",type:"Auditing"},{name:"monitoring",type:"Monitoring"},{name:"categoryValueRef",type:"CategoryValue",isMany:!0,isReference:!0}]},{name:"SequenceFlow",superClass:["FlowElement"],properties:[{name:"isImmediate",isAttr:!0,type:"Boolean"},{name:"conditionExpression",type:"Expression",xml:{serialize:"xsi:type"}},{name:"sourceRef",type:"FlowNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"FlowNode",isAttr:!0,isReference:!0}]},{name:"FlowElementsContainer",isAbstract:!0,superClass:["BaseElement"],properties:[{name:"laneSets",type:"LaneSet",isMany:!0},{name:"flowElements",type:"FlowElement",isMany:!0}]},{name:"CallableElement",isAbstract:!0,superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"ioSpecification",type:"InputOutputSpecification",xml:{serialize:"property"}},{name:"supportedInterfaceRef",type:"Interface",isMany:!0,isReference:!0},{name:"ioBinding",type:"InputOutputBinding",isMany:!0,xml:{serialize:"property"}}]},{name:"FlowNode",isAbstract:!0,superClass:["FlowElement"],properties:[{name:"incoming",type:"SequenceFlow",isMany:!0,isReference:!0},{name:"outgoing",type:"SequenceFlow",isMany:!0,isReference:!0},{name:"lanes",type:"Lane",isMany:!0,isVirtual:!0,isReference:!0}]},{name:"CorrelationPropertyRetrievalExpression",superClass:["BaseElement"],properties:[{name:"messagePath",type:"FormalExpression"},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"CorrelationPropertyBinding",superClass:["BaseElement"],properties:[{name:"dataPath",type:"FormalExpression"},{name:"correlationPropertyRef",type:"CorrelationProperty",isAttr:!0,isReference:!0}]},{name:"Resource",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"resourceParameters",type:"ResourceParameter",isMany:!0}]},{name:"ResourceParameter",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isRequired",isAttr:!0,type:"Boolean"},{name:"type",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"CorrelationSubscription",superClass:["BaseElement"],properties:[{name:"correlationKeyRef",type:"CorrelationKey",isAttr:!0,isReference:!0},{name:"correlationPropertyBinding",type:"CorrelationPropertyBinding",isMany:!0}]},{name:"MessageFlow",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"sourceRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"MessageFlowAssociation",superClass:["BaseElement"],properties:[{name:"innerMessageFlowRef",type:"MessageFlow",isAttr:!0,isReference:!0},{name:"outerMessageFlowRef",type:"MessageFlow",isAttr:!0,isReference:!0}]},{name:"InteractionNode",isAbstract:!0,properties:[{name:"incomingConversationLinks",type:"ConversationLink",isMany:!0,isVirtual:!0,isReference:!0},{name:"outgoingConversationLinks",type:"ConversationLink",isMany:!0,isVirtual:!0,isReference:!0}]},{name:"Participant",superClass:["InteractionNode","BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"interfaceRef",type:"Interface",isMany:!0,isReference:!0},{name:"participantMultiplicity",type:"ParticipantMultiplicity"},{name:"endPointRefs",type:"EndPoint",isMany:!0,isReference:!0},{name:"processRef",type:"Process",isAttr:!0,isReference:!0}]},{name:"ParticipantAssociation",superClass:["BaseElement"],properties:[{name:"innerParticipantRef",type:"Participant",isAttr:!0,isReference:!0},{name:"outerParticipantRef",type:"Participant",isAttr:!0,isReference:!0}]},{name:"ParticipantMultiplicity",properties:[{name:"minimum",default:0,isAttr:!0,type:"Integer"},{name:"maximum",default:1,isAttr:!0,type:"Integer"}],superClass:["BaseElement"]},{name:"Collaboration",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isClosed",isAttr:!0,type:"Boolean"},{name:"participants",type:"Participant",isMany:!0},{name:"messageFlows",type:"MessageFlow",isMany:!0},{name:"artifacts",type:"Artifact",isMany:!0},{name:"conversations",type:"ConversationNode",isMany:!0},{name:"conversationAssociations",type:"ConversationAssociation"},{name:"participantAssociations",type:"ParticipantAssociation",isMany:!0},{name:"messageFlowAssociations",type:"MessageFlowAssociation",isMany:!0},{name:"correlationKeys",type:"CorrelationKey",isMany:!0},{name:"choreographyRef",type:"Choreography",isMany:!0,isReference:!0},{name:"conversationLinks",type:"ConversationLink",isMany:!0}]},{name:"ChoreographyActivity",isAbstract:!0,superClass:["FlowNode"],properties:[{name:"participantRef",type:"Participant",isMany:!0,isReference:!0},{name:"initiatingParticipantRef",type:"Participant",isAttr:!0,isReference:!0},{name:"correlationKeys",type:"CorrelationKey",isMany:!0},{name:"loopType",type:"ChoreographyLoopType",default:"None",isAttr:!0}]},{name:"CallChoreography",superClass:["ChoreographyActivity"],properties:[{name:"calledChoreographyRef",type:"Choreography",isAttr:!0,isReference:!0},{name:"participantAssociations",type:"ParticipantAssociation",isMany:!0}]},{name:"SubChoreography",superClass:["ChoreographyActivity","FlowElementsContainer"],properties:[{name:"artifacts",type:"Artifact",isMany:!0}]},{name:"ChoreographyTask",superClass:["ChoreographyActivity"],properties:[{name:"messageFlowRef",type:"MessageFlow",isMany:!0,isReference:!0}]},{name:"Choreography",superClass:["Collaboration","FlowElementsContainer"]},{name:"GlobalChoreographyTask",superClass:["Choreography"],properties:[{name:"initiatingParticipantRef",type:"Participant",isAttr:!0,isReference:!0}]},{name:"TextAnnotation",superClass:["Artifact"],properties:[{name:"text",type:"String"},{name:"textFormat",default:"text/plain",isAttr:!0,type:"String"}]},{name:"Group",superClass:["Artifact"],properties:[{name:"categoryValueRef",type:"CategoryValue",isAttr:!0,isReference:!0}]},{name:"Association",superClass:["Artifact"],properties:[{name:"associationDirection",type:"AssociationDirection",isAttr:!0},{name:"sourceRef",type:"BaseElement",isAttr:!0,isReference:!0},{name:"targetRef",type:"BaseElement",isAttr:!0,isReference:!0}]},{name:"Category",superClass:["RootElement"],properties:[{name:"categoryValue",type:"CategoryValue",isMany:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Artifact",isAbstract:!0,superClass:["BaseElement"]},{name:"CategoryValue",superClass:["BaseElement"],properties:[{name:"categorizedFlowElements",type:"FlowElement",isMany:!0,isVirtual:!0,isReference:!0},{name:"value",isAttr:!0,type:"String"}]},{name:"Activity",isAbstract:!0,superClass:["FlowNode"],properties:[{name:"isForCompensation",default:!1,isAttr:!0,type:"Boolean"},{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0},{name:"ioSpecification",type:"InputOutputSpecification",xml:{serialize:"property"}},{name:"boundaryEventRefs",type:"BoundaryEvent",isMany:!0,isReference:!0},{name:"properties",type:"Property",isMany:!0},{name:"dataInputAssociations",type:"DataInputAssociation",isMany:!0},{name:"dataOutputAssociations",type:"DataOutputAssociation",isMany:!0},{name:"startQuantity",default:1,isAttr:!0,type:"Integer"},{name:"resources",type:"ResourceRole",isMany:!0},{name:"completionQuantity",default:1,isAttr:!0,type:"Integer"},{name:"loopCharacteristics",type:"LoopCharacteristics"}]},{name:"ServiceTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0}]},{name:"SubProcess",superClass:["Activity","FlowElementsContainer","InteractionNode"],properties:[{name:"triggeredByEvent",default:!1,isAttr:!0,type:"Boolean"},{name:"artifacts",type:"Artifact",isMany:!0}]},{name:"LoopCharacteristics",isAbstract:!0,superClass:["BaseElement"]},{name:"MultiInstanceLoopCharacteristics",superClass:["LoopCharacteristics"],properties:[{name:"isSequential",default:!1,isAttr:!0,type:"Boolean"},{name:"behavior",type:"MultiInstanceBehavior",default:"All",isAttr:!0},{name:"loopCardinality",type:"Expression",xml:{serialize:"xsi:type"}},{name:"loopDataInputRef",type:"ItemAwareElement",isReference:!0},{name:"loopDataOutputRef",type:"ItemAwareElement",isReference:!0},{name:"inputDataItem",type:"DataInput",xml:{serialize:"property"}},{name:"outputDataItem",type:"DataOutput",xml:{serialize:"property"}},{name:"complexBehaviorDefinition",type:"ComplexBehaviorDefinition",isMany:!0},{name:"completionCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"oneBehaviorEventRef",type:"EventDefinition",isAttr:!0,isReference:!0},{name:"noneBehaviorEventRef",type:"EventDefinition",isAttr:!0,isReference:!0}]},{name:"StandardLoopCharacteristics",superClass:["LoopCharacteristics"],properties:[{name:"testBefore",default:!1,isAttr:!0,type:"Boolean"},{name:"loopCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"loopMaximum",type:"Integer",isAttr:!0}]},{name:"CallActivity",superClass:["Activity","InteractionNode"],properties:[{name:"calledElement",type:"String",isAttr:!0}]},{name:"Task",superClass:["Activity","InteractionNode"]},{name:"SendTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"ReceiveTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"instantiate",default:!1,isAttr:!0,type:"Boolean"},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"ScriptTask",superClass:["Task"],properties:[{name:"scriptFormat",isAttr:!0,type:"String"},{name:"script",type:"String"}]},{name:"BusinessRuleTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"}]},{name:"AdHocSubProcess",superClass:["SubProcess"],properties:[{name:"completionCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"ordering",type:"AdHocOrdering",isAttr:!0},{name:"cancelRemainingInstances",default:!0,isAttr:!0,type:"Boolean"}]},{name:"Transaction",superClass:["SubProcess"],properties:[{name:"protocol",isAttr:!0,type:"String"},{name:"method",isAttr:!0,type:"String"}]},{name:"GlobalScriptTask",superClass:["GlobalTask"],properties:[{name:"scriptLanguage",isAttr:!0,type:"String"},{name:"script",isAttr:!0,type:"String"}]},{name:"GlobalBusinessRuleTask",superClass:["GlobalTask"],properties:[{name:"implementation",isAttr:!0,type:"String"}]},{name:"ComplexBehaviorDefinition",superClass:["BaseElement"],properties:[{name:"condition",type:"FormalExpression"},{name:"event",type:"ImplicitThrowEvent"}]},{name:"ResourceRole",superClass:["BaseElement"],properties:[{name:"resourceRef",type:"Resource",isReference:!0},{name:"resourceParameterBindings",type:"ResourceParameterBinding",isMany:!0},{name:"resourceAssignmentExpression",type:"ResourceAssignmentExpression"},{name:"name",isAttr:!0,type:"String"}]},{name:"ResourceParameterBinding",properties:[{name:"expression",type:"Expression",xml:{serialize:"xsi:type"}},{name:"parameterRef",type:"ResourceParameter",isAttr:!0,isReference:!0}],superClass:["BaseElement"]},{name:"ResourceAssignmentExpression",properties:[{name:"expression",type:"Expression",xml:{serialize:"xsi:type"}}],superClass:["BaseElement"]},{name:"Import",properties:[{name:"importType",isAttr:!0,type:"String"},{name:"location",isAttr:!0,type:"String"},{name:"namespace",isAttr:!0,type:"String"}]},{name:"Definitions",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"targetNamespace",isAttr:!0,type:"String"},{name:"expressionLanguage",default:"http://www.w3.org/1999/XPath",isAttr:!0,type:"String"},{name:"typeLanguage",default:"http://www.w3.org/2001/XMLSchema",isAttr:!0,type:"String"},{name:"imports",type:"Import",isMany:!0},{name:"extensions",type:"Extension",isMany:!0},{name:"rootElements",type:"RootElement",isMany:!0},{name:"diagrams",isMany:!0,type:"bpmndi:BPMNDiagram"},{name:"exporter",isAttr:!0,type:"String"},{name:"relationships",type:"Relationship",isMany:!0},{name:"exporterVersion",isAttr:!0,type:"String"}]}],S0=[{name:"ProcessType",literalValues:[{name:"None"},{name:"Public"},{name:"Private"}]},{name:"GatewayDirection",literalValues:[{name:"Unspecified"},{name:"Converging"},{name:"Diverging"},{name:"Mixed"}]},{name:"EventBasedGatewayType",literalValues:[{name:"Parallel"},{name:"Exclusive"}]},{name:"RelationshipDirection",literalValues:[{name:"None"},{name:"Forward"},{name:"Backward"},{name:"Both"}]},{name:"ItemKind",literalValues:[{name:"Physical"},{name:"Information"}]},{name:"ChoreographyLoopType",literalValues:[{name:"None"},{name:"Standard"},{name:"MultiInstanceSequential"},{name:"MultiInstanceParallel"}]},{name:"AssociationDirection",literalValues:[{name:"None"},{name:"One"},{name:"Both"}]},{name:"MultiInstanceBehavior",literalValues:[{name:"None"},{name:"One"},{name:"All"},{name:"Complex"}]},{name:"AdHocOrdering",literalValues:[{name:"Parallel"},{name:"Sequential"}]}],R0={tagAlias:"lowerCase",typePrefix:"t"},C0={name:_0,uri:b0,prefix:x0,associations:E0,types:w0,enumerations:S0,xml:R0},P0="BPMNDI",A0="http://www.omg.org/spec/BPMN/20100524/DI",T0="bpmndi",M0=[{name:"BPMNDiagram",properties:[{name:"plane",type:"BPMNPlane",redefines:"di:Diagram#rootElement"},{name:"labelStyle",type:"BPMNLabelStyle",isMany:!0}],superClass:["di:Diagram"]},{name:"BPMNPlane",properties:[{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"}],superClass:["di:Plane"]},{name:"BPMNShape",properties:[{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"},{name:"isHorizontal",isAttr:!0,type:"Boolean"},{name:"isExpanded",isAttr:!0,type:"Boolean"},{name:"isMarkerVisible",isAttr:!0,type:"Boolean"},{name:"label",type:"BPMNLabel"},{name:"isMessageVisible",isAttr:!0,type:"Boolean"},{name:"participantBandKind",type:"ParticipantBandKind",isAttr:!0},{name:"choreographyActivityShape",type:"BPMNShape",isAttr:!0,isReference:!0}],superClass:["di:LabeledShape"]},{name:"BPMNEdge",properties:[{name:"label",type:"BPMNLabel"},{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"},{name:"sourceElement",isAttr:!0,isReference:!0,type:"di:DiagramElement",redefines:"di:Edge#source"},{name:"targetElement",isAttr:!0,isReference:!0,type:"di:DiagramElement",redefines:"di:Edge#target"},{name:"messageVisibleKind",type:"MessageVisibleKind",isAttr:!0,default:"initiating"}],superClass:["di:LabeledEdge"]},{name:"BPMNLabel",properties:[{name:"labelStyle",type:"BPMNLabelStyle",isAttr:!0,isReference:!0,redefines:"di:DiagramElement#style"}],superClass:["di:Label"]},{name:"BPMNLabelStyle",properties:[{name:"font",type:"dc:Font"}],superClass:["di:Style"]}],k0=[{name:"ParticipantBandKind",literalValues:[{name:"top_initiating"},{name:"middle_initiating"},{name:"bottom_initiating"},{name:"top_non_initiating"},{name:"middle_non_initiating"},{name:"bottom_non_initiating"}]},{name:"MessageVisibleKind",literalValues:[{name:"initiating"},{name:"non_initiating"}]}],D0=[],O0={name:P0,uri:A0,prefix:T0,types:M0,enumerations:k0,associations:D0},L0="DC",I0="http://www.omg.org/spec/DD/20100524/DC",N0="dc",B0=[{name:"Boolean"},{name:"Integer"},{name:"Real"},{name:"String"},{name:"Font",properties:[{name:"name",type:"String",isAttr:!0},{name:"size",type:"Real",isAttr:!0},{name:"isBold",type:"Boolean",isAttr:!0},{name:"isItalic",type:"Boolean",isAttr:!0},{name:"isUnderline",type:"Boolean",isAttr:!0},{name:"isStrikeThrough",type:"Boolean",isAttr:!0}]},{name:"Point",properties:[{name:"x",type:"Real",default:"0",isAttr:!0},{name:"y",type:"Real",default:"0",isAttr:!0}]},{name:"Bounds",properties:[{name:"x",type:"Real",default:"0",isAttr:!0},{name:"y",type:"Real",default:"0",isAttr:!0},{name:"width",type:"Real",isAttr:!0},{name:"height",type:"Real",isAttr:!0}]}],$0=[],j0={name:L0,uri:I0,prefix:N0,types:B0,associations:$0},F0="DI",H0="http://www.omg.org/spec/DD/20100524/DI",z0="di",V0=[{name:"DiagramElement",isAbstract:!0,properties:[{name:"id",isAttr:!0,isId:!0,type:"String"},{name:"extension",type:"Extension"},{name:"owningDiagram",type:"Diagram",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"owningElement",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"modelElement",isReadOnly:!0,isVirtual:!0,isReference:!0,type:"Element"},{name:"style",type:"Style",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"ownedElement",type:"DiagramElement",isReadOnly:!0,isMany:!0,isVirtual:!0}]},{name:"Node",isAbstract:!0,superClass:["DiagramElement"]},{name:"Edge",isAbstract:!0,superClass:["DiagramElement"],properties:[{name:"source",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"target",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"waypoint",isUnique:!1,isMany:!0,type:"dc:Point",xml:{serialize:"xsi:type"}}]},{name:"Diagram",isAbstract:!0,properties:[{name:"id",isAttr:!0,isId:!0,type:"String"},{name:"rootElement",type:"DiagramElement",isReadOnly:!0,isVirtual:!0},{name:"name",isAttr:!0,type:"String"},{name:"documentation",isAttr:!0,type:"String"},{name:"resolution",isAttr:!0,type:"Real"},{name:"ownedStyle",type:"Style",isReadOnly:!0,isMany:!0,isVirtual:!0}]},{name:"Shape",isAbstract:!0,superClass:["Node"],properties:[{name:"bounds",type:"dc:Bounds"}]},{name:"Plane",isAbstract:!0,superClass:["Node"],properties:[{name:"planeElement",type:"DiagramElement",subsettedProperty:"DiagramElement-ownedElement",isMany:!0}]},{name:"LabeledEdge",isAbstract:!0,superClass:["Edge"],properties:[{name:"ownedLabel",type:"Label",isReadOnly:!0,subsettedProperty:"DiagramElement-ownedElement",isMany:!0,isVirtual:!0}]},{name:"LabeledShape",isAbstract:!0,superClass:["Shape"],properties:[{name:"ownedLabel",type:"Label",isReadOnly:!0,subsettedProperty:"DiagramElement-ownedElement",isMany:!0,isVirtual:!0}]},{name:"Label",isAbstract:!0,superClass:["Node"],properties:[{name:"bounds",type:"dc:Bounds"}]},{name:"Style",isAbstract:!0,properties:[{name:"id",isAttr:!0,isId:!0,type:"String"}]},{name:"Extension",properties:[{name:"values",isMany:!0,type:"Element"}]}],G0=[],W0={tagAlias:"lowerCase"},U0={name:F0,uri:H0,prefix:z0,types:V0,associations:G0,xml:W0},q0="bpmn.io colors for BPMN",Y0="http://bpmn.io/schema/bpmn/biocolor/1.0",K0="bioc",X0=[{name:"ColoredShape",extends:["bpmndi:BPMNShape"],properties:[{name:"stroke",isAttr:!0,type:"String"},{name:"fill",isAttr:!0,type:"String"}]},{name:"ColoredEdge",extends:["bpmndi:BPMNEdge"],properties:[{name:"stroke",isAttr:!0,type:"String"},{name:"fill",isAttr:!0,type:"String"}]}],Z0=[],Q0=[],J0={name:q0,uri:Y0,prefix:K0,types:X0,enumerations:Z0,associations:Q0},eE="BPMN in Color",tE="http://www.omg.org/spec/BPMN/non-normative/color/1.0",nE="color",iE=[{name:"ColoredLabel",extends:["bpmndi:BPMNLabel"],properties:[{name:"color",isAttr:!0,type:"String"}]},{name:"ColoredShape",extends:["bpmndi:BPMNShape"],properties:[{name:"background-color",isAttr:!0,type:"String"},{name:"border-color",isAttr:!0,type:"String"}]},{name:"ColoredEdge",extends:["bpmndi:BPMNEdge"],properties:[{name:"border-color",isAttr:!0,type:"String"}]}],rE=[],oE=[],aE={name:eE,uri:tE,prefix:nE,types:iE,enumerations:rE,associations:oE};const sE={bpmn:C0,bpmndi:O0,dc:j0,di:U0,bioc:J0,color:aE};function ad(e,t){const n=D({},sE,e);return new Ja(n,t)}const cE={name:"bpmn-i18n",uri:"http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",prefix:"i18n",types:[{name:"Translation",superClass:["Element"],properties:[{name:"id",isAttr:!0,isId:!0,type:"String"},{name:"body",isBody:!0,type:"String"},{name:"target",isAttr:!0,type:"String",default:"@name"},{name:"textFormat",isAttr:"true",type:"String",default:"text/plain"}]}],enumerations:[],associations:[],xml:{tagAlias:"lowerCase",typePrefix:"t"}},uE="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",sd="i18n",es={[sd]:cE,[yu]:Nf};function cd(){return ad(es)}const ud=cd();async function Iu(e){const{rootElement:t,warnings:n}=await ud.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function lE(e){const{xml:t}=await ud.toXML(e,{format:!0});return t}function Nu(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const ts=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),pE=1,fE=2;function Gi(e){switch(e.kind){case"label-over-line":return`L|${e.edge}|${e.line}`;case"edge-crosses-shape":return`x|${e.edge}|${e.shape}`;case"shape-overlap":return`o|${e.shapes[0]}|${e.shapes[1]}`;case"shape-outside-container":return`c|${e.shape}|${e.container}`;case"edge-overlap-opposite":return`p|${e.edges[0]}|${e.edges[1]}`;case"edge-overlap-mixed":return`m|${e.edges[0]}|${e.edges[1]}`;case"label-on-shared-segment":return`l|${e.edge}|${e.other}`;case"annotation-over-label":return`a|${e.annotation}|${e.label}`}}const ld=20,pd=1;function xn(e){const t=[];for(let n=0;n+1<e.waypoints.length;n++){const i=e.waypoints[n],r=e.waypoints[n+1];Math.abs(i.y-r.y)<.5&&Math.abs(i.x-r.x)>=.5?t.push({axis:"h",at:i.y,lo:Math.min(i.x,r.x),hi:Math.max(i.x,r.x),dir:r.x>i.x?1:-1}):Math.abs(i.x-r.x)<.5&&Math.abs(i.y-r.y)>=.5&&t.push({axis:"v",at:i.x,lo:Math.min(i.y,r.y),hi:Math.max(i.y,r.y),dir:r.y>i.y?1:-1})}return t}function ns(e,t){let n=null;const i=e.type!==t.type;for(const r of xn(e))for(const o of xn(t)){if(r.axis!==o.axis||Math.abs(r.at-o.at)>pd)continue;const a=r.dir!==o.dir?"opposite":i?"mixed":null;if(!a)continue;const s=Math.min(r.hi,o.hi)-Math.max(r.lo,o.lo);s>=ld&&(!n||s>n.length)&&(n={axis:r.axis,length:s,kind:a})}return n}function fd(e,t){const n=ns(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function dE(e,t){let n=0;for(const i of t)i.id!==e.id&&fd(e,i)&&n++;return n}function Ho(e,t){let n=0;for(const i of t)i.id!==e.id&&ns(e,i)&&n++;return n}const dd=15,hd=20;function hE(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-hd||t.at>n[1]+hd)return null;const i=t.axis==="v"?[e.y,e.y+e.height]:[e.x,e.x+e.width],r=Math.max(i[0],t.lo),o=Math.min(i[1],t.hi);return o>r?[r,o]:null}const Bu=20;function is(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>pd)continue;const r=Math.max(e.lo,i.lo),o=Math.min(e.hi,i.hi);o-r<ld||n.push([r-Bu,o+Bu])}return n}function rs(e,t){const n=e.label;if(!n)return null;let i=null;for(const r of xn(e)){const o=hE(n,r);if(o){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of is(r,xn(a)))if(Math.min(c,o[1])>Math.max(s,o[0])){i={other:a.id,axis:r.axis};break}}}}return i}const mE=1,gE=(e,t,n)=>t.x>=e.x-n&&t.y>=e.y-n&&t.x+t.width<=e.x+e.width+n&&t.y+t.height<=e.y+e.height+n;function yE(e,t,n,i){const r=n.x+i,o=n.y+i,a=n.x+n.width-i,s=n.y+n.height-i;if(a<=r||s<=o)return!1;const c=t.x-e.x,u=t.y-e.y;let l=0,p=1;const f=(d,h)=>{if(h===0)return d<=0;const m=d/h;if(h>0){if(m>p)return!1;m>l&&(l=m)}else{if(m<l)return!1;m<p&&(p=m)}return!0};return f(r-e.x,c)&&f(e.x-a,-c)&&f(o-e.y,u)&&f(e.y-s,-u)&&p>l}function md(e,t,n){return e.x+n<t.x+t.width-n&&t.x+n<e.x+e.width-n&&e.y+n<t.y+t.height-n&&t.y+n<e.y+e.height-n}const vE=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,zo=1;function Vo(e,t){const n=e.x+zo,i=e.x+e.width-zo,r=e.y+zo,o=e.y+e.height-zo;return t.axis==="h"?t.at>r&&t.at<o&&t.lo<i&&t.hi>n:t.at>n&&t.at<i&&t.lo<o&&t.hi>r}function $u(e){return[{axis:"h",at:e.y,lo:e.x,hi:e.x+e.width,dir:1},{axis:"h",at:e.y+e.height,lo:e.x,hi:e.x+e.width,dir:1},{axis:"v",at:e.x,lo:e.y,hi:e.y+e.height,dir:1},{axis:"v",at:e.x+e.width,lo:e.y,hi:e.y+e.height,dir:1}]}function gd(e,t){const n=e.label;if(!n)return null;if(xn(e).some(i=>Vo(n,i)))return e.id;for(const i of[...t.edges].filter(r=>r.id!==e.id).sort((r,o)=>r.id.localeCompare(o.id)))if(xn(i).some(r=>Vo(n,r)))return i.id;for(const i of t.shapes.filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if($u(i).some(r=>Vo(n,r)))return i.id;return null}function si(e,t){const n=new Set(e.endpoints),i=[];for(const r of t)if(!n.has(r.id)){for(let o=0;o+1<e.waypoints.length;o++)if(yE(e.waypoints[o],e.waypoints[o+1],r,fE)){i.push(r);break}}return i}function _E(e,t,n,i){const r=(u,l,p)=>(l.x-u.x)*(p.y-u.y)-(l.y-u.y)*(p.x-u.x),o=r(n,i,e),a=r(n,i,t),s=r(e,t,n),c=r(e,t,i);return o*a<0&&s*c<0}const yd=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function os(e,t){let n=0;for(const i of t){if(i.id===e.id||yd(e,i))continue;let r=!1;for(let o=0;o+1<e.waypoints.length&&!r;o++)for(let a=0;a+1<i.waypoints.length&&!r;a++)_E(e.waypoints[o],e.waypoints[o+1],i.waypoints[a],i.waypoints[a+1])&&(r=!0);r&&n++}return n}function Cr(e,t){let n=0;for(const i of t)i.id===e.id||yd(e,i)||os(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function vd(e){let t=0;const n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)os(n[i],[n[r]])>0&&(t+=n[i].type===n[r].type?2:1);return t}function ju(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)if(os(n[i],[n[r]])>0){const o=n[i].id,a=n[r].id;t.push(o<a?[o,a]:[a,o])}return t.sort((i,r)=>`${i[0]}|${i[1]}`.localeCompare(`${r[0]}|${r[1]}`))}const Wi=e=>e.shapes.filter(t=>!t.container);function bE(e,t,n){if(e.type==="bpmn:TextAnnotation")for(const i of t.edges){if(!/Association$/.test(i.type)||!i.endpoints.includes(e.id))continue;const r=i.endpoints.find(a=>a!==e.id),o=r?n.get(r):void 0;if(o){if(o.container)return o.id;if(o.parent)return o.parent}}}function Fu(e){const t=[];for(const n of e.shapes)n.label&&t.push({owner:n.id,rect:n.label});for(const n of e.edges)n.label&&t.push({owner:n.id,rect:n.label});return t}function Ui(e){const t=[],n=e.shapes.filter(a=>!a.container);for(const a of e.edges)for(const s of si(a,n))t.push({kind:"edge-crosses-shape",edge:a.id,shape:s.id});const i=n.filter(a=>!a.attached);for(let a=0;a<i.length;a++)for(let s=a+1;s<i.length;s++){const c=i[a],u=i[s];if(!md(c,u,pE))continue;const l=c.id<u.id?[c.id,u.id]:[u.id,c.id];t.push({kind:"shape-overlap",shapes:l,identical:vE(c,u)})}for(let a=0;a<e.edges.length;a++)for(let s=a+1;s<e.edges.length;s++){const c=e.edges[a],u=e.edges[s],l=ns(c,u);if(!l)continue;const p=c.id<u.id?[c.id,u.id]:[u.id,c.id];t.push({kind:l.kind==="opposite"?"edge-overlap-opposite":"edge-overlap-mixed",edges:p,axis:l.axis,length:Math.round(l.length)})}for(const a of e.edges){if(!a.label)continue;const s=rs(a,e.edges);s&&t.push({kind:"label-on-shared-segment",edge:a.id,other:s.other,axis:s.axis})}for(const a of e.edges){if(!a.label)continue;const s=gd(a,e);s&&t.push({kind:"label-over-line",edge:a.id,line:s})}const r=Fu(e);for(const a of n)if(a.type==="bpmn:TextAnnotation")for(const{owner:s,rect:c}of r)s!==a.id&&md(a,c,zo)&&t.push({kind:"annotation-over-label",annotation:a.id,label:s});const o=new Map(e.shapes.map(a=>[a.id,a]));for(const a of n){const s=a.parent??bE(a,e,o);if(!s)continue;const c=o.get(s);!c||!c.container||gE(c,a,mE)||t.push({kind:"shape-outside-container",shape:a.id,container:c.id})}return t.sort((a,s)=>Gi(a).localeCompare(Gi(s)))}const xt=e=>typeof e=="object"&&e!==null?e:void 0,vt=e=>typeof e=="number"?e:0,Pr=e=>{const t=xt(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function xE(e){const t=xt(e);if(!t)return[];const n=[];for(const i of["sourceRef","targetRef"]){const r=t[i];for(const o of Array.isArray(r)?r:[r]){const a=Pr(o);a&&n.push(a)}}return n}function EE(e,t){const n=xt(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const r=Pr(n);return r?t.get(r):void 0}if(ts.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return Pr(n)}function _d(e){var o,a,s,c,u;const t=[],n=[],i=((o=xt(e))==null?void 0:o.diagrams)??[],r=new Map;for(const l of((a=xt(e))==null?void 0:a.rootElements)??[]){const p=xt(l);if((p==null?void 0:p.$type)==="bpmn:Collaboration")for(const f of p.participants??[]){const d=xt(f),h=Pr(d),m=Pr(d==null?void 0:d.processRef);h&&m&&r.set(m,h)}}for(const l of i){const p=xt((s=xt(l))==null?void 0:s.plane),f=(p==null?void 0:p.planeElement)??[];for(const d of f){const h=xt(d);if(!h)continue;const m=xt(h.bpmnElement),g=typeof(m==null?void 0:m.id)=="string"?m.id:void 0;if(!g)continue;const R=typeof(m==null?void 0:m.$type)=="string"?m.$type:"",E=xt(h.bounds);if(E){const b=h.isExpanded===!1,w=xt((c=xt(h.label))==null?void 0:c.bounds);t.push({id:g,type:R,x:vt(E.x),y:vt(E.y),width:vt(E.width),height:vt(E.height),container:ts.has(R)&&!b,attached:(m==null?void 0:m.attachedToRef)!==void 0,...m?{parent:EE(m,r)}:{},...w?{label:{x:vt(w.x),y:vt(w.y),width:vt(w.width),height:vt(w.height)}}:{}});continue}const x=h.waypoint;if(Array.isArray(x)){const b=xt((u=xt(h.label))==null?void 0:u.bounds);n.push({id:g,type:R,waypoints:x.map(w=>{var T,L;return{x:vt((T=xt(w))==null?void 0:T.x),y:vt((L=xt(w))==null?void 0:L.y)}}),endpoints:xE(m),...b?{label:{x:vt(b.x),y:vt(b.y),width:vt(b.width),height:vt(b.height)}}:{}})}}}return{shapes:t,edges:n}}function bd(e){return Ui(_d(e))}async function wE(e){const{definitions:t,warnings:n}=await Iu(e);return{findings:bd(t),warnings:n}}function pn(e){const t=[],n=[];for(const i of e.getAll()){const r=i;if(r.type==="label"||r.labelTarget)continue;const o=typeof r.type=="string"?r.type:"";if(o==="bpmn:Definitions"||o.startsWith("bpmndi:"))continue;const a=r.waypoints;if(a){const f=xt(r.label);n.push({id:r.id,type:o,waypoints:a.map(d=>({x:vt(d.x),y:vt(d.y)})),endpoints:[Pr(r.source),Pr(r.target)].filter(d=>!!d),...f&&typeof f.x=="number"?{label:{x:f.x,y:vt(f.y),width:vt(f.width),height:vt(f.height)}}:{}});continue}if(typeof r.x!="number"||typeof r.y!="number")continue;const s=xt(r.businessObject),c=xt(r.label);let u=xt(r.parent);for(;u&&u.type==="bpmn:Lane";)u=xt(u.parent);const l=typeof(u==null?void 0:u.type)=="string"?u.type:"",p=u&&ts.has(l)&&l!=="bpmn:Group"&&typeof u.id=="string"?u.id:void 0;t.push({id:r.id,type:o,x:r.x,y:r.y,width:vt(r.width),height:vt(r.height),container:ts.has(o)&&r.collapsed!==!0,attached:(s==null?void 0:s.attachedToRef)!==void 0,...p!==void 0?{parent:p}:{},...c&&typeof c.x=="number"?{label:{x:c.x,y:vt(c.y),width:vt(c.width),height:vt(c.height)}}:{}})}return{shapes:t,edges:n}}const SE={"bpmn:Participant":"participant","bpmn:Lane":"lane","bpmn:SequenceFlow":"sequenceFlow","bpmn:MessageFlow":"messageFlow","bpmn:DataStoreReference":"dataStore","bpmn:DataInputAssociation":"dataAssociation","bpmn:DataOutputAssociation":"dataAssociation","bpmn:TextAnnotation":"annotation","bpmn:Association":"association","bpmn:Group":"group"};function RE(e,t){const n=SE[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function xd(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function Ed(e){const t=()=>e.getAll().filter(n=>n.type!=="label"&&!("labelTarget"in n&&n.labelTarget));return{isCollaboration:()=>t().some(n=>n.type==="bpmn:Participant"),categoryOf:n=>{const i=e.get(n);if(!(!i||i.type==="label"))return RE(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&xd(i)===n).sort((i,r)=>i.y-r.y).map(i=>i.id),participantOf:n=>{const i=e.get(n);return i?xd(i):void 0},endpointsOf:n=>{var r,o;const i=e.get(n);if(!(!i||i.type==="label")&&"waypoints"in i)return{source:(r=i.source)==null?void 0:r.id,target:(o=i.target)==null?void 0:o.id}}}}const wd=20,CE=4,Vt=(e,t)=>Math.abs(e-t)<.5;function Sd(e,t,n,i=wd){if(Vt(e.y,t.y)&&!Vt(e.x,t.x)){const r=Math.min(e.x,t.x),o=Math.max(e.x,t.x);if(!(r<n.x-i&&n.x+n.width+i<o))return null;const a=e.x<t.x?n.x-i:n.x+n.width+i,s=e.x<t.x?n.x+n.width+i:n.x-i,c=u=>[{x:a,y:e.y},{x:a,y:u},{x:s,y:u},{x:s,y:e.y}];return[c(n.y-i),c(n.y+n.height+i)]}if(Vt(e.x,t.x)&&!Vt(e.y,t.y)){const r=Math.min(e.y,t.y),o=Math.max(e.y,t.y);if(!(r<n.y-i&&n.y+n.height+i<o))return null;const a=e.y<t.y?n.y-i:n.y+n.height+i,s=e.y<t.y?n.y+n.height+i:n.y-i,c=u=>[{x:e.x,y:a},{x:u,y:a},{x:u,y:s},{x:e.x,y:s}];return[c(n.x-i),c(n.x+n.width+i)]}return null}function Rd(e,t,n=wd){if(e.length!==4)return null;const[i,r,o,a]=e;if(Vt(i.y,r.y)&&Vt(r.x,o.x)&&Vt(o.y,a.y)){const s=c=>[i,{x:c,y:i.y},{x:c,y:a.y},a];return[s(t.x-n),s(t.x+t.width+n)]}if(Vt(i.x,r.x)&&Vt(r.y,o.y)&&Vt(o.x,a.x)){const s=c=>[i,{x:i.x,y:c},{x:a.x,y:c},a];return[s(t.y-n),s(t.y+t.height+n)]}return null}function Cd(e,t){if(e.endpoints.length!==2)return[];const n=t.find(p=>p.id===e.endpoints[0]),i=t.find(p=>p.id===e.endpoints[1]);if(!n||!i)return[];if(i.x<=n.x+n.width)return[];const r=n.y+n.height/2,o=i.y+i.height/2;if(r>=i.y&&r<=i.y+i.height)return[];const a=i.x+i.width/2,s=n.x+n.width/2,c=r>o,u=[{x:n.x+n.width,y:r},{x:a,y:r},{x:a,y:c?i.y+i.height:i.y}],l=[{x:s,y:c?n.y:n.y+n.height},{x:s,y:o},{x:i.x,y:o}];return[u,l]}const Pd=30,PE=[0,-25,25,-40,40];function AE(e,t){if(e.type!=="bpmn:MessageFlow"||e.endpoints.length!==2)return[];const n=t.find(f=>f.id===e.endpoints[0]),i=t.find(f=>f.id===e.endpoints[1]);if(!n||!i)return[];const r=n.y+n.height/2,o=i.y+i.height/2;if(i.y<n.y+n.height&&i.y+i.height>n.y)return[];const a=o<r,s=a?n.y+n.height:n.y,c=a?s+Pd:s-Pd,u=a?i.y+i.height:i.y,l=n.x+n.width/2,p=i.x+i.width/2;return PE.map(f=>[{x:l,y:s},{x:l,y:c},{x:p+f,y:c},{x:p+f,y:u}])}const TE=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],as=(e,t,n)=>si({...e,waypoints:t},n).length;function Ad(e,t,n,i){let r=[...e.waypoints],o=as(e,r,t);if(o===0)return null;let a=!1;for(const p of Cd(e,t))if(as(e,p,t)===0)return p;const s=(i??[]).filter(p=>p.id!==e.id).flatMap(xn),c=p=>xn({...e,waypoints:p}).some(f=>is(f,s).length>0),u=AE(e,t).filter(p=>as(e,p,t)===0);if(u.length)return u.find(p=>!c(p))??u[0];const l=p=>!n||p.every(f=>f.x>=n.x&&f.x<=n.x+n.width&&f.y>=n.y&&f.y<=n.y+n.height);for(let p=0;p<CE&&o>0;p++){let f=!1;for(let d=0;d+1<r.length&&!f;d++){const h=r[d],m=r[d+1];for(const g of t){if(e.endpoints.includes(g.id)||si({...e,waypoints:[h,m]},[g]).length===0)continue;const R=Sd(h,m,g),E=R?R.map(b=>TE(r,d,b)):Rd(r,g)??[];if(!E.length)continue;const x=[...E].sort((b,w)=>Number(l(w))-Number(l(b)));for(const b of x){const w=as(e,b,t);if(w<o){r=b,o=w,f=!0,a=!0;break}}if(f)break}}if(!f)break}return a&&o===0?r:null}function Td(e,t){const{elementRegistry:n}=e,i=e.modeling,r=pn(n),o=Wi(r),a=Ui(r).filter(c=>c.kind==="edge-crosses-shape"&&!t.has(Gi(c)));if(!a.length)return;const s=new Map;for(const c of a){if(c.kind!=="edge-crosses-shape"||s.has(c.edge))continue;const u=r.edges.find(l=>l.id===c.edge);u&&s.set(c.edge,u)}for(const[c,u]of s){const l=n.get(c);if(!l)continue;const p=l.parent,f=p&&typeof p.x=="number"&&typeof p.width=="number"?{x:p.x,y:p.y,width:p.width,height:p.height}:void 0,d=Ad(u,o,f,r.edges);d&&i.updateWaypoints(l,d)}}const ME=10;function Md(e,t){if(e.parent){const r=t.find(o=>o.id===e.parent);if(r)return r}const n=e.x+e.width/2,i=e.y+e.height/2;return t.find(r=>n>=r.x&&n<=r.x+r.width&&i>=r.y&&i<=r.y+r.height)}function kd(e,t){if(e.waypoints.length<2||e.endpoints.length!==2)return null;const n=t.shapes.filter(z=>z.type==="bpmn:Participant"&&z.container),i=t.shapes.find(z=>z.id===e.endpoints[0]),r=t.shapes.find(z=>z.id===e.endpoints[1]);if(!i||!r)return null;const o=Md(i,n),a=Md(r,n);if(!o||!a||o.id===a.id)return null;const s=a.y>o.y,c=s?o:a,u=s?a:o,l=n.filter(z=>z.id!==o.id&&z.id!==a.id&&z.y>=c.y+c.height&&z.y+z.height<=u.y).sort((z,ue)=>z.y-ue.y);if(!l.length)return null;const p=l[0],f=l[l.length-1],d=(c.y+c.height+p.y)/2,h=(f.y+f.height+u.y)/2,m=s?d:h,g=s?h:d,R=e.waypoints[0],E=e.waypoints[e.waypoints.length-1],x=Wi(t),b=t.edges.filter(z=>z.id!==e.id),w=Cr(e,b),T=si(e,x).length;if(w===0&&T===0)return null;const L=Math.min(...l.map(z=>z.x)),A=Math.max(...l.map(z=>z.x+z.width)),F=(R.x+E.x)/2,H=z=>z.filter((ue,je)=>je===0||!(Vt(ue.x,z[je-1].x)&&Vt(ue.y,z[je-1].y)));let N;for(let z=L;z<=A;z+=ME){const ue=H([R,{x:R.x,y:m},{x:z,y:m},{x:z,y:g},{x:E.x,y:g},E]),je={...e,waypoints:ue};if(si(je,x).length>0)continue;const tt=Cr(je,b),X=Math.abs(z-F);(!N||tt<N.cross||tt===N.cross&&X<N.detour)&&(N={pts:ue,cross:tt,detour:X})}return N&&(T>0?N.cross<=w:N.cross<w)?N.pts:null}function Dd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=pn(n);for(const o of r.edges){if(o.type!=="bpmn:MessageFlow"||t.has(o.id))continue;const a=pn(n),s=a.edges.find(l=>l.id===o.id);if(!s)continue;const c=kd(s,a);if(!c)continue;const u=n.get(o.id);u&&i.updateWaypoints(u,c)}}const eo=[25,-25,40,-40],ss=35;function Od(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];if(i.x+i.width>n.x)return[];const r=n.y+n.height/2;if(r>=i.y&&r<=i.y+i.height)return[];const o=i.x+i.width/2,a=n.x+n.width/2,s=r<i.y,c=s?i.y:i.y+i.height,u=s?n.y:n.y+n.height,l=s?n.y-ss:n.y+n.height+ss,p=[];for(const E of[0,...eo]){if(Math.abs(E)>=i.width/2-5)continue;const x=o+E;p.push({pts:[{x:n.x,y:r},{x,y:r},{x,y:c}],cost:Math.abs(E)});for(const b of[0,...eo]){if(Math.abs(b)>=n.width/2-5)continue;const w=a+b;p.push({pts:[{x:w,y:u},{x:w,y:l},{x,y:l},{x,y:c}],cost:Math.abs(E)+Math.abs(b)})}}const f=50,d=i.y+i.height/2,h=s?n.y+n.height:n.y;for(const E of[0,...eo]){if(Math.abs(E)>=n.width/2-5)continue;const x=a+E;p.push({pts:[{x,y:h},{x,y:d},{x:i.x+i.width,y:d}],cost:f+Math.abs(E)})}const m=60,g=s?i.y+i.height:i.y,R=s?i.y+i.height+ss:i.y-ss;for(const E of[0,...eo]){if(Math.abs(E)>=i.width/2-5)continue;const x=o+E;for(const b of[0,...eo]){if(Math.abs(b)>=n.width/2-5)continue;const w=a+b;p.push({pts:[{x:w,y:h},{x:w,y:R},{x,y:R},{x,y:g}],cost:m+Math.abs(E)+Math.abs(b)})}}return p}const cs=30;function Ld(e,t){for(let n=1;n<e.length-2;n++){const i=e[n],r=e[n+1],o=Vt(i.y,r.y)&&!Vt(i.x,r.x),a=Vt(i.x,r.x)&&!Vt(i.y,r.y);if(!(!o&&!a))for(const s of t)if(o){const c=Math.min(i.x,r.x);if(Math.max(i.x,r.x)<=s.x||c>=s.x+s.width)continue;if(Math.abs(i.y-s.y)<cs||Math.abs(i.y-(s.y+s.height))<cs)return!0}else{const c=Math.min(i.y,r.y);if(Math.max(i.y,r.y)<=s.y||c>=s.y+s.height)continue;if(Math.abs(i.x-s.x)<cs||Math.abs(i.x-(s.x+s.width))<cs)return!0}}return!1}const us=40;function kE(e,t,n){let i=0;for(const r of t){if(r.container||n.includes(r.id))continue;const o=r.x-us,a=r.x+r.width+us,s=r.y-us,c=r.y+r.height+us;for(let u=1;u<e.length-2;u++){const l=e[u],p=e[u+1],f={x:Math.min(l.x,p.x),y:Math.min(l.y,p.y)},d={x:Math.max(l.x,p.x),y:Math.max(l.y,p.y)};if(f.x<a&&d.x>o&&f.y<c&&d.y>s){i++;break}}}return i}function Id(e,t){if(e.type!=="bpmn:SequenceFlow")return null;const n=t.shapes.filter(f=>f.container);if(!Ld(e.waypoints,n))return null;const i=new Map(t.shapes.map(f=>[f.id,f])),r=Wi(t),o=t.edges.filter(f=>f.id!==e.id),a=Ho(e,o),s=Cr(e,o),c=f=>kE(f,t.shapes,e.endpoints)+(Ld(f,n)?1:0),u=c(e.waypoints),l=f=>f.reduce((d,h,m)=>m?d+Math.abs(h.x-f[m-1].x)+Math.abs(h.y-f[m-1].y):0,0);let p;for(const{pts:f,cost:d}of Od(e,i)){const h={...e,waypoints:f};if(si(h,r).length>0||Ho(h,o)>a||Cr(h,o)>s)continue;const m=c(f);if(m>=u)continue;const g=l(f);(!p||m<p.sc||m===p.sc&&(d<p.cost||d===p.cost&&g<p.len))&&(p={pts:f,sc:m,cost:d,len:g})}return(p==null?void 0:p.pts)??null}function Nd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=pn(n).edges.filter(o=>o.type==="bpmn:SequenceFlow"&&!t.has(o.id)).map(o=>o.id).sort();for(const o of r){const a=pn(n),s=a.edges.find(l=>l.id===o);if(!s)continue;const c=Id(s,a);if(!c)continue;const u=n.get(o);u&&i.updateWaypoints(u,c)}}function DE(e,t){const n=e.waypoints;if(n.length<3)return[];const i=[],r=t.get(e.endpoints[0]??""),o=t.get(e.endpoints[1]??""),a=Vt(n[0].x,n[1].x)&&!Vt(n[0].y,n[1].y),s=Vt(n[n.length-1].x,n[n.length-2].x)&&!Vt(n[n.length-1].y,n[n.length-2].y);for(const c of eo){if(a&&r&&Math.abs(c)<r.width/2-5){const u=n.map(l=>({...l}));u[0].x+=c,u[1].x+=c,i.push({pts:u,cost:Math.abs(c)})}if(s&&o&&Math.abs(c)<o.width/2-5){const u=n.map(l=>({...l}));u[u.length-1].x+=c,u[u.length-2].x+=c,i.push({pts:u,cost:Math.abs(c)})}}return i}function Bd(e,t){const n=new Map(t.shapes.map(l=>[l.id,l])),i=Wi(t),r=t.edges.filter(l=>l.id!==e.id),o=Ho(e,r);if(o===0)return null;const a=Cr(e,r);let s;const c=l=>l.reduce((p,f,d)=>d?p+Math.abs(f.x-l[d-1].x)+Math.abs(f.y-l[d-1].y):0,0),u=[...Od(e,n),...DE(e,n)];for(const{pts:l,cost:p}of u){const f={...e,waypoints:l};if(si(f,i).length>0)continue;const d=Ho(f,r),h=Cr(f,r);if(d>=o||h-a>o-d)continue;const m=c(l);(!s||d<s.opposite||d===s.opposite&&(h<s.cross||h===s.cross&&(p<s.cost||p===s.cost&&m<s.len)))&&(s={pts:l,opposite:d,cross:h,cost:p,len:m})}return(s==null?void 0:s.pts)??null}function $d(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=pn(i),a=Ui(o).filter(l=>(l.kind==="edge-overlap-opposite"||l.kind==="edge-overlap-mixed")&&!t.has(Gi(l)));if(!a.length)return;const s=new Set;for(const l of a)if(!(l.kind!=="edge-overlap-opposite"&&l.kind!=="edge-overlap-mixed"))for(const p of l.edges)n.has(p)||s.add(p);const c=l=>{var p;return((p=o.edges.find(f=>f.id===l))==null?void 0:p.type)??""},u=[...s].sort((l,p)=>{const f=c(l)==="bpmn:SequenceFlow"?0:1,d=c(p)==="bpmn:SequenceFlow"?0:1;return f!==d?f-d:l.localeCompare(p)});for(const l of u){const p=pn(i),f=p.edges.find(m=>m.id===l);if(!f)continue;const d=Bd(f,p);if(!d)continue;const h=i.get(l);h&&r.updateWaypoints(h,d)}}const OE=10,LE=(e,t)=>e.x<t.x+t.width&&t.x<e.x+e.width&&e.y<t.y+t.height&&t.y<e.y+e.height;function jd(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!rs(e,i))return null;const r=Wi(t),o=i.flatMap(xn);for(const a of xn(e)){let s=[[a.lo,a.hi]];for(const[d,h]of is(a,o))s=s.flatMap(([m,g])=>{const R=[];return d>m&&R.push([m,Math.min(g,d)]),h<g&&R.push([Math.max(m,h),g]),R.filter(([E,x])=>x>E)});const c=a.axis==="h"?n.width:n.height,u=s.find(([d,h])=>h-d>=c+OE*2);if(!u)continue;const l=(u[0]+u[1])/2,p=a.axis==="h"?{x:l,y:a.at-dd}:{x:a.at+to+n.width/2,y:l},f={x:p.x-n.width/2,y:p.y-n.height/2,width:n.width,height:n.height};if(!rs({...e,label:f},i)&&!r.some(d=>!e.endpoints.includes(d.id)&&LE(f,d)))return f}return null}const to=8;function Fd(e,t){const n=e.label;if(!n)return null;const i=xn(e);if(!i.length)return null;const r=n.x+n.width/2,o=n.y+n.height/2,a=f=>{const d=f.axis==="h"?r:o,h=f.axis==="h"?o-f.at:r-f.at,m=d<f.lo?f.lo-d:d>f.hi?d-f.hi:0;return Math.hypot(h,m)},s=i.reduce((f,d)=>a(d)<a(f)?d:f,i[0]),c=[...i,...t.edges.filter(f=>f.id!==e.id).flatMap(xn),...t.shapes.filter(f=>f.container).flatMap($u)],u=f=>!c.some(d=>Vo(f,d));if(u(n))return null;const l=(s.axis==="v"?n.height:n.width)+to,p=[0,-l,l,-2*l,2*l];if(s.axis==="v")for(const f of[s.at+to,s.at-to-n.width])for(const d of p){const h=n.y+d;if(h<s.lo||h+n.height>s.hi)continue;const m={...n,x:f,y:h};if(u(m))return m}else for(const f of[s.at-to-n.height,s.at+to])for(const d of p){const h=n.x+d;if(h<s.lo||h+n.width>s.hi)continue;const m={...n,x:h,y:f};if(u(m))return m}return null}function Hd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=pn(n);for(const o of r.edges){if(!o.label||t.has(o.id))continue;const a=Fd(o,r);if(!a)continue;const s=n.get(o.id),c=s==null?void 0:s.label;c&&i.moveElements([c],{x:a.x-c.x,y:a.y-c.y})}}function zd(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=pn(i),a=Ui(o).filter(s=>s.kind==="label-on-shared-segment"&&!t.has(Gi(s)));for(const s of a){if(s.kind!=="label-on-shared-segment"||n.has(s.edge))continue;const c=o.edges.find(f=>f.id===s.edge);if(!c)continue;const u=jd(c,o);if(!u)continue;const l=i.get(s.edge),p=l==null?void 0:l.label;p&&r.moveElements([p],{x:u.x-p.x,y:u.y-p.y})}}const IE=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,Vd=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),Gd={"participant.add":[{path:"participant",shape:["id"]},{path:"participant.lanes[]",shape:["id"],optional:!0}],"participant.update":[{path:"id",shape:null},{path:"lanes[]",shape:["id"],optional:!0}],"node.add":[{path:"node",shape:["id","type"]}],"node.update":[{path:"id",shape:null}],"sequenceFlow.add":[{path:"flow",shape:["id","source","target"]}],"sequenceFlow.update":[{path:"id",shape:null}],"messageFlow.add":[{path:"flow",shape:["id","source","target"]}],"messageFlow.update":[{path:"id",shape:null}],"dataStore.add":[{path:"dataStore",shape:["id"]},{path:"associations[]",shape:["source","target"],optional:!0}],"dataStore.update":[{path:"id",shape:null}],"dataAssociation.add":[{path:"association",shape:["source","target"]}],"association.add":[{path:"association",shape:["source","target"]}],"annotation.add":[{path:"annotation",shape:["id","text"]},{path:"association",shape:["source","target"],optional:!0},{path:"placement",shape:["anchor","side"],optional:!0}],"annotation.update":[{path:"id",shape:null},{path:"placement",shape:["anchor","side"],optional:!0}],"group.add":[{path:"group",shape:["id"]},{path:"group.members[]",shape:null,optional:!0}],"group.update":[{path:"id",shape:null},{path:"members[]",shape:null,optional:!0}],"element.remove":[{path:"id",shape:null}]},ls=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Hu=e=>typeof e=="string"&&e!=="";function NE(e){const t=[];function n(i,r,o,a){if(a===null){Hu(o)||t.push({kind:"payload-invalid",opIndex:i,field:r});return}if(!ls(o)){t.push({kind:"payload-invalid",opIndex:i,field:r});return}for(const s of a)Hu(o[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${r}.${s}`})}return e.forEach((i,r)=>{if(!ls(i)||!Hu(i.kind)||!(i.kind in Gd)){t.push({kind:"payload-invalid",opIndex:r,field:"kind"});return}for(const o of Gd[i.kind]){const a=o.path.endsWith("[]"),s=a?o.path.slice(0,-2):o.path,c=s.split(".");let u=i;for(const p of c.slice(0,-1)){if(!ls(u))break;u=u[p]}if(!ls(u))continue;const l=u[c[c.length-1]];if(!(l===void 0&&o.optional)&&!(l===null&&o.optional)){if(!a){n(r,o.path,l,o.shape);continue}if(!Array.isArray(l)){t.push({kind:"payload-invalid",opIndex:r,field:o.path});continue}l.forEach((p,f)=>n(r,`${s}[${f}]`,p,o.shape))}}if(i.kind==="node.add"){const o=i.band;o!==void 0&&(!Number.isInteger(o)||o<0)&&t.push({kind:"payload-invalid",opIndex:r,field:"band"})}}),t}function Wd(e,t){const n=NE(e);if(n.length>0)return n;const i=[],r=new Map,o=new Map;function a(f,d,h){if(!IE.test(d)){i.push({kind:"id-invalid",opIndex:f,id:d});return}if(t.categoryOf(d)!==void 0||r.has(d)){i.push({kind:"id-duplicate",opIndex:f,id:d});return}r.set(d,{...h,opIndex:f})}e.forEach((f,d)=>{var h;switch(f.kind){case"participant.add":a(d,f.participant.id,{category:"participant",lanes:(f.participant.lanes??[]).map(m=>m.id)});for(const m of f.participant.lanes??[])a(d,m.id,{category:"lane"});break;case"node.add":a(d,f.node.id,{category:"flowNode",participant:f.node.participant});break;case"sequenceFlow.add":a(d,f.flow.id,{category:"sequenceFlow"});break;case"messageFlow.add":a(d,f.flow.id,{category:"messageFlow"});break;case"dataStore.add":a(d,f.dataStore.id,{category:"dataStore"});for(const m of f.associations??[])m.id&&a(d,m.id,{category:"dataAssociation"});break;case"dataAssociation.add":f.association.id&&a(d,f.association.id,{category:"dataAssociation"});break;case"association.add":f.association.id&&a(d,f.association.id,{category:"association"});break;case"annotation.add":a(d,f.annotation.id,{category:"annotation"}),(h=f.association)!=null&&h.id&&a(d,f.association.id,{category:"association"});break;case"group.add":a(d,f.group.id,{category:"group"});break;case"participant.update":if(f.lanes){o.set(f.id,f.lanes.map(m=>m.id));for(const m of f.lanes)t.categoryOf(m.id)===void 0&&a(d,m.id,{category:"lane"})}break}});const s=f=>{var d;return((d=r.get(f))==null?void 0:d.category)??t.categoryOf(f)},c=f=>{const d=r.get(f);return d?d.category==="participant"?f:d.participant:t.categoryOf(f)==="participant"?f:t.participantOf(f)};function u(f,d,h,m){const g=s(d);if(g===void 0){i.push({kind:"ref-missing",opIndex:f,ref:d,role:h});return}if(m&&!m.includes(g)){i.push({kind:"ref-category",opIndex:f,ref:d,role:h,expected:m.join("|"),actual:g});return}return g}const l=t.isCollaboration()||e.some(f=>f.kind==="participant.add");return e.forEach((f,d)=>{var h;switch(f.kind){case"participant.add":break;case"node.add":{const{participant:m,lane:g}=f.node;if(m===void 0){(l||g!==void 0)&&i.push({kind:"participant-required",opIndex:d,id:f.node.id});break}if(u(d,m,"participant",["participant"])===void 0)break;g!==void 0&&((((h=r.get(m))==null?void 0:h.lanes)??o.get(m)??t.lanesOf(m)).includes(g)||i.push({kind:"lane-unknown",opIndex:d,lane:g,participant:m}));break}case"sequenceFlow.add":{const{id:m,source:g,target:R,name:E,condition:x}=f.flow,b=u(d,g,"source",["flowNode"]),w=u(d,R,"target",["flowNode"]);b&&w&&c(g)!==c(R)&&i.push({kind:"flow-cross-pool",opIndex:d,id:m}),E!==void 0&&x!==void 0&&i.push({kind:"condition-name-conflict",opIndex:d,id:m});break}case"messageFlow.add":{const{id:m,source:g,target:R}=f.flow,E=u(d,g,"source",["flowNode","participant"]),x=u(d,R,"target",["flowNode","participant"]);if(E&&x){const b=c(g),w=c(R);b!==void 0&&b===w&&i.push({kind:"message-flow-same-pool",opIndex:d,id:m})}break}case"dataStore.add":{for(const m of f.associations??[]){if([m.source,m.target].filter(E=>E===f.dataStore.id).length!==1){i.push({kind:"data-association-ends",opIndex:d,source:m.source,target:m.target});continue}const R=m.source===f.dataStore.id?m.target:m.source;u(d,R,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:m,target:g}=f.association,R=u(d,m,"source"),E=u(d,g,"target");if(R&&E){const x=new Set([R,E]);x.has("dataStore")&&x.has("flowNode")||i.push({kind:"data-association-ends",opIndex:d,source:m,target:g})}break}case"association.add":{const{id:m,source:g,target:R}=f.association,E=u(d,g,"source"),x=u(d,R,"target");E&&x&&E!=="annotation"&&x!=="annotation"&&i.push({kind:"association-detached",opIndex:d,annotation:m??`${g}->${R}`});break}case"annotation.add":{if(f.association){const{source:m,target:g}=f.association;if(m!==f.annotation.id&&g!==f.annotation.id)i.push({kind:"association-detached",opIndex:d,annotation:f.annotation.id});else{const R=m===f.annotation.id?g:m;u(d,R,"association")}}f.placement&&u(d,f.placement.anchor,"anchor");break}case"group.add":{for(const m of f.group.members??[]){const g=u(d,m,"member");g&&Vd.has(g)&&i.push({kind:"ref-category",opIndex:d,ref:m,role:"member",expected:"shape",actual:g})}break}case"participant.update":{if(p(d,f.id,"participant")===void 0)break;if(f.lanes){const m=t.lanesOf(f.id),g=f.lanes.map(E=>E.id);for(const E of m)g.includes(E)||i.push({kind:"lane-shrink-unsupported",opIndex:d,participant:f.id,lane:E});for(const E of g)t.categoryOf(E)!==void 0&&!m.includes(E)&&i.push({kind:"id-duplicate",opIndex:d,id:E});const R=g.filter(E=>m.includes(E));R.length===m.length&&R.some((E,x)=>E!==m[x])&&i.push({kind:"lane-reorder-unsupported",opIndex:d,participant:f.id})}break}case"node.update":{if(p(d,f.id,"flowNode")===void 0)break;if(f.lane!==void 0){const m=t.participantOf(f.id);(m?o.get(m)??t.lanesOf(m):[]).includes(f.lane)||i.push({kind:"lane-unknown",opIndex:d,lane:f.lane,participant:m??""})}break}case"sequenceFlow.update":{if(p(d,f.id,"sequenceFlow")===void 0)break;if(f.name!==void 0&&f.condition!==void 0&&i.push({kind:"condition-name-conflict",opIndex:d,id:f.id}),f.source!==void 0||f.target!==void 0){const m=f.source===void 0||u(d,f.source,"source",["flowNode"])!==void 0,g=f.target===void 0||u(d,f.target,"target",["flowNode"])!==void 0,R=t.endpointsOf(f.id),E=f.source??(R==null?void 0:R.source),x=f.target??(R==null?void 0:R.target);m&&g&&E!==void 0&&x!==void 0&&new Set([c(E),c(x),c(f.id)]).size>1&&i.push({kind:"flow-cross-pool",opIndex:d,id:f.id})}break}case"messageFlow.update":p(d,f.id,"messageFlow");break;case"dataStore.update":p(d,f.id,"dataStore");break;case"annotation.update":{if(p(d,f.id,"annotation")===void 0)break;f.placement&&u(d,f.placement.anchor,"anchor");break}case"group.update":{if(p(d,f.id,"group")===void 0)break;for(const m of f.members??[]){const g=u(d,m,"member");g&&Vd.has(g)&&i.push({kind:"ref-category",opIndex:d,ref:m,role:"member",expected:"shape",actual:g})}break}case"element.remove":{p(d,f.id)==="lane"&&i.push({kind:"ref-category",opIndex:d,ref:f.id,role:"target",expected:"removable",actual:"lane"});break}}}),i;function p(f,d,h){if(r.has(d)){i.push({kind:"target-added-in-batch",opIndex:f,id:d});return}const m=t.categoryOf(d);if(m===void 0){i.push({kind:"ref-missing",opIndex:f,ref:d,role:"target"});return}if(h&&m!==h){i.push({kind:"ref-category",opIndex:f,ref:d,role:"target",expected:h,actual:m});return}return m}}const no={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},BE=/[ᄀ-ᇿ -〿-ヿ㐀-鿿가--⦆]/;function $E(e){const t=no;return BE.test(e)?t.cjkEm:e===" "?t.spaceEm:e>="0"&&e<="9"?t.digitEm:e>="A"&&e<="Z"?t.upperEm:e>="a"&&e<="z"?t.lowerEm:t.otherEm}function Go(e,t){let n=0;for(const i of e)n+=t*$E(i);return n}function Ud(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&jE(e),FE(e),HE(e),zE(e)}function jE(e){var i;const t=(i=e.HTMLCanvasElement)==null?void 0:i.prototype;if(!t||t.__headlessTextMeasurement)return;t.__headlessTextMeasurement=!0;const n={font:"12px sans-serif",letterSpacing:"0px",measureText(r){var a;const o=Number.parseFloat(((a=String(n.font).match(/(\d+(?:\.\d+)?)px/))==null?void 0:a[1])??"12");return{width:Go(r,o),fontBoundingBoxAscent:o*no.ascentEm,fontBoundingBoxDescent:o*no.descentEm,actualBoundingBoxAscent:o*no.ascentEm,actualBoundingBoxDescent:o*no.descentEm}}};t.getContext=()=>n}function FE(e){if(e.SVGMatrix)return;class t{constructor(){qr(this,"a",1);qr(this,"b",0);qr(this,"c",0);qr(this,"d",1);qr(this,"e",0);qr(this,"f",0)}static of(i,r,o,a,s,c){return Object.assign(new t,{a:i,b:r,c:o,d:a,e:s,f:c})}multiply(i){return t.of(this.a*i.a+this.c*i.b,this.b*i.a+this.d*i.b,this.a*i.c+this.c*i.d,this.b*i.c+this.d*i.d,this.a*i.e+this.c*i.f+this.e,this.b*i.e+this.d*i.f+this.f)}translate(i,r){return this.multiply(t.of(1,0,0,1,i,r))}scale(i,r=i){return this.multiply(t.of(i,0,0,r,0,0))}inverse(){const i=this.a*this.d-this.b*this.c;return t.of(this.d/i,-this.b/i,-this.c/i,this.a/i,(this.c*this.f-this.d*this.e)/i,(this.b*this.e-this.a*this.f)/i)}}e.SVGMatrix=t}function HE(e){var o;const t=()=>{const a=new e.SVGMatrix;return{type:0,matrix:a,setTranslate(s,c){a.e=s,a.f=c},setScale(s,c){a.a=s,a.d=c},setRotate(s,c=0,u=0){const l=s*Math.PI/180,p=Math.cos(l),f=Math.sin(l);a.a=p,a.b=f,a.c=-f,a.d=p,a.e=c-p*c+f*u,a.f=u-f*c-p*u},setMatrix(s){Object.assign(a,s)}}},n=a=>{const s=t();return Object.assign(s.matrix,a),s},i=(o=e.SVGSVGElement)==null?void 0:o.prototype;i&&!i.createSVGTransform&&(i.createSVGTransform=t,i.createSVGTransformFromMatrix=n,i.createSVGMatrix=()=>new e.SVGMatrix,i.createSVGPoint=()=>({x:0,y:0,matrixTransform:()=>({x:0,y:0})}));const r=e.SVGElement.prototype;Object.getOwnPropertyDescriptor(r,"transform")||Object.defineProperty(r,"transform",{configurable:!0,get(){if(!this.__headlessTransformList){const a=[];this.__headlessTransformList={baseVal:{get numberOfItems(){return a.length},clear:()=>{a.length=0},appendItem:s=>(a.push(s),s),getItem:s=>a[s],createSVGTransformFromMatrix:n,consolidate:()=>a[a.length-1]??null}}}return this.__headlessTransformList}})}function zE(e){const t=e.SVGElement.prototype;if(!t.getCTM){const n=()=>new e.SVGMatrix;t.getCTM=n,t.getScreenCTM=n}t.getBBox||(t.getBBox=function(){const n=String(this.textContent??"");return{x:0,y:0,width:Go(n,12),height:14}})}function qd(e){return{modeling:e.get("modeling"),bpmnFactory:e.get("bpmnFactory"),elementFactory:e.get("elementFactory"),elementRegistry:e.get("elementRegistry"),canvas:e.get("canvas"),autoPlace:e.get("autoPlace"),bpmnReplace:e.get("bpmnReplace")}}function ps(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const zu={"top-left":[-1,-1],top:[0,-1],"top-right":[1,-1],right:[1,0],"bottom-right":[1,1],bottom:[0,1],"bottom-left":[-1,1],left:[-1,0]};function Kt(e,t){return e.filter(n=>n.kind===t)}function Yd(e,t){var lx,px,fx,dx,hx;const{modeling:n,bpmnFactory:i,elementFactory:r,elementRegistry:o,canvas:a,autoPlace:s,bpmnReplace:c}=t,u=()=>a.getRootElement(),l=S=>o.get(S),p=S=>{const P=l(S);if(!P)throw new Error(`하강 참조 해소 실패: ${S}`);return P},f=S=>{let P=S.parent;for(;P;){if(P.type==="bpmn:Participant")return P;P=P.parent}},d=Kt(e,"participant.add"),h=Kt(e,"node.add"),m=Kt(e,"sequenceFlow.add"),g=Kt(e,"messageFlow.add"),R=Kt(e,"dataStore.add"),E=Kt(e,"dataAssociation.add"),x=Kt(e,"annotation.add"),b=Kt(e,"group.add"),w=new Map(h.map(S=>[S.node.id,S])),T=(S,P,O)=>{var Ce;const V=S.businessObject,G=(((Ce=V.extensionElements)==null?void 0:Ce.values)??[]).filter(J=>J.$type!==P),j=O?[...G,i.create(P,O)]:G;if(!j.length){V.extensionElements&&n.updateProperties(S,{extensionElements:void 0});return}const Z=i.create("bpmn:ExtensionElements",{values:j});j.forEach(J=>{J.$parent=Z}),n.updateProperties(S,{extensionElements:Z})},L=S=>({anchor:S.anchor,side:S.side,...S.offset!==void 0?{offset:S.offset}:{}});for(const S of Kt(e,"element.remove")){const P=l(S.id);P&&n.removeElements([P])}const A=S=>o.filter(P=>{var O;return P.type==="bpmn:Lane"&&((O=f(P))==null?void 0:O.id)===S}).sort((P,O)=>P.y-O.y);for(const S of Kt(e,"participant.update")){const P=p(S.id);if(S.name!==void 0&&n.updateProperties(P,{name:S.name??void 0}),!S.lanes)continue;const O=A(S.id);if(!O.length){n.splitLane(P,S.lanes.length),A(S.id).forEach((G,j)=>{const Z=S.lanes[j];Z&&n.updateProperties(G,{id:Z.id,name:Z.name})});continue}const V=new Set(O.map(G=>G.id));S.lanes.forEach((G,j)=>{if(V.has(G.id)){n.updateProperties(p(G.id),{name:G.name});return}const Z=j===0?n.addLane(A(S.id)[0],"top"):n.addLane(p(S.lanes[j-1].id),"bottom");n.updateProperties(Z,{id:G.id,name:G.name})})}const F=150,H=80,N=90,z=180,ue=new Set;for(const S of d){ue.add(`pool:${S.participant.id}`);for(const P of S.participant.lanes??[])ue.add(P.id)}const je=new Map;for(const S of h){const P=S.node.lane??`pool:${S.node.participant??""}`;let O=je.get(P);O||je.set(P,O=new Set([0])),S.band!==void 0&&O.add(S.band)}const tt=new Map;for(const[S,P]of je){if(!ue.has(S))continue;const O=[...P].sort((j,Z)=>j-Z),V=O.map((j,Z)=>Z===0?0:Z%2===1?Math.ceil(Z/2):-(Z/2)),G=Math.min(...V);tt.set(S,new Map(O.map((j,Z)=>[j,V[Z]-G])))}{const S=new Map;for(const P of d)(P.participant.lanes??[]).forEach((O,V)=>S.set(O.id,V));for(const[P,O]of tt){if(!S.has(P)||O.size<2)continue;const V=S.get(P),G=O.get(0)??0,j=new Set;for(const Fe of h){if(Fe.node.lane!==P||(Fe.band??0)!==0||!Fe.node.type.endsWith("Gateway"))continue;const Pe={in:new Set,out:new Set,cross:new Set};for(const _e of m){const st=_e.flow.source===Fe.node.id;if(!st&&_e.flow.target!==Fe.node.id)continue;const qt=w.get(st?_e.flow.target:_e.flow.source);if(!qt||qt.node.participant!==Fe.node.participant||!qt.node.lane)continue;let Zn,un=!1;if(qt.node.lane!==P){const Bn=S.get(qt.node.lane);if(Bn===void 0)continue;Zn=Bn>V?"down":"up",un=!0}else{const Bn=O.get(qt.band??0)??G;Zn=Bn>G?"down":Bn<G?"up":void 0}Zn&&(Pe[st?"out":"in"].add(Zn),un&&Pe.cross.add(Zn))}for(const _e of["up","down"])Pe.in.has(_e)&&Pe.out.has(_e)&&Pe.cross.has(_e)&&j.add(_e)}if(j.size!==1)continue;const[Z]=j,Ce=Math.max(...O.values()),J=Z==="down"?Ce:0;if(G===J)continue;const be=[...O.entries()].filter(([Fe])=>Fe!==0).sort((Fe,Pe)=>Fe[1]-Pe[1]),Ke=[...Array(Ce+1).keys()].filter(Fe=>Fe!==J),lt=new Map([[0,J]]);be.forEach(([Fe],Pe)=>lt.set(Fe,Ke[Pe])),tt.set(P,lt)}}const X=S=>{var P;return(((P=je.get(S))==null?void 0:P.size)??0)>1},se=S=>S.band??(S.node.lane||!X(`pool:${S.node.participant??""}`)?void 0:0),fe=new Map,oe=S=>fe.get(S.node.id)??se(S),de=new Set,ee=new Set;{const S=new Map;for(const V of m)S.set(V.flow.target,(S.get(V.flow.target)??0)+1);const P=V=>{const G=[],j=new Set([V]),Z=[V];for(;Z.length;){const Ce=Z.shift();G.push(Ce);for(const J of m)J.flow.source!==Ce||j.has(J.flow.target)||(S.get(J.flow.target)??0)!==1||(j.add(J.flow.target),Z.push(J.flow.target))}return G},O=(V,G)=>{var j;return((j=tt.get(V))==null?void 0:j.get(G))??G};for(const V of h){if(!V.node.type.endsWith("Gateway"))continue;const G=V.node.lane??`pool:${V.node.participant??""}`,j=tt.get(G);if(!j||j.size<2)continue;const Z=oe(V);if(Z===void 0||O(G,Z)!==O(G,0))continue;const Ce=O(G,Z),J=m.filter(_e=>_e.flow.source===V.node.id).map(_e=>w.get(_e.flow.target)).filter(_e=>!!_e&&(_e.node.lane??`pool:${_e.node.participant??""}`)===G),be=J.filter(_e=>{const st=oe(_e);return st!==void 0&&O(G,st)===Ce&&(S.get(_e.node.id)??0)===1}),Ke=J.some(_e=>{const st=oe(_e);return st!==void 0&&O(G,st)>Ce});if(be.length!==1||!Ke)continue;const lt=new Set(J.flatMap(_e=>P(_e.node.id)));if(!m.some(_e=>_e.flow.target===V.node.id&<.has(_e.flow.source)))continue;const Pe=new Map;for(const[_e,st]of j)Pe.set(_e,st+1);Pe.set(-1,0),tt.set(G,Pe);for(const _e of P(be[0].node.id))w.has(_e)&&(fe.set(_e,-1),ee.add(_e));de.add(V.node.id)}}const $=(S,P)=>{var O;return((O=tt.get(S))==null?void 0:O.get(P))??P},B=new Map;for(const[S,P]of je){let O=0;for(const V of P)O=Math.max(O,$(S,V));B.set(S,O)}const U=S=>z+F*S,Ae=d.map((S,P)=>({op:S,declared:P}));Ae.sort((S,P)=>{const O=S.op.order??Number.POSITIVE_INFINITY,V=P.op.order??Number.POSITIVE_INFINITY;return O!==V?O-V:S.declared-P.declared});let wt=80;for(const S of o.getAll())S.parent===u()&&"height"in S&&typeof S.y=="number"&&(wt=Math.max(wt,S.y+S.height+60));for(const{op:S}of Ae){const P=S.participant,O=h.filter(Fe=>Fe.node.participant===P.id).length,V=((lx=P.lanes)==null?void 0:lx.length)??0,G=Math.max(1200,O*160+300),j=(P.lanes??[]).map(Fe=>U(B.get(Fe.id)??0)),Z=j.reduce((Fe,Pe)=>Fe+Pe,0);V&&Z<300&&(j[V-1]+=300-Z);const Ce=Math.max(300,F*((B.get(`pool:${P.id}`)??0)+1)),J=P.blackBox||O+V===0?120:V?Math.max(300,Z):Ce,be=r.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:P.id,name:P.name,...S.order!==void 0?{"bwl:poolOrder":S.order}:{},...P.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:G,height:J,isExpanded:!0}),Ke=n.createShape(be,{x:100+G/2,y:wt+J/2},u()),lt=P.lanes??[];if(lt.length&&n.splitLane(Ke,lt.length),lt.length){const Fe=o.filter(Pe=>{var _e;return Pe.type==="bpmn:Lane"&&((_e=f(Pe))==null?void 0:_e.id)===P.id}).sort((Pe,_e)=>Pe.y-_e.y);if(Fe.forEach((Pe,_e)=>{const st=lt[_e];st&&n.updateProperties(Pe,{id:st.id,name:st.name})}),j.some(Pe=>Pe!==Ke.height/V)){let Pe=Ke.y;Fe.forEach((_e,st)=>{const qt=j[st];n.resizeShape(_e,{x:_e.x,y:Pe,width:_e.width,height:qt}),Pe+=qt})}}wt=Ke.y+Ke.height+60}const C=S=>{var V;const P=w.get(S);if(P)return P.node.participant??"";const O=l(S);return O?O.type==="bpmn:Participant"?O.id:((V=f(O))==null?void 0:V.id)??"":""},_=new Map,y=S=>{let P=_.get(S);return P||_.set(S,P={nodes:[],flows:[]}),P};for(const S of h)y(S.node.participant??"").nodes.push(S);for(const S of m)y(C(S.flow.source)).flows.push(S);const k=S=>{var P;return i.create("bpmn:SequenceFlow",{id:S.id,name:S.name??((P=S.condition)==null?void 0:P.label)})},I=(S,P)=>r.createShape({type:ps(S.type),businessObject:i.create(ps(S.type),{id:S.id,name:S.name,...P!==void 0?{"bwl:band":P}:{}})}),W=[...Ae.map(({op:S})=>S.participant.id).filter(S=>_.has(S)),...[..._.keys()].filter(S=>!d.some(P=>P.participant.id===S))],ae=S=>S.endsWith("Gateway");for(const S of W){const P=_.get(S),O=S?p(S):void 0,V=O?O.x+150:250;let G=O?O.y+80:120;const j=(ne,he,le)=>{const Ze=u().children.filter(qe=>!("waypoints"in qe&&qe.waypoints)&&qe.id!==he&&typeof qe.y=="number"&&qe.y>=ne);Ze.length&&n.moveElements(Ze,{x:0,y:le})},Z=(ne,he)=>{if(ne){const Me=p(ne),Xe=U(he);if(Me.height>=Xe)return;const Ft=Xe-Me.height,ce=f(Me),We=ce?ce.y+ce.height:Me.y+Me.height;n.resizeLane(Me,{x:Me.x,y:Me.y,width:Me.width,height:Xe},!1),j(We,ce==null?void 0:ce.id,Ft);return}if(!O)return;const le=F*(he+1);if(O.height>=le)return;const Ze=le-O.height,qe=O.y+O.height;n.resizeShape(O,{x:O.x,y:O.y,width:O.width,height:le}),j(qe,O.id,Ze)},Ce=(ne,he,le)=>{if(ne){const Ze=p(ne);return Ze.y+Math.min(Ze.height/2,N)+$(ne,he??0)*F}return he!==void 0&&O?O.y+H+$(`pool:${S}`,he)*F:le},J=(ne,he,le)=>{if(ne){const Ze=p(ne);return Ze.y+Math.min(Ze.height/2,N)+he*F}return O?O.y+H+he*F:le},be=ne=>ne.participant?p(ne.participant):u(),Ke=30,lt=(ne,he,le,Ze)=>{const qe=le-he.width/2,Me=Ze-he.height/2;return(ne.children??[]).find(Xe=>!("waypoints"in Xe&&Xe.waypoints)&&Xe.type!=="bpmn:Lane"&&Xe.type!=="label"&&typeof Xe.x=="number"&&qe<Xe.x+Xe.width+Ke&&qe+he.width+Ke>Xe.x&&Me<Xe.y+Xe.height&&Me+he.height>Xe.y)},Fe=(ne,he,le,Ze,qe,Me)=>{const Xe=le!==void 0||Ze!==void 0,Ft=$(le??`pool:${S}`,Ze??0);if(Xe)for(let Le=0;Le<4;Le++){const Ne=J(le,Ft+Le,Me);if(!lt(ne,he,qe,Ne))return Z(le,Ft+Le),{x:qe,y:Ne}}const ce=Ce(le,Ze,Me);Xe&&Z(le,Ft);let We=qe;for(let Le=0;Le<64;Le++){const Ne=lt(ne,he,We,ce);if(!Ne)break;We=Ne.x+Ne.width+130+he.width/2}return{x:We,y:ce}},Pe=new Set(P.flows.map(ne=>ne.flow.target)),_e=new Map;for(const ne of P.nodes){if(Pe.has(ne.node.id))continue;const he=I(ne.node,ne.band),le=se(ne),Ze=ne.node.lane?`${ne.node.lane}|${le??""}`:le!==void 0?`band:${le}`:"",qe=be(ne.node),Me=Fe(qe,he,ne.node.lane,le,_e.get(Ze)??V,G);n.createShape(he,Me,qe),_e.set(Ze,Me.x+he.width+130),!ne.node.lane&&le===void 0&&(G+=160)}const st=new Set,qt=new Map,Zn=new Map,un=new Map;if(S&&ue.has(`pool:${S}`)){const ne=new Map;for(const ce of P.flows)ne.set(ce.flow.target,(ne.get(ce.flow.target)??0)+1);const he=ce=>Ce(ce.node.lane,oe(ce),Number.NaN),le=new Set,Ze=ce=>{var Ne;const We=(Ne=w.get(ce))==null?void 0:Ne.node.participant;if(We)return l(We);const Le=l(ce);if(Le)return Le.type==="bpmn:Participant"?Le:f(Le)},qe=ce=>{const We=[],Le=new Set([ce]),Ne=[ce];for(;Ne.length;){const dt=Ne.shift(),Qe=w.get(dt);Qe&&We.push(Qe);for(const Ee of P.flows)Ee.flow.source!==dt||Le.has(Ee.flow.target)||(ne.get(Ee.flow.target)??0)!==1||(Le.add(Ee.flow.target),Ne.push(Ee.flow.target))}return We},Me=ce=>{if(!O)return;const We=new Set(ce.map(dt=>dt.node.id));let Le=!1,Ne=!1;for(const dt of g){if(!We.has(dt.flow.source))continue;const Qe=Ze(dt.flow.target);!Qe||Qe.id===O.id||(Qe.y<O.y?Le=!0:Ne=!0)}return Le&&!Ne?"up":Ne&&!Le?"down":void 0};for(const ce of P.nodes){if(!ae(ce.node.type))continue;const We=Ce(ce.node.lane,se(ce),Number.NaN);if(Number.isNaN(We))continue;const Le=[];for(const Ee of P.flows){if(Ee.flow.source!==ce.node.id)continue;const ze=w.get(Ee.flow.target);if(!ze||ze.node.lane!==ce.node.lane||(ne.get(ze.node.id)??0)!==1)continue;const Je=se(ze);if(Je===void 0)continue;const hn=Ce(ze.node.lane,Je,Number.NaN);if(Number.isNaN(hn))continue;const Ur=qe(ze.node.id),Yt=Me(Ur);Yt&&Le.push({subtree:Ur,band:Je,row:hn,dir:Yt})}if(!Le.some(Ee=>Ee.dir==="up")||!Le.some(Ee=>Ee.dir==="down")||!Le.some(Ee=>Ee.dir==="up"&&Le.some(ze=>ze.dir==="down"&&ze.row<Ee.row)))continue;const dt=[...Le].sort((Ee,ze)=>Ee.row-ze.row);[...Le.filter(Ee=>Ee.dir==="up"),...Le.filter(Ee=>Ee.dir==="down")].sort((Ee,ze)=>Ee.dir===ze.dir?Ee.row-ze.row:Ee.dir==="up"?-1:1).forEach((Ee,ze)=>{const Je=dt[ze].band;if(Je!==Ee.band){le.add(ce.node.id);for(const hn of Ee.subtree)se(hn)===Ee.band&&fe.set(hn.node.id,Je)}})}const Xe=ce=>{if(!O)return;const We=new Set(ce.map(dt=>dt.node.id));let Le=!1,Ne=!1;for(const dt of g){if(!We.has(dt.flow.target))continue;const Qe=Ze(dt.flow.source);!Qe||Qe.id===O.id||(Qe.y<O.y?Le=!0:Ne=!0)}return Le&&!Ne?"up":Ne&&!Le?"down":void 0};for(const ce of P.nodes){if(!ae(ce.node.type))continue;const We=ce.node.lane??`pool:${S}`,Le=tt.get(We);if(!Le||Le.size<2)continue;const Ne=Le.get(0);if(Ne===void 0)continue;const dt=Math.max(...Le.values()),Qe=Ne===dt&&Ne!==0?"down":void 0;if(!Qe)continue;const Ee=[];for(const Yt of P.flows){if(Yt.flow.source!==ce.node.id)continue;const Qn=w.get(Yt.flow.target);if(!Qn||Qn.node.lane!==ce.node.lane||(ne.get(Qn.node.id)??0)!==1)continue;const mx=oe(Qn);mx!==void 0&&Ee.push({t:Qn,subtree:qe(Qn.node.id),band:mx})}const ze=Ee.find(Yt=>(Le.get(Yt.band)??Yt.band)===Ne);if(!ze||Xe(ze.subtree)===Qe||Me(ze.subtree)===Qe)continue;const Je=Ee.find(Yt=>Yt!==ze&&Xe(Yt.subtree)===Qe);if(!Je)continue;const hn=ze.band,Ur=Je.band;for(const Yt of ze.subtree)oe(Yt)===hn&&fe.set(Yt.node.id,Ur);for(const Yt of Je.subtree)oe(Yt)===Ur&&fe.set(Yt.node.id,hn);le.add(ce.node.id)}for(const ce of P.nodes){if(!ae(ce.node.type))continue;const We=he(ce);if(Number.isNaN(We)||x.some(Ee=>{var ze,Je;return(((ze=Ee.placement)==null?void 0:ze.anchor)??(Ee.association?Ee.association.source===Ee.annotation.id?Ee.association.target:Ee.association.source:void 0))===ce.node.id&&((Je=Ee.placement)==null?void 0:Je.side.startsWith("bottom"))}))continue;let Ne,dt=!1,Qe;for(const Ee of P.flows){if(Ee.flow.source!==ce.node.id)continue;const ze=w.get(Ee.flow.target);if(!ze||!ze.node.lane&&se(ze)===void 0)continue;const Je=he(ze);Number.isNaN(Je)||(Math.abs(Je-We)<.5&&(dt=!0),Je>We?!Ne||Je>Ne.row?Ne={id:ze.node.id,row:Je,count:1}:Je===Ne.row&&Ne.count++:Je<We&&ze.node.lane===ce.node.lane&&(!Qe||Je>Qe.row?Qe={op:ze,row:Je,count:1}:Je===Qe.row&&Qe.count++))}Ne&&Ne.count===1&&(ne.get(Ne.id)??0)===1&&!le.has(ce.node.id)&&st.add(Ne.id),!dt&&Qe&&Qe.count===1&&(ne.get(Qe.op.node.id)??0)===1&&!de.has(ce.node.id)&&qt.set(Qe.op.node.id,{lane:ce.node.lane,band:oe(ce)})}const Ft=new Map;for(const ce of g)Ft.set(ce.flow.target,[...Ft.get(ce.flow.target)??[],ce]);for(const ce of P.nodes){const We=Ft.get(ce.node.id);if(!We||We.length!==1||!ne.get(ce.node.id)||!ce.node.lane&&se(ce)===void 0||ee.has(ce.node.id))continue;const Le=(px=w.get(We[0].flow.source))==null?void 0:px.node.participant,Ne=Le?l(Le):void 0;if(!Ne||!O||Ne.id===O.id)continue;const dt=ce.node.lane??`pool:${S}`,Qe=tt.get(dt);if(!Qe)continue;const Ee=Qe.get(0)??0,ze=(Qe.get(oe(ce)??0)??Ee)-Ee;if(ze===0)continue;const Je=Ne.y<O.y;if(Je&&ze<0||!Je&&ze>0)continue;let hn;for(const[Ur,Yt]of Qe){const Qn=Yt-Ee;(Je&&Qn<0&&(!hn||Qn<hn.row)||!Je&&Qn>0&&(!hn||Qn>hn.row))&&(hn={band:Ur,row:Qn})}hn&&Zn.set(ce.node.id,{lane:ce.node.lane,band:hn.band})}}const Bn=new Set;let gu=0;for(;gu++<P.nodes.length+2;){for(let le=0;le<P.nodes.length+P.flows.length+2;le++){let Ze=!1;for(const qe of P.flows){const Me=qe.flow;if(Bn.has(Me.id))continue;const Xe=l(Me.source);if(!Xe)continue;const Ft=l(Me.target),ce=w.get(Me.target);if(!Ft&&ce){const We=I(ce.node,ce.band),Le=oe(ce);if(ce.node.lane||Le!==void 0){const Ne=be(ce.node),dt=Xe,Qe=dt.x+(un.get(Me.source)??0)+dt.width+130,Ee=qt.get(Me.target)??Zn.get(Me.target),ze=Fe(Ne,We,Ee?Ee.lane:ce.node.lane,Ee?Ee.band:Le,st.has(Me.target)?dt.x+dt.width/2:Qe,Number.NaN),Je=n.createShape(We,ze,Ne);st.has(Me.target)&&un.set(Me.target,Qe-(Je.x+Je.width/2)),n.connect(Xe,Je,{type:"bpmn:SequenceFlow",businessObject:k(Me)})}else s.append(Xe,We,{connection:{type:"bpmn:SequenceFlow",businessObject:k(Me)}})}else if(Ft)n.connect(Xe,Ft,{type:"bpmn:SequenceFlow",businessObject:k(Me)});else continue;Bn.add(Me.id),Ze=!0}if(!Ze)break}const ne=P.nodes.filter(le=>!l(le.node.id));if(!ne.length)break;const he=ne[0];{const le=I(he.node,he.band),Ze=be(he.node),qe=se(he);n.createShape(le,Fe(Ze,le,he.node.lane,qe,V,G),Ze),!he.node.lane&&qe===void 0&&(G+=160)}}}const Te=40,He=(S,P=()=>!0)=>{const O=l(S);if(!O)return[];const V=[O],G=new Set([S]);for(let j=0;j<V.length;j++){const Z=V[j].id;for(const Ce of m){const J=Ce.flow.target;if(Ce.flow.source!==Z||G.has(J)||!w.has(J))continue;G.add(J);const be=l(J);be&&P(be)&&V.push(be)}}return V};for(const S of Kt(e,"sequenceFlow.update")){if(S.target===void 0)continue;const P=w.get(S.target);if(!P)continue;const O=l(S.target),V=l(S.id);if(!O||!V)continue;const G=S.source!==void 0?l(S.source):V.source,j=V.target;if(!G||!j||j.id===O.id)continue;const Z=He(S.target),Ce=new Set(Z.map(Pe=>Pe.id)),J=Math.min(...Z.map(Pe=>Pe.x)),be=Math.max(...Z.map(Pe=>Pe.x+Pe.width)),Ke=G.x+G.width,lt=be-J+Te*2-(j.x-Ke);if(lt>0){const Pe=f(O),_e=(Pe==null?void 0:Pe.children)??[],st=un=>un.type==="bpmn:Lane",qt=_e.filter(un=>!("waypoints"in un&&un.waypoints)&&!st(un)&&!Ce.has(un.id)&&un.x>=j.x),Zn=Pe?[Pe,..._e.filter(un=>st(un))]:[];qt.length&&n.createSpace(qt,Zn,{x:lt,y:0},"e",j.x-1)}const Fe=P.node.lane||P.band!==void 0?O.y+O.height/2:G.y+G.height/2;n.moveElements(Z,{x:Ke+Te-J,y:Fe-(O.y+O.height/2)})}const bt=(S,P)=>{const O=P.target===S,V=p(P.source),G=p(P.target),j=O?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(V,G,P.id?{type:j,businessObject:i.create(j,{id:P.id})}:{type:j})};for(const S of R){const P=S.associations??[],O=P.map(j=>j.source===S.dataStore.id?j.target:j.source).map(l).find(Boolean),V=O?f(O)??u():u(),G=O?{x:O.x+O.width/2,y:O.y+O.height+110}:{x:200,y:wt+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:S.dataStore.id,name:S.dataStore.name})},G,V);for(const j of P)bt(S.dataStore.id,j)}for(const S of E){const O=p(S.association.target).type==="bpmn:DataStoreReference"?S.association.target:S.association.source;bt(O,S.association)}const nt=100,kt=S=>{for(const P of d){if(!P.participant.blackBox)continue;const O=l(P.participant.id);if(!O)continue;const V=[];for(const j of g){const Z=j.flow.source===P.participant.id?j.flow.target:j.flow.target===P.participant.id?j.flow.source:void 0,Ce=Z?l(Z):void 0;Ce&&typeof Ce.x=="number"&&Ce.type!=="bpmn:Participant"&&V.push(Ce)}if(!V.length)continue;const G=Math.max(...V.map(j=>j.x+j.width/2))+nt;if(G>O.x+O.width&&n.resizeShape(O,{x:O.x,y:O.y,width:G-O.x,height:O.height}),!!S)for(const j of g){const Z=l(j.flow.id),Ce=j.flow.source===P.participant.id?j.flow.target:j.flow.target===P.participant.id?j.flow.source:void 0,J=Ce?l(Ce):void 0;if(!Z||!J||J.type==="bpmn:Participant")continue;const be=J.x+J.width/2;if(be<O.x+10||be>O.x+O.width-10)continue;const Ke=O.y>J.y,lt=Ke?J.y+J.height:J.y,Fe=Ke?O.y:O.y+O.height,Pe=j.flow.source===P.participant.id?[{x:be,y:Fe},{x:be,y:lt}]:[{x:be,y:lt},{x:be,y:Fe}],_e=pn(o),st={..._e.edges.find(qt=>qt.id===j.flow.id),waypoints:Pe};si(st,Wi(_e)).length||n.updateWaypoints(Z,Pe)}}};kt(!1);for(const S of g){const P=S.flow;n.connect(p(P.source),p(P.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:P.id,name:P.name})})}const Ut=100,cn=30,ct=4,$t=S=>!("waypoints"in S&&S.waypoints)&&S.type!=="bpmn:Lane"&&S.type!=="label"&&typeof S.x=="number",jt=()=>{const S=pn(o);return{bad:Ui(S).filter(P=>P.kind==="edge-crosses-shape"||P.kind==="edge-overlap-opposite"||P.kind==="edge-overlap-mixed").length,crossings:vd(S),straight:S.edges.filter(P=>P.type==="bpmn:MessageFlow"&&P.waypoints.length===2).length}},Wr=S=>{const P=pn(o),O=P.edges.find(V=>V.id===S);return!!O&&si(O,Wi(P)).length>0},Mn=(S,P,O)=>{const V=new Set(S.map(be=>be.id)),G=(P.children??[]).filter($t).filter(be=>!V.has(be.id));if(S.some(be=>G.some(Ke=>be.x+O<Ke.x+Ke.width+cn&&be.x+O+be.width+cn>Ke.x&&be.y<Ke.y+Ke.height&&be.y+be.height>Ke.y)))return null;const Z=P.width;n.moveElements(S,{x:O,y:0});const J=Math.max(...S.map(be=>be.x+be.width))+150-(P.x+P.width);return J>0&&n.resizeShape(P,{x:P.x,y:P.y,width:P.width+J,height:P.height}),()=>{n.moveElements(S,{x:-O,y:0}),J>0&&n.resizeShape(P,{x:P.x,y:P.y,width:Z,height:P.height})}},ni=(S,P)=>P.bad>S.bad||P.crossings>S.crossings&&P.straight<=S.straight,Nn=(S,P,O,V=()=>!0)=>{const G=jt(),j=Mn(S,P,O);if(!j)return!1;const Z=jt();return ni(G,Z)||!V()?(j(),!1):!0},Dt=S=>{var O;const P=(O=w.get(S))==null?void 0:O.node.participant;return!!P&&ue.has(`pool:${P}`)},ii=new Map;for(const S of g){if(!Dt(S.flow.target))continue;const P=ii.get(S.flow.target)??[];P.push(S),ii.set(S.flow.target,P)}const No=[...ii.keys()],kn=new Set(m.map(S=>S.flow.target)),Ue=S=>Ae.findIndex(({op:P})=>P.participant.id===S);No.sort((S,P)=>{var G,j;const O=kn.has(S)?1:0,V=kn.has(P)?1:0;return O!==V?O-V:Ue((G=w.get(S))==null?void 0:G.node.participant)-Ue((j=w.get(P))==null?void 0:j.node.participant)});const Ye=S=>S.x+S.width/2,rx=S=>{let P;for(const O of ii.get(S)??[]){const V=l(O.flow.source);if(!V)continue;const G=Ye(V);(!P||G>P.cx)&&(P={op:O,cx:G})}return P==null?void 0:P.op},TD=S=>{const P=rx(S),O=l(S),V=P?l(P.flow.source):void 0;return O&&V?Ye(V)-Ye(O):void 0},MD=S=>{const P=TD(S);return P!==void 0&&Math.abs(P)<Ut},Of=S=>{const P=rx(S);if(!P)return null;const O=l(S),V=l(P.flow.source);if(!O||!V)return null;const G=Ye(V)-Ye(O);if(G>=Ut){const j=p(w.get(S).node.participant);return{subtree:He(S,Z=>Z.x>=O.x),pool:j,dx:G}}if(-G>=Ut&&Dt(P.flow.source)){const j=p(w.get(P.flow.source).node.participant);return{subtree:He(P.flow.source,Z=>Z.x>=V.x&&!MD(Z.id)),pool:j,dx:-G}}return null},ox=()=>No.map(S=>({id:S,plan:Of(S)})).filter(S=>!!S.plan).sort((S,P)=>Math.min(...S.plan.subtree.map(O=>O.x))-Math.min(...P.plan.subtree.map(O=>O.x))).map(S=>S.id);for(let S=0;S<3;S++){const P=jt(),O=[];for(const G of ox()){const j=Of(G);if(!j)continue;const Z=Mn(j.subtree,j.pool,j.dx);Z&&O.push(Z)}if(!O.length)break;if(!ni(P,jt()))continue;for(const G of O.reverse())G();let V=!1;for(const G of ox()){const j=Of(G);j&&Nn(j.subtree,j.pool,j.dx)&&(V=!0)}if(!V)break}for(const S of No.flatMap(P=>ii.get(P)??[])){if(!Wr(S.flow.id))continue;const P=l(S.flow.target);if(!P)continue;const O=p(w.get(S.flow.target).node.participant),V=He(S.flow.target,j=>j.x>=P.x),G=P.width+130;for(let j=1;j<=ct&&!Nn(V,O,G*j,()=>!Wr(S.flow.id));j++);}{const P=V=>V.y+V.height/2,O=[];for(const[V,G]of w){const j=G.node.participant;if(!j||!ue.has(`pool:${j}`))continue;const Z=m.filter(be=>be.flow.target===V);if(Z.length!==1)continue;const Ce=l(Z[0].flow.source),J=l(V);!Ce||!J||!w.has(Ce.id)||Math.abs(P(Ce)-P(J))>1||J.x-(Ce.x+Ce.width)<=131||O.push({id:V,pred:Ce,node:J})}O.sort((V,G)=>V.node.x-G.node.x);for(const{id:V}of O){const G=w.get(V),j=l(V),Z=l(m.find(Pe=>Pe.flow.target===V).flow.source);if(!j||!Z)continue;const Ce=j.x-(Z.x+Z.width);if(Ce<=131)continue;const J=p(G.node.participant),be=He(V,Pe=>Pe.x>=j.x),Ke=jt(),lt=Mn(be,J,-(Ce-130));if(!lt)continue;const Fe=jt();(Fe.bad>Ke.bad||Fe.crossings>=Ke.crossings)&<()}}kt(!0);let ax=0;for(const S of b){const P=(S.group.members??[]).map(l).filter(j=>!!j),O=40;let V;if(P.length){const j=Math.min(...P.map(be=>be.x))-O,Z=Math.min(...P.map(be=>be.y))-O,Ce=Math.max(...P.map(be=>be.x+be.width))+O,J=Math.max(...P.map(be=>be.y+be.height))+O;V={x:j,y:Z,width:Ce-j,height:J-Z}}else V={x:300+ax*350,y:40,width:300,height:200},ax++;const G=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:S.group.id}),width:V.width,height:V.height},{x:V.x+V.width/2,y:V.y+V.height/2},u());S.group.name&&n.updateLabel(G,S.group.name),(fx=S.group.members)!=null&&fx.length&&T(G,"bwl:Members",{refs:S.group.members.join(" ")})}const sx=S=>{const P=S.waypoints;if(P!=null&&P.length){const V=P[Math.floor((P.length-1)/2)];return{x:V.x,y:V.y,width:0,height:0}}const O=S;return{x:O.x,y:O.y,width:O.width,height:O.height}};let Ua=0;const cx=12,ux=14,kD=15,DD=300,OD=S=>{const P=S.split(`
|
|
7
|
+
`),O=Math.max(...P.map(j=>Go(j,cx))),V=Math.max(100,Math.min(DD,Math.ceil(O)+ux)),G=P.reduce((j,Z)=>j+Math.max(1,Math.ceil((Go(Z,cx)+ux)/V)),0);return{width:V,height:Math.max(30,G*kD+10)}},en=10;for(const S of x){const P=S.association,O=((dx=S.placement)==null?void 0:dx.anchor)??(P?P.source===S.annotation.id?P.target:P.source:void 0),V=O?l(O):void 0,G=V?sx(V):void 0,j=OD(S.annotation.text??"");let Z;if(G&&S.placement){const[Ke,lt]=zu[S.placement.side],Fe=S.placement.offset??50;Z={x:G.x+G.width/2+Ke*(G.width/2+j.width/2+Fe),y:G.y+G.height/2+lt*(G.height/2+j.height/2+Fe)}}else G?(Z={x:G.x+G.width/2+180+Ua%3*260,y:G.y-110-Ua%2*95},Ua++):(Z={x:300+Ua*260,y:60},Ua++);const Ce=V?f(V)??u():u(),J=Ce;if(G&&typeof J.x=="number"&&typeof J.width=="number"&&J.type==="bpmn:Participant"){const Ke=(ne,he)=>{const[le,Ze]=zu[ne];let qe={x:G.x+G.width/2+le*(G.width/2+j.width/2+he),y:G.y+G.height/2+Ze*(G.height/2+j.height/2+he)};const Me=J.x+en+j.width/2,Xe=J.x+J.width-en-j.width/2,Ft=J.y+en+j.height/2,ce=J.y+J.height-en-j.height/2,We={x:Math.min(Xe,Math.max(Me,qe.x)),y:Math.min(ce,Math.max(Ft,qe.y))};return(We.x!==qe.x||We.y!==qe.y)&&(qe=Math.abs(We.x-(G.x+G.width/2))<(G.width+j.width)/2+en&&Math.abs(We.y-(G.y+G.height/2))<(G.height+j.height)/2+en?{x:G.x+G.width+en+j.width/2,y:We.y}:We),qe},lt=(J.children??[]).filter(ne=>!("waypoints"in ne&&ne.waypoints)&&ne.type!=="bpmn:Lane"&&ne.type!=="label"&&typeof ne.x=="number"),Fe=pn(o),Pe=Fe.edges.flatMap(xn),_e=Fu(Fe).map(ne=>ne.rect),st=ne=>({x0:ne.x-j.width/2-en,x1:ne.x+j.width/2+en,y0:ne.y-j.height/2-en,y1:ne.y+j.height/2+en}),qt=ne=>{const he=st(ne);return lt.some(le=>he.x0<le.x+le.width&&he.x1>le.x&&he.y0<le.y+le.height&&he.y1>le.y)},Zn=ne=>{const he=st(ne);return Pe.some(le=>le.axis==="h"?le.at>he.y0&&le.at<he.y1&&le.lo<he.x1&&le.hi>he.x0:le.at>he.x0&&le.at<he.x1&&le.lo<he.y1&&le.hi>he.y0)},un=ne=>{const he=st(ne);return _e.some(le=>he.x0<le.x+le.width&&he.x1>le.x&&he.y0<le.y+le.height&&he.y1>le.y)},Bn=ne=>qt(ne)||Zn(ne)||un(ne),gu=ne=>ne.x-j.width/2>=J.x&&ne.x+j.width/2<=J.x+J.width&&ne.y-j.height/2>=J.y&&ne.y+j.height/2<=J.y+J.height;if(S.placement){const ne=Me=>Me.startsWith("top")?Me.replace(/^top/,"bottom"):Me.replace(/^bottom/,"top"),he=Me=>Me.endsWith("left")?Me.replace(/left$/,"right"):Me.replace(/right$/,"left"),le=S.placement.side,Ze=[le,ne(le),he(le),ne(he(le)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],qe=S.placement.offset??50;if(Z=Ke(le,qe),Bn(Z)){const Me=new Set;for(const Xe of Ze){if(Me.has(Xe))continue;Me.add(Xe);const Ft=Ke(Xe,qe);if(gu(Ft)&&!Bn(Ft)){Z=Ft;break}}}}else{const ne=J.x+en+j.width/2,he=J.x+J.width-en-j.width/2,le=J.y+en+j.height/2,Ze=J.y+J.height-en-j.height/2;if(Z={x:Math.min(he,Math.max(ne,Z.x)),y:Math.min(Ze,Math.max(le,Z.y))},Bn(Z)){const qe=(G.width+j.width)/2+en,Xe=[{x:Z.x+qe,y:Z.y},{x:Z.x-qe,y:Z.y},{x:Z.x,y:Z.y-j.height-en},{x:Z.x,y:Z.y+j.height+en}].filter(gu).find(Ft=>!Bn(Ft));Xe&&(Z=Xe)}}}const be=n.createShape({type:"bpmn:TextAnnotation",width:j.width,height:j.height,businessObject:i.create("bpmn:TextAnnotation",{id:S.annotation.id,text:S.annotation.text})},Z,Ce);if(P){const Ke=lt=>lt===S.annotation.id?be:p(lt);n.connect(Ke(P.source),Ke(P.target),P.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:P.id})}:{type:"bpmn:Association"})}S.placement&&T(be,"bwl:Placement",L(S.placement))}for(const S of Kt(e,"association.add")){const P=S.association;n.connect(p(P.source),p(P.target),P.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:P.id})}:{type:"bpmn:Association"})}for(const S of Kt(e,"node.update")){let P=p(S.id);if(S.type&&ps(S.type)!==P.type&&(P=c.replaceElement(P,{type:ps(S.type)})),S.name!==void 0&&n.updateProperties(P,{name:S.name??void 0}),S.lane){const O=p(S.lane),V=O.y+O.height/2-(P.y+P.height/2);V!==0&&n.moveElements([P],{x:0,y:V})}}for(const S of Kt(e,"sequenceFlow.update")){const P=p(S.id);if(S.source!==void 0||S.target!==void 0){const O=P,V=S.source!==void 0?p(S.source):O.source,G=S.target!==void 0?p(S.target):O.target,j=Z=>({x:Z.x+Z.width/2,y:Z.y+Z.height/2});n.reconnect(O,V,G,[j(V),j(G)])}S.name!==void 0&&n.updateProperties(P,{name:S.name??void 0}),S.condition!==void 0&&n.updateProperties(P,{name:((hx=S.condition)==null?void 0:hx.label)??void 0})}for(const S of Kt(e,"messageFlow.update"))S.name!==void 0&&n.updateProperties(p(S.id),{name:S.name??void 0});for(const S of Kt(e,"dataStore.update"))S.name!==void 0&&n.updateProperties(p(S.id),{name:S.name??void 0});for(const S of Kt(e,"annotation.update")){const P=p(S.id);if(S.text!==void 0&&n.updateProperties(P,{text:S.text}),S.placement===null)T(P,"bwl:Placement",null);else if(S.placement){const O=sx(p(S.placement.anchor)),[V,G]=zu[S.placement.side],j=S.placement.offset??50,Z=O.x+O.width/2+V*(O.width/2+P.width/2+j),Ce=O.y+O.height/2+G*(O.height/2+P.height/2+j);n.moveElements([P],{x:Z-(P.x+P.width/2),y:Ce-(P.y+P.height/2)}),T(P,"bwl:Placement",L(S.placement))}}for(const S of Kt(e,"group.update")){const P=p(S.id);if(S.name!==void 0&&n.updateLabel(P,S.name??""),S.members){const O=S.members.map(l).filter(V=>!!V);if(O.length){const G=Math.min(...O.map(J=>J.x))-40,j=Math.min(...O.map(J=>J.y))-40,Z=Math.max(...O.map(J=>J.x+J.width))+40,Ce=Math.max(...O.map(J=>J.y+J.height))+40;n.resizeShape(P,{x:G,y:j,width:Z-G,height:Ce-j})}T(P,"bwl:Members",{refs:S.members.join(" ")})}}}function Kd(e,t,n=Yd){const i=qd(e),r=Wd(t,Ed(i.elementRegistry)),o={edgeCrossings:{before:0,after:0}};if(r.length)return{ok:!1,issues:r,findings:[],stats:o};const a=pn(i.elementRegistry),s=new Set(Ui(a).map(Gi)),c=new Set(a.edges.map(d=>d.id)),u=ju(a).length,l=e.get("commandStack");try{$f(l,()=>{n(t,i),Dd(i,c),Td(i,s),$d(i,s,c),Nd(i,c),zd(i,s,c),Hd(i,c)})}catch(d){return{ok:!1,issues:[{kind:"lower-failed",message:d instanceof Error?d.message:String(d)}],findings:[],stats:o}}const p=pn(i.elementRegistry),f=Ui(p).filter(d=>!s.has(Gi(d)));return{ok:!0,issues:[],findings:f,stats:{edgeCrossings:{before:u,after:ju(p).length}}}}function VE(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function GE(e,t){return typeof e.get=="function"?e.get(t):e[t]}function Xd(e,t){const n=GE(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function Zd(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(r=>(r==null?void 0:r.$type)===t)}function WE(e){return typeof e=="string"&&vu.includes(e)}function ci(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function Qd(e){const t=e.rootElements??[],n=t.find(X=>X.$type==="bpmn:Collaboration"),i=new Map(t.filter(X=>X.$type==="bpmn:Process").map(X=>[X.id,X])),r=[],o=[],a=[],s=[],c=[],u=[],l={poolOrders:{},bands:{},placements:{}},p=[],f=[],d=[],h=[],m=[],g=[],R=new Set,E=new Set,x=X=>{X&&R.add(X)},b=X=>{R.add(X),E.add(X)},w=X=>{const se=Zd(X,"bwl:Placement");if(!se)return;const fe=typeof se.anchor=="string"?se.anchor:void 0;if(!fe||!WE(se.side))return;const oe=typeof se.offset=="number"?se.offset:void 0;m.push({owner:X.id,anchor:fe,side:se.side,...oe!==void 0?{offset:oe}:{}})},T=X=>{const se=Zd(X,"bwl:Members"),fe=typeof(se==null?void 0:se.refs)=="string"?se.refs.split(/\s+/).filter(Boolean):[];fe.length&&g.push({owner:X.id,refs:fe})},L=X=>{var se;for(const fe of X)switch(x(fe.id),fe.$type){case"bpmn:TextAnnotation":b(fe.id),s.push({id:fe.id,text:typeof fe.text=="string"?fe.text:""}),w(fe);break;case"bpmn:Association":d.push({id:fe.id,type:fe.$type,source:ci(fe.sourceRef),target:ci(fe.targetRef)});break;case"bpmn:Group":{b(fe.id);const oe=(se=fe.categoryValueRef)==null?void 0:se.value;c.push({id:fe.id,...typeof oe=="string"&&oe?{name:oe}:{}}),T(fe);break}default:u.push({id:fe.id,type:fe.$type,reason:"type-outside-mvp"})}},A=(X,se)=>{const fe=X.flowElements??[],oe=(X.laneSets??[]).flatMap(ee=>ee.lanes??[]),de=new Map;for(const ee of oe){x(ee.id);for(const $ of ee.flowNodeRef??[]){const B=ci($);B&&de.set(B,ee.id)}}for(const ee of fe){if(x(ee.id),ee.$type==="bpmn:SequenceFlow"){p.push({id:ee.id,source:ci(ee.sourceRef),target:ci(ee.targetRef),...typeof ee.name=="string"&&ee.name?{name:ee.name}:{}});continue}if(ee.$type==="bpmn:DataStoreReference"){b(ee.id),a.push({id:ee.id,...ee.name?{name:ee.name}:{}});continue}const $=VE(ee.$type);if(!Lf($)){u.push({id:ee.id,type:ee.$type,reason:"type-outside-mvp"});continue}b(ee.id),o.push({id:ee.id,type:$,...ee.name?{name:ee.name}:{},...se?{participant:se}:{},...de.has(ee.id)?{lane:de.get(ee.id)}:{}});const B=Xd(ee,"bwl:band");B!==void 0&&(l.bands[ee.id]=B);for(const U of ee.dataOutputAssociations??[])x(U.id),h.push({id:U.id,type:U.$type,source:ee.id,target:ci(U.targetRef)});for(const U of ee.dataInputAssociations??[])x(U.id),h.push({id:U.id,type:U.$type,source:ci((U.sourceRef??[])[0]),target:ee.id})}L(X.artifacts??[])};if(n){const X=new Set;for(const se of n.participants??[]){b(se.id);const fe=ci(se.processRef);fe&&X.add(fe);const oe=fe?i.get(fe):void 0,de=((oe==null?void 0:oe.laneSets)??[]).flatMap(U=>U.lanes??[]),ee=de.map(U=>({id:U.id,...U.name?{name:U.name}:{}}));for(const U of ee)b(U.id);const $=!oe||(oe.flowElements??[]).length===0&&de.length===0&&(oe.artifacts??[]).length===0;r.push({id:se.id,...se.name?{name:se.name}:{},...$?{blackBox:!0}:{},...ee.length?{lanes:ee}:{}});const B=Xd(se,"bwl:poolOrder");B!==void 0&&(l.poolOrders[se.id]=B),oe&&A(oe,se.id)}for(const se of n.messageFlows??[])x(se.id),f.push({id:se.id,source:ci(se.sourceRef),target:ci(se.targetRef),...typeof se.name=="string"&&se.name?{name:se.name}:{}});L(n.artifacts??[]);for(const[se,fe]of i)!X.has(se)&&(fe.flowElements??[]).length>0&&u.push({id:se,type:fe.$type,reason:"unreachable-process"})}else for(const X of i.values())A(X);const F=[],H=[],N=[],z=[],ue=(X,se)=>!!X&&!!se&&E.has(X)&&E.has(se);for(const X of p){if(!ue(X.source,X.target)){u.push({id:X.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}F.push({id:X.id,source:X.source,target:X.target,...X.name?{name:X.name}:{}}),E.add(X.id)}for(const X of f){if(!ue(X.source,X.target)){u.push({id:X.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}H.push({id:X.id,source:X.source,target:X.target,...X.name?{name:X.name}:{}}),E.add(X.id)}for(const X of h){if(!ue(X.source,X.target)){u.push({id:X.id??"",type:X.type,reason:"endpoint-outside-mvp"});continue}z.push({...X.id?{id:X.id}:{},source:X.source,target:X.target}),X.id&&E.add(X.id)}for(const X of d){if(!ue(X.source,X.target)){u.push({id:X.id??"",type:X.type,reason:"endpoint-outside-mvp"});continue}N.push({...X.id?{id:X.id}:{},source:X.source,target:X.target})}const je=new Map(c.map(X=>[X.id,X]));for(const{owner:X,refs:se}of g){const fe=se.filter(de=>R.has(de)),oe=je.get(X);oe&&fe.length&&(oe.members=fe)}for(const X of m)R.has(X.anchor)&&(l.placements[X.owner]={anchor:X.anchor,side:X.side,...X.offset!==void 0?{offset:X.offset}:{}});return{definition:{...r.length?{participants:r}:{},nodes:o,sequenceFlows:F,...H.length?{messageFlows:H}:{},...a.length?{dataStores:a}:{},...z.length?{dataAssociations:z}:{},...s.length?{annotations:s}:{},...N.length?{associations:N}:{},...c.length?{groups:c}:{}},hints:l,omitted:u}}async function UE(e){const{definitions:t,warnings:n}=await Iu(e);return{...Qd(t),warnings:n}}function qE(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function Jd(e,t,{currentVersion:n}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const i=Kd(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 YE=Symbol("bpmn-editor");function KE(){const e=St.ref(!1),t=St.ref(!0),n=St.ref(!1);let i,r;const o=()=>{e.value=!0};function a(u,l){u.get("canvas").getContainer().style.pointerEvents=l?"":"none";const p=u.get("keyboard");l?(r&&p.bind(r),r=void 0):r||(r=p.getBinding(),p.unbind())}function s(){if(!i)throw new Error("modeler not attached — 뷰 @ready 후 attach() 필요");return i}function c(){return i==null?void 0:i.get("commandStack")}return{dirty:e,editable:t,agentBusy:n,attach(u){i&&this.detach(),i=u,i.get("eventBus").on("commandStack.changed",o),t.value||a(i,!1)},detach(){i==null||i.get("eventBus").off("commandStack.changed",o),i&&!t.value&&a(i,!0),r=void 0,i=void 0},setEditable(u){t.value=u,i&&a(i,u)},async applyAgentBatch(u,l){const p=s();n.value=!0;try{const f=await Jd(p,u,{currentVersion:l});return f.status==="applied"&&(e.value=!1),f}finally{n.value=!1}},async importXml(u){const{warnings:l}=await s().importXML(u);return e.value=!1,{warnings:Nu(l)}},async saveXml(){const{xml:u}=await s().saveXML({format:!0});return e.value=!1,u??""},undo:()=>{var u;return(u=c())==null?void 0:u.undo()},redo:()=>{var u;return(u=c())==null?void 0:u.redo()},canUndo:()=>{var u;return((u=c())==null?void 0:u.canUndo())??!1},canRedo:()=>{var u;return((u=c())==null?void 0:u.canRedo())??!1}}}function ie(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function XE(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Vu={exports:{}},eh;function ZE(){if(eh)return Vu.exports;eh=1;var e=Vu.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 u=parseInt(a,n);return u!==1/0&&u>=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},Vu.exports}var QE=ZE(),JE=XE(QE);function ui(e){if(!(this instanceof ui))return new ui(e);e=e||[128,36,1],this._seed=e.length?JE.rack(e[0],e[1],e[2]):e}ui.prototype.next=function(e){return this._seed(e||!0)},ui.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},ui.prototype.claim=function(e,t){this._seed.set(e,t||!0)},ui.prototype.assigned=function(e){return this._seed.get(e)||!1},ui.prototype.unclaim=function(e){delete this._seed.hats[e]},ui.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const Lt={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};Lt.td=Lt.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],Lt.option=Lt.optgroup=[1,'<select multiple="multiple">',"</select>"],Lt.thead=Lt.tbody=Lt.colgroup=Lt.caption=Lt.tfoot=[1,"<table>","</table>"],Lt.polyline=Lt.ellipse=Lt.polygon=Lt.circle=Lt.text=Lt.line=Lt.path=Lt.rect=Lt.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function ut(e,t=globalThis.document){var u;if(typeof e!="string")throw new TypeError("String expected");const n=/^<!--(.*?)-->$/s.exec(e);if(n)return t.createComment(n[1]);const i=(u=/<([\w:]+)/.exec(e))==null?void 0:u[1];if(!i)return t.createTextNode(e);if(e=e.trim(),i==="body"){const l=t.createElement("html");l.innerHTML=e;const{lastChild:p}=l;return p.remove(),p}let[r,o,a]=Object.hasOwn(Lt,i)?Lt[i]:Lt._default,s=t.createElement("div");for(s.innerHTML=o+e+a;r--;)s=s.lastChild;if(s.firstChild===s.lastChild){const{firstChild:l}=s;return l.remove(),l}const c=t.createDocumentFragment();return c.append(...s.childNodes),c}function ew(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 fn(e,...t){const n=e.style;return M(t,function(i){i&&M(i,function(r,o){n[o]=r})}),e}function on(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const tw=Object.prototype.toString;function ft(e){return new qi(e)}function qi(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}qi.prototype.add=function(e){return this.list.add(e),this},qi.prototype.remove=function(e){return tw.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},qi.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},qi.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},qi.prototype.array=function(){return Array.from(this.list)},qi.prototype.has=qi.prototype.contains=function(e){return this.list.contains(e)};function fs(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Ar(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function nw(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ds={},th;function iw(){if(th)return ds;th=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return ds.bind=function(r,o,a,s){return e||i(),r[e](n+o,a,s||!1),a},ds.unbind=function(r,o,a,s){return t||i(),r[t](n+o,a,s||!1),a},ds}var nh=iw(),rw=nw(nh),we=ew({__proto__:null,default:rw},[nh]),ih=["focus","blur"];function ow(e,t,n,i,r){return ih.indexOf(n)!==-1&&(r=!0),we.bind(e,n,function(o){var a=o.target||o.srcElement;o.delegateTarget=Ar(a,t,!0),o.delegateTarget&&i.call(e,o)},r)}function aw(e,t,n,i){return ih.indexOf(t)!==-1&&(i=!0),we.unbind(e,t,n,i)}var En={bind:ow,unbind:aw};function Gu(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function et(e,t){return t=t||document,t.querySelector(e)}function hs(e,t){return t=t||document,t.querySelectorAll(e)}function li(e){e.parentNode&&e.parentNode.removeChild(e)}function sw(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function cw(e,t){return t.appendChild(sw(e,t))}function Se(e,t){return cw(t,e),e}var Wu=2,rh={"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":Wu,"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":Wu,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function uw(e,t){return rh[t]?e.style[t]:e.getAttributeNS(null,t)}function oh(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=rh[i];r?(r===Wu&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function lw(e,t){var n=Object.keys(t),i,r;for(i=0,r;r=n[i];i++)oh(e,r,t[r])}function re(e,t,n){if(typeof t=="string")if(n!==void 0)oh(e,t,n);else return uw(e,t);else lw(e,t);return e}const pw=Object.prototype.toString;function $e(e){return new Yi(e)}function Yi(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Yi.prototype.add=function(e){return this.list.add(e),this},Yi.prototype.remove=function(e){return pw.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Yi.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},Yi.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Yi.prototype.array=function(){return Array.from(this.list)},Yi.prototype.has=Yi.prototype.contains=function(e){return this.list.contains(e)};function ms(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function ah(e){return e.cloneNode(!0)}var Uu={svg:"http://www.w3.org/2000/svg"},sh='<svg xmlns="'+Uu.svg+'"';function fw(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(Uu.svg)===-1&&(e=sh+e.substring(4)):(e=sh+">"+e+"</svg>",t=!0);var n=dw(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function dw(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function pe(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=fw(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(Uu.svg,e),t&&re(n,t),n}var qu=null;function ch(){return qu===null&&(qu=pe("svg")),qu}function uh(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function hw(e,t,n,i,r,o){var a=ch().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return uh(a,e);case 6:return uh(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}function Wo(e){return ch().createSVGTransform()}var lh=/([&<>]{1})/g,mw=/([&<>\n\r"]{1})/g,gw={"&":"&","<":"<",">":">",'"':"'"};function Yu(e,t){function n(i,r){return gw[r]||r}return e.replace(t,n)}function ph(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(Yu(e.textContent,lh));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,'="',Yu(o.value,mw),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)ph(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",Yu(e.nodeValue,lh),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function yw(e){for(var t=e.firstChild,n=[];t;)ph(t,n),t=t.nextSibling;return n.join("")}function fh(e,t){return yw(e)}function It(e){var t=e.parentNode;return t&&t.removeChild(e),e}function vw(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function _w(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(vw(e,i))}function Uo(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),_w(n,t)),n.consolidate()}const bw=/^class[ {]/;function xw(e){return bw.test(e.toString())}function Ku(e){return Array.isArray(e)}function Xu(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function gs(...e){e.length===1&&Ku(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const Ew=/constructor\s*[^(]*\(\s*([^)]*)\)/m,ww=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,Sw=/\/\*([^*]*)\*\//m;function Rw(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(xw(e)?Ew:ww);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const r=i.match(Sw);return(r&&r[1]||i).trim()})||[]}function dh(e,t){const n=t||{get:function(x,b){if(i.push(x),b===!1)return null;throw s(`No provider for "${x}"!`)}},i=[],r=this._providers=Object.create(n._providers||null),o=this._instances=Object.create(null),a=o.injector=this,s=function(x){const b=i.join(" -> ");return i.length=0,new Error(b?`${x} (Resolving: ${b})`:x)};function c(x,b){if(!r[x]&&x.includes(".")){const w=x.split(".");let T=c(w.shift());for(;w.length;)T=T[w.shift()];return T}if(Xu(o,x))return o[x];if(Xu(r,x)){if(i.indexOf(x)!==-1)throw i.push(x),s("Cannot resolve circular dependency!");return i.push(x),o[x]=r[x][0](r[x][1]),i.pop(),o[x]}return n.get(x,b)}function u(x,b){if(typeof b>"u"&&(b={}),typeof x!="function")if(Ku(x))x=gs(x.slice());else throw s(`Cannot invoke "${x}". Expected a function!`);const T=(x.$inject||Rw(x)).map(L=>Xu(b,L)?b[L]:c(L));return{fn:x,dependencies:T}}function l(x){const{fn:b,dependencies:w}=u(x),T=Function.prototype.bind.call(b,null,...w);return new T}function p(x,b,w){const{fn:T,dependencies:L}=u(x,w);return T.apply(b,L)}function f(x){return gs(b=>x.get(b))}function d(x,b){if(b&&b.length){const w=Object.create(null),T=Object.create(null),L=[],A=[],F=[];let H,N,z,ue;for(let je in r)H=r[je],b.indexOf(je)!==-1&&(H[2]==="private"?(N=L.indexOf(H[3]),N===-1?(z=H[3].createChild([],b),ue=f(z),L.push(H[3]),A.push(z),F.push(ue),w[je]=[ue,je,"private",z]):w[je]=[F[N],je,"private",A[N]]):w[je]=[H[2],H[1]],T[je]=!0),(H[2]==="factory"||H[2]==="type")&&H[1].$scope&&b.forEach(tt=>{H[1].$scope.indexOf(tt)!==-1&&(w[je]=[H[2],H[1]],T[tt]=!0)});b.forEach(je=>{if(!T[je])throw new Error('No provider for "'+je+'". Cannot use provider from the parent!')}),x.unshift(w)}return new dh(x,a)}const h={factory:p,type:l,value:function(x){return x}};function m(x,b){const w=x.__init__||[];return function(){w.forEach(T=>{typeof T=="string"?b.get(T):b.invoke(T)})}}function g(x){const b=x.__exports__;if(b){const w=x.__modules__,T=Object.keys(x).reduce((N,z)=>(z!=="__exports__"&&z!=="__modules__"&&z!=="__init__"&&z!=="__depends__"&&(N[z]=x[z]),N),Object.create(null)),L=(w||[]).concat(T),A=d(L),F=gs(function(N){return A.get(N)});b.forEach(function(N){r[N]=[F,N,"private",A]});const H=(x.__init__||[]).slice();return H.unshift(function(){A.init()}),x=Object.assign({},x,{__init__:H}),m(x,A)}return Object.keys(x).forEach(function(w){if(w==="__init__"||w==="__depends__")return;const T=x[w];if(T[2]==="private"){r[w]=T;return}const L=T[0],A=T[1];r[w]=[h[L],Cw(L,A),L]}),m(x,a)}function R(x,b){return x.indexOf(b)!==-1||(x=(b.__depends__||[]).reduce(R,x),x.indexOf(b)!==-1)?x:x.concat(b)}function E(x){const b=x.reduce(R,[]).map(g);let w=!1;return function(){w||(w=!0,b.forEach(T=>T()))}}this.get=c,this.invoke=p,this.instantiate=l,this.createChild=d,this.init=E(e)}function Cw(e,t){return e!=="value"&&Ku(t)&&(t=gs(t.slice())),t}var Pw=1e3;function Si(e,t){var n=this;t=t||Pw,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)})}Si.prototype.canRender=function(e){},Si.prototype.drawShape=function(e,t){},Si.prototype.drawConnection=function(e,t){},Si.prototype.getShapePath=function(e){},Si.prototype.getConnectionPath=function(e){};function Tr(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function Aw(e){return["M",e.x,e.y]}function Zu(e){return["L",e.x,e.y]}function Tw(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function Mw(e,t){const n=e.length,i=[Aw(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(Zu(a));continue}const c=Math.min(t,Qu(a.x-o.x,a.y-o.y),Qu(s.x-a.x,s.y-a.y));if(!c){i.push(Zu(a));continue}const u=ys(a,o,c),l=ys(a,o,c*.5),p=ys(a,s,c),f=ys(a,s,c*.5);i.push(Zu(u)),i.push(Tw(l,f,p))}return i}function ys(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=Qu(i,r),a=n/o;return{x:e.x+i*a,y:e.y+r*a}}function Qu(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function qo(e,t,n){xe(t)&&(n=t,t=null),t||(t={});const i=pe("path",t);return xe(n)&&(i.dataset.cornerRadius=String(n)),Ju(i,e)}function Ju(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return re(e,{d:Tr(Mw(t,n))}),e}function vs(e){var t=new Set(e);return Oe(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function Mr(e,t,n){n=n||0,ge(e)||(e=[e]),M(e,function(i,r){var o=t(i,r,n);ge(o)&&o.length&&Mr(o,t,n+1)})}function el(e,t,n){var i=new Set,r=new Set;return Mr(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 Yo(e,t){return el(e)}function kw(e,t,n){xr(t)&&(t=!0),Ht(t)&&(n=t,t=!0),n=n||{};var i=Ko(n.allShapes),r=Ko(n.allConnections),o=Ko(n.enclosedElements),a=Ko(n.enclosedConnections),s=Ko(n.topLevel,t&&Xr(e,function(l){return l.id}));function c(l){s[l.source.id]&&s[l.target.id]&&(s[l.id]=[l]),i[l.source.id]&&i[l.target.id]&&(a[l.id]=o[l.id]=l),r[l.id]=l}function u(l){if(o[l.id]=l,l.waypoints)a[l.id]=r[l.id]=l;else return i[l.id]=l,M(l.incoming,c),M(l.outgoing,c),l.children}return Mr(e,u),{allShapes:i,allConnections:r,topLevel:s,enclosedConnections:a,enclosedElements:o}}function Rt(e,t){t=!!t,ge(e)||(e=[e]);var n,i,r,o;return M(e,function(a){var s=a;a.waypoints&&!t&&(s=Rt(a.waypoints,!0));var c=s.x,u=s.y,l=s.height||0,p=s.width||0;(c<n||n===void 0)&&(n=c),(u<i||i===void 0)&&(i=u),(c+p>r||r===void 0)&&(r=c+p),(u+l>o||o===void 0)&&(o=u+l)}),{x:n,y:i,height:o-i,width:r-n}}function io(e,t){var n={};return M(e,function(i){var r=i;r.waypoints&&(r=Rt(r)),!xe(t.y)&&r.x>t.x&&(n[i.id]=i),!xe(t.x)&&r.y>t.y&&(n[i.id]=i),r.x>t.x&&r.y>t.y&&(xe(t.width)&&xe(t.height)&&r.width+r.x<t.width+t.x&&r.height+r.y<t.height+t.y||!xe(t.width)||!xe(t.height))&&(n[i.id]=i)}),n}function hh(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function mh(e){return!!(e&&e.isFrame)}function Ko(e,t){return D({},e||{},t||{})}var Dw=1;function Ki(e,t){Si.call(this,e,Dw),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})}ie(Ki,Si),Ki.prototype.canRender=function(){return!0},Ki.prototype.drawShape=function(t,n,i){var r=pe("rect");return re(r,{x:0,y:0,width:n.width||0,height:n.height||0}),mh(n)?re(r,D({},this.FRAME_STYLE,i||{})):re(r,D({},this.SHAPE_STYLE,i||{})),Se(t,r),r},Ki.prototype.drawConnection=function(t,n,i){var r=qo(n.waypoints,D({},this.CONNECTION_STYLE,i||{}));return Se(t,r),r},Ki.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 Tr(a)},Ki.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 Tr(o)},Ki.$inject=["eventBus","styles"];function Ow(){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 D(o,{class:n})},this.style=function(n,i){!ge(n)&&!i&&(i=n,n=[]);var r=bn(n,function(o,a){return D(o,e[a]||{})},{});return i?D(r,i):r},this.computeStyle=function(n,i,r){return ge(i)||(r=i,i=[]),t.style(i||[],D({},r,n||{}))}}const Lw={__init__:["defaultRenderer"],defaultRenderer:["type",Ki],styles:["type",Ow]};function _t(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function Et(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 tl(e,t){return!e||!t?-1:e.indexOf(t)}function Xo(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function nl(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=Xo(e,t);return Math.abs(r/o)<=i}var Iw=2;function Ri(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[r,o]of Object.entries(i))if(Nw(r,n))return o;return!1}function Nw(e,t){const n=t[0];return Er(t,function(i){return Math.abs(n[e]-i[e])<=Iw})}function gh(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 il(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var Bw=/,?([a-z]),?/gi,yh=parseFloat,Ct=Math,Xi=Ct.PI,pi=Ct.min,fi=Ct.max,vh=Ct.pow,Zi=Ct.abs,$w=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,jw=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,_h=Array.isArray||function(e){return e instanceof Array};function Fw(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Hw(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 zw(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 Fw(r,i)?(Hw(o,i),r[i]):(o.length>=1e3&&delete r[o.shift()],o.push(i),r[i]=e(...arguments),r[i])}return t}function Vw(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($w,function(i,r,o){var a=[],s=r.toLowerCase();for(o.replace(jw,function(c,u){u&&a.push(+u)}),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=ol,n}function Gw(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 Ww(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 rl(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 ol(){return this.join(",").replace(Bw,"$1")}function Uw(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=ol,t}function bh(e,t,n,i,r,o,a,s,c){var u=1-c,l=vh(u,3),p=vh(u,2),f=c*c,d=f*c,h=l*e+p*3*c*n+u*3*c*c*r+d*a,m=l*t+p*3*c*i+u*3*c*c*o+d*s;return{x:_s(h),y:_s(m)}}function xh(e){var t=Qw(...e);return rl(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function Qi(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function qw(e,t){return e=rl(e),t=rl(t),Qi(t,e.x,e.y)||Qi(t,e.x2,e.y)||Qi(t,e.x,e.y2)||Qi(t,e.x2,e.y2)||Qi(e,t.x,t.y)||Qi(e,t.x2,t.y)||Qi(e,t.x,t.y2)||Qi(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 Eh(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 wh(e,t,n,i,r,o,a,s,c){c==null&&(c=1),c=c>1?1:c<0?0:c;for(var u=c/2,l=12,p=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],f=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],d=0,h=0;h<l;h++){var m=u*p[h]+u,g=Eh(m,e,n,r,a),R=Eh(m,t,i,o,s),E=g*g+R*R;d+=f[h]*Ct.sqrt(E)}return u*d}function Yw(e,t,n,i,r,o,a,s){if(!(fi(e,n)<pi(r,a)||pi(e,n)>fi(r,a)||fi(t,i)<pi(o,s)||pi(t,i)>fi(o,s))){var c=(e*i-t*n)*(r-a)-(e-n)*(r*s-o*a),u=(e*i-t*n)*(o-s)-(t-i)*(r*s-o*a),l=(e-n)*(o-s)-(t-i)*(r-a);if(l){var p=_s(c/l),f=_s(u/l),d=+p.toFixed(2),h=+f.toFixed(2);if(!(d<+pi(e,n).toFixed(2)||d>+fi(e,n).toFixed(2)||d<+pi(r,a).toFixed(2)||d>+fi(r,a).toFixed(2)||h<+pi(t,i).toFixed(2)||h>+fi(t,i).toFixed(2)||h<+pi(o,s).toFixed(2)||h>+fi(o,s).toFixed(2)))return{x:p,y:f}}}}function _s(e){return Math.round(e*1e11)/1e11}function Kw(e,t,n){var i=xh(e),r=xh(t);if(!qw(i,r))return[];var o=wh(...e),a=wh(...t),s=Rh(e)?1:~~(o/5)||1,c=Rh(t)?1:~~(a/5)||1,u=new Array(s+1),l=new Array(c+1),p={},f=[],d,h;for(d=0;d<s+1;d++){var m=bh(...e,d/s);u[d]={x:m.x,y:m.y,t:d/s}}for(d=0;d<c+1;d++)m=bh(...t,d/c),l[d]={x:m.x,y:m.y,t:d/c};for(d=0;d<s;d++)for(h=0;h<c;h++){var g=u[d],R=u[d+1],E=l[h],x=l[h+1],b=Zi(R.x-g.x)<.01?"y":"x",w=Zi(x.x-E.x)<.01?"y":"x",T=Yw(g.x,g.y,R.x,R.y,E.x,E.y,x.x,x.y),L;if(T){if(L=T.x.toFixed(9)+"#"+T.y.toFixed(9),p[L])continue;p[L]=!0;var A=g.t+Zi((T[b]-g[b])/(R[b]-g[b]))*(R.t-g.t),F=E.t+Zi((T[w]-E[w])/(x[w]-E[w]))*(x.t-E.t);A>=0&&A<=1&&F>=0&&F<=1&&f.push({x:T.x,y:T.y,t1:A,t2:F})}}return f}function Sh(e,t,n){e=Ah(e),t=Ah(t);for(var i,r,o,a,s,c,u,l,p,f,d=n?0:[],h=0,m=e.length;h<m;h++){var g=e[h];if(g[0]=="M")i=s=g[1],r=c=g[2];else{g[0]=="C"?(p=[i,r,...g.slice(1)],i=p[6],r=p[7]):(p=[i,r,i,r,s,c,s,c],i=s,r=c);for(var R=0,E=t.length;R<E;R++){var x=t[R];if(x[0]=="M")o=u=x[1],a=l=x[2];else{x[0]=="C"?(f=[o,a,...x.slice(1)],o=f[6],a=f[7]):(f=[o,a,o,a,u,l,u,l],o=u,a=l);var b=Kw(p,f);{for(var w=0,T=b.length;w<T;w++)b[w].segment1=h,b[w].segment2=R,b[w].bez1=p,b[w].bez2=f;d=d.concat(b)}}}}}return d}function Xw(e){return _h(e)&&_h(e[0])}function Zw(e){if(Gw(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,u,l=a,p=e.length;l<p;l++){if(u=e[l],s=u[0],t[l]=c=new Array(u.length),s!=s.toUpperCase())switch(c[0]=s.toUpperCase(),c[0]){case"A":c[1]=u[1],c[2]=u[2],c[3]=u[3],c[4]=u[4],c[5]=u[5],c[6]=+u[6]+n,c[7]=+u[7]+i;break;case"V":c[1]=+u[1]+i;break;case"H":c[1]=+u[1]+n;break;case"M":r=+u[1]+n,o=+u[2]+i;default:for(var f=1,d=u.length;f<d;f++)c[f]=+u[f]+(f%2?n:i)}else for(var h=0,m=u.length;h<m;h++)c[h]=u[h];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=ol,t}function Rh(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function bs(e,t,n,i){return[e,t,n,i,n,i]}function Ch(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 Ph(e,t,n,i,r,o,a,s,c,u){var l=Xi*120/180,p=Xi/180*(+r||0),f=[],d,h=zw(function(C,_,y){var k=C*Ct.cos(y)-_*Ct.sin(y),I=C*Ct.sin(y)+_*Ct.cos(y);return{x:k,y:I}});if(u)L=u[0],A=u[1],w=u[2],T=u[3];else{d=h(e,t,-p),e=d.x,t=d.y,d=h(s,c,-p),s=d.x,c=d.y;var m=(e-s)/2,g=(t-c)/2,R=m*m/(n*n)+g*g/(i*i);R>1&&(R=Ct.sqrt(R),n=R*n,i=R*i);var E=n*n,x=i*i,b=(o==a?-1:1)*Ct.sqrt(Zi((E*x-E*g*g-x*m*m)/(E*g*g+x*m*m))),w=b*n*g/i+(e+s)/2,T=b*-i*m/n+(t+c)/2,L=Ct.asin(((t-T)/i).toFixed(9)),A=Ct.asin(((c-T)/i).toFixed(9));L=e<w?Xi-L:L,A=s<w?Xi-A:A,L<0&&(L=Xi*2+L),A<0&&(A=Xi*2+A),a&&L>A&&(L=L-Xi*2),!a&&A>L&&(A=A-Xi*2)}var F=A-L;if(Zi(F)>l){var H=A,N=s,z=c;A=L+l*(a&&A>L?1:-1),s=w+n*Ct.cos(A),c=T+i*Ct.sin(A),f=Ph(s,c,n,i,r,0,a,N,z,[A,H,w,T])}F=A-L;var ue=Ct.cos(L),je=Ct.sin(L),tt=Ct.cos(A),X=Ct.sin(A),se=Ct.tan(F/4),fe=4/3*n*se,oe=4/3*i*se,de=[e,t],ee=[e+fe*je,t-oe*ue],$=[s+fe*X,c-oe*tt],B=[s,c];if(ee[0]=2*de[0]-ee[0],ee[1]=2*de[1]-ee[1],u)return[ee,$,B].concat(f);f=[ee,$,B].concat(f).join().split(",");for(var U=[],Ae=0,wt=f.length;Ae<wt;Ae++)U[Ae]=Ae%2?h(f[Ae-1],f[Ae],p).y:h(f[Ae],f[Ae+1],p).x;return U}function Qw(e,t,n,i,r,o,a,s){for(var c=[],u=[[],[]],l,p,f,d,h,m,g,R,E=0;E<2;++E){if(E==0?(p=6*e-12*n+6*r,l=-3*e+9*n-9*r+3*a,f=3*n-3*e):(p=6*t-12*i+6*o,l=-3*t+9*i-9*o+3*s,f=3*i-3*t),Zi(l)<1e-12){if(Zi(p)<1e-12)continue;d=-f/p,0<d&&d<1&&c.push(d);continue}g=p*p-4*f*l,R=Ct.sqrt(g),!(g<0)&&(h=(-p+R)/(2*l),0<h&&h<1&&c.push(h),m=(-p-R)/(2*l),0<m&&m<1&&c.push(m))}for(var x=c.length,b=x,w;x--;)d=c[x],w=1-d,u[0][x]=w*w*w*e+3*w*w*d*n+3*w*d*d*r+d*d*d*a,u[1][x]=w*w*w*t+3*w*w*d*i+3*w*d*d*o+d*d*d*s;return u[0][b]=e,u[1][b]=t,u[0][b+1]=a,u[1][b+1]=s,u[0].length=u[1].length=b+2,{x0:pi(...u[0]),y0:pi(...u[1]),x1:fi(...u[0]),y1:fi(...u[1])}}function Ah(e){if(Xw(e)||(e=Vw(e)),Ww(e))return e;for(var t=Uw(Zw(e)),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i=function(f,d,h){var m,g;if(!f)return["C",d.x,d.y,d.x,d.y,d.x,d.y];switch(!(f[0]in{T:1,Q:1})&&(d.qx=d.qy=null),f[0]){case"M":d.X=f[1],d.Y=f[2];break;case"A":f=["C",...Ph(d.x,d.y,...f.slice(1))];break;case"S":h=="C"||h=="S"?(m=d.x*2-d.bx,g=d.y*2-d.by):(m=d.x,g=d.y),f=["C",m,g,...f.slice(1)];break;case"T":h=="Q"||h=="T"?(d.qx=d.x*2-d.qx,d.qy=d.y*2-d.qy):(d.qx=d.x,d.qy=d.y),f=["C",...Ch(d.x,d.y,d.qx,d.qy,f[1],f[2])];break;case"Q":d.qx=f[1],d.qy=f[2],f=["C",...Ch(d.x,d.y,f[1],f[2],f[3],f[4])];break;case"L":f=["C",...bs(d.x,d.y,f[1],f[2])];break;case"H":f=["C",...bs(d.x,d.y,f[1],d.y)];break;case"V":f=["C",...bs(d.x,d.y,d.x,f[1])];break;case"Z":f=["C",...bs(d.x,d.y,d.X,d.Y)];break}return f},r=function(f,d){if(f[d].length>7){f[d].shift();for(var h=f[d];h.length;)o[d]="A",f.splice(d++,0,["C",...h.splice(0,6)]);f.splice(d,1),u=t.length}},o=[],a="",s="",c=0,u=t.length;c<u;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 l=t[c],p=l.length;n.x=l[p-2],n.y=l[p-1],n.bx=yh(l[p-4])||n.x,n.by=yh(l[p-3])||n.y}return t}function it(e){return Ht(e)&&_n(e,"waypoints")}function ke(e){return Ht(e)&&_n(e,"labelTarget")}function Jw(e){return Ht(e)&&Yr(e.parent)}function Th(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function Ci(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function me(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function xs(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function e1(e){return Ci({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function t1(e){for(var t=e.waypoints,n=t.reduce(function(u,l,p){var f=t[p-1];if(f){var d=u[u.length-1],h=d&&d.endLength||0,m=r1(f,l);u.push({start:f,end:l,startLength:h,endLength:h+m,length:m})}return u},[]),i=n.reduce(function(u,l){return u+l.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 ye(e){return it(e)?t1(e):e1(e)}function Xt(e,t,n){n=n||0,Ht(n)||(n={x:n,y:n});var i=me(e),r=me(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,u=o?"top":s?"bottom":null,l=c?"left":a?"right":null;return l&&u?u+"-"+l:l||u||"intersect"}function Zo(e,t,n){var i=n1(e,t);return i.length===1||i.length===2&&Xo(i[0],i[1])<1?Ci(i[0]):i.length>1?(i=ri(i,function(r){var o=Math.floor(r.t2*100)||1;return o=100-o,o=(o<10?"0":"")+o,r.segment2+"#"+o}),Ci(i[n?0:i.length-1])):null}function n1(e,t){return Sh(e,t)}function i1(e){e=e.slice();for(var t=0,n,i,r;e[t];)n=e[t],i=e[t-1],r=e[t+1],Xo(n,r)===0||nl(i,r,n)?e.splice(t,1):t++;return e}function r1(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Es(e,t){return Math.round(e*t)/t}function Mh(e){return xe(e)?e+"px":e}function o1(e){for(;e.parent;)e=e.parent;return e}function a1(e){e=D({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),fn(n,{position:"relative",overflow:"hidden",width:Mh(e.width),height:Mh(e.height)}),t.appendChild(n),n}function kh(e,t,n){const i=pe("g");$e(i).add(t);const r=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}const s1="base",Dh=0,c1=1,u1={shape:["x","y","width","height"],connection:["waypoints"]};function ve(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||{})}ve.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],ve.prototype._init=function(e){const t=this._eventBus,n=this._container=a1(e),i=this._svg=pe("svg");re(i,{width:"100%",height:"100%"}),on(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")}),Se(n,i);const r=this._viewport=kh(i,"viewport");e.deferUpdate&&(this._viewboxChanged=Eu(this._viewboxChanged,300)),this._restoreFocus=Eu(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)},ve.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},ve.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},ve.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=hh(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},ve.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},ve.prototype.restoreFocus=function(){this._restoreFocus()},ve.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},ve.prototype.isFocused=function(){return this._focused},ve.prototype.getDefaultLayer=function(){return this.getLayer(s1,Dh)},ve.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},ve.prototype._getChildIndex=function(e){return bn(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},ve.prototype._createLayer=function(e,t){typeof t>"u"&&(t=c1);const n=this._getChildIndex(t);return{group:kh(this._viewport,"layer-"+e,n),index:t,visible:!0}},ve.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},ve.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&&(It(n),t.visible=!1),n},ve.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],It(t.group))},ve.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},ve.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const r=this._findPlaneForRoot(o1(i));if(!r||n&&r.rootElement!==n)return;n=r.rootElement}return n},ve.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},ve.prototype._findPlaneForRoot=function(e){return at(this._planes,function(t){return t.rootElement===e})},ve.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},ve.prototype._resolveElements=function(e){return ge(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},ve.prototype.getContainer=function(){return this._container},ve.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&&(M([i.gfx,i.secondaryGfx],function(r){r&&(n?(e.markers.add(t),$e(r).add(t)):(e.markers.delete(t),$e(r).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},ve.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},ve.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},ve.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},ve.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},ve.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},ve.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,Dh);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},ve.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},ve.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},ve.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)},ve.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})},ve.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})},ve.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=u1[e];if(!Er(n,function(r){return typeof t[r]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},ve.prototype._setParent=function(e,t,n){Et(t.children,e,n),e.parent=t},ve.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},ve.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},ve.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},ve.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),_t(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},ve.prototype.removeShape=function(e){return this._removeElement(e,"shape")},ve.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},ve.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},ve.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},ve.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},ve.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,u;if(e)this._changeViewbox(function(){s=Math.min(n.width/e.width,n.height/e.height);const l=this._svg.createSVGMatrix().scale(s).translate(-e.x,-e.y);Uo(t,l)});else return o=this._rootElement?this.getActiveLayer():null,i=o&&o.getBBox()||{},a=Uo(t),r=a?a.matrix:hw(),s=Es(r.a,1e3),c=Es(-r.e||0,1e3),u=Es(-r.f||0,1e3),e=this._cachedViewbox={x:c?c/s:0,y:u?u/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},ve.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=D({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),Oh(t,n)}),{x:n.e,y:n.f}},ve.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(h=>h!=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=Rt(o),s=me(a),c=this.viewbox(),u=this.zoom();let l,p;c.y+=t.top/u,c.x+=t.left/u,c.width-=(t.right+t.left)/u,c.height-=(t.bottom+t.top)/u;const f=me(c);if(!(a.width<c.width&&a.height<c.height))l=a.x-c.x,p=a.y-c.y;else{const h=Math.max(0,s.right-f.right),m=Math.min(0,s.left-f.left),g=Math.max(0,s.bottom-f.bottom),R=Math.min(0,s.top-f.top);l=h||m,p=g||R}this.scroll({dx:-l*u,dy:-p*u})},ve.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)}),Es(i.a,1e3)};function Oh(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}ve.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},ve.prototype._setZoom=function(e,t){const n=this._svg,i=this._viewport,r=n.createSVGMatrix(),o=n.createSVGPoint();let a,s,c,u,l;c=i.getCTM();const p=c.a;return t?(a=D(o,t),s=a.matrixTransform(c.inverse()),u=r.translate(s.x,s.y).scale(1/p*e).translate(-s.x,-s.y),l=c.multiply(u)):l=r.scale(e),Oh(this._viewport,l),l},ve.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},ve.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}},ve.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var ro="data-element-id";function On(e){this._elements={},this._eventBus=e}On.$inject=["eventBus"],On.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),re(t,ro,i),n&&re(n,ro,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},On.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(re(i.gfx,ro,""),i.secondaryGfx&&re(i.secondaryGfx,ro,""),delete t[n])},On.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)},On.prototype.updateGraphics=function(e,t,n){var i=e.id||e,r=this._elements[i];return n?r.secondaryGfx=t:r.gfx=t,t&&re(t,ro,i),t},On.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&re(e,ro);var n=this._elements[t];return n&&n.element},On.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},On.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}},On.prototype.getAll=function(){return this.filter(function(e){return e})},On.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)})},On.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},On.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 l1(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 p1(e){return e.__refs_collection===!0}function f1(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function Lh(e,t,n){var i=l1(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 d1(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 jn(e,t){if(!(this instanceof jn))return new jn(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}jn.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?Lh(this,t,e):d1(this,t,e)},jn.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return p1(n)||Lh(this,t,e),n},jn.prototype.ensureBound=function(e,t){f1(e,t)||this.bind(e,t)},jn.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},jn.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var al=new jn({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Ih=new jn({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Nh=new jn({name:"attachers",collection:!0},{name:"host"}),Bh=new jn({name:"outgoing",collection:!0},{name:"source"}),$h=new jn({name:"incoming",collection:!0},{name:"target"});function oo(){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)}}),al.bind(this,"parent"),Ih.bind(this,"labels"),Bh.bind(this,"outgoing"),$h.bind(this,"incoming")}function Qo(){oo.call(this),al.bind(this,"children"),Nh.bind(this,"host"),Nh.bind(this,"attachers")}ie(Qo,oo);function jh(){oo.call(this),al.bind(this,"children")}ie(jh,Qo);function Fh(){Qo.call(this),Ih.bind(this,"labelTarget")}ie(Fh,Qo);function Hh(){oo.call(this),Bh.bind(this,"source"),$h.bind(this,"target")}ie(Hh,oo);var h1={connection:Hh,shape:Qo,label:Fh,root:jh};function m1(e,t){var n=h1[e];if(!n)throw new Error("unknown type: <"+e+">");return D(new n,t)}function g1(e){return e instanceof oo}function Pi(){this._uid=12}Pi.prototype.createRoot=function(e){return this.create("root",e)},Pi.prototype.createLabel=function(e){return this.create("label",e)},Pi.prototype.createShape=function(e){return this.create("shape",e)},Pi.prototype.createConnection=function(e){return this.create("connection",e)},Pi.prototype.create=function(e,t){return t=D({},t||{}),t.id||(t.id=e+"_"+this._uid++),m1(e,t)};var ws="__fn",zh=1e3,y1=Array.prototype.slice;function wn(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}wn.prototype.on=function(e,t,n,i){if(e=ge(e)?e:[e],zt(t)&&(i=n,n=t,t=zh),!xe(t))throw new Error("priority must be a number");var r=n;i&&(r=mn(n,i),r[ws]=n[ws]||n);var o=this;e.forEach(function(a){o._addListener(a,{priority:t,callback:r,next:null})})},wn.prototype.once=function(e,t,n,i){var r=this;if(zt(t)&&(i=n,n=t,t=zh),!xe(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[ws]=n,this.on(e,t,o)},wn.prototype.off=function(e,t){e=ge(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},wn.prototype.createEvent=function(e){var t=new Jo;return t.init(e),t},wn.prototype.fire=function(e,t){var n,i,r,o;if(o=y1.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 Jo?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}},wn.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},wn.prototype._destroy=function(){this._listeners={}},wn.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},wn.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=v1(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},wn.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},wn.prototype._getListeners=function(e){return this._listeners[e]},wn.prototype._setListeners=function(e,t){this._listeners[e]=t},wn.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[ws]===t)&&(r?r.next=i:this._setListeners(e,i)),r=n,n=i};function Jo(){}Jo.prototype.stopPropagation=function(){this.cancelBubble=!0},Jo.prototype.preventDefault=function(){this.defaultPrevented=!0},Jo.prototype.init=function(e){D(this,e||{})};function v1(e,t){return e.apply(null,t)}function kr(e){return e.childNodes[0]}function _1(e){return e.parentNode.childNodes[1]}function Ss(e,t,n,i,r){var o=Wo();o.setTranslate(t,n);var a=Wo();a.setRotate(i||0,0,0);var s=Wo();s.setScale(1,1),Uo(e,[o,a,s])}function Zt(e,t,n){var i=Wo();i.setTranslate(t,n),Uo(e,i)}function Vh(e,t){var n=Wo();n.setRotate(t,0,0),Uo(e,n)}function Ln(e,t){this._eventBus=e,this._elementRegistry=t}Ln.$inject=["eventBus","elementRegistry"],Ln.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=_1(t),n||(n=pe("g"),$e(n).add("djs-children"),Se(t.parentNode,n))):n=t,n},Ln.prototype._clear=function(e){var t=kr(e);return fs(t),t},Ln.prototype._createContainer=function(e,t,n,i){var r=pe("g");$e(r).add("djs-group"),typeof n<"u"?b1(r,t,t.childNodes[n]):Se(t,r);var o=pe("g");$e(o).add("djs-element"),$e(o).add("djs-"+e),i&&$e(o).add("djs-frame"),Se(r,o);var a=pe("g");return $e(a).add("djs-visual"),Se(o,a),o},Ln.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,mh(t))},Ln.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=bn(e,function(r,o){return o.parent&&(r[o.parent.id]=o.parent),r},{}),M(i,function(r){var o=r.children;if(o){var a=t._getChildrenContainer(r),s=a.firstChild;M(o,function(c){var u=n.getGraphics(c).parentNode;u===s?s=s.nextSibling:a.insertBefore(u,s)})}})},Ln.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},Ln.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},Ln.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},Ln.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},Ln.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),Zt(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?re(n,"display","none"):re(n,"display","block")}},Ln.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);It(t.parentNode)};function b1(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const x1={__depends__:[Lw],__init__:["canvas"],canvas:["type",ve],elementRegistry:["type",On],elementFactory:["type",Pi],eventBus:["type",wn],graphicsFactory:["type",Ln]};function E1(e){var t=new dh(e);return t.init(),t}function w1(e){e=e||{};var t={config:["value",e]},n=[t,x1].concat(e.modules||[]);return E1(n)}function Ji(e,t){this._injector=t||w1(e),this.get("eventBus").fire("diagram.init")}Ji.prototype.get=function(e,t){return this._injector.get(e,t)},Ji.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},Ji.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},Ji.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function an(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function gn(e,t){return e.$instanceOf(t)}function S1(e){return at(e.rootElements,function(t){return gn(t,"bpmn:Process")||gn(t,"bpmn:Collaboration")})}function R1(e){var t={},n=[],i={};function r($,B){return function(U){$(U,B)}}function o($){t[$.id]=$}function a($){return t[$.id]}function s($,B){var U=$.gfx;if(U)throw new Error(`already rendered ${an($)}`);return e.element($,i[$.id],B)}function c($,B){return e.root($,i[$.id],B)}function u($,B){try{var U=i[$.id]&&s($,B);return o($),U}catch(Ae){l(Ae.message,{element:$,error:Ae}),console.error(`failed to import ${an($)}`,Ae)}}function l($,B){e.error($,B)}var p=this.registerDi=function(B){var U=B.bpmnElement;U?i[U.id]?l(`multiple DI elements defined for ${an(U)}`,{element:U}):i[U.id]=B:l(`no bpmnElement referenced in ${an(B)}`,{element:B})};function f($){d($.plane)}function d($){p($),M($.planeElement,h)}function h($){p($)}this.handleDefinitions=function(B,U){var Ae=B.diagrams;if(U&&Ae.indexOf(U)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!U&&Ae&&Ae.length&&(U=Ae[0]),!U)throw new Error("no diagram to display");i={},f(U);var wt=U.plane;if(!wt)throw new Error(`no plane for ${an(U)}`);var C=wt.bpmnElement;if(!C)if(C=S1(B),C)l(`correcting missing bpmnElement on ${an(wt)} to ${an(C)}`),wt.bpmnElement=C,p(wt);else throw new Error("no process or collaboration to display");var _=c(C,wt);if(gn(C,"bpmn:Process")||gn(C,"bpmn:SubProcess"))g(C,_);else if(gn(C,"bpmn:Collaboration"))de(C,_),R(B.rootElements,_);else throw new Error(`unsupported bpmnElement for ${an(wt)}: ${an(C)}`);m(n)};var m=this.handleDeferred=function(){for(var B;n.length;)B=n.shift(),B()};function g($,B){se($,B),F($.ioSpecification,B),A($.artifacts,B),o($)}function R($,B){var U=Oe($,function(Ae){return!a(Ae)&&gn(Ae,"bpmn:Process")&&Ae.laneSets});U.forEach(r(g,B))}function E($,B){u($,B)}function x($,B){M($,r(E,B))}function b($,B){u($,B)}function w($,B){u($,B)}function T($,B){u($,B)}function L($,B){u($,B)}function A($,B){M($,function(U){gn(U,"bpmn:Association")?n.push(function(){L(U,B)}):L(U,B)})}function F($,B){$&&(M($.dataInputs,r(w,B)),M($.dataOutputs,r(T,B)))}var H=this.handleSubProcess=function(B,U){se(B,U),A(B.artifacts,U)};function N($,B){var U=u($,B);gn($,"bpmn:SubProcess")&&H($,U||B),gn($,"bpmn:Activity")&&F($.ioSpecification,B),n.push(function(){M($.dataInputAssociations,r(b,B)),M($.dataOutputAssociations,r(b,B))})}function z($,B){u($,B)}function ue($,B){u($,B)}function je($,B){n.push(function(){var U=u($,B);$.childLaneSet&&tt($.childLaneSet,U||B),ee($)})}function tt($,B){M($.lanes,r(je,B))}function X($,B){M($,r(tt,B))}function se($,B){fe($.flowElements,B),$.laneSets&&X($.laneSets,B)}function fe($,B){M($,function(U){gn(U,"bpmn:SequenceFlow")?n.push(function(){z(U,B)}):gn(U,"bpmn:BoundaryEvent")?n.unshift(function(){N(U,B)}):gn(U,"bpmn:FlowNode")?N(U,B):gn(U,"bpmn:DataObject")||(gn(U,"bpmn:DataStoreReference")||gn(U,"bpmn:DataObjectReference")?ue(U,B):l(`unrecognized flowElement ${an(U)} in context ${an(B&&B.businessObject)}`,{element:U,context:B}))})}function oe($,B){var U=u($,B),Ae=$.processRef;Ae&&g(Ae,U||B)}function de($,B){M($.participants,r(oe,B)),n.push(function(){x($.messageFlows,B)}),A($.artifacts,B)}function ee($){M($.flowNodeRef,function(B){var U=B.get("lanes");U&&U.push($)})}}function v(e,t){var n=K(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function De(e,t){return Fi(t,function(n){return v(e,n)})}function K(e){return e&&e.businessObject||e}function Ve(e){return e&&e.di}function C1(e,t,n){var i,r,o,a,s=[];function c(u,l){var p={root:function(m,g){return i.add(m,g)},element:function(m,g,R){return i.add(m,g,R)},error:function(m,g){s.push({message:m,context:g})}},f=new R1(p);l=l||u.diagrams&&u.diagrams[0];var d=P1(u,l);if(!d)throw new Error("no diagram to display");M(d,function(m){f.handleDefinitions(u,m)});var h=l.plane.bpmnElement.id;o.setRootElement(o.findRoot(h+"_plane")||o.findRoot(h))}return new Promise(function(u,l){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}),u({warnings:s})}catch(p){return p.warnings=s,l(p)}})}function P1(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!v(n,"bpmn:Process")&&!v(n,"bpmn:Collaboration")&&(i=A1(n));var r;v(i,"bpmn:Collaboration")?r=i:r=at(e.rootElements,function(u){if(v(u,"bpmn:Collaboration"))return at(u.participants,function(l){return l.processRef===i})});var o=[i];r&&(o=nn(r.participants,function(u){return u.processRef}),o.push(r));var a=Gh(o),s=[t],c=[n];return M(e.diagrams,function(u){if(u.plane){var l=u.plane.bpmnElement;a.indexOf(l)!==-1&&c.indexOf(l)===-1&&(s.push(u),c.push(l))}}),s}}function Gh(e){var t=[];return M(e,function(n){n&&(t.push(n),t=t.concat(Gh(n.flowElements)))}),t}function A1(e){for(var t=e;t;){if(v(t,"bpmn:Process"))return t;t=t.$parent}}var T1='<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>',Wh=T1,Uh={verticalAlign:"middle"},qh={color:"#404040"},M1={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},k1={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},D1={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"},O1='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+Wh+'</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>',di;function L1(){di=ut(O1),fn(di,M1),fn(et("svg",di),Uh),fn(et(".backdrop",di),k1),fn(et(".notice",di),D1),fn(et(".link",di),qh,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function I1(){di||(L1(),En.bind(di,".backdrop","click",function(e){document.body.removeChild(di)})),document.body.appendChild(di)}const Rs=5,Yh="djs-outline-hidden";function ht(e){e=D({},B1,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),j1(this._container)}ie(ht,Ji),ht.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(f){throw this._emit("import.parse.complete",{error:f}),f}let s=a.rootElement;const c=a.references,u=a.warnings,l=a.elementsById;o=o.concat(u),s=this._emit("import.parse.complete",r({error:null,definitions:s,elementsById:l,references:c,warnings:o}))||s;const p=await this.importDefinitions(s,n);return o=o.concat(p.warnings),this._emit("import.done",{error:null,warnings:o}),{warnings:o}}catch(a){let s=a;throw o=o.concat(s.warnings||[]),Cs(s,o),s=N1(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},ht.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},ht.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const o=new Error("no XML imported");throw Cs(o,[]),o}if(typeof t=="string"&&(i=$1(n,t),!i)){const o=new Error("BPMNDiagram <"+t+"> not found");throw Cs(o,[]),o}try{this.clear()}catch(o){throw Cs(o,[]),o}const{warnings:r}=await C1(this,n,i);return{warnings:r}},ht.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},ht.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),r=i.getActiveLayer(),o=et(":scope > defs",i._svg),a=fh(r),s=o?"<defs>"+fh(o)+"</defs>":"",c=i.getContainer();ft(c).add(Yh);let u;try{u=r.getBBox()}finally{ft(c).remove(Yh)}const l=u.x-Rs,p=u.y-Rs,f=u.width+Rs*2,d=u.height+Rs*2;t=`<?xml version="1.0" encoding="utf-8"?>
|
|
7
8
|
<!-- created with bpmn-js / http://bpmn.io -->
|
|
8
9
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
|
9
|
-
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="`+f+'" height="'+d+'" viewBox="'+p+" "+l+" "+f+" "+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}},$e.prototype._setDefinitions=function(e){this._definitions=e},$e.prototype.getModules=function(){return this._modules},$e.prototype.clear=function(){this.getDefinitions()&&ii.prototype.clear.call(this)},$e.prototype.destroy=function(){ii.prototype.destroy.call(this),mn(this._container)},$e.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},$e.prototype.off=function(e,t){this.get("eventBus").off(e,t)},$e.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=Ae(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},$e.prototype.getDefinitions=function(){return this._definitions},$e.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},$e.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=D(pn(n,["additionalModules"]),{canvas:D({},n.canvas,{container:e}),modules:a});ii.call(this,s),n&&n.container&&this.attachTo(n.container)},$e.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},$e.prototype._createContainer=function(e){const t=Ie('<div class="bjs-container"></div>');return wt(t,{width:qf(e.width),height:qf(e.height),position:e.position}),t},$e.prototype._createModdle=function(e){const t=D({},this._moddleExtensions,e.moddleExtensions);return new zp(t)},$e.prototype._modules=[];function ua(e,t){return e.warnings=t,e}function KE(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 XE={width:"100%",height:"100%",position:"relative"};function qf(e){return e+(ue(e)?"px":"")}function ZE(e,t){return t&&Oe(e.diagrams,function(n){return n.id===t})||null}function QE(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+Vf+"</a>",i=Ie(n);wt(Ae("svg",i),Gf),wt(i,Wf,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),le.bind(i,"click",function(r){YE(),r.preventDefault()})}function ir(e){$e.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)}X(ir,$e),ir.prototype._createModdle=function(e){var t=$e.prototype._createModdle.call(this,e);return t.ids=new hn([32,36,1]),t},ir.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 Ee(e,t){return y(e,"bpmn:CallActivity")?!1:y(e,"bpmn:SubProcess")?(t=t||we(e),t&&y(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):y(e,"bpmn:Participant")?!!G(e).processRef:!0}function at(e){if(!(!y(e,"bpmn:Participant")&&!y(e,"bpmn:Lane"))){var t=we(e).isHorizontal;return t===void 0?!0:t}}function JE(e){return e&&G(e).isInterrupting!==!1}function Et(e){return e&&!!G(e).triggeredByEvent}function rr(e,t){var n=G(e).eventDefinitions;return qn(n,function(i){return y(i,t)})}function ex(e){return rr(e,"bpmn:ErrorEventDefinition")}function tx(e){return rr(e,"bpmn:EscalationEventDefinition")}function nx(e){return rr(e,"bpmn:CompensateEventDefinition")}var Ii={width:90,height:20},Yf=15;function ri(e){return y(e,"bpmn:Event")||y(e,"bpmn:Gateway")||y(e,"bpmn:DataStoreReference")||y(e,"bpmn:DataObjectReference")||y(e,"bpmn:DataInput")||y(e,"bpmn:DataOutput")||y(e,"bpmn:SequenceFlow")||y(e,"bpmn:MessageFlow")||y(e,"bpmn:Group")}function la(e){return he(e.label)}function ix(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=rx(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-=Yf:a+=Yf,{x:a,y:s}}function rx(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 Bc(e){return e.waypoints?ix(e.waypoints):y(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+Ii.height/2}:{x:e.x+e.width/2,y:e.y+e.height+Ii.height/2}}function ox(e,t){var n,i,r,o=e.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(Ii.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=Bc(t),i=Ii),D({x:n.x-i.width/2,y:n.y-i.height/2},i)}function Kf(e){if(y(e,"bpmn:FlowElement")||y(e,"bpmn:Participant")||y(e,"bpmn:Lane")||y(e,"bpmn:SequenceFlow")||y(e,"bpmn:MessageFlow")||y(e,"bpmn:DataInput")||y(e,"bpmn:DataOutput"))return"name";if(y(e,"bpmn:TextAnnotation"))return"text";if(y(e,"bpmn:Group"))return"categoryValueRef"}function ax(e){var t=e.categoryValueRef;return t&&t.value||""}function Vt(e){var t=e.businessObject,n=Kf(t);if(n)return n==="categoryValueRef"?ax(t):t[n]||""}function sx(e,t){var n=e.businessObject,i=Kf(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function cx(e){return he(e)&&ri(e.labelTarget)}var or=7;function Xf(e){let t=[];return A(e.incoming,n=>{y(n,"bpmn:Association")&&y(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),A(e.outgoing,n=>{y(n,"bpmn:Association")&&y(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function Ur(e){const t=new Map;return A(Tc(e),n=>{A(Xf(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 Nc="hsl(225, 10%, 15%)",ux="white";function _n(e,t){return qn(e.eventDefinitions,function(n){return n.$type===t})}function lx(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function px(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function be(e,t,n){var i=we(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||ux}function K(e,t,n){var i=we(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||Nc}function qr(e,t,n,i){var r=we(e),o=r.get("label");return i||o&&o.get("color:color")||t||K(e,n)}function Zf(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 ki(r)}function $c(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 ki(a)}function fx(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 ki(s)}function dx(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 ki(o)}function Yr(e,t={}){return{width:qt(e,t),height:It(e,t)}}function qt(e,t={}){return Mt(t,"width")?t.width:e.width}function It(e,t={}){return Mt(t,"height")?t.height:e.height}var hx=new hn,mx=10,pa=3,gx=1.5,fa=10,vx=4,ar=.95,yx=1,_x=.25;function Li(e,t,n,i,r,o,a){kn.call(this,t,a);var s=e&&e.defaultFillColor,c=e&&e.defaultStrokeColor,u=e&&e.defaultLabelColor;function p(x){return n.computeStyle(x,{strokeLinecap:"round",strokeLinejoin:"round",stroke:Nc,strokeWidth:2,fill:"white"})}function l(x){return n.computeStyle(x,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:Nc,strokeWidth:2})}function f(x,g){var{ref:m={x:0,y:0},scale:P=1,element:k,parentGfx:j=r._svg}=g,q=te("marker",{id:x,viewBox:"0 0 20 20",refX:m.x,refY:m.y,markerWidth:20*P,markerHeight:20*P,orient:"auto"});pe(q,k);var J=Ae(":scope > defs",j);J||(J=te("defs"),pe(j,J)),pe(J,q)}function d(x,g,m,P){var k=hx.nextPrefixed("marker-");return h(x,k,g,m,P),"url(#"+k+")"}function h(x,g,m,P,k){if(m==="sequenceflow-end"){var j=te("path",{d:"M 1 5 L 11 10 L 1 15 Z",...p({fill:k,stroke:k,strokeWidth:1})});f(g,{element:j,ref:{x:11,y:10},scale:.5,parentGfx:x})}if(m==="messageflow-start"){var q=te("circle",{cx:6,cy:6,r:3.5,...p({fill:P,stroke:k,strokeWidth:1,strokeDasharray:[1e4,1]})});f(g,{element:q,ref:{x:6,y:6},parentGfx:x})}if(m==="messageflow-end"){var J=te("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...p({fill:P,stroke:k,strokeWidth:1,strokeDasharray:[1e4,1]})});f(g,{element:J,ref:{x:8.5,y:5},parentGfx:x})}if(m==="association-start"){var ve=te("path",{d:"M 11 5 L 1 10 L 11 15",...l({fill:"none",stroke:k,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(g,{element:ve,ref:{x:1,y:10},scale:.5,parentGfx:x})}if(m==="association-end"){var de=te("path",{d:"M 1 5 L 11 10 L 1 15",...l({fill:"none",stroke:k,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(g,{element:de,ref:{x:11,y:10},scale:.5,parentGfx:x})}if(m==="conditional-flow-marker"){var _e=te("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...p({fill:P,stroke:k})});f(g,{element:_e,ref:{x:-1,y:10},scale:.5,parentGfx:x})}if(m==="conditional-default-flow-marker"){var Ve=te("path",{d:"M 6 4 L 10 16",...p({stroke:k,fill:"none"})});f(g,{element:Ve,ref:{x:0,y:10},scale:.5,parentGfx:x})}}function v(x,g,m,P,k={}){rt(P)&&(k=P,P=0),P=P||0,k=p(k);var j=g/2,q=m/2,J=te("circle",{cx:j,cy:q,r:Math.round((g+m)/4-P),...k});return pe(x,J),J}function _(x,g,m,P,k,j){rt(k)&&(j=k,k=0),k=k||0,j=p(j);var q=te("rect",{x:k,y:k,width:g-k*2,height:m-k*2,rx:P,ry:P,...j});return pe(x,q),q}function S(x,g,m,P){var k=g/2,j=m/2,q=[{x:k,y:0},{x:g,y:j},{x:k,y:m},{x:0,y:j}],J=q.map(function(de){return de.x+","+de.y}).join(" ");P=p(P);var ve=te("polygon",{...P,points:J});return pe(x,ve),ve}function w(x,g,m,P){m=l(m);var k=jr(g,m,P);return pe(x,k),k}function E(x,g,m){return w(x,g,m,5)}function b(x,g,m){m=l(m);var P=te("path",{...m,d:g});return pe(x,P),P}function R(x,g,m,P){return b(g,m,D({"data-marker":x},P))}function T(x){return $[x]}function O(x){return function(g,m,P){return T(x)(g,m,P)}}var C={"bpmn:MessageEventDefinition":function(x,g,m={},P){var k=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:m.width||g.width,containerHeight:m.height||g.height,position:{mx:.235,my:.315}}),j=P?K(g,c,m.stroke):be(g,s,m.fill),q=P?be(g,s,m.fill):K(g,c,m.stroke),J=b(x,k,{fill:j,stroke:q,strokeWidth:1});return J},"bpmn:TimerEventDefinition":function(x,g,m={}){var P=m.width||g.width,k=m.height||g.height,j=m.width?1:2,q=v(x,P,k,.2*k,{fill:be(g,s,m.fill),stroke:K(g,c,m.stroke),strokeWidth:j}),J=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:P,containerHeight:k,position:{mx:.5,my:.5}});b(x,J,{stroke:K(g,c,m.stroke),strokeWidth:j});for(var ve=0;ve<12;ve++){var de=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:P,containerHeight:k,position:{mx:.5,my:.5}}),_e=P/2,Ve=k/2;b(x,de,{strokeWidth:1,stroke:K(g,c,m.stroke),transform:"rotate("+ve*30+","+Ve+","+_e+")"})}return q},"bpmn:EscalationEventDefinition":function(x,g,m={},P){var k=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:m.width||g.width,containerHeight:m.height||g.height,position:{mx:.5,my:.2}}),j=P?K(g,c,m.stroke):be(g,s,m.fill);return b(x,k,{fill:j,stroke:K(g,c,m.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(x,g,m={}){var P=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:m.width||g.width,containerHeight:m.height||g.height,position:{mx:.5,my:.222}});return b(x,P,{fill:be(g,s,m.fill),stroke:K(g,c,m.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(x,g,m={},P){var k=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:g.width,containerHeight:g.height,position:{mx:.57,my:.263}}),j=P?K(g,c,m.stroke):be(g,s,m.fill);return b(x,k,{fill:j,stroke:K(g,c,m.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(x,g,m={},P){var k=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:m.width||g.width,containerHeight:m.height||g.height,position:{mx:.2,my:.722}}),j=P?K(g,c,m.stroke):be(g,s,m.fill);return b(x,k,{fill:j,stroke:K(g,c,m.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(x,g,m={},P){var k=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:g.width,containerHeight:g.height,position:{mx:.638,my:-.055}}),j=P?K(g,c,m.stroke):"none",q=b(x,k,{fill:j,stroke:K(g,c,m.stroke),strokeWidth:1});return Hf(q,45),q},"bpmn:CompensateEventDefinition":function(x,g,m={},P){var k=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:m.width||g.width,containerHeight:m.height||g.height,position:{mx:.22,my:.5}}),j=P?K(g,c,m.stroke):be(g,s,m.fill);return b(x,k,{fill:j,stroke:K(g,c,m.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(x,g,m={},P){var k=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:m.width||g.width,containerHeight:m.height||g.height,position:{mx:.5,my:.2}}),j=P?K(g,c,m.stroke):be(g,s,m.fill);return b(x,k,{strokeWidth:1,fill:j,stroke:K(g,c,m.stroke)})},"bpmn:MultipleEventDefinition":function(x,g,m={},P){var k=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:m.width||g.width,containerHeight:m.height||g.height,position:{mx:.211,my:.36}}),j=P?K(g,c,m.stroke):be(g,s,m.fill);return b(x,k,{fill:j,stroke:K(g,c,m.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(x,g,m={}){var P=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:m.width||g.width,containerHeight:m.height||g.height,position:{mx:.458,my:.194}});return b(x,P,{fill:be(g,s,m.fill),stroke:K(g,c,m.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(x,g,m={}){var P=v(x,g.width,g.height,8,{fill:K(g,c,m.stroke),stroke:K(g,c,m.stroke),strokeWidth:4});return P}};function F(x,g,m={},P){var k=G(x),j=lx(k),q=P||x;return k.get("eventDefinitions")&&k.get("eventDefinitions").length>1?k.get("parallelMultiple")?C["bpmn:ParallelMultipleEventDefinition"](g,q,m,j):C["bpmn:MultipleEventDefinition"](g,q,m,j):_n(k,"bpmn:MessageEventDefinition")?C["bpmn:MessageEventDefinition"](g,q,m,j):_n(k,"bpmn:TimerEventDefinition")?C["bpmn:TimerEventDefinition"](g,q,m,j):_n(k,"bpmn:ConditionalEventDefinition")?C["bpmn:ConditionalEventDefinition"](g,q,m,j):_n(k,"bpmn:SignalEventDefinition")?C["bpmn:SignalEventDefinition"](g,q,m,j):_n(k,"bpmn:EscalationEventDefinition")?C["bpmn:EscalationEventDefinition"](g,q,m,j):_n(k,"bpmn:LinkEventDefinition")?C["bpmn:LinkEventDefinition"](g,q,m,j):_n(k,"bpmn:ErrorEventDefinition")?C["bpmn:ErrorEventDefinition"](g,q,m,j):_n(k,"bpmn:CancelEventDefinition")?C["bpmn:CancelEventDefinition"](g,q,m,j):_n(k,"bpmn:CompensateEventDefinition")?C["bpmn:CompensateEventDefinition"](g,q,m,j):_n(k,"bpmn:TerminateEventDefinition")?C["bpmn:TerminateEventDefinition"](g,q,m,j):null}var N={ParticipantMultiplicityMarker:function(x,g,m={}){var P=qt(g,m),k=It(g,m),j=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:P,containerHeight:k,position:{mx:(P/2-6)/P,my:(k-15)/k}});R("participant-multiplicity",x,j,{strokeWidth:2,fill:be(g,s,m.fill),stroke:K(g,c,m.stroke)})},SubProcessMarker:function(x,g,m={}){var P=_(x,14,14,0,{strokeWidth:1,fill:be(g,s,m.fill),stroke:K(g,c,m.stroke)});lt(P,g.width/2-7.5,g.height-20);var k=i.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:g.width,containerHeight:g.height,position:{mx:(g.width/2-7.5)/g.width,my:(g.height-20)/g.height}});R("sub-process",x,k,{fill:be(g,s,m.fill),stroke:K(g,c,m.stroke)})},ParallelMarker:function(x,g,m){var P=qt(g,m),k=It(g,m),j=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:P,containerHeight:k,position:{mx:(P/2+m.parallel)/P,my:(k-20)/k}});R("parallel",x,j,{fill:be(g,s,m.fill),stroke:K(g,c,m.stroke)})},SequentialMarker:function(x,g,m){var P=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:g.width,containerHeight:g.height,position:{mx:(g.width/2+m.seq)/g.width,my:(g.height-19)/g.height}});R("sequential",x,P,{fill:be(g,s,m.fill),stroke:K(g,c,m.stroke)})},CompensationMarker:function(x,g,m){var P=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:g.width,containerHeight:g.height,position:{mx:(g.width/2+m.compensation)/g.width,my:(g.height-13)/g.height}});R("compensation",x,P,{strokeWidth:1,fill:be(g,s,m.fill),stroke:K(g,c,m.stroke)})},LoopMarker:function(x,g,m){var P=qt(g,m),k=It(g,m),j=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:P,containerHeight:k,position:{mx:(P/2+m.loop)/P,my:(k-7)/k}});R("loop",x,j,{strokeWidth:1.5,fill:"none",stroke:K(g,c,m.stroke),strokeMiterlimit:.5})},AdhocMarker:function(x,g,m){var P=qt(g,m),k=It(g,m),j=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:P,containerHeight:k,position:{mx:(P/2+m.adhoc)/P,my:(k-15)/k}});R("adhoc",x,j,{strokeWidth:1,fill:K(g,c,m.stroke),stroke:K(g,c,m.stroke)})}};function I(x,g,m,P){N[x](g,m,P)}function W(x,g,m=[],P={}){P={fill:P.fill,stroke:P.stroke,width:qt(g,P),height:It(g,P)};var k=G(g),j=m.includes("SubProcessMarker");j?P={...P,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:P={...P,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},k.get("isForCompensation")&&m.push("CompensationMarker"),y(k,"bpmn:AdHocSubProcess")&&(m.push("AdhocMarker"),j||D(P,{compensation:P.compensation-18}));var q=k.get("loopCharacteristics"),J=q&&q.get("isSequential");q&&(D(P,{compensation:P.compensation-18}),m.includes("AdhocMarker")&&D(P,{seq:-23,loop:-18,parallel:-24}),J===void 0&&m.push("LoopMarker"),J===!1&&m.push("ParallelMarker"),J===!0&&m.push("SequentialMarker")),m.includes("CompensationMarker")&&m.length===1&&D(P,{compensation:-8}),A(m,function(ve){I(ve,x,g,P)})}function re(x,g,m={}){m=D({size:{width:100}},m);var P=o.createText(g||"",m);return xe(P).add("djs-label"),pe(x,P),P}function Pe(x,g,m,P={}){var k=G(g),j=Yr({x:g.x,y:g.y,width:g.width,height:g.height},P);return re(x,k.name,{align:m,box:j,padding:7,style:{fill:qr(g,u,c,P.stroke)}})}function Qe(x,g,m={}){var P={width:g.width,height:g.height,x:g.width/2+g.x,y:g.height/2+g.y};return re(x,Vt(g),{box:P,style:D({},o.getExternalStyle(),{fill:qr(g,u,c,m.stroke)})})}function U(x,g,m,P={}){var k=at(m),j=re(x,g,{box:{height:30,width:k?It(m,P):qt(m,P)},align:"center-middle",style:{fill:qr(m,u,c,P.stroke)}});if(k){var q=-1*It(m,P);sa(j,0,-q,270)}}function ee(x,g,m={}){var{width:P,height:k}=Yr(g,m);return _(x,P,k,fa,{...m,fill:be(g,s,m.fill),fillOpacity:ar,stroke:K(g,c,m.stroke)})}function oe(x,g,m={}){var P=G(g),k=be(g,s,m.fill),j=K(g,c,m.stroke);return(P.get("associationDirection")==="One"||P.get("associationDirection")==="Both")&&(m.markerEnd=d(x,"association-end",k,j)),P.get("associationDirection")==="Both"&&(m.markerStart=d(x,"association-start",k,j)),m=Se(m,["markerStart","markerEnd"]),E(x,g.waypoints,{...m,stroke:j,strokeDasharray:"0, 5"})}function Q(x,g,m={}){var P=be(g,s,m.fill),k=K(g,c,m.stroke),j=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:g.width,containerHeight:g.height,position:{mx:.474,my:.296}}),q=b(x,j,{fill:P,fillOpacity:ar,stroke:k}),J=G(g);if(px(J)){var ve=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:g.width,containerHeight:g.height,position:{mx:.33,my:(g.height-18)/g.height}});b(x,ve,{strokeWidth:2,fill:P,stroke:k})}return q}function ne(x,g,m={}){return v(x,g.width,g.height,{fillOpacity:ar,...m,fill:be(g,s,m.fill),stroke:K(g,c,m.stroke)})}function Y(x,g,m={}){return S(x,g.width,g.height,{fill:be(g,s,m.fill),fillOpacity:ar,stroke:K(g,c,m.stroke)})}function B(x,g,m={}){var P=_(x,qt(g,m),It(g,m),0,{fill:be(g,s,m.fill),fillOpacity:m.fillOpacity||ar,stroke:K(g,c,m.stroke),strokeWidth:1.5}),k=G(g);if(y(k,"bpmn:Lane")){var j=k.get("name");U(x,j,g,m)}return P}function L(x,g,m={}){var P=ee(x,g,m),k=Ee(g);if(Et(g)&&(Z(P,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!k)){var j=G(g).flowElements||[],q=j.filter(J=>y(J,"bpmn:StartEvent"));q.length===1&&H(q[0],x,m,g)}return Pe(x,g,k?"center-top":"center-middle",m),k?W(x,g,void 0,m):W(x,g,["SubProcessMarker"],m),P}function H(x,g,m,P){var k=22,j={fill:be(P,s,m.fill),stroke:K(P,c,m.stroke),width:k,height:k},q=G(x).isInterrupting,J=q?0:3,ve=q?1:1.2,de=20,_e=(k-de)/2,Ve="translate("+_e+","+_e+")";v(g,de,de,{fill:j.fill,stroke:j.stroke,strokeWidth:ve,strokeDasharray:J,transform:Ve}),F(x,g,j,P)}function M(x,g,m={}){var P=ee(x,g,m);return Pe(x,g,"center-middle",m),W(x,g,void 0,m),P}var $=this.handlers={"bpmn:AdHocSubProcess":function(x,g,m={}){return Ee(g)?m=Se(m,["fill","stroke","width","height"]):m=Se(m,["fill","stroke"]),L(x,g,m)},"bpmn:Association":function(x,g,m={}){return m=Se(m,["fill","stroke"]),oe(x,g,m)},"bpmn:BoundaryEvent":function(x,g,m={}){var{renderIcon:P=!0}=m;m=Se(m,["fill","stroke"]);var k=G(g),j=k.get("cancelActivity");m={strokeWidth:1.5,fill:be(g,s,m.fill),fillOpacity:yx,stroke:K(g,c,m.stroke)},j||(m.strokeDasharray="6");var q=ne(x,g,m);return v(x,g.width,g.height,pa,{...m,fill:"none"}),P&&F(g,x,m),q},"bpmn:BusinessRuleTask":function(x,g,m={}){m=Se(m,["fill","stroke"]);var P=M(x,g,m),k=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),j=b(x,k);Z(j,{fill:be(g,s,m.fill),stroke:K(g,c,m.stroke),strokeWidth:1});var q=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),J=b(x,q);return Z(J,{fill:K(g,c,m.stroke),stroke:K(g,c,m.stroke),strokeWidth:1}),P},"bpmn:CallActivity":function(x,g,m={}){return m=Se(m,["fill","stroke"]),L(x,g,{strokeWidth:5,...m})},"bpmn:ComplexGateway":function(x,g,m={}){m=Se(m,["fill","stroke"]);var P=Y(x,g,m),k=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:g.width,containerHeight:g.height,position:{mx:.46,my:.26}});return b(x,k,{fill:K(g,c,m.stroke),stroke:K(g,c,m.stroke),strokeWidth:1}),P},"bpmn:DataInput":function(x,g,m={}){m=Se(m,["fill","stroke"]);var P=i.getRawPath("DATA_ARROW"),k=Q(x,g,m);return b(x,P,{fill:"none",stroke:K(g,c,m.stroke),strokeWidth:1}),k},"bpmn:DataInputAssociation":function(x,g,m={}){return m=Se(m,["fill","stroke"]),oe(x,g,{...m,markerEnd:d(x,"association-end",be(g,s,m.fill),K(g,c,m.stroke))})},"bpmn:DataObject":function(x,g,m={}){return m=Se(m,["fill","stroke"]),Q(x,g,m)},"bpmn:DataObjectReference":O("bpmn:DataObject"),"bpmn:DataOutput":function(x,g,m={}){m=Se(m,["fill","stroke"]);var P=i.getRawPath("DATA_ARROW"),k=Q(x,g,m);return b(x,P,{strokeWidth:1,fill:K(g,c,m.stroke),stroke:K(g,c,m.stroke)}),k},"bpmn:DataOutputAssociation":function(x,g,m={}){return m=Se(m,["fill","stroke"]),oe(x,g,{...m,markerEnd:d(x,"association-end",be(g,s,m.fill),K(g,c,m.stroke))})},"bpmn:DataStoreReference":function(x,g,m={}){m=Se(m,["fill","stroke"]);var P=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:g.width,containerHeight:g.height,position:{mx:0,my:.133}});return b(x,P,{fill:be(g,s,m.fill),fillOpacity:ar,stroke:K(g,c,m.stroke),strokeWidth:2})},"bpmn:EndEvent":function(x,g,m={}){var{renderIcon:P=!0}=m;m=Se(m,["fill","stroke"]);var k=ne(x,g,{...m,strokeWidth:4});return P&&F(g,x,m),k},"bpmn:EventBasedGateway":function(x,g,m={}){m=Se(m,["fill","stroke"]);var P=G(g),k=Y(x,g,m);v(x,g.width,g.height,g.height*.2,{fill:be(g,"none",m.fill),stroke:K(g,c,m.stroke),strokeWidth:1});var j=P.get("eventGatewayType"),q=!!P.get("instantiate");function J(){var de=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:g.width,containerHeight:g.height,position:{mx:.36,my:.44}});b(x,de,{fill:"none",stroke:K(g,c,m.stroke),strokeWidth:2})}if(j==="Parallel"){var ve=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:g.width,containerHeight:g.height,position:{mx:.474,my:.296}});b(x,ve,{fill:"none",stroke:K(g,c,m.stroke),strokeWidth:1})}else j==="Exclusive"&&(q||v(x,g.width,g.height,g.height*.26,{fill:"none",stroke:K(g,c,m.stroke),strokeWidth:1}),J());return k},"bpmn:ExclusiveGateway":function(x,g,m={}){m=Se(m,["fill","stroke"]);var P=Y(x,g,m),k=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:g.width,containerHeight:g.height,position:{mx:.32,my:.3}}),j=we(g);return j.get("isMarkerVisible")&&b(x,k,{fill:K(g,c,m.stroke),stroke:K(g,c,m.stroke),strokeWidth:1}),P},"bpmn:Gateway":function(x,g,m={}){return m=Se(m,["fill","stroke"]),Y(x,g,m)},"bpmn:Group":function(x,g,m={}){return m=Se(m,["fill","stroke","width","height"]),_(x,g.width,g.height,fa,{stroke:K(g,c,m.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:qt(g,m),height:It(g,m)})},"bpmn:InclusiveGateway":function(x,g,m={}){m=Se(m,["fill","stroke"]);var P=Y(x,g,m);return v(x,g.width,g.height,g.height*.24,{fill:be(g,s,m.fill),stroke:K(g,c,m.stroke),strokeWidth:2.5}),P},"bpmn:IntermediateEvent":function(x,g,m={}){var{renderIcon:P=!0}=m;m=Se(m,["fill","stroke"]);var k=ne(x,g,{...m,strokeWidth:1.5});return v(x,g.width,g.height,pa,{fill:"none",stroke:K(g,c,m.stroke),strokeWidth:1.5}),P&&F(g,x,m),k},"bpmn:IntermediateCatchEvent":O("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":O("bpmn:IntermediateEvent"),"bpmn:Lane":function(x,g,m={}){return m=Se(m,["fill","stroke","width","height"]),B(x,g,{...m,fillOpacity:_x})},"bpmn:ManualTask":function(x,g,m={}){m=Se(m,["fill","stroke"]);var P=M(x,g,m),k=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return b(x,k,{fill:be(g,s,m.fill),stroke:K(g,c,m.stroke),strokeWidth:.5}),P},"bpmn:MessageFlow":function(x,g,m={}){m=Se(m,["fill","stroke"]);var P=G(g),k=we(g),j=be(g,s,m.fill),q=K(g,c,m.stroke),J=E(x,g.waypoints,{markerEnd:d(x,"messageflow-end",j,q),markerStart:d(x,"messageflow-start",j,q),stroke:q,strokeDasharray:"10, 11",strokeWidth:1.5});if(P.get("messageRef")){var ve=J.getPointAtLength(J.getTotalLength()/2),de=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:ve.x,y:ve.y}}),_e={strokeWidth:1};k.get("messageVisibleKind")==="initiating"?(_e.fill=j,_e.stroke=q):(_e.fill=q,_e.stroke=j);var Ve=b(x,de,_e),dt=P.get("messageRef"),Rt=dt.get("name"),Re=re(x,Rt,{align:"center-top",fitBox:!0,style:{fill:q}}),Ne=Ve.getBBox(),ht=Re.getBBox(),cn=ve.x-ht.width/2,Gt=ve.y+Ne.height/2+mx;sa(Re,cn,Gt,0)}return J},"bpmn:ParallelGateway":function(x,g,m={}){m=Se(m,["fill","stroke"]);var P=Y(x,g,m),k=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:g.width,containerHeight:g.height,position:{mx:.46,my:.2}});return b(x,k,{fill:K(g,c,m.stroke),stroke:K(g,c,m.stroke),strokeWidth:1}),P},"bpmn:Participant":function(x,g,m={}){m=Se(m,["fill","stroke","width","height"]);var P=B(x,g,m),k=Ee(g),j=at(g),q=G(g),J=q.get("name");if(k){var ve=j?[{x:30,y:0},{x:30,y:It(g,m)}]:[{x:0,y:30},{x:qt(g,m),y:30}];w(x,ve,{stroke:K(g,c,m.stroke),strokeWidth:gx}),U(x,J,g,m)}else{var de=Yr(g,m);j||(de.height=qt(g,m),de.width=It(g,m));var _e=re(x,J,{box:de,align:"center-middle",style:{fill:qr(g,u,c,m.stroke)}});if(!j){var Ve=-1*It(g,m);sa(_e,0,-Ve,270)}}return q.get("participantMultiplicity")&&I("ParticipantMultiplicityMarker",x,g,m),P},"bpmn:ReceiveTask":function(x,g,m={}){m=Se(m,["fill","stroke"]);var P=G(g),k=M(x,g,m),j;return P.get("instantiate")?(v(x,28,28,20*.22,{fill:be(g,s,m.fill),stroke:K(g,c,m.stroke),strokeWidth:1}),j=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):j=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),b(x,j,{fill:be(g,s,m.fill),stroke:K(g,c,m.stroke),strokeWidth:1}),k},"bpmn:ScriptTask":function(x,g,m={}){m=Se(m,["fill","stroke"]);var P=M(x,g,m),k=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return b(x,k,{fill:be(g,s,m.fill),stroke:K(g,c,m.stroke),strokeWidth:1}),P},"bpmn:SendTask":function(x,g,m={}){m=Se(m,["fill","stroke"]);var P=M(x,g,m),k=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return b(x,k,{fill:K(g,c,m.stroke),stroke:be(g,s,m.fill),strokeWidth:1}),P},"bpmn:SequenceFlow":function(x,g,m={}){m=Se(m,["fill","stroke"]);var P=be(g,s,m.fill),k=K(g,c,m.stroke),j=E(x,g.waypoints,{markerEnd:d(x,"sequenceflow-end",P,k),stroke:k}),q=G(g),{source:J}=g;if(J){var ve=G(J);q.get("conditionExpression")&&y(ve,"bpmn:Activity")&&Z(j,{markerStart:d(x,"conditional-flow-marker",P,k)}),ve.get("default")&&(y(ve,"bpmn:Gateway")||y(ve,"bpmn:Activity"))&&ve.get("default")===q&&Z(j,{markerStart:d(x,"conditional-default-flow-marker",P,k)})}return j},"bpmn:ServiceTask":function(x,g,m={}){m=Se(m,["fill","stroke"]);var P=M(x,g,m);v(x,10,10,{fill:be(g,s,m.fill),stroke:"none",transform:"translate(6, 6)"});var k=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});b(x,k,{fill:be(g,s,m.fill),stroke:K(g,c,m.stroke),strokeWidth:1}),v(x,10,10,{fill:be(g,s,m.fill),stroke:"none",transform:"translate(11, 10)"});var j=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return b(x,j,{fill:be(g,s,m.fill),stroke:K(g,c,m.stroke),strokeWidth:1}),P},"bpmn:StartEvent":function(x,g,m={}){var{renderIcon:P=!0}=m;m=Se(m,["fill","stroke"]);var k=G(g);k.get("isInterrupting")||(m={...m,strokeDasharray:"6"});var j=ne(x,g,m);return P&&F(g,x,m),j},"bpmn:SubProcess":function(x,g,m={}){return Ee(g)?m=Se(m,["fill","stroke","width","height"]):m=Se(m,["fill","stroke"]),L(x,g,m)},"bpmn:Task":function(x,g,m={}){return m=Se(m,["fill","stroke"]),M(x,g,m)},"bpmn:TextAnnotation":function(x,g,m={}){m=Se(m,["fill","stroke"]);var{width:P,height:k}=Yr(g,m),j=_(x,P,k,0,0,{fill:"none",stroke:"none"}),q=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:P,containerHeight:k,position:{mx:0,my:0}});b(x,q,{stroke:K(g,c,m.stroke)});var J=G(g),ve=J.get("text")||"";return re(x,ve,{align:"left-top",box:Yr(g,m),padding:or,style:{fill:qr(g,u,c,m.stroke)}}),j},"bpmn:Transaction":function(x,g,m={}){Ee(g)?m=Se(m,["fill","stroke","width","height"]):m=Se(m,["fill","stroke"]);var P=L(x,g,{strokeWidth:1.5,...m}),k=n.style(["no-fill","no-events"],{stroke:K(g,c,m.stroke),strokeWidth:1.5}),j=Ee(g);return j||(m={}),_(x,qt(g,m),It(g,m),fa-pa,pa,k),P},"bpmn:UserTask":function(x,g,m={}){m=Se(m,["fill","stroke"]);var P=M(x,g,m),k=15,j=12,q=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:k,y:j}});b(x,q,{fill:be(g,s,m.fill),stroke:K(g,c,m.stroke),strokeWidth:.5});var J=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:k,y:j}});b(x,J,{fill:be(g,s,m.fill),stroke:K(g,c,m.stroke),strokeWidth:.5});var ve=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:k,y:j}});return b(x,ve,{fill:K(g,c,m.stroke),stroke:K(g,c,m.stroke),strokeWidth:.5}),P},label:function(x,g,m={}){return Qe(x,g,m)}};this._drawPath=b,this._renderer=T}X(Li,kn),Li.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],Li.prototype.canRender=function(e){return y(e,"bpmn:BaseElement")},Li.prototype.drawShape=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},Li.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},Li.prototype.getShapePath=function(e){return he(e)?$c(e,vx):y(e,"bpmn:Event")?Zf(e):y(e,"bpmn:Activity")?$c(e,fa):y(e,"bpmn:Gateway")?fx(e):dx(e)};function Se(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var bx=0,Ex={width:150,height:50};function xx(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function wx(e){return rt(e)?D({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var jc=null;function Sx(){return jc||(jc=document.createElement("canvas").getContext("2d")),jc}function Rx(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(Qf(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function Qf(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function Cx(e,t){var n=Sx();if(!n)return{width:0,height:0};n.font=Rx(t),"letterSpacing"in n&&(n.letterSpacing=Qf(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 Px(e,t,n){for(var i=e.shift(),r=i,o;;){if(o=Cx(r,n),o.width=r?o.width:0,r===" "||r===""||o.width<Math.round(t)||r.length<2)return Ax(e,r,i,o);r=Mx(r,o.width,t)}}function Ax(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 Jf="";function Tx(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===Jf)&&r.pop();break}var a=r[r.length-1];return a&&a===Jf&&(r[r.length-1]="-"),r.join("")}function Mx(e,t,n){var i=Math.max(e.length*(n/t),1),r=Tx(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function da(e){this._config=D({},{size:Ex,padding:bx,style:{},align:"center-top"},e||{})}da.prototype.createText=function(e,t){return this.layoutText(e,t).element},da.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},da.prototype.layoutText=function(e,t){for(var n=D({},this._config.size,t.box),i=D({},this._config.style,t.style),r=xx(t.align||this._config.align),o=wx(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=kx(i),c=e.split(/\u00AD?\r?\n/),u=[],p=n.width-o.left-o.right;c.length;)u.push(Px(c,p,i));r.vertical==="middle"&&(o.top=o.bottom=0);var l=kt(u,function(_,S,w){return _+(s||S.height)},0)+o.top+o.bottom,f=kt(u,function(_,S,w){return S.width>_?S.width:_},0),d=o.top;r.vertical==="middle"&&(d+=(n.height-l)/2),d-=(s||u[0].height)/4;var h=te("text");Z(h,i),A(u,function(_){var S;switch(d+=s||_.height,r.horizontal){case"left":S=o.left;break;case"right":S=(a?f:p)-o.right-_.width;break;default:S=Math.max(((a?f:p)-_.width)/2+o.left,0)}var w=te("tspan");Z(w,{x:S,y:d}),w.textContent=_.text,pe(h,w)});var v={width:f,height:l};return{dimensions:v,element:h}};function kx(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var Dx=12,Ox=1.2,Ix=40;function ed(e){var t=D({fontFamily:"Arial, sans-serif",fontSize:Dx,fontWeight:"normal",lineHeight:Ox},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=D({},t,{fontSize:n},e&&e.externalStyle||{}),r=new da({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,Ii.width),height:30},u=o(s,c,{style:i});return{x:Math.round(a.x+a.width/2-u.width/2),y:a.y,width:Math.ceil(u.width),height:Math.ceil(u.height)}},this.getTextAnnotationBounds=function(a,s){var c=o(s,a,{style:t,align:"left-top",padding:or});return{x:a.x,y:a.y,width:a.width,height:Math.max(Ix,Math.round(c.height))}},this.getDimensions=function(a,s){return r.getDimensions(a,s||{})};function o(a,s,c){return r.getDimensions(a,D({box:s},c))}this.createText=function(a,s){return r.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}ed.$inject=["config.textRenderer"];function Lx(){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,u=0;u<i.heightElements.length;u++)a["y"+u]=i.heightElements[u]*s;for(var p=0;p<i.widthElements.length;p++)a["x"+p]=i.widthElements[p]*c}var l=jx(i.d,{mx:r,my:o,e:a});return l}}var Bx=/\{([^{}]+)\}/g,Nx=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function $x(e,t,n){var i=n;return t.replace(Nx,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 jx(e,t){return String(e).replace(Bx,function(n,i){return $x(n,i,t)})}const Fx={__init__:["bpmnRenderer"],bpmnRenderer:["type",Li],textRenderer:["type",ed],pathMap:["type",Lx]};function Hx(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const Kr={translate:["value",Hx]};function ha(e,t,n){return D({id:e.id,type:e.$type,businessObject:e,di:t},n)}function zx(e,t,n){var i=e.waypoint;return!i||i.length<2?[se(t),se(n)]:i.map(function(r){return{x:r.x,y:r.y}})}function td(e,t,n){return new Error(`element ${bt(t)} referenced by ${bt(e)}#${n} not yet drawn`)}function Ln(e,t,n,i,r){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=r}Ln.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],Ln.prototype.add=function(e,t,n){var i,r,o;if(y(t,"bpmndi:BPMNPlane")){var a=y(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(ha(e,t,a)),this._canvas.addRootElement(i)}else if(y(t,"bpmndi:BPMNShape")){var s=!Ee(e,t),c=Gx(e);r=n&&(n.hidden||n.collapsed);var u=t.bounds;i=this._elementFactory.createShape(ha(e,t,{collapsed:s,hidden:r,x:Math.round(u.x),y:Math.round(u.y),width:Math.round(u.width),height:Math.round(u.height),isFrame:c})),y(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),y(e,"bpmn:Lane")&&(o=0),y(e,"bpmn:DataStoreReference")&&(Vx(n,se(u))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,o)}else if(y(t,"bpmndi:BPMNEdge")){var p=this._getSource(e),l=this._getTarget(e);r=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(ha(e,t,{hidden:r,source:p,target:l,waypoints:zx(t,p,l)})),y(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,o)}else throw new Error(`unknown di ${bt(t)} for element ${bt(e)}`);return ri(e)&&Vt(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},Ln.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${bt(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),r=i&&i.attachers;if(!i)throw td(e,n,"attachedToRef");t.host=i,r||(i.attachers=r=[]),r.indexOf(t)===-1&&r.push(t)},Ln.prototype.addLabel=function(e,t,n){var i,r,o;return i=ox(t,n),r=Vt(n),r&&(i=this._textRenderer.getExternalLabelBounds(i,r)),o=this._elementFactory.createLabel(ha(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!Vt(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)},Ln.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?td(e,i,t+"Ref"):new Error(`${bt(e)}#${t} Ref not specified`)},Ln.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},Ln.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},Ln.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function Vx(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 Gx(e){return y(e,"bpmn:Group")}const nd={__depends__:[Fx,{__depends__:[Kr],bpmnImporter:["type",Ln]}]};function Xr(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function an(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Fc(e){return Math.log(e)/Math.log(10)}var Wx=1e3;function V(e){this._eventBus=e}V.$inject=["eventBus"];function Ux(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}V.prototype.on=function(e,t,n,i,r,o){if((ot(t)||ue(t))&&(o=r,r=i,i=n,n=t,t=null),ot(n)&&(o=r,r=i,i=n,n=Wx),rt(r)&&(o=r,r=!1),!ot(i))throw new Error("handlerFn must be a function");ae(e)||(e=[e]);var a=this._eventBus;A(e,function(s){var c=["commandStack",s,t].filter(function(u){return u}).join(".");a.on(c,n,r?Ux(i,o):i,o)})},V.prototype.canExecute=Bn("canExecute"),V.prototype.preExecute=Bn("preExecute"),V.prototype.preExecuted=Bn("preExecuted"),V.prototype.execute=Bn("execute"),V.prototype.executed=Bn("executed"),V.prototype.postExecute=Bn("postExecute"),V.prototype.postExecuted=Bn("postExecuted"),V.prototype.revert=Bn("revert"),V.prototype.reverted=Bn("reverted");function Bn(e){return function(n,i,r,o,a){(ot(n)||ue(n))&&(a=o,o=r,r=i,i=n,n=null),this.on(n,e,i,r,o,a)}}var Hc=["top","bottom","left","right"],ma=10;function zc(e,t){V.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,u=o.hints||{};u.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(la(r)&&!Te(r)){var o=Kx(r);o&&i(r,o)}}function i(r,o){var a=se(r),s=r.label,c=se(s);if(s.parent){var u=ie(r),p;switch(o){case"top":p={x:a.x,y:u.top-ma-s.height/2};break;case"left":p={x:u.left-ma-s.width/2,y:a.y};break;case"bottom":p={x:a.x,y:u.bottom+ma+s.height/2};break;case"right":p={x:u.right+ma+s.width/2,y:a.y};break}var l=an(p,c);t.moveShape(s,l)}}}X(zc,V),zc.$inject=["eventBus","modeling"];function qx(e){var t=e.host,n=se(e),i=ut(n,t),r;i.indexOf("-")>=0?r=i.split("-"):r=[i];var o=Hc.filter(function(a){return r.indexOf(a)===-1});return o}function Yx(e){var t=se(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 id(t,i)});return n}function Kx(e){var t=se(e.label),n=se(e),i=id(n,t);if(Xx(i)){var r=Yx(e);if(e.host){var o=qx(e);r=r.concat(o)}var a=Hc.filter(function(s){return r.indexOf(s)===-1});return a.indexOf(i)!==-1?ut(e.label,e)!=="intersect"?void 0:i:a[0]}}function id(e,t){return ut(t,e,5)}function Xx(e){return Hc.indexOf(e)!==-1}function Vc(e){V.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,i=t.shape;t.position||(y(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)}X(Vc,V),Vc.$inject=["eventBus"];var Zx=1500;function Gc(e,t,n){e.invoke(V,this),this.preExecute("elements.delete",Zx,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=ye(r,u=>y(u,"bpmn:Participant")||y(u,"bpmn:SubProcess"));if(!o.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(u=>y(u,"bpmn:Artifact"))),c=new Set;return A(o,u=>{const p=new Set(Ki(er(Array.from(s),Ue(u))));c=c.union(p),s=s.difference(p)}),Array.from(c)}}X(Gc,V),Gc.$inject=["injector","eventBus","canvas"];function Wc(e,t){e.invoke(V,this),this.postExecute("shape.move",function(n){var i=n.newParent,r=n.shape,o=ye(r.incoming.concat(r.outgoing),function(a){return y(a,"bpmn:Association")});A(o,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}X(Wc,V),Wc.$inject=["injector","modeling"];function sr(e,t){for(Tt(t)&&(t=[t]);e=e.parent;)if(ge(e,t))return e;return null}function rd(e,t){var n=sr(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=sr(e,i),n)return at(n);if(ge(e,i))return at(e);var r;for(r=G(e);r&&!y(r,"bpmn:Process");r=r.$parent);if(!t)return!0;var o=t.find(function(a){var s=G(a);return s&&s.get("processRef")===r});return o?at(o):!0}var od=500;function ga(e,t){t.invoke(V,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",od,function(i){var r=i.elements;r=r.filter(function(o){var a=o.host;return ad(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",od,function(i){var r=i.shapes,o=i.newHost;if(r.length===1){var a=r[0];ad(a,o)&&(i.shapes=[n._replaceShape(a,o)])}},!0)}ga.$inject=["bpmnReplace","injector"],X(ga,V),ga.prototype._replaceShape=function(e,t){var n=Qx(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function Qx(e){var t=G(e),n=t.eventDefinitions;return n&&n[0]}function ad(e,t){return!he(e)&&ge(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function Uc(e,t){V.call(this,e);function n(i){return ye(i.attachers,function(r){return y(r,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var r=i.context.source,o=i.context.target,a=n(o);y(r,"bpmn:EventBasedGateway")&&y(o,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var r=i.context.oldSource,o=i.context.newSource;y(r,"bpmn:Gateway")&&y(o,"bpmn:EventBasedGateway")&&A(o.outgoing,function(a){var s=a.target,c=n(s);y(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}Uc.$inject=["eventBus","modeling"],X(Uc,V);function sd(e){return e.create("bpmn:Category")}function Jx(e){return e.create("bpmn:CategoryValue")}function cd(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=Jx(e)),n.$parent||(n.$parent=sd(e)),n}function ew(e,t,n){return Ge(t.get("categoryValue"),e),e.$parent=t,Ge(n.get("rootElements"),t),t.$parent=n,e}function tw(e){var t=e.$parent;return t&&(ze(t.get("categoryValue"),e),e.$parent=null),e}function nw(e){var t=e.$parent;return t&&(ze(t.get("rootElements"),e),e.$parent=null),e}var iw=500;function qc(e,t,n){n.invoke(V,this);function i(c){return t.filter(function(u){return y(u,"bpmn:Group")&&!u.labelTarget}).map(G).filter(function(u){return u!==c})}function r(c,u){return i(u).some(function(p){return p.get("categoryValueRef")===c})}function o(c,u){return i(u).some(function(p){var l=p.get("categoryValueRef");return l&&l.$parent===c})}function a(c,u){c&&u&&ew(c,u,e.getDefinitions())}function s(c,u,p){u&&!o(u,p)&&nw(u),c&&!r(c,p)&&tw(c)}this.executed(["shape.create","label.create"],function(c){var u=c.labelTarget||c.shape;!y(u,"bpmn:Group")||u.labelTarget||a(c.categoryValue,c.category)},!0),this.reverted(["shape.create","label.create"],function(c){var u=c.labelTarget||c.shape;!y(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,G(u))},!0),this.executed(["shape.move","shape.resize"],iw,function(c){a(c.categoryValue,c.category)},!0),this.reverted(["shape.move","shape.resize"],function(c){var u=c.shape;c.categoryValue&&s(c.categoryValue,c.category,G(u))},!0),this.executed("group.updateRefs",function(c){ud(c).forEach(function(u){a(u.categoryValue,u.category)})},!0),this.reverted("group.updateRefs",function(c){ud(c).forEach(function(u){s(u.categoryValue,u.category,G(u.groupShape))})},!0),this.executed("shape.delete",function(c){var u=c.shape;!y(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,G(u))},!0),this.reverted("shape.delete",function(c){var u=c.shape;!y(u,"bpmn:Group")||u.labelTarget||a(c.categoryValue,c.category)},!0)}qc.$inject=["bpmnjs","elementRegistry","injector"],X(qc,V);function ud(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function Yc(e,t,n){V.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(_){const S=_.source,w=_.target;cr(S)&&Zr(w)&&p(w)}function r(_){const S=_.connection,w=_.source,E=_.target;cr(w)&&va(E)&&(u(E),f(w,[S]))}function o(_){const S=_.newTarget,w=_.oldSource,E=_.oldTarget;if(E!==S){const b=w;Zr(E)&&p(E),cr(b)&&va(S)&&u(S)}}function a(_){const{element:S}=_;Zr(S)?(l(S),d(S)):va(S)&&h(S)}function s(_){const{newData:S,oldShape:w}=_;if(cr(_.oldShape)&&S.eventDefinitionType!=="bpmn:CompensateEventDefinition"||S.type!=="bpmn:BoundaryEvent"){const E=w.outgoing.find(({target:b})=>Zr(b));E&&E.target&&(_._connectionTarget=E.target)}else if(!cr(_.oldShape)&&S.eventDefinitionType==="bpmn:CompensateEventDefinition"&&S.type==="bpmn:BoundaryEvent"){const E=w.outgoing.find(({target:b})=>va(b));E&&E.target&&(_._connectionTarget=E.target),v(w)}}function c(_){const{_connectionTarget:S,newShape:w}=_;S&&t.connect(w,S)}function u(_){t.updateProperties(_,{isForCompensation:!0})}function p(_){t.updateProperties(_,{isForCompensation:void 0})}function l(_){for(const S of _.incoming)n.canConnect(S.source,_)||t.removeConnection(S);for(const S of _.outgoing)n.canConnect(_,S.target)||t.removeConnection(S)}function f(_,S){_.outgoing.filter(b=>y(b,"bpmn:Association")).filter(b=>Zr(b.target)&&!S.includes(b)).forEach(b=>t.removeConnection(b))}function d(_){const S=_.attachers.slice();S.length&&t.removeElements(S)}function h(_){const S=_.incoming.filter(w=>cr(w.source));t.removeElements(S)}function v(_){const S=_.outgoing.filter(w=>y(w,"bpmn:SequenceFlow"));t.removeElements(S)}}X(Yc,V),Yc.$inject=["eventBus","modeling","bpmnRules"];function Zr(e){const t=G(e);return t&&t.get("isForCompensation")}function cr(e){return e&&y(e,"bpmn:BoundaryEvent")&&rr(e,"bpmn:CompensateEventDefinition")}function va(e){return e&&y(e,"bpmn:Activity")&&!Et(e)}function Kc(e){e.invoke(V,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,r=n.shape;y(i,"bpmn:Lane")&&!y(r,"bpmn:Lane")&&(n.parent=sr(i,"bpmn:Participant"))})}Kc.$inject=["injector"],X(Kc,V);function Xc(e,t){V.call(this,e),this.preExecute("shape.create",function(n){var a;var i=n.context,r=i.shape;if(y(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}})}Xc.$inject=["eventBus","bpmnFactory"],X(Xc,V);var Zc=20,Qc=20,ld=30,ya=2e3;function Jc(e,t,n){V.call(this,t),t.on(["create.start","shape.move.start"],ya,function(r){var o=r.context,a=o.shape,s=e.getRootElement();if(!(!y(a,"bpmn:Participant")||!y(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(l){return!y(l,"bpmn:Group")&&!he(l)&&!Te(l)});if(c.length){var u=Ue(c),p=rw(a,u);D(a,p),o.createConstraints=ow(a,u)}}}),t.on("create.start",ya,function(r){var o=r.context,a=o.shape,s=e.getRootElement(),c=e.getGraphics(s);function u(p){p.element=s,p.gfx=c}y(a,"bpmn:Participant")&&y(s,"bpmn:Process")&&(t.on("element.hover",ya,u),t.once("create.cleanup",function(){t.off("element.hover",u)}))});function i(){var r=e.getRootElement();return y(r,"bpmn:Collaboration")?r:n.makeCollaboration()}this.preExecute("elements.create",ya,function(r){var o=r.elements,a=r.parent,s=aw(o),c;s&&y(a,"bpmn:Process")&&(r.parent=i(),c=r.hints=r.hints||{},c.participant=s,c.process=a,c.processRef=G(s).get("processRef"))},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;y(a,"bpmn:Participant")&&y(o,"bpmn:Process")&&(r.parent=i(),r.process=o,r.processRef=G(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)&&G(s).set("processRef",G(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,u=o.participant;a&&(!u||c===u)&&G(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 u=a.children.slice();c?s===c&&n.moveElements(u,{x:0,y:0},c):n.moveElements(u,{x:0,y:0},s)}},!0)}Jc.$inject=["canvas","eventBus","modeling"],X(Jc,V);function rw(e,t){t={width:t.width+Zc*2+ld,height:t.height+Qc*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 ow(e,t){return t=ie(t),{bottom:t.top+e.height/2-Qc,left:t.right-e.width/2+Zc,top:t.bottom-e.height/2+Qc,right:t.left+e.width/2-Zc-ld}}function aw(e){return Oe(e,function(t){return y(t,"bpmn:Participant")})}var pd="__targetRef_placeholder";function eu(e,t){V.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],fd(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],fd(o));function n(a,s,c){var u=a.get("dataInputAssociations");return Oe(u,function(p){return p!==c&&p.targetRef===s})}function i(a,s){var c=a.get("properties"),u=Oe(c,function(p){return p.name===pd});return!u&&s&&(u=t.create("bpmn:Property",{name:pd}),Ge(c,u)),u}function r(a,s){var c=i(a);c&&(n(a,c,s)||ze(a.get("properties"),c))}function o(a){var s=a.context,c=s.connection,u=c.businessObject,p=c.target,l=p&&p.businessObject,f=s.newTarget,d=f&&f.businessObject,h=s.oldTarget||s.target,v=h&&h.businessObject,_=c.businessObject,S;v&&v!==l&&r(v,u),d&&d!==l&&r(d,u),l?(S=i(l,!0),_.targetRef=S):_.targetRef=null}}eu.$inject=["eventBus","bpmnFactory"],X(eu,V);function fd(e){return function(t){var n=t.context,i=n.connection;if(y(i,"bpmn:DataInputAssociation"))return e(t)}}function _a(e){this._bpmnUpdater=e}_a.$inject=["bpmnUpdater"],_a.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),[]},_a.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 tu(e,t,n,i){V.call(this,i),t.registerHandler("dataStore.updateContainment",_a);function r(){return n.filter(function(s){return y(s,"bpmn:Participant")&&G(s).processRef})[0]}function o(s){return s.children.filter(function(c){return y(c,"bpmn:DataStoreReference")&&!c.labelTarget})}function a(s,c){var u=s.businessObject||s;if(c=c||r(),c){var p=c.businessObject||c;t.execute("dataStore.updateContainment",{dataStoreBo:u,dataStoreDi:we(s),newSemanticParent:p.processRef||p,newDiParent:we(c)})}}this.preExecute("shape.create",function(s){var c=s.context,u=c.shape;y(u,"bpmn:DataStoreReference")&&u.type!=="label"&&(c.hints||(c.hints={}),c.hints.autoResize=!1)}),this.preExecute("elements.move",function(s){var c=s.context,u=c.shapes,p=u.filter(function(l){return y(l,"bpmn:DataStoreReference")});p.length&&(c.hints||(c.hints={}),c.hints.autoResize=u.filter(function(l){return!y(l,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,u=c.shape,p=u.parent;y(u,"bpmn:DataStoreReference")&&u.type!=="label"&&y(p,"bpmn:Collaboration")&&a(u)}),this.postExecute("shape.move",function(s){var c=s.context,u=c.shape,p=c.oldParent,l=u.parent;if(!y(p,"bpmn:Collaboration")&&y(u,"bpmn:DataStoreReference")&&u.type!=="label"&&y(l,"bpmn:Collaboration")){var f=y(p,"bpmn:Participant")?p:cw(p,"bpmn:Participant");a(u,f)}}),this.postExecute("shape.delete",function(s){var c=s.context,u=c.shape,p=e.getRootElement();ge(u,["bpmn:Participant","bpmn:SubProcess"])&&y(p,"bpmn:Collaboration")&&o(p).filter(function(l){return sw(l,u)}).forEach(function(l){a(l)})}),this.postExecute("canvas.updateRoot",function(s){var c=s.context,u=c.oldRoot,p=c.newRoot,l=o(u);l.forEach(function(f){y(p,"bpmn:Process")&&a(f,p)})})}tu.$inject=["canvas","commandStack","elementRegistry","eventBus"],X(tu,V);function sw(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 cw(e,t){for(;e.parent;){if(y(e.parent,t))return e.parent;e=e.parent}}var ba=Math.max,Ea=Math.min,uw=20;function dd(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function lw(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 pw(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 xa(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return ue(r)&&(i=(/top|left/.test(e)?Ea:ba)(i,r)),ue(o)&&(i=(/top|left/.test(e)?ba:Ea)(i,o)),i}function fw(e,t){if(!t)return e;var n=ie(e);return ra({top:xa("top",n,t),right:xa("right",n,t),bottom:xa("bottom",n,t),left:xa("left",n,t)})}function dw(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:Ea(o.top,a.top),left:Ea(o.left,a.left),bottom:ba(o.bottom,a.bottom),right:ba(o.right,a.right)};return ra(s)}function Qr(e,t){return typeof e<"u"?e:uw}function hw(e,t){var n,i,r,o;return typeof t=="object"?(n=Qr(t.left),i=Qr(t.right),r=Qr(t.top),o=Qr(t.bottom)):n=i=r=o=Qr(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function mw(e){return!(e.waypoints||e.type==="label")}function hd(e,t){var n;if(e.length===void 0?n=ye(e.children,mw):n=e,n.length)return hw(Ue(n),t)}var oi=Math.abs;function gw(e,t){return dd(ie(t),ie(e))}var vw=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Yt=30;function wa(e,t){return t=t||[],e.children.filter(function(n){y(n,"bpmn:Lane")&&(wa(n,t),t.push(n))}),t}function ai(e){return e.children.filter(function(t){return y(t,"bpmn:Lane")})}function Kt(e){return sr(e,vw)||e}function yw(e,t){var n=Kt(e),i=y(n,"bpmn:Process")?[]:[n],r=wa(n,i),o=ie(e),a=ie(t),s=gw(e,t),c=[],u=at(e);return r.forEach(function(p){if(p!==e){var l=u?0:s.top,f=u?s.right:0,d=u?0:s.bottom,h=u?s.left:0,v=ie(p);s.top&&(oi(v.bottom-o.top)<10&&(d=a.top-v.bottom),oi(v.top-o.top)<5&&(l=a.top-v.top)),s.left&&(oi(v.right-o.left)<10&&(f=a.left-v.right),oi(v.left-o.left)<5&&(h=a.left-v.left)),s.bottom&&(oi(v.top-o.bottom)<10&&(l=a.bottom-v.top),oi(v.bottom-o.bottom)<5&&(d=a.bottom-v.bottom)),s.right&&(oi(v.left-o.right)<10&&(h=a.right-v.left),oi(v.right-o.right)<5&&(f=a.right-v.right)),(l||f||d||h)&&c.push({shape:p,newBounds:pw(p,{top:l,right:f,bottom:d,left:h})})}}),c}var _w=500;function nu(e,t){V.call(this,e);function n(i,r){var o=at(i),a=ai(r),s=[],c=[],u=[],p=[];if(Di(a,function(_){return o?_.y>i.y?c.push(_):s.push(_):_.x>i.x?p.push(_):u.push(_),_.children}),!!a.length){var l;o?c.length&&s.length?l=i.height/2:l=i.height:p.length&&u.length?l=i.width/2:l=i.width;var f,d,h,v;s.length&&(f=t.calculateAdjustments(s,"y",l,i.y-10),t.makeSpace(f.movingShapes,f.resizingShapes,{x:0,y:l},"s")),c.length&&(d=t.calculateAdjustments(c,"y",-l,i.y+i.height+10),t.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:-l},"n")),u.length&&(h=t.calculateAdjustments(u,"x",l,i.x-10),t.makeSpace(h.movingShapes,h.resizingShapes,{x:l,y:0},"e")),p.length&&(v=t.calculateAdjustments(p,"x",-l,i.x+i.width+10),t.makeSpace(v.movingShapes,v.resizingShapes,{x:-l,y:0},"w"))}}this.postExecuted("shape.delete",_w,function(i){var r=i.context,o=r.hints,a=r.shape,s=r.oldParent;y(a,"bpmn:Lane")&&(o&&o.nested||n(a,s))})}nu.$inject=["eventBus","spaceTool"],X(nu,V);var md=500;function Sa(e,t){t.invoke(V,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",md,function(i){var r=i.elements;r.filter(function(o){var a=o.host;return gd(o,a)}).map(function(o){return r.indexOf(o)}).forEach(function(o){i.elements[o]=n._replaceShape(r[o])})},!0),this.preExecute("elements.move",md,function(i){var r=i.shapes,o=i.newHost;r.forEach(function(a,s){var c=a.host;gd(a,Ew(r,c)?c:o)&&(r[s]=n._replaceShape(a))})},!0)}Sa.$inject=["bpmnReplace","injector"],X(Sa,V),Sa.prototype._replaceShape=function(e){var t=bw(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function bw(e){var t=G(e),n=t.eventDefinitions;return n&&n[0]}function gd(e,t){return!he(e)&&y(e,"bpmn:BoundaryEvent")&&!t}function Ew(e,t){return e.indexOf(t)!==-1}var Ra=Math.round,xw=Math.max;function ww(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 Sw(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var vd=10;function Rw(e,t){var n,i;for(n=0;i=e[n];n++)if(zr(i,t)<=vd)return{point:e[n],bendpoint:!0,index:n};return null}function Cw(e,t){var n=xf(ww(t,vd),Sw(e)),i=n[0],r=n[n.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=xw(i.segment2,r.segment2)-1,{point:e[o],bendpoint:!0,index:o}):{point:{x:Ra(i.x+r.x)/2,y:Ra(i.y+r.y)/2},index:i.segment2}:{point:{x:Ra(i.x),y:Ra(i.y)},index:i.segment2}:null}function iu(e,t){return Rw(e,t)||Cw(e,t)}function ru(e,t,n){V.call(this,e);function i(r,o,a){var s=o.waypoints,c,u,p,l,f,d,h,v=r.outgoing.slice(),_=r.incoming.slice(),S;ue(a.width)?S=se(a):S=a;var w=iu(s,S);if(w){if(c=s.slice(0,w.index),u=s.slice(w.index+(w.bendpoint?1:0)),!c.length||!u.length)return;p=w.bendpoint?s[w.index]:S,(c.length===1||!yd(r,c[c.length-1]))&&c.push(_d(p)),(u.length===1||!yd(r,u[0]))&&u.unshift(_d(p))}l=o.source,f=o.target,t.canConnect(l,r,o)&&(n.reconnectEnd(o,r,c||S),d=o),t.canConnect(r,f,o)&&(d?h=n.connect(r,f,{type:o.type,waypoints:u}):(n.reconnectStart(o,r,u||S),h=o));var E=[].concat(d&&ye(_,function(b){return b.source===d.source})||[],h&&ye(v,function(b){return b.target===h.target})||[]);E.length&&n.removeElements(E)}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 u=se(c),p={x:u.x+s.x,y:u.y+s.y},l=Oe(o.children,function(f){var d=t.canInsert(a,f);return d&&iu(f.waypoints,p)});l&&(r.targetFlow=l,r.position=p)}},!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)}X(ru,V),ru.$inject=["eventBus","bpmnRules","modeling"];function yd(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 _d(e){return D({},e)}function ou(e,t){V.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)&&ur(r)){var c=[];y(o,"bpmn:EventBasedGateway")?c=a.incoming.filter(u=>u!==r&&ur(u)):c=a.incoming.filter(u=>u!==r&&ur(u)&&y(u.source,"bpmn:EventBasedGateway")),c.forEach(function(u){t.removeConnection(u)})}}),this.preExecuted("shape.replace",function(n){var i=n.context,r=i.newShape;if(y(r,"bpmn:EventBasedGateway")){var o=r.outgoing.filter(ur).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);o.forEach(function(a){a.incoming.filter(ur).forEach(function(s){const c=a.incoming.filter(ur).filter(function(u){return u.source===r});(s.source!==r||c.length>1)&&t.removeConnection(s)})})}})}ou.$inject=["eventBus","modeling"],X(ou,V);function ur(e){return y(e,"bpmn:SequenceFlow")}var Ca=1500,bd=2e3;function Ed(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"],Ca,function(i){var r=i.context,o=r.shape||i.shape,a=i.hover;y(a,"bpmn:Lane")&&!ge(o,["bpmn:Lane","bpmn:Participant"])&&(i.hover=Kt(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(o.labelTarget||ge(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"],Ca,function(i){var r=i.hover;y(r,"bpmn:Lane")&&(i.hover=Kt(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],Ca,function(i){var r=i.context,o=i.hover,a=r.type;y(o,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=Kt(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],Ca,function(i){var r=i.context,o=r.start;y(o,"bpmn:Lane")&&(r.start=Kt(o)||o)}),t.on("shape.move.start",bd,function(i){var r=i.shape;y(r,"bpmn:Lane")&&(i.shape=Kt(r)||r)}),t.on("spaceTool.move",bd,function(i){var r=i.hover;r&&y(r,"bpmn:Lane")&&(i.hover=Kt(r))})}Ed.$inject=["elementRegistry","eventBus","canvas"];var xd=770;function au(e,t,n,i){n.invoke(V,this);function r(s,c){var u=G(s),p=c.categoryValue||u.categoryValueRef;p||(p=cd(e,u));var l=c.category||p.$parent||sd(e);u.categoryValueRef=p,p.$parent=l,c.categoryValue=p,c.category=l}function o(s,c){var u=G(s),p=c.categoryValue||u.categoryValueRef,l=c.category||p&&p.$parent;p&&(c.categoryValue=p,c.category=l,u.categoryValueRef=null)}this.execute("label.create",function(s){var c=s.context,u=c.labelTarget;y(u,"bpmn:Group")&&r(u,c)}),this.revert("label.create",function(s){var c=s.context,u=c.labelTarget;y(u,"bpmn:Group")&&o(u,c)}),this.execute("shape.delete",function(s){var c=s.context,u=c.shape,p=G(u);if(!(!y(u,"bpmn:Group")||u.labelTarget)){var l=c.categoryValue=p.categoryValueRef;l&&(c.category=l.$parent,p.categoryValueRef=null)}}),this.reverted("shape.delete",function(s){var c=s.context,u=c.shape;if(!(!y(u,"bpmn:Group")||u.labelTarget)){var p=c.category,l=c.categoryValue,f=G(u);l&&(f.categoryValueRef=l,l.$parent=p)}}),this.execute("shape.create",function(s){var c=s.context,u=c.shape,p=c.hints||{};!y(u,"bpmn:Group")||u.labelTarget||p.createElementsBehavior===!1&&!G(u).categoryValueRef&&!c.categoryValue||r(u,c)}),this.reverted("shape.create",function(s){var c=s.context,u=c.shape,p=c.hints||{};!y(u,"bpmn:Group")||u.labelTarget||p.createElementsBehavior===!1&&!G(u).categoryValueRef&&!c.categoryValue||o(u,c)}),this.executed(["shape.move","shape.resize"],function(s){var c=s.context,u=c.shape;!y(u,"bpmn:Group")||u.labelTarget||G(u).categoryValueRef||r(u,c)}),this.reverted(["shape.move","shape.resize"],function(s){var c=s.context,u=c.shape;!y(u,"bpmn:Group")||u.labelTarget||!c.categoryValue||o(u,c)});function a(s,c){var u=e.create(s.$type);return i.copyElement(s,u,null,c)}t.on("copyPaste.copyElement",xd,function(s){var c=s.descriptor,u=s.element;if(!(!y(u,"bpmn:Group")||u.labelTarget)){var p=G(u);if(p.categoryValueRef){var l=p.categoryValueRef;c.categoryValue=a(l,!0),l.$parent&&(c.category=a(l.$parent,!0))}}}),t.on("copyPaste.pasteElement",xd,function(s){var c=s.descriptor,u=c.businessObject,p=c.categoryValue,l=c.category;p&&(p=u.categoryValueRef=a(p)),l&&(p.$parent=a(l)),delete c.category,delete c.categoryValue})}au.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],X(au,V);function su(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 wd(e){function t(i,r,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=su(i,r,o,a),u=su(i,r,o,s),p;c&&u?Sd(c,o)>Sd(u,o)?p=u:p=c:p=c||u,i.original=p}function n(i){var r=i.waypoints;t(r[0],r[1],se(i.source)),t(r[r.length-1],r[r.length-2],se(i.target))}e.on("bpmnElement.added",function(i){var r=i.element;r.waypoints&&n(r)})}wd.$inject=["eventBus"];function Sd(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function cu(e){V.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=G(i),o=we(i);if(ge(r,t)){var a=o.get("isHorizontal");a===void 0&&(a=!0),o.set("isHorizontal",a)}})}cu.$inject=["eventBus"],X(cu,V);function Rd(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Cd(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function Pw(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 Aw(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 uu(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=Aw([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 Pd(e,t){var n=uu(e,t),i={x:n.x-e.x,y:n.y-e.y};return Rd(i)}function Jr(e,t){return Rd({x:e.x-t.x,y:e.y-t.y})}var Ad=Math.sqrt,Td=Math.min,Tw=Math.max,Md=Math.abs;function kd(e){return Math.pow(e,2)}function eo(e,t){return Ad(kd(e.x-t.x)+kd(e.y-t.y))}function Mw(e,t){var n=0,i,r,o,a,s,c,u,p,l,f,d;for(n=0;n<t.length-1;n++){if(i=t[n],r=t[n+1],Od(i,r)?u=[i]:(o=eo(e,i),a=eo(e,r),c=Td(o,a),u=kw(i,r,e,c)),u.length<1)throw new Error("expected between [1, 2] circle -> line intersections");u.length===1&&(p={type:"bendpoint",position:u[0],segmentIndex:n,bendpointIndex:Od(i,u[0])?n:n+1}),u.length===2&&(s=Ow(u[0],u[1]),p={type:"segment",position:s,segmentIndex:n,relativeLocation:eo(i,s)/eo(i,r)}),l=eo(p.position,e),(!d||f>l)&&(d=p,f=l)}return d}function kw(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,u=r*a+o*s,p=a*a+s*s-i*i,l=u/c,f=p/c,d=l*l-f;if(d<0&&d>-1e-6&&(d=0),d<0)return[];var h=Ad(d),v=-l+h,_=-l-h,S={x:e.x-r*v,y:e.y-o*v};if(d===0)return[S];var w={x:e.x-r*_,y:e.y-o*_};return[S,w].filter(function(E){return Dw(E,e,t)})}function Dw(e,t,n){return Dd(e.x,t.x,n.x)&&Dd(e.y,t.y,n.y)}function Dd(e,t,n){return e>=Td(t,n)-Pa&&e<=Tw(t,n)+Pa}function Ow(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var Pa=.1;function Od(e,t){return Md(e.x-t.x)<=Pa&&Md(e.y-t.y)<=Pa}function Iw(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,u=i.bendpointMove.bendpointIndex,p;if(o===0)return r;if(r>=u&&(p=c?r+1:r-1),r<u&&(p=r,c&&n.type!=="bendpoint"&&u-1===r)){var l=Ld(t,u);l<n.relativeLocation&&p++}return p}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 Id(e,t,n,i){var r=0,o=0,a={point:e,delta:{x:0,y:0}},s=Mw(e,n),c=s.segmentIndex,u=Iw(n,t,s,i);if(u<0||u>t.length-2||u===null)return a;var p=Bd(n,c),l=Bd(t,u),f=s.position,d=Bw(p,f),h=Lw(p,l);if(s.type==="bendpoint"){var v=t.length-n.length,_=s.bendpointIndex,S=n[_];if(t.indexOf(S)!==-1)return a;if(v===0){var w=t[_];return r=w.x-s.position.x,o=w.y-s.position.y,{delta:{x:r,y:o},point:{x:e.x+r,y:e.y+o}}}v<0&&_!==0&&_<n.length-1&&(d=Ld(n,_))}var E={x:(l[1].x-l[0].x)*d+l[0].x,y:(l[1].y-l[0].y)*d+l[0].y},b=Pw({x:e.x-f.x,y:e.y-f.y},h);return r=E.x+b.x-e.x,o=E.y+b.y-e.y,{point:On(E),delta:On({x:r,y:o})}}function Ld(e,t){var n=Jr(e[t-1],e[t]),i=Jr(e[t],e[t+1]),r=n/(n+i);return r}function Lw(e,t){var n=Cd(e),i=Cd(t);return i-n}function Bd(e,t){return[e[t],e[t+1]]}function Bw(e,t){var n=Jr(e[0],e[1]),i=Jr(e[0],t);return n===0?0:i/n}function Nw(e,t,n,i){var r=se(e);return Id(r,t,n,i).delta}function to(e,t,n){var i=Xr(t),r=Xr(n),o=an(e,i),a={x:o.x*(n.width/t.width),y:o.y*(n.height/t.height)};return On({x:r.x+a.x,y:r.y+a.y})}function Nd(e,t,n){var i=Xr(e),r=Xr(t),o=Xr(n),a=an(e,i),s=an(i,r),c=$w(i,t,n);if(c)return c;var u={x:s.x*(n.width/t.width),y:s.y*(n.height/t.height)},p={x:o.x+u.x,y:o.y+u.y};return On({x:p.x+a.x-e.x,y:p.y+a.y-e.y})}function $w(e,t,n){var i=ie(t),r=ie(n);if(jw(i,r))return null;var o=ut(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=ut(n,s),c!==o?null:a}function jw(e,t){return Fw(e,t)||Hw(e,t)}function Fw(e,t){return e.right!==t.right&&e.left!==t.left}function Hw(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var $d="name",jd="text";function lu(e,t,n,i){V.call(this,e),this.postExecute("element.updateProperties",r),this.postExecute("element.updateModdleProperties",a=>{G(a.context.element)===a.context.moddleElement&&r(a)});function r(a){var s=a.context,c=s.element,u=s.properties;if($d in u&&t.updateLabel(c,u[$d]),jd in u&&y(c,"bpmn:TextAnnotation")){var p=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},u[jd]||"");t.updateLabel(c,u.text,p)}}this.postExecute(["shape.create","connection.create"],function(a){var s=a.context,c=s.hints||{};if(c.createElementsBehavior!==!1){var u=s.shape||s.connection;he(u)||!ri(u)||Vt(u)&&t.updateLabel(u,Vt(u))}}),this.postExecute("shape.delete",function(a){var s=a.context,c=s.labelTarget,u=s.hints||{};c&&u.unsetLabel!==!1&&t.updateLabel(c,null,null,{removeShape:!1})});function o(a){var s=a.context,c=s.connection,u=c.label,p=D({},s.hints),l=s.newWaypoints||c.waypoints,f=s.oldWaypoints;return typeof p.startChanged>"u"&&(p.startChanged=!!p.connectionStart),typeof p.endChanged>"u"&&(p.endChanged=!!p.connectionEnd),Nw(u,l,f,p)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(a){var s=a.context,c=s.hints||{};if(c.labelBehavior!==!1){var u=s.connection,p=u.label,l;!p||!p.parent||(l=o(a),t.moveShape(p,l))}}),this.postExecute(["shape.replace"],function(a){var s=a.context,c=s.newShape,u=s.oldShape,p=G(c);p&&ri(p)&&u.label&&c.label&&(c.label.x=u.label.x,c.label.y=u.label.y)}),this.preExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.hints||{};if(!(!he(c)||u.autoResize)){var p=s.newBounds,l=i.getDimensions(Vt(c)||"",{box:p,style:i.getExternalStyle()}),f=Math.ceil(l.height),d=p.y!==c.y,h=c.y+c.height;s.newBounds={width:p.width,height:f,x:p.x,y:d?h-f:p.y}}}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.newBounds,p=s.oldBounds;if(la(c)){var l=c.label,f=se(l),d=Gw(p),h=Vw(f,d),v=zw(h,p,u);t.moveShape(l,v)}})}X(lu,V),lu.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function zw(e,t,n){var i=to(e,t,n);return On(an(i,e))}function Vw(e,t){if(t.length){var n=Ww(e,t);return uu(e,n)}}function Gw(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 Ww(e,t){var n=t.map(function(r){return{line:r,distance:Pd(e,r)}}),i=ln(n,"distance");return i[0].line}function Uw(e,t,n,i){return Id(e,t,n,i).point}function pu(e,t){V.call(this,e);function n(i,r){var o=i.context,a=o.connection,s=D({},o.hints),c=o.newWaypoints||a.waypoints,u=o.oldWaypoints;return typeof s.startChanged>"u"&&(s.startChanged=!!s.connectionStart),typeof s.endChanged>"u"&&(s.endChanged=!!s.connectionEnd),Uw(r,c,u,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 u=c.waypoints[c.waypoints.length-1],p=n(i,u),l=[].concat(c.waypoints.slice(0,-1),[p]);t.updateWaypoints(c,l)}),a.forEach(function(c){var u=c.waypoints[0],p=n(i,u),l=[].concat([p],c.waypoints.slice(1));t.updateWaypoints(c,l)})}),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(u){var p=u.waypoints[u.waypoints.length-1],l={x:p.x+c.x,y:p.y+c.y},f=[].concat(u.waypoints.slice(0,-1),[l]);t.updateWaypoints(u,f)}),a.forEach(function(u){var p=u.waypoints[0],l={x:p.x+c.x,y:p.y+c.y},f=[].concat([l],u.waypoints.slice(1));t.updateWaypoints(u,f)})})}X(pu,V),pu.$inject=["eventBus","modeling"];function Aa(e,t,n){var i=Ma(e),r=Hd(i,t),o=i[0];return r.length?r[r.length-1]:to(o.original||o,n,t)}function Ta(e,t,n){var i=Ma(e),r=Hd(i,t),o=i[i.length-1];return r.length?r[0]:to(o.original||o,n,t)}function fu(e,t,n){var i=Ma(e),r=Fd(t,n),o=i[0];return to(o.original||o,r,t)}function du(e,t,n){var i=Ma(e),r=Fd(t,n),o=i[i.length-1];return to(o.original||o,r,t)}function Fd(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function Ma(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Hd(e,t){var n=vt(e,Yw);return ye(n,function(i){return qw(i,t)})}function qw(e,t){return ut(t,e,1)==="intersect"}function Yw(e){return e.original||e}function hu(e,t){V.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,r=n.newShape;if(Kw(i,r)){var o=Xw(i);o.incoming.forEach(function(a){var s=Ta(a,r,i);t.reconnectEnd(a,r,s)}),o.outgoing.forEach(function(a){var s=Aa(a,r,i);t.reconnectStart(a,r,s)})}},!0)}hu.$inject=["eventBus","modeling"],X(hu,V);function Kw(e,t){return y(e,"bpmn:Participant")&&Ee(e)&&y(t,"bpmn:Participant")&&!Ee(t)}function Xw(e){var t=Fr([e]),n=[],i=[];return t.forEach(function(r){r!==e&&(r.incoming.forEach(function(o){y(o,"bpmn:MessageFlow")&&n.push(o)}),r.outgoing.forEach(function(o){y(o,"bpmn:MessageFlow")&&i.push(o)}))},[]),{incoming:n,outgoing:i}}const Zw=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function zd(e){const t=G(e);if(!y(t,"bpmn:BoundaryEvent")&&!(y(t,"bpmn:StartEvent")&&Et(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:Zw.some(i=>y(n[0],i))}function Vd(e){return y(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function mu(e,t){e.invoke(V,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,r=n.context.newShape,o=n.context.hints;if(!zd(r))return;const a=Vd(r);if(o.targetElement&&o.targetElement[a]!==void 0)return;const c=G(i).get(a),u=G(r).get(a);c!==u&&t.updateProperties(r,{[a]:c})})}mu.$inject=["injector","modeling"],X(mu,V);function gu(e,t){V.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,r=we(i),o=r&&r.get("label"),a=o&&o.get("bounds");a&&t.updateModdleProperties(i,o,{bounds:void 0})},!0)}X(gu,V),gu.$inject=["eventBus","modeling"];function vu(e,t,n){V.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(!(!y(o,"bpmn:SequenceFlow")||!y(a,"bpmn:SequenceFlow"))&&t.canConnect(o.source,a.target,o)){var s=Qw(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}X(vu,V),vu.$inject=["eventBus","bpmnRules","modeling"];function lr(e){return e.original||e}function Qw(e,t){var n=su(lr(e[e.length-2]),lr(e[e.length-1]),lr(t[1]),lr(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[lr(e[0]),lr(t[t.length-1])]}function yu(e,t){V.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,r=i.parent;y(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)}yu.$inject=["eventBus","modeling"],X(yu,V);function _u(e,t,n,i){V.call(this,e);var r=i.get("dragging",!1);function o(c){var u=c.source,p=c.target,l=c.parent;if(l){var f,d;y(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(u,p)||(d=!0),n.canConnectMessageFlow(u,p)&&(f="bpmn:MessageFlow")),y(c,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(u,p)||(d=!0),n.canConnectSequenceFlow(u,p)&&(f="bpmn:SequenceFlow")),d&&t.removeConnection(c),f&&t.connect(u,p,{type:f,waypoints:c.waypoints.slice()})}}function a(c){var u=c.context,p=u.connection,l=u.newSource||p.source,f=u.newTarget||p.target,d,h;d=n.canConnect(l,f),!(!d||d.type===p.type)&&(h=t.connect(l,f,{type:d.type,associationDirection:d.associationDirection,waypoints:p.waypoints.slice()}),p.parent&&t.removeConnection(p),u.connection=h,r&&s(p,h))}function s(c,u){var p=r.context(),l=p&&p.payload.previousSelection,f;!l||!l.length||(f=l.indexOf(c),f!==-1&&l.splice(f,1,u))}this.postExecuted("elements.move",function(c){var u=c.closure,p=u.allConnections;A(p,o)},!0),this.preExecute("connection.reconnect",a),this.postExecuted("element.updateProperties",function(c){var u=c.context,p=u.properties,l=u.element,f=l.businessObject,d;p.default&&(d=Oe(l.outgoing,Zi({id:l.businessObject.default.id})),d&&t.updateProperties(d,{conditionExpression:void 0})),p.conditionExpression&&f.sourceRef.default===f&&t.updateProperties(l.source,{default:void 0})})}X(_u,V),_u.$inject=["eventBus","modeling","bpmnRules","injector"];function ka(e,t,n,i,r,o){i.invoke(V,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=o,this.postExecuted(["elements.create"],500,function(a){var s=a.context,c=s.parent,u=s.elements,p=kt(u,function(l,f){var d=t.canReplace([f],f.host||f.parent||c);return d?l.concat(d.replacements):l},[]);p.length&&this._replaceElements(u,p)},this),this.postExecuted(["elements.move"],500,function(a){var s=a.context,c=s.newParent,u=s.newHost,p=[];A(s.closure.topLevel,function(f){Et(f)?p=p.concat(f.children):p=p.concat(f)}),p.length===1&&u&&(c=u);var l=t.canReplace(p,c);l&&this._replaceElements(p,l.replacements,u)},this),this.postExecute(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,u=s.newShape,p=c.attachers,l;p&&p.length&&(l=t.canReplace(p,u),this._replaceElements(p,l.replacements))},this),this.postExecuted(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,u=s.newShape;r.unclaimId(c.businessObject.id,c.businessObject),r.updateProperties(u,{id:c.id})})}X(ka,V),ka.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,r=this._selection;A(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)},ka.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var Jw=1500,e1={width:140,height:120},bu={width:300,height:60},Eu={width:60,height:300},Da={width:300,height:150},Oa={width:150,height:300},Gd={width:140,height:120},Wd={width:100,height:40};function Ud(e){e.on("resize.start",Jw,function(t){var n=t.context,i=n.shape,r=n.direction,o=n.balanced;(y(i,"bpmn:Lane")||y(i,"bpmn:Participant"))&&(n.resizeConstraints=o1(i,r,o)),y(i,"bpmn:SubProcess")&&Ee(i)&&(n.minDimensions=Gd),y(i,"bpmn:TextAnnotation")&&(n.minDimensions=Wd)})}Ud.$inject=["eventBus"];var si=Math.abs,t1=Math.min,n1=Math.max;function qd(e,t,n,i){var r=e[t];e[t]=r===void 0?n:i(n,r)}function pr(e,t,n){return qd(e,t,n,t1)}function fr(e,t,n){return qd(e,t,n,n1)}var i1={top:20,left:50,right:20,bottom:20},r1={top:50,left:20,right:20,bottom:20};function o1(e,t,n){var i=Kt(e),r=!0,o=!0,a=wa(i,[i]),s=ie(e),c={},u={},p=at(e),l=p?bu:Eu;/n/.test(t)?u.top=s.bottom-l.height:/e/.test(t)?u.right=s.left+l.width:/s/.test(t)?u.bottom=s.top+l.height:/w/.test(t)&&(u.left=s.right-l.width),a.forEach(function(h){var v=ie(h);p?(v.top<s.top-10&&(r=!1),v.bottom>s.bottom+10&&(o=!1)):(v.left<s.left-10&&(r=!1),v.right>s.right+10&&(o=!1)),/n/.test(t)&&(n&&si(s.top-v.bottom)<10&&fr(c,"top",v.top+l.height),si(s.top-v.top)<5&&pr(u,"top",v.bottom-l.height)),/e/.test(t)&&(n&&si(s.right-v.left)<10&&pr(c,"right",v.right-l.width),si(s.right-v.right)<5&&fr(u,"right",v.left+l.width)),/s/.test(t)&&(n&&si(s.bottom-v.top)<10&&pr(c,"bottom",v.bottom-l.height),si(s.bottom-v.bottom)<5&&fr(u,"bottom",v.top+l.height)),/w/.test(t)&&(n&&si(s.left-v.right)<10&&fr(c,"left",v.left+l.width),si(s.left-v.left)<5&&pr(u,"left",v.right-l.width))});var f=i.children.filter(function(h){return!h.hidden&&!h.waypoints&&(y(h,"bpmn:FlowElement")||y(h,"bpmn:Artifact"))}),d=p?i1:r1;return f.forEach(function(h){var v=ie(h);/n/.test(t)&&(!p||r)&&pr(u,"top",v.top-d.top),/e/.test(t)&&(p||o)&&fr(u,"right",v.right+d.right),/s/.test(t)&&(!p||o)&&fr(u,"bottom",v.bottom+d.bottom),/w/.test(t)&&(p||r)&&pr(u,"left",v.left-d.left)}),{min:u,max:c}}function Yd(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function dr(e){return e.originalEvent||e.srcEvent}function xu(e){Yd(e),Yd(dr(e))}function Bi(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 Kd(){return/mac/i.test(navigator.platform)}function Xd(e,t){return(dr(e)||e).button===t}function ci(e){return Xd(e,0)}function a1(e){return Xd(e,1)}function no(e){var t=dr(e)||e;return ci(e)?Kd()?t.metaKey:t.ctrlKey:!1}function Ia(e){var t=dr(e)||e;return ci(e)&&t.shiftKey}var Zd=1001;function Qd(e,t){e.on("resize.start",Zd+500,function(n){var i=n.context,r=i.shape;(y(r,"bpmn:Lane")||y(r,"bpmn:Participant"))&&(i.balanced=!no(n))}),e.on("resize.end",Zd,function(n){var i=n.context,r=i.shape,o=i.canExecute,a=i.newBounds;if(y(r,"bpmn:Lane")||y(r,"bpmn:Participant"))return o&&(a=Pf(a),t.resizeLane(r,a,i.balanced)),!1})}Qd.$inject=["eventBus","modeling"];var s1=500;function wu(e,t,n,i,r){n.invoke(V,this);function o(p){return ge(p,["bpmn:ReceiveTask","bpmn:SendTask"])||c1(p,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(p){var l=e.getDefinitions(),f=l.get("rootElements");return!!Oe(f,Zi({id:p.id}))}function s(p){if(y(p,"bpmn:ErrorEventDefinition"))return"errorRef";if(y(p,"bpmn:EscalationEventDefinition"))return"escalationRef";if(y(p,"bpmn:MessageEventDefinition"))return"messageRef";if(y(p,"bpmn:SignalEventDefinition"))return"signalRef"}function c(p){if(ge(p,["bpmn:ReceiveTask","bpmn:SendTask"]))return p.get("messageRef");var l=p.get("eventDefinitions"),f=l[0];return f.get(s(f))}function u(p,l){if(ge(p,["bpmn:ReceiveTask","bpmn:SendTask"]))return p.set("messageRef",l);var f=p.get("eventDefinitions"),d=f[0];return d.set(s(d),l)}this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],function(p){var l=p.shape||p.element;if(o(l)){var f=G(l),d=c(f),h;d&&!a(d)&&(h=e.getDefinitions().get("rootElements"),Ge(h,d),p.addedRootElement=d)}},!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],function(p){var l=p.addedRootElement;if(l){var f=e.getDefinitions().get("rootElements");ze(f,l)}},!0),t.on("copyPaste.copyElement",function(p){var l=p.descriptor,f=p.element;if(!(f.labelTarget||!o(f))){var d=G(f),h=c(d);h&&(l.referencedRootElement=h)}}),t.on("copyPaste.pasteElement",s1,function(p){var l=p.descriptor,f=l.businessObject,d=l.referencedRootElement;d&&(a(d)||(d=i.copyElement(d,r.create(d.$type))),u(f,d),delete l.referencedRootElement)})}wu.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],X(wu,V);function c1(e,t){return ae(t)||(t=[t]),qn(t,function(n){return rr(e,n)})}var Jd=Math.max;function eh(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,r=t.start,o={};return A(n,function(a){var s=a.id;y(a,"bpmn:Participant")&&(o[s]=l1(a,i,r)),y(a,"bpmn:Lane")&&(o[s]=at(a)?bu:Eu),y(a,"bpmn:SubProcess")&&Ee(a)&&(o[s]=Gd),y(a,"bpmn:TextAnnotation")&&(o[s]=Wd),y(a,"bpmn:Group")&&(o[s]=e1)}),o})}eh.$inject=["eventBus"];function u1(e){return e==="x"}function l1(e,t,n){var i=at(e);if(!d1(e))return i?Da:Oa;var r=u1(t),o={};return r?i?o=Da:o={width:f1(e,n,r),height:Oa.height}:i?o={width:Da.width,height:p1(e,n,r)}:o=Oa,o}function p1(e,t,n){var i;return i=h1(e,t,n),Jd(Da.height,i)}function f1(e,t,n){var i;return i=m1(e,t,n),Jd(Oa.width,i)}function d1(e){return!!ai(e).length}function h1(e,t,n){var i=ai(e),r;return r=Su(i,t,n),e.height-r.height+bu.height}function m1(e,t,n){var i=ai(e),r;return r=Su(i,t,n),e.width-r.width+Eu.width}function Su(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=ai(r),o.length?Su(o,t,n):r}var th="_plane";function nh(e){var t=e.id;return g1(t)}function bn(e){var t=e.id;return y(e,"bpmn:SubProcess")?ih(t):t}function Ni(e){return ih(e)}function La(e){var t=we(e);return y(t,"bpmndi:BPMNPlane")}function ih(e){return e+th}function g1(e){return e.replace(new RegExp(th+"$"),"")}var rh=400,v1=600,oh={x:180,y:160};function Nn(e,t,n,i,r,o,a){V.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(l){return y(l,"bpmn:SubProcess")&&!Ee(l)}function u(l){var f=l.shape,d=l.newRootElement,h=G(f);d=s._addDiagram(d||h),l.newRootElement=e.addRootElement(d)}function p(l){var f=l.shape,d=G(f);s._removeDiagram(d);var h=l.newRootElement=a.get(bn(d));e.removeRootElement(h)}this.executed("shape.create",function(l){var f=l.shape;c(f)&&u(l)},!0),this.postExecuted("elements.create",function(l){var f=l.elements;A(f,function(d){if(c(d)){var h=a.get(bn(d));if(!(!h||!d.children||!d.children.length)){var v=ah(d);s._showRecursively(v),s._moveChildrenToShape(v,h)}}})},!0),this.reverted("shape.create",function(l){var f=l.shape;c(f)&&p(l)},!0),this.preExecute("shape.delete",function(l){var f=l.shape;!y(f,"bpmn:SubProcess")||!Ee(f)||A(Ur([f]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(l){var f=l.shape;if(c(f)){var d=a.get(bn(f));d&&n.removeElements(d.children.slice())}},!0),this.executed("shape.delete",function(l){var f=l.shape;c(f)&&p(l)},!0),this.reverted("shape.delete",function(l){var f=l.shape;c(f)&&u(l)},!0),this.preExecuted("shape.replace",function(l){var f=l.oldShape,d=l.newShape;!c(f)||!c(d)||(l.oldRoot=e.removeRootElement(bn(f)))},!0),this.postExecuted("shape.replace",function(l){var f=l.newShape,d=l.oldRoot,h=e.findRoot(bn(f));if(!(!d||!h)){var v=d.children;n.moveElements(v,{x:0,y:0},h)}},!0),this.executed("element.updateProperties",function(l){var f=l.element;if(y(f,"bpmn:SubProcess")){var d=l.properties,h=l.oldProperties,v=h.id,_=d.id;if(v!==_){if(La(f)){a.updateId(f,Ni(_)),a.updateId(v,_);return}var S=a.get(Ni(v));S&&a.updateId(Ni(v),Ni(_))}}},!0),this.reverted("element.updateProperties",function(l){var f=l.element;if(y(f,"bpmn:SubProcess")){var d=l.properties,h=l.oldProperties,v=h.id,_=d.id;if(v!==_){if(La(f)){a.updateId(f,Ni(v)),a.updateId(_,v);return}var S=a.get(Ni(_));S&&a.updateId(S,Ni(v))}}},!0),t.on("element.changed",function(l){var f=l.element;if(La(f)){var d=f,h=a.get(nh(d));!h||h===d||t.fire("element.changed",{element:h})}}),this.executed("shape.toggleCollapse",rh,function(l){var f=l.shape;y(f,"bpmn:SubProcess")&&(Ee(f)?p(l):(u(l),s._showRecursively(f.children)))},!0),this.reverted("shape.toggleCollapse",rh,function(l){var f=l.shape;y(f,"bpmn:SubProcess")&&(Ee(f)?p(l):(u(l),s._showRecursively(f.children)))},!0),this.postExecuted("shape.toggleCollapse",v1,function(l){var f=l.shape;if(y(f,"bpmn:SubProcess")){var d=l.newRootElement;if(d)if(Ee(f))s._moveChildrenToShape(d.children.slice(),f),A(Ur(f.children),v=>{n.moveShape(v.annotation,{x:0,y:0},f.parent),A(v.associations,_=>{n.moveConnection(_,{x:0,y:0},f.parent)})});else{s._disconnectSharedAnnotations(f);var h=ah(f);s._moveChildrenToShape(h,d)}}},!0),t.on("copyPaste.createTree",function(l){var f=l.element,d=l.children;if(c(f)){var h=bn(f),v=a.get(h);v&&d.push.apply(d,v.children)}}),t.on("copyPaste.copyElement",function(l){var f=l.descriptor,d=l.element,h=l.elements,v=d.parent,_=y(we(v),"bpmndi:BPMNPlane");if(_){var S=nh(v),w=Oe(h,function(E){return E.id===S});w&&(f.parent=w.id)}}),t.on("copyPaste.pasteElement",function(l){var f=l.descriptor;f.parent&&(c(f.parent)||f.parent.hidden)&&(f.hidden=!0)})}X(Nn,V),Nn.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=Ue(i),o;if(!t.x)o={x:oh.x-r.x,y:oh.y-r.y};else{var a=se(t),s=se(r);o={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,o,t,{autoResize:!1})}},Nn.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(Xf(e).map(i=>i.annotation));n.size&&A(Ur(e.children),i=>{n.has(i.annotation)&&A(i.associations,r=>{t.removeConnection(r)})})},Nn.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},Nn.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},Nn.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:bn(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return o},Nn.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=Oe(n,function(r){return r.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},Nn.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function y1(e){var t=[];return A(Ur(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function ah(e){return e.children.slice().concat(y1(e.children)).concat(_1(e))}function _1(e){return Tc(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function Ru(e,t){e.invoke(V,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,r=n.context.newShape;if(!(!y(r,"bpmn:SubProcess")||y(r,"bpmn:AdHocSubProcess")||!(y(i,"bpmn:Task")||y(i,"bpmn:CallActivity"))||!Ee(r))){var o=b1(r);t.createShape({type:"bpmn:StartEvent"},o,r)}})}Ru.$inject=["injector","modeling"],X(Ru,V);function b1(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function Cu(e,t){V.call(this,e),this.preExecute("connection.create",function(n){const{target:i}=n;y(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&&y(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(!(!y(r,"bpmn:TextAnnotation")||o.autoResize)){var a=i.newBounds,s=t.getTextAnnotationBounds(a,Vt(r)||""),c=a.y!==r.y&&Math.abs(a.y+a.height-(r.y+r.height))<=1,u=r.y+r.height;i.newBounds={width:a.width,height:s.height,x:a.x,y:c?u-s.height:a.y}}})}X(Cu,V),Cu.$inject=["eventBus","textRenderer"];function Pu(e,t){V.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(Ee(i))return;var r=Fr(i);r.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();A(s,function(u){o(u,!0)}),A(c,function(u){o(u,!1)})});function o(a,s){r.indexOf(a.source)!==-1&&r.indexOf(a.target)!==-1||y(a,"bpmn:Association")&&(y(a.source,"bpmn:TextAnnotation")||y(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,i,se(i)):t.reconnectStart(a,i,se(i)))}},!0)}X(Pu,V),Pu.$inject=["eventBus","modeling"];var Au=500;function Tu(e,t,n){V.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,u=s,p,l;return p=E1(c).concat([a]),l=hd(p),l?(u.width=Math.max(l.width,u.width),u.height=Math.max(l.height,u.height),u.x=l.x+(l.width-u.width)/2,u.y=l.y+(l.height-u.height)/2):(u.x=a.x+(a.width-u.width)/2,u.y=a.y+(a.height-u.height)/2),u}function o(a,s){return{x:a.x+(a.width-s.width)/2,y:a.y+(a.height-s.height)/2,width:s.width,height:s.height}}this.executed(["shape.toggleCollapse"],Au,function(a){var s=a.context,c=s.shape;y(c,"bpmn:SubProcess")&&(c.collapsed?we(c).isExpanded=!1:(i(c.children),we(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],Au,function(a){var s=a.context,c=s.shape;c.collapsed?we(c).isExpanded=!1:we(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],Au,function(a){var s=a.context.shape,c=t.getDefaultSize(s),u;s.collapsed?u=o(s,c):u=r(s,c),n.resizeShape(s,u,null,{autoResize:s.collapsed?!1:"nwse"})})}X(Tu,V),Tu.$inject=["eventBus","elementFactory","modeling"];function E1(e){return e.filter(function(t){return!t.hidden})}function Mu(e,t,n,i){t.invoke(V,this),this.preExecute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.businessObject;he(a)||(y(a,"bpmn:Participant")&&Ee(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;y(r,"bpmn:Collaboration")&&n.ids.unclaim(o.id)})}X(Mu,V),Mu.$inject=["canvas","injector","moddle","modeling"];function ku(e,t){V.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,r=i.connection,o=r.source;x1(r,o)&&t.updateProperties(o,{default:null})})}X(ku,V),ku.$inject=["eventBus","modeling"];function x1(e,t){if(!y(e,"bpmn:SequenceFlow"))return!1;var n=G(t),i=G(e);return n.get("default")===i}var w1=500,S1=5e3,sh=["shape.create","shape.delete","shape.move","shape.resize"],ch=[...sh,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function Du(e,t){V.call(this,e);var n;function i(){return n=n||new R1,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(ch,S1,function(){i()}),this.postExecuted(ch,w1,function(){o()}),this.preExecute(sh,function(a){var s=a.context,c=s.shape,u=r();!c||c.labelTarget||(y(c,"bpmn:Lane")&&u.addLane(c),y(c,"bpmn:FlowNode")&&u.addFlowNode(c))})}Du.$inject=["eventBus","modeling"],X(Du,V);function R1(){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 C1=500,P1=5e3,uh=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],lh=[...uh,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function Ou(e,t){V.call(this,e);var n;function i(){return n=n||new A1,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(lh,P1,function(){i()}),this.postExecuted(lh,C1,function(){o()}),this.preExecute(uh,function(a){var s=a.context.connection||a.context.shape,c=r();!s||s.labelTarget||(y(s,"bpmn:FlowElement")&&c.addFlowElement(s),y(s,"bpmn:Group")&&c.addGroup(s))}),this.preExecute("label.create",function(a){var s=a.context.labelTarget;y(s,"bpmn:Group")&&r().addGroup(s)})}Ou.$inject=["eventBus","modeling"],X(Ou,V);function A1(){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 Iu(e,t){V.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,r=i.elements;for(const o of r)T1(o)&&!k1(o)&&t.updateProperties(o,{isForCompensation:void 0})})}X(Iu,V),Iu.$inject=["eventBus","modeling"];function T1(e){const t=G(e);return t&&t.isForCompensation}function M1(e){return e&&y(e,"bpmn:BoundaryEvent")&&rr(e,"bpmn:CompensateEventDefinition")}function k1(e){return e.incoming.filter(n=>M1(n.source)).length>0}const D1={__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",zc],appendBehavior:["type",Vc],associationBehavior:["type",Wc],attachEventBehavior:["type",ga],artifactBehavior:["type",Gc],boundaryEventBehavior:["type",Uc],categoryRootElementReferenceBehavior:["type",qc],compensateBoundaryEventBehaviour:["type",Yc],createBehavior:["type",Kc],createDataObjectBehavior:["type",Xc],createParticipantBehavior:["type",Jc],dataInputAssociationBehavior:["type",eu],dataStoreBehavior:["type",tu],deleteLaneBehavior:["type",nu],detachEventBehavior:["type",Sa],dropOnFlowBehavior:["type",ru],eventBasedGatewayBehavior:["type",ou],fixHoverBehavior:["type",Ed],groupBehavior:["type",au],importDockingFix:["type",wd],isHorizontalFix:["type",cu],labelBehavior:["type",lu],layoutConnectionBehavior:["type",pu],messageFlowBehavior:["type",hu],nonInterruptingBehavior:["type",mu],removeElementBehavior:["type",vu],removeEmbeddedLabelBoundsBehavior:["type",gu],removeParticipantBehavior:["type",yu],replaceConnectionBehavior:["type",_u],replaceElementBehaviour:["type",ka],resizeBehavior:["type",Ud],resizeLaneBehavior:["type",Qd],rootElementReferenceBehavior:["type",wu],spaceToolBehavior:["type",eh],subProcessPlaneBehavior:["type",Nn],subProcessStartEventBehavior:["type",Ru],textAnnotationBehavior:["type",Cu],toggleCollapseConnectionBehaviour:["type",Pu],toggleElementCollapseBehaviour:["type",Tu],unclaimIdBehavior:["type",Mu],unsetDefaultFlowBehavior:["type",ku],updateFlowNodeRefsBehavior:["type",Du],updateCategoryValueRefsBehavior:["type",Ou],setCompensationActivityAfterPasteBehavior:["type",Iu]};function Lu(e){this._commandStack=e.get("commandStack",!1)}Lu.$inject=["injector"],Lu.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const En={__init__:["rules"],rules:["type",Lu]};function Xt(e){V.call(this,e),this.init()}Xt.$inject=["eventBus"],X(Xt,V),Xt.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)})},Xt.prototype.init=function(){};function ph(e,t){var n=ut(e,t,-15);return n!=="intersect"?n:null}function pt(e){Xt.call(this,e)}X(pt,Xt),pt.$inject=["eventBus"],pt.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return O1(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 Na(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return Na(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 Sh(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return Te(i)&&!$a(t,i)?!1:Ci(t,function(r){return Te(r)?Na(r.source,r.target,r):r.host?io(r,r.host,null,n):ju(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 yh(a)&&!n.includes(a.host)})?!1:io(n,t,null,i)||xh(n,t,i)||wh(n,t)||$a(n,t)}),this.addRule("shape.create",function(e){return ju(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return io(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return Th(n,t)})},pt.prototype.canConnectMessageFlow=Ph,pt.prototype.canConnectSequenceFlow=Ah,pt.prototype.canConnectDataAssociation=Fu,pt.prototype.canConnectAssociation=Rh,pt.prototype.canConnectCompensationAssociation=Ch,pt.prototype.canMove=wh,pt.prototype.canAttach=io,pt.prototype.canReplace=xh,pt.prototype.canDrop=hr,pt.prototype.canInsert=$a,pt.prototype.canCreate=ju,pt.prototype.canConnect=Na,pt.prototype.canResize=Sh,pt.prototype.canCopy=Th;function O1(e){return Bu(e)?null:ge(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function Bu(e){return!e||he(e)}function fh(e){do{if(y(e,"bpmn:Process"))return G(e);if(y(e,"bpmn:Participant"))return G(e).processRef||G(e)}while(e=e.parent)}function Nu(e){return y(e,"bpmn:TextAnnotation")}function $u(e){return y(e,"bpmn:Group")&&!e.labelTarget}function dh(e){return y(e,"bpmn:BoundaryEvent")&&xn(e,"bpmn:CompensateEventDefinition")}function Ba(e){return G(e).isForCompensation}function I1(e,t){var n=fh(e),i=fh(t);return n===i}function L1(e){return y(e,"bpmn:InteractionNode")&&!y(e,"bpmn:BoundaryEvent")&&(!y(e,"bpmn:Event")||y(e,"bpmn:ThrowEvent")&&gh(e,"bpmn:MessageEventDefinition"))}function B1(e){return y(e,"bpmn:InteractionNode")&&!Ba(e)&&(!y(e,"bpmn:Event")||y(e,"bpmn:CatchEvent")&&gh(e,"bpmn:MessageEventDefinition"))&&!(y(e,"bpmn:BoundaryEvent")&&!xn(e,"bpmn:MessageEventDefinition"))}function hh(e){for(var t=e;t=t.parent;){if(y(t,"bpmn:FlowElementsContainer"))return G(t);if(y(t,"bpmn:Participant"))return G(t).processRef}return null}function mh(e,t){var n=hh(e),i=hh(t);return n===i}function xn(e,t){var n=G(e);return!!Oe(n.eventDefinitions||[],function(i){return y(i,t)})}function gh(e,t){var n=G(e);return(n.eventDefinitions||[]).every(function(i){return y(i,t)})}function N1(e){return y(e,"bpmn:FlowNode")&&!y(e,"bpmn:EndEvent")&&!Et(e)&&!(y(e,"bpmn:IntermediateThrowEvent")&&xn(e,"bpmn:LinkEventDefinition"))&&!dh(e)&&!Ba(e)}function $1(e){return y(e,"bpmn:FlowNode")&&!y(e,"bpmn:StartEvent")&&!y(e,"bpmn:BoundaryEvent")&&!Et(e)&&!(y(e,"bpmn:IntermediateCatchEvent")&&xn(e,"bpmn:LinkEventDefinition"))&&!Ba(e)}function j1(e){return y(e,"bpmn:ReceiveTask")||y(e,"bpmn:IntermediateCatchEvent")&&(xn(e,"bpmn:MessageEventDefinition")||xn(e,"bpmn:TimerEventDefinition")||xn(e,"bpmn:ConditionalEventDefinition")||xn(e,"bpmn:SignalEventDefinition"))}function F1(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function vh(e,t){var n=F1(t);return n.indexOf(e)!==-1}function Na(e,t,n){if(Bu(e)||Bu(t))return null;if(!y(n,"bpmn:DataAssociation")){if(Ph(e,t))return{type:"bpmn:MessageFlow"};if(Ah(e,t))return{type:"bpmn:SequenceFlow"}}var i=Fu(e,t);return i||(Ch(e,t)?{type:"bpmn:Association",associationDirection:"One"}:Rh(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function hr(e,t){return he(e)||$u(e)?!0:y(t,"bpmn:Participant")&&!Ee(t)?!1:y(e,"bpmn:Participant")?y(t,"bpmn:Process")||y(t,"bpmn:Collaboration"):ge(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:y(e,"bpmn:Lane")?y(t,"bpmn:Participant")||y(t,"bpmn:Lane"):y(e,"bpmn:BoundaryEvent")&&!H1(e)?!1:y(e,"bpmn:FlowElement")&&!y(e,"bpmn:DataStoreReference")?y(t,"bpmn:FlowElementsContainer")?Ee(t):ge(t,["bpmn:Participant","bpmn:Lane"]):y(e,"bpmn:DataStoreReference")&&y(t,"bpmn:Collaboration")?qn(G(t).get("participants"),function(n){return!!n.get("processRef")}):ge(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?ge(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):y(e,"bpmn:MessageFlow")?y(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function H1(e){return G(e).cancelActivity&&(_h(e)||bh(e))}function yh(e){return!he(e)&&y(e,"bpmn:BoundaryEvent")}function z1(e){return y(e,"bpmn:Lane")}function V1(e){return yh(e)||y(e,"bpmn:IntermediateThrowEvent")&&_h(e)?!0:y(e,"bpmn:IntermediateCatchEvent")&&bh(e)}function _h(e){var t=G(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function bh(e){return Eh(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function Eh(e,t){return t.some(function(n){return xn(e,n)})}function G1(e){return y(e,"bpmn:ReceiveTask")&&Oe(e.incoming,function(t){return y(t.source,"bpmn:EventBasedGateway")})}function io(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var r=e[0];return he(r)||!V1(r)||Et(t)||!y(t,"bpmn:Activity")||Ba(t)||i&&!ph(i,t)||G1(t)?!1:"attach"}function xh(e,t,n){if(!t)return!1;var i={replacements:[]};return A(e,function(r){Et(t)||y(r,"bpmn:StartEvent")&&r.type!=="label"&&hr(r,t)&&(JE(r)||i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),(ex(r)||tx(r)||nx(r))&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),Eh(r,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&y(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"})),y(t,"bpmn:Transaction")||xn(r,"bpmn:CancelEventDefinition")&&r.type!=="label"&&(y(r,"bpmn:EndEvent")&&hr(r,t)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:EndEvent"}),y(r,"bpmn:BoundaryEvent")&&io(r,t,null,n)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function wh(e,t){return qn(e,z1)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return hr(n,t)})}function ju(e,t,n,i){return t?he(e)||$u(e)?!0:hr(e,t)||$a(e,t):!1}function Sh(e,t,n){return y(e,"bpmn:SubProcess")?Ee(e)&&(!t||t.width>=100&&t.height>=80):y(e,"bpmn:Lane")||y(e,"bpmn:Participant")?!0:Nu(e)?n?n==="e"||n==="w":!0:$u(e)?!0:he(e)?n?n==="e"||n==="w":!0:!1}function W1(e,t){var n=Nu(e),i=Nu(t);return(n||i)&&n!==i}function Rh(e,t){return vh(t,e)||vh(e,t)?!1:W1(e,t)?!0:!!Fu(e,t)}function Ch(e,t){return mh(e,t)&&dh(e)&&y(t,"bpmn:Activity")&&!q1(t,e)&&!Et(t)}function Ph(e,t){return kh(e)&&!kh(t)?!1:L1(e)&&B1(t)&&!I1(e,t)}function Ah(e,t){return N1(e)&&$1(t)&&mh(e,t)&&!(y(e,"bpmn:EventBasedGateway")&&!j1(t))}function Fu(e,t){return ge(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&ge(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:ge(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&ge(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function $a(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:ge(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!he(t)&&y(e,"bpmn:FlowNode")&&!y(e,"bpmn:BoundaryEvent")&&hr(e,t.parent)}function Hu(e,t){return e&&t&&e.indexOf(t)!==-1}function Th(e,t){return he(t)?!0:!(y(t,"bpmn:Lane")&&!Hu(e,t.parent)||y(t,"bpmn:MessageFlow")&&!U1(e,t))}function U1(e,t){var n=Mh(t.source),i=Mh(t.target);return Hu(e,n)&&Hu(e,i)}function Mh(e){for(;e;e=e.parent)if(y(e,"bpmn:Participant"))return e;return null}function kh(e){return sr(e,"bpmn:Process")||sr(e,"bpmn:Collaboration")}function q1(e,t){return e.attachers.includes(t)}const Y1={__depends__:[En],__init__:["bpmnRules"],bpmnRules:["type",pt]};var K1=2e3;function Dh(e,t){e.on("saveXML.start",K1,n);function n(){var i=t.getRootElements();A(i,function(r){var o=we(r),a,s;a=Fr([r]),a=ye(a,function(c){return c!==r&&!c.labelTarget}),s=vt(a,we),o.set("planeElement",s)})}}Dh.$inject=["eventBus","canvas"];const X1={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",Dh]};function ja(e){V.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)})}ja.prototype.getOrdering=function(e,t){return null},X(ja,V);function zu(e,t){ja.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=Oe(n,function(c){return ge(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 u=s;u&&!ge(u,c);)u=u.parent;if(!u)throw new Error(`no parent for <${a.id}> in <${s&&s.id}>`);return u}this.getOrdering=function(a,s){if(a.labelTarget||y(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 u=s.children.indexOf(a),p=wp(s.children,function(l){return!a.labelTarget&&l.labelTarget?!1:c.level<r(l).level});return p!==-1&&u!==-1&&u<p&&(p-=1),{index:p,parent:s}}}zu.$inject=["eventBus","canvas"],X(zu,ja);const Z1={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",zu]};function ro(){}ro.prototype.get=function(){return this._data},ro.prototype.set=function(e){this._data=e},ro.prototype.clear=function(){var e=this._data;return delete this._data,e},ro.prototype.isEmpty=function(){return!this._data};const Q1={clipboard:["type",ro]};var Oh=1500;function Ih(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),u=c&&e.get(c);c&&u&&(a.stopPropagation(),r.hover({element:u,gfx:c}),r.move(s))}}r&&t.on("drag.start",function(a){t.once("drag.move",Oh,function(s){o(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",Oh,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=Bi(a),c=document.elementFromPoint(s.x,s.y),J1(c)}}Ih.$inject=["elementRegistry","eventBus","injector"];function J1(e){return Mi(e,"svg, .djs-element",!0)}const eS={__init__:["hoverFix"],hoverFix:["type",Ih]};function tS(e){return!0}function Fa(e){return ci(e)||a1(e)}var Lh=500;function Bh(e,t,n){var i=this;function r(C,F,N){if(!s(C,F)){var I,W,re;N?W=t.getGraphics(N):(I=F.delegateTarget||F.target,I&&(W=I,N=t.get(W))),!(!W||!N)&&(re=e.fire(C,{element:N,gfx:W,originalEvent:F}),re===!1&&(F.stopPropagation(),F.preventDefault()))}}var o={};function a(C){return o[C]}function s(C,F){var N=u[C]||ci;return!N(F)}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"},u={"element.contextmenu":tS,"element.mousedown":Fa,"element.mouseup":Fa,"element.click":Fa,"element.dblclick":Fa};function p(C,F,N){var I=c[C];if(!I)throw new Error("unmapped DOM event name <"+C+">");return r(I,F,N)}var l="svg, .djs-element";function f(C,F,N,I){var W=o[N]=function(re){r(N,re)};I&&(u[N]=I),W.$delegate=Dt.bind(C,l,F,W)}function d(C,F,N){var I=a(N);I&&Dt.unbind(C,F,I.$delegate)}function h(C){A(c,function(F,N){f(C,N,F)})}function v(C){A(c,function(F,N){d(C,N,F)})}e.on("canvas.destroy",function(C){v(C.svg)}),e.on("canvas.init",function(C){h(C.svg)}),e.on(["shape.added","connection.added"],function(C){var F=C.element,N=C.gfx;e.fire("interactionEvents.createHit",{element:F,gfx:N})}),e.on(["shape.changed","connection.changed"],Lh,function(C){var F=C.element,N=C.gfx;e.fire("interactionEvents.updateHit",{element:F,gfx:N})}),e.on("interactionEvents.createHit",Lh,function(C){var F=C.element,N=C.gfx;i.createDefaultHit(F,N)}),e.on("interactionEvents.updateHit",function(C){var F=C.element,N=C.gfx;i.updateDefaultHit(F,N)});var _=R("djs-hit djs-hit-stroke"),S=R("djs-hit djs-hit-click-stroke"),w=R("djs-hit djs-hit-all"),E=R("djs-hit djs-hit-no-move"),b={all:w,"click-stroke":S,stroke:_,"no-move":E};function R(C,F){return F=D({stroke:"white",strokeWidth:15},F||{}),n.cls(C,["no-fill","no-border"],F)}function T(C,F){var N=b[F];if(!N)throw new Error("invalid hit type <"+F+">");return Z(C,N),C}function O(C,F){pe(C,F)}this.removeHits=function(C){var F=Zo(".djs-hit",C);A(F,tt)},this.createDefaultHit=function(C,F){var N=C.waypoints,I=C.isFrame,W;return N?this.createWaypointsHit(F,N):(W=I?"stroke":"all",this.createBoxHit(F,W,{width:C.width,height:C.height}))},this.createWaypointsHit=function(C,F){var N=jr(F);return T(N,"stroke"),O(C,N),N},this.createBoxHit=function(C,F,N){N=D({x:0,y:0},N);var I=te("rect");return T(I,F),Z(I,N),O(C,I),I},this.updateDefaultHit=function(C,F){var N=Ae(".djs-hit",F);if(N)return C.waypoints?Ac(N,C.waypoints):Z(N,{width:C.width,height:C.height}),N},this.fire=r,this.triggerMouseEvent=p,this.mouseHandler=a,this.registerEvent=f,this.unregisterEvent=d}Bh.$inject=["eventBus","elementRegistry","styles"];const Ha={__init__:["interactionEvents"],interactionEvents:["type",Bh]};function mr(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)})}mr.$inject=["eventBus","canvas"],mr.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()})}},mr.prototype.get=function(){return Array.from(this._selectedElements)},mr.prototype.isSelected=function(e){return this._selectedElements.has(e)},mr.prototype.select=function(e,t){var n=this.get();ae(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?A(e,o=>{this._selectedElements.add(o)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var Nh="hover",$h="selected";function jh(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,Nh)}),t.on("element.out",function(r){i(r.element,Nh)}),t.on("selection.changed",function(r){function o(u){i(u,$h)}function a(u){n(u,$h)}var s=new Set(r.oldSelection),c=new Set(r.newSelection);for(let u of s)c.has(u)||o(u);for(let u of c)s.has(u)||a(u)})}jh.$inject=["canvas","eventBus"];function Fh(e,t,n,i){e.on("create.end",500,function(r){var o=r.context,a=o.canExecute,s=o.elements,c=o.hints||{},u=c.autoSelect;if(a){if(u===!1)return;ae(u)?t.select(u):t.select(s.filter(nS))}}),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=Oe(o,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(r){if(ci(r)){var o=r.element;o===n.getRootElement()&&(o=null);var a=t.isSelected(o),s=t.get().length>1,c=Ia(r);if(a&&s)return c?t.deselect(o):t.select(o);a?t.deselect(o):t.select(o,c)}})}Fh.$inject=["eventBus","selection","canvas","elementRegistry"];function nS(e){return!e.hidden}const Zt={__init__:["selectionVisuals","selectionBehavior"],__depends__:[Ha],selection:["type",mr],selectionVisuals:["type",jh],selectionBehavior:["type",Fh]};var iS=/^djs-cursor-.*$/;function za(e){var t=Be(document.body);t.removeMatching(iS),e&&t.add("djs-cursor-"+e)}function Hh(){za(null)}var rS=5e3;function zh(e,t){t=t||"element.click";function n(){return!1}return e.once(t,rS,n),function(){e.off(t,n)}}var oS=["c","C"],aS=["v","V"],sS=["d","D"],cS=["x","X"],uS=["y","Y"],Vh=["z","Z"];function lS(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Lt(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function nt(e,t){return e=ae(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function Vu(e){return e.shiftKey}function pS(e){return Lt(e)&&nt(oS,e)}function fS(e){return Lt(e)&&nt(aS,e)}function dS(e){return Lt(e)&&nt(sS,e)}function hS(e){return Lt(e)&&nt(cS,e)}function mS(e){return Lt(e)&&!Vu(e)&&nt(Vh,e)}function gS(e){return Lt(e)&&(nt(uS,e)||nt(Vh,e)&&Vu(e))}var gr=Math.round,Gh="djs-drag-active";function $i(e){e.preventDefault()}function vS(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function yS(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Wh(e,t,n,i){var r={threshold:5,trapClick:!0},o;function a(E){var b=t.viewbox(),R=t._container.getBoundingClientRect();return{x:b.x+(E.x-R.left)/b.scale,y:b.y+(E.y-R.top)/b.scale}}function s(E,b){b=b||o;var R=e.createEvent(D({},b.payload,b.data,{isTouch:b.isTouch}));return e.fire("drag."+E,R)===!1?!1:e.fire(b.prefix+"."+E,R)}function c(E){var b=E.filter(function(R){return i.get(R.id)});b.length&&n.select(b)}function u(E,b){var R=o.payload,T=o.displacement,O=o.globalStart,C=Bi(E),F=an(C,O),N=o.localStart,I=a(C),W=an(I,N);if(!o.active&&(b||yS(F)>o.threshold)){if(D(R,{x:gr(N.x+T.x),y:gr(N.y+T.y),dx:0,dy:0},{originalEvent:E}),s("start")===!1)return _();o.active=!0,o.keepSelection||(R.previousSelection=n.get(),n.select(null)),o.cursor&&za(o.cursor),t.addMarker(t.getRootElement(),Gh)}xu(E),o.active&&(D(R,{x:gr(I.x+T.x),y:gr(I.y+T.y),dx:gr(W.x),dy:gr(W.y)},{originalEvent:E}),s("move"))}function p(E){var b,R=!0;o.active&&(E&&(o.payload.originalEvent=E,xu(E)),R=s("end")),R===!1&&s("rejected"),b=S(R!==!0),s("ended",b)}function l(E){nt("Escape",E)&&($i(E),_())}function f(E){var b;o.active&&(b=zh(e),setTimeout(b,400),$i(E)),p(E)}function d(E){u(E)}function h(E){var b=o.payload;b.hoverGfx=E.gfx,b.hover=E.element,s("hover")}function v(E){s("out");var b=o.payload;b.hoverGfx=null,b.hover=null}function _(E){var b;if(o){var R=o.active;R&&s("cancel"),b=S(E),R&&s("canceled",b)}}function S(E){var b,R;s("cleanup"),Hh(),o.trapClick?R=f:R=p,le.unbind(document,"mousemove",u),le.unbind(document,"dragstart",$i),le.unbind(document,"selectstart",$i),le.unbind(document,"mousedown",R,!0),le.unbind(document,"mouseup",R,!0),le.unbind(document,"keyup",l),le.unbind(document,"touchstart",d,!0),le.unbind(document,"touchcancel",_,!0),le.unbind(document,"touchmove",u,!0),le.unbind(document,"touchend",p,!0),e.off("element.hover",h),e.off("element.out",v),t.removeMarker(t.getRootElement(),Gh);var T=o.payload.previousSelection;return E!==!1&&T&&!n.get().length&&c(T),b=o,o=null,b}function w(E,b,R,T){o&&_(!1),typeof b=="string"&&(T=R,R=b,b=null),T=D({},r,T||{});var O=T.data||{},C,F,N,I,W;if(T.trapClick?I=f:I=p,E?(C=dr(E)||E,F=Bi(E),xu(E),C.type==="dragstart"&&$i(C)):(C=null,F={x:0,y:0}),N=a(F),b||(b=N),W=vS(C),o=D({prefix:R,data:O,payload:{},globalStart:F,displacement:an(b,N),localStart:N,isTouch:W},T),T.manual||(W?(le.bind(document,"touchstart",d,!0),le.bind(document,"touchcancel",_,!0),le.bind(document,"touchmove",u,!0),le.bind(document,"touchend",p,!0)):(le.bind(document,"mousemove",u),le.bind(document,"dragstart",$i),le.bind(document,"selectstart",$i),le.bind(document,"mousedown",I,!0),le.bind(document,"mouseup",I,!0)),le.bind(document,"keyup",l),e.on("element.hover",h),e.on("element.out",v)),s("init")===!1)return _(),!1;T.autoActivate&&u(E,!0)}e.on("diagram.destroy",_),this.init=w,this.move=u,this.hover=h,this.out=v,this.end=p,this.cancel=_,this.context=function(){return o},this.setOptions=function(E){D(r,E)}}Wh.$inject=["eventBus","canvas","selection","elementRegistry"];const $n={__depends__:[eS,Zt],dragging:["type",Wh]};function vr(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}vr.prototype.next=function(){return this._prefix+ ++this._counter};const _S=new vr("ps");var bS=["marker-start","marker-mid","marker-end"],ES=["circle","ellipse","line","path","polygon","polyline","path","rect"];function ui(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}ui.$inject=["elementRegistry","eventBus","canvas","styles"],ui.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")},ui.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},ui.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var r=rf(n);return this._cloneMarkers(Oi(r),i),Z(r,this._styles.cls(i,[])),pe(t,r),Z(r,"data-preview-support-element-id",e.id),r},ui.prototype.addFrame=function(e,t){var n=te("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return pe(t,n),Z(n,"data-preview-support-element-id",e.id),n},ui.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(r=>{i._cloneMarkers(r,t,n)}),RS(e)&&bS.forEach(function(r){if(Z(e,r)){var o=xS(e,r,i._canvas.getContainer());o&&i._cloneMarker(n,e,o,r,t)}})},ui.prototype._cloneMarker=function(e,t,n,i,r="djs-dragger"){var o=[n.id,r,_S.next()].join("-"),a=Ae("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||rf(n);s.id=o,xe(s).add(r);var c=Ae(":scope > defs",e);c||(c=te("defs"),pe(e,c)),pe(c,s);var u=SS(s.id);Z(t,i,u)};function xS(e,t,n){var i=wS(Z(e,t));return Ae("marker#"+i,n||document)}function wS(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function SS(e){return"url(#"+e+")"}function RS(e){return ES.indexOf(e.nodeName)!==-1}const yr={__init__:["previewSupport"],previewSupport:["type",ui]};var CS="drop-ok",Uh="drop-not-ok",qh="attach-ok",Yh="new-parent",Kh="create",PS=2e3;function Xh(e,t,n,i,r){function o(c,u,p,l,f){if(!u)return!1;c=ye(c,function(w){var E=w.labelTarget;return!w.parent&&!(he(w)&&c.indexOf(E)!==-1)});var d=Oe(c,function(w){return!Te(w)}),h=!1,v=!1,_=!1;Qh(c)&&(h=r.allowed("shape.attach",{position:p,shape:d,target:u})),h||(Qh(c)?_=r.allowed("shape.create",{position:p,shape:d,source:l,target:u}):_=r.allowed("elements.create",{elements:c,position:p,target:u}));var S=f.connectionTarget;return _||h?(d&&l&&(v=r.allowed("connection.create",{source:S===l?d:l,target:S===l?l:d,hints:{targetParent:u,targetAttach:h}})),{attach:h,connect:v}):_===null||h===null?null:!1}function a(c,u){[qh,CS,Uh,Yh].forEach(function(p){p===u?e.addMarker(c,p):e.removeMarker(c,p)})}n.on(["create.move","create.hover"],function(c){var u=c.context,p=u.elements,l=c.hover,f=u.source,d=u.hints||{};if(!l){u.canExecute=!1,u.target=null;return}Zh(c);var h={x:c.x,y:c.y},v=u.canExecute=l&&o(p,l,h,f,d);l&&v!==null&&(u.target=l,v&&v.attach?a(l,qh):a(l,v?Yh:Uh))}),n.on(["create.end","create.out","create.cleanup"],function(c){var u=c.hover;u&&a(u,null)}),n.on("create.end",function(c){var u=c.context,p=u.source,l=u.shape,f=u.elements,d=u.target,h=u.canExecute,v=h&&h.attach,_=h&&h.connect,S=u.hints||{};if(h===!1||!d)return!1;Zh(c);var w={x:c.x,y:c.y};_?l=i.appendShape(p,l,w,d,{attach:v,connection:_===!0?{}:_,connectionTarget:S.connectionTarget}):(f=i.createElements(f,w,d,D({},S,{attach:v})),l=Oe(f,function(E){return!Te(E)})),D(u,{elements:f,shape:l}),D(c,{elements:f,shape:l})});function s(){var c=t.context();c&&c.prefix===Kh&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],PS,function(){n.off("elements.changed",s)})}),this.start=function(c,u,p){ae(u)||(u=[u]);var l=Oe(u,function(h){return!Te(h)});if(l){p=D({elements:u,hints:{},shape:l},p||{}),A(u,function(h){ue(h.x)||(h.x=0),ue(h.y)||(h.y=0)});var f=ye(u,function(h){return!h.hidden}),d=Ue(f);A(u,function(h){Te(h)&&(h.waypoints=vt(h.waypoints,function(v){return{x:v.x-d.x-d.width/2,y:v.y-d.y-d.height/2}})),D(h,{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2})}),t.init(c,Kh,{cursor:"grabbing",autoActivate:!0,data:{shape:l,elements:u,context:p}})}}}Xh.$inject=["canvas","dragging","eventBus","modeling","rules"];function Zh(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 Qh(e){return e&&e.length===1&&!Te(e[0])}var AS=750;function Jh(e,t,n,i,r){function o(a){var s=te("g");Z(s,r.cls("djs-drag-group",["no-events"]));var c=te("g");return a.forEach(function(u){var p;u.hidden||(u.waypoints?(p=n._createContainer("connection",c),n.drawConnection(Oi(p),u)):(p=n._createContainer("shape",c),n.drawShape(Oi(p),u),lt(p,u.x,u.y)),i.addDragger(u,s,p))}),s}t.on("create.move",AS,function(a){var s=a.hover,c=a.context,u=c.elements,p=c.dragGroup;p||(p=c.dragGroup=o(u));var l;s?(p.parentNode||(l=e.getActiveLayer(),pe(l,p)),lt(p,a.x,a.y)):tt(p)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&tt(c)})}Jh.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const Va={__depends__:[$n,yr,En,Zt],__init__:["create","createPreview"],create:["type",Xh],createPreview:["type",Jh]};function Gu(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)})}Gu.$inject=["eventBus"],Gu.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||TS(0,0)};function TS(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 oo={__init__:["mouse"],mouse:["type",Gu]};var em=2e3;function Bt(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 u=c.descriptor,p=c.element,l=c.elementsSet;u.priority=1,u.id=p.id,l.has(p.parent)&&(u.parent=p.parent.id),MS(p)&&(u.priority=2,u.host=p.host.id),Te(p)&&(u.priority=3,u.source=p.source.id,u.target=p.target.id,u.waypoints=kS(p)),he(p)&&(u.priority=4,u.labelTarget=p.labelTarget.id),A(["x","y","width","height"],function(f){ue(p[f])&&(u[f]=p[f])}),u.hidden=p.hidden,u.collapsed=p.collapsed}),r.on("copyPaste.elementsCopied",em,function(c){var u;((u=c.hints)==null?void 0:u.clip)!==!1&&n.set(c.tree)}),r.on("copyPaste.pasteElements",em,function(c){c.tree||(c.tree=n.get())}),r.on("copyPaste.pasteElements",function(c){var u=c.hints;D(u,{createElementsBehavior:!1})})}Bt.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],Bt.prototype.copy=function(e,t={}){var n,i;return ae(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(ae(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},Bt.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})}}},Bt.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},Bt.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},Bt.prototype._getElementIdsFromTree=function(e){var t={};return A(e,function(n){A(n,function(i){i.id&&(t[i.id]=!0)})}),t},Bt.prototype._paste=function(e,t,n,i){A(e,function(o){ue(o.x)||(o.x=0),ue(o.y)||(o.y=0)});var r=Ue(e);return A(e,function(o){Te(o)&&(o.waypoints=vt(o.waypoints,function(a){return{x:a.x-r.x-r.width/2,y:a.y-r.y-r.height/2}})),D(o,{x:o.x-r.x-r.width/2,y:o.y-r.y-r.height/2})}),this._modeling.createElements(e,n,t,D({},i))},Bt.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return A(e,function(o,a){o=ln(o,"priority"),A(o,function(s){var c=D({},pn(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var u;if(Te(c)){c.source=i[s.source],c.target=i[s.target],u=i[s.id]=t.createConnection(c),r.push(u);return}if(he(c)){c.labelTarget=i[c.labelTarget],u=i[s.id]=t.createLabel(c),r.push(u);return}c.host&&(c.host=i[c.host]),u=i[s.id]=t.createShape(c),r.push(u)})}),r},Bt.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(pn(e,["id"]));return t},Bt.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(pn(e,["id"]));return t},Bt.prototype.createShape=function(e){var t=this._elementFactory.createShape(pn(e,["id"]));return t},Bt.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(Te(e)&&(!n.has(e.source)||!n.has(e.target))||he(e)&&!n.has(e.labelTarget))},Bt.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[],o=new Map,a=ta(e);function s(l,f){return t.allowed("element.copy",{element:l,elements:f})}function c(l,f){var d=o.get(l);if(!d){var h={element:l,depth:f};r.push(h),o.set(l,h);return}if(d.depth<f){r=u(d,r);var v={element:d.element,depth:f};r.push(v),o.set(l,v)}}function u(l,f){var d=f.indexOf(l);return d!==-1&&f.splice(d,1),f}Di(a,function(l,f,d){if(he(l))return;A(l.labels,function(_){c(_,d)});function h(_){_&&_.length&&A(_,function(S){A(S.labels,function(w){c(w,d)}),c(S,d)})}A([l.attachers,l.incoming,l.outgoing],h),c(l,d);var v=[];return l.children&&(v=l.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:l,children:v}),v}),e=vt(r,function(l){return l.element});var p=new Set(e);return r=vt(r,function(l){return l.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:l.descriptor,element:l.element,elements:e,elementsSet:p}),l}),r=ln(r,function(l){return l.descriptor.priority}),e=vt(r,function(l){return l.element}),A(r,function(l){var f=l.depth;if(!n.hasRelations(l.element,e,p)){nm(l.element,e),p.delete(l.element);return}if(!s(l.element,e)){nm(l.element,e),p.delete(l.element);return}i[f]||(i[f]=[]),i[f].push(l.descriptor)}),i};function MS(e){return!!e.host}function kS(e){return vt(e.waypoints,function(t){return t=tm(t),t.original&&(t.original=tm(t.original)),t})}function tm(e){return D({},e)}function nm(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const DS={__depends__:[Q1,Va,oo,En],__init__:["copyPaste"],copyPaste:["type",Bt]};function Wu(e,t,n){ae(n)||(n=[n]),A(n,function(i){Ri(e[i])||(t[i]=e[i])})}var Uu=750;function im(e,t,n){function i(c,u){var p=e.create(c.$type);return n.copyElement(c,p,null,u)}t.on("copyPaste.copyElement",Uu,function(c){var u=c.descriptor,p=c.element,l=G(p);if(he(p))return u;var f=u.businessObject=i(l,!0),d=u.di=i(we(p),!0);d.bpmnElement=f,Wu(f,u,"name"),Wu(d,u,"isExpanded"),l.default&&(u.default=l.default.id)});var r="-bpmn-js-refs";function o(c){return c[r]=c[r]||{}}function a(c,u){c[r]=u}function s(c,u,p){var l=G(c);return c.default&&(p[c.default]={element:l,property:"default"}),c.host&&(G(c).attachedToRef=G(u[c.host])),pn(p,kt(p,function(f,d,h){var v=d.element,_=d.property;return h===c.id&&(v.set(_,l),f.push(c.id)),f},[]))}t.on("copyPaste.pasteElement",function(c){var u=c.cache,p=c.descriptor,l=p.businessObject,f=p.di;if(he(p)){p.businessObject=G(u[p.labelTarget]),p.di=we(u[p.labelTarget]);return}l=p.businessObject=i(l),f=p.di=i(f),f.bpmnElement=l,Wu(p,l,["isExpanded","name"]),p.type=l.$type}),t.on("copyPaste.copyElement",Uu,function(c){var u=c.descriptor,p=c.element;if(y(p,"bpmn:Participant")){var l=G(p);l.processRef&&(u.processRef=i(l.processRef,!0))}}),t.on("copyPaste.pasteElement",function(c){var u=c.descriptor,p=u.processRef;p&&(u.processRef=i(p))}),t.on("copyPaste.createTree",function(c){var u=c.element,p=c.children;y(u,"bpmn:SubProcess")&&A(Ur(p),l=>{p.push(l.annotation)})}),t.on("copyPaste.pasteElement",Uu,function(c){var u=c.cache,p=c.descriptor;a(u,s(p,u,o(u)))})}im.$inject=["bpmnFactory","eventBus","moddleCopy"];const OS=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],IS=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function ao(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 ln(r,o=>o==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:r,property:o,propertyName:a}=i,s=rt(r)&&r.$descriptor;if(a&&IS.includes(a))return o;if(a&&OS.includes(a)||a&&s&&!Oe(s.properties,Zi({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",i=>{const{property:r}=i;if(y(r,"bpmn:ExtensionElements")&&(!r.values||!r.values.length))return!1})}ao.$inject=["eventBus","bpmnFactory","moddle"],ao.prototype.copyElement=function(e,t,n,i=!1){n&&!ae(n)&&(n=[n]),n=n||qu(e.$descriptor);const r=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return r===!1||(ae(r)&&(n=r),A(n,o=>{let a;Mt(e,o)&&(a=e.get(o));const s=this.copyProperty(a,t,o,i);!Je(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:o})===!1||t.set(o,s)})),t},ao.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 rt(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):ae(e)?kt(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):rt(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},ao.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 qu(e,t){return kt(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const rm={__depends__:[DS],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",im],moddleCopy:["type",ao]};var om=Math.round;function Yu(e,t){this._modeling=e,this._eventBus=t}Yu.$inject=["modeling","eventBus"],Yu.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,u=om(s+o/2),p=om(c+a/2),l=i.replaceShape(e,D({},t,{x:u,y:p,width:o,height:a}),n);return r.fire("replace.end",{element:e,newElement:l,hints:n}),l};function am(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:r={}}=n;r.select!==!1&&e.select(i)})}am.$inject=["selection","eventBus"];const LS={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",am],replace:["type",Yu]};function BS(e,t,n){ae(n)||(n=[n]),A(n,function(i){Ri(e[i])||(t[i]=e[i])})}var NS=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function $S(e,t){var n=e&&Mt(e,"collapsed")?e.collapsed:!Ee(e),i;return t&&(Mt(t,"collapsed")||Mt(t,"isExpanded"))?i=Mt(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function sm(e,t,n,i,r,o){function a(s,c,u){u=u||{};var p=c.type,l=s.businessObject;if(Ga(l)&&(p==="bpmn:SubProcess"||p==="bpmn:AdHocSubProcess")&&$S(s,c))return i.toggleCollapse(s),s;var f=e.create(p),d={type:p,businessObject:f};d.di={},p==="bpmn:ExclusiveGateway"&&(d.di.isMarkerVisible=!0),BS(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var h=qu(l.$descriptor),v=qu(f.$descriptor,!0),_=jS(h,v);D(f,on(c,NS));var S=ye(_,function(b){return b==="eventDefinitions"?cm(s,c.eventDefinitionType):b==="loopCharacteristics"?!Et(f):Mt(f,b)||b==="processRef"&&c.isExpanded===!1||b==="triggeredByEvent"?!1:b==="isForCompensation"?!Et(f):!0});if(f=n.copyElement(l,f,S),c.eventDefinitionType&&(cm(f,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),y(l,"bpmn:Activity")){if(Ga(l))d.isExpanded=Ee(s);else if(c&&Mt(c,"isExpanded")){d.isExpanded=c.isExpanded;var w=t.getDefaultSize(f,{isExpanded:d.isExpanded});d.width=w.width,d.height=w.height,d.x=s.x-(d.width-s.width)/2,d.y=s.y-(d.height-s.height)/2}Ee(s)&&!y(l,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(Ga(l)&&!Ga(f)&&(u.moveChildren=!1),y(l,"bpmn:Participant")){c.isExpanded===!0?f.processRef=e.create("bpmn:Process"):u.moveChildren=!1;var E=at(s);we(s).isHorizontal||(we(d).isHorizontal=E),d.width=E?s.width:t.getDefaultSize(d).width,d.height=E?t.getDefaultSize(d).height:s.height}return o.allowed("shape.resize",{shape:f})||(d.height=t.getDefaultSize(d).height,d.width=t.getDefaultSize(d).width),f.name=l.name,ge(l,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&ge(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(f.default=l.default),c.host&&!y(l,"bpmn:BoundaryEvent")&&y(f,"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,{...u,targetElement:c})}this.replaceElement=a}sm.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function Ga(e){return y(e,"bpmn:SubProcess")}function cm(e,t){var n=G(e);return t&&n.get("eventDefinitions").some(function(i){return y(i,t)})}function jS(e,t){return e.filter(function(n){return t.includes(n)})}const um={__depends__:[rm,LS,Zt],bpmnReplace:["type",sm]};var FS=250;function ji(e){this._eventBus=e,this._tools=[],this._active=null}ji.$inject=["eventBus"],ji.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)},ji.prototype.isActive=function(e){return e&&this._active===e},ji.prototype.length=function(e){return this._tools.length},ji.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},ji.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),A(t,function(r){i.push(r+".ended"),i.push(r+".canceled")}),n.on(i,FS,function(r){this._active&&(HS(r)||this.setActive(null))},this)};function HS(e){var t=e.originalEvent&&e.originalEvent.target;return t&&Mi(t,'.group[data-group="tools"]')}const Wa={__depends__:[$n],__init__:["toolManager"],toolManager:["type",ji]};function zS(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 VS(e,t){var n=[],i=new Set(e);A(t,function(o){i.add(o)});var r=new Set;return i.forEach(function(o){var a=o.incoming,s=o.outgoing;A(a.concat(s),function(c){var u=c.source,p=c.target;(i.has(u)||i.has(p))&&(r.has(c)||(r.add(c),n.push(c)))})}),n}function GS(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 Ku=Math.abs,WS=Math.round,jn={x:"width",y:"height"},lm="crosshair",li={n:"top",w:"left",s:"bottom",e:"right"},US=1500,Ua={n:"s",w:"e",s:"n",e:"w"},qa=20;function Qt(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",US,function(c){var u=c.context,p=u.initialized;p||(p=u.initialized=s.init(c,u)),p&&fm(c)}),n.on("spaceTool.end",function(c){var u=c.context,p=u.axis,l=u.direction,f=u.movingShapes,d=u.resizingShapes,h=u.start;if(u.initialized){fm(c);var v={x:0,y:0};v[p]=WS(c["d"+p]),s.makeSpace(f,d,v,l,h),n.once("spaceTool.ended",function(_){s.activateSelection(_.originalEvent,!0,!0)})}})}Qt.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Qt.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:lm,data:{context:{reactivate:n}},trapClick:!1})},Qt.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:lm,data:{context:{}}})},Qt.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},Qt.prototype.init=function(e,t){var n=Ku(e.dx)>Ku(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(Ku(i)<5)return!1;i<0&&(i*=-1),no(e)&&(i*=-1);var o=zS(n,i),a=this._canvas.getRootElement();!Ia(e)&&e.hover&&(a=e.hover);var s=[...Fr(a),...a.attachers||[]],c=this.calculateAdjustments(s,n,i,r),u=this._eventBus.fire("spaceTool.getMinDimensions",{axis:n,direction:o,shapes:c.resizingShapes,start:r}),p=qS(c,n,o,r,u);return D(t,c,{axis:n,direction:o,spaceToolConstraints:p,start:r}),za("resize-"+(n==="x"?"ew":"ns")),!0},Qt.prototype.calculateAdjustments=function(e,t,n,i){var r=this._rules,o=[],a=[],s=new Set,c=new Set,u=[],p=[];function l(d){s.has(d)||(s.add(d),o.push(d));var h=d.label;h&&!s.has(h)&&(s.add(h),o.push(h))}function f(d){c.has(d)||(c.add(d),a.push(d))}return A(e,function(d){if(!(!d.parent||he(d))){if(Te(d)){p.push(d);return}var h=d[t],v=h+d[jn[t]];if(YS(d)&&(n>0&&se(d)[t]>i||n<0&&se(d)[t]<i)){u.push(d);return}if(n>0&&h>i||n<0&&v<i){l(d);return}if(h<i&&v>i&&r.allowed("shape.resize",{shape:d})){f(d);return}}}),A(o,function(d){var h=d.attachers;h&&A(h,function(v){l(v)})}),A(u,function(d){var h=d.host;(s.has(h)||c.has(h))&&l(d)}),A(p,function(d){var h=d.source,v=d.target,_=d.label;(s.has(h)||c.has(h))&&(s.has(v)||c.has(v))&&_&&l(_)}),{movingShapes:o,resizingShapes:a}},Qt.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Qt.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function pm(e){return{top:e.top-qa,right:e.right+qa,bottom:e.bottom+qa,left:e.left-qa}}function fm(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,r;ue(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),ue(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),ue(n.top)&&(r=Math.max(e.y,n.top),e.dy=e.dy+r-e.y,e.y=r),ue(n.bottom)&&(r=Math.min(e.y,n.bottom),e.dy=e.dy+r-e.y,e.y=r)}}function qS(e,t,n,i,r){var o=e.movingShapes,a=e.resizingShapes;if(a.length){var s={},c,u,p=new Set(o),l=new Set(a);return A(a,function(f){var d=f.attachers,h=f.children,v=ie(f),_=ye(h,function(W){return!Te(W)&&!he(W)&&!p.has(W)&&!l.has(W)}),S=ye(h,function(W){return!Te(W)&&!he(W)&&p.has(W)}),w,E,b,R=[],T=[],O,C,F,N;_.length&&(E=pm(ie(Ue(_))),w=i-v[li[n]]+E[li[n]],n==="n"?s.bottom=u=ue(u)?Math.min(u,w):w:n==="w"?s.right=u=ue(u)?Math.min(u,w):w:n==="s"?s.top=c=ue(c)?Math.max(c,w):w:n==="e"&&(s.left=c=ue(c)?Math.max(c,w):w)),S.length&&(b=pm(ie(Ue(S))),w=i-b[li[Ua[n]]]+v[li[Ua[n]]],n==="n"?s.bottom=u=ue(u)?Math.min(u,w):w:n==="w"?s.right=u=ue(u)?Math.min(u,w):w:n==="s"?s.top=c=ue(c)?Math.max(c,w):w:n==="e"&&(s.left=c=ue(c)?Math.max(c,w):w)),d&&d.length&&(d.forEach(function(W){p.has(W)?R.push(W):T.push(W)}),R.length&&(O=ie(Ue(R.map(se))),C=v[li[Ua[n]]]-(O[li[Ua[n]]]-i)),T.length&&(F=ie(Ue(T.map(se))),N=F[li[n]]-(v[li[n]]-i)),n==="n"?(w=Math.min(C||1/0,N||1/0),s.bottom=u=ue(u)?Math.min(u,w):w):n==="w"?(w=Math.min(C||1/0,N||1/0),s.right=u=ue(u)?Math.min(u,w):w):n==="s"?(w=Math.max(C||-1/0,N||-1/0),s.top=c=ue(c)?Math.max(c,w):w):n==="e"&&(w=Math.max(C||-1/0,N||-1/0),s.left=c=ue(c)?Math.max(c,w):w));var I=r&&r[f.id];I&&(n==="n"?(w=i+f[jn[t]]-I[jn[t]],s.bottom=u=ue(u)?Math.min(u,w):w):n==="w"?(w=i+f[jn[t]]-I[jn[t]],s.right=u=ue(u)?Math.min(u,w):w):n==="s"?(w=i-f[jn[t]]+I[jn[t]],s.top=c=ue(c)?Math.max(c,w):w):n==="e"&&(w=i-f[jn[t]]+I[jn[t]],s.left=c=ue(c)?Math.max(c,w):w))}),s}}function YS(e){return!!e.host}var Xu="djs-dragging",dm="djs-resizing",KS=250,Ya=Math.max;function hm(e,t,n,i,r){function o(a,s){A(a,function(c){r.addDragger(c,s),n.addMarker(c,Xu)})}e.on("spaceTool.selection.start",function(a){var s=n.getLayer("space"),c=a.context,u={x:"M 0,-10000 L 0,10000",y:"M -10000,0 L 10000,0"},p=te("g");Z(p,i.cls("djs-crosshair-group",["no-events"])),pe(s,p);var l=te("path");Z(l,"d",u.x),xe(l).add("djs-crosshair"),pe(p,l);var f=te("path");Z(f,"d",u.y),xe(f).add("djs-crosshair"),pe(p,f),c.crosshairGroup=p}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;lt(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&tt(c)}),e.on("spaceTool.move",KS,function(a){var s=a.context,c=s.line,u=s.axis,p=s.movingShapes,l=s.resizingShapes;if(s.initialized){if(!s.dragGroup){var f=n.getLayer("space");c=te("path"),Z(c,"d","M0,0 L0,0"),xe(c).add("djs-crosshair"),pe(f,c),s.line=c;var d=te("g");Z(d,i.cls("djs-drag-group",["no-events"])),pe(n.getActiveLayer(),d),o(p,d);var h=new Set(p);A(l,function(T){h.add(T)});var v=new Set,_=s.movingConnections=[];h.forEach(function(T){A(T.outgoing,function(O){v.has(O)||!Te(O)||!h.has(O.target)||(v.add(O),_.push(O))})}),o(_,d),s.dragGroup=d}if(!s.frameGroup){var S=te("g");Z(S,i.cls("djs-frame-group",["no-events"])),pe(n.getActiveLayer(),S);var w=[];A(l,function(T){var O=r.addFrame(T,S),C=O.getBBox();w.push({element:O,initialBounds:C}),n.addMarker(T,dm)}),s.frameGroup=S,s.frames=w}var E={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};Z(c,{d:E[u]});var b={x:"y",y:"x"},R={x:a.dx,y:a.dy};R[b[s.axis]]=0,lt(s.dragGroup,R.x,R.y),A(s.frames,function(T){var O=T.element,C=T.initialBounds,F,N;s.direction==="e"?Z(O,{width:Ya(C.width+R.x,5)}):(F=Ya(C.width-R.x,5),Z(O,{width:F,x:C.x+C.width-F})),s.direction==="s"?Z(O,{height:Ya(C.height+R.y,5)}):(N=Ya(C.height-R.y,5),Z(O,{height:N,y:C.y+C.height-N}))})}}),e.on("spaceTool.cleanup",function(a){var s=a.context,c=s.movingShapes,u=s.movingConnections,p=s.resizingShapes,l=s.line,f=s.dragGroup,d=s.frameGroup;A(c,function(h){n.removeMarker(h,Xu)}),A(u,function(h){n.removeMarker(h,Xu)}),f&&(tt(l),tt(f)),A(p,function(h){n.removeMarker(h,dm)}),d&&tt(d)})}hm.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const XS={__init__:["spaceToolPreview"],__depends__:[$n,En,Wa,yr,oo],spaceTool:["type",Qt],spaceToolPreview:["type",hm]};function Ka(e,t){e.invoke(Qt,this),this._canvas=t}Ka.$inject=["injector","canvas"],X(Ka,Qt),Ka.prototype.calculateAdjustments=function(e,t,n,i){var r=this._canvas.getRootElement(),o=e[0]===r?null:e[0],a=[];o&&(a=Ki(er(r.children.filter(u=>y(u,"bpmn:Artifact")),Ue(o))));const s=[...e,...a];var c=Qt.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(u){return!(y(u,"bpmn:TextAnnotation")||ZS(u)&&(t==="y"&&at(u)||t==="x"&&!at(u)))}),c};function ZS(e){return y(e,"bpmn:Participant")&&!G(e).processRef}const mm={__depends__:[XS],spaceTool:["type",Ka]};function je(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)}je.$inject=["eventBus","injector"],je.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()},je.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},je.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},je.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()}},je.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()}},je.prototype.register=function(e,t){this._setHandler(e,t)},je.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)},je.prototype.canUndo=function(){return!!this._getUndoAction()},je.prototype.canRedo=function(){return!!this._getRedoAction()},je.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},je.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},je.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)})},je.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},je.prototype._createId=function(){return this._uid++},je.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},je.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()},je.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)},je.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:Sp("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},je.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=ae(e)?e:[e],t.dirty=t.dirty.concat(e))},je.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},je.prototype._revertedAction=function(e){this._stackIdx--},je.prototype._getHandler=function(e){return this._handlerMap[e]},je.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 QS={commandStack:["type",je]};function pi(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 JS=250,gm=1400;function Zu(e,t,n){V.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",gm,function(r){var o=r.context,a=o.shapes,s=o.validatedShapes;o.shapes=vm(a),o.validatedShapes=vm(s)}),i&&t.on("shape.move.start",JS,function(r){var o=r.context,a=new Set(o.shapes),s=new Set;for(const c of a)for(const u of c.labels)!u.hidden&&!a.has(u)&&s.add(u),c.labelTarget&&s.add(c);for(const c of s)i.makeDraggable(o,c,!0)}),this.preExecuted("elements.move",gm,function(r){var o=r.context,a=o.closure,s=a.enclosedElements,c=[];A(s,function(u){A(u.labels,function(p){s[p.id]||c.push(p)})}),a.addAll(c)}),this.preExecute(["connection.delete","shape.delete"],function(r){var o=r.context,a=o.connection||o.shape;pi(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=Mc(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&&(Ge(s.labels,a,c),a.labelTarget=s)})}X(Zu,V),Zu.$inject=["injector","eventBus","modeling"];function vm(e){var t=new Set(e);return ye(e,function(n){return!t.has(n.labelTarget)})}const eR={__init__:["labelSupport"],labelSupport:["type",Zu]};var tR=251,ym=1401,_m="attach-ok";function Qu(e,t,n,i,r){V.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",ym,function(a){var s=a.context,c=s.shapes,u=s.validatedShapes;s.shapes=nR(c),s.validatedShapes=iR(u)}),o&&t.on("shape.move.start",tR,function(a){var s=a.context,c=s.shapes,u=Ju(c);A(u,function(p){o.makeDraggable(s,p,!0),A(p.labels,function(l){o.makeDraggable(s,l,!0)})})}),o&&t.on("shape.move.start",function(a){var s=a.context,c=s.shapes;if(c.length===1){var u=c[0],p=u.host;p&&(n.addMarker(p,_m),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(p,_m)}))}}),this.preExecuted("elements.move",ym,function(a){var s=a.context,c=s.closure,u=s.shapes,p=Ju(u);A(p,function(l){c.add(l,c.topLevel[l.host.id])})}),this.postExecuted("elements.move",function(a){var s=a.context,c=s.shapes,u=s.newHost,p;u&&c.length!==1||(u?p=c:p=ye(c,function(l){var f=l.host;return rR(l)&&!oR(c,f)}),A(p,function(l){r.updateAttachment(l,u)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;A(s,function(c){A(c.attachers,function(u){A(u.outgoing.slice(),function(p){var l=i.allowed("connection.reconnect",{connection:p,source:p.source,target:p.target});l||r.removeConnection(p)}),A(u.incoming.slice(),function(p){var l=i.allowed("connection.reconnect",{connection:p,source:p.source,target:p.target});l||r.removeConnection(p)})})})}),this.postExecute("shape.create",function(a){var s=a.context,c=s.shape,u=s.host;u&&r.updateAttachment(c,u)}),this.postExecute("shape.replace",function(a){var s=a.context,c=s.oldShape,u=s.newShape;pi(c.attachers,function(p){var l=i.allowed("elements.move",{target:u,shapes:[p]});l==="attach"?r.updateAttachment(p,u):r.removeShape(p)}),u.attachers.length&&A(u.attachers,function(p){var l=Nd(p,c,u);r.moveShape(p,l,p.parent)})}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.oldBounds,p=s.newBounds,l=c.attachers,f=s.hints||{};f.attachSupport!==!1&&A(l,function(d){var h=Nd(d,u,p);r.moveShape(d,h,d.parent),A(d.labels,function(v){r.moveShape(v,h,v.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;pi(s.attachers,function(c){r.removeShape(c)}),s.host&&r.updateAttachment(s,null)})}X(Qu,V),Qu.$inject=["injector","eventBus","canvas","rules","modeling"];function Ju(e){return nc(vt(e,function(t){return t.attachers||[]}))}function nR(e){var t=Ju(e);return P_("id",e,t)}function iR(e){var t=Xi(e,"id");return ye(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function rR(e){return!!e.host}function oR(e,t){return e.indexOf(t)!==-1}const aR={__depends__:[En],__init__:["attachSupport"],attachSupport:["type",Qu]};function bm(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(ff(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)})}bm.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const el={__init__:["changeSupport"],changeSupport:["type",bm]};function Jt(e){this._model=e}Jt.$inject=["moddle"],Jt.prototype._needsId=function(e){return ge(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"])},Jt.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;y(e,"bpmn:Activity")?t="Activity":y(e,"bpmn:Event")?t="Event":y(e,"bpmn:Gateway")?t="Gateway":ge(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))},Jt.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},Jt.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},Jt.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",D({bpmnElement:e,bounds:this.createDiBounds()},t))},Jt.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},Jt.prototype.createDiWaypoints=function(e){var t=this;return vt(e,function(n){return t.createDiWaypoint(n)})},Jt.prototype.createDiWaypoint=function(e){return this.create("dc:Point",on(e,["x","y"]))},Jt.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",D({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},Jt.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",D({bpmnElement:e},t))};function Nt(e,t,n){V.call(this,e),this._bpmnFactory=t;var i=this;function r(d){var h=d.context,v=h.hints||{},_;!h.cropped&&v.createElementsBehavior!==!1&&(_=h.connection,_.waypoints=n.getCroppedWaypoints(_),h.cropped=!0)}this.executed(["connection.layout","connection.create"],r),this.reverted(["connection.layout"],function(d){delete d.context.cropped});function o(d){var h=d.context;i.updateParent(h.shape||h.connection,h.oldParent)}function a(d){var h=d.context,v=h.shape||h.connection,_=h.parent||h.newParent;i.updateParent(v,_)}this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],$t(o)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],$t(a));function s(d){var h=d.context,v=h.oldRoot,_=v.children;A(_,function(S){y(S,"bpmn:BaseElement")&&i.updateParent(S)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(d){var h=d.context.shape;y(h,"bpmn:BaseElement")&&i.updateBounds(h)}this.executed(["shape.move","shape.create","shape.resize"],$t(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],$t(function(d){d.context.shape.type!=="label"&&c(d)})),e.on("shape.changed",function(d){d.element.type==="label"&&c({context:{shape:d.element}})});function u(d){i.updateConnection(d.context)}this.executed(["connection.create","connection.move","connection.delete","connection.reconnect"],$t(u)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],$t(u));function p(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],$t(p)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],$t(p)),this.executed("connection.reconnect",$t(function(d){var h=d.context,v=h.connection,_=h.oldSource,S=h.newSource,w=G(v),E=G(_),b=G(S);w.conditionExpression&&!ge(b,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(h.oldConditionExpression=w.conditionExpression,delete w.conditionExpression),_!==S&&E.default===w&&(h.oldDefault=E.default,delete E.default)})),this.reverted("connection.reconnect",$t(function(d){var h=d.context,v=h.connection,_=h.oldSource,S=h.newSource,w=G(v),E=G(_),b=G(S);h.oldConditionExpression&&(w.conditionExpression=h.oldConditionExpression),h.oldDefault&&(E.default=h.oldDefault,delete b.default)}));function l(d){i.updateAttachment(d.context)}this.executed(["element.updateAttachment"],$t(l)),this.reverted(["element.updateAttachment"],$t(l)),this.executed("element.updateLabel",$t(f)),this.reverted("element.updateLabel",$t(f));function f(d){const{element:h}=d.context,v=Vt(h),_=we(h),S=_&&_.get("label");ri(h)||La(h)||(v&&!S?_.set("label",t.create("bpmndi:BPMNLabel")):!v&&S&&_.set("label",void 0))}}X(Nt,V),Nt.$inject=["eventBus","bpmnFactory","connectionDocking"],Nt.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},Nt.prototype.updateParent=function(e,t){if(!he(e)&&!(y(e,"bpmn:DataStoreReference")&&e.parent&&y(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=we(e),o=n&&n.businessObject,a=we(n);y(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,o,t&&t.businessObject),y(e,"bpmn:DataOutputAssociation")&&(e.source?o=e.source.businessObject:o=null),y(e,"bpmn:DataInputAssociation")&&(e.target?o=e.target.businessObject:o=null),this.updateSemanticParent(i,o),y(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,o),this.updateDiParent(r,a)}},Nt.prototype.updateBounds=function(e){var t=we(e),n=cR(e);if(n){var i=an(n,t.get("bounds"));D(n,{x:e.x+i.x,y:e.y+i.y})}var r=he(e)?this._getLabel(t):t,o=r.bounds;o||(o=this._bpmnFactory.createDiBounds(),r.set("bounds",o)),D(o,{x:e.x,y:e.y,width:e.width,height:e.height})},Nt.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,r;y(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),ze(i,e)),y(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),Ge(r,e))}},Nt.prototype.updateDiConnection=function(e,t,n){var i=we(e),r=we(t),o=we(n);i.sourceElement&&i.sourceElement.bpmnElement!==G(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==G(n)&&(i.targetElement=n&&o)},Nt.prototype.updateDiParent=function(e,t){if(t&&!y(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(ze(n,e),e.$parent=null)}};function sR(e){for(;e&&!y(e,"bpmn:Definitions");)e=e.$parent;return e}Nt.prototype.getLaneSet=function(e){var t,n;return y(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(y(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)},Nt.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&!((y(e,"bpmn:DataInput")||y(e,"bpmn:DataOutput"))&&(y(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(y(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(y(e,"bpmn:FlowElement")){if(t){if(y(t,"bpmn:Participant"))t=t.processRef;else if(y(t,"bpmn:Lane"))do t=t.$parent.$parent;while(y(t,"bpmn:Lane"))}i="flowElements"}else if(y(e,"bpmn:Artifact")){for(;t&&!y(t,"bpmn:Process")&&!y(t,"bpmn:SubProcess")&&!y(t,"bpmn:Collaboration");)if(y(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;i="artifacts"}else if(y(e,"bpmn:MessageFlow"))i="messageFlows";else if(y(e,"bpmn:Participant")){i="participants";var r=e.processRef,o;r&&(o=sR(e.$parent||t),e.$parent&&(ze(o.get("rootElements"),r),r.$parent=null),t&&(Ge(o.get("rootElements"),r),r.$parent=o))}else y(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":y(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),ze(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);ze(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},Nt.prototype.updateConnectionWaypoints=function(e){var t=we(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},Nt.prototype.updateConnection=function(e){var t=e.connection,n=G(t),i=t.source,r=G(i),o=t.target,a=G(t.target),s;if(y(n,"bpmn:DataAssociation"))y(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=r,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):y(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||r,this.updateSemanticParent(n,r,s),n.targetRef=a);else{var c=y(n,"bpmn:SequenceFlow");n.sourceRef!==r&&(c&&(ze(n.sourceRef&&n.sourceRef.get("outgoing"),n),r&&r.get("outgoing")&&r.get("outgoing").push(n)),n.sourceRef=r),n.targetRef!==a&&(c&&(ze(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)},Nt.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function $t(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;y(i,"bpmn:BaseElement")&&e(t)}}function cR(e){if(y(e,"bpmn:Activity")){var t=we(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function fi(e,t){In.call(this),this._bpmnFactory=e,this._moddle=t}X(fi,In),fi.$inject=["bpmnFactory","moddle"],fi.prototype._baseCreate=In.prototype.create,fi.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,D({type:"label",di:n},Ii,t))}return this.createElement(e,t)},fi.prototype.createElement=function(e,t){t=D({},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(!lR(r)){var o=D({},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)}y(i,"bpmn:Group")&&(t=D({isFrame:!0},t)),t=uR(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=tl(r,t,"isExpanded")),ge(i,["bpmn:Lane","bpmn:Participant"])&&(t=tl(r,t,"isHorizontal")),y(i,"bpmn:SubProcess")&&(t.collapsed=!Ee(i,r)),y(i,"bpmn:ExclusiveGateway")&&(Mt(r,"isMarkerVisible")?r.isMarkerVisible===void 0&&(r.isMarkerVisible=!1):r.isMarkerVisible=!0),Je(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),Je(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=D({id:i.id},n,t,{businessObject:i,di:r}),this._baseCreate(e,t)},fi.prototype.getDefaultSize=function(e,t){var n=G(e);if(t=t||we(e),y(n,"bpmn:SubProcess"))return Ee(n,t)?{width:350,height:200}:{width:100,height:80};if(y(n,"bpmn:Task"))return{width:100,height:80};if(y(n,"bpmn:Gateway"))return{width:50,height:50};if(y(n,"bpmn:Event"))return{width:36,height:36};if(y(n,"bpmn:Participant")){var i=t.isHorizontal===void 0||t.isHorizontal===!0;return Ee(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return y(n,"bpmn:Lane")?{width:400,height:100}:y(n,"bpmn:DataObjectReference")?{width:36,height:50}:y(n,"bpmn:DataStoreReference")?{width:50,height:50}:y(n,"bpmn:TextAnnotation")?{width:100,height:40}:y(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},fi.prototype.createParticipantShape=function(e){return rt(e)||(e={isExpanded:e}),e=D({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function uR(e,t,n){return A(n,function(i){t=tl(e,t,i)}),t}function tl(e,t,n){return t[n]===void 0?t:(e[n]=t[n],pn(t,[n]))}function lR(e){return ge(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function Xa(e,t){this._modeling=e,this._canvas=t}Xa.$inject=["modeling","canvas"],Xa.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;A(n,function(r){var o={x:0,y:0};Je(i.left)?o.x=i.left-r.x:Je(i.right)?o.x=i.right-r.width-r.x:Je(i.center)?o.x=i.center-Math.round(r.width/2)-r.x:Je(i.top)?o.y=i.top-r.y:Je(i.bottom)?o.y=i.bottom-r.height-r.y:Je(i.middle)&&(o.y=i.middle-Math.round(r.height/2)-r.y),t.moveElements([r],o,r.parent)})},Xa.prototype.postExecute=function(e){};function Za(e){this._modeling=e}Za.$inject=["modeling"],Za.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},Za.prototype.postExecute=function(e){var t=e.hints||{};pR(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 pR(e,t){return qn(e.outgoing,function(n){return n.target===t})}function Qa(e,t){this._canvas=e,this._layouter=t}Qa.$inject=["canvas","layouter"],Qa.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},Qa.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var Ja=Math.round;function nl(e){this._modeling=e}nl.$inject=["modeling"],nl.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,r=e.position,o=e.hints,a=this._modeling;A(t,function(l){ue(l.x)||(l.x=0),ue(l.y)||(l.y=0)});var s=ye(t,function(l){return!l.hidden}),c=Ue(s);A(t,function(l){Te(l)&&(l.waypoints=vt(l.waypoints,function(f){return{x:Ja(f.x-c.x-c.width/2+r.x),y:Ja(f.y-c.y-c.height/2+r.y)}})),D(l,{x:Ja(l.x-c.x-c.width/2+r.x),y:Ja(l.y-c.y-c.height/2+r.y)})});var u=new Set(ta(t)),p={};A(t,function(l){if(Te(l)){p[l.id]=ue(i)?a.createConnection(p[l.source.id],p[l.target.id],i,l,l.parent||n,o):a.createConnection(p[l.source.id],p[l.target.id],l,l.parent||n,o);return}var f=D({},o);u.has(l)||(f.autoResize=!1),he(l)&&(f=pn(f,["attach"])),p[l.id]=ue(i)?a.createShape(l,on(l,["x","y","width","height"]),l.parent||n,i,f):a.createShape(l,on(l,["x","y","width","height"]),l.parent||n,f)}),e.elements=Ki(p)};var Em=Math.round;function di(e){this._canvas=e}di.$inject=["canvas"],di.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?D(t,n):D(t,{x:n.x-Em(t.width/2),y:n.y-Em(t.height/2)}),this._canvas.addShape(t,i,r),t},di.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function so(e){di.call(this,e)}X(so,di),so.$inject=["canvas"];var fR=di.prototype.execute;so.prototype.execute=function(e){var t=e.shape;return hR(t),t.labelTarget=e.labelTarget,fR.call(this,e)};var dR=di.prototype.revert;so.prototype.revert=function(e){return e.shape.labelTarget=null,dR.call(this,e)};function hR(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function co(e,t){this._canvas=e,this._modeling=t}co.$inject=["canvas","modeling"],co.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;pi(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),pi(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},co.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=Mc(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},co.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,Ge(n.children,t,i),this._canvas.addConnection(t,n),t};function il(e,t){this._modeling=e,this._elementRegistry=t}il.$inject=["modeling","elementRegistry"],il.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;A(i,function(r){n.get(r.id)&&(r.waypoints?t.removeConnection(r):t.removeShape(r))})};function uo(e,t){this._canvas=e,this._modeling=t}uo.$inject=["canvas","modeling"],uo.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;pi(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),pi(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),pi(n.children,function(i){Te(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},uo.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=Mc(i.children,n),t.removeShape(n),n},uo.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return Ge(i.children,n,r),t.addShape(n,i),n};function es(e){this._modeling=e}es.$inject=["modeling"];var xm={x:"y",y:"x"};es.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(_,S){_.range.min=Math.min(S[i],_.range.min),_.range.max=Math.max(S[i]+S[r],_.range.max)}function a(_){return _[i]+_[r]/2}function s(_){return _.length-1}function c(_){return _.max-_.min}function u(_,S){var w={y:0};w[i]=_-a(S),w[i]&&(w[xm[i]]=0,t.moveElements([S],w,S.parent))}var p=n[0],l=s(n),f=n[l],d,h,v=0;A(n,function(_,S){var w,E,b;if(_.elements.length<2){S&&S!==n.length-1&&(o(_,_.elements[0]),v+=c(_.range));return}w=ln(_.elements,i),E=w[0],S===l&&(E=w[s(w)]),b=a(E),_.range=null,A(w,function(R){if(u(b,R),_.range===null){_.range={min:R[i],max:R[i]+R[r]};return}o(_,R)}),S&&S!==n.length-1&&(v+=c(_.range))}),h=Math.abs(f.range.min-p.range.max),d=Math.round((h-v)/(n.length-1)),!(d<n.length-1)&&A(n,function(_,S){var w={},E;_===p||_===f||(E=n[S-1],_.range.max=0,A(_.elements,function(b,R){w[xm[i]]=0,w[i]=E.range.max-b[i]+d,_.range.min!==b[i]&&(w[i]+=b[i]-_.range.min),w[i]&&t.moveElements([b],w,b.parent),_.range.max=Math.max(b[i]+b[r],R?_.range.max:0)}))})},es.prototype.postExecute=function(e){};function ts(e,t){this._layouter=e,this._canvas=t}ts.$inject=["layouter","canvas"],ts.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return D(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},ts.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function rl(){}rl.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=ze(o.children,t),Ge(i.children,t,r),t.parent=i,A(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},rl.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return ze(n.children,t),Ge(i.children,t,r),t.parent=i,A(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 ol(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}ol.prototype.add=function(e,t){return this.addAll([e],t)},ol.prototype.addAll=function(e,t){var n=G0(e,!!t,this);return D(this,n),this};function lo(e){this._modeling=e}lo.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},lo.prototype.moveClosure=function(e,t,n,i,r){var o=this._modeling,a=e.allShapes,s=e.allConnections,c=e.enclosedConnections,u=e.topLevel,p=!1;r&&r.parent===n&&(p=!0),A(a,function(l){o.moveShape(l,t,u[l.id]&&!p&&n,{recurse:!1,layout:!1})}),A(s,function(l){var f=!!a[l.source.id],d=!!a[l.target.id];c[l.id]&&f&&d?o.moveConnection(l,t,u[l.id]&&!p&&n):o.layoutConnection(l,{connectionStart:f&&fu(l,l.source,t),connectionEnd:d&&du(l,l.target,t)})})},lo.prototype.getClosure=function(e){return new ol().addAll(e,!0)};function ns(e){this._helper=new lo(e)}ns.$inject=["modeling"],ns.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},ns.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 Fi(e){this._modeling=e,this._helper=new lo(e)}Fi.$inject=["modeling"],Fi.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=on(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=ze(o.children,t),Ge(i.children,t,r),D(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},Fi.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,r=this._modeling;i.layout!==!1&&(A(t.incoming,function(o){r.layoutConnection(o,{connectionEnd:du(o,t,n)})}),A(t.outgoing,function(o){r.layoutConnection(o,{connectionStart:fu(o,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},Fi.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return Ge(n.children,t,i),D(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},Fi.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},Fi.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function po(e){this._modeling=e}po.$inject=["modeling"],po.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 ae(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},po.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||wm(ae(r)?r[0]:r)),i&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||wm(ae(r)?r[r.length-1]:r)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},po.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 wm(e){return e.original||e}function Fn(e,t){this._modeling=e,this._rules=t}Fn.$inject=["modeling","rules"],Fn.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(h,v,_){return i.allowed("connection.reconnect",{connection:_,source:h,target:v})}var u={x:o.x,y:o.y},p={x:r.x,y:r.y,width:r.width,height:r.height};s=e.newShape=e.newShape||t.createShape(o,u,r.parent,a),r.host&&n.updateAttachment(s,r.host);var l;a.moveChildren!==!1&&(l=r.children.slice(),n.moveElements(l,{x:0,y:0},s,a));var f=r.incoming.slice(),d=r.outgoing.slice();A(f,function(h){var v=h.source,_=c(v,s,h);_&&t.reconnectEnd(h,s,Ta(h,s,p),a)}),A(d,function(h){var v=h.target,_=c(s,v,h);_&&t.reconnectStart(h,s,Aa(h,s,p),a)})},Fn.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},Fn.prototype.execute=function(e){},Fn.prototype.revert=function(e){},Fn.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},Fn.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},Fn.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function fo(e){this._modeling=e}fo.$inject=["modeling"],fo.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},D(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},fo.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,r=e.hints||{};r.layout!==!1&&(A(n.incoming,function(o){t.layoutConnection(o,{connectionEnd:Ta(o,n,i)})}),A(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:Aa(o,n,i)})}))},fo.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return D(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function hi(e){this._modeling=e}hi.$inject=["modeling"],hi.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),A(r,function(s){a[s.id]=gR(s)}),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(VS(i,r),t,n,o,i,r,a)},hi.prototype.execute=function(){},hi.prototype.revert=function(){},hi.prototype.moveShapes=function(e,t){var n=this;A(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},hi.prototype.resizeShapes=function(e,t,n){var i=this;A(e,function(r){var o=GS(r,n,t);i._modeling.resizeShape(r,o,null,{attachSupport:!1,autoResize:!1,layout:!1})})},hi.prototype.updateConnectionWaypoints=function(e,t,n,i,r,o,a){var s=this,c=new Set(r),u=new Set(o);A(e,function(p){var l=p.source,f=p.target,d=mR(p),h=Rm(n),v={},_=c.has(l)||u.has(l),S=c.has(f)||u.has(f);_&&S?(d=vt(d,function(w){return Cm(w,i,n)&&(w[h]=w[h]+t[h]),w.original&&Cm(w.original,i,n)&&(w.original[h]=w.original[h]+t[h]),w}),s._modeling.updateWaypoints(p,d,{labelBehavior:!1})):(_||S)&&(c.has(l)?v.connectionStart=fu(p,l,t):c.has(f)?v.connectionEnd=du(p,f,t):u.has(l)?v.connectionStart=Aa(p,l,a[l.id]):u.has(f)&&(v.connectionEnd=Ta(p,f,a[f.id])),s._modeling.layoutConnection(p,v))})};function Sm(e){return D({},e)}function mR(e){return vt(e.waypoints,function(t){return t=Sm(t),t.original&&(t.original=Sm(t.original)),t})}function Rm(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function Cm(e,t,n){var i=Rm(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function gR(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function is(e){this._modeling=e}is.$inject=["modeling"],is.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=Pm(n),t.collapsed=!t.collapsed;var i=Am(n,t.collapsed);return[t].concat(i)},is.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,r=Tm(i,n);return t.collapsed=!t.collapsed,[t].concat(r)};function Pm(e){var t={};return A(e,function(n){t[n.id]=n.hidden,n.children&&(t=D({},t,Pm(n.children)))}),t}function Am(e,t){var n=[];return A(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(Am(i.children,i.collapsed||t)))}),n}function Tm(e,t){var n=[];return A(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(Tm(i.children,t)))}),n}function rs(e){this._modeling=e}rs.$inject=["modeling"],rs.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=Mm(i,t),km(n,t),t.host=n,t},rs.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,Mm(n,t),km(i,t,r),t};function Mm(e,t){return ze(e&&e.attachers,t)}function km(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),Ge(i,t,n)}}function al(){}al.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},al.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function Me(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}Me.$inject=["eventBus","elementFactory","commandStack"],Me.prototype.getHandlers=function(){return{"shape.append":Za,"shape.create":di,"shape.delete":uo,"shape.move":Fi,"shape.resize":fo,"shape.replace":Fn,"shape.toggleCollapse":is,spaceTool:hi,"label.create":so,"connection.create":Qa,"connection.delete":co,"connection.move":rl,"connection.layout":ts,"connection.updateWaypoints":al,"connection.reconnect":po,"elements.create":nl,"elements.move":ns,"elements.delete":il,"elements.distribute":es,"elements.align":Xa,"element.updateAttachment":rs}},Me.prototype.registerHandlers=function(e){A(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},Me.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)},Me.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},Me.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)},Me.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)},Me.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},Me.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},Me.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},Me.prototype.createElements=function(e,t,n,i,r){ae(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},Me.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},Me.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},Me.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},Me.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},Me.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},Me.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},Me.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},Me.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},Me.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},Me.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)},Me.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},Me.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)},Me.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,D(i,{docking:"source"}))},Me.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,D(i,{docking:"target"}))},Me.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},Me.prototype._create=function(e,t){return TE(t)?t:this._elementFactory.create(e,t)},Me.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function ho(e){this._elementRegistry=e}ho.$inject=["elementRegistry"],ho.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||vR(n,Ho(i));return Dm(n,i),e.oldProperties=o,e.changed=r,r},ho.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return Dm(n,t),i},ho.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return y(e,"bpmn:DataObject")?yR(e,t):[]};function vR(e,t){return kt(t,function(n,i){return n[i]=e.get(i),n},{})}function Dm(e,t){A(t,function(n,i){e.set(i,n)})}function yR(e,t){return t.filter(function(n){return y(n,"bpmn:DataObjectReference")&&G(n).dataObjectRef===e})}var mo="default",Hn="id",Om="di",_R={width:0,height:0};function go(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}go.$inject=["elementRegistry","moddle","modeling","textRenderer"],go.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=SR(e.properties),s=e.oldProperties||bR(t,a);return Im(a,o)&&(r.unclaim(o[Hn]),i.updateId(t,a[Hn]),r.claim(a[Hn],o)),mo in a&&(a[mo]&&n.push(i.get(a[mo].id)),o[mo]&&n.push(i.get(o[mo].id))),Lm(t,a),e.oldProperties=s,e.changed=n,n},go.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&G(n).name;if(i){var r=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,r,_R)}},go.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 Lm(t,i),Im(n,r)&&(a.unclaim(n[Hn]),o.updateId(t,i[Hn]),a.claim(i[Hn],r)),e.changed};function Im(e,t){return Hn in e&&e[Hn]!==t[Hn]}function bR(e,t){var n=Ho(t),i=e.businessObject,r=we(e);return kt(n,function(o,a){return a!==Om?o[a]=i.get(a):o[a]=ER(r,Ho(t.di)),o},{})}function ER(e,t){return kt(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function Lm(e,t){var n=e.businessObject,i=we(e);A(t,function(r,o){o!==Om?n.set(o,r):i&&xR(i,r)})}function xR(e,t){A(t,function(n,i){e.set(i,n)})}var wR=["default"];function SR(e){var t=D({},e);return wR.forEach(function(n){n in e&&(t[n]=G(t[n]))}),t}function os(e,t){this._canvas=e,this._modeling=t}os.$inject=["canvas","modeling"],os.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=we(r);return t.setRootElement(n),t.removeRootElement(r),Ge(a.rootElements,i),i.$parent=a,ze(a.rootElements,o),o.$parent=null,r.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=r,[]},os.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,a=i.$parent,s=we(n);return t.setRootElement(r),t.removeRootElement(n),ze(a.rootElements,i),i.$parent=null,Ge(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,r.di=s,[]};function sl(e,t){this._modeling=e,this._spaceTool=t}sl.$inject=["modeling","spaceTool"],sl.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=Kt(i),a=o===i,s=a?i:i.parent,c=ai(s),u=at(i);if(u?r==="left"?r="top":r==="right"&&(r="bottom"):r==="top"?r="left":r==="bottom"&&(r="right"),!c.length){var p=u?{x:i.x+Yt,y:i.y,width:i.width-Yt,height:i.height}:{x:i.x,y:i.y+Yt,width:i.width,height:i.height-Yt};n.createShape({type:"bpmn:Lane",isHorizontal:u},p,s)}var l=[];Di(o,function(b){return l.push(b),b.label&&l.push(b.label),b===i?[]:ye(b.children,function(R){return R!==i})});var f,d,h,v,_;r==="top"?(f=-120,d=i.y,h=d+10,v="n",_="y"):r==="left"?(f=-120,d=i.x,h=d+10,v="w",_="x"):r==="bottom"?(f=120,d=i.y+i.height,h=d-10,v="s",_="y"):r==="right"&&(f=120,d=i.x+i.width,h=d-10,v="e",_="x");var S=t.calculateAdjustments(l,_,f,h),w=u?{x:0,y:f}:{x:f,y:0};t.makeSpace(S.movingShapes,S.resizingShapes,w,v,h);var E=u?{x:i.x+(a?Yt:0),y:d-(r==="top"?120:0),width:i.width-(a?Yt:0),height:120}:{x:d-(r==="left"?120:0),y:i.y+(a?Yt:0),width:120,height:i.height-(a?Yt:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:u},E,s)};function cl(e){this._modeling=e}cl.$inject=["modeling"],cl.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=ai(n),o=r.length;if(o>i)throw new Error(`more than <${i}> child lanes`);var a=at(n),s=a?n.height:n.width,c=Math.round(s/i),u,p,l,f;for(f=0;f<i;f++)f===i-1?u=s-c*f:u=c,p=a?{x:n.x+Yt,y:n.y+f*c,width:n.width-Yt,height:u}:{x:n.x+f*c,y:n.y+Yt,width:u,height:n.height-Yt},f<o?t.resizeShape(r[f],p):(l={type:"bpmn:Lane",isHorizontal:a},t.createShape(l,p,n))};function vo(e,t){this._modeling=e,this._spaceTool=t}vo.$inject=["modeling","spaceTool"],vo.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},vo.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=yw(e,t);n.resizeShape(e,t),i.forEach(function(r){n.resizeShape(r.shape,r.newBounds)})},vo.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=ie(e),r=ie(t),o=dd(r,i),a=Kt(e),s=[],c=[];Di(a,function(h){return s.push(h),(y(h,"bpmn:Lane")||y(h,"bpmn:Participant"))&&c.push(h),h.children});var u,p,l,f,d;(o.bottom||o.top)&&(u=o.bottom||o.top,p=e.y+(o.bottom?e.height:0)+(o.bottom?-10:10),l=o.bottom?"s":"n",f=o.top>0||o.bottom<0?-u:u,d=n.calculateAdjustments(s,"y",f,p),n.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:u},l)),(o.left||o.right)&&(u=o.right||o.left,p=e.x+(o.right?e.width:0)+(o.right?-10:100),l=o.right?"e":"w",f=o.left>0||o.right<0?-u:u,d=n.calculateAdjustments(c,"x",f,p),n.makeSpace(d.movingShapes,d.resizingShapes,{x:u,y:0},l))};var yo="flowNodeRef",ul="lanes";function as(){}as.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},o=[];function a(p,l){var f=ie(l),d={x:p.x+p.width/2,y:p.y+p.height/2};return d.x>f.left&&d.x<f.right&&d.y>f.top&&d.y<f.bottom}function s(p){n.indexOf(p)===-1&&(o.push(p),n.push(p))}function c(p){var l=Kt(p);return r[l.id]||(r[l.id]=wa(l)),r[l.id]}function u(p){if(!p.parent)return[];var l=c(p);return l.filter(function(f){return a(p,f)}).map(function(f){return f.businessObject})}return t.forEach(function(p){var l=Kt(p);if(!(!l||n.indexOf(l)!==-1)){var f=l.children.filter(function(d){return y(d,"bpmn:FlowNode")});f.forEach(s),n.push(l)}}),e.forEach(s),o.forEach(function(p){var l=p.businessObject,f=l.get(ul),d=f.slice(),h=u(p);i.push({flowNode:l,remove:d,add:h})}),t.forEach(function(p){var l=p.businessObject;p.parent||l.get(yo).forEach(function(f){i.push({flowNode:f,remove:[l],add:[]})})}),i},as.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(ul);n.remove.forEach(function(o){ze(r,o),ze(o.get(yo),i)}),n.add.forEach(function(o){Ge(r,o),Ge(o.get(yo),i)})}),[]},as.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,r=i.get(ul);n.add.forEach(function(o){ze(r,o),ze(o.get(yo),i)}),n.remove.forEach(function(o){Ge(r,o),Ge(o.get(yo),i)})}),[]};var ll="categoryValueRef";function _o(e,t){this._bpmnFactory=e,this._elementRegistry=t}_o.$inject=["bpmnFactory","elementRegistry"],_o.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,r=new Map,o=[],a=new Map;function s(w,E,b){if(E){var R=a.get(w);R||(R={},a.set(w,R)),!(b&&R.present)&&(!b&&R.past||(b?R.present={categoryValue:E,root:pl(w)}:R.past={categoryValue:E}))}}function c(w){r.set(w,G(w))}function u(){n.filter(function(w){return y(w,"bpmn:FlowElement")&&!he(w)&&w.parent}).forEach(c)}function p(w){var E=G(w),b=E.get("categoryValueRef");return b||(b=cd(i,E),o.push(RR(w,b))),b}function l(w){return w.reduce(function(E,b){var R=pl(b),T=E.get(R);return T||(T=[],E.set(R,T)),T.push(b),E},new Map)}e=Array.from(e||[]);var f=l(e);t.length&&u(),e.forEach(c),n.filter(function(w){return y(w,"bpmn:Group")&&!he(w)&&w.parent}).forEach(function(w){var E=G(w).get("categoryValueRef");if(!E){var b=pl(w),R=f.get(b)||[],T=er(R,w),O=Object.keys(T).length>0;O&&(E=p(w))}s(w,E,!0)}),t.forEach(function(w){s(w.groupShape,w.categoryValue,!1)}),o.length&&u();var d=Array.from(r.keys()),h=Array.from(a.values()).reduce(function(w,E){return E.present&&w.add(E.present.categoryValue),E.past&&w.add(E.past.categoryValue),w},new Set),v=new Map,_=l(d);a.forEach(function(w,E){var b=w.present;if(b){var R=_.get(b.root)||[],T=er(R,E);R.forEach(function(O){if(T[O.id]){var C=v.get(O);C||(C=new Set,v.set(O,C)),C.add(b.categoryValue)}})}});var S=d.reduce(function(w,E){var b=r.get(E),R=b.get(ll),T=new Set(R),O=v.get(E)||new Set,C=Array.from(O).filter(function(N){return!T.has(N)}),F=R.filter(function(N){return h.has(N)&&!O.has(N)});return(C.length||F.length)&&w.push({businessObject:b,categoryValuesToAdd:C,categoryValuesToRemove:F}),w},[]);return{flowElements:S,groups:o}},_o.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),CR(t.groups),AR(t.flowElements),[]},_o.prototype.revert=function(e){var t=e.updates;return TR(t.flowElements),PR(t.groups),[]};function RR(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function CR(e){e.forEach(function(t){G(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function PR(e){e.forEach(function(t){G(t.groupShape).categoryValueRef=null})}function AR(e){e.forEach(function(t){var n=t.businessObject,i=n.get(ll);t.categoryValuesToRemove.forEach(function(r){ze(i,r)}),t.categoryValuesToAdd.forEach(function(r){Ge(i,r,!0)})})}function TR(e){e.forEach(function(t){var n=t.businessObject,i=n.get(ll);t.categoryValuesToAdd.forEach(function(r){ze(i,r)}),t.categoryValuesToRemove.forEach(function(r){Ge(i,r,!0)})})}function pl(e){for(;e.parent;)e=e.parent;return e}function ss(e){this._moddle=e}ss.$inject=["moddle"],ss.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),[]},ss.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 MR={fill:void 0,stroke:void 0};function fl(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(Tt(t)){var n=kR(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}fl.$inject=["commandStack"],fl.prototype.postExecute=function(e){var t=e.elements,n=e.colors||MR,i=this,r={};"fill"in n&&D(r,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&D(r,{"border-color":this._normalizeColor(n.stroke)}),A(t,function(o){var a=Te(o)?on(r,["border-color"]):r,s=we(o);if(DR(a),he(o)){if(!s||!y(s.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:o,moddleElement:s.label,properties:{color:r["border-color"]}})}else{if(!ge(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:o,properties:{di:a}})}})};function kR(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 DR(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var OR={width:0,height:0};function Bm(e,t,n){function i(c,u){var p=c.label||c,l=c.labelTarget||c;return sx(p,u),[p,l]}function r(c){var u=c.element,p=u.businessObject,l=c.newLabel;if(!he(u)&&ri(u)&&!la(u)&&!Nm(l)){var f=7,d=Bc(u);d={x:d.x,y:d.y+f},e.createLabel(u,d,{id:p.id+"_label",businessObject:p,di:u.di})}}function o(c){return c.oldLabel=Vt(c.element),i(c.element,c.newLabel)}function a(c){return i(c.element,c.oldLabel)}function s(c){var u=c.element,p=u.label||u,l=c.newLabel,f=c.newBounds,d=c.hints||{};if(!(!he(p)&&!y(p,"bpmn:TextAnnotation"))){if(he(p)&&Nm(l)){d.removeShape!==!1&&e.removeShape(p,{unsetLabel:!1});return}var h=Vt(u);typeof f>"u"&&(f=t.getExternalLabelBounds(p,h)),f&&e.resizeShape(p,f,OR)}}this.preExecute=r,this.execute=o,this.revert=a,this.postExecute=s}Bm.$inject=["modeling","textRenderer","bpmnFactory"];function Nm(e){return!e||!e.trim()}function ft(e,t,n,i){Me.call(this,e,t,n),this._bpmnRules=i}X(ft,Me),ft.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],ft.prototype.getHandlers=function(){var e=Me.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=ho,e["element.updateProperties"]=go,e["canvas.updateRoot"]=os,e["lane.add"]=sl,e["lane.resize"]=vo,e["lane.split"]=cl,e["lane.updateRefs"]=as,e["group.updateRefs"]=_o,e["id.updateClaim"]=ss,e["element.setColor"]=fl,e["element.updateLabel"]=Bm,e},ft.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},ft.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)},ft.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},ft.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},ft.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},ft.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},ft.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},ft.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},ft.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},ft.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},ft.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},ft.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},ft.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},ft.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function $m(){}$m.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||se(t.source||e.source),t.connectionEnd||se(t.target||e.target)]};var cs=20,IR=5,us=Math.round,jm=20,LR={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function BR(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function NR(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function Fm(e,t,n){var i=ut(t,e,IR),r=n.split(":")[0],o=us((t.x-e.x)/2+e.x),a=us((t.y-e.y)/2+e.y),s,c,u=NR(r,i),p=/h|r|l/.test(r),l=!1,f=!1;return u?(s=p?{x:o,y:e.y}:{x:e.x,y:a},c=p?"h:h":"v:v"):(l=BR(i,r),c=p?"h:v":"v:h",l?p?(f=a===e.y,s={x:e.x+cs*(/l/.test(r)?-1:1),y:f?a+cs:a}):(f=o===e.x,s={x:f?o+cs:o,y:e.y+cs*(/t/.test(r)?-1:1)}):s={x:o,y:a}),{waypoints:dl(e,s,c).concat(s),directions:c,turnNextDirections:f}}function $R(e,t,n){return Fm(e,t,n)}function jR(e,t,n){var i=Fm(t,e,Hm(n));return{waypoints:i.waypoints.slice().reverse(),directions:Hm(i.directions),turnNextDirections:i.turnNextDirections}}function FR(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=dl(e.waypoints[e.waypoints.length-1],t.waypoints[0],r);return{waypoints:o,directions:r}}function Hm(e){return e.split(":").reverse().join(":")}function HR(e,t,n){var i=us((t.x-e.x)/2+e.x),r=us((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 dl(e,t,n){if(n=n||"h:h",!XR(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(Vm(n)){var i=$R(e,t,n),r=jR(e,t,n),o=FR(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return HR(e,t,n)}function zR(e,t,n){var i=dl(e,t,n);return i.unshift(e),i.push(t),Wm(i)}function VR(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=R_(o,"straight")[0]||"h:h",s=LR[a]||0,c=ut(e,t,s),u=KR(c,a);n=n||se(e),i=i||se(t);var p=u.split(":"),l=Gm(n,e,p[0],ZR(c)),f=Gm(i,t,p[1],c);return zR(l,f,u)}function GR(e,t,n,i,r,o){ae(n)&&(r=n,o=i,n=se(e),i=se(t)),o=D({preferredLayouts:[]},o),r=r||[];var a=o.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&UR(e,t,n,i,o),c||(c=o.connectionEnd&&YR(t,e,i,r),c)||(c=o.connectionStart&&qR(e,t,n,r),c)?c:!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:VR(e,t,n,i,o)}function WR(e,t,n){return e>=t&&e<=n}function zm(e,t,n){var i={x:"width",y:"height"};return WR(t[e],n[e],n[e]+n[i[e]])}function UR(e,t,n,i,r){var o={},a,s;return s=ut(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),r.preserveDocking==="target"?zm(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:zm(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 qR(e,t,n,i){return hl(e,t,n,i)}function YR(e,t,n,i){var r=i.slice().reverse();return r=hl(e,t,n,r),r?r.reverse():null}function hl(e,t,n,i){function r(p){return p.length<3?!0:p.length>4?!1:!!Oe(p,function(l,f){var d=p[f-1];return d&&zr(l,d)<3})}function o(p,l,f){var d=Dn(l,p);switch(d){case"v":return{x:f.x,y:p.y};case"h":return{x:p.x,y:f.y}}return{x:p.x,y:p.y}}function a(p,l,f){var d;for(d=p.length-2;d!==0;d--)if(hf(p[d],l,jm)||hf(p[d],f,jm))return p.slice(d);return p}if(r(i))return null;var s=i[0],c=i.slice(),u;return c[0]=n,c[1]=o(c[1],s,n),u=a(c,e,t),u!==c&&(c=hl(e,t,n,u)),c&&Dn(c)?null:c}function KR(e,t){if(Vm(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 XR(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function Vm(e){return e&&/t|r|b|l/.test(e)}function ZR(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 Gm(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 Wm(e){return e.reduce(function(t,n,i){var r=t[t.length-1],o=e[i+1];return kc(r,o,n,0)||t.push(n),t},[])}var QR=-10,JR=40,eC={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},tC={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},ml={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},bo={top:"t",right:"r",bottom:"b",left:"l"};function ls(e){this._elementRegistry=e}X(ls,$m),ls.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,u;if(o||(o=Um(r&&r[0],n)),a||(a=Um(r&&r[r.length-1],i)),(y(e,"bpmn:Association")||y(e,"bpmn:DataAssociation"))&&r&&!qm(n,i))return[].concat([o],r.slice(1,-1),[a]);var p=rd(n,s)?eC:tC;return y(e,"bpmn:MessageFlow")?c=iC(n,i,p):(y(e,"bpmn:SequenceFlow")||qm(n,i))&&(n===i?c={preferredLayouts:uC(n,e,p)}:y(n,"bpmn:BoundaryEvent")?c={preferredLayouts:lC(n,i,a,p)}:Eo(n)||Eo(i)?c={preferredLayouts:p.subProcess,preserveDocking:oC(n)}:y(n,"bpmn:Gateway")?c={preferredLayouts:p.fromGateway}:y(i,"bpmn:Gateway")?c={preferredLayouts:p.toGateway}:c={preferredLayouts:p.default}),c&&(c=D(c,t),u=Wm(GR(n,i,o,a,r,c))),u||[o,a]};function nC(e){var t=e.host;return ut(se(e),t,QR)}function iC(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:rC(e,t)}}function rC(e,t){return y(t,"bpmn:Participant")?"source":y(e,"bpmn:Participant")?"target":Eo(t)?"source":Eo(e)||y(t,"bpmn:Event")?"target":y(e,"bpmn:Event")?"source":null}function oC(e){return Eo(e)?"target":"source"}function Um(e,t){return e?e.original||e:se(t)}function qm(e,t){return y(t,"bpmn:Activity")&&y(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function Eo(e){return y(e,"bpmn:SubProcess")&&Ee(e)}function Hi(e,t){return e===t}function aC(e,t){return t.indexOf(e)!==-1}function _r(e){var t=/right|left/.exec(e);return t&&t[0]}function br(e){var t=/top|bottom/.exec(e);return t&&t[0]}function Ym(e,t){return ml[e]===t}function sC(e,t){var n=_r(e),i=ml[n];return t.indexOf(i)!==-1}function cC(e,t){var n=br(e),i=ml[n];return t.indexOf(i)!==-1}function Km(e){return e==="right"||e==="left"}function uC(e,t,n){var i=t.waypoints,r=i&&i.length&&ut(i[0],e);return r==="top"?n.loop.fromTop:r==="right"?n.loop.fromRight:r==="left"?n.loop.fromLeft:n.loop.fromBottom}function lC(e,t,n,i){var r=se(e),o=se(t),a=nC(e),s,c,u=Hi(e.host,t),p=aC(a,["top","right","bottom","left"]),l=ut(o,r,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return u?pC(a,p,e,t,n,i):(s=fC(a,l,p,i.isHorizontal),c=dC(a,l,p,i.isHorizontal),[s+":"+c])}function pC(e,t,n,i,r,o){var a=t?e:o.isHorizontal?br(e):_r(e),s=bo[a],c;return t?Km(e)?c=Xm("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:c=Xm("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function Xm(e,t,n,i){var r=JR;return!(gl(e,i,n,r)||gl(e,i,{x:n.x+n.width,y:n.y+n.height},r)||gl(e,i,se(t),r))}function gl(e,t,n,i){return Math.abs(t[e]-n[e])<i}function fC(e,t,n,i){if(n)return bo[e];var r=br(e),o=_r(e),a=br(t),s=_r(t);if(i){if(Hi(r,a)||Ym(o,s))return bo[r]}else if(Hi(o,s)||Ym(r,a))return bo[o];return bo[i?o:r]}function dC(e,t,n,i){if(n)return Km(e)?sC(e,t)||Hi(e,t)?"h":"v":cC(e,t)||Hi(e,t)?"v":"h";var r=br(e),o=_r(e),a=br(t),s=_r(t);return a&&!s?"v":s&&!a?"h":i?Hi(r,a)?"h":"v":Hi(o,s)?"v":"h"}ls.$inject=["elementRegistry"];function Zm(e){return D({original:e.point.original||e.point},e.actual)}function mi(e,t){this._elementRegistry=e,this._graphicsFactory=t}mi.$inject=["elementRegistry","graphicsFactory"],mi.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(Zm(i)),o.push(Zm(r)),o},mi.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}},mi.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return Vr(i,r,n)},mi.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},mi.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},mi.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const vl={__init__:["modeling","bpmnUpdater"],__depends__:[D1,Y1,X1,Z1,um,QS,eR,aR,Zt,el,mm],bpmnFactory:["type",Jt],bpmnUpdater:["type",Nt],elementFactory:["type",fi],modeling:["type",ft],layouter:["type",ls],connectionDocking:["type",mi]};var hC=10,Qm=50,mC=250;function yl(e,t,n,i){for(var r;r=gC(e,n,t);)n=i(t,n,r);return n}function _l(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,u=a.minDistance;c<0?r[o]=Math.min(i[o]+c-t[s]/2,n[o]-u+c):r[o]=Math.max(i[o]+i[s]+c+t[s]/2,n[o]+u+c)}}),r}}function gC(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=yC(e);return Oe(r,function(o){if(o===n)return!1;var a=ut(o,i,hC);return a==="intersect"})}function vC(e,t){t||(t={});function n(h){return h.source===e?1:-1}var i=t.defaultDistance||Qm,r=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||mC,c=t.reference||"start";o||(o=EC);function u(h,v){return r==="n"?c==="start"?ie(h).top-ie(v).bottom:c==="center"?ie(h).top-se(v).y:ie(h).top-ie(v).top:r==="w"?c==="start"?ie(h).left-ie(v).right:c==="center"?ie(h).left-se(v).x:ie(h).left-ie(v).left:r==="s"?c==="start"?ie(v).top-ie(h).bottom:c==="center"?se(v).y-ie(h).bottom:ie(v).bottom-ie(h).bottom:c==="start"?ie(v).left-ie(h).right:c==="center"?se(v).x-ie(h).right:ie(v).right-ie(h).right}var p=e.incoming.filter(o).map(function(h){var v=a(h),_=v<0?u(h.source,e):u(e,h.source);return{id:h.source.id,distance:_,weight:v}}),l=e.outgoing.filter(o).map(function(h){var v=a(h),_=v>0?u(e,h.target):u(h.target,e);return{id:h.target.id,distance:_,weight:v}}),f=p.concat(l).reduce(function(h,v){return h[v.id+"__weight_"+v.weight]=v,h},{}),d=kt(f,function(h,v){var _=v.distance,S=v.weight;return _<0||_>s||(h[String(_)]||(h[String(_)]=0),h[String(_)]+=1*S,(!h.distance||h[h.distance]<h[String(_)])&&(h.distance=_)),h},{});return d.distance||i}function yC(e){var t=bl(e);return e.host&&(t=t.concat(bl(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(bl(i))},[]))),t}function bl(e){return bC(e).concat(_C(e))}function _C(e){return e.incoming.map(function(t){return t.source})}function bC(e){return e.outgoing.map(function(t){return t.target})}function EC(){return!0}var xC=100;function Jm(e,t,n){e.on("autoPlace",xC,function(i){var r=i.shape,o=i.source;return wC(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}}Jm.$inject=["eventBus","modeling","canvas"];function wC(e,t,n){n||(n={});var i=n.defaultDistance||Qm,r=se(e),o=ie(e);return{x:o.right+i+t.width/2,y:r.y}}function eg(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}eg.$inject=["eventBus","selection"];const SC={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",Jm],autoPlaceSelectionBehavior:["type",eg]};function tg(e,t,n){var i=rd(e,n);if(y(t,"bpmn:TextAnnotation"))return CC(e,t,i);if(ge(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return PC(e,t,i);if(y(t,"bpmn:FlowNode"))return RC(e,t,i)}function RC(e,t,n){var i=ie(e),r=se(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=vC(e,{filter:function(d){return y(d,"bpmn:SequenceFlow")},direction:o.directionHint}),s=30,c=o.minDistance,u=o.baseOrientation;y(e,"bpmn:BoundaryEvent")&&(u=ut(e,e.host,-25),u.indexOf(o.boundaryOrientation)!==-1&&(s*=-1));var p=n?{x:i.right+a+t.width/2,y:r.y+ng(u,c,o)}:{x:r.x+ng(u,c,o),y:i.bottom+a+t.height/2},l={margin:s,minDistance:c},f=n?{y:l}:{x:l};return yl(e,t,p,_l(f))}function ng(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function CC(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};Te(e)&&(r=se(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 yl(e,t,r,_l(a))}function PC(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 yl(e,t,r,_l(a))}function ig(e,t){e.on("autoPlace",function(n){var i=n.shape,r=n.source;return tg(r,i,t)})}ig.$inject=["eventBus","elementRegistry"];const ps={__depends__:[SC],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",ig]},Er={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},AC=/[ᄀ-ᇿ -〿-ヿ㐀-鿿가--⦆]/;function TC(e){const t=Er;return AC.test(e)?t.cjkEm:e===" "?t.spaceEm:e>="0"&&e<="9"?t.digitEm:e>="A"&&e<="Z"?t.upperEm:e>="a"&&e<="z"?t.lowerEm:t.otherEm}function El(e,t){let n=0;for(const i of e)n+=t*TC(i);return n}function rg(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&MC(e),kC(e),DC(e),OC(e)}function MC(e){var i;const t=(i=e.HTMLCanvasElement)==null?void 0:i.prototype;if(!t||t.__headlessTextMeasurement)return;t.__headlessTextMeasurement=!0;const n={font:"12px sans-serif",letterSpacing:"0px",measureText(r){var a;const o=Number.parseFloat(((a=String(n.font).match(/(\d+(?:\.\d+)?)px/))==null?void 0:a[1])??"12");return{width:El(r,o),fontBoundingBoxAscent:o*Er.ascentEm,fontBoundingBoxDescent:o*Er.descentEm,actualBoundingBoxAscent:o*Er.ascentEm,actualBoundingBoxDescent:o*Er.descentEm}}};t.getContext=()=>n}function kC(e){if(e.SVGMatrix)return;class t{constructor(){qi(this,"a",1);qi(this,"b",0);qi(this,"c",0);qi(this,"d",1);qi(this,"e",0);qi(this,"f",0)}static of(i,r,o,a,s,c){return Object.assign(new t,{a:i,b:r,c:o,d:a,e:s,f:c})}multiply(i){return t.of(this.a*i.a+this.c*i.b,this.b*i.a+this.d*i.b,this.a*i.c+this.c*i.d,this.b*i.c+this.d*i.d,this.a*i.e+this.c*i.f+this.e,this.b*i.e+this.d*i.f+this.f)}translate(i,r){return this.multiply(t.of(1,0,0,1,i,r))}scale(i,r=i){return this.multiply(t.of(i,0,0,r,0,0))}inverse(){const i=this.a*this.d-this.b*this.c;return t.of(this.d/i,-this.b/i,-this.c/i,this.a/i,(this.c*this.f-this.d*this.e)/i,(this.b*this.e-this.a*this.f)/i)}}e.SVGMatrix=t}function DC(e){var o;const t=()=>{const a=new e.SVGMatrix;return{type:0,matrix:a,setTranslate(s,c){a.e=s,a.f=c},setScale(s,c){a.a=s,a.d=c},setRotate(s,c=0,u=0){const p=s*Math.PI/180,l=Math.cos(p),f=Math.sin(p);a.a=l,a.b=f,a.c=-f,a.d=l,a.e=c-l*c+f*u,a.f=u-f*c-l*u},setMatrix(s){Object.assign(a,s)}}},n=a=>{const s=t();return Object.assign(s.matrix,a),s},i=(o=e.SVGSVGElement)==null?void 0:o.prototype;i&&!i.createSVGTransform&&(i.createSVGTransform=t,i.createSVGTransformFromMatrix=n,i.createSVGMatrix=()=>new e.SVGMatrix,i.createSVGPoint=()=>({x:0,y:0,matrixTransform:()=>({x:0,y:0})}));const r=e.SVGElement.prototype;Object.getOwnPropertyDescriptor(r,"transform")||Object.defineProperty(r,"transform",{configurable:!0,get(){if(!this.__headlessTransformList){const a=[];this.__headlessTransformList={baseVal:{get numberOfItems(){return a.length},clear:()=>{a.length=0},appendItem:s=>(a.push(s),s),getItem:s=>a[s],createSVGTransformFromMatrix:n,consolidate:()=>a[a.length-1]??null}}}return this.__headlessTransformList}})}function OC(e){const t=e.SVGElement.prototype;if(!t.getCTM){const n=()=>new e.SVGMatrix;t.getCTM=n,t.getScreenCTM=n}t.getBBox||(t.getBBox=function(){const n=String(this.textContent??"");return{x:0,y:0,width:El(n,12),height:14}})}const og=[nd,Kr,vl,ps];function IC(e={}){rg(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new ir({container:t,moddleExtensions:e.moddleExtensions??Yo,additionalModules:[...og,...e.additionalModules??[]]})}var LC=new vr("ov"),BC=500;function st(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=LC,this._overlayDefaults=D({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=NC(n.getContainer()),this._init()}st.$inject=["config.overlays","eventBus","canvas","elementRegistry"],st.prototype.get=function(e){if(Tt(e)&&(e={id:e}),Tt(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?ye(t.overlays,Zi({type:e.type})):t.overlays.slice():[]}else return e.type?ye(this._overlays,Zi({type:e.type})):e.id?this._overlays[e.id]:null},st.prototype.add=function(e,t,n){if(rt(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=D({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},st.prototype.remove=function(e){var t=this.get(e)||[];ae(t)||(t=[t]);var n=this;A(t,function(i){var r=n._getOverlayContainer(i.element,!0);if(i&&(mn(i.html),mn(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)}})},st.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},st.prototype.show=function(){fs(this._overlayRoot)},st.prototype.hide=function(){fs(this._overlayRoot,!1)},st.prototype.clear=function(){this._overlays={},this._overlayContainers=[],Ko(this._overlayRoot)},st.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=Ue(t);i=o.x,r=o.y}ag(n,i,r),_t(e.html,"data-container-id",t.id)},st.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=Ue(i).width:a=i.width,r=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=Ue(i).height:s=i.height,o=t.bottom*-1+s}ag(n,r||0,o||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},st.prototype._createOverlayContainer=function(e){var t=Ie('<div class="djs-overlays" />');wt(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},st.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";sg(this._overlayRoot,n)},st.prototype._getOverlayContainer=function(e,t){var n=Oe(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},st.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)),Tt(i)&&(i=Ie(i)),o=this._getOverlayContainer(n),r=Ie('<div class="djs-overlay" data-overlay-id="'+t+'">'),wt(r,{position:"absolute"}),r.appendChild(i),e.type&&Be(r).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();fs(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())},st.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&&(Je(r)&&r>t.scale||Je(o)&&o<t.scale))&&(c=!1),fs(a,c),this._updateOverlayScale(e,t)},st.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),Je(i)&&t.scale<i&&(a=(1/t.scale||1)*i),Je(r)&&t.scale>r&&(a=(1/t.scale||1)*r)),Je(a)&&(s="scale("+a+","+a+")"),sg(o,s)},st.prototype._updateOverlaysVisibilty=function(e){var t=this;A(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},st.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});A(o,function(c){t.remove(c.id)});var a=t._getOverlayContainer(r);if(a){mn(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",BC,function(i){var r=i.element,o=t._getOverlayContainer(r,!0);o&&(A(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&&Be(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 NC(e){var t=Ie('<div class="djs-overlay-container" />');return wt(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function ag(e,t,n){wt(e,{left:t+"px",top:n+"px"})}function fs(e,t){e.style.display=t===!1?"none":""}function sg(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const ds={__init__:["overlays"],overlays:["type",st]};function xl(e,t){t.invoke(V,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)})}X(xl,V),xl.$inject=["canvas","injector"];const $C={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",xl]};function xo(e){return CSS.escape(e)}var jC={"&":"&","<":"<",">":">",'"':""","'":"'"};function cg(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return jC[t]})}var FC="bjs-breadcrumbs-shown";function ug(e,t,n){var i=Ie('<ul class="bjs-breadcrumbs"></ul>'),r=n.getContainer(),o=Be(r);r.appendChild(i);var a=[];e.on("element.changed",function(c){var u=c.element,p=G(u),l=Oe(a,function(f){return f===p});l&&s()});function s(c){c&&(a=HC(c));var u=a.flatMap(function(l){var f=n.findRoot(bn(l))||n.findRoot(l.id);if(!f&&y(l,"bpmn:Process")){var d=t.find(function(_){var S=G(_);return S&&S.get("processRef")===l});f=d&&n.findRoot(d.id)}if(!f)return[];var h=cg(l.name||l.id),v=Ie('<li><span class="bjs-crumb"><a title="'+h+'">'+h+"</a></span></li>");return v.addEventListener("click",function(){n.setRootElement(f)}),v});i.innerHTML="";var p=u.length>1;o.toggle(FC,p),u.forEach(function(l){i.appendChild(l)})}e.on("root.set",function(c){s(c.element)})}ug.$inject=["eventBus","elementRegistry","canvas"];function HC(e){for(var t=G(e),n=[],i=t;i;i=i.$parent)(y(i,"bpmn:SubProcess")||y(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function lg(e,t){var n=null,i=new zC;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,!(!y(o,"bpmn:SubProcess")&&!s)){s=s||{x:0,y:0,zoom:1};var c=(a.x-s.x)*a.scale,u=(a.y-s.y)*a.scale;(c!==0||u!==0)&&t.scroll({dx:c,dy:u}),s.zoom!==a.scale&&t.zoom(s.zoom,{x:0,y:0})}}),e.on("diagram.clear",function(){i.clear(),n=null})}lg.$inject=["eventBus","canvas"];function zC(){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 pg={x:180,y:160};function zi(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,r){n._handleImport(r.definitions)})}zi.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)})}},zi.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;y(a,"bpmn:SubProcess")&&!o.isExpanded&&n.push(a),GC(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},zi.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=VC(e),i={x:n.x-pg.x,y:n.y-pg.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)})},zi.prototype._moveToDiPlane=function(e,t){var n=fg(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},zi.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},zi.$inject=["eventBus","moddle"];function fg(e){return y(e,"bpmndi:BPMNDiagram")?e:fg(e.$parent)}function VC(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)}}),ra(t)}function GC(e,t){var n=e.$parent;return!(!y(n,"bpmn:SubProcess")||n===t.bpmnElement||ge(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var hs=250,WC='<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>',UC="bjs-drilldown-empty";function gi(e,t,n,i,r){V.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",hs,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",hs,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],hs,function(a){var s=a.oldParent,c=a.newParent||a.parent,u=a.shape;o._canDrillDown(u)&&o._addOverlay(u),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(u)},!0),this.reverted(["shape.create","shape.move","shape.delete"],hs,function(a){var s=a.oldParent,c=a.newParent||a.parent,u=a.shape;o._canDrillDown(u)&&o._addOverlay(u),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(u)},!0),t.on("import.render.complete",function(){n.filter(function(a){return o._canDrillDown(a)}).map(function(a){o._addOverlay(a)})})}X(gi,V),gi.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},gi.prototype._canDrillDown=function(e){var t=this._canvas;return y(e,"bpmn:SubProcess")&&t.findRoot(bn(e))},gi.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=G(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var r=n&&n.get("flowElements")&&n.get("flowElements").length;Be(i.html).toggle(UC,!r)}},gi.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=G(e),r=n.get({element:e,type:"drilldown"});r.length&&this._removeOverlay(e);var o=Ie('<button type="button" class="bjs-drilldown">'+WC+"</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(bn(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:o}),this._updateOverlayVisibility(e)},gi.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},gi.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const qC={__depends__:[ds,el,$C],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",ug],drilldownCentering:["type",lg],drilldownOverlayBehavior:["type",gi],subprocessCompatibility:["type",zi]};function vi(e){$e.call(this,e)}X(vi,$e),vi.prototype._modules=[nd,qC,ds,Zt,Kr],vi.prototype._moddleExtensions={};var ms="keyboard.keydown",YC="keyboard.keyup",KC=1e3,dg="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 St(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(dg));var i=e&&e.bind!==!1;t.on("canvas.init",function(r){n._target=r.svg,i&&n.bind(),n._fire("init")})}St.$inject=["config.keyboard","eventBus"],St.prototype._keydownHandler=function(e){this._keyHandler(e,ms)},St.prototype._keyupHandler=function(e){this._keyHandler(e,YC)},St.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||ms,i),n&&e.preventDefault()}},St.prototype._isEventIgnored=function(e){return!1},St.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(dg)),this.unbind(),e=this._node=this._target,le.bind(e,"keydown",this._keydownHandler),le.bind(e,"keyup",this._keyupHandler),this._fire("bind")},St.prototype.getBinding=function(){return this._node},St.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),le.unbind(e,"keydown",this._keydownHandler),le.unbind(e,"keyup",this._keyupHandler)),this._node=null},St.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},St.prototype.addListener=function(e,t,n){ot(e)&&(n=t,t=e,e=KC),this._eventBus.on(n||ms,e,t)},St.prototype.removeListener=function(e,t){this._eventBus.off(t||ms,e)},St.prototype.hasModifier=lS,St.prototype.isCmd=Lt,St.prototype.isShift=Vu,St.prototype.isKey=nt;var XC=500;function xr(e,t){var n=this;e.on("editorActions.init",XC,function(i){var r=i.editorActions;n.registerBindings(t,r)})}xr.$inject=["eventBus","keyboard"],xr.prototype.registerBindings=function(e,t){function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("undo",function(i){var r=i.keyEvent;if(mS(r))return t.trigger("undo"),!0}),n("redo",function(i){var r=i.keyEvent;if(gS(r))return t.trigger("redo"),!0}),n("copy",function(i){var r=i.keyEvent;if(pS(r))return t.trigger("copy"),!0}),n("paste",function(i){var r=i.keyEvent;if(fS(r))return t.trigger("paste"),!0}),n("duplicate",function(i){var r=i.keyEvent;if(dS(r))return t.trigger("duplicate"),!0}),n("cut",function(i){var r=i.keyEvent;if(hS(r))return t.trigger("cut"),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(nt(["+","Add","="],r)&&Lt(r))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(nt(["-","Subtract"],r)&&Lt(r))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var r=i.keyEvent;if(nt("0",r)&&Lt(r))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var r=i.keyEvent;if(nt(["Backspace","Delete","Del"],r))return t.trigger("removeSelection"),!0})};const wl={__init__:["keyboard","keyboardBindings"],keyboard:["type",St],keyboardBindings:["type",xr]};var ZC={moveSpeed:50,moveSpeedAccelerated:200};function hg(e,t,n){var i=this;this._config=D({},ZC,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,u;switch(a.key){case"ArrowLeft":case"Left":u="left";break;case"ArrowUp":case"Up":u="up";break;case"ArrowRight":case"Right":u="right";break;case"ArrowDown":case"Down":u="down";break}return i.moveCanvas({speed:c,direction:u}),!0}}this.moveCanvas=function(o){var a=0,s=0,c=o.speed,u=c/Math.min(Math.sqrt(n.viewbox().scale),1);switch(o.direction){case"left":a=u;break;case"up":s=u;break;case"right":a=-u;break;case"down":s=-u;break}n.scroll({dx:a,dy:s})}}hg.$inject=["config.keyboardMove","keyboard","canvas"];const mg={__depends__:[wl],__init__:["keyboardMove"],keyboardMove:["type",hg]};var QC=15;function gg(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,u=n.button,p=Bi(s),l=an(p,c);if(!n.dragging&&JC(l)>QC&&(n.dragging=!0,u===0&&zh(e),za("grab")),n.dragging){var f=n.last||n.start;l=an(p,f),t.scroll({dx:l.x,dy:l.y}),n.last=p}s.preventDefault()}function o(s){le.unbind(document,"mousemove",r),le.unbind(document,"mouseup",o),n=null,Hh()}function a(s){if(!Mi(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:Bi(s)},le.bind(document,"mousemove",r),le.bind(document,"mouseup",o),!0}}this.isActive=function(){return!!n}}gg.$inject=["eventBus","canvas"];function JC(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const vg={__init__:["moveCanvas"],moveCanvas:["type",gg]};function yg(e,t){var n=Fc(e.min),i=Fc(e.max),r=Math.abs(n)+Math.abs(i);return r/t}function eP(e,t){return Math.max(e.min,Math.min(e.max,t))}var tP=Math.sign||function(e){return e>=0?1:-1},Sl={min:.2,max:4},_g=10,nP=.1,iP=.75;function wn(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=Ct(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||iP;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}wn.$inject=["config.zoomScroll","eventBus","canvas"],wn.prototype.scroll=function(t){this._canvas.scroll(t)},wn.prototype.reset=function(){this._canvas.zoom("fit-viewport")},wn.prototype.zoom=function(t,n){var i=yg(Sl,_g*2);this._totalDelta+=t,Math.abs(this._totalDelta)>nP&&(this._zoom(t,n,i),this._totalDelta=0)},wn.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||Kd()&&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))*tP(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)}},wn.prototype.stepZoom=function(t,n){var i=yg(Sl,_g);this._zoom(t,n,i)},wn.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=Fc(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(eP(Sl,s),t)},wn.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,r=this._enabled;return typeof t>"u"&&(t=!r),r!==t&&le[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},wn.prototype._init=function(e){this.toggle(e)};const bg={__init__:["zoomScroll"],zoomScroll:["type",wn]};function wo(e){vi.call(this,e)}X(wo,vi),wo.prototype._navigationModules=[mg,vg,bg],wo.prototype._modules=[].concat(vi.prototype._modules,wo.prototype._navigationModules);function Rl(e){return e&&e[e.length-1]}function Eg(e){return e.y}function xg(e){return e.x}var rP={left:xg,center:xg,right:function(e){return e.x+e.width},top:Eg,middle:Eg,bottom:function(e){return e.y+e.height}};function wr(e,t){this._modeling=e,this._rules=t}wr.$inject=["modeling","rules"],wr.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}},wr.prototype._isType=function(e,t){return t.indexOf(e)!==-1},wr.prototype._alignmentPosition=function(e,t){var n=this._getOrientationDetails(e),i=n.axis,r=n.dimension,o={},a={},s=!1,c,u,p;function l(f,d){return Math.round((f[i]+d[i]+d[r])/2)}if(this._isType(e,["left","top"]))o[e]=t[0][i];else if(this._isType(e,["right","bottom"]))p=Rl(t),o[e]=p[i]+p[r];else if(this._isType(e,["center","middle"])){if(A(t,function(f){var d=f[i]+Math.round(f[r]/2);a[d]?a[d].elements.push(f):a[d]={elements:[f],center:d}}),c=ln(a,function(f){return f.elements.length>1&&(s=!0),f.elements.length}),s)return o[e]=Rl(c).center,o;u=t[0],t=ln(t,function(f){return f[i]+f[r]}),p=Rl(t),o[e]=l(u,p)}return o},wr.prototype.trigger=function(e,t){var n=this._modeling,i,r=ye(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:r}),ae(i)&&(r=i),!(r.length<2||!i)){var o=rP[t],a=ln(r,o),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const oP={__init__:["alignElements"],alignElements:["type",wr]},aP=new vr;function Sr(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}Sr.$inject=["eventBus"],Sr.prototype.schedule=function(e,t=aP.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},Sr.prototype._schedule=function(e,t){const n=sP();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}},Sr.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},Sr.prototype._cancel=function(e){clearTimeout(e.executionId)};function sP(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const cP={scheduler:["type",Sr]};var uP="djs-element-hidden",gs=".entry",lP=1e3,wg=8,pP=300;function Ye(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}Ye.$inject=["canvas","elementRegistry","eventBus","scheduler"],Ye.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=ae(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=ae(i.target)?i.target:[i.target];r.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},Ye.prototype._createContainer=function(){var e=Ie('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},Ye.prototype.registerProvider=function(e,t){t||(t=e,e=lP),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},Ye.prototype.getEntries=function(e){var t=this._getProviders(),n=ae(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return A(t,function(r){if(ot(r[n])){var o=r[n](e);ot(o)?i=o(i):A(o,function(a,s){i[s]=a})}}),i},Ye.prototype.trigger=function(e,t,n){var i=this,r,o,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(r=_t(a,"data-action"),o=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(r,"hover",o,n)},pP);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(r,e,o,n)},Ye.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(ot(s)){if(t==="click")return s(n,r,i)}else if(s[t])return s[t](n,r,i);n.preventDefault()}}}},Ye.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))}},Ye.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Ye.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),i;A(t,function(r,o){var a=r.group||"default",s=Ie(r.html||'<div class="entry" draggable="true"></div>'),c;_t(s,"data-action",o),c=Ae("[data-group="+xo(a)+"]",n),c||(c=Ie('<div class="group"></div>'),_t(c,"data-group",a),n.appendChild(c)),c.appendChild(s),r.className&&fP(s,r.className),r.title&&_t(s,"title",r.title),r.imageUrl&&(i=Ie("<img>"),_t(i,"src",r.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),Be(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},Ye.prototype._createHtml=function(e){var t=this,n=Ie('<div class="djs-context-pad"></div>');return Dt.bind(n,gs,"click",function(i){t.trigger("click",i)}),Dt.bind(n,gs,"dragstart",function(i){t.trigger("dragstart",i)}),Dt.bind(n,gs,"mouseover",function(i){t.trigger("mouseover",i)}),Dt.bind(n,gs,"mouseout",function(i){t.trigger("mouseout",i)}),le.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},Ye.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()&&hP(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},Ye.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},Ye.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return ae(e)!==ae(n)?!1:ae(e)?e.length===n.length&&Ci(e,function(i){return n.includes(i)}):n===e},Ye.prototype.isShown=function(){return this.isOpen()&&Be(this._current.html).has("open")},Ye.prototype.show=function(){this.isOpen()&&(Be(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},Ye.prototype.hide=function(){this.isOpen()&&(Be(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},Ye.prototype._getPosition=function(e){if(!ae(e)&&Te(e)){var t=this._canvas.viewbox(),n=dP(e),i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale;return{left:i+wg*this._canvas.zoom(),top:r}}var o=this._canvas.getContainer(),a=o.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+wg*this._canvas.zoom(),top:s.top-a.top}},Ye.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")},Ye.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=ae(n)?n:[n],r=i.some(function(o){return t._canvas.hasMarker(o,uP)});r?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},Ye.prototype._getTargetBounds=function(e){var t=this,n=ae(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 fP(e,t){var n=Be(e);t=ae(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function dP(e){return e.waypoints[e.waypoints.length-1]}function hP(e,t){return e=ae(e)?e:[e],t=ae(t)?t:[t],e.length===t.length&&Ci(e,function(n){return t.includes(n)})}const Sg={__depends__:[Ha,cP,ds],contextPad:["type",Ye]};var vs,Fe,Rg,yi,Cg,Pg,Ag,Cl,ys,So,Tg,Pl,Al,Tl,_s={},bs=[],mP=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Es=Array.isArray;function zn(e,t){for(var n in t)e[n]=t[n];return e}function Ml(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Mg(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?vs.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 xs(e,a,i,r,null)}function xs(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??++Rg,__i:-1,__u:0};return r==null&&Fe.vnode!=null&&Fe.vnode(o),o}function ws(e){return e.children}function Ss(e,t){this.props=e,this.context=t}function Vi(e,t){if(t==null)return e.__?Vi(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"?Vi(e):null}function gP(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],r=[],o=zn({},t);o.__v=t.__v+1,Fe.vnode&&Fe.vnode(o),kl(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??Vi(t),!!(32&t.__u),r),o.__v=t.__v,o.__.__k[o.__i]=o,$g(i,o,r),t.__e=t.__=null,o.__e!=n&&kg(o)}}function kg(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}),kg(e)}function Dg(e){(!e.__d&&(e.__d=!0)&&yi.push(e)&&!Rs.__r++||Cg!=Fe.debounceRendering)&&((Cg=Fe.debounceRendering)||Pg)(Rs)}function Rs(){try{for(var e,t=1;yi.length;)yi.length>t&&yi.sort(Ag),e=yi.shift(),t=yi.length,gP(e)}finally{yi.length=Rs.__r=0}}function Og(e,t,n,i,r,o,a,s,c,u,p){var l,f,d,h,v,_,S=i&&i.__k||bs,w=t.length;for(c=vP(n,t,S,c,w),l=0;l<w;l++)(d=n.__k[l])!=null&&(f=d.__i!=-1&&S[d.__i]||_s,d.__i=l,_=kl(e,d,f,r,o,a,s,c,u,p),h=d.__e,d.ref&&f.ref!=d.ref&&(f.ref&&Dl(f.ref,null,d),p.push(d.ref,d.__c||h,d)),v==null&&h!=null&&(v=h),4&d.__u?(c=Ig(d,c,e),f.__e&&(f.__e=null)):typeof d.type=="function"&&_!==void 0?c=_:h&&(c=h.nextSibling),d.__u&=-7);return n.__e=v,c}function vP(e,t,n,i,r){var o,a,s,c,u,p=n.length,l=p,f=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]=xs(null,a,null,null,null):Es(a)?a=e.__k[o]=xs(ws,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=xs(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[o]=a,c=o+f,a.__=e,a.__b=e.__b+1,s=null,(u=a.__i=yP(a,n,c,l))!=-1&&(l--,(s=n[u])&&(s.__u|=2)),s==null||s.__v==null?(u==-1&&(r>p?f--:r<p&&f++),typeof a.type!="function"&&(a.__u|=4)):u!=c&&(u==c-1?f--:u==c+1?f++:(u>c?f--:f++,a.__u|=4))):e.__k[o]=null;if(l)for(o=0;o<p;o++)(s=n[o])!=null&&(2&s.__u)==0&&(s.__e==i&&(i=Vi(s)),Fg(s,s));return i}function Ig(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=Ig(i[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=Vi(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function yP(e,t,n,i){var r,o,a,s=e.key,c=e.type,u=t[n],p=u!=null&&(2&u.__u)==0;if(u===null&&s==null||p&&s==u.key&&c==u.type)return n;if(i>(p?1:0)){for(r=n-1,o=n+1;r>=0||o<t.length;)if((u=t[a=r>=0?r--:o++])!=null&&(2&u.__u)==0&&s==u.key&&c==u.type)return a}return-1}function Lg(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||mP.test(t)?n:n+"px"}function Cs(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||Lg(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||Lg(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(Tg,"$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[So]=i[So]:(n[So]=Pl,e.addEventListener(t,o?Tl:Al,o)):e.removeEventListener(t,o?Tl:Al,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 Bg(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[ys]==null)t[ys]=Pl++;else if(t[ys]<n[So])return;return n(Fe.event?Fe.event(t):t)}}}function kl(e,t,n,i,r,o,a,s,c,u){var p,l,f,d,h,v,_,S,w,E,b,R,T,O,C,F,N=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[s=t.__e=n.__e]),(p=Fe.__b)&&p(t);e:if(typeof N=="function"){l=a.length;try{if(w=t.props,E=N.prototype&&N.prototype.render,b=(p=N.contextType)&&i[p.__c],R=p?b?b.props.value:p.__:i,n.__c?S=(f=t.__c=n.__c).__=f.__E:(E?t.__c=f=new N(w,R):(t.__c=f=new Ss(w,R),f.constructor=N,f.render=bP),b&&b.sub(f),f.state||(f.state={}),f.__n=i,d=f.__d=!0,f.__h=[],f._sb=[]),E&&f.__s==null&&(f.__s=f.state),E&&N.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=zn({},f.__s)),zn(f.__s,N.getDerivedStateFromProps(w,f.__s))),h=f.props,v=f.state,f.__v=t,d)E&&N.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),E&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(E&&N.getDerivedStateFromProps==null&&w!==h&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(w,R),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(w,f.__s,R)===!1){t.__v!=n.__v&&(f.props=w,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(I){I&&(I.__=t)}),bs.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&a.push(f),s=Vi(n);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(w,f.__s,R),E&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(h,v,_)})}if(f.context=R,f.props=w,f.__P=e,f.__e=!1,T=Fe.__r,O=0,E)f.state=f.__s,f.__d=!1,T&&T(t),p=f.render(f.props,f.state,f.context),bs.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,T&&T(t),p=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++O<25);f.state=f.__s,f.getChildContext!=null&&(i=zn(zn({},i),f.getChildContext())),E&&!d&&f.getSnapshotBeforeUpdate!=null&&(_=f.getSnapshotBeforeUpdate(h,v)),C=p!=null&&p.type===ws&&p.key==null?jg(p.props.children):p,s=Og(e,Es(C)?C:[C],t,n,i,r,o,a,s,c,u),f.base=t.__e,t.__u&=-161,f.__h.length&&a.push(f),S&&(f.__E=f.__=null)}catch(I){if(a.length=l,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(F=o.length;F--;)Ml(o[F])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),I.then||Ng(t),Fe.__e(I,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=_P(n.__e,t,n,i,r,o,a,c,u);return(p=Fe.diffed)&&p(t),128&t.__u?void 0:s}function Ng(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Ng))}function $g(e,t,n){for(var i=0;i<n.length;i++)Dl(n[i],n[++i],n[++i]);Fe.__c&&Fe.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){Fe.__e(o,r.__v)}})}function jg(e){return typeof e!="object"||e==null||e.__b>0?e:Es(e)?e.map(jg):e.constructor!==void 0?null:zn({},e)}function _P(e,t,n,i,r,o,a,s,c){var u,p,l,f,d,h,v,_=n.props||_s,S=t.props,w=t.type;if(w=="svg"?r="http://www.w3.org/2000/svg":w=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),o!=null){for(u=0;u<o.length;u++)if((d=o[u])&&"setAttribute"in d==!!w&&(w?d.localName==w:d.nodeType==3)){e=d,o[u]=null;break}}if(e==null){if(w==null)return document.createTextNode(S);e=document.createElementNS(r,w,S.is&&S),s&&(Fe.__m&&Fe.__m(t,o),s=!1),o=null}if(w==null)_===S||s&&e.data==S||(e.data=S);else{if(o=w=="textarea"&&S.defaultValue!=null?null:o&&vs.call(e.childNodes),!s&&o!=null)for(_={},u=0;u<e.attributes.length;u++)_[(d=e.attributes[u]).name]=d.value;for(u in _)d=_[u],u=="dangerouslySetInnerHTML"?l=d:u=="children"||u in S||u=="value"&&"defaultValue"in S||u=="checked"&&"defaultChecked"in S||Cs(e,u,null,d,r);for(u in S)d=S[u],u=="children"?f=d:u=="dangerouslySetInnerHTML"?p=d:u=="value"?h=d:u=="checked"?v=d:s&&typeof d!="function"||_[u]===d||Cs(e,u,d,_[u],r);if(p)s||l&&(p.__html==l.__html||p.__html==e.innerHTML)||(e.innerHTML=p.__html),t.__k=[];else if(l&&(e.innerHTML=""),Og(t.type=="template"?e.content:e,Es(f)?f:[f],t,n,i,w=="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,a,o?o[0]:n.__k&&Vi(n,0),s,c),o!=null)for(u=o.length;u--;)Ml(o[u]);s&&w!="textarea"||(u="value",w=="progress"&&h==null?e.removeAttribute("value"):h!=null&&(h!==e[u]||w=="progress"&&!h||w=="option"&&h!=_[u])&&Cs(e,u,h,_[u],r),u="checked",v!=null&&v!=e[u]&&Cs(e,u,v,_[u],r))}return e}function Dl(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){Fe.__e(r,n)}}function Fg(e,t,n){var i,r;if(Fe.unmount&&Fe.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||Dl(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){Fe.__e(o,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&Fg(i[r],t,n||typeof e.type!="function");n||Ml(e.__e),e.__c=e.__=e.__e=void 0}function bP(e,t,n){return this.constructor(e,n)}function Hg(e,t,n){var i,r,o,a;t==document&&(t=document.documentElement),Fe.__&&Fe.__(e,t),r=(i=!1)?null:t.__k,o=[],a=[],kl(t,e=t.__k=Mg(ws,null,[e]),r||_s,_s,t.namespaceURI,r?null:t.firstChild?vs.call(t.childNodes):null,o,r?r.__e:t.firstChild,i,a),$g(o,e,a),e.props.children=null}vs=bs.slice,Fe={__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}},Rg=0,Ss.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=zn({},this.state),typeof e=="function"&&(e=e(zn({},n),this.props)),e&&zn(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Dg(this))},Ss.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Dg(this))},Ss.prototype.render=ws,yi=[],Pg=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Ag=function(e,t){return e.__v.__b-t.__v.__b},Rs.__r=0,Cl=Math.random().toString(8),ys="__d"+Cl,So="__a"+Cl,Tg=/(PointerCapture)$|Capture$/i,Pl=0,Al=Bg(!1),Tl=Bg(!0);var zg=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,zg(e,s,n,["",null])),i.push(r),s[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(s)}return i},Vg=new Map;function EP(e){var t=Vg.get(this);return t||(t=new Map,Vg.set(this,t)),(t=zg(this,t.get(e)||(t.set(e,t=(function(n){for(var i,r,o=1,a="",s="",c=[0],u=function(f){o===1&&(f||(a=a.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?c.push(0,f,a):o===3&&(f||a)?(c.push(3,f,a),o=2):o===2&&a==="..."&&f?c.push(4,f,0):o===2&&a&&!f?c.push(5,0,!0,a):o>=5&&((a||!f&&o===5)&&(c.push(o,0,a,r),o=6),f&&(c.push(o,f,0,r),o=6)),a=""},p=0;p<n.length;p++){p&&(o===1&&u(),u(p));for(var l=0;l<n[p].length;l++)i=n[p][l],o===1?i==="<"?(u(),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===">"?(u(),o=1):o&&(i==="="?(o=5,r=a,a=""):i==="/"&&(o<5||n[p][l+1]===">")?(u(),o===3&&(c=c[0]),o=c,(c=c[0]).push(2,0,o),o=0):i===" "||i===" "||i===`
|
|
10
|
-
`||i==="\r"?(u(),o=2):a+=i),o===3&&a==="!--"&&(o=4,c=c[0])}return u(),c})(e)),t),arguments,[])).length>1?t:t[0]}var
|
|
10
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="`+f+'" height="'+d+'" viewBox="'+l+" "+p+" "+f+" "+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}},ht.prototype._setDefinitions=function(e){this._definitions=e},ht.prototype.getModules=function(){return this._modules},ht.prototype.clear=function(){this.getDefinitions()&&Ji.prototype.clear.call(this)},ht.prototype.destroy=function(){Ji.prototype.destroy.call(this),li(this._container)},ht.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},ht.prototype.off=function(e,t){this.get("eventBus").off(e,t)},ht.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=et(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},ht.prototype.getDefinitions=function(){return this._definitions},ht.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},ht.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=D(oi(n,["additionalModules"]),{canvas:D({},n.canvas,{container:e}),modules:a});Ji.call(this,s),n&&n.container&&this.attachTo(n.container)},ht.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},ht.prototype._createContainer=function(e){const t=ut('<div class="bjs-container"></div>');return fn(t,{width:Kh(e.width),height:Kh(e.height),position:e.position}),t},ht.prototype._createModdle=function(e){const t=D({},this._moddleExtensions,e.moddleExtensions);return new ad(t)},ht.prototype._modules=[];function Cs(e,t){return e.warnings=t,e}function N1(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 B1={width:"100%",height:"100%",position:"relative"};function Kh(e){return e+(xe(e)?"px":"")}function $1(e,t){return t&&at(e.diagrams,function(n){return n.id===t})||null}function j1(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+Wh+"</a>",i=ut(n);fn(et("svg",i),Uh),fn(i,qh,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),we.bind(i,"click",function(r){I1(),r.preventDefault()})}function ao(e){ht.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)}ie(ao,ht),ao.prototype._createModdle=function(e){var t=ht.prototype._createModdle.call(this,e);return t.ids=new ui([32,36,1]),t},ao.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 Be(e,t){return v(e,"bpmn:CallActivity")?!1:v(e,"bpmn:SubProcess")?(t=t||Ve(e),t&&v(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):v(e,"bpmn:Participant")?!!K(e).processRef:!0}function Gt(e){if(!(!v(e,"bpmn:Participant")&&!v(e,"bpmn:Lane"))){var t=Ve(e).isHorizontal;return t===void 0?!0:t}}function F1(e){return e&&K(e).isInterrupting!==!1}function sn(e){return e&&!!K(e).triggeredByEvent}function so(e,t){var n=K(e).eventDefinitions;return Fi(n,function(i){return v(i,t)})}function H1(e){return so(e,"bpmn:ErrorEventDefinition")}function z1(e){return so(e,"bpmn:EscalationEventDefinition")}function V1(e){return so(e,"bpmn:CompensateEventDefinition")}var Dr={width:90,height:20},Xh=15;function er(e){return v(e,"bpmn:Event")||v(e,"bpmn:Gateway")||v(e,"bpmn:DataStoreReference")||v(e,"bpmn:DataObjectReference")||v(e,"bpmn:DataInput")||v(e,"bpmn:DataOutput")||v(e,"bpmn:SequenceFlow")||v(e,"bpmn:MessageFlow")||v(e,"bpmn:Group")}function Ps(e){return ke(e.label)}function G1(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=W1(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-=Xh:a+=Xh,{x:a,y:s}}function W1(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 sl(e){return e.waypoints?G1(e.waypoints):v(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+Dr.height/2}:{x:e.x+e.width/2,y:e.y+e.height+Dr.height/2}}function U1(e,t){var n,i,r,o=e.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(Dr.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=sl(t),i=Dr),D({x:n.x-i.width/2,y:n.y-i.height/2},i)}function Zh(e){if(v(e,"bpmn:FlowElement")||v(e,"bpmn:Participant")||v(e,"bpmn:Lane")||v(e,"bpmn:SequenceFlow")||v(e,"bpmn:MessageFlow")||v(e,"bpmn:DataInput")||v(e,"bpmn:DataOutput"))return"name";if(v(e,"bpmn:TextAnnotation"))return"text";if(v(e,"bpmn:Group"))return"categoryValueRef"}function q1(e){var t=e.categoryValueRef;return t&&t.value||""}function In(e){var t=e.businessObject,n=Zh(t);if(n)return n==="categoryValueRef"?q1(t):t[n]||""}function Y1(e,t){var n=e.businessObject,i=Zh(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function K1(e){return ke(e)&&er(e.labelTarget)}var co=7;function Qh(e){let t=[];return M(e.incoming,n=>{v(n,"bpmn:Association")&&v(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),M(e.outgoing,n=>{v(n,"bpmn:Association")&&v(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function ea(e){const t=new Map;return M(el(e),n=>{M(Qh(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 cl="hsl(225, 10%, 15%)",X1="white";function hi(e,t){return Fi(e.eventDefinitions,function(n){return n.$type===t})}function Z1(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function Q1(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function Ie(e,t,n){var i=Ve(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||X1}function te(e,t,n){var i=Ve(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||cl}function ta(e,t,n,i){var r=Ve(e),o=r.get("label");return i||o&&o.get("color:color")||t||te(e,n)}function Jh(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 Tr(r)}function ul(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 Tr(a)}function J1(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 Tr(s)}function eS(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 Tr(o)}function na(e,t={}){return{width:Fn(e,t),height:Sn(e,t)}}function Fn(e,t={}){return _n(t,"width")?t.width:e.width}function Sn(e,t={}){return _n(t,"height")?t.height:e.height}var tS=new ui,nS=10,As=3,iS=1.5,Ts=10,rS=4,uo=.95,oS=1,aS=.25;function Or(e,t,n,i,r,o,a){Si.call(this,t,a);var s=e&&e.defaultFillColor,c=e&&e.defaultStrokeColor,u=e&&e.defaultLabelColor;function l(C){return n.computeStyle(C,{strokeLinecap:"round",strokeLinejoin:"round",stroke:cl,strokeWidth:2,fill:"white"})}function p(C){return n.computeStyle(C,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:cl,strokeWidth:2})}function f(C,_){var{ref:y={x:0,y:0},scale:k=1,element:I,parentGfx:W=r._svg}=_,ae=pe("marker",{id:C,viewBox:"0 0 20 20",refX:y.x,refY:y.y,markerWidth:20*k,markerHeight:20*k,orient:"auto"});Se(ae,I);var Te=et(":scope > defs",W);Te||(Te=pe("defs"),Se(W,Te)),Se(Te,ae)}function d(C,_,y,k){var I=tS.nextPrefixed("marker-");return h(C,I,_,y,k),"url(#"+I+")"}function h(C,_,y,k,I){if(y==="sequenceflow-end"){var W=pe("path",{d:"M 1 5 L 11 10 L 1 15 Z",...l({fill:I,stroke:I,strokeWidth:1})});f(_,{element:W,ref:{x:11,y:10},scale:.5,parentGfx:C})}if(y==="messageflow-start"){var ae=pe("circle",{cx:6,cy:6,r:3.5,...l({fill:k,stroke:I,strokeWidth:1,strokeDasharray:[1e4,1]})});f(_,{element:ae,ref:{x:6,y:6},parentGfx:C})}if(y==="messageflow-end"){var Te=pe("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...l({fill:k,stroke:I,strokeWidth:1,strokeDasharray:[1e4,1]})});f(_,{element:Te,ref:{x:8.5,y:5},parentGfx:C})}if(y==="association-start"){var He=pe("path",{d:"M 11 5 L 1 10 L 11 15",...p({fill:"none",stroke:I,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(_,{element:He,ref:{x:1,y:10},scale:.5,parentGfx:C})}if(y==="association-end"){var bt=pe("path",{d:"M 1 5 L 11 10 L 1 15",...p({fill:"none",stroke:I,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(_,{element:bt,ref:{x:11,y:10},scale:.5,parentGfx:C})}if(y==="conditional-flow-marker"){var nt=pe("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...l({fill:k,stroke:I})});f(_,{element:nt,ref:{x:-1,y:10},scale:.5,parentGfx:C})}if(y==="conditional-default-flow-marker"){var kt=pe("path",{d:"M 6 4 L 10 16",...l({stroke:I,fill:"none"})});f(_,{element:kt,ref:{x:0,y:10},scale:.5,parentGfx:C})}}function m(C,_,y,k,I={}){Ht(k)&&(I=k,k=0),k=k||0,I=l(I);var W=_/2,ae=y/2,Te=pe("circle",{cx:W,cy:ae,r:Math.round((_+y)/4-k),...I});return Se(C,Te),Te}function g(C,_,y,k,I,W){Ht(I)&&(W=I,I=0),I=I||0,W=l(W);var ae=pe("rect",{x:I,y:I,width:_-I*2,height:y-I*2,rx:k,ry:k,...W});return Se(C,ae),ae}function R(C,_,y,k){var I=_/2,W=y/2,ae=[{x:I,y:0},{x:_,y:W},{x:I,y},{x:0,y:W}],Te=ae.map(function(bt){return bt.x+","+bt.y}).join(" ");k=l(k);var He=pe("polygon",{...k,points:Te});return Se(C,He),He}function E(C,_,y,k){y=p(y);var I=qo(_,y,k);return Se(C,I),I}function x(C,_,y){return E(C,_,y,5)}function b(C,_,y){y=p(y);var k=pe("path",{...y,d:_});return Se(C,k),k}function w(C,_,y,k){return b(_,y,D({"data-marker":C},k))}function T(C){return wt[C]}function L(C){return function(_,y,k){return T(C)(_,y,k)}}var A={"bpmn:MessageEventDefinition":function(C,_,y={},k){var I=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.235,my:.315}}),W=k?te(_,c,y.stroke):Ie(_,s,y.fill),ae=k?Ie(_,s,y.fill):te(_,c,y.stroke),Te=b(C,I,{fill:W,stroke:ae,strokeWidth:1});return Te},"bpmn:TimerEventDefinition":function(C,_,y={}){var k=y.width||_.width,I=y.height||_.height,W=y.width?1:2,ae=m(C,k,I,.2*I,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:W}),Te=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:k,containerHeight:I,position:{mx:.5,my:.5}});b(C,Te,{stroke:te(_,c,y.stroke),strokeWidth:W});for(var He=0;He<12;He++){var bt=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:k,containerHeight:I,position:{mx:.5,my:.5}}),nt=k/2,kt=I/2;b(C,bt,{strokeWidth:1,stroke:te(_,c,y.stroke),transform:"rotate("+He*30+","+kt+","+nt+")"})}return ae},"bpmn:EscalationEventDefinition":function(C,_,y={},k){var I=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.5,my:.2}}),W=k?te(_,c,y.stroke):Ie(_,s,y.fill);return b(C,I,{fill:W,stroke:te(_,c,y.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(C,_,y={}){var k=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.5,my:.222}});return b(C,k,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(C,_,y={},k){var I=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.57,my:.263}}),W=k?te(_,c,y.stroke):Ie(_,s,y.fill);return b(C,I,{fill:W,stroke:te(_,c,y.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(C,_,y={},k){var I=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.2,my:.722}}),W=k?te(_,c,y.stroke):Ie(_,s,y.fill);return b(C,I,{fill:W,stroke:te(_,c,y.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(C,_,y={},k){var I=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.638,my:-.055}}),W=k?te(_,c,y.stroke):"none",ae=b(C,I,{fill:W,stroke:te(_,c,y.stroke),strokeWidth:1});return Vh(ae,45),ae},"bpmn:CompensateEventDefinition":function(C,_,y={},k){var I=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.22,my:.5}}),W=k?te(_,c,y.stroke):Ie(_,s,y.fill);return b(C,I,{fill:W,stroke:te(_,c,y.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(C,_,y={},k){var I=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.5,my:.2}}),W=k?te(_,c,y.stroke):Ie(_,s,y.fill);return b(C,I,{strokeWidth:1,fill:W,stroke:te(_,c,y.stroke)})},"bpmn:MultipleEventDefinition":function(C,_,y={},k){var I=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.211,my:.36}}),W=k?te(_,c,y.stroke):Ie(_,s,y.fill);return b(C,I,{fill:W,stroke:te(_,c,y.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(C,_,y={}){var k=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.458,my:.194}});return b(C,k,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(C,_,y={}){var k=m(C,_.width,_.height,8,{fill:te(_,c,y.stroke),stroke:te(_,c,y.stroke),strokeWidth:4});return k}};function F(C,_,y={},k){var I=K(C),W=Z1(I),ae=k||C;return I.get("eventDefinitions")&&I.get("eventDefinitions").length>1?I.get("parallelMultiple")?A["bpmn:ParallelMultipleEventDefinition"](_,ae,y,W):A["bpmn:MultipleEventDefinition"](_,ae,y,W):hi(I,"bpmn:MessageEventDefinition")?A["bpmn:MessageEventDefinition"](_,ae,y,W):hi(I,"bpmn:TimerEventDefinition")?A["bpmn:TimerEventDefinition"](_,ae,y,W):hi(I,"bpmn:ConditionalEventDefinition")?A["bpmn:ConditionalEventDefinition"](_,ae,y,W):hi(I,"bpmn:SignalEventDefinition")?A["bpmn:SignalEventDefinition"](_,ae,y,W):hi(I,"bpmn:EscalationEventDefinition")?A["bpmn:EscalationEventDefinition"](_,ae,y,W):hi(I,"bpmn:LinkEventDefinition")?A["bpmn:LinkEventDefinition"](_,ae,y,W):hi(I,"bpmn:ErrorEventDefinition")?A["bpmn:ErrorEventDefinition"](_,ae,y,W):hi(I,"bpmn:CancelEventDefinition")?A["bpmn:CancelEventDefinition"](_,ae,y,W):hi(I,"bpmn:CompensateEventDefinition")?A["bpmn:CompensateEventDefinition"](_,ae,y,W):hi(I,"bpmn:TerminateEventDefinition")?A["bpmn:TerminateEventDefinition"](_,ae,y,W):null}var H={ParticipantMultiplicityMarker:function(C,_,y={}){var k=Fn(_,y),I=Sn(_,y),W=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:k,containerHeight:I,position:{mx:(k/2-6)/k,my:(I-15)/I}});w("participant-multiplicity",C,W,{strokeWidth:2,fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke)})},SubProcessMarker:function(C,_,y={}){var k=g(C,14,14,0,{strokeWidth:1,fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke)});Zt(k,_.width/2-7.5,_.height-20);var I=i.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:_.width,containerHeight:_.height,position:{mx:(_.width/2-7.5)/_.width,my:(_.height-20)/_.height}});w("sub-process",C,I,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke)})},ParallelMarker:function(C,_,y){var k=Fn(_,y),I=Sn(_,y),W=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:k,containerHeight:I,position:{mx:(k/2+y.parallel)/k,my:(I-20)/I}});w("parallel",C,W,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke)})},SequentialMarker:function(C,_,y){var k=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:(_.width/2+y.seq)/_.width,my:(_.height-19)/_.height}});w("sequential",C,k,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke)})},CompensationMarker:function(C,_,y){var k=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:(_.width/2+y.compensation)/_.width,my:(_.height-13)/_.height}});w("compensation",C,k,{strokeWidth:1,fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke)})},LoopMarker:function(C,_,y){var k=Fn(_,y),I=Sn(_,y),W=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:k,containerHeight:I,position:{mx:(k/2+y.loop)/k,my:(I-7)/I}});w("loop",C,W,{strokeWidth:1.5,fill:"none",stroke:te(_,c,y.stroke),strokeMiterlimit:.5})},AdhocMarker:function(C,_,y){var k=Fn(_,y),I=Sn(_,y),W=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:k,containerHeight:I,position:{mx:(k/2+y.adhoc)/k,my:(I-15)/I}});w("adhoc",C,W,{strokeWidth:1,fill:te(_,c,y.stroke),stroke:te(_,c,y.stroke)})}};function N(C,_,y,k){H[C](_,y,k)}function z(C,_,y=[],k={}){k={fill:k.fill,stroke:k.stroke,width:Fn(_,k),height:Sn(_,k)};var I=K(_),W=y.includes("SubProcessMarker");W?k={...k,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:k={...k,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},I.get("isForCompensation")&&y.push("CompensationMarker"),v(I,"bpmn:AdHocSubProcess")&&(y.push("AdhocMarker"),W||D(k,{compensation:k.compensation-18}));var ae=I.get("loopCharacteristics"),Te=ae&&ae.get("isSequential");ae&&(D(k,{compensation:k.compensation-18}),y.includes("AdhocMarker")&&D(k,{seq:-23,loop:-18,parallel:-24}),Te===void 0&&y.push("LoopMarker"),Te===!1&&y.push("ParallelMarker"),Te===!0&&y.push("SequentialMarker")),y.includes("CompensationMarker")&&y.length===1&&D(k,{compensation:-8}),M(y,function(He){N(He,C,_,k)})}function ue(C,_,y={}){y=D({size:{width:100}},y);var k=o.createText(_||"",y);return $e(k).add("djs-label"),Se(C,k),k}function je(C,_,y,k={}){var I=K(_),W=na({x:_.x,y:_.y,width:_.width,height:_.height},k);return ue(C,I.name,{align:y,box:W,padding:7,style:{fill:ta(_,u,c,k.stroke)}})}function tt(C,_,y={}){var k={width:_.width,height:_.height,x:_.width/2+_.x,y:_.height/2+_.y};return ue(C,In(_),{box:k,style:D({},o.getExternalStyle(),{fill:ta(_,u,c,y.stroke)})})}function X(C,_,y,k={}){var I=Gt(y),W=ue(C,_,{box:{height:30,width:I?Sn(y,k):Fn(y,k)},align:"center-middle",style:{fill:ta(y,u,c,k.stroke)}});if(I){var ae=-1*Sn(y,k);Ss(W,0,-ae,270)}}function se(C,_,y={}){var{width:k,height:I}=na(_,y);return g(C,k,I,Ts,{...y,fill:Ie(_,s,y.fill),fillOpacity:uo,stroke:te(_,c,y.stroke)})}function fe(C,_,y={}){var k=K(_),I=Ie(_,s,y.fill),W=te(_,c,y.stroke);return(k.get("associationDirection")==="One"||k.get("associationDirection")==="Both")&&(y.markerEnd=d(C,"association-end",I,W)),k.get("associationDirection")==="Both"&&(y.markerStart=d(C,"association-start",I,W)),y=Ge(y,["markerStart","markerEnd"]),x(C,_.waypoints,{...y,stroke:W,strokeDasharray:"0, 5"})}function oe(C,_,y={}){var k=Ie(_,s,y.fill),I=te(_,c,y.stroke),W=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.474,my:.296}}),ae=b(C,W,{fill:k,fillOpacity:uo,stroke:I}),Te=K(_);if(Q1(Te)){var He=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.33,my:(_.height-18)/_.height}});b(C,He,{strokeWidth:2,fill:k,stroke:I})}return ae}function de(C,_,y={}){return m(C,_.width,_.height,{fillOpacity:uo,...y,fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke)})}function ee(C,_,y={}){return R(C,_.width,_.height,{fill:Ie(_,s,y.fill),fillOpacity:uo,stroke:te(_,c,y.stroke)})}function $(C,_,y={}){var k=g(C,Fn(_,y),Sn(_,y),0,{fill:Ie(_,s,y.fill),fillOpacity:y.fillOpacity||uo,stroke:te(_,c,y.stroke),strokeWidth:1.5}),I=K(_);if(v(I,"bpmn:Lane")){var W=I.get("name");X(C,W,_,y)}return k}function B(C,_,y={}){var k=se(C,_,y),I=Be(_);if(sn(_)&&(re(k,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!I)){var W=K(_).flowElements||[],ae=W.filter(Te=>v(Te,"bpmn:StartEvent"));ae.length===1&&U(ae[0],C,y,_)}return je(C,_,I?"center-top":"center-middle",y),I?z(C,_,void 0,y):z(C,_,["SubProcessMarker"],y),k}function U(C,_,y,k){var I=22,W={fill:Ie(k,s,y.fill),stroke:te(k,c,y.stroke),width:I,height:I},ae=K(C).isInterrupting,Te=ae?0:3,He=ae?1:1.2,bt=20,nt=(I-bt)/2,kt="translate("+nt+","+nt+")";m(_,bt,bt,{fill:W.fill,stroke:W.stroke,strokeWidth:He,strokeDasharray:Te,transform:kt}),F(C,_,W,k)}function Ae(C,_,y={}){var k=se(C,_,y);return je(C,_,"center-middle",y),z(C,_,void 0,y),k}var wt=this.handlers={"bpmn:AdHocSubProcess":function(C,_,y={}){return Be(_)?y=Ge(y,["fill","stroke","width","height"]):y=Ge(y,["fill","stroke"]),B(C,_,y)},"bpmn:Association":function(C,_,y={}){return y=Ge(y,["fill","stroke"]),fe(C,_,y)},"bpmn:BoundaryEvent":function(C,_,y={}){var{renderIcon:k=!0}=y;y=Ge(y,["fill","stroke"]);var I=K(_),W=I.get("cancelActivity");y={strokeWidth:1.5,fill:Ie(_,s,y.fill),fillOpacity:oS,stroke:te(_,c,y.stroke)},W||(y.strokeDasharray="6");var ae=de(C,_,y);return m(C,_.width,_.height,As,{...y,fill:"none"}),k&&F(_,C,y),ae},"bpmn:BusinessRuleTask":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var k=Ae(C,_,y),I=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),W=b(C,I);re(W,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:1});var ae=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),Te=b(C,ae);return re(Te,{fill:te(_,c,y.stroke),stroke:te(_,c,y.stroke),strokeWidth:1}),k},"bpmn:CallActivity":function(C,_,y={}){return y=Ge(y,["fill","stroke"]),B(C,_,{strokeWidth:5,...y})},"bpmn:ComplexGateway":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var k=ee(C,_,y),I=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:_.width,containerHeight:_.height,position:{mx:.46,my:.26}});return b(C,I,{fill:te(_,c,y.stroke),stroke:te(_,c,y.stroke),strokeWidth:1}),k},"bpmn:DataInput":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var k=i.getRawPath("DATA_ARROW"),I=oe(C,_,y);return b(C,k,{fill:"none",stroke:te(_,c,y.stroke),strokeWidth:1}),I},"bpmn:DataInputAssociation":function(C,_,y={}){return y=Ge(y,["fill","stroke"]),fe(C,_,{...y,markerEnd:d(C,"association-end",Ie(_,s,y.fill),te(_,c,y.stroke))})},"bpmn:DataObject":function(C,_,y={}){return y=Ge(y,["fill","stroke"]),oe(C,_,y)},"bpmn:DataObjectReference":L("bpmn:DataObject"),"bpmn:DataOutput":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var k=i.getRawPath("DATA_ARROW"),I=oe(C,_,y);return b(C,k,{strokeWidth:1,fill:te(_,c,y.stroke),stroke:te(_,c,y.stroke)}),I},"bpmn:DataOutputAssociation":function(C,_,y={}){return y=Ge(y,["fill","stroke"]),fe(C,_,{...y,markerEnd:d(C,"association-end",Ie(_,s,y.fill),te(_,c,y.stroke))})},"bpmn:DataStoreReference":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var k=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:0,my:.133}});return b(C,k,{fill:Ie(_,s,y.fill),fillOpacity:uo,stroke:te(_,c,y.stroke),strokeWidth:2})},"bpmn:EndEvent":function(C,_,y={}){var{renderIcon:k=!0}=y;y=Ge(y,["fill","stroke"]);var I=de(C,_,{...y,strokeWidth:4});return k&&F(_,C,y),I},"bpmn:EventBasedGateway":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var k=K(_),I=ee(C,_,y);m(C,_.width,_.height,_.height*.2,{fill:Ie(_,"none",y.fill),stroke:te(_,c,y.stroke),strokeWidth:1});var W=k.get("eventGatewayType"),ae=!!k.get("instantiate");function Te(){var bt=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:_.width,containerHeight:_.height,position:{mx:.36,my:.44}});b(C,bt,{fill:"none",stroke:te(_,c,y.stroke),strokeWidth:2})}if(W==="Parallel"){var He=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:_.width,containerHeight:_.height,position:{mx:.474,my:.296}});b(C,He,{fill:"none",stroke:te(_,c,y.stroke),strokeWidth:1})}else W==="Exclusive"&&(ae||m(C,_.width,_.height,_.height*.26,{fill:"none",stroke:te(_,c,y.stroke),strokeWidth:1}),Te());return I},"bpmn:ExclusiveGateway":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var k=ee(C,_,y),I=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:_.width,containerHeight:_.height,position:{mx:.32,my:.3}}),W=Ve(_);return W.get("isMarkerVisible")&&b(C,I,{fill:te(_,c,y.stroke),stroke:te(_,c,y.stroke),strokeWidth:1}),k},"bpmn:Gateway":function(C,_,y={}){return y=Ge(y,["fill","stroke"]),ee(C,_,y)},"bpmn:Group":function(C,_,y={}){return y=Ge(y,["fill","stroke","width","height"]),g(C,_.width,_.height,Ts,{stroke:te(_,c,y.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:Fn(_,y),height:Sn(_,y)})},"bpmn:InclusiveGateway":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var k=ee(C,_,y);return m(C,_.width,_.height,_.height*.24,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:2.5}),k},"bpmn:IntermediateEvent":function(C,_,y={}){var{renderIcon:k=!0}=y;y=Ge(y,["fill","stroke"]);var I=de(C,_,{...y,strokeWidth:1.5});return m(C,_.width,_.height,As,{fill:"none",stroke:te(_,c,y.stroke),strokeWidth:1.5}),k&&F(_,C,y),I},"bpmn:IntermediateCatchEvent":L("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":L("bpmn:IntermediateEvent"),"bpmn:Lane":function(C,_,y={}){return y=Ge(y,["fill","stroke","width","height"]),$(C,_,{...y,fillOpacity:aS})},"bpmn:ManualTask":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var k=Ae(C,_,y),I=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return b(C,I,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:.5}),k},"bpmn:MessageFlow":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var k=K(_),I=Ve(_),W=Ie(_,s,y.fill),ae=te(_,c,y.stroke),Te=x(C,_.waypoints,{markerEnd:d(C,"messageflow-end",W,ae),markerStart:d(C,"messageflow-start",W,ae),stroke:ae,strokeDasharray:"10, 11",strokeWidth:1.5});if(k.get("messageRef")){var He=Te.getPointAtLength(Te.getTotalLength()/2),bt=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:He.x,y:He.y}}),nt={strokeWidth:1};I.get("messageVisibleKind")==="initiating"?(nt.fill=W,nt.stroke=ae):(nt.fill=ae,nt.stroke=W);var kt=b(C,bt,nt),Ut=k.get("messageRef"),cn=Ut.get("name"),ct=ue(C,cn,{align:"center-top",fitBox:!0,style:{fill:ae}}),$t=kt.getBBox(),jt=ct.getBBox(),Wr=He.x-jt.width/2,Mn=He.y+$t.height/2+nS;Ss(ct,Wr,Mn,0)}return Te},"bpmn:ParallelGateway":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var k=ee(C,_,y),I=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:_.width,containerHeight:_.height,position:{mx:.46,my:.2}});return b(C,I,{fill:te(_,c,y.stroke),stroke:te(_,c,y.stroke),strokeWidth:1}),k},"bpmn:Participant":function(C,_,y={}){y=Ge(y,["fill","stroke","width","height"]);var k=$(C,_,y),I=Be(_),W=Gt(_),ae=K(_),Te=ae.get("name");if(I){var He=W?[{x:30,y:0},{x:30,y:Sn(_,y)}]:[{x:0,y:30},{x:Fn(_,y),y:30}];E(C,He,{stroke:te(_,c,y.stroke),strokeWidth:iS}),X(C,Te,_,y)}else{var bt=na(_,y);W||(bt.height=Fn(_,y),bt.width=Sn(_,y));var nt=ue(C,Te,{box:bt,align:"center-middle",style:{fill:ta(_,u,c,y.stroke)}});if(!W){var kt=-1*Sn(_,y);Ss(nt,0,-kt,270)}}return ae.get("participantMultiplicity")&&N("ParticipantMultiplicityMarker",C,_,y),k},"bpmn:ReceiveTask":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var k=K(_),I=Ae(C,_,y),W;return k.get("instantiate")?(m(C,28,28,20*.22,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:1}),W=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):W=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),b(C,W,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:1}),I},"bpmn:ScriptTask":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var k=Ae(C,_,y),I=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return b(C,I,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:1}),k},"bpmn:SendTask":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var k=Ae(C,_,y),I=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return b(C,I,{fill:te(_,c,y.stroke),stroke:Ie(_,s,y.fill),strokeWidth:1}),k},"bpmn:SequenceFlow":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var k=Ie(_,s,y.fill),I=te(_,c,y.stroke),W=x(C,_.waypoints,{markerEnd:d(C,"sequenceflow-end",k,I),stroke:I}),ae=K(_),{source:Te}=_;if(Te){var He=K(Te);ae.get("conditionExpression")&&v(He,"bpmn:Activity")&&re(W,{markerStart:d(C,"conditional-flow-marker",k,I)}),He.get("default")&&(v(He,"bpmn:Gateway")||v(He,"bpmn:Activity"))&&He.get("default")===ae&&re(W,{markerStart:d(C,"conditional-default-flow-marker",k,I)})}return W},"bpmn:ServiceTask":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var k=Ae(C,_,y);m(C,10,10,{fill:Ie(_,s,y.fill),stroke:"none",transform:"translate(6, 6)"});var I=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});b(C,I,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:1}),m(C,10,10,{fill:Ie(_,s,y.fill),stroke:"none",transform:"translate(11, 10)"});var W=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return b(C,W,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:1}),k},"bpmn:StartEvent":function(C,_,y={}){var{renderIcon:k=!0}=y;y=Ge(y,["fill","stroke"]);var I=K(_);I.get("isInterrupting")||(y={...y,strokeDasharray:"6"});var W=de(C,_,y);return k&&F(_,C,y),W},"bpmn:SubProcess":function(C,_,y={}){return Be(_)?y=Ge(y,["fill","stroke","width","height"]):y=Ge(y,["fill","stroke"]),B(C,_,y)},"bpmn:Task":function(C,_,y={}){return y=Ge(y,["fill","stroke"]),Ae(C,_,y)},"bpmn:TextAnnotation":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var{width:k,height:I}=na(_,y),W=g(C,k,I,0,0,{fill:"none",stroke:"none"}),ae=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:k,containerHeight:I,position:{mx:0,my:0}});b(C,ae,{stroke:te(_,c,y.stroke)});var Te=K(_),He=Te.get("text")||"";return ue(C,He,{align:"left-top",box:na(_,y),padding:co,style:{fill:ta(_,u,c,y.stroke)}}),W},"bpmn:Transaction":function(C,_,y={}){Be(_)?y=Ge(y,["fill","stroke","width","height"]):y=Ge(y,["fill","stroke"]);var k=B(C,_,{strokeWidth:1.5,...y}),I=n.style(["no-fill","no-events"],{stroke:te(_,c,y.stroke),strokeWidth:1.5}),W=Be(_);return W||(y={}),g(C,Fn(_,y),Sn(_,y),Ts-As,As,I),k},"bpmn:UserTask":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var k=Ae(C,_,y),I=15,W=12,ae=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:I,y:W}});b(C,ae,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:.5});var Te=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:I,y:W}});b(C,Te,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:.5});var He=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:I,y:W}});return b(C,He,{fill:te(_,c,y.stroke),stroke:te(_,c,y.stroke),strokeWidth:.5}),k},label:function(C,_,y={}){return tt(C,_,y)}};this._drawPath=b,this._renderer=T}ie(Or,Si),Or.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],Or.prototype.canRender=function(e){return v(e,"bpmn:BaseElement")},Or.prototype.drawShape=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},Or.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},Or.prototype.getShapePath=function(e){return ke(e)?ul(e,rS):v(e,"bpmn:Event")?Jh(e):v(e,"bpmn:Activity")?ul(e,Ts):v(e,"bpmn:Gateway")?J1(e):eS(e)};function Ge(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var sS=0,cS={width:150,height:50};function uS(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function lS(e){return Ht(e)?D({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var ll=null;function pS(){return ll||(ll=document.createElement("canvas").getContext("2d")),ll}function fS(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(em(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function em(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function dS(e,t){var n=pS();if(!n)return{width:0,height:0};n.font=fS(t),"letterSpacing"in n&&(n.letterSpacing=em(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 hS(e,t,n){for(var i=e.shift(),r=i,o;;){if(o=dS(r,n),o.width=r?o.width:0,r===" "||r===""||o.width<Math.round(t)||r.length<2)return mS(e,r,i,o);r=yS(r,o.width,t)}}function mS(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 tm="";function gS(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===tm)&&r.pop();break}var a=r[r.length-1];return a&&a===tm&&(r[r.length-1]="-"),r.join("")}function yS(e,t,n){var i=Math.max(e.length*(n/t),1),r=gS(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function Ms(e){this._config=D({},{size:cS,padding:sS,style:{},align:"center-top"},e||{})}Ms.prototype.createText=function(e,t){return this.layoutText(e,t).element},Ms.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Ms.prototype.layoutText=function(e,t){for(var n=D({},this._config.size,t.box),i=D({},this._config.style,t.style),r=uS(t.align||this._config.align),o=lS(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=vS(i),c=e.split(/\u00AD?\r?\n/),u=[],l=n.width-o.left-o.right;c.length;)u.push(hS(c,l,i));r.vertical==="middle"&&(o.top=o.bottom=0);var p=bn(u,function(g,R,E){return g+(s||R.height)},0)+o.top+o.bottom,f=bn(u,function(g,R,E){return R.width>g?R.width:g},0),d=o.top;r.vertical==="middle"&&(d+=(n.height-p)/2),d-=(s||u[0].height)/4;var h=pe("text");re(h,i),M(u,function(g){var R;switch(d+=s||g.height,r.horizontal){case"left":R=o.left;break;case"right":R=(a?f:l)-o.right-g.width;break;default:R=Math.max(((a?f:l)-g.width)/2+o.left,0)}var E=pe("tspan");re(E,{x:R,y:d}),E.textContent=g.text,Se(h,E)});var m={width:f,height:p};return{dimensions:m,element:h}};function vS(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var _S=12,bS=1.2,xS=40;function nm(e){var t=D({fontFamily:"Arial, sans-serif",fontSize:_S,fontWeight:"normal",lineHeight:bS},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=D({},t,{fontSize:n},e&&e.externalStyle||{}),r=new Ms({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,Dr.width),height:30},u=o(s,c,{style:i});return{x:Math.round(a.x+a.width/2-u.width/2),y:a.y,width:Math.ceil(u.width),height:Math.ceil(u.height)}},this.getTextAnnotationBounds=function(a,s){var c=o(s,a,{style:t,align:"left-top",padding:co});return{x:a.x,y:a.y,width:a.width,height:Math.max(xS,Math.round(c.height))}},this.getDimensions=function(a,s){return r.getDimensions(a,s||{})};function o(a,s,c){return r.getDimensions(a,D({box:s},c))}this.createText=function(a,s){return r.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}nm.$inject=["config.textRenderer"];function ES(){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,u=0;u<i.heightElements.length;u++)a["y"+u]=i.heightElements[u]*s;for(var l=0;l<i.widthElements.length;l++)a["x"+l]=i.widthElements[l]*c}var p=CS(i.d,{mx:r,my:o,e:a});return p}}var wS=/\{([^{}]+)\}/g,SS=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function RS(e,t,n){var i=n;return t.replace(SS,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 CS(e,t){return String(e).replace(wS,function(n,i){return RS(n,i,t)})}const PS={__init__:["bpmnRenderer"],bpmnRenderer:["type",Or],textRenderer:["type",nm],pathMap:["type",ES]};function AS(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const ia={translate:["value",AS]};function ks(e,t,n){return D({id:e.id,type:e.$type,businessObject:e,di:t},n)}function TS(e,t,n){var i=e.waypoint;return!i||i.length<2?[ye(t),ye(n)]:i.map(function(r){return{x:r.x,y:r.y}})}function im(e,t,n){return new Error(`element ${an(t)} referenced by ${an(e)}#${n} not yet drawn`)}function Ai(e,t,n,i,r){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=r}Ai.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],Ai.prototype.add=function(e,t,n){var i,r,o;if(v(t,"bpmndi:BPMNPlane")){var a=v(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(ks(e,t,a)),this._canvas.addRootElement(i)}else if(v(t,"bpmndi:BPMNShape")){var s=!Be(e,t),c=kS(e);r=n&&(n.hidden||n.collapsed);var u=t.bounds;i=this._elementFactory.createShape(ks(e,t,{collapsed:s,hidden:r,x:Math.round(u.x),y:Math.round(u.y),width:Math.round(u.width),height:Math.round(u.height),isFrame:c})),v(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),v(e,"bpmn:Lane")&&(o=0),v(e,"bpmn:DataStoreReference")&&(MS(n,ye(u))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,o)}else if(v(t,"bpmndi:BPMNEdge")){var l=this._getSource(e),p=this._getTarget(e);r=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(ks(e,t,{hidden:r,source:l,target:p,waypoints:TS(t,l,p)})),v(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,o)}else throw new Error(`unknown di ${an(t)} for element ${an(e)}`);return er(e)&&In(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},Ai.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${an(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),r=i&&i.attachers;if(!i)throw im(e,n,"attachedToRef");t.host=i,r||(i.attachers=r=[]),r.indexOf(t)===-1&&r.push(t)},Ai.prototype.addLabel=function(e,t,n){var i,r,o;return i=U1(t,n),r=In(n),r&&(i=this._textRenderer.getExternalLabelBounds(i,r)),o=this._elementFactory.createLabel(ks(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!In(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)},Ai.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?im(e,i,t+"Ref"):new Error(`${an(e)}#${t} Ref not specified`)},Ai.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},Ai.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},Ai.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function MS(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 kS(e){return v(e,"bpmn:Group")}const rm={__depends__:[PS,{__depends__:[ia],bpmnImporter:["type",Ai]}]};function ra(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function ei(e,t){return{x:e.x-t.x,y:e.y-t.y}}function pl(e){return Math.log(e)/Math.log(10)}var DS=1e3;function Y(e){this._eventBus=e}Y.$inject=["eventBus"];function OS(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}Y.prototype.on=function(e,t,n,i,r,o){if((zt(t)||xe(t))&&(o=r,r=i,i=n,n=t,t=null),zt(n)&&(o=r,r=i,i=n,n=DS),Ht(r)&&(o=r,r=!1),!zt(i))throw new Error("handlerFn must be a function");ge(e)||(e=[e]);var a=this._eventBus;M(e,function(s){var c=["commandStack",s,t].filter(function(u){return u}).join(".");a.on(c,n,r?OS(i,o):i,o)})},Y.prototype.canExecute=Ti("canExecute"),Y.prototype.preExecute=Ti("preExecute"),Y.prototype.preExecuted=Ti("preExecuted"),Y.prototype.execute=Ti("execute"),Y.prototype.executed=Ti("executed"),Y.prototype.postExecute=Ti("postExecute"),Y.prototype.postExecuted=Ti("postExecuted"),Y.prototype.revert=Ti("revert"),Y.prototype.reverted=Ti("reverted");function Ti(e){return function(n,i,r,o,a){(zt(n)||xe(n))&&(a=o,o=r,r=i,i=n,n=null),this.on(n,e,i,r,o,a)}}var fl=["top","bottom","left","right"],Ds=10;function dl(e,t){Y.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,u=o.hints||{};u.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(Ps(r)&&!it(r)){var o=NS(r);o&&i(r,o)}}function i(r,o){var a=ye(r),s=r.label,c=ye(s);if(s.parent){var u=me(r),l;switch(o){case"top":l={x:a.x,y:u.top-Ds-s.height/2};break;case"left":l={x:u.left-Ds-s.width/2,y:a.y};break;case"bottom":l={x:a.x,y:u.bottom+Ds+s.height/2};break;case"right":l={x:u.right+Ds+s.width/2,y:a.y};break}var p=ei(l,c);t.moveShape(s,p)}}}ie(dl,Y),dl.$inject=["eventBus","modeling"];function LS(e){var t=e.host,n=ye(e),i=Xt(n,t),r;i.indexOf("-")>=0?r=i.split("-"):r=[i];var o=fl.filter(function(a){return r.indexOf(a)===-1});return o}function IS(e){var t=ye(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 om(t,i)});return n}function NS(e){var t=ye(e.label),n=ye(e),i=om(n,t);if(BS(i)){var r=IS(e);if(e.host){var o=LS(e);r=r.concat(o)}var a=fl.filter(function(s){return r.indexOf(s)===-1});return a.indexOf(i)!==-1?Xt(e.label,e)!=="intersect"?void 0:i:a[0]}}function om(e,t){return Xt(t,e,5)}function BS(e){return fl.indexOf(e)!==-1}function hl(e){Y.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,i=t.shape;t.position||(v(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)}ie(hl,Y),hl.$inject=["eventBus"];var $S=1500;function ml(e,t,n){e.invoke(Y,this),this.preExecute("elements.delete",$S,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=Oe(r,u=>v(u,"bpmn:Participant")||v(u,"bpmn:SubProcess"));if(!o.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(u=>v(u,"bpmn:Artifact"))),c=new Set;return M(o,u=>{const l=new Set(Kr(io(Array.from(s),Rt(u))));c=c.union(l),s=s.difference(l)}),Array.from(c)}}ie(ml,Y),ml.$inject=["injector","eventBus","canvas"];function gl(e,t){e.invoke(Y,this),this.postExecute("shape.move",function(n){var i=n.newParent,r=n.shape,o=Oe(r.incoming.concat(r.outgoing),function(a){return v(a,"bpmn:Association")});M(o,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}ie(gl,Y),gl.$inject=["injector","modeling"];function lo(e,t){for(vn(t)&&(t=[t]);e=e.parent;)if(De(e,t))return e;return null}function am(e,t){var n=lo(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=lo(e,i),n)return Gt(n);if(De(e,i))return Gt(e);var r;for(r=K(e);r&&!v(r,"bpmn:Process");r=r.$parent);if(!t)return!0;var o=t.find(function(a){var s=K(a);return s&&s.get("processRef")===r});return o?Gt(o):!0}var sm=500;function Os(e,t){t.invoke(Y,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",sm,function(i){var r=i.elements;r=r.filter(function(o){var a=o.host;return cm(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",sm,function(i){var r=i.shapes,o=i.newHost;if(r.length===1){var a=r[0];cm(a,o)&&(i.shapes=[n._replaceShape(a,o)])}},!0)}Os.$inject=["bpmnReplace","injector"],ie(Os,Y),Os.prototype._replaceShape=function(e,t){var n=jS(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function jS(e){var t=K(e),n=t.eventDefinitions;return n&&n[0]}function cm(e,t){return!ke(e)&&De(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function yl(e,t){Y.call(this,e);function n(i){return Oe(i.attachers,function(r){return v(r,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var r=i.context.source,o=i.context.target,a=n(o);v(r,"bpmn:EventBasedGateway")&&v(o,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var r=i.context.oldSource,o=i.context.newSource;v(r,"bpmn:Gateway")&&v(o,"bpmn:EventBasedGateway")&&M(o.outgoing,function(a){var s=a.target,c=n(s);v(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}yl.$inject=["eventBus","modeling"],ie(yl,Y);function um(e){return e.create("bpmn:Category")}function FS(e){return e.create("bpmn:CategoryValue")}function lm(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=FS(e)),n.$parent||(n.$parent=um(e)),n}function HS(e,t,n){return Et(t.get("categoryValue"),e),e.$parent=t,Et(n.get("rootElements"),t),t.$parent=n,e}function zS(e){var t=e.$parent;return t&&(_t(t.get("categoryValue"),e),e.$parent=null),e}function VS(e){var t=e.$parent;return t&&(_t(t.get("rootElements"),e),e.$parent=null),e}var GS=500;function vl(e,t,n){n.invoke(Y,this);function i(c){return t.filter(function(u){return v(u,"bpmn:Group")&&!u.labelTarget}).map(K).filter(function(u){return u!==c})}function r(c,u){return i(u).some(function(l){return l.get("categoryValueRef")===c})}function o(c,u){return i(u).some(function(l){var p=l.get("categoryValueRef");return p&&p.$parent===c})}function a(c,u){c&&u&&HS(c,u,e.getDefinitions())}function s(c,u,l){u&&!o(u,l)&&VS(u),c&&!r(c,l)&&zS(c)}this.executed(["shape.create","label.create"],function(c){var u=c.labelTarget||c.shape;!v(u,"bpmn:Group")||u.labelTarget||a(c.categoryValue,c.category)},!0),this.reverted(["shape.create","label.create"],function(c){var u=c.labelTarget||c.shape;!v(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,K(u))},!0),this.executed(["shape.move","shape.resize"],GS,function(c){a(c.categoryValue,c.category)},!0),this.reverted(["shape.move","shape.resize"],function(c){var u=c.shape;c.categoryValue&&s(c.categoryValue,c.category,K(u))},!0),this.executed("group.updateRefs",function(c){pm(c).forEach(function(u){a(u.categoryValue,u.category)})},!0),this.reverted("group.updateRefs",function(c){pm(c).forEach(function(u){s(u.categoryValue,u.category,K(u.groupShape))})},!0),this.executed("shape.delete",function(c){var u=c.shape;!v(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,K(u))},!0),this.reverted("shape.delete",function(c){var u=c.shape;!v(u,"bpmn:Group")||u.labelTarget||a(c.categoryValue,c.category)},!0)}vl.$inject=["bpmnjs","elementRegistry","injector"],ie(vl,Y);function pm(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function _l(e,t,n){Y.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(g){const R=g.source,E=g.target;po(R)&&oa(E)&&l(E)}function r(g){const R=g.connection,E=g.source,x=g.target;po(E)&&Ls(x)&&(u(x),f(E,[R]))}function o(g){const R=g.newTarget,E=g.oldSource,x=g.oldTarget;if(x!==R){const b=E;oa(x)&&l(x),po(b)&&Ls(R)&&u(R)}}function a(g){const{element:R}=g;oa(R)?(p(R),d(R)):Ls(R)&&h(R)}function s(g){const{newData:R,oldShape:E}=g;if(po(g.oldShape)&&R.eventDefinitionType!=="bpmn:CompensateEventDefinition"||R.type!=="bpmn:BoundaryEvent"){const x=E.outgoing.find(({target:b})=>oa(b));x&&x.target&&(g._connectionTarget=x.target)}else if(!po(g.oldShape)&&R.eventDefinitionType==="bpmn:CompensateEventDefinition"&&R.type==="bpmn:BoundaryEvent"){const x=E.outgoing.find(({target:b})=>Ls(b));x&&x.target&&(g._connectionTarget=x.target),m(E)}}function c(g){const{_connectionTarget:R,newShape:E}=g;R&&t.connect(E,R)}function u(g){t.updateProperties(g,{isForCompensation:!0})}function l(g){t.updateProperties(g,{isForCompensation:void 0})}function p(g){for(const R of g.incoming)n.canConnect(R.source,g)||t.removeConnection(R);for(const R of g.outgoing)n.canConnect(g,R.target)||t.removeConnection(R)}function f(g,R){g.outgoing.filter(b=>v(b,"bpmn:Association")).filter(b=>oa(b.target)&&!R.includes(b)).forEach(b=>t.removeConnection(b))}function d(g){const R=g.attachers.slice();R.length&&t.removeElements(R)}function h(g){const R=g.incoming.filter(E=>po(E.source));t.removeElements(R)}function m(g){const R=g.outgoing.filter(E=>v(E,"bpmn:SequenceFlow"));t.removeElements(R)}}ie(_l,Y),_l.$inject=["eventBus","modeling","bpmnRules"];function oa(e){const t=K(e);return t&&t.get("isForCompensation")}function po(e){return e&&v(e,"bpmn:BoundaryEvent")&&so(e,"bpmn:CompensateEventDefinition")}function Ls(e){return e&&v(e,"bpmn:Activity")&&!sn(e)}function bl(e){e.invoke(Y,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,r=n.shape;v(i,"bpmn:Lane")&&!v(r,"bpmn:Lane")&&(n.parent=lo(i,"bpmn:Participant"))})}bl.$inject=["injector"],ie(bl,Y);function xl(e,t){Y.call(this,e),this.preExecute("shape.create",function(n){var a;var i=n.context,r=i.shape;if(v(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}})}xl.$inject=["eventBus","bpmnFactory"],ie(xl,Y);var El=20,wl=20,fm=30,Is=2e3;function Sl(e,t,n){Y.call(this,t),t.on(["create.start","shape.move.start"],Is,function(r){var o=r.context,a=o.shape,s=e.getRootElement();if(!(!v(a,"bpmn:Participant")||!v(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(p){return!v(p,"bpmn:Group")&&!ke(p)&&!it(p)});if(c.length){var u=Rt(c),l=WS(a,u);D(a,l),o.createConstraints=US(a,u)}}}),t.on("create.start",Is,function(r){var o=r.context,a=o.shape,s=e.getRootElement(),c=e.getGraphics(s);function u(l){l.element=s,l.gfx=c}v(a,"bpmn:Participant")&&v(s,"bpmn:Process")&&(t.on("element.hover",Is,u),t.once("create.cleanup",function(){t.off("element.hover",u)}))});function i(){var r=e.getRootElement();return v(r,"bpmn:Collaboration")?r:n.makeCollaboration()}this.preExecute("elements.create",Is,function(r){var o=r.elements,a=r.parent,s=qS(o),c;s&&v(a,"bpmn:Process")&&(r.parent=i(),c=r.hints=r.hints||{},c.participant=s,c.process=a,c.processRef=K(s).get("processRef"))},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;v(a,"bpmn:Participant")&&v(o,"bpmn:Process")&&(r.parent=i(),r.process=o,r.processRef=K(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)&&K(s).set("processRef",K(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,u=o.participant;a&&(!u||c===u)&&K(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 u=a.children.slice();c?s===c&&n.moveElements(u,{x:0,y:0},c):n.moveElements(u,{x:0,y:0},s)}},!0)}Sl.$inject=["canvas","eventBus","modeling"],ie(Sl,Y);function WS(e,t){t={width:t.width+El*2+fm,height:t.height+wl*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 US(e,t){return t=me(t),{bottom:t.top+e.height/2-wl,left:t.right-e.width/2+El,top:t.bottom-e.height/2+wl,right:t.left+e.width/2-El-fm}}function qS(e){return at(e,function(t){return v(t,"bpmn:Participant")})}var dm="__targetRef_placeholder";function Rl(e,t){Y.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],hm(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],hm(o));function n(a,s,c){var u=a.get("dataInputAssociations");return at(u,function(l){return l!==c&&l.targetRef===s})}function i(a,s){var c=a.get("properties"),u=at(c,function(l){return l.name===dm});return!u&&s&&(u=t.create("bpmn:Property",{name:dm}),Et(c,u)),u}function r(a,s){var c=i(a);c&&(n(a,c,s)||_t(a.get("properties"),c))}function o(a){var s=a.context,c=s.connection,u=c.businessObject,l=c.target,p=l&&l.businessObject,f=s.newTarget,d=f&&f.businessObject,h=s.oldTarget||s.target,m=h&&h.businessObject,g=c.businessObject,R;m&&m!==p&&r(m,u),d&&d!==p&&r(d,u),p?(R=i(p,!0),g.targetRef=R):g.targetRef=null}}Rl.$inject=["eventBus","bpmnFactory"],ie(Rl,Y);function hm(e){return function(t){var n=t.context,i=n.connection;if(v(i,"bpmn:DataInputAssociation"))return e(t)}}function Ns(e){this._bpmnUpdater=e}Ns.$inject=["bpmnUpdater"],Ns.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),[]},Ns.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 Cl(e,t,n,i){Y.call(this,i),t.registerHandler("dataStore.updateContainment",Ns);function r(){return n.filter(function(s){return v(s,"bpmn:Participant")&&K(s).processRef})[0]}function o(s){return s.children.filter(function(c){return v(c,"bpmn:DataStoreReference")&&!c.labelTarget})}function a(s,c){var u=s.businessObject||s;if(c=c||r(),c){var l=c.businessObject||c;t.execute("dataStore.updateContainment",{dataStoreBo:u,dataStoreDi:Ve(s),newSemanticParent:l.processRef||l,newDiParent:Ve(c)})}}this.preExecute("shape.create",function(s){var c=s.context,u=c.shape;v(u,"bpmn:DataStoreReference")&&u.type!=="label"&&(c.hints||(c.hints={}),c.hints.autoResize=!1)}),this.preExecute("elements.move",function(s){var c=s.context,u=c.shapes,l=u.filter(function(p){return v(p,"bpmn:DataStoreReference")});l.length&&(c.hints||(c.hints={}),c.hints.autoResize=u.filter(function(p){return!v(p,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,u=c.shape,l=u.parent;v(u,"bpmn:DataStoreReference")&&u.type!=="label"&&v(l,"bpmn:Collaboration")&&a(u)}),this.postExecute("shape.move",function(s){var c=s.context,u=c.shape,l=c.oldParent,p=u.parent;if(!v(l,"bpmn:Collaboration")&&v(u,"bpmn:DataStoreReference")&&u.type!=="label"&&v(p,"bpmn:Collaboration")){var f=v(l,"bpmn:Participant")?l:KS(l,"bpmn:Participant");a(u,f)}}),this.postExecute("shape.delete",function(s){var c=s.context,u=c.shape,l=e.getRootElement();De(u,["bpmn:Participant","bpmn:SubProcess"])&&v(l,"bpmn:Collaboration")&&o(l).filter(function(p){return YS(p,u)}).forEach(function(p){a(p)})}),this.postExecute("canvas.updateRoot",function(s){var c=s.context,u=c.oldRoot,l=c.newRoot,p=o(u);p.forEach(function(f){v(l,"bpmn:Process")&&a(f,l)})})}Cl.$inject=["canvas","commandStack","elementRegistry","eventBus"],ie(Cl,Y);function YS(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 KS(e,t){for(;e.parent;){if(v(e.parent,t))return e.parent;e=e.parent}}var Bs=Math.max,$s=Math.min,XS=20;function mm(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function ZS(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 QS(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 js(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return xe(r)&&(i=(/top|left/.test(e)?$s:Bs)(i,r)),xe(o)&&(i=(/top|left/.test(e)?Bs:$s)(i,o)),i}function JS(e,t){if(!t)return e;var n=me(e);return xs({top:js("top",n,t),right:js("right",n,t),bottom:js("bottom",n,t),left:js("left",n,t)})}function eR(e,t,n,i){var r=me(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?me(i):o,s={top:$s(o.top,a.top),left:$s(o.left,a.left),bottom:Bs(o.bottom,a.bottom),right:Bs(o.right,a.right)};return xs(s)}function aa(e,t){return typeof e<"u"?e:XS}function tR(e,t){var n,i,r,o;return typeof t=="object"?(n=aa(t.left),i=aa(t.right),r=aa(t.top),o=aa(t.bottom)):n=i=r=o=aa(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function nR(e){return!(e.waypoints||e.type==="label")}function gm(e,t){var n;if(e.length===void 0?n=Oe(e.children,nR):n=e,n.length)return tR(Rt(n),t)}var tr=Math.abs;function iR(e,t){return mm(me(t),me(e))}var rR=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Hn=30;function Fs(e,t){return t=t||[],e.children.filter(function(n){v(n,"bpmn:Lane")&&(Fs(n,t),t.push(n))}),t}function nr(e){return e.children.filter(function(t){return v(t,"bpmn:Lane")})}function zn(e){return lo(e,rR)||e}function oR(e,t){var n=zn(e),i=v(n,"bpmn:Process")?[]:[n],r=Fs(n,i),o=me(e),a=me(t),s=iR(e,t),c=[],u=Gt(e);return r.forEach(function(l){if(l!==e){var p=u?0:s.top,f=u?s.right:0,d=u?0:s.bottom,h=u?s.left:0,m=me(l);s.top&&(tr(m.bottom-o.top)<10&&(d=a.top-m.bottom),tr(m.top-o.top)<5&&(p=a.top-m.top)),s.left&&(tr(m.right-o.left)<10&&(f=a.left-m.right),tr(m.left-o.left)<5&&(h=a.left-m.left)),s.bottom&&(tr(m.top-o.bottom)<10&&(p=a.bottom-m.top),tr(m.bottom-o.bottom)<5&&(d=a.bottom-m.bottom)),s.right&&(tr(m.left-o.right)<10&&(h=a.right-m.left),tr(m.right-o.right)<5&&(f=a.right-m.right)),(p||f||d||h)&&c.push({shape:l,newBounds:QS(l,{top:p,right:f,bottom:d,left:h})})}}),c}var aR=500;function Pl(e,t){Y.call(this,e);function n(i,r){var o=Gt(i),a=nr(r),s=[],c=[],u=[],l=[];if(Mr(a,function(g){return o?g.y>i.y?c.push(g):s.push(g):g.x>i.x?l.push(g):u.push(g),g.children}),!!a.length){var p;o?c.length&&s.length?p=i.height/2:p=i.height:l.length&&u.length?p=i.width/2:p=i.width;var f,d,h,m;s.length&&(f=t.calculateAdjustments(s,"y",p,i.y-10),t.makeSpace(f.movingShapes,f.resizingShapes,{x:0,y:p},"s")),c.length&&(d=t.calculateAdjustments(c,"y",-p,i.y+i.height+10),t.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:-p},"n")),u.length&&(h=t.calculateAdjustments(u,"x",p,i.x-10),t.makeSpace(h.movingShapes,h.resizingShapes,{x:p,y:0},"e")),l.length&&(m=t.calculateAdjustments(l,"x",-p,i.x+i.width+10),t.makeSpace(m.movingShapes,m.resizingShapes,{x:-p,y:0},"w"))}}this.postExecuted("shape.delete",aR,function(i){var r=i.context,o=r.hints,a=r.shape,s=r.oldParent;v(a,"bpmn:Lane")&&(o&&o.nested||n(a,s))})}Pl.$inject=["eventBus","spaceTool"],ie(Pl,Y);var ym=500;function Hs(e,t){t.invoke(Y,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",ym,function(i){var r=i.elements;r.filter(function(o){var a=o.host;return vm(o,a)}).map(function(o){return r.indexOf(o)}).forEach(function(o){i.elements[o]=n._replaceShape(r[o])})},!0),this.preExecute("elements.move",ym,function(i){var r=i.shapes,o=i.newHost;r.forEach(function(a,s){var c=a.host;vm(a,cR(r,c)?c:o)&&(r[s]=n._replaceShape(a))})},!0)}Hs.$inject=["bpmnReplace","injector"],ie(Hs,Y),Hs.prototype._replaceShape=function(e){var t=sR(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function sR(e){var t=K(e),n=t.eventDefinitions;return n&&n[0]}function vm(e,t){return!ke(e)&&v(e,"bpmn:BoundaryEvent")&&!t}function cR(e,t){return e.indexOf(t)!==-1}var zs=Math.round,uR=Math.max;function lR(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 pR(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var _m=10;function fR(e,t){var n,i;for(n=0;i=e[n];n++)if(Xo(i,t)<=_m)return{point:e[n],bendpoint:!0,index:n};return null}function dR(e,t){var n=Sh(lR(t,_m),pR(e)),i=n[0],r=n[n.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=uR(i.segment2,r.segment2)-1,{point:e[o],bendpoint:!0,index:o}):{point:{x:zs(i.x+r.x)/2,y:zs(i.y+r.y)/2},index:i.segment2}:{point:{x:zs(i.x),y:zs(i.y)},index:i.segment2}:null}function Al(e,t){return fR(e,t)||dR(e,t)}function Tl(e,t,n){Y.call(this,e);function i(r,o,a){var s=o.waypoints,c,u,l,p,f,d,h,m=r.outgoing.slice(),g=r.incoming.slice(),R;xe(a.width)?R=ye(a):R=a;var E=Al(s,R);if(E){if(c=s.slice(0,E.index),u=s.slice(E.index+(E.bendpoint?1:0)),!c.length||!u.length)return;l=E.bendpoint?s[E.index]:R,(c.length===1||!bm(r,c[c.length-1]))&&c.push(xm(l)),(u.length===1||!bm(r,u[0]))&&u.unshift(xm(l))}p=o.source,f=o.target,t.canConnect(p,r,o)&&(n.reconnectEnd(o,r,c||R),d=o),t.canConnect(r,f,o)&&(d?h=n.connect(r,f,{type:o.type,waypoints:u}):(n.reconnectStart(o,r,u||R),h=o));var x=[].concat(d&&Oe(g,function(b){return b.source===d.source})||[],h&&Oe(m,function(b){return b.target===h.target})||[]);x.length&&n.removeElements(x)}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 u=ye(c),l={x:u.x+s.x,y:u.y+s.y},p=at(o.children,function(f){var d=t.canInsert(a,f);return d&&Al(f.waypoints,l)});p&&(r.targetFlow=p,r.position=l)}},!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)}ie(Tl,Y),Tl.$inject=["eventBus","bpmnRules","modeling"];function bm(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 xm(e){return D({},e)}function Ml(e,t){Y.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)&&fo(r)){var c=[];v(o,"bpmn:EventBasedGateway")?c=a.incoming.filter(u=>u!==r&&fo(u)):c=a.incoming.filter(u=>u!==r&&fo(u)&&v(u.source,"bpmn:EventBasedGateway")),c.forEach(function(u){t.removeConnection(u)})}}),this.preExecuted("shape.replace",function(n){var i=n.context,r=i.newShape;if(v(r,"bpmn:EventBasedGateway")){var o=r.outgoing.filter(fo).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);o.forEach(function(a){a.incoming.filter(fo).forEach(function(s){const c=a.incoming.filter(fo).filter(function(u){return u.source===r});(s.source!==r||c.length>1)&&t.removeConnection(s)})})}})}Ml.$inject=["eventBus","modeling"],ie(Ml,Y);function fo(e){return v(e,"bpmn:SequenceFlow")}var Vs=1500,Em=2e3;function wm(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"],Vs,function(i){var r=i.context,o=r.shape||i.shape,a=i.hover;v(a,"bpmn:Lane")&&!De(o,["bpmn:Lane","bpmn:Participant"])&&(i.hover=zn(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(o.labelTarget||De(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"],Vs,function(i){var r=i.hover;v(r,"bpmn:Lane")&&(i.hover=zn(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],Vs,function(i){var r=i.context,o=i.hover,a=r.type;v(o,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=zn(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],Vs,function(i){var r=i.context,o=r.start;v(o,"bpmn:Lane")&&(r.start=zn(o)||o)}),t.on("shape.move.start",Em,function(i){var r=i.shape;v(r,"bpmn:Lane")&&(i.shape=zn(r)||r)}),t.on("spaceTool.move",Em,function(i){var r=i.hover;r&&v(r,"bpmn:Lane")&&(i.hover=zn(r))})}wm.$inject=["elementRegistry","eventBus","canvas"];var Sm=770;function kl(e,t,n,i){n.invoke(Y,this);function r(s,c){var u=K(s),l=c.categoryValue||u.categoryValueRef;l||(l=lm(e,u));var p=c.category||l.$parent||um(e);u.categoryValueRef=l,l.$parent=p,c.categoryValue=l,c.category=p}function o(s,c){var u=K(s),l=c.categoryValue||u.categoryValueRef,p=c.category||l&&l.$parent;l&&(c.categoryValue=l,c.category=p,u.categoryValueRef=null)}this.execute("label.create",function(s){var c=s.context,u=c.labelTarget;v(u,"bpmn:Group")&&r(u,c)}),this.revert("label.create",function(s){var c=s.context,u=c.labelTarget;v(u,"bpmn:Group")&&o(u,c)}),this.execute("shape.delete",function(s){var c=s.context,u=c.shape,l=K(u);if(!(!v(u,"bpmn:Group")||u.labelTarget)){var p=c.categoryValue=l.categoryValueRef;p&&(c.category=p.$parent,l.categoryValueRef=null)}}),this.reverted("shape.delete",function(s){var c=s.context,u=c.shape;if(!(!v(u,"bpmn:Group")||u.labelTarget)){var l=c.category,p=c.categoryValue,f=K(u);p&&(f.categoryValueRef=p,p.$parent=l)}}),this.execute("shape.create",function(s){var c=s.context,u=c.shape,l=c.hints||{};!v(u,"bpmn:Group")||u.labelTarget||l.createElementsBehavior===!1&&!K(u).categoryValueRef&&!c.categoryValue||r(u,c)}),this.reverted("shape.create",function(s){var c=s.context,u=c.shape,l=c.hints||{};!v(u,"bpmn:Group")||u.labelTarget||l.createElementsBehavior===!1&&!K(u).categoryValueRef&&!c.categoryValue||o(u,c)}),this.executed(["shape.move","shape.resize"],function(s){var c=s.context,u=c.shape;!v(u,"bpmn:Group")||u.labelTarget||K(u).categoryValueRef||r(u,c)}),this.reverted(["shape.move","shape.resize"],function(s){var c=s.context,u=c.shape;!v(u,"bpmn:Group")||u.labelTarget||!c.categoryValue||o(u,c)});function a(s,c){var u=e.create(s.$type);return i.copyElement(s,u,null,c)}t.on("copyPaste.copyElement",Sm,function(s){var c=s.descriptor,u=s.element;if(!(!v(u,"bpmn:Group")||u.labelTarget)){var l=K(u);if(l.categoryValueRef){var p=l.categoryValueRef;c.categoryValue=a(p,!0),p.$parent&&(c.category=a(p.$parent,!0))}}}),t.on("copyPaste.pasteElement",Sm,function(s){var c=s.descriptor,u=c.businessObject,l=c.categoryValue,p=c.category;l&&(l=u.categoryValueRef=a(l)),p&&(l.$parent=a(p)),delete c.category,delete c.categoryValue})}kl.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],ie(kl,Y);function Dl(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 Rm(e){function t(i,r,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=Dl(i,r,o,a),u=Dl(i,r,o,s),l;c&&u?Cm(c,o)>Cm(u,o)?l=u:l=c:l=c||u,i.original=l}function n(i){var r=i.waypoints;t(r[0],r[1],ye(i.source)),t(r[r.length-1],r[r.length-2],ye(i.target))}e.on("bpmnElement.added",function(i){var r=i.element;r.waypoints&&n(r)})}Rm.$inject=["eventBus"];function Cm(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Ol(e){Y.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=K(i),o=Ve(i);if(De(r,t)){var a=o.get("isHorizontal");a===void 0&&(a=!0),o.set("isHorizontal",a)}})}Ol.$inject=["eventBus"],ie(Ol,Y);function Pm(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Am(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function hR(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 mR(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 Ll(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=mR([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 Tm(e,t){var n=Ll(e,t),i={x:n.x-e.x,y:n.y-e.y};return Pm(i)}function sa(e,t){return Pm({x:e.x-t.x,y:e.y-t.y})}var Mm=Math.sqrt,km=Math.min,gR=Math.max,Dm=Math.abs;function Om(e){return Math.pow(e,2)}function ca(e,t){return Mm(Om(e.x-t.x)+Om(e.y-t.y))}function yR(e,t){var n=0,i,r,o,a,s,c,u,l,p,f,d;for(n=0;n<t.length-1;n++){if(i=t[n],r=t[n+1],Im(i,r)?u=[i]:(o=ca(e,i),a=ca(e,r),c=km(o,a),u=vR(i,r,e,c)),u.length<1)throw new Error("expected between [1, 2] circle -> line intersections");u.length===1&&(l={type:"bendpoint",position:u[0],segmentIndex:n,bendpointIndex:Im(i,u[0])?n:n+1}),u.length===2&&(s=bR(u[0],u[1]),l={type:"segment",position:s,segmentIndex:n,relativeLocation:ca(i,s)/ca(i,r)}),p=ca(l.position,e),(!d||f>p)&&(d=l,f=p)}return d}function vR(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,u=r*a+o*s,l=a*a+s*s-i*i,p=u/c,f=l/c,d=p*p-f;if(d<0&&d>-1e-6&&(d=0),d<0)return[];var h=Mm(d),m=-p+h,g=-p-h,R={x:e.x-r*m,y:e.y-o*m};if(d===0)return[R];var E={x:e.x-r*g,y:e.y-o*g};return[R,E].filter(function(x){return _R(x,e,t)})}function _R(e,t,n){return Lm(e.x,t.x,n.x)&&Lm(e.y,t.y,n.y)}function Lm(e,t,n){return e>=km(t,n)-Gs&&e<=gR(t,n)+Gs}function bR(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var Gs=.1;function Im(e,t){return Dm(e.x-t.x)<=Gs&&Dm(e.y-t.y)<=Gs}function xR(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,u=i.bendpointMove.bendpointIndex,l;if(o===0)return r;if(r>=u&&(l=c?r+1:r-1),r<u&&(l=r,c&&n.type!=="bendpoint"&&u-1===r)){var p=Bm(t,u);p<n.relativeLocation&&l++}return l}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 Nm(e,t,n,i){var r=0,o=0,a={point:e,delta:{x:0,y:0}},s=yR(e,n),c=s.segmentIndex,u=xR(n,t,s,i);if(u<0||u>t.length-2||u===null)return a;var l=$m(n,c),p=$m(t,u),f=s.position,d=wR(l,f),h=ER(l,p);if(s.type==="bendpoint"){var m=t.length-n.length,g=s.bendpointIndex,R=n[g];if(t.indexOf(R)!==-1)return a;if(m===0){var E=t[g];return r=E.x-s.position.x,o=E.y-s.position.y,{delta:{x:r,y:o},point:{x:e.x+r,y:e.y+o}}}m<0&&g!==0&&g<n.length-1&&(d=Bm(n,g))}var x={x:(p[1].x-p[0].x)*d+p[0].x,y:(p[1].y-p[0].y)*d+p[0].y},b=hR({x:e.x-f.x,y:e.y-f.y},h);return r=x.x+b.x-e.x,o=x.y+b.y-e.y,{point:Ci(x),delta:Ci({x:r,y:o})}}function Bm(e,t){var n=sa(e[t-1],e[t]),i=sa(e[t],e[t+1]),r=n/(n+i);return r}function ER(e,t){var n=Am(e),i=Am(t);return i-n}function $m(e,t){return[e[t],e[t+1]]}function wR(e,t){var n=sa(e[0],e[1]),i=sa(e[0],t);return n===0?0:i/n}function SR(e,t,n,i){var r=ye(e);return Nm(r,t,n,i).delta}function ua(e,t,n){var i=ra(t),r=ra(n),o=ei(e,i),a={x:o.x*(n.width/t.width),y:o.y*(n.height/t.height)};return Ci({x:r.x+a.x,y:r.y+a.y})}function jm(e,t,n){var i=ra(e),r=ra(t),o=ra(n),a=ei(e,i),s=ei(i,r),c=RR(i,t,n);if(c)return c;var u={x:s.x*(n.width/t.width),y:s.y*(n.height/t.height)},l={x:o.x+u.x,y:o.y+u.y};return Ci({x:l.x+a.x-e.x,y:l.y+a.y-e.y})}function RR(e,t,n){var i=me(t),r=me(n);if(CR(i,r))return null;var o=Xt(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=Xt(n,s),c!==o?null:a}function CR(e,t){return PR(e,t)||AR(e,t)}function PR(e,t){return e.right!==t.right&&e.left!==t.left}function AR(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var Fm="name",Hm="text";function Il(e,t,n,i){Y.call(this,e),this.postExecute("element.updateProperties",r),this.postExecute("element.updateModdleProperties",a=>{K(a.context.element)===a.context.moddleElement&&r(a)});function r(a){var s=a.context,c=s.element,u=s.properties;if(Fm in u&&t.updateLabel(c,u[Fm]),Hm in u&&v(c,"bpmn:TextAnnotation")){var l=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},u[Hm]||"");t.updateLabel(c,u.text,l)}}this.postExecute(["shape.create","connection.create"],function(a){var s=a.context,c=s.hints||{};if(c.createElementsBehavior!==!1){var u=s.shape||s.connection;ke(u)||!er(u)||In(u)&&t.updateLabel(u,In(u))}}),this.postExecute("shape.delete",function(a){var s=a.context,c=s.labelTarget,u=s.hints||{};c&&u.unsetLabel!==!1&&t.updateLabel(c,null,null,{removeShape:!1})});function o(a){var s=a.context,c=s.connection,u=c.label,l=D({},s.hints),p=s.newWaypoints||c.waypoints,f=s.oldWaypoints;return typeof l.startChanged>"u"&&(l.startChanged=!!l.connectionStart),typeof l.endChanged>"u"&&(l.endChanged=!!l.connectionEnd),SR(u,p,f,l)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(a){var s=a.context,c=s.hints||{};if(c.labelBehavior!==!1){var u=s.connection,l=u.label,p;!l||!l.parent||(p=o(a),t.moveShape(l,p))}}),this.postExecute(["shape.replace"],function(a){var s=a.context,c=s.newShape,u=s.oldShape,l=K(c);l&&er(l)&&u.label&&c.label&&(c.label.x=u.label.x,c.label.y=u.label.y)}),this.preExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.hints||{};if(!(!ke(c)||u.autoResize)){var l=s.newBounds,p=i.getDimensions(In(c)||"",{box:l,style:i.getExternalStyle()}),f=Math.ceil(p.height),d=l.y!==c.y,h=c.y+c.height;s.newBounds={width:l.width,height:f,x:l.x,y:d?h-f:l.y}}}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.newBounds,l=s.oldBounds;if(Ps(c)){var p=c.label,f=ye(p),d=kR(l),h=MR(f,d),m=TR(h,l,u);t.moveShape(p,m)}})}ie(Il,Y),Il.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function TR(e,t,n){var i=ua(e,t,n);return Ci(ei(i,e))}function MR(e,t){if(t.length){var n=DR(e,t);return Ll(e,n)}}function kR(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 DR(e,t){var n=t.map(function(r){return{line:r,distance:Tm(e,r)}}),i=ri(n,"distance");return i[0].line}function OR(e,t,n,i){return Nm(e,t,n,i).point}function Nl(e,t){Y.call(this,e);function n(i,r){var o=i.context,a=o.connection,s=D({},o.hints),c=o.newWaypoints||a.waypoints,u=o.oldWaypoints;return typeof s.startChanged>"u"&&(s.startChanged=!!s.connectionStart),typeof s.endChanged>"u"&&(s.endChanged=!!s.connectionEnd),OR(r,c,u,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 u=c.waypoints[c.waypoints.length-1],l=n(i,u),p=[].concat(c.waypoints.slice(0,-1),[l]);t.updateWaypoints(c,p)}),a.forEach(function(c){var u=c.waypoints[0],l=n(i,u),p=[].concat([l],c.waypoints.slice(1));t.updateWaypoints(c,p)})}),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(u){var l=u.waypoints[u.waypoints.length-1],p={x:l.x+c.x,y:l.y+c.y},f=[].concat(u.waypoints.slice(0,-1),[p]);t.updateWaypoints(u,f)}),a.forEach(function(u){var l=u.waypoints[0],p={x:l.x+c.x,y:l.y+c.y},f=[].concat([p],u.waypoints.slice(1));t.updateWaypoints(u,f)})})}ie(Nl,Y),Nl.$inject=["eventBus","modeling"];function Ws(e,t,n){var i=qs(e),r=Vm(i,t),o=i[0];return r.length?r[r.length-1]:ua(o.original||o,n,t)}function Us(e,t,n){var i=qs(e),r=Vm(i,t),o=i[i.length-1];return r.length?r[0]:ua(o.original||o,n,t)}function Bl(e,t,n){var i=qs(e),r=zm(t,n),o=i[0];return ua(o.original||o,r,t)}function $l(e,t,n){var i=qs(e),r=zm(t,n),o=i[i.length-1];return ua(o.original||o,r,t)}function zm(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function qs(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Vm(e,t){var n=nn(e,IR);return Oe(n,function(i){return LR(i,t)})}function LR(e,t){return Xt(t,e,1)==="intersect"}function IR(e){return e.original||e}function jl(e,t){Y.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,r=n.newShape;if(NR(i,r)){var o=BR(i);o.incoming.forEach(function(a){var s=Us(a,r,i);t.reconnectEnd(a,r,s)}),o.outgoing.forEach(function(a){var s=Ws(a,r,i);t.reconnectStart(a,r,s)})}},!0)}jl.$inject=["eventBus","modeling"],ie(jl,Y);function NR(e,t){return v(e,"bpmn:Participant")&&Be(e)&&v(t,"bpmn:Participant")&&!Be(t)}function BR(e){var t=Yo([e]),n=[],i=[];return t.forEach(function(r){r!==e&&(r.incoming.forEach(function(o){v(o,"bpmn:MessageFlow")&&n.push(o)}),r.outgoing.forEach(function(o){v(o,"bpmn:MessageFlow")&&i.push(o)}))},[]),{incoming:n,outgoing:i}}const $R=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function Gm(e){const t=K(e);if(!v(t,"bpmn:BoundaryEvent")&&!(v(t,"bpmn:StartEvent")&&sn(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:$R.some(i=>v(n[0],i))}function Wm(e){return v(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function Fl(e,t){e.invoke(Y,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,r=n.context.newShape,o=n.context.hints;if(!Gm(r))return;const a=Wm(r);if(o.targetElement&&o.targetElement[a]!==void 0)return;const c=K(i).get(a),u=K(r).get(a);c!==u&&t.updateProperties(r,{[a]:c})})}Fl.$inject=["injector","modeling"],ie(Fl,Y);function Hl(e,t){Y.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,r=Ve(i),o=r&&r.get("label"),a=o&&o.get("bounds");a&&t.updateModdleProperties(i,o,{bounds:void 0})},!0)}ie(Hl,Y),Hl.$inject=["eventBus","modeling"];function zl(e,t,n){Y.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(!(!v(o,"bpmn:SequenceFlow")||!v(a,"bpmn:SequenceFlow"))&&t.canConnect(o.source,a.target,o)){var s=jR(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}ie(zl,Y),zl.$inject=["eventBus","bpmnRules","modeling"];function ho(e){return e.original||e}function jR(e,t){var n=Dl(ho(e[e.length-2]),ho(e[e.length-1]),ho(t[1]),ho(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[ho(e[0]),ho(t[t.length-1])]}function Vl(e,t){Y.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,r=i.parent;v(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)}Vl.$inject=["eventBus","modeling"],ie(Vl,Y);function Gl(e,t,n,i){Y.call(this,e);var r=i.get("dragging",!1);function o(c){var u=c.source,l=c.target,p=c.parent;if(p){var f,d;v(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(u,l)||(d=!0),n.canConnectMessageFlow(u,l)&&(f="bpmn:MessageFlow")),v(c,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(u,l)||(d=!0),n.canConnectSequenceFlow(u,l)&&(f="bpmn:SequenceFlow")),d&&t.removeConnection(c),f&&t.connect(u,l,{type:f,waypoints:c.waypoints.slice()})}}function a(c){var u=c.context,l=u.connection,p=u.newSource||l.source,f=u.newTarget||l.target,d,h;d=n.canConnect(p,f),!(!d||d.type===l.type)&&(h=t.connect(p,f,{type:d.type,associationDirection:d.associationDirection,waypoints:l.waypoints.slice()}),l.parent&&t.removeConnection(l),u.connection=h,r&&s(l,h))}function s(c,u){var l=r.context(),p=l&&l.payload.previousSelection,f;!p||!p.length||(f=p.indexOf(c),f!==-1&&p.splice(f,1,u))}this.postExecuted("elements.move",function(c){var u=c.closure,l=u.allConnections;M(l,o)},!0),this.preExecute("connection.reconnect",a),this.postExecuted("element.updateProperties",function(c){var u=c.context,l=u.properties,p=u.element,f=p.businessObject,d;l.default&&(d=at(p.outgoing,Zr({id:p.businessObject.default.id})),d&&t.updateProperties(d,{conditionExpression:void 0})),l.conditionExpression&&f.sourceRef.default===f&&t.updateProperties(p.source,{default:void 0})})}ie(Gl,Y),Gl.$inject=["eventBus","modeling","bpmnRules","injector"];function Ys(e,t,n,i,r,o){i.invoke(Y,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=o,this.postExecuted(["elements.create"],500,function(a){var s=a.context,c=s.parent,u=s.elements,l=bn(u,function(p,f){var d=t.canReplace([f],f.host||f.parent||c);return d?p.concat(d.replacements):p},[]);l.length&&this._replaceElements(u,l)},this),this.postExecuted(["elements.move"],500,function(a){var s=a.context,c=s.newParent,u=s.newHost,l=[];M(s.closure.topLevel,function(f){sn(f)?l=l.concat(f.children):l=l.concat(f)}),l.length===1&&u&&(c=u);var p=t.canReplace(l,c);p&&this._replaceElements(l,p.replacements,u)},this),this.postExecute(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,u=s.newShape,l=c.attachers,p;l&&l.length&&(p=t.canReplace(l,u),this._replaceElements(l,p.replacements))},this),this.postExecuted(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,u=s.newShape;r.unclaimId(c.businessObject.id,c.businessObject),r.updateProperties(u,{id:c.id})})}ie(Ys,Y),Ys.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,r=this._selection;M(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)},Ys.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var FR=1500,HR={width:140,height:120},Wl={width:300,height:60},Ul={width:60,height:300},Ks={width:300,height:150},Xs={width:150,height:300},Um={width:140,height:120},qm={width:100,height:40};function Ym(e){e.on("resize.start",FR,function(t){var n=t.context,i=n.shape,r=n.direction,o=n.balanced;(v(i,"bpmn:Lane")||v(i,"bpmn:Participant"))&&(n.resizeConstraints=UR(i,r,o)),v(i,"bpmn:SubProcess")&&Be(i)&&(n.minDimensions=Um),v(i,"bpmn:TextAnnotation")&&(n.minDimensions=qm)})}Ym.$inject=["eventBus"];var ir=Math.abs,zR=Math.min,VR=Math.max;function Km(e,t,n,i){var r=e[t];e[t]=r===void 0?n:i(n,r)}function mo(e,t,n){return Km(e,t,n,zR)}function go(e,t,n){return Km(e,t,n,VR)}var GR={top:20,left:50,right:20,bottom:20},WR={top:50,left:20,right:20,bottom:20};function UR(e,t,n){var i=zn(e),r=!0,o=!0,a=Fs(i,[i]),s=me(e),c={},u={},l=Gt(e),p=l?Wl:Ul;/n/.test(t)?u.top=s.bottom-p.height:/e/.test(t)?u.right=s.left+p.width:/s/.test(t)?u.bottom=s.top+p.height:/w/.test(t)&&(u.left=s.right-p.width),a.forEach(function(h){var m=me(h);l?(m.top<s.top-10&&(r=!1),m.bottom>s.bottom+10&&(o=!1)):(m.left<s.left-10&&(r=!1),m.right>s.right+10&&(o=!1)),/n/.test(t)&&(n&&ir(s.top-m.bottom)<10&&go(c,"top",m.top+p.height),ir(s.top-m.top)<5&&mo(u,"top",m.bottom-p.height)),/e/.test(t)&&(n&&ir(s.right-m.left)<10&&mo(c,"right",m.right-p.width),ir(s.right-m.right)<5&&go(u,"right",m.left+p.width)),/s/.test(t)&&(n&&ir(s.bottom-m.top)<10&&mo(c,"bottom",m.bottom-p.height),ir(s.bottom-m.bottom)<5&&go(u,"bottom",m.top+p.height)),/w/.test(t)&&(n&&ir(s.left-m.right)<10&&go(c,"left",m.left+p.width),ir(s.left-m.left)<5&&mo(u,"left",m.right-p.width))});var f=i.children.filter(function(h){return!h.hidden&&!h.waypoints&&(v(h,"bpmn:FlowElement")||v(h,"bpmn:Artifact"))}),d=l?GR:WR;return f.forEach(function(h){var m=me(h);/n/.test(t)&&(!l||r)&&mo(u,"top",m.top-d.top),/e/.test(t)&&(l||o)&&go(u,"right",m.right+d.right),/s/.test(t)&&(!l||o)&&go(u,"bottom",m.bottom+d.bottom),/w/.test(t)&&(l||r)&&mo(u,"left",m.left-d.left)}),{min:u,max:c}}function Xm(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function yo(e){return e.originalEvent||e.srcEvent}function ql(e){Xm(e),Xm(yo(e))}function Lr(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 Zm(){return/mac/i.test(navigator.platform)}function Qm(e,t){return(yo(e)||e).button===t}function rr(e){return Qm(e,0)}function qR(e){return Qm(e,1)}function la(e){var t=yo(e)||e;return rr(e)?Zm()?t.metaKey:t.ctrlKey:!1}function Zs(e){var t=yo(e)||e;return rr(e)&&t.shiftKey}var Jm=1001;function eg(e,t){e.on("resize.start",Jm+500,function(n){var i=n.context,r=i.shape;(v(r,"bpmn:Lane")||v(r,"bpmn:Participant"))&&(i.balanced=!la(n))}),e.on("resize.end",Jm,function(n){var i=n.context,r=i.shape,o=i.canExecute,a=i.newBounds;if(v(r,"bpmn:Lane")||v(r,"bpmn:Participant"))return o&&(a=Th(a),t.resizeLane(r,a,i.balanced)),!1})}eg.$inject=["eventBus","modeling"];var YR=500;function Yl(e,t,n,i,r){n.invoke(Y,this);function o(l){return De(l,["bpmn:ReceiveTask","bpmn:SendTask"])||KR(l,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(l){var p=e.getDefinitions(),f=p.get("rootElements");return!!at(f,Zr({id:l.id}))}function s(l){if(v(l,"bpmn:ErrorEventDefinition"))return"errorRef";if(v(l,"bpmn:EscalationEventDefinition"))return"escalationRef";if(v(l,"bpmn:MessageEventDefinition"))return"messageRef";if(v(l,"bpmn:SignalEventDefinition"))return"signalRef"}function c(l){if(De(l,["bpmn:ReceiveTask","bpmn:SendTask"]))return l.get("messageRef");var p=l.get("eventDefinitions"),f=p[0];return f.get(s(f))}function u(l,p){if(De(l,["bpmn:ReceiveTask","bpmn:SendTask"]))return l.set("messageRef",p);var f=l.get("eventDefinitions"),d=f[0];return d.set(s(d),p)}this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],function(l){var p=l.shape||l.element;if(o(p)){var f=K(p),d=c(f),h;d&&!a(d)&&(h=e.getDefinitions().get("rootElements"),Et(h,d),l.addedRootElement=d)}},!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],function(l){var p=l.addedRootElement;if(p){var f=e.getDefinitions().get("rootElements");_t(f,p)}},!0),t.on("copyPaste.copyElement",function(l){var p=l.descriptor,f=l.element;if(!(f.labelTarget||!o(f))){var d=K(f),h=c(d);h&&(p.referencedRootElement=h)}}),t.on("copyPaste.pasteElement",YR,function(l){var p=l.descriptor,f=p.businessObject,d=p.referencedRootElement;d&&(a(d)||(d=i.copyElement(d,r.create(d.$type))),u(f,d),delete p.referencedRootElement)})}Yl.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],ie(Yl,Y);function KR(e,t){return ge(t)||(t=[t]),Fi(t,function(n){return so(e,n)})}var tg=Math.max;function ng(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,r=t.start,o={};return M(n,function(a){var s=a.id;v(a,"bpmn:Participant")&&(o[s]=ZR(a,i,r)),v(a,"bpmn:Lane")&&(o[s]=Gt(a)?Wl:Ul),v(a,"bpmn:SubProcess")&&Be(a)&&(o[s]=Um),v(a,"bpmn:TextAnnotation")&&(o[s]=qm),v(a,"bpmn:Group")&&(o[s]=HR)}),o})}ng.$inject=["eventBus"];function XR(e){return e==="x"}function ZR(e,t,n){var i=Gt(e);if(!eC(e))return i?Ks:Xs;var r=XR(t),o={};return r?i?o=Ks:o={width:JR(e,n,r),height:Xs.height}:i?o={width:Ks.width,height:QR(e,n,r)}:o=Xs,o}function QR(e,t,n){var i;return i=tC(e,t,n),tg(Ks.height,i)}function JR(e,t,n){var i;return i=nC(e,t,n),tg(Xs.width,i)}function eC(e){return!!nr(e).length}function tC(e,t,n){var i=nr(e),r;return r=Kl(i,t,n),e.height-r.height+Wl.height}function nC(e,t,n){var i=nr(e),r;return r=Kl(i,t,n),e.width-r.width+Ul.width}function Kl(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=nr(r),o.length?Kl(o,t,n):r}var ig="_plane";function rg(e){var t=e.id;return iC(t)}function mi(e){var t=e.id;return v(e,"bpmn:SubProcess")?og(t):t}function Ir(e){return og(e)}function Qs(e){var t=Ve(e);return v(t,"bpmndi:BPMNPlane")}function og(e){return e+ig}function iC(e){return e.replace(new RegExp(ig+"$"),"")}var ag=400,rC=600,sg={x:180,y:160};function Mi(e,t,n,i,r,o,a){Y.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(p){return v(p,"bpmn:SubProcess")&&!Be(p)}function u(p){var f=p.shape,d=p.newRootElement,h=K(f);d=s._addDiagram(d||h),p.newRootElement=e.addRootElement(d)}function l(p){var f=p.shape,d=K(f);s._removeDiagram(d);var h=p.newRootElement=a.get(mi(d));e.removeRootElement(h)}this.executed("shape.create",function(p){var f=p.shape;c(f)&&u(p)},!0),this.postExecuted("elements.create",function(p){var f=p.elements;M(f,function(d){if(c(d)){var h=a.get(mi(d));if(!(!h||!d.children||!d.children.length)){var m=cg(d);s._showRecursively(m),s._moveChildrenToShape(m,h)}}})},!0),this.reverted("shape.create",function(p){var f=p.shape;c(f)&&l(p)},!0),this.preExecute("shape.delete",function(p){var f=p.shape;!v(f,"bpmn:SubProcess")||!Be(f)||M(ea([f]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(p){var f=p.shape;if(c(f)){var d=a.get(mi(f));d&&n.removeElements(d.children.slice())}},!0),this.executed("shape.delete",function(p){var f=p.shape;c(f)&&l(p)},!0),this.reverted("shape.delete",function(p){var f=p.shape;c(f)&&u(p)},!0),this.preExecuted("shape.replace",function(p){var f=p.oldShape,d=p.newShape;!c(f)||!c(d)||(p.oldRoot=e.removeRootElement(mi(f)))},!0),this.postExecuted("shape.replace",function(p){var f=p.newShape,d=p.oldRoot,h=e.findRoot(mi(f));if(!(!d||!h)){var m=d.children;n.moveElements(m,{x:0,y:0},h)}},!0),this.executed("element.updateProperties",function(p){var f=p.element;if(v(f,"bpmn:SubProcess")){var d=p.properties,h=p.oldProperties,m=h.id,g=d.id;if(m!==g){if(Qs(f)){a.updateId(f,Ir(g)),a.updateId(m,g);return}var R=a.get(Ir(m));R&&a.updateId(Ir(m),Ir(g))}}},!0),this.reverted("element.updateProperties",function(p){var f=p.element;if(v(f,"bpmn:SubProcess")){var d=p.properties,h=p.oldProperties,m=h.id,g=d.id;if(m!==g){if(Qs(f)){a.updateId(f,Ir(m)),a.updateId(g,m);return}var R=a.get(Ir(g));R&&a.updateId(R,Ir(m))}}},!0),t.on("element.changed",function(p){var f=p.element;if(Qs(f)){var d=f,h=a.get(rg(d));!h||h===d||t.fire("element.changed",{element:h})}}),this.executed("shape.toggleCollapse",ag,function(p){var f=p.shape;v(f,"bpmn:SubProcess")&&(Be(f)?l(p):(u(p),s._showRecursively(f.children)))},!0),this.reverted("shape.toggleCollapse",ag,function(p){var f=p.shape;v(f,"bpmn:SubProcess")&&(Be(f)?l(p):(u(p),s._showRecursively(f.children)))},!0),this.postExecuted("shape.toggleCollapse",rC,function(p){var f=p.shape;if(v(f,"bpmn:SubProcess")){var d=p.newRootElement;if(d)if(Be(f))s._moveChildrenToShape(d.children.slice(),f),M(ea(f.children),m=>{n.moveShape(m.annotation,{x:0,y:0},f.parent),M(m.associations,g=>{n.moveConnection(g,{x:0,y:0},f.parent)})});else{s._disconnectSharedAnnotations(f);var h=cg(f);s._moveChildrenToShape(h,d)}}},!0),t.on("copyPaste.createTree",function(p){var f=p.element,d=p.children;if(c(f)){var h=mi(f),m=a.get(h);m&&d.push.apply(d,m.children)}}),t.on("copyPaste.copyElement",function(p){var f=p.descriptor,d=p.element,h=p.elements,m=d.parent,g=v(Ve(m),"bpmndi:BPMNPlane");if(g){var R=rg(m),E=at(h,function(x){return x.id===R});E&&(f.parent=E.id)}}),t.on("copyPaste.pasteElement",function(p){var f=p.descriptor;f.parent&&(c(f.parent)||f.parent.hidden)&&(f.hidden=!0)})}ie(Mi,Y),Mi.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=Rt(i),o;if(!t.x)o={x:sg.x-r.x,y:sg.y-r.y};else{var a=ye(t),s=ye(r);o={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,o,t,{autoResize:!1})}},Mi.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(Qh(e).map(i=>i.annotation));n.size&&M(ea(e.children),i=>{n.has(i.annotation)&&M(i.associations,r=>{t.removeConnection(r)})})},Mi.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},Mi.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},Mi.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:mi(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return o},Mi.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=at(n,function(r){return r.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},Mi.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function oC(e){var t=[];return M(ea(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function cg(e){return e.children.slice().concat(oC(e.children)).concat(aC(e))}function aC(e){return el(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function Xl(e,t){e.invoke(Y,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,r=n.context.newShape;if(!(!v(r,"bpmn:SubProcess")||v(r,"bpmn:AdHocSubProcess")||!(v(i,"bpmn:Task")||v(i,"bpmn:CallActivity"))||!Be(r))){var o=sC(r);t.createShape({type:"bpmn:StartEvent"},o,r)}})}Xl.$inject=["injector","modeling"],ie(Xl,Y);function sC(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function Zl(e,t){Y.call(this,e),this.preExecute("connection.create",function(n){const{target:i}=n;v(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&&v(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(!(!v(r,"bpmn:TextAnnotation")||o.autoResize)){var a=i.newBounds,s=t.getTextAnnotationBounds(a,In(r)||""),c=a.y!==r.y&&Math.abs(a.y+a.height-(r.y+r.height))<=1,u=r.y+r.height;i.newBounds={width:a.width,height:s.height,x:a.x,y:c?u-s.height:a.y}}})}ie(Zl,Y),Zl.$inject=["eventBus","textRenderer"];function Ql(e,t){Y.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(Be(i))return;var r=Yo(i);r.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();M(s,function(u){o(u,!0)}),M(c,function(u){o(u,!1)})});function o(a,s){r.indexOf(a.source)!==-1&&r.indexOf(a.target)!==-1||v(a,"bpmn:Association")&&(v(a.source,"bpmn:TextAnnotation")||v(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,i,ye(i)):t.reconnectStart(a,i,ye(i)))}},!0)}ie(Ql,Y),Ql.$inject=["eventBus","modeling"];var Jl=500;function ep(e,t,n){Y.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,u=s,l,p;return l=cC(c).concat([a]),p=gm(l),p?(u.width=Math.max(p.width,u.width),u.height=Math.max(p.height,u.height),u.x=p.x+(p.width-u.width)/2,u.y=p.y+(p.height-u.height)/2):(u.x=a.x+(a.width-u.width)/2,u.y=a.y+(a.height-u.height)/2),u}function o(a,s){return{x:a.x+(a.width-s.width)/2,y:a.y+(a.height-s.height)/2,width:s.width,height:s.height}}this.executed(["shape.toggleCollapse"],Jl,function(a){var s=a.context,c=s.shape;v(c,"bpmn:SubProcess")&&(c.collapsed?Ve(c).isExpanded=!1:(i(c.children),Ve(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],Jl,function(a){var s=a.context,c=s.shape;c.collapsed?Ve(c).isExpanded=!1:Ve(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],Jl,function(a){var s=a.context.shape,c=t.getDefaultSize(s),u;s.collapsed?u=o(s,c):u=r(s,c),n.resizeShape(s,u,null,{autoResize:s.collapsed?!1:"nwse"})})}ie(ep,Y),ep.$inject=["eventBus","elementFactory","modeling"];function cC(e){return e.filter(function(t){return!t.hidden})}function tp(e,t,n,i){t.invoke(Y,this),this.preExecute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.businessObject;ke(a)||(v(a,"bpmn:Participant")&&Be(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;v(r,"bpmn:Collaboration")&&n.ids.unclaim(o.id)})}ie(tp,Y),tp.$inject=["canvas","injector","moddle","modeling"];function np(e,t){Y.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,r=i.connection,o=r.source;uC(r,o)&&t.updateProperties(o,{default:null})})}ie(np,Y),np.$inject=["eventBus","modeling"];function uC(e,t){if(!v(e,"bpmn:SequenceFlow"))return!1;var n=K(t),i=K(e);return n.get("default")===i}var lC=500,pC=5e3,ug=["shape.create","shape.delete","shape.move","shape.resize"],lg=[...ug,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function ip(e,t){Y.call(this,e);var n;function i(){return n=n||new fC,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(lg,pC,function(){i()}),this.postExecuted(lg,lC,function(){o()}),this.preExecute(ug,function(a){var s=a.context,c=s.shape,u=r();!c||c.labelTarget||(v(c,"bpmn:Lane")&&u.addLane(c),v(c,"bpmn:FlowNode")&&u.addFlowNode(c))})}ip.$inject=["eventBus","modeling"],ie(ip,Y);function fC(){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 dC=500,hC=5e3,pg=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],fg=[...pg,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function rp(e,t){Y.call(this,e);var n;function i(){return n=n||new mC,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(fg,hC,function(){i()}),this.postExecuted(fg,dC,function(){o()}),this.preExecute(pg,function(a){var s=a.context.connection||a.context.shape,c=r();!s||s.labelTarget||(v(s,"bpmn:FlowElement")&&c.addFlowElement(s),v(s,"bpmn:Group")&&c.addGroup(s))}),this.preExecute("label.create",function(a){var s=a.context.labelTarget;v(s,"bpmn:Group")&&r().addGroup(s)})}rp.$inject=["eventBus","modeling"],ie(rp,Y);function mC(){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 op(e,t){Y.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,r=i.elements;for(const o of r)gC(o)&&!vC(o)&&t.updateProperties(o,{isForCompensation:void 0})})}ie(op,Y),op.$inject=["eventBus","modeling"];function gC(e){const t=K(e);return t&&t.isForCompensation}function yC(e){return e&&v(e,"bpmn:BoundaryEvent")&&so(e,"bpmn:CompensateEventDefinition")}function vC(e){return e.incoming.filter(n=>yC(n.source)).length>0}const _C={__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",dl],appendBehavior:["type",hl],associationBehavior:["type",gl],attachEventBehavior:["type",Os],artifactBehavior:["type",ml],boundaryEventBehavior:["type",yl],categoryRootElementReferenceBehavior:["type",vl],compensateBoundaryEventBehaviour:["type",_l],createBehavior:["type",bl],createDataObjectBehavior:["type",xl],createParticipantBehavior:["type",Sl],dataInputAssociationBehavior:["type",Rl],dataStoreBehavior:["type",Cl],deleteLaneBehavior:["type",Pl],detachEventBehavior:["type",Hs],dropOnFlowBehavior:["type",Tl],eventBasedGatewayBehavior:["type",Ml],fixHoverBehavior:["type",wm],groupBehavior:["type",kl],importDockingFix:["type",Rm],isHorizontalFix:["type",Ol],labelBehavior:["type",Il],layoutConnectionBehavior:["type",Nl],messageFlowBehavior:["type",jl],nonInterruptingBehavior:["type",Fl],removeElementBehavior:["type",zl],removeEmbeddedLabelBoundsBehavior:["type",Hl],removeParticipantBehavior:["type",Vl],replaceConnectionBehavior:["type",Gl],replaceElementBehaviour:["type",Ys],resizeBehavior:["type",Ym],resizeLaneBehavior:["type",eg],rootElementReferenceBehavior:["type",Yl],spaceToolBehavior:["type",ng],subProcessPlaneBehavior:["type",Mi],subProcessStartEventBehavior:["type",Xl],textAnnotationBehavior:["type",Zl],toggleCollapseConnectionBehaviour:["type",Ql],toggleElementCollapseBehaviour:["type",ep],unclaimIdBehavior:["type",tp],unsetDefaultFlowBehavior:["type",np],updateFlowNodeRefsBehavior:["type",ip],updateCategoryValueRefsBehavior:["type",rp],setCompensationActivityAfterPasteBehavior:["type",op]};function ap(e){this._commandStack=e.get("commandStack",!1)}ap.$inject=["injector"],ap.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const gi={__init__:["rules"],rules:["type",ap]};function Vn(e){Y.call(this,e),this.init()}Vn.$inject=["eventBus"],ie(Vn,Y),Vn.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)})},Vn.prototype.init=function(){};function dg(e,t){var n=Xt(e,t,-15);return n!=="intersect"?n:null}function Qt(e){Vn.call(this,e)}ie(Qt,Vn),Qt.$inject=["eventBus"],Qt.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return bC(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 Cg(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return it(i)&&!tc(t,i)?!1:Er(t,function(r){return it(r)?ec(r.source,r.target,r):r.host?pa(r,r.host,null,n):lp(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 bg(a)&&!n.includes(a.host)})?!1:pa(n,t,null,i)||Sg(n,t,i)||Rg(n,t)||tc(n,t)}),this.addRule("shape.create",function(e){return lp(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return pa(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return kg(n,t)})},Qt.prototype.canConnectMessageFlow=Tg,Qt.prototype.canConnectSequenceFlow=Mg,Qt.prototype.canConnectDataAssociation=pp,Qt.prototype.canConnectAssociation=Pg,Qt.prototype.canConnectCompensationAssociation=Ag,Qt.prototype.canMove=Rg,Qt.prototype.canAttach=pa,Qt.prototype.canReplace=Sg,Qt.prototype.canDrop=vo,Qt.prototype.canInsert=tc,Qt.prototype.canCreate=lp,Qt.prototype.canConnect=ec,Qt.prototype.canResize=Cg,Qt.prototype.canCopy=kg;function bC(e){return sp(e)?null:De(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function sp(e){return!e||ke(e)}function hg(e){do{if(v(e,"bpmn:Process"))return K(e);if(v(e,"bpmn:Participant"))return K(e).processRef||K(e)}while(e=e.parent)}function cp(e){return v(e,"bpmn:TextAnnotation")}function up(e){return v(e,"bpmn:Group")&&!e.labelTarget}function mg(e){return v(e,"bpmn:BoundaryEvent")&&yi(e,"bpmn:CompensateEventDefinition")}function Js(e){return K(e).isForCompensation}function xC(e,t){var n=hg(e),i=hg(t);return n===i}function EC(e){return v(e,"bpmn:InteractionNode")&&!v(e,"bpmn:BoundaryEvent")&&(!v(e,"bpmn:Event")||v(e,"bpmn:ThrowEvent")&&vg(e,"bpmn:MessageEventDefinition"))}function wC(e){return v(e,"bpmn:InteractionNode")&&!Js(e)&&(!v(e,"bpmn:Event")||v(e,"bpmn:CatchEvent")&&vg(e,"bpmn:MessageEventDefinition"))&&!(v(e,"bpmn:BoundaryEvent")&&!yi(e,"bpmn:MessageEventDefinition"))}function gg(e){for(var t=e;t=t.parent;){if(v(t,"bpmn:FlowElementsContainer"))return K(t);if(v(t,"bpmn:Participant"))return K(t).processRef}return null}function yg(e,t){var n=gg(e),i=gg(t);return n===i}function yi(e,t){var n=K(e);return!!at(n.eventDefinitions||[],function(i){return v(i,t)})}function vg(e,t){var n=K(e);return(n.eventDefinitions||[]).every(function(i){return v(i,t)})}function SC(e){return v(e,"bpmn:FlowNode")&&!v(e,"bpmn:EndEvent")&&!sn(e)&&!(v(e,"bpmn:IntermediateThrowEvent")&&yi(e,"bpmn:LinkEventDefinition"))&&!mg(e)&&!Js(e)}function RC(e){return v(e,"bpmn:FlowNode")&&!v(e,"bpmn:StartEvent")&&!v(e,"bpmn:BoundaryEvent")&&!sn(e)&&!(v(e,"bpmn:IntermediateCatchEvent")&&yi(e,"bpmn:LinkEventDefinition"))&&!Js(e)}function CC(e){return v(e,"bpmn:ReceiveTask")||v(e,"bpmn:IntermediateCatchEvent")&&(yi(e,"bpmn:MessageEventDefinition")||yi(e,"bpmn:TimerEventDefinition")||yi(e,"bpmn:ConditionalEventDefinition")||yi(e,"bpmn:SignalEventDefinition"))}function PC(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function _g(e,t){var n=PC(t);return n.indexOf(e)!==-1}function ec(e,t,n){if(sp(e)||sp(t))return null;if(!v(n,"bpmn:DataAssociation")){if(Tg(e,t))return{type:"bpmn:MessageFlow"};if(Mg(e,t))return{type:"bpmn:SequenceFlow"}}var i=pp(e,t);return i||(Ag(e,t)?{type:"bpmn:Association",associationDirection:"One"}:Pg(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function vo(e,t){return ke(e)||up(e)?!0:v(t,"bpmn:Participant")&&!Be(t)?!1:v(e,"bpmn:Participant")?v(t,"bpmn:Process")||v(t,"bpmn:Collaboration"):De(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:v(e,"bpmn:Lane")?v(t,"bpmn:Participant")||v(t,"bpmn:Lane"):v(e,"bpmn:BoundaryEvent")&&!AC(e)?!1:v(e,"bpmn:FlowElement")&&!v(e,"bpmn:DataStoreReference")?v(t,"bpmn:FlowElementsContainer")?Be(t):De(t,["bpmn:Participant","bpmn:Lane"]):v(e,"bpmn:DataStoreReference")&&v(t,"bpmn:Collaboration")?Fi(K(t).get("participants"),function(n){return!!n.get("processRef")}):De(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?De(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):v(e,"bpmn:MessageFlow")?v(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function AC(e){return K(e).cancelActivity&&(xg(e)||Eg(e))}function bg(e){return!ke(e)&&v(e,"bpmn:BoundaryEvent")}function TC(e){return v(e,"bpmn:Lane")}function MC(e){return bg(e)||v(e,"bpmn:IntermediateThrowEvent")&&xg(e)?!0:v(e,"bpmn:IntermediateCatchEvent")&&Eg(e)}function xg(e){var t=K(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function Eg(e){return wg(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function wg(e,t){return t.some(function(n){return yi(e,n)})}function kC(e){return v(e,"bpmn:ReceiveTask")&&at(e.incoming,function(t){return v(t.source,"bpmn:EventBasedGateway")})}function pa(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var r=e[0];return ke(r)||!MC(r)||sn(t)||!v(t,"bpmn:Activity")||Js(t)||i&&!dg(i,t)||kC(t)?!1:"attach"}function Sg(e,t,n){if(!t)return!1;var i={replacements:[]};return M(e,function(r){sn(t)||v(r,"bpmn:StartEvent")&&r.type!=="label"&&vo(r,t)&&(F1(r)||i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),(H1(r)||z1(r)||V1(r))&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),wg(r,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&v(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"})),v(t,"bpmn:Transaction")||yi(r,"bpmn:CancelEventDefinition")&&r.type!=="label"&&(v(r,"bpmn:EndEvent")&&vo(r,t)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:EndEvent"}),v(r,"bpmn:BoundaryEvent")&&pa(r,t,null,n)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function Rg(e,t){return Fi(e,TC)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return vo(n,t)})}function lp(e,t,n,i){return t?ke(e)||up(e)?!0:vo(e,t)||tc(e,t):!1}function Cg(e,t,n){return v(e,"bpmn:SubProcess")?Be(e)&&(!t||t.width>=100&&t.height>=80):v(e,"bpmn:Lane")||v(e,"bpmn:Participant")?!0:cp(e)?n?n==="e"||n==="w":!0:up(e)?!0:ke(e)?n?n==="e"||n==="w":!0:!1}function DC(e,t){var n=cp(e),i=cp(t);return(n||i)&&n!==i}function Pg(e,t){return _g(t,e)||_g(e,t)?!1:DC(e,t)?!0:!!pp(e,t)}function Ag(e,t){return yg(e,t)&&mg(e)&&v(t,"bpmn:Activity")&&!LC(t,e)&&!sn(t)}function Tg(e,t){return Og(e)&&!Og(t)?!1:EC(e)&&wC(t)&&!xC(e,t)}function Mg(e,t){return SC(e)&&RC(t)&&yg(e,t)&&!(v(e,"bpmn:EventBasedGateway")&&!CC(t))}function pp(e,t){return De(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&De(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:De(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&De(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function tc(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:De(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!ke(t)&&v(e,"bpmn:FlowNode")&&!v(e,"bpmn:BoundaryEvent")&&vo(e,t.parent)}function fp(e,t){return e&&t&&e.indexOf(t)!==-1}function kg(e,t){return ke(t)?!0:!(v(t,"bpmn:Lane")&&!fp(e,t.parent)||v(t,"bpmn:MessageFlow")&&!OC(e,t))}function OC(e,t){var n=Dg(t.source),i=Dg(t.target);return fp(e,n)&&fp(e,i)}function Dg(e){for(;e;e=e.parent)if(v(e,"bpmn:Participant"))return e;return null}function Og(e){return lo(e,"bpmn:Process")||lo(e,"bpmn:Collaboration")}function LC(e,t){return e.attachers.includes(t)}const IC={__depends__:[gi],__init__:["bpmnRules"],bpmnRules:["type",Qt]};var NC=2e3;function Lg(e,t){e.on("saveXML.start",NC,n);function n(){var i=t.getRootElements();M(i,function(r){var o=Ve(r),a,s;a=Yo([r]),a=Oe(a,function(c){return c!==r&&!c.labelTarget}),s=nn(a,Ve),o.set("planeElement",s)})}}Lg.$inject=["eventBus","canvas"];const BC={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",Lg]};function nc(e){Y.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)})}nc.prototype.getOrdering=function(e,t){return null},ie(nc,Y);function dp(e,t){nc.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=at(n,function(c){return De(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 u=s;u&&!De(u,c);)u=u.parent;if(!u)throw new Error(`no parent for <${a.id}> in <${s&&s.id}>`);return u}this.getOrdering=function(a,s){if(a.labelTarget||v(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 u=s.children.indexOf(a),l=Hf(s.children,function(p){return!a.labelTarget&&p.labelTarget?!1:c.level<r(p).level});return l!==-1&&u!==-1&&u<l&&(l-=1),{index:l,parent:s}}}dp.$inject=["eventBus","canvas"],ie(dp,nc);const $C={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",dp]};function fa(){}fa.prototype.get=function(){return this._data},fa.prototype.set=function(e){this._data=e},fa.prototype.clear=function(){var e=this._data;return delete this._data,e},fa.prototype.isEmpty=function(){return!this._data};const jC={clipboard:["type",fa]};var Ig=1500;function Ng(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),u=c&&e.get(c);c&&u&&(a.stopPropagation(),r.hover({element:u,gfx:c}),r.move(s))}}r&&t.on("drag.start",function(a){t.once("drag.move",Ig,function(s){o(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",Ig,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=Lr(a),c=document.elementFromPoint(s.x,s.y),FC(c)}}Ng.$inject=["elementRegistry","eventBus","injector"];function FC(e){return Ar(e,"svg, .djs-element",!0)}const HC={__init__:["hoverFix"],hoverFix:["type",Ng]};function zC(e){return!0}function ic(e){return rr(e)||qR(e)}var Bg=500;function $g(e,t,n){var i=this;function r(A,F,H){if(!s(A,F)){var N,z,ue;H?z=t.getGraphics(H):(N=F.delegateTarget||F.target,N&&(z=N,H=t.get(z))),!(!z||!H)&&(ue=e.fire(A,{element:H,gfx:z,originalEvent:F}),ue===!1&&(F.stopPropagation(),F.preventDefault()))}}var o={};function a(A){return o[A]}function s(A,F){var H=u[A]||rr;return!H(F)}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"},u={"element.contextmenu":zC,"element.mousedown":ic,"element.mouseup":ic,"element.click":ic,"element.dblclick":ic};function l(A,F,H){var N=c[A];if(!N)throw new Error("unmapped DOM event name <"+A+">");return r(N,F,H)}var p="svg, .djs-element";function f(A,F,H,N){var z=o[H]=function(ue){r(H,ue)};N&&(u[H]=N),z.$delegate=En.bind(A,p,F,z)}function d(A,F,H){var N=a(H);N&&En.unbind(A,F,N.$delegate)}function h(A){M(c,function(F,H){f(A,H,F)})}function m(A){M(c,function(F,H){d(A,H,F)})}e.on("canvas.destroy",function(A){m(A.svg)}),e.on("canvas.init",function(A){h(A.svg)}),e.on(["shape.added","connection.added"],function(A){var F=A.element,H=A.gfx;e.fire("interactionEvents.createHit",{element:F,gfx:H})}),e.on(["shape.changed","connection.changed"],Bg,function(A){var F=A.element,H=A.gfx;e.fire("interactionEvents.updateHit",{element:F,gfx:H})}),e.on("interactionEvents.createHit",Bg,function(A){var F=A.element,H=A.gfx;i.createDefaultHit(F,H)}),e.on("interactionEvents.updateHit",function(A){var F=A.element,H=A.gfx;i.updateDefaultHit(F,H)});var g=w("djs-hit djs-hit-stroke"),R=w("djs-hit djs-hit-click-stroke"),E=w("djs-hit djs-hit-all"),x=w("djs-hit djs-hit-no-move"),b={all:E,"click-stroke":R,stroke:g,"no-move":x};function w(A,F){return F=D({stroke:"white",strokeWidth:15},F||{}),n.cls(A,["no-fill","no-border"],F)}function T(A,F){var H=b[F];if(!H)throw new Error("invalid hit type <"+F+">");return re(A,H),A}function L(A,F){Se(A,F)}this.removeHits=function(A){var F=hs(".djs-hit",A);M(F,It)},this.createDefaultHit=function(A,F){var H=A.waypoints,N=A.isFrame,z;return H?this.createWaypointsHit(F,H):(z=N?"stroke":"all",this.createBoxHit(F,z,{width:A.width,height:A.height}))},this.createWaypointsHit=function(A,F){var H=qo(F);return T(H,"stroke"),L(A,H),H},this.createBoxHit=function(A,F,H){H=D({x:0,y:0},H);var N=pe("rect");return T(N,F),re(N,H),L(A,N),N},this.updateDefaultHit=function(A,F){var H=et(".djs-hit",F);if(H)return A.waypoints?Ju(H,A.waypoints):re(H,{width:A.width,height:A.height}),H},this.fire=r,this.triggerMouseEvent=l,this.mouseHandler=a,this.registerEvent=f,this.unregisterEvent=d}$g.$inject=["eventBus","elementRegistry","styles"];const rc={__init__:["interactionEvents"],interactionEvents:["type",$g]};function _o(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)})}_o.$inject=["eventBus","canvas"],_o.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()})}},_o.prototype.get=function(){return Array.from(this._selectedElements)},_o.prototype.isSelected=function(e){return this._selectedElements.has(e)},_o.prototype.select=function(e,t){var n=this.get();ge(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?M(e,o=>{this._selectedElements.add(o)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var jg="hover",Fg="selected";function Hg(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,jg)}),t.on("element.out",function(r){i(r.element,jg)}),t.on("selection.changed",function(r){function o(u){i(u,Fg)}function a(u){n(u,Fg)}var s=new Set(r.oldSelection),c=new Set(r.newSelection);for(let u of s)c.has(u)||o(u);for(let u of c)s.has(u)||a(u)})}Hg.$inject=["canvas","eventBus"];function zg(e,t,n,i){e.on("create.end",500,function(r){var o=r.context,a=o.canExecute,s=o.elements,c=o.hints||{},u=c.autoSelect;if(a){if(u===!1)return;ge(u)?t.select(u):t.select(s.filter(VC))}}),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=at(o,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(r){if(rr(r)){var o=r.element;o===n.getRootElement()&&(o=null);var a=t.isSelected(o),s=t.get().length>1,c=Zs(r);if(a&&s)return c?t.deselect(o):t.select(o);a?t.deselect(o):t.select(o,c)}})}zg.$inject=["eventBus","selection","canvas","elementRegistry"];function VC(e){return!e.hidden}const Gn={__init__:["selectionVisuals","selectionBehavior"],__depends__:[rc],selection:["type",_o],selectionVisuals:["type",Hg],selectionBehavior:["type",zg]};var GC=/^djs-cursor-.*$/;function oc(e){var t=ft(document.body);t.removeMatching(GC),e&&t.add("djs-cursor-"+e)}function Vg(){oc(null)}var WC=5e3;function Gg(e,t){t=t||"element.click";function n(){return!1}return e.once(t,WC,n),function(){e.off(t,n)}}var UC=["c","C"],qC=["v","V"],YC=["d","D"],KC=["x","X"],XC=["y","Y"],Wg=["z","Z"];function ZC(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Rn(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function Nt(e,t){return e=ge(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function hp(e){return e.shiftKey}function QC(e){return Rn(e)&&Nt(UC,e)}function JC(e){return Rn(e)&&Nt(qC,e)}function eP(e){return Rn(e)&&Nt(YC,e)}function tP(e){return Rn(e)&&Nt(KC,e)}function nP(e){return Rn(e)&&!hp(e)&&Nt(Wg,e)}function iP(e){return Rn(e)&&(Nt(XC,e)||Nt(Wg,e)&&hp(e))}var bo=Math.round,Ug="djs-drag-active";function Nr(e){e.preventDefault()}function rP(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function oP(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function qg(e,t,n,i){var r={threshold:5,trapClick:!0},o;function a(x){var b=t.viewbox(),w=t._container.getBoundingClientRect();return{x:b.x+(x.x-w.left)/b.scale,y:b.y+(x.y-w.top)/b.scale}}function s(x,b){b=b||o;var w=e.createEvent(D({},b.payload,b.data,{isTouch:b.isTouch}));return e.fire("drag."+x,w)===!1?!1:e.fire(b.prefix+"."+x,w)}function c(x){var b=x.filter(function(w){return i.get(w.id)});b.length&&n.select(b)}function u(x,b){var w=o.payload,T=o.displacement,L=o.globalStart,A=Lr(x),F=ei(A,L),H=o.localStart,N=a(A),z=ei(N,H);if(!o.active&&(b||oP(F)>o.threshold)){if(D(w,{x:bo(H.x+T.x),y:bo(H.y+T.y),dx:0,dy:0},{originalEvent:x}),s("start")===!1)return g();o.active=!0,o.keepSelection||(w.previousSelection=n.get(),n.select(null)),o.cursor&&oc(o.cursor),t.addMarker(t.getRootElement(),Ug)}ql(x),o.active&&(D(w,{x:bo(N.x+T.x),y:bo(N.y+T.y),dx:bo(z.x),dy:bo(z.y)},{originalEvent:x}),s("move"))}function l(x){var b,w=!0;o.active&&(x&&(o.payload.originalEvent=x,ql(x)),w=s("end")),w===!1&&s("rejected"),b=R(w!==!0),s("ended",b)}function p(x){Nt("Escape",x)&&(Nr(x),g())}function f(x){var b;o.active&&(b=Gg(e),setTimeout(b,400),Nr(x)),l(x)}function d(x){u(x)}function h(x){var b=o.payload;b.hoverGfx=x.gfx,b.hover=x.element,s("hover")}function m(x){s("out");var b=o.payload;b.hoverGfx=null,b.hover=null}function g(x){var b;if(o){var w=o.active;w&&s("cancel"),b=R(x),w&&s("canceled",b)}}function R(x){var b,w;s("cleanup"),Vg(),o.trapClick?w=f:w=l,we.unbind(document,"mousemove",u),we.unbind(document,"dragstart",Nr),we.unbind(document,"selectstart",Nr),we.unbind(document,"mousedown",w,!0),we.unbind(document,"mouseup",w,!0),we.unbind(document,"keyup",p),we.unbind(document,"touchstart",d,!0),we.unbind(document,"touchcancel",g,!0),we.unbind(document,"touchmove",u,!0),we.unbind(document,"touchend",l,!0),e.off("element.hover",h),e.off("element.out",m),t.removeMarker(t.getRootElement(),Ug);var T=o.payload.previousSelection;return x!==!1&&T&&!n.get().length&&c(T),b=o,o=null,b}function E(x,b,w,T){o&&g(!1),typeof b=="string"&&(T=w,w=b,b=null),T=D({},r,T||{});var L=T.data||{},A,F,H,N,z;if(T.trapClick?N=f:N=l,x?(A=yo(x)||x,F=Lr(x),ql(x),A.type==="dragstart"&&Nr(A)):(A=null,F={x:0,y:0}),H=a(F),b||(b=H),z=rP(A),o=D({prefix:w,data:L,payload:{},globalStart:F,displacement:ei(b,H),localStart:H,isTouch:z},T),T.manual||(z?(we.bind(document,"touchstart",d,!0),we.bind(document,"touchcancel",g,!0),we.bind(document,"touchmove",u,!0),we.bind(document,"touchend",l,!0)):(we.bind(document,"mousemove",u),we.bind(document,"dragstart",Nr),we.bind(document,"selectstart",Nr),we.bind(document,"mousedown",N,!0),we.bind(document,"mouseup",N,!0)),we.bind(document,"keyup",p),e.on("element.hover",h),e.on("element.out",m)),s("init")===!1)return g(),!1;T.autoActivate&&u(x,!0)}e.on("diagram.destroy",g),this.init=E,this.move=u,this.hover=h,this.out=m,this.end=l,this.cancel=g,this.context=function(){return o},this.setOptions=function(x){D(r,x)}}qg.$inject=["eventBus","canvas","selection","elementRegistry"];const ki={__depends__:[HC,Gn],dragging:["type",qg]};function xo(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}xo.prototype.next=function(){return this._prefix+ ++this._counter};const aP=new xo("ps");var sP=["marker-start","marker-mid","marker-end"],cP=["circle","ellipse","line","path","polygon","polyline","path","rect"];function or(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}or.$inject=["elementRegistry","eventBus","canvas","styles"],or.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")},or.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},or.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var r=ah(n);return this._cloneMarkers(kr(r),i),re(r,this._styles.cls(i,[])),Se(t,r),re(r,"data-preview-support-element-id",e.id),r},or.prototype.addFrame=function(e,t){var n=pe("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return Se(t,n),re(n,"data-preview-support-element-id",e.id),n},or.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(r=>{i._cloneMarkers(r,t,n)}),fP(e)&&sP.forEach(function(r){if(re(e,r)){var o=uP(e,r,i._canvas.getContainer());o&&i._cloneMarker(n,e,o,r,t)}})},or.prototype._cloneMarker=function(e,t,n,i,r="djs-dragger"){var o=[n.id,r,aP.next()].join("-"),a=et("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||ah(n);s.id=o,$e(s).add(r);var c=et(":scope > defs",e);c||(c=pe("defs"),Se(e,c)),Se(c,s);var u=pP(s.id);re(t,i,u)};function uP(e,t,n){var i=lP(re(e,t));return et("marker#"+i,n||document)}function lP(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function pP(e){return"url(#"+e+")"}function fP(e){return cP.indexOf(e.nodeName)!==-1}const Eo={__init__:["previewSupport"],previewSupport:["type",or]};var dP="drop-ok",Yg="drop-not-ok",Kg="attach-ok",Xg="new-parent",Zg="create",hP=2e3;function Qg(e,t,n,i,r){function o(c,u,l,p,f){if(!u)return!1;c=Oe(c,function(E){var x=E.labelTarget;return!E.parent&&!(ke(E)&&c.indexOf(x)!==-1)});var d=at(c,function(E){return!it(E)}),h=!1,m=!1,g=!1;ey(c)&&(h=r.allowed("shape.attach",{position:l,shape:d,target:u})),h||(ey(c)?g=r.allowed("shape.create",{position:l,shape:d,source:p,target:u}):g=r.allowed("elements.create",{elements:c,position:l,target:u}));var R=f.connectionTarget;return g||h?(d&&p&&(m=r.allowed("connection.create",{source:R===p?d:p,target:R===p?p:d,hints:{targetParent:u,targetAttach:h}})),{attach:h,connect:m}):g===null||h===null?null:!1}function a(c,u){[Kg,dP,Yg,Xg].forEach(function(l){l===u?e.addMarker(c,l):e.removeMarker(c,l)})}n.on(["create.move","create.hover"],function(c){var u=c.context,l=u.elements,p=c.hover,f=u.source,d=u.hints||{};if(!p){u.canExecute=!1,u.target=null;return}Jg(c);var h={x:c.x,y:c.y},m=u.canExecute=p&&o(l,p,h,f,d);p&&m!==null&&(u.target=p,m&&m.attach?a(p,Kg):a(p,m?Xg:Yg))}),n.on(["create.end","create.out","create.cleanup"],function(c){var u=c.hover;u&&a(u,null)}),n.on("create.end",function(c){var u=c.context,l=u.source,p=u.shape,f=u.elements,d=u.target,h=u.canExecute,m=h&&h.attach,g=h&&h.connect,R=u.hints||{};if(h===!1||!d)return!1;Jg(c);var E={x:c.x,y:c.y};g?p=i.appendShape(l,p,E,d,{attach:m,connection:g===!0?{}:g,connectionTarget:R.connectionTarget}):(f=i.createElements(f,E,d,D({},R,{attach:m})),p=at(f,function(x){return!it(x)})),D(u,{elements:f,shape:p}),D(c,{elements:f,shape:p})});function s(){var c=t.context();c&&c.prefix===Zg&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],hP,function(){n.off("elements.changed",s)})}),this.start=function(c,u,l){ge(u)||(u=[u]);var p=at(u,function(h){return!it(h)});if(p){l=D({elements:u,hints:{},shape:p},l||{}),M(u,function(h){xe(h.x)||(h.x=0),xe(h.y)||(h.y=0)});var f=Oe(u,function(h){return!h.hidden}),d=Rt(f);M(u,function(h){it(h)&&(h.waypoints=nn(h.waypoints,function(m){return{x:m.x-d.x-d.width/2,y:m.y-d.y-d.height/2}})),D(h,{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2})}),t.init(c,Zg,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:u,context:l}})}}}Qg.$inject=["canvas","dragging","eventBus","modeling","rules"];function Jg(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 ey(e){return e&&e.length===1&&!it(e[0])}var mP=750;function ty(e,t,n,i,r){function o(a){var s=pe("g");re(s,r.cls("djs-drag-group",["no-events"]));var c=pe("g");return a.forEach(function(u){var l;u.hidden||(u.waypoints?(l=n._createContainer("connection",c),n.drawConnection(kr(l),u)):(l=n._createContainer("shape",c),n.drawShape(kr(l),u),Zt(l,u.x,u.y)),i.addDragger(u,s,l))}),s}t.on("create.move",mP,function(a){var s=a.hover,c=a.context,u=c.elements,l=c.dragGroup;l||(l=c.dragGroup=o(u));var p;s?(l.parentNode||(p=e.getActiveLayer(),Se(p,l)),Zt(l,a.x,a.y)):It(l)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&It(c)})}ty.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const ac={__depends__:[ki,Eo,gi,Gn],__init__:["create","createPreview"],create:["type",Qg],createPreview:["type",ty]};function mp(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)})}mp.$inject=["eventBus"],mp.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||gP(0,0)};function gP(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 da={__init__:["mouse"],mouse:["type",mp]};var ny=2e3;function Cn(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 u=c.descriptor,l=c.element,p=c.elementsSet;u.priority=1,u.id=l.id,p.has(l.parent)&&(u.parent=l.parent.id),yP(l)&&(u.priority=2,u.host=l.host.id),it(l)&&(u.priority=3,u.source=l.source.id,u.target=l.target.id,u.waypoints=vP(l)),ke(l)&&(u.priority=4,u.labelTarget=l.labelTarget.id),M(["x","y","width","height"],function(f){xe(l[f])&&(u[f]=l[f])}),u.hidden=l.hidden,u.collapsed=l.collapsed}),r.on("copyPaste.elementsCopied",ny,function(c){var u;((u=c.hints)==null?void 0:u.clip)!==!1&&n.set(c.tree)}),r.on("copyPaste.pasteElements",ny,function(c){c.tree||(c.tree=n.get())}),r.on("copyPaste.pasteElements",function(c){var u=c.hints;D(u,{createElementsBehavior:!1})})}Cn.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],Cn.prototype.copy=function(e,t={}){var n,i;return ge(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(ge(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},Cn.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})}}},Cn.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},Cn.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},Cn.prototype._getElementIdsFromTree=function(e){var t={};return M(e,function(n){M(n,function(i){i.id&&(t[i.id]=!0)})}),t},Cn.prototype._paste=function(e,t,n,i){M(e,function(o){xe(o.x)||(o.x=0),xe(o.y)||(o.y=0)});var r=Rt(e);return M(e,function(o){it(o)&&(o.waypoints=nn(o.waypoints,function(a){return{x:a.x-r.x-r.width/2,y:a.y-r.y-r.height/2}})),D(o,{x:o.x-r.x-r.width/2,y:o.y-r.y-r.height/2})}),this._modeling.createElements(e,n,t,D({},i))},Cn.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return M(e,function(o,a){o=ri(o,"priority"),M(o,function(s){var c=D({},oi(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var u;if(it(c)){c.source=i[s.source],c.target=i[s.target],u=i[s.id]=t.createConnection(c),r.push(u);return}if(ke(c)){c.labelTarget=i[c.labelTarget],u=i[s.id]=t.createLabel(c),r.push(u);return}c.host&&(c.host=i[c.host]),u=i[s.id]=t.createShape(c),r.push(u)})}),r},Cn.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(oi(e,["id"]));return t},Cn.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(oi(e,["id"]));return t},Cn.prototype.createShape=function(e){var t=this._elementFactory.createShape(oi(e,["id"]));return t},Cn.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(it(e)&&(!n.has(e.source)||!n.has(e.target))||ke(e)&&!n.has(e.labelTarget))},Cn.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[],o=new Map,a=vs(e);function s(p,f){return t.allowed("element.copy",{element:p,elements:f})}function c(p,f){var d=o.get(p);if(!d){var h={element:p,depth:f};r.push(h),o.set(p,h);return}if(d.depth<f){r=u(d,r);var m={element:d.element,depth:f};r.push(m),o.set(p,m)}}function u(p,f){var d=f.indexOf(p);return d!==-1&&f.splice(d,1),f}Mr(a,function(p,f,d){if(ke(p))return;M(p.labels,function(g){c(g,d)});function h(g){g&&g.length&&M(g,function(R){M(R.labels,function(E){c(E,d)}),c(R,d)})}M([p.attachers,p.incoming,p.outgoing],h),c(p,d);var m=[];return p.children&&(m=p.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:p,children:m}),m}),e=nn(r,function(p){return p.element});var l=new Set(e);return r=nn(r,function(p){return p.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:p.descriptor,element:p.element,elements:e,elementsSet:l}),p}),r=ri(r,function(p){return p.descriptor.priority}),e=nn(r,function(p){return p.element}),M(r,function(p){var f=p.depth;if(!n.hasRelations(p.element,e,l)){ry(p.element,e),l.delete(p.element);return}if(!s(p.element,e)){ry(p.element,e),l.delete(p.element);return}i[f]||(i[f]=[]),i[f].push(p.descriptor)}),i};function yP(e){return!!e.host}function vP(e){return nn(e.waypoints,function(t){return t=iy(t),t.original&&(t.original=iy(t.original)),t})}function iy(e){return D({},e)}function ry(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const _P={__depends__:[jC,ac,da,gi],__init__:["copyPaste"],copyPaste:["type",Cn]};function gp(e,t,n){ge(n)||(n=[n]),M(n,function(i){xr(e[i])||(t[i]=e[i])})}var yp=750;function oy(e,t,n){function i(c,u){var l=e.create(c.$type);return n.copyElement(c,l,null,u)}t.on("copyPaste.copyElement",yp,function(c){var u=c.descriptor,l=c.element,p=K(l);if(ke(l))return u;var f=u.businessObject=i(p,!0),d=u.di=i(Ve(l),!0);d.bpmnElement=f,gp(f,u,"name"),gp(d,u,"isExpanded"),p.default&&(u.default=p.default.id)});var r="-bpmn-js-refs";function o(c){return c[r]=c[r]||{}}function a(c,u){c[r]=u}function s(c,u,l){var p=K(c);return c.default&&(l[c.default]={element:p,property:"default"}),c.host&&(K(c).attachedToRef=K(u[c.host])),oi(l,bn(l,function(f,d,h){var m=d.element,g=d.property;return h===c.id&&(m.set(g,p),f.push(c.id)),f},[]))}t.on("copyPaste.pasteElement",function(c){var u=c.cache,l=c.descriptor,p=l.businessObject,f=l.di;if(ke(l)){l.businessObject=K(u[l.labelTarget]),l.di=Ve(u[l.labelTarget]);return}p=l.businessObject=i(p),f=l.di=i(f),f.bpmnElement=p,gp(l,p,["isExpanded","name"]),l.type=p.$type}),t.on("copyPaste.copyElement",yp,function(c){var u=c.descriptor,l=c.element;if(v(l,"bpmn:Participant")){var p=K(l);p.processRef&&(u.processRef=i(p.processRef,!0))}}),t.on("copyPaste.pasteElement",function(c){var u=c.descriptor,l=u.processRef;l&&(u.processRef=i(l))}),t.on("copyPaste.createTree",function(c){var u=c.element,l=c.children;v(u,"bpmn:SubProcess")&&M(ea(l),p=>{l.push(p.annotation)})}),t.on("copyPaste.pasteElement",yp,function(c){var u=c.cache,l=c.descriptor;a(u,s(l,u,o(u)))})}oy.$inject=["bpmnFactory","eventBus","moddleCopy"];const bP=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],xP=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function ha(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 ri(r,o=>o==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:r,property:o,propertyName:a}=i,s=Ht(r)&&r.$descriptor;if(a&&xP.includes(a))return o;if(a&&bP.includes(a)||a&&s&&!at(s.properties,Zr({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",i=>{const{property:r}=i;if(v(r,"bpmn:ExtensionElements")&&(!r.values||!r.values.length))return!1})}ha.$inject=["eventBus","bpmnFactory","moddle"],ha.prototype.copyElement=function(e,t,n,i=!1){n&&!ge(n)&&(n=[n]),n=n||vp(e.$descriptor);const r=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return r===!1||(ge(r)&&(n=r),M(n,o=>{let a;_n(e,o)&&(a=e.get(o));const s=this.copyProperty(a,t,o,i);!Ot(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:o})===!1||t.set(o,s)})),t},ha.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 Ht(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):ge(e)?bn(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):Ht(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},ha.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 vp(e,t){return bn(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const ay={__depends__:[_P],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",oy],moddleCopy:["type",ha]};var sy=Math.round;function _p(e,t){this._modeling=e,this._eventBus=t}_p.$inject=["modeling","eventBus"],_p.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,u=sy(s+o/2),l=sy(c+a/2),p=i.replaceShape(e,D({},t,{x:u,y:l,width:o,height:a}),n);return r.fire("replace.end",{element:e,newElement:p,hints:n}),p};function cy(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:r={}}=n;r.select!==!1&&e.select(i)})}cy.$inject=["selection","eventBus"];const EP={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",cy],replace:["type",_p]};function wP(e,t,n){ge(n)||(n=[n]),M(n,function(i){xr(e[i])||(t[i]=e[i])})}var SP=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function RP(e,t){var n=e&&_n(e,"collapsed")?e.collapsed:!Be(e),i;return t&&(_n(t,"collapsed")||_n(t,"isExpanded"))?i=_n(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function uy(e,t,n,i,r,o){function a(s,c,u){u=u||{};var l=c.type,p=s.businessObject;if(sc(p)&&(l==="bpmn:SubProcess"||l==="bpmn:AdHocSubProcess")&&RP(s,c))return i.toggleCollapse(s),s;var f=e.create(l),d={type:l,businessObject:f};d.di={},l==="bpmn:ExclusiveGateway"&&(d.di.isMarkerVisible=!0),wP(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var h=vp(p.$descriptor),m=vp(f.$descriptor,!0),g=CP(h,m);D(f,Jn(c,SP));var R=Oe(g,function(b){return b==="eventDefinitions"?ly(s,c.eventDefinitionType):b==="loopCharacteristics"?!sn(f):_n(f,b)||b==="processRef"&&c.isExpanded===!1||b==="triggeredByEvent"?!1:b==="isForCompensation"?!sn(f):!0});if(f=n.copyElement(p,f,R),c.eventDefinitionType&&(ly(f,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),v(p,"bpmn:Activity")){if(sc(p))d.isExpanded=Be(s);else if(c&&_n(c,"isExpanded")){d.isExpanded=c.isExpanded;var E=t.getDefaultSize(f,{isExpanded:d.isExpanded});d.width=E.width,d.height=E.height,d.x=s.x-(d.width-s.width)/2,d.y=s.y-(d.height-s.height)/2}Be(s)&&!v(p,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(sc(p)&&!sc(f)&&(u.moveChildren=!1),v(p,"bpmn:Participant")){c.isExpanded===!0?f.processRef=e.create("bpmn:Process"):u.moveChildren=!1;var x=Gt(s);Ve(s).isHorizontal||(Ve(d).isHorizontal=x),d.width=x?s.width:t.getDefaultSize(d).width,d.height=x?t.getDefaultSize(d).height:s.height}return o.allowed("shape.resize",{shape:f})||(d.height=t.getDefaultSize(d).height,d.width=t.getDefaultSize(d).width),f.name=p.name,De(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&De(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(f.default=p.default),c.host&&!v(p,"bpmn:BoundaryEvent")&&v(f,"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,{...u,targetElement:c})}this.replaceElement=a}uy.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function sc(e){return v(e,"bpmn:SubProcess")}function ly(e,t){var n=K(e);return t&&n.get("eventDefinitions").some(function(i){return v(i,t)})}function CP(e,t){return e.filter(function(n){return t.includes(n)})}const py={__depends__:[ay,EP,Gn],bpmnReplace:["type",uy]};var PP=250;function Br(e){this._eventBus=e,this._tools=[],this._active=null}Br.$inject=["eventBus"],Br.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)},Br.prototype.isActive=function(e){return e&&this._active===e},Br.prototype.length=function(e){return this._tools.length},Br.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Br.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),M(t,function(r){i.push(r+".ended"),i.push(r+".canceled")}),n.on(i,PP,function(r){this._active&&(AP(r)||this.setActive(null))},this)};function AP(e){var t=e.originalEvent&&e.originalEvent.target;return t&&Ar(t,'.group[data-group="tools"]')}const cc={__depends__:[ki],__init__:["toolManager"],toolManager:["type",Br]};function TP(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 MP(e,t){var n=[],i=new Set(e);M(t,function(o){i.add(o)});var r=new Set;return i.forEach(function(o){var a=o.incoming,s=o.outgoing;M(a.concat(s),function(c){var u=c.source,l=c.target;(i.has(u)||i.has(l))&&(r.has(c)||(r.add(c),n.push(c)))})}),n}function kP(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 bp=Math.abs,DP=Math.round,Di={x:"width",y:"height"},fy="crosshair",ar={n:"top",w:"left",s:"bottom",e:"right"},OP=1500,uc={n:"s",w:"e",s:"n",e:"w"},lc=20;function Wn(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",OP,function(c){var u=c.context,l=u.initialized;l||(l=u.initialized=s.init(c,u)),l&&hy(c)}),n.on("spaceTool.end",function(c){var u=c.context,l=u.axis,p=u.direction,f=u.movingShapes,d=u.resizingShapes,h=u.start;if(u.initialized){hy(c);var m={x:0,y:0};m[l]=DP(c["d"+l]),s.makeSpace(f,d,m,p,h),n.once("spaceTool.ended",function(g){s.activateSelection(g.originalEvent,!0,!0)})}})}Wn.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Wn.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:fy,data:{context:{reactivate:n}},trapClick:!1})},Wn.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:fy,data:{context:{}}})},Wn.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},Wn.prototype.init=function(e,t){var n=bp(e.dx)>bp(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(bp(i)<5)return!1;i<0&&(i*=-1),la(e)&&(i*=-1);var o=TP(n,i),a=this._canvas.getRootElement();!Zs(e)&&e.hover&&(a=e.hover);var s=[...Yo(a),...a.attachers||[]],c=this.calculateAdjustments(s,n,i,r),u=this._eventBus.fire("spaceTool.getMinDimensions",{axis:n,direction:o,shapes:c.resizingShapes,start:r}),l=LP(c,n,o,r,u);return D(t,c,{axis:n,direction:o,spaceToolConstraints:l,start:r}),oc("resize-"+(n==="x"?"ew":"ns")),!0},Wn.prototype.calculateAdjustments=function(e,t,n,i){var r=this._rules,o=[],a=[],s=new Set,c=new Set,u=[],l=[];function p(d){s.has(d)||(s.add(d),o.push(d));var h=d.label;h&&!s.has(h)&&(s.add(h),o.push(h))}function f(d){c.has(d)||(c.add(d),a.push(d))}return M(e,function(d){if(!(!d.parent||ke(d))){if(it(d)){l.push(d);return}var h=d[t],m=h+d[Di[t]];if(IP(d)&&(n>0&&ye(d)[t]>i||n<0&&ye(d)[t]<i)){u.push(d);return}if(n>0&&h>i||n<0&&m<i){p(d);return}if(h<i&&m>i&&r.allowed("shape.resize",{shape:d})){f(d);return}}}),M(o,function(d){var h=d.attachers;h&&M(h,function(m){p(m)})}),M(u,function(d){var h=d.host;(s.has(h)||c.has(h))&&p(d)}),M(l,function(d){var h=d.source,m=d.target,g=d.label;(s.has(h)||c.has(h))&&(s.has(m)||c.has(m))&&g&&p(g)}),{movingShapes:o,resizingShapes:a}},Wn.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Wn.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function dy(e){return{top:e.top-lc,right:e.right+lc,bottom:e.bottom+lc,left:e.left-lc}}function hy(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,r;xe(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),xe(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),xe(n.top)&&(r=Math.max(e.y,n.top),e.dy=e.dy+r-e.y,e.y=r),xe(n.bottom)&&(r=Math.min(e.y,n.bottom),e.dy=e.dy+r-e.y,e.y=r)}}function LP(e,t,n,i,r){var o=e.movingShapes,a=e.resizingShapes;if(a.length){var s={},c,u,l=new Set(o),p=new Set(a);return M(a,function(f){var d=f.attachers,h=f.children,m=me(f),g=Oe(h,function(z){return!it(z)&&!ke(z)&&!l.has(z)&&!p.has(z)}),R=Oe(h,function(z){return!it(z)&&!ke(z)&&l.has(z)}),E,x,b,w=[],T=[],L,A,F,H;g.length&&(x=dy(me(Rt(g))),E=i-m[ar[n]]+x[ar[n]],n==="n"?s.bottom=u=xe(u)?Math.min(u,E):E:n==="w"?s.right=u=xe(u)?Math.min(u,E):E:n==="s"?s.top=c=xe(c)?Math.max(c,E):E:n==="e"&&(s.left=c=xe(c)?Math.max(c,E):E)),R.length&&(b=dy(me(Rt(R))),E=i-b[ar[uc[n]]]+m[ar[uc[n]]],n==="n"?s.bottom=u=xe(u)?Math.min(u,E):E:n==="w"?s.right=u=xe(u)?Math.min(u,E):E:n==="s"?s.top=c=xe(c)?Math.max(c,E):E:n==="e"&&(s.left=c=xe(c)?Math.max(c,E):E)),d&&d.length&&(d.forEach(function(z){l.has(z)?w.push(z):T.push(z)}),w.length&&(L=me(Rt(w.map(ye))),A=m[ar[uc[n]]]-(L[ar[uc[n]]]-i)),T.length&&(F=me(Rt(T.map(ye))),H=F[ar[n]]-(m[ar[n]]-i)),n==="n"?(E=Math.min(A||1/0,H||1/0),s.bottom=u=xe(u)?Math.min(u,E):E):n==="w"?(E=Math.min(A||1/0,H||1/0),s.right=u=xe(u)?Math.min(u,E):E):n==="s"?(E=Math.max(A||-1/0,H||-1/0),s.top=c=xe(c)?Math.max(c,E):E):n==="e"&&(E=Math.max(A||-1/0,H||-1/0),s.left=c=xe(c)?Math.max(c,E):E));var N=r&&r[f.id];N&&(n==="n"?(E=i+f[Di[t]]-N[Di[t]],s.bottom=u=xe(u)?Math.min(u,E):E):n==="w"?(E=i+f[Di[t]]-N[Di[t]],s.right=u=xe(u)?Math.min(u,E):E):n==="s"?(E=i-f[Di[t]]+N[Di[t]],s.top=c=xe(c)?Math.max(c,E):E):n==="e"&&(E=i-f[Di[t]]+N[Di[t]],s.left=c=xe(c)?Math.max(c,E):E))}),s}}function IP(e){return!!e.host}var xp="djs-dragging",my="djs-resizing",NP=250,pc=Math.max;function gy(e,t,n,i,r){function o(a,s){M(a,function(c){r.addDragger(c,s),n.addMarker(c,xp)})}e.on("spaceTool.selection.start",function(a){var s=n.getLayer("space"),c=a.context,u={x:"M 0,-10000 L 0,10000",y:"M -10000,0 L 10000,0"},l=pe("g");re(l,i.cls("djs-crosshair-group",["no-events"])),Se(s,l);var p=pe("path");re(p,"d",u.x),$e(p).add("djs-crosshair"),Se(l,p);var f=pe("path");re(f,"d",u.y),$e(f).add("djs-crosshair"),Se(l,f),c.crosshairGroup=l}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;Zt(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&It(c)}),e.on("spaceTool.move",NP,function(a){var s=a.context,c=s.line,u=s.axis,l=s.movingShapes,p=s.resizingShapes;if(s.initialized){if(!s.dragGroup){var f=n.getLayer("space");c=pe("path"),re(c,"d","M0,0 L0,0"),$e(c).add("djs-crosshair"),Se(f,c),s.line=c;var d=pe("g");re(d,i.cls("djs-drag-group",["no-events"])),Se(n.getActiveLayer(),d),o(l,d);var h=new Set(l);M(p,function(T){h.add(T)});var m=new Set,g=s.movingConnections=[];h.forEach(function(T){M(T.outgoing,function(L){m.has(L)||!it(L)||!h.has(L.target)||(m.add(L),g.push(L))})}),o(g,d),s.dragGroup=d}if(!s.frameGroup){var R=pe("g");re(R,i.cls("djs-frame-group",["no-events"])),Se(n.getActiveLayer(),R);var E=[];M(p,function(T){var L=r.addFrame(T,R),A=L.getBBox();E.push({element:L,initialBounds:A}),n.addMarker(T,my)}),s.frameGroup=R,s.frames=E}var x={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};re(c,{d:x[u]});var b={x:"y",y:"x"},w={x:a.dx,y:a.dy};w[b[s.axis]]=0,Zt(s.dragGroup,w.x,w.y),M(s.frames,function(T){var L=T.element,A=T.initialBounds,F,H;s.direction==="e"?re(L,{width:pc(A.width+w.x,5)}):(F=pc(A.width-w.x,5),re(L,{width:F,x:A.x+A.width-F})),s.direction==="s"?re(L,{height:pc(A.height+w.y,5)}):(H=pc(A.height-w.y,5),re(L,{height:H,y:A.y+A.height-H}))})}}),e.on("spaceTool.cleanup",function(a){var s=a.context,c=s.movingShapes,u=s.movingConnections,l=s.resizingShapes,p=s.line,f=s.dragGroup,d=s.frameGroup;M(c,function(h){n.removeMarker(h,xp)}),M(u,function(h){n.removeMarker(h,xp)}),f&&(It(p),It(f)),M(l,function(h){n.removeMarker(h,my)}),d&&It(d)})}gy.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const BP={__init__:["spaceToolPreview"],__depends__:[ki,gi,cc,Eo,da],spaceTool:["type",Wn],spaceToolPreview:["type",gy]};function fc(e,t){e.invoke(Wn,this),this._canvas=t}fc.$inject=["injector","canvas"],ie(fc,Wn),fc.prototype.calculateAdjustments=function(e,t,n,i){var r=this._canvas.getRootElement(),o=e[0]===r?null:e[0],a=[];o&&(a=Kr(io(r.children.filter(u=>v(u,"bpmn:Artifact")),Rt(o))));const s=[...e,...a];var c=Wn.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(u){return!(v(u,"bpmn:TextAnnotation")||$P(u)&&(t==="y"&&Gt(u)||t==="x"&&!Gt(u)))}),c};function $P(e){return v(e,"bpmn:Participant")&&!K(e).processRef}const yy={__depends__:[BP],spaceTool:["type",fc]};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:zf("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=ge(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 jP={commandStack:["type",mt]};function sr(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 FP=250,vy=1400;function Ep(e,t,n){Y.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",vy,function(r){var o=r.context,a=o.shapes,s=o.validatedShapes;o.shapes=_y(a),o.validatedShapes=_y(s)}),i&&t.on("shape.move.start",FP,function(r){var o=r.context,a=new Set(o.shapes),s=new Set;for(const c of a)for(const u of c.labels)!u.hidden&&!a.has(u)&&s.add(u),c.labelTarget&&s.add(c);for(const c of s)i.makeDraggable(o,c,!0)}),this.preExecuted("elements.move",vy,function(r){var o=r.context,a=o.closure,s=a.enclosedElements,c=[];M(s,function(u){M(u.labels,function(l){s[l.id]||c.push(l)})}),a.addAll(c)}),this.preExecute(["connection.delete","shape.delete"],function(r){var o=r.context,a=o.connection||o.shape;sr(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=tl(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&&(Et(s.labels,a,c),a.labelTarget=s)})}ie(Ep,Y),Ep.$inject=["injector","eventBus","modeling"];function _y(e){var t=new Set(e);return Oe(e,function(n){return!t.has(n.labelTarget)})}const HP={__init__:["labelSupport"],labelSupport:["type",Ep]};var zP=251,by=1401,xy="attach-ok";function wp(e,t,n,i,r){Y.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",by,function(a){var s=a.context,c=s.shapes,u=s.validatedShapes;s.shapes=VP(c),s.validatedShapes=GP(u)}),o&&t.on("shape.move.start",zP,function(a){var s=a.context,c=s.shapes,u=Sp(c);M(u,function(l){o.makeDraggable(s,l,!0),M(l.labels,function(p){o.makeDraggable(s,p,!0)})})}),o&&t.on("shape.move.start",function(a){var s=a.context,c=s.shapes;if(c.length===1){var u=c[0],l=u.host;l&&(n.addMarker(l,xy),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(l,xy)}))}}),this.preExecuted("elements.move",by,function(a){var s=a.context,c=s.closure,u=s.shapes,l=Sp(u);M(l,function(p){c.add(p,c.topLevel[p.host.id])})}),this.postExecuted("elements.move",function(a){var s=a.context,c=s.shapes,u=s.newHost,l;u&&c.length!==1||(u?l=c:l=Oe(c,function(p){var f=p.host;return WP(p)&&!UP(c,f)}),M(l,function(p){r.updateAttachment(p,u)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;M(s,function(c){M(c.attachers,function(u){M(u.outgoing.slice(),function(l){var p=i.allowed("connection.reconnect",{connection:l,source:l.source,target:l.target});p||r.removeConnection(l)}),M(u.incoming.slice(),function(l){var p=i.allowed("connection.reconnect",{connection:l,source:l.source,target:l.target});p||r.removeConnection(l)})})})}),this.postExecute("shape.create",function(a){var s=a.context,c=s.shape,u=s.host;u&&r.updateAttachment(c,u)}),this.postExecute("shape.replace",function(a){var s=a.context,c=s.oldShape,u=s.newShape;sr(c.attachers,function(l){var p=i.allowed("elements.move",{target:u,shapes:[l]});p==="attach"?r.updateAttachment(l,u):r.removeShape(l)}),u.attachers.length&&M(u.attachers,function(l){var p=jm(l,c,u);r.moveShape(l,p,l.parent)})}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.oldBounds,l=s.newBounds,p=c.attachers,f=s.hints||{};f.attachSupport!==!1&&M(p,function(d){var h=jm(d,u,l);r.moveShape(d,h,d.parent),M(d.labels,function(m){r.moveShape(m,h,m.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;sr(s.attachers,function(c){r.removeShape(c)}),s.host&&r.updateAttachment(s,null)})}ie(wp,Y),wp.$inject=["injector","eventBus","canvas","rules","modeling"];function Sp(e){return bu(nn(e,function(t){return t.attachers||[]}))}function VP(e){var t=Sp(e);return Nx("id",e,t)}function GP(e){var t=Xr(e,"id");return Oe(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function WP(e){return!!e.host}function UP(e,t){return e.indexOf(t)!==-1}const qP={__depends__:[gi],__init__:["attachSupport"],attachSupport:["type",wp]};function Ey(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(hh(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)})}Ey.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const Rp={__init__:["changeSupport"],changeSupport:["type",Ey]};function Un(e){this._model=e}Un.$inject=["moddle"],Un.prototype._needsId=function(e){return De(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"])},Un.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;v(e,"bpmn:Activity")?t="Activity":v(e,"bpmn:Event")?t="Event":v(e,"bpmn:Gateway")?t="Gateway":De(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))},Un.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},Un.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},Un.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",D({bpmnElement:e,bounds:this.createDiBounds()},t))},Un.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},Un.prototype.createDiWaypoints=function(e){var t=this;return nn(e,function(n){return t.createDiWaypoint(n)})},Un.prototype.createDiWaypoint=function(e){return this.create("dc:Point",Jn(e,["x","y"]))},Un.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",D({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},Un.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",D({bpmnElement:e},t))};function Pn(e,t,n){Y.call(this,e),this._bpmnFactory=t;var i=this;function r(d){var h=d.context,m=h.hints||{},g;!h.cropped&&m.createElementsBehavior!==!1&&(g=h.connection,g.waypoints=n.getCroppedWaypoints(g),h.cropped=!0)}this.executed(["connection.layout","connection.create"],r),this.reverted(["connection.layout"],function(d){delete d.context.cropped});function o(d){var h=d.context;i.updateParent(h.shape||h.connection,h.oldParent)}function a(d){var h=d.context,m=h.shape||h.connection,g=h.parent||h.newParent;i.updateParent(m,g)}this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],An(o)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],An(a));function s(d){var h=d.context,m=h.oldRoot,g=m.children;M(g,function(R){v(R,"bpmn:BaseElement")&&i.updateParent(R)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(d){var h=d.context.shape;v(h,"bpmn:BaseElement")&&i.updateBounds(h)}this.executed(["shape.move","shape.create","shape.resize"],An(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],An(function(d){d.context.shape.type!=="label"&&c(d)})),e.on("shape.changed",function(d){d.element.type==="label"&&c({context:{shape:d.element}})});function u(d){i.updateConnection(d.context)}this.executed(["connection.create","connection.move","connection.delete","connection.reconnect"],An(u)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],An(u));function l(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],An(l)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],An(l)),this.executed("connection.reconnect",An(function(d){var h=d.context,m=h.connection,g=h.oldSource,R=h.newSource,E=K(m),x=K(g),b=K(R);E.conditionExpression&&!De(b,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(h.oldConditionExpression=E.conditionExpression,delete E.conditionExpression),g!==R&&x.default===E&&(h.oldDefault=x.default,delete x.default)})),this.reverted("connection.reconnect",An(function(d){var h=d.context,m=h.connection,g=h.oldSource,R=h.newSource,E=K(m),x=K(g),b=K(R);h.oldConditionExpression&&(E.conditionExpression=h.oldConditionExpression),h.oldDefault&&(x.default=h.oldDefault,delete b.default)}));function p(d){i.updateAttachment(d.context)}this.executed(["element.updateAttachment"],An(p)),this.reverted(["element.updateAttachment"],An(p)),this.executed("element.updateLabel",An(f)),this.reverted("element.updateLabel",An(f));function f(d){const{element:h}=d.context,m=In(h),g=Ve(h),R=g&&g.get("label");er(h)||Qs(h)||(m&&!R?g.set("label",t.create("bpmndi:BPMNLabel")):!m&&R&&g.set("label",void 0))}}ie(Pn,Y),Pn.$inject=["eventBus","bpmnFactory","connectionDocking"],Pn.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},Pn.prototype.updateParent=function(e,t){if(!ke(e)&&!(v(e,"bpmn:DataStoreReference")&&e.parent&&v(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=Ve(e),o=n&&n.businessObject,a=Ve(n);v(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,o,t&&t.businessObject),v(e,"bpmn:DataOutputAssociation")&&(e.source?o=e.source.businessObject:o=null),v(e,"bpmn:DataInputAssociation")&&(e.target?o=e.target.businessObject:o=null),this.updateSemanticParent(i,o),v(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,o),this.updateDiParent(r,a)}},Pn.prototype.updateBounds=function(e){var t=Ve(e),n=KP(e);if(n){var i=ei(n,t.get("bounds"));D(n,{x:e.x+i.x,y:e.y+i.y})}var r=ke(e)?this._getLabel(t):t,o=r.bounds;o||(o=this._bpmnFactory.createDiBounds(),r.set("bounds",o)),D(o,{x:e.x,y:e.y,width:e.width,height:e.height})},Pn.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,r;v(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),_t(i,e)),v(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),Et(r,e))}},Pn.prototype.updateDiConnection=function(e,t,n){var i=Ve(e),r=Ve(t),o=Ve(n);i.sourceElement&&i.sourceElement.bpmnElement!==K(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==K(n)&&(i.targetElement=n&&o)},Pn.prototype.updateDiParent=function(e,t){if(t&&!v(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(_t(n,e),e.$parent=null)}};function YP(e){for(;e&&!v(e,"bpmn:Definitions");)e=e.$parent;return e}Pn.prototype.getLaneSet=function(e){var t,n;return v(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(v(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)},Pn.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&!((v(e,"bpmn:DataInput")||v(e,"bpmn:DataOutput"))&&(v(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(v(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(v(e,"bpmn:FlowElement")){if(t){if(v(t,"bpmn:Participant"))t=t.processRef;else if(v(t,"bpmn:Lane"))do t=t.$parent.$parent;while(v(t,"bpmn:Lane"))}i="flowElements"}else if(v(e,"bpmn:Artifact")){for(;t&&!v(t,"bpmn:Process")&&!v(t,"bpmn:SubProcess")&&!v(t,"bpmn:Collaboration");)if(v(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;i="artifacts"}else if(v(e,"bpmn:MessageFlow"))i="messageFlows";else if(v(e,"bpmn:Participant")){i="participants";var r=e.processRef,o;r&&(o=YP(e.$parent||t),e.$parent&&(_t(o.get("rootElements"),r),r.$parent=null),t&&(Et(o.get("rootElements"),r),r.$parent=o))}else v(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":v(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),_t(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);_t(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},Pn.prototype.updateConnectionWaypoints=function(e){var t=Ve(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},Pn.prototype.updateConnection=function(e){var t=e.connection,n=K(t),i=t.source,r=K(i),o=t.target,a=K(t.target),s;if(v(n,"bpmn:DataAssociation"))v(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=r,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):v(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||r,this.updateSemanticParent(n,r,s),n.targetRef=a);else{var c=v(n,"bpmn:SequenceFlow");n.sourceRef!==r&&(c&&(_t(n.sourceRef&&n.sourceRef.get("outgoing"),n),r&&r.get("outgoing")&&r.get("outgoing").push(n)),n.sourceRef=r),n.targetRef!==a&&(c&&(_t(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)},Pn.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function An(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;v(i,"bpmn:BaseElement")&&e(t)}}function KP(e){if(v(e,"bpmn:Activity")){var t=Ve(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function cr(e,t){Pi.call(this),this._bpmnFactory=e,this._moddle=t}ie(cr,Pi),cr.$inject=["bpmnFactory","moddle"],cr.prototype._baseCreate=Pi.prototype.create,cr.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,D({type:"label",di:n},Dr,t))}return this.createElement(e,t)},cr.prototype.createElement=function(e,t){t=D({},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(!ZP(r)){var o=D({},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)}v(i,"bpmn:Group")&&(t=D({isFrame:!0},t)),t=XP(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=Cp(r,t,"isExpanded")),De(i,["bpmn:Lane","bpmn:Participant"])&&(t=Cp(r,t,"isHorizontal")),v(i,"bpmn:SubProcess")&&(t.collapsed=!Be(i,r)),v(i,"bpmn:ExclusiveGateway")&&(_n(r,"isMarkerVisible")?r.isMarkerVisible===void 0&&(r.isMarkerVisible=!1):r.isMarkerVisible=!0),Ot(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),Ot(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=D({id:i.id},n,t,{businessObject:i,di:r}),this._baseCreate(e,t)},cr.prototype.getDefaultSize=function(e,t){var n=K(e);if(t=t||Ve(e),v(n,"bpmn:SubProcess"))return Be(n,t)?{width:350,height:200}:{width:100,height:80};if(v(n,"bpmn:Task"))return{width:100,height:80};if(v(n,"bpmn:Gateway"))return{width:50,height:50};if(v(n,"bpmn:Event"))return{width:36,height:36};if(v(n,"bpmn:Participant")){var i=t.isHorizontal===void 0||t.isHorizontal===!0;return Be(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return v(n,"bpmn:Lane")?{width:400,height:100}:v(n,"bpmn:DataObjectReference")?{width:36,height:50}:v(n,"bpmn:DataStoreReference")?{width:50,height:50}:v(n,"bpmn:TextAnnotation")?{width:100,height:40}:v(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},cr.prototype.createParticipantShape=function(e){return Ht(e)||(e={isExpanded:e}),e=D({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function XP(e,t,n){return M(n,function(i){t=Cp(e,t,i)}),t}function Cp(e,t,n){return t[n]===void 0?t:(e[n]=t[n],oi(t,[n]))}function ZP(e){return De(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function dc(e,t){this._modeling=e,this._canvas=t}dc.$inject=["modeling","canvas"],dc.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;M(n,function(r){var o={x:0,y:0};Ot(i.left)?o.x=i.left-r.x:Ot(i.right)?o.x=i.right-r.width-r.x:Ot(i.center)?o.x=i.center-Math.round(r.width/2)-r.x:Ot(i.top)?o.y=i.top-r.y:Ot(i.bottom)?o.y=i.bottom-r.height-r.y:Ot(i.middle)&&(o.y=i.middle-Math.round(r.height/2)-r.y),t.moveElements([r],o,r.parent)})},dc.prototype.postExecute=function(e){};function hc(e){this._modeling=e}hc.$inject=["modeling"],hc.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},hc.prototype.postExecute=function(e){var t=e.hints||{};QP(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 QP(e,t){return Fi(e.outgoing,function(n){return n.target===t})}function mc(e,t){this._canvas=e,this._layouter=t}mc.$inject=["canvas","layouter"],mc.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},mc.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var gc=Math.round;function Pp(e){this._modeling=e}Pp.$inject=["modeling"],Pp.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,r=e.position,o=e.hints,a=this._modeling;M(t,function(p){xe(p.x)||(p.x=0),xe(p.y)||(p.y=0)});var s=Oe(t,function(p){return!p.hidden}),c=Rt(s);M(t,function(p){it(p)&&(p.waypoints=nn(p.waypoints,function(f){return{x:gc(f.x-c.x-c.width/2+r.x),y:gc(f.y-c.y-c.height/2+r.y)}})),D(p,{x:gc(p.x-c.x-c.width/2+r.x),y:gc(p.y-c.y-c.height/2+r.y)})});var u=new Set(vs(t)),l={};M(t,function(p){if(it(p)){l[p.id]=xe(i)?a.createConnection(l[p.source.id],l[p.target.id],i,p,p.parent||n,o):a.createConnection(l[p.source.id],l[p.target.id],p,p.parent||n,o);return}var f=D({},o);u.has(p)||(f.autoResize=!1),ke(p)&&(f=oi(f,["attach"])),l[p.id]=xe(i)?a.createShape(p,Jn(p,["x","y","width","height"]),p.parent||n,i,f):a.createShape(p,Jn(p,["x","y","width","height"]),p.parent||n,f)}),e.elements=Kr(l)};var wy=Math.round;function ur(e){this._canvas=e}ur.$inject=["canvas"],ur.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?D(t,n):D(t,{x:n.x-wy(t.width/2),y:n.y-wy(t.height/2)}),this._canvas.addShape(t,i,r),t},ur.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function ma(e){ur.call(this,e)}ie(ma,ur),ma.$inject=["canvas"];var JP=ur.prototype.execute;ma.prototype.execute=function(e){var t=e.shape;return tA(t),t.labelTarget=e.labelTarget,JP.call(this,e)};var eA=ur.prototype.revert;ma.prototype.revert=function(e){return e.shape.labelTarget=null,eA.call(this,e)};function tA(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function ga(e,t){this._canvas=e,this._modeling=t}ga.$inject=["canvas","modeling"],ga.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;sr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),sr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},ga.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=tl(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},ga.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,Et(n.children,t,i),this._canvas.addConnection(t,n),t};function Ap(e,t){this._modeling=e,this._elementRegistry=t}Ap.$inject=["modeling","elementRegistry"],Ap.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;M(i,function(r){n.get(r.id)&&(r.waypoints?t.removeConnection(r):t.removeShape(r))})};function ya(e,t){this._canvas=e,this._modeling=t}ya.$inject=["canvas","modeling"],ya.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;sr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),sr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),sr(n.children,function(i){it(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},ya.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=tl(i.children,n),t.removeShape(n),n},ya.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return Et(i.children,n,r),t.addShape(n,i),n};function yc(e){this._modeling=e}yc.$inject=["modeling"];var Sy={x:"y",y:"x"};yc.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(g,R){g.range.min=Math.min(R[i],g.range.min),g.range.max=Math.max(R[i]+R[r],g.range.max)}function a(g){return g[i]+g[r]/2}function s(g){return g.length-1}function c(g){return g.max-g.min}function u(g,R){var E={y:0};E[i]=g-a(R),E[i]&&(E[Sy[i]]=0,t.moveElements([R],E,R.parent))}var l=n[0],p=s(n),f=n[p],d,h,m=0;M(n,function(g,R){var E,x,b;if(g.elements.length<2){R&&R!==n.length-1&&(o(g,g.elements[0]),m+=c(g.range));return}E=ri(g.elements,i),x=E[0],R===p&&(x=E[s(E)]),b=a(x),g.range=null,M(E,function(w){if(u(b,w),g.range===null){g.range={min:w[i],max:w[i]+w[r]};return}o(g,w)}),R&&R!==n.length-1&&(m+=c(g.range))}),h=Math.abs(f.range.min-l.range.max),d=Math.round((h-m)/(n.length-1)),!(d<n.length-1)&&M(n,function(g,R){var E={},x;g===l||g===f||(x=n[R-1],g.range.max=0,M(g.elements,function(b,w){E[Sy[i]]=0,E[i]=x.range.max-b[i]+d,g.range.min!==b[i]&&(E[i]+=b[i]-g.range.min),E[i]&&t.moveElements([b],E,b.parent),g.range.max=Math.max(b[i]+b[r],w?g.range.max:0)}))})},yc.prototype.postExecute=function(e){};function vc(e,t){this._layouter=e,this._canvas=t}vc.$inject=["layouter","canvas"],vc.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return D(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},vc.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function Tp(){}Tp.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=_t(o.children,t),Et(i.children,t,r),t.parent=i,M(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},Tp.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return _t(n.children,t),Et(i.children,t,r),t.parent=i,M(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 Mp(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}Mp.prototype.add=function(e,t){return this.addAll([e],t)},Mp.prototype.addAll=function(e,t){var n=kw(e,!!t,this);return D(this,n),this};function va(e){this._modeling=e}va.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},va.prototype.moveClosure=function(e,t,n,i,r){var o=this._modeling,a=e.allShapes,s=e.allConnections,c=e.enclosedConnections,u=e.topLevel,l=!1;r&&r.parent===n&&(l=!0),M(a,function(p){o.moveShape(p,t,u[p.id]&&!l&&n,{recurse:!1,layout:!1})}),M(s,function(p){var f=!!a[p.source.id],d=!!a[p.target.id];c[p.id]&&f&&d?o.moveConnection(p,t,u[p.id]&&!l&&n):o.layoutConnection(p,{connectionStart:f&&Bl(p,p.source,t),connectionEnd:d&&$l(p,p.target,t)})})},va.prototype.getClosure=function(e){return new Mp().addAll(e,!0)};function _c(e){this._helper=new va(e)}_c.$inject=["modeling"],_c.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},_c.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 $r(e){this._modeling=e,this._helper=new va(e)}$r.$inject=["modeling"],$r.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=Jn(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=_t(o.children,t),Et(i.children,t,r),D(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},$r.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,r=this._modeling;i.layout!==!1&&(M(t.incoming,function(o){r.layoutConnection(o,{connectionEnd:$l(o,t,n)})}),M(t.outgoing,function(o){r.layoutConnection(o,{connectionStart:Bl(o,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},$r.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return Et(n.children,t,i),D(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},$r.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},$r.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function _a(e){this._modeling=e}_a.$inject=["modeling"],_a.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 ge(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},_a.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||Ry(ge(r)?r[0]:r)),i&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||Ry(ge(r)?r[r.length-1]:r)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},_a.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 Ry(e){return e.original||e}function Oi(e,t){this._modeling=e,this._rules=t}Oi.$inject=["modeling","rules"],Oi.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(h,m,g){return i.allowed("connection.reconnect",{connection:g,source:h,target:m})}var u={x:o.x,y:o.y},l={x:r.x,y:r.y,width:r.width,height:r.height};s=e.newShape=e.newShape||t.createShape(o,u,r.parent,a),r.host&&n.updateAttachment(s,r.host);var p;a.moveChildren!==!1&&(p=r.children.slice(),n.moveElements(p,{x:0,y:0},s,a));var f=r.incoming.slice(),d=r.outgoing.slice();M(f,function(h){var m=h.source,g=c(m,s,h);g&&t.reconnectEnd(h,s,Us(h,s,l),a)}),M(d,function(h){var m=h.target,g=c(s,m,h);g&&t.reconnectStart(h,s,Ws(h,s,l),a)})},Oi.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},Oi.prototype.execute=function(e){},Oi.prototype.revert=function(e){},Oi.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},Oi.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},Oi.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},D(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&&(M(n.incoming,function(o){t.layoutConnection(o,{connectionEnd:Us(o,n,i)})}),M(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:Ws(o,n,i)})}))},ba.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return D(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function lr(e){this._modeling=e}lr.$inject=["modeling"],lr.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),M(r,function(s){a[s.id]=iA(s)}),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(MP(i,r),t,n,o,i,r,a)},lr.prototype.execute=function(){},lr.prototype.revert=function(){},lr.prototype.moveShapes=function(e,t){var n=this;M(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},lr.prototype.resizeShapes=function(e,t,n){var i=this;M(e,function(r){var o=kP(r,n,t);i._modeling.resizeShape(r,o,null,{attachSupport:!1,autoResize:!1,layout:!1})})},lr.prototype.updateConnectionWaypoints=function(e,t,n,i,r,o,a){var s=this,c=new Set(r),u=new Set(o);M(e,function(l){var p=l.source,f=l.target,d=nA(l),h=Py(n),m={},g=c.has(p)||u.has(p),R=c.has(f)||u.has(f);g&&R?(d=nn(d,function(E){return Ay(E,i,n)&&(E[h]=E[h]+t[h]),E.original&&Ay(E.original,i,n)&&(E.original[h]=E.original[h]+t[h]),E}),s._modeling.updateWaypoints(l,d,{labelBehavior:!1})):(g||R)&&(c.has(p)?m.connectionStart=Bl(l,p,t):c.has(f)?m.connectionEnd=$l(l,f,t):u.has(p)?m.connectionStart=Ws(l,p,a[p.id]):u.has(f)&&(m.connectionEnd=Us(l,f,a[f.id])),s._modeling.layoutConnection(l,m))})};function Cy(e){return D({},e)}function nA(e){return nn(e.waypoints,function(t){return t=Cy(t),t.original&&(t.original=Cy(t.original)),t})}function Py(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function Ay(e,t,n){var i=Py(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function iA(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function bc(e){this._modeling=e}bc.$inject=["modeling"],bc.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=Ty(n),t.collapsed=!t.collapsed;var i=My(n,t.collapsed);return[t].concat(i)},bc.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,r=ky(i,n);return t.collapsed=!t.collapsed,[t].concat(r)};function Ty(e){var t={};return M(e,function(n){t[n.id]=n.hidden,n.children&&(t=D({},t,Ty(n.children)))}),t}function My(e,t){var n=[];return M(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(My(i.children,i.collapsed||t)))}),n}function ky(e,t){var n=[];return M(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(ky(i.children,t)))}),n}function xc(e){this._modeling=e}xc.$inject=["modeling"],xc.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=Dy(i,t),Oy(n,t),t.host=n,t},xc.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,Dy(n,t),Oy(i,t,r),t};function Dy(e,t){return _t(e&&e.attachers,t)}function Oy(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),Et(i,t,n)}}function kp(){}kp.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},kp.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function rt(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}rt.$inject=["eventBus","elementFactory","commandStack"],rt.prototype.getHandlers=function(){return{"shape.append":hc,"shape.create":ur,"shape.delete":ya,"shape.move":$r,"shape.resize":ba,"shape.replace":Oi,"shape.toggleCollapse":bc,spaceTool:lr,"label.create":ma,"connection.create":mc,"connection.delete":ga,"connection.move":Tp,"connection.layout":vc,"connection.updateWaypoints":kp,"connection.reconnect":_a,"elements.create":Pp,"elements.move":_c,"elements.delete":Ap,"elements.distribute":yc,"elements.align":dc,"element.updateAttachment":xc}},rt.prototype.registerHandlers=function(e){M(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},rt.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)},rt.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},rt.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)},rt.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)},rt.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},rt.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},rt.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},rt.prototype.createElements=function(e,t,n,i,r){ge(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},rt.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},rt.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},rt.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},rt.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},rt.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},rt.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},rt.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},rt.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},rt.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},rt.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)},rt.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},rt.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)},rt.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,D(i,{docking:"source"}))},rt.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,D(i,{docking:"target"}))},rt.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},rt.prototype._create=function(e,t){return g1(t)?t:this._elementFactory.create(e,t)},rt.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function xa(e){this._elementRegistry=e}xa.$inject=["elementRegistry"],xa.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||rA(n,qa(i));return Ly(n,i),e.oldProperties=o,e.changed=r,r},xa.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return Ly(n,t),i},xa.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return v(e,"bpmn:DataObject")?oA(e,t):[]};function rA(e,t){return bn(t,function(n,i){return n[i]=e.get(i),n},{})}function Ly(e,t){M(t,function(n,i){e.set(i,n)})}function oA(e,t){return t.filter(function(n){return v(n,"bpmn:DataObjectReference")&&K(n).dataObjectRef===e})}var Ea="default",Li="id",Iy="di",aA={width:0,height:0};function wa(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}wa.$inject=["elementRegistry","moddle","modeling","textRenderer"],wa.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=pA(e.properties),s=e.oldProperties||sA(t,a);return Ny(a,o)&&(r.unclaim(o[Li]),i.updateId(t,a[Li]),r.claim(a[Li],o)),Ea in a&&(a[Ea]&&n.push(i.get(a[Ea].id)),o[Ea]&&n.push(i.get(o[Ea].id))),By(t,a),e.oldProperties=s,e.changed=n,n},wa.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&K(n).name;if(i){var r=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,r,aA)}},wa.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 By(t,i),Ny(n,r)&&(a.unclaim(n[Li]),o.updateId(t,i[Li]),a.claim(i[Li],r)),e.changed};function Ny(e,t){return Li in e&&e[Li]!==t[Li]}function sA(e,t){var n=qa(t),i=e.businessObject,r=Ve(e);return bn(n,function(o,a){return a!==Iy?o[a]=i.get(a):o[a]=cA(r,qa(t.di)),o},{})}function cA(e,t){return bn(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function By(e,t){var n=e.businessObject,i=Ve(e);M(t,function(r,o){o!==Iy?n.set(o,r):i&&uA(i,r)})}function uA(e,t){M(t,function(n,i){e.set(i,n)})}var lA=["default"];function pA(e){var t=D({},e);return lA.forEach(function(n){n in e&&(t[n]=K(t[n]))}),t}function Ec(e,t){this._canvas=e,this._modeling=t}Ec.$inject=["canvas","modeling"],Ec.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=Ve(r);return t.setRootElement(n),t.removeRootElement(r),Et(a.rootElements,i),i.$parent=a,_t(a.rootElements,o),o.$parent=null,r.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=r,[]},Ec.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,a=i.$parent,s=Ve(n);return t.setRootElement(r),t.removeRootElement(n),_t(a.rootElements,i),i.$parent=null,Et(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,r.di=s,[]};function Dp(e,t){this._modeling=e,this._spaceTool=t}Dp.$inject=["modeling","spaceTool"],Dp.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=zn(i),a=o===i,s=a?i:i.parent,c=nr(s),u=Gt(i);if(u?r==="left"?r="top":r==="right"&&(r="bottom"):r==="top"?r="left":r==="bottom"&&(r="right"),!c.length){var l=u?{x:i.x+Hn,y:i.y,width:i.width-Hn,height:i.height}:{x:i.x,y:i.y+Hn,width:i.width,height:i.height-Hn};n.createShape({type:"bpmn:Lane",isHorizontal:u},l,s)}var p=[];Mr(o,function(b){return p.push(b),b.label&&p.push(b.label),b===i?[]:Oe(b.children,function(w){return w!==i})});var f,d,h,m,g;r==="top"?(f=-120,d=i.y,h=d+10,m="n",g="y"):r==="left"?(f=-120,d=i.x,h=d+10,m="w",g="x"):r==="bottom"?(f=120,d=i.y+i.height,h=d-10,m="s",g="y"):r==="right"&&(f=120,d=i.x+i.width,h=d-10,m="e",g="x");var R=t.calculateAdjustments(p,g,f,h),E=u?{x:0,y:f}:{x:f,y:0};t.makeSpace(R.movingShapes,R.resizingShapes,E,m,h);var x=u?{x:i.x+(a?Hn:0),y:d-(r==="top"?120:0),width:i.width-(a?Hn:0),height:120}:{x:d-(r==="left"?120:0),y:i.y+(a?Hn:0),width:120,height:i.height-(a?Hn:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:u},x,s)};function Op(e){this._modeling=e}Op.$inject=["modeling"],Op.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=nr(n),o=r.length;if(o>i)throw new Error(`more than <${i}> child lanes`);var a=Gt(n),s=a?n.height:n.width,c=Math.round(s/i),u,l,p,f;for(f=0;f<i;f++)f===i-1?u=s-c*f:u=c,l=a?{x:n.x+Hn,y:n.y+f*c,width:n.width-Hn,height:u}:{x:n.x+f*c,y:n.y+Hn,width:u,height:n.height-Hn},f<o?t.resizeShape(r[f],l):(p={type:"bpmn:Lane",isHorizontal:a},t.createShape(p,l,n))};function Sa(e,t){this._modeling=e,this._spaceTool=t}Sa.$inject=["modeling","spaceTool"],Sa.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},Sa.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=oR(e,t);n.resizeShape(e,t),i.forEach(function(r){n.resizeShape(r.shape,r.newBounds)})},Sa.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=me(e),r=me(t),o=mm(r,i),a=zn(e),s=[],c=[];Mr(a,function(h){return s.push(h),(v(h,"bpmn:Lane")||v(h,"bpmn:Participant"))&&c.push(h),h.children});var u,l,p,f,d;(o.bottom||o.top)&&(u=o.bottom||o.top,l=e.y+(o.bottom?e.height:0)+(o.bottom?-10:10),p=o.bottom?"s":"n",f=o.top>0||o.bottom<0?-u:u,d=n.calculateAdjustments(s,"y",f,l),n.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:u},p)),(o.left||o.right)&&(u=o.right||o.left,l=e.x+(o.right?e.width:0)+(o.right?-10:100),p=o.right?"e":"w",f=o.left>0||o.right<0?-u:u,d=n.calculateAdjustments(c,"x",f,l),n.makeSpace(d.movingShapes,d.resizingShapes,{x:u,y:0},p))};var Ra="flowNodeRef",Lp="lanes";function wc(){}wc.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},o=[];function a(l,p){var f=me(p),d={x:l.x+l.width/2,y:l.y+l.height/2};return d.x>f.left&&d.x<f.right&&d.y>f.top&&d.y<f.bottom}function s(l){n.indexOf(l)===-1&&(o.push(l),n.push(l))}function c(l){var p=zn(l);return r[p.id]||(r[p.id]=Fs(p)),r[p.id]}function u(l){if(!l.parent)return[];var p=c(l);return p.filter(function(f){return a(l,f)}).map(function(f){return f.businessObject})}return t.forEach(function(l){var p=zn(l);if(!(!p||n.indexOf(p)!==-1)){var f=p.children.filter(function(d){return v(d,"bpmn:FlowNode")});f.forEach(s),n.push(p)}}),e.forEach(s),o.forEach(function(l){var p=l.businessObject,f=p.get(Lp),d=f.slice(),h=u(l);i.push({flowNode:p,remove:d,add:h})}),t.forEach(function(l){var p=l.businessObject;l.parent||p.get(Ra).forEach(function(f){i.push({flowNode:f,remove:[p],add:[]})})}),i},wc.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(Lp);n.remove.forEach(function(o){_t(r,o),_t(o.get(Ra),i)}),n.add.forEach(function(o){Et(r,o),Et(o.get(Ra),i)})}),[]},wc.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,r=i.get(Lp);n.add.forEach(function(o){_t(r,o),_t(o.get(Ra),i)}),n.remove.forEach(function(o){Et(r,o),Et(o.get(Ra),i)})}),[]};var Ip="categoryValueRef";function Ca(e,t){this._bpmnFactory=e,this._elementRegistry=t}Ca.$inject=["bpmnFactory","elementRegistry"],Ca.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,r=new Map,o=[],a=new Map;function s(E,x,b){if(x){var w=a.get(E);w||(w={},a.set(E,w)),!(b&&w.present)&&(!b&&w.past||(b?w.present={categoryValue:x,root:Np(E)}:w.past={categoryValue:x}))}}function c(E){r.set(E,K(E))}function u(){n.filter(function(E){return v(E,"bpmn:FlowElement")&&!ke(E)&&E.parent}).forEach(c)}function l(E){var x=K(E),b=x.get("categoryValueRef");return b||(b=lm(i,x),o.push(fA(E,b))),b}function p(E){return E.reduce(function(x,b){var w=Np(b),T=x.get(w);return T||(T=[],x.set(w,T)),T.push(b),x},new Map)}e=Array.from(e||[]);var f=p(e);t.length&&u(),e.forEach(c),n.filter(function(E){return v(E,"bpmn:Group")&&!ke(E)&&E.parent}).forEach(function(E){var x=K(E).get("categoryValueRef");if(!x){var b=Np(E),w=f.get(b)||[],T=io(w,E),L=Object.keys(T).length>0;L&&(x=l(E))}s(E,x,!0)}),t.forEach(function(E){s(E.groupShape,E.categoryValue,!1)}),o.length&&u();var d=Array.from(r.keys()),h=Array.from(a.values()).reduce(function(E,x){return x.present&&E.add(x.present.categoryValue),x.past&&E.add(x.past.categoryValue),E},new Set),m=new Map,g=p(d);a.forEach(function(E,x){var b=E.present;if(b){var w=g.get(b.root)||[],T=io(w,x);w.forEach(function(L){if(T[L.id]){var A=m.get(L);A||(A=new Set,m.set(L,A)),A.add(b.categoryValue)}})}});var R=d.reduce(function(E,x){var b=r.get(x),w=b.get(Ip),T=new Set(w),L=m.get(x)||new Set,A=Array.from(L).filter(function(H){return!T.has(H)}),F=w.filter(function(H){return h.has(H)&&!L.has(H)});return(A.length||F.length)&&E.push({businessObject:b,categoryValuesToAdd:A,categoryValuesToRemove:F}),E},[]);return{flowElements:R,groups:o}},Ca.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),dA(t.groups),mA(t.flowElements),[]},Ca.prototype.revert=function(e){var t=e.updates;return gA(t.flowElements),hA(t.groups),[]};function fA(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function dA(e){e.forEach(function(t){K(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function hA(e){e.forEach(function(t){K(t.groupShape).categoryValueRef=null})}function mA(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Ip);t.categoryValuesToRemove.forEach(function(r){_t(i,r)}),t.categoryValuesToAdd.forEach(function(r){Et(i,r,!0)})})}function gA(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Ip);t.categoryValuesToAdd.forEach(function(r){_t(i,r)}),t.categoryValuesToRemove.forEach(function(r){Et(i,r,!0)})})}function Np(e){for(;e.parent;)e=e.parent;return e}function Sc(e){this._moddle=e}Sc.$inject=["moddle"],Sc.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),[]},Sc.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 yA={fill:void 0,stroke:void 0};function Bp(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(vn(t)){var n=vA(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}Bp.$inject=["commandStack"],Bp.prototype.postExecute=function(e){var t=e.elements,n=e.colors||yA,i=this,r={};"fill"in n&&D(r,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&D(r,{"border-color":this._normalizeColor(n.stroke)}),M(t,function(o){var a=it(o)?Jn(r,["border-color"]):r,s=Ve(o);if(_A(a),ke(o)){if(!s||!v(s.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:o,moddleElement:s.label,properties:{color:r["border-color"]}})}else{if(!De(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:o,properties:{di:a}})}})};function vA(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 _A(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var bA={width:0,height:0};function $y(e,t,n){function i(c,u){var l=c.label||c,p=c.labelTarget||c;return Y1(l,u),[l,p]}function r(c){var u=c.element,l=u.businessObject,p=c.newLabel;if(!ke(u)&&er(u)&&!Ps(u)&&!jy(p)){var f=7,d=sl(u);d={x:d.x,y:d.y+f},e.createLabel(u,d,{id:l.id+"_label",businessObject:l,di:u.di})}}function o(c){return c.oldLabel=In(c.element),i(c.element,c.newLabel)}function a(c){return i(c.element,c.oldLabel)}function s(c){var u=c.element,l=u.label||u,p=c.newLabel,f=c.newBounds,d=c.hints||{};if(!(!ke(l)&&!v(l,"bpmn:TextAnnotation"))){if(ke(l)&&jy(p)){d.removeShape!==!1&&e.removeShape(l,{unsetLabel:!1});return}var h=In(u);typeof f>"u"&&(f=t.getExternalLabelBounds(l,h)),f&&e.resizeShape(l,f,bA)}}this.preExecute=r,this.execute=o,this.revert=a,this.postExecute=s}$y.$inject=["modeling","textRenderer","bpmnFactory"];function jy(e){return!e||!e.trim()}function Jt(e,t,n,i){rt.call(this,e,t,n),this._bpmnRules=i}ie(Jt,rt),Jt.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],Jt.prototype.getHandlers=function(){var e=rt.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=xa,e["element.updateProperties"]=wa,e["canvas.updateRoot"]=Ec,e["lane.add"]=Dp,e["lane.resize"]=Sa,e["lane.split"]=Op,e["lane.updateRefs"]=wc,e["group.updateRefs"]=Ca,e["id.updateClaim"]=Sc,e["element.setColor"]=Bp,e["element.updateLabel"]=$y,e},Jt.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},Jt.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)},Jt.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},Jt.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},Jt.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},Jt.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},Jt.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},Jt.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Jt.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Jt.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},Jt.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},Jt.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},Jt.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},Jt.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function Fy(){}Fy.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||ye(t.source||e.source),t.connectionEnd||ye(t.target||e.target)]};var Rc=20,xA=5,Cc=Math.round,Hy=20,EA={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function wA(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function SA(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function zy(e,t,n){var i=Xt(t,e,xA),r=n.split(":")[0],o=Cc((t.x-e.x)/2+e.x),a=Cc((t.y-e.y)/2+e.y),s,c,u=SA(r,i),l=/h|r|l/.test(r),p=!1,f=!1;return u?(s=l?{x:o,y:e.y}:{x:e.x,y:a},c=l?"h:h":"v:v"):(p=wA(i,r),c=l?"h:v":"v:h",p?l?(f=a===e.y,s={x:e.x+Rc*(/l/.test(r)?-1:1),y:f?a+Rc:a}):(f=o===e.x,s={x:f?o+Rc:o,y:e.y+Rc*(/t/.test(r)?-1:1)}):s={x:o,y:a}),{waypoints:$p(e,s,c).concat(s),directions:c,turnNextDirections:f}}function RA(e,t,n){return zy(e,t,n)}function CA(e,t,n){var i=zy(t,e,Vy(n));return{waypoints:i.waypoints.slice().reverse(),directions:Vy(i.directions),turnNextDirections:i.turnNextDirections}}function PA(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=$p(e.waypoints[e.waypoints.length-1],t.waypoints[0],r);return{waypoints:o,directions:r}}function Vy(e){return e.split(":").reverse().join(":")}function AA(e,t,n){var i=Cc((t.x-e.x)/2+e.x),r=Cc((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 $p(e,t,n){if(n=n||"h:h",!BA(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(Wy(n)){var i=RA(e,t,n),r=CA(e,t,n),o=PA(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return AA(e,t,n)}function TA(e,t,n){var i=$p(e,t,n);return i.unshift(e),i.push(t),qy(i)}function MA(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=Lx(o,"straight")[0]||"h:h",s=EA[a]||0,c=Xt(e,t,s),u=NA(c,a);n=n||ye(e),i=i||ye(t);var l=u.split(":"),p=Uy(n,e,l[0],$A(c)),f=Uy(i,t,l[1],c);return TA(p,f,u)}function kA(e,t,n,i,r,o){ge(n)&&(r=n,o=i,n=ye(e),i=ye(t)),o=D({preferredLayouts:[]},o),r=r||[];var a=o.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&OA(e,t,n,i,o),c||(c=o.connectionEnd&&IA(t,e,i,r),c)||(c=o.connectionStart&&LA(e,t,n,r),c)?c:!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:MA(e,t,n,i,o)}function DA(e,t,n){return e>=t&&e<=n}function Gy(e,t,n){var i={x:"width",y:"height"};return DA(t[e],n[e],n[e]+n[i[e]])}function OA(e,t,n,i,r){var o={},a,s;return s=Xt(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),r.preserveDocking==="target"?Gy(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:Gy(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 LA(e,t,n,i){return jp(e,t,n,i)}function IA(e,t,n,i){var r=i.slice().reverse();return r=jp(e,t,n,r),r?r.reverse():null}function jp(e,t,n,i){function r(l){return l.length<3?!0:l.length>4?!1:!!at(l,function(p,f){var d=l[f-1];return d&&Xo(p,d)<3})}function o(l,p,f){var d=Ri(p,l);switch(d){case"v":return{x:f.x,y:l.y};case"h":return{x:l.x,y:f.y}}return{x:l.x,y:l.y}}function a(l,p,f){var d;for(d=l.length-2;d!==0;d--)if(gh(l[d],p,Hy)||gh(l[d],f,Hy))return l.slice(d);return l}if(r(i))return null;var s=i[0],c=i.slice(),u;return c[0]=n,c[1]=o(c[1],s,n),u=a(c,e,t),u!==c&&(c=jp(e,t,n,u)),c&&Ri(c)?null:c}function NA(e,t){if(Wy(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 BA(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function Wy(e){return e&&/t|r|b|l/.test(e)}function $A(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 Uy(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 qy(e){return e.reduce(function(t,n,i){var r=t[t.length-1],o=e[i+1];return nl(r,o,n,0)||t.push(n),t},[])}var jA=-10,FA=40,HA={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},zA={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},Fp={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},Pa={top:"t",right:"r",bottom:"b",left:"l"};function Pc(e){this._elementRegistry=e}ie(Pc,Fy),Pc.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,u;if(o||(o=Yy(r&&r[0],n)),a||(a=Yy(r&&r[r.length-1],i)),(v(e,"bpmn:Association")||v(e,"bpmn:DataAssociation"))&&r&&!Ky(n,i))return[].concat([o],r.slice(1,-1),[a]);var l=am(n,s)?HA:zA;return v(e,"bpmn:MessageFlow")?c=GA(n,i,l):(v(e,"bpmn:SequenceFlow")||Ky(n,i))&&(n===i?c={preferredLayouts:XA(n,e,l)}:v(n,"bpmn:BoundaryEvent")?c={preferredLayouts:ZA(n,i,a,l)}:Aa(n)||Aa(i)?c={preferredLayouts:l.subProcess,preserveDocking:UA(n)}:v(n,"bpmn:Gateway")?c={preferredLayouts:l.fromGateway}:v(i,"bpmn:Gateway")?c={preferredLayouts:l.toGateway}:c={preferredLayouts:l.default}),c&&(c=D(c,t),u=qy(kA(n,i,o,a,r,c))),u||[o,a]};function VA(e){var t=e.host;return Xt(ye(e),t,jA)}function GA(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:WA(e,t)}}function WA(e,t){return v(t,"bpmn:Participant")?"source":v(e,"bpmn:Participant")?"target":Aa(t)?"source":Aa(e)||v(t,"bpmn:Event")?"target":v(e,"bpmn:Event")?"source":null}function UA(e){return Aa(e)?"target":"source"}function Yy(e,t){return e?e.original||e:ye(t)}function Ky(e,t){return v(t,"bpmn:Activity")&&v(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function Aa(e){return v(e,"bpmn:SubProcess")&&Be(e)}function jr(e,t){return e===t}function qA(e,t){return t.indexOf(e)!==-1}function wo(e){var t=/right|left/.exec(e);return t&&t[0]}function So(e){var t=/top|bottom/.exec(e);return t&&t[0]}function Xy(e,t){return Fp[e]===t}function YA(e,t){var n=wo(e),i=Fp[n];return t.indexOf(i)!==-1}function KA(e,t){var n=So(e),i=Fp[n];return t.indexOf(i)!==-1}function Zy(e){return e==="right"||e==="left"}function XA(e,t,n){var i=t.waypoints,r=i&&i.length&&Xt(i[0],e);return r==="top"?n.loop.fromTop:r==="right"?n.loop.fromRight:r==="left"?n.loop.fromLeft:n.loop.fromBottom}function ZA(e,t,n,i){var r=ye(e),o=ye(t),a=VA(e),s,c,u=jr(e.host,t),l=qA(a,["top","right","bottom","left"]),p=Xt(o,r,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return u?QA(a,l,e,t,n,i):(s=JA(a,p,l,i.isHorizontal),c=eT(a,p,l,i.isHorizontal),[s+":"+c])}function QA(e,t,n,i,r,o){var a=t?e:o.isHorizontal?So(e):wo(e),s=Pa[a],c;return t?Zy(e)?c=Qy("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:c=Qy("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function Qy(e,t,n,i){var r=FA;return!(Hp(e,i,n,r)||Hp(e,i,{x:n.x+n.width,y:n.y+n.height},r)||Hp(e,i,ye(t),r))}function Hp(e,t,n,i){return Math.abs(t[e]-n[e])<i}function JA(e,t,n,i){if(n)return Pa[e];var r=So(e),o=wo(e),a=So(t),s=wo(t);if(i){if(jr(r,a)||Xy(o,s))return Pa[r]}else if(jr(o,s)||Xy(r,a))return Pa[o];return Pa[i?o:r]}function eT(e,t,n,i){if(n)return Zy(e)?YA(e,t)||jr(e,t)?"h":"v":KA(e,t)||jr(e,t)?"v":"h";var r=So(e),o=wo(e),a=So(t),s=wo(t);return a&&!s?"v":s&&!a?"h":i?jr(r,a)?"h":"v":jr(o,s)?"v":"h"}Pc.$inject=["elementRegistry"];function Jy(e){return D({original:e.point.original||e.point},e.actual)}function pr(e,t){this._elementRegistry=e,this._graphicsFactory=t}pr.$inject=["elementRegistry","graphicsFactory"],pr.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(Jy(i)),o.push(Jy(r)),o},pr.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}},pr.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return Zo(i,r,n)},pr.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},pr.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},pr.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const zp={__init__:["modeling","bpmnUpdater"],__depends__:[_C,IC,BC,$C,py,jP,HP,qP,Gn,Rp,yy],bpmnFactory:["type",Un],bpmnUpdater:["type",Pn],elementFactory:["type",cr],modeling:["type",Jt],layouter:["type",Pc],connectionDocking:["type",pr]};var tT=10,ev=50,nT=250;function Vp(e,t,n,i){for(var r;r=iT(e,n,t);)n=i(t,n,r);return n}function Gp(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,u=a.minDistance;c<0?r[o]=Math.min(i[o]+c-t[s]/2,n[o]-u+c):r[o]=Math.max(i[o]+i[s]+c+t[s]/2,n[o]+u+c)}}),r}}function iT(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=oT(e);return at(r,function(o){if(o===n)return!1;var a=Xt(o,i,tT);return a==="intersect"})}function rT(e,t){t||(t={});function n(h){return h.source===e?1:-1}var i=t.defaultDistance||ev,r=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||nT,c=t.reference||"start";o||(o=cT);function u(h,m){return r==="n"?c==="start"?me(h).top-me(m).bottom:c==="center"?me(h).top-ye(m).y:me(h).top-me(m).top:r==="w"?c==="start"?me(h).left-me(m).right:c==="center"?me(h).left-ye(m).x:me(h).left-me(m).left:r==="s"?c==="start"?me(m).top-me(h).bottom:c==="center"?ye(m).y-me(h).bottom:me(m).bottom-me(h).bottom:c==="start"?me(m).left-me(h).right:c==="center"?ye(m).x-me(h).right:me(m).right-me(h).right}var l=e.incoming.filter(o).map(function(h){var m=a(h),g=m<0?u(h.source,e):u(e,h.source);return{id:h.source.id,distance:g,weight:m}}),p=e.outgoing.filter(o).map(function(h){var m=a(h),g=m>0?u(e,h.target):u(h.target,e);return{id:h.target.id,distance:g,weight:m}}),f=l.concat(p).reduce(function(h,m){return h[m.id+"__weight_"+m.weight]=m,h},{}),d=bn(f,function(h,m){var g=m.distance,R=m.weight;return g<0||g>s||(h[String(g)]||(h[String(g)]=0),h[String(g)]+=1*R,(!h.distance||h[h.distance]<h[String(g)])&&(h.distance=g)),h},{});return d.distance||i}function oT(e){var t=Wp(e);return e.host&&(t=t.concat(Wp(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(Wp(i))},[]))),t}function Wp(e){return sT(e).concat(aT(e))}function aT(e){return e.incoming.map(function(t){return t.source})}function sT(e){return e.outgoing.map(function(t){return t.target})}function cT(){return!0}var uT=100;function tv(e,t,n){e.on("autoPlace",uT,function(i){var r=i.shape,o=i.source;return lT(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}}tv.$inject=["eventBus","modeling","canvas"];function lT(e,t,n){n||(n={});var i=n.defaultDistance||ev,r=ye(e),o=me(e);return{x:o.right+i+t.width/2,y:r.y}}function nv(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}nv.$inject=["eventBus","selection"];const pT={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",tv],autoPlaceSelectionBehavior:["type",nv]};function iv(e,t,n){var i=am(e,n);if(v(t,"bpmn:TextAnnotation"))return dT(e,t,i);if(De(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return hT(e,t,i);if(v(t,"bpmn:FlowNode"))return fT(e,t,i)}function fT(e,t,n){var i=me(e),r=ye(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=rT(e,{filter:function(d){return v(d,"bpmn:SequenceFlow")},direction:o.directionHint}),s=30,c=o.minDistance,u=o.baseOrientation;v(e,"bpmn:BoundaryEvent")&&(u=Xt(e,e.host,-25),u.indexOf(o.boundaryOrientation)!==-1&&(s*=-1));var l=n?{x:i.right+a+t.width/2,y:r.y+rv(u,c,o)}:{x:r.x+rv(u,c,o),y:i.bottom+a+t.height/2},p={margin:s,minDistance:c},f=n?{y:p}:{x:p};return Vp(e,t,l,Gp(f))}function rv(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function dT(e,t,n){var i=me(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};it(e)&&(r=ye(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 Vp(e,t,r,Gp(a))}function hT(e,t,n){var i=me(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 Vp(e,t,r,Gp(a))}function ov(e,t){e.on("autoPlace",function(n){var i=n.shape,r=n.source;return iv(r,i,t)})}ov.$inject=["eventBus","elementRegistry"];const Ac={__depends__:[pT],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",ov]},av=[rm,ia,zp,Ac];function mT(e={}){Ud(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new ao({container:t,moddleExtensions:e.moddleExtensions??es,additionalModules:[...av,...e.additionalModules??[]]})}var gT=new xo("ov"),yT=500;function Wt(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=gT,this._overlayDefaults=D({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=vT(n.getContainer()),this._init()}Wt.$inject=["config.overlays","eventBus","canvas","elementRegistry"],Wt.prototype.get=function(e){if(vn(e)&&(e={id:e}),vn(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?Oe(t.overlays,Zr({type:e.type})):t.overlays.slice():[]}else return e.type?Oe(this._overlays,Zr({type:e.type})):e.id?this._overlays[e.id]:null},Wt.prototype.add=function(e,t,n){if(Ht(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=D({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},Wt.prototype.remove=function(e){var t=this.get(e)||[];ge(t)||(t=[t]);var n=this;M(t,function(i){var r=n._getOverlayContainer(i.element,!0);if(i&&(li(i.html),li(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)}})},Wt.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},Wt.prototype.show=function(){Tc(this._overlayRoot)},Wt.prototype.hide=function(){Tc(this._overlayRoot,!1)},Wt.prototype.clear=function(){this._overlays={},this._overlayContainers=[],fs(this._overlayRoot)},Wt.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=Rt(t);i=o.x,r=o.y}sv(n,i,r),on(e.html,"data-container-id",t.id)},Wt.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=Rt(i).width:a=i.width,r=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=Rt(i).height:s=i.height,o=t.bottom*-1+s}sv(n,r||0,o||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Wt.prototype._createOverlayContainer=function(e){var t=ut('<div class="djs-overlays" />');fn(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},Wt.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";cv(this._overlayRoot,n)},Wt.prototype._getOverlayContainer=function(e,t){var n=at(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},Wt.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)),vn(i)&&(i=ut(i)),o=this._getOverlayContainer(n),r=ut('<div class="djs-overlay" data-overlay-id="'+t+'">'),fn(r,{position:"absolute"}),r.appendChild(i),e.type&&ft(r).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();Tc(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())},Wt.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&&(Ot(r)&&r>t.scale||Ot(o)&&o<t.scale))&&(c=!1),Tc(a,c),this._updateOverlayScale(e,t)},Wt.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),Ot(i)&&t.scale<i&&(a=(1/t.scale||1)*i),Ot(r)&&t.scale>r&&(a=(1/t.scale||1)*r)),Ot(a)&&(s="scale("+a+","+a+")"),cv(o,s)},Wt.prototype._updateOverlaysVisibilty=function(e){var t=this;M(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},Wt.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});M(o,function(c){t.remove(c.id)});var a=t._getOverlayContainer(r);if(a){li(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",yT,function(i){var r=i.element,o=t._getOverlayContainer(r,!0);o&&(M(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&&ft(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 vT(e){var t=ut('<div class="djs-overlay-container" />');return fn(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function sv(e,t,n){fn(e,{left:t+"px",top:n+"px"})}function Tc(e,t){e.style.display=t===!1?"none":""}function cv(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const Mc={__init__:["overlays"],overlays:["type",Wt]};function Up(e,t){t.invoke(Y,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)})}ie(Up,Y),Up.$inject=["canvas","injector"];const _T={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",Up]};function Ta(e){return CSS.escape(e)}var bT={"&":"&","<":"<",">":">",'"':""","'":"'"};function uv(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return bT[t]})}var xT="bjs-breadcrumbs-shown";function lv(e,t,n){var i=ut('<ul class="bjs-breadcrumbs"></ul>'),r=n.getContainer(),o=ft(r);r.appendChild(i);var a=[];e.on("element.changed",function(c){var u=c.element,l=K(u),p=at(a,function(f){return f===l});p&&s()});function s(c){c&&(a=ET(c));var u=a.flatMap(function(p){var f=n.findRoot(mi(p))||n.findRoot(p.id);if(!f&&v(p,"bpmn:Process")){var d=t.find(function(g){var R=K(g);return R&&R.get("processRef")===p});f=d&&n.findRoot(d.id)}if(!f)return[];var h=uv(p.name||p.id),m=ut('<li><span class="bjs-crumb"><a title="'+h+'">'+h+"</a></span></li>");return m.addEventListener("click",function(){n.setRootElement(f)}),m});i.innerHTML="";var l=u.length>1;o.toggle(xT,l),u.forEach(function(p){i.appendChild(p)})}e.on("root.set",function(c){s(c.element)})}lv.$inject=["eventBus","elementRegistry","canvas"];function ET(e){for(var t=K(e),n=[],i=t;i;i=i.$parent)(v(i,"bpmn:SubProcess")||v(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function pv(e,t){var n=null,i=new wT;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,!(!v(o,"bpmn:SubProcess")&&!s)){s=s||{x:0,y:0,zoom:1};var c=(a.x-s.x)*a.scale,u=(a.y-s.y)*a.scale;(c!==0||u!==0)&&t.scroll({dx:c,dy:u}),s.zoom!==a.scale&&t.zoom(s.zoom,{x:0,y:0})}}),e.on("diagram.clear",function(){i.clear(),n=null})}pv.$inject=["eventBus","canvas"];function wT(){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 fv={x:180,y:160};function Fr(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,r){n._handleImport(r.definitions)})}Fr.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)})}},Fr.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;v(a,"bpmn:SubProcess")&&!o.isExpanded&&n.push(a),RT(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},Fr.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=ST(e),i={x:n.x-fv.x,y:n.y-fv.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)})},Fr.prototype._moveToDiPlane=function(e,t){var n=dv(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},Fr.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},Fr.$inject=["eventBus","moddle"];function dv(e){return v(e,"bpmndi:BPMNDiagram")?e:dv(e.$parent)}function ST(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=me(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),xs(t)}function RT(e,t){var n=e.$parent;return!(!v(n,"bpmn:SubProcess")||n===t.bpmnElement||De(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var kc=250,CT='<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>',PT="bjs-drilldown-empty";function fr(e,t,n,i,r){Y.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",kc,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",kc,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],kc,function(a){var s=a.oldParent,c=a.newParent||a.parent,u=a.shape;o._canDrillDown(u)&&o._addOverlay(u),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(u)},!0),this.reverted(["shape.create","shape.move","shape.delete"],kc,function(a){var s=a.oldParent,c=a.newParent||a.parent,u=a.shape;o._canDrillDown(u)&&o._addOverlay(u),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(u)},!0),t.on("import.render.complete",function(){n.filter(function(a){return o._canDrillDown(a)}).map(function(a){o._addOverlay(a)})})}ie(fr,Y),fr.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},fr.prototype._canDrillDown=function(e){var t=this._canvas;return v(e,"bpmn:SubProcess")&&t.findRoot(mi(e))},fr.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=K(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var r=n&&n.get("flowElements")&&n.get("flowElements").length;ft(i.html).toggle(PT,!r)}},fr.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=K(e),r=n.get({element:e,type:"drilldown"});r.length&&this._removeOverlay(e);var o=ut('<button type="button" class="bjs-drilldown">'+CT+"</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(mi(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:o}),this._updateOverlayVisibility(e)},fr.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},fr.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const AT={__depends__:[Mc,Rp,_T],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",lv],drilldownCentering:["type",pv],drilldownOverlayBehavior:["type",fr],subprocessCompatibility:["type",Fr]};function dr(e){ht.call(this,e)}ie(dr,ht),dr.prototype._modules=[rm,AT,Mc,Gn,ia],dr.prototype._moddleExtensions={};var Dc="keyboard.keydown",TT="keyboard.keyup",MT=1e3,hv="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 dn(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(hv));var i=e&&e.bind!==!1;t.on("canvas.init",function(r){n._target=r.svg,i&&n.bind(),n._fire("init")})}dn.$inject=["config.keyboard","eventBus"],dn.prototype._keydownHandler=function(e){this._keyHandler(e,Dc)},dn.prototype._keyupHandler=function(e){this._keyHandler(e,TT)},dn.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||Dc,i),n&&e.preventDefault()}},dn.prototype._isEventIgnored=function(e){return!1},dn.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(hv)),this.unbind(),e=this._node=this._target,we.bind(e,"keydown",this._keydownHandler),we.bind(e,"keyup",this._keyupHandler),this._fire("bind")},dn.prototype.getBinding=function(){return this._node},dn.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),we.unbind(e,"keydown",this._keydownHandler),we.unbind(e,"keyup",this._keyupHandler)),this._node=null},dn.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},dn.prototype.addListener=function(e,t,n){zt(e)&&(n=t,t=e,e=MT),this._eventBus.on(n||Dc,e,t)},dn.prototype.removeListener=function(e,t){this._eventBus.off(t||Dc,e)},dn.prototype.hasModifier=ZC,dn.prototype.isCmd=Rn,dn.prototype.isShift=hp,dn.prototype.isKey=Nt;var kT=500;function Ro(e,t){var n=this;e.on("editorActions.init",kT,function(i){var r=i.editorActions;n.registerBindings(t,r)})}Ro.$inject=["eventBus","keyboard"],Ro.prototype.registerBindings=function(e,t){function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("undo",function(i){var r=i.keyEvent;if(nP(r))return t.trigger("undo"),!0}),n("redo",function(i){var r=i.keyEvent;if(iP(r))return t.trigger("redo"),!0}),n("copy",function(i){var r=i.keyEvent;if(QC(r))return t.trigger("copy"),!0}),n("paste",function(i){var r=i.keyEvent;if(JC(r))return t.trigger("paste"),!0}),n("duplicate",function(i){var r=i.keyEvent;if(eP(r))return t.trigger("duplicate"),!0}),n("cut",function(i){var r=i.keyEvent;if(tP(r))return t.trigger("cut"),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(Nt(["+","Add","="],r)&&Rn(r))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(Nt(["-","Subtract"],r)&&Rn(r))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var r=i.keyEvent;if(Nt("0",r)&&Rn(r))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var r=i.keyEvent;if(Nt(["Backspace","Delete","Del"],r))return t.trigger("removeSelection"),!0})};const qp={__init__:["keyboard","keyboardBindings"],keyboard:["type",dn],keyboardBindings:["type",Ro]};var DT={moveSpeed:50,moveSpeedAccelerated:200};function mv(e,t,n){var i=this;this._config=D({},DT,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,u;switch(a.key){case"ArrowLeft":case"Left":u="left";break;case"ArrowUp":case"Up":u="up";break;case"ArrowRight":case"Right":u="right";break;case"ArrowDown":case"Down":u="down";break}return i.moveCanvas({speed:c,direction:u}),!0}}this.moveCanvas=function(o){var a=0,s=0,c=o.speed,u=c/Math.min(Math.sqrt(n.viewbox().scale),1);switch(o.direction){case"left":a=u;break;case"up":s=u;break;case"right":a=-u;break;case"down":s=-u;break}n.scroll({dx:a,dy:s})}}mv.$inject=["config.keyboardMove","keyboard","canvas"];const gv={__depends__:[qp],__init__:["keyboardMove"],keyboardMove:["type",mv]};var OT=15;function yv(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,u=n.button,l=Lr(s),p=ei(l,c);if(!n.dragging&<(p)>OT&&(n.dragging=!0,u===0&&Gg(e),oc("grab")),n.dragging){var f=n.last||n.start;p=ei(l,f),t.scroll({dx:p.x,dy:p.y}),n.last=l}s.preventDefault()}function o(s){we.unbind(document,"mousemove",r),we.unbind(document,"mouseup",o),n=null,Vg()}function a(s){if(!Ar(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:Lr(s)},we.bind(document,"mousemove",r),we.bind(document,"mouseup",o),!0}}this.isActive=function(){return!!n}}yv.$inject=["eventBus","canvas"];function LT(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const vv={__init__:["moveCanvas"],moveCanvas:["type",yv]};function _v(e,t){var n=pl(e.min),i=pl(e.max),r=Math.abs(n)+Math.abs(i);return r/t}function IT(e,t){return Math.max(e.min,Math.min(e.max,t))}var NT=Math.sign||function(e){return e>=0?1:-1},Yp={min:.2,max:4},bv=10,BT=.1,$T=.75;function vi(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=mn(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||$T;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}vi.$inject=["config.zoomScroll","eventBus","canvas"],vi.prototype.scroll=function(t){this._canvas.scroll(t)},vi.prototype.reset=function(){this._canvas.zoom("fit-viewport")},vi.prototype.zoom=function(t,n){var i=_v(Yp,bv*2);this._totalDelta+=t,Math.abs(this._totalDelta)>BT&&(this._zoom(t,n,i),this._totalDelta=0)},vi.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||Zm()&&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))*NT(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)}},vi.prototype.stepZoom=function(t,n){var i=_v(Yp,bv);this._zoom(t,n,i)},vi.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=pl(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(IT(Yp,s),t)},vi.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,r=this._enabled;return typeof t>"u"&&(t=!r),r!==t&&we[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},vi.prototype._init=function(e){this.toggle(e)};const xv={__init__:["zoomScroll"],zoomScroll:["type",vi]};function Ma(e){dr.call(this,e)}ie(Ma,dr),Ma.prototype._navigationModules=[gv,vv,xv],Ma.prototype._modules=[].concat(dr.prototype._modules,Ma.prototype._navigationModules);function Kp(e){return e&&e[e.length-1]}function Ev(e){return e.y}function wv(e){return e.x}var jT={left:wv,center:wv,right:function(e){return e.x+e.width},top:Ev,middle:Ev,bottom:function(e){return e.y+e.height}};function Co(e,t){this._modeling=e,this._rules=t}Co.$inject=["modeling","rules"],Co.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}},Co.prototype._isType=function(e,t){return t.indexOf(e)!==-1},Co.prototype._alignmentPosition=function(e,t){var n=this._getOrientationDetails(e),i=n.axis,r=n.dimension,o={},a={},s=!1,c,u,l;function p(f,d){return Math.round((f[i]+d[i]+d[r])/2)}if(this._isType(e,["left","top"]))o[e]=t[0][i];else if(this._isType(e,["right","bottom"]))l=Kp(t),o[e]=l[i]+l[r];else if(this._isType(e,["center","middle"])){if(M(t,function(f){var d=f[i]+Math.round(f[r]/2);a[d]?a[d].elements.push(f):a[d]={elements:[f],center:d}}),c=ri(a,function(f){return f.elements.length>1&&(s=!0),f.elements.length}),s)return o[e]=Kp(c).center,o;u=t[0],t=ri(t,function(f){return f[i]+f[r]}),l=Kp(t),o[e]=p(u,l)}return o},Co.prototype.trigger=function(e,t){var n=this._modeling,i,r=Oe(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:r}),ge(i)&&(r=i),!(r.length<2||!i)){var o=jT[t],a=ri(r,o),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const FT={__init__:["alignElements"],alignElements:["type",Co]},HT=new xo;function Po(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}Po.$inject=["eventBus"],Po.prototype.schedule=function(e,t=HT.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},Po.prototype._schedule=function(e,t){const n=zT();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}},Po.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},Po.prototype._cancel=function(e){clearTimeout(e.executionId)};function zT(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const VT={scheduler:["type",Po]};var GT="djs-element-hidden",Oc=".entry",WT=1e3,Sv=8,UT=300;function Pt(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}Pt.$inject=["canvas","elementRegistry","eventBus","scheduler"],Pt.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=ge(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=ge(i.target)?i.target:[i.target];r.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},Pt.prototype._createContainer=function(){var e=ut('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},Pt.prototype.registerProvider=function(e,t){t||(t=e,e=WT),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},Pt.prototype.getEntries=function(e){var t=this._getProviders(),n=ge(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return M(t,function(r){if(zt(r[n])){var o=r[n](e);zt(o)?i=o(i):M(o,function(a,s){i[s]=a})}}),i},Pt.prototype.trigger=function(e,t,n){var i=this,r,o,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(r=on(a,"data-action"),o=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(r,"hover",o,n)},UT);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(r,e,o,n)},Pt.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(zt(s)){if(t==="click")return s(n,r,i)}else if(s[t])return s[t](n,r,i);n.preventDefault()}}}},Pt.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))}},Pt.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Pt.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),i;M(t,function(r,o){var a=r.group||"default",s=ut(r.html||'<div class="entry" draggable="true"></div>'),c;on(s,"data-action",o),c=et("[data-group="+Ta(a)+"]",n),c||(c=ut('<div class="group"></div>'),on(c,"data-group",a),n.appendChild(c)),c.appendChild(s),r.className&&qT(s,r.className),r.title&&on(s,"title",r.title),r.imageUrl&&(i=ut("<img>"),on(i,"src",r.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),ft(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},Pt.prototype._createHtml=function(e){var t=this,n=ut('<div class="djs-context-pad"></div>');return En.bind(n,Oc,"click",function(i){t.trigger("click",i)}),En.bind(n,Oc,"dragstart",function(i){t.trigger("dragstart",i)}),En.bind(n,Oc,"mouseover",function(i){t.trigger("mouseover",i)}),En.bind(n,Oc,"mouseout",function(i){t.trigger("mouseout",i)}),we.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},Pt.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()&&KT(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},Pt.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},Pt.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return ge(e)!==ge(n)?!1:ge(e)?e.length===n.length&&Er(e,function(i){return n.includes(i)}):n===e},Pt.prototype.isShown=function(){return this.isOpen()&&ft(this._current.html).has("open")},Pt.prototype.show=function(){this.isOpen()&&(ft(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},Pt.prototype.hide=function(){this.isOpen()&&(ft(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},Pt.prototype._getPosition=function(e){if(!ge(e)&&it(e)){var t=this._canvas.viewbox(),n=YT(e),i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale;return{left:i+Sv*this._canvas.zoom(),top:r}}var o=this._canvas.getContainer(),a=o.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+Sv*this._canvas.zoom(),top:s.top-a.top}},Pt.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")},Pt.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=ge(n)?n:[n],r=i.some(function(o){return t._canvas.hasMarker(o,GT)});r?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},Pt.prototype._getTargetBounds=function(e){var t=this,n=ge(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 qT(e,t){var n=ft(e);t=ge(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function YT(e){return e.waypoints[e.waypoints.length-1]}function KT(e,t){return e=ge(e)?e:[e],t=ge(t)?t:[t],e.length===t.length&&Er(e,function(n){return t.includes(n)})}const Rv={__depends__:[rc,VT,Mc],contextPad:["type",Pt]};var Lc,gt,Cv,hr,Pv,Av,Tv,Xp,Ic,ka,Mv,Zp,Qp,Jp,Nc={},Bc=[],XT=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,$c=Array.isArray;function Ii(e,t){for(var n in t)e[n]=t[n];return e}function ef(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function kv(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?Lc.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 jc(e,a,i,r,null)}function jc(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??++Cv,__i:-1,__u:0};return r==null&>.vnode!=null&>.vnode(o),o}function Fc(e){return e.children}function Hc(e,t){this.props=e,this.context=t}function Hr(e,t){if(t==null)return e.__?Hr(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"?Hr(e):null}function ZT(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],r=[],o=Ii({},t);o.__v=t.__v+1,gt.vnode&>.vnode(o),tf(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??Hr(t),!!(32&t.__u),r),o.__v=t.__v,o.__.__k[o.__i]=o,jv(i,o,r),t.__e=t.__=null,o.__e!=n&&Dv(o)}}function Dv(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}),Dv(e)}function Ov(e){(!e.__d&&(e.__d=!0)&&hr.push(e)&&!zc.__r++||Pv!=gt.debounceRendering)&&((Pv=gt.debounceRendering)||Av)(zc)}function zc(){try{for(var e,t=1;hr.length;)hr.length>t&&hr.sort(Tv),e=hr.shift(),t=hr.length,ZT(e)}finally{hr.length=zc.__r=0}}function Lv(e,t,n,i,r,o,a,s,c,u,l){var p,f,d,h,m,g,R=i&&i.__k||Bc,E=t.length;for(c=QT(n,t,R,c,E),p=0;p<E;p++)(d=n.__k[p])!=null&&(f=d.__i!=-1&&R[d.__i]||Nc,d.__i=p,g=tf(e,d,f,r,o,a,s,c,u,l),h=d.__e,d.ref&&f.ref!=d.ref&&(f.ref&&nf(f.ref,null,d),l.push(d.ref,d.__c||h,d)),m==null&&h!=null&&(m=h),4&d.__u?(c=Iv(d,c,e),f.__e&&(f.__e=null)):typeof d.type=="function"&&g!==void 0?c=g:h&&(c=h.nextSibling),d.__u&=-7);return n.__e=m,c}function QT(e,t,n,i,r){var o,a,s,c,u,l=n.length,p=l,f=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]=jc(null,a,null,null,null):$c(a)?a=e.__k[o]=jc(Fc,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=jc(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[o]=a,c=o+f,a.__=e,a.__b=e.__b+1,s=null,(u=a.__i=JT(a,n,c,p))!=-1&&(p--,(s=n[u])&&(s.__u|=2)),s==null||s.__v==null?(u==-1&&(r>l?f--:r<l&&f++),typeof a.type!="function"&&(a.__u|=4)):u!=c&&(u==c-1?f--:u==c+1?f++:(u>c?f--:f++,a.__u|=4))):e.__k[o]=null;if(p)for(o=0;o<l;o++)(s=n[o])!=null&&(2&s.__u)==0&&(s.__e==i&&(i=Hr(s)),Hv(s,s));return i}function Iv(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=Iv(i[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=Hr(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function JT(e,t,n,i){var r,o,a,s=e.key,c=e.type,u=t[n],l=u!=null&&(2&u.__u)==0;if(u===null&&s==null||l&&s==u.key&&c==u.type)return n;if(i>(l?1:0)){for(r=n-1,o=n+1;r>=0||o<t.length;)if((u=t[a=r>=0?r--:o++])!=null&&(2&u.__u)==0&&s==u.key&&c==u.type)return a}return-1}function Nv(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||XT.test(t)?n:n+"px"}function Vc(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||Nv(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||Nv(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(Mv,"$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[ka]=i[ka]:(n[ka]=Zp,e.addEventListener(t,o?Jp:Qp,o)):e.removeEventListener(t,o?Jp:Qp,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 Bv(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Ic]==null)t[Ic]=Zp++;else if(t[Ic]<n[ka])return;return n(gt.event?gt.event(t):t)}}}function tf(e,t,n,i,r,o,a,s,c,u){var l,p,f,d,h,m,g,R,E,x,b,w,T,L,A,F,H=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[s=t.__e=n.__e]),(l=gt.__b)&&l(t);e:if(typeof H=="function"){p=a.length;try{if(E=t.props,x=H.prototype&&H.prototype.render,b=(l=H.contextType)&&i[l.__c],w=l?b?b.props.value:l.__:i,n.__c?R=(f=t.__c=n.__c).__=f.__E:(x?t.__c=f=new H(E,w):(t.__c=f=new Hc(E,w),f.constructor=H,f.render=tM),b&&b.sub(f),f.state||(f.state={}),f.__n=i,d=f.__d=!0,f.__h=[],f._sb=[]),x&&f.__s==null&&(f.__s=f.state),x&&H.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=Ii({},f.__s)),Ii(f.__s,H.getDerivedStateFromProps(E,f.__s))),h=f.props,m=f.state,f.__v=t,d)x&&H.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),x&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(x&&H.getDerivedStateFromProps==null&&E!==h&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(E,w),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(E,f.__s,w)===!1){t.__v!=n.__v&&(f.props=E,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(N){N&&(N.__=t)}),Bc.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&a.push(f),s=Hr(n);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(E,f.__s,w),x&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(h,m,g)})}if(f.context=w,f.props=E,f.__P=e,f.__e=!1,T=gt.__r,L=0,x)f.state=f.__s,f.__d=!1,T&&T(t),l=f.render(f.props,f.state,f.context),Bc.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,T&&T(t),l=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++L<25);f.state=f.__s,f.getChildContext!=null&&(i=Ii(Ii({},i),f.getChildContext())),x&&!d&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(h,m)),A=l!=null&&l.type===Fc&&l.key==null?Fv(l.props.children):l,s=Lv(e,$c(A)?A:[A],t,n,i,r,o,a,s,c,u),f.base=t.__e,t.__u&=-161,f.__h.length&&a.push(f),R&&(f.__E=f.__=null)}catch(N){if(a.length=p,t.__v=null,c||o!=null){if(N.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(F=o.length;F--;)ef(o[F])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),N.then||$v(t),gt.__e(N,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=eM(n.__e,t,n,i,r,o,a,c,u);return(l=gt.diffed)&&l(t),128&t.__u?void 0:s}function $v(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some($v))}function jv(e,t,n){for(var i=0;i<n.length;i++)nf(n[i],n[++i],n[++i]);gt.__c&>.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){gt.__e(o,r.__v)}})}function Fv(e){return typeof e!="object"||e==null||e.__b>0?e:$c(e)?e.map(Fv):e.constructor!==void 0?null:Ii({},e)}function eM(e,t,n,i,r,o,a,s,c){var u,l,p,f,d,h,m,g=n.props||Nc,R=t.props,E=t.type;if(E=="svg"?r="http://www.w3.org/2000/svg":E=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),o!=null){for(u=0;u<o.length;u++)if((d=o[u])&&"setAttribute"in d==!!E&&(E?d.localName==E:d.nodeType==3)){e=d,o[u]=null;break}}if(e==null){if(E==null)return document.createTextNode(R);e=document.createElementNS(r,E,R.is&&R),s&&(gt.__m&>.__m(t,o),s=!1),o=null}if(E==null)g===R||s&&e.data==R||(e.data=R);else{if(o=E=="textarea"&&R.defaultValue!=null?null:o&&Lc.call(e.childNodes),!s&&o!=null)for(g={},u=0;u<e.attributes.length;u++)g[(d=e.attributes[u]).name]=d.value;for(u in g)d=g[u],u=="dangerouslySetInnerHTML"?p=d:u=="children"||u in R||u=="value"&&"defaultValue"in R||u=="checked"&&"defaultChecked"in R||Vc(e,u,null,d,r);for(u in R)d=R[u],u=="children"?f=d:u=="dangerouslySetInnerHTML"?l=d:u=="value"?h=d:u=="checked"?m=d:s&&typeof d!="function"||g[u]===d||Vc(e,u,d,g[u],r);if(l)s||p&&(l.__html==p.__html||l.__html==e.innerHTML)||(e.innerHTML=l.__html),t.__k=[];else if(p&&(e.innerHTML=""),Lv(t.type=="template"?e.content:e,$c(f)?f:[f],t,n,i,E=="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,a,o?o[0]:n.__k&&Hr(n,0),s,c),o!=null)for(u=o.length;u--;)ef(o[u]);s&&E!="textarea"||(u="value",E=="progress"&&h==null?e.removeAttribute("value"):h!=null&&(h!==e[u]||E=="progress"&&!h||E=="option"&&h!=g[u])&&Vc(e,u,h,g[u],r),u="checked",m!=null&&m!=e[u]&&Vc(e,u,m,g[u],r))}return e}function nf(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){gt.__e(r,n)}}function Hv(e,t,n){var i,r;if(gt.unmount&>.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||nf(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){gt.__e(o,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&Hv(i[r],t,n||typeof e.type!="function");n||ef(e.__e),e.__c=e.__=e.__e=void 0}function tM(e,t,n){return this.constructor(e,n)}function zv(e,t,n){var i,r,o,a;t==document&&(t=document.documentElement),gt.__&>.__(e,t),r=(i=!1)?null:t.__k,o=[],a=[],tf(t,e=t.__k=kv(Fc,null,[e]),r||Nc,Nc,t.namespaceURI,r?null:t.firstChild?Lc.call(t.childNodes):null,o,r?r.__e:t.firstChild,i,a),jv(o,e,a),e.props.children=null}Lc=Bc.slice,gt={__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}},Cv=0,Hc.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Ii({},this.state),typeof e=="function"&&(e=e(Ii({},n),this.props)),e&&Ii(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Ov(this))},Hc.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Ov(this))},Hc.prototype.render=Fc,hr=[],Av=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Tv=function(e,t){return e.__v.__b-t.__v.__b},zc.__r=0,Xp=Math.random().toString(8),Ic="__d"+Xp,ka="__a"+Xp,Mv=/(PointerCapture)$|Capture$/i,Zp=0,Qp=Bv(!1),Jp=Bv(!0);var Vv=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,Vv(e,s,n,["",null])),i.push(r),s[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(s)}return i},Gv=new Map;function nM(e){var t=Gv.get(this);return t||(t=new Map,Gv.set(this,t)),(t=Vv(this,t.get(e)||(t.set(e,t=(function(n){for(var i,r,o=1,a="",s="",c=[0],u=function(f){o===1&&(f||(a=a.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?c.push(0,f,a):o===3&&(f||a)?(c.push(3,f,a),o=2):o===2&&a==="..."&&f?c.push(4,f,0):o===2&&a&&!f?c.push(5,0,!0,a):o>=5&&((a||!f&&o===5)&&(c.push(o,0,a,r),o=6),f&&(c.push(o,f,0,r),o=6)),a=""},l=0;l<n.length;l++){l&&(o===1&&u(),u(l));for(var p=0;p<n[l].length;p++)i=n[l][p],o===1?i==="<"?(u(),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===">"?(u(),o=1):o&&(i==="="?(o=5,r=a,a=""):i==="/"&&(o<5||n[l][p+1]===">")?(u(),o===3&&(c=c[0]),o=c,(c=c[0]).push(2,0,o),o=0):i===" "||i===" "||i===`
|
|
11
|
+
`||i==="\r"?(u(),o=2):a+=i),o===3&&a==="!--"&&(o=4,c=c[0])}return u(),c})(e)),t),arguments,[])).length>1?t:t[0]}var ot=nM.bind(kv),Ao,At,rf,Wv,Da=0,Uv=[],Bt=gt,qv=Bt.__b,Yv=Bt.__r,Kv=Bt.diffed,Xv=Bt.__c,Zv=Bt.unmount,Qv=Bt.__;function Gc(e,t){Bt.__h&&Bt.__h(At,e,Da||t),Da=0;var n=At.__H||(At.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function of(e){return Da=1,iM(e_,e)}function iM(e,t,n){var i=Gc(Ao++,2);if(i.t=e,!i.__c&&(i.__=[e_(void 0,t),function(s){var c=i.__N?i.__N[0]:i.__[0],u=i.t(c,s);c!==u&&(i.__N=[u,i.__[1]],i.__c.setState({}))}],i.__c=At,!At.__f)){var r=function(s,c,u){if(!i.__c.__H)return!0;var l=!1,p=i.__c.props!==s;if(i.__c.__H.__.some(function(d){if(d.__N){l=!0;var h=d.__[0];d.__=d.__N,d.__N=void 0,h!==d.__[0]&&(p=!0)}}),o){var f=o.call(this,s,c,u);return l?f||p:f}return!l||p};At.__f=!0;var o=At.shouldComponentUpdate,a=At.componentWillUpdate;At.componentWillUpdate=function(s,c,u){if(this.__e){var l=o;o=void 0,r(s,c,u),o=l}a&&a.call(this,s,c,u)},At.shouldComponentUpdate=r}return i.__N||i.__}function Wc(e,t){var n=Gc(Ao++,3);!Bt.__s&&cf(n.__H,t)&&(n.__=e,n.u=t,At.__H.__h.push(n))}function af(e,t){var n=Gc(Ao++,4);!Bt.__s&&cf(n.__H,t)&&(n.__=e,n.u=t,At.__h.push(n))}function Uc(e){return Da=5,Ni(function(){return{current:e}},[])}function Ni(e,t){var n=Gc(Ao++,7);return cf(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Oa(e,t){return Da=8,Ni(function(){return e},t)}function rM(){for(var e;e=Uv.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(qc),t.__h.some(sf),t.__h=[]}catch(n){t.__h=[],Bt.__e(n,e.__v)}}}Bt.__b=function(e){At=null,qv&&qv(e)},Bt.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Qv&&Qv(e,t)},Bt.__r=function(e){Yv&&Yv(e),Ao=0;var t=(At=e.__c).__H;t&&(rf===At?(t.__h=[],At.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(qc),t.__h.some(sf),t.__h=[],Ao=0)),rf=At},Bt.diffed=function(e){Kv&&Kv(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Uv.push(t)!==1&&Wv===Bt.requestAnimationFrame||((Wv=Bt.requestAnimationFrame)||oM)(rM)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),rf=At=null},Bt.__c=function(e,t){t.some(function(n){try{n.__h.some(qc),n.__h=n.__h.filter(function(i){return!i.__||sf(i)})}catch(i){t.some(function(r){r.__h&&(r.__h=[])}),t=[],Bt.__e(i,n.__v)}}),Xv&&Xv(e,t)},Bt.unmount=function(e){Zv&&Zv(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{qc(i)}catch(r){t=r}}),n.__H=void 0,t&&Bt.__e(t,n.__v))};var Jv=typeof requestAnimationFrame=="function";function oM(e){var t,n=function(){clearTimeout(i),Jv&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);Jv&&(t=requestAnimationFrame(n))}function qc(e){var t=At,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),At=t}function sf(e){var t=At;e.__c=e.__(),At=t}function cf(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function e_(e,t){return typeof t=="function"?t(e):t}function aM(e){const{navigationStack:t,setNavigationStack:n}=e,i=Ni(()=>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 ot`
|
|
11
12
|
<div class="djs-popup-breadcrumbs">
|
|
12
|
-
${r&&
|
|
13
|
+
${r&&ot`
|
|
13
14
|
<button
|
|
14
15
|
type="button"
|
|
15
16
|
class="djs-popup-breadcrumbs-item djs-popup-breadcrumbs-item--back"
|
|
@@ -22,7 +23,7 @@
|
|
|
22
23
|
</svg>
|
|
23
24
|
</button>
|
|
24
25
|
`}
|
|
25
|
-
${i.map((a,s)=>
|
|
26
|
+
${i.map((a,s)=>ot`
|
|
26
27
|
<button
|
|
27
28
|
key=${s}
|
|
28
29
|
type="button"
|
|
@@ -34,46 +35,46 @@
|
|
|
34
35
|
</button>
|
|
35
36
|
<span class="djs-popup-breadcrumbs-item--separator" aria-hidden="true"></span>
|
|
36
37
|
`)}
|
|
37
|
-
${o&&
|
|
38
|
+
${o&&ot`
|
|
38
39
|
<span class="djs-popup-breadcrumbs-item djs-popup-breadcrumbs-item--current" title=${o}>
|
|
39
40
|
${o}
|
|
40
41
|
</span>
|
|
41
42
|
`}
|
|
42
43
|
</div>
|
|
43
|
-
`}function
|
|
44
|
+
`}function t_(e){var t,n,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(n=t_(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function Yc(){for(var e,t,n=0,i="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=t_(e))&&(i&&(i+=" "),i+=t);return i}function sM(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:r,title:o}=e,a=Ni(()=>cM(t),[t]),s=u=>u.action&&!u.disabled,c=(u,l)=>{if(s(l))return n(u,l)};return ot`
|
|
44
45
|
<div class="djs-popup-header">
|
|
45
46
|
<h3 class="djs-popup-title" title=${o}>${o}</h3>
|
|
46
|
-
${a.map(u=>
|
|
47
|
+
${a.map(u=>ot`
|
|
47
48
|
<ul key=${u.id} class="djs-popup-header-group" data-header-group=${u.id}>
|
|
48
49
|
|
|
49
|
-
${u.entries.map(
|
|
50
|
-
<li key=${
|
|
51
|
-
<${s(
|
|
52
|
-
class=${
|
|
53
|
-
onClick=${
|
|
54
|
-
title=${
|
|
55
|
-
data-id=${
|
|
56
|
-
aria-disabled=${
|
|
57
|
-
onMouseEnter=${()=>s(
|
|
58
|
-
onMouseLeave=${()=>s(
|
|
59
|
-
onFocus=${()=>s(
|
|
60
|
-
onBlur=${()=>s(
|
|
50
|
+
${u.entries.map(l=>ot`
|
|
51
|
+
<li key=${l.id}>
|
|
52
|
+
<${s(l)?"button":"span"}
|
|
53
|
+
class=${uM(l,l===i)}
|
|
54
|
+
onClick=${p=>c(p,l)}
|
|
55
|
+
title=${l.title||l.label}
|
|
56
|
+
data-id=${l.id}
|
|
57
|
+
aria-disabled=${l.disabled||void 0}
|
|
58
|
+
onMouseEnter=${()=>s(l)&&r(l)}
|
|
59
|
+
onMouseLeave=${()=>s(l)&&r(null)}
|
|
60
|
+
onFocus=${()=>s(l)&&r(l)}
|
|
61
|
+
onBlur=${()=>s(l)&&r(null)}
|
|
61
62
|
>
|
|
62
|
-
${
|
|
63
|
-
${
|
|
64
|
-
<span class="djs-popup-label">${
|
|
63
|
+
${l.imageUrl&&ot`<img class="djs-popup-entry-icon" src=${l.imageUrl} alt="" />`||l.imageHtml&&ot`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:l.imageHtml}} />`}
|
|
64
|
+
${l.label?ot`
|
|
65
|
+
<span class="djs-popup-label">${l.label}</span>
|
|
65
66
|
`:null}
|
|
66
|
-
</${
|
|
67
|
+
</${l.action?"button":"span"}>
|
|
67
68
|
</li>
|
|
68
69
|
`)}
|
|
69
70
|
</ul>
|
|
70
71
|
`)}
|
|
71
72
|
</div>
|
|
72
|
-
`}function
|
|
73
|
+
`}function cM(e){return e.reduce((t,n)=>{const i=n.group||"default",r=t.find(o=>o.id===i);return r?r.entries.push(n):t.push({id:i,entries:[n]}),t},[])}function uM(e,t){return Yc("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function n_(e,t){return`${e}-entry-${t.id}`}function lM(e){const{idPrefix:t,entry:n,selected:i,onMouseEnter:r,onMouseLeave:o,onAction:a}=e,s=(u,l)=>{if(!n.disabled)return a(u,n,l)},c=!n.entries;return ot`
|
|
73
74
|
<li
|
|
74
|
-
class=${
|
|
75
|
+
class=${Yc("entry",{selected:i,disabled:n.disabled})}
|
|
75
76
|
data-id=${n.id}
|
|
76
|
-
id=${
|
|
77
|
+
id=${n_(t,n)}
|
|
77
78
|
role="option"
|
|
78
79
|
aria-selected=${i||void 0}
|
|
79
80
|
aria-haspopup=${n.entries?"true":void 0}
|
|
@@ -87,17 +88,17 @@
|
|
|
87
88
|
>
|
|
88
89
|
<div class="djs-popup-entry-content">
|
|
89
90
|
<span
|
|
90
|
-
class=${
|
|
91
|
+
class=${Yc("djs-popup-entry-name",n.className)}
|
|
91
92
|
>
|
|
92
|
-
${n.imageUrl&&
|
|
93
|
+
${n.imageUrl&&ot`<img class="djs-popup-entry-icon" src=${n.imageUrl} alt="" />`||n.imageHtml&&ot`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:n.imageHtml}} />`}
|
|
93
94
|
|
|
94
|
-
${n.label?
|
|
95
|
+
${n.label?ot`
|
|
95
96
|
<span class="djs-popup-label">
|
|
96
97
|
${n.label}
|
|
97
98
|
</span>
|
|
98
99
|
`:null}
|
|
99
100
|
|
|
100
|
-
${n.documentationRef&&
|
|
101
|
+
${n.documentationRef&&ot`
|
|
101
102
|
<a
|
|
102
103
|
class="djs-popup-entry-docs"
|
|
103
104
|
href=${n.documentationRef}
|
|
@@ -114,7 +115,7 @@
|
|
|
114
115
|
</a>
|
|
115
116
|
`}
|
|
116
117
|
</span>
|
|
117
|
-
${n.description&&
|
|
118
|
+
${n.description&&ot`
|
|
118
119
|
<span
|
|
119
120
|
class="djs-popup-entry-description"
|
|
120
121
|
>
|
|
@@ -122,7 +123,7 @@
|
|
|
122
123
|
</span>
|
|
123
124
|
`}
|
|
124
125
|
</div>
|
|
125
|
-
${n.entries&&
|
|
126
|
+
${n.entries&&ot`
|
|
126
127
|
<div class="djs-popup-entry-chevron" aria-hidden="true">
|
|
127
128
|
<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
128
129
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M3.96967 1.46967C4.26256 1.17678 4.73744 1.17678 5.03033 1.46967L9.03033 5.46967C9.32322 5.76256 9.32322 6.23744 9.03033 6.53033L5.03033 10.5303C4.73744 10.8232 4.26256 10.8232 3.96967 10.5303C3.67678 10.2374 3.67678 9.76256 3.96967 9.46967L7.43934 6L3.96967 2.53033C3.67678 2.23744 3.67678 1.76256 3.96967 1.46967Z" fill="currentColor"/>
|
|
@@ -130,10 +131,10 @@
|
|
|
130
131
|
</div>
|
|
131
132
|
`}
|
|
132
133
|
</li>
|
|
133
|
-
`}function
|
|
134
|
+
`}function pM(e){const{selectedEntry:t,setSelectedEntry:n,groupedEntries:i,keyboardSelection:r,idPrefix:o,id:a,ariaLabel:s,tabIndex:c,ariaActivedescendant:u,...l}=e,p=Uc();af(()=>{if(!r||!r.current)return;const m=p.current;if(!m)return;const g=m.querySelector(".selected");g&&fM(g)},[t]);const f=()=>{r.current=!1},d=m=>{r.current||n(m)},h=()=>{r.current||n(null)};return ot`
|
|
134
135
|
<div
|
|
135
136
|
class="djs-popup-results"
|
|
136
|
-
ref=${
|
|
137
|
+
ref=${p}
|
|
137
138
|
id=${a}
|
|
138
139
|
role="listbox"
|
|
139
140
|
aria-label=${s}
|
|
@@ -141,62 +142,62 @@
|
|
|
141
142
|
aria-activedescendant=${u}
|
|
142
143
|
onMouseMove=${f}
|
|
143
144
|
>
|
|
144
|
-
${i.map(
|
|
145
|
-
${
|
|
146
|
-
<div key=${
|
|
147
|
-
${
|
|
145
|
+
${i.map(m=>ot`
|
|
146
|
+
${m.name&&ot`
|
|
147
|
+
<div key=${m.id} id=${i_(o,m)} class="entry-header" title=${m.name}>
|
|
148
|
+
${m.name}
|
|
148
149
|
</div>
|
|
149
150
|
`}
|
|
150
151
|
<ul
|
|
151
152
|
class="djs-popup-group"
|
|
152
|
-
data-group=${
|
|
153
|
+
data-group=${m.id}
|
|
153
154
|
role="group"
|
|
154
|
-
aria-labelledby=${
|
|
155
|
+
aria-labelledby=${m.name?i_(o,m):void 0}
|
|
155
156
|
>
|
|
156
|
-
${
|
|
157
|
-
<${
|
|
158
|
-
key=${
|
|
157
|
+
${m.entries.map(g=>ot`
|
|
158
|
+
<${lM}
|
|
159
|
+
key=${g.id}
|
|
159
160
|
idPrefix=${o}
|
|
160
|
-
entry=${
|
|
161
|
-
selected=${
|
|
162
|
-
onMouseEnter=${()=>d(
|
|
161
|
+
entry=${g}
|
|
162
|
+
selected=${g===t}
|
|
163
|
+
onMouseEnter=${()=>d(g)}
|
|
163
164
|
onMouseLeave=${h}
|
|
164
|
-
...${
|
|
165
|
+
...${l}
|
|
165
166
|
/>
|
|
166
167
|
`)}
|
|
167
168
|
</ul>
|
|
168
169
|
`)}
|
|
169
170
|
</div>
|
|
170
|
-
`}function
|
|
171
|
-
<${
|
|
171
|
+
`}function i_(e,t){return`${e}-group-${t.id}`}function fM(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const dM=new xo("djs-popup");function hM(e){const{onClose:t,onSelect:n,className:i,headerEntries:r,position:o,title:a,width:s,scale:c,search:u,emptyPlaceholder:l,searchFn:p,entries:f,onOpened:d,onClosed:h}=e,[m,g]=of([]);Wc(()=>{g([])},[f]);const[R,E]=of(""),x=R.trim().length>0,b=Ni(()=>yM(f),[f]),w=Ni(()=>Ot(u)?b.length>5:!1,[u,b]),T=Ni(()=>{const $=m.length?m[m.length-1].entries:f;return w?x?p(b.filter(({searchable:B})=>B!==!1),R,{keys:["label","search","description"]}).map(({item:B})=>B):$.filter(({rank:B=0})=>B>=0):$},[w,x,b,R,p,m,f]),L=Ni(()=>x?T.length?[{id:"default",entries:T}]:[]:vM(T),[T,x]),[A,F]=of(T[0]),H=Uc(null),N=Uc(!1),z=Ni(()=>dM.next(),[]),ue=`${z}-results`,je=A&&n_(z,A);Wc(()=>{const $=H.current;$&&T.includes($)?F($):F(T[0]),H.current=null},[T]);const tt=Oa($=>{const B=gM(L);let Ae=B.indexOf(A)+$;Ae<0&&(Ae=B.length-1),Ae>=B.length&&(Ae=0),N.current=!0,F(B[Ae])},[L,A]),X=Oa($=>{$>0&&A&&A.entries&&(N.current=!0,g(B=>[...B,A])),$<0&&m.length>0&&(N.current=!0,H.current=m[m.length+$],g(B=>B.slice(0,$)))},[A,m]),se=Oa(($,B,U)=>{if(!(!B||B.disabled))return B.entries?($.preventDefault(),X(1)):n($,B,U)},[n,X]),fe=Oa($=>{if($.key==="Enter"&&A){const B=$.target;return!!Ar(B,"a, button",!0)||A.disabled?void 0:se($,A)}if($.key==="Backspace"){const B=$.target;if(!(Gu(B,"input")&&B.value!==""))return X(-1),$.preventDefault()}if($.key==="ArrowUp")return tt(-1),$.preventDefault();if($.key==="ArrowDown")return tt(1),$.preventDefault();if($.key==="ArrowRight")return X(1),$.preventDefault();if($.key==="ArrowLeft")return X(-1),$.preventDefault()},[A,tt,X,se]),oe=Oa($=>{Gu($.target,"input")&&E(()=>$.target.value)},[E]);Wc(()=>(d(),()=>{h()}),[]);const de=!x&&m.length>0,ee=(a||r.length>0)&&!de;return ot`
|
|
172
|
+
<${r_}
|
|
172
173
|
onClose=${t}
|
|
173
|
-
onKeyup=${
|
|
174
|
-
onKeydown=${
|
|
174
|
+
onKeyup=${oe}
|
|
175
|
+
onKeydown=${fe}
|
|
175
176
|
className=${i}
|
|
176
177
|
position=${o}
|
|
177
178
|
width=${s}
|
|
178
179
|
scale=${c}
|
|
179
|
-
navigationStack=${
|
|
180
|
+
navigationStack=${m}
|
|
180
181
|
>
|
|
181
|
-
${
|
|
182
|
-
<${
|
|
182
|
+
${ee&&ot`
|
|
183
|
+
<${sM}
|
|
183
184
|
headerEntries=${r}
|
|
184
185
|
onSelect=${n}
|
|
185
|
-
selectedEntry=${
|
|
186
|
+
selectedEntry=${A}
|
|
186
187
|
setSelectedEntry=${F}
|
|
187
188
|
title=${a}
|
|
188
189
|
/>
|
|
189
190
|
`}
|
|
190
|
-
${
|
|
191
|
-
<${
|
|
192
|
-
navigationStack=${
|
|
193
|
-
setNavigationStack=${
|
|
191
|
+
${de&&ot`
|
|
192
|
+
<${aM}
|
|
193
|
+
navigationStack=${m}
|
|
194
|
+
setNavigationStack=${g}
|
|
194
195
|
/>
|
|
195
196
|
`}
|
|
196
|
-
${f.length>0&&
|
|
197
|
+
${f.length>0&&ot`
|
|
197
198
|
<div class="djs-popup-body">
|
|
198
199
|
|
|
199
|
-
${
|
|
200
|
+
${w&&ot`
|
|
200
201
|
<div class="djs-popup-search">
|
|
201
202
|
<svg class="djs-popup-search-icon" width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
202
203
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.0325 8.5H9.625L13.3675 12.25L12.25 13.3675L8.5 9.625V9.0325L8.2975 8.8225C7.4425 9.5575 6.3325 10 5.125 10C2.4325 10 0.25 7.8175 0.25 5.125C0.25 2.4325 2.4325 0.25 5.125 0.25C7.8175 0.25 10 2.4325 10 5.125C10 6.3325 9.5575 7.4425 8.8225 8.2975L9.0325 8.5ZM1.75 5.125C1.75 6.9925 3.2575 8.5 5.125 8.5C6.9925 8.5 8.5 6.9925 8.5 5.125C8.5 3.2575 6.9925 1.75 5.125 1.75C3.2575 1.75 1.75 3.2575 1.75 5.125Z" fill="#22242A"/>
|
|
@@ -207,39 +208,39 @@
|
|
|
207
208
|
role="combobox"
|
|
208
209
|
aria-label="${a||"Search"}"
|
|
209
210
|
aria-expanded="true"
|
|
210
|
-
aria-controls=${
|
|
211
|
-
aria-activedescendant=${
|
|
211
|
+
aria-controls=${ue}
|
|
212
|
+
aria-activedescendant=${je||void 0}
|
|
212
213
|
aria-autocomplete="list"
|
|
213
214
|
/>
|
|
214
215
|
</div>
|
|
215
216
|
`}
|
|
216
217
|
|
|
217
|
-
${
|
|
218
|
+
${x&&ot`
|
|
218
219
|
<div class="djs-popup-search-count" aria-live="polite">
|
|
219
220
|
${T.length} ${T.length===1?"result":"results"} found
|
|
220
221
|
</div>
|
|
221
222
|
`}
|
|
222
223
|
|
|
223
|
-
<${
|
|
224
|
-
groupedEntries=${
|
|
225
|
-
selectedEntry=${
|
|
224
|
+
<${pM}
|
|
225
|
+
groupedEntries=${L}
|
|
226
|
+
selectedEntry=${A}
|
|
226
227
|
setSelectedEntry=${F}
|
|
227
|
-
keyboardSelection=${
|
|
228
|
-
onAction=${
|
|
229
|
-
idPrefix=${
|
|
230
|
-
id=${
|
|
228
|
+
keyboardSelection=${N}
|
|
229
|
+
onAction=${se}
|
|
230
|
+
idPrefix=${z}
|
|
231
|
+
id=${ue}
|
|
231
232
|
ariaLabel=${a||"Results"}
|
|
232
|
-
tabIndex=${
|
|
233
|
-
ariaActivedescendant=${
|
|
233
|
+
tabIndex=${w?-1:0}
|
|
234
|
+
ariaActivedescendant=${w?void 0:je||void 0}
|
|
234
235
|
/>
|
|
235
236
|
|
|
236
|
-
${
|
|
237
|
+
${A&&A.documentationRef&&ot`
|
|
237
238
|
<div class="djs-popup-footer">
|
|
238
239
|
<a
|
|
239
240
|
class="djs-popup-footer-docs"
|
|
240
|
-
href=${
|
|
241
|
-
onClick=${
|
|
242
|
-
aria-label=${
|
|
241
|
+
href=${A.documentationRef}
|
|
242
|
+
onClick=${$=>$.stopPropagation()}
|
|
243
|
+
aria-label=${A.label?`Open entry documentation for ${A.label}`:"Open entry documentation"}
|
|
243
244
|
target="_blank"
|
|
244
245
|
rel="noopener"
|
|
245
246
|
>
|
|
@@ -253,14 +254,14 @@
|
|
|
253
254
|
`}
|
|
254
255
|
</div>
|
|
255
256
|
`}
|
|
256
|
-
${
|
|
257
|
-
<div class="djs-popup-no-results">${
|
|
257
|
+
${l&&T.length===0&&ot`
|
|
258
|
+
<div class="djs-popup-no-results">${zt(l)?l(R):l}</div>
|
|
258
259
|
`}
|
|
259
|
-
</${
|
|
260
|
-
`}function
|
|
260
|
+
</${r_}>
|
|
261
|
+
`}function r_(e){const{onClose:t,onKeydown:n,onKeyup:i,className:r,children:o,navigationStack:a,position:s}=e,c=Uc();return af(()=>{if(typeof s!="function")return;const u=c.current,l=s(u);u.style.left=`${l.x}px`,u.style.top=`${l.y}px`},[c.current,s]),af(()=>{const u=c.current;if(!u)return;(u.querySelector("input")||u.querySelector('[role="listbox"]')||u).focus()},[a]),Wc(()=>{const u=p=>{if(p.key==="Escape")return p.preventDefault(),t()},l=p=>{if(!Ar(p.target,".djs-popup",!0))return t()};return document.documentElement.addEventListener("keydown",u),document.body.addEventListener("click",l,!0),()=>{document.documentElement.removeEventListener("keydown",u),document.body.removeEventListener("click",l,!0)}},[]),ot`
|
|
261
262
|
<div
|
|
262
|
-
class=${
|
|
263
|
-
style=${
|
|
263
|
+
class=${Yc("djs-popup",r)}
|
|
264
|
+
style=${mM(e)}
|
|
264
265
|
onKeydown=${n}
|
|
265
266
|
onKeyup=${i}
|
|
266
267
|
ref=${c}
|
|
@@ -268,8 +269,8 @@
|
|
|
268
269
|
>
|
|
269
270
|
${o}
|
|
270
271
|
</div>
|
|
271
|
-
`}function
|
|
272
|
-
<${
|
|
272
|
+
`}function mM(e){const{width:t}=e,n=typeof t=="number"?`${t}px`:t;return{transform:`scale(${e.scale})`,width:Ot(t)?n:void 0,maxWidth:Ot(t)?"unset":void 0,"transform-origin":"top left"}}function gM(e){const t=[];return e.forEach(n=>{n.entries.forEach(i=>{t.push(i)})}),t}function yM(e){const t=[];function n(i){i.forEach(r=>{if(r.entries){n(r.entries);return}t.push(r)})}return n(e),t}function vM(e){const t=[],n=o=>t.find(a=>o.id===a.id),i=o=>!!n(o),r=o=>typeof o=="string"?{id:o}:o;return e.forEach(o=>{const a=o.group?r(o.group):{id:"default"};i(a)?n(a).entries.push(o):t.push({...a,entries:[o]})}),t}var _M="data-id",o_=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],bM=1e3;function yt(e,t,n,i){this._eventBus=t,this._canvas=n,this._search=i,this._current=null;var r=Ot(e&&e.scale)?e.scale:{min:1,max:1};this._config={scale:r},t.on("diagram.destroy",()=>{this.close()}),t.on("element.changed",o=>{const a=this.isOpen()&&this._current.target;o.element===a&&this.refresh()})}yt.$inject=["config.popupMenu","eventBus","canvas","search"],yt.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:i,emptyPlaceholder:r,options:o}=this._current,a=a_(n),s=Object.entries(i).map(([f,d])=>({id:f,...d})),c=e&&(f=>this._ensureVisible(f,e)),u=this._updateScale(this._current.container);zv(ot`
|
|
273
|
+
<${hM}
|
|
273
274
|
onClose=${f=>this.close(f)}
|
|
274
275
|
onSelect=${(f,d,h)=>this.trigger(f,d,h)}
|
|
275
276
|
position=${c}
|
|
@@ -283,7 +284,7 @@
|
|
|
283
284
|
searchFn=${this._search}
|
|
284
285
|
...${{...o}}
|
|
285
286
|
/>
|
|
286
|
-
`,this._current.container)},
|
|
287
|
+
`,this._current.container)},yt.prototype.open=function(e,t,n,i){if(!e)throw new Error("target is missing");if(!t)throw new Error("providers for <"+t+"> not found");if(!n)throw new Error("position is missing");var r=this._eventBus.fire("popupMenu.open.allowed",{target:e,providerId:t});if(r===!1)return;this.isOpen()&&this.close();const{entries:o,headerEntries:a,emptyPlaceholder:s}=this._getContext(e,t);this._current={position:n,providerId:t,target:e,entries:o,headerEntries:a,emptyPlaceholder:s,container:this._createContainer({provider:t}),options:i},this._emit("open"),this._bindAutoClose(),this._render()},yt.prototype.refresh=function(){if(!this.isOpen())return;const{target:e,providerId:t}=this._current,{entries:n,headerEntries:i,emptyPlaceholder:r}=this._getContext(e,t);this._current={...this._current,entries:n,headerEntries:i,emptyPlaceholder:r},this._emit("refresh"),this._render()},yt.prototype._getContext=function(e,t){const n=this._getProviders(t);if(!n||!n.length)throw new Error("provider for <"+t+"> not found");const i=this._getEntries(e,n),r=this._getHeaderEntries(e,n),o=this._getEmptyPlaceholder(n);return{entries:i,headerEntries:r,emptyPlaceholder:o,empty:!(Object.keys(i).length||Object.keys(r).length)}},yt.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},yt.prototype.reset=function(){const e=this._current.container;zv(null,e),li(e)},yt.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},yt.prototype._onOpened=function(){this._emit("opened")},yt.prototype._onClosed=function(){this._emit("closed")},yt.prototype._createContainer=function(e){var t=this._canvas,n=t.getContainer();const i=ut(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return n.appendChild(i),i},yt.prototype._bindAutoClose=function(){this._eventBus.once(o_,this.close,this)},yt.prototype._unbindAutoClose=function(){this._eventBus.off(o_,this.close,this)},yt.prototype._updateScale=function(){var e=this._canvas.zoom(),t=this._config.scale,n,i,r=e;return t!==!0&&(t===!1?(n=1,i=1):(n=t.min,i=t.max),Ot(n)&&e<n&&(r=n),Ot(i)&&e>i&&(r=i)),r},yt.prototype._ensureVisible=function(e,t){var n=document.documentElement.getBoundingClientRect(),i=e.getBoundingClientRect(),r={},o=t.x,a=t.y;return t.x+i.width>n.width&&(r.x=!0),t.y+i.height>n.height&&(r.y=!0),r.x&&r.y?(o=t.x-i.width,a=t.y-i.height):r.x?(o=t.x-i.width,a=t.y):r.y&&t.y<i.height?(o=t.x,a=10):r.y&&(o=t.x,a=t.y-i.height),t.y<n.top&&(a=t.y+i.height),{x:o,y:a}},yt.prototype.isEmpty=function(e,t){if(!e)throw new Error("target is missing");if(!t)throw new Error("provider ID is missing");const n=this._getProviders(t);return!n||!n.length?!0:this._getContext(e,t).empty},yt.prototype.registerProvider=function(e,t,n){n||(n=t,t=bM),this._eventBus.on("popupMenu.getProviders."+e,t,function(i){i.providers.push(n)})},yt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},yt.prototype._getEntries=function(e,t){var n={};return M(t,function(i){if(!i.getPopupMenuEntries){M(i.getEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=oi(o,["id"])});return}var r=i.getPopupMenuEntries(e);zt(r)?n=r(n):M(r,function(o,a){n[a]=o})}),n},yt.prototype._getHeaderEntries=function(e,t){var n={};return M(t,function(i){if(!i.getPopupMenuHeaderEntries){if(!i.getHeaderEntries)return;M(i.getHeaderEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=oi(o,["id"])});return}var r=i.getPopupMenuHeaderEntries(e);zt(r)?n=r(n):M(r,function(o,a){n[a]=o})}),n},yt.prototype._getEmptyPlaceholder=function(e){const t=e.find(n=>zt(n.getEmptyPlaceholder));return t&&t.getEmptyPlaceholder()},yt.prototype.isOpen=function(){return!!this._current},yt.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let r=Ar(e.delegateTarget||e.target,".entry",!0),o=on(r,_M);t={id:o,...this._getEntry(o)}}const i=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(zt(i)){if(n==="click")return i(e,t)}else if(i[n])return i[n](e,t)}},yt.prototype._getEntry=function(e){var t=this._current.entries[e]||this._current.headerEntries[e];if(!t)throw new Error("entry not found");return t};function a_(e,t=[]){return Object.entries(e).map(([n,i])=>{const r={id:n,...i};return r.entries?r.entries=a_(r.entries,[...t,...s_(r.search)]):t.length&&(r.search=[...t,...s_(r.search)]),r})}function s_(e){return e?ge(e)?e:[e]:[]}function xM(e,t,n){const{keys:i}=n;if(t=t.trim().toLowerCase(),!t)throw new Error("<pattern> must not be empty");const r=t.trim().toLowerCase().split(/\s+/);return e.flatMap(o=>{const a=EM(o,r,i);return a?{item:o,tokens:a}:[]}).sort(wM(i))}function EM(e,t,n){const{matchedWords:i,tokens:r}=n.reduce((o,a)=>{const s=e[a],{tokens:c,matchedWords:u}=ge(s)?s.reduce((l,p)=>{const{tokens:f,matchedWords:d}=f_(p,t);return{tokens:[...l.tokens,f],matchedWords:{...l.matchedWords,...d}}},{matchedWords:{},tokens:[]}):f_(s,t);return{tokens:{...o.tokens,[a]:c},matchedWords:{...o.matchedWords,...u}}},{matchedWords:{},tokens:{}});return Object.keys(i).length!==t.length?null:r}function wM(e){return(t,n)=>{let i=0,r=1;for(const o of e){const a=SM(t.tokens[o],n.tokens[o]);if(a!==0){i+=a*r,r*=c_;continue}const s=RM(t.item[o],n.item[o]);if(s!==0){i+=s*r,r*=c_;continue}}return i}}function SM(e,t){return u_(t)-u_(e)}const c_=.5,To={FULL:131.9,START_FULL_WORD:8,START_WORD_PART:7.87,WORD_START:2.19,WORD_PART:1,NO_MATCH:-.07};function u_(e){const t=e.reduce((s,c)=>s+l_(c),0),n=e.flat(),i=n.reduce((s,c)=>s+c.value.length,0),r=n.reduce((s,c)=>s+(c.match?c.value.length:0),0),o=i?r/i:0;return t*(1+o)}function l_(e){if(ge(e))return Math.max(...e.map(l_));const t=Math.log(e.value.length);return e.match?(e.start?e.end?To.FULL:e.wordEnd?To.START_FULL_WORD:To.START_WORD_PART:e.wordStart?To.WORD_START:To.WORD_PART)*t:To.NO_MATCH*t}function p_(e=""){return ge(e)?e.join(", "):e}function RM(e,t){return p_(e).localeCompare(p_(t))}function f_(e,t){var u;if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},r=t.map(CM),o=[`(?<all>${r.join("\\s+")})`,...r].join("|"),a=new RegExp(o,"ig");let s,c=0;for(;s=a.exec(e);){const[l]=s,p=s.index,f=s.index+l.length,d=p===0,h=f===e.length,m=!!((u=s.groups)!=null&&u.all),g=d||/\s/.test(e.charAt(p-1)),R=h||/\s/.test(e.charAt(f));s.index>c&&n.push({value:e.slice(c,s.index),index:c}),n.push({value:l,index:s.index,match:!0,wordStart:g,wordEnd:R,start:d,end:h,all:m});const E=m?t:[l];for(const x of E)i[x.toLowerCase()]=!0;c=s.index+l.length}return c<e.length&&n.push({value:e.slice(c),index:c}),{tokens:n,matchedWords:i}}function CM(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}const d_={search:["value",xM]},uf={__depends__:[d_],__init__:["popupMenu"],popupMenu:["type",yt]};var h_={align:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2000 2000">
|
|
287
288
|
<line x1="200" y1="150" x2="200" y2="1850" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>
|
|
288
289
|
<rect x="500" y="150" width="1300" height="700" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
|
|
289
290
|
<rect x="500" y="1150" width="700" height="700" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
|
|
@@ -311,8 +312,8 @@
|
|
|
311
312
|
<line x1="150" y1="900" x2="1650" y2="900" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>
|
|
312
313
|
<rect x="150" y="250" width="600" height="1300" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
|
|
313
314
|
<rect x="1050" y="500" width="600" height="800" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
|
|
314
|
-
</svg>`},UP=900;function Pr(e,t,n,i){e.registerProvider(UP,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}Pr.$inject=["contextPad","popupMenu","translate","canvas"],Pr.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&D(t,this._getEntries(e)),t},Pr.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},Pr.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${dv.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);D(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},Pr.prototype._getMenuPosition=function(e){var t=5,n=this._contextPad.getPad(e).html,i=n.getBoundingClientRect(),r={x:i.left,y:i.bottom+t};return r};var qP=["left","center","right","top","middle","bottom"];function Po(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}Po.$inject=["popupMenu","alignElements","translate","rules"],Po.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&D(t,this._getEntries(e)),t},Po.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},Po.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return A(qP,function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:dv[o],action:function(){t.trigger(e,o),i.close()}}}),r};function Ds(e){Xt.call(this,e)}Ds.$inject=["eventBus"],X(Ds,Xt),Ds.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=ye(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=ta(n),n.length<2?!1:n})};const YP={__depends__:[oP,Sg,$l],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",Pr],alignElementsMenuProvider:["type",Po],bpmnAlignElements:["type",Ds]};function Gn(e,t,n,i){V.call(this,e),this._elementRegistry=t,this._modeling=n,this._rules=i;var r=this;this.postExecuted(["shape.create"],function(o){var a=o.context,s=a.hints||{},c=a.shape,u=a.parent||a.newParent;s.autoResize!==!1&&r._expand([c],u)}),this.postExecuted(["elements.move"],function(o){var a=o.context,s=nc(Ki(a.closure.topLevel)),c=a.hints,u=c?c.autoResize:!0;if(u!==!1){var p=Xi(s,function(l){return l.parent.id});A(p,function(l,f){ae(u)&&(l=l.filter(function(d){return Oe(u,Zi({id:d.id}))})),r._expand(l,f)})}}),this.postExecuted(["shape.toggleCollapse"],function(o){var a=o.context,s=a.hints,c=a.shape;s&&s.autoResize===!1||c.collapsed||r._expand(c.children||[],c)}),this.postExecuted(["shape.resize"],function(o){var a=o.context,s=a.hints,c=a.shape,u=c.parent;s&&s.autoResize===!1||u&&r._expand([c],u)})}Gn.$inject=["eventBus","elementRegistry","modeling","rules"],X(Gn,V),Gn.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=ie(Ue(e)),o=ie(t),a={};return r.top-o.top<i.top&&(a.top=r.top-n.top),r.left-o.left<i.left&&(a.left=r.left-n.left),o.right-r.right<i.right&&(a.right=r.right+n.right),o.bottom-r.bottom<i.bottom&&(a.bottom=r.bottom+n.bottom),ra(D({},o,a))},Gn.prototype._expand=function(e,t){typeof t=="string"&&(t=this._elementRegistry.get(t));var n=this._rules.allowed("element.autoResize",{elements:e,target:t});if(n){var i=this._getOptimalBounds(e,t);if(KP(i,t)){var r=XP(on(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:r});var o=t.parent;o&&this._expand([t],o)}}},Gn.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},Gn.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},Gn.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function KP(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function XP(e,t){var n="";return e=ie(e),t=ie(t),e.top>t.top&&(n=n.concat("n")),e.right<t.right&&(n=n.concat("w")),e.bottom<t.bottom&&(n=n.concat("s")),e.left>t.left&&(n=n.concat("e")),n}function Os(e){e.invoke(Gn,this)}Os.$inject=["injector"],X(Os,Gn),Os.prototype.resize=function(e,t,n){y(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};function Ao(e){Xt.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}Ao.$inject=["eventBus"],X(Ao,Xt),Ao.prototype.canResize=function(e,t){return!1};function Is(e,t){Ao.call(this,e),this._modeling=t}X(Is,Ao),Is.$inject=["eventBus","modeling"],Is.prototype.canResize=function(e,t){if(y(t.di,"bpmndi:BPMNPlane")||!y(t,"bpmn:Participant")&&!y(t,"bpmn:Lane")&&!y(t,"bpmn:SubProcess"))return!1;var n=!0;return A(e,function(i){if(y(i,"bpmn:Lane")||he(i)){n=!1;return}}),n};const ZP={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",Os],bpmnAutoResizeProvider:["type",Is]};function Ar(e,t,n){this._canvas=n,this._opts=D({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var i=this;t.on("drag.move",function(r){var o=i._toBorderPoint(r);i.startScroll(o)}),t.on(["drag.cleanup"],function(){i.stopScroll()})}Ar.$inject=["config.autoScroll","eventBus","canvas"],Ar.prototype.startScroll=function(e){var t=this._canvas,n=this._opts,i=this,r=t.getContainer().getBoundingClientRect(),o=[e.x,e.y,r.width-e.x,r.height-e.y];this.stopScroll();for(var a=0,s=0,c=0;c<4;c++)QP(o[c],n.scrollThresholdOut[c],n.scrollThresholdIn[c])&&(c===0?a=n.scrollStep:c==1?s=n.scrollStep:c==2?a=-n.scrollStep:c==3&&(s=-n.scrollStep));(a!==0||s!==0)&&(t.scroll({dx:a,dy:s}),this._scrolling=setTimeout(function(){i.startScroll(e)},n.scrollRepeatTimeout))};function QP(e,t,n){return t<e&&e<n}Ar.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Ar.prototype.setOptions=function(e){this._opts=D({},this._opts,e)},Ar.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=Bi(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const JP={__depends__:[$n],__init__:["autoScroll"],autoScroll:["type",Ar]};var hv="djs-bendpoint",mv="djs-segment-dragger";function eA(e,t){var n=Bi(t),i=e._container.getBoundingClientRect(),r;r={x:i.left,y:i.top};var o=e.viewbox();return{x:o.x+(n.x-r.x)/o.scale,y:o.y+(n.y-r.y)/o.scale}}function jl(e,t,n){var i=eA(e,n),r=iu(t,i);return r}function Fl(e,t){var n=te("g");xe(n).add(hv),pe(e,n);var i=te("circle");Z(i,{cx:0,cy:0,r:4}),xe(i).add("djs-visual"),pe(n,i);var r=te("circle");return Z(r,{cx:0,cy:0,r:10}),xe(r).add("djs-hit"),pe(n,r),t&&xe(n).add(t),n}function tA(e,t,n,i){var r=te("g");pe(e,r);var o=18,a=6,s=11,c=iA(t,n,i),u=a+s,p=te("rect");Z(p,{x:-o/2,y:-a/2,width:o,height:a}),xe(p).add("djs-visual"),pe(r,p);var l=te("rect");return Z(l,{x:-c/2,y:-u/2,width:c,height:u}),xe(l).add("djs-hit"),pe(r,l),Hf(r,i==="v"?90:0),r}function gv(e,t,n){var i=te("g"),r=Dc(t,n),o=Dn(t,n);return pe(e,i),tA(i,t,n,o),xe(i).add(mv),xe(i).add(o==="h"?"horizontal":"vertical"),lt(i,r.x,r.y),i}function Hl(e){return Math.abs(Math.round(e*2/3))}function nA(e,t){var n=rA(e,t);return uu(e,n)}function iA(e,t,n){var i=t.x-e.x,r=t.y-e.y;return Hl(n==="h"?i:r)}function rA(e,t){for(var n=t.waypoints,i=1/0,r,o=0;o<n.length-1;o++){var a=n[o],s=n[o+1],c=Pd(e,[a,s]);c<i&&(i=c,r=o)}return[n[r],n[r+1]]}function vv(e,t,n,i,r){function o(E,b,R){var T=E.index,O=E.point,C,F,N,I,W,re;return T<=0||E.bendpoint?!1:(C=b[T-1],F=b[T],N=Dc(C,F),I=Dn(C,F),W=Math.abs(O.x-N.x),re=Math.abs(O.y-N.y),I&&W<=R&&re<=R)}function a(E,b){var R=E.waypoints,T,O,C,F;return b.index<=0||b.bendpoint||(T={start:R[b.index-1],end:R[b.index]},O=Dn(T.start,T.end),!O)?null:(O==="h"?C=T.end.x-T.start.x:C=T.end.y-T.start.y,F=Hl(C)/2,F)}function s(E,b){var R=b.waypoints,T=jl(t,R,E),O;if(T){O=a(b,T);var C;if(o(T,R,O)?C=r.start(E,b,T.index):C=i.start(E,b,T.index,!T.bendpoint),C!==!1)return!0}}function c(E,b,R){le.bind(E,b,function(T){n.triggerMouseEvent(b,T,R),T.stopPropagation()})}function u(E,b){var R=t.getLayer("overlays"),T=Ae('.djs-bendpoints[data-element-id="'+xo(E.id)+'"]',R);return!T&&b&&(T=te("g"),Z(T,{"data-element-id":E.id}),xe(T).add("djs-bendpoints"),pe(R,T),c(T,"mousedown",E),c(T,"click",E),c(T,"dblclick",E)),T}function p(E,b){return Ae('.djs-segment-dragger[data-segment-idx="'+E+'"]',b)}function l(E,b){b.waypoints.forEach(function(R,T){var O=Fl(E);pe(E,O),lt(O,R.x,R.y)}),Fl(E,"floating")}function f(E,b){for(var R=b.waypoints,T,O,C,F=1;F<R.length;F++)T=R[F-1],O=R[F],Dn(T,O)&&(C=gv(E,T,O),Z(C,{"data-segment-idx":F}),c(C,"mousemove",b))}function d(E){A(Zo("."+hv,E),function(b){tt(b)})}function h(E){A(Zo("."+mv,E),function(b){tt(b)})}function v(E){var b=u(E);return b||(b=u(E,!0),l(b,E),f(b,E)),b}function _(E){var b=u(E);b&&(h(b),d(b),f(b,E),l(b,E))}function S(E,b){var R=Ae(".floating",E),T=b.point;R&&(lt(R,T.x,T.y),xe(R).add("positioned"))}function w(E,b,R){var T=p(b.index,E),O=R[b.index-1],C=R[b.index],F=b.point,N=Dc(O,C),I=Dn(O,C),W,re;T&&(W=oA(T),re={x:F.x-N.x,y:F.y-N.y},I==="v"&&(re={x:re.y,y:re.x}),lt(W,re.x,re.y))}e.on("connection.changed",function(E){_(E.element)}),e.on("connection.remove",function(E){var b=u(E.element);b&&tt(b)}),e.on("element.marker.update",function(E){var b=E.element,R;b.waypoints&&(R=v(b),E.add?xe(R).add(E.marker):xe(R).remove(E.marker))}),e.on("element.mousemove",function(E){var b=E.element,R=b.waypoints,T,O;if(R){if(T=u(b,!0),O=jl(t,R,E.originalEvent),!O)return;S(T,O),O.bendpoint||w(T,O,R)}}),e.on("element.mousedown",function(E){if(ci(E)){var b=E.originalEvent,R=E.element;if(R.waypoints)return s(b,R)}}),e.on("selection.changed",function(E){var b=E.newSelection,R=b[0];R&&R.waypoints&&v(R)}),e.on("element.hover",function(E){var b=E.element;b.waypoints&&v(b)}),e.on("element.out",function(E){var b=E.element;if(b.waypoints){var R=u(b);if(R){var T=Ae(".floating",R);T&&xe(T).remove("positioned")}}}),e.on("element.updateId",function(E){var b=E.element,R=E.newId;if(b.waypoints){var T=u(b);T&&Z(T,{"data-element-id":R})}}),this.addHandles=v,this.updateHandles=_,this.getBendpointsContainer=u,this.getSegmentDragger=p}vv.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function oA(e){return Ae(".djs-visual",e)}var yv=Math.round,Gi="reconnectStart",Wi="reconnectEnd",To="updateWaypoints";function zl(e,t,n,i,r,o){this._injector=e,this.start=function(a,s,c,u){var p=n.getGraphics(s),l=s.source,f=s.target,d=s.waypoints,h;!u&&c===0?h=Gi:!u&&c===d.length-1?h=Wi:h=To;var v=h===To?"connection.updateWaypoints":"connection.reconnect",_=r.allowed(v,{connection:s,source:l,target:f});if(_===!1&&(_=r.allowed(v,{connection:s,source:f,target:l})),_!==!1)return i.init(a,"bendpoint.move",{data:{connection:s,connectionGfx:p,context:{allowed:_,bendpointIndex:c,connection:s,source:l,target:f,insert:u,type:h}}})},t.on("bendpoint.move.hover",function(a){var s=a.context,c=s.connection,u=c.source,p=c.target,l=a.hover,f=s.type;s.hover=l;var d;if(l){var h=f===To?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=r.allowed(h,{connection:c,source:f===Gi?l:u,target:f===Wi?l:p}),d){s.source=f===Gi?l:u,s.target=f===Wi?l:p;return}d===!1&&(d=s.allowed=r.allowed(h,{connection:c,source:f===Wi?l:p,target:f===Gi?l:u})),d&&(s.source=f===Wi?l:p,s.target=f===Gi?l:u)}}),t.on(["bendpoint.move.out","bendpoint.move.cleanup"],function(a){var s=a.context,c=s.type;s.hover=null,s.source=null,s.target=null,c!==To&&(s.allowed=!1)}),t.on("bendpoint.move.end",function(a){var s=a.context,c=s.allowed,u=s.bendpointIndex,p=s.connection,l=s.insert,f=p.waypoints.slice(),d=s.source,h=s.target,v=s.type,_=s.hints||{},S={x:yv(a.x),y:yv(a.y)};if(!c)return!1;v===To?(l?f.splice(u,0,S):f[u]=S,_.bendpointMove={insert:l,bendpointIndex:u},f=this.cropWaypoints(p,f),o.updateWaypoints(p,gE(f),_)):(v===Gi?(_.docking="source",Ls(s)&&(_.docking="target",_.newWaypoints=f.reverse())):v===Wi&&(_.docking="target",Ls(s)&&(_.docking="source",_.newWaypoints=f.reverse())),o.reconnect(p,d,h,S,_))},this)}zl.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],zl.prototype.cropWaypoints=function(e,t){var n=this._injector.get("connectionDocking",!1);if(!n)return t;var i=e.waypoints;return e.waypoints=t,e.waypoints=n.getCroppedWaypoints(e),t=e.waypoints,e.waypoints=i,t};function Ls(e){var t=e.hover,n=e.source,i=e.target,r=e.type;if(r===Gi)return t&&i&&t===i&&n!==i;if(r===Wi)return t&&n&&t===n&&n!==i}var aA="reconnectStart",sA="reconnectEnd",_v="updateWaypoints",Mo="connect-ok",Bs="connect-not-ok",bv="connect-hover",Ev="djs-updating",xv="djs-dragging",wv=1100;function Sv(e,t,n,i){this._injector=t;var r=t.get("connectionPreview",!1);n.on("bendpoint.move.start",function(o){var a=o.context,s=a.bendpointIndex,c=a.connection,u=a.insert,p=c.waypoints,l=p.slice();a.waypoints=p,u&&l.splice(s,0,{x:o.x,y:o.y}),c.waypoints=l;var f=a.draggerGfx=Fl(i.getLayer("overlays"));xe(f).add("djs-dragging"),i.addMarker(c,xv),i.addMarker(c,Ev)}),n.on("bendpoint.move.hover",function(o){var a=o.context,s=a.allowed,c=a.hover,u=a.type;if(c){if(i.addMarker(c,bv),u===_v)return;s?(i.removeMarker(c,Bs),i.addMarker(c,Mo)):s===!1&&(i.removeMarker(c,Mo),i.addMarker(c,Bs))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],wv,function(o){var a=o.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,bv),i.removeMarker(s,c?Mo:Bs))}),n.on("bendpoint.move.move",function(o){var a=o.context,s=a.allowed,c=a.bendpointIndex,u=a.draggerGfx,p=a.hover,l=a.type,f=a.connection,d=f.source,h=f.target,v=f.waypoints.slice(),_={x:o.x,y:o.y},S=a.hints||{},w={};r&&(S.connectionStart&&(w.connectionStart=S.connectionStart),S.connectionEnd&&(w.connectionEnd=S.connectionEnd),l===aA?Ls(a)?(w.connectionEnd=w.connectionEnd||_,w.source=h,w.target=p||d,v=v.reverse()):(w.connectionStart=w.connectionStart||_,w.source=p||d,w.target=h):l===sA?Ls(a)?(w.connectionStart=w.connectionStart||_,w.source=p||h,w.target=d,v=v.reverse()):(w.connectionEnd=w.connectionEnd||_,w.source=d,w.target=p||h):(w.noCropping=!0,w.noLayout=!0,v[c]=_),l===_v&&(v=e.cropWaypoints(f,v)),w.waypoints=v,r.drawPreview(a,s,w)),lt(u,o.x,o.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],wv,function(o){var a=o.context,s=a.connection,c=a.draggerGfx,u=a.hover,p=a.target,l=a.waypoints;s.waypoints=l,tt(c),i.removeMarker(s,Ev),i.removeMarker(s,xv),u&&(i.removeMarker(u,Mo),i.removeMarker(u,p?Mo:Bs)),r&&r.cleanUp(a)})}Sv.$inject=["bendpointMove","injector","eventBus","canvas"];var Rv="connect-hover",Cv="djs-updating";function Pv(e,t,n){return Vl(e,t,e[t]+n)}function Vl(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function cA(e,t,n,i){var r=Math.max(t[i],n[i]),o=Math.min(t[i],n[i]),a=20,s=Math.min(Math.max(o+a,e[i]),r-a);return Vl(t,i,s)}function Av(e){return e==="x"?"y":"x"}function Tv(e,t,n){var i,r;return e.original?e.original:(i=se(t),r=Av(n),Vl(e,r,i[r]))}function Mv(e,t,n,i,r,o){var a=e.get("connectionDocking",!1);this.start=function(l,f,d){var h,v=n.getGraphics(f),_=d-1,S=d,w=f.waypoints,E=w[_],b=w[S],R=jl(n,w,l),T,O,C;if(T=Dn(E,b),!!T)return O=T==="v"?"x":"y",_===0&&(E=Tv(E,f.source,O)),S===w.length-1&&(b=Tv(b,f.target,O)),R?C=R.point:C={x:(E.x+b.x)/2,y:(E.y+b.y)/2},h={connection:f,segmentStartIndex:_,segmentEndIndex:S,segmentStart:E,segmentEnd:b,axis:O,dragPosition:C},i.init(l,C,"connectionSegment.move",{cursor:O==="x"?"resize-ew":"resize-ns",data:{connection:f,connectionGfx:v,context:h}})};function s(l,f){if(!a)return f;var d=l.waypoints,h;return l.waypoints=f,h=a.getCroppedWaypoints(l),l.waypoints=d,h}function c(l){r.update("connection",l.connection,l.connectionGfx)}function u(l,f,d){var h=l.newWaypoints,v=l.segmentStartIndex+f,_=h[v],S=l.segmentEndIndex+f,w=h[S],E=Av(l.axis),b=cA(d,_,w,E);lt(l.draggerGfx,b.x,b.y)}function p(l,f){var d=0,h=l.filter(function(v,_){return kc(l[_-1],l[_+1],v)?(d=_<=f?d-1:d,!1):!0});return{waypoints:h,segmentOffset:d}}t.on("connectionSegment.move.start",function(l){var f=l.context,d=l.connection,h=n.getLayer("overlays");f.originalWaypoints=d.waypoints.slice(),f.draggerGfx=gv(h,f.segmentStart,f.segmentEnd),xe(f.draggerGfx).add("djs-dragging"),n.addMarker(d,Cv)}),t.on("connectionSegment.move.move",function(l){var f=l.context,d=f.connection,h=f.segmentStartIndex,v=f.segmentEndIndex,_=f.segmentStart,S=f.segmentEnd,w=f.axis,E=f.originalWaypoints.slice(),b=Pv(_,w,l["d"+w]),R=Pv(S,w,l["d"+w]),T=E.length,O=0;E[h]=b,E[v]=R;var C,F;h<2&&(C=ut(d.source,b),h===1?C==="intersect"&&(E.shift(),E[0]=b,O--):C!=="intersect"&&(E.unshift(_),O++)),v>T-3&&(F=ut(d.target,R),v===T-2?F==="intersect"&&(E.pop(),E[E.length-1]=R):F!=="intersect"&&E.push(S)),f.newWaypoints=d.waypoints=s(d,E),u(f,O,l),f.newSegmentStartIndex=h+O,c(l)}),t.on("connectionSegment.move.hover",function(l){l.context.hover=l.hover,n.addMarker(l.hover,Rv)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(l){var f=l.context.hover;f&&n.removeMarker(f,Rv)}),t.on("connectionSegment.move.cleanup",function(l){var f=l.context,d=f.connection;f.draggerGfx&&tt(f.draggerGfx),n.removeMarker(d,Cv)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(l){var f=l.context,d=f.connection;d.waypoints=f.originalWaypoints,c(l)}),t.on("connectionSegment.move.end",function(l){var f=l.context,d=f.connection,h=f.newWaypoints,v=f.newSegmentStartIndex;h=h.map(function(R){return{original:R.original,x:Math.round(R.x),y:Math.round(R.y)}});var _=p(h,v),S=_.waypoints,w=s(d,S),E=_.segmentOffset,b={segmentMove:{segmentStartIndex:f.segmentStartIndex,newSegmentStartIndex:v+E}};o.updateWaypoints(d,w,b)})}Mv.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var uA=Math.abs,kv=Math.round;function lA(e,t,n){n=n===void 0?10:n;var i,r;for(i=0;i<t.length;i++)if(r=t[i],uA(r-e)<=n)return r}function Dv(e){return{x:e.x,y:e.y}}function Ov(e){return{x:e.x+e.width,y:e.y+e.height}}function en(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:kv(e.x+e.width/2),y:kv(e.y+e.height/2)}}function Tr(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function Xe(e,t,n){if(typeof t!="string")throw new Error("axis must be in [x, y]");if(typeof n!="number"&&n!==!1)throw new Error("value must be Number or false");var i,r=e[t],o=e.snapped=e.snapped||{};return n===!1?o[t]=!1:(o[t]=!0,i=n-r,e[t]+=i,e["d"+t]+=i),r}function Iv(e){return e.children||[]}var pA=Math.abs,Lv=Math.round,Gl=10;function Bv(e){function t(o,a){if(ae(o)){for(var s=o.length;s--;)if(pA(o[s]-a)<=Gl)return o[s]}else{o=+o;var c=a%o;if(c<Gl)return a-c;if(c>o-Gl)return a-c+o}return a}function n(o,a){if(o.waypoints)return nA(a,o);if(o.width)return{x:Lv(o.width/2+o.x),y:Lv(o.height/2+o.y)}}function i(o){var a=o.context,s=a.snapPoints,c=a.connection,u=c.waypoints,p=a.segmentStart,l=a.segmentStartIndex,f=a.segmentEnd,d=a.segmentEndIndex,h=a.axis;if(s)return s;var v=[u[l-1],p,f,u[d+1]];return l<2&&v.unshift(n(c.source,o)),d>u.length-3&&v.unshift(n(c.target,o)),a.snapPoints=s={horizontal:[],vertical:[]},A(v,function(_){_&&(_=_.original||_,h==="y"&&s.horizontal.push(_.y),h==="x"&&s.vertical.push(_.x))}),s}e.on("connectionSegment.move.move",1500,function(o){var a=i(o),s=o.x,c=o.y,u,p;if(a){u=t(a.vertical,s),p=t(a.horizontal,c);var l=s-u,f=c-p;D(o,{dx:o.dx-l,dy:o.dy-f,x:u,y:p}),(l||a.vertical.indexOf(s)!==-1)&&Xe(o,"x",u),(f||a.horizontal.indexOf(c)!==-1)&&Xe(o,"y",p)}});function r(o){var a=o.snapPoints,s=o.connection.waypoints,c=o.bendpointIndex;if(a)return a;var u=[s[c-1],s[c+1]];return o.snapPoints=a={horizontal:[],vertical:[]},A(u,function(p){p&&(p=p.original||p,a.horizontal.push(p.y),a.vertical.push(p.x))}),a}e.on(["connect.hover","connect.move","connect.end"],1500,function(o){var a=o.context,s=a.hover,c=s&&n(s,o);!Te(s)||!c||!c.x||!c.y||(Xe(o,"x",c.x),Xe(o,"y",c.y))}),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(o){var a=o.context,s=r(a),c=a.hover,u=c&&n(c,o),p=o.x,l=o.y,f,d;if(s){f=t(u?s.vertical.concat([u.x]):s.vertical,p),d=t(u?s.horizontal.concat([u.y]):s.horizontal,l);var h=p-f,v=l-d;D(o,{dx:o.dx-h,dy:o.dy-v,x:o.x-h,y:o.y-v}),(h||s.vertical.indexOf(p)!==-1)&&Xe(o,"x",f),(v||s.horizontal.indexOf(l)!==-1)&&Xe(o,"y",d)}})}Bv.$inject=["eventBus"];const fA={__depends__:[$n,En],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",vv],bendpointMove:["type",zl],bendpointMovePreview:["type",Sv],connectionSegmentMove:["type",Mv],bendpointSnapping:["type",Bv]};function Nv(e,t,n,i){function r(a,s){return i.allowed("connection.create",{source:a,target:s})}function o(a,s){return r(s,a)}e.on("connect.hover",function(a){var s=a.context,c=s.start,u=a.hover,p;if(s.hover=u,p=s.canExecute=r(c,u),!Yi(p)){if(p!==!1){s.source=c,s.target=u;return}p=s.canExecute=o(c,u),!Yi(p)&&p!==!1&&(s.source=u,s.target=c)}}),e.on(["connect.out","connect.cleanup"],function(a){var s=a.context;s.hover=null,s.source=null,s.target=null,s.canExecute=!1}),e.on("connect.end",function(a){var s=a.context,c=s.canExecute,u=s.connectionStart,p={x:a.x,y:a.y},l=s.source,f=s.target;if(!c)return!1;var d=null,h={connectionStart:Wl(s)?p:u,connectionEnd:Wl(s)?u:p};rt(c)&&(d=c),s.connection=n.connect(l,f,d,h)}),this.start=function(a,s,c,u){rt(c)||(u=c,c=se(s)),t.init(a,"connect",{autoActivate:u,data:{shape:s,context:{start:s,connectionStart:c}}})}}Nv.$inject=["eventBus","dragging","modeling","rules"];function Wl(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var dA=1100,hA=900,$v="connect-ok",jv="connect-not-ok";function Fv(e,t,n){var i=e.get("connectionPreview",!1);i&&t.on("connect.move",function(r){var o=r.context,a=o.canExecute,s=o.hover,c=o.source,u=o.start,p=o.startPosition,l=o.target,f=o.connectionStart||p,d=o.connectionEnd||{x:r.x,y:r.y},h=f,v=d;Wl(o)&&(h=d,v=f),i.drawPreview(o,a,{source:c||u,target:l||s,connectionStart:h,connectionEnd:v})}),t.on("connect.hover",hA,function(r){var o=r.context,a=r.hover,s=o.canExecute;s!==null&&n.addMarker(a,s?$v:jv)}),t.on(["connect.out","connect.cleanup"],dA,function(r){var o=r.hover;o&&(n.removeMarker(o,$v),n.removeMarker(o,jv))}),i&&t.on("connect.cleanup",function(r){i.cleanUp(r.context)})}Fv.$inject=["injector","eventBus","canvas"];const Ul={__depends__:[Zt,En,$n],__init__:["connectPreview"],connect:["type",Nv],connectPreview:["type",Fv]};var mA="djs-dragger";function Wn(e,t,n,i){this._canvas=t,this._graphicsFactory=n,this._elementFactory=i,this._connectionDocking=e.get("connectionDocking",!1),this._layouter=e.get("layouter",!1)}Wn.$inject=["injector","canvas","graphicsFactory","elementFactory"],Wn.prototype.drawPreview=function(e,t,n){n=n||{};var i=e.connectionPreviewGfx,r=e.getConnection,o=n.source,a=n.target,s=n.waypoints,c=n.connectionStart,u=n.connectionEnd,p=n.noLayout,l=n.noCropping,f=n.noNoop,d,h=this;if(i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),Qo(i),r||(r=e.getConnection=gA(function(v,_,S){return h.getConnection(v,_,S)})),t&&(d=r(t,o,a)),!d){!f&&this.drawNoopPreview(i,n);return}d.waypoints=s||[],this._layouter&&!p&&(d.waypoints=this._layouter.layoutConnection(d,{source:o,target:a,connectionStart:c,connectionEnd:u,waypoints:n.waypoints||d.waypoints})),(!d.waypoints||!d.waypoints.length)&&(d.waypoints=[o?se(o):c,a?se(a):u]),this._connectionDocking&&(o||a)&&!l&&(d.waypoints=this._connectionDocking.getCroppedWaypoints(d,o,a)),this._graphicsFactory.drawConnection(i,d,{stroke:"var(--element-dragger-color)"})},Wn.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||se(n),o=t.connectionEnd||se(i),a=this.cropWaypoints(r,o,n,i),s=this.createNoopConnection(a[0],a[1]);pe(e,s)},Wn.prototype.cropWaypoints=function(e,t,n,i){var r=this._graphicsFactory,o=n&&r.getShapePath(n),a=i&&r.getShapePath(i),s=r.getConnectionPath({waypoints:[e,t]});return e=n&&Vr(o,s,!0)||e,t=i&&Vr(a,s,!1)||t,[e,t]},Wn.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&tt(e.connectionPreviewGfx)},Wn.prototype.getConnection=function(e){var t=vA(e);return this._elementFactory.createConnection(t)},Wn.prototype.createConnectionPreviewGfx=function(){var e=te("g");return Z(e,{pointerEvents:"none"}),xe(e).add(mA),pe(this._canvas.getActiveLayer(),e),e},Wn.prototype.createNoopConnection=function(e,t){return jr([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function gA(e){var t={};return function(n){var i=JSON.stringify(n),r=t[i];return r||(r=t[i]=e.apply(null,arguments)),r}}function vA(e){return rt(e)?e:{}}const yA={__init__:["connectionPreview"],connectionPreview:["type",Wn]},Ns="complex-preview";class Hv{constructor(t,n,i){this._canvas=t,this._graphicsFactory=n,this._previewSupport=i,this._markers=[]}create(t){this.cleanUp();const{created:n=[],moved:i=[],removed:r=[],resized:o=[]}=t,a=this._canvas.getLayer(Ns);n.filter(s=>!_A(s)).forEach(s=>{let c;Te(s)?(c=this._graphicsFactory._createContainer("connection",te("g")),this._graphicsFactory.drawConnection(Oi(c),s)):(c=this._graphicsFactory._createContainer("shape",te("g")),this._graphicsFactory.drawShape(Oi(c),s),lt(c,s.x,s.y)),this._previewSupport.addDragger(s,a,c)}),i.forEach(({element:s,delta:c})=>{this._previewSupport.addDragger(s,a,void 0,"djs-dragging"),this._canvas.addMarker(s,"djs-element-hidden"),this._markers.push([s,"djs-element-hidden"]);const u=this._previewSupport.addDragger(s,a);Te(s)?lt(u,c.x,c.y):lt(u,s.x+c.x,s.y+c.y)}),r.forEach(s=>{this._previewSupport.addDragger(s,a,void 0,"djs-dragging"),this._canvas.addMarker(s,"djs-element-hidden"),this._markers.push([s,"djs-element-hidden"])}),o.forEach(({shape:s,bounds:c})=>{this._canvas.addMarker(s,"djs-hidden"),this._markers.push([s,"djs-hidden"]),this._previewSupport.addDragger(s,a,void 0,"djs-dragging");const u=this._graphicsFactory._createContainer("shape",te("g"));this._graphicsFactory.drawShape(Oi(u),s,{width:c.width,height:c.height}),lt(u,c.x,c.y),this._previewSupport.addDragger(s,a,u)})}cleanUp(){Qo(this._canvas.getLayer(Ns)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(Ns)}hide(){this._canvas.hideLayer(Ns)}}Hv.$inject=["canvas","graphicsFactory","previewSupport"];function _A(e){return e.hidden}const bA={__depends__:[yr],__init__:["complexPreview"],complexPreview:["type",Hv]},zv=Math.round;function $s(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}$s.prototype.create=function(e,t,n){const i=this._complexPreview,r=this._connectionDocking,o=this._elementFactory,a=this._eventBus,s=this._layouter,c=this._rules,u=o.createShape(D({type:t},n)),p=a.fire("autoPlace",{source:e,shape:u});if(!p)return;D(u,{x:p.x-zv(u.width/2),y:p.y-zv(u.height/2)});const l=c.allowed("connection.create",{source:e,target:u,hints:{targetParent:e.parent}});let f=null;l&&(f=o.createConnection(l),f.waypoints=s.layoutConnection(f,{source:e,target:u}),f.waypoints=r.getCroppedWaypoints(f,e,u)),i.create({created:[u,f].filter(d=>!Yi(d))})},$s.prototype.cleanUp=function(){this._complexPreview.cleanUp()},$s.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const EA={__depends__:[ps,bA,vl],__init__:["appendPreview"],appendPreview:["type",$s]};var Vv=Math.min,Gv=Math.max;function ql(e){e.preventDefault()}function ko(e){e.stopPropagation()}function xA(e){return e.nodeType===Node.TEXT_NODE}function wA(e){return[].slice.call(e)}function sn(e){this.container=e.container,this.parent=Ie('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=Ae("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=Ct(this.autoResize,this),this.handlePaste=Ct(this.handlePaste,this)}sn.prototype.create=function(e,t,n,i){var r=this,o=this.parent,a=this.content,s=this.container;i=this.options=i||{},t=this.style=t||{};var c=on(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);D(o.style,{width:e.width+"px",height:e.height+"px",maxWidth:e.maxWidth+"px",maxHeight:e.maxHeight+"px",minWidth:e.minWidth+"px",minHeight:e.minHeight+"px",left:e.x+"px",top:e.y+"px",backgroundColor:"#ffffff",position:"absolute",overflow:"visible",border:"1px solid #ccc",boxSizing:"border-box",wordWrap:"normal",textAlign:"center",outline:"none"},c);var u=on(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return D(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},u),i.centerVertically&&D(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},u),a.innerText=n,le.bind(a,"keydown",this.keyHandler),le.bind(a,"mousedown",ko),le.bind(a,"paste",r.handlePaste),le.bind(a,"focusout",this.focusoutHandler),i.autoResize&&le.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(o),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),o},sn.prototype.handlePaste=function(e){var t=this.options,n=this.style;e.preventDefault();var i;if(e.clipboardData?i=e.clipboardData.getData("text/plain"):i=window.clipboardData.getData("Text"),this.insertText(i),t.autoResize){var r=this.autoResize(n);r&&this.resizeHandler(r)}},sn.prototype.insertText=function(e){e=SA(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},sn.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,r=t.startOffset,o=t.endOffset,a=t.commonAncestorContainer,s=wA(a.childNodes),c,u;if(xA(a)){var p=n.textContent;n.textContent=p.substring(0,r)+e+p.substring(o),c=n,u=r+e.length}else if(n===this.content&&i===this.content){var l=document.createTextNode(e);this.content.insertBefore(l,s[r]),c=l,u=l.textContent.length}else{var f=s.indexOf(n),d=s.indexOf(i);s.forEach(function(h,v){v===f?h.textContent=n.textContent.substring(0,r)+e+i.textContent.substring(o):v>f&&v<=d&&mn(h)}),c=n,u=r+e.length}c&&u!==void 0&&setTimeout(function(){self.setSelection(c,u)})},sn.prototype.autoResize=function(){var e=this.parent,t=this.content,n=parseInt(this.style.fontSize)||12;if(t.scrollHeight>e.offsetHeight||t.scrollHeight<e.offsetHeight-n){var i=e.getBoundingClientRect(),r=t.scrollHeight;e.style.height=r+"px",this.resizeHandler({width:i.width,height:i.height,dx:0,dy:r-i.height})}},sn.prototype.resizable=function(){var e=this,t=this.parent,n=this.resizeHandle,i=parseInt(this.style.minWidth)||0,r=parseInt(this.style.minHeight)||0,o=parseInt(this.style.maxWidth)||1/0,a=parseInt(this.style.maxHeight)||1/0;if(!n){n=this.resizeHandle=Ie('<div class="djs-direct-editing-resize-handle"></div>');var s,c,u,p,l=function(h){ql(h),ko(h),s=h.clientX,c=h.clientY;var v=t.getBoundingClientRect();u=v.width,p=v.height,le.bind(document,"mousemove",f),le.bind(document,"mouseup",d)},f=function(h){ql(h),ko(h);var v=Vv(Gv(u+h.clientX-s,i),o),_=Vv(Gv(p+h.clientY-c,r),a);t.style.width=v+"px",t.style.height=_+"px",e.resizeHandler({width:u,height:p,dx:h.clientX-s,dy:h.clientY-c})},d=function(h){ql(h),ko(h),le.unbind(document,"mousemove",f,!1),le.unbind(document,"mouseup",d,!1)};le.bind(n,"mousedown",l)}D(n.style,{position:"absolute",bottom:"0px",right:"0px",cursor:"nwse-resize",width:"0",height:"0",borderTop:(parseInt(this.style.fontSize)/4||3)+"px solid transparent",borderRight:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderBottom:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderLeft:(parseInt(this.style.fontSize)/4||3)+"px solid transparent"}),t.appendChild(n)},sn.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),le.unbind(t,"keydown",this.keyHandler),le.unbind(t,"mousedown",ko),le.unbind(t,"input",this.autoResize),le.unbind(t,"paste",this.handlePaste),le.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),mn(n)),mn(e)},sn.prototype.getValue=function(){return this.content.innerText.trim()},sn.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},sn.prototype.setSelection=function(e,t){var n=document.createRange();e===null?n.selectNodeContents(this.content):(n.setStart(e,t),n.setEnd(e,t));var i=window.getSelection();i.removeAllRanges(),i.addRange(n)};function SA(e){return e.replace(/\r\n|\r|\n/g,`
|
|
315
|
-
`)}function jt(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new sn({container:t.getContainer(),keyHandler:Ct(this._handleKey,this),resizeHandler:Ct(this._handleResize,this),focusoutHandler:Ct(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}jt.$inject=["eventBus","canvas"],jt.prototype.registerProvider=function(e){this._providers.push(e)},jt.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},jt.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},jt.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},jt.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},jt.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},jt.prototype.complete=function(){var e=this._active;if(e){var t,n=e.context.bounds,i=this.$textbox.getBoundingClientRect(),r=this.getValue(),o=e.context.text;(r!==o||i.height!==n.height||i.width!==n.width)&&(t=this._textbox.container.getBoundingClientRect(),e.provider.update(e.element,r,e.context.text,{x:i.left-t.left,y:i.top-t.top,width:i.width,height:i.height})),this._fire("complete"),this.close()}},jt.prototype.getValue=function(){return this._textbox.getValue()},jt.prototype._handleKey=function(e){e.stopPropagation();var t=e.keyCode||e.charCode;if(t===27)return e.preventDefault(),this.cancel();if(t===13&&!e.shiftKey)return e.preventDefault(),this.complete()},jt.prototype._handleResize=function(e){this._fire("resize",e)},jt.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},jt.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=Oe(this._providers,function(i){return(t=i.activate(e))?i:null});return t&&(this.$textbox=this._textbox.create(t.bounds,t.style,t.text,t.options),this._active={element:e,context:t,provider:n},t.options&&t.options.resizable&&(this.resizable=!0),this._fire("activate")),!!t};const Wv={__depends__:[Ha],__init__:["directEditing"],directEditing:["type",jt]};function RA(e){return function(t){var n=t.target,i=G(e),r=i.eventDefinitions&&i.eventDefinitions[0],o=i.$type===n.type,a=(r&&r.$type)===n.eventDefinitionType,s=!!n.triggeredByEvent==!!i.triggeredByEvent,c=n.isExpanded===void 0||n.isExpanded===Ee(e);return!o||!a||!s||!c}}const CA={task:{label:"Task",className:"bpmn-icon-task",target:{type:"bpmn:Task"}},"user-task":{label:"User task",className:"bpmn-icon-user",target:{type:"bpmn:UserTask"}},"service-task":{label:"Service task",className:"bpmn-icon-service",target:{type:"bpmn:ServiceTask"}},"send-task":{label:"Send task",className:"bpmn-icon-send",target:{type:"bpmn:SendTask"}},"receive-task":{label:"Receive task",className:"bpmn-icon-receive",target:{type:"bpmn:ReceiveTask"}},"manual-task":{label:"Manual task",className:"bpmn-icon-manual",target:{type:"bpmn:ManualTask"}},"rule-task":{label:"Business rule task",className:"bpmn-icon-business-rule",target:{type:"bpmn:BusinessRuleTask"}},"script-task":{label:"Script task",className:"bpmn-icon-script",target:{type:"bpmn:ScriptTask"}},"call-activity":{label:"Call activity",className:"bpmn-icon-call-activity",target:{type:"bpmn:CallActivity"}},transaction:{label:"Transaction",className:"bpmn-icon-transaction",target:{type:"bpmn:Transaction",isExpanded:!0}},"event-subprocess":{label:"Event sub-process",className:"bpmn-icon-event-subprocess-expanded",target:{type:"bpmn:SubProcess",triggeredByEvent:!0,isExpanded:!0}},"collapsed-subprocess":{label:"Sub-process (collapsed)",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:SubProcess",isExpanded:!1}},"expanded-subprocess":{label:"Sub-process (expanded)",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:SubProcess",isExpanded:!0}},"collapsed-ad-hoc-subprocess":{label:"Ad-hoc sub-process (collapsed)",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:AdHocSubProcess",isExpanded:!1}},"expanded-ad-hoc-subprocess":{label:"Ad-hoc sub-process (expanded)",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:AdHocSubProcess",isExpanded:!0}},"exclusive-gateway":{label:"Exclusive gateway",className:"bpmn-icon-gateway-xor",target:{type:"bpmn:ExclusiveGateway"}},"parallel-gateway":{label:"Parallel gateway",className:"bpmn-icon-gateway-parallel",target:{type:"bpmn:ParallelGateway"}},"inclusive-gateway":{label:"Inclusive gateway",className:"bpmn-icon-gateway-or",target:{type:"bpmn:InclusiveGateway"}},"complex-gateway":{label:"Complex gateway",className:"bpmn-icon-gateway-complex",target:{type:"bpmn:ComplexGateway"}},"event-based-gateway":{label:"Event-based gateway",className:"bpmn-icon-gateway-eventbased",target:{type:"bpmn:EventBasedGateway",instantiate:!1,eventGatewayType:"Exclusive"}},"data-store-reference":{label:"Data store reference",className:"bpmn-icon-data-store",target:{type:"bpmn:DataStoreReference"}},"data-object-reference":{label:"Data object reference",className:"bpmn-icon-data-object",target:{type:"bpmn:DataObjectReference"}},"expanded-pool":{label:"Expanded pool/participant",className:"bpmn-icon-participant",target:{type:"bpmn:Participant",isExpanded:!0}},"collapsed-pool":{label:"Empty pool/participant",className:"bpmn-icon-lane",target:{type:"bpmn:Participant",isExpanded:!1}},"none-start-event":{label:"Start event",className:"bpmn-icon-start-event-none",target:{type:"bpmn:StartEvent"}},"none-intermediate-throwing":{label:"Intermediate throw event",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:IntermediateThrowEvent"}},"none-boundary-event":{label:"Boundary event",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:BoundaryEvent"}},"none-end-event":{label:"End event",className:"bpmn-icon-end-event-none",target:{type:"bpmn:EndEvent"}},"message-start":{label:"Message start event",className:"bpmn-icon-start-event-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition",isInterrupting:!0}},"timer-start":{label:"Timer start event",className:"bpmn-icon-start-event-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition",isInterrupting:!0}},"conditional-start":{label:"Conditional start event",className:"bpmn-icon-start-event-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",isInterrupting:!0}},"signal-start":{label:"Signal start event",className:"bpmn-icon-start-event-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition",isInterrupting:!0}},"error-start":{label:"Error start event",className:"bpmn-icon-start-event-error",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ErrorEventDefinition",isInterrupting:!0}},"escalation-start":{label:"Escalation start event",className:"bpmn-icon-start-event-escalation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",isInterrupting:!0}},"compensation-start":{label:"Compensation start event",className:"bpmn-icon-start-event-compensation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:CompensateEventDefinition",isInterrupting:!0}},"non-interrupting-message-start":{label:"Message start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition",isInterrupting:!1}},"non-interrupting-timer-start":{label:"Timer start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition",isInterrupting:!1}},"non-interrupting-conditional-start":{label:"Conditional start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",isInterrupting:!1}},"non-interrupting-signal-start":{label:"Signal start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition",isInterrupting:!1}},"non-interrupting-escalation-start":{label:"Escalation start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-escalation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",isInterrupting:!1}},"message-intermediate-catch":{label:"Message intermediate catch event",className:"bpmn-icon-intermediate-event-catch-message",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},"message-intermediate-throw":{label:"Message intermediate throw event",className:"bpmn-icon-intermediate-event-throw-message",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},"timer-intermediate-catch":{label:"Timer intermediate catch event",className:"bpmn-icon-intermediate-event-catch-timer",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:TimerEventDefinition"}},"escalation-intermediate-throw":{label:"Escalation intermediate throw event",className:"bpmn-icon-intermediate-event-throw-escalation",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},"conditional-intermediate-catch":{label:"Conditional intermediate catch event",className:"bpmn-icon-intermediate-event-catch-condition",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition"}},"link-intermediate-catch":{label:"Link intermediate catch event",className:"bpmn-icon-intermediate-event-catch-link",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:LinkEventDefinition",eventDefinitionAttrs:{name:""}}},"link-intermediate-throw":{label:"Link intermediate throw event",className:"bpmn-icon-intermediate-event-throw-link",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:LinkEventDefinition",eventDefinitionAttrs:{name:""}}},"compensation-intermediate-throw":{label:"Compensation intermediate throw event",className:"bpmn-icon-intermediate-event-throw-compensation",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},"signal-intermediate-catch":{label:"Signal intermediate catch event",className:"bpmn-icon-intermediate-event-catch-signal",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},"signal-intermediate-throw":{label:"Signal intermediate throw event",className:"bpmn-icon-intermediate-event-throw-signal",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},"message-boundary":{label:"Message boundary event",className:"bpmn-icon-intermediate-event-catch-message",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:MessageEventDefinition",cancelActivity:!0}},"timer-boundary":{label:"Timer boundary event",className:"bpmn-icon-intermediate-event-catch-timer",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:TimerEventDefinition",cancelActivity:!0}},"escalation-boundary":{label:"Escalation boundary event",className:"bpmn-icon-intermediate-event-catch-escalation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",cancelActivity:!0}},"conditional-boundary":{label:"Conditional boundary event",className:"bpmn-icon-intermediate-event-catch-condition",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",cancelActivity:!0}},"error-boundary":{label:"Error boundary event",className:"bpmn-icon-intermediate-event-catch-error",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ErrorEventDefinition",cancelActivity:!0}},"cancel-boundary":{label:"Cancel boundary event",className:"bpmn-icon-intermediate-event-catch-cancel",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CancelEventDefinition",cancelActivity:!0}},"signal-boundary":{label:"Signal boundary event",className:"bpmn-icon-intermediate-event-catch-signal",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:SignalEventDefinition",cancelActivity:!0}},"compensation-boundary":{label:"Compensation boundary event",className:"bpmn-icon-intermediate-event-catch-compensation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CompensateEventDefinition",cancelActivity:!0}},"non-interrupting-message-boundary":{label:"Message boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-message",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:MessageEventDefinition",cancelActivity:!1}},"non-interrupting-timer-boundary":{label:"Timer boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-timer",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:TimerEventDefinition",cancelActivity:!1}},"non-interrupting-escalation-boundary":{label:"Escalation boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-escalation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",cancelActivity:!1}},"non-interrupting-conditional-boundary":{label:"Conditional boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-condition",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",cancelActivity:!1}},"non-interrupting-signal-boundary":{label:"Signal boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-signal",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:SignalEventDefinition",cancelActivity:!1}},"message-end":{label:"Message end event",className:"bpmn-icon-end-event-message",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},"escalation-end":{label:"Escalation end event",className:"bpmn-icon-end-event-escalation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},"error-end":{label:"Error end event",className:"bpmn-icon-end-event-error",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:ErrorEventDefinition"}},"cancel-end":{label:"Cancel end event",className:"bpmn-icon-end-event-cancel",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:CancelEventDefinition"}},"compensation-end":{label:"Compensation end event",className:"bpmn-icon-end-event-compensation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},"signal-end":{label:"Signal end event",className:"bpmn-icon-end-event-signal",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},"terminate-end":{label:"Terminate end event",className:"bpmn-icon-end-event-terminate",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:TerminateEventDefinition"}}};function z(e,t={}){var n=CA[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var PA=[z("none-start-event",{actionName:"replace-with-none-start"}),z("none-intermediate-throwing"),z("none-end-event",{actionName:"replace-with-none-end"}),z("message-start"),z("timer-start"),z("conditional-start"),z("signal-start")],AA=[z("none-start-event",{actionName:"replace-with-none-start"}),z("none-intermediate-throwing"),z("none-end-event",{actionName:"replace-with-none-end"})],TA=[z("none-start-event",{actionName:"replace-with-none-start"}),z("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),z("none-end-event",{actionName:"replace-with-none-end"}),z("message-intermediate-catch"),z("message-intermediate-throw"),z("timer-intermediate-catch"),z("escalation-intermediate-throw"),z("conditional-intermediate-catch"),z("link-intermediate-catch"),z("link-intermediate-throw"),z("compensation-intermediate-throw"),z("signal-intermediate-catch"),z("signal-intermediate-throw")],MA=[z("none-start-event",{actionName:"replace-with-none-start"}),z("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),z("none-end-event",{actionName:"replace-with-none-end"}),z("message-end"),z("escalation-end"),z("error-end"),z("cancel-end"),z("compensation-end"),z("signal-end"),z("terminate-end")],kA=[z("exclusive-gateway"),z("parallel-gateway"),z("inclusive-gateway"),z("complex-gateway"),z("event-based-gateway")],DA=[z("transaction"),z("event-subprocess"),z("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),z("collapsed-subprocess")],OA=[z("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),z("transaction"),z("event-subprocess"),z("collapsed-ad-hoc-subprocess")],Uv=[z("transaction"),z("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),z("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),z("event-subprocess")],IA=Uv,qv=[z("task"),z("user-task"),z("service-task"),z("send-task"),z("receive-task"),z("manual-task"),z("rule-task"),z("script-task"),z("call-activity"),z("collapsed-subprocess"),z("expanded-subprocess"),z("collapsed-ad-hoc-subprocess"),z("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],LA=[z("data-store-reference")],BA=[z("data-object-reference")],NA=[z("message-boundary"),z("timer-boundary"),z("escalation-boundary"),z("conditional-boundary"),z("error-boundary"),z("cancel-boundary"),z("signal-boundary"),z("compensation-boundary"),z("non-interrupting-message-boundary"),z("non-interrupting-timer-boundary"),z("non-interrupting-escalation-boundary"),z("non-interrupting-conditional-boundary"),z("non-interrupting-signal-boundary")],$A=[z("message-start"),z("timer-start"),z("conditional-start"),z("signal-start"),z("error-start"),z("escalation-start"),z("compensation-start"),z("non-interrupting-message-start"),z("non-interrupting-timer-start"),z("non-interrupting-conditional-start"),z("non-interrupting-signal-start"),z("non-interrupting-escalation-start")],jA=[{label:"Sequence flow",actionName:"replace-with-sequence-flow",className:"bpmn-icon-connection"},{label:"Default flow",actionName:"replace-with-default-flow",className:"bpmn-icon-default-flow"},{label:"Conditional flow",actionName:"replace-with-conditional-flow",className:"bpmn-icon-conditional-flow"}],FA=[z("expanded-pool"),z("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],HA={"bpmn:MessageEventDefinition":[z("message-start"),z("message-intermediate-catch"),z("message-intermediate-throw"),z("message-end")],"bpmn:TimerEventDefinition":[z("timer-start"),z("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[z("conditional-start"),z("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[z("signal-start"),z("signal-intermediate-catch"),z("signal-intermediate-throw"),z("signal-end")],"bpmn:ErrorEventDefinition":[z("error-start"),z("error-end")],"bpmn:EscalationEventDefinition":[z("escalation-start"),z("escalation-intermediate-throw"),z("escalation-end")],"bpmn:CompensateEventDefinition":[z("compensation-start"),z("compensation-intermediate-throw"),z("compensation-end")]};const Yv={"start-event-non-interrupting":`
|
|
315
|
+
</svg>`},PM=900;function Mo(e,t,n,i){e.registerProvider(PM,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}Mo.$inject=["contextPad","popupMenu","translate","canvas"],Mo.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&D(t,this._getEntries(e)),t},Mo.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},Mo.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${h_.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);D(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},Mo.prototype._getMenuPosition=function(e){var t=5,n=this._contextPad.getPad(e).html,i=n.getBoundingClientRect(),r={x:i.left,y:i.bottom+t};return r};var AM=["left","center","right","top","middle","bottom"];function La(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}La.$inject=["popupMenu","alignElements","translate","rules"],La.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&D(t,this._getEntries(e)),t},La.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},La.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return M(AM,function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:h_[o],action:function(){t.trigger(e,o),i.close()}}}),r};function Kc(e){Vn.call(this,e)}Kc.$inject=["eventBus"],ie(Kc,Vn),Kc.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=Oe(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=vs(n),n.length<2?!1:n})};const TM={__depends__:[FT,Rv,uf],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",Mo],alignElementsMenuProvider:["type",La],bpmnAlignElements:["type",Kc]};function Bi(e,t,n,i){Y.call(this,e),this._elementRegistry=t,this._modeling=n,this._rules=i;var r=this;this.postExecuted(["shape.create"],function(o){var a=o.context,s=a.hints||{},c=a.shape,u=a.parent||a.newParent;s.autoResize!==!1&&r._expand([c],u)}),this.postExecuted(["elements.move"],function(o){var a=o.context,s=bu(Kr(a.closure.topLevel)),c=a.hints,u=c?c.autoResize:!0;if(u!==!1){var l=Xr(s,function(p){return p.parent.id});M(l,function(p,f){ge(u)&&(p=p.filter(function(d){return at(u,Zr({id:d.id}))})),r._expand(p,f)})}}),this.postExecuted(["shape.toggleCollapse"],function(o){var a=o.context,s=a.hints,c=a.shape;s&&s.autoResize===!1||c.collapsed||r._expand(c.children||[],c)}),this.postExecuted(["shape.resize"],function(o){var a=o.context,s=a.hints,c=a.shape,u=c.parent;s&&s.autoResize===!1||u&&r._expand([c],u)})}Bi.$inject=["eventBus","elementRegistry","modeling","rules"],ie(Bi,Y),Bi.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=me(Rt(e)),o=me(t),a={};return r.top-o.top<i.top&&(a.top=r.top-n.top),r.left-o.left<i.left&&(a.left=r.left-n.left),o.right-r.right<i.right&&(a.right=r.right+n.right),o.bottom-r.bottom<i.bottom&&(a.bottom=r.bottom+n.bottom),xs(D({},o,a))},Bi.prototype._expand=function(e,t){typeof t=="string"&&(t=this._elementRegistry.get(t));var n=this._rules.allowed("element.autoResize",{elements:e,target:t});if(n){var i=this._getOptimalBounds(e,t);if(MM(i,t)){var r=kM(Jn(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:r});var o=t.parent;o&&this._expand([t],o)}}},Bi.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},Bi.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},Bi.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function MM(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function kM(e,t){var n="";return e=me(e),t=me(t),e.top>t.top&&(n=n.concat("n")),e.right<t.right&&(n=n.concat("w")),e.bottom<t.bottom&&(n=n.concat("s")),e.left>t.left&&(n=n.concat("e")),n}function Xc(e){e.invoke(Bi,this)}Xc.$inject=["injector"],ie(Xc,Bi),Xc.prototype.resize=function(e,t,n){v(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};function Ia(e){Vn.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}Ia.$inject=["eventBus"],ie(Ia,Vn),Ia.prototype.canResize=function(e,t){return!1};function Zc(e,t){Ia.call(this,e),this._modeling=t}ie(Zc,Ia),Zc.$inject=["eventBus","modeling"],Zc.prototype.canResize=function(e,t){if(v(t.di,"bpmndi:BPMNPlane")||!v(t,"bpmn:Participant")&&!v(t,"bpmn:Lane")&&!v(t,"bpmn:SubProcess"))return!1;var n=!0;return M(e,function(i){if(v(i,"bpmn:Lane")||ke(i)){n=!1;return}}),n};const DM={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",Xc],bpmnAutoResizeProvider:["type",Zc]};function ko(e,t,n){this._canvas=n,this._opts=D({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var i=this;t.on("drag.move",function(r){var o=i._toBorderPoint(r);i.startScroll(o)}),t.on(["drag.cleanup"],function(){i.stopScroll()})}ko.$inject=["config.autoScroll","eventBus","canvas"],ko.prototype.startScroll=function(e){var t=this._canvas,n=this._opts,i=this,r=t.getContainer().getBoundingClientRect(),o=[e.x,e.y,r.width-e.x,r.height-e.y];this.stopScroll();for(var a=0,s=0,c=0;c<4;c++)OM(o[c],n.scrollThresholdOut[c],n.scrollThresholdIn[c])&&(c===0?a=n.scrollStep:c==1?s=n.scrollStep:c==2?a=-n.scrollStep:c==3&&(s=-n.scrollStep));(a!==0||s!==0)&&(t.scroll({dx:a,dy:s}),this._scrolling=setTimeout(function(){i.startScroll(e)},n.scrollRepeatTimeout))};function OM(e,t,n){return t<e&&e<n}ko.prototype.stopScroll=function(){clearTimeout(this._scrolling)},ko.prototype.setOptions=function(e){this._opts=D({},this._opts,e)},ko.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=Lr(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const LM={__depends__:[ki],__init__:["autoScroll"],autoScroll:["type",ko]};var m_="djs-bendpoint",g_="djs-segment-dragger";function IM(e,t){var n=Lr(t),i=e._container.getBoundingClientRect(),r;r={x:i.left,y:i.top};var o=e.viewbox();return{x:o.x+(n.x-r.x)/o.scale,y:o.y+(n.y-r.y)/o.scale}}function lf(e,t,n){var i=IM(e,n),r=Al(t,i);return r}function pf(e,t){var n=pe("g");$e(n).add(m_),Se(e,n);var i=pe("circle");re(i,{cx:0,cy:0,r:4}),$e(i).add("djs-visual"),Se(n,i);var r=pe("circle");return re(r,{cx:0,cy:0,r:10}),$e(r).add("djs-hit"),Se(n,r),t&&$e(n).add(t),n}function NM(e,t,n,i){var r=pe("g");Se(e,r);var o=18,a=6,s=11,c=$M(t,n,i),u=a+s,l=pe("rect");re(l,{x:-o/2,y:-a/2,width:o,height:a}),$e(l).add("djs-visual"),Se(r,l);var p=pe("rect");return re(p,{x:-c/2,y:-u/2,width:c,height:u}),$e(p).add("djs-hit"),Se(r,p),Vh(r,i==="v"?90:0),r}function y_(e,t,n){var i=pe("g"),r=il(t,n),o=Ri(t,n);return Se(e,i),NM(i,t,n,o),$e(i).add(g_),$e(i).add(o==="h"?"horizontal":"vertical"),Zt(i,r.x,r.y),i}function ff(e){return Math.abs(Math.round(e*2/3))}function BM(e,t){var n=jM(e,t);return Ll(e,n)}function $M(e,t,n){var i=t.x-e.x,r=t.y-e.y;return ff(n==="h"?i:r)}function jM(e,t){for(var n=t.waypoints,i=1/0,r,o=0;o<n.length-1;o++){var a=n[o],s=n[o+1],c=Tm(e,[a,s]);c<i&&(i=c,r=o)}return[n[r],n[r+1]]}function v_(e,t,n,i,r){function o(x,b,w){var T=x.index,L=x.point,A,F,H,N,z,ue;return T<=0||x.bendpoint?!1:(A=b[T-1],F=b[T],H=il(A,F),N=Ri(A,F),z=Math.abs(L.x-H.x),ue=Math.abs(L.y-H.y),N&&z<=w&&ue<=w)}function a(x,b){var w=x.waypoints,T,L,A,F;return b.index<=0||b.bendpoint||(T={start:w[b.index-1],end:w[b.index]},L=Ri(T.start,T.end),!L)?null:(L==="h"?A=T.end.x-T.start.x:A=T.end.y-T.start.y,F=ff(A)/2,F)}function s(x,b){var w=b.waypoints,T=lf(t,w,x),L;if(T){L=a(b,T);var A;if(o(T,w,L)?A=r.start(x,b,T.index):A=i.start(x,b,T.index,!T.bendpoint),A!==!1)return!0}}function c(x,b,w){we.bind(x,b,function(T){n.triggerMouseEvent(b,T,w),T.stopPropagation()})}function u(x,b){var w=t.getLayer("overlays"),T=et('.djs-bendpoints[data-element-id="'+Ta(x.id)+'"]',w);return!T&&b&&(T=pe("g"),re(T,{"data-element-id":x.id}),$e(T).add("djs-bendpoints"),Se(w,T),c(T,"mousedown",x),c(T,"click",x),c(T,"dblclick",x)),T}function l(x,b){return et('.djs-segment-dragger[data-segment-idx="'+x+'"]',b)}function p(x,b){b.waypoints.forEach(function(w,T){var L=pf(x);Se(x,L),Zt(L,w.x,w.y)}),pf(x,"floating")}function f(x,b){for(var w=b.waypoints,T,L,A,F=1;F<w.length;F++)T=w[F-1],L=w[F],Ri(T,L)&&(A=y_(x,T,L),re(A,{"data-segment-idx":F}),c(A,"mousemove",b))}function d(x){M(hs("."+m_,x),function(b){It(b)})}function h(x){M(hs("."+g_,x),function(b){It(b)})}function m(x){var b=u(x);return b||(b=u(x,!0),p(b,x),f(b,x)),b}function g(x){var b=u(x);b&&(h(b),d(b),f(b,x),p(b,x))}function R(x,b){var w=et(".floating",x),T=b.point;w&&(Zt(w,T.x,T.y),$e(w).add("positioned"))}function E(x,b,w){var T=l(b.index,x),L=w[b.index-1],A=w[b.index],F=b.point,H=il(L,A),N=Ri(L,A),z,ue;T&&(z=FM(T),ue={x:F.x-H.x,y:F.y-H.y},N==="v"&&(ue={x:ue.y,y:ue.x}),Zt(z,ue.x,ue.y))}e.on("connection.changed",function(x){g(x.element)}),e.on("connection.remove",function(x){var b=u(x.element);b&&It(b)}),e.on("element.marker.update",function(x){var b=x.element,w;b.waypoints&&(w=m(b),x.add?$e(w).add(x.marker):$e(w).remove(x.marker))}),e.on("element.mousemove",function(x){var b=x.element,w=b.waypoints,T,L;if(w){if(T=u(b,!0),L=lf(t,w,x.originalEvent),!L)return;R(T,L),L.bendpoint||E(T,L,w)}}),e.on("element.mousedown",function(x){if(rr(x)){var b=x.originalEvent,w=x.element;if(w.waypoints)return s(b,w)}}),e.on("selection.changed",function(x){var b=x.newSelection,w=b[0];w&&w.waypoints&&m(w)}),e.on("element.hover",function(x){var b=x.element;b.waypoints&&m(b)}),e.on("element.out",function(x){var b=x.element;if(b.waypoints){var w=u(b);if(w){var T=et(".floating",w);T&&$e(T).remove("positioned")}}}),e.on("element.updateId",function(x){var b=x.element,w=x.newId;if(b.waypoints){var T=u(b);T&&re(T,{"data-element-id":w})}}),this.addHandles=m,this.updateHandles=g,this.getBendpointsContainer=u,this.getSegmentDragger=l}v_.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function FM(e){return et(".djs-visual",e)}var __=Math.round,zr="reconnectStart",Vr="reconnectEnd",Na="updateWaypoints";function df(e,t,n,i,r,o){this._injector=e,this.start=function(a,s,c,u){var l=n.getGraphics(s),p=s.source,f=s.target,d=s.waypoints,h;!u&&c===0?h=zr:!u&&c===d.length-1?h=Vr:h=Na;var m=h===Na?"connection.updateWaypoints":"connection.reconnect",g=r.allowed(m,{connection:s,source:p,target:f});if(g===!1&&(g=r.allowed(m,{connection:s,source:f,target:p})),g!==!1)return i.init(a,"bendpoint.move",{data:{connection:s,connectionGfx:l,context:{allowed:g,bendpointIndex:c,connection:s,source:p,target:f,insert:u,type:h}}})},t.on("bendpoint.move.hover",function(a){var s=a.context,c=s.connection,u=c.source,l=c.target,p=a.hover,f=s.type;s.hover=p;var d;if(p){var h=f===Na?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=r.allowed(h,{connection:c,source:f===zr?p:u,target:f===Vr?p:l}),d){s.source=f===zr?p:u,s.target=f===Vr?p:l;return}d===!1&&(d=s.allowed=r.allowed(h,{connection:c,source:f===Vr?p:l,target:f===zr?p:u})),d&&(s.source=f===Vr?p:l,s.target=f===zr?p:u)}}),t.on(["bendpoint.move.out","bendpoint.move.cleanup"],function(a){var s=a.context,c=s.type;s.hover=null,s.source=null,s.target=null,c!==Na&&(s.allowed=!1)}),t.on("bendpoint.move.end",function(a){var s=a.context,c=s.allowed,u=s.bendpointIndex,l=s.connection,p=s.insert,f=l.waypoints.slice(),d=s.source,h=s.target,m=s.type,g=s.hints||{},R={x:__(a.x),y:__(a.y)};if(!c)return!1;m===Na?(p?f.splice(u,0,R):f[u]=R,g.bendpointMove={insert:p,bendpointIndex:u},f=this.cropWaypoints(l,f),o.updateWaypoints(l,i1(f),g)):(m===zr?(g.docking="source",Qc(s)&&(g.docking="target",g.newWaypoints=f.reverse())):m===Vr&&(g.docking="target",Qc(s)&&(g.docking="source",g.newWaypoints=f.reverse())),o.reconnect(l,d,h,R,g))},this)}df.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],df.prototype.cropWaypoints=function(e,t){var n=this._injector.get("connectionDocking",!1);if(!n)return t;var i=e.waypoints;return e.waypoints=t,e.waypoints=n.getCroppedWaypoints(e),t=e.waypoints,e.waypoints=i,t};function Qc(e){var t=e.hover,n=e.source,i=e.target,r=e.type;if(r===zr)return t&&i&&t===i&&n!==i;if(r===Vr)return t&&n&&t===n&&n!==i}var HM="reconnectStart",zM="reconnectEnd",b_="updateWaypoints",Ba="connect-ok",Jc="connect-not-ok",x_="connect-hover",E_="djs-updating",w_="djs-dragging",S_=1100;function R_(e,t,n,i){this._injector=t;var r=t.get("connectionPreview",!1);n.on("bendpoint.move.start",function(o){var a=o.context,s=a.bendpointIndex,c=a.connection,u=a.insert,l=c.waypoints,p=l.slice();a.waypoints=l,u&&p.splice(s,0,{x:o.x,y:o.y}),c.waypoints=p;var f=a.draggerGfx=pf(i.getLayer("overlays"));$e(f).add("djs-dragging"),i.addMarker(c,w_),i.addMarker(c,E_)}),n.on("bendpoint.move.hover",function(o){var a=o.context,s=a.allowed,c=a.hover,u=a.type;if(c){if(i.addMarker(c,x_),u===b_)return;s?(i.removeMarker(c,Jc),i.addMarker(c,Ba)):s===!1&&(i.removeMarker(c,Ba),i.addMarker(c,Jc))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],S_,function(o){var a=o.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,x_),i.removeMarker(s,c?Ba:Jc))}),n.on("bendpoint.move.move",function(o){var a=o.context,s=a.allowed,c=a.bendpointIndex,u=a.draggerGfx,l=a.hover,p=a.type,f=a.connection,d=f.source,h=f.target,m=f.waypoints.slice(),g={x:o.x,y:o.y},R=a.hints||{},E={};r&&(R.connectionStart&&(E.connectionStart=R.connectionStart),R.connectionEnd&&(E.connectionEnd=R.connectionEnd),p===HM?Qc(a)?(E.connectionEnd=E.connectionEnd||g,E.source=h,E.target=l||d,m=m.reverse()):(E.connectionStart=E.connectionStart||g,E.source=l||d,E.target=h):p===zM?Qc(a)?(E.connectionStart=E.connectionStart||g,E.source=l||h,E.target=d,m=m.reverse()):(E.connectionEnd=E.connectionEnd||g,E.source=d,E.target=l||h):(E.noCropping=!0,E.noLayout=!0,m[c]=g),p===b_&&(m=e.cropWaypoints(f,m)),E.waypoints=m,r.drawPreview(a,s,E)),Zt(u,o.x,o.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],S_,function(o){var a=o.context,s=a.connection,c=a.draggerGfx,u=a.hover,l=a.target,p=a.waypoints;s.waypoints=p,It(c),i.removeMarker(s,E_),i.removeMarker(s,w_),u&&(i.removeMarker(u,Ba),i.removeMarker(u,l?Ba:Jc)),r&&r.cleanUp(a)})}R_.$inject=["bendpointMove","injector","eventBus","canvas"];var C_="connect-hover",P_="djs-updating";function A_(e,t,n){return hf(e,t,e[t]+n)}function hf(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function VM(e,t,n,i){var r=Math.max(t[i],n[i]),o=Math.min(t[i],n[i]),a=20,s=Math.min(Math.max(o+a,e[i]),r-a);return hf(t,i,s)}function T_(e){return e==="x"?"y":"x"}function M_(e,t,n){var i,r;return e.original?e.original:(i=ye(t),r=T_(n),hf(e,r,i[r]))}function k_(e,t,n,i,r,o){var a=e.get("connectionDocking",!1);this.start=function(p,f,d){var h,m=n.getGraphics(f),g=d-1,R=d,E=f.waypoints,x=E[g],b=E[R],w=lf(n,E,p),T,L,A;if(T=Ri(x,b),!!T)return L=T==="v"?"x":"y",g===0&&(x=M_(x,f.source,L)),R===E.length-1&&(b=M_(b,f.target,L)),w?A=w.point:A={x:(x.x+b.x)/2,y:(x.y+b.y)/2},h={connection:f,segmentStartIndex:g,segmentEndIndex:R,segmentStart:x,segmentEnd:b,axis:L,dragPosition:A},i.init(p,A,"connectionSegment.move",{cursor:L==="x"?"resize-ew":"resize-ns",data:{connection:f,connectionGfx:m,context:h}})};function s(p,f){if(!a)return f;var d=p.waypoints,h;return p.waypoints=f,h=a.getCroppedWaypoints(p),p.waypoints=d,h}function c(p){r.update("connection",p.connection,p.connectionGfx)}function u(p,f,d){var h=p.newWaypoints,m=p.segmentStartIndex+f,g=h[m],R=p.segmentEndIndex+f,E=h[R],x=T_(p.axis),b=VM(d,g,E,x);Zt(p.draggerGfx,b.x,b.y)}function l(p,f){var d=0,h=p.filter(function(m,g){return nl(p[g-1],p[g+1],m)?(d=g<=f?d-1:d,!1):!0});return{waypoints:h,segmentOffset:d}}t.on("connectionSegment.move.start",function(p){var f=p.context,d=p.connection,h=n.getLayer("overlays");f.originalWaypoints=d.waypoints.slice(),f.draggerGfx=y_(h,f.segmentStart,f.segmentEnd),$e(f.draggerGfx).add("djs-dragging"),n.addMarker(d,P_)}),t.on("connectionSegment.move.move",function(p){var f=p.context,d=f.connection,h=f.segmentStartIndex,m=f.segmentEndIndex,g=f.segmentStart,R=f.segmentEnd,E=f.axis,x=f.originalWaypoints.slice(),b=A_(g,E,p["d"+E]),w=A_(R,E,p["d"+E]),T=x.length,L=0;x[h]=b,x[m]=w;var A,F;h<2&&(A=Xt(d.source,b),h===1?A==="intersect"&&(x.shift(),x[0]=b,L--):A!=="intersect"&&(x.unshift(g),L++)),m>T-3&&(F=Xt(d.target,w),m===T-2?F==="intersect"&&(x.pop(),x[x.length-1]=w):F!=="intersect"&&x.push(R)),f.newWaypoints=d.waypoints=s(d,x),u(f,L,p),f.newSegmentStartIndex=h+L,c(p)}),t.on("connectionSegment.move.hover",function(p){p.context.hover=p.hover,n.addMarker(p.hover,C_)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var f=p.context.hover;f&&n.removeMarker(f,C_)}),t.on("connectionSegment.move.cleanup",function(p){var f=p.context,d=f.connection;f.draggerGfx&&It(f.draggerGfx),n.removeMarker(d,P_)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(p){var f=p.context,d=f.connection;d.waypoints=f.originalWaypoints,c(p)}),t.on("connectionSegment.move.end",function(p){var f=p.context,d=f.connection,h=f.newWaypoints,m=f.newSegmentStartIndex;h=h.map(function(w){return{original:w.original,x:Math.round(w.x),y:Math.round(w.y)}});var g=l(h,m),R=g.waypoints,E=s(d,R),x=g.segmentOffset,b={segmentMove:{segmentStartIndex:f.segmentStartIndex,newSegmentStartIndex:m+x}};o.updateWaypoints(d,E,b)})}k_.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var GM=Math.abs,D_=Math.round;function WM(e,t,n){n=n===void 0?10:n;var i,r;for(i=0;i<t.length;i++)if(r=t[i],GM(r-e)<=n)return r}function O_(e){return{x:e.x,y:e.y}}function L_(e){return{x:e.x+e.width,y:e.y+e.height}}function qn(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:D_(e.x+e.width/2),y:D_(e.y+e.height/2)}}function Do(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function Tt(e,t,n){if(typeof t!="string")throw new Error("axis must be in [x, y]");if(typeof n!="number"&&n!==!1)throw new Error("value must be Number or false");var i,r=e[t],o=e.snapped=e.snapped||{};return n===!1?o[t]=!1:(o[t]=!0,i=n-r,e[t]+=i,e["d"+t]+=i),r}function I_(e){return e.children||[]}var UM=Math.abs,N_=Math.round,mf=10;function B_(e){function t(o,a){if(ge(o)){for(var s=o.length;s--;)if(UM(o[s]-a)<=mf)return o[s]}else{o=+o;var c=a%o;if(c<mf)return a-c;if(c>o-mf)return a-c+o}return a}function n(o,a){if(o.waypoints)return BM(a,o);if(o.width)return{x:N_(o.width/2+o.x),y:N_(o.height/2+o.y)}}function i(o){var a=o.context,s=a.snapPoints,c=a.connection,u=c.waypoints,l=a.segmentStart,p=a.segmentStartIndex,f=a.segmentEnd,d=a.segmentEndIndex,h=a.axis;if(s)return s;var m=[u[p-1],l,f,u[d+1]];return p<2&&m.unshift(n(c.source,o)),d>u.length-3&&m.unshift(n(c.target,o)),a.snapPoints=s={horizontal:[],vertical:[]},M(m,function(g){g&&(g=g.original||g,h==="y"&&s.horizontal.push(g.y),h==="x"&&s.vertical.push(g.x))}),s}e.on("connectionSegment.move.move",1500,function(o){var a=i(o),s=o.x,c=o.y,u,l;if(a){u=t(a.vertical,s),l=t(a.horizontal,c);var p=s-u,f=c-l;D(o,{dx:o.dx-p,dy:o.dy-f,x:u,y:l}),(p||a.vertical.indexOf(s)!==-1)&&Tt(o,"x",u),(f||a.horizontal.indexOf(c)!==-1)&&Tt(o,"y",l)}});function r(o){var a=o.snapPoints,s=o.connection.waypoints,c=o.bendpointIndex;if(a)return a;var u=[s[c-1],s[c+1]];return o.snapPoints=a={horizontal:[],vertical:[]},M(u,function(l){l&&(l=l.original||l,a.horizontal.push(l.y),a.vertical.push(l.x))}),a}e.on(["connect.hover","connect.move","connect.end"],1500,function(o){var a=o.context,s=a.hover,c=s&&n(s,o);!it(s)||!c||!c.x||!c.y||(Tt(o,"x",c.x),Tt(o,"y",c.y))}),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(o){var a=o.context,s=r(a),c=a.hover,u=c&&n(c,o),l=o.x,p=o.y,f,d;if(s){f=t(u?s.vertical.concat([u.x]):s.vertical,l),d=t(u?s.horizontal.concat([u.y]):s.horizontal,p);var h=l-f,m=p-d;D(o,{dx:o.dx-h,dy:o.dy-m,x:o.x-h,y:o.y-m}),(h||s.vertical.indexOf(l)!==-1)&&Tt(o,"x",f),(m||s.horizontal.indexOf(p)!==-1)&&Tt(o,"y",d)}})}B_.$inject=["eventBus"];const qM={__depends__:[ki,gi],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",v_],bendpointMove:["type",df],bendpointMovePreview:["type",R_],connectionSegmentMove:["type",k_],bendpointSnapping:["type",B_]};function $_(e,t,n,i){function r(a,s){return i.allowed("connection.create",{source:a,target:s})}function o(a,s){return r(s,a)}e.on("connect.hover",function(a){var s=a.context,c=s.start,u=a.hover,l;if(s.hover=u,l=s.canExecute=r(c,u),!Yr(l)){if(l!==!1){s.source=c,s.target=u;return}l=s.canExecute=o(c,u),!Yr(l)&&l!==!1&&(s.source=u,s.target=c)}}),e.on(["connect.out","connect.cleanup"],function(a){var s=a.context;s.hover=null,s.source=null,s.target=null,s.canExecute=!1}),e.on("connect.end",function(a){var s=a.context,c=s.canExecute,u=s.connectionStart,l={x:a.x,y:a.y},p=s.source,f=s.target;if(!c)return!1;var d=null,h={connectionStart:gf(s)?l:u,connectionEnd:gf(s)?u:l};Ht(c)&&(d=c),s.connection=n.connect(p,f,d,h)}),this.start=function(a,s,c,u){Ht(c)||(u=c,c=ye(s)),t.init(a,"connect",{autoActivate:u,data:{shape:s,context:{start:s,connectionStart:c}}})}}$_.$inject=["eventBus","dragging","modeling","rules"];function gf(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var YM=1100,KM=900,j_="connect-ok",F_="connect-not-ok";function H_(e,t,n){var i=e.get("connectionPreview",!1);i&&t.on("connect.move",function(r){var o=r.context,a=o.canExecute,s=o.hover,c=o.source,u=o.start,l=o.startPosition,p=o.target,f=o.connectionStart||l,d=o.connectionEnd||{x:r.x,y:r.y},h=f,m=d;gf(o)&&(h=d,m=f),i.drawPreview(o,a,{source:c||u,target:p||s,connectionStart:h,connectionEnd:m})}),t.on("connect.hover",KM,function(r){var o=r.context,a=r.hover,s=o.canExecute;s!==null&&n.addMarker(a,s?j_:F_)}),t.on(["connect.out","connect.cleanup"],YM,function(r){var o=r.hover;o&&(n.removeMarker(o,j_),n.removeMarker(o,F_))}),i&&t.on("connect.cleanup",function(r){i.cleanUp(r.context)})}H_.$inject=["injector","eventBus","canvas"];const yf={__depends__:[Gn,gi,ki],__init__:["connectPreview"],connect:["type",$_],connectPreview:["type",H_]};var XM="djs-dragger";function $i(e,t,n,i){this._canvas=t,this._graphicsFactory=n,this._elementFactory=i,this._connectionDocking=e.get("connectionDocking",!1),this._layouter=e.get("layouter",!1)}$i.$inject=["injector","canvas","graphicsFactory","elementFactory"],$i.prototype.drawPreview=function(e,t,n){n=n||{};var i=e.connectionPreviewGfx,r=e.getConnection,o=n.source,a=n.target,s=n.waypoints,c=n.connectionStart,u=n.connectionEnd,l=n.noLayout,p=n.noCropping,f=n.noNoop,d,h=this;if(i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),ms(i),r||(r=e.getConnection=ZM(function(m,g,R){return h.getConnection(m,g,R)})),t&&(d=r(t,o,a)),!d){!f&&this.drawNoopPreview(i,n);return}d.waypoints=s||[],this._layouter&&!l&&(d.waypoints=this._layouter.layoutConnection(d,{source:o,target:a,connectionStart:c,connectionEnd:u,waypoints:n.waypoints||d.waypoints})),(!d.waypoints||!d.waypoints.length)&&(d.waypoints=[o?ye(o):c,a?ye(a):u]),this._connectionDocking&&(o||a)&&!p&&(d.waypoints=this._connectionDocking.getCroppedWaypoints(d,o,a)),this._graphicsFactory.drawConnection(i,d,{stroke:"var(--element-dragger-color)"})},$i.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||ye(n),o=t.connectionEnd||ye(i),a=this.cropWaypoints(r,o,n,i),s=this.createNoopConnection(a[0],a[1]);Se(e,s)},$i.prototype.cropWaypoints=function(e,t,n,i){var r=this._graphicsFactory,o=n&&r.getShapePath(n),a=i&&r.getShapePath(i),s=r.getConnectionPath({waypoints:[e,t]});return e=n&&Zo(o,s,!0)||e,t=i&&Zo(a,s,!1)||t,[e,t]},$i.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&It(e.connectionPreviewGfx)},$i.prototype.getConnection=function(e){var t=QM(e);return this._elementFactory.createConnection(t)},$i.prototype.createConnectionPreviewGfx=function(){var e=pe("g");return re(e,{pointerEvents:"none"}),$e(e).add(XM),Se(this._canvas.getActiveLayer(),e),e},$i.prototype.createNoopConnection=function(e,t){return qo([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function ZM(e){var t={};return function(n){var i=JSON.stringify(n),r=t[i];return r||(r=t[i]=e.apply(null,arguments)),r}}function QM(e){return Ht(e)?e:{}}const JM={__init__:["connectionPreview"],connectionPreview:["type",$i]},eu="complex-preview";class z_{constructor(t,n,i){this._canvas=t,this._graphicsFactory=n,this._previewSupport=i,this._markers=[]}create(t){this.cleanUp();const{created:n=[],moved:i=[],removed:r=[],resized:o=[]}=t,a=this._canvas.getLayer(eu);n.filter(s=>!e2(s)).forEach(s=>{let c;it(s)?(c=this._graphicsFactory._createContainer("connection",pe("g")),this._graphicsFactory.drawConnection(kr(c),s)):(c=this._graphicsFactory._createContainer("shape",pe("g")),this._graphicsFactory.drawShape(kr(c),s),Zt(c,s.x,s.y)),this._previewSupport.addDragger(s,a,c)}),i.forEach(({element:s,delta:c})=>{this._previewSupport.addDragger(s,a,void 0,"djs-dragging"),this._canvas.addMarker(s,"djs-element-hidden"),this._markers.push([s,"djs-element-hidden"]);const u=this._previewSupport.addDragger(s,a);it(s)?Zt(u,c.x,c.y):Zt(u,s.x+c.x,s.y+c.y)}),r.forEach(s=>{this._previewSupport.addDragger(s,a,void 0,"djs-dragging"),this._canvas.addMarker(s,"djs-element-hidden"),this._markers.push([s,"djs-element-hidden"])}),o.forEach(({shape:s,bounds:c})=>{this._canvas.addMarker(s,"djs-hidden"),this._markers.push([s,"djs-hidden"]),this._previewSupport.addDragger(s,a,void 0,"djs-dragging");const u=this._graphicsFactory._createContainer("shape",pe("g"));this._graphicsFactory.drawShape(kr(u),s,{width:c.width,height:c.height}),Zt(u,c.x,c.y),this._previewSupport.addDragger(s,a,u)})}cleanUp(){ms(this._canvas.getLayer(eu)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(eu)}hide(){this._canvas.hideLayer(eu)}}z_.$inject=["canvas","graphicsFactory","previewSupport"];function e2(e){return e.hidden}const t2={__depends__:[Eo],__init__:["complexPreview"],complexPreview:["type",z_]},V_=Math.round;function tu(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}tu.prototype.create=function(e,t,n){const i=this._complexPreview,r=this._connectionDocking,o=this._elementFactory,a=this._eventBus,s=this._layouter,c=this._rules,u=o.createShape(D({type:t},n)),l=a.fire("autoPlace",{source:e,shape:u});if(!l)return;D(u,{x:l.x-V_(u.width/2),y:l.y-V_(u.height/2)});const p=c.allowed("connection.create",{source:e,target:u,hints:{targetParent:e.parent}});let f=null;p&&(f=o.createConnection(p),f.waypoints=s.layoutConnection(f,{source:e,target:u}),f.waypoints=r.getCroppedWaypoints(f,e,u)),i.create({created:[u,f].filter(d=>!Yr(d))})},tu.prototype.cleanUp=function(){this._complexPreview.cleanUp()},tu.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const n2={__depends__:[Ac,t2,zp],__init__:["appendPreview"],appendPreview:["type",tu]};var G_=Math.min,W_=Math.max;function vf(e){e.preventDefault()}function $a(e){e.stopPropagation()}function i2(e){return e.nodeType===Node.TEXT_NODE}function r2(e){return[].slice.call(e)}function ti(e){this.container=e.container,this.parent=ut('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=et("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=mn(this.autoResize,this),this.handlePaste=mn(this.handlePaste,this)}ti.prototype.create=function(e,t,n,i){var r=this,o=this.parent,a=this.content,s=this.container;i=this.options=i||{},t=this.style=t||{};var c=Jn(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);D(o.style,{width:e.width+"px",height:e.height+"px",maxWidth:e.maxWidth+"px",maxHeight:e.maxHeight+"px",minWidth:e.minWidth+"px",minHeight:e.minHeight+"px",left:e.x+"px",top:e.y+"px",backgroundColor:"#ffffff",position:"absolute",overflow:"visible",border:"1px solid #ccc",boxSizing:"border-box",wordWrap:"normal",textAlign:"center",outline:"none"},c);var u=Jn(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return D(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},u),i.centerVertically&&D(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},u),a.innerText=n,we.bind(a,"keydown",this.keyHandler),we.bind(a,"mousedown",$a),we.bind(a,"paste",r.handlePaste),we.bind(a,"focusout",this.focusoutHandler),i.autoResize&&we.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(o),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),o},ti.prototype.handlePaste=function(e){var t=this.options,n=this.style;e.preventDefault();var i;if(e.clipboardData?i=e.clipboardData.getData("text/plain"):i=window.clipboardData.getData("Text"),this.insertText(i),t.autoResize){var r=this.autoResize(n);r&&this.resizeHandler(r)}},ti.prototype.insertText=function(e){e=o2(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},ti.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,r=t.startOffset,o=t.endOffset,a=t.commonAncestorContainer,s=r2(a.childNodes),c,u;if(i2(a)){var l=n.textContent;n.textContent=l.substring(0,r)+e+l.substring(o),c=n,u=r+e.length}else if(n===this.content&&i===this.content){var p=document.createTextNode(e);this.content.insertBefore(p,s[r]),c=p,u=p.textContent.length}else{var f=s.indexOf(n),d=s.indexOf(i);s.forEach(function(h,m){m===f?h.textContent=n.textContent.substring(0,r)+e+i.textContent.substring(o):m>f&&m<=d&&li(h)}),c=n,u=r+e.length}c&&u!==void 0&&setTimeout(function(){self.setSelection(c,u)})},ti.prototype.autoResize=function(){var e=this.parent,t=this.content,n=parseInt(this.style.fontSize)||12;if(t.scrollHeight>e.offsetHeight||t.scrollHeight<e.offsetHeight-n){var i=e.getBoundingClientRect(),r=t.scrollHeight;e.style.height=r+"px",this.resizeHandler({width:i.width,height:i.height,dx:0,dy:r-i.height})}},ti.prototype.resizable=function(){var e=this,t=this.parent,n=this.resizeHandle,i=parseInt(this.style.minWidth)||0,r=parseInt(this.style.minHeight)||0,o=parseInt(this.style.maxWidth)||1/0,a=parseInt(this.style.maxHeight)||1/0;if(!n){n=this.resizeHandle=ut('<div class="djs-direct-editing-resize-handle"></div>');var s,c,u,l,p=function(h){vf(h),$a(h),s=h.clientX,c=h.clientY;var m=t.getBoundingClientRect();u=m.width,l=m.height,we.bind(document,"mousemove",f),we.bind(document,"mouseup",d)},f=function(h){vf(h),$a(h);var m=G_(W_(u+h.clientX-s,i),o),g=G_(W_(l+h.clientY-c,r),a);t.style.width=m+"px",t.style.height=g+"px",e.resizeHandler({width:u,height:l,dx:h.clientX-s,dy:h.clientY-c})},d=function(h){vf(h),$a(h),we.unbind(document,"mousemove",f,!1),we.unbind(document,"mouseup",d,!1)};we.bind(n,"mousedown",p)}D(n.style,{position:"absolute",bottom:"0px",right:"0px",cursor:"nwse-resize",width:"0",height:"0",borderTop:(parseInt(this.style.fontSize)/4||3)+"px solid transparent",borderRight:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderBottom:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderLeft:(parseInt(this.style.fontSize)/4||3)+"px solid transparent"}),t.appendChild(n)},ti.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),we.unbind(t,"keydown",this.keyHandler),we.unbind(t,"mousedown",$a),we.unbind(t,"input",this.autoResize),we.unbind(t,"paste",this.handlePaste),we.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),li(n)),li(e)},ti.prototype.getValue=function(){return this.content.innerText.trim()},ti.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},ti.prototype.setSelection=function(e,t){var n=document.createRange();e===null?n.selectNodeContents(this.content):(n.setStart(e,t),n.setEnd(e,t));var i=window.getSelection();i.removeAllRanges(),i.addRange(n)};function o2(e){return e.replace(/\r\n|\r|\n/g,`
|
|
316
|
+
`)}function Tn(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new ti({container:t.getContainer(),keyHandler:mn(this._handleKey,this),resizeHandler:mn(this._handleResize,this),focusoutHandler:mn(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}Tn.$inject=["eventBus","canvas"],Tn.prototype.registerProvider=function(e){this._providers.push(e)},Tn.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},Tn.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},Tn.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},Tn.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},Tn.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},Tn.prototype.complete=function(){var e=this._active;if(e){var t,n=e.context.bounds,i=this.$textbox.getBoundingClientRect(),r=this.getValue(),o=e.context.text;(r!==o||i.height!==n.height||i.width!==n.width)&&(t=this._textbox.container.getBoundingClientRect(),e.provider.update(e.element,r,e.context.text,{x:i.left-t.left,y:i.top-t.top,width:i.width,height:i.height})),this._fire("complete"),this.close()}},Tn.prototype.getValue=function(){return this._textbox.getValue()},Tn.prototype._handleKey=function(e){e.stopPropagation();var t=e.keyCode||e.charCode;if(t===27)return e.preventDefault(),this.cancel();if(t===13&&!e.shiftKey)return e.preventDefault(),this.complete()},Tn.prototype._handleResize=function(e){this._fire("resize",e)},Tn.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},Tn.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=at(this._providers,function(i){return(t=i.activate(e))?i:null});return t&&(this.$textbox=this._textbox.create(t.bounds,t.style,t.text,t.options),this._active={element:e,context:t,provider:n},t.options&&t.options.resizable&&(this.resizable=!0),this._fire("activate")),!!t};const U_={__depends__:[rc],__init__:["directEditing"],directEditing:["type",Tn]};function a2(e){return function(t){var n=t.target,i=K(e),r=i.eventDefinitions&&i.eventDefinitions[0],o=i.$type===n.type,a=(r&&r.$type)===n.eventDefinitionType,s=!!n.triggeredByEvent==!!i.triggeredByEvent,c=n.isExpanded===void 0||n.isExpanded===Be(e);return!o||!a||!s||!c}}const s2={task:{label:"Task",className:"bpmn-icon-task",target:{type:"bpmn:Task"}},"user-task":{label:"User task",className:"bpmn-icon-user",target:{type:"bpmn:UserTask"}},"service-task":{label:"Service task",className:"bpmn-icon-service",target:{type:"bpmn:ServiceTask"}},"send-task":{label:"Send task",className:"bpmn-icon-send",target:{type:"bpmn:SendTask"}},"receive-task":{label:"Receive task",className:"bpmn-icon-receive",target:{type:"bpmn:ReceiveTask"}},"manual-task":{label:"Manual task",className:"bpmn-icon-manual",target:{type:"bpmn:ManualTask"}},"rule-task":{label:"Business rule task",className:"bpmn-icon-business-rule",target:{type:"bpmn:BusinessRuleTask"}},"script-task":{label:"Script task",className:"bpmn-icon-script",target:{type:"bpmn:ScriptTask"}},"call-activity":{label:"Call activity",className:"bpmn-icon-call-activity",target:{type:"bpmn:CallActivity"}},transaction:{label:"Transaction",className:"bpmn-icon-transaction",target:{type:"bpmn:Transaction",isExpanded:!0}},"event-subprocess":{label:"Event sub-process",className:"bpmn-icon-event-subprocess-expanded",target:{type:"bpmn:SubProcess",triggeredByEvent:!0,isExpanded:!0}},"collapsed-subprocess":{label:"Sub-process (collapsed)",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:SubProcess",isExpanded:!1}},"expanded-subprocess":{label:"Sub-process (expanded)",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:SubProcess",isExpanded:!0}},"collapsed-ad-hoc-subprocess":{label:"Ad-hoc sub-process (collapsed)",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:AdHocSubProcess",isExpanded:!1}},"expanded-ad-hoc-subprocess":{label:"Ad-hoc sub-process (expanded)",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:AdHocSubProcess",isExpanded:!0}},"exclusive-gateway":{label:"Exclusive gateway",className:"bpmn-icon-gateway-xor",target:{type:"bpmn:ExclusiveGateway"}},"parallel-gateway":{label:"Parallel gateway",className:"bpmn-icon-gateway-parallel",target:{type:"bpmn:ParallelGateway"}},"inclusive-gateway":{label:"Inclusive gateway",className:"bpmn-icon-gateway-or",target:{type:"bpmn:InclusiveGateway"}},"complex-gateway":{label:"Complex gateway",className:"bpmn-icon-gateway-complex",target:{type:"bpmn:ComplexGateway"}},"event-based-gateway":{label:"Event-based gateway",className:"bpmn-icon-gateway-eventbased",target:{type:"bpmn:EventBasedGateway",instantiate:!1,eventGatewayType:"Exclusive"}},"data-store-reference":{label:"Data store reference",className:"bpmn-icon-data-store",target:{type:"bpmn:DataStoreReference"}},"data-object-reference":{label:"Data object reference",className:"bpmn-icon-data-object",target:{type:"bpmn:DataObjectReference"}},"expanded-pool":{label:"Expanded pool/participant",className:"bpmn-icon-participant",target:{type:"bpmn:Participant",isExpanded:!0}},"collapsed-pool":{label:"Empty pool/participant",className:"bpmn-icon-lane",target:{type:"bpmn:Participant",isExpanded:!1}},"none-start-event":{label:"Start event",className:"bpmn-icon-start-event-none",target:{type:"bpmn:StartEvent"}},"none-intermediate-throwing":{label:"Intermediate throw event",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:IntermediateThrowEvent"}},"none-boundary-event":{label:"Boundary event",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:BoundaryEvent"}},"none-end-event":{label:"End event",className:"bpmn-icon-end-event-none",target:{type:"bpmn:EndEvent"}},"message-start":{label:"Message start event",className:"bpmn-icon-start-event-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition",isInterrupting:!0}},"timer-start":{label:"Timer start event",className:"bpmn-icon-start-event-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition",isInterrupting:!0}},"conditional-start":{label:"Conditional start event",className:"bpmn-icon-start-event-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",isInterrupting:!0}},"signal-start":{label:"Signal start event",className:"bpmn-icon-start-event-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition",isInterrupting:!0}},"error-start":{label:"Error start event",className:"bpmn-icon-start-event-error",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ErrorEventDefinition",isInterrupting:!0}},"escalation-start":{label:"Escalation start event",className:"bpmn-icon-start-event-escalation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",isInterrupting:!0}},"compensation-start":{label:"Compensation start event",className:"bpmn-icon-start-event-compensation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:CompensateEventDefinition",isInterrupting:!0}},"non-interrupting-message-start":{label:"Message start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition",isInterrupting:!1}},"non-interrupting-timer-start":{label:"Timer start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition",isInterrupting:!1}},"non-interrupting-conditional-start":{label:"Conditional start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",isInterrupting:!1}},"non-interrupting-signal-start":{label:"Signal start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition",isInterrupting:!1}},"non-interrupting-escalation-start":{label:"Escalation start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-escalation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",isInterrupting:!1}},"message-intermediate-catch":{label:"Message intermediate catch event",className:"bpmn-icon-intermediate-event-catch-message",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},"message-intermediate-throw":{label:"Message intermediate throw event",className:"bpmn-icon-intermediate-event-throw-message",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},"timer-intermediate-catch":{label:"Timer intermediate catch event",className:"bpmn-icon-intermediate-event-catch-timer",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:TimerEventDefinition"}},"escalation-intermediate-throw":{label:"Escalation intermediate throw event",className:"bpmn-icon-intermediate-event-throw-escalation",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},"conditional-intermediate-catch":{label:"Conditional intermediate catch event",className:"bpmn-icon-intermediate-event-catch-condition",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition"}},"link-intermediate-catch":{label:"Link intermediate catch event",className:"bpmn-icon-intermediate-event-catch-link",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:LinkEventDefinition",eventDefinitionAttrs:{name:""}}},"link-intermediate-throw":{label:"Link intermediate throw event",className:"bpmn-icon-intermediate-event-throw-link",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:LinkEventDefinition",eventDefinitionAttrs:{name:""}}},"compensation-intermediate-throw":{label:"Compensation intermediate throw event",className:"bpmn-icon-intermediate-event-throw-compensation",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},"signal-intermediate-catch":{label:"Signal intermediate catch event",className:"bpmn-icon-intermediate-event-catch-signal",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},"signal-intermediate-throw":{label:"Signal intermediate throw event",className:"bpmn-icon-intermediate-event-throw-signal",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},"message-boundary":{label:"Message boundary event",className:"bpmn-icon-intermediate-event-catch-message",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:MessageEventDefinition",cancelActivity:!0}},"timer-boundary":{label:"Timer boundary event",className:"bpmn-icon-intermediate-event-catch-timer",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:TimerEventDefinition",cancelActivity:!0}},"escalation-boundary":{label:"Escalation boundary event",className:"bpmn-icon-intermediate-event-catch-escalation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",cancelActivity:!0}},"conditional-boundary":{label:"Conditional boundary event",className:"bpmn-icon-intermediate-event-catch-condition",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",cancelActivity:!0}},"error-boundary":{label:"Error boundary event",className:"bpmn-icon-intermediate-event-catch-error",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ErrorEventDefinition",cancelActivity:!0}},"cancel-boundary":{label:"Cancel boundary event",className:"bpmn-icon-intermediate-event-catch-cancel",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CancelEventDefinition",cancelActivity:!0}},"signal-boundary":{label:"Signal boundary event",className:"bpmn-icon-intermediate-event-catch-signal",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:SignalEventDefinition",cancelActivity:!0}},"compensation-boundary":{label:"Compensation boundary event",className:"bpmn-icon-intermediate-event-catch-compensation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CompensateEventDefinition",cancelActivity:!0}},"non-interrupting-message-boundary":{label:"Message boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-message",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:MessageEventDefinition",cancelActivity:!1}},"non-interrupting-timer-boundary":{label:"Timer boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-timer",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:TimerEventDefinition",cancelActivity:!1}},"non-interrupting-escalation-boundary":{label:"Escalation boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-escalation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",cancelActivity:!1}},"non-interrupting-conditional-boundary":{label:"Conditional boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-condition",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",cancelActivity:!1}},"non-interrupting-signal-boundary":{label:"Signal boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-signal",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:SignalEventDefinition",cancelActivity:!1}},"message-end":{label:"Message end event",className:"bpmn-icon-end-event-message",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},"escalation-end":{label:"Escalation end event",className:"bpmn-icon-end-event-escalation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},"error-end":{label:"Error end event",className:"bpmn-icon-end-event-error",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:ErrorEventDefinition"}},"cancel-end":{label:"Cancel end event",className:"bpmn-icon-end-event-cancel",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:CancelEventDefinition"}},"compensation-end":{label:"Compensation end event",className:"bpmn-icon-end-event-compensation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},"signal-end":{label:"Signal end event",className:"bpmn-icon-end-event-signal",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},"terminate-end":{label:"Terminate end event",className:"bpmn-icon-end-event-terminate",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:TerminateEventDefinition"}}};function q(e,t={}){var n=s2[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var c2=[q("none-start-event",{actionName:"replace-with-none-start"}),q("none-intermediate-throwing"),q("none-end-event",{actionName:"replace-with-none-end"}),q("message-start"),q("timer-start"),q("conditional-start"),q("signal-start")],u2=[q("none-start-event",{actionName:"replace-with-none-start"}),q("none-intermediate-throwing"),q("none-end-event",{actionName:"replace-with-none-end"})],l2=[q("none-start-event",{actionName:"replace-with-none-start"}),q("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),q("none-end-event",{actionName:"replace-with-none-end"}),q("message-intermediate-catch"),q("message-intermediate-throw"),q("timer-intermediate-catch"),q("escalation-intermediate-throw"),q("conditional-intermediate-catch"),q("link-intermediate-catch"),q("link-intermediate-throw"),q("compensation-intermediate-throw"),q("signal-intermediate-catch"),q("signal-intermediate-throw")],p2=[q("none-start-event",{actionName:"replace-with-none-start"}),q("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),q("none-end-event",{actionName:"replace-with-none-end"}),q("message-end"),q("escalation-end"),q("error-end"),q("cancel-end"),q("compensation-end"),q("signal-end"),q("terminate-end")],f2=[q("exclusive-gateway"),q("parallel-gateway"),q("inclusive-gateway"),q("complex-gateway"),q("event-based-gateway")],d2=[q("transaction"),q("event-subprocess"),q("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),q("collapsed-subprocess")],h2=[q("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),q("transaction"),q("event-subprocess"),q("collapsed-ad-hoc-subprocess")],q_=[q("transaction"),q("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),q("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),q("event-subprocess")],m2=q_,Y_=[q("task"),q("user-task"),q("service-task"),q("send-task"),q("receive-task"),q("manual-task"),q("rule-task"),q("script-task"),q("call-activity"),q("collapsed-subprocess"),q("expanded-subprocess"),q("collapsed-ad-hoc-subprocess"),q("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],g2=[q("data-store-reference")],y2=[q("data-object-reference")],v2=[q("message-boundary"),q("timer-boundary"),q("escalation-boundary"),q("conditional-boundary"),q("error-boundary"),q("cancel-boundary"),q("signal-boundary"),q("compensation-boundary"),q("non-interrupting-message-boundary"),q("non-interrupting-timer-boundary"),q("non-interrupting-escalation-boundary"),q("non-interrupting-conditional-boundary"),q("non-interrupting-signal-boundary")],_2=[q("message-start"),q("timer-start"),q("conditional-start"),q("signal-start"),q("error-start"),q("escalation-start"),q("compensation-start"),q("non-interrupting-message-start"),q("non-interrupting-timer-start"),q("non-interrupting-conditional-start"),q("non-interrupting-signal-start"),q("non-interrupting-escalation-start")],b2=[{label:"Sequence flow",actionName:"replace-with-sequence-flow",className:"bpmn-icon-connection"},{label:"Default flow",actionName:"replace-with-default-flow",className:"bpmn-icon-default-flow"},{label:"Conditional flow",actionName:"replace-with-conditional-flow",className:"bpmn-icon-conditional-flow"}],x2=[q("expanded-pool"),q("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],E2={"bpmn:MessageEventDefinition":[q("message-start"),q("message-intermediate-catch"),q("message-intermediate-throw"),q("message-end")],"bpmn:TimerEventDefinition":[q("timer-start"),q("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[q("conditional-start"),q("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[q("signal-start"),q("signal-intermediate-catch"),q("signal-intermediate-throw"),q("signal-end")],"bpmn:ErrorEventDefinition":[q("error-start"),q("error-end")],"bpmn:EscalationEventDefinition":[q("escalation-start"),q("escalation-intermediate-throw"),q("escalation-end")],"bpmn:CompensateEventDefinition":[q("compensation-start"),q("compensation-intermediate-throw"),q("compensation-end")]};const K_={"start-event-non-interrupting":`
|
|
316
317
|
<svg viewBox="0 0 2048 2048" xmlns="http://www.w3.org/2000/svg">
|
|
317
318
|
<g transform="translate(0 995.64)">
|
|
318
319
|
<path d="m1899 28.357c21.545 567.43-598.38 1023.5-1133.6 835.92-548.09-147.21-801.57-873.95-463.59-1330 302.62-480.3 1071.7-507.54 1407.6-49.847 122.14 153.12 190.07 348.07 189.59 543.91z" fill="none" stroke="currentColor" stroke-dasharray="418.310422, 361.2328165" stroke-linecap="round" stroke-width="100"/>
|
|
@@ -323,7 +324,7 @@
|
|
|
323
324
|
<circle cx="1024" cy="28.357" r="875" stroke-dasharray="418.310422, 361.2328165" stroke-width="100"/>
|
|
324
325
|
<circle cx="1024" cy="28.357" r="685" stroke-dasharray="348.31044857,261.23283643" stroke-dashoffset="500" stroke-width="100"/>
|
|
325
326
|
</g>
|
|
326
|
-
</svg>`};function tn(e,t,n,i,r,o,a,s){this._bpmnFactory=e,this._popupMenu=t,this._modeling=n,this._moddle=i,this._bpmnReplace=r,this._rules=o,this._translate=a,this._moddleCopy=s,this._register()}tn.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],tn.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},tn.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],r,o=[];if(ae(e)||!n.allowed("shape.replace",{element:e}))return{};var a=RA(e);return y(t,"bpmn:DataObjectReference")?this._createEntries(e,LA):y(t,"bpmn:DataStoreReference")&&!y(e.parent,"bpmn:Collaboration")?this._createEntries(e,BA):(y(t,"bpmn:Event")&&!y(t,"bpmn:BoundaryEvent")&&(r=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=HA[r]||[],!Et(t.$parent)&&y(t.$parent,"bpmn:SubProcess")&&(i=ye(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),y(t,"bpmn:StartEvent")&&!y(t.$parent,"bpmn:SubProcess")?(o=ye(PA.concat(i),a),this._createEntries(e,o)):y(t,"bpmn:Participant")?(o=ye(FA,function(c){return Ee(e)!==c.target.isExpanded}),this._createEntries(e,o)):y(t,"bpmn:StartEvent")&&Et(t.$parent)?(o=ye($A.concat(i),function(c){var u=c.target,p=u.isInterrupting!==!1,l=t.isInterrupting===p;return a(c)||!a(c)&&!l}),this._createEntries(e,o)):y(t,"bpmn:StartEvent")&&!Et(t.$parent)&&y(t.$parent,"bpmn:SubProcess")?(o=ye(AA.concat(i),a),this._createEntries(e,o)):y(t,"bpmn:EndEvent")?(o=ye(MA.concat(i),function(c){var u=c.target;return u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!y(t.$parent,"bpmn:Transaction")?!1:a(c)}),this._createEntries(e,o)):y(t,"bpmn:BoundaryEvent")?(o=ye(NA,function(c){var u=c.target;if(u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!y(t.attachedToRef,"bpmn:Transaction"))return!1;var p=u.cancelActivity!==!1,l=t.cancelActivity==p;return a(c)||!a(c)&&!l}),this._createEntries(e,o)):y(t,"bpmn:IntermediateCatchEvent")||y(t,"bpmn:IntermediateThrowEvent")?(o=ye(TA.concat(i),a),this._createEntries(e,o)):y(t,"bpmn:Gateway")?(o=ye(kA,a),this._createEntries(e,o)):y(t,"bpmn:Transaction")?(o=ye(Uv,a),this._createEntries(e,o)):Et(t)&&Ee(e)?(o=ye(IA,a),this._createEntries(e,o)):y(t,"bpmn:AdHocSubProcess")&&Ee(e)?(o=ye(OA,a),this._createEntries(e,o)):y(t,"bpmn:SubProcess")&&Ee(e)?(o=ye(DA,a),this._createEntries(e,o)):y(t,"bpmn:SubProcess")&&!Ee(e)?(o=ye(qv,function(c){var u=c.target.type===e.type,p=c.target.isExpanded===!0;return u===p}),this._createEntries(e,o)):y(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,jA):y(t,"bpmn:FlowNode")?(o=ye(qv,a),this._createEntries(e,o)):{})},tn.prototype.getPopupMenuHeaderEntries=function(e){var t={};return y(e,"bpmn:Activity")&&!Et(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),y(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),y(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),zd(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},tn.prototype._createEntries=function(e,t){var n={},i=this;return A(t,function(r){n[r.actionName]=i._createEntry(r,e)}),n},tn.prototype._createSequenceFlowEntries=function(e,t){var n=G(e),i={},r=this._modeling,o=this._moddle,a=this;return A(t,function(s){switch(s.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(y(n.sourceRef,"bpmn:ExclusiveGateway")||y(n.sourceRef,"bpmn:InclusiveGateway")||y(n.sourceRef,"bpmn:ComplexGateway")||y(n.sourceRef,"bpmn:Activity"))&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e.source,{default:n})})});break;case"replace-with-conditional-flow":!n.conditionExpression&&y(n.sourceRef,"bpmn:Activity")&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){var c=o.create("bpmn:FormalExpression",{body:""});r.updateProperties(e,{conditionExpression:c})})});break;default:y(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e,{conditionExpression:void 0})})}),(y(n.sourceRef,"bpmn:ExclusiveGateway")||y(n.sourceRef,"bpmn:InclusiveGateway")||y(n.sourceRef,"bpmn:ComplexGateway")||y(n.sourceRef,"bpmn:Activity"))&&n.sourceRef.default===n&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e.source,{default:void 0})})})}}),i},tn.prototype._createEntry=function(e,t,n){var i=this._translate,r=this._bpmnReplace.replaceElement,o=function(){return r(t,e.target)},a=e.label;return a&&typeof a=="function"&&(a=a(t)),n=n||o,{label:i(a),className:e.className,action:n}},tn.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function i(u,p){if(p.active){t._modeling.updateProperties(e,{loopCharacteristics:void 0});return}var l=e.businessObject.get("loopCharacteristics");l&&y(l,p.options.loopCharacteristics)?t._modeling.updateModdleProperties(e,l,{isSequential:p.options.isSequential}):(l=t._moddle.create(p.options.loopCharacteristics,{isSequential:p.options.isSequential}),t._modeling.updateProperties(e,{loopCharacteristics:l}))}var r=G(e),o=r.loopCharacteristics,a,s,c;return o&&(a=o.isSequential,s=o.isSequential===void 0,c=o.isSequential!==void 0&&!o.isSequential),{"toggle-parallel-mi":{className:"bpmn-icon-parallel-mi-marker",title:n("Parallel multi-instance"),active:c,action:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!1}},"toggle-sequential-mi":{className:"bpmn-icon-sequential-mi-marker",title:n("Sequential multi-instance"),active:a,action:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!0}},"toggle-loop":{className:"bpmn-icon-loop-marker",title:n("Loop"),active:s,action:i,options:{loopCharacteristics:"bpmn:StandardLoopCharacteristics"}}}},tn.prototype._getCollectionHeaderEntries=function(e){var t=this,n=this._translate,i=e.businessObject.dataObjectRef;if(!i)return{};function r(a,s){t._modeling.updateModdleProperties(e,i,{isCollection:!s.active})}var o=i.isCollection;return{"toggle-is-collection":{className:"bpmn-icon-parallel-mi-marker",title:n("Collection"),active:o,action:r}}},tn.prototype._getParticipantMultiplicityHeaderEntries=function(e){var t=this,n=this._bpmnFactory,i=this._translate;function r(a,s){var c=s.active,u;c||(u=n.create("bpmn:ParticipantMultiplicity")),t._modeling.updateProperties(e,{participantMultiplicity:u})}var o=e.businessObject.participantMultiplicity;return{"toggle-participant-multiplicity":{className:"bpmn-icon-parallel-mi-marker",title:i("Participant multiplicity"),active:!!o,action:r}}},tn.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=G(e),i=this,r=Vd(e),o=y(e,"bpmn:BoundaryEvent")?Yv["intermediate-event-non-interrupting"]:Yv["start-event-non-interrupting"],a=!n[r];return{"toggle-non-interrupting":{imageHtml:o,title:t("Toggle non-interrupting"),active:a,action:function(){i._modeling.updateProperties(e,{[r]:!!a})}}}};const zA={__depends__:[$l,um,ps],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",tn]};function Do(e,t,n,i,r,o,a,s,c,u,p,l,f){e=e||{},i.registerProvider(this),this._contextPad=i,this._modeling=r,this._elementFactory=o,this._connect=a,this._create=s,this._popupMenu=c,this._canvas=u,this._rules=p,this._translate=l,this._eventBus=n,this._appendPreview=f,e.autoPlace!==!1&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,function(d){var h=d.context,v=h.shape;if(!(!no(d)||!i.isOpen(v))){var _=i.getEntries(v);_.replace&&_.replace.action.click(d,v)}}),n.on("contextPad.close",function(){f.cleanUp()})}Do.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],Do.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&D(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,r){t.removeElements(r.slice())}}}}),n},Do.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return ae(t)?Ci(e,n=>t.includes(n)):t},Do.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,i=this._elementFactory,r=this._connect,o=this._create,a=this._popupMenu,s=this._autoPlace,c=this._translate,u=this._appendPreview,p={};if(e.type==="label")return this._isDeleteAllowed([e])&&D(p,h()),p;var l=e.businessObject;function f(E,b){r.start(E,b)}function d(E,b){n.removeElements([b])}function h(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:d}}}}function v(E){var b=5,R=t.getPad(E).html,T=R.getBoundingClientRect(),O={x:T.left,y:T.bottom+b};return O}function _(E,b,R,T){function O(N,I){var W=i.createShape(D({type:E},T));o.start(N,W,{source:I})}var C=s?function(N,I){var W=i.createShape(D({type:E},T));s.append(I,W)}:O,F=s?function(N,I){return u.create(I,E,T),()=>{u.cleanUp()}}:null;return{group:"model",className:b,title:R,action:{dragstart:O,click:C,hover:F}}}function S(E){return function(b,R){n.splitLane(R,E),t.open(R,!0)}}if(ge(l,["bpmn:Lane","bpmn:Participant"])&&Ee(e)){var w=ai(e);D(p,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add lane above"),action:{click:function(E,b){n.addLane(b,"top")}}}}),w.length<2&&((at(e)?e.height>=120:e.width>=120)&&D(p,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:S(2)}}}),(at(e)?e.height>=180:e.width>=180)&&D(p,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:S(3)}}})),D(p,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add lane below"),action:{click:function(E,b){n.addLane(b,"bottom")}}}})}return y(l,"bpmn:FlowNode")&&(y(l,"bpmn:EventBasedGateway")?D(p,{"append.receive-task":_("bpmn:ReceiveTask","bpmn-icon-receive-task",c("Append receive task")),"append.message-intermediate-event":_("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",c("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":_("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",c("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":_("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",c("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":_("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",c("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):Kv(l,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?D(p,{"append.compensation-activity":_("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!y(l,"bpmn:EndEvent")&&!l.isForCompensation&&!Kv(l,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!Et(l)&&D(p,{"append.end-event":_("bpmn:EndEvent","bpmn-icon-end-event-none",c("Append end event")),"append.gateway":_("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",c("Append gateway")),"append.append-task":_("bpmn:Task","bpmn-icon-task",c("Append task")),"append.intermediate-event":_("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",c("Append intermediate/boundary event"))})),a.isEmpty(e,"bpmn-replace")||D(p,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(E,b){var R=D(v(b),{cursor:{x:E.x,y:E.y}});a.open(b,"bpmn-replace",R,{title:c("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),y(l,"bpmn:SequenceFlow")&&D(p,{"append.text-annotation":_("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),y(l,"bpmn:MessageFlow")&&D(p,{"append.text-annotation":_("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),ge(l,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&D(p,{"append.text-annotation":_("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation")),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect to other element"),action:{click:f,dragstart:f}}}),y(l,"bpmn:TextAnnotation")&&D(p,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:f,dragstart:f}}}),ge(l,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&D(p,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using data input association"),action:{click:f,dragstart:f}}}),y(l,"bpmn:Group")&&D(p,{"append.text-annotation":_("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&D(p,h()),p};function Kv(e,t,n){var i=e.$instanceOf(t),r=!1,o=e.eventDefinitions||[];return A(o,function(a){a.$type===n&&(r=!0)}),i&&r}const VA={__depends__:[EA,Wv,Sg,Zt,Ul,Va,zA],__init__:["contextPadProvider"],contextPadProvider:["type",Do]};var GA={horizontal:["x","width"],vertical:["y","height"]},Xv=5;function Un(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return ae(i)?i:i?n:[]})}Un.$inject=["modeling","rules"],Un.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},Un.prototype.trigger=function(e,t){var n=this._modeling,i,r;if(!(e.length<3)&&(this._setOrientation(t),r=this._filterElements(e),i=this._createGroups(r),!(i.length<=2)))return n.distributeElements(i,this._axis,this._dimension),i},Un.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(A(t,function(o){r=o(r,n,i)}),r):e},Un.prototype._createGroups=function(e){var t=[],n=this,i=this._axis,r=this._dimension;if(!i)throw new Error('must have a defined "axis" and "dimension"');var o=ln(e,i);return A(o,function(a,s){var c=n._findRange(a,i,r),u,p=t[t.length-1];p&&n._hasIntersection(p.range,c)?t[t.length-1].elements.push(a):(u={range:c,elements:[a]},t.push(u))}),t},Un.prototype._setOrientation=function(e){var t=GA[e];this._axis=t[0],this._dimension=t[1]},Un.prototype._hasIntersection=function(e,t){return Math.max(e.min,e.max)>=Math.min(t.min,t.max)&&Math.min(e.min,e.max)<=Math.max(t.min,t.max)},Un.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+Xv,max:t+n-Xv}};const WA={__init__:["distributeElements"],distributeElements:["type",Un]};function js(e){Xt.call(this,e)}js.$inject=["eventBus"],X(js,Xt),js.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=ye(t,function(n){var i=ge(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=ta(t),t.length<3?!1:t})};var Zv={horizontal:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
|
|
327
|
+
</svg>`};function Yn(e,t,n,i,r,o,a,s){this._bpmnFactory=e,this._popupMenu=t,this._modeling=n,this._moddle=i,this._bpmnReplace=r,this._rules=o,this._translate=a,this._moddleCopy=s,this._register()}Yn.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],Yn.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Yn.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],r,o=[];if(ge(e)||!n.allowed("shape.replace",{element:e}))return{};var a=a2(e);return v(t,"bpmn:DataObjectReference")?this._createEntries(e,g2):v(t,"bpmn:DataStoreReference")&&!v(e.parent,"bpmn:Collaboration")?this._createEntries(e,y2):(v(t,"bpmn:Event")&&!v(t,"bpmn:BoundaryEvent")&&(r=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=E2[r]||[],!sn(t.$parent)&&v(t.$parent,"bpmn:SubProcess")&&(i=Oe(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),v(t,"bpmn:StartEvent")&&!v(t.$parent,"bpmn:SubProcess")?(o=Oe(c2.concat(i),a),this._createEntries(e,o)):v(t,"bpmn:Participant")?(o=Oe(x2,function(c){return Be(e)!==c.target.isExpanded}),this._createEntries(e,o)):v(t,"bpmn:StartEvent")&&sn(t.$parent)?(o=Oe(_2.concat(i),function(c){var u=c.target,l=u.isInterrupting!==!1,p=t.isInterrupting===l;return a(c)||!a(c)&&!p}),this._createEntries(e,o)):v(t,"bpmn:StartEvent")&&!sn(t.$parent)&&v(t.$parent,"bpmn:SubProcess")?(o=Oe(u2.concat(i),a),this._createEntries(e,o)):v(t,"bpmn:EndEvent")?(o=Oe(p2.concat(i),function(c){var u=c.target;return u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!v(t.$parent,"bpmn:Transaction")?!1:a(c)}),this._createEntries(e,o)):v(t,"bpmn:BoundaryEvent")?(o=Oe(v2,function(c){var u=c.target;if(u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!v(t.attachedToRef,"bpmn:Transaction"))return!1;var l=u.cancelActivity!==!1,p=t.cancelActivity==l;return a(c)||!a(c)&&!p}),this._createEntries(e,o)):v(t,"bpmn:IntermediateCatchEvent")||v(t,"bpmn:IntermediateThrowEvent")?(o=Oe(l2.concat(i),a),this._createEntries(e,o)):v(t,"bpmn:Gateway")?(o=Oe(f2,a),this._createEntries(e,o)):v(t,"bpmn:Transaction")?(o=Oe(q_,a),this._createEntries(e,o)):sn(t)&&Be(e)?(o=Oe(m2,a),this._createEntries(e,o)):v(t,"bpmn:AdHocSubProcess")&&Be(e)?(o=Oe(h2,a),this._createEntries(e,o)):v(t,"bpmn:SubProcess")&&Be(e)?(o=Oe(d2,a),this._createEntries(e,o)):v(t,"bpmn:SubProcess")&&!Be(e)?(o=Oe(Y_,function(c){var u=c.target.type===e.type,l=c.target.isExpanded===!0;return u===l}),this._createEntries(e,o)):v(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,b2):v(t,"bpmn:FlowNode")?(o=Oe(Y_,a),this._createEntries(e,o)):{})},Yn.prototype.getPopupMenuHeaderEntries=function(e){var t={};return v(e,"bpmn:Activity")&&!sn(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),v(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),v(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),Gm(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},Yn.prototype._createEntries=function(e,t){var n={},i=this;return M(t,function(r){n[r.actionName]=i._createEntry(r,e)}),n},Yn.prototype._createSequenceFlowEntries=function(e,t){var n=K(e),i={},r=this._modeling,o=this._moddle,a=this;return M(t,function(s){switch(s.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(v(n.sourceRef,"bpmn:ExclusiveGateway")||v(n.sourceRef,"bpmn:InclusiveGateway")||v(n.sourceRef,"bpmn:ComplexGateway")||v(n.sourceRef,"bpmn:Activity"))&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e.source,{default:n})})});break;case"replace-with-conditional-flow":!n.conditionExpression&&v(n.sourceRef,"bpmn:Activity")&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){var c=o.create("bpmn:FormalExpression",{body:""});r.updateProperties(e,{conditionExpression:c})})});break;default:v(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e,{conditionExpression:void 0})})}),(v(n.sourceRef,"bpmn:ExclusiveGateway")||v(n.sourceRef,"bpmn:InclusiveGateway")||v(n.sourceRef,"bpmn:ComplexGateway")||v(n.sourceRef,"bpmn:Activity"))&&n.sourceRef.default===n&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e.source,{default:void 0})})})}}),i},Yn.prototype._createEntry=function(e,t,n){var i=this._translate,r=this._bpmnReplace.replaceElement,o=function(){return r(t,e.target)},a=e.label;return a&&typeof a=="function"&&(a=a(t)),n=n||o,{label:i(a),className:e.className,action:n}},Yn.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function i(u,l){if(l.active){t._modeling.updateProperties(e,{loopCharacteristics:void 0});return}var p=e.businessObject.get("loopCharacteristics");p&&v(p,l.options.loopCharacteristics)?t._modeling.updateModdleProperties(e,p,{isSequential:l.options.isSequential}):(p=t._moddle.create(l.options.loopCharacteristics,{isSequential:l.options.isSequential}),t._modeling.updateProperties(e,{loopCharacteristics:p}))}var r=K(e),o=r.loopCharacteristics,a,s,c;return o&&(a=o.isSequential,s=o.isSequential===void 0,c=o.isSequential!==void 0&&!o.isSequential),{"toggle-parallel-mi":{className:"bpmn-icon-parallel-mi-marker",title:n("Parallel multi-instance"),active:c,action:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!1}},"toggle-sequential-mi":{className:"bpmn-icon-sequential-mi-marker",title:n("Sequential multi-instance"),active:a,action:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!0}},"toggle-loop":{className:"bpmn-icon-loop-marker",title:n("Loop"),active:s,action:i,options:{loopCharacteristics:"bpmn:StandardLoopCharacteristics"}}}},Yn.prototype._getCollectionHeaderEntries=function(e){var t=this,n=this._translate,i=e.businessObject.dataObjectRef;if(!i)return{};function r(a,s){t._modeling.updateModdleProperties(e,i,{isCollection:!s.active})}var o=i.isCollection;return{"toggle-is-collection":{className:"bpmn-icon-parallel-mi-marker",title:n("Collection"),active:o,action:r}}},Yn.prototype._getParticipantMultiplicityHeaderEntries=function(e){var t=this,n=this._bpmnFactory,i=this._translate;function r(a,s){var c=s.active,u;c||(u=n.create("bpmn:ParticipantMultiplicity")),t._modeling.updateProperties(e,{participantMultiplicity:u})}var o=e.businessObject.participantMultiplicity;return{"toggle-participant-multiplicity":{className:"bpmn-icon-parallel-mi-marker",title:i("Participant multiplicity"),active:!!o,action:r}}},Yn.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=K(e),i=this,r=Wm(e),o=v(e,"bpmn:BoundaryEvent")?K_["intermediate-event-non-interrupting"]:K_["start-event-non-interrupting"],a=!n[r];return{"toggle-non-interrupting":{imageHtml:o,title:t("Toggle non-interrupting"),active:a,action:function(){i._modeling.updateProperties(e,{[r]:!!a})}}}};const w2={__depends__:[uf,py,Ac],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Yn]};function ja(e,t,n,i,r,o,a,s,c,u,l,p,f){e=e||{},i.registerProvider(this),this._contextPad=i,this._modeling=r,this._elementFactory=o,this._connect=a,this._create=s,this._popupMenu=c,this._canvas=u,this._rules=l,this._translate=p,this._eventBus=n,this._appendPreview=f,e.autoPlace!==!1&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,function(d){var h=d.context,m=h.shape;if(!(!la(d)||!i.isOpen(m))){var g=i.getEntries(m);g.replace&&g.replace.action.click(d,m)}}),n.on("contextPad.close",function(){f.cleanUp()})}ja.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],ja.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&D(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,r){t.removeElements(r.slice())}}}}),n},ja.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return ge(t)?Er(e,n=>t.includes(n)):t},ja.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,i=this._elementFactory,r=this._connect,o=this._create,a=this._popupMenu,s=this._autoPlace,c=this._translate,u=this._appendPreview,l={};if(e.type==="label")return this._isDeleteAllowed([e])&&D(l,h()),l;var p=e.businessObject;function f(x,b){r.start(x,b)}function d(x,b){n.removeElements([b])}function h(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:d}}}}function m(x){var b=5,w=t.getPad(x).html,T=w.getBoundingClientRect(),L={x:T.left,y:T.bottom+b};return L}function g(x,b,w,T){function L(H,N){var z=i.createShape(D({type:x},T));o.start(H,z,{source:N})}var A=s?function(H,N){var z=i.createShape(D({type:x},T));s.append(N,z)}:L,F=s?function(H,N){return u.create(N,x,T),()=>{u.cleanUp()}}:null;return{group:"model",className:b,title:w,action:{dragstart:L,click:A,hover:F}}}function R(x){return function(b,w){n.splitLane(w,x),t.open(w,!0)}}if(De(p,["bpmn:Lane","bpmn:Participant"])&&Be(e)){var E=nr(e);D(l,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add lane above"),action:{click:function(x,b){n.addLane(b,"top")}}}}),E.length<2&&((Gt(e)?e.height>=120:e.width>=120)&&D(l,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:R(2)}}}),(Gt(e)?e.height>=180:e.width>=180)&&D(l,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:R(3)}}})),D(l,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add lane below"),action:{click:function(x,b){n.addLane(b,"bottom")}}}})}return v(p,"bpmn:FlowNode")&&(v(p,"bpmn:EventBasedGateway")?D(l,{"append.receive-task":g("bpmn:ReceiveTask","bpmn-icon-receive-task",c("Append receive task")),"append.message-intermediate-event":g("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",c("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":g("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",c("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":g("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",c("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":g("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",c("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):X_(p,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?D(l,{"append.compensation-activity":g("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!v(p,"bpmn:EndEvent")&&!p.isForCompensation&&!X_(p,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!sn(p)&&D(l,{"append.end-event":g("bpmn:EndEvent","bpmn-icon-end-event-none",c("Append end event")),"append.gateway":g("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",c("Append gateway")),"append.append-task":g("bpmn:Task","bpmn-icon-task",c("Append task")),"append.intermediate-event":g("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",c("Append intermediate/boundary event"))})),a.isEmpty(e,"bpmn-replace")||D(l,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(x,b){var w=D(m(b),{cursor:{x:x.x,y:x.y}});a.open(b,"bpmn-replace",w,{title:c("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),v(p,"bpmn:SequenceFlow")&&D(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),v(p,"bpmn:MessageFlow")&&D(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),De(p,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&D(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation")),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect to other element"),action:{click:f,dragstart:f}}}),v(p,"bpmn:TextAnnotation")&&D(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:f,dragstart:f}}}),De(p,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&D(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using data input association"),action:{click:f,dragstart:f}}}),v(p,"bpmn:Group")&&D(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&D(l,h()),l};function X_(e,t,n){var i=e.$instanceOf(t),r=!1,o=e.eventDefinitions||[];return M(o,function(a){a.$type===n&&(r=!0)}),i&&r}const S2={__depends__:[n2,U_,Rv,Gn,yf,ac,w2],__init__:["contextPadProvider"],contextPadProvider:["type",ja]};var R2={horizontal:["x","width"],vertical:["y","height"]},Z_=5;function ji(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return ge(i)?i:i?n:[]})}ji.$inject=["modeling","rules"],ji.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},ji.prototype.trigger=function(e,t){var n=this._modeling,i,r;if(!(e.length<3)&&(this._setOrientation(t),r=this._filterElements(e),i=this._createGroups(r),!(i.length<=2)))return n.distributeElements(i,this._axis,this._dimension),i},ji.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(M(t,function(o){r=o(r,n,i)}),r):e},ji.prototype._createGroups=function(e){var t=[],n=this,i=this._axis,r=this._dimension;if(!i)throw new Error('must have a defined "axis" and "dimension"');var o=ri(e,i);return M(o,function(a,s){var c=n._findRange(a,i,r),u,l=t[t.length-1];l&&n._hasIntersection(l.range,c)?t[t.length-1].elements.push(a):(u={range:c,elements:[a]},t.push(u))}),t},ji.prototype._setOrientation=function(e){var t=R2[e];this._axis=t[0],this._dimension=t[1]},ji.prototype._hasIntersection=function(e,t){return Math.max(e.min,e.max)>=Math.min(t.min,t.max)&&Math.min(e.min,e.max)<=Math.max(t.min,t.max)},ji.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+Z_,max:t+n-Z_}};const C2={__init__:["distributeElements"],distributeElements:["type",ji]};function nu(e){Vn.call(this,e)}nu.$inject=["eventBus"],ie(nu,Vn),nu.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=Oe(t,function(n){var i=De(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=vs(t),t.length<3?!1:t})};var Q_={horizontal:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
|
|
327
328
|
<polyline points="450 400 450 150 1350 150 1350 400" style="fill:none;stroke:currentColor;stroke-width:100;stroke-linejoin:round;"/>
|
|
328
329
|
<rect x="150" y="450" width="600" height="1200" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
|
|
329
330
|
<rect x="1050" y="450" width="600" height="800" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
|
|
@@ -331,7 +332,7 @@
|
|
|
331
332
|
<polyline points="400 1350 150 1350 150 450 400 450" style="fill:none;stroke:currentColor;stroke-width:100;stroke-linejoin:round;"/>
|
|
332
333
|
<rect x="450" y="150" width="1200" height="600" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
|
|
333
334
|
<rect x="450" y="1050" width="800" height="600" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
|
|
334
|
-
</svg>`},UA=900;function Oo(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",UA,this)}Oo.$inject=["popupMenu","distributeElements","translate","rules"],Oo.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&D(t,this._getEntries(e)),t},Oo.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},Oo.prototype._getEntries=function(e){var t=this._distributeElements,n=this._translate,i=this._popupMenu,r={"distribute-elements-horizontal":{group:"distribute",title:n("Distribute elements horizontally"),className:"bjs-align-elements-menu-entry",imageHtml:Zv.horizontal,action:function(o,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:Zv.vertical,action:function(o,a){t.trigger(e,"vertical"),i.close()}}};return r};const qA={__depends__:[$l,WA],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",js],distributeElementsMenuProvider:["type",Oo]};var Qv="is not a registered action",YA="is already registered";function nn(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}nn.$inject=["eventBus","injector"],nn.prototype._registerDefaultActions=function(e){var t=e.get("commandStack",!1),n=e.get("modeling",!1),i=e.get("selection",!1),r=e.get("zoomScroll",!1),o=e.get("copyPaste",!1),a=e.get("canvas",!1),s=e.get("rules",!1),c=e.get("keyboardMove",!1),u=e.get("keyboardMoveSelection",!1);t&&(this.register("undo",function(){t.undo()}),this.register("redo",function(){t.redo()})),o&&i&&this.register("copy",function(){var p=i.get();if(p.length)return o.copy(p)}),o&&i&&this.register("duplicate",function(){var p=i.get();if(p.length)return o.duplicate(p)}),o&&this.register("paste",function(){o.paste()}),o&&i&&s&&this.register("cut",function(){var p=i.get();if(p.length){var l=s.allowed("elements.delete",{elements:p});if(l!==!1){var f=ae(l)?l:p;return o.cut(f.slice())}}}),r&&this.register("stepZoom",function(p){r.stepZoom(p.value)}),a&&this.register("zoom",function(p){a.zoom(p.value)}),n&&i&&s&&this.register("removeSelection",function(){var p=i.get();if(p.length){var l=s.allowed("elements.delete",{elements:p}),f;l!==!1&&(ae(l)?f=l:f=p,f.length&&n.removeElements(f.slice()))}}),c&&this.register("moveCanvas",function(p){c.moveCanvas(p)}),u&&this.register("moveSelection",function(p){u.moveSelection(p.direction,p.accelerated)})},nn.prototype.trigger=function(e,t){if(!this._actions[e])throw Yl(e,Qv);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},nn.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);A(e,function(i,r){n._registerAction(r,i)})},nn.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw Yl(e,YA);this._actions[e]=t},nn.prototype.unregister=function(e){if(!this.isRegistered(e))throw Yl(e,Qv);this._actions[e]=void 0},nn.prototype.getActions=function(){return Object.keys(this._actions)},nn.prototype.isRegistered=function(e){return!!this._actions[e]};function Yl(e,t){return new Error(e+" "+t)}const KA={__init__:["editorActions"],editorActions:["type",nn]};function Fs(e){e.invoke(nn,this)}X(Fs,nn),Fs.$inject=["injector"],Fs.prototype._registerDefaultActions=function(e){nn.prototype._registerDefaultActions.call(this,e);var t=e.get("canvas",!1),n=e.get("elementRegistry",!1),i=e.get("selection",!1),r=e.get("spaceTool",!1),o=e.get("lassoTool",!1),a=e.get("handTool",!1),s=e.get("globalConnect",!1),c=e.get("distributeElements",!1),u=e.get("alignElements",!1),p=e.get("directEditing",!1),l=e.get("searchPad",!1),f=e.get("modeling",!1),d=e.get("contextPad",!1);t&&n&&i&&this._registerAction("selectElements",function(){var h=t.getRootElement(),v=n.filter(function(_){return _!==h});return i.select(v),v}),r&&this._registerAction("spaceTool",function(){r.toggle()}),o&&this._registerAction("lassoTool",function(){o.toggle()}),a&&this._registerAction("handTool",function(){a.toggle()}),s&&this._registerAction("globalConnectTool",function(){s.toggle()}),i&&c&&this._registerAction("distributeElements",function(h){var v=i.get(),_=h.type;v.length&&c.trigger(v,_)}),i&&u&&this._registerAction("alignElements",function(h){var v=i.get(),_=[],S=h.type;v.length&&(_=ye(v,function(w){return!y(w,"bpmn:Lane")}),u.trigger(_,S))}),i&&f&&this._registerAction("setColor",function(h){var v=i.get();v.length&&f.setColor(v,h)}),i&&p&&this._registerAction("directEditing",function(){var h=i.get();h.length&&p.activate(h[0])}),l&&this._registerAction("find",function(){l.toggle()}),t&&f&&this._registerAction("moveToOrigin",function(){var h=t.getRootElement(),v,_;y(h,"bpmn:Collaboration")?_=n.filter(function(S){return y(S.parent,"bpmn:Collaboration")}):_=n.filter(function(S){return S!==h&&!y(S.parent,"bpmn:SubProcess")}),v=Ue(_),f.moveElements(_,{x:-v.x,y:-v.y},h)}),i&&d&&this._registerAction("replaceElement",function(h){d.triggerEntry("replace","click",h)})};const XA={__depends__:[KA],editorActions:["type",Fs]};function Jv(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;ge(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}Jv.$inject=["eventBus"];function Ui(e,t){V.call(this,e),this._gridSnapping=t;var n=this;this.preExecute("shape.resize",function(i){var r=i.context,o=r.hints||{},a=o.autoResize;if(a){var s=r.shape,c=r.newBounds;Tt(a)?r.newBounds=n.snapComplex(c,a):r.newBounds=n.snapSimple(s,c)}})}Ui.$inject=["eventBus","gridSnapping","modeling"],X(Ui,V),Ui.prototype.snapSimple=function(e,t){var n=this._gridSnapping;return t.width=n.snapValue(t.width,{min:t.width}),t.height=n.snapValue(t.height,{min:t.height}),t.x=e.x+e.width/2-t.width/2,t.y=e.y+e.height/2-t.height/2,t},Ui.prototype.snapComplex=function(e,t){return/w|e/.test(t)&&(e=this.snapHorizontally(e,t)),/n|s/.test(t)&&(e=this.snapVertically(e,t)),e},Ui.prototype.snapHorizontally=function(e,t){var n=this._gridSnapping,i=/w/.test(t),r=/e/.test(t),o={};return o.width=n.snapValue(e.width,{min:e.width}),r&&(i?(o.x=n.snapValue(e.x,{max:e.x}),o.width+=n.snapValue(e.x-o.x,{min:e.x-o.x})):e.x=e.x+e.width-o.width),D(e,o),e},Ui.prototype.snapVertically=function(e,t){var n=this._gridSnapping,i=/n/.test(t),r=/s/.test(t),o={};return o.height=n.snapValue(e.height,{min:e.height}),i&&(r?(o.y=n.snapValue(e.y,{max:e.y}),o.height+=n.snapValue(e.y-o.y,{min:e.y-o.y})):e.y=e.y+e.height-o.height),D(e,o),e};var ZA=2e3;function ey(e,t){e.on(["spaceTool.move","spaceTool.end"],ZA,function(n){var i=n.context;if(i.initialized){var r=i.axis,o;r==="x"?(o=t.snapValue(n.dx),n.x=n.x+o-n.dx,n.dx=o):(o=t.snapValue(n.dy),n.y=n.y+o-n.dy,n.dy=o)}})}ey.$inject=["eventBus","gridSnapping"];const QA={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",Ui],gridSnappingSpaceToolBehavior:["type",ey]};var Hs=10;function Kl(e,t,n){return n||(n="round"),Math[n](e/t)*t}var JA=1200,eT=800;function _i(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var r=this;t.on("diagram.init",eT,function(){r.setActive(i)}),t.on(["create.move","create.end","bendpoint.move.move","bendpoint.move.end","connect.move","connect.end","connectionSegment.move.move","connectionSegment.move.end","resize.move","resize.end","shape.move.move","shape.move.end"],JA,function(o){var a=o.originalEvent;if(!(!r.active||a&&Lt(a))){var s=o.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(u){var p={},l=nT(o,u,e);l&&(p.offset=l);var f=tT(o,u);f&&D(p,f),Tr(o,u)||r.snapEvent(o,u,p)})}})}_i.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);Xe(e,t,i)},_i.prototype.getGridSpacing=function(){return Hs},_i.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=Kl(e,Hs);var i,r;return t&&t.min&&(i=t.min,ue(i)&&(i=Kl(i+n,Hs,"ceil"),e=Math.max(e,i))),t&&t.max&&(r=t.max,ue(r)&&(r=Kl(r+n,Hs,"floor"),e=Math.min(e,r))),e-=n,e},_i.prototype.isActive=function(){return this.active},_i.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},_i.prototype.toggleActive=function(){this.setActive(!this.active)},_i.$inject=["elementRegistry","eventBus","config.gridSnapping"];function tT(e,t){var n=e.context,i=n.createConstraints,r=n.resizeConstraints||{},o=n.gridSnappingContext,a=o.snapConstraints;if(a&&a[t])return a[t];a||(a=o.snapConstraints={}),a[t]||(a[t]={});var s=n.direction;i&&(zs(t)?(a.x.min=i.left,a.x.max=i.right):(a.y.min=i.top,a.y.max=i.bottom));var c=r.min,u=r.max;return c&&(zs(t)?ny(s)?a.x.max=c.left:a.x.min=c.right:ty(s)?a.y.max=c.top:a.y.min=c.bottom),u&&(zs(t)?ny(s)?a.x.min=u.left:a.x.max=u.right:ty(s)?a.y.min=u.top:a.y.max=u.bottom),a[t]}function nT(e,t,n){var i=e.context,r=e.shape,o=i.gridSnappingContext,a=o.snapLocation,s=o.snapOffset;return s&&ue(s[t])||(s||(s=o.snapOffset={}),ue(s[t])||(s[t]=0),!r)||(n.get(r.id)||(zs(t)?s[t]+=r[t]+r.width/2:s[t]+=r[t]+r.height/2),!a)||(t==="x"?/left/.test(a)?s[t]-=r.width/2:/right/.test(a)&&(s[t]+=r.width/2):/top/.test(a)?s[t]-=r.height/2:/bottom/.test(a)&&(s[t]+=r.height/2)),s[t]}function zs(e){return e==="x"}function ty(e){return e.indexOf("n")!==-1}function ny(e){return e.indexOf("w")!==-1}const iT={__depends__:[QA],__init__:["gridSnapping"],gridSnapping:["type",_i]};var rT=2e3;function iy(e,t,n){e.on("autoPlace",rT,function(i){var r=i.source,o=se(r),a=i.shape,s=tg(r,a,n);return["x","y"].forEach(function(c){var u={};s[c]!==o[c]&&(s[c]>o[c]?u.min=s[c]:u.max=s[c],y(a,"bpmn:TextAnnotation")&&(oT(c)?u.offset=-a.width/2:u.offset=-a.height/2),s[c]=t.snapValue(s[c],u))}),s})}iy.$inject=["eventBus","gridSnapping","elementRegistry"];function oT(e){return e==="x"}var aT=1750;function ry(e,t,n){t.on(["create.start","shape.move.start"],aT,function(i){var r=i.context,o=r.shape,a=e.getRootElement();if(!(!y(o,"bpmn:Participant")||!y(a,"bpmn:Process")||!a.children.length)){var s=r.createConstraints;s&&(o.width=n.snapValue(o.width,{min:o.width}),o.height=n.snapValue(o.height,{min:o.height}))}})}ry.$inject=["canvas","eventBus","gridSnapping"];var sT=3e3;function Vs(e,t,n){V.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],sT,function(r){var o=r.context,a=o.connection,s=o.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||cT(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}Vs.$inject=["eventBus","gridSnapping","modeling"],X(Vs,V),Vs.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=pT(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function cT(e){return e.length>3}function uT(e){return e==="h"}function lT(e){return e==="v"}function pT(e,t,n){var i=Dn(t,n),r={};return uT(i)&&(r.y=e.snapValue(t.y)),lT(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=D({},t,r),n=D({},n,r)),[t,n]}const fT={__depends__:[iT,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",iy],gridSnappingParticipantBehavior:["type",ry],gridSnappingLayoutConnectionBehavior:["type",Vs]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",Jv]};var dT=30,oy=30;function Io(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var r=i.element,o=i.gfx;if(y(r,"bpmn:Lane"))return n._createParticipantHit(r,o);if(y(r,"bpmn:Participant"))return Ee(r)?n._createParticipantHit(r,o):n._createDefaultHit(r,o);if(y(r,"bpmn:SubProcess"))return Ee(r)?n._createSubProcessHit(r,o):n._createDefaultHit(r,o)})}Io.$inject=["eventBus","interactionEvents"],Io.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},Io.prototype._createParticipantHit=function(e,t){this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"no-move",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height});var n=at(e)?{width:dT,height:e.height}:{width:e.width,height:oy};return this._interactionEvents.createBoxHit(t,"all",n),!0},Io.prototype._createSubProcessHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"no-move",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"all",{width:e.width,height:oy}),!0};const hT={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",Io]};function Gs(e){e.invoke(xr,this)}X(Gs,xr),Gs.$inject=["injector"],Gs.prototype.registerBindings=function(e,t){xr.prototype.registerBindings.call(this,e,t);function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("selectElements",function(i){var r=i.keyEvent;if(e.isKey(["a","A"],r)&&e.isCmd(r))return t.trigger("selectElements"),!0}),n("find",function(i){var r=i.keyEvent;if(e.isKey(["f","F"],r)&&e.isCmd(r))return t.trigger("find"),!0}),n("spaceTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["s","S"],r))return t.trigger("spaceTool"),!0}),n("lassoTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["l","L"],r))return t.trigger("lassoTool"),!0}),n("handTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["h","H"],r))return t.trigger("handTool"),!0}),n("globalConnectTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["c","C"],r))return t.trigger("globalConnectTool"),!0}),n("directEditing",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["e","E"],r))return t.trigger("directEditing"),!0}),n("replaceElement",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["r","R"],r))return t.trigger("replaceElement",r),!0})};const mT={__depends__:[wl],__init__:["keyboardBindings"],keyboardBindings:["type",Gs]};var gT={moveSpeed:1,moveSpeedAccelerated:10},vT=1500,ay="left",sy="up",cy="right",uy="down",yT={ArrowLeft:ay,Left:ay,ArrowUp:sy,Up:sy,ArrowRight:cy,Right:cy,ArrowDown:uy,Down:uy},_T={left:function(e){return{x:-e,y:0}},up:function(e){return{x:0,y:-e}},right:function(e){return{x:e,y:0}},down:function(e){return{x:0,y:e}}};function ly(e,t,n,i,r){var o=this;this._config=D({},gT,e||{}),t.addListener(vT,function(a){var s=a.keyEvent,c=yT[s.key];if(c&&!t.isCmd(s)){var u=t.isShift(s);return o.moveSelection(c,u),!0}}),this.moveSelection=function(a,s){var c=r.get();if(c.length){var u=this._config[s?"moveSpeedAccelerated":"moveSpeed"],p=_T[a](u),l=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});l&&n.moveElements(c,p)}}}ly.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const bT={__depends__:[wl,Zt],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",ly]};var py=10;function Lo(e,t,n,i){this._dragging=i,this._rules=t;var r=this;function o(c,u){var p=c.shape,l=c.direction,f=c.resizeConstraints,d;c.delta=u,d=lw(p,l,u),c.newBounds=fw(d,f),c.canExecute=r.canResize(c)}function a(c){var u=c.resizeConstraints,p=c.minBounds;u===void 0&&(p===void 0&&(p=r.computeMinResizeBox(c)),c.resizeConstraints={min:ie(p)})}function s(c){var u=c.shape,p=c.canExecute,l=c.newBounds;if(p){if(l=Pf(l),!ET(u,l))return;n.resizeShape(u,l)}}e.on("resize.start",function(c){a(c.context)}),e.on("resize.move",function(c){var u={x:c.dx,y:c.dy};o(c.context,u)}),e.on("resize.end",function(c){s(c.context)})}Lo.prototype.canResize=function(e){var t=this._rules,n=on(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},Lo.prototype.activate=function(e,t,n){var i=this._dragging,r,o;if(typeof n=="string"&&(n={direction:n}),r=D({shape:t},n),o=r.direction,!o)throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");i.init(e,fy(t,o),"resize",{autoActivate:!0,cursor:xT(o),data:{shape:t,context:r}})},Lo.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,r;return i=e.minDimensions||{width:py,height:py},r=hd(t,e.childrenBoxPadding),dw(n,t,i,r)},Lo.$inject=["eventBus","rules","modeling","dragging"];function ET(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function fy(e,t){var n=se(e),i=ie(e),r={x:n.x,y:n.y};return t.indexOf("n")!==-1?r.y=i.top:t.indexOf("s")!==-1&&(r.y=i.bottom),t.indexOf("e")!==-1?r.x=i.right:t.indexOf("w")!==-1&&(r.x=i.left),r}function xT(e){var t="resize-";return e==="n"||e==="s"?t+"ns":e==="e"||e==="w"?t+"ew":e==="nw"||e==="se"?t+"nwse":t+"nesw"}var dy="djs-resizing",hy="resize-not-ok",wT=500;function my(e,t,n){function i(o){var a=o.shape,s=o.newBounds,c=o.frame;c||(c=o.frame=n.addFrame(a,t.getActiveLayer()),t.addMarker(a,dy)),s.width>5&&Z(c,{x:s.x,width:s.width}),s.height>5&&Z(c,{y:s.y,height:s.height}),o.canExecute?xe(c).remove(hy):xe(c).add(hy)}function r(o){var a=o.shape,s=o.frame;s&&tt(o.frame),t.removeMarker(a,dy)}e.on("resize.move",wT,function(o){i(o.context)}),e.on("resize.cleanup",function(o){r(o.context)})}my.$inject=["eventBus","canvas","previewSupport"];var Ws=-6,Us=8,qs=20,Bo="djs-resizer",ST=["n","w","s","e","nw","ne","se","sw"];function bi(e,t,n,i){this._resize=i,this._canvas=t;var r=this;e.on("selection.changed",function(o){var a=o.newSelection;r.removeResizers(),a.length===1&&A(a,Ct(r.addResizer,r))}),e.on("shape.changed",function(o){var a=o.element;n.isSelected(a)&&(r.removeResizers(),r.addResizer(a))})}bi.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(o){ci(o)&&i.activate(o,e,n)}le.bind(t,"mousedown",r),le.bind(t,"touchstart",r)},bi.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=RT(i),a=te("g");xe(a).add(Bo),xe(a).add(Bo+"-"+e.id),xe(a).add(Bo+"-"+i),pe(r,a);var s=te("rect");Z(s,{x:-Us/2+o.x,y:-Us/2+o.y,width:Us,height:Us}),xe(s).add(Bo+"-visual"),pe(a,s);var c=te("rect");return Z(c,{x:-qs/2+o.x,y:-qs/2+o.y,width:qs,height:qs}),xe(c).add(Bo+"-hit"),pe(a,c),sa(a,t,n),a},bi.prototype.createResizer=function(e,t){var n=fy(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},bi.prototype.addResizer=function(e){var t=this;Te(e)||A(ST,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},bi.prototype.removeResizers=function(){var e=this._getResizersParent();Qo(e)},bi.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},bi.$inject=["eventBus","canvas","selection","resize"];function RT(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-Ws:e.indexOf("w")!==-1&&(t.x=Ws),e.indexOf("s")!==-1?t.y=-Ws:e.indexOf("n")!==-1&&(t.y=Ws),t}const gy={__depends__:[En,$n,yr],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Lo],resizePreview:["type",my],resizeHandles:["type",bi]};var CT=2e3;function No(e,t,n,i,r,o,a){this._bpmnFactory=t,this._canvas=n,this._modeling=r,this._textRenderer=a,i.registerProvider(this),e.on("element.dblclick",function(c){s(c.element,!0)}),e.on(["autoPlace.start","canvas.viewbox.changing","drag.init","element.mousedown","popupMenu.open","root.set","selection.changed"],function(){i.isActive()&&i.complete()}),e.on(["shape.remove","connection.remove"],CT,function(c){i.isActive(c.element)&&i.cancel()}),e.on(["commandStack.changed"],function(c){i.isActive()&&i.cancel()}),e.on("directEditing.activate",function(c){o.removeResizers()}),e.on("create.end",500,function(c){var u=c.context,p=u.shape,l=c.context.canExecute,f=c.isTouch;f||l&&(u.hints&&u.hints.createElementsBehavior===!1||s(p))}),e.on("autoPlace.end",500,function(c){s(c.shape)});function s(c,u){(u||ge(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}No.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],No.prototype.activate=function(e){var t=Vt(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);D(n,i);var r={},o=n.style||{};return D(o,{backgroundColor:null,border:null}),(ge(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||vy(e))&&D(r,{centerVertically:!0}),ri(e)&&(D(r,{resizable:!0,autoResize:!0}),D(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),y(e,"bpmn:TextAnnotation")&&(D(r,{resizable:!0,autoResize:!0}),D(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),D(n,{options:r,style:o}),n}},No.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,i=t.getAbsoluteBBox(n),r={x:i.x+i.width/2,y:i.y+i.height/2},o={x:i.x,y:i.y},a=t.zoom(),s=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),u=c.fontSize*a,p=c.lineHeight,l=s.fontSize*a,f=s.lineHeight,d={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(y(e,"bpmn:Lane")||TT(e)){var h=at(e),v=h?{width:i.height,height:30*a,x:i.x-i.height/2+15*a,y:r.y-30*a/2}:{width:i.width,height:30*a};D(o,v),D(d,{fontSize:l+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:h?"rotate(-90deg)":null})}if(AT(e)){var _=at(e),S=_?{width:i.width,height:i.height}:{width:i.height,height:i.width,x:r.x-i.height/2,y:r.y-i.width/2};D(o,S),D(d,{fontSize:l+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:_?null:"rotate(-90deg)"})}(ge(e,["bpmn:Task","bpmn:CallActivity"])||vy(e))&&(D(o,{width:i.width,height:i.height}),D(d,{fontSize:l+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),PT(e)&&(D(o,{width:i.width,x:i.x}),D(d,{fontSize:l+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var w=1,E=i.width+2*w;if(n.labelTarget&&(D(o,{width:E,height:i.height+2*w,x:i.x-w,y:i.y-w}),D(d,{fontSize:u+"px",lineHeight:p})),ri(n)&&!la(n)&&!he(n)){var b=Bc(e),R=t.getAbsoluteBBox({x:b.x,y:b.y,width:0,height:0}),T=u,O=Ii.width*a+2*w;D(o,{width:O,height:T+2*w,x:R.x-O/2,y:R.y-T/2-w}),D(d,{fontSize:u+"px",lineHeight:p})}return y(e,"bpmn:TextAnnotation")&&(D(o,{width:i.width+2*w,height:i.height+2*w,x:i.x-w,y:i.y-w,minWidth:30*a,minHeight:10*a}),D(d,{textAlign:"left",paddingTop:or*a+"px",paddingBottom:or*a+"px",paddingLeft:or*a+"px",paddingRight:or*a+"px",fontSize:l+"px",lineHeight:f})),{bounds:o,style:d}},No.prototype.update=function(e,t,n,i){var r,o;y(e,"bpmn:TextAnnotation")&&(o=this._canvas.getAbsoluteBBox(e),r={x:e.x,y:e.y,width:e.width/o.width*i.width,height:e.height/o.height*i.height}),MT(t)&&(t=null),this._modeling.updateLabel(e,t,r)};function vy(e){return y(e,"bpmn:SubProcess")&&!Ee(e)}function PT(e){return y(e,"bpmn:SubProcess")&&Ee(e)}function AT(e){return y(e,"bpmn:Participant")&&!Ee(e)}function TT(e){return y(e,"bpmn:Participant")&&Ee(e)}function MT(e){return!e||!e.trim()}var yy="djs-element-hidden",_y="djs-label-hidden";function by(e,t,n){var i=this,r=t.getDefaultLayer(),o,a,s;e.on("directEditing.activate",function(c){var u=c.active;if(o=u.element.label||u.element,y(o,"bpmn:TextAnnotation")){a=t.getAbsoluteBBox(o),s=te("g");var p=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:o.height,position:{mx:0,my:0}}),l=i.path=te("path");Z(l,{d:p,strokeWidth:2,stroke:kT(o)}),pe(s,l),pe(r,s),lt(s,o.x,o.y)}y(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,yy):(y(o,"bpmn:Task")||y(o,"bpmn:CallActivity")||y(o,"bpmn:SubProcess")||y(o,"bpmn:Participant")||y(o,"bpmn:Lane"))&&t.addMarker(o,_y)}),e.on("directEditing.resize",function(c){if(y(o,"bpmn:TextAnnotation")){var u=c.height,p=c.dy,l=Math.max(o.height/a.height*(u+p),0),f=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:l,position:{mx:0,my:0}});Z(i.path,{d:f})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var u=c.active;u&&(t.removeMarker(u.element.label||u.element,yy),t.removeMarker(o,_y)),o=void 0,a=void 0,s&&(tt(s),s=void 0)})}by.$inject=["eventBus","canvas","pathMap"];function kT(e,t){var n=we(e);return n.get("stroke")||t||"black"}const DT={__depends__:[el,gy,Wv],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",No],labelEditingPreview:["type",by]};var OT=500,IT=1e3;function Sn(e,t,n){this._eventBus=e,this._elementRegistry=n,this._outlineOffset=5,this._outlineStyle=t.cls("djs-outline",["no-fill"]);var i=this;function r(o){fE(o)||i.createOutline(o)}e.on("element.hover",function(o){r(o.element)}),e.on("selection.changed",function(o){A(o.newSelection,r)}),e.on(["shape.changed","connection.changed"],OT,function(o){var a=o.element,s=o.gfx,c=Ae(".djs-outline",s);c&&i.updateOutline(a,c)})}Sn.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=Ae(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),pe(t,n),this.updateOutline(e,n)),n},Sn.prototype._createOutlineGfx=function(){var e=te("rect");return Z(e,D({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},Sn.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},Sn.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&A(i,function(r){n=n||r.updateOutline(t,e)}),n||Z(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},Sn.prototype.updateConnectionOutline=function(e,t){var n=Ue(t);Z(e,{x:n.x-this._outlineOffset,y:n.y-this._outlineOffset,width:n.width+this._outlineOffset*2,height:n.height+this._outlineOffset*2})},Sn.prototype.registerProvider=function(e,t){t||(t=e,e=IT),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},Sn.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Sn.prototype.getOutline=function(e){var t,n=this._getProviders();return A(n,function(i){ot(i.getOutline)&&(t=t||i.getOutline(e))}),t},Sn.$inject=["eventBus","styles","elementRegistry"];var Ys=6;function Xl(e,t,n){this._canvas=t;var i=this;e.on("element.changed",function(r){n.isSelected(r.element)&&i._updateMultiSelectionOutline(n.get())}),e.on("selection.changed",function(r){var o=r.newSelection;i._updateMultiSelectionOutline(o)})}Xl.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");Qo(t);var n=e.length>1,i=this._canvas.getContainer();if(xe(i)[n?"add":"remove"]("djs-multi-select"),!!n){var r=LT(Ue(e)),o=te("rect");Z(o,D({rx:3},r)),xe(o).add("djs-selection-outline"),pe(t,o)}},Xl.$inject=["eventBus","canvas","selection"];function LT(e){return{x:e.x-Ys,y:e.y-Ys,width:e.width+Ys*2,height:e.height+Ys*2}}const Zl={__depends__:[Zt],__init__:["outline","multiSelectionOutline"],outline:["type",Sn],multiSelectionOutline:["type",Xl]},Ey=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],xy={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},BT=15,Ks=2;function wy(e,t,n,i,r){const o=t.getLayer("overlays");e.on(["selection.changed","shape.changed"],function(){s()}),e.on("selection.changed",function({newSelection:l}){var d;const f=l.filter(h=>ge(h,Ey));if(f.length===1){const h=f[0];he(h)?a(h,h.labelTarget):(d=h.labels)!=null&&d.length&&a(h.labels[0],h)}if(f.length===2){const h=f.find(he),v=f.find(_=>{var S;return(S=_.labels)==null?void 0:S.includes(h)});h&&v&&a(h,v)}}),e.on("shape.changed",function({element:l}){var f;!ge(l,Ey)||!p(l)||(he(l)?a(l,l.labelTarget):(f=l.labels)!=null&&f.length&&a(l.labels[0],l))});function a(l,f){const d=jr([se(f),se(l)],xy),h=d.getAttribute("d"),_=r.isSelected(l)?c(l):u(l),S=Vr(_,h);if(!S)return;const E=r.isSelected(f)?c(f):u(f),b=Vr(E,h)||se(f);Jr(b,S)<BT||(Ac(d,[b,S]),pe(o,d))}function s(){Zo(`.${xy.class}`,o).forEach(tt)}function c(l){const f=i.getOutline(l);if(!f)return u(l);if(f.x){const d={x:l.x+Ei(f,"x")-Ks,y:l.y+Ei(f,"y")-Ks,width:Ei(f,"width")+Ks*2,height:Ei(f,"height")+Ks*2};return $c(d,Ei(f,"rx"))}if(f.cx){const d=Ei(f,"r"),h={x:l.x+Ei(f,"cx")-d,y:l.y+Ei(f,"cy")-d,width:d*2,height:d*2};return Zf(h)}}function u(l){return n.getShapePath(l)}function p(l){return r.isSelected(l)}}wy.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function Ei(e,t){return parseFloat(Z(e,t)||0)}const NT={__depends__:[Zt,Zl],__init__:["labelLink"],labelLink:["type",wy]};var $T=new vr("tt");function jT(e){var t=Ie('<div class="djs-tooltip-container" />');return wt(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function FT(e,t,n){wt(e,{left:t+"px",top:n+"px"})}function Ql(e,t){e.style.display=t===!1?"none":""}var Sy="djs-tooltip",Jl="."+Sy;function At(e,t){this._eventBus=e,this._canvas=t,this._ids=$T,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=jT(t.getContainer());var n=this;Dt.bind(this._tooltipRoot,Jl,"mousedown",function(i){i.stopPropagation()}),Dt.bind(this._tooltipRoot,Jl,"mouseover",function(i){n.trigger("mouseover",i)}),Dt.bind(this._tooltipRoot,Jl,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}At.$inject=["eventBus","canvas"],At.prototype.add=function(e){if(!e.position)throw new Error("must specifiy tooltip position");if(!e.html)throw new Error("must specifiy tooltip html");var t=this._ids.next();return e=D({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},At.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(_t(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},At.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},At.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},At.prototype.setTimeout=function(e){if(e=this.get(e),!!e){this.clearTimeout(e);var t=this;e.removeTimer=setTimeout(function(){t.remove(e)},e.timeout)}},At.prototype.remove=function(e){var t=this.get(e);t&&(mn(t.html),mn(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},At.prototype.show=function(){Ql(this._tooltipRoot)},At.prototype.hide=function(){Ql(this._tooltipRoot,!1)},At.prototype._updateRoot=function(e){var t=e.scale||1,n=e.scale||1,i="matrix("+t+",0,0,"+n+","+-1*e.x*t+","+-1*e.y*n+")";this._tooltipRoot.style.transform=i,this._tooltipRoot.style["-ms-transform"]=i},At.prototype._addTooltip=function(e){var t=e.id,n=e.html,i,r=this._tooltipRoot;n.get&&n.constructor.prototype.jquery&&(n=n.get(0)),Tt(n)&&(n=Ie(n)),i=Ie('<div data-tooltip-id="'+t+'" class="'+Sy+'">'),wt(i,{position:"absolute"}),i.appendChild(n),e.type&&Be(i).add("djs-tooltip-"+e.type),e.className&&Be(i).add(e.className),e.htmlContainer=i,r.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},At.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;FT(n,t.x,t.y)},At.prototype._updateTooltipVisibilty=function(e){A(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,r=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(r=!1),Ql(i,r))})},At.prototype._init=function(){var e=this;function t(n){e._updateRoot(n),e._updateTooltipVisibilty(n),e.show()}this._eventBus.on("canvas.viewbox.changing",function(n){e.hide()}),this._eventBus.on("canvas.viewbox.changed",function(n){t(n.viewbox)})};const HT={__init__:["tooltips"],tooltips:["type",At]};var zT="flow elements must be children of pools/participants",VT="Data object must be placed within a pool/participant.";function Ry(e,t,n){function i(r,o,a){t.add({position:{x:r.x+5,y:r.y+5},type:"error",timeout:2e3,html:"<div>"+o+"</div>"})}e.on(["shape.move.rejected","create.rejected"],function(r){var o=r.context,a=o.shape,s=o.target;y(s,"bpmn:Collaboration")&&(y(a,"bpmn:FlowNode")?i(r,n(zT)):y(a,"bpmn:DataObjectReference")&&i(r,n(VT)))})}Ry.$inject=["eventBus","tooltips","translate"];const GT={__depends__:[HT],__init__:["modelingFeedback"],modelingFeedback:["type",Ry]};var WT=500,UT=1250,qT=1500,Xs=Math.round;function YT(e){return{x:e.x+Xs(e.width/2),y:e.y+Xs(e.height/2)}}function Cy(e,t,n,i,r){function o(s,c,u,p){return r.allowed("elements.move",{shapes:s,delta:c,position:u,target:p})}e.on("shape.move.start",qT,function(s){var c=s.context,u=s.shape,p=i.get().slice();p.indexOf(u)===-1&&(p=[u]),p=KT(p),D(c,{shapes:p,validatedShapes:p,shape:u})}),e.on("shape.move.start",UT,function(s){var c=s.context,u=c.validatedShapes,p;if(p=c.canExecute=o(u),!p)return!1}),e.on("shape.move.move",WT,function(s){var c=s.context,u=c.validatedShapes,p=s.hover,l={x:s.dx,y:s.dy},f={x:s.x,y:s.y},d;if(d=o(u,l,f,p),c.delta=l,c.canExecute=d,d===null){c.target=null;return}c.target=p}),e.on("shape.move.end",function(s){var c=s.context,u=c.delta,p=c.canExecute,l=p==="attach",f=c.shapes;if(p===!1)return!1;u.x=Xs(u.x),u.y=Xs(u.y),!(u.x===0&&u.y===0)&&n.moveElements(f,u,c.target,{primaryShape:c.shape,attach:l})}),e.on("element.mousedown",function(s){if(ci(s)){var c=dr(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,u,p){if(rt(u)&&(p=u,u=!1),!(c.waypoints||!c.parent)&&!xe(s.target).has("djs-hit-no-move")){var l=YT(c),f=t.init(s,l,"shape.move",{cursor:"grabbing",autoActivate:u,data:{shape:c,context:p||{}}});if(f!==!1)return!0}}this.start=a}Cy.$inject=["eventBus","dragging","modeling","selection","rules"];function KT(e){var t=Xi(e,"id");return ye(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var Py=499,ep="djs-dragging",Ay="drop-ok",Ty="drop-not-ok",My="new-parent",ky="attach-ok";function Dy(e,t,n,i){function r(c){var u=o(c),p=XT(u);return p}function o(c){var u=Fr(c),p=u.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),l=u.concat(p),f=[...new Set(l)];return f}function a(c,u){[ky,Ay,Ty,My].forEach(function(p){p===u?t.addMarker(c,p):t.removeMarker(c,p)})}function s(c,u,p){i.addDragger(u,c.dragGroup),p&&t.addMarker(u,ep),c.allDraggedElements?c.allDraggedElements.push(u):c.allDraggedElements=[u]}e.on("shape.move.start",Py,function(c){var u=c.context,p=u.shapes,l=u.allDraggedElements,f=r(p);if(!u.dragGroup){var d=te("g");Z(d,n.cls("djs-drag-group",["no-events"]));var h=t.getActiveLayer();pe(h,d),u.dragGroup=d}f.forEach(function(v){i.addDragger(v,u.dragGroup)}),l?l=nc([l,o(p)]):l=o(p),A(l,function(v){t.addMarker(v,ep)}),u.allDraggedElements=l,u.differentParents=ZT(p)}),e.on("shape.move.move",Py,function(c){var u=c.context,p=u.dragGroup,l=u.target,f=u.shape.parent,d=u.canExecute;l&&(d==="attach"?a(l,ky):u.canExecute&&f&&l.id!==f.id?a(l,My):a(l,u.canExecute?Ay:Ty)),lt(p,c.dx,c.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(c){var u=c.context,p=u.target;p&&a(p,null)}),e.on("shape.move.cleanup",function(c){var u=c.context,p=u.allDraggedElements,l=u.dragGroup;A(p,function(f){t.removeMarker(f,ep)}),l&&tt(l)}),this.makeDraggable=s}Dy.$inject=["eventBus","canvas","styles","previewSupport"];function XT(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=ye(e,function(i){return Te(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function ZT(e){return C_(Xi(e,function(t){return t.parent&&t.parent.id}))!==1}const QT={__depends__:[Ha,Zt,Zl,En,$n,yr],__init__:["move","movePreview"],move:["type",Cy],movePreview:["type",Dy]};var Oy=".djs-palette-toggle",Iy=".entry",JT=Oy+", "+Iy,tp="djs-palette-",eM="shown",np="open",Ly="two-column",tM=1e3;function Ze(e,t){this._eventBus=e,this._canvas=t;var n=this;e.on("tool-manager.update",function(i){var r=i.tool;n.updateToolHighlight(r)}),e.on("i18n.changed",function(){n._update()}),e.on("diagram.init",function(){n._diagramInitialized=!0,n._rebuild()})}Ze.$inject=["eventBus","canvas"],Ze.prototype.registerProvider=function(e,t){t||(t=e,e=tM),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},Ze.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(iM,{})},Ze.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},Ze.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=Ie(Ze.HTML_MARKUP);n.appendChild(i),Be(n).add(tp+eM),Dt.bind(i,JT,"click",function(r){var o=r.delegateTarget;if(_c(o,Oy))return e.toggle();e.trigger("click",r)}),le.bind(i,"mousedown",function(r){r.stopPropagation()}),Dt.bind(i,Iy,"dragstart",function(r){e.trigger("dragstart",r)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},Ze.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},Ze.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,r,o=Be(n),a=Be(t);"twoColumn"in e?r=e.twoColumn:r=this._needsCollapse(t.clientHeight,this._entries||{}),o.toggle(Ly,r),a.toggle(tp+Ly,r),"open"in e&&(o.toggle(np,e.open),a.toggle(tp+np,e.open)),i.fire("palette.changed",{twoColumn:r,open:this.isOpen()})},Ze.prototype._update=function(){var e=Ae(".djs-palette-entries",this._container),t=this._entries=this.getEntries();Ko(e),A(t,function(n,i){var r=n.group||"default",o=Ae("[data-group="+xo(r)+"]",e);o||(o=Ie('<div class="group"></div>'),_t(o,"data-group",r),e.appendChild(o));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=Ie(a);if(o.appendChild(s),!n.separator&&(_t(s,"data-action",i),n.title&&_t(s,"title",n.title),n.className&&nM(s,n.className),n.imageUrl)){var c=Ie("<img>");_t(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},Ze.prototype.trigger=function(e,t,n){var i,r,o=t.delegateTarget||t.target;return o?(i=_t(o,"data-action"),r=t.originalEvent||t,this.triggerEntry(i,e,r,n)):t.preventDefault()},Ze.prototype.triggerEntry=function(e,t,n,i){var r=this._entries,o,a;if(o=r[e],!!o&&(a=o.action,this._eventBus.fire("palette.trigger",{entry:o,event:n})!==!1)){if(ot(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},Ze.prototype._layoutChanged=function(){this._toggleState({})},Ze.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},Ze.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},Ze.prototype.open=function(){this._toggleState({open:!0})},Ze.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Ze.prototype.isActiveTool=function(e){return e&&this._activeTool===e},Ze.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=Ae(".djs-palette-entries",this._container),this._toolsContainer=Ae("[data-group=tools]",t)),n=this._toolsContainer,A(n.children,function(i){var r=i.getAttribute("data-action");if(r){var o=Be(i);r=r.replace("-tool",""),o.contains("entry")&&r===e?o.add("highlighted-entry"):o.remove("highlighted-entry")}})},Ze.prototype.isOpen=function(){return Be(this._container).has(np)},Ze.prototype._getParentContainer=function(){return this._canvas.getContainer()},Ze.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function nM(e,t){var n=Be(e),i=ae(t)?t:t.split(/\s+/g);i.forEach(function(r){n.add(r)})}function iM(e,t){var n=t.getPaletteEntries();return ot(n)?n(e):(A(n,function(i,r){e[r]=i}),e)}const rM={__init__:["palette"],palette:["type",Ze]};var By="crosshair",Ny="selected",oM="djs-dragging-active-lasso";function xi(e,t,n,i,r,o,a){this._selection=r,this._dragging=n,this._mouse=a;var s=this,c={create:function(l){var f=t.getActiveLayer(),d=l.frame=te("rect");Z(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),pe(f,d),u(!0),this.update(l)},update:function(l){var f=l.frame,d=l.bbox;f&&d&&Z(f,{x:d.x,y:d.y,width:d.width,height:d.height});var h=l.marked,v=l.lastMarked;if(h&&v){for(const _ of v)h.has(_)||t.removeMarker(_,Ny);for(const _ of h)v.has(_)||t.addMarker(_,Ny)}},remove:function(l){this.update(l),l.frame&&tt(l.frame),u(!1)}};function u(l){xe(t.getContainer()).toggle(oM,l)}function p(l){var f=i.getAll();return new Set(Ki(er(f,l)))}o.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",function(l){var f=l.originalEvent.target;!l.hover&&!(f instanceof SVGElement)||e.once("lasso.selection.ended",function(){s.activateLasso(l.originalEvent,!0)})}),e.on("lasso.end",0,function(l){var f=l.context;s._select(Array.from(f.marked))}),e.on("lasso.start",function(l){var f=l.context;f.bbox=$y(l),f.add=Ia(l),f.lastMarked=new Set(r.get()),f.add?f.marked=f.lastMarked:f.marked=new Set,f.initialMarked=f.marked,c.create(f)}),e.on("lasso.move",function(l){var f=l.context,d=f.bbox=$y(l),h=p(d),v=f.initialMarked.union(h);f.lastMarked=f.marked,f.marked=v,c.update(f)}),e.on("lasso.cleanup",function(l){var f=l.context;f.lastMarked=f.marked,f.marked=new Set(r.get()),c.remove(l.context)}),e.on("element.mousedown",1500,function(l){if(Ia(l))return s.activateLasso(l.originalEvent),!0})}xi.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],xi.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:By,data:{context:{}},keepSelection:!0})},xi.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:By,data:{context:{}},keepSelection:!0})},xi.prototype._select=function(e){this._selection.select(e)},xi.prototype.select=function(e,t,n=[]){var i=Ki(er(e,t));this._select([...n,...i])},xi.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},xi.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function $y(e){var t={x:e.x-e.dx,y:e.y-e.dy},n={x:e.x,y:e.y},i;return t.x<=n.x&&t.y<n.y||t.x<n.x&&t.y<=n.y?i={x:t.x,y:t.y,width:n.x-t.x,height:n.y-t.y}:t.x>=n.x&&t.y<n.y||t.x>n.x&&t.y<=n.y?i={x:n.x,y:t.y,width:t.x-n.x,height:n.y-t.y}:t.x<=n.x&&t.y>n.y||t.x<n.x&&t.y>=n.y?i={x:t.x,y:n.y,width:n.x-t.x,height:t.y-n.y}:t.x>=n.x&&t.y>n.y||t.x>n.x&&t.y>=n.y?i={x:n.x,y:n.y,width:t.x-n.x,height:t.y-n.y}:i={x:n.x,y:n.y,width:0,height:0},i}const aM={__depends__:[Wa,oo],__init__:["lassoTool"],lassoTool:["type",xi]};var ip=1500,jy="grab";function Mr(e,t,n,i,r,o){this._dragging=n,this._mouse=o;var a=this,s=i.get("keyboard",!1);r.registerTool("hand",{tool:"hand",dragging:"hand.move"}),e.on("element.mousedown",ip,function(c){if(no(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(ip,function(c){if(!(!Fy(c.keyEvent)||a.isActive())){var u=a._mouse.getLastMoveEvent();a.activateMove(u,!!u)}},"keyboard.keydown"),s&&s.addListener(ip,function(c){!Fy(c.keyEvent)||!a.isActive()||a.toggle()},"keyboard.keyup"),e.on("hand.end",function(c){var u=c.originalEvent.target;if(!c.hover&&!(u instanceof SVGElement))return!1;e.once("hand.ended",function(){a.activateMove(c.originalEvent,{reactivate:!0})})}),e.on("hand.move.move",function(c){var u=t.viewbox().scale;t.scroll({dx:c.dx*u,dy:c.dy*u})}),e.on("hand.move.end",function(c){var u=c.context,p=u.reactivate;return!no(c)&&p&&e.once("hand.move.ended",function(l){a.activateHand(l.originalEvent,!0,!0)}),!1})}Mr.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Mr.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:jy,data:{context:n||{}}})},Mr.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:jy,data:{context:{reactivate:n}}})},Mr.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Mr.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function Fy(e){return nt("Space",e)}const sM={__depends__:[Wa,oo],__init__:["handTool"],handTool:["type",Mr]};var Hy="connect-ok",zy="connect-not-ok";function kr(e,t,n,i,r,o,a){var s=this;this._dragging=t,this._rules=o,this._mouse=a,r.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),e.on("global-connect.hover",function(c){var u=c.context,p=c.hover,l=u.canStartConnect=s.canStartConnect(p);l!==null&&(u.startTarget=p,i.addMarker(p,l?Hy:zy))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var u=c.context.startTarget,p=c.context.canStartConnect;u&&i.removeMarker(u,p?Hy:zy)}),e.on(["global-connect.ended"],function(c){var u=c.context,p=u.startTarget,l={x:c.x,y:c.y},f=s.canStartConnect(p);if(f)return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),n.start(null,p,l)}),!1})}kr.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],kr.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},kr.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},kr.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},kr.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const cM={__depends__:[Ul,En,$n,Wa,oo],globalConnect:["type",kr]};function rp(e,t,n,i,r,o,a,s){this._palette=e,this._create=t,this._elementFactory=n,this._spaceTool=i,this._lassoTool=r,this._handTool=o,this._globalConnect=a,this._translate=s,e.registerProvider(this)}rp.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],rp.prototype.getPaletteEntries=function(){var e={},t=this._create,n=this._elementFactory,i=this._spaceTool,r=this._lassoTool,o=this._handTool,a=this._globalConnect,s=this._translate;function c(l,f,d,h,v){function _(S){var w=n.createShape(D({type:l},v));t.start(S,w)}return{group:f,className:d,title:h,action:{dragstart:_,click:_}}}function u(l){var f=n.createShape({type:"bpmn:SubProcess",x:0,y:0,isExpanded:!0}),d=n.createShape({type:"bpmn:StartEvent",x:40,y:82,parent:f});t.start(l,[f,d],{hints:{autoSelect:[f]}})}function p(l){t.start(l,n.createParticipantShape())}return D(e,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:s("Activate hand tool"),action:{click:function(l){o.activateHand(l)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:s("Activate lasso tool"),action:{click:function(l){r.activateSelection(l)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:s("Activate create/remove space tool"),action:{click:function(l){i.activateSelection(l)}}},"global-connect-tool":{group:"tools",className:"bpmn-icon-connection-multi",title:s("Activate global connect tool"),action:{click:function(l){a.start(l)}}},"tool-separator":{group:"tools",separator:!0},"create.start-event":c("bpmn:StartEvent","event","bpmn-icon-start-event-none",s("Create start event")),"create.intermediate-event":c("bpmn:IntermediateThrowEvent","event","bpmn-icon-intermediate-event-none",s("Create intermediate/boundary event")),"create.end-event":c("bpmn:EndEvent","event","bpmn-icon-end-event-none",s("Create end event")),"create.exclusive-gateway":c("bpmn:ExclusiveGateway","gateway","bpmn-icon-gateway-none",s("Create gateway")),"create.task":c("bpmn:Task","activity","bpmn-icon-task",s("Create task")),"create.data-object":c("bpmn:DataObjectReference","data-object","bpmn-icon-data-object",s("Create data object reference")),"create.data-store":c("bpmn:DataStoreReference","data-store","bpmn-icon-data-store",s("Create data store reference")),"create.subprocess-expanded":{group:"activity",className:"bpmn-icon-subprocess-expanded",title:s("Create expanded sub-process"),action:{dragstart:u,click:u}},"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:s("Create pool/participant"),action:{dragstart:p,click:p}},"create.group":c("bpmn:Group","artifact","bpmn-icon-group",s("Create group"))}),e};const uM={__depends__:[rM,Va,mm,aM,sM,cM,Kr],__init__:["paletteProvider"],paletteProvider:["type",rp]};var lM=250;function op(e,t,n,i,r){V.call(this,e);function o(s){var c=s.canExecute.replacements;A(c,function(u){var p=u.oldElementId,l={type:u.newElementType};if(!s.visualReplacements[p]){var f=t.get(p);D(l,{x:f.x,y:f.y});var d=n.createShape(l);i.addShape(d,f.parent);var h=Ae('[data-element-id="'+xo(f.id)+'"]',s.dragGroup);h&&Z(h,{display:"none"});var v=r.addDragger(d,s.dragGroup);s.visualReplacements[p]=v,i.removeShape(d)}})}function a(s){var c=s.visualReplacements;A(c,function(u,p){var l=Ae('[data-element-id="'+xo(p)+'"]',s.dragGroup);l&&Z(l,{display:"inline"}),u.remove(),c[p]&&delete c[p]})}e.on("shape.move.move",lM,function(s){var c=s.context,u=c.canExecute;c.visualReplacements||(c.visualReplacements={}),u&&u.replacements?o(c):a(c)})}op.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],X(op,V);const pM={__depends__:[yr],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",op]};var fM=1250,ap=40,dM=20,hM=10,Vy=20,Gy=["x","y"],mM=Math.abs;function Wy(e){e.on(["connect.hover","connect.move","connect.end"],fM,function(t){var n=t.context,i=n.canExecute,r=n.start,o=n.hover,a=n.source,s=n.target;t.originalEvent&&Lt(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&o&&gM(t,o,bM(o)),o&&_M(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=en(r),ge(o,["bpmn:Event","bpmn:Gateway"])&&Uy(t,en(o)),ge(o,["bpmn:Task","bpmn:SubProcess"])&&vM(t,o),y(a,"bpmn:BoundaryEvent")&&s===a.host&&yM(t)):qy(i,"bpmn:MessageFlow")?(y(r,"bpmn:Event")&&(n.connectionStart=en(r)),y(o,"bpmn:Event")&&Uy(t,en(o))):n.connectionStart=n.initialConnectionStart)})}Wy.$inject=["eventBus"];function gM(e,t,n){Gy.forEach(function(i){var r=Yy(i,t);e[i]<t[i]+n?Xe(e,i,t[i]+n):e[i]>t[i]+r-n&&Xe(e,i,t[i]+r-n)})}function vM(e,t){var n=en(t);Gy.forEach(function(i){EM(e,t,i)&&Xe(e,i,n[i])})}function yM(e){var t=e.context,n=t.source,i=t.target;if(!xM(t)){var r=en(n),o=ut(r,i,-10),a=[];/top|bottom/.test(o)&&a.push("x"),/left|right/.test(o)&&a.push("y"),a.forEach(function(s){var c=e[s],u;mM(c-r[s])<ap&&(c>r[s]?u=r[s]+ap:u=r[s]-ap,Xe(e,s,u))})}}function Uy(e,t){Xe(e,"x",t.x),Xe(e,"y",t.y)}function qy(e,t){return e&&e.type===t}function _M(e,t){return qn(t,function(n){return qy(e,n)})}function Yy(e,t){return e==="x"?t.width:t.height}function bM(e){return y(e,"bpmn:Task")?hM:dM}function EM(e,t,n){return e[n]>t[n]+Vy&&e[n]<t[n]+Yy(n,t)-Vy}function xM(e){var t=e.hover,n=e.source;return t&&n&&t===n}function wi(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}wi.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},wi.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},wi.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},wi.prototype.getSnapLocations=function(){return this._snapLocations},wi.prototype.setSnapLocations=function(e){this._snapLocations=e},wi.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new Zs,n.initDefaults(this._defaultSnaps)),n};function Zs(){this._snapValues={}}Zs.prototype.add=function(e,t){var n=this._snapValues[e];n||(n=this._snapValues[e]={x:[],y:[]}),n.x.indexOf(t.x)===-1&&n.x.push(t.x),n.y.indexOf(t.y)===-1&&n.y.push(t.y)},Zs.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&lA(e[n],r[n],i)},Zs.prototype.initDefaults=function(e){var t=this;A(e||{},function(n,i){A(n,function(r){t.add(i,r)})})};var wM=1250;function Rn(e,t,n){var i=this;this._elementRegistry=e,t.on(["create.start","shape.move.start"],function(r){i.initSnap(r)}),t.on(["create.move","create.end","shape.move.move","shape.move.end"],wM,function(r){var o=r.context,a=o.shape,s=o.snapContext,c=o.target;if(!(r.originalEvent&&Lt(r.originalEvent))&&!(Tr(r)||!c)){var u=s.pointsForTarget(c);u.initialized||(u=i.addSnapTargetPoints(u,a,c),u.initialized=!0),n.snap(r,u)}}),t.on(["create.cleanup","shape.move.cleanup"],function(){n.hide()})}Rn.$inject=["elementRegistry","eventBus","snapping"],Rn.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,r=n.snapContext;r||(r=n.snapContext=new wi);var o;t.get(i.id)?o=en(i,e):o={x:e.x+en(i).x,y:e.y+en(i).y};var a={x:o.x-i.width/2,y:o.y-i.height/2},s={x:o.x+i.width/2,y:o.y+i.height/2};return r.setSnapOrigin("mid",{x:o.x-e.x,y:o.y-e.y}),he(i)||(r.setSnapOrigin("top-left",{x:a.x-e.x,y:a.y-e.y}),r.setSnapOrigin("bottom-right",{x:s.x-e.x,y:s.y-e.y})),r},Rn.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return A(i,function(r){if(he(r)){he(t)&&e.add("mid",en(r));return}if(Te(r)){if(r.waypoints.length<3)return;var o=r.waypoints.slice(1,-1);A(o,function(a){e.add("mid",a)});return}e.add("mid",en(r))}),!ue(t.x)||!ue(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",en(t)),e},Rn.prototype.getSnapTargets=function(e,t){return Iv(t).filter(function(n){return!SM(n)})};function SM(e){return!!e.hidden}var Ky=1500;function Dr(e,t){t.invoke(Rn,this),e.on(["create.move","create.end"],Ky,AM),e.on(["create.move","create.end","shape.move.move","shape.move.end"],Ky,function(n){var i=n.context,r=i.canExecute,o=i.target,a=r&&(r==="attach"||r.attach);a&&!Tr(n)&&RM(n,o)})}X(Dr,Rn),Dr.$inject=["eventBus","injector"],Dr.prototype.initSnap=function(e){var t=Rn.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return A(n.outgoing,function(r){var o=r.waypoints[0];o=o.original||o,t.setSnapOrigin(r.id+"-docking",Zy(o,i,e))}),A(n.incoming,function(r){var o=r.waypoints[r.waypoints.length-1];o=o.original||o,t.setSnapOrigin(r.id+"-docking",Zy(o,i,e))}),y(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},Dr.prototype.addSnapTargetPoints=function(e,t,n){Rn.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);A(i,function(o){(PM(o)||CM([t,o],"bpmn:TextAnnotation"))&&(e.add("top-left",Dv(o)),e.add("bottom-right",Ov(o)))});var r=this._elementRegistry;return A(t.incoming,function(o){if(r.get(t.id)){Xy(i,o.source)||e.add("mid",se(o.source));var a=o.waypoints[0];e.add(o.id+"-docking",a.original||a)}}),A(t.outgoing,function(o){if(r.get(t.id)){Xy(i,o.target)||e.add("mid",se(o.target));var a=o.waypoints[o.waypoints.length-1];e.add(o.id+"-docking",a.original||a)}}),y(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},Dr.prototype.getSnapTargets=function(e,t){return Rn.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!y(n,"bpmn:Lane")})};function RM(e,t){var n=ie(t),i=ph(e,t),r=e.context,o=r.shape,a;o.parent?a={x:0,y:0}:a=se(o),/top/.test(i)?Xe(e,"y",n.top-a.y):/bottom/.test(i)&&Xe(e,"y",n.bottom-a.y),/left/.test(i)?Xe(e,"x",n.left-a.x):/right/.test(i)&&Xe(e,"x",n.right-a.x)}function CM(e,t){return e.every(function(n){return y(n,t)})}function PM(e){return y(e,"bpmn:SubProcess")&&Ee(e)?!0:y(e,"bpmn:Participant")}function AM(e){var t=e.context,n=t.createConstraints;if(n){var i=n.top,r=n.right,o=n.bottom,a=n.left;(a&&a>=e.x||r&&r<=e.x)&&Xe(e,"x",e.x),(i&&i>=e.y||o&&o<=e.y)&&Xe(e,"y",e.y)}}function Xy(e,t){return e.indexOf(t)!==-1}function Zy(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var TM=1250;function $o(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],TM,function(i){var r=i.context,o=r.shape,a=o.parent,s=r.direction,c=r.snapContext;if(!(i.originalEvent&&Lt(i.originalEvent))&&!Tr(i)){var u=c.pointsForTarget(a);u.initialized||(u=n.addSnapTargetPoints(u,o,a,s),u.initialized=!0),DM(s)&&Xe(i,"x",i.x),OM(s)&&Xe(i,"y",i.y),t.snap(i,u)}}),e.on(["resize.cleanup"],function(){t.hide()})}$o.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new wi);var o=Qy(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},$o.prototype.addSnapTargetPoints=function(e,t,n,i){var r=this.getSnapTargets(t,n);return A(r,function(o){e.add("corner",Ov(o)),e.add("corner",Dv(o))}),e.add("corner",Qy(t,i)),e},$o.$inject=["eventBus","snapping"],$o.prototype.getSnapTargets=function(e,t){return Iv(t).filter(function(n){return!MM(n,e)&&!Te(n)&&!kM(n)&&!he(n)})};function Qy(e,t){var n=se(e),i=ie(e),r={x:n.x,y:n.y};return t.indexOf("n")!==-1?r.y=i.top:t.indexOf("s")!==-1&&(r.y=i.bottom),t.indexOf("e")!==-1?r.x=i.right:t.indexOf("w")!==-1&&(r.x=i.left),r}function MM(e,t){return e.host===t}function kM(e){return!!e.hidden}function DM(e){return e==="n"||e==="s"}function OM(e){return e==="e"||e==="w"}var IM=7,LM=1e3;function Si(e){this._canvas=e,this._asyncHide=rc(Ct(this.hide,this),LM)}Si.$inject=["canvas"],Si.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,r=i.getSnapLocations(),o={x:Tr(e,"x"),y:Tr(e,"y")};A(r,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(A(["x","y"],function(u){var p;o[u]||(p=t.snap(c,a,u,IM),p!==void 0&&(o[u]={value:p,originValue:p-s[u]}))}),o.x&&o.y)return!1}),this.showSnapLine("vertical",o.x&&o.x.value),this.showSnapLine("horizontal",o.y&&o.y.value),A(["x","y"],function(a){var s=o[a];rt(s)&&Xe(e,a,s.originValue)})},Si.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=te("path");return Z(n,{d:"M0,0 L0,0"}),xe(n).add("djs-snap-line"),pe(t,n),{update:function(i){ue(i)?e==="horizontal"?Z(n,{d:"M-100000,"+i+" L+100000,"+i,display:""}):Z(n,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):Z(n,{display:"none"})}}},Si.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},Si.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},Si.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},Si.prototype.hide=function(){A(this._snapLines,function(e){e.update()})};const BM={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",Rn],resizeSnapping:["type",$o],snapping:["type",Si]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",Wy],createMoveSnapping:["type",Dr]};var Jy=300;function fe(e,t,n,i){this._open=!1,this._results={},this._eventMaps=[],this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._canvas=e,this._eventBus=t,this._selection=n,this._translate=i,this._container=this._getBoxHtml(),this._searchInput=Ae(fe.INPUT_SELECTOR,this._container),this._resultsContainer=Ae(fe.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}fe.$inject=["canvas","eventBus","selection","translate"],fe.prototype._bindEvents=function(){var e=this;function t(n,i,r,o){e._eventMaps.push({el:n,type:r,listener:Dt.bind(n,i,r,o)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,fe.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,fe.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,fe.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,fe.INPUT_SELECTOR,"keydown",function(n){nt("ArrowUp",n)&&n.preventDefault(),nt("ArrowDown",n)&&n.preventDefault()}),t(this._container,fe.INPUT_SELECTOR,"keyup",function(n){if(nt("Escape",n))return e.close();if(nt("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(nt("ArrowUp",n))return e._scrollToDirection(!0);if(nt("ArrowDown",n))return e._scrollToDirection();nt(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},fe.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){Dt.unbind(e.el,e.type,e.listener)})},fe.prototype._search=function(e){var t=this;if(this._clearResults(),!!e.trim()){var n=this._searchProvider.find(e);if(n=n.filter(function(r){return!t._canvas.getRootElements().includes(r.element)}),!n.length){this._selection.select(null);return}n.forEach(function(r){var o=r.element.id,a=t._createResultNode(r,o);t._results[o]={element:r.element,node:a}});var i=Ae(fe.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},fe.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},fe.prototype._scrollToNode=function(e){if(!(!e||e===this._getCurrentResult())){var t=e.offsetTop,n=this._resultsContainer.scrollTop,i=t-this._resultsContainer.clientHeight+e.clientHeight;t<n?this._resultsContainer.scrollTop=t:n<i&&(this._resultsContainer.scrollTop=i)}},fe.prototype._clearResults=function(){Ko(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},fe.prototype._getCurrentResult=function(){return Ae(fe.RESULT_SELECTED_SELECTOR,this._resultsContainer)},fe.prototype._createResultNode=function(e,t){var n=Ie(fe.RESULT_HTML);return e.primaryTokens.length>0&&e_(n,e.primaryTokens,fe.RESULT_PRIMARY_HTML),e_(n,e.secondaryTokens,fe.RESULT_SECONDARY_HTML),_t(n,fe.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},fe.prototype.registerProvider=function(e){this._searchProvider=e},fe.prototype.open=function(){if(!this._searchProvider)throw new Error("no search provider registered");this.isOpen()||(this._cachedRootElement=this._canvas.getRootElement(),this._cachedSelection=this._selection.get(),this._cachedViewbox=this._canvas.viewbox(),this._selection.select(null),this._bindEvents(),this._open=!0,Be(this._canvas.getContainer()).add("djs-search-open"),Be(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},fe.prototype.close=function(e=!0){this.isOpen()&&(e&&(this._cachedRootElement&&this._canvas.setRootElement(this._cachedRootElement),this._cachedSelection&&this._selection.select(this._cachedSelection),this._cachedViewbox&&this._canvas.viewbox(this._cachedViewbox),this._eventBus.fire("searchPad.restored")),this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._unbindEvents(),this._open=!1,Be(this._canvas.getContainer()).remove("djs-search-open"),Be(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},fe.prototype.toggle=function(){this.isOpen()?this.close():this.open()},fe.prototype.isOpen=function(){return this._open},fe.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&Be(t).remove(fe.RESULT_SELECTED_CLASS);var n=_t(e,fe.RESULT_ID_ATTRIBUTE),i=this._results[n].element;Be(e).add(fe.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:Jy}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},fe.prototype._select=function(e){var t=_t(e,fe.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:Jy}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},fe.prototype._getBoxHtml=function(){const e=Ie(fe.BOX_HTML),t=Ae(fe.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function e_(e,t,n){var i=NM(t),r=Ie(n);r.innerHTML=i,e.appendChild(r)}function NM(e){var t="";return e.forEach(function(n){var i=cg(n.value||n.matched||n.normal),r=n.match||n.matched;r?t+='<b class="'+fe.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}fe.CONTAINER_SELECTOR=".djs-search-container",fe.INPUT_SELECTOR=".djs-search-input input",fe.RESULTS_CONTAINER_SELECTOR=".djs-search-results",fe.RESULT_SELECTOR=".djs-search-result",fe.RESULT_SELECTED_CLASS="djs-search-result-selected",fe.RESULT_SELECTED_SELECTOR="."+fe.RESULT_SELECTED_CLASS,fe.RESULT_ID_ATTRIBUTE="data-result-id",fe.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",fe.BOX_HTML=`<div class="djs-search-container djs-scrollable">
|
|
335
|
+
</svg>`},P2=900;function Fa(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",P2,this)}Fa.$inject=["popupMenu","distributeElements","translate","rules"],Fa.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&D(t,this._getEntries(e)),t},Fa.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},Fa.prototype._getEntries=function(e){var t=this._distributeElements,n=this._translate,i=this._popupMenu,r={"distribute-elements-horizontal":{group:"distribute",title:n("Distribute elements horizontally"),className:"bjs-align-elements-menu-entry",imageHtml:Q_.horizontal,action:function(o,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:Q_.vertical,action:function(o,a){t.trigger(e,"vertical"),i.close()}}};return r};const A2={__depends__:[uf,C2],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",nu],distributeElementsMenuProvider:["type",Fa]};var J_="is not a registered action",T2="is already registered";function Kn(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}Kn.$inject=["eventBus","injector"],Kn.prototype._registerDefaultActions=function(e){var t=e.get("commandStack",!1),n=e.get("modeling",!1),i=e.get("selection",!1),r=e.get("zoomScroll",!1),o=e.get("copyPaste",!1),a=e.get("canvas",!1),s=e.get("rules",!1),c=e.get("keyboardMove",!1),u=e.get("keyboardMoveSelection",!1);t&&(this.register("undo",function(){t.undo()}),this.register("redo",function(){t.redo()})),o&&i&&this.register("copy",function(){var l=i.get();if(l.length)return o.copy(l)}),o&&i&&this.register("duplicate",function(){var l=i.get();if(l.length)return o.duplicate(l)}),o&&this.register("paste",function(){o.paste()}),o&&i&&s&&this.register("cut",function(){var l=i.get();if(l.length){var p=s.allowed("elements.delete",{elements:l});if(p!==!1){var f=ge(p)?p:l;return o.cut(f.slice())}}}),r&&this.register("stepZoom",function(l){r.stepZoom(l.value)}),a&&this.register("zoom",function(l){a.zoom(l.value)}),n&&i&&s&&this.register("removeSelection",function(){var l=i.get();if(l.length){var p=s.allowed("elements.delete",{elements:l}),f;p!==!1&&(ge(p)?f=p:f=l,f.length&&n.removeElements(f.slice()))}}),c&&this.register("moveCanvas",function(l){c.moveCanvas(l)}),u&&this.register("moveSelection",function(l){u.moveSelection(l.direction,l.accelerated)})},Kn.prototype.trigger=function(e,t){if(!this._actions[e])throw _f(e,J_);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},Kn.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);M(e,function(i,r){n._registerAction(r,i)})},Kn.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw _f(e,T2);this._actions[e]=t},Kn.prototype.unregister=function(e){if(!this.isRegistered(e))throw _f(e,J_);this._actions[e]=void 0},Kn.prototype.getActions=function(){return Object.keys(this._actions)},Kn.prototype.isRegistered=function(e){return!!this._actions[e]};function _f(e,t){return new Error(e+" "+t)}const M2={__init__:["editorActions"],editorActions:["type",Kn]};function iu(e){e.invoke(Kn,this)}ie(iu,Kn),iu.$inject=["injector"],iu.prototype._registerDefaultActions=function(e){Kn.prototype._registerDefaultActions.call(this,e);var t=e.get("canvas",!1),n=e.get("elementRegistry",!1),i=e.get("selection",!1),r=e.get("spaceTool",!1),o=e.get("lassoTool",!1),a=e.get("handTool",!1),s=e.get("globalConnect",!1),c=e.get("distributeElements",!1),u=e.get("alignElements",!1),l=e.get("directEditing",!1),p=e.get("searchPad",!1),f=e.get("modeling",!1),d=e.get("contextPad",!1);t&&n&&i&&this._registerAction("selectElements",function(){var h=t.getRootElement(),m=n.filter(function(g){return g!==h});return i.select(m),m}),r&&this._registerAction("spaceTool",function(){r.toggle()}),o&&this._registerAction("lassoTool",function(){o.toggle()}),a&&this._registerAction("handTool",function(){a.toggle()}),s&&this._registerAction("globalConnectTool",function(){s.toggle()}),i&&c&&this._registerAction("distributeElements",function(h){var m=i.get(),g=h.type;m.length&&c.trigger(m,g)}),i&&u&&this._registerAction("alignElements",function(h){var m=i.get(),g=[],R=h.type;m.length&&(g=Oe(m,function(E){return!v(E,"bpmn:Lane")}),u.trigger(g,R))}),i&&f&&this._registerAction("setColor",function(h){var m=i.get();m.length&&f.setColor(m,h)}),i&&l&&this._registerAction("directEditing",function(){var h=i.get();h.length&&l.activate(h[0])}),p&&this._registerAction("find",function(){p.toggle()}),t&&f&&this._registerAction("moveToOrigin",function(){var h=t.getRootElement(),m,g;v(h,"bpmn:Collaboration")?g=n.filter(function(R){return v(R.parent,"bpmn:Collaboration")}):g=n.filter(function(R){return R!==h&&!v(R.parent,"bpmn:SubProcess")}),m=Rt(g),f.moveElements(g,{x:-m.x,y:-m.y},h)}),i&&d&&this._registerAction("replaceElement",function(h){d.triggerEntry("replace","click",h)})};const k2={__depends__:[M2],editorActions:["type",iu]};function eb(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;De(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}eb.$inject=["eventBus"];function Gr(e,t){Y.call(this,e),this._gridSnapping=t;var n=this;this.preExecute("shape.resize",function(i){var r=i.context,o=r.hints||{},a=o.autoResize;if(a){var s=r.shape,c=r.newBounds;vn(a)?r.newBounds=n.snapComplex(c,a):r.newBounds=n.snapSimple(s,c)}})}Gr.$inject=["eventBus","gridSnapping","modeling"],ie(Gr,Y),Gr.prototype.snapSimple=function(e,t){var n=this._gridSnapping;return t.width=n.snapValue(t.width,{min:t.width}),t.height=n.snapValue(t.height,{min:t.height}),t.x=e.x+e.width/2-t.width/2,t.y=e.y+e.height/2-t.height/2,t},Gr.prototype.snapComplex=function(e,t){return/w|e/.test(t)&&(e=this.snapHorizontally(e,t)),/n|s/.test(t)&&(e=this.snapVertically(e,t)),e},Gr.prototype.snapHorizontally=function(e,t){var n=this._gridSnapping,i=/w/.test(t),r=/e/.test(t),o={};return o.width=n.snapValue(e.width,{min:e.width}),r&&(i?(o.x=n.snapValue(e.x,{max:e.x}),o.width+=n.snapValue(e.x-o.x,{min:e.x-o.x})):e.x=e.x+e.width-o.width),D(e,o),e},Gr.prototype.snapVertically=function(e,t){var n=this._gridSnapping,i=/n/.test(t),r=/s/.test(t),o={};return o.height=n.snapValue(e.height,{min:e.height}),i&&(r?(o.y=n.snapValue(e.y,{max:e.y}),o.height+=n.snapValue(e.y-o.y,{min:e.y-o.y})):e.y=e.y+e.height-o.height),D(e,o),e};var D2=2e3;function tb(e,t){e.on(["spaceTool.move","spaceTool.end"],D2,function(n){var i=n.context;if(i.initialized){var r=i.axis,o;r==="x"?(o=t.snapValue(n.dx),n.x=n.x+o-n.dx,n.dx=o):(o=t.snapValue(n.dy),n.y=n.y+o-n.dy,n.dy=o)}})}tb.$inject=["eventBus","gridSnapping"];const O2={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",Gr],gridSnappingSpaceToolBehavior:["type",tb]};var ru=10;function bf(e,t,n){return n||(n="round"),Math[n](e/t)*t}var L2=1200,I2=800;function mr(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var r=this;t.on("diagram.init",I2,function(){r.setActive(i)}),t.on(["create.move","create.end","bendpoint.move.move","bendpoint.move.end","connect.move","connect.end","connectionSegment.move.move","connectionSegment.move.end","resize.move","resize.end","shape.move.move","shape.move.end"],L2,function(o){var a=o.originalEvent;if(!(!r.active||a&&Rn(a))){var s=o.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(u){var l={},p=B2(o,u,e);p&&(l.offset=p);var f=N2(o,u);f&&D(l,f),Do(o,u)||r.snapEvent(o,u,l)})}})}mr.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);Tt(e,t,i)},mr.prototype.getGridSpacing=function(){return ru},mr.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=bf(e,ru);var i,r;return t&&t.min&&(i=t.min,xe(i)&&(i=bf(i+n,ru,"ceil"),e=Math.max(e,i))),t&&t.max&&(r=t.max,xe(r)&&(r=bf(r+n,ru,"floor"),e=Math.min(e,r))),e-=n,e},mr.prototype.isActive=function(){return this.active},mr.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},mr.prototype.toggleActive=function(){this.setActive(!this.active)},mr.$inject=["elementRegistry","eventBus","config.gridSnapping"];function N2(e,t){var n=e.context,i=n.createConstraints,r=n.resizeConstraints||{},o=n.gridSnappingContext,a=o.snapConstraints;if(a&&a[t])return a[t];a||(a=o.snapConstraints={}),a[t]||(a[t]={});var s=n.direction;i&&(ou(t)?(a.x.min=i.left,a.x.max=i.right):(a.y.min=i.top,a.y.max=i.bottom));var c=r.min,u=r.max;return c&&(ou(t)?ib(s)?a.x.max=c.left:a.x.min=c.right:nb(s)?a.y.max=c.top:a.y.min=c.bottom),u&&(ou(t)?ib(s)?a.x.min=u.left:a.x.max=u.right:nb(s)?a.y.min=u.top:a.y.max=u.bottom),a[t]}function B2(e,t,n){var i=e.context,r=e.shape,o=i.gridSnappingContext,a=o.snapLocation,s=o.snapOffset;return s&&xe(s[t])||(s||(s=o.snapOffset={}),xe(s[t])||(s[t]=0),!r)||(n.get(r.id)||(ou(t)?s[t]+=r[t]+r.width/2:s[t]+=r[t]+r.height/2),!a)||(t==="x"?/left/.test(a)?s[t]-=r.width/2:/right/.test(a)&&(s[t]+=r.width/2):/top/.test(a)?s[t]-=r.height/2:/bottom/.test(a)&&(s[t]+=r.height/2)),s[t]}function ou(e){return e==="x"}function nb(e){return e.indexOf("n")!==-1}function ib(e){return e.indexOf("w")!==-1}const $2={__depends__:[O2],__init__:["gridSnapping"],gridSnapping:["type",mr]};var j2=2e3;function rb(e,t,n){e.on("autoPlace",j2,function(i){var r=i.source,o=ye(r),a=i.shape,s=iv(r,a,n);return["x","y"].forEach(function(c){var u={};s[c]!==o[c]&&(s[c]>o[c]?u.min=s[c]:u.max=s[c],v(a,"bpmn:TextAnnotation")&&(F2(c)?u.offset=-a.width/2:u.offset=-a.height/2),s[c]=t.snapValue(s[c],u))}),s})}rb.$inject=["eventBus","gridSnapping","elementRegistry"];function F2(e){return e==="x"}var H2=1750;function ob(e,t,n){t.on(["create.start","shape.move.start"],H2,function(i){var r=i.context,o=r.shape,a=e.getRootElement();if(!(!v(o,"bpmn:Participant")||!v(a,"bpmn:Process")||!a.children.length)){var s=r.createConstraints;s&&(o.width=n.snapValue(o.width,{min:o.width}),o.height=n.snapValue(o.height,{min:o.height}))}})}ob.$inject=["canvas","eventBus","gridSnapping"];var z2=3e3;function au(e,t,n){Y.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],z2,function(r){var o=r.context,a=o.connection,s=o.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||V2(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}au.$inject=["eventBus","gridSnapping","modeling"],ie(au,Y),au.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=U2(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function V2(e){return e.length>3}function G2(e){return e==="h"}function W2(e){return e==="v"}function U2(e,t,n){var i=Ri(t,n),r={};return G2(i)&&(r.y=e.snapValue(t.y)),W2(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=D({},t,r),n=D({},n,r)),[t,n]}const q2={__depends__:[$2,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",rb],gridSnappingParticipantBehavior:["type",ob],gridSnappingLayoutConnectionBehavior:["type",au]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",eb]};var Y2=30,ab=30;function Ha(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var r=i.element,o=i.gfx;if(v(r,"bpmn:Lane"))return n._createParticipantHit(r,o);if(v(r,"bpmn:Participant"))return Be(r)?n._createParticipantHit(r,o):n._createDefaultHit(r,o);if(v(r,"bpmn:SubProcess"))return Be(r)?n._createSubProcessHit(r,o):n._createDefaultHit(r,o)})}Ha.$inject=["eventBus","interactionEvents"],Ha.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},Ha.prototype._createParticipantHit=function(e,t){this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"no-move",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height});var n=Gt(e)?{width:Y2,height:e.height}:{width:e.width,height:ab};return this._interactionEvents.createBoxHit(t,"all",n),!0},Ha.prototype._createSubProcessHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"no-move",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"all",{width:e.width,height:ab}),!0};const K2={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",Ha]};function su(e){e.invoke(Ro,this)}ie(su,Ro),su.$inject=["injector"],su.prototype.registerBindings=function(e,t){Ro.prototype.registerBindings.call(this,e,t);function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("selectElements",function(i){var r=i.keyEvent;if(e.isKey(["a","A"],r)&&e.isCmd(r))return t.trigger("selectElements"),!0}),n("find",function(i){var r=i.keyEvent;if(e.isKey(["f","F"],r)&&e.isCmd(r))return t.trigger("find"),!0}),n("spaceTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["s","S"],r))return t.trigger("spaceTool"),!0}),n("lassoTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["l","L"],r))return t.trigger("lassoTool"),!0}),n("handTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["h","H"],r))return t.trigger("handTool"),!0}),n("globalConnectTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["c","C"],r))return t.trigger("globalConnectTool"),!0}),n("directEditing",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["e","E"],r))return t.trigger("directEditing"),!0}),n("replaceElement",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["r","R"],r))return t.trigger("replaceElement",r),!0})};const X2={__depends__:[qp],__init__:["keyboardBindings"],keyboardBindings:["type",su]};var Z2={moveSpeed:1,moveSpeedAccelerated:10},Q2=1500,sb="left",cb="up",ub="right",lb="down",J2={ArrowLeft:sb,Left:sb,ArrowUp:cb,Up:cb,ArrowRight:ub,Right:ub,ArrowDown:lb,Down:lb},ek={left:function(e){return{x:-e,y:0}},up:function(e){return{x:0,y:-e}},right:function(e){return{x:e,y:0}},down:function(e){return{x:0,y:e}}};function pb(e,t,n,i,r){var o=this;this._config=D({},Z2,e||{}),t.addListener(Q2,function(a){var s=a.keyEvent,c=J2[s.key];if(c&&!t.isCmd(s)){var u=t.isShift(s);return o.moveSelection(c,u),!0}}),this.moveSelection=function(a,s){var c=r.get();if(c.length){var u=this._config[s?"moveSpeedAccelerated":"moveSpeed"],l=ek[a](u),p=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});p&&n.moveElements(c,l)}}}pb.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const tk={__depends__:[qp,Gn],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",pb]};var fb=10;function za(e,t,n,i){this._dragging=i,this._rules=t;var r=this;function o(c,u){var l=c.shape,p=c.direction,f=c.resizeConstraints,d;c.delta=u,d=ZS(l,p,u),c.newBounds=JS(d,f),c.canExecute=r.canResize(c)}function a(c){var u=c.resizeConstraints,l=c.minBounds;u===void 0&&(l===void 0&&(l=r.computeMinResizeBox(c)),c.resizeConstraints={min:me(l)})}function s(c){var u=c.shape,l=c.canExecute,p=c.newBounds;if(l){if(p=Th(p),!nk(u,p))return;n.resizeShape(u,p)}}e.on("resize.start",function(c){a(c.context)}),e.on("resize.move",function(c){var u={x:c.dx,y:c.dy};o(c.context,u)}),e.on("resize.end",function(c){s(c.context)})}za.prototype.canResize=function(e){var t=this._rules,n=Jn(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},za.prototype.activate=function(e,t,n){var i=this._dragging,r,o;if(typeof n=="string"&&(n={direction:n}),r=D({shape:t},n),o=r.direction,!o)throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");i.init(e,db(t,o),"resize",{autoActivate:!0,cursor:ik(o),data:{shape:t,context:r}})},za.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,r;return i=e.minDimensions||{width:fb,height:fb},r=gm(t,e.childrenBoxPadding),eR(n,t,i,r)},za.$inject=["eventBus","rules","modeling","dragging"];function nk(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function db(e,t){var n=ye(e),i=me(e),r={x:n.x,y:n.y};return t.indexOf("n")!==-1?r.y=i.top:t.indexOf("s")!==-1&&(r.y=i.bottom),t.indexOf("e")!==-1?r.x=i.right:t.indexOf("w")!==-1&&(r.x=i.left),r}function ik(e){var t="resize-";return e==="n"||e==="s"?t+"ns":e==="e"||e==="w"?t+"ew":e==="nw"||e==="se"?t+"nwse":t+"nesw"}var hb="djs-resizing",mb="resize-not-ok",rk=500;function gb(e,t,n){function i(o){var a=o.shape,s=o.newBounds,c=o.frame;c||(c=o.frame=n.addFrame(a,t.getActiveLayer()),t.addMarker(a,hb)),s.width>5&&re(c,{x:s.x,width:s.width}),s.height>5&&re(c,{y:s.y,height:s.height}),o.canExecute?$e(c).remove(mb):$e(c).add(mb)}function r(o){var a=o.shape,s=o.frame;s&&It(o.frame),t.removeMarker(a,hb)}e.on("resize.move",rk,function(o){i(o.context)}),e.on("resize.cleanup",function(o){r(o.context)})}gb.$inject=["eventBus","canvas","previewSupport"];var cu=-6,uu=8,lu=20,Va="djs-resizer",ok=["n","w","s","e","nw","ne","se","sw"];function gr(e,t,n,i){this._resize=i,this._canvas=t;var r=this;e.on("selection.changed",function(o){var a=o.newSelection;r.removeResizers(),a.length===1&&M(a,mn(r.addResizer,r))}),e.on("shape.changed",function(o){var a=o.element;n.isSelected(a)&&(r.removeResizers(),r.addResizer(a))})}gr.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(o){rr(o)&&i.activate(o,e,n)}we.bind(t,"mousedown",r),we.bind(t,"touchstart",r)},gr.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=ak(i),a=pe("g");$e(a).add(Va),$e(a).add(Va+"-"+e.id),$e(a).add(Va+"-"+i),Se(r,a);var s=pe("rect");re(s,{x:-uu/2+o.x,y:-uu/2+o.y,width:uu,height:uu}),$e(s).add(Va+"-visual"),Se(a,s);var c=pe("rect");return re(c,{x:-lu/2+o.x,y:-lu/2+o.y,width:lu,height:lu}),$e(c).add(Va+"-hit"),Se(a,c),Ss(a,t,n),a},gr.prototype.createResizer=function(e,t){var n=db(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},gr.prototype.addResizer=function(e){var t=this;it(e)||M(ok,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},gr.prototype.removeResizers=function(){var e=this._getResizersParent();ms(e)},gr.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},gr.$inject=["eventBus","canvas","selection","resize"];function ak(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-cu:e.indexOf("w")!==-1&&(t.x=cu),e.indexOf("s")!==-1?t.y=-cu:e.indexOf("n")!==-1&&(t.y=cu),t}const yb={__depends__:[gi,ki,Eo],__init__:["resize","resizePreview","resizeHandles"],resize:["type",za],resizePreview:["type",gb],resizeHandles:["type",gr]};var sk=2e3;function Ga(e,t,n,i,r,o,a){this._bpmnFactory=t,this._canvas=n,this._modeling=r,this._textRenderer=a,i.registerProvider(this),e.on("element.dblclick",function(c){s(c.element,!0)}),e.on(["autoPlace.start","canvas.viewbox.changing","drag.init","element.mousedown","popupMenu.open","root.set","selection.changed"],function(){i.isActive()&&i.complete()}),e.on(["shape.remove","connection.remove"],sk,function(c){i.isActive(c.element)&&i.cancel()}),e.on(["commandStack.changed"],function(c){i.isActive()&&i.cancel()}),e.on("directEditing.activate",function(c){o.removeResizers()}),e.on("create.end",500,function(c){var u=c.context,l=u.shape,p=c.context.canExecute,f=c.isTouch;f||p&&(u.hints&&u.hints.createElementsBehavior===!1||s(l))}),e.on("autoPlace.end",500,function(c){s(c.shape)});function s(c,u){(u||De(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}Ga.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],Ga.prototype.activate=function(e){var t=In(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);D(n,i);var r={},o=n.style||{};return D(o,{backgroundColor:null,border:null}),(De(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||vb(e))&&D(r,{centerVertically:!0}),er(e)&&(D(r,{resizable:!0,autoResize:!0}),D(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),v(e,"bpmn:TextAnnotation")&&(D(r,{resizable:!0,autoResize:!0}),D(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),D(n,{options:r,style:o}),n}},Ga.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,i=t.getAbsoluteBBox(n),r={x:i.x+i.width/2,y:i.y+i.height/2},o={x:i.x,y:i.y},a=t.zoom(),s=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),u=c.fontSize*a,l=c.lineHeight,p=s.fontSize*a,f=s.lineHeight,d={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(v(e,"bpmn:Lane")||lk(e)){var h=Gt(e),m=h?{width:i.height,height:30*a,x:i.x-i.height/2+15*a,y:r.y-30*a/2}:{width:i.width,height:30*a};D(o,m),D(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:h?"rotate(-90deg)":null})}if(uk(e)){var g=Gt(e),R=g?{width:i.width,height:i.height}:{width:i.height,height:i.width,x:r.x-i.height/2,y:r.y-i.width/2};D(o,R),D(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:g?null:"rotate(-90deg)"})}(De(e,["bpmn:Task","bpmn:CallActivity"])||vb(e))&&(D(o,{width:i.width,height:i.height}),D(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),ck(e)&&(D(o,{width:i.width,x:i.x}),D(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var E=1,x=i.width+2*E;if(n.labelTarget&&(D(o,{width:x,height:i.height+2*E,x:i.x-E,y:i.y-E}),D(d,{fontSize:u+"px",lineHeight:l})),er(n)&&!Ps(n)&&!ke(n)){var b=sl(e),w=t.getAbsoluteBBox({x:b.x,y:b.y,width:0,height:0}),T=u,L=Dr.width*a+2*E;D(o,{width:L,height:T+2*E,x:w.x-L/2,y:w.y-T/2-E}),D(d,{fontSize:u+"px",lineHeight:l})}return v(e,"bpmn:TextAnnotation")&&(D(o,{width:i.width+2*E,height:i.height+2*E,x:i.x-E,y:i.y-E,minWidth:30*a,minHeight:10*a}),D(d,{textAlign:"left",paddingTop:co*a+"px",paddingBottom:co*a+"px",paddingLeft:co*a+"px",paddingRight:co*a+"px",fontSize:p+"px",lineHeight:f})),{bounds:o,style:d}},Ga.prototype.update=function(e,t,n,i){var r,o;v(e,"bpmn:TextAnnotation")&&(o=this._canvas.getAbsoluteBBox(e),r={x:e.x,y:e.y,width:e.width/o.width*i.width,height:e.height/o.height*i.height}),pk(t)&&(t=null),this._modeling.updateLabel(e,t,r)};function vb(e){return v(e,"bpmn:SubProcess")&&!Be(e)}function ck(e){return v(e,"bpmn:SubProcess")&&Be(e)}function uk(e){return v(e,"bpmn:Participant")&&!Be(e)}function lk(e){return v(e,"bpmn:Participant")&&Be(e)}function pk(e){return!e||!e.trim()}var _b="djs-element-hidden",bb="djs-label-hidden";function xb(e,t,n){var i=this,r=t.getDefaultLayer(),o,a,s;e.on("directEditing.activate",function(c){var u=c.active;if(o=u.element.label||u.element,v(o,"bpmn:TextAnnotation")){a=t.getAbsoluteBBox(o),s=pe("g");var l=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:o.height,position:{mx:0,my:0}}),p=i.path=pe("path");re(p,{d:l,strokeWidth:2,stroke:fk(o)}),Se(s,p),Se(r,s),Zt(s,o.x,o.y)}v(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,_b):(v(o,"bpmn:Task")||v(o,"bpmn:CallActivity")||v(o,"bpmn:SubProcess")||v(o,"bpmn:Participant")||v(o,"bpmn:Lane"))&&t.addMarker(o,bb)}),e.on("directEditing.resize",function(c){if(v(o,"bpmn:TextAnnotation")){var u=c.height,l=c.dy,p=Math.max(o.height/a.height*(u+l),0),f=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:p,position:{mx:0,my:0}});re(i.path,{d:f})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var u=c.active;u&&(t.removeMarker(u.element.label||u.element,_b),t.removeMarker(o,bb)),o=void 0,a=void 0,s&&(It(s),s=void 0)})}xb.$inject=["eventBus","canvas","pathMap"];function fk(e,t){var n=Ve(e);return n.get("stroke")||t||"black"}const dk={__depends__:[Rp,yb,U_],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Ga],labelEditingPreview:["type",xb]};var hk=500,mk=1e3;function _i(e,t,n){this._eventBus=e,this._elementRegistry=n,this._outlineOffset=5,this._outlineStyle=t.cls("djs-outline",["no-fill"]);var i=this;function r(o){Jw(o)||i.createOutline(o)}e.on("element.hover",function(o){r(o.element)}),e.on("selection.changed",function(o){M(o.newSelection,r)}),e.on(["shape.changed","connection.changed"],hk,function(o){var a=o.element,s=o.gfx,c=et(".djs-outline",s);c&&i.updateOutline(a,c)})}_i.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=et(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),Se(t,n),this.updateOutline(e,n)),n},_i.prototype._createOutlineGfx=function(){var e=pe("rect");return re(e,D({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},_i.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},_i.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&M(i,function(r){n=n||r.updateOutline(t,e)}),n||re(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},_i.prototype.updateConnectionOutline=function(e,t){var n=Rt(t);re(e,{x:n.x-this._outlineOffset,y:n.y-this._outlineOffset,width:n.width+this._outlineOffset*2,height:n.height+this._outlineOffset*2})},_i.prototype.registerProvider=function(e,t){t||(t=e,e=mk),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},_i.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},_i.prototype.getOutline=function(e){var t,n=this._getProviders();return M(n,function(i){zt(i.getOutline)&&(t=t||i.getOutline(e))}),t},_i.$inject=["eventBus","styles","elementRegistry"];var pu=6;function xf(e,t,n){this._canvas=t;var i=this;e.on("element.changed",function(r){n.isSelected(r.element)&&i._updateMultiSelectionOutline(n.get())}),e.on("selection.changed",function(r){var o=r.newSelection;i._updateMultiSelectionOutline(o)})}xf.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");ms(t);var n=e.length>1,i=this._canvas.getContainer();if($e(i)[n?"add":"remove"]("djs-multi-select"),!!n){var r=gk(Rt(e)),o=pe("rect");re(o,D({rx:3},r)),$e(o).add("djs-selection-outline"),Se(t,o)}},xf.$inject=["eventBus","canvas","selection"];function gk(e){return{x:e.x-pu,y:e.y-pu,width:e.width+pu*2,height:e.height+pu*2}}const Ef={__depends__:[Gn],__init__:["outline","multiSelectionOutline"],outline:["type",_i],multiSelectionOutline:["type",xf]},Eb=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],wb={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},yk=15,fu=2;function Sb(e,t,n,i,r){const o=t.getLayer("overlays");e.on(["selection.changed","shape.changed"],function(){s()}),e.on("selection.changed",function({newSelection:p}){var d;const f=p.filter(h=>De(h,Eb));if(f.length===1){const h=f[0];ke(h)?a(h,h.labelTarget):(d=h.labels)!=null&&d.length&&a(h.labels[0],h)}if(f.length===2){const h=f.find(ke),m=f.find(g=>{var R;return(R=g.labels)==null?void 0:R.includes(h)});h&&m&&a(h,m)}}),e.on("shape.changed",function({element:p}){var f;!De(p,Eb)||!l(p)||(ke(p)?a(p,p.labelTarget):(f=p.labels)!=null&&f.length&&a(p.labels[0],p))});function a(p,f){const d=qo([ye(f),ye(p)],wb),h=d.getAttribute("d"),g=r.isSelected(p)?c(p):u(p),R=Zo(g,h);if(!R)return;const x=r.isSelected(f)?c(f):u(f),b=Zo(x,h)||ye(f);sa(b,R)<yk||(Ju(d,[b,R]),Se(o,d))}function s(){hs(`.${wb.class}`,o).forEach(It)}function c(p){const f=i.getOutline(p);if(!f)return u(p);if(f.x){const d={x:p.x+yr(f,"x")-fu,y:p.y+yr(f,"y")-fu,width:yr(f,"width")+fu*2,height:yr(f,"height")+fu*2};return ul(d,yr(f,"rx"))}if(f.cx){const d=yr(f,"r"),h={x:p.x+yr(f,"cx")-d,y:p.y+yr(f,"cy")-d,width:d*2,height:d*2};return Jh(h)}}function u(p){return n.getShapePath(p)}function l(p){return r.isSelected(p)}}Sb.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function yr(e,t){return parseFloat(re(e,t)||0)}const vk={__depends__:[Gn,Ef],__init__:["labelLink"],labelLink:["type",Sb]};var _k=new xo("tt");function bk(e){var t=ut('<div class="djs-tooltip-container" />');return fn(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function xk(e,t,n){fn(e,{left:t+"px",top:n+"px"})}function wf(e,t){e.style.display=t===!1?"none":""}var Rb="djs-tooltip",Sf="."+Rb;function yn(e,t){this._eventBus=e,this._canvas=t,this._ids=_k,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=bk(t.getContainer());var n=this;En.bind(this._tooltipRoot,Sf,"mousedown",function(i){i.stopPropagation()}),En.bind(this._tooltipRoot,Sf,"mouseover",function(i){n.trigger("mouseover",i)}),En.bind(this._tooltipRoot,Sf,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}yn.$inject=["eventBus","canvas"],yn.prototype.add=function(e){if(!e.position)throw new Error("must specifiy tooltip position");if(!e.html)throw new Error("must specifiy tooltip html");var t=this._ids.next();return e=D({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},yn.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(on(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},yn.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},yn.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},yn.prototype.setTimeout=function(e){if(e=this.get(e),!!e){this.clearTimeout(e);var t=this;e.removeTimer=setTimeout(function(){t.remove(e)},e.timeout)}},yn.prototype.remove=function(e){var t=this.get(e);t&&(li(t.html),li(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},yn.prototype.show=function(){wf(this._tooltipRoot)},yn.prototype.hide=function(){wf(this._tooltipRoot,!1)},yn.prototype._updateRoot=function(e){var t=e.scale||1,n=e.scale||1,i="matrix("+t+",0,0,"+n+","+-1*e.x*t+","+-1*e.y*n+")";this._tooltipRoot.style.transform=i,this._tooltipRoot.style["-ms-transform"]=i},yn.prototype._addTooltip=function(e){var t=e.id,n=e.html,i,r=this._tooltipRoot;n.get&&n.constructor.prototype.jquery&&(n=n.get(0)),vn(n)&&(n=ut(n)),i=ut('<div data-tooltip-id="'+t+'" class="'+Rb+'">'),fn(i,{position:"absolute"}),i.appendChild(n),e.type&&ft(i).add("djs-tooltip-"+e.type),e.className&&ft(i).add(e.className),e.htmlContainer=i,r.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},yn.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;xk(n,t.x,t.y)},yn.prototype._updateTooltipVisibilty=function(e){M(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,r=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(r=!1),wf(i,r))})},yn.prototype._init=function(){var e=this;function t(n){e._updateRoot(n),e._updateTooltipVisibilty(n),e.show()}this._eventBus.on("canvas.viewbox.changing",function(n){e.hide()}),this._eventBus.on("canvas.viewbox.changed",function(n){t(n.viewbox)})};const Ek={__init__:["tooltips"],tooltips:["type",yn]};var wk="flow elements must be children of pools/participants",Sk="Data object must be placed within a pool/participant.";function Cb(e,t,n){function i(r,o,a){t.add({position:{x:r.x+5,y:r.y+5},type:"error",timeout:2e3,html:"<div>"+o+"</div>"})}e.on(["shape.move.rejected","create.rejected"],function(r){var o=r.context,a=o.shape,s=o.target;v(s,"bpmn:Collaboration")&&(v(a,"bpmn:FlowNode")?i(r,n(wk)):v(a,"bpmn:DataObjectReference")&&i(r,n(Sk)))})}Cb.$inject=["eventBus","tooltips","translate"];const Rk={__depends__:[Ek],__init__:["modelingFeedback"],modelingFeedback:["type",Cb]};var Ck=500,Pk=1250,Ak=1500,du=Math.round;function Tk(e){return{x:e.x+du(e.width/2),y:e.y+du(e.height/2)}}function Pb(e,t,n,i,r){function o(s,c,u,l){return r.allowed("elements.move",{shapes:s,delta:c,position:u,target:l})}e.on("shape.move.start",Ak,function(s){var c=s.context,u=s.shape,l=i.get().slice();l.indexOf(u)===-1&&(l=[u]),l=Mk(l),D(c,{shapes:l,validatedShapes:l,shape:u})}),e.on("shape.move.start",Pk,function(s){var c=s.context,u=c.validatedShapes,l;if(l=c.canExecute=o(u),!l)return!1}),e.on("shape.move.move",Ck,function(s){var c=s.context,u=c.validatedShapes,l=s.hover,p={x:s.dx,y:s.dy},f={x:s.x,y:s.y},d;if(d=o(u,p,f,l),c.delta=p,c.canExecute=d,d===null){c.target=null;return}c.target=l}),e.on("shape.move.end",function(s){var c=s.context,u=c.delta,l=c.canExecute,p=l==="attach",f=c.shapes;if(l===!1)return!1;u.x=du(u.x),u.y=du(u.y),!(u.x===0&&u.y===0)&&n.moveElements(f,u,c.target,{primaryShape:c.shape,attach:p})}),e.on("element.mousedown",function(s){if(rr(s)){var c=yo(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,u,l){if(Ht(u)&&(l=u,u=!1),!(c.waypoints||!c.parent)&&!$e(s.target).has("djs-hit-no-move")){var p=Tk(c),f=t.init(s,p,"shape.move",{cursor:"grabbing",autoActivate:u,data:{shape:c,context:l||{}}});if(f!==!1)return!0}}this.start=a}Pb.$inject=["eventBus","dragging","modeling","selection","rules"];function Mk(e){var t=Xr(e,"id");return Oe(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var Ab=499,Rf="djs-dragging",Tb="drop-ok",Mb="drop-not-ok",kb="new-parent",Db="attach-ok";function Ob(e,t,n,i){function r(c){var u=o(c),l=kk(u);return l}function o(c){var u=Yo(c),l=u.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),p=u.concat(l),f=[...new Set(p)];return f}function a(c,u){[Db,Tb,Mb,kb].forEach(function(l){l===u?t.addMarker(c,l):t.removeMarker(c,l)})}function s(c,u,l){i.addDragger(u,c.dragGroup),l&&t.addMarker(u,Rf),c.allDraggedElements?c.allDraggedElements.push(u):c.allDraggedElements=[u]}e.on("shape.move.start",Ab,function(c){var u=c.context,l=u.shapes,p=u.allDraggedElements,f=r(l);if(!u.dragGroup){var d=pe("g");re(d,n.cls("djs-drag-group",["no-events"]));var h=t.getActiveLayer();Se(h,d),u.dragGroup=d}f.forEach(function(m){i.addDragger(m,u.dragGroup)}),p?p=bu([p,o(l)]):p=o(l),M(p,function(m){t.addMarker(m,Rf)}),u.allDraggedElements=p,u.differentParents=Dk(l)}),e.on("shape.move.move",Ab,function(c){var u=c.context,l=u.dragGroup,p=u.target,f=u.shape.parent,d=u.canExecute;p&&(d==="attach"?a(p,Db):u.canExecute&&f&&p.id!==f.id?a(p,kb):a(p,u.canExecute?Tb:Mb)),Zt(l,c.dx,c.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(c){var u=c.context,l=u.target;l&&a(l,null)}),e.on("shape.move.cleanup",function(c){var u=c.context,l=u.allDraggedElements,p=u.dragGroup;M(l,function(f){t.removeMarker(f,Rf)}),p&&It(p)}),this.makeDraggable=s}Ob.$inject=["eventBus","canvas","styles","previewSupport"];function kk(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=Oe(e,function(i){return it(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function Dk(e){return Ix(Xr(e,function(t){return t.parent&&t.parent.id}))!==1}const Ok={__depends__:[rc,Gn,Ef,gi,ki,Eo],__init__:["move","movePreview"],move:["type",Pb],movePreview:["type",Ob]};var Lb=".djs-palette-toggle",Ib=".entry",Lk=Lb+", "+Ib,Cf="djs-palette-",Ik="shown",Pf="open",Nb="two-column",Nk=1e3;function Mt(e,t){this._eventBus=e,this._canvas=t;var n=this;e.on("tool-manager.update",function(i){var r=i.tool;n.updateToolHighlight(r)}),e.on("i18n.changed",function(){n._update()}),e.on("diagram.init",function(){n._diagramInitialized=!0,n._rebuild()})}Mt.$inject=["eventBus","canvas"],Mt.prototype.registerProvider=function(e,t){t||(t=e,e=Nk),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},Mt.prototype.getEntries=function(){var e=this._getProviders();return e.reduce($k,{})},Mt.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},Mt.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=ut(Mt.HTML_MARKUP);n.appendChild(i),ft(n).add(Cf+Ik),En.bind(i,Lk,"click",function(r){var o=r.delegateTarget;if(Gu(o,Lb))return e.toggle();e.trigger("click",r)}),we.bind(i,"mousedown",function(r){r.stopPropagation()}),En.bind(i,Ib,"dragstart",function(r){e.trigger("dragstart",r)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},Mt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},Mt.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,r,o=ft(n),a=ft(t);"twoColumn"in e?r=e.twoColumn:r=this._needsCollapse(t.clientHeight,this._entries||{}),o.toggle(Nb,r),a.toggle(Cf+Nb,r),"open"in e&&(o.toggle(Pf,e.open),a.toggle(Cf+Pf,e.open)),i.fire("palette.changed",{twoColumn:r,open:this.isOpen()})},Mt.prototype._update=function(){var e=et(".djs-palette-entries",this._container),t=this._entries=this.getEntries();fs(e),M(t,function(n,i){var r=n.group||"default",o=et("[data-group="+Ta(r)+"]",e);o||(o=ut('<div class="group"></div>'),on(o,"data-group",r),e.appendChild(o));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=ut(a);if(o.appendChild(s),!n.separator&&(on(s,"data-action",i),n.title&&on(s,"title",n.title),n.className&&Bk(s,n.className),n.imageUrl)){var c=ut("<img>");on(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},Mt.prototype.trigger=function(e,t,n){var i,r,o=t.delegateTarget||t.target;return o?(i=on(o,"data-action"),r=t.originalEvent||t,this.triggerEntry(i,e,r,n)):t.preventDefault()},Mt.prototype.triggerEntry=function(e,t,n,i){var r=this._entries,o,a;if(o=r[e],!!o&&(a=o.action,this._eventBus.fire("palette.trigger",{entry:o,event:n})!==!1)){if(zt(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},Mt.prototype._layoutChanged=function(){this._toggleState({})},Mt.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},Mt.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},Mt.prototype.open=function(){this._toggleState({open:!0})},Mt.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Mt.prototype.isActiveTool=function(e){return e&&this._activeTool===e},Mt.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=et(".djs-palette-entries",this._container),this._toolsContainer=et("[data-group=tools]",t)),n=this._toolsContainer,M(n.children,function(i){var r=i.getAttribute("data-action");if(r){var o=ft(i);r=r.replace("-tool",""),o.contains("entry")&&r===e?o.add("highlighted-entry"):o.remove("highlighted-entry")}})},Mt.prototype.isOpen=function(){return ft(this._container).has(Pf)},Mt.prototype._getParentContainer=function(){return this._canvas.getContainer()},Mt.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function Bk(e,t){var n=ft(e),i=ge(t)?t:t.split(/\s+/g);i.forEach(function(r){n.add(r)})}function $k(e,t){var n=t.getPaletteEntries();return zt(n)?n(e):(M(n,function(i,r){e[r]=i}),e)}const jk={__init__:["palette"],palette:["type",Mt]};var Bb="crosshair",$b="selected",Fk="djs-dragging-active-lasso";function vr(e,t,n,i,r,o,a){this._selection=r,this._dragging=n,this._mouse=a;var s=this,c={create:function(p){var f=t.getActiveLayer(),d=p.frame=pe("rect");re(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),Se(f,d),u(!0),this.update(p)},update:function(p){var f=p.frame,d=p.bbox;f&&d&&re(f,{x:d.x,y:d.y,width:d.width,height:d.height});var h=p.marked,m=p.lastMarked;if(h&&m){for(const g of m)h.has(g)||t.removeMarker(g,$b);for(const g of h)m.has(g)||t.addMarker(g,$b)}},remove:function(p){this.update(p),p.frame&&It(p.frame),u(!1)}};function u(p){$e(t.getContainer()).toggle(Fk,p)}function l(p){var f=i.getAll();return new Set(Kr(io(f,p)))}o.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",function(p){var f=p.originalEvent.target;!p.hover&&!(f instanceof SVGElement)||e.once("lasso.selection.ended",function(){s.activateLasso(p.originalEvent,!0)})}),e.on("lasso.end",0,function(p){var f=p.context;s._select(Array.from(f.marked))}),e.on("lasso.start",function(p){var f=p.context;f.bbox=jb(p),f.add=Zs(p),f.lastMarked=new Set(r.get()),f.add?f.marked=f.lastMarked:f.marked=new Set,f.initialMarked=f.marked,c.create(f)}),e.on("lasso.move",function(p){var f=p.context,d=f.bbox=jb(p),h=l(d),m=f.initialMarked.union(h);f.lastMarked=f.marked,f.marked=m,c.update(f)}),e.on("lasso.cleanup",function(p){var f=p.context;f.lastMarked=f.marked,f.marked=new Set(r.get()),c.remove(p.context)}),e.on("element.mousedown",1500,function(p){if(Zs(p))return s.activateLasso(p.originalEvent),!0})}vr.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],vr.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:Bb,data:{context:{}},keepSelection:!0})},vr.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:Bb,data:{context:{}},keepSelection:!0})},vr.prototype._select=function(e){this._selection.select(e)},vr.prototype.select=function(e,t,n=[]){var i=Kr(io(e,t));this._select([...n,...i])},vr.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},vr.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function jb(e){var t={x:e.x-e.dx,y:e.y-e.dy},n={x:e.x,y:e.y},i;return t.x<=n.x&&t.y<n.y||t.x<n.x&&t.y<=n.y?i={x:t.x,y:t.y,width:n.x-t.x,height:n.y-t.y}:t.x>=n.x&&t.y<n.y||t.x>n.x&&t.y<=n.y?i={x:n.x,y:t.y,width:t.x-n.x,height:n.y-t.y}:t.x<=n.x&&t.y>n.y||t.x<n.x&&t.y>=n.y?i={x:t.x,y:n.y,width:n.x-t.x,height:t.y-n.y}:t.x>=n.x&&t.y>n.y||t.x>n.x&&t.y>=n.y?i={x:n.x,y:n.y,width:t.x-n.x,height:t.y-n.y}:i={x:n.x,y:n.y,width:0,height:0},i}const Hk={__depends__:[cc,da],__init__:["lassoTool"],lassoTool:["type",vr]};var Af=1500,Fb="grab";function Oo(e,t,n,i,r,o){this._dragging=n,this._mouse=o;var a=this,s=i.get("keyboard",!1);r.registerTool("hand",{tool:"hand",dragging:"hand.move"}),e.on("element.mousedown",Af,function(c){if(la(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(Af,function(c){if(!(!Hb(c.keyEvent)||a.isActive())){var u=a._mouse.getLastMoveEvent();a.activateMove(u,!!u)}},"keyboard.keydown"),s&&s.addListener(Af,function(c){!Hb(c.keyEvent)||!a.isActive()||a.toggle()},"keyboard.keyup"),e.on("hand.end",function(c){var u=c.originalEvent.target;if(!c.hover&&!(u instanceof SVGElement))return!1;e.once("hand.ended",function(){a.activateMove(c.originalEvent,{reactivate:!0})})}),e.on("hand.move.move",function(c){var u=t.viewbox().scale;t.scroll({dx:c.dx*u,dy:c.dy*u})}),e.on("hand.move.end",function(c){var u=c.context,l=u.reactivate;return!la(c)&&l&&e.once("hand.move.ended",function(p){a.activateHand(p.originalEvent,!0,!0)}),!1})}Oo.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Oo.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:Fb,data:{context:n||{}}})},Oo.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:Fb,data:{context:{reactivate:n}}})},Oo.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Oo.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function Hb(e){return Nt("Space",e)}const zk={__depends__:[cc,da],__init__:["handTool"],handTool:["type",Oo]};var zb="connect-ok",Vb="connect-not-ok";function Lo(e,t,n,i,r,o,a){var s=this;this._dragging=t,this._rules=o,this._mouse=a,r.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),e.on("global-connect.hover",function(c){var u=c.context,l=c.hover,p=u.canStartConnect=s.canStartConnect(l);p!==null&&(u.startTarget=l,i.addMarker(l,p?zb:Vb))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var u=c.context.startTarget,l=c.context.canStartConnect;u&&i.removeMarker(u,l?zb:Vb)}),e.on(["global-connect.ended"],function(c){var u=c.context,l=u.startTarget,p={x:c.x,y:c.y},f=s.canStartConnect(l);if(f)return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),n.start(null,l,p)}),!1})}Lo.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],Lo.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},Lo.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},Lo.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Lo.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const Vk={__depends__:[yf,gi,ki,cc,da],globalConnect:["type",Lo]};function Tf(e,t,n,i,r,o,a,s){this._palette=e,this._create=t,this._elementFactory=n,this._spaceTool=i,this._lassoTool=r,this._handTool=o,this._globalConnect=a,this._translate=s,e.registerProvider(this)}Tf.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],Tf.prototype.getPaletteEntries=function(){var e={},t=this._create,n=this._elementFactory,i=this._spaceTool,r=this._lassoTool,o=this._handTool,a=this._globalConnect,s=this._translate;function c(p,f,d,h,m){function g(R){var E=n.createShape(D({type:p},m));t.start(R,E)}return{group:f,className:d,title:h,action:{dragstart:g,click:g}}}function u(p){var f=n.createShape({type:"bpmn:SubProcess",x:0,y:0,isExpanded:!0}),d=n.createShape({type:"bpmn:StartEvent",x:40,y:82,parent:f});t.start(p,[f,d],{hints:{autoSelect:[f]}})}function l(p){t.start(p,n.createParticipantShape())}return D(e,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:s("Activate hand tool"),action:{click:function(p){o.activateHand(p)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:s("Activate lasso tool"),action:{click:function(p){r.activateSelection(p)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:s("Activate create/remove space tool"),action:{click:function(p){i.activateSelection(p)}}},"global-connect-tool":{group:"tools",className:"bpmn-icon-connection-multi",title:s("Activate global connect tool"),action:{click:function(p){a.start(p)}}},"tool-separator":{group:"tools",separator:!0},"create.start-event":c("bpmn:StartEvent","event","bpmn-icon-start-event-none",s("Create start event")),"create.intermediate-event":c("bpmn:IntermediateThrowEvent","event","bpmn-icon-intermediate-event-none",s("Create intermediate/boundary event")),"create.end-event":c("bpmn:EndEvent","event","bpmn-icon-end-event-none",s("Create end event")),"create.exclusive-gateway":c("bpmn:ExclusiveGateway","gateway","bpmn-icon-gateway-none",s("Create gateway")),"create.task":c("bpmn:Task","activity","bpmn-icon-task",s("Create task")),"create.data-object":c("bpmn:DataObjectReference","data-object","bpmn-icon-data-object",s("Create data object reference")),"create.data-store":c("bpmn:DataStoreReference","data-store","bpmn-icon-data-store",s("Create data store reference")),"create.subprocess-expanded":{group:"activity",className:"bpmn-icon-subprocess-expanded",title:s("Create expanded sub-process"),action:{dragstart:u,click:u}},"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:s("Create pool/participant"),action:{dragstart:l,click:l}},"create.group":c("bpmn:Group","artifact","bpmn-icon-group",s("Create group"))}),e};const Gk={__depends__:[jk,ac,yy,Hk,zk,Vk,ia],__init__:["paletteProvider"],paletteProvider:["type",Tf]};var Wk=250;function Mf(e,t,n,i,r){Y.call(this,e);function o(s){var c=s.canExecute.replacements;M(c,function(u){var l=u.oldElementId,p={type:u.newElementType};if(!s.visualReplacements[l]){var f=t.get(l);D(p,{x:f.x,y:f.y});var d=n.createShape(p);i.addShape(d,f.parent);var h=et('[data-element-id="'+Ta(f.id)+'"]',s.dragGroup);h&&re(h,{display:"none"});var m=r.addDragger(d,s.dragGroup);s.visualReplacements[l]=m,i.removeShape(d)}})}function a(s){var c=s.visualReplacements;M(c,function(u,l){var p=et('[data-element-id="'+Ta(l)+'"]',s.dragGroup);p&&re(p,{display:"inline"}),u.remove(),c[l]&&delete c[l]})}e.on("shape.move.move",Wk,function(s){var c=s.context,u=c.canExecute;c.visualReplacements||(c.visualReplacements={}),u&&u.replacements?o(c):a(c)})}Mf.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],ie(Mf,Y);const Uk={__depends__:[Eo],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",Mf]};var qk=1250,kf=40,Yk=20,Kk=10,Gb=20,Wb=["x","y"],Xk=Math.abs;function Ub(e){e.on(["connect.hover","connect.move","connect.end"],qk,function(t){var n=t.context,i=n.canExecute,r=n.start,o=n.hover,a=n.source,s=n.target;t.originalEvent&&Rn(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&o&&Zk(t,o,tD(o)),o&&eD(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=qn(r),De(o,["bpmn:Event","bpmn:Gateway"])&&qb(t,qn(o)),De(o,["bpmn:Task","bpmn:SubProcess"])&&Qk(t,o),v(a,"bpmn:BoundaryEvent")&&s===a.host&&Jk(t)):Yb(i,"bpmn:MessageFlow")?(v(r,"bpmn:Event")&&(n.connectionStart=qn(r)),v(o,"bpmn:Event")&&qb(t,qn(o))):n.connectionStart=n.initialConnectionStart)})}Ub.$inject=["eventBus"];function Zk(e,t,n){Wb.forEach(function(i){var r=Kb(i,t);e[i]<t[i]+n?Tt(e,i,t[i]+n):e[i]>t[i]+r-n&&Tt(e,i,t[i]+r-n)})}function Qk(e,t){var n=qn(t);Wb.forEach(function(i){nD(e,t,i)&&Tt(e,i,n[i])})}function Jk(e){var t=e.context,n=t.source,i=t.target;if(!iD(t)){var r=qn(n),o=Xt(r,i,-10),a=[];/top|bottom/.test(o)&&a.push("x"),/left|right/.test(o)&&a.push("y"),a.forEach(function(s){var c=e[s],u;Xk(c-r[s])<kf&&(c>r[s]?u=r[s]+kf:u=r[s]-kf,Tt(e,s,u))})}}function qb(e,t){Tt(e,"x",t.x),Tt(e,"y",t.y)}function Yb(e,t){return e&&e.type===t}function eD(e,t){return Fi(t,function(n){return Yb(e,n)})}function Kb(e,t){return e==="x"?t.width:t.height}function tD(e){return v(e,"bpmn:Task")?Kk:Yk}function nD(e,t,n){return e[n]>t[n]+Gb&&e[n]<t[n]+Kb(n,t)-Gb}function iD(e){var t=e.hover,n=e.source;return t&&n&&t===n}function _r(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}_r.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},_r.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},_r.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},_r.prototype.getSnapLocations=function(){return this._snapLocations},_r.prototype.setSnapLocations=function(e){this._snapLocations=e},_r.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new hu,n.initDefaults(this._defaultSnaps)),n};function hu(){this._snapValues={}}hu.prototype.add=function(e,t){var n=this._snapValues[e];n||(n=this._snapValues[e]={x:[],y:[]}),n.x.indexOf(t.x)===-1&&n.x.push(t.x),n.y.indexOf(t.y)===-1&&n.y.push(t.y)},hu.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&WM(e[n],r[n],i)},hu.prototype.initDefaults=function(e){var t=this;M(e||{},function(n,i){M(n,function(r){t.add(i,r)})})};var rD=1250;function bi(e,t,n){var i=this;this._elementRegistry=e,t.on(["create.start","shape.move.start"],function(r){i.initSnap(r)}),t.on(["create.move","create.end","shape.move.move","shape.move.end"],rD,function(r){var o=r.context,a=o.shape,s=o.snapContext,c=o.target;if(!(r.originalEvent&&Rn(r.originalEvent))&&!(Do(r)||!c)){var u=s.pointsForTarget(c);u.initialized||(u=i.addSnapTargetPoints(u,a,c),u.initialized=!0),n.snap(r,u)}}),t.on(["create.cleanup","shape.move.cleanup"],function(){n.hide()})}bi.$inject=["elementRegistry","eventBus","snapping"],bi.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,r=n.snapContext;r||(r=n.snapContext=new _r);var o;t.get(i.id)?o=qn(i,e):o={x:e.x+qn(i).x,y:e.y+qn(i).y};var a={x:o.x-i.width/2,y:o.y-i.height/2},s={x:o.x+i.width/2,y:o.y+i.height/2};return r.setSnapOrigin("mid",{x:o.x-e.x,y:o.y-e.y}),ke(i)||(r.setSnapOrigin("top-left",{x:a.x-e.x,y:a.y-e.y}),r.setSnapOrigin("bottom-right",{x:s.x-e.x,y:s.y-e.y})),r},bi.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return M(i,function(r){if(ke(r)){ke(t)&&e.add("mid",qn(r));return}if(it(r)){if(r.waypoints.length<3)return;var o=r.waypoints.slice(1,-1);M(o,function(a){e.add("mid",a)});return}e.add("mid",qn(r))}),!xe(t.x)||!xe(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",qn(t)),e},bi.prototype.getSnapTargets=function(e,t){return I_(t).filter(function(n){return!oD(n)})};function oD(e){return!!e.hidden}var Xb=1500;function Io(e,t){t.invoke(bi,this),e.on(["create.move","create.end"],Xb,uD),e.on(["create.move","create.end","shape.move.move","shape.move.end"],Xb,function(n){var i=n.context,r=i.canExecute,o=i.target,a=r&&(r==="attach"||r.attach);a&&!Do(n)&&aD(n,o)})}ie(Io,bi),Io.$inject=["eventBus","injector"],Io.prototype.initSnap=function(e){var t=bi.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return M(n.outgoing,function(r){var o=r.waypoints[0];o=o.original||o,t.setSnapOrigin(r.id+"-docking",Qb(o,i,e))}),M(n.incoming,function(r){var o=r.waypoints[r.waypoints.length-1];o=o.original||o,t.setSnapOrigin(r.id+"-docking",Qb(o,i,e))}),v(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},Io.prototype.addSnapTargetPoints=function(e,t,n){bi.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);M(i,function(o){(cD(o)||sD([t,o],"bpmn:TextAnnotation"))&&(e.add("top-left",O_(o)),e.add("bottom-right",L_(o)))});var r=this._elementRegistry;return M(t.incoming,function(o){if(r.get(t.id)){Zb(i,o.source)||e.add("mid",ye(o.source));var a=o.waypoints[0];e.add(o.id+"-docking",a.original||a)}}),M(t.outgoing,function(o){if(r.get(t.id)){Zb(i,o.target)||e.add("mid",ye(o.target));var a=o.waypoints[o.waypoints.length-1];e.add(o.id+"-docking",a.original||a)}}),v(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},Io.prototype.getSnapTargets=function(e,t){return bi.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!v(n,"bpmn:Lane")})};function aD(e,t){var n=me(t),i=dg(e,t),r=e.context,o=r.shape,a;o.parent?a={x:0,y:0}:a=ye(o),/top/.test(i)?Tt(e,"y",n.top-a.y):/bottom/.test(i)&&Tt(e,"y",n.bottom-a.y),/left/.test(i)?Tt(e,"x",n.left-a.x):/right/.test(i)&&Tt(e,"x",n.right-a.x)}function sD(e,t){return e.every(function(n){return v(n,t)})}function cD(e){return v(e,"bpmn:SubProcess")&&Be(e)?!0:v(e,"bpmn:Participant")}function uD(e){var t=e.context,n=t.createConstraints;if(n){var i=n.top,r=n.right,o=n.bottom,a=n.left;(a&&a>=e.x||r&&r<=e.x)&&Tt(e,"x",e.x),(i&&i>=e.y||o&&o<=e.y)&&Tt(e,"y",e.y)}}function Zb(e,t){return e.indexOf(t)!==-1}function Qb(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var lD=1250;function Wa(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],lD,function(i){var r=i.context,o=r.shape,a=o.parent,s=r.direction,c=r.snapContext;if(!(i.originalEvent&&Rn(i.originalEvent))&&!Do(i)){var u=c.pointsForTarget(a);u.initialized||(u=n.addSnapTargetPoints(u,o,a,s),u.initialized=!0),dD(s)&&Tt(i,"x",i.x),hD(s)&&Tt(i,"y",i.y),t.snap(i,u)}}),e.on(["resize.cleanup"],function(){t.hide()})}Wa.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new _r);var o=Jb(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},Wa.prototype.addSnapTargetPoints=function(e,t,n,i){var r=this.getSnapTargets(t,n);return M(r,function(o){e.add("corner",L_(o)),e.add("corner",O_(o))}),e.add("corner",Jb(t,i)),e},Wa.$inject=["eventBus","snapping"],Wa.prototype.getSnapTargets=function(e,t){return I_(t).filter(function(n){return!pD(n,e)&&!it(n)&&!fD(n)&&!ke(n)})};function Jb(e,t){var n=ye(e),i=me(e),r={x:n.x,y:n.y};return t.indexOf("n")!==-1?r.y=i.top:t.indexOf("s")!==-1&&(r.y=i.bottom),t.indexOf("e")!==-1?r.x=i.right:t.indexOf("w")!==-1&&(r.x=i.left),r}function pD(e,t){return e.host===t}function fD(e){return!!e.hidden}function dD(e){return e==="n"||e==="s"}function hD(e){return e==="e"||e==="w"}var mD=7,gD=1e3;function br(e){this._canvas=e,this._asyncHide=Eu(mn(this.hide,this),gD)}br.$inject=["canvas"],br.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,r=i.getSnapLocations(),o={x:Do(e,"x"),y:Do(e,"y")};M(r,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(M(["x","y"],function(u){var l;o[u]||(l=t.snap(c,a,u,mD),l!==void 0&&(o[u]={value:l,originValue:l-s[u]}))}),o.x&&o.y)return!1}),this.showSnapLine("vertical",o.x&&o.x.value),this.showSnapLine("horizontal",o.y&&o.y.value),M(["x","y"],function(a){var s=o[a];Ht(s)&&Tt(e,a,s.originValue)})},br.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=pe("path");return re(n,{d:"M0,0 L0,0"}),$e(n).add("djs-snap-line"),Se(t,n),{update:function(i){xe(i)?e==="horizontal"?re(n,{d:"M-100000,"+i+" L+100000,"+i,display:""}):re(n,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):re(n,{display:"none"})}}},br.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},br.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},br.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},br.prototype.hide=function(){M(this._snapLines,function(e){e.update()})};const yD={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",bi],resizeSnapping:["type",Wa],snapping:["type",br]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",Ub],createMoveSnapping:["type",Io]};var ex=300;function Re(e,t,n,i){this._open=!1,this._results={},this._eventMaps=[],this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._canvas=e,this._eventBus=t,this._selection=n,this._translate=i,this._container=this._getBoxHtml(),this._searchInput=et(Re.INPUT_SELECTOR,this._container),this._resultsContainer=et(Re.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}Re.$inject=["canvas","eventBus","selection","translate"],Re.prototype._bindEvents=function(){var e=this;function t(n,i,r,o){e._eventMaps.push({el:n,type:r,listener:En.bind(n,i,r,o)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,Re.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,Re.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,Re.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,Re.INPUT_SELECTOR,"keydown",function(n){Nt("ArrowUp",n)&&n.preventDefault(),Nt("ArrowDown",n)&&n.preventDefault()}),t(this._container,Re.INPUT_SELECTOR,"keyup",function(n){if(Nt("Escape",n))return e.close();if(Nt("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(Nt("ArrowUp",n))return e._scrollToDirection(!0);if(Nt("ArrowDown",n))return e._scrollToDirection();Nt(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},Re.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){En.unbind(e.el,e.type,e.listener)})},Re.prototype._search=function(e){var t=this;if(this._clearResults(),!!e.trim()){var n=this._searchProvider.find(e);if(n=n.filter(function(r){return!t._canvas.getRootElements().includes(r.element)}),!n.length){this._selection.select(null);return}n.forEach(function(r){var o=r.element.id,a=t._createResultNode(r,o);t._results[o]={element:r.element,node:a}});var i=et(Re.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},Re.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},Re.prototype._scrollToNode=function(e){if(!(!e||e===this._getCurrentResult())){var t=e.offsetTop,n=this._resultsContainer.scrollTop,i=t-this._resultsContainer.clientHeight+e.clientHeight;t<n?this._resultsContainer.scrollTop=t:n<i&&(this._resultsContainer.scrollTop=i)}},Re.prototype._clearResults=function(){fs(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},Re.prototype._getCurrentResult=function(){return et(Re.RESULT_SELECTED_SELECTOR,this._resultsContainer)},Re.prototype._createResultNode=function(e,t){var n=ut(Re.RESULT_HTML);return e.primaryTokens.length>0&&tx(n,e.primaryTokens,Re.RESULT_PRIMARY_HTML),tx(n,e.secondaryTokens,Re.RESULT_SECONDARY_HTML),on(n,Re.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},Re.prototype.registerProvider=function(e){this._searchProvider=e},Re.prototype.open=function(){if(!this._searchProvider)throw new Error("no search provider registered");this.isOpen()||(this._cachedRootElement=this._canvas.getRootElement(),this._cachedSelection=this._selection.get(),this._cachedViewbox=this._canvas.viewbox(),this._selection.select(null),this._bindEvents(),this._open=!0,ft(this._canvas.getContainer()).add("djs-search-open"),ft(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},Re.prototype.close=function(e=!0){this.isOpen()&&(e&&(this._cachedRootElement&&this._canvas.setRootElement(this._cachedRootElement),this._cachedSelection&&this._selection.select(this._cachedSelection),this._cachedViewbox&&this._canvas.viewbox(this._cachedViewbox),this._eventBus.fire("searchPad.restored")),this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._unbindEvents(),this._open=!1,ft(this._canvas.getContainer()).remove("djs-search-open"),ft(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},Re.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Re.prototype.isOpen=function(){return this._open},Re.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&ft(t).remove(Re.RESULT_SELECTED_CLASS);var n=on(e,Re.RESULT_ID_ATTRIBUTE),i=this._results[n].element;ft(e).add(Re.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:ex}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},Re.prototype._select=function(e){var t=on(e,Re.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:ex}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},Re.prototype._getBoxHtml=function(){const e=ut(Re.BOX_HTML),t=et(Re.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function tx(e,t,n){var i=vD(t),r=ut(n);r.innerHTML=i,e.appendChild(r)}function vD(e){var t="";return e.forEach(function(n){var i=uv(n.value||n.matched||n.normal),r=n.match||n.matched;r?t+='<b class="'+Re.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}Re.CONTAINER_SELECTOR=".djs-search-container",Re.INPUT_SELECTOR=".djs-search-input input",Re.RESULTS_CONTAINER_SELECTOR=".djs-search-results",Re.RESULT_SELECTOR=".djs-search-result",Re.RESULT_SELECTED_CLASS="djs-search-result-selected",Re.RESULT_SELECTED_SELECTOR="."+Re.RESULT_SELECTED_CLASS,Re.RESULT_ID_ATTRIBUTE="data-result-id",Re.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",Re.BOX_HTML=`<div class="djs-search-container djs-scrollable">
|
|
335
336
|
<div class="djs-search-input">
|
|
336
337
|
<svg class="djs-search-icon" width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
337
338
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.0325 8.5H9.625L13.3675 12.25L12.25 13.3675L8.5 9.625V9.0325L8.2975 8.8225C7.4425 9.5575 6.3325 10 5.125 10C2.4325 10 0.25 7.8175 0.25 5.125C0.25 2.4325 2.4325 0.25 5.125 0.25C7.8175 0.25 10 2.4325 10 5.125C10 6.3325 9.5575 7.4425 8.8225 8.2975L9.0325 8.5ZM1.75 5.125C1.75 6.9925 3.2575 8.5 5.125 8.5C6.9925 8.5 8.5 6.9925 8.5 5.125C8.5 3.2575 6.9925 1.75 5.125 1.75C3.2575 1.75 1.75 3.2575 1.75 5.125Z" fill="#22242A"/>
|
|
@@ -339,4 +340,4 @@
|
|
|
339
340
|
<input type="text" spellcheck="false" />
|
|
340
341
|
</div>
|
|
341
342
|
<div class="djs-search-results" />
|
|
342
|
-
</div>`,
|
|
343
|
+
</div>`,Re.RESULT_HTML='<div class="djs-search-result"></div>',Re.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',Re.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const _D={__depends__:[ia,Mc,Gn],searchPad:["type",Re]};function Df(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}Df.$inject=["elementRegistry","searchPad","canvas","search"],Df.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!ke(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:In(i),id:i.id})),e,{keys:["label","id"]}).map(bD)};function bD(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const xD={__depends__:[_D,d_],__init__:["bpmnSearch"],bpmnSearch:["type",Df]},ED="M44.7648 11.3263L36.9892 2.64074C36.0451 1.58628 34.5651 0.988708 33.1904 0.988708H5.98667C3.22688 0.988708 0.989624 3.34892 0.989624 6.26039V55.0235C0.989624 57.9349 3.22688 60.2952 5.98667 60.2952H40.966C43.7257 60.2952 45.963 57.9349 45.963 55.0235V14.9459C45.963 13.5998 45.6407 12.3048 44.7648 11.3263Z",wD="M1.03845 48.1347C1.03845 49.3511 1.07295 50.758 1.38342 52.064C1.69949 53.3938 2.32428 54.7154 3.56383 55.6428C6.02533 57.4841 10.1161 58.7685 14.8212 59.6067C19.5772 60.4538 25.1388 60.8738 30.6831 60.8738C36.2276 60.8738 41.7891 60.4538 46.545 59.6067C51.2504 58.7687 55.3412 57.4842 57.8028 55.6429C59.0424 54.7156 59.6673 53.3938 59.9834 52.064C60.2938 50.7579 60.3285 49.351 60.3285 48.1344V13.8415C60.3285 12.6249 60.2938 11.218 59.9834 9.91171C59.6673 8.58194 59.0423 7.2602 57.8027 6.33294C55.341 4.49168 51.2503 3.20723 46.545 2.36914C41.7891 1.522 36.2276 1.10204 30.6831 1.10205C25.1388 1.10206 19.5772 1.52206 14.8213 2.36923C10.1162 3.20734 6.02543 4.49183 3.5639 6.33314C2.32433 7.26038 1.69951 8.58206 1.38343 9.91181C1.07295 11.2179 1.03845 12.6247 1.03845 13.8411V48.1347Z",SD={width:36,height:50},RD={width:50,height:50};function nx(e,t,n){return pe("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const Xn=5;function mu(e,t){this._styles=t,e.registerProvider(this)}mu.$inject=["outline","styles"],mu.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(K1(e))return n=pe("rect"),re(n,D({x:-Xn,y:-Xn,rx:4,width:e.width+Xn*2,height:e.height+Xn*2},t)),n;if(!ke(e))return v(e,"bpmn:Gateway")?(n=pe("rect"),D(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),re(n,D({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):De(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=pe("rect"),re(n,D({x:-Xn,y:-Xn,rx:14,width:e.width+Xn*2,height:e.height+Xn*2},t))):v(e,"bpmn:EndEvent")?(n=pe("circle"),re(n,D({cx:e.width/2,cy:e.height/2,r:e.width/2+Xn+1},t))):v(e,"bpmn:Event")?(n=pe("circle"),re(n,D({cx:e.width/2,cy:e.height/2,r:e.width/2+Xn},t))):v(e,"bpmn:DataObjectReference")&&ix(e,"bpmn:DataObjectReference")?n=nx(ED,{x:-6,y:-6},t):v(e,"bpmn:DataStoreReference")&&ix(e,"bpmn:DataStoreReference")&&(n=nx(wD,{x:-6,y:-6},t)),n},mu.prototype.updateOutline=function(e,t){if(!ke(e))return De(e,["bpmn:SubProcess","bpmn:Group"])?(re(t,{width:e.width+Xn*2,height:e.height+Xn*2}),!0):!!De(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function ix(e,t){var n;return t==="bpmn:DataObjectReference"?n=SD:t==="bpmn:DataStoreReference"&&(n=RD),e.width===n.width&&e.height===n.height}const CD={__depends__:[Ef],__init__:["outlineProvider"],outlineProvider:["type",mu]};var PD='<?xml version="1.0" encoding="UTF-8"?><bpmn:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" targetNamespace="http://bpmn.io/schema/bpmn" id="Definitions_1"><bpmn:process id="Process_1" isExecutable="false"><bpmn:startEvent id="StartEvent_1"/></bpmn:process><bpmndi:BPMNDiagram id="BPMNDiagram_1"><bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1"><bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"><dc:Bounds height="36.0" width="36.0" x="173.0" y="102.0"/></bpmndi:BPMNShape></bpmndi:BPMNPlane></bpmndi:BPMNDiagram></bpmn:definitions>';function xi(e){ao.call(this,e)}ie(xi,ao),xi.Viewer=dr,xi.NavigatedViewer=Ma,xi.prototype.createDiagram=function(){return this.importXML(PD)},xi.prototype._interactionModules=[gv,vv,xv],xi.prototype._modelingModules=[TM,Ac,LM,DM,qM,yf,JM,S2,ay,ac,A2,k2,q2,K2,X2,tk,dk,vk,zp,Rk,Ok,Gk,Uk,yb,yD,xD,CD],xi.prototype._modules=[].concat(dr.prototype._modules,xi.prototype._interactionModules,xi.prototype._modelingModules);const AD=((e,t)=>{const n=e.__vccOpts||e;for(const[i,r]of t)n[i]=r;return n})(St.defineComponent({__name:"BpmnModelerView",props:{xml:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,r=n,o=St.ref();let a;async function s(u){if(!a)throw new Error("modeler not mounted");try{const{warnings:l}=await a.importXML(u),p=Nu(l);return r("imported",p),{warnings:p}}catch(l){throw r("import-error",l),l}}async function c(){if(!a)throw new Error("modeler not mounted");const{xml:u}=await a.saveXML({format:!0});return u??""}return St.onMounted(async()=>{a=new xi({container:o.value,moddleExtensions:es}),i.xml&&await s(i.xml),r("ready")}),St.watch(()=>i.xml,u=>{u&&a&&s(u)}),St.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(u,l)=>(St.openBlock(),St.createElementBlock("div",{ref_key:"container",ref:o,class:"bpmn-modeler-view"},null,512))}}),[["__scopeId","data-v-a9b41c97"]]);Q.APPLY_BPMN_OPS_SCHEMA=kx,Q.BPMN_MODDLE_EXTENSIONS=es,Q.BWL_MODDLE_SCHEMA=Nf,Q.BWL_NS=If,Q.BWL_PREFIX=yu,Q.BWL_SIDES=vu,Q.BpmnModelerView=AD,Q.EDITOR=YE,Q.FLOW_LABEL_INDENT=dd,Q.HEADLESS_BPMN_MODULES=av,Q.HEADLESS_TEXT_METRICS=no,Q.I18N_NS=uE,Q.I18N_PREFIX=sd,Q.LABEL_FORK_MARGIN=Bu,Q.MVP_FLOW_NODE_TYPES=Ei,Q.SYMBOLIC_OP_KINDS=jf,Q.SYMBOLIC_OP_SCHEMA=Ff,Q.UNDO_EPISODE_COMMAND=_u,Q.applyBpmnOpBatch=Jd,Q.applyBpmnOps=Kd,Q.approximateTextWidth=Go,Q.auditBpmnGeometry=bd,Q.auditBpmnGeometryXml=wE,Q.auditGeometry=Ui,Q.auditTargetsOf=Wi,Q.axisSegmentsOf=xn,Q.buildBpmnOpBatch=qE,Q.buildRegistryIndex=Ed,Q.containerBoundarySegments=$u,Q.createBpmnEditorController=KE,Q.createBpmnModdle=cd,Q.createHeadlessBpmnModeler=mT,Q.crossedShapesOf=si,Q.crossingCost=Cr,Q.describeProcess=Qd,Q.describeProcessXml=UE,Q.edgeCrossCount=os,Q.edgeCrossingPairsOf=ju,Q.executeAsUndoEpisode=$f,Q.forwardThreePointCandidates=Cd,Q.geometryFindingKey=Gi,Q.installHeadlessBpmnDom=Ud,Q.isMvpFlowNodeType=Lf,Q.labelRectsOf=Fu,Q.lineCrossesLabel=Vo,Q.lineThroughLabel=gd,Q.loadBpmnXml=Iu,Q.lowerOps=Yd,Q.oppositeOverlapCount=dE,Q.oppositeOverlapOf=fd,Q.planBackEdgeBoundaryClearance=Id,Q.planCrossPoolRoute=kd,Q.planEdgeRepair=Ad,Q.planLabelLineClearance=Fd,Q.planLabelPlacement=jd,Q.planMiddleSegmentShifts=Rd,Q.planOppositeOverlapRepair=Bd,Q.planSegmentDetours=Sd,Q.repairIntroducedBoundaryHugging=Nd,Q.repairIntroducedCrossings=Td,Q.repairIntroducedLabelLines=Hd,Q.repairIntroducedOppositeOverlaps=$d,Q.repairIntroducedSharedSegmentLabels=zd,Q.rerouteIntroducedCrossPoolEdges=Dd,Q.resolverServicesOf=qd,Q.saveBpmnXml=lE,Q.sceneCrossingCost=vd,Q.sceneFromDefinitions=_d,Q.sceneFromRegistry=pn,Q.sharedSegmentUnderLabel=rs,Q.sharedSpansOf=is,Q.unreadableOverlapCount=Ho,Q.unreadableOverlapOf=ns,Q.validateOps=Wd,Q.warningMessages=Nu,Object.defineProperty(Q,Symbol.toStringTag,{value:"Module"})}));
|