@g1cloud/bpmn-modeler-next 5.0.0-beta.8 → 5.0.0-beta.9

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.
@@ -1,14 +1,14 @@
1
- (function(X,de){typeof exports=="object"&&typeof module<"u"?de(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],de):(X=typeof globalThis<"u"?globalThis:X||self,de(X.BpmnModeler={},X.Vue))})(this,(function(X,de){"use strict";var NN=Object.defineProperty;var $N=(X,de,Zr)=>de in X?NN(X,de,{enumerable:!0,configurable:!0,writable:!0,value:Zr}):X[de]=Zr;var ki=(X,de,Zr)=>$N(X,typeof de!="symbol"?de+"":de,Zr);const Zr=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","subProcess","boundaryEvent","intermediateCatchEvent"],Us=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","intermediateCatchEvent"];function Dh(e){return Zr.includes(e)}function Lh(e){return Us.includes(e)}const qs=["timer"],Ys={timer:"bpmn:TimerEventDefinition"};function Ih(e){return typeof e=="string"&&qs.includes(e)}function ju(e){if(e.length===1)return qs.find(t=>Ys[t]===e[0])}const Bh="http://g1project.net/spec/bpmn/bwl/1.0",Hu="bwl",zu=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],Gu="bwl:ReviewRequest",Nh={name:"bwl-hints",uri:Bh,prefix:Hu,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:"AfterColumnHint",extends:["bpmn:FlowNode"],properties:[{name:"afterColumn",isAttr:!0,type:"String"}]},{name:"PoolOrderHint",extends:["bpmn:Participant"],properties:[{name:"poolOrder",isAttr:!0,type:"Integer"}]},{name:"ReviewRequest",superClass:["Element"],properties:[{name:"locale",isAttr:!0,type:"String"},{name:"sourceLocale",isAttr:!0,type:"String"},{name:"previous",isBody:!0,type:"String"}]}]},Vu="bwl.undoEpisode",$h=new WeakSet;function LE(e){$h.has(e)||(e.register(Vu,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),$h.add(e))}function Fh(e,t){LE(e);const n={run:t};if(e.execute(Vu,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}function Wu(e){return Array.prototype.concat.apply([],e)}const Ma=Object.prototype.toString,IE=Object.prototype.hasOwnProperty;function Qr(e){return e===void 0}function an(e){return e!==void 0}function Po(e){return e==null}function Fe(e){return Ma.call(e)==="[object Array]"}function dn(e){return Ma.call(e)==="[object Object]"}function Ge(e){return Ma.call(e)==="[object Number]"}function hn(e){const t=Ma.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function Gn(e){return Ma.call(e)==="[object String]"}function BE(e){if(!Fe(e))throw new Error("must supply array")}function Vn(e,t){return!Po(e)&&IE.call(e,t)}function Tt(e,t){const n=Xs(t);let i;return H(e,function(r,o){if(n(r,o))return i=r,!1}),i}function jh(e,t){const n=Xs(t);let i=Fe(e)?-1:void 0;return H(e,function(r,o){if(n(r,o))return i=o,!1}),i}function tt(e,t){const n=Xs(t);let i=[];return H(e,function(r,o){n(r,o)&&i.push(r)}),i}function H(e,t){let n,i;if(Qr(e))return;const r=Fe(e)?HE:jE;for(let o in e)if(Vn(e,o)&&(n=e[o],i=t(n,r(o)),i===!1))return n}function NE(e,t){if(Qr(e))return[];BE(e);const n=Xs(t);return e.filter(function(i,r){return!n(i,r)})}function Wn(e,t,n){return H(e,function(i,r){n=t(n,i,r)}),n}function Jr(e,t){return!!Wn(e,function(n,i,r){return n&&t(i,r)},!0)}function yr(e,t){return!!Tt(e,t)}function Mn(e,t){let n=[];return H(e,function(i,r){n.push(t(i,r))}),n}function Ks(e){return e&&Object.keys(e)||[]}function $E(e){return Ks(e).length}function To(e){return Mn(e,t=>t)}function ko(e,t,n={}){return t=Uu(t),H(e,function(i){let r=t(i)||"_",o=n[r];o||(o=n[r]=[]),o.push(i)}),n}function Hh(e,...t){e=Uu(e);let n={};return H(t,r=>ko(r,e,n)),Mn(n,function(r,o){return r[0]})}const FE=Hh;function Oi(e,t){t=Uu(t);let n=[];return H(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)}),Mn(n,i=>i.v)}function Oo(e){return function(t){return Jr(e,function(n,i){return t[i]===n})}}function Uu(e){return hn(e)?e:t=>t[e]}function Xs(e){return hn(e)?e:t=>t===e}function jE(e){return e}function HE(e){return Number(e)}function qu(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 l(){n&&a(!0),c()}function u(...p){o=Date.now(),i=p,r=this,n||s(t)}return u.flush=l,u.cancel=c,u}function Fn(e,t){return e.bind(t)}function W(e,...t){return Object.assign(e,...t)}function zE(e,t,n){let i=e;return H(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];an(a)&&Po(s)&&(s=i[r]=isNaN(+a)?{}:[]),Qr(a)?Qr(n)?delete i[r]:i[r]=n:i=s}),e}function Ci(e,t){let n={},i=Object(e);return H(t,function(r){r in i&&(n[r]=e[r])}),n}function Di(e,t){let n={},i=Object(e);return H(i,function(r,o){t.indexOf(o)===-1&&(n[o]=r)}),n}function C(e,t){var n=ue(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function et(e,t){return yr(t,function(n){return C(e,n)})}function ue(e){return e&&e.businessObject||e}function pt(e){return e&&e.di}const GE="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",zh="i18n",Pa="i18n:Translation";function Ta(e){if(e){if(C(e,"bpmn:TextAnnotation"))return{target:e,key:"text"};if(C(e,"bpmn:Group"))return e.categoryValueRef?{target:e.categoryValueRef,key:"value"}:void 0;if(C(e,"bpmn:FlowElement")||C(e,"bpmn:Participant")||C(e,"bpmn:Lane")||C(e,"bpmn:MessageFlow")||C(e,"bpmn:DataInput")||C(e,"bpmn:DataOutput"))return{target:e,key:"name"}}}function Zs(e){var t;return(((t=e==null?void 0:e.extensionElements)==null?void 0:t.values)??[]).filter(n=>{var i;return(i=n==null?void 0:n.$instanceOf)==null?void 0:i.call(n,Pa)})}function ni(e){return e.get("xml:lang")}function ka(e){var t;return(((t=e==null?void 0:e.extensionElements)==null?void 0:t.values)??[]).filter(n=>{var i;return(i=n==null?void 0:n.$instanceOf)==null?void 0:i.call(n,Gu)})}const Qs="bwl.updateTranslation";class Yu{constructor(t){this.moddle=t}execute(t){const{element:n,text:i,designLocale:r,locales:o,rootLang:a,nameChangedFrom:s}=t,c=n.businessObject,l=Ta(c),u=[];t.undo=u;const p=Zs(c).filter(I=>ni(I)),f=s??(l?l.target[l.key]??"":""),d=a??r,m=(I=>{if(!I)return[];const P=p.filter(O=>O.body===I).map(ni);return P.length?P:[d]})(f),v=s!==void 0&&f&&!m.includes(t.locale)?m[0]:t.locale,w=I=>{var P;return((P=p.find(O=>ni(O)===I&&O.body))==null?void 0:P.body)??(m.includes(I)?f:"")},x=I=>ka(c).some(P=>P.locale===I),g=w(v);if(g===i)return[];const y=!!g&&!x(v),S=y?o.filter(I=>I!==v&&w(I)&&!x(I)):[],E=()=>{let I=c.extensionElements;return I||(I=this.moddle.create("bpmn:ExtensionElements",{values:[]}),I.$parent=c,c.extensionElements=I,u.push(()=>delete c.extensionElements)),I.get("values")},T=(I,P)=>{const O=E();let F=O.find(Z=>{var he;return((he=Z.$instanceOf)==null?void 0:he.call(Z,Pa))&&ni(Z)===I});if(F){const Z=F.body;F.body=P,u.push(()=>F.body=Z)}else F=this.moddle.create(Pa,{body:P}),F.set("xml:lang",I),F.$parent=c.extensionElements,O.push(F),u.push(()=>O.splice(O.indexOf(F),1))},k=I=>{const P=E(),O=P.indexOf(I);P.splice(O,1),u.push(()=>P.splice(O,0,I))};if(s===void 0){if(v===r&&l){if(f&&!p.some(P=>P.body===f)){const P=a&&a!==r?a:void 0;P&&T(P,f)}const I=Object.prototype.hasOwnProperty.call(l.target,l.key);l.target[l.key]=i,u.push(()=>{I?l.target[l.key]=f:delete l.target[l.key]})}T(v,i)}else(p.some(I=>ni(I)===v)||!f&&v!==d)&&T(v,i);if(!y)for(const I of ka(c).filter(P=>P.locale===v))k(I);for(const I of S){const P=E(),O=this.moddle.create(Gu,{locale:I,sourceLocale:v,previous:g});O.$parent=c.extensionElements,P.push(O),u.push(()=>P.splice(P.indexOf(O),1))}for(const I of ka(c).filter(P=>P.sourceLocale===v&&(P.previous??"")===i))k(I);return u.length?[n,n.label].filter(Boolean):[]}revert(t){for(const n of[...t.undo].reverse())n();return t.undo.length?[t.element,t.element.label].filter(Boolean):[]}}ki(Yu,"$inject",["moddle"]);const Gh=["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"],VE={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},WE={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},UE={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},qE={type:"string",enum:[...qs],description:"이벤트 정의. **type 이 intermediateCatchEvent 일 때만 쓰고, 그때는 반드시 준다**(다른 타입에 주거나 빠뜨리면 거부). timer = 시한 대기(「30분 경과」·「확정 기간 경과」처럼 시간이 지나야 다음으로 가는 자리). 시한 값은 name 에 쓴다 — 표현식 필드는 없다."},YE={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다. ⚠ type 집합은 **읽을 수 있는 것보다 좁다** — describe 는 subProcess·boundaryEvent 도 노드로 내지만 그 둘을 새로 만드는 배치는 미실증이라 여기서 받지 않는다(B-87 ⓐ). intermediateCatchEvent 는 eventDefinition 과 짝으로만 받는다.",properties:{id:{type:"string"},type:{type:"string",enum:[...Us]},eventDefinition:{$ref:"#/$defs/eventDefinition"},name:{type:"string"},participant:{type:"string",description:"소속 풀 id(협업 문서)."},lane:{type:"string",description:"소속 레인 id(풀 정의에 선언된 것)."}},required:["id","type"],additionalProperties:!1},KE={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},XE={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},ZE={type:"object",description:"메시지 플로우(풀 경계를 넘는 연결 — 노드 또는 블랙박스 풀 자체가 끝점).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"}},required:["id","source","target"],additionalProperties:!1},QE={type:"object",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},JE={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},e1={type:"object",properties:{id:{type:"string"},text:{type:"string"}},required:["id","text"],additionalProperties:!1},t1={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},n1={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},i1={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...zu]},offset:{type:"number",description:"앵커 가장자리 → 주석 가장자리 간격(px). 생략 시 50."}},required:["anchor","side"],additionalProperties:!1};function Pn(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const r1={"participant.add":Pn("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트 — **작을수록 위**(생략 시 op 순서가 곧 배치 순서). 값은 상대 순서만 쓰므로 1,2,3… 연속이든 10,20,30 간격이든 같다.",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":Pn("participant.update",{description:"풀 이름/레인 갱신. lanes 는 전체 재선언(생략 = 보존) — 기존 레인을 유지하려면 함께 다시 나열한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"]}),"node.add":Pn("node.add",{description:'플로우 노드 추가. band = 가로 밴드 순번 힌트(주 흐름 0, 갈래 1, 2…) — 위/아래가 아니라 "주 흐름에서 몇 번째 갈래"다. 행 배치(어느 갈래가 위/아래인지)는 호스트가 정한다(대칭·메시지 방향). 레인이 있으면 그 레인 안의 밴드다 — 한 레인 안에서 게이트웨이 출구를 갈라 놓을 때 쓴다. 컨테이너(풀·레인)는 밴드 수만큼 자란다.',properties:{node:{$ref:"#/$defs/irNode"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."},afterColumn:{type:"string",description:"열 지목 힌트 — 그 노드보다 **뒤(오른쪽) 열**에 둔다. 좌표가 아니라 관계다(실제 x 는 호스트가 산출하고 정렬·압축은 그 뒤에도 적용된다). 🔴 **쓸 자리는 하나다 — 시퀀스 유입이 없는 수신 노드**(메시지만 받는 노드). 그런 노드는 열을 정할 근거가 도구에 없어 풀 좌단에 남고, 시간축(x)상 뒤쪽인 프로세스가 앞쪽에 놓여 선이 먼 거리를 돌아온다. 시퀀스로 이어지는 노드에는 쓰지 마라 — 열은 상류가 이미 정한다. 참조가 해소되지 않으면 힌트가 없는 것과 같이 동작한다."}},required:["node"]}),"node.update":Pn("node.update",{description:"노드 이름/레인/타입/밴드 갱신. lane = 레인 재배정(이동), type = 태스크·이벤트 타입 전환, band = 행 재지정. 🔴 **기존 문서에서 band 는 「몇 번째 갈래」가 아니라 그 컨테이너의 행 번호**다(describe 의 hints.bands 가 보여 주는 값) — 신규 배치의 band 가 대칭으로 펴지는 것과 다르다. 간선이 도형을 가로지르거나 반대 방향으로 겹칠 때 그 노드를 다른 행으로 옮기는 채널이다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lane:{type:"string"},type:{type:"string",enum:[...Us]},eventDefinition:{$ref:"#/$defs/eventDefinition"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["id"]}),"sequenceFlow.add":Pn("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":Pn("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":Pn("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":Pn("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataStore.add":Pn("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":Pn("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataAssociation.add":Pn("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":Pn("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":Pn("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":Pn("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":Pn("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":Pn("group.update",{description:"그룹 이름/멤버 갱신. members 는 전체 재선언(생략 = 보존).",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},members:{type:"array",items:{type:"string"}}},required:["id"]}),"element.remove":Pn("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},Vh={anyOf:Gh.map(e=>r1[e])},o1={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:WE,irParticipant:UE,irNode:YE,irFlowCondition:KE,irSequenceFlow:XE,irMessageFlow:ZE,irDataStore:QE,irDataAssociation:JE,irTextAnnotation:e1,irAssociation:t1,irGroup:n1,bwlPlacement:i1,eventDefinition:qE,nullableString:VE,symbolicOp:Vh}};function Ku(){}Ku.prototype.get=function(e){return this.$model.properties.get(this,e)},Ku.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function Wh(e,t){this.model=e,this.properties=t}Wh.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(Ku.prototype);H(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}),H(a,Fn(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 a1=W(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),Uh=W(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 Xu(e,t){var n=Uh[e];return n?n(t):t}function Zu(e){return!!a1[e]}function qh(e){return!!Uh[e]}function Tn(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 ii(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}ii.prototype.build=function(){return Ci(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},ii.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)},ii.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},ii.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=Tn(r[0],i),a=Tn(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},ii.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},ii.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},ii.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},ii.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},ii.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},ii.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")},ii.prototype.hasProperty=function(e){return this.propertiesByName[e]},ii.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,r=e.name;r in n||(H(e.properties,Fn(function(o){o=W({},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 vr(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,H(e,Fn(this.registerPackage,this))}vr.prototype.getPackage=function(e){return this.packageMap[e]},vr.prototype.getPackages=function(){return this.packages},vr.prototype.registerPackage=function(e){e=W({},e);var t=this.packageMap;Yh(t,e,"prefix"),Yh(t,e,"uri"),H(e.types,Fn(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},vr.prototype.registerType=function(e,t){e=W({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:W({},e.meta||{})});var n=Tn(e.name,t.prefix),i=n.name,r=Object.create(null);H(e.properties,Fn(function(o){var a=Tn(o.name,n.prefix),s=a.name;Zu(o.type)||(o.type=Tn(o.type,a.prefix).name),W(o,{ns:a,name:s}),r[s]=o},this)),W(e,{ns:n,name:i,propertiesByName:r}),H(e.extends,Fn(function(o){var a=Tn(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},vr.prototype.mapTypes=function(e,t,n){var i=Zu(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(c,l){var u=Tn(c,Zu(c)?"":e.prefix);r.mapTypes(u,t,l)}function a(c){return o(c,!0)}function s(c){return o(c,!1)}if(!i)throw new Error("unknown type <"+e.name+">");H(i.superClass,n?a:s),t(i,!n),H(i.traits,a)},vr.prototype.getEffectiveDescriptor=function(e){var t=Tn(e),n=new ii(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},vr.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function Yh(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function eo(e){this.model=e}eo.prototype.set=function(e,t,n){if(!Gn(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),r=i&&i.name;s1(n)?i?delete e[r]:delete e.$attrs[Qu(t)]:i?r in e?e[r]=n:Kh(e,i,n):e.$attrs[Qu(t)]=n},eo.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[Qu(t)];var i=n.name;return!e[i]&&n.isMany&&Kh(e,n,[]),e[i]},eo.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=W({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},eo.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},eo.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},eo.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 s1(e){return typeof e>"u"}function Kh(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function Qu(e){return e.replace(/^:/,"")}function ui(e,t={}){this.properties=new eo(this),this.factory=new Wh(this,this.properties),this.registry=new vr(e,this.properties),this.typeCache=Object.create(null),this.config=t}ui.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},ui.prototype.getType=function(e){var t=this.typeCache,n=Gn(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},ui.prototype.createAny=function(e,t,n){var i=Tn(e),r={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){zE(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}),H(n,function(a,s){dn(a)&&a.value!==void 0?r[a.name]=a.value:r[s]=a}),r},ui.prototype.getPackage=function(e){return this.registry.getPackage(e)},ui.prototype.getPackages=function(){return this.registry.getPackages()},ui.prototype.getElementDescriptor=function(e){return e.$descriptor},ui.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},ui.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},ui.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var Xh=String.fromCharCode,c1=Object.prototype.hasOwnProperty,l1=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,Oa={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(Oa).forEach(function(e){Oa[e.toUpperCase()]=Oa[e]});function u1(e,t,n,i){return i?c1.call(Oa,i)?Oa[i]:"&"+i+";":Xh(t||parseInt(n,16))}function to(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(l1,u1):e}var Zh="non-whitespace outside of root node";function br(e){return new Error(e)}function p1(e){return"missing namespace for prefix <"+e+">"}function Js(e){return{get:e,enumerable:!0}}function f1(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var Qh=Symbol("nameCache");function Ju(e){return e+"$uri"}function d1(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[Ju(i)]=n;return t}function ec(){return{line:0,column:0}}function h1(e){throw e}function Jh(e){if(!this)return new Jh(e);var t=e&&e.proxy,n,i,r,o,a=h1,s,c,l,u,p=ec,f=!1,d=!1,h="",m=!1,v=!1,w=null,x=!1,g,y,S,E;function T(O){O instanceof Error||(O=br(O)),w=O,a(O,p)}function k(O){s&&(O instanceof Error||(O=br(O)),s(O,p))}this.on=function(O,F){if(typeof F!="function")throw br("required args <name, cb>");switch(O){case"openTag":i=F;break;case"text":n=F;break;case"closeTag":r=F;break;case"error":a=F;break;case"warn":s=F;break;case"cdata":o=F;break;case"attention":u=F;break;case"question":l=F;break;case"comment":c=F;break;default:throw br("unsupported event: "+O)}return this},this.ns=function(O){if(typeof O>"u"&&(O={}),typeof O!="object")throw br("required args <nsMap={}>");var F=Object.create(null),Z;for(Z in O)F[Z]=O[Z];return v=!0,E=F,this};function I(){g=v?[]:null,y=v?d1(E):null,S=[],p=ec,x=!1,w=null,d=!1,h=""}this.parse=function(O){if(typeof O!="string")throw br("required args <xml=string>");if(f)throw br("parse during stream; call end() first");return I(),P(O),p=ec,x=!1,w},this.write=function(O){if(typeof O!="string")throw br("required args <xml=string>");return f||(I(),f=!0),w||(h=P(h+O,!0)||""),this},this.end=function(){return f||I(),f=!1,w||P(h),h="",p=ec,x=!1,w},this.stop=function(){x=!0};function P(O,F=!1){var Z=null,he=null,Me,Be=0,nt=!1,J=!1,te=0,pe=0,xe,K,V,ie,Te,ke,N,R,_,G="",q=0,ee;function Re(_t,pn){var bn=_t.indexOf(":");if(bn===-1)return _t;var xn=y[_t.substring(0,bn)];return xn?pn===xn?_t.substr(bn+1):xn+_t.substr(bn):(k(p1(_t.substring(0,bn))),null)}function Ze(){if(ee!==null)return ee;var _t,pn,bn=v&&y.xmlns,xn=v&&m?[]:null,wt=q,fn=G,yn=fn.length,wo,ei,Ei,Si,Yt,Ri={},Sa=new Set,ti,st,bt;e:for(;wt<yn;wt++)if(ti=!1,st=fn.charCodeAt(wt),!(st===32||st<14&&st>8)){for((st<65||st>122||st>90&&st<97)&&st!==95&&st!==58&&(k("illegal first char attribute name"),ti=!0),bt=wt+1;bt<yn;bt++)if(st=fn.charCodeAt(bt),!(st>96&&st<123||st>64&&st<91||st>47&&st<59||st===46||st===45||st===95)){if(st===32||st<14&&st>8){k("missing attribute value"),wt=bt;continue e}if(st===61)break;k("illegal attribute name char"),ti=!0}if(Yt=fn.substring(wt,bt),Yt==="xmlns:xmlns"&&(k("illegal declaration of xmlns"),ti=!0),st=fn.charCodeAt(bt+1),st===34)bt=fn.indexOf('"',wt=bt+2),bt===-1&&(bt=fn.indexOf("'",wt),bt!==-1&&(k("attribute value quote missmatch"),ti=!0));else if(st===39)bt=fn.indexOf("'",wt=bt+2),bt===-1&&(bt=fn.indexOf('"',wt),bt!==-1&&(k("attribute value quote missmatch"),ti=!0));else for(k("missing attribute value quotes"),ti=!0,bt=bt+1;bt<yn&&(st=fn.charCodeAt(bt+1),!(st===32||st<14&&st>8));bt++);for(bt===-1&&(k("missing closing quotes"),bt=yn,ti=!0),ti||(Ei=fn.substring(wt,bt)),wt=bt;bt+1<yn&&(st=fn.charCodeAt(bt+1),!(st===32||st<14&&st>8));bt++)wt===bt&&(k("illegal character after attribute end"),ti=!0);if(wt=bt+1,ti)continue e;if(Sa.has(Yt)){k("attribute <"+Yt+"> already defined");continue}if(Sa.add(Yt),!v){Ri[Yt]=Ei;continue}if(m){if(ei=Yt==="xmlns"?"xmlns":Yt.charCodeAt(0)===120&&Yt.substr(0,6)==="xmlns:"?Yt.substr(6):null,ei!==null){if(_t=to(Ei),pn=Ju(ei),Si=E[_t],!Si){if(ei==="xmlns"||pn in y&&y[pn]!==_t)do Si="ns"+Be++;while(typeof y[Si]<"u");else Si=ei;E[_t]=Si}y[ei]!==Si&&(wo||(y=f1(y),wo=!0),y[ei]=Si,ei==="xmlns"&&(y[Ju(Si)]=_t,bn=Si),y[pn]=_t),Ri[Yt]=Ei;continue}xn.push(Yt,Ei);continue}Yt=Re(Yt,bn),Yt!==null&&(Ri[Yt]=Ei)}if(m)for(wt=0,yn=xn.length;wt<yn;wt++)Yt=Re(xn[wt++],bn),Ei=xn[wt],Yt!==null&&(Ri[Yt]=Ei);return ee=Ri}function ht(){for(var _t=/(\r\n|\r|\n)/g,pn=0,bn=0,xn=0,wt=pe,fn,yn;te>=xn&&(fn=_t.exec(O),!(!fn||(wt=fn[0].length+fn.index,wt>te)));)pn+=1,xn=wt;return te==-1?(bn=wt,yn=O.substring(pe)):pe===0?yn=O.substring(pe,te):(bn=te-xn,yn=pe==-1?O.substring(te):O.substring(te,pe+1)),{data:yn,line:pn,column:bn}}for(p=ht,t&&(_=Object.create({},{name:Js(function(){return N}),originalName:Js(function(){return R}),attrs:Js(Ze),ns:Js(function(){return y})}));pe!==-1;){if(O.charCodeAt(pe)===60?te=pe:te=O.indexOf("<",pe),te===-1){if(F)return O.substring(pe);if(S.length)return T("unexpected end of file");if(!d)return T("missing start tag");pe<O.length&&O.substring(pe).trim()&&k(Zh);return}if(d||(d=!0),pe!==te){if(S.length){if(n&&(n(O.substring(pe,te),to,p),x))return}else if(O.substring(pe,te).trim()&&(k(Zh),x))return}if(ie=O.charCodeAt(te+1),ie===33){if(V=O.charCodeAt(te+2),V===91&&O.substr(te+3,6)==="CDATA["){if(pe=O.indexOf("]]>",te),pe===-1)return F?O.substring(te):T("unclosed cdata");if(o&&(o(O.substring(te+9,pe),p),x))return;pe+=3;continue}if(V===45&&O.charCodeAt(te+3)===45){if(pe=O.indexOf("-->",te),pe===-1)return F?O.substring(te):T("unclosed comment");if(c&&(c(O.substring(te+4,pe),to,p),x))return;pe+=3;continue}}if(ie===63){if(pe=O.indexOf("?>",te),pe===-1)return F?O.substring(te):T("unclosed question");if(l&&(l(O.substring(te,pe+2),p),x))return;pe+=2;continue}for(xe=te+1;;xe++){if(Te=O.charCodeAt(xe),isNaN(Te))return F?O.substring(te):(pe=-1,T("unclosed tag"));if(Te===34)V=O.indexOf('"',xe+1),xe=V!==-1?V:xe;else if(Te===39)V=O.indexOf("'",xe+1),xe=V!==-1?V:xe;else if(Te===62){pe=xe;break}}if(ie===33){if(u&&(u(O.substring(te,pe+1),to,p),x))return;pe+=1;continue}if(ee={},ie===47){if(nt=!1,J=!0,!S.length)return T("missing open tag");if(xe=N=S.pop(),V=te+2+xe.length,O.substring(te+2,V)!==xe)return T("closing tag mismatch");for(;V<pe;V++)if(ie=O.charCodeAt(V),!(ie===32||ie>8&&ie<14))return T("close tag")}else{if(O.charCodeAt(pe-1)===47?(xe=N=O.substring(te+1,pe-1),nt=!0,J=!0):(xe=N=O.substring(te+1,pe),nt=!0,J=!1),!(ie>96&&ie<123||ie>64&&ie<91||ie===95||ie===58))return T("illegal first char nodeName");for(V=1,K=xe.length;V<K;V++)if(ie=xe.charCodeAt(V),!(ie>96&&ie<123||ie>64&&ie<91||ie>47&&ie<59||ie===45||ie===95||ie==46)){if(ie===32||ie<14&&ie>8){N=xe.substring(0,V),ee=null;break}return T("invalid nodeName")}J||S.push(N)}if(v){Me=y,nt&&(J||g.push(Me),ee===null&&(m=xe.indexOf("xmlns",V)!==-1)&&(q=V,G=xe,Ze(),m=!1)),R=N,he!==y&&(Z=y[Qh],Z===void 0&&(Z=y[Qh]=Object.create(null)),he=y);var Gt=Z[N];if(Gt!==void 0)N=Gt;else{if(ie=N.indexOf(":"),ie!==-1){if(ke=y[N.substring(0,ie)],!ke)return T("missing namespace on <"+R+">");N=N.substr(ie+1)}else ke=y.xmlns;ke&&(N=ke+":"+N),Z[R]=N}}if(nt&&(q=V,G=xe,i&&(t?i(_,to,J,p):i(N,Ze,to,J,p),x)))return;if(J){if(r&&(r(t?_:N,to,nt,p),x))return;v&&(nt?y=Me:y=g.pop())}pe+=1}}}function em(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var ep={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},tm="property";function nm(e){return e.xml&&e.xml.serialize}function m1(e){const t=nm(e);return t!==tm&&(t||null)}function g1(e){return e.charAt(0).toUpperCase()+e.slice(1)}function im(e,t){return em(t)?e.prefix+":"+g1(e.localName):e.name}function y1(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 v1(e,t,n){const i=Tn(e,t.xmlns),r=`${t[i.prefix]||i.prefix}:${i.localName}`,o=Tn(r);var a=n.getPackage(o.prefix);return y1(o,a)}function xr(e){return new Error(e)}function Zi(e){return e.$descriptor}function b1(e){W(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw xr("expected element");var n=this.elementsById,i=Zi(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 xr("duplicate ID <"+o+">");n[o]=t}},this.addWarning=function(t){this.warnings.push(t)}}function Da(){}Da.prototype.handleEnd=function(){},Da.prototype.handleText=function(){},Da.prototype.handleNode=function(){};function tp(){}tp.prototype=Object.create(Da.prototype),tp.prototype.handleNode=function(){return this};function Do(){}Do.prototype=Object.create(Da.prototype),Do.prototype.handleText=function(e){this.body=(this.body||"")+e};function La(e,t){this.property=e,this.context=t}La.prototype=Object.create(Do.prototype),La.prototype.handleNode=function(e){if(this.element)throw xr("expected no sub nodes");return this.element=this.createReference(e),this},La.prototype.handleEnd=function(){this.element.id=this.body},La.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function np(e,t){this.element=t,this.propertyDesc=e}np.prototype=Object.create(Do.prototype),np.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=Xu(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function tc(){}tc.prototype=Object.create(Do.prototype),tc.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(tc.prototype),Ln.prototype.addReference=function(e){this.context.addReference(e)},Ln.prototype.handleText=function(e){var t=this.element,n=Zi(t),i=n.bodyProperty;if(!i)throw xr("unexpected body text <"+e+">");Do.prototype.handleText.call(this,e)},Ln.prototype.handleEnd=function(){var e=this.body,t=this.element,n=Zi(t),i=n.bodyProperty;i&&e!==void 0&&(e=Xu(i.type,e),t.set(i.name,e))},Ln.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=Zi(n),r=this.context,o=new n({}),a=this.model,s;return H(t,function(c,l){var u=i.propertiesByName[l],p;u&&u.isReference?u.isMany?(p=c.split(" "),H(p,function(f){r.addReference({element:o,property:u.ns.name,id:f})})):r.addReference({element:o,property:u.ns.name,id:c}):(u?c=Xu(u.type,c):l==="xmlns"?l=":"+l:(s=Tn(l,i.ns.prefix),a.getPackage(s.prefix)&&r.addWarning({message:"unknown attribute <"+l+">",element:o,property:l,value:c})),o.set(l,c))}),o},Ln.prototype.getPropertyForNode=function(e){var t=e.name,n=Tn(t),i=this.type,r=this.model,o=Zi(i),a=n.name,s=o.propertiesByName[a];if(s&&!s.isAttr){const l=m1(s);if(l){const u=e.attributes[l];if(u){const p=v1(u,e.ns,r),f=r.getType(p);return W({},s,{effectiveType:Zi(f).name})}}return s}var c=r.getPackage(n.prefix);if(c){const l=im(n,c),u=r.getType(l);if(s=Tt(o.properties,function(p){return!p.isVirtual&&!p.isReference&&!p.isAttribute&&u.hasType(p.type)}),s)return W({},s,{effectiveType:Zi(u).name})}else if(s=Tt(o.properties,function(l){return!l.isReference&&!l.isAttribute&&l.type==="Element"}),s)return s;throw xr("unrecognized element <"+n.name+">")},Ln.prototype.toString=function(){return"ElementDescriptor["+Zi(this.type).name+"]"},Ln.prototype.valueHandler=function(e,t){return new np(e,t)},Ln.prototype.referenceHandler=function(e){return new La(e,this.context)},Ln.prototype.handler=function(e){return e==="Element"?new Lo(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,qh(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?(W(o,{element:i}),this.context.addReference(o)):o.$parent=i),r};function ip(e,t,n){Ln.call(this,e,t,n)}ip.prototype=Object.create(Ln.prototype),ip.prototype.createElement=function(e){var t=e.name,n=Tn(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&im(n,o)||t;if(!r.hasType(a))throw xr("unexpected element <"+e.originalName+">");return Ln.prototype.createElement.call(this,e)};function Lo(e,t,n){this.model=e,this.context=n}Lo.prototype=Object.create(tc.prototype),Lo.prototype.createElement=function(e){var t=e.name,n=Tn(t),i=n.prefix,r=e.ns[i+"$uri"],o=e.attributes;return this.model.createAny(t,r,o)},Lo.prototype.handleChild=function(e){var t=new Lo(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},Lo.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function rp(e){e instanceof ui&&(e={model:e}),W(this,{lax:!1},e)}rp.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 b1(W({},t,{rootHandler:i})),s=new Jh({proxy:!0}),c=x1();i.context=a,c.push(i);function l(S,E,T){var k=E(),I=k.line,P=k.column,O=k.data;O.charAt(0)==="<"&&O.indexOf(" ")!==-1&&(O=O.slice(0,O.indexOf(" "))+">");var F="unparsable content "+(O?O+" ":"")+`detected
1
+ (function(Z,de){typeof exports=="object"&&typeof module<"u"?de(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],de):(Z=typeof globalThis<"u"?globalThis:Z||self,de(Z.BpmnModeler={},Z.Vue))})(this,(function(Z,de){"use strict";var n$=Object.defineProperty;var i$=(Z,de,Jr)=>de in Z?n$(Z,de,{enumerable:!0,configurable:!0,writable:!0,value:Jr}):Z[de]=Jr;var ui=(Z,de,Jr)=>i$(Z,typeof de!="symbol"?de+"":de,Jr);const Jr=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","subProcess","boundaryEvent","intermediateCatchEvent"],Xs=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","intermediateCatchEvent"];function Vh(e){return Jr.includes(e)}function Wh(e){return Xs.includes(e)}const Zs=["timer"],Qs={timer:"bpmn:TimerEventDefinition"};function Uh(e){return typeof e=="string"&&Zs.includes(e)}function Wu(e){if(e.length===1)return Zs.find(t=>Qs[t]===e[0])}const Js=["ko","en","ja","zh"];function UE(e){return typeof e=="string"&&Js.includes(e)}const qh="http://g1project.net/spec/bpmn/bwl/1.0",Uu="bwl",qu=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],ec="bwl:ReviewRequest",Yh={name:"bwl-hints",uri:qh,prefix:Uu,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:"AfterColumnHint",extends:["bpmn:FlowNode"],properties:[{name:"afterColumn",isAttr:!0,type:"String"}]},{name:"PoolOrderHint",extends:["bpmn:Participant"],properties:[{name:"poolOrder",isAttr:!0,type:"Integer"}]},{name:"ReviewRequest",superClass:["Element"],properties:[{name:"locale",isAttr:!0,type:"String"},{name:"sourceLocale",isAttr:!0,type:"String"},{name:"previous",isBody:!0,type:"String"}]}]},Yu="bwl.undoEpisode",Kh=new WeakSet;function qE(e){Kh.has(e)||(e.register(Yu,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),Kh.add(e))}function Xh(e,t){qE(e);const n={run:t};if(e.execute(Yu,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}function Ku(e){return Array.prototype.concat.apply([],e)}const Da=Object.prototype.toString,YE=Object.prototype.hasOwnProperty;function eo(e){return e===void 0}function an(e){return e!==void 0}function Oo(e){return e==null}function $e(e){return Da.call(e)==="[object Array]"}function dn(e){return Da.call(e)==="[object Object]"}function ze(e){return Da.call(e)==="[object Number]"}function hn(e){const t=Da.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function Vn(e){return Da.call(e)==="[object String]"}function KE(e){if(!$e(e))throw new Error("must supply array")}function Wn(e,t){return!Oo(e)&&YE.call(e,t)}function Tt(e,t){const n=nc(t);let i;return H(e,function(r,o){if(n(r,o))return i=r,!1}),i}function Zh(e,t){const n=nc(t);let i=$e(e)?-1:void 0;return H(e,function(r,o){if(n(r,o))return i=o,!1}),i}function tt(e,t){const n=nc(t);let i=[];return H(e,function(r,o){n(r,o)&&i.push(r)}),i}function H(e,t){let n,i;if(eo(e))return;const r=$e(e)?e1:JE;for(let o in e)if(Wn(e,o)&&(n=e[o],i=t(n,r(o)),i===!1))return n}function XE(e,t){if(eo(e))return[];KE(e);const n=nc(t);return e.filter(function(i,r){return!n(i,r)})}function Un(e,t,n){return H(e,function(i,r){n=t(n,i,r)}),n}function to(e,t){return!!Un(e,function(n,i,r){return n&&t(i,r)},!0)}function vr(e,t){return!!Tt(e,t)}function Pn(e,t){let n=[];return H(e,function(i,r){n.push(t(i,r))}),n}function tc(e){return e&&Object.keys(e)||[]}function ZE(e){return tc(e).length}function Do(e){return Pn(e,t=>t)}function Lo(e,t,n={}){return t=Xu(t),H(e,function(i){let r=t(i)||"_",o=n[r];o||(o=n[r]=[]),o.push(i)}),n}function Qh(e,...t){e=Xu(e);let n={};return H(t,r=>Lo(r,e,n)),Pn(n,function(r,o){return r[0]})}const QE=Qh;function Di(e,t){t=Xu(t);let n=[];return H(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)}),Pn(n,i=>i.v)}function Io(e){return function(t){return to(e,function(n,i){return t[i]===n})}}function Xu(e){return hn(e)?e:t=>t[e]}function nc(e){return hn(e)?e:t=>t===e}function JE(e){return e}function e1(e){return Number(e)}function Zu(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 l(){n&&a(!0),c()}function u(...p){o=Date.now(),i=p,r=this,n||s(t)}return u.flush=l,u.cancel=c,u}function jn(e,t){return e.bind(t)}function W(e,...t){return Object.assign(e,...t)}function t1(e,t,n){let i=e;return H(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];an(a)&&Oo(s)&&(s=i[r]=isNaN(+a)?{}:[]),eo(a)?eo(n)?delete i[r]:i[r]=n:i=s}),e}function Mi(e,t){let n={},i=Object(e);return H(t,function(r){r in i&&(n[r]=e[r])}),n}function Li(e,t){let n={},i=Object(e);return H(i,function(r,o){t.indexOf(o)===-1&&(n[o]=r)}),n}function C(e,t){var n=ue(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function et(e,t){return vr(t,function(n){return C(e,n)})}function ue(e){return e&&e.businessObject||e}function pt(e){return e&&e.di}const n1="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",Jh="i18n",Bo="i18n:Translation";function no(e){if(e){if(C(e,"bpmn:TextAnnotation"))return{target:e,key:"text"};if(C(e,"bpmn:Group"))return e.categoryValueRef?{target:e.categoryValueRef,key:"value"}:void 0;if(C(e,"bpmn:FlowElement")||C(e,"bpmn:Participant")||C(e,"bpmn:Lane")||C(e,"bpmn:MessageFlow")||C(e,"bpmn:DataInput")||C(e,"bpmn:DataOutput"))return{target:e,key:"name"}}}function No(e){var t;return(((t=e==null?void 0:e.extensionElements)==null?void 0:t.values)??[]).filter(n=>{var i;return(i=n==null?void 0:n.$instanceOf)==null?void 0:i.call(n,Bo)})}function Tn(e){return e.get("xml:lang")}function br(e){var t;return(((t=e==null?void 0:e.extensionElements)==null?void 0:t.values)??[]).filter(n=>{var i;return(i=n==null?void 0:n.$instanceOf)==null?void 0:i.call(n,ec)})}function La(e){const{designLocale:t,companionLocales:n}=e;return[t,...n.filter((i,r,o)=>i!==t&&o.indexOf(i)===r)]}function Qu(e){var n,i;const t=((n=e==null?void 0:e.get)==null?void 0:n.call(e,"xml:lang"))??((i=e==null?void 0:e.$attrs)==null?void 0:i["xml:lang"]);return typeof t=="string"&&t?t:void 0}function Ju(e,t,n){const i=no(e);if(!i)return{};const r=i.target[i.key]??"",o=No(e).filter(u=>Tn(u)),a=u=>u.body??"",s=r?o.filter(u=>a(u)===r).map(Tn):[],c=r?s.length?s:[n??t.designLocale]:[],l={};for(const u of La(t)){if(c.includes(u)){l[u]=r;continue}const p=o.find(f=>Tn(f)===u&&a(f));p&&(l[u]=a(p))}return l}const ic="bwl.updateTranslation";class ep{constructor(t){this.moddle=t}execute(t){const{element:n,text:i,designLocale:r,locales:o,rootLang:a,nameChangedFrom:s}=t,c=n.businessObject,l=no(c),u=[];t.undo=u;const p=No(c).filter(I=>Tn(I)),f=s??(l?l.target[l.key]??"":""),d=a??r,h=(I=>{if(!I)return[];const P=p.filter(O=>O.body===I).map(Tn);return P.length?P:[d]})(f),y=s!==void 0&&f&&!h.includes(t.locale)?h[0]:t.locale,R=I=>{var P;return((P=p.find(O=>Tn(O)===I&&O.body))==null?void 0:P.body)??(h.includes(I)?f:"")},x=I=>br(c).some(P=>P.locale===I),m=R(y);if(m===i)return[];const v=!!m&&!x(y),_=v?o.filter(I=>I!==y&&R(I)&&!x(I)):[],E=()=>{let I=c.extensionElements;return I||(I=this.moddle.create("bpmn:ExtensionElements",{values:[]}),I.$parent=c,c.extensionElements=I,u.push(()=>delete c.extensionElements)),I.get("values")},T=(I,P)=>{const O=E();let F=O.find(J=>{var he;return((he=J.$instanceOf)==null?void 0:he.call(J,Bo))&&Tn(J)===I});if(F){const J=F.body;F.body=P,u.push(()=>F.body=J)}else F=this.moddle.create(Bo,{body:P}),F.set("xml:lang",I),F.$parent=c.extensionElements,O.push(F),u.push(()=>O.splice(O.indexOf(F),1))},k=I=>{const P=E(),O=P.indexOf(I);P.splice(O,1),u.push(()=>P.splice(O,0,I))};if(s===void 0){if(y===r&&l){if(f&&!p.some(P=>P.body===f)){const P=a&&a!==r?a:void 0;P&&T(P,f)}const I=Object.prototype.hasOwnProperty.call(l.target,l.key);l.target[l.key]=i,u.push(()=>{I?l.target[l.key]=f:delete l.target[l.key]})}T(y,i)}else(p.some(I=>Tn(I)===y)||!f&&y!==d)&&T(y,i);if(!v)for(const I of br(c).filter(P=>P.locale===y))k(I);for(const I of _){const P=E(),O=this.moddle.create(ec,{locale:I,sourceLocale:y,previous:m});O.$parent=c.extensionElements,P.push(O),u.push(()=>P.splice(P.indexOf(O),1))}for(const I of br(c).filter(P=>P.sourceLocale===y&&(P.previous??"")===i))k(I);return u.length?[n,n.label].filter(Boolean):[]}revert(t){for(const n of[...t.undo].reverse())n();return t.undo.length?[t.element,t.element.label].filter(Boolean):[]}}ui(ep,"$inject",["moddle"]);const tp="bwl.setTranslations",i1=(e,t)=>e.locale===t.locale&&(e.sourceLocale??void 0)===t.sourceLocale&&(e.previous??"")===t.previous;class np{constructor(t){this.moddle=t}execute(t){const{element:n,texts:i,confirm:r=[],designLocale:o,locales:a,rootLang:s,before:c}=t,l=n.businessObject,u=[];if(t.undo=u,!no(l))return[];const p=()=>{let R=l.extensionElements;return R||(R=this.moddle.create("bpmn:ExtensionElements",{values:[]}),R.$parent=l,l.extensionElements=R,u.push(()=>delete l.extensionElements)),R.get("values")},f=R=>{const x=p(),m=x.indexOf(R);m<0||(x.splice(m,1),u.push(()=>x.splice(m,0,R)))},d=R=>No(l).find(x=>Tn(x)===R);if(i===null)for(const R of a){const x=d(R);x&&f(x)}else if(i)for(const R of a){const x=i[R];if(x===void 0)continue;const m=d(R);if(m){if(m.body===x)continue;const E=m.body;m.body=x,u.push(()=>m.body=E);continue}if(R===o&&(s??o)===o)continue;const v=p(),_=this.moddle.create(Bo,{body:x});_.set("xml:lang",R),_.$parent=l.extensionElements,v.push(_),u.push(()=>v.splice(v.indexOf(_),1))}const h=[...i===null?[]:c.requests.filter(R=>!r.includes(R.locale)&&!(i&&i[R.locale]!==void 0&&i[R.locale]!==c.texts[R.locale])&&!(i&&R.sourceLocale&&i[R.sourceLocale]===R.previous))];for(const R of br(l)){const x=h.findIndex(m=>i1(R,m));x>=0?h.splice(x,1):f(R)}for(const R of h){const x=p(),m=this.moddle.create(ec,{locale:R.locale,...R.sourceLocale?{sourceLocale:R.sourceLocale}:{},previous:R.previous});m.$parent=l.extensionElements,x.push(m),u.push(()=>x.splice(x.indexOf(m),1))}const y=l.extensionElements;return y&&!y.get("values").length&&(delete l.extensionElements,u.push(()=>l.extensionElements=y)),u.length?[n,n.label].filter(Boolean):[]}revert(t){for(const n of[...t.undo].reverse())n();return t.undo.length?[t.element,t.element.label].filter(Boolean):[]}}ui(np,"$inject",["moddle"]);function ip(e){return br(e).map(t=>({locale:t.locale,...t.sourceLocale?{sourceLocale:t.sourceLocale}:{},previous:t.previous??""}))}class rp{constructor(t){t.registerHandler(ic,ep),t.registerHandler(tp,np)}}ui(rp,"$inject",["commandStack"]);const op={__init__:["translationCommands"],translationCommands:["type",rp]},em=["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","translation.confirm","element.remove"],r1={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},o1={type:"object",description:"다국어 그룹의 문구 — 로케일 → 문구. **그 문서의 문서 언어(설계 + 병기 · describe 의 i18n) 전부**를 담는다(빠지거나 밖의 언어면 거부). 평문 name/text 와 함께 주면 거부. 문서 언어 설정이 없는 문서(describe 에 i18n 이 없다)는 이것 대신 평문을 쓴다.",properties:Object.fromEntries(Js.map(e=>[e,{type:"string"}])),additionalProperties:!1},a1={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},s1={type:"object",description:"풀(participant). 레인은 여기 선언하고 노드가 lane 인자로 배정된다 — 별도 레인 op 없음.",properties:{id:{type:"string",description:"문서 내 유일, XML NCName(공백 없이 문자/밑줄로 시작)."},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"},blackBox:{type:"boolean",description:"true = 내부 프로세스 없는 블랙박스 풀."},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"],additionalProperties:!1},c1={type:"string",enum:[...Zs],description:"이벤트 정의. **type 이 intermediateCatchEvent 일 때만 쓰고, 그때는 반드시 준다**(다른 타입에 주거나 빠뜨리면 거부). timer = 시한 대기(「30분 경과」·「확정 기간 경과」처럼 시간이 지나야 다음으로 가는 자리). 시한 값은 name 에 쓴다 — 표현식 필드는 없다."},l1={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다. ⚠ type 집합은 **읽을 수 있는 것보다 좁다** — describe 는 subProcess·boundaryEvent 도 노드로 내지만 그 둘을 새로 만드는 배치는 미실증이라 여기서 받지 않는다(B-87 ⓐ). intermediateCatchEvent 는 eventDefinition 과 짝으로만 받는다.",properties:{id:{type:"string"},type:{type:"string",enum:[...Xs]},eventDefinition:{$ref:"#/$defs/eventDefinition"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"},participant:{type:"string",description:"소속 풀 id(협업 문서)."},lane:{type:"string",description:"소속 레인 id(풀 정의에 선언된 것)."}},required:["id","type"],additionalProperties:!1},u1={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만. ⚠ 다국어 그룹(describe 에 i18n 이 있다)에서는 쓰지 않는다 — 조건 라벨도 그 플로우의 names 로 준다.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},p1={type:"object",description:"시퀀스 플로우(같은 풀 안 노드 간).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"},condition:{$ref:"#/$defs/irFlowCondition"}},required:["id","source","target"],additionalProperties:!1},f1={type:"object",description:"메시지 플로우(풀 경계를 넘는 연결 — 노드 또는 블랙박스 풀 자체가 끝점).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"}},required:["id","source","target"],additionalProperties:!1},d1={type:"object",properties:{id:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},h1={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},m1={type:"object",description:"텍스트 주석. 본문은 text(평문) 또는 texts(다국어 그룹) 중 하나를 반드시 준다.",properties:{id:{type:"string"},text:{type:"string"},texts:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},g1={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},y1={type:"object",description:"그룹 — members(요소 id 목록)가 bwl:members 힌트로 기록되고 바운즈는 멤버 bbox 로 산출된다.",properties:{id:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"},members:{type:"array",items:{type:"string"}}},required:["id"],additionalProperties:!1},v1={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...qu]},offset:{type:"number",description:"앵커 가장자리 → 주석 가장자리 간격(px). 생략 시 50."}},required:["anchor","side"],additionalProperties:!1};function _n(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const b1={"participant.add":_n("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트 — **작을수록 위**(생략 시 op 순서가 곧 배치 순서). 값은 상대 순서만 쓰므로 1,2,3… 연속이든 10,20,30 간격이든 같다.",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":_n("participant.update",{description:"풀 이름/레인 갱신. lanes 는 전체 재선언(생략 = 보존) — 기존 레인을 유지하려면 함께 다시 나열한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"]}),"node.add":_n("node.add",{description:'플로우 노드 추가. band = 가로 밴드 순번 힌트(주 흐름 0, 갈래 1, 2…) — 위/아래가 아니라 "주 흐름에서 몇 번째 갈래"다. 행 배치(어느 갈래가 위/아래인지)는 호스트가 정한다(대칭·메시지 방향). 레인이 있으면 그 레인 안의 밴드다 — 한 레인 안에서 게이트웨이 출구를 갈라 놓을 때 쓴다. 컨테이너(풀·레인)는 밴드 수만큼 자란다.',properties:{node:{$ref:"#/$defs/irNode"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."},afterColumn:{type:"string",description:"열 지목 힌트 — 그 노드보다 **뒤(오른쪽) 열**에 둔다. 좌표가 아니라 관계다(실제 x 는 호스트가 산출하고 정렬·압축은 그 뒤에도 적용된다). 🔴 **쓸 자리는 하나다 — 시퀀스 유입이 없는 수신 노드**(메시지만 받는 노드). 그런 노드는 열을 정할 근거가 도구에 없어 풀 좌단에 남고, 시간축(x)상 뒤쪽인 프로세스가 앞쪽에 놓여 선이 먼 거리를 돌아온다. 시퀀스로 이어지는 노드에는 쓰지 마라 — 열은 상류가 이미 정한다. 참조가 해소되지 않으면 힌트가 없는 것과 같이 동작한다."}},required:["node"]}),"node.update":_n("node.update",{description:"노드 이름/레인/타입/밴드 갱신. lane = 레인 재배정(이동), type = 태스크·이벤트 타입 전환, band = 행 재지정. 🔴 **기존 문서에서 band 는 「몇 번째 갈래」가 아니라 그 컨테이너의 행 번호**다(describe 의 hints.bands 가 보여 주는 값) — 신규 배치의 band 가 대칭으로 펴지는 것과 다르다. 간선이 도형을 가로지르거나 반대 방향으로 겹칠 때 그 노드를 다른 행으로 옮기는 채널이다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"},lane:{type:"string"},type:{type:"string",enum:[...Xs]},eventDefinition:{$ref:"#/$defs/eventDefinition"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["id"]}),"sequenceFlow.add":_n("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":_n("sequenceFlow.update",{description:"시퀀스 플로우 이름/조건/끝점 갱신. condition: null = 조건 제거. source/target = 끝점 재배선 — 중간 삽입은 기존 플로우를 지우지 말고 이것으로 한쪽 끝을 옮긴 뒤 새 플로우를 추가한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"},condition:{description:"생략 = 보존, null = 제거.",anyOf:[{$ref:"#/$defs/irFlowCondition"},{type:"null"}]},source:{description:"새 출발 노드 id(생략 = 보존). 같은 배치에서 추가한 노드도 지목할 수 있다.",type:"string"},target:{description:"새 도착 노드 id(생략 = 보존). 같은 배치에서 추가한 노드도 지목할 수 있다.",type:"string"}},required:["id"]}),"messageFlow.add":_n("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":_n("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"}},required:["id"]}),"dataStore.add":_n("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":_n("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"}},required:["id"]}),"dataAssociation.add":_n("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":_n("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":_n("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":_n("annotation.update",{description:"주석 본문/방위 힌트 갱신. placement: null = 힌트 제거(휴리스틱 복귀). 주석 삭제는 element.remove.",properties:{id:{type:"string"},text:{type:"string"},texts:{$ref:"#/$defs/localeTexts"},placement:{description:"생략 = 보존, null = 힌트 제거.",anyOf:[{$ref:"#/$defs/bwlPlacement"},{type:"null"}]}},required:["id"]}),"group.add":_n("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":_n("group.update",{description:"그룹 이름/멤버 갱신. members 는 전체 재선언(생략 = 보존).",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"},members:{type:"array",items:{type:"string"}}},required:["id"]}),"translation.confirm":_n("translation.confirm",{description:"확인만 — 그 요소의 locale 칸에 걸린 확인 요청(describe 의 i18n.reviewRequests)을 문구를 바꾸지 않고 해소한다. 다른 언어가 고쳐졌지만(sourceLocale · previous → 지금 문구) 이 칸의 번역이 여전히 맞을 때(오타 수준) 쓴다. 번역을 고쳐야 하면 이것 대신 그 요소의 update 에 names/texts(문서 언어 전부)를 준다 — 문구가 실제로 바뀐 칸의 표식만 해소된다. 다국어 그룹에서만 받고, 그 칸에 표식이 없으면 거부한다.",properties:{id:{type:"string",description:"확인 요청이 걸린 요소 id."},locale:{type:"string",enum:[...Js],description:"확인 요청을 받은 칸의 언어(reviewRequests 의 locale)."}},required:["id","locale"]}),"element.remove":_n("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},tm={anyOf:em.map(e=>b1[e])},x1={type:"object",description:"BPMN 문서에 요소를 추가·수정·삭제할 때 호출한다. 기존 요소는 describeProcess 가 노출하는 id 로 지정하고, 신규 요소 id 는 문서 내 유일한 XML NCName(공백 없이 문자/밑줄 시작)으로 짓는다. 좌표는 지정하지 않는다 — 배치는 서버가 결정하며, 필요하면 힌트(placement/band/order)로 의도만 전달하라. 문서에 문서 언어 설정이 있으면(describe 의 i18n) 문구는 평문 name/text 가 아니라 names/texts 로 문서 언어 전부를 준다.",properties:{ops:{type:"array",items:{$ref:"#/$defs/symbolicOp"}}},required:["ops"],additionalProperties:!1,$defs:{irLane:a1,irParticipant:s1,irNode:l1,irFlowCondition:u1,irSequenceFlow:p1,irMessageFlow:f1,irDataStore:d1,irDataAssociation:h1,irTextAnnotation:m1,irAssociation:g1,irGroup:y1,bwlPlacement:v1,eventDefinition:c1,localeTexts:o1,nullableString:r1,symbolicOp:tm}};function ap(){}ap.prototype.get=function(e){return this.$model.properties.get(this,e)},ap.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function nm(e,t){this.model=e,this.properties=t}nm.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(ap.prototype);H(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}),H(a,jn(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 _1=W(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),im=W(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 sp(e,t){var n=im[e];return n?n(t):t}function cp(e){return!!_1[e]}function rm(e){return!!im[e]}function kn(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 ii(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}ii.prototype.build=function(){return Mi(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},ii.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)},ii.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},ii.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=kn(r[0],i),a=kn(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},ii.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},ii.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},ii.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},ii.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},ii.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},ii.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")},ii.prototype.hasProperty=function(e){return this.propertiesByName[e]},ii.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,r=e.name;r in n||(H(e.properties,jn(function(o){o=W({},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 xr(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,H(e,jn(this.registerPackage,this))}xr.prototype.getPackage=function(e){return this.packageMap[e]},xr.prototype.getPackages=function(){return this.packages},xr.prototype.registerPackage=function(e){e=W({},e);var t=this.packageMap;om(t,e,"prefix"),om(t,e,"uri"),H(e.types,jn(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},xr.prototype.registerType=function(e,t){e=W({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:W({},e.meta||{})});var n=kn(e.name,t.prefix),i=n.name,r=Object.create(null);H(e.properties,jn(function(o){var a=kn(o.name,n.prefix),s=a.name;cp(o.type)||(o.type=kn(o.type,a.prefix).name),W(o,{ns:a,name:s}),r[s]=o},this)),W(e,{ns:n,name:i,propertiesByName:r}),H(e.extends,jn(function(o){var a=kn(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},xr.prototype.mapTypes=function(e,t,n){var i=cp(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(c,l){var u=kn(c,cp(c)?"":e.prefix);r.mapTypes(u,t,l)}function a(c){return o(c,!0)}function s(c){return o(c,!1)}if(!i)throw new Error("unknown type <"+e.name+">");H(i.superClass,n?a:s),t(i,!n),H(i.traits,a)},xr.prototype.getEffectiveDescriptor=function(e){var t=kn(e),n=new ii(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},xr.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function om(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function io(e){this.model=e}io.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;w1(n)?i?delete e[r]:delete e.$attrs[lp(t)]:i?r in e?e[r]=n:am(e,i,n):e.$attrs[lp(t)]=n},io.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[lp(t)];var i=n.name;return!e[i]&&n.isMany&&am(e,n,[]),e[i]},io.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=W({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},io.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},io.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},io.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 w1(e){return typeof e>"u"}function am(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function lp(e){return e.replace(/^:/,"")}function pi(e,t={}){this.properties=new io(this),this.factory=new nm(this,this.properties),this.registry=new xr(e,this.properties),this.typeCache=Object.create(null),this.config=t}pi.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},pi.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},pi.prototype.createAny=function(e,t,n){var i=kn(e),r={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){t1(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}),H(n,function(a,s){dn(a)&&a.value!==void 0?r[a.name]=a.value:r[s]=a}),r},pi.prototype.getPackage=function(e){return this.registry.getPackage(e)},pi.prototype.getPackages=function(){return this.registry.getPackages()},pi.prototype.getElementDescriptor=function(e){return e.$descriptor},pi.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},pi.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},pi.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var sm=String.fromCharCode,E1=Object.prototype.hasOwnProperty,S1=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,Ia={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(Ia).forEach(function(e){Ia[e.toUpperCase()]=Ia[e]});function R1(e,t,n,i){return i?E1.call(Ia,i)?Ia[i]:"&"+i+";":sm(t||parseInt(n,16))}function ro(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(S1,R1):e}var cm="non-whitespace outside of root node";function _r(e){return new Error(e)}function C1(e){return"missing namespace for prefix <"+e+">"}function rc(e){return{get:e,enumerable:!0}}function A1(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var lm=Symbol("nameCache");function up(e){return e+"$uri"}function M1(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[up(i)]=n;return t}function oc(){return{line:0,column:0}}function P1(e){throw e}function um(e){if(!this)return new um(e);var t=e&&e.proxy,n,i,r,o,a=P1,s,c,l,u,p=oc,f=!1,d=!1,g="",h=!1,y=!1,R=null,x=!1,m,v,_,E;function T(O){O instanceof Error||(O=_r(O)),R=O,a(O,p)}function k(O){s&&(O instanceof Error||(O=_r(O)),s(O,p))}this.on=function(O,F){if(typeof F!="function")throw _r("required args <name, cb>");switch(O){case"openTag":i=F;break;case"text":n=F;break;case"closeTag":r=F;break;case"error":a=F;break;case"warn":s=F;break;case"cdata":o=F;break;case"attention":u=F;break;case"question":l=F;break;case"comment":c=F;break;default:throw _r("unsupported event: "+O)}return this},this.ns=function(O){if(typeof O>"u"&&(O={}),typeof O!="object")throw _r("required args <nsMap={}>");var F=Object.create(null),J;for(J in O)F[J]=O[J];return y=!0,E=F,this};function I(){m=y?[]:null,v=y?M1(E):null,_=[],p=oc,x=!1,R=null,d=!1,g=""}this.parse=function(O){if(typeof O!="string")throw _r("required args <xml=string>");if(f)throw _r("parse during stream; call end() first");return I(),P(O),p=oc,x=!1,R},this.write=function(O){if(typeof O!="string")throw _r("required args <xml=string>");return f||(I(),f=!0),R||(g=P(g+O,!0)||""),this},this.end=function(){return f||I(),f=!1,R||P(g),g="",p=oc,x=!1,R},this.stop=function(){x=!0};function P(O,F=!1){var J=null,he=null,Pe,De=0,Ke=!1,rt=!1,Ce=0,X=0,te,U,K,ie,pe,Te,B,S,w,G="",V=0,ee;function Se(_t,pn){var bn=_t.indexOf(":");if(bn===-1)return _t;var xn=v[_t.substring(0,bn)];return xn?pn===xn?_t.substr(bn+1):xn+_t.substr(bn):(k(C1(_t.substring(0,bn))),null)}function Ze(){if(ee!==null)return ee;var _t,pn,bn=y&&v.xmlns,xn=y&&h?[]:null,wt=V,fn=G,yn=fn.length,Ro,ti,Ri,Ci,Yt,Ai={},Pa=new Set,ni,st,bt;e:for(;wt<yn;wt++)if(ni=!1,st=fn.charCodeAt(wt),!(st===32||st<14&&st>8)){for((st<65||st>122||st>90&&st<97)&&st!==95&&st!==58&&(k("illegal first char attribute name"),ni=!0),bt=wt+1;bt<yn;bt++)if(st=fn.charCodeAt(bt),!(st>96&&st<123||st>64&&st<91||st>47&&st<59||st===46||st===45||st===95)){if(st===32||st<14&&st>8){k("missing attribute value"),wt=bt;continue e}if(st===61)break;k("illegal attribute name char"),ni=!0}if(Yt=fn.substring(wt,bt),Yt==="xmlns:xmlns"&&(k("illegal declaration of xmlns"),ni=!0),st=fn.charCodeAt(bt+1),st===34)bt=fn.indexOf('"',wt=bt+2),bt===-1&&(bt=fn.indexOf("'",wt),bt!==-1&&(k("attribute value quote missmatch"),ni=!0));else if(st===39)bt=fn.indexOf("'",wt=bt+2),bt===-1&&(bt=fn.indexOf('"',wt),bt!==-1&&(k("attribute value quote missmatch"),ni=!0));else for(k("missing attribute value quotes"),ni=!0,bt=bt+1;bt<yn&&(st=fn.charCodeAt(bt+1),!(st===32||st<14&&st>8));bt++);for(bt===-1&&(k("missing closing quotes"),bt=yn,ni=!0),ni||(Ri=fn.substring(wt,bt)),wt=bt;bt+1<yn&&(st=fn.charCodeAt(bt+1),!(st===32||st<14&&st>8));bt++)wt===bt&&(k("illegal character after attribute end"),ni=!0);if(wt=bt+1,ni)continue e;if(Pa.has(Yt)){k("attribute <"+Yt+"> already defined");continue}if(Pa.add(Yt),!y){Ai[Yt]=Ri;continue}if(h){if(ti=Yt==="xmlns"?"xmlns":Yt.charCodeAt(0)===120&&Yt.substr(0,6)==="xmlns:"?Yt.substr(6):null,ti!==null){if(_t=ro(Ri),pn=up(ti),Ci=E[_t],!Ci){if(ti==="xmlns"||pn in v&&v[pn]!==_t)do Ci="ns"+De++;while(typeof v[Ci]<"u");else Ci=ti;E[_t]=Ci}v[ti]!==Ci&&(Ro||(v=A1(v),Ro=!0),v[ti]=Ci,ti==="xmlns"&&(v[up(Ci)]=_t,bn=Ci),v[pn]=_t),Ai[Yt]=Ri;continue}xn.push(Yt,Ri);continue}Yt=Se(Yt,bn),Yt!==null&&(Ai[Yt]=Ri)}if(h)for(wt=0,yn=xn.length;wt<yn;wt++)Yt=Se(xn[wt++],bn),Ri=xn[wt],Yt!==null&&(Ai[Yt]=Ri);return ee=Ai}function ht(){for(var _t=/(\r\n|\r|\n)/g,pn=0,bn=0,xn=0,wt=X,fn,yn;Ce>=xn&&(fn=_t.exec(O),!(!fn||(wt=fn[0].length+fn.index,wt>Ce)));)pn+=1,xn=wt;return Ce==-1?(bn=wt,yn=O.substring(X)):X===0?yn=O.substring(X,Ce):(bn=Ce-xn,yn=X==-1?O.substring(Ce):O.substring(Ce,X+1)),{data:yn,line:pn,column:bn}}for(p=ht,t&&(w=Object.create({},{name:rc(function(){return B}),originalName:rc(function(){return S}),attrs:rc(Ze),ns:rc(function(){return v})}));X!==-1;){if(O.charCodeAt(X)===60?Ce=X:Ce=O.indexOf("<",X),Ce===-1){if(F)return O.substring(X);if(_.length)return T("unexpected end of file");if(!d)return T("missing start tag");X<O.length&&O.substring(X).trim()&&k(cm);return}if(d||(d=!0),X!==Ce){if(_.length){if(n&&(n(O.substring(X,Ce),ro,p),x))return}else if(O.substring(X,Ce).trim()&&(k(cm),x))return}if(ie=O.charCodeAt(Ce+1),ie===33){if(K=O.charCodeAt(Ce+2),K===91&&O.substr(Ce+3,6)==="CDATA["){if(X=O.indexOf("]]>",Ce),X===-1)return F?O.substring(Ce):T("unclosed cdata");if(o&&(o(O.substring(Ce+9,X),p),x))return;X+=3;continue}if(K===45&&O.charCodeAt(Ce+3)===45){if(X=O.indexOf("-->",Ce),X===-1)return F?O.substring(Ce):T("unclosed comment");if(c&&(c(O.substring(Ce+4,X),ro,p),x))return;X+=3;continue}}if(ie===63){if(X=O.indexOf("?>",Ce),X===-1)return F?O.substring(Ce):T("unclosed question");if(l&&(l(O.substring(Ce,X+2),p),x))return;X+=2;continue}for(te=Ce+1;;te++){if(pe=O.charCodeAt(te),isNaN(pe))return F?O.substring(Ce):(X=-1,T("unclosed tag"));if(pe===34)K=O.indexOf('"',te+1),te=K!==-1?K:te;else if(pe===39)K=O.indexOf("'",te+1),te=K!==-1?K:te;else if(pe===62){X=te;break}}if(ie===33){if(u&&(u(O.substring(Ce,X+1),ro,p),x))return;X+=1;continue}if(ee={},ie===47){if(Ke=!1,rt=!0,!_.length)return T("missing open tag");if(te=B=_.pop(),K=Ce+2+te.length,O.substring(Ce+2,K)!==te)return T("closing tag mismatch");for(;K<X;K++)if(ie=O.charCodeAt(K),!(ie===32||ie>8&&ie<14))return T("close tag")}else{if(O.charCodeAt(X-1)===47?(te=B=O.substring(Ce+1,X-1),Ke=!0,rt=!0):(te=B=O.substring(Ce+1,X),Ke=!0,rt=!1),!(ie>96&&ie<123||ie>64&&ie<91||ie===95||ie===58))return T("illegal first char nodeName");for(K=1,U=te.length;K<U;K++)if(ie=te.charCodeAt(K),!(ie>96&&ie<123||ie>64&&ie<91||ie>47&&ie<59||ie===45||ie===95||ie==46)){if(ie===32||ie<14&&ie>8){B=te.substring(0,K),ee=null;break}return T("invalid nodeName")}rt||_.push(B)}if(y){Pe=v,Ke&&(rt||m.push(Pe),ee===null&&(h=te.indexOf("xmlns",K)!==-1)&&(V=K,G=te,Ze(),h=!1)),S=B,he!==v&&(J=v[lm],J===void 0&&(J=v[lm]=Object.create(null)),he=v);var Gt=J[B];if(Gt!==void 0)B=Gt;else{if(ie=B.indexOf(":"),ie!==-1){if(Te=v[B.substring(0,ie)],!Te)return T("missing namespace on <"+S+">");B=B.substr(ie+1)}else Te=v.xmlns;Te&&(B=Te+":"+B),J[S]=B}}if(Ke&&(V=K,G=te,i&&(t?i(w,ro,rt,p):i(B,Ze,ro,rt,p),x)))return;if(rt){if(r&&(r(t?w:B,ro,Ke,p),x))return;y&&(Ke?v=Pe:v=m.pop())}X+=1}}}function pm(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var pp={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},fm="property";function dm(e){return e.xml&&e.xml.serialize}function T1(e){const t=dm(e);return t!==fm&&(t||null)}function k1(e){return e.charAt(0).toUpperCase()+e.slice(1)}function hm(e,t){return pm(t)?e.prefix+":"+k1(e.localName):e.name}function O1(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 D1(e,t,n){const i=kn(e,t.xmlns),r=`${t[i.prefix]||i.prefix}:${i.localName}`,o=kn(r);var a=n.getPackage(o.prefix);return O1(o,a)}function wr(e){return new Error(e)}function Qi(e){return e.$descriptor}function L1(e){W(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw wr("expected element");var n=this.elementsById,i=Qi(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 wr("duplicate ID <"+o+">");n[o]=t}},this.addWarning=function(t){this.warnings.push(t)}}function Ba(){}Ba.prototype.handleEnd=function(){},Ba.prototype.handleText=function(){},Ba.prototype.handleNode=function(){};function fp(){}fp.prototype=Object.create(Ba.prototype),fp.prototype.handleNode=function(){return this};function $o(){}$o.prototype=Object.create(Ba.prototype),$o.prototype.handleText=function(e){this.body=(this.body||"")+e};function Na(e,t){this.property=e,this.context=t}Na.prototype=Object.create($o.prototype),Na.prototype.handleNode=function(e){if(this.element)throw wr("expected no sub nodes");return this.element=this.createReference(e),this},Na.prototype.handleEnd=function(){this.element.id=this.body},Na.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function dp(e,t){this.element=t,this.propertyDesc=e}dp.prototype=Object.create($o.prototype),dp.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=sp(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function ac(){}ac.prototype=Object.create($o.prototype),ac.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 In(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}In.prototype=Object.create(ac.prototype),In.prototype.addReference=function(e){this.context.addReference(e)},In.prototype.handleText=function(e){var t=this.element,n=Qi(t),i=n.bodyProperty;if(!i)throw wr("unexpected body text <"+e+">");$o.prototype.handleText.call(this,e)},In.prototype.handleEnd=function(){var e=this.body,t=this.element,n=Qi(t),i=n.bodyProperty;i&&e!==void 0&&(e=sp(i.type,e),t.set(i.name,e))},In.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=Qi(n),r=this.context,o=new n({}),a=this.model,s;return H(t,function(c,l){var u=i.propertiesByName[l],p;u&&u.isReference?u.isMany?(p=c.split(" "),H(p,function(f){r.addReference({element:o,property:u.ns.name,id:f})})):r.addReference({element:o,property:u.ns.name,id:c}):(u?c=sp(u.type,c):l==="xmlns"?l=":"+l:(s=kn(l,i.ns.prefix),a.getPackage(s.prefix)&&r.addWarning({message:"unknown attribute <"+l+">",element:o,property:l,value:c})),o.set(l,c))}),o},In.prototype.getPropertyForNode=function(e){var t=e.name,n=kn(t),i=this.type,r=this.model,o=Qi(i),a=n.name,s=o.propertiesByName[a];if(s&&!s.isAttr){const l=T1(s);if(l){const u=e.attributes[l];if(u){const p=D1(u,e.ns,r),f=r.getType(p);return W({},s,{effectiveType:Qi(f).name})}}return s}var c=r.getPackage(n.prefix);if(c){const l=hm(n,c),u=r.getType(l);if(s=Tt(o.properties,function(p){return!p.isVirtual&&!p.isReference&&!p.isAttribute&&u.hasType(p.type)}),s)return W({},s,{effectiveType:Qi(u).name})}else if(s=Tt(o.properties,function(l){return!l.isReference&&!l.isAttribute&&l.type==="Element"}),s)return s;throw wr("unrecognized element <"+n.name+">")},In.prototype.toString=function(){return"ElementDescriptor["+Qi(this.type).name+"]"},In.prototype.valueHandler=function(e,t){return new dp(e,t)},In.prototype.referenceHandler=function(e){return new Na(e,this.context)},In.prototype.handler=function(e){return e==="Element"?new Fo(this.model,e,this.context):new In(this.model,e,this.context)},In.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,rm(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?(W(o,{element:i}),this.context.addReference(o)):o.$parent=i),r};function hp(e,t,n){In.call(this,e,t,n)}hp.prototype=Object.create(In.prototype),hp.prototype.createElement=function(e){var t=e.name,n=kn(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&hm(n,o)||t;if(!r.hasType(a))throw wr("unexpected element <"+e.originalName+">");return In.prototype.createElement.call(this,e)};function Fo(e,t,n){this.model=e,this.context=n}Fo.prototype=Object.create(ac.prototype),Fo.prototype.createElement=function(e){var t=e.name,n=kn(t),i=n.prefix,r=e.ns[i+"$uri"],o=e.attributes;return this.model.createAny(t,r,o)},Fo.prototype.handleChild=function(e){var t=new Fo(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},Fo.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function mp(e){e instanceof pi&&(e={model:e}),W(this,{lax:!1},e)}mp.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof In?(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 L1(W({},t,{rootHandler:i})),s=new um({proxy:!0}),c=I1();i.context=a,c.push(i);function l(_,E,T){var k=E(),I=k.line,P=k.column,O=k.data;O.charAt(0)==="<"&&O.indexOf(" ")!==-1&&(O=O.slice(0,O.indexOf(" "))+">");var F="unparsable content "+(O?O+" ":"")+`detected
2
2
  line: `+I+`
3
3
  column: `+P+`
4
- nested error: `+S.message;if(T)return a.addWarning({message:F,error:S}),!0;throw xr(F)}function u(S,E){return l(S,E,!0)}function p(){var S=a.elementsById,E=a.references,T,k;for(T=0;k=E[T];T++){var I=k.element,P=S[k.id],O=Zi(I).propertiesByName[k.property];if(P||a.addWarning({message:"unresolved reference <"+k.id+">",element:k.element,property:k.property,value:k.id}),O.isMany){var F=I.get(O.name),Z=F.indexOf(k);Z===-1&&(Z=F.length),P?F[Z]=P:F.splice(Z,1)}else I.set(O.name,P)}}function f(){c.pop().handleEnd()}var d=/^<\?xml /i,h=/ encoding="([^"]+)"/i,m=/^utf-8$/i;function v(S){if(d.test(S)){var E=h.exec(S),T=E&&E[1];!T||m.test(T)||a.addWarning({message:"unsupported document encoding <"+T+">, falling back to UTF-8"})}}function w(S,E){var T=c.peek();try{c.push(T.handleNode(S))}catch(k){l(k,E,o)&&c.push(new tp)}}function x(S,E){try{c.peek().handleText(S)}catch(T){u(T,E)}}function g(S,E){S.trim()&&x(S,E)}var y=r.getPackages().reduce(function(S,E){return S[E.uri]=E.prefix,S},Object.entries(ep).reduce(function(S,[E,T]){return S[T]=E,S},r.config&&r.config.nsMap||{}));return s.ns(y).on("openTag",function(S,E,T,k){var I=S.attrs||{},P=Object.keys(I).reduce(function(F,Z){var he=E(I[Z]);return F[Z]=he,F},{}),O={name:S.name,originalName:S.originalName,attributes:P,ns:S.ns};w(O,k)}).on("question",v).on("closeTag",f).on("cdata",x).on("text",function(S,E,T){g(E(S),T)}).on("error",l).on("warn",u),new Promise(function(S,E){var T;try{s.parse(e),p()}catch(F){T=F}var k=i.element;!T&&!k&&(T=xr("failed to parse document as <"+i.type.$descriptor.name+">"));var I=a.warnings,P=a.references,O=a.elementsById;return T?(T.warnings=I,E(T)):S({rootElement:k,elementsById:O,references:P,warnings:I})})},rp.prototype.handler=function(e){return new ip(this.model,e)};function x1(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var _1=`<?xml version="1.0" encoding="UTF-8"?>
5
- `,w1=/<|>|'|"|&|\n\r|\n/g,rm=/<|>|&/g;function Li(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}Li.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},Li.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},Li.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},Li.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)},Li.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},Li.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},Li.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri},Li.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},Li.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 E1(e){return e.charAt(0).toLowerCase()+e.slice(1)}function S1(e,t){return em(t)?E1(e):e}function om(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function am(e){return Gn(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function R1(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 C1(e,t){return t.isGeneric?W({localName:t.ns.localName},e):W({localName:S1(t.ns.localName,t.$pkg)},e)}function A1(e,t){return W({localName:t.ns.localName},e)}function M1(e){var t=e.$descriptor;return tt(t.properties,function(n){var i=n.name;if(n.isVirtual||!Vn(e,i))return!1;var r=e[i];return r===n.default||r===null?!1:n.isMany?r.length:!0})}var P1={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},T1={"<":"lt",">":"gt","&":"amp"};function sm(e,t,n){return e=Gn(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function k1(e){return sm(e,w1,P1)}function O1(e){return sm(e,rm,T1)}function D1(e){return tt(e,function(t){return t.isAttr})}function L1(e){return tt(e,function(t){return!t.isAttr})}function op(e){this.tagName=e}op.prototype.build=function(e){return this.element=e,this},op.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()};function no(){}no.prototype.serializeValue=no.prototype.serializeTo=function(e){e.append(this.escape?O1(this.value):this.value)},no.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(rm)!==-1&&(this.escape=!0),this};function ap(e){this.tagName=e}om(ap,no),ap.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()};function It(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}It.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=M1(e),this.parseAttributes(D1(r)),this.parseContainments(L1(r))),this.parseGenericAttributes(e,i),this},It.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return C1(t,e)},It.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return A1(t,e)},It.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},It.prototype.nsAttributeName=function(e){var t;if(Gn(e)?t=Tn(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}:W({localName:t.localName},n)},It.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}))},It.prototype.parseGenericContainments=function(e){var t=e.$body;t&&this.body.push(new no().build({type:"String"},t));var n=e.$children;n&&H(n,i=>{this.body.push(new It(this).build(i))})},It.prototype.parseNsAttribute=function(e,t,n){var i=e.$model,r=Tn(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)}},It.prototype.parseNsAttributes=function(e){var t=this,n=e.$attrs,i=[];return H(n,function(r,o){var a=t.parseNsAttribute(e,o,r);a&&i.push(a)}),i},It.prototype.parseGenericAttributes=function(e,t){var n=this;H(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)}})},It.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;H(e,function(r){var o=i.get(r.name),a=r.isReference,s=r.isMany;if(s||(o=[o]),r.isBody)n.push(new no().build(r,o[0]));else if(qh(r.type))H(o,function(l){n.push(new ap(t.addTagName(t.nsPropertyTagName(r))).build(r,l))});else if(a)H(o,function(l){n.push(new op(t.addTagName(t.nsPropertyTagName(r))).build(l))});else{var c=nm(r);H(o,function(l){var u;c?c===tm?u=new It(t,r):u=new nc(t,r,c):u=new It(t),n.push(u.build(l))})}})},It.prototype.getNamespaces=function(e){var t=this.namespaces,n=this.parent,i;return t||(i=n&&n.getNamespaces(),e||!i?this.namespaces=t=new Li(i):t=i),t},It.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},It.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},It.prototype.parseAttributes=function(e){var t=this,n=this.element;H(e,function(i){var r=n.get(i.name);if(i.isReference)if(!i.isMany)r=r.id;else{var o=[];H(r,function(a){o.push(a.id)}),r=o.join(" ")}t.addAttribute(t.nsAttributeName(i),r)})},It.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),am(e)},It.prototype.addAttribute=function(e,t){var n=this.attrs;Gn(t)&&(t=k1(t));var i=jh(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)},It.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=R1(n).concat(t)),H(t,function(i){e.append(" ").append(am(i.name)).append('="').append(i.value).append('"')})},It.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==no;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),H(this.body,function(i){i.serializeTo(e)}),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()};function nc(e,t,n){It.call(this,e,t),this.serialization=n}om(nc,It),nc.prototype.parseNsAttributes=function(e){var t=It.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},nc.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function I1(){this.value="",this.write=function(e){this.value+=e}}function B1(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 N1(e){e=W({format:!1,preamble:!0},e||{});function t(n,i){var r=i||new I1,o=new B1(r,e.format);e.preamble&&o.append(_1);var a=new It,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes($1(s)),a.build(n).serializeTo(o),!i)return r.value}return{toXML:t}}function $1(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in ep)n[i]=ep[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 ic(e,t){ui.call(this,e,t)}ic.prototype=Object.create(ui.prototype),ic.prototype.fromXML=function(e,t,n){Gn(t)||(n=t,t="bpmn:Definitions");var i=new rp(W({model:this,lax:!0},n)),r=i.handler(t);return i.fromXML(e,r)},ic.prototype.toXML=function(e,t){var n=new N1(t);return new Promise(function(i,r){try{var o=n.toXML(e);return i({xml:o})}catch(a){return r(a)}})};var F1="BPMN20",j1="http://www.omg.org/spec/BPMN/20100524/MODEL",H1="bpmn",z1=[],G1=[{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"}]}],V1=[{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"}]}],W1={tagAlias:"lowerCase",typePrefix:"t"},U1={name:F1,uri:j1,prefix:H1,associations:z1,types:G1,enumerations:V1,xml:W1},q1="BPMNDI",Y1="http://www.omg.org/spec/BPMN/20100524/DI",K1="bpmndi",X1=[{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"]}],Z1=[{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"}]}],Q1=[],J1={name:q1,uri:Y1,prefix:K1,types:X1,enumerations:Z1,associations:Q1},eS="DC",tS="http://www.omg.org/spec/DD/20100524/DC",nS="dc",iS=[{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}]}],rS=[],oS={name:eS,uri:tS,prefix:nS,types:iS,associations:rS},aS="DI",sS="http://www.omg.org/spec/DD/20100524/DI",cS="di",lS=[{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"}]}],uS=[],pS={tagAlias:"lowerCase"},fS={name:aS,uri:sS,prefix:cS,types:lS,associations:uS,xml:pS},dS="bpmn.io colors for BPMN",hS="http://bpmn.io/schema/bpmn/biocolor/1.0",mS="bioc",gS=[{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"}]}],yS=[],vS=[],bS={name:dS,uri:hS,prefix:mS,types:gS,enumerations:yS,associations:vS},xS="BPMN in Color",_S="http://www.omg.org/spec/BPMN/non-normative/color/1.0",wS="color",ES=[{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"}]}],SS=[],RS=[],CS={name:xS,uri:_S,prefix:wS,types:ES,enumerations:SS,associations:RS};const AS={bpmn:U1,bpmndi:J1,dc:oS,di:fS,bioc:bS,color:CS};function cm(e,t){const n=W({},AS,e);return new ic(n,t)}const MS={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"}},rc={[zh]:MS,[Hu]:Nh};function lm(){return cm(rc)}const um=lm();async function Io(e){const{rootElement:t,warnings:n}=await um.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function PS(e){const{xml:t}=await um.toXML(e,{format:!0});return t}function sp(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const Bo={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},TS=/[ᄀ-ᇿ -〿぀-ヿ㐀-鿿가-힯＀-⦆]/;function kS(e){const t=Bo;return TS.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 No(e,t){let n=0;for(const i of e)n+=t*kS(i);return n}function pm(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&OS(e),DS(e),LS(e),IS(e)}function OS(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:No(r,o),fontBoundingBoxAscent:o*Bo.ascentEm,fontBoundingBoxDescent:o*Bo.descentEm,actualBoundingBoxAscent:o*Bo.ascentEm,actualBoundingBoxDescent:o*Bo.descentEm}}};t.getContext=()=>n}function DS(e){if(e.SVGMatrix)return;class t{constructor(){ki(this,"a",1);ki(this,"b",0);ki(this,"c",0);ki(this,"d",1);ki(this,"e",0);ki(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 LS(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,l=0){const u=s*Math.PI/180,p=Math.cos(u),f=Math.sin(u);a.a=p,a.b=f,a.c=-f,a.d=p,a.e=c-p*c+f*l,a.f=l-f*c-p*l},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 IS(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:No(n,12),height:14}})}const oc=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),BS=new Set(["bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),NS=1,ac=new Set(["bpmn:TextAnnotation","bpmn:DataStoreReference","bpmn:DataObjectReference","bpmn:DataInput","bpmn:DataOutput"]),$S=2;function ft(e){switch(e.kind){case"label-over-line":return`L|${e.edge}|${e.line}`;case"label-over-shape":return`ls|${e.edge}|${e.shape}`;case"edge-crosses-shape":return`x|${e.edge}|${e.shape}`;case"edge-endpoint-detached":return`d|${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"edge-overlap-unrelated":return`u|${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}`;case"pool-overlap":return`P|${e.pools[0]}|${e.pools[1]}`;case"edge-crosses-subprocess":return`S|${e.edge}|${e.subProcess}`;case"group-overlap-unintended":return`g|${e.groups[0]}|${e.groups[1]}${e.container?`|⊃${e.container}`:""}`;case"group-overlap-unreadable":return e.reason==="minority"?`gu*|${e.group}|${e.shapes.join(",")}`:e.reason==="throughpass"?`gu>|${e.group}|${e.shapes.join(",")}`:`gu|${e.groups[0]}|${e.groups[1]}|${e.shapes.join(",")}`;case"group-stack-unreadable":return`gs|${e.groups.join("|")}|${e.shapes.join(",")}`;case"group-on-container-boundary":return`gb|${e.group}|${e.container}|${e.side}`;case"group-on-group-boundary":return`gg|${e.groups[0]}|${e.groups[1]}|${e.axis}`;case"group-cuts-shape":return`gc|${e.group}|${e.shape}|${e.side}`;case"edge-along-group-boundary":return`eg|${e.edge}|${e.group}`;case"pool-name-over-label":return`pn|${e.pool}|${e.label}`}}const fm=20,sc=5,dm=3,FS=8,$o=15,cp=50,hm=12,jS=hm*1.2;function lp(e,t){const n=t.split(/\r?\n/),i=Math.max(...n.map(o=>No(o,hm))),r=n.length*jS;return{x:e.x+e.width/2-i/2,y:e.y+e.height/2-r/2,width:i,height:r}}const mm=1;function mn(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 Fo(e,t){let n=null;const i=e.type!==t.type,o=!!(e.source&&e.target&&t.source&&t.target)&&e.source!==t.source&&e.source!==t.target&&e.target!==t.source&&e.target!==t.target;for(const a of mn(e))for(const s of mn(t)){if(a.axis!==s.axis||Math.abs(a.at-s.at)>mm)continue;const c=a.dir!==s.dir?"opposite":i?"mixed":o?"unrelated":null;if(!c)continue;const l=Math.min(a.hi,s.hi)-Math.max(a.lo,s.lo);l>=fm&&(!n||l>n.length)&&(n={axis:a.axis,length:l,kind:c})}return n}function up(e){return e.kind==="edge-overlap-opposite"||e.kind==="edge-overlap-mixed"||e.kind==="edge-overlap-unrelated"}function gm(e,t){const n=Fo(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function HS(e,t){let n=0;for(const i of t)i.id!==e.id&&gm(e,i)&&n++;return n}function ri(e,t){let n=0;for(const i of t)i.id!==e.id&&Fo(e,i)&&n++;return n}const ym=15,vm=20;function zS(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-vm||t.at>n[1]+vm)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 pp=20;function cc(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>mm)continue;const r=Math.max(e.lo,i.lo),o=Math.min(e.hi,i.hi);o-r<fm||n.push([r-pp,o+pp])}return n}function lc(e,t){const n=e.label;if(!n)return null;let i=null;for(const r of mn(e)){const o=zS(n,r);if(o){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of cc(r,mn(a)))if(Math.min(c,o[1])>Math.max(s,o[0])){i={other:a.id,axis:r.axis};break}}}}return i}const GS=10,VS=1,WS=(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 US(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,l=t.y-e.y;let u=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>u&&(u=m)}else{if(m<u)return!1;m<p&&(p=m)}return!0};return f(r-e.x,c)&&f(e.x-a,-c)&&f(o-e.y,l)&&f(e.y-s,-l)&&p>u}function fp(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 qS=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,jo=1;function Ii(e,t){const n=e.x+jo,i=e.x+e.width-jo,r=e.y+jo,o=e.y+e.height-jo;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 Ho(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 bm(e,t){const n=e.label;if(!n)return null;if(mn(e).some(i=>Ii(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(mn(i).some(r=>Ii(n,r)))return i.id;for(const i of t.shapes.filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(Ho(i).some(r=>Ii(n,r)))return i.id;return null}function _n(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(US(e.waypoints[o],e.waypoints[o+1],r,$S)){i.push(r);break}}return i}const Ia=(e,t,n)=>{const i=n.x-t.x,r=n.y-t.y,o=i*i+r*r,a=o===0?0:Math.max(0,Math.min(1,((e.x-t.x)*i+(e.y-t.y)*r)/o));return Math.hypot(e.x-(t.x+a*i),e.y-(t.y+a*r))},YS=(e,t,n,i)=>_m(e,t,n,i)?0:Math.min(Ia(e,n,i),Ia(t,n,i),Ia(n,e,t),Ia(i,e,t)),xm=(e,t)=>{let n=!1;for(let i=0,r=t.length-1;i<t.length;r=i++){const o=t[i],a=t[r];o.y>e.y!=a.y>e.y&&e.x<(a.x-o.x)*(e.y-o.y)/(a.y-o.y)+o.x&&(n=!n)}return n};function uc(e,t,n){const{x:i,y:r,width:o,height:a}=n;if(/Event$/.test(n.type)){const l=Math.min(o,a)/2;return Math.max(0,Ia({x:i+o/2,y:r+a/2},e,t)-l)}const s=/Gateway$/.test(n.type)?[{x:i+o/2,y:r},{x:i+o,y:r+a/2},{x:i+o/2,y:r+a},{x:i,y:r+a/2}]:[{x:i,y:r},{x:i+o,y:r},{x:i+o,y:r+a},{x:i,y:r+a}];if(xm(e,s)||xm(t,s))return 0;let c=1/0;for(let l=0;l<s.length;l++)c=Math.min(c,YS(e,t,s[l],s[(l+1)%s.length]));return c}function _m(e,t,n,i){const r=(l,u,p)=>(u.x-l.x)*(p.y-l.y)-(u.y-l.y)*(p.x-l.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 wm=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function Ba(e,t){let n=0;for(const i of t){if(i.id===e.id||wm(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++)_m(e.waypoints[o],e.waypoints[o+1],i.waypoints[a],i.waypoints[a+1])&&(r=!0);r&&n++}return n}function oi(e,t){let n=0;for(const i of t)i.id===e.id||wm(e,i)||Ba(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function Em(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++)Ba(n[i],[n[r]])>0&&(t+=n[i].type===n[r].type?2:1);return t}function pc(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)if(Ba(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]}`))}function Sm(e){const t=pc(e),n=a=>a==="bpmn:MessageFlow"||a.endsWith("Association")?"dashed":"solid",i=new Map(e.edges.map(a=>[a.id,a]));let r=0,o=0;for(const[a,s]of t){const c=i.get(a),l=i.get(s);if(!c||!l)continue;const u=n(c.type),p=n(l.type);u==="solid"&&p==="solid"?r++:u==="dashed"&&p==="dashed"&&o++}return{pairs:t,solidPairs:r,dashedPairs:o,mixedPairs:t.length-r-o,crossPoolMessages:KS(e)}}function KS(e){const t=e.shapes.filter(r=>r.type==="bpmn:Participant");if(t.length<3)return 0;const n=r=>{const o=e.shapes.find(a=>a.id===r);if(o)return t.find(a=>o.x>=a.x&&o.y>=a.y&&o.x+o.width<=a.x+a.width&&o.y+o.height<=a.y+a.height)};let i=0;for(const r of e.edges){if(r.type!=="bpmn:MessageFlow"||r.endpoints.length<2)continue;const o=n(r.endpoints[0]),a=n(r.endpoints[1]);if(!o||!a||o.id===a.id)continue;const s=Math.min(o.y,a.y),c=Math.max(o.y+o.height,a.y+a.height);t.some(l=>l.id!==o.id&&l.id!==a.id&&l.y>s&&l.y+l.height<c)&&i++}return i}function Rm(e,t,n){const i=new Set(t.flatMap(r=>[...r.members]));return e.shapes.filter(r=>!r.container&&!ac.has(r.type)&&!i.has(r.id)&&r.x>=n.x&&r.y>=n.y&&r.x+r.width<=n.right&&r.y+r.height<=n.bottom).map(r=>r.id).sort()}function Cm(e){var n;const t=(n=Dt(e==null?void 0:e.extensionElements))==null?void 0:n.values;if(Array.isArray(t))for(const i of t){const r=Dt(i);if((r==null?void 0:r.$type)!=="bwl:Members"||typeof r.refs!="string")continue;const o=r.refs.split(/\s+/).filter(Boolean);return o.length?o:void 0}}const Am=e=>e?{members:e}:{},ai=e=>e.shapes.filter(t=>!t.container);function XS(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&&o.type!=="bpmn:Group"){if(o.container)return o.id;if(o.parent)return o.parent}}}function ZS(e,t,n){if(e.x<t.x+t.width&&t.x<e.x+e.width&&e.y<t.y+t.height&&t.y<e.y+e.height)return!0;const r=e.x+e.width/2,o=e.y+e.height/2;return n.shapes.some(a=>a.container&&a.id!==t.id&&a.id!==e.id&&a.type!=="bpmn:Group"&&r>=a.x&&r<=a.x+a.width&&o>=a.y&&o<=a.y+a.height)}function Mm(e,t){const n=e.label;if(!n)return null;for(const i of[...t.edges].sort((r,o)=>r.id.localeCompare(o.id)))if(mn(i).some(r=>Ii(n,r)))return i.id;for(const i of[...t.shapes].filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(Ho(i).some(r=>Ii(n,r)))return i.id;return null}function io(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}const Pm=3;function Tm(e,t){const n=Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x),i=Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y);if(n<=0||i<=0)return 0;const r=/Event$/.test(t.type);if(!r&&!/Gateway$/.test(t.type))return Math.min(n,i);const o=t.x+t.width/2,a=t.y+t.height/2,s=Math.min(Math.max(o,e.x),e.x+e.width),c=Math.min(Math.max(a,e.y),e.y+e.height);if(r)return Math.max(0,t.width/2-Math.hypot(s-o,c-a));const l=t.width/2,u=t.height/2;return Math.max(0,(1-(Math.abs(s-o)/l+Math.abs(c-a)/u))*Math.min(l,u))}function Na(e,t){const n=[];for(const i of t.shapes){if(i.container||ac.has(i.type))continue;const r=Tm(e,i);r>=Pm&&n.push({shape:i.id,depth:r})}return n.sort((i,r)=>i.shape.localeCompare(r.shape))}function mt(e,t={}){const n=[],i=e.shapes.filter(g=>!g.container);for(const g of e.edges)for(const y of _n(g,i))n.push({kind:"edge-crosses-shape",edge:g.id,shape:y.id});const r=e.shapes.filter(g=>g.container&&BS.has(g.type));if(r.length){const g=(y,S)=>{const E=e.shapes.find(T=>T.id===S);return!!E&&E.x>=y.x&&E.y>=y.y&&E.x+E.width<=y.x+y.width&&E.y+E.height<=y.y+y.height};for(const y of e.edges)for(const S of _n(y,r))y.endpoints.includes(S.id)||y.endpoints.some(E=>g(S,E))||n.push({kind:"edge-crosses-subprocess",edge:y.id,subProcess:S.id})}for(const g of e.edges){if(g.waypoints.length<2)continue;const y=[[g.source,g.waypoints[0]],[g.target,g.waypoints[g.waypoints.length-1]]];for(const[S,E]of y){if(!S)continue;const T=e.shapes.find(O=>O.id===S);if(!T||T.container)continue;const k=Math.max(T.x-E.x,E.x-(T.x+T.width),0),I=Math.max(T.y-E.y,E.y-(T.y+T.height),0),P=Math.hypot(k,I);P>GS&&n.push({kind:"edge-endpoint-detached",edge:g.id,shape:S,distance:Math.round(P)})}}const o=e.shapes.filter(g=>g.type==="bpmn:Participant");for(let g=0;g<o.length;g++)for(let y=g+1;y<o.length;y++){const S=o[g],E=o[y];if(S.x+S.width<=E.x||E.x+E.width<=S.x||S.y+S.height<=E.y||E.y+E.height<=S.y)continue;const T=(k,I)=>k.x<=I.x&&k.y<=I.y&&k.x+k.width>=I.x+I.width&&k.y+k.height>=I.y+I.height;n.push({kind:"pool-overlap",pools:[S.id,E.id],contained:T(S,E)||T(E,S)})}const a=i.filter(g=>!g.attached);for(let g=0;g<a.length;g++)for(let y=g+1;y<a.length;y++){const S=a[g],E=a[y];if(!fp(S,E,NS))continue;const T=S.id<E.id?[S.id,E.id]:[E.id,S.id];n.push({kind:"shape-overlap",shapes:T,identical:qS(S,E)})}const s=e.shapes.filter(g=>g.type==="bpmn:Group"&&Array.isArray(g.members)&&g.members.length>0);for(let g=0;g<s.length;g++)for(let y=g+1;y<s.length;y++){const S=s[g],E=s[y],T=Math.min(S.x+S.width,E.x+E.width)-Math.max(S.x,E.x),k=Math.min(S.y+S.height,E.y+E.height)-Math.max(S.y,E.y);if(T<=sc||k<=sc)continue;const I=S.id<E.id?[S.id,E.id]:[E.id,S.id],P=new Set(E.members);if(S.members.some(F=>P.has(F))){const F=Rm(e,s,{x:Math.max(S.x,E.x),y:Math.max(S.y,E.y),right:Math.min(S.x+S.width,E.x+E.width),bottom:Math.min(S.y+S.height,E.y+E.height)});F.length&&n.push({kind:"group-overlap-unreadable",reason:"orphan",groups:I,shapes:F});continue}const O=S.x<=E.x&&S.y<=E.y&&S.x+S.width>=E.x+E.width&&S.y+S.height>=E.y+E.height?S.id:E.x<=S.x&&E.y<=S.y&&E.x+E.width>=S.x+S.width&&E.y+E.height>=S.y+S.height?E.id:void 0;n.push({kind:"group-overlap-unintended",groups:I,...O?{container:O}:{}})}const c=new Set(s.flatMap(g=>[...g.members])),l=g=>e.shapes.filter(y=>!y.container&&!ac.has(y.type)&&y.x>=g.x&&y.y>=g.y&&y.x+y.width<=g.x+g.width&&y.y+y.height<=g.y+g.height);for(const g of s){const y=l(g);if(!y.length)continue;const S=new Set(g.members),E=y.filter(T=>!S.has(T.id));E.some(T=>c.has(T.id))&&(E.length*2<y.length||n.push({kind:"group-overlap-unreadable",reason:"minority",group:g.id,shapes:E.map(T=>T.id).sort()}))}for(const g of s){const y=new Set(l(g).map(P=>P.id)),S=new Set(g.members),E=new Set([...y].filter(P=>!S.has(P)&&c.has(P)));if(!E.size)continue;let T=!1,k=!1,I=!1;for(const P of e.edges){if(P.type!=="bpmn:SequenceFlow"||!P.source||!P.target)continue;const O=E.has(P.source),F=E.has(P.target);!O&&F&&!y.has(P.source)?T=!0:O&&!F&&!y.has(P.target)?k=!0:O&&F&&(I=!0)}T&&k&&I&&n.push({kind:"group-overlap-unreadable",reason:"throughpass",group:g.id,shapes:[...E].sort()})}const u=e.shapes.filter(g=>g.type==="bpmn:Group");for(let g=0;g<u.length;g++)for(let y=g+1;y<u.length;y++)for(let S=y+1;S<u.length;S++){const E=[u[g],u[y],u[S]],T={x:Math.max(...E.map(P=>P.x)),y:Math.max(...E.map(P=>P.y)),right:Math.min(...E.map(P=>P.x+P.width)),bottom:Math.min(...E.map(P=>P.y+P.height))};if(T.right-T.x<=sc||T.bottom-T.y<=sc)continue;const k=Rm(e,[],T);if(!k.length)continue;const I=E.map(P=>P.id).sort();n.push({kind:"group-stack-unreadable",groups:I,shapes:k})}for(const g of e.shapes.filter(y=>y.type==="bpmn:Group"))for(const y of e.shapes){if(y.container||y.attached||ac.has(y.type)||y.width<=0||y.height<=0)continue;const S=[["top",g.y,"h",g.x,g.x+g.width],["bottom",g.y+g.height,"h",g.x,g.x+g.width],["left",g.x,"v",g.y,g.y+g.height],["right",g.x+g.width,"v",g.y,g.y+g.height]];for(const[E,T,k,I,P]of S){const O=k==="h"?y.x:y.y,F=k==="h"?y.x+y.width:y.y+y.height;if(!(O<P&&I<F))continue;const Z=k==="h"?y.y:y.x,he=k==="h"?y.y+y.height:y.x+y.width;if(!(Z<T&&T<he))continue;const Me=Math.min(T-Z,he-T);Me<FS||n.push({kind:"group-cuts-shape",group:g.id,shape:y.id,side:E,depth:Me})}}const p=t.includeObservationOnly?e.shapes.filter(g=>g.type==="bpmn:Group"&&g.width>0&&g.height>0):[];if(p.length){const g=new Map(e.shapes.filter(y=>!y.container).map(y=>[y.id,{x:y.x+y.width/2,y:y.y+y.height/2}]));for(const y of e.edges){if(y.type!=="bpmn:SequenceFlow"&&y.type!=="bpmn:MessageFlow")continue;const S=mn(y);if(S.length)for(const E of p){const T=E.x+E.width,k=E.y+E.height,I=y.endpoints.some(O=>{const F=g.get(O);return!!F&&E.x<F.x&&F.x<T&&E.y<F.y&&F.y<k});let P=null;for(const O of S){const[F,Z,he]=O.axis==="v"?[E.y,k,[["left",E.x],["right",T]]]:[E.x,T,[["top",E.y],["bottom",k]]],Me=Math.min(O.hi,Z)-Math.max(O.lo,F);if(Me<cp)continue;const Be=O.axis==="v"?E.x<O.at&&O.at<T:E.y<O.at&&O.at<k;if(!(Be&&I))for(const[nt,J]of he){const te=Math.abs(O.at-J);te<=$o&&(!P||te<P.distance)&&(P={side:nt,inside:Be,distance:te,length:Me})}}P&&n.push({kind:"edge-along-group-boundary",edge:y.id,group:E.id,side:P.side,inside:P.inside,distance:Math.round(P.distance),length:Math.round(P.length)})}}}const f=e.shapes.filter(g=>g.container&&g.type!=="bpmn:Group"&&g.type!=="bpmn:Lane");for(const g of e.shapes.filter(y=>y.type==="bpmn:Group"))for(const y of f){const S=g.x<y.x+y.width&&y.x<g.x+g.width,E=g.y<y.y+y.height&&y.y<g.y+g.height,T=[["top",g.y,y.y,S],["bottom",g.y+g.height,y.y+y.height,S],["left",g.x,y.x,E],["right",g.x+g.width,y.x+y.width,E]];for(const[k,I,P,O]of T)O&&Math.abs(I-P)<=dm&&n.push({kind:"group-on-container-boundary",group:g.id,container:y.id,side:k})}const d=e.shapes.filter(g=>g.type==="bpmn:Group");for(let g=0;g<d.length;g++)for(let y=g+1;y<d.length;y++){const S=d[g],E=d[y],T=S.x<E.x+E.width&&E.x<S.x+S.width,k=S.y<E.y+E.height&&E.y<S.y+S.height,I=[["x",S.x+S.width,E.x,k],["x",E.x+E.width,S.x,k],["y",S.y+S.height,E.y,T],["y",E.y+E.height,S.y,T]];for(const[P,O,F,Z]of I)if(Z&&Math.abs(O-F)<=dm){n.push({kind:"group-on-group-boundary",groups:S.id<E.id?[S.id,E.id]:[E.id,S.id],axis:P});break}}for(let g=0;g<e.edges.length;g++)for(let y=g+1;y<e.edges.length;y++){const S=e.edges[g],E=e.edges[y],T=Fo(S,E);if(!T)continue;const k=S.id<E.id?[S.id,E.id]:[E.id,S.id];n.push({kind:T.kind==="opposite"?"edge-overlap-opposite":T.kind==="mixed"?"edge-overlap-mixed":"edge-overlap-unrelated",edges:k,axis:T.axis,length:Math.round(T.length)})}for(const g of e.edges){if(!g.label)continue;const y=lc(g,e.edges);y&&n.push({kind:"label-on-shared-segment",edge:g.id,other:y.other,axis:y.axis})}for(const g of e.edges){if(!g.label)continue;const y=bm(g,e);y&&n.push({kind:"label-over-line",edge:g.id,line:y})}if(t.includeObservationOnly){for(const g of e.edges)if(!(!g.label||g.type!=="bpmn:SequenceFlow"))for(const{shape:y,depth:S}of Na(g.label,e))n.push({kind:"label-over-shape",edge:g.id,shape:y,depth:Math.round(S)})}const h=new Set(i.map(g=>g.id)),m=e.shapes.filter(g=>g.type==="bpmn:Participant"&&g.label);for(const g of[...i,...m.filter(y=>!h.has(y.id))]){if(!g.label)continue;const y=Mm(g,e);y&&n.push({kind:"label-over-line",edge:g.id,line:y})}const v=new Set(e.shapes.filter(g=>g.type==="bpmn:TextAnnotation").map(g=>g.id));for(const g of m)for(const{owner:y,rect:S}of io(e))y===g.id||v.has(y)||fp(g.label,S,jo)&&n.push({kind:"pool-name-over-label",pool:g.id,label:y});const w=io(e);for(const g of i)if(g.type==="bpmn:TextAnnotation")for(const{owner:y,rect:S}of w)y!==g.id&&fp(g,S,jo)&&n.push({kind:"annotation-over-label",annotation:g.id,label:y});const x=new Map(e.shapes.map(g=>[g.id,g]));for(const g of i){const y=g.parent??XS(g,e,x);if(!y)continue;const S=x.get(y);!S||!S.container||WS(S,g,VS)||g.type==="bpmn:TextAnnotation"&&!ZS(g,S,e)||n.push({kind:"shape-outside-container",shape:g.id,container:S.id})}return n.sort((g,y)=>ft(g).localeCompare(ft(y)))}const Dt=e=>typeof e=="object"&&e!==null?e:void 0,Vt=e=>typeof e=="number"?e:0,Qi=e=>{const t=Dt(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function QS(e){const t=Dt(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=Qi(o);a&&n.push(a)}}return n}function JS(e){const t=Dt(e);if(!t)return{};const n=Array.isArray(t.sourceRef)?void 0:Qi(t.sourceRef),i=Array.isArray(t.targetRef)?void 0:Qi(t.targetRef);return n&&i?{source:n,target:i}:{}}function eR(e,t){const n=Dt(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const r=Qi(n);return r?t.get(r):void 0}if(oc.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return Qi(n)}function km(e){var a,s,c,l,u;const t=[],n=[],i=((a=Dt(e))==null?void 0:a.diagrams)??[],r=new Map,o=new Set;for(const p of((s=Dt(e))==null?void 0:s.rootElements)??[]){const f=Dt(p);if((f==null?void 0:f.$type)==="bpmn:Collaboration")for(const d of f.participants??[]){const h=Dt(d),m=Qi(h),v=Qi(h==null?void 0:h.processRef);m&&v?r.set(v,m):m&&o.add(m)}}for(const p of i){const f=Dt((c=Dt(p))==null?void 0:c.plane),d=(f==null?void 0:f.planeElement)??[];for(const h of d){const m=Dt(h);if(!m)continue;const v=Dt(m.bpmnElement),w=typeof(v==null?void 0:v.id)=="string"?v.id:void 0;if(!w)continue;const x=typeof(v==null?void 0:v.$type)=="string"?v.$type:"",g=Dt(m.bounds);if(g){const S=m.isExpanded===!1&&x!=="bpmn:Participant",E=Dt((l=Dt(m.label))==null?void 0:l.bounds),T={id:w,type:x,x:Vt(g.x),y:Vt(g.y),width:Vt(g.width),height:Vt(g.height),container:oc.has(x)&&!S,attached:(v==null?void 0:v.attachedToRef)!==void 0,...v?{parent:eR(v,r)}:{},...E?{label:{x:Vt(E.x),y:Vt(E.y),width:Vt(E.width),height:Vt(E.height)}}:{},...x==="bpmn:Group"?Am(Cm(v)):{}},k=m.isHorizontal!==!1,I=typeof(v==null?void 0:v.name)=="string"?v.name:"";o.has(w)&&k&&I&&(T.label=lp(T,I)),t.push(T);continue}const y=m.waypoint;if(Array.isArray(y)){const S=Dt((u=Dt(m.label))==null?void 0:u.bounds);n.push({id:w,type:x,waypoints:y.map(E=>{var T,k;return{x:Vt((T=Dt(E))==null?void 0:T.x),y:Vt((k=Dt(E))==null?void 0:k.y)}}),endpoints:QS(v),...JS(v),...S?{label:{x:Vt(S.x),y:Vt(S.y),width:Vt(S.width),height:Vt(S.height)}}:{}})}}}return{shapes:t,edges:n}}function Om(e){return mt(km(e),{includeObservationOnly:!0})}async function tR(e){const{definitions:t,warnings:n}=await Io(e);return{findings:Om(t),warnings:n}}function Xe(e){var i;const t=[],n=[];for(const r of e.getAll()){const o=r;if(o.type==="label"||o.labelTarget)continue;const a=typeof o.type=="string"?o.type:"";if(a==="bpmn:Definitions"||a.startsWith("bpmndi:"))continue;const s=o.waypoints;if(s){const m=Dt(o.label),v=Qi(o.source),w=Qi(o.target);n.push({id:o.id,type:a,waypoints:s.map(x=>({x:Vt(x.x),y:Vt(x.y)})),endpoints:[v,w].filter(x=>!!x),...v&&w?{source:v,target:w}:{},...m&&typeof m.x=="number"?{label:{x:m.x,y:Vt(m.y),width:Vt(m.width),height:Vt(m.height)}}:{}});continue}if(typeof o.x!="number"||typeof o.y!="number")continue;const c=Dt(o.businessObject),l=Dt(o.label);let u=Dt(o.parent);for(;u&&u.type==="bpmn:Lane";)u=Dt(u.parent);const p=typeof(u==null?void 0:u.type)=="string"?u.type:"",f=u&&oc.has(p)&&p!=="bpmn:Group"&&typeof u.id=="string"?u.id:void 0,d={id:o.id,type:a,x:o.x,y:o.y,width:Vt(o.width),height:Vt(o.height),container:oc.has(a)&&(a==="bpmn:Participant"||o.collapsed!==!0),attached:(c==null?void 0:c.attachedToRef)!==void 0,...f!==void 0?{parent:f}:{},...l&&typeof l.x=="number"?{label:{x:l.x,y:Vt(l.y),width:Vt(l.width),height:Vt(l.height)}}:{},...a==="bpmn:Group"?Am(Cm(c)):{}},h=typeof(c==null?void 0:c.name)=="string"?c.name:"";a==="bpmn:Participant"&&!(c!=null&&c.processRef)&&h&&((i=Dt(o.di))==null?void 0:i.isHorizontal)!==!1&&(d.label=lp(d,h)),t.push(d)}return{shapes:t,edges:n}}const nR={"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 iR(e,t){const n=nR[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function Dm(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function Lm(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 iR(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&Dm(i)===n).sort((i,r)=>i.y-r.y).map(i=>i.id),participantOf:n=>{const i=e.get(n);return i?Dm(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}},eventDefinitionOf:n=>{var o;const i=e.get(n);if(!i||i.type!=="bpmn:IntermediateCatchEvent")return;const r=(((o=i.businessObject)==null?void 0:o.eventDefinitions)??[]).map(a=>a.$type);return ju(r)}}}const dp=20,rR=4,kt=(e,t)=>Math.abs(e-t)<.5;function fc(e,t,n,i=dp){if(kt(e.y,t.y)&&!kt(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=l=>[{x:a,y:e.y},{x:a,y:l},{x:s,y:l},{x:s,y:e.y}];return[c(n.y-i),c(n.y+n.height+i)]}if(kt(e.x,t.x)&&!kt(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=l=>[{x:e.x,y:a},{x:l,y:a},{x:l,y:s},{x:e.x,y:s}];return[c(n.x-i),c(n.x+n.width+i)]}return null}function Im(e,t,n,i=dp){if(n.length<2)return null;if(kt(e.y,t.y)&&!kt(e.x,t.x)){const r=Math.min(e.x,t.x),o=Math.max(e.x,t.x),a=Math.min(...n.map(d=>d.x))-i,s=Math.max(...n.map(d=>d.x+d.width))+i;if(!(r<a&&s<o))return null;const c=e.x<t.x?a:s,l=e.x<t.x?s:a,u=Math.min(...n.map(d=>d.y))-i,p=Math.max(...n.map(d=>d.y+d.height))+i,f=d=>[{x:c,y:e.y},{x:c,y:d},{x:l,y:d},{x:l,y:e.y}];return[f(u),f(p)]}if(kt(e.x,t.x)&&!kt(e.y,t.y)){const r=Math.min(e.y,t.y),o=Math.max(e.y,t.y),a=Math.min(...n.map(d=>d.y))-i,s=Math.max(...n.map(d=>d.y+d.height))+i;if(!(r<a&&s<o))return null;const c=e.y<t.y?a:s,l=e.y<t.y?s:a,u=Math.min(...n.map(d=>d.x))-i,p=Math.max(...n.map(d=>d.x+d.width))+i,f=d=>[{x:e.x,y:c},{x:d,y:c},{x:d,y:l},{x:e.x,y:l}];return[f(u),f(p)]}return null}function Bm(e,t,n=dp){if(e.length!==4)return null;const[i,r,o,a]=e;if(kt(i.y,r.y)&&kt(r.x,o.x)&&kt(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(kt(i.x,r.x)&&kt(r.y,o.y)&&kt(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 dc(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,l=[{x:n.x+n.width,y:r},{x:a,y:r},{x:a,y:c?i.y+i.height:i.y}],u=[{x:s,y:c?n.y:n.y+n.height},{x:s,y:o},{x:i.x,y:o}];return[l,u]}const Nm=30,oR=[0,-25,25,-40,40];function aR(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+Nm:s-Nm,l=a?i.y+i.height:i.y,u=n.x+n.width/2,p=i.x+i.width/2;return oR.map(f=>[{x:u,y:s},{x:u,y:c},{x:p+f,y:c},{x:p+f,y:l}])}const hp=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],zo=(e,t,n)=>_n({...e,waypoints:t},n).length;function mp(e,t,n,i){let r=[...e.waypoints],o=zo(e,r,t);if(o===0)return null;let a=!1;for(const p of dc(e,t))if(zo(e,p,t)===0)return p;const s=(i??[]).filter(p=>p.id!==e.id).flatMap(mn),c=p=>mn({...e,waypoints:p}).some(f=>cc(f,s).length>0),l=aR(e,t).filter(p=>zo(e,p,t)===0);if(l.length)return l.find(p=>!c(p))??l[0];const u=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);if(e.endpoints.length===2&&r.length>2){const p=t.find(d=>d.id===e.endpoints[0]),f=t.find(d=>d.id===e.endpoints[1]);if(p&&f&&kt(p.y+p.height/2,f.y+f.height/2)){const d=[r[0],r[r.length-1]];if(kt(d[0].y,d[1].y)&&!kt(d[0].x,d[1].x)){const h=t.filter(x=>!e.endpoints.includes(x.id)&&_n({...e,waypoints:d},[x]).length>0),m=h.length>=2?Im(d[0],d[1],h):null,w=(m?m.map(x=>[d[0],...x,d[1]]):h.length===1?(fc(d[0],d[1],h[0])??[]).map(x=>[d[0],...x,d[1]]):h.length===0?[d]:[]).filter(x=>zo(e,x,t)===0&&x.length<=r.length).sort((x,g)=>Number(u(g))-Number(u(x)));if(w.length)return w.find(x=>!c(x))??w[0]}}}for(let p=0;p+1<r.length;p++){const f=r[p],d=r[p+1],h=t.filter(w=>!e.endpoints.includes(w.id)&&_n({...e,waypoints:[f,d]},[w]).length>0);if(h.length<2)continue;const m=Im(f,d,h);if(!m)continue;const v=m.map(w=>hp(r,p,w)).filter(w=>zo(e,w,t)===0).sort((w,x)=>Number(u(x))-Number(u(w)));if(v.length)return v.find(w=>!c(w))??v[0]}for(let p=0;p<rR&&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 v of t){if(e.endpoints.includes(v.id)||_n({...e,waypoints:[h,m]},[v]).length===0)continue;const w=fc(h,m,v),x=w?w.map(y=>hp(r,d,y)):Bm(r,v)??[];if(!x.length)continue;const g=[...x].sort((y,S)=>Number(u(S))-Number(u(y)));for(const y of g){const S=zo(e,y,t);if(S<o){r=y,o=S,f=!0,a=!0;break}}if(f)break}}if(!f)break}return a&&o===0?r:null}function gp(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Xe(i),a=ai(o),s=new Set,c=mt(o).filter(u=>u.kind==="edge-crosses-shape"&&!t.has(ft(u)));if(!c.length)return s;const l=new Map;for(const u of c){if(u.kind!=="edge-crosses-shape"||l.has(u.edge))continue;const p=o.edges.find(f=>f.id===u.edge);p&&l.set(u.edge,p)}for(const[u,p]of l){if(n&&!n.has(u))continue;const f=i.get(u);if(!f)continue;const d=f.parent,h=d&&typeof d.x=="number"&&typeof d.width=="number"?{x:d.x,y:d.y,width:d.width,height:d.height}:void 0,m=mp(p,a,h,o.edges);if(!m){_n(p,a).some(g=>g.type==="bpmn:TextAnnotation")&&s.add(u);continue}const v=o.edges.filter(g=>g.id!==u),w=ri(p,v);ri({...p,waypoints:m},v)>w||r.updateWaypoints(f,m)}return s}const sR=e=>{const t=[];for(let n=0;n+1<e.waypoints.length;n++){const i=e.waypoints[n],r=e.waypoints[n+1];t.push({id:`__ghost:${e.id}:${n}`,type:"bpmn:Task",x:Math.min(i.x,r.x)-1,y:Math.min(i.y,r.y)-1,width:Math.max(2,Math.abs(r.x-i.x)+2),height:Math.max(2,Math.abs(r.y-i.y)+2),container:!1,attached:!1})}return t},yp=(e,t)=>Ba(e,[t])>0;function $m(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Xe(i),a=ai(o);let s=o;const c=new Set(mt(o).map(ft));for(const[l,u]of pc(o))if(!t.has(`${l}|${u}`))for(const[p,f]of[[l,u],[u,l]]){if(n.has(p))continue;const d=s.edges.find(I=>I.id===p),h=s.edges.find(I=>I.id===f);if(!d||!h)continue;const m=i.get(p);if(!m)continue;const v=m.parent,w=v&&typeof v.x=="number"&&typeof v.width=="number"?{x:v.x,y:v.y,width:v.width,height:v.height}:void 0,x=sR(h),g=[...dc(d,a)??[]],y=mp(d,[...a,...x],w,o.edges);y&&g.push(y);for(let I=0;I+1<d.waypoints.length;I++)for(const P of x)for(const O of fc(d.waypoints[I],d.waypoints[I+1],P)??[])g.push(hp(d.waypoints,I,O));const S=s.edges.filter(I=>I.id!==p),E=I=>({...s,edges:s.edges.map(P=>P.id===p?{...P,waypoints:I}:P)}),T=I=>!w||I.every(P=>P.x>=w.x&&P.x<=w.x+w.width&&P.y>=w.y&&P.y<=w.y+w.height),k=g.find(I=>{const P={...d,waypoints:I};return yp(P,h)||!T(I)||S.some(O=>O.id!==f&&!yp(d,O)&&yp(P,O))?!1:mt(E(I)).every(O=>c.has(ft(O)))});if(k){r.updateWaypoints(m,k),s=E(k);break}}}const cR=10;function Fm(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 jm(e,t){if(e.waypoints.length<2||e.endpoints.length!==2)return null;const n=t.shapes.filter(F=>F.type==="bpmn:Participant"&&F.container),i=t.shapes.find(F=>F.id===e.endpoints[0]),r=t.shapes.find(F=>F.id===e.endpoints[1]);if(!i||!r)return null;const o=Fm(i,n),a=Fm(r,n);if(!o||!a||o.id===a.id)return null;const s=a.y>o.y,c=s?o:a,l=s?a:o,u=n.filter(F=>F.id!==o.id&&F.id!==a.id&&F.y>=c.y+c.height&&F.y+F.height<=l.y).sort((F,Z)=>F.y-Z.y);if(!u.length)return null;const p=u[0],f=u[u.length-1],d=(c.y+c.height+p.y)/2,h=(f.y+f.height+l.y)/2,m=s?d:h,v=s?h:d,w=e.waypoints[0],x=e.waypoints[e.waypoints.length-1],g=ai(t),y=t.edges.filter(F=>F.id!==e.id),S=oi(e,y),E=_n(e,g).length;if(S===0&&E===0||E===0&&e.waypoints.length===2)return null;const T=Math.min(...u.map(F=>F.x)),k=Math.max(...u.map(F=>F.x+F.width)),I=(w.x+x.x)/2,P=F=>F.filter((Z,he)=>he===0||!(kt(Z.x,F[he-1].x)&&kt(Z.y,F[he-1].y)));let O;for(let F=T;F<=k;F+=cR){const Z=P([w,{x:w.x,y:m},{x:F,y:m},{x:F,y:v},{x:x.x,y:v},x]),he={...e,waypoints:Z};if(_n(he,g).length>0)continue;const Me=oi(he,y),Be=Math.abs(F-I);(!O||Me<O.cross||Me===O.cross&&Be<O.detour)&&(O={pts:Z,cross:Me,detour:Be})}return O&&(E>0?O.cross<=S:O.cross<S)?O.pts:null}function Hm(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Xe(n);for(const o of r.edges){if(o.type!=="bpmn:MessageFlow"||t.has(o.id))continue;const a=Xe(n),s=a.edges.find(u=>u.id===o.id);if(!s)continue;const c=jm(s,a);if(!c)continue;const l=n.get(o.id);l&&i.updateWaypoints(l,c)}}const Bi=[25,-25,40,-40],Go=35;function lR(e,t){const n=e.x+e.width/2,i=t.x+t.width/2,r=[];for(const o of[!0,!1]){const a=o?e.y:e.y+e.height,s=o?t.y:t.y+t.height,c=o?Math.min(e.y,t.y)-Go:Math.max(e.y+e.height,t.y+t.height)+Go;for(const l of[0,...Bi])if(!(Math.abs(l)>=e.width/2-5))for(const u of[0,...Bi]){if(Math.abs(u)>=t.width/2-5)continue;const p=n+l,f=i+u;r.push({pts:[{x:p,y:a},{x:p,y:c},{x:f,y:c},{x:f,y:s}],cost:Math.abs(u)+Math.abs(l)})}}return r}function hc(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 lR(n,i);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,l=s?n.y:n.y+n.height,u=s?n.y-Go:n.y+n.height+Go,p=[];for(const x of[0,...Bi]){if(Math.abs(x)>=i.width/2-5)continue;const g=o+x;p.push({pts:[{x:n.x,y:r},{x:g,y:r},{x:g,y:c}],cost:Math.abs(x)});for(const y of[0,...Bi]){if(Math.abs(y)>=n.width/2-5)continue;const S=a+y;p.push({pts:[{x:S,y:l},{x:S,y:u},{x:g,y:u},{x:g,y:c}],cost:Math.abs(x)+Math.abs(y)})}}const f=50,d=i.y+i.height/2,h=s?n.y+n.height:n.y;for(const x of[0,...Bi]){if(Math.abs(x)>=n.width/2-5)continue;const g=a+x;p.push({pts:[{x:g,y:h},{x:g,y:d},{x:i.x+i.width,y:d}],cost:f+Math.abs(x)})}const m=60,v=s?i.y+i.height:i.y,w=s?i.y+i.height+Go:i.y-Go;for(const x of[0,...Bi]){if(Math.abs(x)>=i.width/2-5)continue;const g=o+x;for(const y of[0,...Bi]){if(Math.abs(y)>=n.width/2-5)continue;const S=a+y;p.push({pts:[{x:S,y:h},{x:S,y:w},{x:g,y:w},{x:g,y:v}],cost:m+Math.abs(x)+Math.abs(y)})}}return p}const mc=30;function zm(e,t){for(let n=1;n<e.length-2;n++){const i=e[n],r=e[n+1],o=kt(i.y,r.y)&&!kt(i.x,r.x),a=kt(i.x,r.x)&&!kt(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)<mc||Math.abs(i.y-(s.y+s.height))<mc)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)<mc||Math.abs(i.x-(s.x+s.width))<mc)return!0}}return!1}const gc=40;function uR(e,t,n){let i=0;for(const r of t){if(r.container||n.includes(r.id))continue;const o=r.x-gc,a=r.x+r.width+gc,s=r.y-gc,c=r.y+r.height+gc;for(let l=1;l<e.length-2;l++){const u=e[l],p=e[l+1],f={x:Math.min(u.x,p.x),y:Math.min(u.y,p.y)},d={x:Math.max(u.x,p.x),y:Math.max(u.y,p.y)};if(f.x<a&&d.x>o&&f.y<c&&d.y>s){i++;break}}}return i}function Gm(e,t){if(e.type!=="bpmn:SequenceFlow")return null;const n=t.shapes.filter(E=>E.container),i=new Map(t.shapes.map(E=>[E.id,E])),r=ai(t),o=t.edges.filter(E=>E.id!==e.id),a=ri(e,o),s=oi(e,o),c=E=>uR(E,t.shapes,e.endpoints)+(zm(E,n)?1:0),l=c(e.waypoints),u=E=>{if(!E)return;const T=E.x+E.width/2,k=E.y+E.height/2;return n.find(I=>I.type==="bpmn:Lane"&&T>=I.x&&T<=I.x+I.width&&k>=I.y&&k<=I.y+I.height)},p=u(i.get(e.endpoints[0]??"")),f=u(i.get(e.endpoints[1]??"")),d=!!p&&!!f&&p.id!==f.id,h=E=>{if(!d||!f)return!1;for(let T=1;T<E.length-2;T++){const k=E[T],I=E[T+1];if(kt(k.y,I.y)&&!kt(k.x,I.x)&&k.y>f.y&&k.y<f.y+f.height)return!0}return!1},m=h(e.waypoints),w=(E=>{if(!E)return;const T=E.x+E.width/2,k=E.y+E.height/2;return n.filter(I=>I.type==="bpmn:Participant"&&T>=I.x&&T<=I.x+I.width&&k>=I.y&&k<=I.y+I.height).sort((I,P)=>I.width*I.height-P.width*P.height)[0]})(i.get(e.endpoints[0]??"")),x=E=>{if(!w)return 0;let T=0;for(let k=1;k<E.length-1;k++){const I=E[k];(I.x<w.x||I.x>w.x+w.width||I.y<w.y||I.y>w.y+w.height)&&T++}return T},g=x(e.waypoints);if(!zm(e.waypoints,n)&&!(d&&!m)&&g===0)return null;const y=E=>E.reduce((T,k,I)=>I?T+Math.abs(k.x-E[I-1].x)+Math.abs(k.y-E[I-1].y):0,0);let S;for(const{pts:E,cost:T}of hc(e,i)){const k={...e,waypoints:E};if(_n(k,r).length>0)continue;const I=ri(k,o);if(I>a)continue;const P=x(E);if(P>g)continue;const O=P<g&&I===0;if(!O&&oi(k,o)>s)continue;const F=c(E),Z=h(E);if(!O&&!(Z&&!m)&&F>=l)continue;const Me=Z?0:1,Be=y(E);(!S||P<S.out||P===S.out&&(Me<S.lane||Me===S.lane&&(I<S.opp||I===S.opp&&(F<S.sc||F===S.sc&&(T<S.cost||T===S.cost&&Be<S.len)))))&&(S={pts:E,out:P,sc:F,lane:Me,opp:I,cost:T,len:Be})}return(S==null?void 0:S.pts)??null}function pR(e,t){if(e.type!=="bpmn:SequenceFlow"||e.endpoints.length!==2)return!1;const[n,i]=e.endpoints,r=t.edges.filter(p=>p.type==="bpmn:SequenceFlow"&&p.endpoints.length===2),o=r.filter(p=>p.endpoints[1]===i),a=r.filter(p=>p.endpoints[0]===i);if(o.length!==1||a.length!==1)return!1;const s=t.shapes.find(p=>p.id===n),c=t.shapes.find(p=>p.id===i),l=t.shapes.find(p=>p.id===a[0].endpoints[1]);if(!s||!c||!l||!(s.x+s.width<c.x&&c.x+c.width<l.x))return!1;const u=s.y+s.height/2;return u<l.y||u>l.y+l.height?!1:u<c.y||u>c.y+c.height}function fR(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Xe(i).edges.filter(a=>(!t.has(a.id)||n.has(a.id))&&a.waypoints.length>=4).map(a=>a.id).sort();for(const a of o){const s=Xe(i),c=s.edges.find(v=>v.id===a);if(!c||c.waypoints.length<4)continue;const l=ai(s),u=s.edges.filter(v=>v.id!==a),p=_n(c,l).length,f=ri(c,u),d=oi(c,u),h=n.has(a)?new Set(mt(s).map(ft)):null,m=dc(c,s.shapes);m.length===2&&pR(c,s)&&m.reverse();for(const v of m){if(v.length>=c.waypoints.length)continue;const w={...c,waypoints:v};if(_n(w,l).length>p||ri(w,u)>f||oi(w,u)>d)continue;if(h){const g=new Set(mt({...s,edges:s.edges.map(E=>E.id===a?w:E)}).map(ft)),y=[...g].filter(E=>!h.has(E)).length,S=[...h].filter(E=>!g.has(E)).length;if(y>S)continue}const x=i.get(a);x&&r.updateWaypoints(x,v);break}}}function Vm(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Xe(n).edges.filter(o=>o.type==="bpmn:SequenceFlow"&&!t.has(o.id)).map(o=>o.id).sort();for(const o of r){const a=Xe(n),s=a.edges.find(u=>u.id===o);if(!s)continue;const c=Gm(s,a);if(!c)continue;const l=n.get(o);l&&i.updateWaypoints(l,c)}}function vp(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=kt(n[0].x,n[1].x)&&!kt(n[0].y,n[1].y),s=kt(n[n.length-1].x,n[n.length-2].x)&&!kt(n[n.length-1].y,n[n.length-2].y);for(const c of Bi){if(a&&r&&Math.abs(c)<r.width/2-5){const l=n.map(u=>({...u}));l[0].x+=c,l[1].x+=c,i.push({pts:l,cost:Math.abs(c)})}if(s&&o&&Math.abs(c)<o.width/2-5){const l=n.map(u=>({...u}));l[l.length-1].x+=c,l[l.length-2].x+=c,i.push({pts:l,cost:Math.abs(c)})}}return i}function dR(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(Math.min(n.x+n.width,i.x+i.width)-Math.max(n.x,i.x)>=1)return[];const r=i.y+i.height<=n.y,o=n.y+n.height<=i.y;if(!r&&!o)return[];const a=i.x>=n.x+n.width,s=i.x+i.width<=n.x;if(!a&&!s)return[];const c=n.x+n.width/2,l=n.y+n.height/2,u=i.x+i.width/2,p=i.y+i.height/2,f=a?n.x+n.width:n.x,d=o?n.y+n.height:n.y,h=a?i.x:i.x+i.width,m=o?i.y:i.y+i.height,v=[];for(const w of[0,...Bi])Math.abs(w)<i.width/2-5&&v.push({pts:[{x:f,y:l},{x:u+w,y:l},{x:u+w,y:m}],cost:Math.abs(w)}),Math.abs(w)<i.height/2-5&&v.push({pts:[{x:c,y:d},{x:c,y:p+w},{x:h,y:p+w}],cost:Math.abs(w)});return v}function bp(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[];const r=Math.max(n.x,i.x),o=Math.min(n.x+n.width,i.x+i.width);if(o-r<1)return[];const a=i.y+i.height<=n.y,s=n.y+n.height<=i.y;if(!a&&!s)return[];const c=a?n.y:n.y+n.height,l=a?i.y+i.height:i.y,u=(r+o)/2,p=[];for(const f of[0,...Bi]){const d=u+f;d<=r||d>=o||p.push({pts:[{x:d,y:c},{x:d,y:l}],cost:Math.abs(f)})}return p}function Wm(e,t){const n=new Map(t.shapes.map(d=>[d.id,d])),i=ai(t),r=t.edges.filter(d=>d.id!==e.id),o=ri(e,r);if(o===0)return null;const a=oi(e,r);let s;const c=d=>d.reduce((h,m,v)=>v?h+Math.abs(m.x-d[v-1].x)+Math.abs(m.y-d[v-1].y):0,0),l=3,u=d=>{const h=d[0],m=d[d.length-1],v=Math.hypot(m.x-h.x,m.y-h.y);return v>=1&&c(d)/v>=l?1:0},p=u(e.waypoints),f=[...hc(e,n),...bp(e,n),...vp(e,n)];for(const{pts:d,cost:h}of f){const m={...e,waypoints:d};if(_n(m,i).length>0)continue;const v=ri(m,r),w=oi(m,r),x=o-v+(p-u(d));if(v>=o||w-a>x)continue;const g=c(d);(!s||v<s.opposite||v===s.opposite&&(w<s.cross||w===s.cross&&(h<s.cost||h===s.cost&&g<s.len)))&&(s={pts:d,opposite:v,cross:w,cost:h,len:g})}return(s==null?void 0:s.pts)??null}function Um(e,t){var i;let n=0;for(const r of t)r.id!==e.id&&((i=Fo(e,r))==null?void 0:i.kind)==="unrelated"&&n++;return n}function hR(e,t){const n=new Map(t.shapes.map(f=>[f.id,f])),i=ai(t),r=t.edges.filter(f=>f.id!==e.id),o=Um(e,r);if(o===0)return null;const a=ri(e,r),s=oi(e,r),c=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),l=2;let u;const p=[...hc(e,n),...bp(e,n),...dR(e,n),...vp(e,n)];for(const{pts:f,cost:d}of p){const h={...e,waypoints:f};if(_n(h,i).length>0)continue;const m=Um(h,r);if(m>=o)continue;const v=ri(h,r);if(v-m>a-o)continue;const w=oi(h,r);if(w-s>(o-m)*l)continue;const x=c(f);(!u||m<u.fake||m===u.fake&&(v<u.unreadable||v===u.unreadable&&(w<u.cross||w===u.cross&&(d<u.cost||d===u.cost&&x<u.length))))&&(u={pts:f,fake:m,unreadable:v,cross:w,cost:d,length:x})}return(u==null?void 0:u.pts)??null}function qm(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=mt(Xe(i)).filter(s=>s.kind==="edge-overlap-unrelated"&&!t.has(ft(s)));if(!o.length)return;const a=new Set;for(const s of o)if(s.kind==="edge-overlap-unrelated")for(const c of s.edges)n.has(c)||a.add(c);for(const s of[...a].sort()){const c=Xe(i),l=c.edges.find(f=>f.id===s);if(!l)continue;const u=hR(l,c);if(!u)continue;const p=i.get(s);p&&r.updateWaypoints(p,u)}}function Ym(e,t){const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");return!!n&&!!i&&i.x+i.width>n.x}function Km(e,t,n){var l;if(e.type!=="bpmn:SequenceFlow"||t.type!=="bpmn:SequenceFlow"||((l=Fo(e,t))==null?void 0:l.kind)!=="opposite")return!1;const[i,r]=e.endpoints,[o,a]=t.endpoints,s=[i,r].filter(u=>u&&(u===o||u===a)).length;return!(!!r&&r===o||!!a&&a===i)||s!==1?!1:Ym(e,n)&&Ym(t,n)}function Xm(e,t,n){let i=0;for(const r of t)r.id!==e.id&&Km(e,r,n)&&i++;return i}function mR(e,t){const n=new Map(t.shapes.map(f=>[f.id,f])),i=ai(t),r=t.edges.filter(f=>f.id!==e.id),o=Xm(e,r,n);if(o===0)return null;const a=ri(e,r),s=oi(e,r),c=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),l=2;let u;const p=[...hc(e,n),...bp(e,n),...vp(e,n)];for(const{pts:f,cost:d}of p){const h={...e,waypoints:f};if(_n(h,i).length>0)continue;const m=Xm(h,r,n);if(m>=o)continue;const v=ri(h,r);if(v-m>a-o)continue;const w=oi(h,r);if(w-s>(o-m)*l)continue;const x=c(f);(!u||m<u.chain||m===u.chain&&(v<u.unreadable||v===u.unreadable&&(w<u.cross||w===u.cross&&(d<u.cost||d===u.cost&&x<u.length))))&&(u={pts:f,chain:m,unreadable:v,cross:w,cost:d,length:x})}return(u==null?void 0:u.pts)??null}function gR(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Xe(i),a=new Map(o.shapes.map(l=>[l.id,l])),s=mt(o).filter(l=>l.kind==="edge-overlap-opposite"&&!t.has(ft(l)));if(!s.length)return;const c=new Set;for(const l of s){if(l.kind!=="edge-overlap-opposite")continue;const[u,p]=l.edges.map(f=>o.edges.find(d=>d.id===f));if(!(!u||!p||!Km(u,p,a)))for(const f of l.edges)n.has(f)||c.add(f)}for(const l of[...c].sort()){const u=Xe(i),p=u.edges.find(h=>h.id===l);if(!p)continue;const f=mR(p,u);if(!f)continue;const d=i.get(l);d&&r.updateWaypoints(d,f)}}function Zm(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Xe(i),a=mt(o).filter(u=>up(u)&&!t.has(ft(u)));if(!a.length)return;const s=new Set;for(const u of a)if(up(u))for(const p of u.edges)n.has(p)||s.add(p);const c=u=>{var p;return((p=o.edges.find(f=>f.id===u))==null?void 0:p.type)??""},l=[...s].sort((u,p)=>{const f=c(u)==="bpmn:SequenceFlow"?0:1,d=c(p)==="bpmn:SequenceFlow"?0:1;return f!==d?f-d:u.localeCompare(p)});for(const u of l){const p=Xe(i),f=p.edges.find(m=>m.id===u);if(!f)continue;const d=Wm(f,p);if(!d)continue;const h=i.get(u);h&&r.updateWaypoints(h,d)}}const yR=10,vR=(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 Qm(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!lc(e,i))return null;const r=ai(t),o=i.flatMap(mn);for(const a of mn(e)){let s=[[a.lo,a.hi]];for(const[d,h]of cc(a,o))s=s.flatMap(([m,v])=>{const w=[];return d>m&&w.push([m,Math.min(v,d)]),h<v&&w.push([Math.max(m,h),v]),w.filter(([x,g])=>g>x)});const c=a.axis==="h"?n.width:n.height,l=s.find(([d,h])=>h-d>=c+yR*2);if(!l)continue;const u=(l[0]+l[1])/2,p=a.axis==="h"?{x:u,y:a.at-ym}:{x:a.at+wn+n.width/2,y:u},f={x:p.x-n.width/2,y:p.y-n.height/2,width:n.width,height:n.height};if(!lc({...e,label:f},i)&&!r.some(d=>!e.endpoints.includes(d.id)&&vR(f,d)))return f}return null}const wn=8;function xp(e,t){const n=e.label;if(!n)return null;const i=mn(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(mn),...t.shapes.filter(f=>f.container).flatMap(Ho)],l=f=>!c.some(d=>Ii(f,d));if(l(n))return null;const u=(s.axis==="v"?n.height:n.width)+wn,p=[0,-u,u,-2*u,2*u];if(s.axis==="v")for(const f of[s.at+wn,s.at-wn-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(l(m))return m}else for(const f of[s.at-wn-n.height,s.at+wn])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(l(m))return m}return null}const Jm=30,bR=(e,t)=>{let n=1/0;for(let i=0;i+1<t.length;i++){const r=t[i],o=t[i+1],a=o.x-r.x,s=o.y-r.y,c=a*a+s*s,l=c?Math.max(0,Math.min(1,((e.x-r.x)*a+(e.y-r.y)*s)/c)):0;n=Math.min(n,Math.hypot(e.x-(r.x+l*a),e.y-(r.y+l*s)))}return n},eg=(e,t)=>bR({x:e.x+e.width/2,y:e.y+e.height/2},t);function xR(e,t){const n=e.label;if(!n)return null;const i=mn(e);if(!i.length)return null;const r=[...i,...t.edges.filter(c=>c.id!==e.id).flatMap(mn),...t.shapes.filter(c=>c.container).flatMap(Ho)],o=io(t).filter(c=>c.owner!==e.id).map(c=>c.rect),a=(c,l)=>c.x<l.x+l.width&&l.x<c.x+c.width&&c.y<l.y+l.height&&l.y<c.y+c.height,s=c=>!r.some(l=>Ii(c,l))&&!Na(c,t).length&&!o.some(l=>a(c,l));for(const c of i){const l=(c.lo+c.hi)/2,u=c.axis==="h"?[c.at+wn,c.at-wn-n.height].map(p=>({...n,x:l-n.width/2,y:p})):[c.at+wn,c.at-wn-n.width].map(p=>({...n,x:p,y:l-n.height/2}));for(const p of u)if(s(p))return p}return null}function tg(e,t){var a,s;const{elementRegistry:n}=e,i=e.modeling;let r=Xe(n),o=new Set(mt(r).map(ft));for(const[c,l]of t){const u=l.wps,p=n.get(c),f=p==null?void 0:p.label;if(!f||!(p!=null&&p.waypoints))continue;const d=p.waypoints[0].x-u[0].x,h=p.waypoints[0].y-u[0].y;if(!(p.waypoints.length===u.length&&p.waypoints.every((E,T)=>E.x-u[T].x===d&&E.y-u[T].y===h))){if(((a=p.source)==null?void 0:a.id)===l.source&&((s=p.target)==null?void 0:s.id)===l.target)continue;const E=r.edges.find(O=>O.id===c);if(!(E!=null&&E.label)||!Na(E.label,r).length)continue;let T={...E.label,x:l.label.x,y:l.label.y};if((Na(T,r).length||eg(T,E.waypoints)>Jm)&&(T=null),!T&&eg(E.label,E.waypoints)>Jm&&(T=xR(E,r)),!T)continue;const k=T,I={...r,edges:r.edges.map(O=>O.id===c?{...O,label:k}:O)},P=mt(I);if(P.some(O=>!o.has(ft(O))))continue;i.moveElements([f],{x:k.x-f.x,y:k.y-f.y}),r=I,o=new Set(P.map(ft));continue}const v=l.label.x+d-f.x,w=l.label.y+h-f.y;if(v===0&&w===0)continue;const x=r.edges.find(E=>E.id===c);if(!(x!=null&&x.label))continue;const g={...x.label,x:x.label.x+v,y:x.label.y+w},y={...r,edges:r.edges.map(E=>E.id===c?{...E,label:g}:E)},S=mt(y);S.some(E=>!o.has(ft(E)))||(i.moveElements([f],{x:v,y:w}),r=y,o=new Set(S.map(ft)))}}function ng(e,t,n=new Set){const{elementRegistry:i}=e,r=e.modeling,o=Xe(i);for(const a of o.edges){if(!a.label||t.has(a.id)&&!n.has(a.id))continue;const s=xp(a,o);if(!s)continue;const c=i.get(a.id),l=c==null?void 0:c.label;l&&r.moveElements([l],{x:s.x-l.x,y:s.y-l.y})}}function ig(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Xe(i),a=mt(o).filter(s=>s.kind==="label-on-shared-segment"&&!t.has(ft(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 l=Qm(c,o);if(!l)continue;const u=i.get(s.edge),p=u==null?void 0:u.label;p&&r.moveElements([p],{x:l.x-p.x,y:l.y-p.y})}}function rg(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(mn),...t.shapes.filter(f=>f.container).flatMap(Ho)],r=i.filter(f=>Ii(n,f));if(!r.length)return null;const o=t.shapes.filter(f=>!f.container&&f.id!==e.id),a=io(t).filter(f=>f.owner!==e.id).map(f=>f.rect),s=(f,d)=>f.x<d.x+d.width&&d.x<f.x+f.width&&f.y<d.y+d.height&&d.y<f.y+f.height,c=f=>!i.some(d=>Ii(f,d))&&!o.some(d=>s(f,d))&&!a.some(d=>s(f,d)),l=[];for(const f of r)f.axis==="h"?l.push({...n,y:f.at-wn-n.height},{...n,y:f.at+wn}):l.push({...n,x:f.at-wn-n.width},{...n,x:f.at+wn});const u=e.x+e.width/2,p=e.y+e.height/2;return l.push({...n,x:u-n.width/2,y:e.y+e.height+wn},{...n,x:u-n.width/2,y:e.y-wn-n.height},{...n,x:e.x+e.width+wn,y:p-n.height/2},{...n,x:e.x-wn-n.width,y:p-n.height/2}),l.find(c)??null}function og(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Xe(n);for(const o of r.shapes){if(o.container||!o.label||t.has(o.id))continue;const a=rg(o,Xe(n));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 _R(e,t){const n=e.x,i=e.x+e.width,r=e.y,o=e.y+e.height;if(t.x<n||t.x>i||t.y<r||t.y>o)return{x:Math.round(Math.min(Math.max(t.x,n),i)),y:Math.round(Math.min(Math.max(t.y,r),o))};const s=[[t.x-n,{x:n,y:t.y}],[i-t.x,{x:i,y:t.y}],[t.y-r,{x:t.x,y:r}],[o-t.y,{x:t.x,y:o}]].reduce((c,l)=>l[0]<c[0]?l:c);return{x:Math.round(s[1].x),y:Math.round(s[1].y)}}function ag(e,t){const{elementRegistry:n}=e,i=e.modeling;let r=Xe(n),o=new Set(mt(r).map(ft));const a=[...new Set(mt(r).filter(s=>s.kind==="edge-endpoint-detached"&&!t.has(ft(s))).map(s=>s.edge))].sort();for(const s of a){const c=r.edges.find(m=>m.id===s);if(!c||c.waypoints.length<2)continue;const l=c.waypoints.map(m=>({...m})),u=[[c.endpoints[0],0],[c.endpoints[1],l.length-1]];let p=!1;for(const[m,v]of u){const w=m?r.shapes.find(g=>g.id===m):void 0;if(!w)continue;const x=_R(w,l[v]);x.x===l[v].x&&x.y===l[v].y||(l[v]=x,p=!0)}if(!p)continue;const f={...r,edges:r.edges.map(m=>m.id===s?{...m,waypoints:l}:m)},d=mt(f);if(d.some(m=>!o.has(ft(m))))continue;const h=n.get(s);h&&(i.updateWaypoints(h,l),r=f,o=new Set(d.map(ft)))}}const wR=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,sg=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),cg={"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}]},yc=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),_p=e=>typeof e=="string"&&e!=="";function ER(e){const t=[];function n(i,r,o,a){if(a===null){_p(o)||t.push({kind:"payload-invalid",opIndex:i,field:r});return}if(!yc(o)){t.push({kind:"payload-invalid",opIndex:i,field:r});return}for(const s of a)_p(o[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${r}.${s}`})}return e.forEach((i,r)=>{var o,a,s;if(!yc(i)||!_p(i.kind)||!(i.kind in cg)){t.push({kind:"payload-invalid",opIndex:r,field:"kind"});return}for(const c of cg[i.kind]){const l=c.path.endsWith("[]"),u=l?c.path.slice(0,-2):c.path,p=u.split(".");let f=i;for(const h of p.slice(0,-1)){if(!yc(f))break;f=f[h]}if(!yc(f))continue;const d=f[p[p.length-1]];if(!(d===void 0&&c.optional)&&!(d===null&&c.optional)){if(!l){n(r,c.path,d,c.shape);continue}if(!Array.isArray(d)){t.push({kind:"payload-invalid",opIndex:r,field:c.path});continue}d.forEach((h,m)=>n(r,`${u}[${m}]`,h,c.shape))}}if(i.kind==="node.add"||i.kind==="node.update"){const c=i.band;c!==void 0&&(!Number.isInteger(c)||c<0)&&t.push({kind:"payload-invalid",opIndex:r,field:"band"});const l=i.kind==="node.add"?(o=i.node)==null?void 0:o.type:i.type,u=(i.kind==="node.add"?(a=i.node)==null?void 0:a.id:i.id)??"";if(typeof l=="string"&&!Lh(l)){t.push({kind:"node-type-unsupported",opIndex:r,id:u,type:l});return}const p=i.kind==="node.add"?(s=i.node)==null?void 0:s.eventDefinition:i.eventDefinition;if(p!==void 0&&!Ih(p)){t.push({kind:"payload-invalid",opIndex:r,field:i.kind==="node.add"?"node.eventDefinition":"eventDefinition"});return}l==="intermediateCatchEvent"!==(p!==void 0)&&t.push({kind:"event-definition-mismatch",opIndex:r,id:u,...typeof l=="string"?{type:l}:{},...p!==void 0?{eventDefinition:p}:{}})}}),t}function lg(e,t){const n=ER(e);if(n.length>0)return n;const i=[],r=new Map,o=new Map;function a(h,m,v){if(!wR.test(m)){i.push({kind:"id-invalid",opIndex:h,id:m});return}if(t.categoryOf(m)!==void 0||r.has(m)){i.push({kind:"id-duplicate",opIndex:h,id:m});return}r.set(m,{...v,opIndex:h})}e.forEach((h,m)=>{var v;switch(h.kind){case"participant.add":a(m,h.participant.id,{category:"participant",lanes:(h.participant.lanes??[]).map(w=>w.id)});for(const w of h.participant.lanes??[])a(m,w.id,{category:"lane"});break;case"node.add":a(m,h.node.id,{category:"flowNode",participant:h.node.participant});break;case"sequenceFlow.add":a(m,h.flow.id,{category:"sequenceFlow"});break;case"messageFlow.add":a(m,h.flow.id,{category:"messageFlow"});break;case"dataStore.add":a(m,h.dataStore.id,{category:"dataStore"});for(const w of h.associations??[])w.id&&a(m,w.id,{category:"dataAssociation"});break;case"dataAssociation.add":h.association.id&&a(m,h.association.id,{category:"dataAssociation"});break;case"association.add":h.association.id&&a(m,h.association.id,{category:"association"});break;case"annotation.add":a(m,h.annotation.id,{category:"annotation"}),(v=h.association)!=null&&v.id&&a(m,h.association.id,{category:"association"});break;case"group.add":a(m,h.group.id,{category:"group"});break;case"participant.update":if(h.lanes){o.set(h.id,h.lanes.map(w=>w.id));for(const w of h.lanes)t.categoryOf(w.id)===void 0&&a(m,w.id,{category:"lane"})}break}});const s=h=>{var m;return((m=r.get(h))==null?void 0:m.category)??t.categoryOf(h)},c=h=>{const m=r.get(h);return m?m.category==="participant"?h:m.participant:t.categoryOf(h)==="participant"?h:t.participantOf(h)};function l(h,m,v,w){const x=s(m);if(x===void 0){i.push({kind:"ref-missing",opIndex:h,ref:m,role:v});return}if(w&&!w.includes(x)){i.push({kind:"ref-category",opIndex:h,ref:m,role:v,expected:w.join("|"),actual:x});return}return x}const u=t.isCollaboration()||e.some(h=>h.kind==="participant.add"),p=new Map;for(const h of e)h.kind==="node.add"?p.set(h.node.id,h.node.eventDefinition):h.kind==="node.update"&&h.type!==void 0&&p.set(h.id,h.eventDefinition);const f=h=>p.has(h)?p.get(h)==="timer":t.eventDefinitionOf(h)==="timer";return e.forEach((h,m)=>{var v;switch(h.kind){case"participant.add":break;case"node.add":{const{participant:w,lane:x}=h.node;if(w===void 0){(u||x!==void 0)&&i.push({kind:"participant-required",opIndex:m,id:h.node.id});break}if(l(m,w,"participant",["participant"])===void 0)break;x!==void 0&&((((v=r.get(w))==null?void 0:v.lanes)??o.get(w)??t.lanesOf(w)).includes(x)||i.push({kind:"lane-unknown",opIndex:m,lane:x,participant:w}));break}case"sequenceFlow.add":{const{id:w,source:x,target:g,name:y,condition:S}=h.flow,E=l(m,x,"source",["flowNode"]),T=l(m,g,"target",["flowNode"]);E&&T&&c(x)!==c(g)&&i.push({kind:"flow-cross-pool",opIndex:m,id:w}),y!==void 0&&S!==void 0&&i.push({kind:"condition-name-conflict",opIndex:m,id:w});break}case"messageFlow.add":{const{id:w,source:x,target:g}=h.flow,y=l(m,x,"source",["flowNode","participant"]),S=l(m,g,"target",["flowNode","participant"]);if(y&&S){const E=c(x),T=c(g);E!==void 0&&E===T&&i.push({kind:"message-flow-same-pool",opIndex:m,id:w})}for(const E of[x,g])f(E)&&i.push({kind:"message-flow-timer-endpoint",opIndex:m,id:w,ref:E});break}case"dataStore.add":{for(const w of h.associations??[]){if([w.source,w.target].filter(y=>y===h.dataStore.id).length!==1){i.push({kind:"data-association-ends",opIndex:m,source:w.source,target:w.target});continue}const g=w.source===h.dataStore.id?w.target:w.source;l(m,g,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:w,target:x}=h.association,g=l(m,w,"source"),y=l(m,x,"target");if(g&&y){const S=new Set([g,y]);S.has("dataStore")&&S.has("flowNode")||i.push({kind:"data-association-ends",opIndex:m,source:w,target:x})}break}case"association.add":{const{id:w,source:x,target:g}=h.association,y=l(m,x,"source"),S=l(m,g,"target");y&&S&&y!=="annotation"&&S!=="annotation"&&i.push({kind:"association-detached",opIndex:m,annotation:w??`${x}->${g}`});break}case"annotation.add":{if(h.association){const{source:w,target:x}=h.association;if(w!==h.annotation.id&&x!==h.annotation.id)i.push({kind:"association-detached",opIndex:m,annotation:h.annotation.id});else{const g=w===h.annotation.id?x:w;l(m,g,"association")}}h.placement&&l(m,h.placement.anchor,"anchor");break}case"group.add":{for(const w of h.group.members??[]){const x=l(m,w,"member");x&&sg.has(x)&&i.push({kind:"ref-category",opIndex:m,ref:w,role:"member",expected:"shape",actual:x})}break}case"participant.update":{if(d(m,h.id,"participant")===void 0)break;if(h.lanes){const w=t.lanesOf(h.id),x=h.lanes.map(y=>y.id);for(const y of w)x.includes(y)||i.push({kind:"lane-shrink-unsupported",opIndex:m,participant:h.id,lane:y});for(const y of x)t.categoryOf(y)!==void 0&&!w.includes(y)&&i.push({kind:"id-duplicate",opIndex:m,id:y});const g=x.filter(y=>w.includes(y));g.length===w.length&&g.some((y,S)=>y!==w[S])&&i.push({kind:"lane-reorder-unsupported",opIndex:m,participant:h.id})}break}case"node.update":{if(d(m,h.id,"flowNode")===void 0)break;if(h.lane!==void 0){const w=t.participantOf(h.id);(w?o.get(w)??t.lanesOf(w):[]).includes(h.lane)||i.push({kind:"lane-unknown",opIndex:m,lane:h.lane,participant:w??""})}break}case"sequenceFlow.update":{if(d(m,h.id,"sequenceFlow")===void 0)break;if(h.name!==void 0&&h.condition!==void 0&&i.push({kind:"condition-name-conflict",opIndex:m,id:h.id}),h.source!==void 0||h.target!==void 0){const w=h.source===void 0||l(m,h.source,"source",["flowNode"])!==void 0,x=h.target===void 0||l(m,h.target,"target",["flowNode"])!==void 0,g=t.endpointsOf(h.id),y=h.source??(g==null?void 0:g.source),S=h.target??(g==null?void 0:g.target);w&&x&&y!==void 0&&S!==void 0&&new Set([c(y),c(S),c(h.id)]).size>1&&i.push({kind:"flow-cross-pool",opIndex:m,id:h.id})}break}case"messageFlow.update":d(m,h.id,"messageFlow");break;case"dataStore.update":d(m,h.id,"dataStore");break;case"annotation.update":{if(d(m,h.id,"annotation")===void 0)break;h.placement&&l(m,h.placement.anchor,"anchor");break}case"group.update":{if(d(m,h.id,"group")===void 0)break;for(const w of h.members??[]){const x=l(m,w,"member");x&&sg.has(x)&&i.push({kind:"ref-category",opIndex:m,ref:w,role:"member",expected:"shape",actual:x})}break}case"element.remove":{d(m,h.id)==="lane"&&i.push({kind:"ref-category",opIndex:m,ref:h.id,role:"target",expected:"removable",actual:"lane"});break}}}),i;function d(h,m,v){if(r.has(m)){i.push({kind:"target-added-in-batch",opIndex:h,id:m});return}const w=t.categoryOf(m);if(w===void 0){i.push({kind:"ref-missing",opIndex:h,ref:m,role:"target"});return}if(v&&w!==v){i.push({kind:"ref-category",opIndex:h,ref:m,role:"target",expected:v,actual:w});return}return w}}function ug(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"),spaceTool:e.get("spaceTool")}}function vc(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const bc={"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]},En=10,SR=300,RR=160,pg=20,fg=40,CR=10;function wp(e,t,n,i,r){const o=n,a=(P,O)=>{const[F,Z]=bc[P];let he={x:t.x+t.width/2+F*(t.width/2+o.width/2+O),y:t.y+t.height/2+Z*(t.height/2+o.height/2+O)};const Me=i.x+En+o.width/2,Be=i.x+i.width-En-o.width/2,nt=i.y+En+o.height/2,J=i.y+i.height-En-o.height/2,te={x:Math.min(Be,Math.max(Me,he.x)),y:Math.min(J,Math.max(nt,he.y))};return(te.x!==he.x||te.y!==he.y)&&(he=Math.abs(te.x-(t.x+t.width/2))<(t.width+o.width)/2+En&&Math.abs(te.y-(t.y+t.height/2))<(t.height+o.height)/2+En?{x:t.x+t.width+En+o.width/2,y:te.y}:te),he},s=(i.children??[]).filter(P=>!("waypoints"in P&&P.waypoints)&&P.type!=="bpmn:Lane"&&P.type!=="label"&&typeof P.x=="number"&&P.id!==r.selfId),c=Xe(e),l=P=>{var F,Z;if(!r.selfId)return!1;const O=e.get(P);return!!O&&(((F=O.source)==null?void 0:F.id)===r.selfId||((Z=O.target)==null?void 0:Z.id)===r.selfId)},u=c.edges.filter(P=>!l(P.id)).flatMap(mn),p=io(c).filter(P=>P.owner!==r.selfId).map(P=>P.rect),f=P=>({x0:P.x-o.width/2-En,x1:P.x+o.width/2+En,y0:P.y-o.height/2-En,y1:P.y+o.height/2+En}),d=P=>{const O=f(P);return s.some(F=>O.x0<F.x+F.width&&O.x1>F.x&&O.y0<F.y+F.height&&O.y1>F.y)},h=P=>{const O=f(P);return u.some(F=>F.axis==="h"?F.at>O.y0&&F.at<O.y1&&F.lo<O.x1&&F.hi>O.x0:F.at>O.x0&&F.at<O.x1&&F.lo<O.y1&&F.hi>O.y0)},m=P=>{const O=f(P);return p.some(F=>O.x0<F.x+F.width&&O.x1>F.x&&O.y0<F.y+F.height&&O.y1>F.y)},v=c.shapes.filter(P=>P.type==="bpmn:Group").flatMap(P=>[{axis:"h",at:P.y,lo:P.x,hi:P.x+P.width},{axis:"h",at:P.y+P.height,lo:P.x,hi:P.x+P.width},{axis:"v",at:P.x,lo:P.y,hi:P.y+P.height},{axis:"v",at:P.x+P.width,lo:P.y,hi:P.y+P.height}]),w=P=>{const O=f(P);return v.some(F=>F.axis==="h"?F.at>O.y0&&F.at<O.y1&&F.lo<O.x1&&F.hi>O.x0:F.at>O.x0&&F.at<O.x1&&F.lo<O.y1&&F.hi>O.y0)},x=P=>d(P)||h(P)||m(P)||w(P),g=P=>P.x-o.width/2>=i.x&&P.x+o.width/2<=i.x+i.width&&P.y-o.height/2>=i.y&&P.y+o.height/2<=i.y+i.height;if(r.placement){const P=Be=>Be.startsWith("top")?Be.replace(/^top/,"bottom"):Be.replace(/^bottom/,"top"),O=Be=>Be.endsWith("left")?Be.replace(/left$/,"right"):Be.replace(/right$/,"left"),F=r.placement.side,Z=[F,P(F),O(F),P(O(F)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],he=r.placement.offset??50;let Me=a(F,he);if(x(Me)){const Be=new Set;for(const nt of Z){if(Be.has(nt))continue;Be.add(nt);const J=a(nt,he);if(g(J)&&!x(J)){Me=J;break}}}return Me}const y=r.from,S=i.x+En+o.width/2,E=i.x+i.width-En-o.width/2,T=i.y+En+o.height/2,k=i.y+i.height-En-o.height/2;let I={x:Math.min(E,Math.max(S,y.x)),y:Math.min(k,Math.max(T,y.y))};if(x(I)){const P=(t.width+o.width)/2+En,F=[{x:I.x+P,y:I.y},{x:I.x-P,y:I.y},{x:I.x,y:I.y-o.height-En},{x:I.x,y:I.y+o.height+En}].filter(g).find(Z=>!x(Z));F&&(I=F)}return I}function Qt(e,t){return e.filter(n=>n.kind===t)}class dg extends Error{constructor(t){super(t.kind),this.issue=t,this.name="LowerIssueError"}}function hg(e,t){var pE,fE,dE,hE,mE,gE,yE,vE,bE,xE,_E,wE,EE,SE,RE,CE,AE,ME,PE,TE,kE,OE,DE;const{modeling:n,bpmnFactory:i,elementFactory:r,elementRegistry:o,canvas:a,autoPlace:s,bpmnReplace:c,spaceTool:l}=t,u=()=>a.getRootElement(),p=b=>o.get(b),f=b=>{const A=p(b);if(!A)throw new Error(`하강 참조 해소 실패: ${b}`);return A},d=b=>{let A=b.parent;for(;A;){if(A.type==="bpmn:Participant")return A;A=A.parent}},h=new Map;for(const b of o.filter(A=>!("waypoints"in A&&A.waypoints)&&A.type!=="bpmn:Lane"&&A.type!=="label"&&typeof A.x=="number"))h.set(b.id,{x:b.x,y:b.y});const m=Qt(e,"participant.add"),v=Qt(e,"node.add"),w=Qt(e,"sequenceFlow.add"),x=Qt(e,"messageFlow.add"),g=Qt(e,"dataStore.add"),y=Qt(e,"dataAssociation.add"),S=Qt(e,"annotation.add"),E=Qt(e,"group.add"),T=new Map(v.map(b=>[b.node.id,b])),k=(b,A,M)=>{var j;const D=b.businessObject,$=(((j=D.extensionElements)==null?void 0:j.values)??[]).filter(B=>B.$type!==A),L=M?[...$,i.create(A,M)]:$;if(!L.length){D.extensionElements&&n.updateProperties(b,{extensionElements:void 0});return}const z=i.create("bpmn:ExtensionElements",{values:L});L.forEach(B=>{B.$parent=z}),n.updateProperties(b,{extensionElements:z})},I=b=>({anchor:b.anchor,side:b.side,...b.offset!==void 0?{offset:b.offset}:{}});for(const b of Qt(e,"element.remove")){const A=p(b.id);A&&n.removeElements([A])}const P=b=>o.filter(A=>{var M;return A.type==="bpmn:Lane"&&((M=d(A))==null?void 0:M.id)===b}).sort((A,M)=>A.y-M.y);for(const b of Qt(e,"participant.update")){const A=f(b.id);if(b.name!==void 0&&n.updateProperties(A,{name:b.name??void 0}),!b.lanes)continue;const M=P(b.id);if(!M.length){n.splitLane(A,b.lanes.length),P(b.id).forEach(($,L)=>{const z=b.lanes[L];z&&n.updateProperties($,{id:z.id,name:z.name})});continue}const D=new Set(M.map($=>$.id));b.lanes.forEach(($,L)=>{if(D.has($.id)){n.updateProperties(f($.id),{name:$.name});return}const z=L===0?n.addLane(P(b.id)[0],"top"):n.addLane(f(b.lanes[L-1].id),"bottom");n.updateProperties(z,{id:$.id,name:$.name})})}const O=150,F=130,Z=80,he=90,Me=180,Be=30,nt=30,J=(b,A,M,D,$)=>{const L=M-A.width/2,z=D-A.height/2;return(b.children??[]).find(j=>!("waypoints"in j&&j.waypoints)&&j.type!=="bpmn:Lane"&&j.type!=="label"&&!($!=null&&$.has(j.id))&&typeof j.x=="number"&&L<j.x+j.width+nt&&L+A.width+nt>j.x&&z<j.y+j.height&&z+A.height>j.y)},te=new Set;for(const b of m){te.add(`pool:${b.participant.id}`);for(const A of b.participant.lanes??[])te.add(A.id)}const pe=new Map;for(const b of v){const A=b.node.lane??`pool:${b.node.participant??""}`;let M=pe.get(A);M||pe.set(A,M=new Set([0])),b.band!==void 0&&M.add(b.band)}const xe=new Map;for(const[b,A]of pe){if(!te.has(b))continue;const M=[...A].sort((L,z)=>L-z),D=M.map((L,z)=>z===0?0:z%2===1?Math.ceil(z/2):-(z/2)),$=Math.min(...D);xe.set(b,new Map(M.map((L,z)=>[L,D[z]-$])))}{const b=new Map;for(const A of m)(A.participant.lanes??[]).forEach((M,D)=>b.set(M.id,D));for(const[A,M]of xe){if(!b.has(A)||M.size<2)continue;const D=b.get(A),$=M.get(0)??0,L=new Set;for(const Q of v){if(Q.node.lane!==A||(Q.band??0)!==0||!Q.node.type.endsWith("Gateway"))continue;const fe={in:new Set,out:new Set,cross:new Set};for(const ye of w){const Ce=ye.flow.source===Q.node.id;if(!Ce&&ye.flow.target!==Q.node.id)continue;const lt=T.get(Ce?ye.flow.target:ye.flow.source);if(!lt||lt.node.participant!==Q.node.participant||!lt.node.lane)continue;let Ae,ne=!1;if(lt.node.lane!==A){const le=b.get(lt.node.lane);if(le===void 0)continue;Ae=le>D?"down":"up",ne=!0}else{const le=M.get(lt.band??0)??$;Ae=le>$?"down":le<$?"up":void 0}Ae&&(fe[Ce?"out":"in"].add(Ae),ne&&fe.cross.add(Ae))}for(const ye of["up","down"])fe.in.has(ye)&&fe.out.has(ye)&&fe.cross.has(ye)&&L.add(ye)}if(L.size!==1)continue;const[z]=L,j=Math.max(...M.values()),B=z==="down"?j:0;if($===B)continue;const U=[...M.entries()].filter(([Q])=>Q!==0).sort((Q,fe)=>Q[1]-fe[1]),Y=[...Array(j+1).keys()].filter(Q=>Q!==B),re=new Map([[0,B]]);U.forEach(([Q],fe)=>re.set(Q,Y[fe])),xe.set(A,re)}}const K=b=>{var A;return(((A=pe.get(b))==null?void 0:A.size)??0)>1},V=b=>b.band??(b.node.lane||!K(`pool:${b.node.participant??""}`)?void 0:0),ie=new Map,Te=b=>ie.get(b.node.id)??V(b),ke=new Set,N=new Set;{const b=new Map;for(const D of w)b.set(D.flow.target,(b.get(D.flow.target)??0)+1);const A=D=>{const $=[],L=new Set([D]),z=[D];for(;z.length;){const j=z.shift();$.push(j);for(const B of w)B.flow.source!==j||L.has(B.flow.target)||(b.get(B.flow.target)??0)!==1||(L.add(B.flow.target),z.push(B.flow.target))}return $},M=(D,$)=>{var L;return((L=xe.get(D))==null?void 0:L.get($))??$};for(const D of v){if(!D.node.type.endsWith("Gateway"))continue;const $=D.node.lane??`pool:${D.node.participant??""}`,L=xe.get($);if(!L||L.size<2)continue;const z=Te(D);if(z===void 0||M($,z)!==M($,0))continue;const j=M($,z),B=w.filter(ye=>ye.flow.source===D.node.id).map(ye=>T.get(ye.flow.target)).filter(ye=>!!ye&&(ye.node.lane??`pool:${ye.node.participant??""}`)===$),U=B.filter(ye=>{const Ce=Te(ye);return Ce!==void 0&&M($,Ce)===j&&(b.get(ye.node.id)??0)===1}),Y=B.some(ye=>{const Ce=Te(ye);return Ce!==void 0&&M($,Ce)>j});if(U.length!==1||!Y)continue;const re=new Set(B.flatMap(ye=>A(ye.node.id)));if(!w.some(ye=>ye.flow.target===D.node.id&&re.has(ye.flow.source)))continue;const fe=new Map;for(const[ye,Ce]of L)fe.set(ye,Ce+1);fe.set(-1,0),xe.set($,fe);for(const ye of A(U[0].node.id))T.has(ye)&&(ie.set(ye,-1),N.add(ye));ke.add(D.node.id)}}const R=(b,A)=>{var M;return((M=xe.get(b))==null?void 0:M.get(A))??A},_=(b,A,M,D)=>{const $=b?p(b):A?p(A):void 0;if(!$)return!1;const L=b?$.y+Math.min($.height/2,he):$.y+Z;return Math.abs(L+R(b??`pool:${A??""}`,M)*O-D)<=O/2},G=new Map;for(const[b,A]of pe){let M=0;for(const D of A)M=Math.max(M,R(b,D));G.set(b,M)}const q=b=>Me+O*b,ee=(b,A,M)=>{const D=u().children.filter($=>!("waypoints"in $&&$.waypoints)&&!($.type==="label"&&!("waypoints"in($.labelTarget??{})))&&$.id!==A&&typeof $.y=="number"&&$.y>=b);D.length&&n.moveElements(D,{x:0,y:M})},Re=(b,A,M)=>{const D=b.type==="bpmn:Participant"?b:void 0;if(!D||D.children.some(j=>j.type==="bpmn:Lane"))return;const $=M+A.height/2+Be-D.y;if(D.height>=$)return;const L=$-D.height,z=D.y+D.height;n.resizeShape(D,{x:D.x,y:D.y,width:D.width,height:$}),ee(z,D.id,L)},Ze=(b,A)=>{const M=A-b.height;if(M<=0)return;const D=d(b)??b,$=[],L=B=>{$.push(B);for(const U of B.children??[])L(U)};L(D);const z=b.y+b.height-10,j=l.calculateAdjustments($,"y",M,z);l.makeSpace(j.movingShapes,j.resizingShapes,{x:0,y:M},"s",z)},ht=(b,A,M)=>{if(b){const z=f(b),j=q(A);if(z.height>=j)return;const B=j-z.height,U=d(z),Y=U?U.y+U.height:z.y+z.height;Ze(z,j),ee(Y,U==null?void 0:U.id,B);return}if(!M)return;const D=O*(A+1);if(M.height>=D)return;const $=D-M.height,L=M.y+M.height;n.resizeShape(M,{x:M.x,y:M.y,width:M.width,height:D}),ee(L,M.id,$)},Gt=new Map;for(const b of w)Gt.set(b.flow.target,(Gt.get(b.flow.target)??0)+1);const _t=b=>(Gt.get(b)??0)<=1,pn=(b,A)=>{if(!b)return;const M=p(b);if(!M||M.height>=q(A))return;const D=M.y+M.height-10,$=d(M);if($)return new Set(($.children??[]).filter(L=>L.type!=="bpmn:Lane"&&typeof L.y=="number"&&L.y>D).map(L=>L.id))},bn=(b,A,M)=>{if(!b)return!0;const D=p(b);return D?M-A.height/2>=D.y&&M+A.height/2<=D.y+D.height:!0},xn=m.map((b,A)=>({op:b,declared:A}));xn.sort((b,A)=>{const M=b.op.order??Number.POSITIVE_INFINITY,D=A.op.order??Number.POSITIVE_INFINITY;return M!==D?M-D:b.declared-A.declared});let wt=80;for(const b of o.getAll())b.parent===u()&&"height"in b&&typeof b.y=="number"&&(wt=Math.max(wt,b.y+b.height+60));for(const{op:b}of xn){const A=b.participant,M=v.filter(Q=>Q.node.participant===A.id).length,D=((pE=A.lanes)==null?void 0:pE.length)??0,$=Math.max(1200,M*160+300),L=(A.lanes??[]).map(Q=>q(G.get(Q.id)??0)),z=L.reduce((Q,fe)=>Q+fe,0);D&&z<300&&(L[D-1]+=300-z);const j=Math.max(300,O*((G.get(`pool:${A.id}`)??0)+1)),B=A.blackBox||M+D===0?120:D?Math.max(300,z):j,U=r.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:A.id,name:A.name,...b.order!==void 0?{"bwl:poolOrder":b.order}:{},...A.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:$,height:B,isExpanded:!0}),Y=n.createShape(U,{x:100+$/2,y:wt+B/2},u()),re=A.lanes??[];if(re.length&&n.splitLane(Y,re.length),re.length){const Q=o.filter(fe=>{var ye;return fe.type==="bpmn:Lane"&&((ye=d(fe))==null?void 0:ye.id)===A.id}).sort((fe,ye)=>fe.y-ye.y);if(Q.forEach((fe,ye)=>{const Ce=re[ye];Ce&&n.updateProperties(fe,{id:Ce.id,name:Ce.name})}),L.some(fe=>fe!==Y.height/D)){let fe=Y.y;Q.forEach((ye,Ce)=>{const lt=L[Ce];n.resizeShape(ye,{x:ye.x,y:fe,width:ye.width,height:lt}),fe+=lt})}}wt=Y.y+Y.height+60}const fn=b=>{var D;const A=T.get(b);if(A)return A.node.participant??"";const M=p(b);return M?M.type==="bpmn:Participant"?M.id:((D=d(M))==null?void 0:D.id)??"":""},yn=new Map,wo=b=>{let A=yn.get(b);return A||yn.set(b,A={nodes:[],flows:[]}),A};for(const b of v)wo(b.node.participant??"").nodes.push(b);for(const b of w)wo(fn(b.flow.source)).flows.push(b);const ei=b=>{var A;return i.create("bpmn:SequenceFlow",{id:b.id,name:b.name??((A=b.condition)==null?void 0:A.label)})},Ei=(b,A,M)=>r.createShape({type:vc(b.type),...b.eventDefinition?{eventDefinitionType:Ys[b.eventDefinition]}:{},businessObject:i.create(vc(b.type),{id:b.id,name:b.name,...A!==void 0?{"bwl:band":A}:{},...M!==void 0?{"bwl:afterColumn":M}:{}})}),Si=[...xn.map(({op:b})=>b.participant.id).filter(b=>yn.has(b)),...[...yn.keys()].filter(b=>!m.some(A=>A.participant.id===b))],Yt=b=>b.endsWith("Gateway");for(const b of Si){const A=yn.get(b),M=b?f(b):void 0,D=M?M.x+150:250;let $=M?M.y+80:120;const L=(ne,le,se)=>{if(ne){const ge=f(ne);return ge.y+Math.min(ge.height/2,he)+R(ne,le??0)*O}return le!==void 0&&M?M.y+Z+R(`pool:${b}`,le)*O:se},z=(ne,le,se)=>{if(ne){const ge=f(ne);return ge.y+Math.min(ge.height/2,he)+le*O}return M?M.y+Z+le*O:se},j=ne=>ne.participant?f(ne.participant):u(),B=(ne,le,se,ge,We,Ue,Rt)=>{const Nt=se!==void 0||ge!==void 0,ve=R(se??`pool:${b}`,ge??0);if((ge===void 0||_(se,b,ge,Rt??Number.NaN))&&Rt!==void 0&&bn(se,le,Rt)&&!J(ne,le,We,Rt))return{x:We,y:Rt};if(Nt)for(let me=0;me<4;me++){const Le=z(se,ve+me,Ue);if(!J(ne,le,We,Le,pn(se,ve+me)))return ht(se,ve+me,M),{x:We,y:Le}}const be=L(se,ge,Ue);Nt?ht(se,ve,M):Re(ne,le,be);let oe=We;for(let me=0;me<64;me++){const Le=J(ne,le,oe,be);if(!Le)break;oe=Le.x+Le.width+F+le.width/2}return{x:oe,y:be}},U=new Set(A.flows.map(ne=>ne.flow.target)),Y=new Map,re=ne=>{if(ne===void 0)return;const le=o.get(ne);if(!(!le||typeof le.x!="number"||typeof le.width!="number"))return le.x+le.width+F};for(const ne of A.nodes){if(U.has(ne.node.id))continue;const le=Ei(ne.node,ne.band,ne.afterColumn),se=V(ne),ge=ne.node.lane?`${ne.node.lane}|${se??""}`:se!==void 0?`band:${se}`:"",We=j(ne.node),Ue=Y.get(ge)??D,Rt=re(ne.afterColumn),Nt=Rt===void 0?Ue:Math.max(Ue,Rt),ve=B(We,le,ne.node.lane,se,Nt,$);n.createShape(le,ve,We),Y.set(ge,ve.x+le.width+F),!ne.node.lane&&se===void 0&&($+=160)}const Q=new Set,fe=new Map,ye=new Map,Ce=new Map;if(b&&te.has(`pool:${b}`)){const ne=new Map;for(const ve of A.flows)ne.set(ve.flow.target,(ne.get(ve.flow.target)??0)+1);const le=ve=>L(ve.node.lane,Te(ve),Number.NaN),se=new Set,ge=ve=>{var me;const be=(me=T.get(ve))==null?void 0:me.node.participant;if(be)return p(be);const oe=p(ve);if(oe)return oe.type==="bpmn:Participant"?oe:d(oe)},We=ve=>{const be=[],oe=new Set([ve]),me=[ve];for(;me.length;){const Le=me.shift(),Ke=T.get(Le);Ke&&be.push(Ke);for(const Oe of A.flows)Oe.flow.source!==Le||oe.has(Oe.flow.target)||(ne.get(Oe.flow.target)??0)!==1||(oe.add(Oe.flow.target),me.push(Oe.flow.target))}return be},Ue=ve=>{if(!M)return;const be=new Set(ve.map(Le=>Le.node.id));let oe=!1,me=!1;for(const Le of x){if(!be.has(Le.flow.source))continue;const Ke=ge(Le.flow.target);!Ke||Ke.id===M.id||(Ke.y<M.y?oe=!0:me=!0)}return oe&&!me?"up":me&&!oe?"down":void 0};for(const ve of A.nodes){if(!Yt(ve.node.type))continue;const be=L(ve.node.lane,V(ve),Number.NaN);if(Number.isNaN(be))continue;const oe=[];for(const Oe of A.flows){if(Oe.flow.source!==ve.node.id)continue;const ze=T.get(Oe.flow.target);if(!ze||ze.node.lane!==ve.node.lane||(ne.get(ze.node.id)??0)!==1)continue;const Qe=V(ze);if(Qe===void 0)continue;const we=L(ze.node.lane,Qe,Number.NaN);if(Number.isNaN(we))continue;const ot=We(ze.node.id),Pe=Ue(ot);Pe&&oe.push({subtree:ot,band:Qe,row:we,dir:Pe})}if(!oe.some(Oe=>Oe.dir==="up")||!oe.some(Oe=>Oe.dir==="down")||!oe.some(Oe=>Oe.dir==="up"&&oe.some(ze=>ze.dir==="down"&&ze.row<Oe.row)))continue;const Le=[...oe].sort((Oe,ze)=>Oe.row-ze.row);[...oe.filter(Oe=>Oe.dir==="up"),...oe.filter(Oe=>Oe.dir==="down")].sort((Oe,ze)=>Oe.dir===ze.dir?Oe.row-ze.row:Oe.dir==="up"?-1:1).forEach((Oe,ze)=>{const Qe=Le[ze].band;if(Qe!==Oe.band){se.add(ve.node.id);for(const we of Oe.subtree)V(we)===Oe.band&&ie.set(we.node.id,Qe)}})}const Rt=ve=>{if(!M)return;const be=new Set(ve.map(Le=>Le.node.id));let oe=!1,me=!1;for(const Le of x){if(!be.has(Le.flow.target))continue;const Ke=ge(Le.flow.source);!Ke||Ke.id===M.id||(Ke.y<M.y?oe=!0:me=!0)}return oe&&!me?"up":me&&!oe?"down":void 0};for(const ve of A.nodes){if(!Yt(ve.node.type))continue;const be=ve.node.lane??`pool:${b}`,oe=xe.get(be);if(!oe||oe.size<2)continue;const me=oe.get(0);if(me===void 0)continue;const Le=Math.max(...oe.values()),Ke=me===Le&&me!==0?"down":void 0;if(!Ke)continue;const Oe=[];for(const Pe of A.flows){if(Pe.flow.source!==ve.node.id)continue;const Et=T.get(Pe.flow.target);if(!Et||Et.node.lane!==ve.node.lane||(ne.get(Et.node.id)??0)!==1)continue;const yt=Te(Et);yt!==void 0&&Oe.push({t:Et,subtree:We(Et.node.id),band:yt})}const ze=Oe.find(Pe=>(oe.get(Pe.band)??Pe.band)===me);if(!ze||Rt(ze.subtree)===Ke||Ue(ze.subtree)===Ke)continue;const Qe=Oe.find(Pe=>Pe!==ze&&Rt(Pe.subtree)===Ke);if(!Qe)continue;const we=ze.band,ot=Qe.band;for(const Pe of ze.subtree)Te(Pe)===we&&ie.set(Pe.node.id,ot);for(const Pe of Qe.subtree)Te(Pe)===ot&&ie.set(Pe.node.id,we);se.add(ve.node.id)}for(const ve of A.nodes){if(!Yt(ve.node.type))continue;const be=le(ve);if(Number.isNaN(be)||S.some(Oe=>{var ze,Qe;return(((ze=Oe.placement)==null?void 0:ze.anchor)??(Oe.association?Oe.association.source===Oe.annotation.id?Oe.association.target:Oe.association.source:void 0))===ve.node.id&&((Qe=Oe.placement)==null?void 0:Qe.side.startsWith("bottom"))}))continue;let me,Le=!1,Ke;for(const Oe of A.flows){if(Oe.flow.source!==ve.node.id)continue;const ze=T.get(Oe.flow.target);if(!ze||!ze.node.lane&&V(ze)===void 0)continue;const Qe=le(ze);Number.isNaN(Qe)||(Math.abs(Qe-be)<.5&&(Le=!0),Qe>be?!me||Qe>me.row?me={id:ze.node.id,row:Qe,count:1}:Qe===me.row&&me.count++:Qe<be&&ze.node.lane===ve.node.lane&&(!Ke||Qe>Ke.row?Ke={op:ze,row:Qe,count:1}:Qe===Ke.row&&Ke.count++))}me&&me.count===1&&(ne.get(me.id)??0)===1&&!se.has(ve.node.id)&&Q.add(me.id),!Le&&Ke&&Ke.count===1&&(ne.get(Ke.op.node.id)??0)===1&&!ke.has(ve.node.id)&&fe.set(Ke.op.node.id,{lane:ve.node.lane,band:Te(ve)})}const Nt=new Map;for(const ve of x)Nt.set(ve.flow.target,[...Nt.get(ve.flow.target)??[],ve]);for(const ve of A.nodes){const be=Nt.get(ve.node.id);if(!be||be.length!==1||!ne.get(ve.node.id)||!ve.node.lane&&V(ve)===void 0||N.has(ve.node.id))continue;const oe=(fE=T.get(be[0].flow.source))==null?void 0:fE.node.participant,me=oe?p(oe):void 0;if(!me||!M||me.id===M.id)continue;const Le=ve.node.lane??`pool:${b}`,Ke=xe.get(Le);if(!Ke)continue;const Oe=Ke.get(0)??0,ze=(Ke.get(Te(ve)??0)??Oe)-Oe;if(ze===0)continue;const Qe=me.y<M.y;if(Qe&&ze<0||!Qe&&ze>0)continue;let we;for(const[ot,Pe]of Ke){const Et=Pe-Oe;(Qe&&Et<0&&(!we||Et<we.row)||!Qe&&Et>0&&(!we||Et>we.row))&&(we={band:ot,row:Et})}we&&ye.set(ve.node.id,{lane:ve.node.lane,band:we.band})}}const lt=new Set;let Ae=0;for(;Ae++<A.nodes.length+2;){for(let se=0;se<A.nodes.length+A.flows.length+2;se++){let ge=!1;for(const We of A.flows){const Ue=We.flow;if(lt.has(Ue.id))continue;const Rt=p(Ue.source);if(!Rt)continue;const Nt=p(Ue.target),ve=T.get(Ue.target);if(!Nt&&ve){const be=Ei(ve.node,ve.band),oe=Te(ve);if(ve.node.lane||oe!==void 0){const me=j(ve.node),Le=Rt,Ke=Le.x+(Ce.get(Ue.source)??0)+Le.width+F,Oe=fe.get(Ue.target)??ye.get(Ue.target),ze=B(me,be,Oe?Oe.lane:ve.node.lane,Oe?Oe.band:oe,Q.has(Ue.target)?Le.x+Le.width/2:Ke,Number.NaN,Oe||!_t(Ue.target)?void 0:Le.y+Le.height/2),Qe=n.createShape(be,ze,me);Q.has(Ue.target)&&Ce.set(Ue.target,Ke-(Qe.x+Qe.width/2)),n.connect(Rt,Qe,{type:"bpmn:SequenceFlow",businessObject:ei(Ue)})}else s.append(Rt,be,{connection:{type:"bpmn:SequenceFlow",businessObject:ei(Ue)}})}else if(Nt)n.connect(Rt,Nt,{type:"bpmn:SequenceFlow",businessObject:ei(Ue)});else continue;lt.add(Ue.id),ge=!0}if(!ge)break}const ne=A.nodes.filter(se=>!p(se.node.id));if(!ne.length)break;const le=ne[0];{const se=Ei(le.node,le.band),ge=j(le.node),We=V(le);n.createShape(se,B(ge,se,le.node.lane,We,D,$),ge),!le.node.lane&&We===void 0&&($+=160)}}}const Ri=40,Sa=b=>{const A=Y=>Y.kind==="label-over-line"||Y.kind==="label-over-shape"||Y.kind==="label-on-shared-segment"?Y.edge===b.id:Y.kind==="annotation-over-label"||Y.kind==="pool-name-over-label"?Y.label===b.id:!1,M=()=>new Set(mt(Xe(o)).filter(Y=>!A(Y)).map(Y=>ft(Y))),D=M(),$=b.waypoints.map(Y=>({x:Y.x,y:Y.y})),L=b.label,z=L&&{x:L.x,y:L.y};n.layoutConnection(b,{waypoints:[]});const j=M(),B=[...j].filter(Y=>!D.has(Y)).length,U=[...D].filter(Y=>!j.has(Y)).length;B<=U||(n.updateWaypoints(b,$),L&&z&&(L.x!==z.x||L.y!==z.y)&&n.moveElements([L],{x:z.x-L.x,y:z.y-L.y}))},ti=5,st=10,bt=200,Tu=new Set([...w.map(b=>b.flow.id),...x.map(b=>b.flow.id),...Qt(e,"sequenceFlow.update").map(b=>b.id),...Qt(e,"messageFlow.update").map(b=>b.id)].filter(b=>!!b)),fN=(b,A,M,D,$,L)=>{const z=new Set(b.map(ne=>ne.id)),j=Math.min(...b.map(ne=>ne.x))+A-st,B=Math.max(...b.map(ne=>ne.x+ne.width))+A+bt+st,U=Math.min(...b.map(ne=>ne.y+Math.min(0,...M)))-st,Y=Math.max(...b.map(ne=>ne.y+ne.height+Math.max(0,...M)))+st,re=o.getAll().filter(ne=>{if(ne.type!=="bpmn:SequenceFlow"&&ne.type!=="bpmn:MessageFlow")return!1;const le=ne;return Tu.has(le.id)||!le.waypoints||le.waypoints.length<2||[le.source,le.target].some(ge=>!ge||z.has(ge.id)||ge.x>=D)?!1:le.waypoints.some((ge,We)=>{const Ue=le.waypoints[We+1];return!!Ue&&Math.max(ge.x,Ue.x)>=j&&Math.min(ge.x,Ue.x)<=B&&Math.max(ge.y,Ue.y)>=U&&Math.min(ge.y,Ue.y)<=Y})});if(!re.length)return 0;const Q=ne=>{const le=new Map;for(const se of b)for(const ge of M){const We={id:se.id,type:se.type,x:se.x+A+ne,y:se.y+ge,width:se.width,height:se.height};for(const Ue of re){let Rt=1/0;for(let ve=0;ve+1<Ue.waypoints.length;ve++)Rt=Math.min(Rt,uc(Ue.waypoints[ve],Ue.waypoints[ve+1],We));const Nt=`${Ue.id}|${se.id}`;le.set(Nt,Math.min(le.get(Nt)??1/0,Rt))}}return le},fe=[...Q(0)].filter(([,ne])=>ne<=ti).map(([ne])=>ne);if(!fe.length)return 0;let ye=0;for(let ne=1;ne<=bt;ne++){const le=Q(ne);if([...le.values()].every(se=>se>ti)&&fe.every(se=>(le.get(se)??1/0)>=st)){ye=ne;break}}if(!ye)return 0;const Ce=Math.min(...b.map(ne=>ne.x))+A+ye,lt=new Set(fe.map(ne=>ne.slice(0,ne.indexOf("|"))));return re.some(ne=>ne.type==="bpmn:SequenceFlow"&&lt.has(ne.id)&&ne.waypoints.some((le,se)=>{const ge=ne.waypoints[se+1];if(!ge||Math.min(le.y,ge.y)>L||Math.max(le.y,ge.y)<L||le.y===ge.y)return!1;const We=le.x+(L-le.y)*(ge.x-le.x)/(ge.y-le.y);return We>$&&We<Ce}))?0:ye},Eo=(b,A=()=>!0)=>{const M=p(b);if(!M)return[];const D=[M],$=new Set([b]);for(let L=0;L<D.length;L++){const z=D[L].id;for(const j of w){const B=j.flow.target;if(j.flow.source!==z||$.has(B)||!T.has(B))continue;$.add(B);const U=p(B);U&&A(U)&&D.push(U)}}return D},dN=(b,A=()=>!0)=>{const M=p(b);if(!M)return[];const D=[M],$=new Set([b]);for(let L=0;L<D.length;L++){const z=D[L].id;for(const j of w){const B=j.flow.source;if(j.flow.target!==z||$.has(B)||!T.has(B))continue;$.add(B);const U=p(B);U&&A(U)&&D.push(U)}}return D},Xi=30,mr=b=>!("waypoints"in b&&b.waypoints)&&b.type!=="bpmn:Lane"&&b.type!=="label"&&typeof b.x=="number",ku=(b,A)=>Sp(n,b,A),js=(b,A,M=!1)=>{const D=new Set(b.flatMap(B=>B.subtree.map(U=>U.id)));for(const B of b){const U=(B.pool.children??[]).filter(mr).filter(re=>!D.has(re.id));if(B.subtree.some(re=>U.some(Q=>re.x+A<Q.x+Q.width+Xi&&re.x+A+re.width+Xi>Q.x&&re.y<Q.y+Q.height&&re.y+re.height>Q.y)))return null}const $=b.map(B=>B.pool.width),L=M?o.filter(B=>Array.isArray(B.waypoints)).map(B=>({c:B,wps:B.waypoints.map(U=>({x:U.x,y:U.y}))})):[],z=o.filter(B=>B.type==="label").map(B=>({label:B,x:B.x,y:B.y}));n.moveElements(b.flatMap(B=>B.subtree),{x:A,y:0});const j=b.map(B=>{const Y=Math.max(...B.subtree.map(re=>re.x+re.width))+mg-(B.pool.x+B.pool.width);return Y>0&&ku(B.pool,B.pool.width+Y),Y});return()=>{n.moveElements(b.flatMap(B=>B.subtree),{x:-A,y:0}),b.forEach((B,U)=>{j[U]>0&&ku(B.pool,$[U])});for(const{c:B,wps:U}of L){const Y=B.waypoints??[];Y.length===U.length&&Y.every((Q,fe)=>Math.abs(Q.x-U[fe].x)<=.5&&Math.abs(Q.y-U[fe].y)<=.5)||n.updateWaypoints(B,U.map(Q=>({x:Q.x,y:Q.y})))}for(let B=0;B<3;B++){let U=0;for(const Y of z){const re=Y.x-Y.label.x,Q=Y.y-Y.label.y;Math.abs(re)<=.5&&Math.abs(Q)<=.5||(n.moveElements([Y.label],{x:re,y:Q}),U++)}if(!U)break}}},Sh=b=>{var $,L;const A=new Map,M=new Map;for(const z of o.getAll()){if(z.type!=="bpmn:Participant")continue;const j=z;(j.children??[]).length||(A.set(j.id,j),M.set(j.id,[]))}for(const z of o.getAll()){if(z.type!=="bpmn:MessageFlow")continue;const j=z,B=($=j.source)==null?void 0:$.id,U=(L=j.target)==null?void 0:L.id;B&&U&&M.has(B)&&M.get(B).push(U),B&&U&&M.has(U)&&M.get(U).push(B)}const D=[];for(const[z,j]of M)j.length&&j.every(B=>b.has(B))&&D.push(A.get(z));return D},H0=(b,A)=>{if(!b.length)return null;const M=new Set(b.map(Y=>Y.id)),D=o.getAll().filter(Y=>Y.type==="bpmn:Participant"&&!M.has(Y.id)),$=Math.min(...D.filter(Y=>(Y.children??[]).length>0).map(Y=>Y.x)),L=new Set(b.filter(Y=>Math.abs(Y.x-$)<=2).map(Y=>Y.id));if(b.some(Y=>{const re=L.has(Y.id)?Y.x:Y.x+A,Q=L.has(Y.id)?Y.width+A:Y.width;return D.some(fe=>re<fe.x+fe.width+Xi&&re+Q+Xi>fe.x&&Y.y<fe.y+fe.height&&Y.y+Y.height>fe.y)}))return null;const j=o.filter(Y=>Y.type==="label").map(Y=>({label:Y,x:Y.x,y:Y.y})),B=b.filter(Y=>!L.has(Y.id)),U=b.filter(Y=>L.has(Y.id)).map(Y=>({pool:Y,was:{x:Y.x,y:Y.y,width:Y.width,height:Y.height}}));B.length&&n.moveElements(B,{x:A,y:0});for(const{pool:Y,was:re}of U)n.resizeShape(Y,{...re,width:re.width+A});return()=>{for(const{pool:Y,was:re}of U)n.resizeShape(Y,re);B.length&&n.moveElements(B,{x:-A,y:0});for(let Y=0;Y<3;Y++){let re=0;for(const Q of j){const fe=Q.x-Q.label.x,ye=Q.y-Q.label.y;Math.abs(fe)<=.5&&Math.abs(ye)<=.5||(n.moveElements([Q.label],{x:fe,y:ye}),re++)}if(!re)break}}},z0=()=>{let b=0;for(const A of o.getAll()){if(A.type!=="bpmn:DataInputAssociation"&&A.type!=="bpmn:DataOutputAssociation")continue;const M=A.waypoints??[];for(let D=1;D<M.length;D++)b+=Math.hypot(M[D].x-M[D-1].x,M[D].y-M[D-1].y)}return b},G0=()=>{let b=0;for(const A of o.getAll()){if(A.type!=="bpmn:Association")continue;const M=A.waypoints??[];for(let D=1;D<M.length;D++)b+=Math.hypot(M[D].x-M[D-1].x,M[D].y-M[D-1].y)}return b},hN=b=>{const A=[];for(const M of o.getAll()){if(M.type!=="bpmn:TextAnnotation")continue;const D=M;if(b.has(D.id))continue;const L=[...D.incoming??[],...D.outgoing??[]].filter(B=>B.type==="bpmn:Association").map(B=>B.source===D?B.target:B.source);if(!L.length||L.some(B=>B===void 0))continue;const z=B=>{if(!("waypoints"in B&&B.waypoints))return[B.id];const U=B,Y=[U.source,U.target];return Y.some(re=>!re)?[]:Y.map(re=>re.id)},j=L.flatMap(B=>z(B));j.length&&j.every(B=>b.has(B))&&A.push(D)}return A},V0=()=>mt(Xe(o)).filter(b=>b.kind==="edge-crosses-shape").length,W0=b=>{const A=(b.children??[]).filter(mr);let M=0;for(let D=0;D<A.length;D++)for(let $=D+1;$<A.length;$++){const L=A[D],z=A[$];L.x<z.x+z.width&&L.x+L.width>z.x&&L.y<z.y+z.height&&L.y+L.height>z.y&&M++}return M},Ra=()=>{const b=Xe(o),A=M=>M.length>=2&&(M.every(D=>Math.abs(D.x-M[0].x)<.01)||M.every(D=>Math.abs(D.y-M[0].y)<.01));return{messages:b.edges.filter(M=>M.type==="bpmn:MessageFlow"&&M.waypoints.length===2).length,lines:b.edges.filter(M=>A(M.waypoints)).length}},U0=b=>{const A=new Map;for(const D of o.getAll()){if(D.type!=="bpmn:MessageFlow")continue;const $=D;if(!$.waypoints||$.waypoints.length!==2)continue;const L=$.source,z=$.target;if(!L||!z)continue;const j=b.has(L.id);if(j===b.has(z.id))continue;const B=j?z:L,U=d(B);if(!U||b.has(B.id))continue;const Y=A.get(U.id);Y?B.x<Y.minX&&(Y.minX=B.x):A.set(U.id,{pool:U,minX:B.x})}const M=[];for(const{pool:D,minX:$}of A.values()){const L=(D.children??[]).filter(z=>mr(z)&&!b.has(z.id)&&z.x>=$);L.length&&M.push({subtree:L,pool:D})}return M},mN=(b,A,M)=>{const D=new Map(A.map(z=>[z.pool.id,{subtree:[...z.subtree],pool:z.pool}])),$=new Set(b);for(const z of A)for(const j of z.subtree)$.add(j.id);let L=!1;for(;;){let z=0;for(const j of U0($)){if(j.pool===M)continue;const B=D.get(j.pool.id);B?B.subtree.push(...j.subtree):D.set(j.pool.id,{subtree:[...j.subtree],pool:j.pool});for(const U of j.subtree)$.add(U.id);z+=j.subtree.length}if(!z)break;L=!0}return L?[...D.values()]:null},q0=new Map;for(const b of Qt(e,"sequenceFlow.update")){if(b.target===void 0)continue;const A=T.get(b.target);if(!A)continue;const M=p(b.target),D=p(b.id);if(!M||!D)continue;const $=b.source!==void 0?p(b.source):D.source,L=D.target;if(!$||!L||L.id===M.id)continue;const z=D.waypoints&&D.waypoints.length>=3&&Math.abs(D.waypoints[0].x-D.waypoints[1].x)<1&&Math.abs(D.waypoints[0].y-D.waypoints[1].y)>1?{x:D.waypoints[0].x,y:D.waypoints[0].y}:void 0,j=z?D.waypoints[1].y:void 0,B=z&&D.label?{x:D.label.x,y:D.label.y}:void 0,U=B&&D.label&&Math.abs(B.y+D.label.height/2-j)<=O/5&&B.x+D.label.width>z.x?B.x+D.label.width+6:void 0,Y=($.outgoing??[]).filter(we=>we.type==="bpmn:SequenceFlow"&&we.id!==D.id&&we.target&&!Tu.has(we.id)),re=new Set(Y.map(we=>we.target.id)),Q=we=>{const ot={type:"bpmn:Task",x:we.x+2,y:we.y+2,width:we.width-4,height:we.height-4};return Y.find(Pe=>(Pe.waypoints??[]).some((Et,yt)=>!!Pe.waypoints[yt+1]&&uc(Et,Pe.waypoints[yt+1],ot)===0))},fe=Eo(b.target),ye=new Set(fe.map(we=>we.id)),Ce=Math.min(...fe.map(we=>we.x)),lt=Math.max(...fe.map(we=>we.x+we.width)),Ae=$.x+$.width,ne=M.y+M.height/2,le=fN(fe,Ae+Ri-Ce,[0,$.y+$.height/2-ne,L.y+L.height/2-ne],L.x,Ae,$.y+$.height/2),se=Ae+Ri+le,ge=(()=>{if(U===void 0)return 0;const we=Ae+Ri,ot=$.y+$.height/2-M.height/2,Pe={x:we,y:ot,width:lt-Ce,height:M.height},Et=d($);return((Et==null?void 0:Et.children)??[]).some(gt=>mr(gt)&&!ye.has(gt.id)&&gt.id!==$.id&&gt.id!==L.id&&gt.type!=="bpmn:Group"&&gt.type!=="bpmn:Participant"&&gt.x<Pe.x+Pe.width&&gt.x+gt.width>Pe.x&&gt.y<Pe.y+Pe.height&&gt.y+gt.height>Pe.y)||Q(Pe)?Math.max(0,U-we):0})(),We=lt-Ce+Ri*2+le+ge-(L.x-Ae);let Ue=[];if(We>0){const we=d(M),ot=(we==null?void 0:we.children)??[],Pe=Ne=>Ne.type==="bpmn:Lane";Ue=(()=>{const Ne=new Set;for(const $e of ot)mr($e)&&!ye.has($e.id)&&$e.id!==$.id&&$e.x>=L.x&&Ne.add($e.id);const Pt=[];for(const $e of ot){if($e.type!=="bpmn:DataStoreReference"&&$e.type!=="bpmn:DataObjectReference")continue;const xt=$e,zn=[...xt.incoming??[],...xt.outgoing??[]].filter(Kt=>Kt.type==="bpmn:DataInputAssociation"||Kt.type==="bpmn:DataOutputAssociation").map(Kt=>Kt.source===xt?Kt.target:Kt.source);zn.length&&zn.every(Kt=>Kt!==void 0&&Ne.has(Kt.id))&&Pt.push(xt)}return Pt})();const yt=ot.filter(Ne=>!("waypoints"in Ne&&Ne.waypoints)&&!Pe(Ne)&&Ne.type!=="label"&&!ye.has(Ne.id)&&Ne.id!==$.id&&Ne.x>=L.x),gt=yt.flatMap(Ne=>Ne.labels??[]),Lt=we?[we,...ot.filter(Ne=>Pe(Ne))]:[];if(yt.length){const Ne=new Set(yt.map(it=>it.id)),Pt=U0(Ne),$e=Pt.length?mN(Ne,Pt,we):null,xt=it=>{const vt=new Set(Ne);for(const Ut of it)for(const $n of Ut.subtree)vt.add($n.id);return hN(vt)},Nn=xt(Pt),zn=$e?xt($e):Nn,Kt=Sh(Ne),Bu=new Set(Ne);for(const it of Pt)for(const vt of it.subtree)Bu.add(vt.id);const Nu=Pt.length?Sh(Bu):Kt,$u=(()=>{if(!$e)return[];const it=new Set(Ne);for(const vt of $e)for(const Ut of vt.subtree)it.add(Ut.id);return Sh(it)})(),Gs=new Set([...yt,...Lt].map(it=>it.id)),Oh=ot.filter(it=>{const vt=it.labelTarget;return it.type==="label"&&!!vt&&"waypoints"in vt&&!!vt.source&&!!vt.target&&Gs.has(vt.source.id)&&Gs.has(vt.target.id)});n.createSpace([...yt,...gt,...Oh],Lt,{x:We,y:0},"e",L.x-1);const Fu=(it,vt)=>{const Ut=Ra(),$n=js(it,We);if(!$n)return!1;const Ao=vt.length?H0(vt,We):null,$t=Ra();return $t.messages>Ut.messages&&$t.lines>=Ut.lines?!0:(Ao==null||Ao(),$n(),!1)},Ti=$e?Fu($e,$u):!1;let ut=Ti;!ut&&Pt.length&&(ut=Fu(Pt,Nu));const Xt=Ti?zn:Nn;if(!ut){for(const it of Pt){const vt=Ra(),Ut=js([it],We);if(!Ut)continue;const $n=Ra();($n.messages<=vt.messages||$n.lines<vt.lines)&&Ut()}if(Kt.length){const it=Ra(),vt=H0(Kt,We);if(vt){const Ut=Ra();(Ut.messages<=it.messages||Ut.lines<it.lines)&&vt()}}}if(Xt.length){const it=()=>new Set(mt(Xe(o)).map(Ut=>ft(Ut))),vt=Ut=>{const $n=G0(),Ao=it(),$t=Ut.map(Zt=>({a:Zt,x:Zt.x,y:Zt.y})),gr=o.filter(Zt=>Zt.type==="label").map(Zt=>({label:Zt,x:Zt.x,y:Zt.y}));n.moveElements(Ut,{x:We,y:0});const Mo=[...it()].filter(Zt=>!Ao.has(Zt));if(G0()<$n&&Mo.length===0)return!0;for(const{a:Zt,x:Vs,y:Ws}of $t)(Zt.x!==Vs||Zt.y!==Ws)&&n.moveElements([Zt],{x:Vs-Zt.x,y:Ws-Zt.y});for(const Zt of gr){const Vs=Zt.x-Zt.label.x,Ws=Zt.y-Zt.label.y;(Vs!==0||Ws!==0)&&n.moveElements([Zt.label],{x:Vs,y:Ws})}return!1};if(!vt(Xt)&&Xt.length>1)for(const Ut of Xt)vt([Ut])}}}const Rt=A.node.lane!==void 0?p(A.node.lane):A.node.participant!==void 0?p(A.node.participant):void 0,Nt=we=>{if(!Rt)return!0;const ot=we.y+we.height/2;return ot>=Rt.y&&ot<=Rt.y+Rt.height},ve=!Nt($)&&Nt(L)?L:$,be=ve.y+ve.height/2,oe=be-(M.y+M.height/2),me=A.band!==void 0,Le=me?[M]:fe,Ke=(A.band===void 0||_(A.node.lane,A.node.participant,A.band,be))&&_t(b.target)&&Le.every(we=>{var ot;return bn((ot=T.get(we.id))==null?void 0:ot.node.lane,we,we.y+we.height/2+oe)}),Oe=we=>Math.abs(we.y+we.height/2-(M.y+M.height/2))<=O/2;if(Ke&&me){const we=Math.abs(oe)<=O/2?fe.filter(ot=>ot.id!==M.id&&Oe(ot)):[];if(n.moveElements(fe,{x:se-Ce,y:0}),n.moveElements([M],{x:0,y:oe}),we.length){const ot=()=>new Set(mt(Xe(o)).map(Ne=>ft(Ne))),Pe=ot(),Et=o.filter(Ne=>Ne.type==="label").map(Ne=>({label:Ne,x:Ne.x,y:Ne.y}));n.moveElements(we,{x:0,y:oe});const yt=ot(),gt=[...yt].filter(Ne=>!Pe.has(Ne)).length,Lt=[...Pe].filter(Ne=>!yt.has(Ne)).length;if(gt>Lt){n.moveElements(we,{x:0,y:-oe});for(const Ne of Et){const Pt=Ne.x-Ne.label.x,$e=Ne.y-Ne.label.y;(Pt!==0||$e!==0)&&n.moveElements([Ne.label],{x:Pt,y:$e})}}}}else n.moveElements(fe,{x:se-Ce,y:Ke?oe:0});const ze=d(M);if(!Ke&&A.node.lane===void 0&&A.band!==void 0&&ze){const we=ze.y+Z+R(`pool:${A.node.participant??""}`,A.band)*O,ot=we-(M.y+M.height/2);ot!==0&&!J(ze,M,M.x+M.width/2,we,ye)&&n.moveElements([M],{x:0,y:ot})}if(ze){const we=(ze.children??[]).filter(yt=>mr(yt)&&!ye.has(yt.id)&&yt.type!=="bpmn:Group"&&yt.type!=="bpmn:Participant"),ot=(yt,gt,Lt,Ne,Pt)=>yt.x+gt<Pt.x+Pt.width+Ne&&yt.x+gt+yt.width+Ne>Pt.x&&yt.y+Lt<Pt.y+Pt.height+Ne&&yt.y+Lt+yt.height+Ne>Pt.y,Pe=we.find(yt=>ot(M,0,0,0,yt)),Et=Pe?void 0:Q(M);if(Pe||Et){const yt=["bpmn:SequenceFlow","bpmn:MessageFlow","bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation"],gt=o.getAll().filter(ut=>{if(!yt.includes(ut.type))return!1;const Xt=ut;return Tu.has(Xt.id)||!Xt.waypoints||Xt.waypoints.length<2?!1:![Xt.source,Xt.target].some(it=>!it||ye.has(it.id))}),Lt=(ut,Xt,it)=>{var vt;return bn((vt=T.get(ut.id))==null?void 0:vt.node.lane,ut,ut.y+it+ut.height/2)&&ut.x+Xt>=ze.x&&ut.x+Xt+ut.width<=ze.x+ze.width&&ut.y+it>=ze.y&&ut.y+it+ut.height<=ze.y+ze.height},Ne=(ut,Xt)=>fe.every(it=>Lt(it,ut,Xt)&&!we.some(vt=>ot(it,ut,Xt,st,vt))&&gt.every(vt=>{const Ut={id:it.id,type:it.type,x:it.x+ut,y:it.y+Xt,width:it.width,height:it.height};for(let $n=0;$n+1<vt.waypoints.length;$n++)if(uc(vt.waypoints[$n],vt.waypoints[$n+1],Ut)<st)return!1;return!0})),Pt=M.y+M.height/2,$e=[j,L.y+L.height/2].filter(ut=>ut!==void 0&&Math.abs(ut-Pt)>=1),xt=Pe&&re.has(Pe.id)?Pe:Et==null?void 0:Et.target,Nn=xt?xt.x-M.x:0,zn=Math.max(...fe.map(ut=>ut.x+ut.width)),Kt=[...Nn!==0?[Nn]:[],...le!==0?[-le]:[],0],Bu=U===void 0?[]:Kt.map(ut=>Math.max(ut,U-M.x)),Nu=ut=>zn+ut+Ri<=L.x,$u=[...new Set([...Bu,...Kt])].filter(Nu),Gs=Pe&&re.has(Pe.id)?[Pe.x+Pe.width+Ri-M.x]:[],Oh=U===void 0?[]:Gs.map(ut=>Math.max(ut,U-M.x)),Fu=[...new Set([...Oh,...Gs])].filter(ut=>Nu(ut)&&!$u.includes(ut));let Ti;for(const ut of[$u,Fu]){for(const Xt of $e){for(const it of ut)if(Ne(it,Xt-Pt)){Ti={dx:it,dy:Xt-Pt};break}if(Ti)break}if(Ti)break}if(Ti){const ut=$t=>{const gr=$t;return[gr.edge,gr.other,...Array.isArray(gr.edges)?gr.edges:[]].some(Mo=>typeof Mo=="string"&&Tu.has(Mo))},Xt=()=>new Set(mt(Xe(o)).filter($t=>!ut($t)).map($t=>ft($t))),it=Xt(),vt=o.filter($t=>$t.type==="label").map($t=>({label:$t,x:$t.x,y:$t.y}));n.moveElements(fe,{x:Ti.dx,y:Ti.dy});const Ut=Xt(),$n=[...Ut].filter($t=>!it.has($t)).length,Ao=[...it].filter($t=>!Ut.has($t)).length;if($n>Ao){n.moveElements(fe,{x:-Ti.dx,y:-Ti.dy});for(const $t of vt){const gr=$t.x-$t.label.x,Mo=$t.y-$t.label.y;(gr!==0||Mo!==0)&&n.moveElements([$t.label],{x:gr,y:Mo})}}else z&&q0.set(D.id,{exit:z,channelY:j,label:B})}}}{const we=new Set(fe.map(gt=>gt.id)),ot=new Set(w.map(gt=>gt.flow.id)),Pe=20,Et=gt=>{const Lt=gt.source,Ne=gt.target,Pt=Math.min(Lt.x,Ne.x)-Pe,$e=Math.max(Lt.x+Lt.width,Ne.x+Ne.width)+Pe,xt=Math.min(Lt.y,Ne.y)-Pe,Nn=Math.max(Lt.y+Lt.height,Ne.y+Ne.height)+Pe;return gt.waypoints.some(zn=>zn.x<Pt||zn.x>$e||zn.y<xt||zn.y>Nn)},yt=new Map;for(const gt of fe)for(const Lt of[...gt.incoming??[],...gt.outgoing??[]])Lt.id!==b.id&&ot.has(Lt.id)&&!(we.has(Lt.source.id)&&we.has(Lt.target.id))&&yt.set(Lt.id,Lt);for(const gt of yt.values())Et(gt)&&Sa(gt)}const Qe=Ue.length?d(Ue[0]):void 0;if(Qe){const we={assoc:z0(),overlaps:W0(Qe),crosses:V0()},ot=Ue.map($e=>({st:$e,x:$e.x})),Pe=o.filter($e=>$e.type==="label").map($e=>({label:$e,x:$e.x,y:$e.y})),Et=Math.min(...Ue.flatMap($e=>[...$e.incoming??[],...$e.outgoing??[]].filter(xt=>xt.type==="bpmn:DataInputAssociation"||xt.type==="bpmn:DataOutputAssociation").map(xt=>(xt.source===$e?xt.target:xt.source).x))),yt=new Set(Ue.map($e=>$e.id)),gt=(Qe.children??[]).filter(mr).filter($e=>!yt.has($e.id));let Lt=Et;for(const $e of[...Ue].sort((xt,Nn)=>xt.x-Nn.x)){let xt=Lt;for(let Nn=0;Nn<100;Nn++){const zn=gt.find(Kt=>xt<Kt.x+Kt.width+Xi&&xt+$e.width+Xi>Kt.x&&$e.y<Kt.y+Kt.height&&$e.y+$e.height>Kt.y);if(!zn)break;xt=zn.x+zn.width+Xi}xt!==$e.x&&n.moveElements([$e],{x:xt-$e.x,y:0}),Lt=xt+$e.width+Xi}const Ne=Lt+150-(Qe.x+Qe.width);Ne>0&&ku(Qe,Qe.width+Ne);const Pt={assoc:z0(),overlaps:W0(Qe),crosses:V0()};if(Pt.assoc>=we.assoc||Pt.overlaps>we.overlaps||Pt.crosses>we.crosses){for(const{st:$e,x:xt}of ot)$e.x!==xt&&n.moveElements([$e],{x:xt-$e.x,y:0});Ne>0&&ku(Qe,Qe.width-Ne);for(const $e of Pe){const xt=$e.x-$e.label.x,Nn=$e.y-$e.label.y;(xt!==0||Nn!==0)&&n.moveElements([$e.label],{x:xt,y:Nn})}}}}const Y0=(b,A)=>{const M=A.target===b,D=f(A.source),$=f(A.target),L=M?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(D,$,A.id?{type:L,businessObject:i.create(L,{id:A.id})}:{type:L})},K0=100,X0=b=>{for(const A of m){if(!A.participant.blackBox)continue;const M=p(A.participant.id);if(!M)continue;const D=[];for(const L of x){const z=L.flow.source===A.participant.id?L.flow.target:L.flow.target===A.participant.id?L.flow.source:void 0,j=z?p(z):void 0;j&&typeof j.x=="number"&&j.type!=="bpmn:Participant"&&D.push(j)}if(!D.length)continue;if(!b&&A.order===void 0){const L=(()=>{var j;const z=new Map;for(const B of D){const U=d(B);if(!U)continue;const Y=z.get(U.id);Y?Y.n+=1:z.set(U.id,{shape:U,n:1})}return(j=[...z.values()].sort((B,U)=>U.n-B.n)[0])==null?void 0:j.shape})();if(L){const z=U=>U.reduce((Y,re)=>Y+re,0)/U.length,j=z(D.map(U=>U.y+U.height/2))<L.y+L.height/2,B=o.filter(U=>U.type==="bpmn:Participant"&&U.id!==A.participant.id&&U.id!==L.id).filter(U=>j?U.y+U.height<=L.y+5:U.y>=L.y+L.height-5);if(B.length){const U=[...B.reduce((se,ge)=>se.set(ge.y,(se.get(ge.y)??0)+1),new Map)].sort((se,ge)=>ge[1]-se[1]||(j?ge[0]-se[0]:se[0]-ge[0]))[0][0],Y=Math.min(M.width,SR),re=RR,Q=D.map(se=>se.x+se.width/2),fe=Math.round(z(Q)-Y/2),ye=Math.max(...Q)+K0,Ce=se=>({x:se,width:Math.max(Y,ye-se)}),lt=B.filter(se=>Math.min(se.y+se.height,U+re)-Math.max(se.y,U)>0),Ae=se=>{const ge=Ce(se);return lt.some(We=>We.x<ge.x+ge.width&&ge.x<We.x+We.width)},ne=se=>{const ge=Ce(se);return Q.filter(We=>We>=ge.x+10&&We<=ge.x+ge.width-10).length},le=(()=>{if(!Ae(fe))return fe;const se=ne(fe);return lt.flatMap(ge=>[ge.x+ge.width+pg,ge.x-pg-Y]).map(ge=>Math.round(ge)).filter(ge=>!Ae(ge)&&ne(ge)>=se).sort((ge,We)=>Math.abs(ge-fe)-Math.abs(We-fe))[0]??fe})();if(le!==M.x||U!==M.y||Y!==M.width||re!==M.height){const se=()=>new Set(mt(Xe(o)).map(ve=>ft(ve))),ge=se(),We={x:M.x,y:M.y,width:M.width,height:M.height};n.resizeShape(M,{x:le,y:U,width:Y,height:re});const Ue=se(),Rt=[...Ue].filter(ve=>!ge.has(ve)).length,Nt=[...ge].filter(ve=>!Ue.has(ve)).length;Rt>Nt&&n.resizeShape(M,We)}}}}const $=Math.max(...D.map(L=>L.x+L.width/2))+K0;if($>M.x+M.width&&n.resizeShape(M,{x:M.x,y:M.y,width:$-M.x,height:M.height}),!!b)for(const L of x){const z=p(L.flow.id),j=L.flow.source===A.participant.id?L.flow.target:L.flow.target===A.participant.id?L.flow.source:void 0,B=j?p(j):void 0;if(!z||!B||B.type==="bpmn:Participant")continue;const U=B.x+B.width/2;if(U<M.x+10||U>M.x+M.width-10)continue;const Y=M.y>B.y,re=Y?B.y+B.height:B.y,Q=Y?M.y:M.y+M.height,fe=L.flow.source===A.participant.id?[{x:U,y:Q},{x:U,y:re}]:[{x:U,y:re},{x:U,y:Q}],ye=Xe(o),Ce={...ye.edges.find(lt=>lt.id===L.flow.id),waypoints:fe};_n(Ce,ai(ye)).length||n.updateWaypoints(z,fe)}}};X0(!1);for(const b of x){const A=b.flow;n.connect(f(A.source),f(A.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:A.id,name:A.name})})}{const M=new Set([...w.map(B=>B.flow.id),...x.map(B=>B.flow.id)].filter(B=>!!B)),D=o.filter(B=>!!B.waypoints),$=(B,U)=>Math.abs(U.x-B.x)<2?"L":Math.abs(U.x-(B.x+B.width))<2?"R":Math.abs(U.y-B.y)<2?"T":Math.abs(U.y-(B.y+B.height))<2?"B":void 0,L=new Map,z=(B,U,Y)=>{if(!B||!U||typeof B.x!="number")return;const re=$(B,U);if(!re)return;let Q=L.get(B.id);Q||L.set(B.id,Q=new Map),Q.set(re,[...Q.get(re)??[],Y])};for(const B of D){const U=B.waypoints;!U||U.length<2||(z(B.source,U[0],{id:B.id,dir:"out"}),z(B.target,U[U.length-1],{id:B.id,dir:"in"}))}const j=new Set;for(const[B,U]of L){const Y=p(B);if(!Y||typeof Y.x!="number"||![...U.values()].some(Ae=>{const ne=Ae.filter(le=>le.dir==="in");return Ae.length>=3&&ne.length>=1&&Ae.some(le=>le.dir==="out")&&ne.some(le=>M.has(le.id))}))continue;const Q=d(Y);if(!Q||j.has(Q.id)||(Q.children??[]).some(Ae=>Ae.type==="bpmn:Lane"))continue;const fe=(dE=U.get("T"))!=null&&dE.length?(hE=U.get("B"))!=null&&hE.length?void 0:"B":"T";if(!fe||(fe==="T"?Y.y-Q.y:Q.y+Q.height-(Y.y+Y.height))>=O)continue;const Ce=(Q.children??[]).filter(Ae=>!("waypoints"in Ae&&Ae.waypoints)&&Ae.type!=="label"&&typeof Ae.x=="number"),lt=Q.y+Q.height;n.resizeShape(Q,{x:Q.x,y:Q.y,width:Q.width,height:Q.height+O}),ee(lt,Q.id,O),fe==="T"&&Ce.length&&n.moveElements(Ce,{x:0,y:O}),j.add(Q.id)}}const Rh=20,Z0=4,gN=2,yN=[10,30,80],Kr=()=>{const b=Xe(o);return{bad:mt(b).filter(A=>A.kind==="edge-crosses-shape"||A.kind==="edge-overlap-opposite"||A.kind==="edge-overlap-mixed").length,crossings:Em(b),straight:b.edges.filter(A=>A.type==="bpmn:MessageFlow"&&A.waypoints.length===2).length}},Ca=b=>{const A=Xe(o),M=A.edges.find(D=>D.id===b);return M?_n(M,ai(A)).length:0},Ou=b=>Ca(b)>0,Du=b=>Xe(o).edges.filter(A=>A.type==="bpmn:MessageFlow"&&A.id!==b&&A.waypoints.length===2).length,vN=(b,A,M)=>js([{subtree:b,pool:A}],M),Q0=(b,A)=>A.bad>b.bad||A.crossings>b.crossings&&A.straight<=b.straight&&A.bad>=b.bad,Aa=(b,A)=>Q0(b,A)||A.straight<b.straight,So=(b,A,M=()=>!0,D=Q0,$=!1)=>{const L=Kr(),z=js(b,A,$);if(!z)return!1;const j=Kr();return D(L,j)||!M()?(z(),!1):!0},bN=(b,A,M,D=()=>!0)=>So([{subtree:b,pool:A}],M,D),Ro=b=>{var A;return!!((A=T.get(b))!=null&&A.node.participant)},Hs=new Map;for(const b of x){if(!Ro(b.flow.target))continue;const A=Hs.get(b.flow.target)??[];A.push(b),Hs.set(b.flow.target,A)}const Lu=[...Hs.keys()],Ch=new Set(w.map(b=>b.flow.target)),J0=b=>xn.findIndex(({op:A})=>A.participant.id===b);Lu.sort((b,A)=>{var $,L;const M=Ch.has(b)?1:0,D=Ch.has(A)?1:0;return M!==D?M-D:J0(($=T.get(b))==null?void 0:$.node.participant)-J0((L=T.get(A))==null?void 0:L.node.participant)});const Xr=b=>b.x+b.width/2,xN=b=>{const A=new Map;for(const $ of o.getAll()){const L=$;if(!L.waypoints||!L.source||!L.target)continue;(A.get(L.source.id)??A.set(L.source.id,[]).get(L.source.id)).push(L.target.id)}const M=new Set([b]),D=[b];for(let $=0;$<D.length;$++)for(const L of A.get(D[$])??[])M.has(L)||(M.add(L),D.push(L));return M},_N=(b,A)=>{const M=xN(A);let D;for(const $ of o.getAll()){const L=$;if(L.type!=="bpmn:MessageFlow"||!L.source||!L.target||L.target.id!==b||M.has(L.source.id))continue;const z=L.source;if(typeof z.x!="number"||z.type==="bpmn:Participant")continue;const j=Xr(z);(D===void 0||j>D)&&(D=j)}return D},Ah=(b,A)=>{const M=p(b.flow.source);if(M)return M.type==="bpmn:Participant"?_N(M.id,A):Xr(M)},eE=b=>{let A;for(const M of Hs.get(b)??[]){const D=Ah(M,b);D!==void 0&&(!A||D>A.cx)&&(A={op:M,cx:D})}return A==null?void 0:A.op},wN=b=>{const A=eE(b),M=p(b),D=A?Ah(A,b):void 0;return M&&D!==void 0?D-Xr(M):void 0},EN=b=>{const A=wN(b);return A!==void 0&&Math.abs(A)<Rh},Mh=(b,A,M,D,$)=>{var L;for(let z=!0;z;){z=!1;for(const j of x){if(j.flow.id===M)continue;const B=A.has(j.flow.source),U=A.has(j.flow.target);if(B===U||D(B?j.flow.source:j.flow.target))continue;const Y=B?j.flow.target:j.flow.source;if($(Y)||!Ro(Y))continue;const re=p(j.flow.id);if(!(re!=null&&re.waypoints)||re.waypoints.length!==2)continue;const Q=p(Y),fe=(L=T.get(Y))==null?void 0:L.node.participant;if(!Q||!fe)continue;const ye=Eo(Y,Ce=>Ce.x>=Q.x).filter(Ce=>!A.has(Ce.id));if(!(!ye.length||ye.some(Ce=>$(Ce.id)))){for(const Ce of ye)A.add(Ce.id);b.set(fe,[...b.get(fe)??[],...ye]),z=!0}}}return[...b].map(([z,j])=>({subtree:j,pool:f(z)}))},tE=(b,A,M,D,$)=>Mh(new Map([[A,[...b]]]),new Set(b.map(L=>L.id)),D,L=>L===M,L=>L===$),Ph=b=>{const A=eE(b);if(!A)return null;const M=p(b),D=p(A.flow.source),$=Ah(A,b);if(!M||!D||$===void 0)return null;const L=$-Xr(M);if(L>=Rh){const z=T.get(b).node.participant,j=Eo(b,B=>B.x>=M.x);return{groups:tE(j,z,b,A.flow.id,A.flow.source),dx:L}}if(-L>=Rh&&Ro(A.flow.source)){const z=T.get(A.flow.source).node.participant,j=Eo(A.flow.source,B=>B.x>=D.x&&!EN(B.id));return{groups:tE(j,z,A.flow.source,A.flow.id,b),dx:-L}}return null},nE=()=>Lu.map(b=>({id:b,plan:Ph(b)})).filter(b=>!!b.plan).sort((b,A)=>Math.min(...b.plan.groups.flatMap(M=>M.subtree.map(D=>D.x)))-Math.min(...A.plan.groups.flatMap(M=>M.subtree.map(D=>D.x)))).map(b=>b.id);for(let b=0;b<3;b++){const A=Kr(),M=[];for(const $ of nE()){const L=Ph($);if(!L)continue;const z=js(L.groups,L.dx);z&&M.push(z)}if(!M.length)break;if(!Aa(A,Kr()))continue;for(const $ of M.reverse())$();let D=!1;for(const $ of nE()){const L=Ph($);L&&So(L.groups,L.dx,()=>!0,Aa)&&(D=!0)}if(!D)break}for(const b of Lu){if(Ch.has(b))continue;const A=T.get(b);if(!A||A.node.lane!==void 0)continue;const M=V(A);if(M===void 0)continue;const D=p(b),$=D?d(D):void 0;if(!D||!$)continue;const L=$.y+Z+R(`pool:${A.node.participant??""}`,M)*O,z=L-(D.y+D.height/2);z!==0&&!J($,D,D.x+D.width/2,L)&&n.moveElements([D],{x:0,y:z})}for(const b of Lu.flatMap(A=>Hs.get(A)??[])){if(!Ou(b.flow.id))continue;const A=p(b.flow.target);if(!A)continue;const M=f(T.get(b.flow.target).node.participant),D=Eo(b.flow.target,j=>j.x>=A.x),$=A.width+F,L=Ca(b.flow.id),z=Du(b.flow.id);for(let j=1;j<=Z0;j++){const B=()=>Ca(b.flow.id)<L&&Du(b.flow.id)>=z;if(bN(D,M,$*j,B))break}}const Th=x.map(b=>({id:b.flow.id,source:b.flow.source,target:b.flow.target,preexisting:!1})),iE=new Set(Th.map(b=>b.id));for(const b of o.filter(A=>A.type==="bpmn:MessageFlow"))iE.has(b.id)||!b.source||!b.target||b.source.type==="bpmn:Participant"!=(b.target.type==="bpmn:Participant")&&Th.push({id:b.id,source:b.source.id,target:b.target.id,preexisting:!0});for(const b of Th){if(!Ou(b.id))continue;const A=p(b.source),M=p(b.target);if(!A||!M)continue;let D,$,L;if(b.preexisting){const[j,B]=A.type==="bpmn:Participant"?[M,A]:[A,M];if(D=Xr(j),D<B.x||D>B.x+B.width)continue;[$,L]=j.y<B.y?[j.y+j.height,B.y]:[B.y+B.height,j.y]}else{if(A.type==="bpmn:Participant"||M.type==="bpmn:Participant"||(D=A.x+A.width/2,Math.abs(D-(M.x+M.width/2))>15))continue;[$,L]=A.y<M.y?[A.y+A.height,M.y]:[M.y+M.height,A.y]}const z=[...T.values()].map(j=>p(j.node.id)).filter(j=>!!j&&j.id!==A.id&&j.id!==M.id).filter(j=>j.x<=D&&D<=j.x+j.width&&j.y+j.height>$&&j.y<L).sort((j,B)=>j.x-B.x);for(const j of z){const B=(mE=T.get(j.id))==null?void 0:mE.node.participant,U=B?p(B):void 0;if(!B||!U)continue;const Y=[...T.values()].filter(le=>le.node.participant===B).map(le=>le.node.id),re=le=>le.map(se=>p(se)).filter(se=>!!se),fe=[dN(j.id,le=>{var se;return((se=T.get(le.id))==null?void 0:se.node.participant)===B}),re(Y)].filter(le=>le.length).map(le=>[{subtree:le,pool:U}]);if(b.preexisting){const le=re(Y);le.length&&fe.push(Mh(new Map([[B,[...le]]]),new Set(le.map(se=>se.id)),b.id,()=>!1,se=>se===A.id||se===M.id))}const ye=j.width+F,Ce=Ca(b.id),lt=Du(b.id),Ae=()=>Ca(b.id)<Ce&&Du(b.id)>=lt;let ne=!1;for(const le of fe){for(let se=1;se<=Z0;se++)if(So(le,ye*se,Ae)){ne=!0;break}if(ne)break}if(!Ou(b.id))break}}const Iu=()=>{var A;const b=new Set;for(const M of mt(Xe(o)))M.kind!=="edge-crosses-shape"||iE.has(M.edge)||((A=p(M.edge))==null?void 0:A.type)==="bpmn:MessageFlow"&&b.add(`${M.edge}>${M.shape}`);return b},SN=(b,A)=>Kr().bad>=b&&[...Iu()].some(M=>!A.has(M)),rE=b=>{var A,M;return Ca(b)===0&&((M=(A=p(b))==null?void 0:A.waypoints)==null?void 0:M.length)===2},RN=(b,A,M)=>{const D=new Set(b.flatMap(L=>L.subtree.map(z=>z.id))),$=[...Iu()].filter(L=>!M.has(L)).map(L=>L.split(">")[1]);return[...new Set($)].filter(L=>D.has(L)&&L!==A.source&&L!==A.target)},CN=(b,A,M,D,$)=>{const L=b.map(U=>({...U,subtree:U.subtree.filter(Y=>!$.includes(Y.id))})).filter(U=>U.subtree.length),z=new Set(L.flatMap(U=>U.subtree.map(Y=>Y.id))),j=()=>$.every(U=>{const Y=p(U);return!!Y&&w.filter(re=>re.flow.target===U&&z.has(re.flow.source)).every(re=>{const Q=p(re.flow.source);return!!Q&&Q.x+Q.width<=Y.x})});return So(L,A,()=>rE(M.id)&&[...Iu()].every(U=>D.has(U))&&j(),Aa,!0)};for(const b of x){if(!Ou(b.flow.id))continue;const A=p(b.flow.id);if(((gE=A==null?void 0:A.waypoints)==null?void 0:gE.length)!==2)continue;const M=p(b.flow.source),D=p(b.flow.target);if(!M||!D||M.type==="bpmn:Participant"||D.type==="bpmn:Participant"||!Ro(b.flow.source)||!Ro(b.flow.target)||Math.abs(Xr(M)-Xr(D))>gN)continue;const $=Xr(M),L=A.waypoints.map(Ce=>Ce.y),[z,j]=[Math.min(...L),Math.max(...L)],B=ai(Xe(o)).filter(Ce=>Ce.id!==M.id&&Ce.id!==D.id&&Ce.x<$&&$<Ce.x+Ce.width&&z<Ce.y+Ce.height&&Ce.y<j);if(!B.length)continue;const U=(yE=T.get(b.flow.source))==null?void 0:yE.node.participant,Y=(vE=T.get(b.flow.target))==null?void 0:vE.node.participant;if(!U||!Y)continue;const re=new Map;for(const[Ce,lt,Ae]of[[b.flow.source,M,U],[b.flow.target,D,Y]]){const ne=re.get(Ae)??[],le=Eo(Ce,se=>se.x>=lt.x).filter(se=>!ne.some(ge=>ge.id===se.id));re.set(Ae,[...ne,...le])}const Q=new Set([...re.values()].flat().map(Ce=>Ce.id)),fe=Mh(re,Q,b.flow.id,Ce=>Ce===b.flow.source||Ce===b.flow.target,()=>!1),ye=Math.max(...B.map(Ce=>Ce.x+Ce.width));for(const Ce of yN){const lt=ye+Ce-$;if(lt<=0)continue;const Ae=Kr().bad,ne=Iu();let le=[],se=!0;const ge=()=>!rE(b.flow.id)||se&&(le=RN(fe,b.flow,ne),le.length)?!1:!SN(Ae,ne);if(So(fe,lt,ge,Aa))break;if(le.length&&(CN(fe,lt,b.flow,ne,le)||(se=!1,So(fe,lt,ge,Aa))))break}}{const b=M=>M.y+M.height/2,A=[];for(const M of T.keys()){if(!Ro(M))continue;const D=w.filter(z=>z.flow.target===M);if(D.length!==1)continue;const $=p(D[0].flow.source),L=p(M);!$||!L||!T.has($.id)||Math.abs(b($)-b(L))>1||L.x-($.x+$.width)<=F+1||A.push({id:M,pred:$,node:L})}A.sort((M,D)=>M.node.x-D.node.x);for(const{id:M}of A){const D=T.get(M),$=p(M),L=p(w.find(Q=>Q.flow.target===M).flow.source);if(!$||!L)continue;const z=$.x-(L.x+L.width);if(z<=F+1)continue;const j=f(D.node.participant),B=Eo(M,Q=>Q.x>=$.x),U=Kr(),Y=vN(B,j,-(z-F));if(!Y)continue;const re=Kr();(re.bad>U.bad||re.crossings>=U.crossings||re.straight<U.straight)&&Y()}}X0(!0);const AN=10,MN=400,PN=b=>[...b.incoming??[],...b.outgoing??[]].filter(A=>A.type==="bpmn:DataInputAssociation"||A.type==="bpmn:DataOutputAssociation").map(A=>A.source===b?A.target:A.source).filter(A=>!!A&&typeof A.y=="number"),TN=o.filter(b=>b.type==="bpmn:DataStoreReference"&&h.has(b.id)),kN=(b,A)=>{const M=b.x+b.width/2,D=b.y+b.height/2;let $;for(const L of TN){if((d(L)??u())!==A||L.y<b.y+b.height)continue;const z=Math.abs(L.x+L.width/2-M);z>MN||z<L.width||!PN(L).some(B=>B.height===b.height&&Math.abs(B.y+B.height/2-D)<=AN&&L.y>=B.y+B.height)||(!$||z<$.dx||z===$.dx&&L.id<$.id)&&($={dx:z,id:L.id,cy:L.y+L.height/2})}return $==null?void 0:$.cy};for(const b of g){const A=b.associations??[],M=A.map(L=>L.source===b.dataStore.id?L.target:L.source).map(p).find(Boolean),D=M?d(M)??u():u(),$=M?{x:M.x+M.width/2,y:kN(M,D)??M.y+M.height+110}:{x:200,y:wt+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:b.dataStore.id,name:b.dataStore.name})},$,D);for(const L of A)Y0(b.dataStore.id,L)}for(const b of y){const M=f(b.association.target).type==="bpmn:DataStoreReference"?b.association.target:b.association.source;Y0(M,b.association)}let oE=0;const Co=10,aE=40,ON=(b,A)=>{const M=A.map(B=>d(B)).filter(B=>!!B);for(const B of M){const U=Co,Y=B.y,re=B.y+B.height,Q=B.x,fe=B.x+B.width;if(Math.abs(b.y-Y)<U){const ye=Y+U-b.y;b.y+=ye,b.height-=ye}if(Math.abs(b.y+b.height-re)<U&&(b.height=re-U-b.y),Math.abs(b.x-Q)<U){const ye=Q+U-b.x;b.x+=ye,b.width-=ye}Math.abs(b.x+b.width-fe)<U&&(b.width=fe-U-b.x)}if(!M.length)return;const D=Math.min(...M.map(B=>B.y)),$=Math.max(...M.map(B=>B.y+B.height)),L=D-b.y,z=b.y+b.height-$,j=aE-Co;if(L>0!=z>0)if(L>0&&L<j){const B=L+Co;b.y+=B,b.height-=B}else z>0&&z<j&&(b.height-=z+Co)},DN=(b,A)=>{const M=Co,D=30,$=o.filter(L=>L.type==="bpmn:Group"&&L.id!==A);for(const L of $){const z=L.x,j=L.x+L.width,B=L.y,U=L.y+L.height,Y=b.y<U&&B<b.y+b.height,re=b.x<j&&z<b.x+b.width;if(Y){if(Math.abs(b.x-j)<M){const Q=Math.min(j+M-b.x,D);Q>0&&b.width-Q>0&&(b.x+=Q,b.width-=Q)}if(Math.abs(b.x+b.width-z)<M){const Q=Math.min(b.x+b.width-(z-M),D);Q>0&&b.width-Q>0&&(b.width-=Q)}}if(re){if(Math.abs(b.y-U)<M){const Q=Math.min(U+M-b.y,D);Q>0&&b.height-Q>0&&(b.y+=Q,b.height-=Q)}if(Math.abs(b.y+b.height-B)<M){const Q=Math.min(b.y+b.height-(B-M),D);Q>0&&b.height-Q>0&&(b.height-=Q)}}}},kh=(b,A)=>{const M=aE,D=Math.min(...b.map(B=>B.x))-M,$=Math.min(...b.map(B=>B.y))-M,L=Math.max(...b.map(B=>B.x+B.width))+M,z=Math.max(...b.map(B=>B.y+B.height))+M,j={x:D,y:$,width:L-D,height:z-$};return ON(j,b),DN(j,A),j};for(const b of E){const A=(b.group.members??[]).map(p).filter($=>!!$);let M;A.length?M=kh(A,b.group.id):(M={x:300+oE*350,y:40,width:300,height:200},oE++);const D=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:b.group.id}),width:M.width,height:M.height},{x:M.x+M.width/2,y:M.y+M.height/2},u());b.group.name&&n.updateLabel(D,b.group.name),(bE=b.group.members)!=null&&bE.length&&k(D,"bwl:Members",{refs:b.group.members.join(" ")})}{const b=o.filter($=>!!$.waypoints),A=new Map,M=($,L)=>{!$||!L||(A.has($)||A.set($,new Set),A.get($).add(L))};for(const $ of b){const L=(xE=$.source)==null?void 0:xE.id,z=(_E=$.target)==null?void 0:_E.id;M(L,z),((wE=$.type)!=null&&wE.includes("DataOutputAssociation")||(EE=$.type)!=null&&EE.includes("DataInputAssociation")||$.type==="bpmn:Association")&&M(z,L)}const D=o.filter($=>$.type==="bpmn:Group");for(const $ of D){const z=(((SE=$.businessObject.extensionElements)==null?void 0:SE.values)??[]).find(Ae=>Ae.$type==="bwl:Members"),j=((z==null?void 0:z.refs)??"").split(" ").filter(Boolean);if(!j.length)continue;const B=new Set(j),U=[...j];for(;U.length;){const Ae=U.shift();for(const ne of A.get(Ae)??[])B.has(ne)||(B.add(ne),U.push(ne))}const Y=$.x,re=$.x+$.width,Q=$.y,fe=$.y+$.height,ye=Ae=>w.filter(ne=>ne.flow.target===Ae).length,Ce=Ae=>{var le;const ne=((le=p(Ae))==null?void 0:le.type)??"";if(ne==="bpmn:StartEvent"&&ye(Ae)===0)return!1;if(ne.endsWith("Gateway")){const se=w.filter(ge=>ge.flow.target===Ae).map(ge=>ge.flow.source);if(se.length&&se.every(ge=>{var We;return((We=p(ge))==null?void 0:We.type)==="bpmn:StartEvent"&&ye(ge)===0}))return!1}return!0},lt=o.filter(Ae=>mr(Ae)).filter(Ae=>Ae.type!=="bpmn:Group"&&Ae.type!=="bpmn:Participant"&&Ae.type!=="bpmn:TextAnnotation"&&!B.has(Ae.id)&&Ro(Ae.id)&&Ce(Ae.id)&&Ae.x<re&&Ae.x+Ae.width>Y&&Ae.y<fe&&Ae.y+Ae.height>Q);if(lt.length)for(const Ae of[-1,1]){const ne=lt.filter(be=>(be.x+be.width-Y<=re-be.x?-1:1)===Ae);if(!ne.length)continue;const le=[];for(const be of ne){const oe=le.find(me=>me.some(Le=>be.y<Le.y+Le.height&&be.y+be.height>Le.y));oe?oe.push(be):le.push([be])}const se=new Map;for(const be of le){let oe=Ae<0?Y-Co:re+Co;for(const me of[...be].sort((Le,Ke)=>Ae<0?Ke.x-Le.x:Le.x-Ke.x)){const Le=Ae<0?Math.min(me.x,oe-me.width):Math.max(me.x,oe);oe=Ae<0?Le-Xi:Le+me.width+Xi,Le!==me.x&&Math.sign(Le-me.x)===Ae&&se.set(me.id,Le-me.x)}}const ge=new Map,We=be=>ge.get(be)===be||!ge.get(be)?be:We(ge.get(be));for(const be of ne)ge.set(be.id,be.id);for(const be of x){const oe=se.has(be.flow.source)?be.flow.source:void 0,me=se.has(be.flow.target)?be.flow.target:void 0;if(!oe||!me)continue;const Le=p(be.flow.id);((RE=Le==null?void 0:Le.waypoints)==null?void 0:RE.length)===2&&ge.set(We(oe),We(me))}const Ue=new Map;for(const be of ne){if(!se.has(be.id))continue;const oe=We(be.id);Ue.set(oe,[...Ue.get(oe)??[],be])}const Rt=[...Ue.values()].sort((be,oe)=>Ae<0?Math.min(...be.map(me=>me.x))-Math.min(...oe.map(me=>me.x)):Math.max(...oe.map(me=>me.x))-Math.max(...be.map(me=>me.x))),Nt=[];let ve=!0;for(const be of Rt){const oe=be.map(Ke=>se.get(Ke.id)??0).reduce((Ke,Oe)=>Math.abs(Oe)>Math.abs(Ke)?Oe:Ke,0),me=new Map;let Le=!0;for(const Ke of be){const Oe=d(Ke);if(!Oe){Le=!1;break}me.has(Oe.id)||me.set(Oe.id,{subtree:[],pool:Oe}),me.get(Oe.id).subtree.push(Ke)}Le&&So([...me.values()],oe,()=>!0,Aa)?Nt.push({shapes:be,dx:oe}):ve=!1}if(!ve)for(const be of Nt.reverse())n.moveElements(be.shapes,{x:-be.dx,y:0})}}}{const b=new Set([...E.map(A=>A.group.id),...Qt(e,"group.update").map(A=>A.id)]);for(const A of o.filter(M=>M.type==="bpmn:Group")){if(b.has(A.id))continue;const D=(((CE=A.businessObject.extensionElements)==null?void 0:CE.values)??[]).find(j=>j.$type==="bwl:Members"),$=((D==null?void 0:D.refs)??"").split(" ").filter(Boolean).map(p).filter(j=>!!j);!$.length||!$.some(j=>{const B=h.get(j.id);return!B||B.x!==j.x||B.y!==j.y})||!$.some(j=>j.x<A.x||j.y<A.y||j.x+j.width>A.x+A.width||j.y+j.height>A.y+A.height)||n.resizeShape(A,kh($,A.id))}}{const A=new Map(io(Xe(o)).map(j=>[j.owner,j.rect])),M=o.filter(j=>!!j.waypoints),D=new Map,$=(j,B)=>{!j||!B||(D.has(j)||D.set(j,new Set),D.get(j).add(B))};for(const j of M){const B=(AE=j.source)==null?void 0:AE.id,U=(ME=j.target)==null?void 0:ME.id;$(B,U),((PE=j.type)!=null&&PE.includes("DataOutputAssociation")||(TE=j.type)!=null&&TE.includes("DataInputAssociation")||j.type==="bpmn:Association")&&$(U,B)}const L=j=>w.filter(B=>B.flow.target===j).length,z=j=>{var U;const B=((U=p(j))==null?void 0:U.type)??"";if(B==="bpmn:StartEvent"&&L(j)===0)return!1;if(B.endsWith("Gateway")){const Y=w.filter(re=>re.flow.target===j).map(re=>re.flow.source);if(Y.length&&Y.every(re=>{var Q;return((Q=p(re))==null?void 0:Q.type)==="bpmn:StartEvent"&&L(re)===0}))return!1}return!0};for(const j of o.filter(B=>B.type==="bpmn:Group")){const U=(((kE=j.businessObject.extensionElements)==null?void 0:kE.values)??[]).find(oe=>oe.$type==="bwl:Members"),Y=((U==null?void 0:U.refs)??"").split(" ").filter(Boolean);if(!Y.length)continue;const re=Y.map(p).filter(oe=>!!oe);if(!re.length||!(E.some(oe=>oe.group.id===j.id)||Qt(e,"group.update").some(oe=>oe.id===j.id)||re.some(oe=>{const me=h.get(oe.id);return!me||me.x!==oe.x||me.y!==oe.y})))continue;const fe=new Set(Y),ye=[...Y];for(;ye.length;){const oe=ye.shift();for(const me of D.get(oe)??[])fe.has(me)||(fe.add(me),ye.push(me))}const Ce=j.x,lt=j.x+j.width,Ae=j.y,ne=j.y+j.height,le=oe=>{const me=A.get(oe.id),Le={x:oe.x,y:oe.y,width:oe.width,height:oe.height};return me?[Le,{x:me.x,y:me.y,width:me.width,height:me.height}]:[Le]},se=re.flatMap(le),ge=Math.min(...se.map(oe=>oe.x)),We=Math.max(...se.map(oe=>oe.x+oe.width)),Ue=Math.min(...se.map(oe=>oe.y)),Rt=Math.max(...se.map(oe=>oe.y+oe.height)),Nt={L:ge-Ce,R:lt-We,T:Ue-Ae,B:ne-Rt},ve=o.filter(oe=>mr(oe)).filter(oe=>oe.type!=="bpmn:Group"&&oe.type!=="bpmn:Participant"&&oe.type!=="bpmn:TextAnnotation"&&!fe.has(oe.id)&&z(oe.id)&&oe.x<lt&&oe.x+oe.width>Ce&&oe.y<ne&&oe.y+oe.height>Ae);if(!ve.length)continue;const be={L:0,R:0,T:0,B:0};for(const oe of ve){const me=le(oe),Le=Math.min(...me.map(Pe=>Pe.x)),Ke=Math.max(...me.map(Pe=>Pe.x+Pe.width)),Oe=Math.min(...me.map(Pe=>Pe.y)),ze=Math.max(...me.map(Pe=>Pe.y+Pe.height)),Qe={L:Ke-Ce,R:lt-Le,T:ze-Ae,B:ne-Oe},we=["L","R","T","B"].filter(Pe=>Qe[Pe]<=Nt[Pe]+.001);if(!we.length)continue;const ot=we.reduce((Pe,Et)=>Qe[Et]<Qe[Pe]?Et:Pe,we[0]);be[ot]=Math.max(be[ot],Math.min(Qe[ot]+10,Nt[ot]))}!be.L&&!be.R&&!be.T&&!be.B||n.resizeShape(j,{x:j.x+be.L,y:j.y+be.T,width:j.width-be.L-be.R,height:j.height-be.T-be.B})}}const sE=b=>{const A=b.waypoints;if(A!=null&&A.length){const D=A[Math.floor((A.length-1)/2)];return{x:D.x,y:D.y,width:0,height:0}}const M=b;return{x:M.x,y:M.y,width:M.width,height:M.height}};let zs=0;const cE=12,lE=14,LN=15,IN=300,BN=b=>{const A=b.split(`
7
- `),M=Math.max(...A.map(L=>No(L,cE))),D=Math.max(100,Math.min(IN,Math.ceil(M)+lE)),$=A.reduce((L,z)=>L+Math.max(1,Math.ceil((No(z,cE)+lE)/D)),0);return{width:D,height:Math.max(30,$*LN+10)}};for(const b of S){const A=b.association,M=((OE=b.placement)==null?void 0:OE.anchor)??(A?A.source===b.annotation.id?A.target:A.source:void 0),D=M?p(M):void 0,$=D?sE(D):void 0,L=BN(b.annotation.text??"");let z;if($&&b.placement){const[Y,re]=bc[b.placement.side],Q=b.placement.offset??50;z={x:$.x+$.width/2+Y*($.width/2+L.width/2+Q),y:$.y+$.height/2+re*($.height/2+L.height/2+Q)}}else $?(z={x:$.x+$.width/2+180+zs%3*260,y:$.y-110-zs%2*95},zs++):(z={x:300+zs*260,y:60},zs++);const j=D?d(D)??u():u(),B=j;$&&typeof B.x=="number"&&typeof B.width=="number"&&B.type==="bpmn:Participant"&&(z=wp(o,$,L,B,b.placement?{placement:b.placement}:{from:z}));const U=n.createShape({type:"bpmn:TextAnnotation",width:L.width,height:L.height,businessObject:i.create("bpmn:TextAnnotation",{id:b.annotation.id,text:b.annotation.text})},z,j);if(A){const Y=re=>re===b.annotation.id?U:f(re);n.connect(Y(A.source),Y(A.target),A.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:A.id})}:{type:"bpmn:Association"})}b.placement&&k(U,"bwl:Placement",I(b.placement))}for(const b of Qt(e,"association.add")){const A=b.association;n.connect(f(A.source),f(A.target),A.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:A.id})}:{type:"bpmn:Association"})}const uE=()=>new Set(o.getAll().filter(b=>b.type!=="label").map(b=>b.id));for(const b of Qt(e,"node.update")){let A=f(b.id);if(b.type&&vc(b.type)!==A.type){const M=A.x+A.width/2,D=A.y+A.height/2,$=uE();A=c.replaceElement(A,{type:vc(b.type),...b.eventDefinition?{eventDefinitionType:Ys[b.eventDefinition]}:{}});const L=uE(),z=[...$].filter(U=>U!==b.id&&!L.has(U));if(z.length)throw new dg({kind:"type-change-drops-elements",opIndex:e.indexOf(b),id:b.id,type:b.type,dropped:z});const j=Math.round(M-(A.x+A.width/2)),B=Math.round(D-(A.y+A.height/2));if(j!==0||B!==0){n.moveShape(A,{x:j,y:B});for(const U of[...A.incoming??[],...A.outgoing??[]])Sa(U)}}if(b.name!==void 0&&n.updateProperties(A,{name:b.name??void 0}),b.lane||b.band!==void 0){b.band!==void 0&&n.updateProperties(A,{"bwl:band":b.band});const M=A.y+A.height/2,D=d(A),$=b.lane?f(b.lane):((D==null?void 0:D.children)??[]).find(z=>z.type==="bpmn:Lane"&&M>=z.y&&M<=z.y+z.height);b.band!==void 0&&ht($==null?void 0:$.id,b.band,D);const L=$?$.y+(b.band===void 0?$.height/2:Math.min($.height/2,he)+R($.id,b.band)*O):b.band!==void 0&&D?D.y+Z+R(`pool:${D.id}`,b.band)*O:void 0;if(L!==void 0){const z=L-M;z!==0&&n.moveElements([A],{x:0,y:z})}}}for(const b of Qt(e,"sequenceFlow.update")){const A=f(b.id);if(b.source!==void 0||b.target!==void 0){const M=A,D=b.source!==void 0?f(b.source):M.source,$=b.target!==void 0?f(b.target):M.target,L=B=>({x:B.x+B.width/2,y:B.y+B.height/2});n.reconnect(M,D,$,[L(D),L($)]);const z=q0.get(M.id),j=$.y+$.height/2;if(z&&$.x>z.exit.x&&Math.abs(j-z.exit.y)>1){n.updateWaypoints(M,[z.exit,{x:z.exit.x,y:j},{x:$.x,y:j}]);const B=M.label;if(B&&z.label){const Y=Math.abs(z.label.y+B.height/2-z.channelY)<=O/5&&z.label.x+B.width>z.exit.x,re=z.exit.x+6,Q=$.x-6-B.width,fe=Y?Q>=re?{x:Math.max(re,Math.min(z.label.x,Q)),y:z.label.y+(j-z.channelY)}:void 0:z.label;fe&&(fe.x!==B.x||fe.y!==B.y)&&n.moveElements([B],{x:fe.x-B.x,y:fe.y-B.y})}}else Math.abs(j-(D.y+D.height/2))>1&&Sa(M)}b.name!==void 0&&n.updateProperties(A,{name:b.name??void 0}),b.condition!==void 0&&n.updateProperties(A,{name:((DE=b.condition)==null?void 0:DE.label)??void 0})}for(const b of Qt(e,"messageFlow.update"))b.name!==void 0&&n.updateProperties(f(b.id),{name:b.name??void 0});for(const b of Qt(e,"dataStore.update"))b.name!==void 0&&n.updateProperties(f(b.id),{name:b.name??void 0});for(const b of Qt(e,"annotation.update")){const A=f(b.id);if(b.text!==void 0&&n.updateProperties(A,{text:b.text}),b.placement===null)k(A,"bwl:Placement",null);else if(b.placement){const M=f(b.placement.anchor),D=sE(M),$=d(M)??u(),L=typeof $.x=="number"&&typeof $.width=="number"&&$.type==="bpmn:Participant",[z,j]=bc[b.placement.side],B=b.placement.offset??50,U={x:D.x+D.width/2+z*(D.width/2+A.width/2+B),y:D.y+D.height/2+j*(D.height/2+A.height/2+B)},Y=L?wp(o,D,{width:A.width,height:A.height},$,{placement:b.placement,selfId:b.id}):U;n.moveElements([A],{x:Y.x-(A.x+A.width/2),y:Y.y-(A.y+A.height/2)}),k(A,"bwl:Placement",I(b.placement))}}for(const b of Qt(e,"group.update")){const A=f(b.id);if(b.name!==void 0&&n.updateLabel(A,b.name??""),b.members){const M=b.members.map(p).filter(D=>!!D);M.length&&n.resizeShape(A,kh(M,b.id)),k(A,"bwl:Members",{refs:b.members.join(" ")})}}}function Ep(e){switch(e.kind){case"annotation-over-label":return[e.annotation];case"edge-crosses-shape":return[e.shape];case"shape-outside-container":return[e.shape];case"shape-overlap":return e.shapes;default:return[]}}function AR(e,t,n){var u,p;const{elementRegistry:i}=e,r=e.modeling,o=f=>mt(f).filter(d=>!t.has(ft(d))),a=f=>{var d;return((d=i.get(f))==null?void 0:d.type)==="bpmn:TextAnnotation"},s=Xe(i),c=o(s),l=[...new Set(c.flatMap(Ep))].filter(f=>n.has(f)&&a(f));if(l.length)for(const f of l){const d=i.get(f);if(!d||typeof d.x!="number"||typeof d.width!="number")continue;let h=d.parent,m;for(;h;){if(h.type==="bpmn:Participant"){m=h;break}h=h.parent}if(!m){const he=d.x+d.width/2,Me=d.y+d.height/2;m=i.getAll().find(Be=>{if(Be.type!=="bpmn:Participant")return!1;const nt=Be;return typeof nt.x=="number"&&typeof nt.width=="number"&&he>=nt.x&&he<=nt.x+nt.width&&Me>=nt.y&&Me<=nt.y+nt.height})}if(!m||typeof m.x!="number"||typeof m.width!="number")continue;const w=(((u=d.businessObject.extensionElements)==null?void 0:u.values)??[]).find(he=>he.$type==="bwl:Placement"),x=[...d.incoming??[],...d.outgoing??[]].find(he=>he.type==="bpmn:Association"),g=(w!=null&&w.anchor?i.get(w.anchor):void 0)??(x?((p=x.source)==null?void 0:p.id)===f?x.target:x.source:void 0);if(!g)continue;const y=g.waypoints,S=y!=null&&y.length?{x:y[Math.floor((y.length-1)/2)].x,y:y[Math.floor((y.length-1)/2)].y,width:0,height:0}:{x:g.x,y:g.y,width:g.width,height:g.height},E={width:d.width,height:d.height},T={x:d.x+d.width/2,y:d.y+d.height/2},k=w==null?void 0:w.side,I=[];k&&k in bc&&I.push(wp(i,S,E,m,{placement:{side:k,offset:(w==null?void 0:w.offset)??null},selfId:f}));for(const[he,Me]of[[-1,0],[1,0],[0,-1],[0,1]])for(let Be=1;Be<=CR;Be++)I.push({x:T.x+he*fg*Be,y:T.y+Me*fg*Be});const P={...s,edges:s.edges.filter(he=>he.id!==(x==null?void 0:x.id))},O=o(P),F=O.filter(he=>Ep(he).includes(f)).length;if(!F)continue;let Z;for(const he of I){const Me=he.x-T.x,Be=he.y-T.y;if(!Me&&!Be||he.x-E.width/2<m.x||he.x+E.width/2>m.x+m.width||he.y-E.height/2<m.y||he.y+E.height/2>m.y+m.height)continue;const nt={...P,shapes:P.shapes.map(xe=>xe.id===f?{...xe,x:xe.x+Me,y:xe.y+Be}:xe)},J=o(nt),te=J.filter(xe=>Ep(xe).includes(f)).length;if(te>=F||J.length>O.length)continue;const pe=Math.abs(Me)+Math.abs(Be);if((!Z||te<Z.mine||te===Z.mine&&(J.length<Z.all||J.length===Z.all&&pe<Z.dist))&&(Z={x:he.x,y:he.y,mine:te,all:J.length,dist:pe}),Z.mine===0&&Z.all<O.length)break}Z&&r.moveElements([d],{x:Z.x-T.x,y:Z.y-T.y})}}const MR=60;function Sp(e,t,n,i){const r=t.x+t.width,o=[],a=c=>{for(const l of c.children??[])l.type==="bpmn:Lane"&&(o.push(l),a(l))};a(t),e.resizeShape(t,{x:t.x,y:t.y,width:n,height:t.height},void 0,i);const s=t.x+n;for(const c of o)Math.abs(c.x+c.width-r)<1&&e.resizeShape(c,{x:c.x,y:c.y,width:s-c.x,height:c.height},void 0,i)}function PR(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=u=>mt(u).filter(p=>!t.has(ft(p))),a=u=>u.filter(p=>p.kind==="pool-overlap"),s=new Map(n.shapes.map(u=>[u.id,u])),c=(u,p)=>p.x>=u.x&&p.y>=u.y&&p.x+p.width<=u.x+u.width&&p.y+p.height<=u.y+u.height,l=u=>{if(!s.get(u))return[u];const f=new Set,d=new Set([u]);for(let m=0;m<4;m++){let v=!1;for(const w of n.shapes)w.type!=="bpmn:Group"||f.has(w.id)||[...d].some(x=>{const g=s.get(x);return g&&c(w,g)})&&(f.add(w.id),v=!0);for(const w of n.shapes)w.type!=="bpmn:Participant"||d.has(w.id)||[...f].some(x=>{const g=s.get(x);return g&&c(g,w)})&&(d.add(w.id),v=!0);if(!v)break}const h=n.shapes.filter(m=>!m.parent&&!d.has(m.id)&&!f.has(m.id)&&m.type!=="bpmn:Group"&&m.type!=="bpmn:Participant").filter(m=>[...f].some(v=>{const w=s.get(v);return w&&c(w,m)})).map(m=>m.id);return[...d,...f,...h]};for(let u=0;u<6;u++){const p=Xe(i),f=o(p),d=a(f);if(!d.length)return;const h=new Map(p.shapes.map(y=>[y.id,y]));let m=null;for(const y of d){if(y.kind!=="pool-overlap")continue;const[S,E]=y.pools,T=h.get(S),k=h.get(E);if(!T||!k)continue;const[I,P]=T.x<=k.x?[T,k]:[k,T];if(y.contained)continue;const O=s.get(I.id),F=s.get(P.id),Z=O&&F?Math.max(F.x-(O.x+O.width),0):MR,he=I.x+I.width+Z-P.x;if(he<=0)continue;const Me=l(P.id).filter(Be=>i.get(Be));Me.length&&(!m||he>m.dx)&&(m={movers:Me,dx:he})}if(!m)return;const v=m.movers.map(y=>i.get(y)).filter(y=>!!y&&typeof y.x=="number");if(!v.length)return;const w=f.length,x=d.length;r.moveElements(v,{x:m.dx,y:0});const g=o(Xe(i));if(!(a(g).length<x&&g.length<=w)){r.moveElements(v,{x:-m.dx,y:0});return}}}const xc=.5,mg=150;function TR(e,t){const{elementRegistry:n}=e,i=e.modeling,r=t.shapes.filter(g=>g.type==="bpmn:Participant");if(r.length<2)return;const o=r.map(g=>g.x+g.width),a=Math.max(...o);if(a-Math.min(...o)>xc)return;const s=r.map(g=>n.get(g.id)).filter(g=>!!g&&typeof g.x=="number");if(s.length<2)return;const c=new Map(r.map(g=>[g.id,g.x]));if(s.some(g=>Math.abs(g.x-c.get(g.id))>xc))return;const l=s.map(g=>g.x+g.width);if(Math.max(...l)-Math.min(...l)<=xc)return;const u=g=>g.x+g.width,p=g=>!!g&&typeof g.width=="number",f=g=>{const y={shapes:[],edges:[],lanes:[]},S=E=>{for(const T of E.children??[]){if("waypoints"in T&&T.waypoints){y.edges.push(T);continue}T.type!=="label"&&(T.type==="bpmn:Lane"?y.lanes.push(T):y.shapes.push(T),S(T))}};return S(g),y},d=new Map(s.map(g=>[g.id,f(g)]));let h=a;for(const g of s){const{shapes:y}=d.get(g.id),S=y.flatMap(E=>[u(E),...p(E.label)?[u(E.label)]:[]]);S.length&&(h=Math.max(h,Math.max(...S)+mg))}const m=s.filter(g=>Math.abs(u(g)-h)>xc);if(!m.length)return;for(const g of m){const y=u(g),{shapes:S,edges:E,lanes:T}=d.get(g.id);if([...S.flatMap(P=>[u(P),...p(P.label)?[u(P.label)]:[]]),...E.flatMap(P=>[...P.waypoints.map(O=>O.x),...p(P.label)?[u(P.label)]:[]])].some(P=>P>h)||[...(g.incoming??[]).map(P=>P.waypoints[P.waypoints.length-1]),...(g.outgoing??[]).map(P=>P.waypoints[0])].some(P=>!P||P.x>h||Math.abs(P.x-y)<1))return;if(h>y){const P={x:y,y:g.y,width:h-y,height:g.height},O=new Set([g.id,...S.map(Z=>Z.id),...E.map(Z=>Z.id),...T.map(Z=>Z.id)]);if(n.getAll().some(Z=>{var Be;if("waypoints"in Z&&Z.waypoints||Z.type==="bpmn:Group"||!p(Z))return!1;const he=Z.type==="label"?(Be=Z.labelTarget)==null?void 0:Be.id:Z.id;if(!he||O.has(he)||O.has(Z.id))return!1;const Me=Z;return Me.x<P.x+P.width&&Me.x+Me.width>P.x&&Me.y<P.y+P.height&&Me.y+Me.height>P.y}))return}}const v=()=>new Set(mt(Xe(n)).map(ft)),w=v(),x=m.map(g=>g.width);for(const g of m)Sp(i,g,h-g.x,{layout:!1});[...v()].every(g=>w.has(g))||m.forEach((g,y)=>Sp(i,g,x[y],{layout:!1}))}function kR(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=l=>mt(l).filter(u=>!t.has(ft(u))),a=(l,u)=>u.x>=l.x&&u.y>=l.y&&u.x+u.width<=l.x+l.width&&u.y+u.height<=l.y+l.height,s=l=>({l:Math.min(...l.map(u=>u.x)),t:Math.min(...l.map(u=>u.y)),r:Math.max(...l.map(u=>u.x+u.width)),b:Math.max(...l.map(u=>u.y+u.height))}),c=n.shapes.filter(l=>{var u;return l.type==="bpmn:Group"&&!((u=l.members)!=null&&u.length)});if(c.length)for(const l of c){const u=i.get(l.id);if(!u||typeof u.x!="number")continue;const p=n.shapes.filter(E=>E.id!==l.id&&E.type!=="bpmn:Group"&&a(l,E));if(!p.length)continue;const f=p.map(E=>i.get(E.id)).filter(E=>!!E&&typeof E.x=="number");if(f.length!==p.length)continue;const d=s(p),h=s(f),m=h.l+(l.x-d.l),v=h.t+(l.y-d.t),w=h.r+(l.x+l.width-d.r),x=h.b+(l.y+l.height-d.b),g={x:m,y:v,width:w-m,height:x-v};if(g.width<=0||g.height<=0||Math.abs(g.x-u.x)<1&&Math.abs(g.y-u.y)<1&&Math.abs(g.width-u.width)<1&&Math.abs(g.height-u.height)<1)continue;const y=o(Xe(i)).length,S={x:u.x,y:u.y,width:u.width,height:u.height};r.resizeShape(u,g),o(Xe(i)).length>y&&r.resizeShape(u,S)}}const _c=20,wc=10;function OR(e,t,n,i){var p,f;const{elementRegistry:r}=e,o=e.modeling,a=d=>new Set(mt(d,{includeObservationOnly:!0}).filter(h=>h.kind==="edge-along-group-boundary").map(ft)),s=Xe(r),c=mt(s,{includeObservationOnly:!0}).filter(d=>d.kind==="edge-along-group-boundary"&&!t.has(ft(d)));if(!c.length)return;const l=new Map(n.shapes.map(d=>[d.id,d])),u=new Map;for(const d of c)u.set(d.group,[...u.get(d.group)??[],d]);for(const[d,h]of u){const m=s.shapes.find(ke=>ke.id===d);if(!((p=m==null?void 0:m.members)!=null&&p.length))continue;const v=l.get(d);if(!(!v||Math.abs(v.x-m.x)>=.5||Math.abs(v.y-m.y)>=.5||Math.abs(v.width-m.width)>=.5||Math.abs(v.height-m.height)>=.5))continue;const x=m.members.map(ke=>r.get(ke)).filter(ke=>!!ke&&typeof ke.x=="number");if(!x.length)continue;const g=Math.min(...x.map(ke=>ke.x)),y=Math.min(...x.map(ke=>ke.y)),S=Math.max(...x.map(ke=>ke.x+ke.width)),E=Math.max(...x.map(ke=>ke.y+ke.height)),T=m.x,k=m.y,I=m.x+m.width,P=m.y+m.height;let O=T,F=k,Z=I,he=P;for(const ke of h){const N=s.edges.find(_=>_.id===ke.edge);if(!N)continue;const R=N.endpoints.some(_=>{const G=s.shapes.find(Re=>Re.id===_);if(!G||G.container)return!1;const q=G.x+G.width/2,ee=G.y+G.height/2;return T<q&&q<I&&k<ee&&ee<P});for(const _ of mn(N)){const G=_.axis==="v"?[k,P]:[T,I];Math.min(_.hi,G[1])-Math.max(_.lo,G[0])<cp||(_.axis==="v"?T<_.at&&_.at<I:k<_.at&&_.at<P)&&R||(_.axis==="v"?(Math.abs(_.at-T)<=$o&&(O=Math.max(O,_.at+_c)),Math.abs(_.at-I)<=$o&&(Z=Math.min(Z,_.at-_c))):(Math.abs(_.at-k)<=$o&&(F=Math.max(F,_.at+_c)),Math.abs(_.at-P)<=$o&&(he=Math.min(he,_.at-_c))))}}if(O>g-wc&&(O=T),F>y-wc&&(F=k),Z<S+wc&&(Z=I),he<E+wc&&(he=P),O===T&&F===k&&Z===I&&he===P)continue;const Me=r.get(d),Be={x:Me.x,y:Me.y,width:Me.width,height:Me.height},nt=Xe(r),J=new Set(mt(nt).map(ft)),te=a(nt);o.resizeShape(Me,{x:O,y:F,width:Z-O,height:he-F});let pe=Xe(r),xe=mt(pe).filter(ke=>!J.has(ft(ke)));const K=[];if(xe.length>0&&xe.every(ke=>ke.kind==="label-over-line"&&!i.has(ke.edge)&&pe.edges.some(N=>N.id===ke.edge))){for(const ke of xe){if(ke.kind!=="label-over-line")continue;const N=pe.edges.find(ee=>ee.id===ke.edge),R=N&&xp(N,pe),_=(f=r.get(ke.edge))==null?void 0:f.label;if(!R||!_)continue;const G=R.x-_.x,q=R.y-_.y;o.moveElements([_],{x:G,y:q}),K.push({label:_,dx:G,dy:q})}pe=Xe(r),xe=mt(pe).filter(ke=>!J.has(ft(ke)))}const ie=a(pe),Te=[...ie].some(ke=>!te.has(ke));if(xe.length||Te||ie.size>=te.size){for(const ke of K.reverse())o.moveElements([ke.label],{x:-ke.dx,y:-ke.dy});o.resizeShape(Me,Be)}}}function gg(e,t,n=hg){var y,S;const i=ug(e),r=lg(t,Lm(i.elementRegistry)),o={edgeCrossings:{before:0,after:0,pairs:[],solidPairs:0,dashedPairs:0,mixedPairs:0,crossPoolMessages:0}};if(r.length)return{ok:!1,issues:r,findings:[],stats:o};const a=Xe(i.elementRegistry),s=new Set(mt(a).map(ft)),c=new Set(mt(a,{includeObservationOnly:!0}).map(ft)),l=new Set(a.edges.map(E=>E.id)),u=new Set(t.flatMap(E=>E.kind==="sequenceFlow.update"&&(E.source!==void 0||E.target!==void 0)?[E.id]:[])),p=new Set(a.shapes.map(E=>E.id)),f=pc(a),d=f.length,h=new Set(f.map(([E,T])=>`${E}|${T}`)),m=new Map;for(const E of i.elementRegistry.filter(T=>"waypoints"in T&&!!T.waypoints))E.label&&m.set(E.id,{wps:E.waypoints.map(T=>({x:T.x,y:T.y})),label:{x:E.label.x,y:E.label.y},source:(y=E.source)==null?void 0:y.id,target:(S=E.target)==null?void 0:S.id});const v=e.get("commandStack");try{Fh(v,()=>{n(t,i),PR(i,s,a),TR(i,a),kR(i,s,a),Hm(i,l);const E=gp(i,s);$m(i,h,l),Zm(i,s,l),Vm(i,l),fR(i,l,u),qm(i,s,l),gR(i,s,l),ig(i,s,l),ng(i,l,u),og(i,p),AR(i,s,p),gp(i,s,E),OR(i,c,a,l),ag(i,s),tg(i,m)})}catch(E){return{ok:!1,issues:[E instanceof dg?E.issue:{kind:"lower-failed",message:E instanceof Error?E.message:String(E)}],findings:[],stats:o}}const w=Xe(i.elementRegistry),x=mt(w,{includeObservationOnly:!0}).filter(E=>!c.has(ft(E))),g=Sm(w);return{ok:!0,issues:[],findings:x,stats:{edgeCrossings:{before:d,after:g.pairs.length,pairs:g.pairs,solidPairs:g.solidPairs,dashedPairs:g.dashedPairs,mixedPairs:g.mixedPairs,crossPoolMessages:g.crossPoolMessages}}}}function DR(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function yg(e,t){return typeof e.get=="function"?e.get(t):e[t]}function vg(e,t){const n=yg(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function bg(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(r=>(r==null?void 0:r.$type)===t)}function LR(e){return typeof e=="string"&&zu.includes(e)}function Ai(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function xg(e){const t=e.rootElements??[],n=t.find(J=>J.$type==="bpmn:Collaboration"),i=new Map(t.filter(J=>J.$type==="bpmn:Process").map(J=>[J.id,J])),r=[],o=[],a=[],s=[],c=[],l=[],u={poolOrders:{},bands:{},placements:{},afterColumns:{}},p=[],f=[],d=[],h=[],m=[],v=[],w=[],x=new Set,g=new Set,y=J=>{J&&x.add(J)},S=J=>{x.add(J),g.add(J)},E=J=>{const te=bg(J,"bwl:Placement");if(!te)return;const pe=typeof te.anchor=="string"?te.anchor:void 0;if(!pe||!LR(te.side))return;const xe=typeof te.offset=="number"?te.offset:void 0;m.push({owner:J.id,anchor:pe,side:te.side,...xe!==void 0?{offset:xe}:{}})},T=J=>{const te=bg(J,"bwl:Members"),pe=typeof(te==null?void 0:te.refs)=="string"?te.refs.split(/\s+/).filter(Boolean):[];pe.length&&w.push({owner:J.id,refs:pe})},k=J=>{var te;for(const pe of J)switch(y(pe.id),pe.$type){case"bpmn:TextAnnotation":S(pe.id),s.push({id:pe.id,text:typeof pe.text=="string"?pe.text:""}),E(pe);break;case"bpmn:Association":d.push({id:pe.id,type:pe.$type,source:Ai(pe.sourceRef),target:Ai(pe.targetRef)});break;case"bpmn:Group":{S(pe.id);const xe=(te=pe.categoryValueRef)==null?void 0:te.value;c.push({id:pe.id,...typeof xe=="string"&&xe?{name:xe}:{}}),T(pe);break}default:l.push({id:pe.id,type:pe.$type,reason:"type-outside-mvp"})}},I=J=>{for(const te of J.flowElements??[])y(te.id),l.push({id:te.id,type:te.$type,reason:"inside-container"}),(te.flowElements??[]).length&&I(te);for(const te of J.artifacts??[])y(te.id),l.push({id:te.id,type:te.$type,reason:"inside-container"})},P=(J,te)=>{const pe=J.flowElements??[],xe=(J.laneSets??[]).flatMap(V=>V.lanes??[]),K=new Map;for(const V of xe){y(V.id);for(const ie of V.flowNodeRef??[]){const Te=Ai(ie);Te&&K.set(Te,V.id)}}for(const V of pe){if(y(V.id),V.$type==="bpmn:SequenceFlow"){p.push({id:V.id,source:Ai(V.sourceRef),target:Ai(V.targetRef),...typeof V.name=="string"&&V.name?{name:V.name}:{}});continue}if(V.$type==="bpmn:DataStoreReference"){S(V.id),a.push({id:V.id,...V.name?{name:V.name}:{}});continue}const ie=DR(V.$type),Te=ie==="intermediateCatchEvent"?ju((V.eventDefinitions??[]).map(_=>_.$type)):void 0;if(!Dh(ie)||ie==="intermediateCatchEvent"&&!Te){l.push({id:V.id,type:V.$type,reason:"type-outside-mvp"});continue}S(V.id);const ke=ie==="boundaryEvent"?Ai(V.attachedToRef):void 0;o.push({id:V.id,type:ie,...V.name?{name:V.name}:{},...te?{participant:te}:{},...K.has(V.id)?{lane:K.get(V.id)}:{},...ke?{attachedTo:ke}:{},...Te?{eventDefinition:Te}:{}}),ie==="subProcess"&&I(V);const N=vg(V,"bwl:band");N!==void 0&&(u.bands[V.id]=N);const R=yg(V,"bwl:afterColumn");typeof R=="string"&&R!==""&&v.push([V.id,R]);for(const _ of V.dataOutputAssociations??[])y(_.id),h.push({id:_.id,type:_.$type,source:V.id,target:Ai(_.targetRef)});for(const _ of V.dataInputAssociations??[])y(_.id),h.push({id:_.id,type:_.$type,source:Ai((_.sourceRef??[])[0]),target:V.id})}k(J.artifacts??[])};if(n){const J=new Set;for(const te of n.participants??[]){S(te.id);const pe=Ai(te.processRef);pe&&J.add(pe);const xe=pe?i.get(pe):void 0,K=((xe==null?void 0:xe.laneSets)??[]).flatMap(ke=>ke.lanes??[]),V=K.map(ke=>({id:ke.id,...ke.name?{name:ke.name}:{}}));for(const ke of V)S(ke.id);const ie=!xe||(xe.flowElements??[]).length===0&&K.length===0&&(xe.artifacts??[]).length===0;r.push({id:te.id,...te.name?{name:te.name}:{},...ie?{blackBox:!0}:{},...V.length?{lanes:V}:{}});const Te=vg(te,"bwl:poolOrder");Te!==void 0&&(u.poolOrders[te.id]=Te),xe&&P(xe,te.id)}for(const te of n.messageFlows??[])y(te.id),f.push({id:te.id,source:Ai(te.sourceRef),target:Ai(te.targetRef),...typeof te.name=="string"&&te.name?{name:te.name}:{}});k(n.artifacts??[]);for(const[te,pe]of i)!J.has(te)&&(pe.flowElements??[]).length>0&&l.push({id:te,type:pe.$type,reason:"unreachable-process"})}else for(const J of i.values())P(J);const O=[],F=[],Z=[],he=[],Me=(J,te)=>!!J&&!!te&&g.has(J)&&g.has(te);for(const J of p){if(!Me(J.source,J.target)){l.push({id:J.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}O.push({id:J.id,source:J.source,target:J.target,...J.name?{name:J.name}:{}}),g.add(J.id)}for(const J of f){if(!Me(J.source,J.target)){l.push({id:J.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}F.push({id:J.id,source:J.source,target:J.target,...J.name?{name:J.name}:{}}),g.add(J.id)}for(const J of h){if(!Me(J.source,J.target)){l.push({id:J.id??"",type:J.type,reason:"endpoint-outside-mvp"});continue}he.push({...J.id?{id:J.id}:{},source:J.source,target:J.target}),J.id&&g.add(J.id)}for(const J of d){if(!Me(J.source,J.target)){l.push({id:J.id??"",type:J.type,reason:"endpoint-outside-mvp"});continue}Z.push({...J.id?{id:J.id}:{},source:J.source,target:J.target})}const Be=new Map(c.map(J=>[J.id,J]));for(const{owner:J,refs:te}of w){const pe=te.filter(K=>x.has(K)),xe=Be.get(J);xe&&pe.length&&(xe.members=pe)}for(const J of m)x.has(J.anchor)&&(u.placements[J.owner]={anchor:J.anchor,side:J.side,...J.offset!==void 0?{offset:J.offset}:{}});for(const[J,te]of v)x.has(te)&&(u.afterColumns[J]=te);return{definition:{...r.length?{participants:r}:{},nodes:o,sequenceFlows:O,...F.length?{messageFlows:F}:{},...a.length?{dataStores:a}:{},...he.length?{dataAssociations:he}:{},...s.length?{annotations:s}:{},...Z.length?{associations:Z}:{},...c.length?{groups:c}:{}},hints:u,omitted:l}}async function IR(e){const{definitions:t,warnings:n}=await Io(e);return{...xg(t),warnings:n}}const BR=new Set(["bpmn:ExclusiveGateway","bpmn:ParallelGateway","bpmn:InclusiveGateway","bpmn:EventBasedGateway","bpmn:ComplexGateway"]);function Rp(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function NR(e){return Rp(e.processRef)!==void 0}function $R(e){const t=new Set,n=r=>{const o=Rp(r);o&&t.add(o)},i=r=>{for(const o of r.flowElements??[]){n(o.sourceRef),n(o.targetRef),o.attachedToRef&&(n(o.attachedToRef),t.add(o.id));for(const a of o.dataOutputAssociations??[])t.add(o.id),n(a.targetRef);for(const a of o.dataInputAssociations??[]){t.add(o.id);for(const s of a.sourceRef??[])n(s)}(o.flowElements??[]).length&&i(o)}for(const o of r.artifacts??[])n(o.sourceRef),n(o.targetRef)};for(const r of e.rootElements??[])if(r.$type==="bpmn:Process")i(r);else if(r.$type==="bpmn:Collaboration"){for(const o of r.messageFlows??[])n(o.sourceRef),n(o.targetRef);for(const o of r.artifacts??[])n(o.sourceRef),n(o.targetRef)}return t}function FR(e){const t=[],n=i=>{for(const r of i.flowElements??[])BR.has(r.$type)&&t.push(r),(r.flowElements??[]).length&&n(r)};for(const i of e.rootElements??[])i.$type==="bpmn:Process"&&n(i);return t}function jR(e){if(!e)return!0;const t=(e.laneSets??[]).flatMap(n=>n.lanes??[]);return(e.flowElements??[]).length===0&&t.length===0&&(e.artifacts??[]).length===0}function Cp(e){const t=[],n=e.rootElements??[],i=$R(e);for(const o of FR(e))i.has(o.id)||t.push({ruleId:"CHK-FLOW-1",severity:"warning",targetKind:"flowNode",targetRefs:[o.id],params:{type:o.$type}});const r=n.find(o=>o.$type==="bpmn:Collaboration");if(r){const o=new Map(n.filter(s=>s.$type==="bpmn:Process").map(s=>[s.id,s])),a=[];for(const s of r.participants??[])NR(s)&&jR(o.get(Rp(s.processRef)))&&a.push(s.id);a.length&&t.push({ruleId:"CHK-POOL-1",severity:"info",targetKind:"participant",targetRefs:a,params:{count:a.length}})}return t}async function HR(e){const{definitions:t,warnings:n}=await Io(e);return{issues:Cp(t),warnings:n}}const zR=.5,GR=8,VR=new Set(["bpmn:Definitions","bpmn:Collaboration","bpmn:Process","bpmn:LaneSet","bpmn:ExtensionElements","bpmn:Documentation","bpmn:Relationship","bpmn:Property","bpmn:Category","bpmn:CategoryValue"]),Vo=e=>typeof e=="number"?e:Number(e??NaN),Ec=e=>{if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:""};function WR(e){const t=e,n=[],i=typeof t.name=="string"?t.name:typeof t.text=="string"?t.text:"";n.push(`n=${i.replace(/\s+/g," ").trim()}`);for(const o of["sourceRef","targetRef","attachedToRef","processRef","default"])t[o]!==void 0&&n.push(`${o}=${Ec(t[o])}`);if(String(e.$type)==="bpmn:Group"){const o=t.categoryValueRef,a=Array.isArray(o)?o:o==null?[]:[o];n.push(`cat=[${a.map(s=>`${Ec(s)}:${typeof(s==null?void 0:s.value)=="string"?s.value:""}`).sort().join(",")}]`)}Array.isArray(t.flowNodeRef)&&n.push(`lane=[${t.flowNodeRef.map(Ec).sort().join(",")}]`);const r=t.conditionExpression;return r&&typeof r.body=="string"&&n.push(`cond=${r.body}`),n.join("|")}function UR(e){const t=new Map,n=new Map,i=(a,s)=>{a&&t.set(a,[...t.get(a)??[],...s])},r=a=>{const s=a;return s?[Vo(s.x),Vo(s.y),Vo(s.width),Vo(s.height)]:[]},o=a=>{if(Array.isArray(a))return a.forEach(o);if(!a||typeof a!="object")return;const s=a,c=String(s.$type??"");if(c==="bpmndi:BPMNShape"||c==="bpmndi:BPMNEdge"){const l=Ec(s.bpmnElement);if(c==="bpmndi:BPMNShape")i(l,r(s.bounds));else{const p=Array.isArray(s.waypoint)?s.waypoint:[];i(l,p.flatMap(f=>[Vo(f.x),Vo(f.y)]))}const u=s.label;u!=null&&u.bounds&&l&&n.set(l,r(u.bounds).slice(0,2));return}for(const l of Object.values(s))(Array.isArray(l)||l&&typeof l=="object"&&"$type"in l)&&o(l)};return o(e.diagrams),{body:t,labels:n}}function _g(e){const t=UR(e),n=new Map,i=new Set,r=o=>{if(Array.isArray(o))return o.forEach(r);if(!o||typeof o!="object"||i.has(o))return;i.add(o);const a=o,s=String(a.$type??"");if(s.startsWith("bpmndi:")||s.startsWith("dc:")||s.startsWith("di:"))return;const c=typeof a.id=="string"?a.id:"";c&&s.startsWith("bpmn:")&&!VR.has(s)&&n.set(c,{type:s,props:WR(a),geometry:(t.body.get(c)??[]).join(","),label:(t.labels.get(c)??[]).join(",")});for(const l of Object.values(a))(Array.isArray(l)||l&&typeof l=="object")&&r(l)};return r(e),n}function wg(e,t,n){if(e===t)return!1;const i=e===""?[]:e.split(",").map(Number),r=t===""?[]:t.split(",").map(Number);return i.length!==r.length?!0:i.some((o,a)=>Math.abs(o-r[a])>n)}function Eg(e,t,n={}){const i=n.moveTolerance??zR,r=_g(e),o=_g(t),a=[],s=[],c=[];for(const[l,u]of o){const p=r.get(l);if(!p){a.push(l);continue}(p.type!==u.type||p.props!==u.props||wg(p.geometry,u.geometry,i)||wg(p.label,u.label,n.labelTolerance??GR))&&c.push(l)}for(const l of r.keys())o.has(l)||s.push(l);return{added:a.sort(),removed:s.sort(),modified:c.sort()}}async function qR(e,t,n={}){const[i,r]=await Promise.all([Io(e),Io(t)]);return{...Eg(i.definitions,r.definitions,n),warnings:[...i.warnings,...r.warnings]}}function YR(e){return new Set([...e.added,...e.modified])}function KR(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function Sg(e,t,{currentVersion:n}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const i=gg(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 XR=Symbol("bpmn-editor"),Ap={geometry:[],semantic:[]};function ZR(){const e=de.ref(!1),t=de.ref(!0),n=de.ref(!1),i=de.shallowRef(Ap),r=de.shallowRef(void 0),o=de.shallowRef(void 0);let a,s,c,l;const u=()=>{if(f(),!c){i.value=Ap;return}const x=mt(Xe(c.get("elementRegistry")),{includeObservationOnly:!0}),g=c.getDefinitions();i.value={geometry:x,semantic:g?Cp(g):[]}};function p(){return(c==null?void 0:c.get("i18nDisplay",!1))??void 0}function f(){const x=p();if(!x||!a){o.value=void 0;return}const g=x.locales(),y={};for(const S of g)y[S]={untranslated:x.untranslatedCount(S),reviewRequested:x.reviewRequestedCount(S)};o.value={designLocale:a.designLocale,locales:g,displayLocale:x.getDisplayLocale()??a.designLocale,counts:y}}function d(){const x=p();x&&(x.configure(a),a&&s&&(s=x.setDisplayLocale(s)))}const h=()=>{e.value=!0,u()};function m(x,g){x.get("canvas").getContainer().style.pointerEvents=g?"":"none";const y=x.get("keyboard");g?(l&&y.bind(l),l=void 0):l||(l=y.getBinding(),y.unbind())}function v(){if(!c)throw new Error("modeler not attached — 뷰 @ready 후 attach() 필요");return c}function w(){return c==null?void 0:c.get("commandStack")}return{dirty:e,editable:t,agentBusy:n,issues:i,revalidate:u,changeScope:r,i18n:o,configureI18n(x){a=x,d(),f()},setDisplayLocale(x){var y;s=x;const g=(y=p())==null?void 0:y.setDisplayLocale(x);g&&(s=g),f()},setChangeScope(x){r.value=x===void 0?void 0:new Set(x)},requestFocus(x){if(!c)return;const g=c.get("elementRegistry").get(x);g&&(c.get("canvas").scrollToElement(g,180),c.get("selection").select(g))},describeElement(x){const g=c==null?void 0:c.get("elementRegistry").get(x),y=g==null?void 0:g.businessObject;if(!y)return;const S=typeof y.name=="string"&&y.name.trim()!==""?y.name:y.text;return{name:typeof S=="string"&&S.trim()!==""?S.trim():void 0,type:typeof y.$type=="string"?y.$type:""}},attach(x){c&&this.detach(),c=x,c.get("eventBus").on("commandStack.changed",h),t.value||m(c,!1),d(),u()},detach(){c==null||c.get("eventBus").off("commandStack.changed",h),c&&!t.value&&m(c,!0),l=void 0,c=void 0,i.value=Ap,r.value=void 0,o.value=void 0},setEditable(x){t.value=x,c&&m(c,x)},async applyAgentBatch(x,g){const y=v();n.value=!0;try{const S=await Sg(y,x,{currentVersion:g});return S.status==="applied"&&(e.value=!1),S}finally{n.value=!1}},async importXml(x){const{warnings:g}=await v().importXML(x);return e.value=!1,r.value=void 0,u(),{warnings:sp(g)}},async saveXml(){const{xml:x}=await v().saveXML({format:!0});return e.value=!1,x??""},undo:()=>{var x;return(x=w())==null?void 0:x.undo()},redo:()=>{var x;return(x=w())==null?void 0:x.redo()},canUndo:()=>{var x;return((x=w())==null?void 0:x.canUndo())??!1},canRedo:()=>{var x;return((x=w())==null?void 0:x.canRedo())??!1}}}const QR=new RegExp("\\p{Script=Hangul}","u"),JR=/[\p{Script=Hiragana}\p{Script=Katakana}]/u,eC=new RegExp("\\p{Script=Han}","u");function Mp(e){const t=QR.test(e),n=JR.test(e);return t&&n?{script:"mixed"}:t?{script:"hangul",locale:"ko"}:n?{script:"kana",locale:"ja"}:{script:eC.test(e)?"han":"other"}}function Rg(e){var t,n;return((t=e==null?void 0:e.get)==null?void 0:t.call(e,"xml:lang"))??((n=e==null?void 0:e.$attrs)==null?void 0:n["xml:lang"])}function Cg(e){var i;const t=new Set,n=[];for(const r of(e==null?void 0:e.diagrams)??[])for(const o of((i=r==null?void 0:r.plane)==null?void 0:i.planeElement)??[]){const a=o==null?void 0:o.bpmnElement;if(!a||t.has(a))continue;t.add(a);const s=Ta(a);if(!s)continue;const c=s.target[s.key]??"";c&&n.push({bo:a,name:c,trs:Zs(a).filter(l=>ni(l))})}return n}const $a=e=>({id:e.bo.id,type:e.bo.$type,name:e.name});function tC(e){const t=Rg(e),n=Cg(e);let i;const r={},o=[],a=[],s=[];for(const h of n){const m=h.trs.filter(v=>(v.body??"")===h.name).map(ni);if(m.length){const v=[...m].sort().join("+");r[v]=(r[v]??0)+1,i=i?new Set([...i].filter(w=>m.includes(w))):new Set(m)}else h.trs.some(v=>v.body)?o.push($a(h)):s.push({e:h,inference:Mp(h.name)});for(const v of h.trs){const w=ni(v),x=v.body??"",g=Mp(x);g.locale&&g.locale!==w?a.push({...$a(h),locale:w,script:g.script}):w==="ko"&&g.script==="han"&&h.trs.some(y=>y!==v&&y.body===x)&&a.push({...$a(h),locale:w,script:"han"})}}const c=new Set(s.map(h=>h.inference.locale).filter(Boolean));let l,u;if(t)u="kept";else if(i&&i.size===1)[l,u]=[[...i][0],"matched"];else if(i&&i.size>1){const h=c.size===1?[...c][0]:void 0;h&&i.has(h)?[l,u]=[h,"matched"]:u="ambiguous"}else i?u="mixed":c.size===1?[l,u]=[[...c][0],"script"]:u=c.size>1?"mixed":"no-evidence";const p=t??l,f=[],d=[];for(const{e:h,inference:m}of s)m.locale?m.locale!==p&&f.push({...$a(h),locale:m.locale}):d.push({...$a(h),script:m.script});return{root:{current:t,proposed:l,reason:u},additions:f,undecided:d,drift:o,matchedBy:r,scriptMismatch:a}}function nC(e,t){const n=e.$model;let i=0;if(t.root.proposed&&!Rg(e)&&(e.set("xml:lang",t.root.proposed),i++),!t.additions.length)return i;const r=new Map(Cg(e).map(o=>[o.bo.id,o]));for(const{id:o,name:a,locale:s}of t.additions){const c=r.get(o);if(!c||c.name!==a||c.trs.some(f=>f.body))continue;const l=c.trs.find(f=>ni(f)===s);if(l){l.body=c.name,i++;continue}let u=c.bo.extensionElements;u||(u=n.create("bpmn:ExtensionElements",{values:[]}),u.$parent=c.bo,c.bo.extensionElements=u);const p=n.create(Pa,{body:c.name});p.set("xml:lang",s),p.$parent=u,u.get("values").push(p),i++}return i}function Ee(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function iC(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Pp={exports:{}},Ag;function rC(){if(Ag)return Pp.exports;Ag=1;var e=Pp.exports=function(t,n){if(n||(n=16),t===void 0&&(t=128),t<=0)return"0";for(var i=Math.log(Math.pow(2,t))/Math.log(n),r=2;i===1/0;r*=2)i=Math.log(Math.pow(2,t/r))/Math.log(n)*r;for(var o=i-Math.floor(i),a="",r=0;r<Math.floor(i);r++){var s=Math.floor(Math.random()*n).toString(n);a=s+a}if(o){var c=Math.pow(n,o),s=Math.floor(Math.random()*c).toString(n);a=s+a}var l=parseInt(a,n);return l!==1/0&&l>=Math.pow(2,t)?e(t,n):a};return e.rack=function(t,n,i){var r=function(a){var s=0;do{if(s++>10)if(i)t+=i;else throw new Error("too many ID collisions, use more bits");var c=e(t,n)}while(Object.hasOwnProperty.call(o,c));return o[c]=a,c},o=r.hats={};return r.get=function(a){return r.hats[a]},r.set=function(a,s){return r.hats[a]=s,r},r.bits=t||128,r.base=n||16,r},Pp.exports}var oC=rC(),aC=iC(oC);function Ni(e){if(!(this instanceof Ni))return new Ni(e);e=e||[128,36,1],this._seed=e.length?aC.rack(e[0],e[1],e[2]):e}Ni.prototype.next=function(e){return this._seed(e||!0)},Ni.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},Ni.prototype.claim=function(e,t){this._seed.set(e,t||!0)},Ni.prototype.assigned=function(e){return this._seed.get(e)||!1},Ni.prototype.unclaim=function(e){delete this._seed.hats[e]},Ni.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const sn={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};sn.td=sn.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],sn.option=sn.optgroup=[1,'<select multiple="multiple">',"</select>"],sn.thead=sn.tbody=sn.colgroup=sn.caption=sn.tfoot=[1,"<table>","</table>"],sn.polyline=sn.ellipse=sn.polygon=sn.circle=sn.text=sn.line=sn.path=sn.rect=sn.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function Ot(e,t=globalThis.document){var l;if(typeof e!="string")throw new TypeError("String expected");const n=/^<!--(.*?)-->$/s.exec(e);if(n)return t.createComment(n[1]);const i=(l=/<([\w:]+)/.exec(e))==null?void 0:l[1];if(!i)return t.createTextNode(e);if(e=e.trim(),i==="body"){const u=t.createElement("html");u.innerHTML=e;const{lastChild:p}=u;return p.remove(),p}let[r,o,a]=Object.hasOwn(sn,i)?sn[i]:sn._default,s=t.createElement("div");for(s.innerHTML=o+e+a;r--;)s=s.lastChild;if(s.firstChild===s.lastChild){const{firstChild:u}=s;return u.remove(),u}const c=t.createDocumentFragment();return c.append(...s.childNodes),c}function sC(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 In(e,...t){const n=e.style;return H(t,function(i){i&&H(i,function(r,o){n[o]=r})}),e}function kn(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const cC=Object.prototype.toString;function Bt(e){return new _r(e)}function _r(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}_r.prototype.add=function(e){return this.list.add(e),this},_r.prototype.remove=function(e){return cC.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},_r.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},_r.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},_r.prototype.array=function(){return Array.from(this.list)},_r.prototype.has=_r.prototype.contains=function(e){return this.list.contains(e)};function Sc(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function ro(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function lC(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Rc={},Mg;function uC(){if(Mg)return Rc;Mg=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return Rc.bind=function(r,o,a,s){return e||i(),r[e](n+o,a,s||!1),a},Rc.unbind=function(r,o,a,s){return t||i(),r[t](n+o,a,s||!1),a},Rc}var Pg=uC(),pC=lC(Pg),Ve=sC({__proto__:null,default:pC},[Pg]),Tg=["focus","blur"];function fC(e,t,n,i,r){return Tg.indexOf(n)!==-1&&(r=!0),Ve.bind(e,n,function(o){var a=o.target||o.srcElement;o.delegateTarget=ro(a,t,!0),o.delegateTarget&&i.call(e,o)},r)}function dC(e,t,n,i){return Tg.indexOf(t)!==-1&&(i=!0),Ve.unbind(e,t,n,i)}var Un={bind:fC,unbind:dC};function Tp(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function St(e,t){return t=t||document,t.querySelector(e)}function Cc(e,t){return t=t||document,t.querySelectorAll(e)}function $i(e){e.parentNode&&e.parentNode.removeChild(e)}function hC(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function mC(e,t){return t.appendChild(hC(e,t))}function qe(e,t){return mC(t,e),e}var kp=2,kg={"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":kp,"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":kp,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function gC(e,t){return kg[t]?e.style[t]:e.getAttributeNS(null,t)}function Og(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=kg[i];r?(r===kp&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function yC(e,t){var n=Object.keys(t),i,r;for(i=0,r;r=n[i];i++)Og(e,r,t[r])}function Se(e,t,n){if(typeof t=="string")if(n!==void 0)Og(e,t,n);else return gC(e,t);else yC(e,t);return e}const vC=Object.prototype.toString;function ct(e){return new wr(e)}function wr(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}wr.prototype.add=function(e){return this.list.add(e),this},wr.prototype.remove=function(e){return vC.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},wr.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},wr.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},wr.prototype.array=function(){return Array.from(this.list)},wr.prototype.has=wr.prototype.contains=function(e){return this.list.contains(e)};function Ac(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Dg(e){return e.cloneNode(!0)}var Op={svg:"http://www.w3.org/2000/svg"},Lg='<svg xmlns="'+Op.svg+'"';function bC(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(Op.svg)===-1&&(e=Lg+e.substring(4)):(e=Lg+">"+e+"</svg>",t=!0);var n=xC(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function xC(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function De(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=bC(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(Op.svg,e),t&&Se(n,t),n}var Dp=null;function Ig(){return Dp===null&&(Dp=De("svg")),Dp}function Bg(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function _C(e,t,n,i,r,o){var a=Ig().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return Bg(a,e);case 6:return Bg(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}function Fa(e){return Ig().createSVGTransform()}var Ng=/([&<>]{1})/g,wC=/([&<>\n\r"]{1})/g,EC={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"'"};function Lp(e,t){function n(i,r){return EC[r]||r}return e.replace(t,n)}function $g(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(Lp(e.textContent,Ng));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,'="',Lp(o.value,wC),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)$g(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",Lp(e.nodeValue,Ng),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function SC(e){for(var t=e.firstChild,n=[];t;)$g(t,n),t=t.nextSibling;return n.join("")}function Fg(e,t){return SC(e)}function cn(e){var t=e.parentNode;return t&&t.removeChild(e),e}function RC(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function CC(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(RC(e,i))}function ja(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),CC(n,t)),n.consolidate()}const AC=/^class[ {]/;function MC(e){return AC.test(e.toString())}function Ip(e){return Array.isArray(e)}function Bp(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Mc(...e){e.length===1&&Ip(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const PC=/constructor\s*[^(]*\(\s*([^)]*)\)/m,TC=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,kC=/\/\*([^*]*)\*\//m;function OC(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(MC(e)?PC:TC);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const r=i.match(kC);return(r&&r[1]||i).trim()})||[]}function jg(e,t){const n=t||{get:function(g,y){if(i.push(g),y===!1)return null;throw s(`No provider for "${g}"!`)}},i=[],r=this._providers=Object.create(n._providers||null),o=this._instances=Object.create(null),a=o.injector=this,s=function(g){const y=i.join(" -> ");return i.length=0,new Error(y?`${g} (Resolving: ${y})`:g)};function c(g,y){if(!r[g]&&g.includes(".")){const S=g.split(".");let E=c(S.shift());for(;S.length;)E=E[S.shift()];return E}if(Bp(o,g))return o[g];if(Bp(r,g)){if(i.indexOf(g)!==-1)throw i.push(g),s("Cannot resolve circular dependency!");return i.push(g),o[g]=r[g][0](r[g][1]),i.pop(),o[g]}return n.get(g,y)}function l(g,y){if(typeof y>"u"&&(y={}),typeof g!="function")if(Ip(g))g=Mc(g.slice());else throw s(`Cannot invoke "${g}". Expected a function!`);const E=(g.$inject||OC(g)).map(T=>Bp(y,T)?y[T]:c(T));return{fn:g,dependencies:E}}function u(g){const{fn:y,dependencies:S}=l(g),E=Function.prototype.bind.call(y,null,...S);return new E}function p(g,y,S){const{fn:E,dependencies:T}=l(g,S);return E.apply(y,T)}function f(g){return Mc(y=>g.get(y))}function d(g,y){if(y&&y.length){const S=Object.create(null),E=Object.create(null),T=[],k=[],I=[];let P,O,F,Z;for(let he in r)P=r[he],y.indexOf(he)!==-1&&(P[2]==="private"?(O=T.indexOf(P[3]),O===-1?(F=P[3].createChild([],y),Z=f(F),T.push(P[3]),k.push(F),I.push(Z),S[he]=[Z,he,"private",F]):S[he]=[I[O],he,"private",k[O]]):S[he]=[P[2],P[1]],E[he]=!0),(P[2]==="factory"||P[2]==="type")&&P[1].$scope&&y.forEach(Me=>{P[1].$scope.indexOf(Me)!==-1&&(S[he]=[P[2],P[1]],E[Me]=!0)});y.forEach(he=>{if(!E[he])throw new Error('No provider for "'+he+'". Cannot use provider from the parent!')}),g.unshift(S)}return new jg(g,a)}const h={factory:p,type:u,value:function(g){return g}};function m(g,y){const S=g.__init__||[];return function(){S.forEach(E=>{typeof E=="string"?y.get(E):y.invoke(E)})}}function v(g){const y=g.__exports__;if(y){const S=g.__modules__,E=Object.keys(g).reduce((O,F)=>(F!=="__exports__"&&F!=="__modules__"&&F!=="__init__"&&F!=="__depends__"&&(O[F]=g[F]),O),Object.create(null)),T=(S||[]).concat(E),k=d(T),I=Mc(function(O){return k.get(O)});y.forEach(function(O){r[O]=[I,O,"private",k]});const P=(g.__init__||[]).slice();return P.unshift(function(){k.init()}),g=Object.assign({},g,{__init__:P}),m(g,k)}return Object.keys(g).forEach(function(S){if(S==="__init__"||S==="__depends__")return;const E=g[S];if(E[2]==="private"){r[S]=E;return}const T=E[0],k=E[1];r[S]=[h[T],DC(T,k),T]}),m(g,a)}function w(g,y){return g.indexOf(y)!==-1||(g=(y.__depends__||[]).reduce(w,g),g.indexOf(y)!==-1)?g:g.concat(y)}function x(g){const y=g.reduce(w,[]).map(v);let S=!1;return function(){S||(S=!0,y.forEach(E=>E()))}}this.get=c,this.invoke=p,this.instantiate=u,this.createChild=d,this.init=x(e)}function DC(e,t){return e!=="value"&&Ip(t)&&(t=Mc(t.slice())),t}var LC=1e3;function Ji(e,t){var n=this;t=t||LC,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)})}Ji.prototype.canRender=function(e){},Ji.prototype.drawShape=function(e,t){},Ji.prototype.drawConnection=function(e,t){},Ji.prototype.getShapePath=function(e){},Ji.prototype.getConnectionPath=function(e){};function oo(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function IC(e){return["M",e.x,e.y]}function Np(e){return["L",e.x,e.y]}function BC(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function NC(e,t){const n=e.length,i=[IC(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(Np(a));continue}const c=Math.min(t,$p(a.x-o.x,a.y-o.y),$p(s.x-a.x,s.y-a.y));if(!c){i.push(Np(a));continue}const l=Pc(a,o,c),u=Pc(a,o,c*.5),p=Pc(a,s,c),f=Pc(a,s,c*.5);i.push(Np(l)),i.push(BC(u,f,p))}return i}function Pc(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=$p(i,r),a=n/o;return{x:e.x+i*a,y:e.y+r*a}}function $p(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function Ha(e,t,n){Ge(t)&&(n=t,t=null),t||(t={});const i=De("path",t);return Ge(n)&&(i.dataset.cornerRadius=String(n)),Fp(i,e)}function Fp(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return Se(e,{d:oo(NC(t,n))}),e}function Tc(e){var t=new Set(e);return tt(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function ao(e,t,n){n=n||0,Fe(e)||(e=[e]),H(e,function(i,r){var o=t(i,r,n);Fe(o)&&o.length&&ao(o,t,n+1)})}function jp(e,t,n){var i=new Set,r=new Set;return ao(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 za(e,t){return jp(e)}function $C(e,t,n){Qr(t)&&(t=!0),dn(t)&&(n=t,t=!0),n=n||{};var i=Ga(n.allShapes),r=Ga(n.allConnections),o=Ga(n.enclosedElements),a=Ga(n.enclosedConnections),s=Ga(n.topLevel,t&&ko(e,function(u){return u.id}));function c(u){s[u.source.id]&&s[u.target.id]&&(s[u.id]=[u]),i[u.source.id]&&i[u.target.id]&&(a[u.id]=o[u.id]=u),r[u.id]=u}function l(u){if(o[u.id]=u,u.waypoints)a[u.id]=r[u.id]=u;else return i[u.id]=u,H(u.incoming,c),H(u.outgoing,c),u.children}return ao(e,l),{allShapes:i,allConnections:r,topLevel:s,enclosedConnections:a,enclosedElements:o}}function Jt(e,t){t=!!t,Fe(e)||(e=[e]);var n,i,r,o;return H(e,function(a){var s=a;a.waypoints&&!t&&(s=Jt(a.waypoints,!0));var c=s.x,l=s.y,u=s.height||0,p=s.width||0;(c<n||n===void 0)&&(n=c),(l<i||i===void 0)&&(i=l),(c+p>r||r===void 0)&&(r=c+p),(l+u>o||o===void 0)&&(o=l+u)}),{x:n,y:i,height:o-i,width:r-n}}function Wo(e,t){var n={};return H(e,function(i){var r=i;r.waypoints&&(r=Jt(r)),!Ge(t.y)&&r.x>t.x&&(n[i.id]=i),!Ge(t.x)&&r.y>t.y&&(n[i.id]=i),r.x>t.x&&r.y>t.y&&(Ge(t.width)&&Ge(t.height)&&r.width+r.x<t.width+t.x&&r.height+r.y<t.height+t.y||!Ge(t.width)||!Ge(t.height))&&(n[i.id]=i)}),n}function Hg(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function zg(e){return!!(e&&e.isFrame)}function Ga(e,t){return W({},e||{},t||{})}var FC=1;function Er(e,t){Ji.call(this,e,FC),this.CONNECTION_STYLE=t.style(["no-fill"],{strokeWidth:5,stroke:"fuchsia"}),this.SHAPE_STYLE=t.style({fill:"white",stroke:"fuchsia",strokeWidth:2}),this.FRAME_STYLE=t.style(["no-fill"],{stroke:"fuchsia",strokeDasharray:4,strokeWidth:2})}Ee(Er,Ji),Er.prototype.canRender=function(){return!0},Er.prototype.drawShape=function(t,n,i){var r=De("rect");return Se(r,{x:0,y:0,width:n.width||0,height:n.height||0}),zg(n)?Se(r,W({},this.FRAME_STYLE,i||{})):Se(r,W({},this.SHAPE_STYLE,i||{})),qe(t,r),r},Er.prototype.drawConnection=function(t,n,i){var r=Ha(n.waypoints,W({},this.CONNECTION_STYLE,i||{}));return qe(t,r),r},Er.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 oo(a)},Er.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 oo(o)},Er.$inject=["eventBus","styles"];function jC(){var e={"no-fill":{fill:"none"},"no-border":{strokeOpacity:0},"no-events":{pointerEvents:"none"}},t=this;this.cls=function(n,i,r){var o=this.style(i,r);return W(o,{class:n})},this.style=function(n,i){!Fe(n)&&!i&&(i=n,n=[]);var r=Wn(n,function(o,a){return W(o,e[a]||{})},{});return i?W(r,i):r},this.computeStyle=function(n,i,r){return Fe(i)||(r=i,i=[]),t.style(i||[],W({},r,n||{}))}}const HC={__init__:["defaultRenderer"],defaultRenderer:["type",Er],styles:["type",jC]};function Wt(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function qt(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 Hp(e,t){return!e||!t?-1:e.indexOf(t)}function Va(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function zp(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=Va(e,t);return Math.abs(r/o)<=i}var zC=2;function er(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[r,o]of Object.entries(i))if(GC(r,n))return o;return!1}function GC(e,t){const n=t[0];return Jr(t,function(i){return Math.abs(n[e]-i[e])<=zC})}function Gg(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 Gp(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var VC=/,?([a-z]),?/gi,Vg=parseFloat,en=Math,Sr=en.PI,Fi=en.min,ji=en.max,Wg=en.pow,Rr=en.abs,WC=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,UC=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,Ug=Array.isArray||function(e){return e instanceof Array};function qC(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function YC(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 KC(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 qC(r,i)?(YC(o,i),r[i]):(o.length>=1e3&&delete r[o.shift()],o.push(i),r[i]=e(...arguments),r[i])}return t}function XC(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(WC,function(i,r,o){var a=[],s=r.toLowerCase();for(o.replace(UC,function(c,l){l&&a.push(+l)}),s=="m"&&a.length>2&&(n.push([r,...a.splice(0,2)]),s="l",r=r=="m"?"l":"L");a.length>=t[s]&&(n.push([r,...a.splice(0,t[s])]),!!t[s]););}),n.toString=Wp,n}function ZC(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 QC(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 Vp(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 Wp(){return this.join(",").replace(VC,"$1")}function JC(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=Wp,t}function qg(e,t,n,i,r,o,a,s,c){var l=1-c,u=Wg(l,3),p=Wg(l,2),f=c*c,d=f*c,h=u*e+p*3*c*n+l*3*c*c*r+d*a,m=u*t+p*3*c*i+l*3*c*c*o+d*s;return{x:kc(h),y:kc(m)}}function Yg(e){var t=oA(...e);return Vp(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function Cr(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function eA(e,t){return e=Vp(e),t=Vp(t),Cr(t,e.x,e.y)||Cr(t,e.x2,e.y)||Cr(t,e.x,e.y2)||Cr(t,e.x2,e.y2)||Cr(e,t.x,t.y)||Cr(e,t.x2,t.y)||Cr(e,t.x,t.y2)||Cr(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 Kg(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 Xg(e,t,n,i,r,o,a,s,c){c==null&&(c=1),c=c>1?1:c<0?0:c;for(var l=c/2,u=12,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<u;h++){var m=l*p[h]+l,v=Kg(m,e,n,r,a),w=Kg(m,t,i,o,s),x=v*v+w*w;d+=f[h]*en.sqrt(x)}return l*d}function tA(e,t,n,i,r,o,a,s){if(!(ji(e,n)<Fi(r,a)||Fi(e,n)>ji(r,a)||ji(t,i)<Fi(o,s)||Fi(t,i)>ji(o,s))){var c=(e*i-t*n)*(r-a)-(e-n)*(r*s-o*a),l=(e*i-t*n)*(o-s)-(t-i)*(r*s-o*a),u=(e-n)*(o-s)-(t-i)*(r-a);if(u){var p=kc(c/u),f=kc(l/u),d=+p.toFixed(2),h=+f.toFixed(2);if(!(d<+Fi(e,n).toFixed(2)||d>+ji(e,n).toFixed(2)||d<+Fi(r,a).toFixed(2)||d>+ji(r,a).toFixed(2)||h<+Fi(t,i).toFixed(2)||h>+ji(t,i).toFixed(2)||h<+Fi(o,s).toFixed(2)||h>+ji(o,s).toFixed(2)))return{x:p,y:f}}}}function kc(e){return Math.round(e*1e11)/1e11}function nA(e,t,n){var i=Yg(e),r=Yg(t);if(!eA(i,r))return[];var o=Xg(...e),a=Xg(...t),s=Qg(e)?1:~~(o/5)||1,c=Qg(t)?1:~~(a/5)||1,l=new Array(s+1),u=new Array(c+1),p={},f=[],d,h;for(d=0;d<s+1;d++){var m=qg(...e,d/s);l[d]={x:m.x,y:m.y,t:d/s}}for(d=0;d<c+1;d++)m=qg(...t,d/c),u[d]={x:m.x,y:m.y,t:d/c};for(d=0;d<s;d++)for(h=0;h<c;h++){var v=l[d],w=l[d+1],x=u[h],g=u[h+1],y=Rr(w.x-v.x)<.01?"y":"x",S=Rr(g.x-x.x)<.01?"y":"x",E=tA(v.x,v.y,w.x,w.y,x.x,x.y,g.x,g.y),T;if(E){if(T=E.x.toFixed(9)+"#"+E.y.toFixed(9),p[T])continue;p[T]=!0;var k=v.t+Rr((E[y]-v[y])/(w[y]-v[y]))*(w.t-v.t),I=x.t+Rr((E[S]-x[S])/(g[S]-x[S]))*(g.t-x.t);k>=0&&k<=1&&I>=0&&I<=1&&f.push({x:E.x,y:E.y,t1:k,t2:I})}}return f}function Zg(e,t,n){e=ty(e),t=ty(t);for(var i,r,o,a,s,c,l,u,p,f,d=n?0:[],h=0,m=e.length;h<m;h++){var v=e[h];if(v[0]=="M")i=s=v[1],r=c=v[2];else{v[0]=="C"?(p=[i,r,...v.slice(1)],i=p[6],r=p[7]):(p=[i,r,i,r,s,c,s,c],i=s,r=c);for(var w=0,x=t.length;w<x;w++){var g=t[w];if(g[0]=="M")o=l=g[1],a=u=g[2];else{g[0]=="C"?(f=[o,a,...g.slice(1)],o=f[6],a=f[7]):(f=[o,a,o,a,l,u,l,u],o=l,a=u);var y=nA(p,f);{for(var S=0,E=y.length;S<E;S++)y[S].segment1=h,y[S].segment2=w,y[S].bez1=p,y[S].bez2=f;d=d.concat(y)}}}}}return d}function iA(e){return Ug(e)&&Ug(e[0])}function rA(e){if(ZC(e))return e;var t=new Array(e.length),n=0,i=0,r=0,o=0,a=0,s;e[0][0]=="M"&&(n=+e[0][1],i=+e[0][2],r=n,o=i,a++,t[0]=["M",n,i]);for(var c,l,u=a,p=e.length;u<p;u++){if(l=e[u],s=l[0],t[u]=c=new Array(l.length),s!=s.toUpperCase())switch(c[0]=s.toUpperCase(),c[0]){case"A":c[1]=l[1],c[2]=l[2],c[3]=l[3],c[4]=l[4],c[5]=l[5],c[6]=+l[6]+n,c[7]=+l[7]+i;break;case"V":c[1]=+l[1]+i;break;case"H":c[1]=+l[1]+n;break;case"M":r=+l[1]+n,o=+l[2]+i;default:for(var f=1,d=l.length;f<d;f++)c[f]=+l[f]+(f%2?n:i)}else for(var h=0,m=l.length;h<m;h++)c[h]=l[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=Wp,t}function Qg(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function Oc(e,t,n,i){return[e,t,n,i,n,i]}function Jg(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 ey(e,t,n,i,r,o,a,s,c,l){var u=Sr*120/180,p=Sr/180*(+r||0),f=[],d,h=KC(function(N,R,_){var G=N*en.cos(_)-R*en.sin(_),q=N*en.sin(_)+R*en.cos(_);return{x:G,y:q}});if(l)T=l[0],k=l[1],S=l[2],E=l[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,v=(t-c)/2,w=m*m/(n*n)+v*v/(i*i);w>1&&(w=en.sqrt(w),n=w*n,i=w*i);var x=n*n,g=i*i,y=(o==a?-1:1)*en.sqrt(Rr((x*g-x*v*v-g*m*m)/(x*v*v+g*m*m))),S=y*n*v/i+(e+s)/2,E=y*-i*m/n+(t+c)/2,T=en.asin(((t-E)/i).toFixed(9)),k=en.asin(((c-E)/i).toFixed(9));T=e<S?Sr-T:T,k=s<S?Sr-k:k,T<0&&(T=Sr*2+T),k<0&&(k=Sr*2+k),a&&T>k&&(T=T-Sr*2),!a&&k>T&&(k=k-Sr*2)}var I=k-T;if(Rr(I)>u){var P=k,O=s,F=c;k=T+u*(a&&k>T?1:-1),s=S+n*en.cos(k),c=E+i*en.sin(k),f=ey(s,c,n,i,r,0,a,O,F,[k,P,S,E])}I=k-T;var Z=en.cos(T),he=en.sin(T),Me=en.cos(k),Be=en.sin(k),nt=en.tan(I/4),J=4/3*n*nt,te=4/3*i*nt,pe=[e,t],xe=[e+J*he,t-te*Z],K=[s+J*Be,c-te*Me],V=[s,c];if(xe[0]=2*pe[0]-xe[0],xe[1]=2*pe[1]-xe[1],l)return[xe,K,V].concat(f);f=[xe,K,V].concat(f).join().split(",");for(var ie=[],Te=0,ke=f.length;Te<ke;Te++)ie[Te]=Te%2?h(f[Te-1],f[Te],p).y:h(f[Te],f[Te+1],p).x;return ie}function oA(e,t,n,i,r,o,a,s){for(var c=[],l=[[],[]],u,p,f,d,h,m,v,w,x=0;x<2;++x){if(x==0?(p=6*e-12*n+6*r,u=-3*e+9*n-9*r+3*a,f=3*n-3*e):(p=6*t-12*i+6*o,u=-3*t+9*i-9*o+3*s,f=3*i-3*t),Rr(u)<1e-12){if(Rr(p)<1e-12)continue;d=-f/p,0<d&&d<1&&c.push(d);continue}v=p*p-4*f*u,w=en.sqrt(v),!(v<0)&&(h=(-p+w)/(2*u),0<h&&h<1&&c.push(h),m=(-p-w)/(2*u),0<m&&m<1&&c.push(m))}for(var g=c.length,y=g,S;g--;)d=c[g],S=1-d,l[0][g]=S*S*S*e+3*S*S*d*n+3*S*d*d*r+d*d*d*a,l[1][g]=S*S*S*t+3*S*S*d*i+3*S*d*d*o+d*d*d*s;return l[0][y]=e,l[1][y]=t,l[0][y+1]=a,l[1][y+1]=s,l[0].length=l[1].length=y+2,{x0:Fi(...l[0]),y0:Fi(...l[1]),x1:ji(...l[0]),y1:ji(...l[1])}}function ty(e){if(iA(e)||(e=XC(e)),QC(e))return e;for(var t=JC(rA(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,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",...ey(d.x,d.y,...f.slice(1))];break;case"S":h=="C"||h=="S"?(m=d.x*2-d.bx,v=d.y*2-d.by):(m=d.x,v=d.y),f=["C",m,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",...Jg(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",...Jg(d.x,d.y,f[1],f[2],f[3],f[4])];break;case"L":f=["C",...Oc(d.x,d.y,f[1],f[2])];break;case"H":f=["C",...Oc(d.x,d.y,f[1],d.y)];break;case"V":f=["C",...Oc(d.x,d.y,d.x,f[1])];break;case"Z":f=["C",...Oc(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),l=t.length}},o=[],a="",s="",c=0,l=t.length;c<l;c++){t[c]&&(a=t[c][0]),a!="C"&&(o[c]=a,c&&(s=o[c-1])),t[c]=i(t[c],n,s),o[c]!="A"&&a=="C"&&(o[c]="C"),r(t,c);var u=t[c],p=u.length;n.x=u[p-2],n.y=u[p-1],n.bx=Vg(u[p-4])||n.x,n.by=Vg(u[p-3])||n.y}return t}function Ct(e){return dn(e)&&Vn(e,"waypoints")}function Je(e){return dn(e)&&Vn(e,"labelTarget")}function aA(e){return dn(e)&&Po(e.parent)}function ny(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function tr(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 Dc(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function sA(e){return tr({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function cA(e){for(var t=e.waypoints,n=t.reduce(function(l,u,p){var f=t[p-1];if(f){var d=l[l.length-1],h=d&&d.endLength||0,m=pA(f,u);l.push({start:f,end:u,startLength:h,endLength:h+m,length:m})}return l},[]),i=n.reduce(function(l,u){return l+u.length},0),r=i/2,o=0,a=n[o];a.endLength<r;)a=n[++o];var s=(r-a.startLength)/a.length,c={x:a.start.x+(a.end.x-a.start.x)*s,y:a.start.y+(a.end.y-a.start.y)*s};return c}function je(e){return Ct(e)?cA(e):sA(e)}function Sn(e,t,n){n=n||0,dn(n)||(n={x:n,y:n});var i=Ie(e),r=Ie(t),o=i.bottom+n.y<=r.top,a=i.left-n.x>=r.right,s=i.top-n.y>=r.bottom,c=i.right+n.x<=r.left,l=o?"top":s?"bottom":null,u=c?"left":a?"right":null;return u&&l?l+"-"+u:u||l||"intersect"}function Wa(e,t,n){var i=lA(e,t);return i.length===1||i.length===2&&Va(i[0],i[1])<1?tr(i[0]):i.length>1?(i=Oi(i,function(r){var o=Math.floor(r.t2*100)||1;return o=100-o,o=(o<10?"0":"")+o,r.segment2+"#"+o}),tr(i[n?0:i.length-1])):null}function lA(e,t){return Zg(e,t)}function uA(e){e=e.slice();for(var t=0,n,i,r;e[t];)n=e[t],i=e[t-1],r=e[t+1],Va(n,r)===0||zp(i,r,n)?e.splice(t,1):t++;return e}function pA(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Lc(e,t){return Math.round(e*t)/t}function iy(e){return Ge(e)?e+"px":e}function fA(e){for(;e.parent;)e=e.parent;return e}function dA(e){e=W({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),In(n,{position:"relative",overflow:"hidden",width:iy(e.width),height:iy(e.height)}),t.appendChild(n),n}function ry(e,t,n){const i=De("g");ct(i).add(t);const r=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}const hA="base",oy=0,mA=1,gA={shape:["x","y","width","height"],connection:["waypoints"]};function He(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||{})}He.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],He.prototype._init=function(e){const t=this._eventBus,n=this._container=dA(e),i=this._svg=De("svg");Se(i,{width:"100%",height:"100%"}),kn(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")}),qe(n,i);const r=this._viewport=ry(i,"viewport");e.deferUpdate&&(this._viewboxChanged=qu(this._viewboxChanged,300)),this._restoreFocus=qu(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)},He.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},He.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},He.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=Hg(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},He.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},He.prototype.restoreFocus=function(){this._restoreFocus()},He.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},He.prototype.isFocused=function(){return this._focused},He.prototype.getDefaultLayer=function(){return this.getLayer(hA,oy)},He.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},He.prototype._getChildIndex=function(e){return Wn(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},He.prototype._createLayer=function(e,t){typeof t>"u"&&(t=mA);const n=this._getChildIndex(t);return{group:ry(this._viewport,"layer-"+e,n),index:t,visible:!0}},He.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},He.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&&(cn(n),t.visible=!1),n},He.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],cn(t.group))},He.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},He.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const r=this._findPlaneForRoot(fA(i));if(!r||n&&r.rootElement!==n)return;n=r.rootElement}return n},He.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},He.prototype._findPlaneForRoot=function(e){return Tt(this._planes,function(t){return t.rootElement===e})},He.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},He.prototype._resolveElements=function(e){return Fe(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},He.prototype.getContainer=function(){return this._container},He.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&&(H([i.gfx,i.secondaryGfx],function(r){r&&(n?(e.markers.add(t),ct(r).add(t)):(e.markers.delete(t),ct(r).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},He.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},He.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},He.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},He.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},He.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},He.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,oy);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},He.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},He.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},He.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)},He.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})},He.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})},He.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=gA[e];if(!Jr(n,function(r){return typeof t[r]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},He.prototype._setParent=function(e,t,n){qt(t.children,e,n),e.parent=t},He.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},He.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},He.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},He.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),Wt(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},He.prototype.removeShape=function(e){return this._removeElement(e,"shape")},He.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},He.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},He.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},He.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},He.prototype.viewbox=function(e){if(e===void 0&&this._cachedViewbox)return structuredClone(this._cachedViewbox);const t=this._viewport,n=this.getSize();let i,r,o,a,s,c,l;if(e)this._changeViewbox(function(){s=Math.min(n.width/e.width,n.height/e.height);const u=this._svg.createSVGMatrix().scale(s).translate(-e.x,-e.y);ja(t,u)});else return o=this._rootElement?this.getActiveLayer():null,i=o&&o.getBBox()||{},a=ja(t),r=a?a.matrix:_C(),s=Lc(r.a,1e3),c=Lc(-r.e||0,1e3),l=Lc(-r.f||0,1e3),e=this._cachedViewbox={x:c?c/s:0,y:l?l/s:0,width:n.width/s,height:n.height/s,scale:s,inner:{width:i.width||0,height:i.height||0,x:i.x||0,y:i.y||0},outer:n},e;return e},He.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=W({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),ay(t,n)}),{x:n.e,y:n.f}},He.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=Jt(o),s=Ie(a),c=this.viewbox(),l=this.zoom();let u,p;c.y+=t.top/l,c.x+=t.left/l,c.width-=(t.right+t.left)/l,c.height-=(t.bottom+t.top)/l;const f=Ie(c);if(!(a.width<c.width&&a.height<c.height))u=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),v=Math.max(0,s.bottom-f.bottom),w=Math.min(0,s.top-f.top);u=h||m,p=v||w}this.scroll({dx:-u*l,dy:-p*l})},He.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)}),Lc(i.a,1e3)};function ay(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}He.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},He.prototype._setZoom=function(e,t){const n=this._svg,i=this._viewport,r=n.createSVGMatrix(),o=n.createSVGPoint();let a,s,c,l,u;c=i.getCTM();const p=c.a;return t?(a=W(o,t),s=a.matrixTransform(c.inverse()),l=r.translate(s.x,s.y).scale(1/p*e).translate(-s.x,-s.y),u=c.multiply(l)):u=r.scale(e),ay(this._viewport,u),u},He.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},He.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}},He.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var Uo="data-element-id";function si(e){this._elements={},this._eventBus=e}si.$inject=["eventBus"],si.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),Se(t,Uo,i),n&&Se(n,Uo,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},si.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(Se(i.gfx,Uo,""),i.secondaryGfx&&Se(i.secondaryGfx,Uo,""),delete t[n])},si.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)},si.prototype.updateGraphics=function(e,t,n){var i=e.id||e,r=this._elements[i];return n?r.secondaryGfx=t:r.gfx=t,t&&Se(t,Uo,i),t},si.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&Se(e,Uo);var n=this._elements[t];return n&&n.element},si.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},si.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}},si.prototype.getAll=function(){return this.filter(function(e){return e})},si.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)})},si.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},si.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 yA(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 vA(e){return e.__refs_collection===!0}function bA(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function sy(e,t,n){var i=yA(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 xA(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 pi(e,t){if(!(this instanceof pi))return new pi(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}pi.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?sy(this,t,e):xA(this,t,e)},pi.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return vA(n)||sy(this,t,e),n},pi.prototype.ensureBound=function(e,t){bA(e,t)||this.bind(e,t)},pi.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},pi.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var Up=new pi({name:"children",enumerable:!0,collection:!0},{name:"parent"}),cy=new pi({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),ly=new pi({name:"attachers",collection:!0},{name:"host"}),uy=new pi({name:"outgoing",collection:!0},{name:"source"}),py=new pi({name:"incoming",collection:!0},{name:"target"});function qo(){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)}}),Up.bind(this,"parent"),cy.bind(this,"labels"),uy.bind(this,"outgoing"),py.bind(this,"incoming")}function Ua(){qo.call(this),Up.bind(this,"children"),ly.bind(this,"host"),ly.bind(this,"attachers")}Ee(Ua,qo);function fy(){qo.call(this),Up.bind(this,"children")}Ee(fy,Ua);function dy(){Ua.call(this),cy.bind(this,"labelTarget")}Ee(dy,Ua);function hy(){qo.call(this),uy.bind(this,"source"),py.bind(this,"target")}Ee(hy,qo);var _A={connection:hy,shape:Ua,label:dy,root:fy};function wA(e,t){var n=_A[e];if(!n)throw new Error("unknown type: <"+e+">");return W(new n,t)}function EA(e){return e instanceof qo}function nr(){this._uid=12}nr.prototype.createRoot=function(e){return this.create("root",e)},nr.prototype.createLabel=function(e){return this.create("label",e)},nr.prototype.createShape=function(e){return this.create("shape",e)},nr.prototype.createConnection=function(e){return this.create("connection",e)},nr.prototype.create=function(e,t){return t=W({},t||{}),t.id||(t.id=e+"_"+this._uid++),wA(e,t)};var Ic="__fn",my=1e3,SA=Array.prototype.slice;function qn(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}qn.prototype.on=function(e,t,n,i){if(e=Fe(e)?e:[e],hn(t)&&(i=n,n=t,t=my),!Ge(t))throw new Error("priority must be a number");var r=n;i&&(r=Fn(n,i),r[Ic]=n[Ic]||n);var o=this;e.forEach(function(a){o._addListener(a,{priority:t,callback:r,next:null})})},qn.prototype.once=function(e,t,n,i){var r=this;if(hn(t)&&(i=n,n=t,t=my),!Ge(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[Ic]=n,this.on(e,t,o)},qn.prototype.off=function(e,t){e=Fe(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},qn.prototype.createEvent=function(e){var t=new qa;return t.init(e),t},qn.prototype.fire=function(e,t){var n,i,r,o;if(o=SA.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 qa?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}},qn.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},qn.prototype._destroy=function(){this._listeners={}},qn.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},qn.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=RA(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},qn.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},qn.prototype._getListeners=function(e){return this._listeners[e]},qn.prototype._setListeners=function(e,t){this._listeners[e]=t},qn.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[Ic]===t)&&(r?r.next=i:this._setListeners(e,i)),r=n,n=i};function qa(){}qa.prototype.stopPropagation=function(){this.cancelBubble=!0},qa.prototype.preventDefault=function(){this.defaultPrevented=!0},qa.prototype.init=function(e){W(this,e||{})};function RA(e,t){return e.apply(null,t)}function so(e){return e.childNodes[0]}function CA(e){return e.parentNode.childNodes[1]}function Bc(e,t,n,i,r){var o=Fa();o.setTranslate(t,n);var a=Fa();a.setRotate(i||0,0,0);var s=Fa();s.setScale(1,1),ja(e,[o,a,s])}function Rn(e,t,n){var i=Fa();i.setTranslate(t,n),ja(e,i)}function gy(e,t){var n=Fa();n.setRotate(t,0,0),ja(e,n)}function ci(e,t){this._eventBus=e,this._elementRegistry=t}ci.$inject=["eventBus","elementRegistry"],ci.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=CA(t),n||(n=De("g"),ct(n).add("djs-children"),qe(t.parentNode,n))):n=t,n},ci.prototype._clear=function(e){var t=so(e);return Sc(t),t},ci.prototype._createContainer=function(e,t,n,i){var r=De("g");ct(r).add("djs-group"),typeof n<"u"?AA(r,t,t.childNodes[n]):qe(t,r);var o=De("g");ct(o).add("djs-element"),ct(o).add("djs-"+e),i&&ct(o).add("djs-frame"),qe(r,o);var a=De("g");return ct(a).add("djs-visual"),qe(o,a),o},ci.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,zg(t))},ci.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=Wn(e,function(r,o){return o.parent&&(r[o.parent.id]=o.parent),r},{}),H(i,function(r){var o=r.children;if(o){var a=t._getChildrenContainer(r),s=a.firstChild;H(o,function(c){var l=n.getGraphics(c).parentNode;l===s?s=s.nextSibling:a.insertBefore(l,s)})}})},ci.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},ci.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},ci.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},ci.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},ci.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),Rn(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?Se(n,"display","none"):Se(n,"display","block")}},ci.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);cn(t.parentNode)};function AA(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const MA={__depends__:[HC],__init__:["canvas"],canvas:["type",He],elementRegistry:["type",si],elementFactory:["type",nr],eventBus:["type",qn],graphicsFactory:["type",ci]};function PA(e){var t=new jg(e);return t.init(),t}function TA(e){e=e||{};var t={config:["value",e]},n=[t,MA].concat(e.modules||[]);return PA(n)}function Ar(e,t){this._injector=t||TA(e),this.get("eventBus").fire("diagram.init")}Ar.prototype.get=function(e,t){return this._injector.get(e,t)},Ar.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},Ar.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},Ar.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function On(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function jn(e,t){return e.$instanceOf(t)}function kA(e){return Tt(e.rootElements,function(t){return jn(t,"bpmn:Process")||jn(t,"bpmn:Collaboration")})}function OA(e){var t={},n=[],i={};function r(K,V){return function(ie){K(ie,V)}}function o(K){t[K.id]=K}function a(K){return t[K.id]}function s(K,V){var ie=K.gfx;if(ie)throw new Error(`already rendered ${On(K)}`);return e.element(K,i[K.id],V)}function c(K,V){return e.root(K,i[K.id],V)}function l(K,V){try{var ie=i[K.id]&&s(K,V);return o(K),ie}catch(Te){u(Te.message,{element:K,error:Te}),console.error(`failed to import ${On(K)}`,Te)}}function u(K,V){e.error(K,V)}var p=this.registerDi=function(V){var ie=V.bpmnElement;ie?i[ie.id]?u(`multiple DI elements defined for ${On(ie)}`,{element:ie}):i[ie.id]=V:u(`no bpmnElement referenced in ${On(V)}`,{element:V})};function f(K){d(K.plane)}function d(K){p(K),H(K.planeElement,h)}function h(K){p(K)}this.handleDefinitions=function(V,ie){var Te=V.diagrams;if(ie&&Te.indexOf(ie)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!ie&&Te&&Te.length&&(ie=Te[0]),!ie)throw new Error("no diagram to display");i={},f(ie);var ke=ie.plane;if(!ke)throw new Error(`no plane for ${On(ie)}`);var N=ke.bpmnElement;if(!N)if(N=kA(V),N)u(`correcting missing bpmnElement on ${On(ke)} to ${On(N)}`),ke.bpmnElement=N,p(ke);else throw new Error("no process or collaboration to display");var R=c(N,ke);if(jn(N,"bpmn:Process")||jn(N,"bpmn:SubProcess"))v(N,R);else if(jn(N,"bpmn:Collaboration"))pe(N,R),w(V.rootElements,R);else throw new Error(`unsupported bpmnElement for ${On(ke)}: ${On(N)}`);m(n)};var m=this.handleDeferred=function(){for(var V;n.length;)V=n.shift(),V()};function v(K,V){nt(K,V),I(K.ioSpecification,V),k(K.artifacts,V),o(K)}function w(K,V){var ie=tt(K,function(Te){return!a(Te)&&jn(Te,"bpmn:Process")&&Te.laneSets});ie.forEach(r(v,V))}function x(K,V){l(K,V)}function g(K,V){H(K,r(x,V))}function y(K,V){l(K,V)}function S(K,V){l(K,V)}function E(K,V){l(K,V)}function T(K,V){l(K,V)}function k(K,V){H(K,function(ie){jn(ie,"bpmn:Association")?n.push(function(){T(ie,V)}):T(ie,V)})}function I(K,V){K&&(H(K.dataInputs,r(S,V)),H(K.dataOutputs,r(E,V)))}var P=this.handleSubProcess=function(V,ie){nt(V,ie),k(V.artifacts,ie)};function O(K,V){var ie=l(K,V);jn(K,"bpmn:SubProcess")&&P(K,ie||V),jn(K,"bpmn:Activity")&&I(K.ioSpecification,V),n.push(function(){H(K.dataInputAssociations,r(y,V)),H(K.dataOutputAssociations,r(y,V))})}function F(K,V){l(K,V)}function Z(K,V){l(K,V)}function he(K,V){n.push(function(){var ie=l(K,V);K.childLaneSet&&Me(K.childLaneSet,ie||V),xe(K)})}function Me(K,V){H(K.lanes,r(he,V))}function Be(K,V){H(K,r(Me,V))}function nt(K,V){J(K.flowElements,V),K.laneSets&&Be(K.laneSets,V)}function J(K,V){H(K,function(ie){jn(ie,"bpmn:SequenceFlow")?n.push(function(){F(ie,V)}):jn(ie,"bpmn:BoundaryEvent")?n.unshift(function(){O(ie,V)}):jn(ie,"bpmn:FlowNode")?O(ie,V):jn(ie,"bpmn:DataObject")||(jn(ie,"bpmn:DataStoreReference")||jn(ie,"bpmn:DataObjectReference")?Z(ie,V):u(`unrecognized flowElement ${On(ie)} in context ${On(V&&V.businessObject)}`,{element:ie,context:V}))})}function te(K,V){var ie=l(K,V),Te=K.processRef;Te&&v(Te,ie||V)}function pe(K,V){H(K.participants,r(te,V)),n.push(function(){g(K.messageFlows,V)}),k(K.artifacts,V)}function xe(K){H(K.flowNodeRef,function(V){var ie=V.get("lanes");ie&&ie.push(K)})}}function DA(e,t,n){var i,r,o,a,s=[];function c(l,u){var p={root:function(m,v){return i.add(m,v)},element:function(m,v,w){return i.add(m,v,w)},error:function(m,v){s.push({message:m,context:v})}},f=new OA(p);u=u||l.diagrams&&l.diagrams[0];var d=LA(l,u);if(!d)throw new Error("no diagram to display");H(d,function(m){f.handleDefinitions(l,m)});var h=u.plane.bpmnElement.id;o.setRootElement(o.findRoot(h+"_plane")||o.findRoot(h))}return new Promise(function(l,u){try{return i=e.get("bpmnImporter"),r=e.get("eventBus"),o=e.get("canvas"),r.fire("import.render.start",{definitions:t}),c(t,n),r.fire("import.render.complete",{error:a,warnings:s}),l({warnings:s})}catch(p){return p.warnings=s,u(p)}})}function LA(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!C(n,"bpmn:Process")&&!C(n,"bpmn:Collaboration")&&(i=IA(n));var r;C(i,"bpmn:Collaboration")?r=i:r=Tt(e.rootElements,function(l){if(C(l,"bpmn:Collaboration"))return Tt(l.participants,function(u){return u.processRef===i})});var o=[i];r&&(o=Mn(r.participants,function(l){return l.processRef}),o.push(r));var a=yy(o),s=[t],c=[n];return H(e.diagrams,function(l){if(l.plane){var u=l.plane.bpmnElement;a.indexOf(u)!==-1&&c.indexOf(u)===-1&&(s.push(l),c.push(u))}}),s}}function yy(e){var t=[];return H(e,function(n){n&&(t.push(n),t=t.concat(yy(n.flowElements)))}),t}function IA(e){for(var t=e;t;){if(C(t,"bpmn:Process"))return t;t=t.$parent}}var BA='<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>',vy=BA,by={verticalAlign:"middle"},xy={color:"#404040"},NA={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},$A={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},FA={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"},jA='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+vy+'</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>',Hi;function HA(){Hi=Ot(jA),In(Hi,NA),In(St("svg",Hi),by),In(St(".backdrop",Hi),$A),In(St(".notice",Hi),FA),In(St(".link",Hi),xy,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function zA(){Hi||(HA(),Un.bind(Hi,".backdrop","click",function(e){document.body.removeChild(Hi)})),document.body.appendChild(Hi)}const Nc=5,_y="djs-outline-hidden";function Ft(e){e=W({},VA,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),UA(this._container)}Ee(Ft,Ar),Ft.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,l=a.warnings,u=a.elementsById;o=o.concat(l),s=this._emit("import.parse.complete",r({error:null,definitions:s,elementsById:u,references:c,warnings:o}))||s;const 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||[]),$c(s,o),s=GA(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},Ft.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},Ft.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const o=new Error("no XML imported");throw $c(o,[]),o}if(typeof t=="string"&&(i=WA(n,t),!i)){const o=new Error("BPMNDiagram <"+t+"> not found");throw $c(o,[]),o}try{this.clear()}catch(o){throw $c(o,[]),o}const{warnings:r}=await DA(this,n,i);return{warnings:r}},Ft.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},Ft.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),r=i.getActiveLayer(),o=St(":scope > defs",i._svg),a=Fg(r),s=o?"<defs>"+Fg(o)+"</defs>":"",c=i.getContainer();Bt(c).add(_y);let l;try{l=r.getBBox()}finally{Bt(c).remove(_y)}const u=l.x-Nc,p=l.y-Nc,f=l.width+Nc*2,d=l.height+Nc*2;t=`<?xml version="1.0" encoding="utf-8"?>
4
+ nested error: `+_.message;if(T)return a.addWarning({message:F,error:_}),!0;throw wr(F)}function u(_,E){return l(_,E,!0)}function p(){var _=a.elementsById,E=a.references,T,k;for(T=0;k=E[T];T++){var I=k.element,P=_[k.id],O=Qi(I).propertiesByName[k.property];if(P||a.addWarning({message:"unresolved reference <"+k.id+">",element:k.element,property:k.property,value:k.id}),O.isMany){var F=I.get(O.name),J=F.indexOf(k);J===-1&&(J=F.length),P?F[J]=P:F.splice(J,1)}else I.set(O.name,P)}}function f(){c.pop().handleEnd()}var d=/^<\?xml /i,g=/ encoding="([^"]+)"/i,h=/^utf-8$/i;function y(_){if(d.test(_)){var E=g.exec(_),T=E&&E[1];!T||h.test(T)||a.addWarning({message:"unsupported document encoding <"+T+">, falling back to UTF-8"})}}function R(_,E){var T=c.peek();try{c.push(T.handleNode(_))}catch(k){l(k,E,o)&&c.push(new fp)}}function x(_,E){try{c.peek().handleText(_)}catch(T){u(T,E)}}function m(_,E){_.trim()&&x(_,E)}var v=r.getPackages().reduce(function(_,E){return _[E.uri]=E.prefix,_},Object.entries(pp).reduce(function(_,[E,T]){return _[T]=E,_},r.config&&r.config.nsMap||{}));return s.ns(v).on("openTag",function(_,E,T,k){var I=_.attrs||{},P=Object.keys(I).reduce(function(F,J){var he=E(I[J]);return F[J]=he,F},{}),O={name:_.name,originalName:_.originalName,attributes:P,ns:_.ns};R(O,k)}).on("question",y).on("closeTag",f).on("cdata",x).on("text",function(_,E,T){m(E(_),T)}).on("error",l).on("warn",u),new Promise(function(_,E){var T;try{s.parse(e),p()}catch(F){T=F}var k=i.element;!T&&!k&&(T=wr("failed to parse document as <"+i.type.$descriptor.name+">"));var I=a.warnings,P=a.references,O=a.elementsById;return T?(T.warnings=I,E(T)):_({rootElement:k,elementsById:O,references:P,warnings:I})})},mp.prototype.handler=function(e){return new hp(this.model,e)};function I1(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var B1=`<?xml version="1.0" encoding="UTF-8"?>
5
+ `,N1=/<|>|'|"|&|\n\r|\n/g,mm=/<|>|&/g;function Ii(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}Ii.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},Ii.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},Ii.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},Ii.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)},Ii.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},Ii.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},Ii.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri},Ii.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},Ii.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 $1(e){return e.charAt(0).toLowerCase()+e.slice(1)}function F1(e,t){return pm(t)?$1(e):e}function gm(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function ym(e){return Vn(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function j1(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 H1(e,t){return t.isGeneric?W({localName:t.ns.localName},e):W({localName:F1(t.ns.localName,t.$pkg)},e)}function z1(e,t){return W({localName:t.ns.localName},e)}function G1(e){var t=e.$descriptor;return tt(t.properties,function(n){var i=n.name;if(n.isVirtual||!Wn(e,i))return!1;var r=e[i];return r===n.default||r===null?!1:n.isMany?r.length:!0})}var V1={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},W1={"<":"lt",">":"gt","&":"amp"};function vm(e,t,n){return e=Vn(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function U1(e){return vm(e,N1,V1)}function q1(e){return vm(e,mm,W1)}function Y1(e){return tt(e,function(t){return t.isAttr})}function K1(e){return tt(e,function(t){return!t.isAttr})}function gp(e){this.tagName=e}gp.prototype.build=function(e){return this.element=e,this},gp.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()};function oo(){}oo.prototype.serializeValue=oo.prototype.serializeTo=function(e){e.append(this.escape?q1(this.value):this.value)},oo.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(mm)!==-1&&(this.escape=!0),this};function yp(e){this.tagName=e}gm(yp,oo),yp.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()};function It(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}It.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=G1(e),this.parseAttributes(Y1(r)),this.parseContainments(K1(r))),this.parseGenericAttributes(e,i),this},It.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return H1(t,e)},It.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return z1(t,e)},It.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},It.prototype.nsAttributeName=function(e){var t;if(Vn(e)?t=kn(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}:W({localName:t.localName},n)},It.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}))},It.prototype.parseGenericContainments=function(e){var t=e.$body;t&&this.body.push(new oo().build({type:"String"},t));var n=e.$children;n&&H(n,i=>{this.body.push(new It(this).build(i))})},It.prototype.parseNsAttribute=function(e,t,n){var i=e.$model,r=kn(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)}},It.prototype.parseNsAttributes=function(e){var t=this,n=e.$attrs,i=[];return H(n,function(r,o){var a=t.parseNsAttribute(e,o,r);a&&i.push(a)}),i},It.prototype.parseGenericAttributes=function(e,t){var n=this;H(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)}})},It.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;H(e,function(r){var o=i.get(r.name),a=r.isReference,s=r.isMany;if(s||(o=[o]),r.isBody)n.push(new oo().build(r,o[0]));else if(rm(r.type))H(o,function(l){n.push(new yp(t.addTagName(t.nsPropertyTagName(r))).build(r,l))});else if(a)H(o,function(l){n.push(new gp(t.addTagName(t.nsPropertyTagName(r))).build(l))});else{var c=dm(r);H(o,function(l){var u;c?c===fm?u=new It(t,r):u=new sc(t,r,c):u=new It(t),n.push(u.build(l))})}})},It.prototype.getNamespaces=function(e){var t=this.namespaces,n=this.parent,i;return t||(i=n&&n.getNamespaces(),e||!i?this.namespaces=t=new Ii(i):t=i),t},It.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},It.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},It.prototype.parseAttributes=function(e){var t=this,n=this.element;H(e,function(i){var r=n.get(i.name);if(i.isReference)if(!i.isMany)r=r.id;else{var o=[];H(r,function(a){o.push(a.id)}),r=o.join(" ")}t.addAttribute(t.nsAttributeName(i),r)})},It.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),ym(e)},It.prototype.addAttribute=function(e,t){var n=this.attrs;Vn(t)&&(t=U1(t));var i=Zh(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)},It.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=j1(n).concat(t)),H(t,function(i){e.append(" ").append(ym(i.name)).append('="').append(i.value).append('"')})},It.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==oo;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),H(this.body,function(i){i.serializeTo(e)}),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()};function sc(e,t,n){It.call(this,e,t),this.serialization=n}gm(sc,It),sc.prototype.parseNsAttributes=function(e){var t=It.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},sc.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function X1(){this.value="",this.write=function(e){this.value+=e}}function Z1(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 Q1(e){e=W({format:!1,preamble:!0},e||{});function t(n,i){var r=i||new X1,o=new Z1(r,e.format);e.preamble&&o.append(B1);var a=new It,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(J1(s)),a.build(n).serializeTo(o),!i)return r.value}return{toXML:t}}function J1(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in pp)n[i]=pp[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 cc(e,t){pi.call(this,e,t)}cc.prototype=Object.create(pi.prototype),cc.prototype.fromXML=function(e,t,n){Vn(t)||(n=t,t="bpmn:Definitions");var i=new mp(W({model:this,lax:!0},n)),r=i.handler(t);return i.fromXML(e,r)},cc.prototype.toXML=function(e,t){var n=new Q1(t);return new Promise(function(i,r){try{var o=n.toXML(e);return i({xml:o})}catch(a){return r(a)}})};var eS="BPMN20",tS="http://www.omg.org/spec/BPMN/20100524/MODEL",nS="bpmn",iS=[],rS=[{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"}]}],oS=[{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"}]}],aS={tagAlias:"lowerCase",typePrefix:"t"},sS={name:eS,uri:tS,prefix:nS,associations:iS,types:rS,enumerations:oS,xml:aS},cS="BPMNDI",lS="http://www.omg.org/spec/BPMN/20100524/DI",uS="bpmndi",pS=[{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"]}],fS=[{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"}]}],dS=[],hS={name:cS,uri:lS,prefix:uS,types:pS,enumerations:fS,associations:dS},mS="DC",gS="http://www.omg.org/spec/DD/20100524/DC",yS="dc",vS=[{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}]}],bS=[],xS={name:mS,uri:gS,prefix:yS,types:vS,associations:bS},_S="DI",wS="http://www.omg.org/spec/DD/20100524/DI",ES="di",SS=[{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"}]}],RS=[],CS={tagAlias:"lowerCase"},AS={name:_S,uri:wS,prefix:ES,types:SS,associations:RS,xml:CS},MS="bpmn.io colors for BPMN",PS="http://bpmn.io/schema/bpmn/biocolor/1.0",TS="bioc",kS=[{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"}]}],OS=[],DS=[],LS={name:MS,uri:PS,prefix:TS,types:kS,enumerations:OS,associations:DS},IS="BPMN in Color",BS="http://www.omg.org/spec/BPMN/non-normative/color/1.0",NS="color",$S=[{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"}]}],FS=[],jS=[],HS={name:IS,uri:BS,prefix:NS,types:$S,enumerations:FS,associations:jS};const zS={bpmn:sS,bpmndi:hS,dc:xS,di:AS,bioc:LS,color:HS};function bm(e,t){const n=W({},zS,e);return new cc(n,t)}const GS={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"}},lc={[Jh]:GS,[Uu]:Yh};function xm(){return bm(lc)}const _m=xm();async function jo(e){const{rootElement:t,warnings:n}=await _m.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function VS(e){const{xml:t}=await _m.toXML(e,{format:!0});return t}function vp(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const Ho={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},WS=/[ᄀ-ᇿ -〿぀-ヿ㐀-鿿가-힯＀-⦆]/;function US(e){const t=Ho;return WS.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 zo(e,t){let n=0;for(const i of e)n+=t*US(i);return n}function wm(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&qS(e),YS(e),KS(e),XS(e)}function qS(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:zo(r,o),fontBoundingBoxAscent:o*Ho.ascentEm,fontBoundingBoxDescent:o*Ho.descentEm,actualBoundingBoxAscent:o*Ho.ascentEm,actualBoundingBoxDescent:o*Ho.descentEm}}};t.getContext=()=>n}function YS(e){if(e.SVGMatrix)return;class t{constructor(){ui(this,"a",1);ui(this,"b",0);ui(this,"c",0);ui(this,"d",1);ui(this,"e",0);ui(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 KS(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,l=0){const u=s*Math.PI/180,p=Math.cos(u),f=Math.sin(u);a.a=p,a.b=f,a.c=-f,a.d=p,a.e=c-p*c+f*l,a.f=l-f*c-p*l},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 XS(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:zo(n,12),height:14}})}const uc=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),ZS=new Set(["bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),QS=1,pc=new Set(["bpmn:TextAnnotation","bpmn:DataStoreReference","bpmn:DataObjectReference","bpmn:DataInput","bpmn:DataOutput"]),JS=2;function ft(e){switch(e.kind){case"label-over-line":return`L|${e.edge}|${e.line}`;case"label-over-shape":return`ls|${e.edge}|${e.shape}`;case"edge-crosses-shape":return`x|${e.edge}|${e.shape}`;case"edge-endpoint-detached":return`d|${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"edge-overlap-unrelated":return`u|${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}`;case"pool-overlap":return`P|${e.pools[0]}|${e.pools[1]}`;case"edge-crosses-subprocess":return`S|${e.edge}|${e.subProcess}`;case"group-overlap-unintended":return`g|${e.groups[0]}|${e.groups[1]}${e.container?`|⊃${e.container}`:""}`;case"group-overlap-unreadable":return e.reason==="minority"?`gu*|${e.group}|${e.shapes.join(",")}`:e.reason==="throughpass"?`gu>|${e.group}|${e.shapes.join(",")}`:`gu|${e.groups[0]}|${e.groups[1]}|${e.shapes.join(",")}`;case"group-stack-unreadable":return`gs|${e.groups.join("|")}|${e.shapes.join(",")}`;case"group-on-container-boundary":return`gb|${e.group}|${e.container}|${e.side}`;case"group-on-group-boundary":return`gg|${e.groups[0]}|${e.groups[1]}|${e.axis}`;case"group-cuts-shape":return`gc|${e.group}|${e.shape}|${e.side}`;case"edge-along-group-boundary":return`eg|${e.edge}|${e.group}`;case"pool-name-over-label":return`pn|${e.pool}|${e.label}`}}const Em=20,fc=5,Sm=3,eR=8,Go=15,bp=50,Rm=12,tR=Rm*1.2;function xp(e,t){const n=t.split(/\r?\n/),i=Math.max(...n.map(o=>zo(o,Rm))),r=n.length*tR;return{x:e.x+e.width/2-i/2,y:e.y+e.height/2-r/2,width:i,height:r}}const Cm=1;function mn(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 Vo(e,t){let n=null;const i=e.type!==t.type,o=!!(e.source&&e.target&&t.source&&t.target)&&e.source!==t.source&&e.source!==t.target&&e.target!==t.source&&e.target!==t.target;for(const a of mn(e))for(const s of mn(t)){if(a.axis!==s.axis||Math.abs(a.at-s.at)>Cm)continue;const c=a.dir!==s.dir?"opposite":i?"mixed":o?"unrelated":null;if(!c)continue;const l=Math.min(a.hi,s.hi)-Math.max(a.lo,s.lo);l>=Em&&(!n||l>n.length)&&(n={axis:a.axis,length:l,kind:c})}return n}function _p(e){return e.kind==="edge-overlap-opposite"||e.kind==="edge-overlap-mixed"||e.kind==="edge-overlap-unrelated"}function Am(e,t){const n=Vo(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function nR(e,t){let n=0;for(const i of t)i.id!==e.id&&Am(e,i)&&n++;return n}function ri(e,t){let n=0;for(const i of t)i.id!==e.id&&Vo(e,i)&&n++;return n}const Mm=15,Pm=20;function iR(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-Pm||t.at>n[1]+Pm)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 wp=20;function dc(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>Cm)continue;const r=Math.max(e.lo,i.lo),o=Math.min(e.hi,i.hi);o-r<Em||n.push([r-wp,o+wp])}return n}function hc(e,t){const n=e.label;if(!n)return null;let i=null;for(const r of mn(e)){const o=iR(n,r);if(o){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of dc(r,mn(a)))if(Math.min(c,o[1])>Math.max(s,o[0])){i={other:a.id,axis:r.axis};break}}}}return i}const rR=10,oR=1,aR=(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 sR(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,l=t.y-e.y;let u=0,p=1;const f=(d,g)=>{if(g===0)return d<=0;const h=d/g;if(g>0){if(h>p)return!1;h>u&&(u=h)}else{if(h<u)return!1;h<p&&(p=h)}return!0};return f(r-e.x,c)&&f(e.x-a,-c)&&f(o-e.y,l)&&f(e.y-s,-l)&&p>u}function Ep(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 cR=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,Wo=1;function Bi(e,t){const n=e.x+Wo,i=e.x+e.width-Wo,r=e.y+Wo,o=e.y+e.height-Wo;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 Uo(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 Tm(e,t){const n=e.label;if(!n)return null;if(mn(e).some(i=>Bi(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(mn(i).some(r=>Bi(n,r)))return i.id;for(const i of t.shapes.filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(Uo(i).some(r=>Bi(n,r)))return i.id;return null}function wn(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(sR(e.waypoints[o],e.waypoints[o+1],r,JS)){i.push(r);break}}return i}const $a=(e,t,n)=>{const i=n.x-t.x,r=n.y-t.y,o=i*i+r*r,a=o===0?0:Math.max(0,Math.min(1,((e.x-t.x)*i+(e.y-t.y)*r)/o));return Math.hypot(e.x-(t.x+a*i),e.y-(t.y+a*r))},lR=(e,t,n,i)=>Om(e,t,n,i)?0:Math.min($a(e,n,i),$a(t,n,i),$a(n,e,t),$a(i,e,t)),km=(e,t)=>{let n=!1;for(let i=0,r=t.length-1;i<t.length;r=i++){const o=t[i],a=t[r];o.y>e.y!=a.y>e.y&&e.x<(a.x-o.x)*(e.y-o.y)/(a.y-o.y)+o.x&&(n=!n)}return n};function mc(e,t,n){const{x:i,y:r,width:o,height:a}=n;if(/Event$/.test(n.type)){const l=Math.min(o,a)/2;return Math.max(0,$a({x:i+o/2,y:r+a/2},e,t)-l)}const s=/Gateway$/.test(n.type)?[{x:i+o/2,y:r},{x:i+o,y:r+a/2},{x:i+o/2,y:r+a},{x:i,y:r+a/2}]:[{x:i,y:r},{x:i+o,y:r},{x:i+o,y:r+a},{x:i,y:r+a}];if(km(e,s)||km(t,s))return 0;let c=1/0;for(let l=0;l<s.length;l++)c=Math.min(c,lR(e,t,s[l],s[(l+1)%s.length]));return c}function Om(e,t,n,i){const r=(l,u,p)=>(u.x-l.x)*(p.y-l.y)-(u.y-l.y)*(p.x-l.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 Dm=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function Fa(e,t){let n=0;for(const i of t){if(i.id===e.id||Dm(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++)Om(e.waypoints[o],e.waypoints[o+1],i.waypoints[a],i.waypoints[a+1])&&(r=!0);r&&n++}return n}function oi(e,t){let n=0;for(const i of t)i.id===e.id||Dm(e,i)||Fa(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function Lm(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++)Fa(n[i],[n[r]])>0&&(t+=n[i].type===n[r].type?2:1);return t}function gc(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)if(Fa(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]}`))}function Im(e){const t=gc(e),n=a=>a==="bpmn:MessageFlow"||a.endsWith("Association")?"dashed":"solid",i=new Map(e.edges.map(a=>[a.id,a]));let r=0,o=0;for(const[a,s]of t){const c=i.get(a),l=i.get(s);if(!c||!l)continue;const u=n(c.type),p=n(l.type);u==="solid"&&p==="solid"?r++:u==="dashed"&&p==="dashed"&&o++}return{pairs:t,solidPairs:r,dashedPairs:o,mixedPairs:t.length-r-o,crossPoolMessages:uR(e)}}function uR(e){const t=e.shapes.filter(r=>r.type==="bpmn:Participant");if(t.length<3)return 0;const n=r=>{const o=e.shapes.find(a=>a.id===r);if(o)return t.find(a=>o.x>=a.x&&o.y>=a.y&&o.x+o.width<=a.x+a.width&&o.y+o.height<=a.y+a.height)};let i=0;for(const r of e.edges){if(r.type!=="bpmn:MessageFlow"||r.endpoints.length<2)continue;const o=n(r.endpoints[0]),a=n(r.endpoints[1]);if(!o||!a||o.id===a.id)continue;const s=Math.min(o.y,a.y),c=Math.max(o.y+o.height,a.y+a.height);t.some(l=>l.id!==o.id&&l.id!==a.id&&l.y>s&&l.y+l.height<c)&&i++}return i}function Bm(e,t,n){const i=new Set(t.flatMap(r=>[...r.members]));return e.shapes.filter(r=>!r.container&&!pc.has(r.type)&&!i.has(r.id)&&r.x>=n.x&&r.y>=n.y&&r.x+r.width<=n.right&&r.y+r.height<=n.bottom).map(r=>r.id).sort()}function Nm(e){var n;const t=(n=Dt(e==null?void 0:e.extensionElements))==null?void 0:n.values;if(Array.isArray(t))for(const i of t){const r=Dt(i);if((r==null?void 0:r.$type)!=="bwl:Members"||typeof r.refs!="string")continue;const o=r.refs.split(/\s+/).filter(Boolean);return o.length?o:void 0}}const $m=e=>e?{members:e}:{},ai=e=>e.shapes.filter(t=>!t.container);function pR(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&&o.type!=="bpmn:Group"){if(o.container)return o.id;if(o.parent)return o.parent}}}function fR(e,t,n){if(e.x<t.x+t.width&&t.x<e.x+e.width&&e.y<t.y+t.height&&t.y<e.y+e.height)return!0;const r=e.x+e.width/2,o=e.y+e.height/2;return n.shapes.some(a=>a.container&&a.id!==t.id&&a.id!==e.id&&a.type!=="bpmn:Group"&&r>=a.x&&r<=a.x+a.width&&o>=a.y&&o<=a.y+a.height)}function Fm(e,t){const n=e.label;if(!n)return null;for(const i of[...t.edges].sort((r,o)=>r.id.localeCompare(o.id)))if(mn(i).some(r=>Bi(n,r)))return i.id;for(const i of[...t.shapes].filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(Uo(i).some(r=>Bi(n,r)))return i.id;return null}function ao(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}const jm=3;function Hm(e,t){const n=Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x),i=Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y);if(n<=0||i<=0)return 0;const r=/Event$/.test(t.type);if(!r&&!/Gateway$/.test(t.type))return Math.min(n,i);const o=t.x+t.width/2,a=t.y+t.height/2,s=Math.min(Math.max(o,e.x),e.x+e.width),c=Math.min(Math.max(a,e.y),e.y+e.height);if(r)return Math.max(0,t.width/2-Math.hypot(s-o,c-a));const l=t.width/2,u=t.height/2;return Math.max(0,(1-(Math.abs(s-o)/l+Math.abs(c-a)/u))*Math.min(l,u))}function ja(e,t){const n=[];for(const i of t.shapes){if(i.container||pc.has(i.type))continue;const r=Hm(e,i);r>=jm&&n.push({shape:i.id,depth:r})}return n.sort((i,r)=>i.shape.localeCompare(r.shape))}function mt(e,t={}){const n=[],i=e.shapes.filter(m=>!m.container);for(const m of e.edges)for(const v of wn(m,i))n.push({kind:"edge-crosses-shape",edge:m.id,shape:v.id});const r=e.shapes.filter(m=>m.container&&ZS.has(m.type));if(r.length){const m=(v,_)=>{const E=e.shapes.find(T=>T.id===_);return!!E&&E.x>=v.x&&E.y>=v.y&&E.x+E.width<=v.x+v.width&&E.y+E.height<=v.y+v.height};for(const v of e.edges)for(const _ of wn(v,r))v.endpoints.includes(_.id)||v.endpoints.some(E=>m(_,E))||n.push({kind:"edge-crosses-subprocess",edge:v.id,subProcess:_.id})}for(const m of e.edges){if(m.waypoints.length<2)continue;const v=[[m.source,m.waypoints[0]],[m.target,m.waypoints[m.waypoints.length-1]]];for(const[_,E]of v){if(!_)continue;const T=e.shapes.find(O=>O.id===_);if(!T||T.container)continue;const k=Math.max(T.x-E.x,E.x-(T.x+T.width),0),I=Math.max(T.y-E.y,E.y-(T.y+T.height),0),P=Math.hypot(k,I);P>rR&&n.push({kind:"edge-endpoint-detached",edge:m.id,shape:_,distance:Math.round(P)})}}const o=e.shapes.filter(m=>m.type==="bpmn:Participant");for(let m=0;m<o.length;m++)for(let v=m+1;v<o.length;v++){const _=o[m],E=o[v];if(_.x+_.width<=E.x||E.x+E.width<=_.x||_.y+_.height<=E.y||E.y+E.height<=_.y)continue;const T=(k,I)=>k.x<=I.x&&k.y<=I.y&&k.x+k.width>=I.x+I.width&&k.y+k.height>=I.y+I.height;n.push({kind:"pool-overlap",pools:[_.id,E.id],contained:T(_,E)||T(E,_)})}const a=i.filter(m=>!m.attached);for(let m=0;m<a.length;m++)for(let v=m+1;v<a.length;v++){const _=a[m],E=a[v];if(!Ep(_,E,QS))continue;const T=_.id<E.id?[_.id,E.id]:[E.id,_.id];n.push({kind:"shape-overlap",shapes:T,identical:cR(_,E)})}const s=e.shapes.filter(m=>m.type==="bpmn:Group"&&Array.isArray(m.members)&&m.members.length>0);for(let m=0;m<s.length;m++)for(let v=m+1;v<s.length;v++){const _=s[m],E=s[v],T=Math.min(_.x+_.width,E.x+E.width)-Math.max(_.x,E.x),k=Math.min(_.y+_.height,E.y+E.height)-Math.max(_.y,E.y);if(T<=fc||k<=fc)continue;const I=_.id<E.id?[_.id,E.id]:[E.id,_.id],P=new Set(E.members);if(_.members.some(F=>P.has(F))){const F=Bm(e,s,{x:Math.max(_.x,E.x),y:Math.max(_.y,E.y),right:Math.min(_.x+_.width,E.x+E.width),bottom:Math.min(_.y+_.height,E.y+E.height)});F.length&&n.push({kind:"group-overlap-unreadable",reason:"orphan",groups:I,shapes:F});continue}const O=_.x<=E.x&&_.y<=E.y&&_.x+_.width>=E.x+E.width&&_.y+_.height>=E.y+E.height?_.id:E.x<=_.x&&E.y<=_.y&&E.x+E.width>=_.x+_.width&&E.y+E.height>=_.y+_.height?E.id:void 0;n.push({kind:"group-overlap-unintended",groups:I,...O?{container:O}:{}})}const c=new Set(s.flatMap(m=>[...m.members])),l=m=>e.shapes.filter(v=>!v.container&&!pc.has(v.type)&&v.x>=m.x&&v.y>=m.y&&v.x+v.width<=m.x+m.width&&v.y+v.height<=m.y+m.height);for(const m of s){const v=l(m);if(!v.length)continue;const _=new Set(m.members),E=v.filter(T=>!_.has(T.id));E.some(T=>c.has(T.id))&&(E.length*2<v.length||n.push({kind:"group-overlap-unreadable",reason:"minority",group:m.id,shapes:E.map(T=>T.id).sort()}))}for(const m of s){const v=new Set(l(m).map(P=>P.id)),_=new Set(m.members),E=new Set([...v].filter(P=>!_.has(P)&&c.has(P)));if(!E.size)continue;let T=!1,k=!1,I=!1;for(const P of e.edges){if(P.type!=="bpmn:SequenceFlow"||!P.source||!P.target)continue;const O=E.has(P.source),F=E.has(P.target);!O&&F&&!v.has(P.source)?T=!0:O&&!F&&!v.has(P.target)?k=!0:O&&F&&(I=!0)}T&&k&&I&&n.push({kind:"group-overlap-unreadable",reason:"throughpass",group:m.id,shapes:[...E].sort()})}const u=e.shapes.filter(m=>m.type==="bpmn:Group");for(let m=0;m<u.length;m++)for(let v=m+1;v<u.length;v++)for(let _=v+1;_<u.length;_++){const E=[u[m],u[v],u[_]],T={x:Math.max(...E.map(P=>P.x)),y:Math.max(...E.map(P=>P.y)),right:Math.min(...E.map(P=>P.x+P.width)),bottom:Math.min(...E.map(P=>P.y+P.height))};if(T.right-T.x<=fc||T.bottom-T.y<=fc)continue;const k=Bm(e,[],T);if(!k.length)continue;const I=E.map(P=>P.id).sort();n.push({kind:"group-stack-unreadable",groups:I,shapes:k})}for(const m of e.shapes.filter(v=>v.type==="bpmn:Group"))for(const v of e.shapes){if(v.container||v.attached||pc.has(v.type)||v.width<=0||v.height<=0)continue;const _=[["top",m.y,"h",m.x,m.x+m.width],["bottom",m.y+m.height,"h",m.x,m.x+m.width],["left",m.x,"v",m.y,m.y+m.height],["right",m.x+m.width,"v",m.y,m.y+m.height]];for(const[E,T,k,I,P]of _){const O=k==="h"?v.x:v.y,F=k==="h"?v.x+v.width:v.y+v.height;if(!(O<P&&I<F))continue;const J=k==="h"?v.y:v.x,he=k==="h"?v.y+v.height:v.x+v.width;if(!(J<T&&T<he))continue;const Pe=Math.min(T-J,he-T);Pe<eR||n.push({kind:"group-cuts-shape",group:m.id,shape:v.id,side:E,depth:Pe})}}const p=t.includeObservationOnly?e.shapes.filter(m=>m.type==="bpmn:Group"&&m.width>0&&m.height>0):[];if(p.length){const m=new Map(e.shapes.filter(v=>!v.container).map(v=>[v.id,{x:v.x+v.width/2,y:v.y+v.height/2}]));for(const v of e.edges){if(v.type!=="bpmn:SequenceFlow"&&v.type!=="bpmn:MessageFlow")continue;const _=mn(v);if(_.length)for(const E of p){const T=E.x+E.width,k=E.y+E.height,I=v.endpoints.some(O=>{const F=m.get(O);return!!F&&E.x<F.x&&F.x<T&&E.y<F.y&&F.y<k});let P=null;for(const O of _){const[F,J,he]=O.axis==="v"?[E.y,k,[["left",E.x],["right",T]]]:[E.x,T,[["top",E.y],["bottom",k]]],Pe=Math.min(O.hi,J)-Math.max(O.lo,F);if(Pe<bp)continue;const De=O.axis==="v"?E.x<O.at&&O.at<T:E.y<O.at&&O.at<k;if(!(De&&I))for(const[Ke,rt]of he){const Ce=Math.abs(O.at-rt);Ce<=Go&&(!P||Ce<P.distance)&&(P={side:Ke,inside:De,distance:Ce,length:Pe})}}P&&n.push({kind:"edge-along-group-boundary",edge:v.id,group:E.id,side:P.side,inside:P.inside,distance:Math.round(P.distance),length:Math.round(P.length)})}}}const f=e.shapes.filter(m=>m.container&&m.type!=="bpmn:Group"&&m.type!=="bpmn:Lane");for(const m of e.shapes.filter(v=>v.type==="bpmn:Group"))for(const v of f){const _=m.x<v.x+v.width&&v.x<m.x+m.width,E=m.y<v.y+v.height&&v.y<m.y+m.height,T=[["top",m.y,v.y,_],["bottom",m.y+m.height,v.y+v.height,_],["left",m.x,v.x,E],["right",m.x+m.width,v.x+v.width,E]];for(const[k,I,P,O]of T)O&&Math.abs(I-P)<=Sm&&n.push({kind:"group-on-container-boundary",group:m.id,container:v.id,side:k})}const d=e.shapes.filter(m=>m.type==="bpmn:Group");for(let m=0;m<d.length;m++)for(let v=m+1;v<d.length;v++){const _=d[m],E=d[v],T=_.x<E.x+E.width&&E.x<_.x+_.width,k=_.y<E.y+E.height&&E.y<_.y+_.height,I=[["x",_.x+_.width,E.x,k],["x",E.x+E.width,_.x,k],["y",_.y+_.height,E.y,T],["y",E.y+E.height,_.y,T]];for(const[P,O,F,J]of I)if(J&&Math.abs(O-F)<=Sm){n.push({kind:"group-on-group-boundary",groups:_.id<E.id?[_.id,E.id]:[E.id,_.id],axis:P});break}}for(let m=0;m<e.edges.length;m++)for(let v=m+1;v<e.edges.length;v++){const _=e.edges[m],E=e.edges[v],T=Vo(_,E);if(!T)continue;const k=_.id<E.id?[_.id,E.id]:[E.id,_.id];n.push({kind:T.kind==="opposite"?"edge-overlap-opposite":T.kind==="mixed"?"edge-overlap-mixed":"edge-overlap-unrelated",edges:k,axis:T.axis,length:Math.round(T.length)})}for(const m of e.edges){if(!m.label)continue;const v=hc(m,e.edges);v&&n.push({kind:"label-on-shared-segment",edge:m.id,other:v.other,axis:v.axis})}for(const m of e.edges){if(!m.label)continue;const v=Tm(m,e);v&&n.push({kind:"label-over-line",edge:m.id,line:v})}if(t.includeObservationOnly){for(const m of e.edges)if(!(!m.label||m.type!=="bpmn:SequenceFlow"))for(const{shape:v,depth:_}of ja(m.label,e))n.push({kind:"label-over-shape",edge:m.id,shape:v,depth:Math.round(_)})}const g=new Set(i.map(m=>m.id)),h=e.shapes.filter(m=>m.type==="bpmn:Participant"&&m.label);for(const m of[...i,...h.filter(v=>!g.has(v.id))]){if(!m.label)continue;const v=Fm(m,e);v&&n.push({kind:"label-over-line",edge:m.id,line:v})}const y=new Set(e.shapes.filter(m=>m.type==="bpmn:TextAnnotation").map(m=>m.id));for(const m of h)for(const{owner:v,rect:_}of ao(e))v===m.id||y.has(v)||Ep(m.label,_,Wo)&&n.push({kind:"pool-name-over-label",pool:m.id,label:v});const R=ao(e);for(const m of i)if(m.type==="bpmn:TextAnnotation")for(const{owner:v,rect:_}of R)v!==m.id&&Ep(m,_,Wo)&&n.push({kind:"annotation-over-label",annotation:m.id,label:v});const x=new Map(e.shapes.map(m=>[m.id,m]));for(const m of i){const v=m.parent??pR(m,e,x);if(!v)continue;const _=x.get(v);!_||!_.container||aR(_,m,oR)||m.type==="bpmn:TextAnnotation"&&!fR(m,_,e)||n.push({kind:"shape-outside-container",shape:m.id,container:_.id})}return n.sort((m,v)=>ft(m).localeCompare(ft(v)))}const Dt=e=>typeof e=="object"&&e!==null?e:void 0,Vt=e=>typeof e=="number"?e:0,Ji=e=>{const t=Dt(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function dR(e){const t=Dt(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=Ji(o);a&&n.push(a)}}return n}function hR(e){const t=Dt(e);if(!t)return{};const n=Array.isArray(t.sourceRef)?void 0:Ji(t.sourceRef),i=Array.isArray(t.targetRef)?void 0:Ji(t.targetRef);return n&&i?{source:n,target:i}:{}}function mR(e,t){const n=Dt(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const r=Ji(n);return r?t.get(r):void 0}if(uc.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return Ji(n)}function zm(e){var a,s,c,l,u;const t=[],n=[],i=((a=Dt(e))==null?void 0:a.diagrams)??[],r=new Map,o=new Set;for(const p of((s=Dt(e))==null?void 0:s.rootElements)??[]){const f=Dt(p);if((f==null?void 0:f.$type)==="bpmn:Collaboration")for(const d of f.participants??[]){const g=Dt(d),h=Ji(g),y=Ji(g==null?void 0:g.processRef);h&&y?r.set(y,h):h&&o.add(h)}}for(const p of i){const f=Dt((c=Dt(p))==null?void 0:c.plane),d=(f==null?void 0:f.planeElement)??[];for(const g of d){const h=Dt(g);if(!h)continue;const y=Dt(h.bpmnElement),R=typeof(y==null?void 0:y.id)=="string"?y.id:void 0;if(!R)continue;const x=typeof(y==null?void 0:y.$type)=="string"?y.$type:"",m=Dt(h.bounds);if(m){const _=h.isExpanded===!1&&x!=="bpmn:Participant",E=Dt((l=Dt(h.label))==null?void 0:l.bounds),T={id:R,type:x,x:Vt(m.x),y:Vt(m.y),width:Vt(m.width),height:Vt(m.height),container:uc.has(x)&&!_,attached:(y==null?void 0:y.attachedToRef)!==void 0,...y?{parent:mR(y,r)}:{},...E?{label:{x:Vt(E.x),y:Vt(E.y),width:Vt(E.width),height:Vt(E.height)}}:{},...x==="bpmn:Group"?$m(Nm(y)):{}},k=h.isHorizontal!==!1,I=typeof(y==null?void 0:y.name)=="string"?y.name:"";o.has(R)&&k&&I&&(T.label=xp(T,I)),t.push(T);continue}const v=h.waypoint;if(Array.isArray(v)){const _=Dt((u=Dt(h.label))==null?void 0:u.bounds);n.push({id:R,type:x,waypoints:v.map(E=>{var T,k;return{x:Vt((T=Dt(E))==null?void 0:T.x),y:Vt((k=Dt(E))==null?void 0:k.y)}}),endpoints:dR(y),...hR(y),..._?{label:{x:Vt(_.x),y:Vt(_.y),width:Vt(_.width),height:Vt(_.height)}}:{}})}}}return{shapes:t,edges:n}}function Gm(e){return mt(zm(e),{includeObservationOnly:!0})}async function gR(e){const{definitions:t,warnings:n}=await jo(e);return{findings:Gm(t),warnings:n}}function Xe(e){var i;const t=[],n=[];for(const r of e.getAll()){const o=r;if(o.type==="label"||o.labelTarget)continue;const a=typeof o.type=="string"?o.type:"";if(a==="bpmn:Definitions"||a.startsWith("bpmndi:"))continue;const s=o.waypoints;if(s){const h=Dt(o.label),y=Ji(o.source),R=Ji(o.target);n.push({id:o.id,type:a,waypoints:s.map(x=>({x:Vt(x.x),y:Vt(x.y)})),endpoints:[y,R].filter(x=>!!x),...y&&R?{source:y,target:R}:{},...h&&typeof h.x=="number"?{label:{x:h.x,y:Vt(h.y),width:Vt(h.width),height:Vt(h.height)}}:{}});continue}if(typeof o.x!="number"||typeof o.y!="number")continue;const c=Dt(o.businessObject),l=Dt(o.label);let u=Dt(o.parent);for(;u&&u.type==="bpmn:Lane";)u=Dt(u.parent);const p=typeof(u==null?void 0:u.type)=="string"?u.type:"",f=u&&uc.has(p)&&p!=="bpmn:Group"&&typeof u.id=="string"?u.id:void 0,d={id:o.id,type:a,x:o.x,y:o.y,width:Vt(o.width),height:Vt(o.height),container:uc.has(a)&&(a==="bpmn:Participant"||o.collapsed!==!0),attached:(c==null?void 0:c.attachedToRef)!==void 0,...f!==void 0?{parent:f}:{},...l&&typeof l.x=="number"?{label:{x:l.x,y:Vt(l.y),width:Vt(l.width),height:Vt(l.height)}}:{},...a==="bpmn:Group"?$m(Nm(c)):{}},g=typeof(c==null?void 0:c.name)=="string"?c.name:"";a==="bpmn:Participant"&&!(c!=null&&c.processRef)&&g&&((i=Dt(o.di))==null?void 0:i.isHorizontal)!==!1&&(d.label=xp(d,g)),t.push(d)}return{shapes:t,edges:n}}const yR={"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 vR(e,t){const n=yR[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function Vm(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function Wm(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 vR(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&Vm(i)===n).sort((i,r)=>i.y-r.y).map(i=>i.id),participantOf:n=>{const i=e.get(n);return i?Vm(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}},eventDefinitionOf:n=>{var o;const i=e.get(n);if(!i||i.type!=="bpmn:IntermediateCatchEvent")return;const r=(((o=i.businessObject)==null?void 0:o.eventDefinitions)??[]).map(a=>a.$type);return Wu(r)},reviewRequestLocalesOf:n=>{const i=e.get(n);return!i||i.type==="label"?[]:br(i.businessObject).map(r=>r.locale)}}}const Sp=20,bR=4,kt=(e,t)=>Math.abs(e-t)<.5;function yc(e,t,n,i=Sp){if(kt(e.y,t.y)&&!kt(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=l=>[{x:a,y:e.y},{x:a,y:l},{x:s,y:l},{x:s,y:e.y}];return[c(n.y-i),c(n.y+n.height+i)]}if(kt(e.x,t.x)&&!kt(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=l=>[{x:e.x,y:a},{x:l,y:a},{x:l,y:s},{x:e.x,y:s}];return[c(n.x-i),c(n.x+n.width+i)]}return null}function Um(e,t,n,i=Sp){if(n.length<2)return null;if(kt(e.y,t.y)&&!kt(e.x,t.x)){const r=Math.min(e.x,t.x),o=Math.max(e.x,t.x),a=Math.min(...n.map(d=>d.x))-i,s=Math.max(...n.map(d=>d.x+d.width))+i;if(!(r<a&&s<o))return null;const c=e.x<t.x?a:s,l=e.x<t.x?s:a,u=Math.min(...n.map(d=>d.y))-i,p=Math.max(...n.map(d=>d.y+d.height))+i,f=d=>[{x:c,y:e.y},{x:c,y:d},{x:l,y:d},{x:l,y:e.y}];return[f(u),f(p)]}if(kt(e.x,t.x)&&!kt(e.y,t.y)){const r=Math.min(e.y,t.y),o=Math.max(e.y,t.y),a=Math.min(...n.map(d=>d.y))-i,s=Math.max(...n.map(d=>d.y+d.height))+i;if(!(r<a&&s<o))return null;const c=e.y<t.y?a:s,l=e.y<t.y?s:a,u=Math.min(...n.map(d=>d.x))-i,p=Math.max(...n.map(d=>d.x+d.width))+i,f=d=>[{x:e.x,y:c},{x:d,y:c},{x:d,y:l},{x:e.x,y:l}];return[f(u),f(p)]}return null}function qm(e,t,n=Sp){if(e.length!==4)return null;const[i,r,o,a]=e;if(kt(i.y,r.y)&&kt(r.x,o.x)&&kt(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(kt(i.x,r.x)&&kt(r.y,o.y)&&kt(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 vc(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,l=[{x:n.x+n.width,y:r},{x:a,y:r},{x:a,y:c?i.y+i.height:i.y}],u=[{x:s,y:c?n.y:n.y+n.height},{x:s,y:o},{x:i.x,y:o}];return[l,u]}const Ym=30,xR=[0,-25,25,-40,40];function _R(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+Ym:s-Ym,l=a?i.y+i.height:i.y,u=n.x+n.width/2,p=i.x+i.width/2;return xR.map(f=>[{x:u,y:s},{x:u,y:c},{x:p+f,y:c},{x:p+f,y:l}])}const Rp=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],qo=(e,t,n)=>wn({...e,waypoints:t},n).length;function Cp(e,t,n,i){let r=[...e.waypoints],o=qo(e,r,t);if(o===0)return null;let a=!1;for(const p of vc(e,t))if(qo(e,p,t)===0)return p;const s=(i??[]).filter(p=>p.id!==e.id).flatMap(mn),c=p=>mn({...e,waypoints:p}).some(f=>dc(f,s).length>0),l=_R(e,t).filter(p=>qo(e,p,t)===0);if(l.length)return l.find(p=>!c(p))??l[0];const u=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);if(e.endpoints.length===2&&r.length>2){const p=t.find(d=>d.id===e.endpoints[0]),f=t.find(d=>d.id===e.endpoints[1]);if(p&&f&&kt(p.y+p.height/2,f.y+f.height/2)){const d=[r[0],r[r.length-1]];if(kt(d[0].y,d[1].y)&&!kt(d[0].x,d[1].x)){const g=t.filter(x=>!e.endpoints.includes(x.id)&&wn({...e,waypoints:d},[x]).length>0),h=g.length>=2?Um(d[0],d[1],g):null,R=(h?h.map(x=>[d[0],...x,d[1]]):g.length===1?(yc(d[0],d[1],g[0])??[]).map(x=>[d[0],...x,d[1]]):g.length===0?[d]:[]).filter(x=>qo(e,x,t)===0&&x.length<=r.length).sort((x,m)=>Number(u(m))-Number(u(x)));if(R.length)return R.find(x=>!c(x))??R[0]}}}for(let p=0;p+1<r.length;p++){const f=r[p],d=r[p+1],g=t.filter(R=>!e.endpoints.includes(R.id)&&wn({...e,waypoints:[f,d]},[R]).length>0);if(g.length<2)continue;const h=Um(f,d,g);if(!h)continue;const y=h.map(R=>Rp(r,p,R)).filter(R=>qo(e,R,t)===0).sort((R,x)=>Number(u(x))-Number(u(R)));if(y.length)return y.find(R=>!c(R))??y[0]}for(let p=0;p<bR&&o>0;p++){let f=!1;for(let d=0;d+1<r.length&&!f;d++){const g=r[d],h=r[d+1];for(const y of t){if(e.endpoints.includes(y.id)||wn({...e,waypoints:[g,h]},[y]).length===0)continue;const R=yc(g,h,y),x=R?R.map(v=>Rp(r,d,v)):qm(r,y)??[];if(!x.length)continue;const m=[...x].sort((v,_)=>Number(u(_))-Number(u(v)));for(const v of m){const _=qo(e,v,t);if(_<o){r=v,o=_,f=!0,a=!0;break}}if(f)break}}if(!f)break}return a&&o===0?r:null}function Ap(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Xe(i),a=ai(o),s=new Set,c=mt(o).filter(u=>u.kind==="edge-crosses-shape"&&!t.has(ft(u)));if(!c.length)return s;const l=new Map;for(const u of c){if(u.kind!=="edge-crosses-shape"||l.has(u.edge))continue;const p=o.edges.find(f=>f.id===u.edge);p&&l.set(u.edge,p)}for(const[u,p]of l){if(n&&!n.has(u))continue;const f=i.get(u);if(!f)continue;const d=f.parent,g=d&&typeof d.x=="number"&&typeof d.width=="number"?{x:d.x,y:d.y,width:d.width,height:d.height}:void 0,h=Cp(p,a,g,o.edges);if(!h){wn(p,a).some(m=>m.type==="bpmn:TextAnnotation")&&s.add(u);continue}const y=o.edges.filter(m=>m.id!==u),R=ri(p,y);ri({...p,waypoints:h},y)>R||r.updateWaypoints(f,h)}return s}const wR=e=>{const t=[];for(let n=0;n+1<e.waypoints.length;n++){const i=e.waypoints[n],r=e.waypoints[n+1];t.push({id:`__ghost:${e.id}:${n}`,type:"bpmn:Task",x:Math.min(i.x,r.x)-1,y:Math.min(i.y,r.y)-1,width:Math.max(2,Math.abs(r.x-i.x)+2),height:Math.max(2,Math.abs(r.y-i.y)+2),container:!1,attached:!1})}return t},Mp=(e,t)=>Fa(e,[t])>0;function Km(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Xe(i),a=ai(o);let s=o;const c=new Set(mt(o).map(ft));for(const[l,u]of gc(o))if(!t.has(`${l}|${u}`))for(const[p,f]of[[l,u],[u,l]]){if(n.has(p))continue;const d=s.edges.find(I=>I.id===p),g=s.edges.find(I=>I.id===f);if(!d||!g)continue;const h=i.get(p);if(!h)continue;const y=h.parent,R=y&&typeof y.x=="number"&&typeof y.width=="number"?{x:y.x,y:y.y,width:y.width,height:y.height}:void 0,x=wR(g),m=[...vc(d,a)??[]],v=Cp(d,[...a,...x],R,o.edges);v&&m.push(v);for(let I=0;I+1<d.waypoints.length;I++)for(const P of x)for(const O of yc(d.waypoints[I],d.waypoints[I+1],P)??[])m.push(Rp(d.waypoints,I,O));const _=s.edges.filter(I=>I.id!==p),E=I=>({...s,edges:s.edges.map(P=>P.id===p?{...P,waypoints:I}:P)}),T=I=>!R||I.every(P=>P.x>=R.x&&P.x<=R.x+R.width&&P.y>=R.y&&P.y<=R.y+R.height),k=m.find(I=>{const P={...d,waypoints:I};return Mp(P,g)||!T(I)||_.some(O=>O.id!==f&&!Mp(d,O)&&Mp(P,O))?!1:mt(E(I)).every(O=>c.has(ft(O)))});if(k){r.updateWaypoints(h,k),s=E(k);break}}}const ER=10;function Xm(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 Zm(e,t){if(e.waypoints.length<2||e.endpoints.length!==2)return null;const n=t.shapes.filter(F=>F.type==="bpmn:Participant"&&F.container),i=t.shapes.find(F=>F.id===e.endpoints[0]),r=t.shapes.find(F=>F.id===e.endpoints[1]);if(!i||!r)return null;const o=Xm(i,n),a=Xm(r,n);if(!o||!a||o.id===a.id)return null;const s=a.y>o.y,c=s?o:a,l=s?a:o,u=n.filter(F=>F.id!==o.id&&F.id!==a.id&&F.y>=c.y+c.height&&F.y+F.height<=l.y).sort((F,J)=>F.y-J.y);if(!u.length)return null;const p=u[0],f=u[u.length-1],d=(c.y+c.height+p.y)/2,g=(f.y+f.height+l.y)/2,h=s?d:g,y=s?g:d,R=e.waypoints[0],x=e.waypoints[e.waypoints.length-1],m=ai(t),v=t.edges.filter(F=>F.id!==e.id),_=oi(e,v),E=wn(e,m).length;if(_===0&&E===0||E===0&&e.waypoints.length===2)return null;const T=Math.min(...u.map(F=>F.x)),k=Math.max(...u.map(F=>F.x+F.width)),I=(R.x+x.x)/2,P=F=>F.filter((J,he)=>he===0||!(kt(J.x,F[he-1].x)&&kt(J.y,F[he-1].y)));let O;for(let F=T;F<=k;F+=ER){const J=P([R,{x:R.x,y:h},{x:F,y:h},{x:F,y},{x:x.x,y},x]),he={...e,waypoints:J};if(wn(he,m).length>0)continue;const Pe=oi(he,v),De=Math.abs(F-I);(!O||Pe<O.cross||Pe===O.cross&&De<O.detour)&&(O={pts:J,cross:Pe,detour:De})}return O&&(E>0?O.cross<=_:O.cross<_)?O.pts:null}function Qm(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Xe(n);for(const o of r.edges){if(o.type!=="bpmn:MessageFlow"||t.has(o.id))continue;const a=Xe(n),s=a.edges.find(u=>u.id===o.id);if(!s)continue;const c=Zm(s,a);if(!c)continue;const l=n.get(o.id);l&&i.updateWaypoints(l,c)}}const Ni=[25,-25,40,-40],Yo=35;function SR(e,t){const n=e.x+e.width/2,i=t.x+t.width/2,r=[];for(const o of[!0,!1]){const a=o?e.y:e.y+e.height,s=o?t.y:t.y+t.height,c=o?Math.min(e.y,t.y)-Yo:Math.max(e.y+e.height,t.y+t.height)+Yo;for(const l of[0,...Ni])if(!(Math.abs(l)>=e.width/2-5))for(const u of[0,...Ni]){if(Math.abs(u)>=t.width/2-5)continue;const p=n+l,f=i+u;r.push({pts:[{x:p,y:a},{x:p,y:c},{x:f,y:c},{x:f,y:s}],cost:Math.abs(u)+Math.abs(l)})}}return r}function bc(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 SR(n,i);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,l=s?n.y:n.y+n.height,u=s?n.y-Yo:n.y+n.height+Yo,p=[];for(const x of[0,...Ni]){if(Math.abs(x)>=i.width/2-5)continue;const m=o+x;p.push({pts:[{x:n.x,y:r},{x:m,y:r},{x:m,y:c}],cost:Math.abs(x)});for(const v of[0,...Ni]){if(Math.abs(v)>=n.width/2-5)continue;const _=a+v;p.push({pts:[{x:_,y:l},{x:_,y:u},{x:m,y:u},{x:m,y:c}],cost:Math.abs(x)+Math.abs(v)})}}const f=50,d=i.y+i.height/2,g=s?n.y+n.height:n.y;for(const x of[0,...Ni]){if(Math.abs(x)>=n.width/2-5)continue;const m=a+x;p.push({pts:[{x:m,y:g},{x:m,y:d},{x:i.x+i.width,y:d}],cost:f+Math.abs(x)})}const h=60,y=s?i.y+i.height:i.y,R=s?i.y+i.height+Yo:i.y-Yo;for(const x of[0,...Ni]){if(Math.abs(x)>=i.width/2-5)continue;const m=o+x;for(const v of[0,...Ni]){if(Math.abs(v)>=n.width/2-5)continue;const _=a+v;p.push({pts:[{x:_,y:g},{x:_,y:R},{x:m,y:R},{x:m,y}],cost:h+Math.abs(x)+Math.abs(v)})}}return p}const xc=30;function Jm(e,t){for(let n=1;n<e.length-2;n++){const i=e[n],r=e[n+1],o=kt(i.y,r.y)&&!kt(i.x,r.x),a=kt(i.x,r.x)&&!kt(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)<xc||Math.abs(i.y-(s.y+s.height))<xc)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)<xc||Math.abs(i.x-(s.x+s.width))<xc)return!0}}return!1}const _c=40;function RR(e,t,n){let i=0;for(const r of t){if(r.container||n.includes(r.id))continue;const o=r.x-_c,a=r.x+r.width+_c,s=r.y-_c,c=r.y+r.height+_c;for(let l=1;l<e.length-2;l++){const u=e[l],p=e[l+1],f={x:Math.min(u.x,p.x),y:Math.min(u.y,p.y)},d={x:Math.max(u.x,p.x),y:Math.max(u.y,p.y)};if(f.x<a&&d.x>o&&f.y<c&&d.y>s){i++;break}}}return i}function eg(e,t){if(e.type!=="bpmn:SequenceFlow")return null;const n=t.shapes.filter(E=>E.container),i=new Map(t.shapes.map(E=>[E.id,E])),r=ai(t),o=t.edges.filter(E=>E.id!==e.id),a=ri(e,o),s=oi(e,o),c=E=>RR(E,t.shapes,e.endpoints)+(Jm(E,n)?1:0),l=c(e.waypoints),u=E=>{if(!E)return;const T=E.x+E.width/2,k=E.y+E.height/2;return n.find(I=>I.type==="bpmn:Lane"&&T>=I.x&&T<=I.x+I.width&&k>=I.y&&k<=I.y+I.height)},p=u(i.get(e.endpoints[0]??"")),f=u(i.get(e.endpoints[1]??"")),d=!!p&&!!f&&p.id!==f.id,g=E=>{if(!d||!f)return!1;for(let T=1;T<E.length-2;T++){const k=E[T],I=E[T+1];if(kt(k.y,I.y)&&!kt(k.x,I.x)&&k.y>f.y&&k.y<f.y+f.height)return!0}return!1},h=g(e.waypoints),R=(E=>{if(!E)return;const T=E.x+E.width/2,k=E.y+E.height/2;return n.filter(I=>I.type==="bpmn:Participant"&&T>=I.x&&T<=I.x+I.width&&k>=I.y&&k<=I.y+I.height).sort((I,P)=>I.width*I.height-P.width*P.height)[0]})(i.get(e.endpoints[0]??"")),x=E=>{if(!R)return 0;let T=0;for(let k=1;k<E.length-1;k++){const I=E[k];(I.x<R.x||I.x>R.x+R.width||I.y<R.y||I.y>R.y+R.height)&&T++}return T},m=x(e.waypoints);if(!Jm(e.waypoints,n)&&!(d&&!h)&&m===0)return null;const v=E=>E.reduce((T,k,I)=>I?T+Math.abs(k.x-E[I-1].x)+Math.abs(k.y-E[I-1].y):0,0);let _;for(const{pts:E,cost:T}of bc(e,i)){const k={...e,waypoints:E};if(wn(k,r).length>0)continue;const I=ri(k,o);if(I>a)continue;const P=x(E);if(P>m)continue;const O=P<m&&I===0;if(!O&&oi(k,o)>s)continue;const F=c(E),J=g(E);if(!O&&!(J&&!h)&&F>=l)continue;const Pe=J?0:1,De=v(E);(!_||P<_.out||P===_.out&&(Pe<_.lane||Pe===_.lane&&(I<_.opp||I===_.opp&&(F<_.sc||F===_.sc&&(T<_.cost||T===_.cost&&De<_.len)))))&&(_={pts:E,out:P,sc:F,lane:Pe,opp:I,cost:T,len:De})}return(_==null?void 0:_.pts)??null}function CR(e,t){if(e.type!=="bpmn:SequenceFlow"||e.endpoints.length!==2)return!1;const[n,i]=e.endpoints,r=t.edges.filter(p=>p.type==="bpmn:SequenceFlow"&&p.endpoints.length===2),o=r.filter(p=>p.endpoints[1]===i),a=r.filter(p=>p.endpoints[0]===i);if(o.length!==1||a.length!==1)return!1;const s=t.shapes.find(p=>p.id===n),c=t.shapes.find(p=>p.id===i),l=t.shapes.find(p=>p.id===a[0].endpoints[1]);if(!s||!c||!l||!(s.x+s.width<c.x&&c.x+c.width<l.x))return!1;const u=s.y+s.height/2;return u<l.y||u>l.y+l.height?!1:u<c.y||u>c.y+c.height}function AR(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Xe(i).edges.filter(a=>(!t.has(a.id)||n.has(a.id))&&a.waypoints.length>=4).map(a=>a.id).sort();for(const a of o){const s=Xe(i),c=s.edges.find(y=>y.id===a);if(!c||c.waypoints.length<4)continue;const l=ai(s),u=s.edges.filter(y=>y.id!==a),p=wn(c,l).length,f=ri(c,u),d=oi(c,u),g=n.has(a)?new Set(mt(s).map(ft)):null,h=vc(c,s.shapes);h.length===2&&CR(c,s)&&h.reverse();for(const y of h){if(y.length>=c.waypoints.length)continue;const R={...c,waypoints:y};if(wn(R,l).length>p||ri(R,u)>f||oi(R,u)>d)continue;if(g){const m=new Set(mt({...s,edges:s.edges.map(E=>E.id===a?R:E)}).map(ft)),v=[...m].filter(E=>!g.has(E)).length,_=[...g].filter(E=>!m.has(E)).length;if(v>_)continue}const x=i.get(a);x&&r.updateWaypoints(x,y);break}}}function tg(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Xe(n).edges.filter(o=>o.type==="bpmn:SequenceFlow"&&!t.has(o.id)).map(o=>o.id).sort();for(const o of r){const a=Xe(n),s=a.edges.find(u=>u.id===o);if(!s)continue;const c=eg(s,a);if(!c)continue;const l=n.get(o);l&&i.updateWaypoints(l,c)}}function Pp(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=kt(n[0].x,n[1].x)&&!kt(n[0].y,n[1].y),s=kt(n[n.length-1].x,n[n.length-2].x)&&!kt(n[n.length-1].y,n[n.length-2].y);for(const c of Ni){if(a&&r&&Math.abs(c)<r.width/2-5){const l=n.map(u=>({...u}));l[0].x+=c,l[1].x+=c,i.push({pts:l,cost:Math.abs(c)})}if(s&&o&&Math.abs(c)<o.width/2-5){const l=n.map(u=>({...u}));l[l.length-1].x+=c,l[l.length-2].x+=c,i.push({pts:l,cost:Math.abs(c)})}}return i}function MR(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(Math.min(n.x+n.width,i.x+i.width)-Math.max(n.x,i.x)>=1)return[];const r=i.y+i.height<=n.y,o=n.y+n.height<=i.y;if(!r&&!o)return[];const a=i.x>=n.x+n.width,s=i.x+i.width<=n.x;if(!a&&!s)return[];const c=n.x+n.width/2,l=n.y+n.height/2,u=i.x+i.width/2,p=i.y+i.height/2,f=a?n.x+n.width:n.x,d=o?n.y+n.height:n.y,g=a?i.x:i.x+i.width,h=o?i.y:i.y+i.height,y=[];for(const R of[0,...Ni])Math.abs(R)<i.width/2-5&&y.push({pts:[{x:f,y:l},{x:u+R,y:l},{x:u+R,y:h}],cost:Math.abs(R)}),Math.abs(R)<i.height/2-5&&y.push({pts:[{x:c,y:d},{x:c,y:p+R},{x:g,y:p+R}],cost:Math.abs(R)});return y}function Tp(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[];const r=Math.max(n.x,i.x),o=Math.min(n.x+n.width,i.x+i.width);if(o-r<1)return[];const a=i.y+i.height<=n.y,s=n.y+n.height<=i.y;if(!a&&!s)return[];const c=a?n.y:n.y+n.height,l=a?i.y+i.height:i.y,u=(r+o)/2,p=[];for(const f of[0,...Ni]){const d=u+f;d<=r||d>=o||p.push({pts:[{x:d,y:c},{x:d,y:l}],cost:Math.abs(f)})}return p}function ng(e,t){const n=new Map(t.shapes.map(d=>[d.id,d])),i=ai(t),r=t.edges.filter(d=>d.id!==e.id),o=ri(e,r);if(o===0)return null;const a=oi(e,r);let s;const c=d=>d.reduce((g,h,y)=>y?g+Math.abs(h.x-d[y-1].x)+Math.abs(h.y-d[y-1].y):0,0),l=3,u=d=>{const g=d[0],h=d[d.length-1],y=Math.hypot(h.x-g.x,h.y-g.y);return y>=1&&c(d)/y>=l?1:0},p=u(e.waypoints),f=[...bc(e,n),...Tp(e,n),...Pp(e,n)];for(const{pts:d,cost:g}of f){const h={...e,waypoints:d};if(wn(h,i).length>0)continue;const y=ri(h,r),R=oi(h,r),x=o-y+(p-u(d));if(y>=o||R-a>x)continue;const m=c(d);(!s||y<s.opposite||y===s.opposite&&(R<s.cross||R===s.cross&&(g<s.cost||g===s.cost&&m<s.len)))&&(s={pts:d,opposite:y,cross:R,cost:g,len:m})}return(s==null?void 0:s.pts)??null}function ig(e,t){var i;let n=0;for(const r of t)r.id!==e.id&&((i=Vo(e,r))==null?void 0:i.kind)==="unrelated"&&n++;return n}function PR(e,t){const n=new Map(t.shapes.map(f=>[f.id,f])),i=ai(t),r=t.edges.filter(f=>f.id!==e.id),o=ig(e,r);if(o===0)return null;const a=ri(e,r),s=oi(e,r),c=f=>f.reduce((d,g,h)=>h?d+Math.abs(g.x-f[h-1].x)+Math.abs(g.y-f[h-1].y):0,0),l=2;let u;const p=[...bc(e,n),...Tp(e,n),...MR(e,n),...Pp(e,n)];for(const{pts:f,cost:d}of p){const g={...e,waypoints:f};if(wn(g,i).length>0)continue;const h=ig(g,r);if(h>=o)continue;const y=ri(g,r);if(y-h>a-o)continue;const R=oi(g,r);if(R-s>(o-h)*l)continue;const x=c(f);(!u||h<u.fake||h===u.fake&&(y<u.unreadable||y===u.unreadable&&(R<u.cross||R===u.cross&&(d<u.cost||d===u.cost&&x<u.length))))&&(u={pts:f,fake:h,unreadable:y,cross:R,cost:d,length:x})}return(u==null?void 0:u.pts)??null}function rg(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=mt(Xe(i)).filter(s=>s.kind==="edge-overlap-unrelated"&&!t.has(ft(s)));if(!o.length)return;const a=new Set;for(const s of o)if(s.kind==="edge-overlap-unrelated")for(const c of s.edges)n.has(c)||a.add(c);for(const s of[...a].sort()){const c=Xe(i),l=c.edges.find(f=>f.id===s);if(!l)continue;const u=PR(l,c);if(!u)continue;const p=i.get(s);p&&r.updateWaypoints(p,u)}}function og(e,t){const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");return!!n&&!!i&&i.x+i.width>n.x}function ag(e,t,n){var l;if(e.type!=="bpmn:SequenceFlow"||t.type!=="bpmn:SequenceFlow"||((l=Vo(e,t))==null?void 0:l.kind)!=="opposite")return!1;const[i,r]=e.endpoints,[o,a]=t.endpoints,s=[i,r].filter(u=>u&&(u===o||u===a)).length;return!(!!r&&r===o||!!a&&a===i)||s!==1?!1:og(e,n)&&og(t,n)}function sg(e,t,n){let i=0;for(const r of t)r.id!==e.id&&ag(e,r,n)&&i++;return i}function TR(e,t){const n=new Map(t.shapes.map(f=>[f.id,f])),i=ai(t),r=t.edges.filter(f=>f.id!==e.id),o=sg(e,r,n);if(o===0)return null;const a=ri(e,r),s=oi(e,r),c=f=>f.reduce((d,g,h)=>h?d+Math.abs(g.x-f[h-1].x)+Math.abs(g.y-f[h-1].y):0,0),l=2;let u;const p=[...bc(e,n),...Tp(e,n),...Pp(e,n)];for(const{pts:f,cost:d}of p){const g={...e,waypoints:f};if(wn(g,i).length>0)continue;const h=sg(g,r,n);if(h>=o)continue;const y=ri(g,r);if(y-h>a-o)continue;const R=oi(g,r);if(R-s>(o-h)*l)continue;const x=c(f);(!u||h<u.chain||h===u.chain&&(y<u.unreadable||y===u.unreadable&&(R<u.cross||R===u.cross&&(d<u.cost||d===u.cost&&x<u.length))))&&(u={pts:f,chain:h,unreadable:y,cross:R,cost:d,length:x})}return(u==null?void 0:u.pts)??null}function kR(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Xe(i),a=new Map(o.shapes.map(l=>[l.id,l])),s=mt(o).filter(l=>l.kind==="edge-overlap-opposite"&&!t.has(ft(l)));if(!s.length)return;const c=new Set;for(const l of s){if(l.kind!=="edge-overlap-opposite")continue;const[u,p]=l.edges.map(f=>o.edges.find(d=>d.id===f));if(!(!u||!p||!ag(u,p,a)))for(const f of l.edges)n.has(f)||c.add(f)}for(const l of[...c].sort()){const u=Xe(i),p=u.edges.find(g=>g.id===l);if(!p)continue;const f=TR(p,u);if(!f)continue;const d=i.get(l);d&&r.updateWaypoints(d,f)}}function cg(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Xe(i),a=mt(o).filter(u=>_p(u)&&!t.has(ft(u)));if(!a.length)return;const s=new Set;for(const u of a)if(_p(u))for(const p of u.edges)n.has(p)||s.add(p);const c=u=>{var p;return((p=o.edges.find(f=>f.id===u))==null?void 0:p.type)??""},l=[...s].sort((u,p)=>{const f=c(u)==="bpmn:SequenceFlow"?0:1,d=c(p)==="bpmn:SequenceFlow"?0:1;return f!==d?f-d:u.localeCompare(p)});for(const u of l){const p=Xe(i),f=p.edges.find(h=>h.id===u);if(!f)continue;const d=ng(f,p);if(!d)continue;const g=i.get(u);g&&r.updateWaypoints(g,d)}}const OR=10,DR=(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 lg(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!hc(e,i))return null;const r=ai(t),o=i.flatMap(mn);for(const a of mn(e)){let s=[[a.lo,a.hi]];for(const[d,g]of dc(a,o))s=s.flatMap(([h,y])=>{const R=[];return d>h&&R.push([h,Math.min(y,d)]),g<y&&R.push([Math.max(h,g),y]),R.filter(([x,m])=>m>x)});const c=a.axis==="h"?n.width:n.height,l=s.find(([d,g])=>g-d>=c+OR*2);if(!l)continue;const u=(l[0]+l[1])/2,p=a.axis==="h"?{x:u,y:a.at-Mm}:{x:a.at+En+n.width/2,y:u},f={x:p.x-n.width/2,y:p.y-n.height/2,width:n.width,height:n.height};if(!hc({...e,label:f},i)&&!r.some(d=>!e.endpoints.includes(d.id)&&DR(f,d)))return f}return null}const En=8;function kp(e,t){const n=e.label;if(!n)return null;const i=mn(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,g=f.axis==="h"?o-f.at:r-f.at,h=d<f.lo?f.lo-d:d>f.hi?d-f.hi:0;return Math.hypot(g,h)},s=i.reduce((f,d)=>a(d)<a(f)?d:f,i[0]),c=[...i,...t.edges.filter(f=>f.id!==e.id).flatMap(mn),...t.shapes.filter(f=>f.container).flatMap(Uo)],l=f=>!c.some(d=>Bi(f,d));if(l(n))return null;const u=(s.axis==="v"?n.height:n.width)+En,p=[0,-u,u,-2*u,2*u];if(s.axis==="v")for(const f of[s.at+En,s.at-En-n.width])for(const d of p){const g=n.y+d;if(g<s.lo||g+n.height>s.hi)continue;const h={...n,x:f,y:g};if(l(h))return h}else for(const f of[s.at-En-n.height,s.at+En])for(const d of p){const g=n.x+d;if(g<s.lo||g+n.width>s.hi)continue;const h={...n,x:g,y:f};if(l(h))return h}return null}const ug=30,LR=(e,t)=>{let n=1/0;for(let i=0;i+1<t.length;i++){const r=t[i],o=t[i+1],a=o.x-r.x,s=o.y-r.y,c=a*a+s*s,l=c?Math.max(0,Math.min(1,((e.x-r.x)*a+(e.y-r.y)*s)/c)):0;n=Math.min(n,Math.hypot(e.x-(r.x+l*a),e.y-(r.y+l*s)))}return n},pg=(e,t)=>LR({x:e.x+e.width/2,y:e.y+e.height/2},t);function IR(e,t){const n=e.label;if(!n)return null;const i=mn(e);if(!i.length)return null;const r=[...i,...t.edges.filter(c=>c.id!==e.id).flatMap(mn),...t.shapes.filter(c=>c.container).flatMap(Uo)],o=ao(t).filter(c=>c.owner!==e.id).map(c=>c.rect),a=(c,l)=>c.x<l.x+l.width&&l.x<c.x+c.width&&c.y<l.y+l.height&&l.y<c.y+c.height,s=c=>!r.some(l=>Bi(c,l))&&!ja(c,t).length&&!o.some(l=>a(c,l));for(const c of i){const l=(c.lo+c.hi)/2,u=c.axis==="h"?[c.at+En,c.at-En-n.height].map(p=>({...n,x:l-n.width/2,y:p})):[c.at+En,c.at-En-n.width].map(p=>({...n,x:p,y:l-n.height/2}));for(const p of u)if(s(p))return p}return null}function fg(e,t){var a,s;const{elementRegistry:n}=e,i=e.modeling;let r=Xe(n),o=new Set(mt(r).map(ft));for(const[c,l]of t){const u=l.wps,p=n.get(c),f=p==null?void 0:p.label;if(!f||!(p!=null&&p.waypoints))continue;const d=p.waypoints[0].x-u[0].x,g=p.waypoints[0].y-u[0].y;if(!(p.waypoints.length===u.length&&p.waypoints.every((E,T)=>E.x-u[T].x===d&&E.y-u[T].y===g))){if(((a=p.source)==null?void 0:a.id)===l.source&&((s=p.target)==null?void 0:s.id)===l.target)continue;const E=r.edges.find(O=>O.id===c);if(!(E!=null&&E.label)||!ja(E.label,r).length)continue;let T={...E.label,x:l.label.x,y:l.label.y};if((ja(T,r).length||pg(T,E.waypoints)>ug)&&(T=null),!T&&pg(E.label,E.waypoints)>ug&&(T=IR(E,r)),!T)continue;const k=T,I={...r,edges:r.edges.map(O=>O.id===c?{...O,label:k}:O)},P=mt(I);if(P.some(O=>!o.has(ft(O))))continue;i.moveElements([f],{x:k.x-f.x,y:k.y-f.y}),r=I,o=new Set(P.map(ft));continue}const y=l.label.x+d-f.x,R=l.label.y+g-f.y;if(y===0&&R===0)continue;const x=r.edges.find(E=>E.id===c);if(!(x!=null&&x.label))continue;const m={...x.label,x:x.label.x+y,y:x.label.y+R},v={...r,edges:r.edges.map(E=>E.id===c?{...E,label:m}:E)},_=mt(v);_.some(E=>!o.has(ft(E)))||(i.moveElements([f],{x:y,y:R}),r=v,o=new Set(_.map(ft)))}}function dg(e,t,n=new Set){const{elementRegistry:i}=e,r=e.modeling,o=Xe(i);for(const a of o.edges){if(!a.label||t.has(a.id)&&!n.has(a.id))continue;const s=kp(a,o);if(!s)continue;const c=i.get(a.id),l=c==null?void 0:c.label;l&&r.moveElements([l],{x:s.x-l.x,y:s.y-l.y})}}function hg(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Xe(i),a=mt(o).filter(s=>s.kind==="label-on-shared-segment"&&!t.has(ft(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 l=lg(c,o);if(!l)continue;const u=i.get(s.edge),p=u==null?void 0:u.label;p&&r.moveElements([p],{x:l.x-p.x,y:l.y-p.y})}}function mg(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(mn),...t.shapes.filter(f=>f.container).flatMap(Uo)],r=i.filter(f=>Bi(n,f));if(!r.length)return null;const o=t.shapes.filter(f=>!f.container&&f.id!==e.id),a=ao(t).filter(f=>f.owner!==e.id).map(f=>f.rect),s=(f,d)=>f.x<d.x+d.width&&d.x<f.x+f.width&&f.y<d.y+d.height&&d.y<f.y+f.height,c=f=>!i.some(d=>Bi(f,d))&&!o.some(d=>s(f,d))&&!a.some(d=>s(f,d)),l=[];for(const f of r)f.axis==="h"?l.push({...n,y:f.at-En-n.height},{...n,y:f.at+En}):l.push({...n,x:f.at-En-n.width},{...n,x:f.at+En});const u=e.x+e.width/2,p=e.y+e.height/2;return l.push({...n,x:u-n.width/2,y:e.y+e.height+En},{...n,x:u-n.width/2,y:e.y-En-n.height},{...n,x:e.x+e.width+En,y:p-n.height/2},{...n,x:e.x-En-n.width,y:p-n.height/2}),l.find(c)??null}function gg(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Xe(n);for(const o of r.shapes){if(o.container||!o.label||t.has(o.id))continue;const a=mg(o,Xe(n));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 BR(e,t){const n=e.x,i=e.x+e.width,r=e.y,o=e.y+e.height;if(t.x<n||t.x>i||t.y<r||t.y>o)return{x:Math.round(Math.min(Math.max(t.x,n),i)),y:Math.round(Math.min(Math.max(t.y,r),o))};const s=[[t.x-n,{x:n,y:t.y}],[i-t.x,{x:i,y:t.y}],[t.y-r,{x:t.x,y:r}],[o-t.y,{x:t.x,y:o}]].reduce((c,l)=>l[0]<c[0]?l:c);return{x:Math.round(s[1].x),y:Math.round(s[1].y)}}function yg(e,t){const{elementRegistry:n}=e,i=e.modeling;let r=Xe(n),o=new Set(mt(r).map(ft));const a=[...new Set(mt(r).filter(s=>s.kind==="edge-endpoint-detached"&&!t.has(ft(s))).map(s=>s.edge))].sort();for(const s of a){const c=r.edges.find(h=>h.id===s);if(!c||c.waypoints.length<2)continue;const l=c.waypoints.map(h=>({...h})),u=[[c.endpoints[0],0],[c.endpoints[1],l.length-1]];let p=!1;for(const[h,y]of u){const R=h?r.shapes.find(m=>m.id===h):void 0;if(!R)continue;const x=BR(R,l[y]);x.x===l[y].x&&x.y===l[y].y||(l[y]=x,p=!0)}if(!p)continue;const f={...r,edges:r.edges.map(h=>h.id===s?{...h,waypoints:l}:h)},d=mt(f);if(d.some(h=>!o.has(ft(h))))continue;const g=n.get(s);g&&(i.updateWaypoints(g,l),r=f,o=new Set(d.map(ft)))}}const Op=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function vg(e,t){const n=(r,o,a,s="name")=>{const c=s==="text"?"texts":"names",l=u=>o?`${o}.${u}`:u;return{id:r,plainField:l(s),mapField:l(c),plain:a[s],map:a[c]}},i=e;switch(e.kind){case"participant.add":return[n(e.participant.id,"participant",e.participant),...(e.participant.lanes??[]).map((r,o)=>n(r.id,`participant.lanes[${o}]`,r))];case"participant.update":return[n(e.id,"",i),...(e.lanes??[]).map((r,o)=>({...n(r.id,`lanes[${o}]`,r),omittedMeansRemove:(t==null?void 0:t.categoryOf(r.id))==="lane"}))];case"node.add":return[n(e.node.id,"node",e.node)];case"sequenceFlow.add":return[{...n(e.flow.id,"flow",e.flow),condition:e.flow.condition,conditionField:"flow.condition"}];case"sequenceFlow.update":return[{...n(e.id,"",i),condition:e.condition,conditionField:"condition"}];case"messageFlow.add":return[n(e.flow.id,"flow",e.flow)];case"dataStore.add":return[n(e.dataStore.id,"dataStore",e.dataStore)];case"annotation.add":return[n(e.annotation.id,"annotation",e.annotation,"text")];case"annotation.update":return[n(e.id,"",i,"text")];case"group.add":return[n(e.group.id,"group",e.group)];case"node.update":case"messageFlow.update":case"dataStore.update":case"group.update":return[n(e.id,"",i)];default:return[]}}function NR(e,t,n){const i=[],r=n?La(n):[];return e.forEach((o,a)=>{if(o.kind==="translation.confirm"){if(!n){i.push({kind:"locale-texts-not-enabled",opIndex:a,id:o.id,field:"locale"});return}if(!r.includes(o.locale)){i.push({kind:"locale-not-in-document",opIndex:a,id:o.id,field:"locale",locale:o.locale,locales:r});return}t.categoryOf(o.id)!==void 0&&!t.reviewRequestLocalesOf(o.id).includes(o.locale)&&i.push({kind:"review-request-missing",opIndex:a,id:o.id,locale:o.locale});return}for(const s of vg(o,t)){const c=s.plain!==void 0,l=s.map!==void 0;if(c&&l){i.push({kind:"locale-texts-conflict",opIndex:a,id:s.id,field:s.mapField});continue}if(l&&s.condition!==void 0&&s.condition!==null){i.push({kind:"locale-texts-conflict",opIndex:a,id:s.id,field:s.conditionField});continue}if(!n){l&&i.push({kind:"locale-texts-not-enabled",opIndex:a,id:s.id,field:s.mapField});continue}if(c&&s.plain!==null){i.push({kind:"locale-texts-required",opIndex:a,id:s.id,field:s.plainField,locales:r});continue}if(s.condition!==void 0&&s.condition!==null){i.push({kind:"locale-texts-required",opIndex:a,id:s.id,field:s.conditionField,locales:r});continue}if(!l)continue;if(!Op(s.map)){i.push({kind:"payload-invalid",opIndex:a,field:s.mapField});continue}const u=s.map;let p=!0;for(const[d,g]of Object.entries(u))typeof g!="string"||g===""?(i.push({kind:"payload-invalid",opIndex:a,field:`${s.mapField}.${d}`}),p=!1):r.includes(d)||(i.push({kind:"locale-not-in-document",opIndex:a,id:s.id,field:s.mapField,locale:d,locales:r}),p=!1);if(!p)continue;const f=r.filter(d=>!(d in u));f.length&&i.push({kind:"locale-texts-incomplete",opIndex:a,id:s.id,field:s.mapField,missing:f})}}),i}function fi(e,t,n){const i=t==="text"?"texts":"names",{[i]:r,...o}=e;return n===void 0?o:{...o,[t]:n}}function $R(e,t,n){const i=new Map;if(!n)return{ops:[...e],writes:i};const{designLocale:r}=n,o=c=>{let l=i.get(c);return l||i.set(c,l={}),l},a=c=>{if(Op(c.map)){const l=c.map;return o(c.id).texts={...l},l[r]}if(c.plain===null||c.condition===null&&c.plain===void 0){o(c.id).texts=null;return}c.plain===void 0&&c.omittedMeansRemove&&(o(c.id).texts=null)},s=[];for(const c of e){if(c.kind==="translation.confirm"){const u=o(c.id);u.confirm=[...u.confirm??[],c.locale];continue}const l=vg(c,t);if(!l.length){s.push(c);continue}switch(c.kind){case"participant.add":{const[u,...p]=l,f=fi(c.participant,"name",a(u));c.participant.lanes&&(f.lanes=c.participant.lanes.map((d,g)=>fi(d,"name",a(p[g])))),s.push({...c,participant:f});break}case"participant.update":{const[u,...p]=l,f=fi(c,"name",a(u));c.lanes&&(f.lanes=c.lanes.map((d,g)=>fi(d,"name",a(p[g])))),s.push(f);break}case"node.add":s.push({...c,node:fi(c.node,"name",a(l[0]))});break;case"sequenceFlow.add":s.push({...c,flow:fi(c.flow,"name",a(l[0]))});break;case"messageFlow.add":s.push({...c,flow:fi(c.flow,"name",a(l[0]))});break;case"dataStore.add":s.push({...c,dataStore:fi(c.dataStore,"name",a(l[0]))});break;case"annotation.add":s.push({...c,annotation:fi(c.annotation,"text",a(l[0]))});break;case"group.add":s.push({...c,group:fi(c.group,"name",a(l[0]))});break;case"annotation.update":s.push(fi(c,"text",a(l[0])));break;default:s.push(Op(l[0].map)?fi(c,"name",a(l[0])):(a(l[0]),c))}}return{ops:s,writes:i}}const FR=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,bg=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),xg={"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"]},{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}],"translation.confirm":[{path:"id",shape:null},{path:"locale",shape:null}],"element.remove":[{path:"id",shape:null}]},Ha=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),wc=e=>typeof e=="string"&&e!=="";function jR(e){const t=[];function n(i,r,o,a){if(a===null){wc(o)||t.push({kind:"payload-invalid",opIndex:i,field:r});return}if(!Ha(o)){t.push({kind:"payload-invalid",opIndex:i,field:r});return}for(const s of a)wc(o[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${r}.${s}`})}return e.forEach((i,r)=>{var o,a,s;if(!Ha(i)||!wc(i.kind)||!(i.kind in xg)){t.push({kind:"payload-invalid",opIndex:r,field:"kind"});return}for(const c of xg[i.kind]){const l=c.path.endsWith("[]"),u=l?c.path.slice(0,-2):c.path,p=u.split(".");let f=i;for(const g of p.slice(0,-1)){if(!Ha(f))break;f=f[g]}if(!Ha(f))continue;const d=f[p[p.length-1]];if(!(d===void 0&&c.optional)&&!(d===null&&c.optional)){if(!l){n(r,c.path,d,c.shape);continue}if(!Array.isArray(d)){t.push({kind:"payload-invalid",opIndex:r,field:c.path});continue}d.forEach((g,h)=>n(r,`${u}[${h}]`,g,c.shape))}}if(i.kind==="annotation.add"){const c=i.annotation;Ha(c)&&!wc(c.text)&&c.texts===void 0&&t.push({kind:"payload-invalid",opIndex:r,field:"annotation.text"})}if(i.kind==="node.add"||i.kind==="node.update"){const c=i.band;c!==void 0&&(!Number.isInteger(c)||c<0)&&t.push({kind:"payload-invalid",opIndex:r,field:"band"});const l=i.kind==="node.add"?(o=i.node)==null?void 0:o.type:i.type,u=(i.kind==="node.add"?(a=i.node)==null?void 0:a.id:i.id)??"";if(typeof l=="string"&&!Wh(l)){t.push({kind:"node-type-unsupported",opIndex:r,id:u,type:l});return}const p=i.kind==="node.add"?(s=i.node)==null?void 0:s.eventDefinition:i.eventDefinition;if(p!==void 0&&!Uh(p)){t.push({kind:"payload-invalid",opIndex:r,field:i.kind==="node.add"?"node.eventDefinition":"eventDefinition"});return}l==="intermediateCatchEvent"!==(p!==void 0)&&t.push({kind:"event-definition-mismatch",opIndex:r,id:u,...typeof l=="string"?{type:l}:{},...p!==void 0?{eventDefinition:p}:{}})}}),t}function _g(e,t,n={}){const i=jR(e);if(i.length>0)return i;const r=[],o=new Map,a=new Map;function s(h,y,R){if(!FR.test(y)){r.push({kind:"id-invalid",opIndex:h,id:y});return}if(t.categoryOf(y)!==void 0||o.has(y)){r.push({kind:"id-duplicate",opIndex:h,id:y});return}o.set(y,{...R,opIndex:h})}e.forEach((h,y)=>{var R;switch(h.kind){case"participant.add":s(y,h.participant.id,{category:"participant",lanes:(h.participant.lanes??[]).map(x=>x.id)});for(const x of h.participant.lanes??[])s(y,x.id,{category:"lane"});break;case"node.add":s(y,h.node.id,{category:"flowNode",participant:h.node.participant});break;case"sequenceFlow.add":s(y,h.flow.id,{category:"sequenceFlow"});break;case"messageFlow.add":s(y,h.flow.id,{category:"messageFlow"});break;case"dataStore.add":s(y,h.dataStore.id,{category:"dataStore"});for(const x of h.associations??[])x.id&&s(y,x.id,{category:"dataAssociation"});break;case"dataAssociation.add":h.association.id&&s(y,h.association.id,{category:"dataAssociation"});break;case"association.add":h.association.id&&s(y,h.association.id,{category:"association"});break;case"annotation.add":s(y,h.annotation.id,{category:"annotation"}),(R=h.association)!=null&&R.id&&s(y,h.association.id,{category:"association"});break;case"group.add":s(y,h.group.id,{category:"group"});break;case"participant.update":if(h.lanes){a.set(h.id,h.lanes.map(x=>x.id));for(const x of h.lanes)t.categoryOf(x.id)===void 0&&s(y,x.id,{category:"lane"})}break}});const c=h=>{var y;return((y=o.get(h))==null?void 0:y.category)??t.categoryOf(h)},l=h=>{const y=o.get(h);return y?y.category==="participant"?h:y.participant:t.categoryOf(h)==="participant"?h:t.participantOf(h)};function u(h,y,R,x){const m=c(y);if(m===void 0){r.push({kind:"ref-missing",opIndex:h,ref:y,role:R});return}if(x&&!x.includes(m)){r.push({kind:"ref-category",opIndex:h,ref:y,role:R,expected:x.join("|"),actual:m});return}return m}const p=t.isCollaboration()||e.some(h=>h.kind==="participant.add"),f=new Map;for(const h of e)h.kind==="node.add"?f.set(h.node.id,h.node.eventDefinition):h.kind==="node.update"&&h.type!==void 0&&f.set(h.id,h.eventDefinition);const d=h=>f.has(h)?f.get(h)==="timer":t.eventDefinitionOf(h)==="timer";return e.forEach((h,y)=>{var R;switch(h.kind){case"participant.add":break;case"node.add":{const{participant:x,lane:m}=h.node;if(x===void 0){(p||m!==void 0)&&r.push({kind:"participant-required",opIndex:y,id:h.node.id});break}if(u(y,x,"participant",["participant"])===void 0)break;m!==void 0&&((((R=o.get(x))==null?void 0:R.lanes)??a.get(x)??t.lanesOf(x)).includes(m)||r.push({kind:"lane-unknown",opIndex:y,lane:m,participant:x}));break}case"sequenceFlow.add":{const{id:x,source:m,target:v,name:_,condition:E}=h.flow,T=u(y,m,"source",["flowNode"]),k=u(y,v,"target",["flowNode"]);T&&k&&l(m)!==l(v)&&r.push({kind:"flow-cross-pool",opIndex:y,id:x}),_!==void 0&&E!==void 0&&r.push({kind:"condition-name-conflict",opIndex:y,id:x});break}case"messageFlow.add":{const{id:x,source:m,target:v}=h.flow,_=u(y,m,"source",["flowNode","participant"]),E=u(y,v,"target",["flowNode","participant"]);if(_&&E){const T=l(m),k=l(v);T!==void 0&&T===k&&r.push({kind:"message-flow-same-pool",opIndex:y,id:x})}for(const T of[m,v])d(T)&&r.push({kind:"message-flow-timer-endpoint",opIndex:y,id:x,ref:T});break}case"dataStore.add":{for(const x of h.associations??[]){if([x.source,x.target].filter(_=>_===h.dataStore.id).length!==1){r.push({kind:"data-association-ends",opIndex:y,source:x.source,target:x.target});continue}const v=x.source===h.dataStore.id?x.target:x.source;u(y,v,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:x,target:m}=h.association,v=u(y,x,"source"),_=u(y,m,"target");if(v&&_){const E=new Set([v,_]);E.has("dataStore")&&E.has("flowNode")||r.push({kind:"data-association-ends",opIndex:y,source:x,target:m})}break}case"association.add":{const{id:x,source:m,target:v}=h.association,_=u(y,m,"source"),E=u(y,v,"target");_&&E&&_!=="annotation"&&E!=="annotation"&&r.push({kind:"association-detached",opIndex:y,annotation:x??`${m}->${v}`});break}case"annotation.add":{if(h.association){const{source:x,target:m}=h.association;if(x!==h.annotation.id&&m!==h.annotation.id)r.push({kind:"association-detached",opIndex:y,annotation:h.annotation.id});else{const v=x===h.annotation.id?m:x;u(y,v,"association")}}h.placement&&u(y,h.placement.anchor,"anchor");break}case"group.add":{for(const x of h.group.members??[]){const m=u(y,x,"member");m&&bg.has(m)&&r.push({kind:"ref-category",opIndex:y,ref:x,role:"member",expected:"shape",actual:m})}break}case"participant.update":{if(g(y,h.id,"participant")===void 0)break;if(h.lanes){const x=t.lanesOf(h.id),m=h.lanes.map(_=>_.id);for(const _ of x)m.includes(_)||r.push({kind:"lane-shrink-unsupported",opIndex:y,participant:h.id,lane:_});for(const _ of m)t.categoryOf(_)!==void 0&&!x.includes(_)&&r.push({kind:"id-duplicate",opIndex:y,id:_});const v=m.filter(_=>x.includes(_));v.length===x.length&&v.some((_,E)=>_!==x[E])&&r.push({kind:"lane-reorder-unsupported",opIndex:y,participant:h.id})}break}case"node.update":{if(g(y,h.id,"flowNode")===void 0)break;if(h.lane!==void 0){const x=t.participantOf(h.id);(x?a.get(x)??t.lanesOf(x):[]).includes(h.lane)||r.push({kind:"lane-unknown",opIndex:y,lane:h.lane,participant:x??""})}break}case"sequenceFlow.update":{if(g(y,h.id,"sequenceFlow")===void 0)break;if(h.name!==void 0&&h.condition!==void 0&&r.push({kind:"condition-name-conflict",opIndex:y,id:h.id}),h.source!==void 0||h.target!==void 0){const x=h.source===void 0||u(y,h.source,"source",["flowNode"])!==void 0,m=h.target===void 0||u(y,h.target,"target",["flowNode"])!==void 0,v=t.endpointsOf(h.id),_=h.source??(v==null?void 0:v.source),E=h.target??(v==null?void 0:v.target);x&&m&&_!==void 0&&E!==void 0&&new Set([l(_),l(E),l(h.id)]).size>1&&r.push({kind:"flow-cross-pool",opIndex:y,id:h.id})}break}case"messageFlow.update":g(y,h.id,"messageFlow");break;case"dataStore.update":g(y,h.id,"dataStore");break;case"annotation.update":{if(g(y,h.id,"annotation")===void 0)break;h.placement&&u(y,h.placement.anchor,"anchor");break}case"group.update":{if(g(y,h.id,"group")===void 0)break;for(const x of h.members??[]){const m=u(y,x,"member");m&&bg.has(m)&&r.push({kind:"ref-category",opIndex:y,ref:x,role:"member",expected:"shape",actual:m})}break}case"translation.confirm":g(y,h.id);break;case"element.remove":{g(y,h.id)==="lane"&&r.push({kind:"ref-category",opIndex:y,ref:h.id,role:"target",expected:"removable",actual:"lane"});break}}}),r.push(...NR(e,t,n.i18n)),r;function g(h,y,R){if(o.has(y)){r.push({kind:"target-added-in-batch",opIndex:h,id:y});return}const x=t.categoryOf(y);if(x===void 0){r.push({kind:"ref-missing",opIndex:h,ref:y,role:"target"});return}if(R&&x!==R){r.push({kind:"ref-category",opIndex:h,ref:y,role:"target",expected:R,actual:x});return}return x}}function wg(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"),spaceTool:e.get("spaceTool")}}function Ec(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const Sc={"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]},Sn=10,HR=300,zR=160,Eg=20,Sg=40,GR=10;function Dp(e,t,n,i,r){const o=n,a=(P,O)=>{const[F,J]=Sc[P];let he={x:t.x+t.width/2+F*(t.width/2+o.width/2+O),y:t.y+t.height/2+J*(t.height/2+o.height/2+O)};const Pe=i.x+Sn+o.width/2,De=i.x+i.width-Sn-o.width/2,Ke=i.y+Sn+o.height/2,rt=i.y+i.height-Sn-o.height/2,Ce={x:Math.min(De,Math.max(Pe,he.x)),y:Math.min(rt,Math.max(Ke,he.y))};return(Ce.x!==he.x||Ce.y!==he.y)&&(he=Math.abs(Ce.x-(t.x+t.width/2))<(t.width+o.width)/2+Sn&&Math.abs(Ce.y-(t.y+t.height/2))<(t.height+o.height)/2+Sn?{x:t.x+t.width+Sn+o.width/2,y:Ce.y}:Ce),he},s=(i.children??[]).filter(P=>!("waypoints"in P&&P.waypoints)&&P.type!=="bpmn:Lane"&&P.type!=="label"&&typeof P.x=="number"&&P.id!==r.selfId),c=Xe(e),l=P=>{var F,J;if(!r.selfId)return!1;const O=e.get(P);return!!O&&(((F=O.source)==null?void 0:F.id)===r.selfId||((J=O.target)==null?void 0:J.id)===r.selfId)},u=c.edges.filter(P=>!l(P.id)).flatMap(mn),p=ao(c).filter(P=>P.owner!==r.selfId).map(P=>P.rect),f=P=>({x0:P.x-o.width/2-Sn,x1:P.x+o.width/2+Sn,y0:P.y-o.height/2-Sn,y1:P.y+o.height/2+Sn}),d=P=>{const O=f(P);return s.some(F=>O.x0<F.x+F.width&&O.x1>F.x&&O.y0<F.y+F.height&&O.y1>F.y)},g=P=>{const O=f(P);return u.some(F=>F.axis==="h"?F.at>O.y0&&F.at<O.y1&&F.lo<O.x1&&F.hi>O.x0:F.at>O.x0&&F.at<O.x1&&F.lo<O.y1&&F.hi>O.y0)},h=P=>{const O=f(P);return p.some(F=>O.x0<F.x+F.width&&O.x1>F.x&&O.y0<F.y+F.height&&O.y1>F.y)},y=c.shapes.filter(P=>P.type==="bpmn:Group").flatMap(P=>[{axis:"h",at:P.y,lo:P.x,hi:P.x+P.width},{axis:"h",at:P.y+P.height,lo:P.x,hi:P.x+P.width},{axis:"v",at:P.x,lo:P.y,hi:P.y+P.height},{axis:"v",at:P.x+P.width,lo:P.y,hi:P.y+P.height}]),R=P=>{const O=f(P);return y.some(F=>F.axis==="h"?F.at>O.y0&&F.at<O.y1&&F.lo<O.x1&&F.hi>O.x0:F.at>O.x0&&F.at<O.x1&&F.lo<O.y1&&F.hi>O.y0)},x=P=>d(P)||g(P)||h(P)||R(P),m=P=>P.x-o.width/2>=i.x&&P.x+o.width/2<=i.x+i.width&&P.y-o.height/2>=i.y&&P.y+o.height/2<=i.y+i.height;if(r.placement){const P=De=>De.startsWith("top")?De.replace(/^top/,"bottom"):De.replace(/^bottom/,"top"),O=De=>De.endsWith("left")?De.replace(/left$/,"right"):De.replace(/right$/,"left"),F=r.placement.side,J=[F,P(F),O(F),P(O(F)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],he=r.placement.offset??50;let Pe=a(F,he);if(x(Pe)){const De=new Set;for(const Ke of J){if(De.has(Ke))continue;De.add(Ke);const rt=a(Ke,he);if(m(rt)&&!x(rt)){Pe=rt;break}}}return Pe}const v=r.from,_=i.x+Sn+o.width/2,E=i.x+i.width-Sn-o.width/2,T=i.y+Sn+o.height/2,k=i.y+i.height-Sn-o.height/2;let I={x:Math.min(E,Math.max(_,v.x)),y:Math.min(k,Math.max(T,v.y))};if(x(I)){const P=(t.width+o.width)/2+Sn,F=[{x:I.x+P,y:I.y},{x:I.x-P,y:I.y},{x:I.x,y:I.y-o.height-Sn},{x:I.x,y:I.y+o.height+Sn}].filter(m).find(J=>!x(J));F&&(I=F)}return I}function Qt(e,t){return e.filter(n=>n.kind===t)}class Rg extends Error{constructor(t){super(t.kind),this.issue=t,this.name="LowerIssueError"}}function Cg(e,t){var EE,SE,RE,CE,AE,ME,PE,TE,kE,OE,DE,LE,IE,BE,NE,$E,FE,jE,HE,zE,GE,VE,WE;const{modeling:n,bpmnFactory:i,elementFactory:r,elementRegistry:o,canvas:a,autoPlace:s,bpmnReplace:c,spaceTool:l}=t,u=()=>a.getRootElement(),p=b=>o.get(b),f=b=>{const A=p(b);if(!A)throw new Error(`하강 참조 해소 실패: ${b}`);return A},d=b=>{let A=b.parent;for(;A;){if(A.type==="bpmn:Participant")return A;A=A.parent}},g=new Map;for(const b of o.filter(A=>!("waypoints"in A&&A.waypoints)&&A.type!=="bpmn:Lane"&&A.type!=="label"&&typeof A.x=="number"))g.set(b.id,{x:b.x,y:b.y});const h=Qt(e,"participant.add"),y=Qt(e,"node.add"),R=Qt(e,"sequenceFlow.add"),x=Qt(e,"messageFlow.add"),m=Qt(e,"dataStore.add"),v=Qt(e,"dataAssociation.add"),_=Qt(e,"annotation.add"),E=Qt(e,"group.add"),T=new Map(y.map(b=>[b.node.id,b])),k=(b,A,M)=>{var j;const D=b.businessObject,$=(((j=D.extensionElements)==null?void 0:j.values)??[]).filter(N=>N.$type!==A),L=M?[...$,i.create(A,M)]:$;if(!L.length){D.extensionElements&&n.updateProperties(b,{extensionElements:void 0});return}const z=i.create("bpmn:ExtensionElements",{values:L});L.forEach(N=>{N.$parent=z}),n.updateProperties(b,{extensionElements:z})},I=b=>({anchor:b.anchor,side:b.side,...b.offset!==void 0?{offset:b.offset}:{}});for(const b of Qt(e,"element.remove")){const A=p(b.id);A&&n.removeElements([A])}const P=b=>o.filter(A=>{var M;return A.type==="bpmn:Lane"&&((M=d(A))==null?void 0:M.id)===b}).sort((A,M)=>A.y-M.y);for(const b of Qt(e,"participant.update")){const A=f(b.id);if(b.name!==void 0&&n.updateProperties(A,{name:b.name??void 0}),!b.lanes)continue;const M=P(b.id);if(!M.length){n.splitLane(A,b.lanes.length),P(b.id).forEach(($,L)=>{const z=b.lanes[L];z&&n.updateProperties($,{id:z.id,name:z.name})});continue}const D=new Set(M.map($=>$.id));b.lanes.forEach(($,L)=>{if(D.has($.id)){n.updateProperties(f($.id),{name:$.name});return}const z=L===0?n.addLane(P(b.id)[0],"top"):n.addLane(f(b.lanes[L-1].id),"bottom");n.updateProperties(z,{id:$.id,name:$.name})})}const O=150,F=130,J=80,he=90,Pe=180,De=30,Ke=30,rt=(b,A,M,D,$)=>{const L=M-A.width/2,z=D-A.height/2;return(b.children??[]).find(j=>!("waypoints"in j&&j.waypoints)&&j.type!=="bpmn:Lane"&&j.type!=="label"&&!($!=null&&$.has(j.id))&&typeof j.x=="number"&&L<j.x+j.width+Ke&&L+A.width+Ke>j.x&&z<j.y+j.height&&z+A.height>j.y)},Ce=new Set;for(const b of h){Ce.add(`pool:${b.participant.id}`);for(const A of b.participant.lanes??[])Ce.add(A.id)}const X=new Map;for(const b of y){const A=b.node.lane??`pool:${b.node.participant??""}`;let M=X.get(A);M||X.set(A,M=new Set([0])),b.band!==void 0&&M.add(b.band)}const te=new Map;for(const[b,A]of X){if(!Ce.has(b))continue;const M=[...A].sort((L,z)=>L-z),D=M.map((L,z)=>z===0?0:z%2===1?Math.ceil(z/2):-(z/2)),$=Math.min(...D);te.set(b,new Map(M.map((L,z)=>[L,D[z]-$])))}{const b=new Map;for(const A of h)(A.participant.lanes??[]).forEach((M,D)=>b.set(M.id,D));for(const[A,M]of te){if(!b.has(A)||M.size<2)continue;const D=b.get(A),$=M.get(0)??0,L=new Set;for(const Q of y){if(Q.node.lane!==A||(Q.band??0)!==0||!Q.node.type.endsWith("Gateway"))continue;const fe={in:new Set,out:new Set,cross:new Set};for(const ye of R){const Re=ye.flow.source===Q.node.id;if(!Re&&ye.flow.target!==Q.node.id)continue;const lt=T.get(Re?ye.flow.target:ye.flow.source);if(!lt||lt.node.participant!==Q.node.participant||!lt.node.lane)continue;let Ae,ne=!1;if(lt.node.lane!==A){const le=b.get(lt.node.lane);if(le===void 0)continue;Ae=le>D?"down":"up",ne=!0}else{const le=M.get(lt.band??0)??$;Ae=le>$?"down":le<$?"up":void 0}Ae&&(fe[Re?"out":"in"].add(Ae),ne&&fe.cross.add(Ae))}for(const ye of["up","down"])fe.in.has(ye)&&fe.out.has(ye)&&fe.cross.has(ye)&&L.add(ye)}if(L.size!==1)continue;const[z]=L,j=Math.max(...M.values()),N=z==="down"?j:0;if($===N)continue;const q=[...M.entries()].filter(([Q])=>Q!==0).sort((Q,fe)=>Q[1]-fe[1]),Y=[...Array(j+1).keys()].filter(Q=>Q!==N),re=new Map([[0,N]]);q.forEach(([Q],fe)=>re.set(Q,Y[fe])),te.set(A,re)}}const U=b=>{var A;return(((A=X.get(b))==null?void 0:A.size)??0)>1},K=b=>b.band??(b.node.lane||!U(`pool:${b.node.participant??""}`)?void 0:0),ie=new Map,pe=b=>ie.get(b.node.id)??K(b),Te=new Set,B=new Set;{const b=new Map;for(const D of R)b.set(D.flow.target,(b.get(D.flow.target)??0)+1);const A=D=>{const $=[],L=new Set([D]),z=[D];for(;z.length;){const j=z.shift();$.push(j);for(const N of R)N.flow.source!==j||L.has(N.flow.target)||(b.get(N.flow.target)??0)!==1||(L.add(N.flow.target),z.push(N.flow.target))}return $},M=(D,$)=>{var L;return((L=te.get(D))==null?void 0:L.get($))??$};for(const D of y){if(!D.node.type.endsWith("Gateway"))continue;const $=D.node.lane??`pool:${D.node.participant??""}`,L=te.get($);if(!L||L.size<2)continue;const z=pe(D);if(z===void 0||M($,z)!==M($,0))continue;const j=M($,z),N=R.filter(ye=>ye.flow.source===D.node.id).map(ye=>T.get(ye.flow.target)).filter(ye=>!!ye&&(ye.node.lane??`pool:${ye.node.participant??""}`)===$),q=N.filter(ye=>{const Re=pe(ye);return Re!==void 0&&M($,Re)===j&&(b.get(ye.node.id)??0)===1}),Y=N.some(ye=>{const Re=pe(ye);return Re!==void 0&&M($,Re)>j});if(q.length!==1||!Y)continue;const re=new Set(N.flatMap(ye=>A(ye.node.id)));if(!R.some(ye=>ye.flow.target===D.node.id&&re.has(ye.flow.source)))continue;const fe=new Map;for(const[ye,Re]of L)fe.set(ye,Re+1);fe.set(-1,0),te.set($,fe);for(const ye of A(q[0].node.id))T.has(ye)&&(ie.set(ye,-1),B.add(ye));Te.add(D.node.id)}}const S=(b,A)=>{var M;return((M=te.get(b))==null?void 0:M.get(A))??A},w=(b,A,M,D)=>{const $=b?p(b):A?p(A):void 0;if(!$)return!1;const L=b?$.y+Math.min($.height/2,he):$.y+J;return Math.abs(L+S(b??`pool:${A??""}`,M)*O-D)<=O/2},G=new Map;for(const[b,A]of X){let M=0;for(const D of A)M=Math.max(M,S(b,D));G.set(b,M)}const V=b=>Pe+O*b,ee=(b,A,M)=>{const D=u().children.filter($=>!("waypoints"in $&&$.waypoints)&&!($.type==="label"&&!("waypoints"in($.labelTarget??{})))&&$.id!==A&&typeof $.y=="number"&&$.y>=b);D.length&&n.moveElements(D,{x:0,y:M})},Se=(b,A,M)=>{const D=b.type==="bpmn:Participant"?b:void 0;if(!D||D.children.some(j=>j.type==="bpmn:Lane"))return;const $=M+A.height/2+De-D.y;if(D.height>=$)return;const L=$-D.height,z=D.y+D.height;n.resizeShape(D,{x:D.x,y:D.y,width:D.width,height:$}),ee(z,D.id,L)},Ze=(b,A)=>{const M=A-b.height;if(M<=0)return;const D=d(b)??b,$=[],L=N=>{$.push(N);for(const q of N.children??[])L(q)};L(D);const z=b.y+b.height-10,j=l.calculateAdjustments($,"y",M,z);l.makeSpace(j.movingShapes,j.resizingShapes,{x:0,y:M},"s",z)},ht=(b,A,M)=>{if(b){const z=f(b),j=V(A);if(z.height>=j)return;const N=j-z.height,q=d(z),Y=q?q.y+q.height:z.y+z.height;Ze(z,j),ee(Y,q==null?void 0:q.id,N);return}if(!M)return;const D=O*(A+1);if(M.height>=D)return;const $=D-M.height,L=M.y+M.height;n.resizeShape(M,{x:M.x,y:M.y,width:M.width,height:D}),ee(L,M.id,$)},Gt=new Map;for(const b of R)Gt.set(b.flow.target,(Gt.get(b.flow.target)??0)+1);const _t=b=>(Gt.get(b)??0)<=1,pn=(b,A)=>{if(!b)return;const M=p(b);if(!M||M.height>=V(A))return;const D=M.y+M.height-10,$=d(M);if($)return new Set(($.children??[]).filter(L=>L.type!=="bpmn:Lane"&&typeof L.y=="number"&&L.y>D).map(L=>L.id))},bn=(b,A,M)=>{if(!b)return!0;const D=p(b);return D?M-A.height/2>=D.y&&M+A.height/2<=D.y+D.height:!0},xn=h.map((b,A)=>({op:b,declared:A}));xn.sort((b,A)=>{const M=b.op.order??Number.POSITIVE_INFINITY,D=A.op.order??Number.POSITIVE_INFINITY;return M!==D?M-D:b.declared-A.declared});let wt=80;for(const b of o.getAll())b.parent===u()&&"height"in b&&typeof b.y=="number"&&(wt=Math.max(wt,b.y+b.height+60));for(const{op:b}of xn){const A=b.participant,M=y.filter(Q=>Q.node.participant===A.id).length,D=((EE=A.lanes)==null?void 0:EE.length)??0,$=Math.max(1200,M*160+300),L=(A.lanes??[]).map(Q=>V(G.get(Q.id)??0)),z=L.reduce((Q,fe)=>Q+fe,0);D&&z<300&&(L[D-1]+=300-z);const j=Math.max(300,O*((G.get(`pool:${A.id}`)??0)+1)),N=A.blackBox||M+D===0?120:D?Math.max(300,z):j,q=r.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:A.id,name:A.name,...b.order!==void 0?{"bwl:poolOrder":b.order}:{},...A.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:$,height:N,isExpanded:!0}),Y=n.createShape(q,{x:100+$/2,y:wt+N/2},u()),re=A.lanes??[];if(re.length&&n.splitLane(Y,re.length),re.length){const Q=o.filter(fe=>{var ye;return fe.type==="bpmn:Lane"&&((ye=d(fe))==null?void 0:ye.id)===A.id}).sort((fe,ye)=>fe.y-ye.y);if(Q.forEach((fe,ye)=>{const Re=re[ye];Re&&n.updateProperties(fe,{id:Re.id,name:Re.name})}),L.some(fe=>fe!==Y.height/D)){let fe=Y.y;Q.forEach((ye,Re)=>{const lt=L[Re];n.resizeShape(ye,{x:ye.x,y:fe,width:ye.width,height:lt}),fe+=lt})}}wt=Y.y+Y.height+60}const fn=b=>{var D;const A=T.get(b);if(A)return A.node.participant??"";const M=p(b);return M?M.type==="bpmn:Participant"?M.id:((D=d(M))==null?void 0:D.id)??"":""},yn=new Map,Ro=b=>{let A=yn.get(b);return A||yn.set(b,A={nodes:[],flows:[]}),A};for(const b of y)Ro(b.node.participant??"").nodes.push(b);for(const b of R)Ro(fn(b.flow.source)).flows.push(b);const ti=b=>{var A;return i.create("bpmn:SequenceFlow",{id:b.id,name:b.name??((A=b.condition)==null?void 0:A.label)})},Ri=(b,A,M)=>r.createShape({type:Ec(b.type),...b.eventDefinition?{eventDefinitionType:Qs[b.eventDefinition]}:{},businessObject:i.create(Ec(b.type),{id:b.id,name:b.name,...A!==void 0?{"bwl:band":A}:{},...M!==void 0?{"bwl:afterColumn":M}:{}})}),Ci=[...xn.map(({op:b})=>b.participant.id).filter(b=>yn.has(b)),...[...yn.keys()].filter(b=>!h.some(A=>A.participant.id===b))],Yt=b=>b.endsWith("Gateway");for(const b of Ci){const A=yn.get(b),M=b?f(b):void 0,D=M?M.x+150:250;let $=M?M.y+80:120;const L=(ne,le,se)=>{if(ne){const ge=f(ne);return ge.y+Math.min(ge.height/2,he)+S(ne,le??0)*O}return le!==void 0&&M?M.y+J+S(`pool:${b}`,le)*O:se},z=(ne,le,se)=>{if(ne){const ge=f(ne);return ge.y+Math.min(ge.height/2,he)+le*O}return M?M.y+J+le*O:se},j=ne=>ne.participant?f(ne.participant):u(),N=(ne,le,se,ge,Ve,We,Rt)=>{const Nt=se!==void 0||ge!==void 0,ve=S(se??`pool:${b}`,ge??0);if((ge===void 0||w(se,b,ge,Rt??Number.NaN))&&Rt!==void 0&&bn(se,le,Rt)&&!rt(ne,le,Ve,Rt))return{x:Ve,y:Rt};if(Nt)for(let me=0;me<4;me++){const Le=z(se,ve+me,We);if(!rt(ne,le,Ve,Le,pn(se,ve+me)))return ht(se,ve+me,M),{x:Ve,y:Le}}const be=L(se,ge,We);Nt?ht(se,ve,M):Se(ne,le,be);let oe=Ve;for(let me=0;me<64;me++){const Le=rt(ne,le,oe,be);if(!Le)break;oe=Le.x+Le.width+F+le.width/2}return{x:oe,y:be}},q=new Set(A.flows.map(ne=>ne.flow.target)),Y=new Map,re=ne=>{if(ne===void 0)return;const le=o.get(ne);if(!(!le||typeof le.x!="number"||typeof le.width!="number"))return le.x+le.width+F};for(const ne of A.nodes){if(q.has(ne.node.id))continue;const le=Ri(ne.node,ne.band,ne.afterColumn),se=K(ne),ge=ne.node.lane?`${ne.node.lane}|${se??""}`:se!==void 0?`band:${se}`:"",Ve=j(ne.node),We=Y.get(ge)??D,Rt=re(ne.afterColumn),Nt=Rt===void 0?We:Math.max(We,Rt),ve=N(Ve,le,ne.node.lane,se,Nt,$);n.createShape(le,ve,Ve),Y.set(ge,ve.x+le.width+F),!ne.node.lane&&se===void 0&&($+=160)}const Q=new Set,fe=new Map,ye=new Map,Re=new Map;if(b&&Ce.has(`pool:${b}`)){const ne=new Map;for(const ve of A.flows)ne.set(ve.flow.target,(ne.get(ve.flow.target)??0)+1);const le=ve=>L(ve.node.lane,pe(ve),Number.NaN),se=new Set,ge=ve=>{var me;const be=(me=T.get(ve))==null?void 0:me.node.participant;if(be)return p(be);const oe=p(ve);if(oe)return oe.type==="bpmn:Participant"?oe:d(oe)},Ve=ve=>{const be=[],oe=new Set([ve]),me=[ve];for(;me.length;){const Le=me.shift(),Ye=T.get(Le);Ye&&be.push(Ye);for(const ke of A.flows)ke.flow.source!==Le||oe.has(ke.flow.target)||(ne.get(ke.flow.target)??0)!==1||(oe.add(ke.flow.target),me.push(ke.flow.target))}return be},We=ve=>{if(!M)return;const be=new Set(ve.map(Le=>Le.node.id));let oe=!1,me=!1;for(const Le of x){if(!be.has(Le.flow.source))continue;const Ye=ge(Le.flow.target);!Ye||Ye.id===M.id||(Ye.y<M.y?oe=!0:me=!0)}return oe&&!me?"up":me&&!oe?"down":void 0};for(const ve of A.nodes){if(!Yt(ve.node.type))continue;const be=L(ve.node.lane,K(ve),Number.NaN);if(Number.isNaN(be))continue;const oe=[];for(const ke of A.flows){if(ke.flow.source!==ve.node.id)continue;const He=T.get(ke.flow.target);if(!He||He.node.lane!==ve.node.lane||(ne.get(He.node.id)??0)!==1)continue;const Qe=K(He);if(Qe===void 0)continue;const _e=L(He.node.lane,Qe,Number.NaN);if(Number.isNaN(_e))continue;const ot=Ve(He.node.id),Me=We(ot);Me&&oe.push({subtree:ot,band:Qe,row:_e,dir:Me})}if(!oe.some(ke=>ke.dir==="up")||!oe.some(ke=>ke.dir==="down")||!oe.some(ke=>ke.dir==="up"&&oe.some(He=>He.dir==="down"&&He.row<ke.row)))continue;const Le=[...oe].sort((ke,He)=>ke.row-He.row);[...oe.filter(ke=>ke.dir==="up"),...oe.filter(ke=>ke.dir==="down")].sort((ke,He)=>ke.dir===He.dir?ke.row-He.row:ke.dir==="up"?-1:1).forEach((ke,He)=>{const Qe=Le[He].band;if(Qe!==ke.band){se.add(ve.node.id);for(const _e of ke.subtree)K(_e)===ke.band&&ie.set(_e.node.id,Qe)}})}const Rt=ve=>{if(!M)return;const be=new Set(ve.map(Le=>Le.node.id));let oe=!1,me=!1;for(const Le of x){if(!be.has(Le.flow.target))continue;const Ye=ge(Le.flow.source);!Ye||Ye.id===M.id||(Ye.y<M.y?oe=!0:me=!0)}return oe&&!me?"up":me&&!oe?"down":void 0};for(const ve of A.nodes){if(!Yt(ve.node.type))continue;const be=ve.node.lane??`pool:${b}`,oe=te.get(be);if(!oe||oe.size<2)continue;const me=oe.get(0);if(me===void 0)continue;const Le=Math.max(...oe.values()),Ye=me===Le&&me!==0?"down":void 0;if(!Ye)continue;const ke=[];for(const Me of A.flows){if(Me.flow.source!==ve.node.id)continue;const Et=T.get(Me.flow.target);if(!Et||Et.node.lane!==ve.node.lane||(ne.get(Et.node.id)??0)!==1)continue;const yt=pe(Et);yt!==void 0&&ke.push({t:Et,subtree:Ve(Et.node.id),band:yt})}const He=ke.find(Me=>(oe.get(Me.band)??Me.band)===me);if(!He||Rt(He.subtree)===Ye||We(He.subtree)===Ye)continue;const Qe=ke.find(Me=>Me!==He&&Rt(Me.subtree)===Ye);if(!Qe)continue;const _e=He.band,ot=Qe.band;for(const Me of He.subtree)pe(Me)===_e&&ie.set(Me.node.id,ot);for(const Me of Qe.subtree)pe(Me)===ot&&ie.set(Me.node.id,_e);se.add(ve.node.id)}for(const ve of A.nodes){if(!Yt(ve.node.type))continue;const be=le(ve);if(Number.isNaN(be)||_.some(ke=>{var He,Qe;return(((He=ke.placement)==null?void 0:He.anchor)??(ke.association?ke.association.source===ke.annotation.id?ke.association.target:ke.association.source:void 0))===ve.node.id&&((Qe=ke.placement)==null?void 0:Qe.side.startsWith("bottom"))}))continue;let me,Le=!1,Ye;for(const ke of A.flows){if(ke.flow.source!==ve.node.id)continue;const He=T.get(ke.flow.target);if(!He||!He.node.lane&&K(He)===void 0)continue;const Qe=le(He);Number.isNaN(Qe)||(Math.abs(Qe-be)<.5&&(Le=!0),Qe>be?!me||Qe>me.row?me={id:He.node.id,row:Qe,count:1}:Qe===me.row&&me.count++:Qe<be&&He.node.lane===ve.node.lane&&(!Ye||Qe>Ye.row?Ye={op:He,row:Qe,count:1}:Qe===Ye.row&&Ye.count++))}me&&me.count===1&&(ne.get(me.id)??0)===1&&!se.has(ve.node.id)&&Q.add(me.id),!Le&&Ye&&Ye.count===1&&(ne.get(Ye.op.node.id)??0)===1&&!Te.has(ve.node.id)&&fe.set(Ye.op.node.id,{lane:ve.node.lane,band:pe(ve)})}const Nt=new Map;for(const ve of x)Nt.set(ve.flow.target,[...Nt.get(ve.flow.target)??[],ve]);for(const ve of A.nodes){const be=Nt.get(ve.node.id);if(!be||be.length!==1||!ne.get(ve.node.id)||!ve.node.lane&&K(ve)===void 0||B.has(ve.node.id))continue;const oe=(SE=T.get(be[0].flow.source))==null?void 0:SE.node.participant,me=oe?p(oe):void 0;if(!me||!M||me.id===M.id)continue;const Le=ve.node.lane??`pool:${b}`,Ye=te.get(Le);if(!Ye)continue;const ke=Ye.get(0)??0,He=(Ye.get(pe(ve)??0)??ke)-ke;if(He===0)continue;const Qe=me.y<M.y;if(Qe&&He<0||!Qe&&He>0)continue;let _e;for(const[ot,Me]of Ye){const Et=Me-ke;(Qe&&Et<0&&(!_e||Et<_e.row)||!Qe&&Et>0&&(!_e||Et>_e.row))&&(_e={band:ot,row:Et})}_e&&ye.set(ve.node.id,{lane:ve.node.lane,band:_e.band})}}const lt=new Set;let Ae=0;for(;Ae++<A.nodes.length+2;){for(let se=0;se<A.nodes.length+A.flows.length+2;se++){let ge=!1;for(const Ve of A.flows){const We=Ve.flow;if(lt.has(We.id))continue;const Rt=p(We.source);if(!Rt)continue;const Nt=p(We.target),ve=T.get(We.target);if(!Nt&&ve){const be=Ri(ve.node,ve.band),oe=pe(ve);if(ve.node.lane||oe!==void 0){const me=j(ve.node),Le=Rt,Ye=Le.x+(Re.get(We.source)??0)+Le.width+F,ke=fe.get(We.target)??ye.get(We.target),He=N(me,be,ke?ke.lane:ve.node.lane,ke?ke.band:oe,Q.has(We.target)?Le.x+Le.width/2:Ye,Number.NaN,ke||!_t(We.target)?void 0:Le.y+Le.height/2),Qe=n.createShape(be,He,me);Q.has(We.target)&&Re.set(We.target,Ye-(Qe.x+Qe.width/2)),n.connect(Rt,Qe,{type:"bpmn:SequenceFlow",businessObject:ti(We)})}else s.append(Rt,be,{connection:{type:"bpmn:SequenceFlow",businessObject:ti(We)}})}else if(Nt)n.connect(Rt,Nt,{type:"bpmn:SequenceFlow",businessObject:ti(We)});else continue;lt.add(We.id),ge=!0}if(!ge)break}const ne=A.nodes.filter(se=>!p(se.node.id));if(!ne.length)break;const le=ne[0];{const se=Ri(le.node,le.band),ge=j(le.node),Ve=K(le);n.createShape(se,N(ge,se,le.node.lane,Ve,D,$),ge),!le.node.lane&&Ve===void 0&&($+=160)}}}const Ai=40,Pa=b=>{const A=Y=>Y.kind==="label-over-line"||Y.kind==="label-over-shape"||Y.kind==="label-on-shared-segment"?Y.edge===b.id:Y.kind==="annotation-over-label"||Y.kind==="pool-name-over-label"?Y.label===b.id:!1,M=()=>new Set(mt(Xe(o)).filter(Y=>!A(Y)).map(Y=>ft(Y))),D=M(),$=b.waypoints.map(Y=>({x:Y.x,y:Y.y})),L=b.label,z=L&&{x:L.x,y:L.y};n.layoutConnection(b,{waypoints:[]});const j=M(),N=[...j].filter(Y=>!D.has(Y)).length,q=[...D].filter(Y=>!j.has(Y)).length;N<=q||(n.updateWaypoints(b,$),L&&z&&(L.x!==z.x||L.y!==z.y)&&n.moveElements([L],{x:z.x-L.x,y:z.y-L.y}))},ni=5,st=10,bt=200,Iu=new Set([...R.map(b=>b.flow.id),...x.map(b=>b.flow.id),...Qt(e,"sequenceFlow.update").map(b=>b.id),...Qt(e,"messageFlow.update").map(b=>b.id)].filter(b=>!!b)),kN=(b,A,M,D,$,L)=>{const z=new Set(b.map(ne=>ne.id)),j=Math.min(...b.map(ne=>ne.x))+A-st,N=Math.max(...b.map(ne=>ne.x+ne.width))+A+bt+st,q=Math.min(...b.map(ne=>ne.y+Math.min(0,...M)))-st,Y=Math.max(...b.map(ne=>ne.y+ne.height+Math.max(0,...M)))+st,re=o.getAll().filter(ne=>{if(ne.type!=="bpmn:SequenceFlow"&&ne.type!=="bpmn:MessageFlow")return!1;const le=ne;return Iu.has(le.id)||!le.waypoints||le.waypoints.length<2||[le.source,le.target].some(ge=>!ge||z.has(ge.id)||ge.x>=D)?!1:le.waypoints.some((ge,Ve)=>{const We=le.waypoints[Ve+1];return!!We&&Math.max(ge.x,We.x)>=j&&Math.min(ge.x,We.x)<=N&&Math.max(ge.y,We.y)>=q&&Math.min(ge.y,We.y)<=Y})});if(!re.length)return 0;const Q=ne=>{const le=new Map;for(const se of b)for(const ge of M){const Ve={id:se.id,type:se.type,x:se.x+A+ne,y:se.y+ge,width:se.width,height:se.height};for(const We of re){let Rt=1/0;for(let ve=0;ve+1<We.waypoints.length;ve++)Rt=Math.min(Rt,mc(We.waypoints[ve],We.waypoints[ve+1],Ve));const Nt=`${We.id}|${se.id}`;le.set(Nt,Math.min(le.get(Nt)??1/0,Rt))}}return le},fe=[...Q(0)].filter(([,ne])=>ne<=ni).map(([ne])=>ne);if(!fe.length)return 0;let ye=0;for(let ne=1;ne<=bt;ne++){const le=Q(ne);if([...le.values()].every(se=>se>ni)&&fe.every(se=>(le.get(se)??1/0)>=st)){ye=ne;break}}if(!ye)return 0;const Re=Math.min(...b.map(ne=>ne.x))+A+ye,lt=new Set(fe.map(ne=>ne.slice(0,ne.indexOf("|"))));return re.some(ne=>ne.type==="bpmn:SequenceFlow"&&lt.has(ne.id)&&ne.waypoints.some((le,se)=>{const ge=ne.waypoints[se+1];if(!ge||Math.min(le.y,ge.y)>L||Math.max(le.y,ge.y)<L||le.y===ge.y)return!1;const Ve=le.x+(L-le.y)*(ge.x-le.x)/(ge.y-le.y);return Ve>$&&Ve<Re}))?0:ye},Co=(b,A=()=>!0)=>{const M=p(b);if(!M)return[];const D=[M],$=new Set([b]);for(let L=0;L<D.length;L++){const z=D[L].id;for(const j of R){const N=j.flow.target;if(j.flow.source!==z||$.has(N)||!T.has(N))continue;$.add(N);const q=p(N);q&&A(q)&&D.push(q)}}return D},ON=(b,A=()=>!0)=>{const M=p(b);if(!M)return[];const D=[M],$=new Set([b]);for(let L=0;L<D.length;L++){const z=D[L].id;for(const j of R){const N=j.flow.source;if(j.flow.target!==z||$.has(N)||!T.has(N))continue;$.add(N);const q=p(N);q&&A(q)&&D.push(q)}}return D},Zi=30,gr=b=>!("waypoints"in b&&b.waypoints)&&b.type!=="bpmn:Lane"&&b.type!=="label"&&typeof b.x=="number",Bu=(b,A)=>Ip(n,b,A),Vs=(b,A,M=!1)=>{const D=new Set(b.flatMap(N=>N.subtree.map(q=>q.id)));for(const N of b){const q=(N.pool.children??[]).filter(gr).filter(re=>!D.has(re.id));if(N.subtree.some(re=>q.some(Q=>re.x+A<Q.x+Q.width+Zi&&re.x+A+re.width+Zi>Q.x&&re.y<Q.y+Q.height&&re.y+re.height>Q.y)))return null}const $=b.map(N=>N.pool.width),L=M?o.filter(N=>Array.isArray(N.waypoints)).map(N=>({c:N,wps:N.waypoints.map(q=>({x:q.x,y:q.y}))})):[],z=o.filter(N=>N.type==="label").map(N=>({label:N,x:N.x,y:N.y}));n.moveElements(b.flatMap(N=>N.subtree),{x:A,y:0});const j=b.map(N=>{const Y=Math.max(...N.subtree.map(re=>re.x+re.width))+Ag-(N.pool.x+N.pool.width);return Y>0&&Bu(N.pool,N.pool.width+Y),Y});return()=>{n.moveElements(b.flatMap(N=>N.subtree),{x:-A,y:0}),b.forEach((N,q)=>{j[q]>0&&Bu(N.pool,$[q])});for(const{c:N,wps:q}of L){const Y=N.waypoints??[];Y.length===q.length&&Y.every((Q,fe)=>Math.abs(Q.x-q[fe].x)<=.5&&Math.abs(Q.y-q[fe].y)<=.5)||n.updateWaypoints(N,q.map(Q=>({x:Q.x,y:Q.y})))}for(let N=0;N<3;N++){let q=0;for(const Y of z){const re=Y.x-Y.label.x,Q=Y.y-Y.label.y;Math.abs(re)<=.5&&Math.abs(Q)<=.5||(n.moveElements([Y.label],{x:re,y:Q}),q++)}if(!q)break}}},Ih=b=>{var $,L;const A=new Map,M=new Map;for(const z of o.getAll()){if(z.type!=="bpmn:Participant")continue;const j=z;(j.children??[]).length||(A.set(j.id,j),M.set(j.id,[]))}for(const z of o.getAll()){if(z.type!=="bpmn:MessageFlow")continue;const j=z,N=($=j.source)==null?void 0:$.id,q=(L=j.target)==null?void 0:L.id;N&&q&&M.has(N)&&M.get(N).push(q),N&&q&&M.has(q)&&M.get(q).push(N)}const D=[];for(const[z,j]of M)j.length&&j.every(N=>b.has(N))&&D.push(A.get(z));return D},J0=(b,A)=>{if(!b.length)return null;const M=new Set(b.map(Y=>Y.id)),D=o.getAll().filter(Y=>Y.type==="bpmn:Participant"&&!M.has(Y.id)),$=Math.min(...D.filter(Y=>(Y.children??[]).length>0).map(Y=>Y.x)),L=new Set(b.filter(Y=>Math.abs(Y.x-$)<=2).map(Y=>Y.id));if(b.some(Y=>{const re=L.has(Y.id)?Y.x:Y.x+A,Q=L.has(Y.id)?Y.width+A:Y.width;return D.some(fe=>re<fe.x+fe.width+Zi&&re+Q+Zi>fe.x&&Y.y<fe.y+fe.height&&Y.y+Y.height>fe.y)}))return null;const j=o.filter(Y=>Y.type==="label").map(Y=>({label:Y,x:Y.x,y:Y.y})),N=b.filter(Y=>!L.has(Y.id)),q=b.filter(Y=>L.has(Y.id)).map(Y=>({pool:Y,was:{x:Y.x,y:Y.y,width:Y.width,height:Y.height}}));N.length&&n.moveElements(N,{x:A,y:0});for(const{pool:Y,was:re}of q)n.resizeShape(Y,{...re,width:re.width+A});return()=>{for(const{pool:Y,was:re}of q)n.resizeShape(Y,re);N.length&&n.moveElements(N,{x:-A,y:0});for(let Y=0;Y<3;Y++){let re=0;for(const Q of j){const fe=Q.x-Q.label.x,ye=Q.y-Q.label.y;Math.abs(fe)<=.5&&Math.abs(ye)<=.5||(n.moveElements([Q.label],{x:fe,y:ye}),re++)}if(!re)break}}},eE=()=>{let b=0;for(const A of o.getAll()){if(A.type!=="bpmn:DataInputAssociation"&&A.type!=="bpmn:DataOutputAssociation")continue;const M=A.waypoints??[];for(let D=1;D<M.length;D++)b+=Math.hypot(M[D].x-M[D-1].x,M[D].y-M[D-1].y)}return b},tE=()=>{let b=0;for(const A of o.getAll()){if(A.type!=="bpmn:Association")continue;const M=A.waypoints??[];for(let D=1;D<M.length;D++)b+=Math.hypot(M[D].x-M[D-1].x,M[D].y-M[D-1].y)}return b},DN=b=>{const A=[];for(const M of o.getAll()){if(M.type!=="bpmn:TextAnnotation")continue;const D=M;if(b.has(D.id))continue;const L=[...D.incoming??[],...D.outgoing??[]].filter(N=>N.type==="bpmn:Association").map(N=>N.source===D?N.target:N.source);if(!L.length||L.some(N=>N===void 0))continue;const z=N=>{if(!("waypoints"in N&&N.waypoints))return[N.id];const q=N,Y=[q.source,q.target];return Y.some(re=>!re)?[]:Y.map(re=>re.id)},j=L.flatMap(N=>z(N));j.length&&j.every(N=>b.has(N))&&A.push(D)}return A},nE=()=>mt(Xe(o)).filter(b=>b.kind==="edge-crosses-shape").length,iE=b=>{const A=(b.children??[]).filter(gr);let M=0;for(let D=0;D<A.length;D++)for(let $=D+1;$<A.length;$++){const L=A[D],z=A[$];L.x<z.x+z.width&&L.x+L.width>z.x&&L.y<z.y+z.height&&L.y+L.height>z.y&&M++}return M},Ta=()=>{const b=Xe(o),A=M=>M.length>=2&&(M.every(D=>Math.abs(D.x-M[0].x)<.01)||M.every(D=>Math.abs(D.y-M[0].y)<.01));return{messages:b.edges.filter(M=>M.type==="bpmn:MessageFlow"&&M.waypoints.length===2).length,lines:b.edges.filter(M=>A(M.waypoints)).length}},rE=b=>{const A=new Map;for(const D of o.getAll()){if(D.type!=="bpmn:MessageFlow")continue;const $=D;if(!$.waypoints||$.waypoints.length!==2)continue;const L=$.source,z=$.target;if(!L||!z)continue;const j=b.has(L.id);if(j===b.has(z.id))continue;const N=j?z:L,q=d(N);if(!q||b.has(N.id))continue;const Y=A.get(q.id);Y?N.x<Y.minX&&(Y.minX=N.x):A.set(q.id,{pool:q,minX:N.x})}const M=[];for(const{pool:D,minX:$}of A.values()){const L=(D.children??[]).filter(z=>gr(z)&&!b.has(z.id)&&z.x>=$);L.length&&M.push({subtree:L,pool:D})}return M},LN=(b,A,M)=>{const D=new Map(A.map(z=>[z.pool.id,{subtree:[...z.subtree],pool:z.pool}])),$=new Set(b);for(const z of A)for(const j of z.subtree)$.add(j.id);let L=!1;for(;;){let z=0;for(const j of rE($)){if(j.pool===M)continue;const N=D.get(j.pool.id);N?N.subtree.push(...j.subtree):D.set(j.pool.id,{subtree:[...j.subtree],pool:j.pool});for(const q of j.subtree)$.add(q.id);z+=j.subtree.length}if(!z)break;L=!0}return L?[...D.values()]:null},oE=new Map;for(const b of Qt(e,"sequenceFlow.update")){if(b.target===void 0)continue;const A=T.get(b.target);if(!A)continue;const M=p(b.target),D=p(b.id);if(!M||!D)continue;const $=b.source!==void 0?p(b.source):D.source,L=D.target;if(!$||!L||L.id===M.id)continue;const z=D.waypoints&&D.waypoints.length>=3&&Math.abs(D.waypoints[0].x-D.waypoints[1].x)<1&&Math.abs(D.waypoints[0].y-D.waypoints[1].y)>1?{x:D.waypoints[0].x,y:D.waypoints[0].y}:void 0,j=z?D.waypoints[1].y:void 0,N=z&&D.label?{x:D.label.x,y:D.label.y}:void 0,q=N&&D.label&&Math.abs(N.y+D.label.height/2-j)<=O/5&&N.x+D.label.width>z.x?N.x+D.label.width+6:void 0,Y=($.outgoing??[]).filter(_e=>_e.type==="bpmn:SequenceFlow"&&_e.id!==D.id&&_e.target&&!Iu.has(_e.id)),re=new Set(Y.map(_e=>_e.target.id)),Q=_e=>{const ot={type:"bpmn:Task",x:_e.x+2,y:_e.y+2,width:_e.width-4,height:_e.height-4};return Y.find(Me=>(Me.waypoints??[]).some((Et,yt)=>!!Me.waypoints[yt+1]&&mc(Et,Me.waypoints[yt+1],ot)===0))},fe=Co(b.target),ye=new Set(fe.map(_e=>_e.id)),Re=Math.min(...fe.map(_e=>_e.x)),lt=Math.max(...fe.map(_e=>_e.x+_e.width)),Ae=$.x+$.width,ne=M.y+M.height/2,le=kN(fe,Ae+Ai-Re,[0,$.y+$.height/2-ne,L.y+L.height/2-ne],L.x,Ae,$.y+$.height/2),se=Ae+Ai+le,ge=(()=>{if(q===void 0)return 0;const _e=Ae+Ai,ot=$.y+$.height/2-M.height/2,Me={x:_e,y:ot,width:lt-Re,height:M.height},Et=d($);return((Et==null?void 0:Et.children)??[]).some(gt=>gr(gt)&&!ye.has(gt.id)&&gt.id!==$.id&&gt.id!==L.id&&gt.type!=="bpmn:Group"&&gt.type!=="bpmn:Participant"&&gt.x<Me.x+Me.width&&gt.x+gt.width>Me.x&&gt.y<Me.y+Me.height&&gt.y+gt.height>Me.y)||Q(Me)?Math.max(0,q-_e):0})(),Ve=lt-Re+Ai*2+le+ge-(L.x-Ae);let We=[];if(Ve>0){const _e=d(M),ot=(_e==null?void 0:_e.children)??[],Me=Be=>Be.type==="bpmn:Lane";We=(()=>{const Be=new Set;for(const Ne of ot)gr(Ne)&&!ye.has(Ne.id)&&Ne.id!==$.id&&Ne.x>=L.x&&Be.add(Ne.id);const Pt=[];for(const Ne of ot){if(Ne.type!=="bpmn:DataStoreReference"&&Ne.type!=="bpmn:DataObjectReference")continue;const xt=Ne,Gn=[...xt.incoming??[],...xt.outgoing??[]].filter(Kt=>Kt.type==="bpmn:DataInputAssociation"||Kt.type==="bpmn:DataOutputAssociation").map(Kt=>Kt.source===xt?Kt.target:Kt.source);Gn.length&&Gn.every(Kt=>Kt!==void 0&&Be.has(Kt.id))&&Pt.push(xt)}return Pt})();const yt=ot.filter(Be=>!("waypoints"in Be&&Be.waypoints)&&!Me(Be)&&Be.type!=="label"&&!ye.has(Be.id)&&Be.id!==$.id&&Be.x>=L.x),gt=yt.flatMap(Be=>Be.labels??[]),Lt=_e?[_e,...ot.filter(Be=>Me(Be))]:[];if(yt.length){const Be=new Set(yt.map(nt=>nt.id)),Pt=rE(Be),Ne=Pt.length?LN(Be,Pt,_e):null,xt=nt=>{const vt=new Set(Be);for(const Ut of nt)for(const Fn of Ut.subtree)vt.add(Fn.id);return DN(vt)},$n=xt(Pt),Gn=Ne?xt(Ne):$n,Kt=Ih(Be),Hu=new Set(Be);for(const nt of Pt)for(const vt of nt.subtree)Hu.add(vt.id);const zu=Pt.length?Ih(Hu):Kt,Gu=(()=>{if(!Ne)return[];const nt=new Set(Be);for(const vt of Ne)for(const Ut of vt.subtree)nt.add(Ut.id);return Ih(nt)})(),qs=new Set([...yt,...Lt].map(nt=>nt.id)),Gh=ot.filter(nt=>{const vt=nt.labelTarget;return nt.type==="label"&&!!vt&&"waypoints"in vt&&!!vt.source&&!!vt.target&&qs.has(vt.source.id)&&qs.has(vt.target.id)});n.createSpace([...yt,...gt,...Gh],Lt,{x:Ve,y:0},"e",L.x-1);const Vu=(nt,vt)=>{const Ut=Ta(),Fn=Vs(nt,Ve);if(!Fn)return!1;const To=vt.length?J0(vt,Ve):null,$t=Ta();return $t.messages>Ut.messages&&$t.lines>=Ut.lines?!0:(To==null||To(),Fn(),!1)},Oi=Ne?Vu(Ne,Gu):!1;let ut=Oi;!ut&&Pt.length&&(ut=Vu(Pt,zu));const Xt=Oi?Gn:$n;if(!ut){for(const nt of Pt){const vt=Ta(),Ut=Vs([nt],Ve);if(!Ut)continue;const Fn=Ta();(Fn.messages<=vt.messages||Fn.lines<vt.lines)&&Ut()}if(Kt.length){const nt=Ta(),vt=J0(Kt,Ve);if(vt){const Ut=Ta();(Ut.messages<=nt.messages||Ut.lines<nt.lines)&&vt()}}}if(Xt.length){const nt=()=>new Set(mt(Xe(o)).map(Ut=>ft(Ut))),vt=Ut=>{const Fn=tE(),To=nt(),$t=Ut.map(Zt=>({a:Zt,x:Zt.x,y:Zt.y})),yr=o.filter(Zt=>Zt.type==="label").map(Zt=>({label:Zt,x:Zt.x,y:Zt.y}));n.moveElements(Ut,{x:Ve,y:0});const ko=[...nt()].filter(Zt=>!To.has(Zt));if(tE()<Fn&&ko.length===0)return!0;for(const{a:Zt,x:Ys,y:Ks}of $t)(Zt.x!==Ys||Zt.y!==Ks)&&n.moveElements([Zt],{x:Ys-Zt.x,y:Ks-Zt.y});for(const Zt of yr){const Ys=Zt.x-Zt.label.x,Ks=Zt.y-Zt.label.y;(Ys!==0||Ks!==0)&&n.moveElements([Zt.label],{x:Ys,y:Ks})}return!1};if(!vt(Xt)&&Xt.length>1)for(const Ut of Xt)vt([Ut])}}}const Rt=A.node.lane!==void 0?p(A.node.lane):A.node.participant!==void 0?p(A.node.participant):void 0,Nt=_e=>{if(!Rt)return!0;const ot=_e.y+_e.height/2;return ot>=Rt.y&&ot<=Rt.y+Rt.height},ve=!Nt($)&&Nt(L)?L:$,be=ve.y+ve.height/2,oe=be-(M.y+M.height/2),me=A.band!==void 0,Le=me?[M]:fe,Ye=(A.band===void 0||w(A.node.lane,A.node.participant,A.band,be))&&_t(b.target)&&Le.every(_e=>{var ot;return bn((ot=T.get(_e.id))==null?void 0:ot.node.lane,_e,_e.y+_e.height/2+oe)}),ke=_e=>Math.abs(_e.y+_e.height/2-(M.y+M.height/2))<=O/2;if(Ye&&me){const _e=Math.abs(oe)<=O/2?fe.filter(ot=>ot.id!==M.id&&ke(ot)):[];if(n.moveElements(fe,{x:se-Re,y:0}),n.moveElements([M],{x:0,y:oe}),_e.length){const ot=()=>new Set(mt(Xe(o)).map(Be=>ft(Be))),Me=ot(),Et=o.filter(Be=>Be.type==="label").map(Be=>({label:Be,x:Be.x,y:Be.y}));n.moveElements(_e,{x:0,y:oe});const yt=ot(),gt=[...yt].filter(Be=>!Me.has(Be)).length,Lt=[...Me].filter(Be=>!yt.has(Be)).length;if(gt>Lt){n.moveElements(_e,{x:0,y:-oe});for(const Be of Et){const Pt=Be.x-Be.label.x,Ne=Be.y-Be.label.y;(Pt!==0||Ne!==0)&&n.moveElements([Be.label],{x:Pt,y:Ne})}}}}else n.moveElements(fe,{x:se-Re,y:Ye?oe:0});const He=d(M);if(!Ye&&A.node.lane===void 0&&A.band!==void 0&&He){const _e=He.y+J+S(`pool:${A.node.participant??""}`,A.band)*O,ot=_e-(M.y+M.height/2);ot!==0&&!rt(He,M,M.x+M.width/2,_e,ye)&&n.moveElements([M],{x:0,y:ot})}if(He){const _e=(He.children??[]).filter(yt=>gr(yt)&&!ye.has(yt.id)&&yt.type!=="bpmn:Group"&&yt.type!=="bpmn:Participant"),ot=(yt,gt,Lt,Be,Pt)=>yt.x+gt<Pt.x+Pt.width+Be&&yt.x+gt+yt.width+Be>Pt.x&&yt.y+Lt<Pt.y+Pt.height+Be&&yt.y+Lt+yt.height+Be>Pt.y,Me=_e.find(yt=>ot(M,0,0,0,yt)),Et=Me?void 0:Q(M);if(Me||Et){const yt=["bpmn:SequenceFlow","bpmn:MessageFlow","bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation"],gt=o.getAll().filter(ut=>{if(!yt.includes(ut.type))return!1;const Xt=ut;return Iu.has(Xt.id)||!Xt.waypoints||Xt.waypoints.length<2?!1:![Xt.source,Xt.target].some(nt=>!nt||ye.has(nt.id))}),Lt=(ut,Xt,nt)=>{var vt;return bn((vt=T.get(ut.id))==null?void 0:vt.node.lane,ut,ut.y+nt+ut.height/2)&&ut.x+Xt>=He.x&&ut.x+Xt+ut.width<=He.x+He.width&&ut.y+nt>=He.y&&ut.y+nt+ut.height<=He.y+He.height},Be=(ut,Xt)=>fe.every(nt=>Lt(nt,ut,Xt)&&!_e.some(vt=>ot(nt,ut,Xt,st,vt))&&gt.every(vt=>{const Ut={id:nt.id,type:nt.type,x:nt.x+ut,y:nt.y+Xt,width:nt.width,height:nt.height};for(let Fn=0;Fn+1<vt.waypoints.length;Fn++)if(mc(vt.waypoints[Fn],vt.waypoints[Fn+1],Ut)<st)return!1;return!0})),Pt=M.y+M.height/2,Ne=[j,L.y+L.height/2].filter(ut=>ut!==void 0&&Math.abs(ut-Pt)>=1),xt=Me&&re.has(Me.id)?Me:Et==null?void 0:Et.target,$n=xt?xt.x-M.x:0,Gn=Math.max(...fe.map(ut=>ut.x+ut.width)),Kt=[...$n!==0?[$n]:[],...le!==0?[-le]:[],0],Hu=q===void 0?[]:Kt.map(ut=>Math.max(ut,q-M.x)),zu=ut=>Gn+ut+Ai<=L.x,Gu=[...new Set([...Hu,...Kt])].filter(zu),qs=Me&&re.has(Me.id)?[Me.x+Me.width+Ai-M.x]:[],Gh=q===void 0?[]:qs.map(ut=>Math.max(ut,q-M.x)),Vu=[...new Set([...Gh,...qs])].filter(ut=>zu(ut)&&!Gu.includes(ut));let Oi;for(const ut of[Gu,Vu]){for(const Xt of Ne){for(const nt of ut)if(Be(nt,Xt-Pt)){Oi={dx:nt,dy:Xt-Pt};break}if(Oi)break}if(Oi)break}if(Oi){const ut=$t=>{const yr=$t;return[yr.edge,yr.other,...Array.isArray(yr.edges)?yr.edges:[]].some(ko=>typeof ko=="string"&&Iu.has(ko))},Xt=()=>new Set(mt(Xe(o)).filter($t=>!ut($t)).map($t=>ft($t))),nt=Xt(),vt=o.filter($t=>$t.type==="label").map($t=>({label:$t,x:$t.x,y:$t.y}));n.moveElements(fe,{x:Oi.dx,y:Oi.dy});const Ut=Xt(),Fn=[...Ut].filter($t=>!nt.has($t)).length,To=[...nt].filter($t=>!Ut.has($t)).length;if(Fn>To){n.moveElements(fe,{x:-Oi.dx,y:-Oi.dy});for(const $t of vt){const yr=$t.x-$t.label.x,ko=$t.y-$t.label.y;(yr!==0||ko!==0)&&n.moveElements([$t.label],{x:yr,y:ko})}}else z&&oE.set(D.id,{exit:z,channelY:j,label:N})}}}{const _e=new Set(fe.map(gt=>gt.id)),ot=new Set(R.map(gt=>gt.flow.id)),Me=20,Et=gt=>{const Lt=gt.source,Be=gt.target,Pt=Math.min(Lt.x,Be.x)-Me,Ne=Math.max(Lt.x+Lt.width,Be.x+Be.width)+Me,xt=Math.min(Lt.y,Be.y)-Me,$n=Math.max(Lt.y+Lt.height,Be.y+Be.height)+Me;return gt.waypoints.some(Gn=>Gn.x<Pt||Gn.x>Ne||Gn.y<xt||Gn.y>$n)},yt=new Map;for(const gt of fe)for(const Lt of[...gt.incoming??[],...gt.outgoing??[]])Lt.id!==b.id&&ot.has(Lt.id)&&!(_e.has(Lt.source.id)&&_e.has(Lt.target.id))&&yt.set(Lt.id,Lt);for(const gt of yt.values())Et(gt)&&Pa(gt)}const Qe=We.length?d(We[0]):void 0;if(Qe){const _e={assoc:eE(),overlaps:iE(Qe),crosses:nE()},ot=We.map(Ne=>({st:Ne,x:Ne.x})),Me=o.filter(Ne=>Ne.type==="label").map(Ne=>({label:Ne,x:Ne.x,y:Ne.y})),Et=Math.min(...We.flatMap(Ne=>[...Ne.incoming??[],...Ne.outgoing??[]].filter(xt=>xt.type==="bpmn:DataInputAssociation"||xt.type==="bpmn:DataOutputAssociation").map(xt=>(xt.source===Ne?xt.target:xt.source).x))),yt=new Set(We.map(Ne=>Ne.id)),gt=(Qe.children??[]).filter(gr).filter(Ne=>!yt.has(Ne.id));let Lt=Et;for(const Ne of[...We].sort((xt,$n)=>xt.x-$n.x)){let xt=Lt;for(let $n=0;$n<100;$n++){const Gn=gt.find(Kt=>xt<Kt.x+Kt.width+Zi&&xt+Ne.width+Zi>Kt.x&&Ne.y<Kt.y+Kt.height&&Ne.y+Ne.height>Kt.y);if(!Gn)break;xt=Gn.x+Gn.width+Zi}xt!==Ne.x&&n.moveElements([Ne],{x:xt-Ne.x,y:0}),Lt=xt+Ne.width+Zi}const Be=Lt+150-(Qe.x+Qe.width);Be>0&&Bu(Qe,Qe.width+Be);const Pt={assoc:eE(),overlaps:iE(Qe),crosses:nE()};if(Pt.assoc>=_e.assoc||Pt.overlaps>_e.overlaps||Pt.crosses>_e.crosses){for(const{st:Ne,x:xt}of ot)Ne.x!==xt&&n.moveElements([Ne],{x:xt-Ne.x,y:0});Be>0&&Bu(Qe,Qe.width-Be);for(const Ne of Me){const xt=Ne.x-Ne.label.x,$n=Ne.y-Ne.label.y;(xt!==0||$n!==0)&&n.moveElements([Ne.label],{x:xt,y:$n})}}}}const aE=(b,A)=>{const M=A.target===b,D=f(A.source),$=f(A.target),L=M?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(D,$,A.id?{type:L,businessObject:i.create(L,{id:A.id})}:{type:L})},sE=100,cE=b=>{for(const A of h){if(!A.participant.blackBox)continue;const M=p(A.participant.id);if(!M)continue;const D=[];for(const L of x){const z=L.flow.source===A.participant.id?L.flow.target:L.flow.target===A.participant.id?L.flow.source:void 0,j=z?p(z):void 0;j&&typeof j.x=="number"&&j.type!=="bpmn:Participant"&&D.push(j)}if(!D.length)continue;if(!b&&A.order===void 0){const L=(()=>{var j;const z=new Map;for(const N of D){const q=d(N);if(!q)continue;const Y=z.get(q.id);Y?Y.n+=1:z.set(q.id,{shape:q,n:1})}return(j=[...z.values()].sort((N,q)=>q.n-N.n)[0])==null?void 0:j.shape})();if(L){const z=q=>q.reduce((Y,re)=>Y+re,0)/q.length,j=z(D.map(q=>q.y+q.height/2))<L.y+L.height/2,N=o.filter(q=>q.type==="bpmn:Participant"&&q.id!==A.participant.id&&q.id!==L.id).filter(q=>j?q.y+q.height<=L.y+5:q.y>=L.y+L.height-5);if(N.length){const q=[...N.reduce((se,ge)=>se.set(ge.y,(se.get(ge.y)??0)+1),new Map)].sort((se,ge)=>ge[1]-se[1]||(j?ge[0]-se[0]:se[0]-ge[0]))[0][0],Y=Math.min(M.width,HR),re=zR,Q=D.map(se=>se.x+se.width/2),fe=Math.round(z(Q)-Y/2),ye=Math.max(...Q)+sE,Re=se=>({x:se,width:Math.max(Y,ye-se)}),lt=N.filter(se=>Math.min(se.y+se.height,q+re)-Math.max(se.y,q)>0),Ae=se=>{const ge=Re(se);return lt.some(Ve=>Ve.x<ge.x+ge.width&&ge.x<Ve.x+Ve.width)},ne=se=>{const ge=Re(se);return Q.filter(Ve=>Ve>=ge.x+10&&Ve<=ge.x+ge.width-10).length},le=(()=>{if(!Ae(fe))return fe;const se=ne(fe);return lt.flatMap(ge=>[ge.x+ge.width+Eg,ge.x-Eg-Y]).map(ge=>Math.round(ge)).filter(ge=>!Ae(ge)&&ne(ge)>=se).sort((ge,Ve)=>Math.abs(ge-fe)-Math.abs(Ve-fe))[0]??fe})();if(le!==M.x||q!==M.y||Y!==M.width||re!==M.height){const se=()=>new Set(mt(Xe(o)).map(ve=>ft(ve))),ge=se(),Ve={x:M.x,y:M.y,width:M.width,height:M.height};n.resizeShape(M,{x:le,y:q,width:Y,height:re});const We=se(),Rt=[...We].filter(ve=>!ge.has(ve)).length,Nt=[...ge].filter(ve=>!We.has(ve)).length;Rt>Nt&&n.resizeShape(M,Ve)}}}}const $=Math.max(...D.map(L=>L.x+L.width/2))+sE;if($>M.x+M.width&&n.resizeShape(M,{x:M.x,y:M.y,width:$-M.x,height:M.height}),!!b)for(const L of x){const z=p(L.flow.id),j=L.flow.source===A.participant.id?L.flow.target:L.flow.target===A.participant.id?L.flow.source:void 0,N=j?p(j):void 0;if(!z||!N||N.type==="bpmn:Participant")continue;const q=N.x+N.width/2;if(q<M.x+10||q>M.x+M.width-10)continue;const Y=M.y>N.y,re=Y?N.y+N.height:N.y,Q=Y?M.y:M.y+M.height,fe=L.flow.source===A.participant.id?[{x:q,y:Q},{x:q,y:re}]:[{x:q,y:re},{x:q,y:Q}],ye=Xe(o),Re={...ye.edges.find(lt=>lt.id===L.flow.id),waypoints:fe};wn(Re,ai(ye)).length||n.updateWaypoints(z,fe)}}};cE(!1);for(const b of x){const A=b.flow;n.connect(f(A.source),f(A.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:A.id,name:A.name})})}{const M=new Set([...R.map(N=>N.flow.id),...x.map(N=>N.flow.id)].filter(N=>!!N)),D=o.filter(N=>!!N.waypoints),$=(N,q)=>Math.abs(q.x-N.x)<2?"L":Math.abs(q.x-(N.x+N.width))<2?"R":Math.abs(q.y-N.y)<2?"T":Math.abs(q.y-(N.y+N.height))<2?"B":void 0,L=new Map,z=(N,q,Y)=>{if(!N||!q||typeof N.x!="number")return;const re=$(N,q);if(!re)return;let Q=L.get(N.id);Q||L.set(N.id,Q=new Map),Q.set(re,[...Q.get(re)??[],Y])};for(const N of D){const q=N.waypoints;!q||q.length<2||(z(N.source,q[0],{id:N.id,dir:"out"}),z(N.target,q[q.length-1],{id:N.id,dir:"in"}))}const j=new Set;for(const[N,q]of L){const Y=p(N);if(!Y||typeof Y.x!="number"||![...q.values()].some(Ae=>{const ne=Ae.filter(le=>le.dir==="in");return Ae.length>=3&&ne.length>=1&&Ae.some(le=>le.dir==="out")&&ne.some(le=>M.has(le.id))}))continue;const Q=d(Y);if(!Q||j.has(Q.id)||(Q.children??[]).some(Ae=>Ae.type==="bpmn:Lane"))continue;const fe=(RE=q.get("T"))!=null&&RE.length?(CE=q.get("B"))!=null&&CE.length?void 0:"B":"T";if(!fe||(fe==="T"?Y.y-Q.y:Q.y+Q.height-(Y.y+Y.height))>=O)continue;const Re=(Q.children??[]).filter(Ae=>!("waypoints"in Ae&&Ae.waypoints)&&Ae.type!=="label"&&typeof Ae.x=="number"),lt=Q.y+Q.height;n.resizeShape(Q,{x:Q.x,y:Q.y,width:Q.width,height:Q.height+O}),ee(lt,Q.id,O),fe==="T"&&Re.length&&n.moveElements(Re,{x:0,y:O}),j.add(Q.id)}}const Bh=20,lE=4,IN=2,BN=[10,30,80],Zr=()=>{const b=Xe(o);return{bad:mt(b).filter(A=>A.kind==="edge-crosses-shape"||A.kind==="edge-overlap-opposite"||A.kind==="edge-overlap-mixed").length,crossings:Lm(b),straight:b.edges.filter(A=>A.type==="bpmn:MessageFlow"&&A.waypoints.length===2).length}},ka=b=>{const A=Xe(o),M=A.edges.find(D=>D.id===b);return M?wn(M,ai(A)).length:0},Nu=b=>ka(b)>0,$u=b=>Xe(o).edges.filter(A=>A.type==="bpmn:MessageFlow"&&A.id!==b&&A.waypoints.length===2).length,NN=(b,A,M)=>Vs([{subtree:b,pool:A}],M),uE=(b,A)=>A.bad>b.bad||A.crossings>b.crossings&&A.straight<=b.straight&&A.bad>=b.bad,Oa=(b,A)=>uE(b,A)||A.straight<b.straight,Ao=(b,A,M=()=>!0,D=uE,$=!1)=>{const L=Zr(),z=Vs(b,A,$);if(!z)return!1;const j=Zr();return D(L,j)||!M()?(z(),!1):!0},$N=(b,A,M,D=()=>!0)=>Ao([{subtree:b,pool:A}],M,D),Mo=b=>{var A;return!!((A=T.get(b))!=null&&A.node.participant)},Ws=new Map;for(const b of x){if(!Mo(b.flow.target))continue;const A=Ws.get(b.flow.target)??[];A.push(b),Ws.set(b.flow.target,A)}const Fu=[...Ws.keys()],Nh=new Set(R.map(b=>b.flow.target)),pE=b=>xn.findIndex(({op:A})=>A.participant.id===b);Fu.sort((b,A)=>{var $,L;const M=Nh.has(b)?1:0,D=Nh.has(A)?1:0;return M!==D?M-D:pE(($=T.get(b))==null?void 0:$.node.participant)-pE((L=T.get(A))==null?void 0:L.node.participant)});const Qr=b=>b.x+b.width/2,FN=b=>{const A=new Map;for(const $ of o.getAll()){const L=$;if(!L.waypoints||!L.source||!L.target)continue;(A.get(L.source.id)??A.set(L.source.id,[]).get(L.source.id)).push(L.target.id)}const M=new Set([b]),D=[b];for(let $=0;$<D.length;$++)for(const L of A.get(D[$])??[])M.has(L)||(M.add(L),D.push(L));return M},jN=(b,A)=>{const M=FN(A);let D;for(const $ of o.getAll()){const L=$;if(L.type!=="bpmn:MessageFlow"||!L.source||!L.target||L.target.id!==b||M.has(L.source.id))continue;const z=L.source;if(typeof z.x!="number"||z.type==="bpmn:Participant")continue;const j=Qr(z);(D===void 0||j>D)&&(D=j)}return D},$h=(b,A)=>{const M=p(b.flow.source);if(M)return M.type==="bpmn:Participant"?jN(M.id,A):Qr(M)},fE=b=>{let A;for(const M of Ws.get(b)??[]){const D=$h(M,b);D!==void 0&&(!A||D>A.cx)&&(A={op:M,cx:D})}return A==null?void 0:A.op},HN=b=>{const A=fE(b),M=p(b),D=A?$h(A,b):void 0;return M&&D!==void 0?D-Qr(M):void 0},zN=b=>{const A=HN(b);return A!==void 0&&Math.abs(A)<Bh},Fh=(b,A,M,D,$)=>{var L;for(let z=!0;z;){z=!1;for(const j of x){if(j.flow.id===M)continue;const N=A.has(j.flow.source),q=A.has(j.flow.target);if(N===q||D(N?j.flow.source:j.flow.target))continue;const Y=N?j.flow.target:j.flow.source;if($(Y)||!Mo(Y))continue;const re=p(j.flow.id);if(!(re!=null&&re.waypoints)||re.waypoints.length!==2)continue;const Q=p(Y),fe=(L=T.get(Y))==null?void 0:L.node.participant;if(!Q||!fe)continue;const ye=Co(Y,Re=>Re.x>=Q.x).filter(Re=>!A.has(Re.id));if(!(!ye.length||ye.some(Re=>$(Re.id)))){for(const Re of ye)A.add(Re.id);b.set(fe,[...b.get(fe)??[],...ye]),z=!0}}}return[...b].map(([z,j])=>({subtree:j,pool:f(z)}))},dE=(b,A,M,D,$)=>Fh(new Map([[A,[...b]]]),new Set(b.map(L=>L.id)),D,L=>L===M,L=>L===$),jh=b=>{const A=fE(b);if(!A)return null;const M=p(b),D=p(A.flow.source),$=$h(A,b);if(!M||!D||$===void 0)return null;const L=$-Qr(M);if(L>=Bh){const z=T.get(b).node.participant,j=Co(b,N=>N.x>=M.x);return{groups:dE(j,z,b,A.flow.id,A.flow.source),dx:L}}if(-L>=Bh&&Mo(A.flow.source)){const z=T.get(A.flow.source).node.participant,j=Co(A.flow.source,N=>N.x>=D.x&&!zN(N.id));return{groups:dE(j,z,A.flow.source,A.flow.id,b),dx:-L}}return null},hE=()=>Fu.map(b=>({id:b,plan:jh(b)})).filter(b=>!!b.plan).sort((b,A)=>Math.min(...b.plan.groups.flatMap(M=>M.subtree.map(D=>D.x)))-Math.min(...A.plan.groups.flatMap(M=>M.subtree.map(D=>D.x)))).map(b=>b.id);for(let b=0;b<3;b++){const A=Zr(),M=[];for(const $ of hE()){const L=jh($);if(!L)continue;const z=Vs(L.groups,L.dx);z&&M.push(z)}if(!M.length)break;if(!Oa(A,Zr()))continue;for(const $ of M.reverse())$();let D=!1;for(const $ of hE()){const L=jh($);L&&Ao(L.groups,L.dx,()=>!0,Oa)&&(D=!0)}if(!D)break}for(const b of Fu){if(Nh.has(b))continue;const A=T.get(b);if(!A||A.node.lane!==void 0)continue;const M=K(A);if(M===void 0)continue;const D=p(b),$=D?d(D):void 0;if(!D||!$)continue;const L=$.y+J+S(`pool:${A.node.participant??""}`,M)*O,z=L-(D.y+D.height/2);z!==0&&!rt($,D,D.x+D.width/2,L)&&n.moveElements([D],{x:0,y:z})}for(const b of Fu.flatMap(A=>Ws.get(A)??[])){if(!Nu(b.flow.id))continue;const A=p(b.flow.target);if(!A)continue;const M=f(T.get(b.flow.target).node.participant),D=Co(b.flow.target,j=>j.x>=A.x),$=A.width+F,L=ka(b.flow.id),z=$u(b.flow.id);for(let j=1;j<=lE;j++){const N=()=>ka(b.flow.id)<L&&$u(b.flow.id)>=z;if($N(D,M,$*j,N))break}}const Hh=x.map(b=>({id:b.flow.id,source:b.flow.source,target:b.flow.target,preexisting:!1})),mE=new Set(Hh.map(b=>b.id));for(const b of o.filter(A=>A.type==="bpmn:MessageFlow"))mE.has(b.id)||!b.source||!b.target||b.source.type==="bpmn:Participant"!=(b.target.type==="bpmn:Participant")&&Hh.push({id:b.id,source:b.source.id,target:b.target.id,preexisting:!0});for(const b of Hh){if(!Nu(b.id))continue;const A=p(b.source),M=p(b.target);if(!A||!M)continue;let D,$,L;if(b.preexisting){const[j,N]=A.type==="bpmn:Participant"?[M,A]:[A,M];if(D=Qr(j),D<N.x||D>N.x+N.width)continue;[$,L]=j.y<N.y?[j.y+j.height,N.y]:[N.y+N.height,j.y]}else{if(A.type==="bpmn:Participant"||M.type==="bpmn:Participant"||(D=A.x+A.width/2,Math.abs(D-(M.x+M.width/2))>15))continue;[$,L]=A.y<M.y?[A.y+A.height,M.y]:[M.y+M.height,A.y]}const z=[...T.values()].map(j=>p(j.node.id)).filter(j=>!!j&&j.id!==A.id&&j.id!==M.id).filter(j=>j.x<=D&&D<=j.x+j.width&&j.y+j.height>$&&j.y<L).sort((j,N)=>j.x-N.x);for(const j of z){const N=(AE=T.get(j.id))==null?void 0:AE.node.participant,q=N?p(N):void 0;if(!N||!q)continue;const Y=[...T.values()].filter(le=>le.node.participant===N).map(le=>le.node.id),re=le=>le.map(se=>p(se)).filter(se=>!!se),fe=[ON(j.id,le=>{var se;return((se=T.get(le.id))==null?void 0:se.node.participant)===N}),re(Y)].filter(le=>le.length).map(le=>[{subtree:le,pool:q}]);if(b.preexisting){const le=re(Y);le.length&&fe.push(Fh(new Map([[N,[...le]]]),new Set(le.map(se=>se.id)),b.id,()=>!1,se=>se===A.id||se===M.id))}const ye=j.width+F,Re=ka(b.id),lt=$u(b.id),Ae=()=>ka(b.id)<Re&&$u(b.id)>=lt;let ne=!1;for(const le of fe){for(let se=1;se<=lE;se++)if(Ao(le,ye*se,Ae)){ne=!0;break}if(ne)break}if(!Nu(b.id))break}}const ju=()=>{var A;const b=new Set;for(const M of mt(Xe(o)))M.kind!=="edge-crosses-shape"||mE.has(M.edge)||((A=p(M.edge))==null?void 0:A.type)==="bpmn:MessageFlow"&&b.add(`${M.edge}>${M.shape}`);return b},GN=(b,A)=>Zr().bad>=b&&[...ju()].some(M=>!A.has(M)),gE=b=>{var A,M;return ka(b)===0&&((M=(A=p(b))==null?void 0:A.waypoints)==null?void 0:M.length)===2},VN=(b,A,M)=>{const D=new Set(b.flatMap(L=>L.subtree.map(z=>z.id))),$=[...ju()].filter(L=>!M.has(L)).map(L=>L.split(">")[1]);return[...new Set($)].filter(L=>D.has(L)&&L!==A.source&&L!==A.target)},WN=(b,A,M,D,$)=>{const L=b.map(q=>({...q,subtree:q.subtree.filter(Y=>!$.includes(Y.id))})).filter(q=>q.subtree.length),z=new Set(L.flatMap(q=>q.subtree.map(Y=>Y.id))),j=()=>$.every(q=>{const Y=p(q);return!!Y&&R.filter(re=>re.flow.target===q&&z.has(re.flow.source)).every(re=>{const Q=p(re.flow.source);return!!Q&&Q.x+Q.width<=Y.x})});return Ao(L,A,()=>gE(M.id)&&[...ju()].every(q=>D.has(q))&&j(),Oa,!0)};for(const b of x){if(!Nu(b.flow.id))continue;const A=p(b.flow.id);if(((ME=A==null?void 0:A.waypoints)==null?void 0:ME.length)!==2)continue;const M=p(b.flow.source),D=p(b.flow.target);if(!M||!D||M.type==="bpmn:Participant"||D.type==="bpmn:Participant"||!Mo(b.flow.source)||!Mo(b.flow.target)||Math.abs(Qr(M)-Qr(D))>IN)continue;const $=Qr(M),L=A.waypoints.map(Re=>Re.y),[z,j]=[Math.min(...L),Math.max(...L)],N=ai(Xe(o)).filter(Re=>Re.id!==M.id&&Re.id!==D.id&&Re.x<$&&$<Re.x+Re.width&&z<Re.y+Re.height&&Re.y<j);if(!N.length)continue;const q=(PE=T.get(b.flow.source))==null?void 0:PE.node.participant,Y=(TE=T.get(b.flow.target))==null?void 0:TE.node.participant;if(!q||!Y)continue;const re=new Map;for(const[Re,lt,Ae]of[[b.flow.source,M,q],[b.flow.target,D,Y]]){const ne=re.get(Ae)??[],le=Co(Re,se=>se.x>=lt.x).filter(se=>!ne.some(ge=>ge.id===se.id));re.set(Ae,[...ne,...le])}const Q=new Set([...re.values()].flat().map(Re=>Re.id)),fe=Fh(re,Q,b.flow.id,Re=>Re===b.flow.source||Re===b.flow.target,()=>!1),ye=Math.max(...N.map(Re=>Re.x+Re.width));for(const Re of BN){const lt=ye+Re-$;if(lt<=0)continue;const Ae=Zr().bad,ne=ju();let le=[],se=!0;const ge=()=>!gE(b.flow.id)||se&&(le=VN(fe,b.flow,ne),le.length)?!1:!GN(Ae,ne);if(Ao(fe,lt,ge,Oa))break;if(le.length&&(WN(fe,lt,b.flow,ne,le)||(se=!1,Ao(fe,lt,ge,Oa))))break}}{const b=M=>M.y+M.height/2,A=[];for(const M of T.keys()){if(!Mo(M))continue;const D=R.filter(z=>z.flow.target===M);if(D.length!==1)continue;const $=p(D[0].flow.source),L=p(M);!$||!L||!T.has($.id)||Math.abs(b($)-b(L))>1||L.x-($.x+$.width)<=F+1||A.push({id:M,pred:$,node:L})}A.sort((M,D)=>M.node.x-D.node.x);for(const{id:M}of A){const D=T.get(M),$=p(M),L=p(R.find(Q=>Q.flow.target===M).flow.source);if(!$||!L)continue;const z=$.x-(L.x+L.width);if(z<=F+1)continue;const j=f(D.node.participant),N=Co(M,Q=>Q.x>=$.x),q=Zr(),Y=NN(N,j,-(z-F));if(!Y)continue;const re=Zr();(re.bad>q.bad||re.crossings>=q.crossings||re.straight<q.straight)&&Y()}}cE(!0);const UN=10,qN=400,YN=b=>[...b.incoming??[],...b.outgoing??[]].filter(A=>A.type==="bpmn:DataInputAssociation"||A.type==="bpmn:DataOutputAssociation").map(A=>A.source===b?A.target:A.source).filter(A=>!!A&&typeof A.y=="number"),KN=o.filter(b=>b.type==="bpmn:DataStoreReference"&&g.has(b.id)),XN=(b,A)=>{const M=b.x+b.width/2,D=b.y+b.height/2;let $;for(const L of KN){if((d(L)??u())!==A||L.y<b.y+b.height)continue;const z=Math.abs(L.x+L.width/2-M);z>qN||z<L.width||!YN(L).some(N=>N.height===b.height&&Math.abs(N.y+N.height/2-D)<=UN&&L.y>=N.y+N.height)||(!$||z<$.dx||z===$.dx&&L.id<$.id)&&($={dx:z,id:L.id,cy:L.y+L.height/2})}return $==null?void 0:$.cy};for(const b of m){const A=b.associations??[],M=A.map(L=>L.source===b.dataStore.id?L.target:L.source).map(p).find(Boolean),D=M?d(M)??u():u(),$=M?{x:M.x+M.width/2,y:XN(M,D)??M.y+M.height+110}:{x:200,y:wt+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:b.dataStore.id,name:b.dataStore.name})},$,D);for(const L of A)aE(b.dataStore.id,L)}for(const b of v){const M=f(b.association.target).type==="bpmn:DataStoreReference"?b.association.target:b.association.source;aE(M,b.association)}let yE=0;const Po=10,vE=40,ZN=(b,A)=>{const M=A.map(N=>d(N)).filter(N=>!!N);for(const N of M){const q=Po,Y=N.y,re=N.y+N.height,Q=N.x,fe=N.x+N.width;if(Math.abs(b.y-Y)<q){const ye=Y+q-b.y;b.y+=ye,b.height-=ye}if(Math.abs(b.y+b.height-re)<q&&(b.height=re-q-b.y),Math.abs(b.x-Q)<q){const ye=Q+q-b.x;b.x+=ye,b.width-=ye}Math.abs(b.x+b.width-fe)<q&&(b.width=fe-q-b.x)}if(!M.length)return;const D=Math.min(...M.map(N=>N.y)),$=Math.max(...M.map(N=>N.y+N.height)),L=D-b.y,z=b.y+b.height-$,j=vE-Po;if(L>0!=z>0)if(L>0&&L<j){const N=L+Po;b.y+=N,b.height-=N}else z>0&&z<j&&(b.height-=z+Po)},QN=(b,A)=>{const M=Po,D=30,$=o.filter(L=>L.type==="bpmn:Group"&&L.id!==A);for(const L of $){const z=L.x,j=L.x+L.width,N=L.y,q=L.y+L.height,Y=b.y<q&&N<b.y+b.height,re=b.x<j&&z<b.x+b.width;if(Y){if(Math.abs(b.x-j)<M){const Q=Math.min(j+M-b.x,D);Q>0&&b.width-Q>0&&(b.x+=Q,b.width-=Q)}if(Math.abs(b.x+b.width-z)<M){const Q=Math.min(b.x+b.width-(z-M),D);Q>0&&b.width-Q>0&&(b.width-=Q)}}if(re){if(Math.abs(b.y-q)<M){const Q=Math.min(q+M-b.y,D);Q>0&&b.height-Q>0&&(b.y+=Q,b.height-=Q)}if(Math.abs(b.y+b.height-N)<M){const Q=Math.min(b.y+b.height-(N-M),D);Q>0&&b.height-Q>0&&(b.height-=Q)}}}},zh=(b,A)=>{const M=vE,D=Math.min(...b.map(N=>N.x))-M,$=Math.min(...b.map(N=>N.y))-M,L=Math.max(...b.map(N=>N.x+N.width))+M,z=Math.max(...b.map(N=>N.y+N.height))+M,j={x:D,y:$,width:L-D,height:z-$};return ZN(j,b),QN(j,A),j};for(const b of E){const A=(b.group.members??[]).map(p).filter($=>!!$);let M;A.length?M=zh(A,b.group.id):(M={x:300+yE*350,y:40,width:300,height:200},yE++);const D=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:b.group.id}),width:M.width,height:M.height},{x:M.x+M.width/2,y:M.y+M.height/2},u());b.group.name&&n.updateLabel(D,b.group.name),(kE=b.group.members)!=null&&kE.length&&k(D,"bwl:Members",{refs:b.group.members.join(" ")})}{const b=o.filter($=>!!$.waypoints),A=new Map,M=($,L)=>{!$||!L||(A.has($)||A.set($,new Set),A.get($).add(L))};for(const $ of b){const L=(OE=$.source)==null?void 0:OE.id,z=(DE=$.target)==null?void 0:DE.id;M(L,z),((LE=$.type)!=null&&LE.includes("DataOutputAssociation")||(IE=$.type)!=null&&IE.includes("DataInputAssociation")||$.type==="bpmn:Association")&&M(z,L)}const D=o.filter($=>$.type==="bpmn:Group");for(const $ of D){const z=(((BE=$.businessObject.extensionElements)==null?void 0:BE.values)??[]).find(Ae=>Ae.$type==="bwl:Members"),j=((z==null?void 0:z.refs)??"").split(" ").filter(Boolean);if(!j.length)continue;const N=new Set(j),q=[...j];for(;q.length;){const Ae=q.shift();for(const ne of A.get(Ae)??[])N.has(ne)||(N.add(ne),q.push(ne))}const Y=$.x,re=$.x+$.width,Q=$.y,fe=$.y+$.height,ye=Ae=>R.filter(ne=>ne.flow.target===Ae).length,Re=Ae=>{var le;const ne=((le=p(Ae))==null?void 0:le.type)??"";if(ne==="bpmn:StartEvent"&&ye(Ae)===0)return!1;if(ne.endsWith("Gateway")){const se=R.filter(ge=>ge.flow.target===Ae).map(ge=>ge.flow.source);if(se.length&&se.every(ge=>{var Ve;return((Ve=p(ge))==null?void 0:Ve.type)==="bpmn:StartEvent"&&ye(ge)===0}))return!1}return!0},lt=o.filter(Ae=>gr(Ae)).filter(Ae=>Ae.type!=="bpmn:Group"&&Ae.type!=="bpmn:Participant"&&Ae.type!=="bpmn:TextAnnotation"&&!N.has(Ae.id)&&Mo(Ae.id)&&Re(Ae.id)&&Ae.x<re&&Ae.x+Ae.width>Y&&Ae.y<fe&&Ae.y+Ae.height>Q);if(lt.length)for(const Ae of[-1,1]){const ne=lt.filter(be=>(be.x+be.width-Y<=re-be.x?-1:1)===Ae);if(!ne.length)continue;const le=[];for(const be of ne){const oe=le.find(me=>me.some(Le=>be.y<Le.y+Le.height&&be.y+be.height>Le.y));oe?oe.push(be):le.push([be])}const se=new Map;for(const be of le){let oe=Ae<0?Y-Po:re+Po;for(const me of[...be].sort((Le,Ye)=>Ae<0?Ye.x-Le.x:Le.x-Ye.x)){const Le=Ae<0?Math.min(me.x,oe-me.width):Math.max(me.x,oe);oe=Ae<0?Le-Zi:Le+me.width+Zi,Le!==me.x&&Math.sign(Le-me.x)===Ae&&se.set(me.id,Le-me.x)}}const ge=new Map,Ve=be=>ge.get(be)===be||!ge.get(be)?be:Ve(ge.get(be));for(const be of ne)ge.set(be.id,be.id);for(const be of x){const oe=se.has(be.flow.source)?be.flow.source:void 0,me=se.has(be.flow.target)?be.flow.target:void 0;if(!oe||!me)continue;const Le=p(be.flow.id);((NE=Le==null?void 0:Le.waypoints)==null?void 0:NE.length)===2&&ge.set(Ve(oe),Ve(me))}const We=new Map;for(const be of ne){if(!se.has(be.id))continue;const oe=Ve(be.id);We.set(oe,[...We.get(oe)??[],be])}const Rt=[...We.values()].sort((be,oe)=>Ae<0?Math.min(...be.map(me=>me.x))-Math.min(...oe.map(me=>me.x)):Math.max(...oe.map(me=>me.x))-Math.max(...be.map(me=>me.x))),Nt=[];let ve=!0;for(const be of Rt){const oe=be.map(Ye=>se.get(Ye.id)??0).reduce((Ye,ke)=>Math.abs(ke)>Math.abs(Ye)?ke:Ye,0),me=new Map;let Le=!0;for(const Ye of be){const ke=d(Ye);if(!ke){Le=!1;break}me.has(ke.id)||me.set(ke.id,{subtree:[],pool:ke}),me.get(ke.id).subtree.push(Ye)}Le&&Ao([...me.values()],oe,()=>!0,Oa)?Nt.push({shapes:be,dx:oe}):ve=!1}if(!ve)for(const be of Nt.reverse())n.moveElements(be.shapes,{x:-be.dx,y:0})}}}{const b=new Set([...E.map(A=>A.group.id),...Qt(e,"group.update").map(A=>A.id)]);for(const A of o.filter(M=>M.type==="bpmn:Group")){if(b.has(A.id))continue;const D=((($E=A.businessObject.extensionElements)==null?void 0:$E.values)??[]).find(j=>j.$type==="bwl:Members"),$=((D==null?void 0:D.refs)??"").split(" ").filter(Boolean).map(p).filter(j=>!!j);!$.length||!$.some(j=>{const N=g.get(j.id);return!N||N.x!==j.x||N.y!==j.y})||!$.some(j=>j.x<A.x||j.y<A.y||j.x+j.width>A.x+A.width||j.y+j.height>A.y+A.height)||n.resizeShape(A,zh($,A.id))}}{const A=new Map(ao(Xe(o)).map(j=>[j.owner,j.rect])),M=o.filter(j=>!!j.waypoints),D=new Map,$=(j,N)=>{!j||!N||(D.has(j)||D.set(j,new Set),D.get(j).add(N))};for(const j of M){const N=(FE=j.source)==null?void 0:FE.id,q=(jE=j.target)==null?void 0:jE.id;$(N,q),((HE=j.type)!=null&&HE.includes("DataOutputAssociation")||(zE=j.type)!=null&&zE.includes("DataInputAssociation")||j.type==="bpmn:Association")&&$(q,N)}const L=j=>R.filter(N=>N.flow.target===j).length,z=j=>{var q;const N=((q=p(j))==null?void 0:q.type)??"";if(N==="bpmn:StartEvent"&&L(j)===0)return!1;if(N.endsWith("Gateway")){const Y=R.filter(re=>re.flow.target===j).map(re=>re.flow.source);if(Y.length&&Y.every(re=>{var Q;return((Q=p(re))==null?void 0:Q.type)==="bpmn:StartEvent"&&L(re)===0}))return!1}return!0};for(const j of o.filter(N=>N.type==="bpmn:Group")){const q=(((GE=j.businessObject.extensionElements)==null?void 0:GE.values)??[]).find(oe=>oe.$type==="bwl:Members"),Y=((q==null?void 0:q.refs)??"").split(" ").filter(Boolean);if(!Y.length)continue;const re=Y.map(p).filter(oe=>!!oe);if(!re.length||!(E.some(oe=>oe.group.id===j.id)||Qt(e,"group.update").some(oe=>oe.id===j.id)||re.some(oe=>{const me=g.get(oe.id);return!me||me.x!==oe.x||me.y!==oe.y})))continue;const fe=new Set(Y),ye=[...Y];for(;ye.length;){const oe=ye.shift();for(const me of D.get(oe)??[])fe.has(me)||(fe.add(me),ye.push(me))}const Re=j.x,lt=j.x+j.width,Ae=j.y,ne=j.y+j.height,le=oe=>{const me=A.get(oe.id),Le={x:oe.x,y:oe.y,width:oe.width,height:oe.height};return me?[Le,{x:me.x,y:me.y,width:me.width,height:me.height}]:[Le]},se=re.flatMap(le),ge=Math.min(...se.map(oe=>oe.x)),Ve=Math.max(...se.map(oe=>oe.x+oe.width)),We=Math.min(...se.map(oe=>oe.y)),Rt=Math.max(...se.map(oe=>oe.y+oe.height)),Nt={L:ge-Re,R:lt-Ve,T:We-Ae,B:ne-Rt},ve=o.filter(oe=>gr(oe)).filter(oe=>oe.type!=="bpmn:Group"&&oe.type!=="bpmn:Participant"&&oe.type!=="bpmn:TextAnnotation"&&!fe.has(oe.id)&&z(oe.id)&&oe.x<lt&&oe.x+oe.width>Re&&oe.y<ne&&oe.y+oe.height>Ae);if(!ve.length)continue;const be={L:0,R:0,T:0,B:0};for(const oe of ve){const me=le(oe),Le=Math.min(...me.map(Me=>Me.x)),Ye=Math.max(...me.map(Me=>Me.x+Me.width)),ke=Math.min(...me.map(Me=>Me.y)),He=Math.max(...me.map(Me=>Me.y+Me.height)),Qe={L:Ye-Re,R:lt-Le,T:He-Ae,B:ne-ke},_e=["L","R","T","B"].filter(Me=>Qe[Me]<=Nt[Me]+.001);if(!_e.length)continue;const ot=_e.reduce((Me,Et)=>Qe[Et]<Qe[Me]?Et:Me,_e[0]);be[ot]=Math.max(be[ot],Math.min(Qe[ot]+10,Nt[ot]))}!be.L&&!be.R&&!be.T&&!be.B||n.resizeShape(j,{x:j.x+be.L,y:j.y+be.T,width:j.width-be.L-be.R,height:j.height-be.T-be.B})}}const bE=b=>{const A=b.waypoints;if(A!=null&&A.length){const D=A[Math.floor((A.length-1)/2)];return{x:D.x,y:D.y,width:0,height:0}}const M=b;return{x:M.x,y:M.y,width:M.width,height:M.height}};let Us=0;const xE=12,_E=14,JN=15,e$=300,t$=b=>{const A=b.split(`
7
+ `),M=Math.max(...A.map(L=>zo(L,xE))),D=Math.max(100,Math.min(e$,Math.ceil(M)+_E)),$=A.reduce((L,z)=>L+Math.max(1,Math.ceil((zo(z,xE)+_E)/D)),0);return{width:D,height:Math.max(30,$*JN+10)}};for(const b of _){const A=b.association,M=((VE=b.placement)==null?void 0:VE.anchor)??(A?A.source===b.annotation.id?A.target:A.source:void 0),D=M?p(M):void 0,$=D?bE(D):void 0,L=t$(b.annotation.text??"");let z;if($&&b.placement){const[Y,re]=Sc[b.placement.side],Q=b.placement.offset??50;z={x:$.x+$.width/2+Y*($.width/2+L.width/2+Q),y:$.y+$.height/2+re*($.height/2+L.height/2+Q)}}else $?(z={x:$.x+$.width/2+180+Us%3*260,y:$.y-110-Us%2*95},Us++):(z={x:300+Us*260,y:60},Us++);const j=D?d(D)??u():u(),N=j;$&&typeof N.x=="number"&&typeof N.width=="number"&&N.type==="bpmn:Participant"&&(z=Dp(o,$,L,N,b.placement?{placement:b.placement}:{from:z}));const q=n.createShape({type:"bpmn:TextAnnotation",width:L.width,height:L.height,businessObject:i.create("bpmn:TextAnnotation",{id:b.annotation.id,text:b.annotation.text})},z,j);if(A){const Y=re=>re===b.annotation.id?q:f(re);n.connect(Y(A.source),Y(A.target),A.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:A.id})}:{type:"bpmn:Association"})}b.placement&&k(q,"bwl:Placement",I(b.placement))}for(const b of Qt(e,"association.add")){const A=b.association;n.connect(f(A.source),f(A.target),A.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:A.id})}:{type:"bpmn:Association"})}const wE=()=>new Set(o.getAll().filter(b=>b.type!=="label").map(b=>b.id));for(const b of Qt(e,"node.update")){let A=f(b.id);if(b.type&&Ec(b.type)!==A.type){const M=A.x+A.width/2,D=A.y+A.height/2,$=wE();A=c.replaceElement(A,{type:Ec(b.type),...b.eventDefinition?{eventDefinitionType:Qs[b.eventDefinition]}:{}});const L=wE(),z=[...$].filter(q=>q!==b.id&&!L.has(q));if(z.length)throw new Rg({kind:"type-change-drops-elements",opIndex:e.indexOf(b),id:b.id,type:b.type,dropped:z});const j=Math.round(M-(A.x+A.width/2)),N=Math.round(D-(A.y+A.height/2));if(j!==0||N!==0){n.moveShape(A,{x:j,y:N});for(const q of[...A.incoming??[],...A.outgoing??[]])Pa(q)}}if(b.name!==void 0&&n.updateProperties(A,{name:b.name??void 0}),b.lane||b.band!==void 0){b.band!==void 0&&n.updateProperties(A,{"bwl:band":b.band});const M=A.y+A.height/2,D=d(A),$=b.lane?f(b.lane):((D==null?void 0:D.children)??[]).find(z=>z.type==="bpmn:Lane"&&M>=z.y&&M<=z.y+z.height);b.band!==void 0&&ht($==null?void 0:$.id,b.band,D);const L=$?$.y+(b.band===void 0?$.height/2:Math.min($.height/2,he)+S($.id,b.band)*O):b.band!==void 0&&D?D.y+J+S(`pool:${D.id}`,b.band)*O:void 0;if(L!==void 0){const z=L-M;z!==0&&n.moveElements([A],{x:0,y:z})}}}for(const b of Qt(e,"sequenceFlow.update")){const A=f(b.id);if(b.source!==void 0||b.target!==void 0){const M=A,D=b.source!==void 0?f(b.source):M.source,$=b.target!==void 0?f(b.target):M.target,L=N=>({x:N.x+N.width/2,y:N.y+N.height/2});n.reconnect(M,D,$,[L(D),L($)]);const z=oE.get(M.id),j=$.y+$.height/2;if(z&&$.x>z.exit.x&&Math.abs(j-z.exit.y)>1){n.updateWaypoints(M,[z.exit,{x:z.exit.x,y:j},{x:$.x,y:j}]);const N=M.label;if(N&&z.label){const Y=Math.abs(z.label.y+N.height/2-z.channelY)<=O/5&&z.label.x+N.width>z.exit.x,re=z.exit.x+6,Q=$.x-6-N.width,fe=Y?Q>=re?{x:Math.max(re,Math.min(z.label.x,Q)),y:z.label.y+(j-z.channelY)}:void 0:z.label;fe&&(fe.x!==N.x||fe.y!==N.y)&&n.moveElements([N],{x:fe.x-N.x,y:fe.y-N.y})}}else Math.abs(j-(D.y+D.height/2))>1&&Pa(M)}b.name!==void 0&&n.updateProperties(A,{name:b.name??void 0}),b.condition!==void 0&&n.updateProperties(A,{name:((WE=b.condition)==null?void 0:WE.label)??void 0})}for(const b of Qt(e,"messageFlow.update"))b.name!==void 0&&n.updateProperties(f(b.id),{name:b.name??void 0});for(const b of Qt(e,"dataStore.update"))b.name!==void 0&&n.updateProperties(f(b.id),{name:b.name??void 0});for(const b of Qt(e,"annotation.update")){const A=f(b.id);if(b.text!==void 0&&n.updateProperties(A,{text:b.text}),b.placement===null)k(A,"bwl:Placement",null);else if(b.placement){const M=f(b.placement.anchor),D=bE(M),$=d(M)??u(),L=typeof $.x=="number"&&typeof $.width=="number"&&$.type==="bpmn:Participant",[z,j]=Sc[b.placement.side],N=b.placement.offset??50,q={x:D.x+D.width/2+z*(D.width/2+A.width/2+N),y:D.y+D.height/2+j*(D.height/2+A.height/2+N)},Y=L?Dp(o,D,{width:A.width,height:A.height},$,{placement:b.placement,selfId:b.id}):q;n.moveElements([A],{x:Y.x-(A.x+A.width/2),y:Y.y-(A.y+A.height/2)}),k(A,"bwl:Placement",I(b.placement))}}for(const b of Qt(e,"group.update")){const A=f(b.id);if(b.name!==void 0&&n.updateLabel(A,b.name??""),b.members){const M=b.members.map(p).filter(D=>!!D);M.length&&n.resizeShape(A,zh(M,b.id)),k(A,"bwl:Members",{refs:b.members.join(" ")})}}}function Lp(e){switch(e.kind){case"annotation-over-label":return[e.annotation];case"edge-crosses-shape":return[e.shape];case"shape-outside-container":return[e.shape];case"shape-overlap":return e.shapes;default:return[]}}function VR(e,t,n){var u,p;const{elementRegistry:i}=e,r=e.modeling,o=f=>mt(f).filter(d=>!t.has(ft(d))),a=f=>{var d;return((d=i.get(f))==null?void 0:d.type)==="bpmn:TextAnnotation"},s=Xe(i),c=o(s),l=[...new Set(c.flatMap(Lp))].filter(f=>n.has(f)&&a(f));if(l.length)for(const f of l){const d=i.get(f);if(!d||typeof d.x!="number"||typeof d.width!="number")continue;let g=d.parent,h;for(;g;){if(g.type==="bpmn:Participant"){h=g;break}g=g.parent}if(!h){const he=d.x+d.width/2,Pe=d.y+d.height/2;h=i.getAll().find(De=>{if(De.type!=="bpmn:Participant")return!1;const Ke=De;return typeof Ke.x=="number"&&typeof Ke.width=="number"&&he>=Ke.x&&he<=Ke.x+Ke.width&&Pe>=Ke.y&&Pe<=Ke.y+Ke.height})}if(!h||typeof h.x!="number"||typeof h.width!="number")continue;const R=(((u=d.businessObject.extensionElements)==null?void 0:u.values)??[]).find(he=>he.$type==="bwl:Placement"),x=[...d.incoming??[],...d.outgoing??[]].find(he=>he.type==="bpmn:Association"),m=(R!=null&&R.anchor?i.get(R.anchor):void 0)??(x?((p=x.source)==null?void 0:p.id)===f?x.target:x.source:void 0);if(!m)continue;const v=m.waypoints,_=v!=null&&v.length?{x:v[Math.floor((v.length-1)/2)].x,y:v[Math.floor((v.length-1)/2)].y,width:0,height:0}:{x:m.x,y:m.y,width:m.width,height:m.height},E={width:d.width,height:d.height},T={x:d.x+d.width/2,y:d.y+d.height/2},k=R==null?void 0:R.side,I=[];k&&k in Sc&&I.push(Dp(i,_,E,h,{placement:{side:k,offset:(R==null?void 0:R.offset)??null},selfId:f}));for(const[he,Pe]of[[-1,0],[1,0],[0,-1],[0,1]])for(let De=1;De<=GR;De++)I.push({x:T.x+he*Sg*De,y:T.y+Pe*Sg*De});const P={...s,edges:s.edges.filter(he=>he.id!==(x==null?void 0:x.id))},O=o(P),F=O.filter(he=>Lp(he).includes(f)).length;if(!F)continue;let J;for(const he of I){const Pe=he.x-T.x,De=he.y-T.y;if(!Pe&&!De||he.x-E.width/2<h.x||he.x+E.width/2>h.x+h.width||he.y-E.height/2<h.y||he.y+E.height/2>h.y+h.height)continue;const Ke={...P,shapes:P.shapes.map(te=>te.id===f?{...te,x:te.x+Pe,y:te.y+De}:te)},rt=o(Ke),Ce=rt.filter(te=>Lp(te).includes(f)).length;if(Ce>=F||rt.length>O.length)continue;const X=Math.abs(Pe)+Math.abs(De);if((!J||Ce<J.mine||Ce===J.mine&&(rt.length<J.all||rt.length===J.all&&X<J.dist))&&(J={x:he.x,y:he.y,mine:Ce,all:rt.length,dist:X}),J.mine===0&&J.all<O.length)break}J&&r.moveElements([d],{x:J.x-T.x,y:J.y-T.y})}}const WR=60;function Ip(e,t,n,i){const r=t.x+t.width,o=[],a=c=>{for(const l of c.children??[])l.type==="bpmn:Lane"&&(o.push(l),a(l))};a(t),e.resizeShape(t,{x:t.x,y:t.y,width:n,height:t.height},void 0,i);const s=t.x+n;for(const c of o)Math.abs(c.x+c.width-r)<1&&e.resizeShape(c,{x:c.x,y:c.y,width:s-c.x,height:c.height},void 0,i)}function UR(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=u=>mt(u).filter(p=>!t.has(ft(p))),a=u=>u.filter(p=>p.kind==="pool-overlap"),s=new Map(n.shapes.map(u=>[u.id,u])),c=(u,p)=>p.x>=u.x&&p.y>=u.y&&p.x+p.width<=u.x+u.width&&p.y+p.height<=u.y+u.height,l=u=>{if(!s.get(u))return[u];const f=new Set,d=new Set([u]);for(let h=0;h<4;h++){let y=!1;for(const R of n.shapes)R.type!=="bpmn:Group"||f.has(R.id)||[...d].some(x=>{const m=s.get(x);return m&&c(R,m)})&&(f.add(R.id),y=!0);for(const R of n.shapes)R.type!=="bpmn:Participant"||d.has(R.id)||[...f].some(x=>{const m=s.get(x);return m&&c(m,R)})&&(d.add(R.id),y=!0);if(!y)break}const g=n.shapes.filter(h=>!h.parent&&!d.has(h.id)&&!f.has(h.id)&&h.type!=="bpmn:Group"&&h.type!=="bpmn:Participant").filter(h=>[...f].some(y=>{const R=s.get(y);return R&&c(R,h)})).map(h=>h.id);return[...d,...f,...g]};for(let u=0;u<6;u++){const p=Xe(i),f=o(p),d=a(f);if(!d.length)return;const g=new Map(p.shapes.map(v=>[v.id,v]));let h=null;for(const v of d){if(v.kind!=="pool-overlap")continue;const[_,E]=v.pools,T=g.get(_),k=g.get(E);if(!T||!k)continue;const[I,P]=T.x<=k.x?[T,k]:[k,T];if(v.contained)continue;const O=s.get(I.id),F=s.get(P.id),J=O&&F?Math.max(F.x-(O.x+O.width),0):WR,he=I.x+I.width+J-P.x;if(he<=0)continue;const Pe=l(P.id).filter(De=>i.get(De));Pe.length&&(!h||he>h.dx)&&(h={movers:Pe,dx:he})}if(!h)return;const y=h.movers.map(v=>i.get(v)).filter(v=>!!v&&typeof v.x=="number");if(!y.length)return;const R=f.length,x=d.length;r.moveElements(y,{x:h.dx,y:0});const m=o(Xe(i));if(!(a(m).length<x&&m.length<=R)){r.moveElements(y,{x:-h.dx,y:0});return}}}const Rc=.5,Ag=150;function qR(e,t){const{elementRegistry:n}=e,i=e.modeling,r=t.shapes.filter(m=>m.type==="bpmn:Participant");if(r.length<2)return;const o=r.map(m=>m.x+m.width),a=Math.max(...o);if(a-Math.min(...o)>Rc)return;const s=r.map(m=>n.get(m.id)).filter(m=>!!m&&typeof m.x=="number");if(s.length<2)return;const c=new Map(r.map(m=>[m.id,m.x]));if(s.some(m=>Math.abs(m.x-c.get(m.id))>Rc))return;const l=s.map(m=>m.x+m.width);if(Math.max(...l)-Math.min(...l)<=Rc)return;const u=m=>m.x+m.width,p=m=>!!m&&typeof m.width=="number",f=m=>{const v={shapes:[],edges:[],lanes:[]},_=E=>{for(const T of E.children??[]){if("waypoints"in T&&T.waypoints){v.edges.push(T);continue}T.type!=="label"&&(T.type==="bpmn:Lane"?v.lanes.push(T):v.shapes.push(T),_(T))}};return _(m),v},d=new Map(s.map(m=>[m.id,f(m)]));let g=a;for(const m of s){const{shapes:v}=d.get(m.id),_=v.flatMap(E=>[u(E),...p(E.label)?[u(E.label)]:[]]);_.length&&(g=Math.max(g,Math.max(..._)+Ag))}const h=s.filter(m=>Math.abs(u(m)-g)>Rc);if(!h.length)return;for(const m of h){const v=u(m),{shapes:_,edges:E,lanes:T}=d.get(m.id);if([..._.flatMap(P=>[u(P),...p(P.label)?[u(P.label)]:[]]),...E.flatMap(P=>[...P.waypoints.map(O=>O.x),...p(P.label)?[u(P.label)]:[]])].some(P=>P>g)||[...(m.incoming??[]).map(P=>P.waypoints[P.waypoints.length-1]),...(m.outgoing??[]).map(P=>P.waypoints[0])].some(P=>!P||P.x>g||Math.abs(P.x-v)<1))return;if(g>v){const P={x:v,y:m.y,width:g-v,height:m.height},O=new Set([m.id,..._.map(J=>J.id),...E.map(J=>J.id),...T.map(J=>J.id)]);if(n.getAll().some(J=>{var De;if("waypoints"in J&&J.waypoints||J.type==="bpmn:Group"||!p(J))return!1;const he=J.type==="label"?(De=J.labelTarget)==null?void 0:De.id:J.id;if(!he||O.has(he)||O.has(J.id))return!1;const Pe=J;return Pe.x<P.x+P.width&&Pe.x+Pe.width>P.x&&Pe.y<P.y+P.height&&Pe.y+Pe.height>P.y}))return}}const y=()=>new Set(mt(Xe(n)).map(ft)),R=y(),x=h.map(m=>m.width);for(const m of h)Ip(i,m,g-m.x,{layout:!1});[...y()].every(m=>R.has(m))||h.forEach((m,v)=>Ip(i,m,x[v],{layout:!1}))}function YR(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=l=>mt(l).filter(u=>!t.has(ft(u))),a=(l,u)=>u.x>=l.x&&u.y>=l.y&&u.x+u.width<=l.x+l.width&&u.y+u.height<=l.y+l.height,s=l=>({l:Math.min(...l.map(u=>u.x)),t:Math.min(...l.map(u=>u.y)),r:Math.max(...l.map(u=>u.x+u.width)),b:Math.max(...l.map(u=>u.y+u.height))}),c=n.shapes.filter(l=>{var u;return l.type==="bpmn:Group"&&!((u=l.members)!=null&&u.length)});if(c.length)for(const l of c){const u=i.get(l.id);if(!u||typeof u.x!="number")continue;const p=n.shapes.filter(E=>E.id!==l.id&&E.type!=="bpmn:Group"&&a(l,E));if(!p.length)continue;const f=p.map(E=>i.get(E.id)).filter(E=>!!E&&typeof E.x=="number");if(f.length!==p.length)continue;const d=s(p),g=s(f),h=g.l+(l.x-d.l),y=g.t+(l.y-d.t),R=g.r+(l.x+l.width-d.r),x=g.b+(l.y+l.height-d.b),m={x:h,y,width:R-h,height:x-y};if(m.width<=0||m.height<=0||Math.abs(m.x-u.x)<1&&Math.abs(m.y-u.y)<1&&Math.abs(m.width-u.width)<1&&Math.abs(m.height-u.height)<1)continue;const v=o(Xe(i)).length,_={x:u.x,y:u.y,width:u.width,height:u.height};r.resizeShape(u,m),o(Xe(i)).length>v&&r.resizeShape(u,_)}}const Cc=20,Ac=10;function KR(e,t,n,i){var p,f;const{elementRegistry:r}=e,o=e.modeling,a=d=>new Set(mt(d,{includeObservationOnly:!0}).filter(g=>g.kind==="edge-along-group-boundary").map(ft)),s=Xe(r),c=mt(s,{includeObservationOnly:!0}).filter(d=>d.kind==="edge-along-group-boundary"&&!t.has(ft(d)));if(!c.length)return;const l=new Map(n.shapes.map(d=>[d.id,d])),u=new Map;for(const d of c)u.set(d.group,[...u.get(d.group)??[],d]);for(const[d,g]of u){const h=s.shapes.find(Te=>Te.id===d);if(!((p=h==null?void 0:h.members)!=null&&p.length))continue;const y=l.get(d);if(!(!y||Math.abs(y.x-h.x)>=.5||Math.abs(y.y-h.y)>=.5||Math.abs(y.width-h.width)>=.5||Math.abs(y.height-h.height)>=.5))continue;const x=h.members.map(Te=>r.get(Te)).filter(Te=>!!Te&&typeof Te.x=="number");if(!x.length)continue;const m=Math.min(...x.map(Te=>Te.x)),v=Math.min(...x.map(Te=>Te.y)),_=Math.max(...x.map(Te=>Te.x+Te.width)),E=Math.max(...x.map(Te=>Te.y+Te.height)),T=h.x,k=h.y,I=h.x+h.width,P=h.y+h.height;let O=T,F=k,J=I,he=P;for(const Te of g){const B=s.edges.find(w=>w.id===Te.edge);if(!B)continue;const S=B.endpoints.some(w=>{const G=s.shapes.find(Se=>Se.id===w);if(!G||G.container)return!1;const V=G.x+G.width/2,ee=G.y+G.height/2;return T<V&&V<I&&k<ee&&ee<P});for(const w of mn(B)){const G=w.axis==="v"?[k,P]:[T,I];Math.min(w.hi,G[1])-Math.max(w.lo,G[0])<bp||(w.axis==="v"?T<w.at&&w.at<I:k<w.at&&w.at<P)&&S||(w.axis==="v"?(Math.abs(w.at-T)<=Go&&(O=Math.max(O,w.at+Cc)),Math.abs(w.at-I)<=Go&&(J=Math.min(J,w.at-Cc))):(Math.abs(w.at-k)<=Go&&(F=Math.max(F,w.at+Cc)),Math.abs(w.at-P)<=Go&&(he=Math.min(he,w.at-Cc))))}}if(O>m-Ac&&(O=T),F>v-Ac&&(F=k),J<_+Ac&&(J=I),he<E+Ac&&(he=P),O===T&&F===k&&J===I&&he===P)continue;const Pe=r.get(d),De={x:Pe.x,y:Pe.y,width:Pe.width,height:Pe.height},Ke=Xe(r),rt=new Set(mt(Ke).map(ft)),Ce=a(Ke);o.resizeShape(Pe,{x:O,y:F,width:J-O,height:he-F});let X=Xe(r),te=mt(X).filter(Te=>!rt.has(ft(Te)));const U=[];if(te.length>0&&te.every(Te=>Te.kind==="label-over-line"&&!i.has(Te.edge)&&X.edges.some(B=>B.id===Te.edge))){for(const Te of te){if(Te.kind!=="label-over-line")continue;const B=X.edges.find(ee=>ee.id===Te.edge),S=B&&kp(B,X),w=(f=r.get(Te.edge))==null?void 0:f.label;if(!S||!w)continue;const G=S.x-w.x,V=S.y-w.y;o.moveElements([w],{x:G,y:V}),U.push({label:w,dx:G,dy:V})}X=Xe(r),te=mt(X).filter(Te=>!rt.has(ft(Te)))}const ie=a(X),pe=[...ie].some(Te=>!Ce.has(Te));if(te.length||pe||ie.size>=Ce.size){for(const Te of U.reverse())o.moveElements([Te.label],{x:-Te.dx,y:-Te.dy});o.resizeShape(Pe,De)}}}function XR(e,t,n,i){var c;const r=n.getRootElement().businessObject,o=Qu((r==null?void 0:r.$parent)??r),a=La(i),s=new Map;for(const l of e.keys()){const u=(c=t.get(l))==null?void 0:c.businessObject;s.set(l,u?{texts:Ju(u,i,o),requests:ip(u)}:{texts:{},requests:[]})}return{contexts:()=>[...e].flatMap(([l,u])=>{const p=t.get(l);return p?[{element:p,...u.texts!==void 0?{texts:u.texts}:{},...u.confirm?{confirm:u.confirm}:{},designLocale:i.designLocale,locales:a,...o?{rootLang:o}:{},before:s.get(l)}]:[]})}}function Mg(e,t,n={}){var I,P;const{i18n:i,lower:r=Cg}=n,o=wg(e),a=Wm(o.elementRegistry),s=_g(t,a,{i18n:i}),c={edgeCrossings:{before:0,after:0,pairs:[],solidPairs:0,dashedPairs:0,mixedPairs:0,crossPoolMessages:0}};if(s.length)return{ok:!1,issues:s,findings:[],stats:c};const l=$R(t,a,i),u=i&&l.writes.size?XR(l.writes,o.elementRegistry,o.canvas,i):void 0,p=Xe(o.elementRegistry),f=new Set(mt(p).map(ft)),d=new Set(mt(p,{includeObservationOnly:!0}).map(ft)),g=new Set(p.edges.map(O=>O.id)),h=new Set(t.flatMap(O=>O.kind==="sequenceFlow.update"&&(O.source!==void 0||O.target!==void 0)?[O.id]:[])),y=new Set(p.shapes.map(O=>O.id)),R=gc(p),x=R.length,m=new Set(R.map(([O,F])=>`${O}|${F}`)),v=new Map;for(const O of o.elementRegistry.filter(F=>"waypoints"in F&&!!F.waypoints))O.label&&v.set(O.id,{wps:O.waypoints.map(F=>({x:F.x,y:F.y})),label:{x:O.label.x,y:O.label.y},source:(I=O.source)==null?void 0:I.id,target:(P=O.target)==null?void 0:P.id});const _=e.get("commandStack");try{Xh(_,()=>{r(l.ops,o);for(const F of(u==null?void 0:u.contexts())??[])_.execute(tp,F);UR(o,f,p),qR(o,p),YR(o,f,p),Qm(o,g);const O=Ap(o,f);Km(o,m,g),cg(o,f,g),tg(o,g),AR(o,g,h),rg(o,f,g),kR(o,f,g),hg(o,f,g),dg(o,g,h),gg(o,y),VR(o,f,y),Ap(o,f,O),KR(o,d,p,g),yg(o,f),fg(o,v)})}catch(O){return{ok:!1,issues:[O instanceof Rg?O.issue:{kind:"lower-failed",message:O instanceof Error?O.message:String(O)}],findings:[],stats:c}}const E=Xe(o.elementRegistry),T=mt(E,{includeObservationOnly:!0}).filter(O=>!d.has(ft(O))),k=Im(E);return{ok:!0,issues:[],findings:T,stats:{edgeCrossings:{before:x,after:k.pairs.length,pairs:k.pairs,solidPairs:k.solidPairs,dashedPairs:k.dashedPairs,mixedPairs:k.mixedPairs,crossPoolMessages:k.crossPoolMessages}}}}function ZR(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function Pg(e,t){return typeof e.get=="function"?e.get(t):e[t]}function Tg(e,t){const n=Pg(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function kg(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(r=>(r==null?void 0:r.$type)===t)}function QR(e){return typeof e=="string"&&qu.includes(e)}function Pi(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function Og(e,t={}){const n=e.rootElements??[],i=n.find(X=>X.$type==="bpmn:Collaboration"),r=new Map(n.filter(X=>X.$type==="bpmn:Process").map(X=>[X.id,X])),o=[],a=[],s=[],c=[],l=[],u=[],p={poolOrders:{},bands:{},placements:{},afterColumns:{}},f=[],d=[],g=[],h=[],y=[],R=[],x=[],m=new Map,v=new Set,_=new Set,E=X=>{X&&v.add(X)},T=X=>{v.add(X),_.add(X)},k=X=>{const te=kg(X,"bwl:Placement");if(!te)return;const U=typeof te.anchor=="string"?te.anchor:void 0;if(!U||!QR(te.side))return;const K=typeof te.offset=="number"?te.offset:void 0;y.push({owner:X.id,anchor:U,side:te.side,...K!==void 0?{offset:K}:{}})},I=X=>{const te=kg(X,"bwl:Members"),U=typeof(te==null?void 0:te.refs)=="string"?te.refs.split(/\s+/).filter(Boolean):[];U.length&&x.push({owner:X.id,refs:U})},P=X=>{var te;for(const U of X)switch(E(U.id),U.$type){case"bpmn:TextAnnotation":T(U.id),m.set(U.id,U),c.push({id:U.id,text:typeof U.text=="string"?U.text:""}),k(U);break;case"bpmn:Association":g.push({id:U.id,type:U.$type,source:Pi(U.sourceRef),target:Pi(U.targetRef)});break;case"bpmn:Group":{T(U.id),m.set(U.id,U);const K=(te=U.categoryValueRef)==null?void 0:te.value;l.push({id:U.id,...typeof K=="string"&&K?{name:K}:{}}),I(U);break}default:u.push({id:U.id,type:U.$type,reason:"type-outside-mvp"})}},O=X=>{for(const te of X.flowElements??[])E(te.id),u.push({id:te.id,type:te.$type,reason:"inside-container"}),(te.flowElements??[]).length&&O(te);for(const te of X.artifacts??[])E(te.id),u.push({id:te.id,type:te.$type,reason:"inside-container"})},F=(X,te)=>{const U=X.flowElements??[],K=(X.laneSets??[]).flatMap(pe=>pe.lanes??[]),ie=new Map;for(const pe of K){E(pe.id),m.set(pe.id,pe);for(const Te of pe.flowNodeRef??[]){const B=Pi(Te);B&&ie.set(B,pe.id)}}for(const pe of U){if(E(pe.id),m.set(pe.id,pe),pe.$type==="bpmn:SequenceFlow"){f.push({id:pe.id,source:Pi(pe.sourceRef),target:Pi(pe.targetRef),...typeof pe.name=="string"&&pe.name?{name:pe.name}:{}});continue}if(pe.$type==="bpmn:DataStoreReference"){T(pe.id),s.push({id:pe.id,...pe.name?{name:pe.name}:{}});continue}const Te=ZR(pe.$type),B=Te==="intermediateCatchEvent"?Wu((pe.eventDefinitions??[]).map(V=>V.$type)):void 0;if(!Vh(Te)||Te==="intermediateCatchEvent"&&!B){u.push({id:pe.id,type:pe.$type,reason:"type-outside-mvp"});continue}T(pe.id);const S=Te==="boundaryEvent"?Pi(pe.attachedToRef):void 0;a.push({id:pe.id,type:Te,...pe.name?{name:pe.name}:{},...te?{participant:te}:{},...ie.has(pe.id)?{lane:ie.get(pe.id)}:{},...S?{attachedTo:S}:{},...B?{eventDefinition:B}:{}}),Te==="subProcess"&&O(pe);const w=Tg(pe,"bwl:band");w!==void 0&&(p.bands[pe.id]=w);const G=Pg(pe,"bwl:afterColumn");typeof G=="string"&&G!==""&&R.push([pe.id,G]);for(const V of pe.dataOutputAssociations??[])E(V.id),h.push({id:V.id,type:V.$type,source:pe.id,target:Pi(V.targetRef)});for(const V of pe.dataInputAssociations??[])E(V.id),h.push({id:V.id,type:V.$type,source:Pi((V.sourceRef??[])[0]),target:pe.id})}P(X.artifacts??[])};if(i){const X=new Set;for(const te of i.participants??[]){T(te.id),m.set(te.id,te);const U=Pi(te.processRef);U&&X.add(U);const K=U?r.get(U):void 0,ie=((K==null?void 0:K.laneSets)??[]).flatMap(S=>S.lanes??[]),pe=ie.map(S=>({id:S.id,...S.name?{name:S.name}:{}}));for(const S of pe)T(S.id);const Te=!K||(K.flowElements??[]).length===0&&ie.length===0&&(K.artifacts??[]).length===0;o.push({id:te.id,...te.name?{name:te.name}:{},...Te?{blackBox:!0}:{},...pe.length?{lanes:pe}:{}});const B=Tg(te,"bwl:poolOrder");B!==void 0&&(p.poolOrders[te.id]=B),K&&F(K,te.id)}for(const te of i.messageFlows??[])E(te.id),m.set(te.id,te),d.push({id:te.id,source:Pi(te.sourceRef),target:Pi(te.targetRef),...typeof te.name=="string"&&te.name?{name:te.name}:{}});P(i.artifacts??[]);for(const[te,U]of r)!X.has(te)&&(U.flowElements??[]).length>0&&u.push({id:te,type:U.$type,reason:"unreachable-process"})}else for(const X of r.values())F(X);const J=[],he=[],Pe=[],De=[],Ke=(X,te)=>!!X&&!!te&&_.has(X)&&_.has(te);for(const X of f){if(!Ke(X.source,X.target)){u.push({id:X.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}J.push({id:X.id,source:X.source,target:X.target,...X.name?{name:X.name}:{}}),_.add(X.id)}for(const X of d){if(!Ke(X.source,X.target)){u.push({id:X.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}he.push({id:X.id,source:X.source,target:X.target,...X.name?{name:X.name}:{}}),_.add(X.id)}for(const X of h){if(!Ke(X.source,X.target)){u.push({id:X.id??"",type:X.type,reason:"endpoint-outside-mvp"});continue}De.push({...X.id?{id:X.id}:{},source:X.source,target:X.target}),X.id&&_.add(X.id)}for(const X of g){if(!Ke(X.source,X.target)){u.push({id:X.id??"",type:X.type,reason:"endpoint-outside-mvp"});continue}Pe.push({...X.id?{id:X.id}:{},source:X.source,target:X.target})}const rt=new Map(l.map(X=>[X.id,X]));for(const{owner:X,refs:te}of x){const U=te.filter(ie=>v.has(ie)),K=rt.get(X);K&&U.length&&(K.members=U)}for(const X of y)v.has(X.anchor)&&(p.placements[X.owner]={anchor:X.anchor,side:X.side,...X.offset!==void 0?{offset:X.offset}:{}});for(const[X,te]of R)v.has(te)&&(p.afterColumns[X]=te);const Ce={...o.length?{participants:o}:{},nodes:a,sequenceFlows:J,...he.length?{messageFlows:he}:{},...s.length?{dataStores:s}:{},...De.length?{dataAssociations:De}:{},...c.length?{annotations:c}:{},...Pe.length?{associations:Pe}:{},...l.length?{groups:l}:{}};return t.i18n?{definition:Ce,hints:p,omitted:u,i18n:JR(Ce,m,e,t.i18n)}:{definition:Ce,hints:p,omitted:u}}function JR(e,t,n,i){const r=Qu(n),o=La(i),a=[],s=(c,l)=>{const u=t.get(c.id);if(!u)return;const p=Ju(u,i,r);Object.keys(p).length&&(c[l]=p);for(const f of ip(u))o.includes(f.locale)&&a.push({id:c.id,...f})};for(const c of e.participants??[]){s(c,"names");for(const l of c.lanes??[])s(l,"names")}for(const c of[e.nodes,e.sequenceFlows,e.messageFlows,e.dataStores,e.groups])for(const l of c??[])s(l,"names");for(const c of e.annotations??[])s(c,"texts");return{designLocale:i.designLocale,companionLocales:o.slice(1),reviewRequests:a}}async function eC(e,t={}){const{definitions:n,warnings:i}=await jo(e);return{...Og(n,t),warnings:i}}const tC=new Set(["bpmn:ExclusiveGateway","bpmn:ParallelGateway","bpmn:InclusiveGateway","bpmn:EventBasedGateway","bpmn:ComplexGateway"]);function Bp(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function nC(e){return Bp(e.processRef)!==void 0}function iC(e){const t=new Set,n=r=>{const o=Bp(r);o&&t.add(o)},i=r=>{for(const o of r.flowElements??[]){n(o.sourceRef),n(o.targetRef),o.attachedToRef&&(n(o.attachedToRef),t.add(o.id));for(const a of o.dataOutputAssociations??[])t.add(o.id),n(a.targetRef);for(const a of o.dataInputAssociations??[]){t.add(o.id);for(const s of a.sourceRef??[])n(s)}(o.flowElements??[]).length&&i(o)}for(const o of r.artifacts??[])n(o.sourceRef),n(o.targetRef)};for(const r of e.rootElements??[])if(r.$type==="bpmn:Process")i(r);else if(r.$type==="bpmn:Collaboration"){for(const o of r.messageFlows??[])n(o.sourceRef),n(o.targetRef);for(const o of r.artifacts??[])n(o.sourceRef),n(o.targetRef)}return t}function rC(e){const t=[],n=i=>{for(const r of i.flowElements??[])tC.has(r.$type)&&t.push(r),(r.flowElements??[]).length&&n(r)};for(const i of e.rootElements??[])i.$type==="bpmn:Process"&&n(i);return t}function oC(e){if(!e)return!0;const t=(e.laneSets??[]).flatMap(n=>n.lanes??[]);return(e.flowElements??[]).length===0&&t.length===0&&(e.artifacts??[]).length===0}function Np(e){const t=[],n=e.rootElements??[],i=iC(e);for(const o of rC(e))i.has(o.id)||t.push({ruleId:"CHK-FLOW-1",severity:"warning",targetKind:"flowNode",targetRefs:[o.id],params:{type:o.$type}});const r=n.find(o=>o.$type==="bpmn:Collaboration");if(r){const o=new Map(n.filter(s=>s.$type==="bpmn:Process").map(s=>[s.id,s])),a=[];for(const s of r.participants??[])nC(s)&&oC(o.get(Bp(s.processRef)))&&a.push(s.id);a.length&&t.push({ruleId:"CHK-POOL-1",severity:"info",targetKind:"participant",targetRefs:a,params:{count:a.length}})}return t}async function aC(e){const{definitions:t,warnings:n}=await jo(e);return{issues:Np(t),warnings:n}}const sC=.5,cC=8,lC=new Set(["bpmn:Definitions","bpmn:Collaboration","bpmn:Process","bpmn:LaneSet","bpmn:ExtensionElements","bpmn:Documentation","bpmn:Relationship","bpmn:Property","bpmn:Category","bpmn:CategoryValue"]),Ko=e=>typeof e=="number"?e:Number(e??NaN),Mc=e=>{if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:""};function uC(e){const t=e,n=[],i=typeof t.name=="string"?t.name:typeof t.text=="string"?t.text:"";n.push(`n=${i.replace(/\s+/g," ").trim()}`);for(const o of["sourceRef","targetRef","attachedToRef","processRef","default"])t[o]!==void 0&&n.push(`${o}=${Mc(t[o])}`);if(String(e.$type)==="bpmn:Group"){const o=t.categoryValueRef,a=Array.isArray(o)?o:o==null?[]:[o];n.push(`cat=[${a.map(s=>`${Mc(s)}:${typeof(s==null?void 0:s.value)=="string"?s.value:""}`).sort().join(",")}]`)}Array.isArray(t.flowNodeRef)&&n.push(`lane=[${t.flowNodeRef.map(Mc).sort().join(",")}]`);const r=t.conditionExpression;return r&&typeof r.body=="string"&&n.push(`cond=${r.body}`),n.join("|")}function pC(e){const t=new Map,n=new Map,i=(a,s)=>{a&&t.set(a,[...t.get(a)??[],...s])},r=a=>{const s=a;return s?[Ko(s.x),Ko(s.y),Ko(s.width),Ko(s.height)]:[]},o=a=>{if(Array.isArray(a))return a.forEach(o);if(!a||typeof a!="object")return;const s=a,c=String(s.$type??"");if(c==="bpmndi:BPMNShape"||c==="bpmndi:BPMNEdge"){const l=Mc(s.bpmnElement);if(c==="bpmndi:BPMNShape")i(l,r(s.bounds));else{const p=Array.isArray(s.waypoint)?s.waypoint:[];i(l,p.flatMap(f=>[Ko(f.x),Ko(f.y)]))}const u=s.label;u!=null&&u.bounds&&l&&n.set(l,r(u.bounds).slice(0,2));return}for(const l of Object.values(s))(Array.isArray(l)||l&&typeof l=="object"&&"$type"in l)&&o(l)};return o(e.diagrams),{body:t,labels:n}}function Dg(e){const t=pC(e),n=new Map,i=new Set,r=o=>{if(Array.isArray(o))return o.forEach(r);if(!o||typeof o!="object"||i.has(o))return;i.add(o);const a=o,s=String(a.$type??"");if(s.startsWith("bpmndi:")||s.startsWith("dc:")||s.startsWith("di:"))return;const c=typeof a.id=="string"?a.id:"";c&&s.startsWith("bpmn:")&&!lC.has(s)&&n.set(c,{type:s,props:uC(a),geometry:(t.body.get(c)??[]).join(","),label:(t.labels.get(c)??[]).join(",")});for(const l of Object.values(a))(Array.isArray(l)||l&&typeof l=="object")&&r(l)};return r(e),n}function Lg(e,t,n){if(e===t)return!1;const i=e===""?[]:e.split(",").map(Number),r=t===""?[]:t.split(",").map(Number);return i.length!==r.length?!0:i.some((o,a)=>Math.abs(o-r[a])>n)}function Ig(e,t,n={}){const i=n.moveTolerance??sC,r=Dg(e),o=Dg(t),a=[],s=[],c=[];for(const[l,u]of o){const p=r.get(l);if(!p){a.push(l);continue}(p.type!==u.type||p.props!==u.props||Lg(p.geometry,u.geometry,i)||Lg(p.label,u.label,n.labelTolerance??cC))&&c.push(l)}for(const l of r.keys())o.has(l)||s.push(l);return{added:a.sort(),removed:s.sort(),modified:c.sort()}}async function fC(e,t,n={}){const[i,r]=await Promise.all([jo(e),jo(t)]);return{...Ig(i.definitions,r.definitions,n),warnings:[...i.warnings,...r.warnings]}}function dC(e){return new Set([...e.added,...e.modified])}function hC(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function Bg(e,t,{currentVersion:n,i18n:i}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const r=Mg(e,t.ops,{i18n:i});if(!r.ok)return{status:"rejected",issues:r.issues};const{xml:o}=await e.saveXML({format:!0});return{status:"applied",version:n+1,xml:o??"",findings:r.findings,stats:r.stats}}const mC=Symbol("bpmn-editor"),$p={geometry:[],semantic:[]};function gC(){const e=de.ref(!1),t=de.ref(!0),n=de.ref(!1),i=de.shallowRef($p),r=de.shallowRef(void 0),o=de.shallowRef(void 0);let a,s,c,l;const u=()=>{if(f(),!c){i.value=$p;return}const x=mt(Xe(c.get("elementRegistry")),{includeObservationOnly:!0}),m=c.getDefinitions();i.value={geometry:x,semantic:m?Np(m):[]}};function p(){return(c==null?void 0:c.get("i18nDisplay",!1))??void 0}function f(){const x=p();if(!x||!a){o.value=void 0;return}const m=x.locales(),v={};for(const _ of m)v[_]={untranslated:x.untranslatedCount(_),reviewRequested:x.reviewRequestedCount(_)};o.value={designLocale:a.designLocale,locales:m,displayLocale:x.getDisplayLocale()??a.designLocale,counts:v}}function d(){const x=p();x&&(x.configure(a),a&&s&&(s=x.setDisplayLocale(s)))}const g=()=>{e.value=!0,u()};function h(x,m){x.get("canvas").getContainer().style.pointerEvents=m?"":"none";const v=x.get("keyboard");m?(l&&v.bind(l),l=void 0):l||(l=v.getBinding(),v.unbind())}function y(){if(!c)throw new Error("modeler not attached — 뷰 @ready 후 attach() 필요");return c}function R(){return c==null?void 0:c.get("commandStack")}return{dirty:e,editable:t,agentBusy:n,issues:i,revalidate:u,changeScope:r,i18n:o,configureI18n(x){a=x,d(),f()},setDisplayLocale(x){var v;s=x;const m=(v=p())==null?void 0:v.setDisplayLocale(x);m&&(s=m),f()},setChangeScope(x){r.value=x===void 0?void 0:new Set(x)},requestFocus(x){if(!c)return;const m=c.get("elementRegistry").get(x);m&&(c.get("canvas").scrollToElement(m,180),c.get("selection").select(m))},describeElement(x){const m=c==null?void 0:c.get("elementRegistry").get(x),v=m==null?void 0:m.businessObject;if(!v)return;const _=typeof v.name=="string"&&v.name.trim()!==""?v.name:v.text;return{name:typeof _=="string"&&_.trim()!==""?_.trim():void 0,type:typeof v.$type=="string"?v.$type:""}},attach(x){c&&this.detach(),c=x,c.get("eventBus").on("commandStack.changed",g),t.value||h(c,!1),d(),u()},detach(){c==null||c.get("eventBus").off("commandStack.changed",g),c&&!t.value&&h(c,!0),l=void 0,c=void 0,i.value=$p,r.value=void 0,o.value=void 0},setEditable(x){t.value=x,c&&h(c,x)},async applyAgentBatch(x,m){const v=y();n.value=!0;try{const _=await Bg(v,x,{currentVersion:m,...a?{i18n:{designLocale:a.designLocale,companionLocales:a.companionLocales}}:{}});return _.status==="applied"&&(e.value=!1),_}finally{n.value=!1}},async importXml(x){const{warnings:m}=await y().importXML(x);return e.value=!1,r.value=void 0,u(),{warnings:vp(m)}},async saveXml(){const{xml:x}=await y().saveXML({format:!0});return e.value=!1,x??""},undo:()=>{var x;return(x=R())==null?void 0:x.undo()},redo:()=>{var x;return(x=R())==null?void 0:x.redo()},canUndo:()=>{var x;return((x=R())==null?void 0:x.canUndo())??!1},canRedo:()=>{var x;return((x=R())==null?void 0:x.canRedo())??!1}}}const yC=new RegExp("\\p{Script=Hangul}","u"),vC=/[\p{Script=Hiragana}\p{Script=Katakana}]/u,bC=new RegExp("\\p{Script=Han}","u");function Fp(e){const t=yC.test(e),n=vC.test(e);return t&&n?{script:"mixed"}:t?{script:"hangul",locale:"ko"}:n?{script:"kana",locale:"ja"}:{script:bC.test(e)?"han":"other"}}function Ng(e){var t,n;return((t=e==null?void 0:e.get)==null?void 0:t.call(e,"xml:lang"))??((n=e==null?void 0:e.$attrs)==null?void 0:n["xml:lang"])}function $g(e){var i;const t=new Set,n=[];for(const r of(e==null?void 0:e.diagrams)??[])for(const o of((i=r==null?void 0:r.plane)==null?void 0:i.planeElement)??[]){const a=o==null?void 0:o.bpmnElement;if(!a||t.has(a))continue;t.add(a);const s=no(a);if(!s)continue;const c=s.target[s.key]??"";c&&n.push({bo:a,name:c,trs:No(a).filter(l=>Tn(l))})}return n}const za=e=>({id:e.bo.id,type:e.bo.$type,name:e.name});function xC(e){const t=Ng(e),n=$g(e);let i;const r={},o=[],a=[],s=[];for(const g of n){const h=g.trs.filter(y=>(y.body??"")===g.name).map(Tn);if(h.length){const y=[...h].sort().join("+");r[y]=(r[y]??0)+1,i=i?new Set([...i].filter(R=>h.includes(R))):new Set(h)}else g.trs.some(y=>y.body)?o.push(za(g)):s.push({e:g,inference:Fp(g.name)});for(const y of g.trs){const R=Tn(y),x=y.body??"",m=Fp(x);m.locale&&m.locale!==R?a.push({...za(g),locale:R,script:m.script}):R==="ko"&&m.script==="han"&&g.trs.some(v=>v!==y&&v.body===x)&&a.push({...za(g),locale:R,script:"han"})}}const c=new Set(s.map(g=>g.inference.locale).filter(Boolean));let l,u;if(t)u="kept";else if(i&&i.size===1)[l,u]=[[...i][0],"matched"];else if(i&&i.size>1){const g=c.size===1?[...c][0]:void 0;g&&i.has(g)?[l,u]=[g,"matched"]:u="ambiguous"}else i?u="mixed":c.size===1?[l,u]=[[...c][0],"script"]:u=c.size>1?"mixed":"no-evidence";const p=t??l,f=[],d=[];for(const{e:g,inference:h}of s)h.locale?h.locale!==p&&f.push({...za(g),locale:h.locale}):d.push({...za(g),script:h.script});return{root:{current:t,proposed:l,reason:u},additions:f,undecided:d,drift:o,matchedBy:r,scriptMismatch:a}}function _C(e,t){const n=e.$model;let i=0;if(t.root.proposed&&!Ng(e)&&(e.set("xml:lang",t.root.proposed),i++),!t.additions.length)return i;const r=new Map($g(e).map(o=>[o.bo.id,o]));for(const{id:o,name:a,locale:s}of t.additions){const c=r.get(o);if(!c||c.name!==a||c.trs.some(f=>f.body))continue;const l=c.trs.find(f=>Tn(f)===s);if(l){l.body=c.name,i++;continue}let u=c.bo.extensionElements;u||(u=n.create("bpmn:ExtensionElements",{values:[]}),u.$parent=c.bo,c.bo.extensionElements=u);const p=n.create(Bo,{body:c.name});p.set("xml:lang",s),p.$parent=u,u.get("values").push(p),i++}return i}function we(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function wC(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var jp={exports:{}},Fg;function EC(){if(Fg)return jp.exports;Fg=1;var e=jp.exports=function(t,n){if(n||(n=16),t===void 0&&(t=128),t<=0)return"0";for(var i=Math.log(Math.pow(2,t))/Math.log(n),r=2;i===1/0;r*=2)i=Math.log(Math.pow(2,t/r))/Math.log(n)*r;for(var o=i-Math.floor(i),a="",r=0;r<Math.floor(i);r++){var s=Math.floor(Math.random()*n).toString(n);a=s+a}if(o){var c=Math.pow(n,o),s=Math.floor(Math.random()*c).toString(n);a=s+a}var l=parseInt(a,n);return l!==1/0&&l>=Math.pow(2,t)?e(t,n):a};return e.rack=function(t,n,i){var r=function(a){var s=0;do{if(s++>10)if(i)t+=i;else throw new Error("too many ID collisions, use more bits");var c=e(t,n)}while(Object.hasOwnProperty.call(o,c));return o[c]=a,c},o=r.hats={};return r.get=function(a){return r.hats[a]},r.set=function(a,s){return r.hats[a]=s,r},r.bits=t||128,r.base=n||16,r},jp.exports}var SC=EC(),RC=wC(SC);function $i(e){if(!(this instanceof $i))return new $i(e);e=e||[128,36,1],this._seed=e.length?RC.rack(e[0],e[1],e[2]):e}$i.prototype.next=function(e){return this._seed(e||!0)},$i.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},$i.prototype.claim=function(e,t){this._seed.set(e,t||!0)},$i.prototype.assigned=function(e){return this._seed.get(e)||!1},$i.prototype.unclaim=function(e){delete this._seed.hats[e]},$i.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const sn={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};sn.td=sn.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],sn.option=sn.optgroup=[1,'<select multiple="multiple">',"</select>"],sn.thead=sn.tbody=sn.colgroup=sn.caption=sn.tfoot=[1,"<table>","</table>"],sn.polyline=sn.ellipse=sn.polygon=sn.circle=sn.text=sn.line=sn.path=sn.rect=sn.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function Ot(e,t=globalThis.document){var l;if(typeof e!="string")throw new TypeError("String expected");const n=/^<!--(.*?)-->$/s.exec(e);if(n)return t.createComment(n[1]);const i=(l=/<([\w:]+)/.exec(e))==null?void 0:l[1];if(!i)return t.createTextNode(e);if(e=e.trim(),i==="body"){const u=t.createElement("html");u.innerHTML=e;const{lastChild:p}=u;return p.remove(),p}let[r,o,a]=Object.hasOwn(sn,i)?sn[i]:sn._default,s=t.createElement("div");for(s.innerHTML=o+e+a;r--;)s=s.lastChild;if(s.firstChild===s.lastChild){const{firstChild:u}=s;return u.remove(),u}const c=t.createDocumentFragment();return c.append(...s.childNodes),c}function CC(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 Bn(e,...t){const n=e.style;return H(t,function(i){i&&H(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 AC=Object.prototype.toString;function Bt(e){return new Er(e)}function Er(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Er.prototype.add=function(e){return this.list.add(e),this},Er.prototype.remove=function(e){return AC.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Er.prototype.removeMatching=function(e){const t=this.array();for(let n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},Er.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Er.prototype.array=function(){return Array.from(this.list)},Er.prototype.has=Er.prototype.contains=function(e){return this.list.contains(e)};function Pc(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function so(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function MC(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Tc={},jg;function PC(){if(jg)return Tc;jg=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return Tc.bind=function(r,o,a,s){return e||i(),r[e](n+o,a,s||!1),a},Tc.unbind=function(r,o,a,s){return t||i(),r[t](n+o,a,s||!1),a},Tc}var Hg=PC(),TC=MC(Hg),Ge=CC({__proto__:null,default:TC},[Hg]),zg=["focus","blur"];function kC(e,t,n,i,r){return zg.indexOf(n)!==-1&&(r=!0),Ge.bind(e,n,function(o){var a=o.target||o.srcElement;o.delegateTarget=so(a,t,!0),o.delegateTarget&&i.call(e,o)},r)}function OC(e,t,n,i){return zg.indexOf(t)!==-1&&(i=!0),Ge.unbind(e,t,n,i)}var qn={bind:kC,unbind:OC};function Hp(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function St(e,t){return t=t||document,t.querySelector(e)}function kc(e,t){return t=t||document,t.querySelectorAll(e)}function Fi(e){e.parentNode&&e.parentNode.removeChild(e)}function DC(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function LC(e,t){return t.appendChild(DC(e,t))}function Ue(e,t){return LC(t,e),e}var zp=2,Gg={"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":zp,"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":zp,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function IC(e,t){return Gg[t]?e.style[t]:e.getAttributeNS(null,t)}function Vg(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=Gg[i];r?(r===zp&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function BC(e,t){var n=Object.keys(t),i,r;for(i=0,r;r=n[i];i++)Vg(e,r,t[r])}function Ee(e,t,n){if(typeof t=="string")if(n!==void 0)Vg(e,t,n);else return IC(e,t);else BC(e,t);return e}const NC=Object.prototype.toString;function ct(e){return new Sr(e)}function Sr(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Sr.prototype.add=function(e){return this.list.add(e),this},Sr.prototype.remove=function(e){return NC.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Sr.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},Sr.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Sr.prototype.array=function(){return Array.from(this.list)},Sr.prototype.has=Sr.prototype.contains=function(e){return this.list.contains(e)};function Oc(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Wg(e){return e.cloneNode(!0)}var Gp={svg:"http://www.w3.org/2000/svg"},Ug='<svg xmlns="'+Gp.svg+'"';function $C(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(Gp.svg)===-1&&(e=Ug+e.substring(4)):(e=Ug+">"+e+"</svg>",t=!0);var n=FC(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function FC(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function Oe(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=$C(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(Gp.svg,e),t&&Ee(n,t),n}var Vp=null;function qg(){return Vp===null&&(Vp=Oe("svg")),Vp}function Yg(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function jC(e,t,n,i,r,o){var a=qg().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return Yg(a,e);case 6:return Yg(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}function Ga(e){return qg().createSVGTransform()}var Kg=/([&<>]{1})/g,HC=/([&<>\n\r"]{1})/g,zC={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"'"};function Wp(e,t){function n(i,r){return zC[r]||r}return e.replace(t,n)}function Xg(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(Wp(e.textContent,Kg));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,'="',Wp(o.value,HC),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)Xg(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",Wp(e.nodeValue,Kg),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function GC(e){for(var t=e.firstChild,n=[];t;)Xg(t,n),t=t.nextSibling;return n.join("")}function Zg(e,t){return GC(e)}function cn(e){var t=e.parentNode;return t&&t.removeChild(e),e}function VC(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function WC(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(VC(e,i))}function Va(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),WC(n,t)),n.consolidate()}const UC=/^class[ {]/;function qC(e){return UC.test(e.toString())}function Up(e){return Array.isArray(e)}function qp(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Dc(...e){e.length===1&&Up(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const YC=/constructor\s*[^(]*\(\s*([^)]*)\)/m,KC=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,XC=/\/\*([^*]*)\*\//m;function ZC(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(qC(e)?YC:KC);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const r=i.match(XC);return(r&&r[1]||i).trim()})||[]}function Qg(e,t){const n=t||{get:function(m,v){if(i.push(m),v===!1)return null;throw s(`No provider for "${m}"!`)}},i=[],r=this._providers=Object.create(n._providers||null),o=this._instances=Object.create(null),a=o.injector=this,s=function(m){const v=i.join(" -> ");return i.length=0,new Error(v?`${m} (Resolving: ${v})`:m)};function c(m,v){if(!r[m]&&m.includes(".")){const _=m.split(".");let E=c(_.shift());for(;_.length;)E=E[_.shift()];return E}if(qp(o,m))return o[m];if(qp(r,m)){if(i.indexOf(m)!==-1)throw i.push(m),s("Cannot resolve circular dependency!");return i.push(m),o[m]=r[m][0](r[m][1]),i.pop(),o[m]}return n.get(m,v)}function l(m,v){if(typeof v>"u"&&(v={}),typeof m!="function")if(Up(m))m=Dc(m.slice());else throw s(`Cannot invoke "${m}". Expected a function!`);const E=(m.$inject||ZC(m)).map(T=>qp(v,T)?v[T]:c(T));return{fn:m,dependencies:E}}function u(m){const{fn:v,dependencies:_}=l(m),E=Function.prototype.bind.call(v,null,..._);return new E}function p(m,v,_){const{fn:E,dependencies:T}=l(m,_);return E.apply(v,T)}function f(m){return Dc(v=>m.get(v))}function d(m,v){if(v&&v.length){const _=Object.create(null),E=Object.create(null),T=[],k=[],I=[];let P,O,F,J;for(let he in r)P=r[he],v.indexOf(he)!==-1&&(P[2]==="private"?(O=T.indexOf(P[3]),O===-1?(F=P[3].createChild([],v),J=f(F),T.push(P[3]),k.push(F),I.push(J),_[he]=[J,he,"private",F]):_[he]=[I[O],he,"private",k[O]]):_[he]=[P[2],P[1]],E[he]=!0),(P[2]==="factory"||P[2]==="type")&&P[1].$scope&&v.forEach(Pe=>{P[1].$scope.indexOf(Pe)!==-1&&(_[he]=[P[2],P[1]],E[Pe]=!0)});v.forEach(he=>{if(!E[he])throw new Error('No provider for "'+he+'". Cannot use provider from the parent!')}),m.unshift(_)}return new Qg(m,a)}const g={factory:p,type:u,value:function(m){return m}};function h(m,v){const _=m.__init__||[];return function(){_.forEach(E=>{typeof E=="string"?v.get(E):v.invoke(E)})}}function y(m){const v=m.__exports__;if(v){const _=m.__modules__,E=Object.keys(m).reduce((O,F)=>(F!=="__exports__"&&F!=="__modules__"&&F!=="__init__"&&F!=="__depends__"&&(O[F]=m[F]),O),Object.create(null)),T=(_||[]).concat(E),k=d(T),I=Dc(function(O){return k.get(O)});v.forEach(function(O){r[O]=[I,O,"private",k]});const P=(m.__init__||[]).slice();return P.unshift(function(){k.init()}),m=Object.assign({},m,{__init__:P}),h(m,k)}return Object.keys(m).forEach(function(_){if(_==="__init__"||_==="__depends__")return;const E=m[_];if(E[2]==="private"){r[_]=E;return}const T=E[0],k=E[1];r[_]=[g[T],QC(T,k),T]}),h(m,a)}function R(m,v){return m.indexOf(v)!==-1||(m=(v.__depends__||[]).reduce(R,m),m.indexOf(v)!==-1)?m:m.concat(v)}function x(m){const v=m.reduce(R,[]).map(y);let _=!1;return function(){_||(_=!0,v.forEach(E=>E()))}}this.get=c,this.invoke=p,this.instantiate=u,this.createChild=d,this.init=x(e)}function QC(e,t){return e!=="value"&&Up(t)&&(t=Dc(t.slice())),t}var JC=1e3;function er(e,t){var n=this;t=t||JC,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)})}er.prototype.canRender=function(e){},er.prototype.drawShape=function(e,t){},er.prototype.drawConnection=function(e,t){},er.prototype.getShapePath=function(e){},er.prototype.getConnectionPath=function(e){};function co(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function eA(e){return["M",e.x,e.y]}function Yp(e){return["L",e.x,e.y]}function tA(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function nA(e,t){const n=e.length,i=[eA(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(Yp(a));continue}const c=Math.min(t,Kp(a.x-o.x,a.y-o.y),Kp(s.x-a.x,s.y-a.y));if(!c){i.push(Yp(a));continue}const l=Lc(a,o,c),u=Lc(a,o,c*.5),p=Lc(a,s,c),f=Lc(a,s,c*.5);i.push(Yp(l)),i.push(tA(u,f,p))}return i}function Lc(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=Kp(i,r),a=n/o;return{x:e.x+i*a,y:e.y+r*a}}function Kp(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function Wa(e,t,n){ze(t)&&(n=t,t=null),t||(t={});const i=Oe("path",t);return ze(n)&&(i.dataset.cornerRadius=String(n)),Xp(i,e)}function Xp(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return Ee(e,{d:co(nA(t,n))}),e}function Ic(e){var t=new Set(e);return tt(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function lo(e,t,n){n=n||0,$e(e)||(e=[e]),H(e,function(i,r){var o=t(i,r,n);$e(o)&&o.length&&lo(o,t,n+1)})}function Zp(e,t,n){var i=new Set,r=new Set;return lo(e,function(o,a,s){i.add(o);var c=o.children;if(c&&!r.has(c))return r.add(c),c}),Array.from(i)}function Ua(e,t){return Zp(e)}function iA(e,t,n){eo(t)&&(t=!0),dn(t)&&(n=t,t=!0),n=n||{};var i=qa(n.allShapes),r=qa(n.allConnections),o=qa(n.enclosedElements),a=qa(n.enclosedConnections),s=qa(n.topLevel,t&&Lo(e,function(u){return u.id}));function c(u){s[u.source.id]&&s[u.target.id]&&(s[u.id]=[u]),i[u.source.id]&&i[u.target.id]&&(a[u.id]=o[u.id]=u),r[u.id]=u}function l(u){if(o[u.id]=u,u.waypoints)a[u.id]=r[u.id]=u;else return i[u.id]=u,H(u.incoming,c),H(u.outgoing,c),u.children}return lo(e,l),{allShapes:i,allConnections:r,topLevel:s,enclosedConnections:a,enclosedElements:o}}function Jt(e,t){t=!!t,$e(e)||(e=[e]);var n,i,r,o;return H(e,function(a){var s=a;a.waypoints&&!t&&(s=Jt(a.waypoints,!0));var c=s.x,l=s.y,u=s.height||0,p=s.width||0;(c<n||n===void 0)&&(n=c),(l<i||i===void 0)&&(i=l),(c+p>r||r===void 0)&&(r=c+p),(l+u>o||o===void 0)&&(o=l+u)}),{x:n,y:i,height:o-i,width:r-n}}function Xo(e,t){var n={};return H(e,function(i){var r=i;r.waypoints&&(r=Jt(r)),!ze(t.y)&&r.x>t.x&&(n[i.id]=i),!ze(t.x)&&r.y>t.y&&(n[i.id]=i),r.x>t.x&&r.y>t.y&&(ze(t.width)&&ze(t.height)&&r.width+r.x<t.width+t.x&&r.height+r.y<t.height+t.y||!ze(t.width)||!ze(t.height))&&(n[i.id]=i)}),n}function Jg(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function ey(e){return!!(e&&e.isFrame)}function qa(e,t){return W({},e||{},t||{})}var rA=1;function Rr(e,t){er.call(this,e,rA),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})}we(Rr,er),Rr.prototype.canRender=function(){return!0},Rr.prototype.drawShape=function(t,n,i){var r=Oe("rect");return Ee(r,{x:0,y:0,width:n.width||0,height:n.height||0}),ey(n)?Ee(r,W({},this.FRAME_STYLE,i||{})):Ee(r,W({},this.SHAPE_STYLE,i||{})),Ue(t,r),r},Rr.prototype.drawConnection=function(t,n,i){var r=Wa(n.waypoints,W({},this.CONNECTION_STYLE,i||{}));return Ue(t,r),r},Rr.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 co(a)},Rr.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 co(o)},Rr.$inject=["eventBus","styles"];function oA(){var e={"no-fill":{fill:"none"},"no-border":{strokeOpacity:0},"no-events":{pointerEvents:"none"}},t=this;this.cls=function(n,i,r){var o=this.style(i,r);return W(o,{class:n})},this.style=function(n,i){!$e(n)&&!i&&(i=n,n=[]);var r=Un(n,function(o,a){return W(o,e[a]||{})},{});return i?W(r,i):r},this.computeStyle=function(n,i,r){return $e(i)||(r=i,i=[]),t.style(i||[],W({},r,n||{}))}}const aA={__init__:["defaultRenderer"],defaultRenderer:["type",Rr],styles:["type",oA]};function Wt(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function qt(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 Qp(e,t){return!e||!t?-1:e.indexOf(t)}function Ya(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Jp(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=Ya(e,t);return Math.abs(r/o)<=i}var sA=2;function tr(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[r,o]of Object.entries(i))if(cA(r,n))return o;return!1}function cA(e,t){const n=t[0];return to(t,function(i){return Math.abs(n[e]-i[e])<=sA})}function ty(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 ef(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var lA=/,?([a-z]),?/gi,ny=parseFloat,en=Math,Cr=en.PI,ji=en.min,Hi=en.max,iy=en.pow,Ar=en.abs,uA=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,pA=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,ry=Array.isArray||function(e){return e instanceof Array};function fA(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function dA(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 hA(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 fA(r,i)?(dA(o,i),r[i]):(o.length>=1e3&&delete r[o.shift()],o.push(i),r[i]=e(...arguments),r[i])}return t}function mA(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(uA,function(i,r,o){var a=[],s=r.toLowerCase();for(o.replace(pA,function(c,l){l&&a.push(+l)}),s=="m"&&a.length>2&&(n.push([r,...a.splice(0,2)]),s="l",r=r=="m"?"l":"L");a.length>=t[s]&&(n.push([r,...a.splice(0,t[s])]),!!t[s]););}),n.toString=nf,n}function gA(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 yA(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 tf(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 nf(){return this.join(",").replace(lA,"$1")}function vA(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=nf,t}function oy(e,t,n,i,r,o,a,s,c){var l=1-c,u=iy(l,3),p=iy(l,2),f=c*c,d=f*c,g=u*e+p*3*c*n+l*3*c*c*r+d*a,h=u*t+p*3*c*i+l*3*c*c*o+d*s;return{x:Bc(g),y:Bc(h)}}function ay(e){var t=SA(...e);return tf(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function Mr(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function bA(e,t){return e=tf(e),t=tf(t),Mr(t,e.x,e.y)||Mr(t,e.x2,e.y)||Mr(t,e.x,e.y2)||Mr(t,e.x2,e.y2)||Mr(e,t.x,t.y)||Mr(e,t.x2,t.y)||Mr(e,t.x,t.y2)||Mr(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 sy(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 cy(e,t,n,i,r,o,a,s,c){c==null&&(c=1),c=c>1?1:c<0?0:c;for(var l=c/2,u=12,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,g=0;g<u;g++){var h=l*p[g]+l,y=sy(h,e,n,r,a),R=sy(h,t,i,o,s),x=y*y+R*R;d+=f[g]*en.sqrt(x)}return l*d}function xA(e,t,n,i,r,o,a,s){if(!(Hi(e,n)<ji(r,a)||ji(e,n)>Hi(r,a)||Hi(t,i)<ji(o,s)||ji(t,i)>Hi(o,s))){var c=(e*i-t*n)*(r-a)-(e-n)*(r*s-o*a),l=(e*i-t*n)*(o-s)-(t-i)*(r*s-o*a),u=(e-n)*(o-s)-(t-i)*(r-a);if(u){var p=Bc(c/u),f=Bc(l/u),d=+p.toFixed(2),g=+f.toFixed(2);if(!(d<+ji(e,n).toFixed(2)||d>+Hi(e,n).toFixed(2)||d<+ji(r,a).toFixed(2)||d>+Hi(r,a).toFixed(2)||g<+ji(t,i).toFixed(2)||g>+Hi(t,i).toFixed(2)||g<+ji(o,s).toFixed(2)||g>+Hi(o,s).toFixed(2)))return{x:p,y:f}}}}function Bc(e){return Math.round(e*1e11)/1e11}function _A(e,t,n){var i=ay(e),r=ay(t);if(!bA(i,r))return[];var o=cy(...e),a=cy(...t),s=uy(e)?1:~~(o/5)||1,c=uy(t)?1:~~(a/5)||1,l=new Array(s+1),u=new Array(c+1),p={},f=[],d,g;for(d=0;d<s+1;d++){var h=oy(...e,d/s);l[d]={x:h.x,y:h.y,t:d/s}}for(d=0;d<c+1;d++)h=oy(...t,d/c),u[d]={x:h.x,y:h.y,t:d/c};for(d=0;d<s;d++)for(g=0;g<c;g++){var y=l[d],R=l[d+1],x=u[g],m=u[g+1],v=Ar(R.x-y.x)<.01?"y":"x",_=Ar(m.x-x.x)<.01?"y":"x",E=xA(y.x,y.y,R.x,R.y,x.x,x.y,m.x,m.y),T;if(E){if(T=E.x.toFixed(9)+"#"+E.y.toFixed(9),p[T])continue;p[T]=!0;var k=y.t+Ar((E[v]-y[v])/(R[v]-y[v]))*(R.t-y.t),I=x.t+Ar((E[_]-x[_])/(m[_]-x[_]))*(m.t-x.t);k>=0&&k<=1&&I>=0&&I<=1&&f.push({x:E.x,y:E.y,t1:k,t2:I})}}return f}function ly(e,t,n){e=dy(e),t=dy(t);for(var i,r,o,a,s,c,l,u,p,f,d=n?0:[],g=0,h=e.length;g<h;g++){var y=e[g];if(y[0]=="M")i=s=y[1],r=c=y[2];else{y[0]=="C"?(p=[i,r,...y.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,x=t.length;R<x;R++){var m=t[R];if(m[0]=="M")o=l=m[1],a=u=m[2];else{m[0]=="C"?(f=[o,a,...m.slice(1)],o=f[6],a=f[7]):(f=[o,a,o,a,l,u,l,u],o=l,a=u);var v=_A(p,f);{for(var _=0,E=v.length;_<E;_++)v[_].segment1=g,v[_].segment2=R,v[_].bez1=p,v[_].bez2=f;d=d.concat(v)}}}}}return d}function wA(e){return ry(e)&&ry(e[0])}function EA(e){if(gA(e))return e;var t=new Array(e.length),n=0,i=0,r=0,o=0,a=0,s;e[0][0]=="M"&&(n=+e[0][1],i=+e[0][2],r=n,o=i,a++,t[0]=["M",n,i]);for(var c,l,u=a,p=e.length;u<p;u++){if(l=e[u],s=l[0],t[u]=c=new Array(l.length),s!=s.toUpperCase())switch(c[0]=s.toUpperCase(),c[0]){case"A":c[1]=l[1],c[2]=l[2],c[3]=l[3],c[4]=l[4],c[5]=l[5],c[6]=+l[6]+n,c[7]=+l[7]+i;break;case"V":c[1]=+l[1]+i;break;case"H":c[1]=+l[1]+n;break;case"M":r=+l[1]+n,o=+l[2]+i;default:for(var f=1,d=l.length;f<d;f++)c[f]=+l[f]+(f%2?n:i)}else for(var g=0,h=l.length;g<h;g++)c[g]=l[g];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=nf,t}function uy(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function Nc(e,t,n,i){return[e,t,n,i,n,i]}function py(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 fy(e,t,n,i,r,o,a,s,c,l){var u=Cr*120/180,p=Cr/180*(+r||0),f=[],d,g=hA(function(B,S,w){var G=B*en.cos(w)-S*en.sin(w),V=B*en.sin(w)+S*en.cos(w);return{x:G,y:V}});if(l)T=l[0],k=l[1],_=l[2],E=l[3];else{d=g(e,t,-p),e=d.x,t=d.y,d=g(s,c,-p),s=d.x,c=d.y;var h=(e-s)/2,y=(t-c)/2,R=h*h/(n*n)+y*y/(i*i);R>1&&(R=en.sqrt(R),n=R*n,i=R*i);var x=n*n,m=i*i,v=(o==a?-1:1)*en.sqrt(Ar((x*m-x*y*y-m*h*h)/(x*y*y+m*h*h))),_=v*n*y/i+(e+s)/2,E=v*-i*h/n+(t+c)/2,T=en.asin(((t-E)/i).toFixed(9)),k=en.asin(((c-E)/i).toFixed(9));T=e<_?Cr-T:T,k=s<_?Cr-k:k,T<0&&(T=Cr*2+T),k<0&&(k=Cr*2+k),a&&T>k&&(T=T-Cr*2),!a&&k>T&&(k=k-Cr*2)}var I=k-T;if(Ar(I)>u){var P=k,O=s,F=c;k=T+u*(a&&k>T?1:-1),s=_+n*en.cos(k),c=E+i*en.sin(k),f=fy(s,c,n,i,r,0,a,O,F,[k,P,_,E])}I=k-T;var J=en.cos(T),he=en.sin(T),Pe=en.cos(k),De=en.sin(k),Ke=en.tan(I/4),rt=4/3*n*Ke,Ce=4/3*i*Ke,X=[e,t],te=[e+rt*he,t-Ce*J],U=[s+rt*De,c-Ce*Pe],K=[s,c];if(te[0]=2*X[0]-te[0],te[1]=2*X[1]-te[1],l)return[te,U,K].concat(f);f=[te,U,K].concat(f).join().split(",");for(var ie=[],pe=0,Te=f.length;pe<Te;pe++)ie[pe]=pe%2?g(f[pe-1],f[pe],p).y:g(f[pe],f[pe+1],p).x;return ie}function SA(e,t,n,i,r,o,a,s){for(var c=[],l=[[],[]],u,p,f,d,g,h,y,R,x=0;x<2;++x){if(x==0?(p=6*e-12*n+6*r,u=-3*e+9*n-9*r+3*a,f=3*n-3*e):(p=6*t-12*i+6*o,u=-3*t+9*i-9*o+3*s,f=3*i-3*t),Ar(u)<1e-12){if(Ar(p)<1e-12)continue;d=-f/p,0<d&&d<1&&c.push(d);continue}y=p*p-4*f*u,R=en.sqrt(y),!(y<0)&&(g=(-p+R)/(2*u),0<g&&g<1&&c.push(g),h=(-p-R)/(2*u),0<h&&h<1&&c.push(h))}for(var m=c.length,v=m,_;m--;)d=c[m],_=1-d,l[0][m]=_*_*_*e+3*_*_*d*n+3*_*d*d*r+d*d*d*a,l[1][m]=_*_*_*t+3*_*_*d*i+3*_*d*d*o+d*d*d*s;return l[0][v]=e,l[1][v]=t,l[0][v+1]=a,l[1][v+1]=s,l[0].length=l[1].length=v+2,{x0:ji(...l[0]),y0:ji(...l[1]),x1:Hi(...l[0]),y1:Hi(...l[1])}}function dy(e){if(wA(e)||(e=mA(e)),yA(e))return e;for(var t=vA(EA(e)),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i=function(f,d,g){var h,y;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",...fy(d.x,d.y,...f.slice(1))];break;case"S":g=="C"||g=="S"?(h=d.x*2-d.bx,y=d.y*2-d.by):(h=d.x,y=d.y),f=["C",h,y,...f.slice(1)];break;case"T":g=="Q"||g=="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",...py(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",...py(d.x,d.y,f[1],f[2],f[3],f[4])];break;case"L":f=["C",...Nc(d.x,d.y,f[1],f[2])];break;case"H":f=["C",...Nc(d.x,d.y,f[1],d.y)];break;case"V":f=["C",...Nc(d.x,d.y,d.x,f[1])];break;case"Z":f=["C",...Nc(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 g=f[d];g.length;)o[d]="A",f.splice(d++,0,["C",...g.splice(0,6)]);f.splice(d,1),l=t.length}},o=[],a="",s="",c=0,l=t.length;c<l;c++){t[c]&&(a=t[c][0]),a!="C"&&(o[c]=a,c&&(s=o[c-1])),t[c]=i(t[c],n,s),o[c]!="A"&&a=="C"&&(o[c]="C"),r(t,c);var u=t[c],p=u.length;n.x=u[p-2],n.y=u[p-1],n.bx=ny(u[p-4])||n.x,n.by=ny(u[p-3])||n.y}return t}function Ct(e){return dn(e)&&Wn(e,"waypoints")}function Je(e){return dn(e)&&Wn(e,"labelTarget")}function RA(e){return dn(e)&&Oo(e.parent)}function hy(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function nr(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 $c(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function CA(e){return nr({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function AA(e){for(var t=e.waypoints,n=t.reduce(function(l,u,p){var f=t[p-1];if(f){var d=l[l.length-1],g=d&&d.endLength||0,h=TA(f,u);l.push({start:f,end:u,startLength:g,endLength:g+h,length:h})}return l},[]),i=n.reduce(function(l,u){return l+u.length},0),r=i/2,o=0,a=n[o];a.endLength<r;)a=n[++o];var s=(r-a.startLength)/a.length,c={x:a.start.x+(a.end.x-a.start.x)*s,y:a.start.y+(a.end.y-a.start.y)*s};return c}function Fe(e){return Ct(e)?AA(e):CA(e)}function Rn(e,t,n){n=n||0,dn(n)||(n={x:n,y:n});var i=Ie(e),r=Ie(t),o=i.bottom+n.y<=r.top,a=i.left-n.x>=r.right,s=i.top-n.y>=r.bottom,c=i.right+n.x<=r.left,l=o?"top":s?"bottom":null,u=c?"left":a?"right":null;return u&&l?l+"-"+u:u||l||"intersect"}function Ka(e,t,n){var i=MA(e,t);return i.length===1||i.length===2&&Ya(i[0],i[1])<1?nr(i[0]):i.length>1?(i=Di(i,function(r){var o=Math.floor(r.t2*100)||1;return o=100-o,o=(o<10?"0":"")+o,r.segment2+"#"+o}),nr(i[n?0:i.length-1])):null}function MA(e,t){return ly(e,t)}function PA(e){e=e.slice();for(var t=0,n,i,r;e[t];)n=e[t],i=e[t-1],r=e[t+1],Ya(n,r)===0||Jp(i,r,n)?e.splice(t,1):t++;return e}function TA(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Fc(e,t){return Math.round(e*t)/t}function my(e){return ze(e)?e+"px":e}function kA(e){for(;e.parent;)e=e.parent;return e}function OA(e){e=W({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),Bn(n,{position:"relative",overflow:"hidden",width:my(e.width),height:my(e.height)}),t.appendChild(n),n}function gy(e,t,n){const i=Oe("g");ct(i).add(t);const r=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}const DA="base",yy=0,LA=1,IA={shape:["x","y","width","height"],connection:["waypoints"]};function je(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||{})}je.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],je.prototype._init=function(e){const t=this._eventBus,n=this._container=OA(e),i=this._svg=Oe("svg");Ee(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")}),Ue(n,i);const r=this._viewport=gy(i,"viewport");e.deferUpdate&&(this._viewboxChanged=Zu(this._viewboxChanged,300)),this._restoreFocus=Zu(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)},je.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},je.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},je.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=Jg(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},je.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},je.prototype.restoreFocus=function(){this._restoreFocus()},je.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},je.prototype.isFocused=function(){return this._focused},je.prototype.getDefaultLayer=function(){return this.getLayer(DA,yy)},je.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},je.prototype._getChildIndex=function(e){return Un(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},je.prototype._createLayer=function(e,t){typeof t>"u"&&(t=LA);const n=this._getChildIndex(t);return{group:gy(this._viewport,"layer-"+e,n),index:t,visible:!0}},je.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},je.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&&(cn(n),t.visible=!1),n},je.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],cn(t.group))},je.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},je.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const r=this._findPlaneForRoot(kA(i));if(!r||n&&r.rootElement!==n)return;n=r.rootElement}return n},je.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},je.prototype._findPlaneForRoot=function(e){return Tt(this._planes,function(t){return t.rootElement===e})},je.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},je.prototype._resolveElements=function(e){return $e(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},je.prototype.getContainer=function(){return this._container},je.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&&(H([i.gfx,i.secondaryGfx],function(r){r&&(n?(e.markers.add(t),ct(r).add(t)):(e.markers.delete(t),ct(r).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},je.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},je.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},je.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},je.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},je.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},je.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,yy);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},je.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},je.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},je.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)},je.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})},je.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})},je.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=IA[e];if(!to(n,function(r){return typeof t[r]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},je.prototype._setParent=function(e,t,n){qt(t.children,e,n),e.parent=t},je.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},je.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},je.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},je.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),Wt(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},je.prototype.removeShape=function(e){return this._removeElement(e,"shape")},je.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},je.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},je.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},je.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},je.prototype.viewbox=function(e){if(e===void 0&&this._cachedViewbox)return structuredClone(this._cachedViewbox);const t=this._viewport,n=this.getSize();let i,r,o,a,s,c,l;if(e)this._changeViewbox(function(){s=Math.min(n.width/e.width,n.height/e.height);const u=this._svg.createSVGMatrix().scale(s).translate(-e.x,-e.y);Va(t,u)});else return o=this._rootElement?this.getActiveLayer():null,i=o&&o.getBBox()||{},a=Va(t),r=a?a.matrix:jC(),s=Fc(r.a,1e3),c=Fc(-r.e||0,1e3),l=Fc(-r.f||0,1e3),e=this._cachedViewbox={x:c?c/s:0,y:l?l/s:0,width:n.width/s,height:n.height/s,scale:s,inner:{width:i.width||0,height:i.height||0,x:i.x||0,y:i.y||0},outer:n},e;return e},je.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=W({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),vy(t,n)}),{x:n.e,y:n.f}},je.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(g=>g!=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=Jt(o),s=Ie(a),c=this.viewbox(),l=this.zoom();let u,p;c.y+=t.top/l,c.x+=t.left/l,c.width-=(t.right+t.left)/l,c.height-=(t.bottom+t.top)/l;const f=Ie(c);if(!(a.width<c.width&&a.height<c.height))u=a.x-c.x,p=a.y-c.y;else{const g=Math.max(0,s.right-f.right),h=Math.min(0,s.left-f.left),y=Math.max(0,s.bottom-f.bottom),R=Math.min(0,s.top-f.top);u=g||h,p=y||R}this.scroll({dx:-u*l,dy:-p*l})},je.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)}),Fc(i.a,1e3)};function vy(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}je.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},je.prototype._setZoom=function(e,t){const n=this._svg,i=this._viewport,r=n.createSVGMatrix(),o=n.createSVGPoint();let a,s,c,l,u;c=i.getCTM();const p=c.a;return t?(a=W(o,t),s=a.matrixTransform(c.inverse()),l=r.translate(s.x,s.y).scale(1/p*e).translate(-s.x,-s.y),u=c.multiply(l)):u=r.scale(e),vy(this._viewport,u),u},je.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},je.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}},je.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var Zo="data-element-id";function si(e){this._elements={},this._eventBus=e}si.$inject=["eventBus"],si.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),Ee(t,Zo,i),n&&Ee(n,Zo,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},si.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(Ee(i.gfx,Zo,""),i.secondaryGfx&&Ee(i.secondaryGfx,Zo,""),delete t[n])},si.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)},si.prototype.updateGraphics=function(e,t,n){var i=e.id||e,r=this._elements[i];return n?r.secondaryGfx=t:r.gfx=t,t&&Ee(t,Zo,i),t},si.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&Ee(e,Zo);var n=this._elements[t];return n&&n.element},si.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},si.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}},si.prototype.getAll=function(){return this.filter(function(e){return e})},si.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)})},si.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},si.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 BA(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 NA(e){return e.__refs_collection===!0}function $A(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function by(e,t,n){var i=BA(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 FA(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 di(e,t){if(!(this instanceof di))return new di(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}di.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?by(this,t,e):FA(this,t,e)},di.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return NA(n)||by(this,t,e),n},di.prototype.ensureBound=function(e,t){$A(e,t)||this.bind(e,t)},di.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},di.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var rf=new di({name:"children",enumerable:!0,collection:!0},{name:"parent"}),xy=new di({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),_y=new di({name:"attachers",collection:!0},{name:"host"}),wy=new di({name:"outgoing",collection:!0},{name:"source"}),Ey=new di({name:"incoming",collection:!0},{name:"target"});function Qo(){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)}}),rf.bind(this,"parent"),xy.bind(this,"labels"),wy.bind(this,"outgoing"),Ey.bind(this,"incoming")}function Xa(){Qo.call(this),rf.bind(this,"children"),_y.bind(this,"host"),_y.bind(this,"attachers")}we(Xa,Qo);function Sy(){Qo.call(this),rf.bind(this,"children")}we(Sy,Xa);function Ry(){Xa.call(this),xy.bind(this,"labelTarget")}we(Ry,Xa);function Cy(){Qo.call(this),wy.bind(this,"source"),Ey.bind(this,"target")}we(Cy,Qo);var jA={connection:Cy,shape:Xa,label:Ry,root:Sy};function HA(e,t){var n=jA[e];if(!n)throw new Error("unknown type: <"+e+">");return W(new n,t)}function zA(e){return e instanceof Qo}function ir(){this._uid=12}ir.prototype.createRoot=function(e){return this.create("root",e)},ir.prototype.createLabel=function(e){return this.create("label",e)},ir.prototype.createShape=function(e){return this.create("shape",e)},ir.prototype.createConnection=function(e){return this.create("connection",e)},ir.prototype.create=function(e,t){return t=W({},t||{}),t.id||(t.id=e+"_"+this._uid++),HA(e,t)};var jc="__fn",Ay=1e3,GA=Array.prototype.slice;function Yn(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}Yn.prototype.on=function(e,t,n,i){if(e=$e(e)?e:[e],hn(t)&&(i=n,n=t,t=Ay),!ze(t))throw new Error("priority must be a number");var r=n;i&&(r=jn(n,i),r[jc]=n[jc]||n);var o=this;e.forEach(function(a){o._addListener(a,{priority:t,callback:r,next:null})})},Yn.prototype.once=function(e,t,n,i){var r=this;if(hn(t)&&(i=n,n=t,t=Ay),!ze(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[jc]=n,this.on(e,t,o)},Yn.prototype.off=function(e,t){e=$e(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},Yn.prototype.createEvent=function(e){var t=new Za;return t.init(e),t},Yn.prototype.fire=function(e,t){var n,i,r,o;if(o=GA.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 Za?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}},Yn.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},Yn.prototype._destroy=function(){this._listeners={}},Yn.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},Yn.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=VA(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},Yn.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},Yn.prototype._getListeners=function(e){return this._listeners[e]},Yn.prototype._setListeners=function(e,t){this._listeners[e]=t},Yn.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[jc]===t)&&(r?r.next=i:this._setListeners(e,i)),r=n,n=i};function Za(){}Za.prototype.stopPropagation=function(){this.cancelBubble=!0},Za.prototype.preventDefault=function(){this.defaultPrevented=!0},Za.prototype.init=function(e){W(this,e||{})};function VA(e,t){return e.apply(null,t)}function uo(e){return e.childNodes[0]}function WA(e){return e.parentNode.childNodes[1]}function Hc(e,t,n,i,r){var o=Ga();o.setTranslate(t,n);var a=Ga();a.setRotate(i||0,0,0);var s=Ga();s.setScale(1,1),Va(e,[o,a,s])}function Cn(e,t,n){var i=Ga();i.setTranslate(t,n),Va(e,i)}function My(e,t){var n=Ga();n.setRotate(t,0,0),Va(e,n)}function ci(e,t){this._eventBus=e,this._elementRegistry=t}ci.$inject=["eventBus","elementRegistry"],ci.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=WA(t),n||(n=Oe("g"),ct(n).add("djs-children"),Ue(t.parentNode,n))):n=t,n},ci.prototype._clear=function(e){var t=uo(e);return Pc(t),t},ci.prototype._createContainer=function(e,t,n,i){var r=Oe("g");ct(r).add("djs-group"),typeof n<"u"?UA(r,t,t.childNodes[n]):Ue(t,r);var o=Oe("g");ct(o).add("djs-element"),ct(o).add("djs-"+e),i&&ct(o).add("djs-frame"),Ue(r,o);var a=Oe("g");return ct(a).add("djs-visual"),Ue(o,a),o},ci.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,ey(t))},ci.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=Un(e,function(r,o){return o.parent&&(r[o.parent.id]=o.parent),r},{}),H(i,function(r){var o=r.children;if(o){var a=t._getChildrenContainer(r),s=a.firstChild;H(o,function(c){var l=n.getGraphics(c).parentNode;l===s?s=s.nextSibling:a.insertBefore(l,s)})}})},ci.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},ci.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},ci.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},ci.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},ci.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),Cn(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?Ee(n,"display","none"):Ee(n,"display","block")}},ci.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);cn(t.parentNode)};function UA(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const qA={__depends__:[aA],__init__:["canvas"],canvas:["type",je],elementRegistry:["type",si],elementFactory:["type",ir],eventBus:["type",Yn],graphicsFactory:["type",ci]};function YA(e){var t=new Qg(e);return t.init(),t}function KA(e){e=e||{};var t={config:["value",e]},n=[t,qA].concat(e.modules||[]);return YA(n)}function Pr(e,t){this._injector=t||KA(e),this.get("eventBus").fire("diagram.init")}Pr.prototype.get=function(e,t){return this._injector.get(e,t)},Pr.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},Pr.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},Pr.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function Dn(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function Hn(e,t){return e.$instanceOf(t)}function XA(e){return Tt(e.rootElements,function(t){return Hn(t,"bpmn:Process")||Hn(t,"bpmn:Collaboration")})}function ZA(e){var t={},n=[],i={};function r(U,K){return function(ie){U(ie,K)}}function o(U){t[U.id]=U}function a(U){return t[U.id]}function s(U,K){var ie=U.gfx;if(ie)throw new Error(`already rendered ${Dn(U)}`);return e.element(U,i[U.id],K)}function c(U,K){return e.root(U,i[U.id],K)}function l(U,K){try{var ie=i[U.id]&&s(U,K);return o(U),ie}catch(pe){u(pe.message,{element:U,error:pe}),console.error(`failed to import ${Dn(U)}`,pe)}}function u(U,K){e.error(U,K)}var p=this.registerDi=function(K){var ie=K.bpmnElement;ie?i[ie.id]?u(`multiple DI elements defined for ${Dn(ie)}`,{element:ie}):i[ie.id]=K:u(`no bpmnElement referenced in ${Dn(K)}`,{element:K})};function f(U){d(U.plane)}function d(U){p(U),H(U.planeElement,g)}function g(U){p(U)}this.handleDefinitions=function(K,ie){var pe=K.diagrams;if(ie&&pe.indexOf(ie)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!ie&&pe&&pe.length&&(ie=pe[0]),!ie)throw new Error("no diagram to display");i={},f(ie);var Te=ie.plane;if(!Te)throw new Error(`no plane for ${Dn(ie)}`);var B=Te.bpmnElement;if(!B)if(B=XA(K),B)u(`correcting missing bpmnElement on ${Dn(Te)} to ${Dn(B)}`),Te.bpmnElement=B,p(Te);else throw new Error("no process or collaboration to display");var S=c(B,Te);if(Hn(B,"bpmn:Process")||Hn(B,"bpmn:SubProcess"))y(B,S);else if(Hn(B,"bpmn:Collaboration"))X(B,S),R(K.rootElements,S);else throw new Error(`unsupported bpmnElement for ${Dn(Te)}: ${Dn(B)}`);h(n)};var h=this.handleDeferred=function(){for(var K;n.length;)K=n.shift(),K()};function y(U,K){Ke(U,K),I(U.ioSpecification,K),k(U.artifacts,K),o(U)}function R(U,K){var ie=tt(U,function(pe){return!a(pe)&&Hn(pe,"bpmn:Process")&&pe.laneSets});ie.forEach(r(y,K))}function x(U,K){l(U,K)}function m(U,K){H(U,r(x,K))}function v(U,K){l(U,K)}function _(U,K){l(U,K)}function E(U,K){l(U,K)}function T(U,K){l(U,K)}function k(U,K){H(U,function(ie){Hn(ie,"bpmn:Association")?n.push(function(){T(ie,K)}):T(ie,K)})}function I(U,K){U&&(H(U.dataInputs,r(_,K)),H(U.dataOutputs,r(E,K)))}var P=this.handleSubProcess=function(K,ie){Ke(K,ie),k(K.artifacts,ie)};function O(U,K){var ie=l(U,K);Hn(U,"bpmn:SubProcess")&&P(U,ie||K),Hn(U,"bpmn:Activity")&&I(U.ioSpecification,K),n.push(function(){H(U.dataInputAssociations,r(v,K)),H(U.dataOutputAssociations,r(v,K))})}function F(U,K){l(U,K)}function J(U,K){l(U,K)}function he(U,K){n.push(function(){var ie=l(U,K);U.childLaneSet&&Pe(U.childLaneSet,ie||K),te(U)})}function Pe(U,K){H(U.lanes,r(he,K))}function De(U,K){H(U,r(Pe,K))}function Ke(U,K){rt(U.flowElements,K),U.laneSets&&De(U.laneSets,K)}function rt(U,K){H(U,function(ie){Hn(ie,"bpmn:SequenceFlow")?n.push(function(){F(ie,K)}):Hn(ie,"bpmn:BoundaryEvent")?n.unshift(function(){O(ie,K)}):Hn(ie,"bpmn:FlowNode")?O(ie,K):Hn(ie,"bpmn:DataObject")||(Hn(ie,"bpmn:DataStoreReference")||Hn(ie,"bpmn:DataObjectReference")?J(ie,K):u(`unrecognized flowElement ${Dn(ie)} in context ${Dn(K&&K.businessObject)}`,{element:ie,context:K}))})}function Ce(U,K){var ie=l(U,K),pe=U.processRef;pe&&y(pe,ie||K)}function X(U,K){H(U.participants,r(Ce,K)),n.push(function(){m(U.messageFlows,K)}),k(U.artifacts,K)}function te(U){H(U.flowNodeRef,function(K){var ie=K.get("lanes");ie&&ie.push(U)})}}function QA(e,t,n){var i,r,o,a,s=[];function c(l,u){var p={root:function(h,y){return i.add(h,y)},element:function(h,y,R){return i.add(h,y,R)},error:function(h,y){s.push({message:h,context:y})}},f=new ZA(p);u=u||l.diagrams&&l.diagrams[0];var d=JA(l,u);if(!d)throw new Error("no diagram to display");H(d,function(h){f.handleDefinitions(l,h)});var g=u.plane.bpmnElement.id;o.setRootElement(o.findRoot(g+"_plane")||o.findRoot(g))}return new Promise(function(l,u){try{return i=e.get("bpmnImporter"),r=e.get("eventBus"),o=e.get("canvas"),r.fire("import.render.start",{definitions:t}),c(t,n),r.fire("import.render.complete",{error:a,warnings:s}),l({warnings:s})}catch(p){return p.warnings=s,u(p)}})}function JA(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!C(n,"bpmn:Process")&&!C(n,"bpmn:Collaboration")&&(i=eM(n));var r;C(i,"bpmn:Collaboration")?r=i:r=Tt(e.rootElements,function(l){if(C(l,"bpmn:Collaboration"))return Tt(l.participants,function(u){return u.processRef===i})});var o=[i];r&&(o=Pn(r.participants,function(l){return l.processRef}),o.push(r));var a=Py(o),s=[t],c=[n];return H(e.diagrams,function(l){if(l.plane){var u=l.plane.bpmnElement;a.indexOf(u)!==-1&&c.indexOf(u)===-1&&(s.push(l),c.push(u))}}),s}}function Py(e){var t=[];return H(e,function(n){n&&(t.push(n),t=t.concat(Py(n.flowElements)))}),t}function eM(e){for(var t=e;t;){if(C(t,"bpmn:Process"))return t;t=t.$parent}}var tM='<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>',Ty=tM,ky={verticalAlign:"middle"},Oy={color:"#404040"},nM={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},iM={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},rM={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"},oM='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+Ty+'</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>',zi;function aM(){zi=Ot(oM),Bn(zi,nM),Bn(St("svg",zi),ky),Bn(St(".backdrop",zi),iM),Bn(St(".notice",zi),rM),Bn(St(".link",zi),Oy,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function sM(){zi||(aM(),qn.bind(zi,".backdrop","click",function(e){document.body.removeChild(zi)})),document.body.appendChild(zi)}const zc=5,Dy="djs-outline-hidden";function Ft(e){e=W({},lM,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),pM(this._container)}we(Ft,Pr),Ft.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,l=a.warnings,u=a.elementsById;o=o.concat(l),s=this._emit("import.parse.complete",r({error:null,definitions:s,elementsById:u,references:c,warnings:o}))||s;const 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||[]),Gc(s,o),s=cM(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},Ft.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},Ft.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const o=new Error("no XML imported");throw Gc(o,[]),o}if(typeof t=="string"&&(i=uM(n,t),!i)){const o=new Error("BPMNDiagram <"+t+"> not found");throw Gc(o,[]),o}try{this.clear()}catch(o){throw Gc(o,[]),o}const{warnings:r}=await QA(this,n,i);return{warnings:r}},Ft.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},Ft.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),r=i.getActiveLayer(),o=St(":scope > defs",i._svg),a=Zg(r),s=o?"<defs>"+Zg(o)+"</defs>":"",c=i.getContainer();Bt(c).add(Dy);let l;try{l=r.getBBox()}finally{Bt(c).remove(Dy)}const u=l.x-zc,p=l.y-zc,f=l.width+zc*2,d=l.height+zc*2;t=`<?xml version="1.0" encoding="utf-8"?>
8
8
  <!-- created with bpmn-js / http://bpmn.io -->
9
9
  <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
10
- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="`+f+'" height="'+d+'" viewBox="'+u+" "+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}},Ft.prototype._setDefinitions=function(e){this._definitions=e},Ft.prototype.getModules=function(){return this._modules},Ft.prototype.clear=function(){this.getDefinitions()&&Ar.prototype.clear.call(this)},Ft.prototype.destroy=function(){Ar.prototype.destroy.call(this),$i(this._container)},Ft.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},Ft.prototype.off=function(e,t){this.get("eventBus").off(e,t)},Ft.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=St(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},Ft.prototype.getDefinitions=function(){return this._definitions},Ft.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},Ft.prototype._init=function(e,t,n){const i=n.modules||this.getModules(n),r=n.additionalModules||[],o=[{bpmnjs:["value",this],moddle:["value",t]}],a=[].concat(o,i,r),s=W(Di(n,["additionalModules"]),{canvas:W({},n.canvas,{container:e}),modules:a});Ar.call(this,s),n&&n.container&&this.attachTo(n.container)},Ft.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},Ft.prototype._createContainer=function(e){const t=Ot('<div class="bjs-container"></div>');return In(t,{width:wy(e.width),height:wy(e.height),position:e.position}),t},Ft.prototype._createModdle=function(e){const t=W({},this._moddleExtensions,e.moddleExtensions);return new cm(t)},Ft.prototype._modules=[];function $c(e,t){return e.warnings=t,e}function GA(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 VA={width:"100%",height:"100%",position:"relative"};function wy(e){return e+(Ge(e)?"px":"")}function WA(e,t){return t&&Tt(e.diagrams,function(n){return n.id===t})||null}function UA(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+vy+"</a>",i=Ot(n);In(St("svg",i),by),In(i,xy,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),Ve.bind(i,"click",function(r){zA(),r.preventDefault()})}function Yo(e){Ft.call(this,e),this.on("import.parse.complete",function(t){t.error||this._collectIds(t.definitions,t.elementsById)},this),this.on("diagram.destroy",function(){this.get("moddle").ids.clear()},this)}Ee(Yo,Ft),Yo.prototype._createModdle=function(e){var t=Ft.prototype._createModdle.call(this,e);return t.ids=new Ni([32,36,1]),t},Yo.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 at(e,t){return C(e,"bpmn:CallActivity")?!1:C(e,"bpmn:SubProcess")?(t=t||pt(e),t&&C(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):C(e,"bpmn:Participant")?!!ue(e).processRef:!0}function gn(e){if(!(!C(e,"bpmn:Participant")&&!C(e,"bpmn:Lane"))){var t=pt(e).isHorizontal;return t===void 0?!0:t}}function qA(e){return e&&ue(e).isInterrupting!==!1}function Dn(e){return e&&!!ue(e).triggeredByEvent}function Ko(e,t){var n=ue(e).eventDefinitions;return yr(n,function(i){return C(i,t)})}function YA(e){return Ko(e,"bpmn:ErrorEventDefinition")}function KA(e){return Ko(e,"bpmn:EscalationEventDefinition")}function XA(e){return Ko(e,"bpmn:CompensateEventDefinition")}var co={width:90,height:20},Ey=15;function Mr(e){return C(e,"bpmn:Event")||C(e,"bpmn:Gateway")||C(e,"bpmn:DataStoreReference")||C(e,"bpmn:DataObjectReference")||C(e,"bpmn:DataInput")||C(e,"bpmn:DataOutput")||C(e,"bpmn:SequenceFlow")||C(e,"bpmn:MessageFlow")||C(e,"bpmn:Group")}function Fc(e){return Je(e.label)}function ZA(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=QA(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-=Ey:a+=Ey,{x:a,y:s}}function QA(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 qp(e){return e.waypoints?ZA(e.waypoints):C(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+co.height/2}:{x:e.x+e.width/2,y:e.y+e.height+co.height/2}}function JA(e,t){var n,i,r,o=e.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(co.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=qp(t),i=co),W({x:n.x-i.width/2,y:n.y-i.height/2},i)}function Sy(e){if(C(e,"bpmn:FlowElement")||C(e,"bpmn:Participant")||C(e,"bpmn:Lane")||C(e,"bpmn:SequenceFlow")||C(e,"bpmn:MessageFlow")||C(e,"bpmn:DataInput")||C(e,"bpmn:DataOutput"))return"name";if(C(e,"bpmn:TextAnnotation"))return"text";if(C(e,"bpmn:Group"))return"categoryValueRef"}function eM(e){var t=e.categoryValueRef;return t&&t.value||""}function li(e){var t=e.businessObject,n=Sy(t);if(n)return n==="categoryValueRef"?eM(t):t[n]||""}function tM(e,t){var n=e.businessObject,i=Sy(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function nM(e){return Je(e)&&Mr(e.labelTarget)}var Xo=7;function Ry(e){let t=[];return H(e.incoming,n=>{C(n,"bpmn:Association")&&C(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),H(e.outgoing,n=>{C(n,"bpmn:Association")&&C(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function Ya(e){const t=new Map;return H(jp(e),n=>{H(Ry(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 Yp="hsl(225, 10%, 15%)",iM="white";function zi(e,t){return yr(e.eventDefinitions,function(n){return n.$type===t})}function rM(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function oM(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function rt(e,t,n){var i=pt(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||iM}function _e(e,t,n){var i=pt(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||Yp}function Ka(e,t,n,i){var r=pt(e),o=r.get("label");return i||o&&o.get("color:color")||t||_e(e,n)}function Cy(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 oo(r)}function Kp(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 oo(a)}function aM(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 oo(s)}function sM(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 oo(o)}function Xa(e,t={}){return{width:fi(e,t),height:Yn(e,t)}}function fi(e,t={}){return Vn(t,"width")?t.width:e.width}function Yn(e,t={}){return Vn(t,"height")?t.height:e.height}var cM=new Ni,lM=10,jc=3,uM=1.5,Hc=10,pM=4,Zo=.95,fM=1,dM=.25;function lo(e,t,n,i,r,o,a){Ji.call(this,t,a);var s=e&&e.defaultFillColor,c=e&&e.defaultStrokeColor,l=e&&e.defaultLabelColor;function u(N){return n.computeStyle(N,{strokeLinecap:"round",strokeLinejoin:"round",stroke:Yp,strokeWidth:2,fill:"white"})}function p(N){return n.computeStyle(N,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:Yp,strokeWidth:2})}function f(N,R){var{ref:_={x:0,y:0},scale:G=1,element:q,parentGfx:ee=r._svg}=R,Re=De("marker",{id:N,viewBox:"0 0 20 20",refX:_.x,refY:_.y,markerWidth:20*G,markerHeight:20*G,orient:"auto"});qe(Re,q);var Ze=St(":scope > defs",ee);Ze||(Ze=De("defs"),qe(ee,Ze)),qe(Ze,Re)}function d(N,R,_,G){var q=cM.nextPrefixed("marker-");return h(N,q,R,_,G),"url(#"+q+")"}function h(N,R,_,G,q){if(_==="sequenceflow-end"){var ee=De("path",{d:"M 1 5 L 11 10 L 1 15 Z",...u({fill:q,stroke:q,strokeWidth:1})});f(R,{element:ee,ref:{x:11,y:10},scale:.5,parentGfx:N})}if(_==="messageflow-start"){var Re=De("circle",{cx:6,cy:6,r:3.5,...u({fill:G,stroke:q,strokeWidth:1,strokeDasharray:[1e4,1]})});f(R,{element:Re,ref:{x:6,y:6},parentGfx:N})}if(_==="messageflow-end"){var Ze=De("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...u({fill:G,stroke:q,strokeWidth:1,strokeDasharray:[1e4,1]})});f(R,{element:Ze,ref:{x:8.5,y:5},parentGfx:N})}if(_==="association-start"){var ht=De("path",{d:"M 11 5 L 1 10 L 11 15",...p({fill:"none",stroke:q,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(R,{element:ht,ref:{x:1,y:10},scale:.5,parentGfx:N})}if(_==="association-end"){var Gt=De("path",{d:"M 1 5 L 11 10 L 1 15",...p({fill:"none",stroke:q,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(R,{element:Gt,ref:{x:11,y:10},scale:.5,parentGfx:N})}if(_==="conditional-flow-marker"){var _t=De("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...u({fill:G,stroke:q})});f(R,{element:_t,ref:{x:-1,y:10},scale:.5,parentGfx:N})}if(_==="conditional-default-flow-marker"){var pn=De("path",{d:"M 6 4 L 10 16",...u({stroke:q,fill:"none"})});f(R,{element:pn,ref:{x:0,y:10},scale:.5,parentGfx:N})}}function m(N,R,_,G,q={}){dn(G)&&(q=G,G=0),G=G||0,q=u(q);var ee=R/2,Re=_/2,Ze=De("circle",{cx:ee,cy:Re,r:Math.round((R+_)/4-G),...q});return qe(N,Ze),Ze}function v(N,R,_,G,q,ee){dn(q)&&(ee=q,q=0),q=q||0,ee=u(ee);var Re=De("rect",{x:q,y:q,width:R-q*2,height:_-q*2,rx:G,ry:G,...ee});return qe(N,Re),Re}function w(N,R,_,G){var q=R/2,ee=_/2,Re=[{x:q,y:0},{x:R,y:ee},{x:q,y:_},{x:0,y:ee}],Ze=Re.map(function(Gt){return Gt.x+","+Gt.y}).join(" ");G=u(G);var ht=De("polygon",{...G,points:Ze});return qe(N,ht),ht}function x(N,R,_,G){_=p(_);var q=Ha(R,_,G);return qe(N,q),q}function g(N,R,_){return x(N,R,_,5)}function y(N,R,_){_=p(_);var G=De("path",{..._,d:R});return qe(N,G),G}function S(N,R,_,G){return y(R,_,W({"data-marker":N},G))}function E(N){return ke[N]}function T(N){return function(R,_,G){return E(N)(R,_,G)}}var k={"bpmn:MessageEventDefinition":function(N,R,_={},G){var q=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:_.width||R.width,containerHeight:_.height||R.height,position:{mx:.235,my:.315}}),ee=G?_e(R,c,_.stroke):rt(R,s,_.fill),Re=G?rt(R,s,_.fill):_e(R,c,_.stroke),Ze=y(N,q,{fill:ee,stroke:Re,strokeWidth:1});return Ze},"bpmn:TimerEventDefinition":function(N,R,_={}){var G=_.width||R.width,q=_.height||R.height,ee=_.width?1:2,Re=m(N,G,q,.2*q,{fill:rt(R,s,_.fill),stroke:_e(R,c,_.stroke),strokeWidth:ee}),Ze=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:G,containerHeight:q,position:{mx:.5,my:.5}});y(N,Ze,{stroke:_e(R,c,_.stroke),strokeWidth:ee});for(var ht=0;ht<12;ht++){var Gt=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:G,containerHeight:q,position:{mx:.5,my:.5}}),_t=G/2,pn=q/2;y(N,Gt,{strokeWidth:1,stroke:_e(R,c,_.stroke),transform:"rotate("+ht*30+","+pn+","+_t+")"})}return Re},"bpmn:EscalationEventDefinition":function(N,R,_={},G){var q=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width||R.width,containerHeight:_.height||R.height,position:{mx:.5,my:.2}}),ee=G?_e(R,c,_.stroke):rt(R,s,_.fill);return y(N,q,{fill:ee,stroke:_e(R,c,_.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(N,R,_={}){var G=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width||R.width,containerHeight:_.height||R.height,position:{mx:.5,my:.222}});return y(N,G,{fill:rt(R,s,_.fill),stroke:_e(R,c,_.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(N,R,_={},G){var q=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width,containerHeight:R.height,position:{mx:.57,my:.263}}),ee=G?_e(R,c,_.stroke):rt(R,s,_.fill);return y(N,q,{fill:ee,stroke:_e(R,c,_.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(N,R,_={},G){var q=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:_.width||R.width,containerHeight:_.height||R.height,position:{mx:.2,my:.722}}),ee=G?_e(R,c,_.stroke):rt(R,s,_.fill);return y(N,q,{fill:ee,stroke:_e(R,c,_.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(N,R,_={},G){var q=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width,containerHeight:R.height,position:{mx:.638,my:-.055}}),ee=G?_e(R,c,_.stroke):"none",Re=y(N,q,{fill:ee,stroke:_e(R,c,_.stroke),strokeWidth:1});return gy(Re,45),Re},"bpmn:CompensateEventDefinition":function(N,R,_={},G){var q=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width||R.width,containerHeight:_.height||R.height,position:{mx:.22,my:.5}}),ee=G?_e(R,c,_.stroke):rt(R,s,_.fill);return y(N,q,{fill:ee,stroke:_e(R,c,_.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(N,R,_={},G){var q=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:_.width||R.width,containerHeight:_.height||R.height,position:{mx:.5,my:.2}}),ee=G?_e(R,c,_.stroke):rt(R,s,_.fill);return y(N,q,{strokeWidth:1,fill:ee,stroke:_e(R,c,_.stroke)})},"bpmn:MultipleEventDefinition":function(N,R,_={},G){var q=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:_.width||R.width,containerHeight:_.height||R.height,position:{mx:.211,my:.36}}),ee=G?_e(R,c,_.stroke):rt(R,s,_.fill);return y(N,q,{fill:ee,stroke:_e(R,c,_.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(N,R,_={}){var G=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:_.width||R.width,containerHeight:_.height||R.height,position:{mx:.458,my:.194}});return y(N,G,{fill:rt(R,s,_.fill),stroke:_e(R,c,_.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(N,R,_={}){var G=m(N,R.width,R.height,8,{fill:_e(R,c,_.stroke),stroke:_e(R,c,_.stroke),strokeWidth:4});return G}};function I(N,R,_={},G){var q=ue(N),ee=rM(q),Re=G||N;return q.get("eventDefinitions")&&q.get("eventDefinitions").length>1?q.get("parallelMultiple")?k["bpmn:ParallelMultipleEventDefinition"](R,Re,_,ee):k["bpmn:MultipleEventDefinition"](R,Re,_,ee):zi(q,"bpmn:MessageEventDefinition")?k["bpmn:MessageEventDefinition"](R,Re,_,ee):zi(q,"bpmn:TimerEventDefinition")?k["bpmn:TimerEventDefinition"](R,Re,_,ee):zi(q,"bpmn:ConditionalEventDefinition")?k["bpmn:ConditionalEventDefinition"](R,Re,_,ee):zi(q,"bpmn:SignalEventDefinition")?k["bpmn:SignalEventDefinition"](R,Re,_,ee):zi(q,"bpmn:EscalationEventDefinition")?k["bpmn:EscalationEventDefinition"](R,Re,_,ee):zi(q,"bpmn:LinkEventDefinition")?k["bpmn:LinkEventDefinition"](R,Re,_,ee):zi(q,"bpmn:ErrorEventDefinition")?k["bpmn:ErrorEventDefinition"](R,Re,_,ee):zi(q,"bpmn:CancelEventDefinition")?k["bpmn:CancelEventDefinition"](R,Re,_,ee):zi(q,"bpmn:CompensateEventDefinition")?k["bpmn:CompensateEventDefinition"](R,Re,_,ee):zi(q,"bpmn:TerminateEventDefinition")?k["bpmn:TerminateEventDefinition"](R,Re,_,ee):null}var P={ParticipantMultiplicityMarker:function(N,R,_={}){var G=fi(R,_),q=Yn(R,_),ee=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:q,position:{mx:(G/2-6)/G,my:(q-15)/q}});S("participant-multiplicity",N,ee,{strokeWidth:2,fill:rt(R,s,_.fill),stroke:_e(R,c,_.stroke)})},SubProcessMarker:function(N,R,_={}){var G=v(N,14,14,0,{strokeWidth:1,fill:rt(R,s,_.fill),stroke:_e(R,c,_.stroke)});Rn(G,R.width/2-7.5,R.height-20);var q=i.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:R.width,containerHeight:R.height,position:{mx:(R.width/2-7.5)/R.width,my:(R.height-20)/R.height}});S("sub-process",N,q,{fill:rt(R,s,_.fill),stroke:_e(R,c,_.stroke)})},ParallelMarker:function(N,R,_){var G=fi(R,_),q=Yn(R,_),ee=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:q,position:{mx:(G/2+_.parallel)/G,my:(q-20)/q}});S("parallel",N,ee,{fill:rt(R,s,_.fill),stroke:_e(R,c,_.stroke)})},SequentialMarker:function(N,R,_){var G=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width,containerHeight:R.height,position:{mx:(R.width/2+_.seq)/R.width,my:(R.height-19)/R.height}});S("sequential",N,G,{fill:rt(R,s,_.fill),stroke:_e(R,c,_.stroke)})},CompensationMarker:function(N,R,_){var G=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width,containerHeight:R.height,position:{mx:(R.width/2+_.compensation)/R.width,my:(R.height-13)/R.height}});S("compensation",N,G,{strokeWidth:1,fill:rt(R,s,_.fill),stroke:_e(R,c,_.stroke)})},LoopMarker:function(N,R,_){var G=fi(R,_),q=Yn(R,_),ee=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:q,position:{mx:(G/2+_.loop)/G,my:(q-7)/q}});S("loop",N,ee,{strokeWidth:1.5,fill:"none",stroke:_e(R,c,_.stroke),strokeMiterlimit:.5})},AdhocMarker:function(N,R,_){var G=fi(R,_),q=Yn(R,_),ee=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:q,position:{mx:(G/2+_.adhoc)/G,my:(q-15)/q}});S("adhoc",N,ee,{strokeWidth:1,fill:_e(R,c,_.stroke),stroke:_e(R,c,_.stroke)})}};function O(N,R,_,G){P[N](R,_,G)}function F(N,R,_=[],G={}){G={fill:G.fill,stroke:G.stroke,width:fi(R,G),height:Yn(R,G)};var q=ue(R),ee=_.includes("SubProcessMarker");ee?G={...G,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:G={...G,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},q.get("isForCompensation")&&_.push("CompensationMarker"),C(q,"bpmn:AdHocSubProcess")&&(_.push("AdhocMarker"),ee||W(G,{compensation:G.compensation-18}));var Re=q.get("loopCharacteristics"),Ze=Re&&Re.get("isSequential");Re&&(W(G,{compensation:G.compensation-18}),_.includes("AdhocMarker")&&W(G,{seq:-23,loop:-18,parallel:-24}),Ze===void 0&&_.push("LoopMarker"),Ze===!1&&_.push("ParallelMarker"),Ze===!0&&_.push("SequentialMarker")),_.includes("CompensationMarker")&&_.length===1&&W(G,{compensation:-8}),H(_,function(ht){O(ht,N,R,G)})}function Z(N,R,_={}){_=W({size:{width:100}},_);var G=o.createText(R||"",_);return ct(G).add("djs-label"),qe(N,G),G}function he(N,R,_,G={}){var q=ue(R),ee=Xa({x:R.x,y:R.y,width:R.width,height:R.height},G);return Z(N,q.name,{align:_,box:ee,padding:7,style:{fill:Ka(R,l,c,G.stroke)}})}function Me(N,R,_={}){var G={width:R.width,height:R.height,x:R.width/2+R.x,y:R.height/2+R.y};return Z(N,li(R),{box:G,style:W({},o.getExternalStyle(),{fill:Ka(R,l,c,_.stroke)})})}function Be(N,R,_,G={}){var q=gn(_),ee=Z(N,R,{box:{height:30,width:q?Yn(_,G):fi(_,G)},align:"center-middle",style:{fill:Ka(_,l,c,G.stroke)}});if(q){var Re=-1*Yn(_,G);Bc(ee,0,-Re,270)}}function nt(N,R,_={}){var{width:G,height:q}=Xa(R,_);return v(N,G,q,Hc,{..._,fill:rt(R,s,_.fill),fillOpacity:Zo,stroke:_e(R,c,_.stroke)})}function J(N,R,_={}){var G=ue(R),q=rt(R,s,_.fill),ee=_e(R,c,_.stroke);return(G.get("associationDirection")==="One"||G.get("associationDirection")==="Both")&&(_.markerEnd=d(N,"association-end",q,ee)),G.get("associationDirection")==="Both"&&(_.markerStart=d(N,"association-start",q,ee)),_=dt(_,["markerStart","markerEnd"]),g(N,R.waypoints,{..._,stroke:ee,strokeDasharray:"0, 5"})}function te(N,R,_={}){var G=rt(R,s,_.fill),q=_e(R,c,_.stroke),ee=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width,containerHeight:R.height,position:{mx:.474,my:.296}}),Re=y(N,ee,{fill:G,fillOpacity:Zo,stroke:q}),Ze=ue(R);if(oM(Ze)){var ht=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width,containerHeight:R.height,position:{mx:.33,my:(R.height-18)/R.height}});y(N,ht,{strokeWidth:2,fill:G,stroke:q})}return Re}function pe(N,R,_={}){return m(N,R.width,R.height,{fillOpacity:Zo,..._,fill:rt(R,s,_.fill),stroke:_e(R,c,_.stroke)})}function xe(N,R,_={}){return w(N,R.width,R.height,{fill:rt(R,s,_.fill),fillOpacity:Zo,stroke:_e(R,c,_.stroke)})}function K(N,R,_={}){var G=v(N,fi(R,_),Yn(R,_),0,{fill:rt(R,s,_.fill),fillOpacity:_.fillOpacity||Zo,stroke:_e(R,c,_.stroke),strokeWidth:1.5}),q=ue(R);if(C(q,"bpmn:Lane")){var ee=q.get("name");Be(N,ee,R,_)}return G}function V(N,R,_={}){var G=nt(N,R,_),q=at(R);if(Dn(R)&&(Se(G,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!q)){var ee=ue(R).flowElements||[],Re=ee.filter(Ze=>C(Ze,"bpmn:StartEvent"));Re.length===1&&ie(Re[0],N,_,R)}return he(N,R,q?"center-top":"center-middle",_),q?F(N,R,void 0,_):F(N,R,["SubProcessMarker"],_),G}function ie(N,R,_,G){var q=22,ee={fill:rt(G,s,_.fill),stroke:_e(G,c,_.stroke),width:q,height:q},Re=ue(N).isInterrupting,Ze=Re?0:3,ht=Re?1:1.2,Gt=20,_t=(q-Gt)/2,pn="translate("+_t+","+_t+")";m(R,Gt,Gt,{fill:ee.fill,stroke:ee.stroke,strokeWidth:ht,strokeDasharray:Ze,transform:pn}),I(N,R,ee,G)}function Te(N,R,_={}){var G=nt(N,R,_);return he(N,R,"center-middle",_),F(N,R,void 0,_),G}var ke=this.handlers={"bpmn:AdHocSubProcess":function(N,R,_={}){return at(R)?_=dt(_,["fill","stroke","width","height"]):_=dt(_,["fill","stroke"]),V(N,R,_)},"bpmn:Association":function(N,R,_={}){return _=dt(_,["fill","stroke"]),J(N,R,_)},"bpmn:BoundaryEvent":function(N,R,_={}){var{renderIcon:G=!0}=_;_=dt(_,["fill","stroke"]);var q=ue(R),ee=q.get("cancelActivity");_={strokeWidth:1.5,fill:rt(R,s,_.fill),fillOpacity:fM,stroke:_e(R,c,_.stroke)},ee||(_.strokeDasharray="6");var Re=pe(N,R,_);return m(N,R.width,R.height,jc,{..._,fill:"none"}),G&&I(R,N,_),Re},"bpmn:BusinessRuleTask":function(N,R,_={}){_=dt(_,["fill","stroke"]);var G=Te(N,R,_),q=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),ee=y(N,q);Se(ee,{fill:rt(R,s,_.fill),stroke:_e(R,c,_.stroke),strokeWidth:1});var Re=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),Ze=y(N,Re);return Se(Ze,{fill:_e(R,c,_.stroke),stroke:_e(R,c,_.stroke),strokeWidth:1}),G},"bpmn:CallActivity":function(N,R,_={}){return _=dt(_,["fill","stroke"]),V(N,R,{strokeWidth:5,..._})},"bpmn:ComplexGateway":function(N,R,_={}){_=dt(_,["fill","stroke"]);var G=xe(N,R,_),q=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:R.width,containerHeight:R.height,position:{mx:.46,my:.26}});return y(N,q,{fill:_e(R,c,_.stroke),stroke:_e(R,c,_.stroke),strokeWidth:1}),G},"bpmn:DataInput":function(N,R,_={}){_=dt(_,["fill","stroke"]);var G=i.getRawPath("DATA_ARROW"),q=te(N,R,_);return y(N,G,{fill:"none",stroke:_e(R,c,_.stroke),strokeWidth:1}),q},"bpmn:DataInputAssociation":function(N,R,_={}){return _=dt(_,["fill","stroke"]),J(N,R,{..._,markerEnd:d(N,"association-end",rt(R,s,_.fill),_e(R,c,_.stroke))})},"bpmn:DataObject":function(N,R,_={}){return _=dt(_,["fill","stroke"]),te(N,R,_)},"bpmn:DataObjectReference":T("bpmn:DataObject"),"bpmn:DataOutput":function(N,R,_={}){_=dt(_,["fill","stroke"]);var G=i.getRawPath("DATA_ARROW"),q=te(N,R,_);return y(N,G,{strokeWidth:1,fill:_e(R,c,_.stroke),stroke:_e(R,c,_.stroke)}),q},"bpmn:DataOutputAssociation":function(N,R,_={}){return _=dt(_,["fill","stroke"]),J(N,R,{..._,markerEnd:d(N,"association-end",rt(R,s,_.fill),_e(R,c,_.stroke))})},"bpmn:DataStoreReference":function(N,R,_={}){_=dt(_,["fill","stroke"]);var G=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width,containerHeight:R.height,position:{mx:0,my:.133}});return y(N,G,{fill:rt(R,s,_.fill),fillOpacity:Zo,stroke:_e(R,c,_.stroke),strokeWidth:2})},"bpmn:EndEvent":function(N,R,_={}){var{renderIcon:G=!0}=_;_=dt(_,["fill","stroke"]);var q=pe(N,R,{..._,strokeWidth:4});return G&&I(R,N,_),q},"bpmn:EventBasedGateway":function(N,R,_={}){_=dt(_,["fill","stroke"]);var G=ue(R),q=xe(N,R,_);m(N,R.width,R.height,R.height*.2,{fill:rt(R,"none",_.fill),stroke:_e(R,c,_.stroke),strokeWidth:1});var ee=G.get("eventGatewayType"),Re=!!G.get("instantiate");function Ze(){var Gt=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:R.width,containerHeight:R.height,position:{mx:.36,my:.44}});y(N,Gt,{fill:"none",stroke:_e(R,c,_.stroke),strokeWidth:2})}if(ee==="Parallel"){var ht=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:R.width,containerHeight:R.height,position:{mx:.474,my:.296}});y(N,ht,{fill:"none",stroke:_e(R,c,_.stroke),strokeWidth:1})}else ee==="Exclusive"&&(Re||m(N,R.width,R.height,R.height*.26,{fill:"none",stroke:_e(R,c,_.stroke),strokeWidth:1}),Ze());return q},"bpmn:ExclusiveGateway":function(N,R,_={}){_=dt(_,["fill","stroke"]);var G=xe(N,R,_),q=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:R.width,containerHeight:R.height,position:{mx:.32,my:.3}}),ee=pt(R);return ee.get("isMarkerVisible")&&y(N,q,{fill:_e(R,c,_.stroke),stroke:_e(R,c,_.stroke),strokeWidth:1}),G},"bpmn:Gateway":function(N,R,_={}){return _=dt(_,["fill","stroke"]),xe(N,R,_)},"bpmn:Group":function(N,R,_={}){return _=dt(_,["fill","stroke","width","height"]),v(N,R.width,R.height,Hc,{stroke:_e(R,c,_.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:fi(R,_),height:Yn(R,_)})},"bpmn:InclusiveGateway":function(N,R,_={}){_=dt(_,["fill","stroke"]);var G=xe(N,R,_);return m(N,R.width,R.height,R.height*.24,{fill:rt(R,s,_.fill),stroke:_e(R,c,_.stroke),strokeWidth:2.5}),G},"bpmn:IntermediateEvent":function(N,R,_={}){var{renderIcon:G=!0}=_;_=dt(_,["fill","stroke"]);var q=pe(N,R,{..._,strokeWidth:1.5});return m(N,R.width,R.height,jc,{fill:"none",stroke:_e(R,c,_.stroke),strokeWidth:1.5}),G&&I(R,N,_),q},"bpmn:IntermediateCatchEvent":T("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":T("bpmn:IntermediateEvent"),"bpmn:Lane":function(N,R,_={}){return _=dt(_,["fill","stroke","width","height"]),K(N,R,{..._,fillOpacity:dM})},"bpmn:ManualTask":function(N,R,_={}){_=dt(_,["fill","stroke"]);var G=Te(N,R,_),q=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return y(N,q,{fill:rt(R,s,_.fill),stroke:_e(R,c,_.stroke),strokeWidth:.5}),G},"bpmn:MessageFlow":function(N,R,_={}){_=dt(_,["fill","stroke"]);var G=ue(R),q=pt(R),ee=rt(R,s,_.fill),Re=_e(R,c,_.stroke),Ze=g(N,R.waypoints,{markerEnd:d(N,"messageflow-end",ee,Re),markerStart:d(N,"messageflow-start",ee,Re),stroke:Re,strokeDasharray:"10, 11",strokeWidth:1.5});if(G.get("messageRef")){var ht=Ze.getPointAtLength(Ze.getTotalLength()/2),Gt=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:ht.x,y:ht.y}}),_t={strokeWidth:1};q.get("messageVisibleKind")==="initiating"?(_t.fill=ee,_t.stroke=Re):(_t.fill=Re,_t.stroke=ee);var pn=y(N,Gt,_t),bn=G.get("messageRef"),xn=bn.get("name"),wt=Z(N,xn,{align:"center-top",fitBox:!0,style:{fill:Re}}),fn=pn.getBBox(),yn=wt.getBBox(),wo=ht.x-yn.width/2,ei=ht.y+fn.height/2+lM;Bc(wt,wo,ei,0)}return Ze},"bpmn:ParallelGateway":function(N,R,_={}){_=dt(_,["fill","stroke"]);var G=xe(N,R,_),q=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:R.width,containerHeight:R.height,position:{mx:.46,my:.2}});return y(N,q,{fill:_e(R,c,_.stroke),stroke:_e(R,c,_.stroke),strokeWidth:1}),G},"bpmn:Participant":function(N,R,_={}){_=dt(_,["fill","stroke","width","height"]);var G=K(N,R,_),q=at(R),ee=gn(R),Re=ue(R),Ze=Re.get("name");if(q){var ht=ee?[{x:30,y:0},{x:30,y:Yn(R,_)}]:[{x:0,y:30},{x:fi(R,_),y:30}];x(N,ht,{stroke:_e(R,c,_.stroke),strokeWidth:uM}),Be(N,Ze,R,_)}else{var Gt=Xa(R,_);ee||(Gt.height=fi(R,_),Gt.width=Yn(R,_));var _t=Z(N,Ze,{box:Gt,align:"center-middle",style:{fill:Ka(R,l,c,_.stroke)}});if(!ee){var pn=-1*Yn(R,_);Bc(_t,0,-pn,270)}}return Re.get("participantMultiplicity")&&O("ParticipantMultiplicityMarker",N,R,_),G},"bpmn:ReceiveTask":function(N,R,_={}){_=dt(_,["fill","stroke"]);var G=ue(R),q=Te(N,R,_),ee;return G.get("instantiate")?(m(N,28,28,20*.22,{fill:rt(R,s,_.fill),stroke:_e(R,c,_.stroke),strokeWidth:1}),ee=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):ee=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),y(N,ee,{fill:rt(R,s,_.fill),stroke:_e(R,c,_.stroke),strokeWidth:1}),q},"bpmn:ScriptTask":function(N,R,_={}){_=dt(_,["fill","stroke"]);var G=Te(N,R,_),q=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return y(N,q,{fill:rt(R,s,_.fill),stroke:_e(R,c,_.stroke),strokeWidth:1}),G},"bpmn:SendTask":function(N,R,_={}){_=dt(_,["fill","stroke"]);var G=Te(N,R,_),q=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return y(N,q,{fill:_e(R,c,_.stroke),stroke:rt(R,s,_.fill),strokeWidth:1}),G},"bpmn:SequenceFlow":function(N,R,_={}){_=dt(_,["fill","stroke"]);var G=rt(R,s,_.fill),q=_e(R,c,_.stroke),ee=g(N,R.waypoints,{markerEnd:d(N,"sequenceflow-end",G,q),stroke:q}),Re=ue(R),{source:Ze}=R;if(Ze){var ht=ue(Ze);Re.get("conditionExpression")&&C(ht,"bpmn:Activity")&&Se(ee,{markerStart:d(N,"conditional-flow-marker",G,q)}),ht.get("default")&&(C(ht,"bpmn:Gateway")||C(ht,"bpmn:Activity"))&&ht.get("default")===Re&&Se(ee,{markerStart:d(N,"conditional-default-flow-marker",G,q)})}return ee},"bpmn:ServiceTask":function(N,R,_={}){_=dt(_,["fill","stroke"]);var G=Te(N,R,_);m(N,10,10,{fill:rt(R,s,_.fill),stroke:"none",transform:"translate(6, 6)"});var q=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});y(N,q,{fill:rt(R,s,_.fill),stroke:_e(R,c,_.stroke),strokeWidth:1}),m(N,10,10,{fill:rt(R,s,_.fill),stroke:"none",transform:"translate(11, 10)"});var ee=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return y(N,ee,{fill:rt(R,s,_.fill),stroke:_e(R,c,_.stroke),strokeWidth:1}),G},"bpmn:StartEvent":function(N,R,_={}){var{renderIcon:G=!0}=_;_=dt(_,["fill","stroke"]);var q=ue(R);q.get("isInterrupting")||(_={..._,strokeDasharray:"6"});var ee=pe(N,R,_);return G&&I(R,N,_),ee},"bpmn:SubProcess":function(N,R,_={}){return at(R)?_=dt(_,["fill","stroke","width","height"]):_=dt(_,["fill","stroke"]),V(N,R,_)},"bpmn:Task":function(N,R,_={}){return _=dt(_,["fill","stroke"]),Te(N,R,_)},"bpmn:TextAnnotation":function(N,R,_={}){_=dt(_,["fill","stroke"]);var{width:G,height:q}=Xa(R,_),ee=v(N,G,q,0,0,{fill:"none",stroke:"none"}),Re=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:q,position:{mx:0,my:0}});y(N,Re,{stroke:_e(R,c,_.stroke)});var Ze=ue(R),ht=Ze.get("text")||"";return Z(N,ht,{align:"left-top",box:Xa(R,_),padding:Xo,style:{fill:Ka(R,l,c,_.stroke)}}),ee},"bpmn:Transaction":function(N,R,_={}){at(R)?_=dt(_,["fill","stroke","width","height"]):_=dt(_,["fill","stroke"]);var G=V(N,R,{strokeWidth:1.5,..._}),q=n.style(["no-fill","no-events"],{stroke:_e(R,c,_.stroke),strokeWidth:1.5}),ee=at(R);return ee||(_={}),v(N,fi(R,_),Yn(R,_),Hc-jc,jc,q),G},"bpmn:UserTask":function(N,R,_={}){_=dt(_,["fill","stroke"]);var G=Te(N,R,_),q=15,ee=12,Re=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:q,y:ee}});y(N,Re,{fill:rt(R,s,_.fill),stroke:_e(R,c,_.stroke),strokeWidth:.5});var Ze=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:q,y:ee}});y(N,Ze,{fill:rt(R,s,_.fill),stroke:_e(R,c,_.stroke),strokeWidth:.5});var ht=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:q,y:ee}});return y(N,ht,{fill:_e(R,c,_.stroke),stroke:_e(R,c,_.stroke),strokeWidth:.5}),G},label:function(N,R,_={}){return Me(N,R,_)}};this._drawPath=y,this._renderer=E}Ee(lo,Ji),lo.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],lo.prototype.canRender=function(e){return C(e,"bpmn:BaseElement")},lo.prototype.drawShape=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},lo.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},lo.prototype.getShapePath=function(e){return Je(e)?Kp(e,pM):C(e,"bpmn:Event")?Cy(e):C(e,"bpmn:Activity")?Kp(e,Hc):C(e,"bpmn:Gateway")?aM(e):sM(e)};function dt(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var hM=0,mM={width:150,height:50};function gM(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function yM(e){return dn(e)?W({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var Xp=null;function vM(){return Xp||(Xp=document.createElement("canvas").getContext("2d")),Xp}function bM(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(Ay(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function Ay(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function xM(e,t){var n=vM();if(!n)return{width:0,height:0};n.font=bM(t),"letterSpacing"in n&&(n.letterSpacing=Ay(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 _M(e,t,n){for(var i=e.shift(),r=i,o;;){if(o=xM(r,n),o.width=r?o.width:0,r===" "||r===""||o.width<Math.round(t)||r.length<2)return wM(e,r,i,o);r=SM(r,o.width,t)}}function wM(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 My="­";function EM(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===My)&&r.pop();break}var a=r[r.length-1];return a&&a===My&&(r[r.length-1]="-"),r.join("")}function SM(e,t,n){var i=Math.max(e.length*(n/t),1),r=EM(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function zc(e){this._config=W({},{size:mM,padding:hM,style:{},align:"center-top"},e||{})}zc.prototype.createText=function(e,t){return this.layoutText(e,t).element},zc.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},zc.prototype.layoutText=function(e,t){for(var n=W({},this._config.size,t.box),i=W({},this._config.style,t.style),r=gM(t.align||this._config.align),o=yM(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=RM(i),c=e.split(/\u00AD?\r?\n/),l=[],u=n.width-o.left-o.right;c.length;)l.push(_M(c,u,i));r.vertical==="middle"&&(o.top=o.bottom=0);var p=Wn(l,function(v,w,x){return v+(s||w.height)},0)+o.top+o.bottom,f=Wn(l,function(v,w,x){return w.width>v?w.width:v},0),d=o.top;r.vertical==="middle"&&(d+=(n.height-p)/2),d-=(s||l[0].height)/4;var h=De("text");Se(h,i),H(l,function(v){var w;switch(d+=s||v.height,r.horizontal){case"left":w=o.left;break;case"right":w=(a?f:u)-o.right-v.width;break;default:w=Math.max(((a?f:u)-v.width)/2+o.left,0)}var x=De("tspan");Se(x,{x:w,y:d}),x.textContent=v.text,qe(h,x)});var m={width:f,height:p};return{dimensions:m,element:h}};function RM(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var CM=12,AM=1.2,MM=40;function Py(e){var t=W({fontFamily:"Arial, sans-serif",fontSize:CM,fontWeight:"normal",lineHeight:AM},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=W({},t,{fontSize:n},e&&e.externalStyle||{}),r=new zc({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,co.width),height:30},l=o(s,c,{style:i});return{x:Math.round(a.x+a.width/2-l.width/2),y:a.y,width:Math.ceil(l.width),height:Math.ceil(l.height)}},this.getTextAnnotationBounds=function(a,s){var c=o(s,a,{style:t,align:"left-top",padding:Xo});return{x:a.x,y:a.y,width:a.width,height:Math.max(MM,Math.round(c.height))}},this.getDimensions=function(a,s){return r.getDimensions(a,s||{})};function o(a,s,c){return r.getDimensions(a,W({box:s},c))}this.createText=function(a,s){return r.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}Py.$inject=["config.textRenderer"];function PM(){this.pathMap={EVENT_MESSAGE:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:36,width:36,heightElements:[6,14],widthElements:[10.5,21]},EVENT_SIGNAL:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x1},0 Z",height:36,width:36,heightElements:[18],widthElements:[10,20]},EVENT_ESCALATION:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x0},-{e.y1} l -{e.x0},{e.y1} Z",height:36,width:36,heightElements:[20,7],widthElements:[8]},EVENT_CONDITIONAL:{d:"M {e.x0},{e.y0} l {e.x1},0 l 0,{e.y2} l -{e.x1},0 Z M {e.x2},{e.y3} l {e.x0},0 M {e.x2},{e.y4} l {e.x0},0 M {e.x2},{e.y5} l {e.x0},0 M {e.x2},{e.y6} l {e.x0},0 M {e.x2},{e.y7} l {e.x0},0 M {e.x2},{e.y8} l {e.x0},0 ",height:36,width:36,heightElements:[8.5,14.5,18,11.5,14.5,17.5,20.5,23.5,26.5],widthElements:[10.5,14.5,12.5]},EVENT_LINK:{d:"m {mx},{my} 0,{e.y0} -{e.x1},0 0,{e.y1} {e.x1},0 0,{e.y0} {e.x0},-{e.y2} -{e.x0},-{e.y2} z",height:36,width:36,heightElements:[4.4375,6.75,7.8125],widthElements:[9.84375,13.5]},EVENT_ERROR:{d:"m {mx},{my} {e.x0},-{e.y0} {e.x1},-{e.y1} {e.x2},{e.y2} {e.x3},-{e.y3} -{e.x4},{e.y4} -{e.x5},-{e.y5} z",height:36,width:36,heightElements:[.023,8.737,8.151,16.564,10.591,8.714],widthElements:[.085,6.672,6.97,4.273,5.337,6.636]},EVENT_CANCEL_45:{d:"m {mx},{my} -{e.x1},0 0,{e.x0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:36,width:36,heightElements:[4.75,8.5],widthElements:[4.75,8.5]},EVENT_COMPENSATION:{d:"m {mx},{my} {e.x0},-{e.y0} 0,{e.y1} z m {e.x1},-{e.y2} {e.x2},-{e.y3} 0,{e.y1} -{e.x2},-{e.y3} z",height:36,width:36,heightElements:[6.5,13,.4,6.1],widthElements:[9,9.3,8.7]},EVENT_TIMER_WH:{d:"M {mx},{my} l {e.x0},-{e.y0} m -{e.x0},{e.y0} l {e.x1},{e.y1} ",height:36,width:36,heightElements:[10,2],widthElements:[3,7]},EVENT_TIMER_LINE:{d:"M {mx},{my} m {e.x0},{e.y0} l -{e.x1},{e.y1} ",height:36,width:36,heightElements:[10,3],widthElements:[0,0]},EVENT_MULTIPLE:{d:"m {mx},{my} {e.x1},-{e.y0} {e.x1},{e.y0} -{e.x0},{e.y1} -{e.x2},0 z",height:36,width:36,heightElements:[6.28099,12.56199],widthElements:[3.1405,9.42149,12.56198]},EVENT_PARALLEL_MULTIPLE:{d:"m {mx},{my} {e.x0},0 0,{e.y1} {e.x1},0 0,{e.y0} -{e.x1},0 0,{e.y1} -{e.x0},0 0,-{e.y1} -{e.x1},0 0,-{e.y0} {e.x1},0 z",height:36,width:36,heightElements:[2.56228,7.68683],widthElements:[2.56228,7.68683]},GATEWAY_EXCLUSIVE:{d:"m {mx},{my} {e.x0},{e.y0} {e.x1},{e.y0} {e.x2},0 {e.x4},{e.y2} {e.x4},{e.y1} {e.x2},0 {e.x1},{e.y3} {e.x0},{e.y3} {e.x3},0 {e.x5},{e.y1} {e.x5},{e.y2} {e.x3},0 z",height:17.5,width:17.5,heightElements:[8.5,6.5312,-6.5312,-8.5],widthElements:[6.5,-6.5,3,-3,5,-5]},GATEWAY_PARALLEL:{d:"m {mx},{my} 0,{e.y1} -{e.x1},0 0,{e.y0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:30,width:30,heightElements:[5,12.5],widthElements:[5,12.5]},GATEWAY_EVENT_BASED:{d:"m {mx},{my} {e.x0},{e.y0} {e.x0},{e.y1} {e.x1},{e.y2} {e.x2},0 z",height:11,width:11,heightElements:[-6,6,12,-12],widthElements:[9,-3,-12]},GATEWAY_COMPLEX:{d:"m {mx},{my} 0,{e.y0} -{e.x0},-{e.y1} -{e.x1},{e.y2} {e.x0},{e.y1} -{e.x2},0 0,{e.y3} {e.x2},0 -{e.x0},{e.y1} l {e.x1},{e.y2} {e.x0},-{e.y1} 0,{e.y0} {e.x3},0 0,-{e.y0} {e.x0},{e.y1} {e.x1},-{e.y2} -{e.x0},-{e.y1} {e.x2},0 0,-{e.y3} -{e.x2},0 {e.x0},-{e.y1} -{e.x1},-{e.y2} -{e.x0},{e.y1} 0,-{e.y0} -{e.x3},0 z",height:17.125,width:17.125,heightElements:[4.875,3.4375,2.125,3],widthElements:[3.4375,2.125,4.875,3]},DATA_OBJECT_PATH:{d:"m 0,0 {e.x1},0 {e.x0},{e.y0} 0,{e.y1} -{e.x2},0 0,-{e.y2} {e.x1},0 0,{e.y0} {e.x0},0",height:61,width:51,heightElements:[10,50,60],widthElements:[10,40,50,60]},DATA_OBJECT_COLLECTION_PATH:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},DATA_ARROW:{d:"m 5,9 9,0 0,-3 5,5 -5,5 0,-3 -9,0 z",height:61,width:51,heightElements:[],widthElements:[]},DATA_STORE:{d:"m {mx},{my} l 0,{e.y2} c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 l 0,-{e.y2} c -{e.x0},-{e.y1} -{e.x1},-{e.y1} -{e.x2},0c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0",height:61,width:61,heightElements:[7,10,45],widthElements:[2,58,60]},TEXT_ANNOTATION:{d:"m {mx}, {my} m 10,0 l -10,0 l 0,{e.y0} l 10,0",height:30,width:10,heightElements:[30],widthElements:[10]},MARKER_SUB_PROCESS:{d:"m{mx},{my} m 7,2 l 0,10 m -5,-5 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_PARALLEL:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},MARKER_SEQUENTIAL:{d:"m{mx},{my} m 0,3 l 10,0 m -10,3 l 10,0 m -10,3 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_COMPENSATION:{d:"m {mx},{my} 7,-5 0,10 z m 7.1,-0.3 6.9,-4.7 0,10 -6.9,-4.7 z",height:10,width:21,heightElements:[],widthElements:[]},MARKER_LOOP:{d:"m {mx},{my} c 3.526979,0 6.386161,-2.829858 6.386161,-6.320661 0,-3.490806 -2.859182,-6.320661 -6.386161,-6.320661 -3.526978,0 -6.38616,2.829855 -6.38616,6.320661 0,1.745402 0.714797,3.325567 1.870463,4.469381 0.577834,0.571908 1.265885,1.034728 2.029916,1.35457 l -0.718163,-3.909793 m 0.718163,3.909793 -3.885211,0.802902",height:13.9,width:13.7,heightElements:[],widthElements:[]},MARKER_ADHOC:{d:"m {mx},{my} m 0.84461,2.64411 c 1.05533,-1.23780996 2.64337,-2.07882 4.29653,-1.97997996 2.05163,0.0805 3.85579,1.15803 5.76082,1.79107 1.06385,0.34139996 2.24454,0.1438 3.18759,-0.43767 0.61743,-0.33642 1.2775,-0.64078 1.7542,-1.17511 0,0.56023 0,1.12046 0,1.6807 -0.98706,0.96237996 -2.29792,1.62393996 -3.6918,1.66181996 -1.24459,0.0927 -2.46671,-0.2491 -3.59505,-0.74812 -1.35789,-0.55965 -2.75133,-1.33436996 -4.27027,-1.18121996 -1.37741,0.14601 -2.41842,1.13685996 -3.44288,1.96782996 z",height:4,width:15,heightElements:[],widthElements:[]},TASK_TYPE_SEND:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:14,width:21,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_SCRIPT:{d:"m {mx},{my} c 9.966553,-6.27276 -8.000926,-7.91932 2.968968,-14.938 l -8.802728,0 c -10.969894,7.01868 6.997585,8.66524 -2.968967,14.938 z m -7,-12 l 5,0 m -4.5,3 l 4.5,0 m -3,3 l 5,0m -4,3 l 5,0",height:15,width:12.6,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_USER_1:{d:"m {mx},{my} c 0.909,-0.845 1.594,-2.049 1.594,-3.385 0,-2.554 -1.805,-4.62199999 -4.357,-4.62199999 -2.55199998,0 -4.28799998,2.06799999 -4.28799998,4.62199999 0,1.348 0.974,2.562 1.89599998,3.405 -0.52899998,0.187 -5.669,2.097 -5.794,4.7560005 v 6.718 h 17 v -6.718 c 0,-2.2980005 -5.5279996,-4.5950005 -6.0509996,-4.7760005 zm -8,6 l 0,5.5 m 11,0 l 0,-5"},TASK_TYPE_USER_2:{d:"m {mx},{my} m 2.162,1.009 c 0,2.4470005 -2.158,4.4310005 -4.821,4.4310005 -2.66499998,0 -4.822,-1.981 -4.822,-4.4310005 "},TASK_TYPE_USER_3:{d:"m {mx},{my} m -6.9,-3.80 c 0,0 2.25099998,-2.358 4.27399998,-1.177 2.024,1.181 4.221,1.537 4.124,0.965 -0.098,-0.57 -0.117,-3.79099999 -4.191,-4.13599999 -3.57499998,0.001 -4.20799998,3.36699999 -4.20699998,4.34799999 z"},TASK_TYPE_MANUAL:{d:"m {mx},{my} c 0.234,-0.01 5.604,0.008 8.029,0.004 0.808,0 1.271,-0.172 1.417,-0.752 0.227,-0.898 -0.334,-1.314 -1.338,-1.316 -2.467,-0.01 -7.886,-0.004 -8.108,-0.004 -0.014,-0.079 0.016,-0.533 0,-0.61 0.195,-0.042 8.507,0.006 9.616,0.002 0.877,-0.007 1.35,-0.438 1.353,-1.208 0.003,-0.768 -0.479,-1.09 -1.35,-1.091 -2.968,-0.002 -9.619,-0.013 -9.619,-0.013 v -0.591 c 0,0 5.052,-0.016 7.225,-0.016 0.888,-0.002 1.354,-0.416 1.351,-1.193 -0.006,-0.761 -0.492,-1.196 -1.361,-1.196 -3.473,-0.005 -10.86,-0.003 -11.0829995,-0.003 -0.022,-0.047 -0.045,-0.094 -0.069,-0.139 0.3939995,-0.319 2.0409995,-1.626 2.4149995,-2.017 0.469,-0.4870005 0.519,-1.1650005 0.162,-1.6040005 -0.414,-0.511 -0.973,-0.5 -1.48,-0.236 -1.4609995,0.764 -6.5999995,3.6430005 -7.7329995,4.2710005 -0.9,0.499 -1.516,1.253 -1.882,2.19 -0.37000002,0.95 -0.17,2.01 -0.166,2.979 0.004,0.718 -0.27300002,1.345 -0.055,2.063 0.629,2.087 2.425,3.312 4.859,3.318 4.6179995,0.014 9.2379995,-0.139 13.8569995,-0.158 0.755,-0.004 1.171,-0.301 1.182,-1.033 0.012,-0.754 -0.423,-0.969 -1.183,-0.973 -1.778,-0.01 -5.824,-0.004 -6.04,-0.004 10e-4,-0.084 0.003,-0.586 10e-4,-0.67 z"},TASK_TYPE_INSTANTIATING_SEND:{d:"m {mx},{my} l 0,8.4 l 12.6,0 l 0,-8.4 z l 6.3,3.6 l 6.3,-3.6"},TASK_TYPE_SERVICE:{d:"m {mx},{my} v -1.71335 c 0.352326,-0.0705 0.703932,-0.17838 1.047628,-0.32133 0.344416,-0.14465 0.665822,-0.32133 0.966377,-0.52145 l 1.19431,1.18005 1.567487,-1.57688 -1.195028,-1.18014 c 0.403376,-0.61394 0.683079,-1.29908 0.825447,-2.01824 l 1.622133,-0.01 v -2.2196 l -1.636514,0.01 c -0.07333,-0.35153 -0.178319,-0.70024 -0.323564,-1.04372 -0.145244,-0.34406 -0.321407,-0.6644 -0.522735,-0.96217 l 1.131035,-1.13631 -1.583305,-1.56293 -1.129598,1.13589 c -0.614052,-0.40108 -1.302883,-0.68093 -2.022633,-0.82247 l 0.0093,-1.61852 h -2.241173 l 0.0042,1.63124 c -0.353763,0.0736 -0.705369,0.17977 -1.049785,0.32371 -0.344415,0.14437 -0.665102,0.32092 -0.9635006,0.52046 l -1.1698628,-1.15823 -1.5667691,1.5792 1.1684265,1.15669 c -0.4026573,0.61283 -0.68308,1.29797 -0.8247287,2.01713 l -1.6588041,0.003 v 2.22174 l 1.6724648,-0.006 c 0.073327,0.35077 0.1797598,0.70243 0.3242851,1.04472 0.1452428,0.34448 0.3214064,0.6644 0.5227339,0.96066 l -1.1993431,1.19723 1.5840256,1.56011 1.1964668,-1.19348 c 0.6140517,0.40346 1.3028827,0.68232 2.0233517,0.82331 l 7.19e-4,1.69892 h 2.226848 z m 0.221462,-3.9957 c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_SERVICE_FILL:{d:"m {mx},{my} c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_BUSINESS_RULE_HEADER:{d:"m {mx},{my} 0,4 20,0 0,-4 z"},TASK_TYPE_BUSINESS_RULE_MAIN:{d:"m {mx},{my} 0,12 20,0 0,-12 zm 0,8 l 20,0 m -13,-4 l 0,8"},MESSAGE_FLOW_MARKER:{d:"m {mx},{my} m -10.5 ,-7 l 0,14 l 21,0 l 0,-14 z l 10.5,6 l 10.5,-6"}},this.getRawPath=function(t){return this.pathMap[t].d},this.getScaledPath=function(t,n){var i=this.pathMap[t],r,o;n.abspos?(r=n.abspos.x,o=n.abspos.y):(r=n.containerWidth*n.position.mx,o=n.containerHeight*n.position.my);var a={};if(n.position){for(var s=n.containerHeight/i.height*n.yScaleFactor,c=n.containerWidth/i.width*n.xScaleFactor,l=0;l<i.heightElements.length;l++)a["y"+l]=i.heightElements[l]*s;for(var u=0;u<i.widthElements.length;u++)a["x"+u]=i.widthElements[u]*c}var p=DM(i.d,{mx:r,my:o,e:a});return p}}var TM=/\{([^{}]+)\}/g,kM=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function OM(e,t,n){var i=n;return t.replace(kM,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 DM(e,t){return String(e).replace(TM,function(n,i){return OM(n,i,t)})}const LM={__init__:["bpmnRenderer"],bpmnRenderer:["type",lo],textRenderer:["type",Py],pathMap:["type",PM]};function IM(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const Za={translate:["value",IM]};function Gc(e,t,n){return W({id:e.id,type:e.$type,businessObject:e,di:t},n)}function BM(e,t,n){var i=e.waypoint;return!i||i.length<2?[je(t),je(n)]:i.map(function(r){return{x:r.x,y:r.y}})}function Ty(e,t,n){return new Error(`element ${On(t)} referenced by ${On(e)}#${n} not yet drawn`)}function ir(e,t,n,i,r){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=r}ir.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],ir.prototype.add=function(e,t,n){var i,r,o;if(C(t,"bpmndi:BPMNPlane")){var a=C(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(Gc(e,t,a)),this._canvas.addRootElement(i)}else if(C(t,"bpmndi:BPMNShape")){var s=!at(e,t),c=$M(e);r=n&&(n.hidden||n.collapsed);var l=t.bounds;i=this._elementFactory.createShape(Gc(e,t,{collapsed:s,hidden:r,x:Math.round(l.x),y:Math.round(l.y),width:Math.round(l.width),height:Math.round(l.height),isFrame:c})),C(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),C(e,"bpmn:Lane")&&(o=0),C(e,"bpmn:DataStoreReference")&&(NM(n,je(l))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,o)}else if(C(t,"bpmndi:BPMNEdge")){var u=this._getSource(e),p=this._getTarget(e);r=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(Gc(e,t,{hidden:r,source:u,target:p,waypoints:BM(t,u,p)})),C(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,o)}else throw new Error(`unknown di ${On(t)} for element ${On(e)}`);return Mr(e)&&li(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},ir.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${On(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),r=i&&i.attachers;if(!i)throw Ty(e,n,"attachedToRef");t.host=i,r||(i.attachers=r=[]),r.indexOf(t)===-1&&r.push(t)},ir.prototype.addLabel=function(e,t,n){var i,r,o;return i=JA(t,n),r=li(n),r&&(i=this._textRenderer.getExternalLabelBounds(i,r)),o=this._elementFactory.createLabel(Gc(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!li(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)},ir.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?Ty(e,i,t+"Ref"):new Error(`${On(e)}#${t} Ref not specified`)},ir.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},ir.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},ir.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function NM(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 $M(e){return C(e,"bpmn:Group")}const ky={__depends__:[LM,{__depends__:[Za],bpmnImporter:["type",ir]}]};function Qa(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Mi(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Zp(e){return Math.log(e)/Math.log(10)}var FM=1e3;function ce(e){this._eventBus=e}ce.$inject=["eventBus"];function jM(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}ce.prototype.on=function(e,t,n,i,r,o){if((hn(t)||Ge(t))&&(o=r,r=i,i=n,n=t,t=null),hn(n)&&(o=r,r=i,i=n,n=FM),dn(r)&&(o=r,r=!1),!hn(i))throw new Error("handlerFn must be a function");Fe(e)||(e=[e]);var a=this._eventBus;H(e,function(s){var c=["commandStack",s,t].filter(function(l){return l}).join(".");a.on(c,n,r?jM(i,o):i,o)})},ce.prototype.canExecute=rr("canExecute"),ce.prototype.preExecute=rr("preExecute"),ce.prototype.preExecuted=rr("preExecuted"),ce.prototype.execute=rr("execute"),ce.prototype.executed=rr("executed"),ce.prototype.postExecute=rr("postExecute"),ce.prototype.postExecuted=rr("postExecuted"),ce.prototype.revert=rr("revert"),ce.prototype.reverted=rr("reverted");function rr(e){return function(n,i,r,o,a){(hn(n)||Ge(n))&&(a=o,o=r,r=i,i=n,n=null),this.on(n,e,i,r,o,a)}}var Qp=["top","bottom","left","right"],Vc=10;function Jp(e,t){ce.call(this,e),this.postExecuted(["connection.create","connection.layout","connection.updateWaypoints"],function(r){var o=r.context,a=o.connection,s=a.source,c=a.target,l=o.hints||{};l.createElementsBehavior!==!1&&(n(s),n(c))}),this.postExecuted(["label.create"],function(r){var o=r.context,a=o.shape,s=o.hints||{};s.createElementsBehavior!==!1&&n(a.labelTarget)}),this.postExecuted(["elements.create"],function(r){var o=r.context,a=o.elements,s=o.hints||{};s.createElementsBehavior!==!1&&a.forEach(function(c){n(c)})});function n(r){if(Fc(r)&&!Ct(r)){var o=GM(r);o&&i(r,o)}}function i(r,o){var a=je(r),s=r.label,c=je(s);if(s.parent){var l=Ie(r),u;switch(o){case"top":u={x:a.x,y:l.top-Vc-s.height/2};break;case"left":u={x:l.left-Vc-s.width/2,y:a.y};break;case"bottom":u={x:a.x,y:l.bottom+Vc+s.height/2};break;case"right":u={x:l.right+Vc+s.width/2,y:a.y};break}var p=Mi(u,c);t.moveShape(s,p)}}}Ee(Jp,ce),Jp.$inject=["eventBus","modeling"];function HM(e){var t=e.host,n=je(e),i=Sn(n,t),r;i.indexOf("-")>=0?r=i.split("-"):r=[i];var o=Qp.filter(function(a){return r.indexOf(a)===-1});return o}function zM(e){var t=je(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 Oy(t,i)});return n}function GM(e){var t=je(e.label),n=je(e),i=Oy(n,t);if(VM(i)){var r=zM(e);if(e.host){var o=HM(e);r=r.concat(o)}var a=Qp.filter(function(s){return r.indexOf(s)===-1});return a.indexOf(i)!==-1?Sn(e.label,e)!=="intersect"?void 0:i:a[0]}}function Oy(e,t){return Sn(t,e,5)}function VM(e){return Qp.indexOf(e)!==-1}function ef(e){ce.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,i=t.shape;t.position||(C(i,"bpmn:TextAnnotation")?t.position={x:n.x+n.width/2+75,y:n.y-50-i.height/2}:t.position={x:n.x+n.width+80+i.width/2,y:n.y+n.height/2})},!0)}Ee(ef,ce),ef.$inject=["eventBus"];var WM=1500;function tf(e,t,n){e.invoke(ce,this),this.preExecute("elements.delete",WM,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=tt(r,l=>C(l,"bpmn:Participant")||C(l,"bpmn:SubProcess"));if(!o.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(l=>C(l,"bpmn:Artifact"))),c=new Set;return H(o,l=>{const u=new Set(To(Wo(Array.from(s),Jt(l))));c=c.union(u),s=s.difference(u)}),Array.from(c)}}Ee(tf,ce),tf.$inject=["injector","eventBus","canvas"];function nf(e,t){e.invoke(ce,this),this.postExecute("shape.move",function(n){var i=n.newParent,r=n.shape,o=tt(r.incoming.concat(r.outgoing),function(a){return C(a,"bpmn:Association")});H(o,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}Ee(nf,ce),nf.$inject=["injector","modeling"];function Qo(e,t){for(Gn(t)&&(t=[t]);e=e.parent;)if(et(e,t))return e;return null}function Dy(e,t){var n=Qo(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=Qo(e,i),n)return gn(n);if(et(e,i))return gn(e);var r;for(r=ue(e);r&&!C(r,"bpmn:Process");r=r.$parent);if(!t)return!0;var o=t.find(function(a){var s=ue(a);return s&&s.get("processRef")===r});return o?gn(o):!0}var Ly=500;function Wc(e,t){t.invoke(ce,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Ly,function(i){var r=i.elements;r=r.filter(function(o){var a=o.host;return Iy(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",Ly,function(i){var r=i.shapes,o=i.newHost;if(r.length===1){var a=r[0];Iy(a,o)&&(i.shapes=[n._replaceShape(a,o)])}},!0)}Wc.$inject=["bpmnReplace","injector"],Ee(Wc,ce),Wc.prototype._replaceShape=function(e,t){var n=UM(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function UM(e){var t=ue(e),n=t.eventDefinitions;return n&&n[0]}function Iy(e,t){return!Je(e)&&et(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function rf(e,t){ce.call(this,e);function n(i){return tt(i.attachers,function(r){return C(r,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var r=i.context.source,o=i.context.target,a=n(o);C(r,"bpmn:EventBasedGateway")&&C(o,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var r=i.context.oldSource,o=i.context.newSource;C(r,"bpmn:Gateway")&&C(o,"bpmn:EventBasedGateway")&&H(o.outgoing,function(a){var s=a.target,c=n(s);C(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}rf.$inject=["eventBus","modeling"],Ee(rf,ce);function By(e){return e.create("bpmn:Category")}function qM(e){return e.create("bpmn:CategoryValue")}function Ny(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=qM(e)),n.$parent||(n.$parent=By(e)),n}function YM(e,t,n){return qt(t.get("categoryValue"),e),e.$parent=t,qt(n.get("rootElements"),t),t.$parent=n,e}function KM(e){var t=e.$parent;return t&&(Wt(t.get("categoryValue"),e),e.$parent=null),e}function XM(e){var t=e.$parent;return t&&(Wt(t.get("rootElements"),e),e.$parent=null),e}var ZM=500;function of(e,t,n){n.invoke(ce,this);function i(c){return t.filter(function(l){return C(l,"bpmn:Group")&&!l.labelTarget}).map(ue).filter(function(l){return l!==c})}function r(c,l){return i(l).some(function(u){return u.get("categoryValueRef")===c})}function o(c,l){return i(l).some(function(u){var p=u.get("categoryValueRef");return p&&p.$parent===c})}function a(c,l){c&&l&&YM(c,l,e.getDefinitions())}function s(c,l,u){l&&!o(l,u)&&XM(l),c&&!r(c,u)&&KM(c)}this.executed(["shape.create","label.create"],function(c){var l=c.labelTarget||c.shape;!C(l,"bpmn:Group")||l.labelTarget||a(c.categoryValue,c.category)},!0),this.reverted(["shape.create","label.create"],function(c){var l=c.labelTarget||c.shape;!C(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,ue(l))},!0),this.executed(["shape.move","shape.resize"],ZM,function(c){a(c.categoryValue,c.category)},!0),this.reverted(["shape.move","shape.resize"],function(c){var l=c.shape;c.categoryValue&&s(c.categoryValue,c.category,ue(l))},!0),this.executed("group.updateRefs",function(c){$y(c).forEach(function(l){a(l.categoryValue,l.category)})},!0),this.reverted("group.updateRefs",function(c){$y(c).forEach(function(l){s(l.categoryValue,l.category,ue(l.groupShape))})},!0),this.executed("shape.delete",function(c){var l=c.shape;!C(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,ue(l))},!0),this.reverted("shape.delete",function(c){var l=c.shape;!C(l,"bpmn:Group")||l.labelTarget||a(c.categoryValue,c.category)},!0)}of.$inject=["bpmnjs","elementRegistry","injector"],Ee(of,ce);function $y(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function af(e,t,n){ce.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(v){const w=v.source,x=v.target;Jo(w)&&Ja(x)&&u(x)}function r(v){const w=v.connection,x=v.source,g=v.target;Jo(x)&&Uc(g)&&(l(g),f(x,[w]))}function o(v){const w=v.newTarget,x=v.oldSource,g=v.oldTarget;if(g!==w){const y=x;Ja(g)&&u(g),Jo(y)&&Uc(w)&&l(w)}}function a(v){const{element:w}=v;Ja(w)?(p(w),d(w)):Uc(w)&&h(w)}function s(v){const{newData:w,oldShape:x}=v;if(Jo(v.oldShape)&&w.eventDefinitionType!=="bpmn:CompensateEventDefinition"||w.type!=="bpmn:BoundaryEvent"){const g=x.outgoing.find(({target:y})=>Ja(y));g&&g.target&&(v._connectionTarget=g.target)}else if(!Jo(v.oldShape)&&w.eventDefinitionType==="bpmn:CompensateEventDefinition"&&w.type==="bpmn:BoundaryEvent"){const g=x.outgoing.find(({target:y})=>Uc(y));g&&g.target&&(v._connectionTarget=g.target),m(x)}}function c(v){const{_connectionTarget:w,newShape:x}=v;w&&t.connect(x,w)}function l(v){t.updateProperties(v,{isForCompensation:!0})}function u(v){t.updateProperties(v,{isForCompensation:void 0})}function p(v){for(const w of v.incoming)n.canConnect(w.source,v)||t.removeConnection(w);for(const w of v.outgoing)n.canConnect(v,w.target)||t.removeConnection(w)}function f(v,w){v.outgoing.filter(y=>C(y,"bpmn:Association")).filter(y=>Ja(y.target)&&!w.includes(y)).forEach(y=>t.removeConnection(y))}function d(v){const w=v.attachers.slice();w.length&&t.removeElements(w)}function h(v){const w=v.incoming.filter(x=>Jo(x.source));t.removeElements(w)}function m(v){const w=v.outgoing.filter(x=>C(x,"bpmn:SequenceFlow"));t.removeElements(w)}}Ee(af,ce),af.$inject=["eventBus","modeling","bpmnRules"];function Ja(e){const t=ue(e);return t&&t.get("isForCompensation")}function Jo(e){return e&&C(e,"bpmn:BoundaryEvent")&&Ko(e,"bpmn:CompensateEventDefinition")}function Uc(e){return e&&C(e,"bpmn:Activity")&&!Dn(e)}function sf(e){e.invoke(ce,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,r=n.shape;C(i,"bpmn:Lane")&&!C(r,"bpmn:Lane")&&(n.parent=Qo(i,"bpmn:Participant"))})}sf.$inject=["injector"],Ee(sf,ce);function cf(e,t){ce.call(this,e),this.preExecute("shape.create",function(n){var a;var i=n.context,r=i.shape;if(C(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}})}cf.$inject=["eventBus","bpmnFactory"],Ee(cf,ce);var lf=20,uf=20,Fy=30,qc=2e3;function pf(e,t,n){ce.call(this,t),t.on(["create.start","shape.move.start"],qc,function(r){var o=r.context,a=o.shape,s=e.getRootElement();if(!(!C(a,"bpmn:Participant")||!C(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(p){return!C(p,"bpmn:Group")&&!Je(p)&&!Ct(p)});if(c.length){var l=Jt(c),u=QM(a,l);W(a,u),o.createConstraints=JM(a,l)}}}),t.on("create.start",qc,function(r){var o=r.context,a=o.shape,s=e.getRootElement(),c=e.getGraphics(s);function l(u){u.element=s,u.gfx=c}C(a,"bpmn:Participant")&&C(s,"bpmn:Process")&&(t.on("element.hover",qc,l),t.once("create.cleanup",function(){t.off("element.hover",l)}))});function i(){var r=e.getRootElement();return C(r,"bpmn:Collaboration")?r:n.makeCollaboration()}this.preExecute("elements.create",qc,function(r){var o=r.elements,a=r.parent,s=eP(o),c;s&&C(a,"bpmn:Process")&&(r.parent=i(),c=r.hints=r.hints||{},c.participant=s,c.process=a,c.processRef=ue(s).get("processRef"))},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;C(a,"bpmn:Participant")&&C(o,"bpmn:Process")&&(r.parent=i(),r.process=o,r.processRef=ue(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)&&ue(s).set("processRef",ue(a))},!0),this.revert("shape.create",function(r){var o=r.hints||{},a=r.process||o.process,s=r.processRef||o.processRef,c=r.shape,l=o.participant;a&&(!l||c===l)&&ue(c).set("processRef",s)},!0),this.postExecute("shape.create",function(r){var o=r.hints||{},a=r.process||r.hints.process,s=r.shape,c=o.participant;if(a){var l=a.children.slice();c?s===c&&n.moveElements(l,{x:0,y:0},c):n.moveElements(l,{x:0,y:0},s)}},!0)}pf.$inject=["canvas","eventBus","modeling"],Ee(pf,ce);function QM(e,t){t={width:t.width+lf*2+Fy,height:t.height+uf*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 JM(e,t){return t=Ie(t),{bottom:t.top+e.height/2-uf,left:t.right-e.width/2+lf,top:t.bottom-e.height/2+uf,right:t.left+e.width/2-lf-Fy}}function eP(e){return Tt(e,function(t){return C(t,"bpmn:Participant")})}var jy="__targetRef_placeholder";function ff(e,t){ce.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],Hy(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],Hy(o));function n(a,s,c){var l=a.get("dataInputAssociations");return Tt(l,function(u){return u!==c&&u.targetRef===s})}function i(a,s){var c=a.get("properties"),l=Tt(c,function(u){return u.name===jy});return!l&&s&&(l=t.create("bpmn:Property",{name:jy}),qt(c,l)),l}function r(a,s){var c=i(a);c&&(n(a,c,s)||Wt(a.get("properties"),c))}function o(a){var s=a.context,c=s.connection,l=c.businessObject,u=c.target,p=u&&u.businessObject,f=s.newTarget,d=f&&f.businessObject,h=s.oldTarget||s.target,m=h&&h.businessObject,v=c.businessObject,w;m&&m!==p&&r(m,l),d&&d!==p&&r(d,l),p?(w=i(p,!0),v.targetRef=w):v.targetRef=null}}ff.$inject=["eventBus","bpmnFactory"],Ee(ff,ce);function Hy(e){return function(t){var n=t.context,i=n.connection;if(C(i,"bpmn:DataInputAssociation"))return e(t)}}function Yc(e){this._bpmnUpdater=e}Yc.$inject=["bpmnUpdater"],Yc.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),[]},Yc.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 df(e,t,n,i){ce.call(this,i),t.registerHandler("dataStore.updateContainment",Yc);function r(){return n.filter(function(s){return C(s,"bpmn:Participant")&&ue(s).processRef})[0]}function o(s){return s.children.filter(function(c){return C(c,"bpmn:DataStoreReference")&&!c.labelTarget})}function a(s,c){var l=s.businessObject||s;if(c=c||r(),c){var u=c.businessObject||c;t.execute("dataStore.updateContainment",{dataStoreBo:l,dataStoreDi:pt(s),newSemanticParent:u.processRef||u,newDiParent:pt(c)})}}this.preExecute("shape.create",function(s){var c=s.context,l=c.shape;C(l,"bpmn:DataStoreReference")&&l.type!=="label"&&(c.hints||(c.hints={}),c.hints.autoResize=!1)}),this.preExecute("elements.move",function(s){var c=s.context,l=c.shapes,u=l.filter(function(p){return C(p,"bpmn:DataStoreReference")});u.length&&(c.hints||(c.hints={}),c.hints.autoResize=l.filter(function(p){return!C(p,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,l=c.shape,u=l.parent;C(l,"bpmn:DataStoreReference")&&l.type!=="label"&&C(u,"bpmn:Collaboration")&&a(l)}),this.postExecute("shape.move",function(s){var c=s.context,l=c.shape,u=c.oldParent,p=l.parent;if(!C(u,"bpmn:Collaboration")&&C(l,"bpmn:DataStoreReference")&&l.type!=="label"&&C(p,"bpmn:Collaboration")){var f=C(u,"bpmn:Participant")?u:nP(u,"bpmn:Participant");a(l,f)}}),this.postExecute("shape.delete",function(s){var c=s.context,l=c.shape,u=e.getRootElement();et(l,["bpmn:Participant","bpmn:SubProcess"])&&C(u,"bpmn:Collaboration")&&o(u).filter(function(p){return tP(p,l)}).forEach(function(p){a(p)})}),this.postExecute("canvas.updateRoot",function(s){var c=s.context,l=c.oldRoot,u=c.newRoot,p=o(l);p.forEach(function(f){C(u,"bpmn:Process")&&a(f,u)})})}df.$inject=["canvas","commandStack","elementRegistry","eventBus"],Ee(df,ce);function tP(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 nP(e,t){for(;e.parent;){if(C(e.parent,t))return e.parent;e=e.parent}}var Kc=Math.max,Xc=Math.min,iP=20;function zy(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function rP(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 oP(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 Zc(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return Ge(r)&&(i=(/top|left/.test(e)?Xc:Kc)(i,r)),Ge(o)&&(i=(/top|left/.test(e)?Kc:Xc)(i,o)),i}function aP(e,t){if(!t)return e;var n=Ie(e);return Dc({top:Zc("top",n,t),right:Zc("right",n,t),bottom:Zc("bottom",n,t),left:Zc("left",n,t)})}function sP(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:Xc(o.top,a.top),left:Xc(o.left,a.left),bottom:Kc(o.bottom,a.bottom),right:Kc(o.right,a.right)};return Dc(s)}function es(e,t){return typeof e<"u"?e:iP}function cP(e,t){var n,i,r,o;return typeof t=="object"?(n=es(t.left),i=es(t.right),r=es(t.top),o=es(t.bottom)):n=i=r=o=es(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function lP(e){return!(e.waypoints||e.type==="label")}function Gy(e,t){var n;if(e.length===void 0?n=tt(e.children,lP):n=e,n.length)return cP(Jt(n),t)}var Pr=Math.abs;function uP(e,t){return zy(Ie(t),Ie(e))}var pP=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],di=30;function Qc(e,t){return t=t||[],e.children.filter(function(n){C(n,"bpmn:Lane")&&(Qc(n,t),t.push(n))}),t}function Tr(e){return e.children.filter(function(t){return C(t,"bpmn:Lane")})}function hi(e){return Qo(e,pP)||e}function fP(e,t){var n=hi(e),i=C(n,"bpmn:Process")?[]:[n],r=Qc(n,i),o=Ie(e),a=Ie(t),s=uP(e,t),c=[],l=gn(e);return r.forEach(function(u){if(u!==e){var p=l?0:s.top,f=l?s.right:0,d=l?0:s.bottom,h=l?s.left:0,m=Ie(u);s.top&&(Pr(m.bottom-o.top)<10&&(d=a.top-m.bottom),Pr(m.top-o.top)<5&&(p=a.top-m.top)),s.left&&(Pr(m.right-o.left)<10&&(f=a.left-m.right),Pr(m.left-o.left)<5&&(h=a.left-m.left)),s.bottom&&(Pr(m.top-o.bottom)<10&&(p=a.bottom-m.top),Pr(m.bottom-o.bottom)<5&&(d=a.bottom-m.bottom)),s.right&&(Pr(m.left-o.right)<10&&(h=a.right-m.left),Pr(m.right-o.right)<5&&(f=a.right-m.right)),(p||f||d||h)&&c.push({shape:u,newBounds:oP(u,{top:p,right:f,bottom:d,left:h})})}}),c}var dP=500;function hf(e,t){ce.call(this,e);function n(i,r){var o=gn(i),a=Tr(r),s=[],c=[],l=[],u=[];if(ao(a,function(v){return o?v.y>i.y?c.push(v):s.push(v):v.x>i.x?u.push(v):l.push(v),v.children}),!!a.length){var p;o?c.length&&s.length?p=i.height/2:p=i.height:u.length&&l.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")),l.length&&(h=t.calculateAdjustments(l,"x",p,i.x-10),t.makeSpace(h.movingShapes,h.resizingShapes,{x:p,y:0},"e")),u.length&&(m=t.calculateAdjustments(u,"x",-p,i.x+i.width+10),t.makeSpace(m.movingShapes,m.resizingShapes,{x:-p,y:0},"w"))}}this.postExecuted("shape.delete",dP,function(i){var r=i.context,o=r.hints,a=r.shape,s=r.oldParent;C(a,"bpmn:Lane")&&(o&&o.nested||n(a,s))})}hf.$inject=["eventBus","spaceTool"],Ee(hf,ce);var Vy=500;function Jc(e,t){t.invoke(ce,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Vy,function(i){var r=i.elements;r.filter(function(o){var a=o.host;return Wy(o,a)}).map(function(o){return r.indexOf(o)}).forEach(function(o){i.elements[o]=n._replaceShape(r[o])})},!0),this.preExecute("elements.move",Vy,function(i){var r=i.shapes,o=i.newHost;r.forEach(function(a,s){var c=a.host;Wy(a,mP(r,c)?c:o)&&(r[s]=n._replaceShape(a))})},!0)}Jc.$inject=["bpmnReplace","injector"],Ee(Jc,ce),Jc.prototype._replaceShape=function(e){var t=hP(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function hP(e){var t=ue(e),n=t.eventDefinitions;return n&&n[0]}function Wy(e,t){return!Je(e)&&C(e,"bpmn:BoundaryEvent")&&!t}function mP(e,t){return e.indexOf(t)!==-1}var el=Math.round,gP=Math.max;function yP(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 vP(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var Uy=10;function bP(e,t){var n,i;for(n=0;i=e[n];n++)if(Va(i,t)<=Uy)return{point:e[n],bendpoint:!0,index:n};return null}function xP(e,t){var n=Zg(yP(t,Uy),vP(e)),i=n[0],r=n[n.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=gP(i.segment2,r.segment2)-1,{point:e[o],bendpoint:!0,index:o}):{point:{x:el(i.x+r.x)/2,y:el(i.y+r.y)/2},index:i.segment2}:{point:{x:el(i.x),y:el(i.y)},index:i.segment2}:null}function mf(e,t){return bP(e,t)||xP(e,t)}function gf(e,t,n){ce.call(this,e);function i(r,o,a){var s=o.waypoints,c,l,u,p,f,d,h,m=r.outgoing.slice(),v=r.incoming.slice(),w;Ge(a.width)?w=je(a):w=a;var x=mf(s,w);if(x){if(c=s.slice(0,x.index),l=s.slice(x.index+(x.bendpoint?1:0)),!c.length||!l.length)return;u=x.bendpoint?s[x.index]:w,(c.length===1||!qy(r,c[c.length-1]))&&c.push(Yy(u)),(l.length===1||!qy(r,l[0]))&&l.unshift(Yy(u))}p=o.source,f=o.target,t.canConnect(p,r,o)&&(n.reconnectEnd(o,r,c||w),d=o),t.canConnect(r,f,o)&&(d?h=n.connect(r,f,{type:o.type,waypoints:l}):(n.reconnectStart(o,r,l||w),h=o));var g=[].concat(d&&tt(v,function(y){return y.source===d.source})||[],h&&tt(m,function(y){return y.target===h.target})||[]);g.length&&n.removeElements(g)}this.preExecute("elements.move",function(r){var o=r.newParent,a=r.shapes,s=r.delta,c=a[0];if(!(!c||!o)){o&&o.waypoints&&(r.newParent=o=o.parent);var l=je(c),u={x:l.x+s.x,y:l.y+s.y},p=Tt(o.children,function(f){var d=t.canInsert(a,f);return d&&mf(f.waypoints,u)});p&&(r.targetFlow=p,r.position=u)}},!0),this.postExecuted("elements.move",function(r){var o=r.shapes,a=r.targetFlow,s=r.position;a&&i(o[0],a,s)},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;t.canInsert(a,o)&&(r.targetFlow=o,r.parent=o.parent)},!0),this.postExecuted("shape.create",function(r){var o=r.shape,a=r.targetFlow,s=r.position;a&&i(o,a,s)},!0)}Ee(gf,ce),gf.$inject=["eventBus","bpmnRules","modeling"];function qy(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 Yy(e){return W({},e)}function yf(e,t){ce.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)&&ea(r)){var c=[];C(o,"bpmn:EventBasedGateway")?c=a.incoming.filter(l=>l!==r&&ea(l)):c=a.incoming.filter(l=>l!==r&&ea(l)&&C(l.source,"bpmn:EventBasedGateway")),c.forEach(function(l){t.removeConnection(l)})}}),this.preExecuted("shape.replace",function(n){var i=n.context,r=i.newShape;if(C(r,"bpmn:EventBasedGateway")){var o=r.outgoing.filter(ea).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);o.forEach(function(a){a.incoming.filter(ea).forEach(function(s){const c=a.incoming.filter(ea).filter(function(l){return l.source===r});(s.source!==r||c.length>1)&&t.removeConnection(s)})})}})}yf.$inject=["eventBus","modeling"],Ee(yf,ce);function ea(e){return C(e,"bpmn:SequenceFlow")}var tl=1500,Ky=2e3;function Xy(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"],tl,function(i){var r=i.context,o=r.shape||i.shape,a=i.hover;C(a,"bpmn:Lane")&&!et(o,["bpmn:Lane","bpmn:Participant"])&&(i.hover=hi(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(o.labelTarget||et(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"],tl,function(i){var r=i.hover;C(r,"bpmn:Lane")&&(i.hover=hi(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],tl,function(i){var r=i.context,o=i.hover,a=r.type;C(o,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=hi(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],tl,function(i){var r=i.context,o=r.start;C(o,"bpmn:Lane")&&(r.start=hi(o)||o)}),t.on("shape.move.start",Ky,function(i){var r=i.shape;C(r,"bpmn:Lane")&&(i.shape=hi(r)||r)}),t.on("spaceTool.move",Ky,function(i){var r=i.hover;r&&C(r,"bpmn:Lane")&&(i.hover=hi(r))})}Xy.$inject=["elementRegistry","eventBus","canvas"];var Zy=770;function vf(e,t,n,i){n.invoke(ce,this);function r(s,c){var l=ue(s),u=c.categoryValue||l.categoryValueRef;u||(u=Ny(e,l));var p=c.category||u.$parent||By(e);l.categoryValueRef=u,u.$parent=p,c.categoryValue=u,c.category=p}function o(s,c){var l=ue(s),u=c.categoryValue||l.categoryValueRef,p=c.category||u&&u.$parent;u&&(c.categoryValue=u,c.category=p,l.categoryValueRef=null)}this.execute("label.create",function(s){var c=s.context,l=c.labelTarget;C(l,"bpmn:Group")&&r(l,c)}),this.revert("label.create",function(s){var c=s.context,l=c.labelTarget;C(l,"bpmn:Group")&&o(l,c)}),this.execute("shape.delete",function(s){var c=s.context,l=c.shape,u=ue(l);if(!(!C(l,"bpmn:Group")||l.labelTarget)){var p=c.categoryValue=u.categoryValueRef;p&&(c.category=p.$parent,u.categoryValueRef=null)}}),this.reverted("shape.delete",function(s){var c=s.context,l=c.shape;if(!(!C(l,"bpmn:Group")||l.labelTarget)){var u=c.category,p=c.categoryValue,f=ue(l);p&&(f.categoryValueRef=p,p.$parent=u)}}),this.execute("shape.create",function(s){var c=s.context,l=c.shape,u=c.hints||{};!C(l,"bpmn:Group")||l.labelTarget||u.createElementsBehavior===!1&&!ue(l).categoryValueRef&&!c.categoryValue||r(l,c)}),this.reverted("shape.create",function(s){var c=s.context,l=c.shape,u=c.hints||{};!C(l,"bpmn:Group")||l.labelTarget||u.createElementsBehavior===!1&&!ue(l).categoryValueRef&&!c.categoryValue||o(l,c)}),this.executed(["shape.move","shape.resize"],function(s){var c=s.context,l=c.shape;!C(l,"bpmn:Group")||l.labelTarget||ue(l).categoryValueRef||r(l,c)}),this.reverted(["shape.move","shape.resize"],function(s){var c=s.context,l=c.shape;!C(l,"bpmn:Group")||l.labelTarget||!c.categoryValue||o(l,c)});function a(s,c){var l=e.create(s.$type);return i.copyElement(s,l,null,c)}t.on("copyPaste.copyElement",Zy,function(s){var c=s.descriptor,l=s.element;if(!(!C(l,"bpmn:Group")||l.labelTarget)){var u=ue(l);if(u.categoryValueRef){var p=u.categoryValueRef;c.categoryValue=a(p,!0),p.$parent&&(c.category=a(p.$parent,!0))}}}),t.on("copyPaste.pasteElement",Zy,function(s){var c=s.descriptor,l=c.businessObject,u=c.categoryValue,p=c.category;u&&(u=l.categoryValueRef=a(u)),p&&(u.$parent=a(p)),delete c.category,delete c.categoryValue})}vf.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],Ee(vf,ce);function bf(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 Qy(e){function t(i,r,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=bf(i,r,o,a),l=bf(i,r,o,s),u;c&&l?Jy(c,o)>Jy(l,o)?u=l:u=c:u=c||l,i.original=u}function n(i){var r=i.waypoints;t(r[0],r[1],je(i.source)),t(r[r.length-1],r[r.length-2],je(i.target))}e.on("bpmnElement.added",function(i){var r=i.element;r.waypoints&&n(r)})}Qy.$inject=["eventBus"];function Jy(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function xf(e){ce.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=ue(i),o=pt(i);if(et(r,t)){var a=o.get("isHorizontal");a===void 0&&(a=!0),o.set("isHorizontal",a)}})}xf.$inject=["eventBus"],Ee(xf,ce);function ev(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function tv(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function _P(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 wP(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 _f(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=wP([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 nv(e,t){var n=_f(e,t),i={x:n.x-e.x,y:n.y-e.y};return ev(i)}function ts(e,t){return ev({x:e.x-t.x,y:e.y-t.y})}var iv=Math.sqrt,rv=Math.min,EP=Math.max,ov=Math.abs;function av(e){return Math.pow(e,2)}function ns(e,t){return iv(av(e.x-t.x)+av(e.y-t.y))}function SP(e,t){var n=0,i,r,o,a,s,c,l,u,p,f,d;for(n=0;n<t.length-1;n++){if(i=t[n],r=t[n+1],cv(i,r)?l=[i]:(o=ns(e,i),a=ns(e,r),c=rv(o,a),l=RP(i,r,e,c)),l.length<1)throw new Error("expected between [1, 2] circle -> line intersections");l.length===1&&(u={type:"bendpoint",position:l[0],segmentIndex:n,bendpointIndex:cv(i,l[0])?n:n+1}),l.length===2&&(s=AP(l[0],l[1]),u={type:"segment",position:s,segmentIndex:n,relativeLocation:ns(i,s)/ns(i,r)}),p=ns(u.position,e),(!d||f>p)&&(d=u,f=p)}return d}function RP(e,t,n,i){var r=t.x-e.x,o=t.y-e.y,a=n.x-e.x,s=n.y-e.y,c=r*r+o*o,l=r*a+o*s,u=a*a+s*s-i*i,p=l/c,f=u/c,d=p*p-f;if(d<0&&d>-1e-6&&(d=0),d<0)return[];var h=iv(d),m=-p+h,v=-p-h,w={x:e.x-r*m,y:e.y-o*m};if(d===0)return[w];var x={x:e.x-r*v,y:e.y-o*v};return[w,x].filter(function(g){return CP(g,e,t)})}function CP(e,t,n){return sv(e.x,t.x,n.x)&&sv(e.y,t.y,n.y)}function sv(e,t,n){return e>=rv(t,n)-nl&&e<=EP(t,n)+nl}function AP(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var nl=.1;function cv(e,t){return ov(e.x-t.x)<=nl&&ov(e.y-t.y)<=nl}function MP(e,t,n,i){var r=n.segmentIndex,o=t.length-e.length;if(i.segmentMove){var a=i.segmentMove.segmentStartIndex,s=i.segmentMove.newSegmentStartIndex;return r===a?s:r>=s?r+o<s?s:r+o:r}if(i.bendpointMove){var c=i.bendpointMove.insert,l=i.bendpointMove.bendpointIndex,u;if(o===0)return r;if(r>=l&&(u=c?r+1:r-1),r<l&&(u=r,c&&n.type!=="bendpoint"&&l-1===r)){var p=uv(t,l);p<n.relativeLocation&&u++}return u}return o===0?r:i.connectionStart&&r===0?0:i.connectionEnd&&r===e.length-2?t.length-2:Math.floor((t.length-2)/2)}function lv(e,t,n,i){var r=0,o=0,a={point:e,delta:{x:0,y:0}},s=SP(e,n),c=s.segmentIndex,l=MP(n,t,s,i);if(l<0||l>t.length-2||l===null)return a;var u=pv(n,c),p=pv(t,l),f=s.position,d=TP(u,f),h=PP(u,p);if(s.type==="bendpoint"){var m=t.length-n.length,v=s.bendpointIndex,w=n[v];if(t.indexOf(w)!==-1)return a;if(m===0){var x=t[v];return r=x.x-s.position.x,o=x.y-s.position.y,{delta:{x:r,y:o},point:{x:e.x+r,y:e.y+o}}}m<0&&v!==0&&v<n.length-1&&(d=uv(n,v))}var g={x:(p[1].x-p[0].x)*d+p[0].x,y:(p[1].y-p[0].y)*d+p[0].y},y=_P({x:e.x-f.x,y:e.y-f.y},h);return r=g.x+y.x-e.x,o=g.y+y.y-e.y,{point:tr(g),delta:tr({x:r,y:o})}}function uv(e,t){var n=ts(e[t-1],e[t]),i=ts(e[t],e[t+1]),r=n/(n+i);return r}function PP(e,t){var n=tv(e),i=tv(t);return i-n}function pv(e,t){return[e[t],e[t+1]]}function TP(e,t){var n=ts(e[0],e[1]),i=ts(e[0],t);return n===0?0:i/n}function kP(e,t,n,i){var r=je(e);return lv(r,t,n,i).delta}function is(e,t,n){var i=Qa(t),r=Qa(n),o=Mi(e,i),a={x:o.x*(n.width/t.width),y:o.y*(n.height/t.height)};return tr({x:r.x+a.x,y:r.y+a.y})}function fv(e,t,n){var i=Qa(e),r=Qa(t),o=Qa(n),a=Mi(e,i),s=Mi(i,r),c=OP(i,t,n);if(c)return c;var l={x:s.x*(n.width/t.width),y:s.y*(n.height/t.height)},u={x:o.x+l.x,y:o.y+l.y};return tr({x:u.x+a.x-e.x,y:u.y+a.y-e.y})}function OP(e,t,n){var i=Ie(t),r=Ie(n);if(DP(i,r))return null;var o=Sn(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=Sn(n,s),c!==o?null:a}function DP(e,t){return LP(e,t)||IP(e,t)}function LP(e,t){return e.right!==t.right&&e.left!==t.left}function IP(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var dv="name",hv="text";function wf(e,t,n,i){ce.call(this,e),this.postExecute("element.updateProperties",r),this.postExecute("element.updateModdleProperties",a=>{ue(a.context.element)===a.context.moddleElement&&r(a)});function r(a){var s=a.context,c=s.element,l=s.properties;if(dv in l&&t.updateLabel(c,l[dv]),hv in l&&C(c,"bpmn:TextAnnotation")){var u=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},l[hv]||"");t.updateLabel(c,l.text,u)}}this.postExecute(["shape.create","connection.create"],function(a){var s=a.context,c=s.hints||{};if(c.createElementsBehavior!==!1){var l=s.shape||s.connection;Je(l)||!Mr(l)||li(l)&&t.updateLabel(l,li(l))}}),this.postExecute("shape.delete",function(a){var s=a.context,c=s.labelTarget,l=s.hints||{};c&&l.unsetLabel!==!1&&t.updateLabel(c,null,null,{removeShape:!1})});function o(a){var s=a.context,c=s.connection,l=c.label,u=W({},s.hints),p=s.newWaypoints||c.waypoints,f=s.oldWaypoints;return typeof u.startChanged>"u"&&(u.startChanged=!!u.connectionStart),typeof u.endChanged>"u"&&(u.endChanged=!!u.connectionEnd),kP(l,p,f,u)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(a){var s=a.context,c=s.hints||{};if(c.labelBehavior!==!1){var l=s.connection,u=l.label,p;!u||!u.parent||(p=o(a),t.moveShape(u,p))}}),this.postExecute(["shape.replace"],function(a){var s=a.context,c=s.newShape,l=s.oldShape,u=ue(c);u&&Mr(u)&&l.label&&c.label&&(c.label.x=l.label.x,c.label.y=l.label.y)}),this.preExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.hints||{};if(!(!Je(c)||l.autoResize)){var u=s.newBounds,p=i.getDimensions(li(c)||"",{box:u,style:i.getExternalStyle()}),f=Math.ceil(p.height),d=u.y!==c.y,h=c.y+c.height;s.newBounds={width:u.width,height:f,x:u.x,y:d?h-f:u.y}}}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.newBounds,u=s.oldBounds;if(Fc(c)){var p=c.label,f=je(p),d=$P(u),h=NP(f,d),m=BP(h,u,l);t.moveShape(p,m)}})}Ee(wf,ce),wf.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function BP(e,t,n){var i=is(e,t,n);return tr(Mi(i,e))}function NP(e,t){if(t.length){var n=FP(e,t);return _f(e,n)}}function $P(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 FP(e,t){var n=t.map(function(r){return{line:r,distance:nv(e,r)}}),i=Oi(n,"distance");return i[0].line}function jP(e,t,n,i){return lv(e,t,n,i).point}function Ef(e,t){ce.call(this,e);function n(i,r){var o=i.context,a=o.connection,s=W({},o.hints),c=o.newWaypoints||a.waypoints,l=o.oldWaypoints;return typeof s.startChanged>"u"&&(s.startChanged=!!s.connectionStart),typeof s.endChanged>"u"&&(s.endChanged=!!s.connectionEnd),jP(r,c,l,s)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(i){var r=i.context,o=r.connection,a=o.outgoing,s=o.incoming;s.forEach(function(c){var l=c.waypoints[c.waypoints.length-1],u=n(i,l),p=[].concat(c.waypoints.slice(0,-1),[u]);t.updateWaypoints(c,p)}),a.forEach(function(c){var l=c.waypoints[0],u=n(i,l),p=[].concat([u],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(l){var u=l.waypoints[l.waypoints.length-1],p={x:u.x+c.x,y:u.y+c.y},f=[].concat(l.waypoints.slice(0,-1),[p]);t.updateWaypoints(l,f)}),a.forEach(function(l){var u=l.waypoints[0],p={x:u.x+c.x,y:u.y+c.y},f=[].concat([p],l.waypoints.slice(1));t.updateWaypoints(l,f)})})}Ee(Ef,ce),Ef.$inject=["eventBus","modeling"];function il(e,t,n){var i=ol(e),r=gv(i,t),o=i[0];return r.length?r[r.length-1]:is(o.original||o,n,t)}function rl(e,t,n){var i=ol(e),r=gv(i,t),o=i[i.length-1];return r.length?r[0]:is(o.original||o,n,t)}function Sf(e,t,n){var i=ol(e),r=mv(t,n),o=i[0];return is(o.original||o,r,t)}function Rf(e,t,n){var i=ol(e),r=mv(t,n),o=i[i.length-1];return is(o.original||o,r,t)}function mv(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function ol(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function gv(e,t){var n=Mn(e,zP);return tt(n,function(i){return HP(i,t)})}function HP(e,t){return Sn(t,e,1)==="intersect"}function zP(e){return e.original||e}function Cf(e,t){ce.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,r=n.newShape;if(GP(i,r)){var o=VP(i);o.incoming.forEach(function(a){var s=rl(a,r,i);t.reconnectEnd(a,r,s)}),o.outgoing.forEach(function(a){var s=il(a,r,i);t.reconnectStart(a,r,s)})}},!0)}Cf.$inject=["eventBus","modeling"],Ee(Cf,ce);function GP(e,t){return C(e,"bpmn:Participant")&&at(e)&&C(t,"bpmn:Participant")&&!at(t)}function VP(e){var t=za([e]),n=[],i=[];return t.forEach(function(r){r!==e&&(r.incoming.forEach(function(o){C(o,"bpmn:MessageFlow")&&n.push(o)}),r.outgoing.forEach(function(o){C(o,"bpmn:MessageFlow")&&i.push(o)}))},[]),{incoming:n,outgoing:i}}const WP=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function yv(e){const t=ue(e);if(!C(t,"bpmn:BoundaryEvent")&&!(C(t,"bpmn:StartEvent")&&Dn(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:WP.some(i=>C(n[0],i))}function vv(e){return C(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function Af(e,t){e.invoke(ce,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,r=n.context.newShape,o=n.context.hints;if(!yv(r))return;const a=vv(r);if(o.targetElement&&o.targetElement[a]!==void 0)return;const c=ue(i).get(a),l=ue(r).get(a);c!==l&&t.updateProperties(r,{[a]:c})})}Af.$inject=["injector","modeling"],Ee(Af,ce);function Mf(e,t){ce.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,r=pt(i),o=r&&r.get("label"),a=o&&o.get("bounds");a&&t.updateModdleProperties(i,o,{bounds:void 0})},!0)}Ee(Mf,ce),Mf.$inject=["eventBus","modeling"];function Pf(e,t,n){ce.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(!(!C(o,"bpmn:SequenceFlow")||!C(a,"bpmn:SequenceFlow"))&&t.canConnect(o.source,a.target,o)){var s=UP(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}Ee(Pf,ce),Pf.$inject=["eventBus","bpmnRules","modeling"];function ta(e){return e.original||e}function UP(e,t){var n=bf(ta(e[e.length-2]),ta(e[e.length-1]),ta(t[1]),ta(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[ta(e[0]),ta(t[t.length-1])]}function Tf(e,t){ce.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,r=i.parent;C(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)}Tf.$inject=["eventBus","modeling"],Ee(Tf,ce);function kf(e,t,n,i){ce.call(this,e);var r=i.get("dragging",!1);function o(c){var l=c.source,u=c.target,p=c.parent;if(p){var f,d;C(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(l,u)||(d=!0),n.canConnectMessageFlow(l,u)&&(f="bpmn:MessageFlow")),C(c,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(l,u)||(d=!0),n.canConnectSequenceFlow(l,u)&&(f="bpmn:SequenceFlow")),d&&t.removeConnection(c),f&&t.connect(l,u,{type:f,waypoints:c.waypoints.slice()})}}function a(c){var l=c.context,u=l.connection,p=l.newSource||u.source,f=l.newTarget||u.target,d,h;d=n.canConnect(p,f),!(!d||d.type===u.type)&&(h=t.connect(p,f,{type:d.type,associationDirection:d.associationDirection,waypoints:u.waypoints.slice()}),u.parent&&t.removeConnection(u),l.connection=h,r&&s(u,h))}function s(c,l){var u=r.context(),p=u&&u.payload.previousSelection,f;!p||!p.length||(f=p.indexOf(c),f!==-1&&p.splice(f,1,l))}this.postExecuted("elements.move",function(c){var l=c.closure,u=l.allConnections;H(u,o)},!0),this.preExecute("connection.reconnect",a),this.postExecuted("element.updateProperties",function(c){var l=c.context,u=l.properties,p=l.element,f=p.businessObject,d;u.default&&(d=Tt(p.outgoing,Oo({id:p.businessObject.default.id})),d&&t.updateProperties(d,{conditionExpression:void 0})),u.conditionExpression&&f.sourceRef.default===f&&t.updateProperties(p.source,{default:void 0})})}Ee(kf,ce),kf.$inject=["eventBus","modeling","bpmnRules","injector"];function al(e,t,n,i,r,o){i.invoke(ce,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=o,this.postExecuted(["elements.create"],500,function(a){var s=a.context,c=s.parent,l=s.elements,u=Wn(l,function(p,f){var d=t.canReplace([f],f.host||f.parent||c);return d?p.concat(d.replacements):p},[]);u.length&&this._replaceElements(l,u)},this),this.postExecuted(["elements.move"],500,function(a){var s=a.context,c=s.newParent,l=s.newHost,u=[];H(s.closure.topLevel,function(f){Dn(f)?u=u.concat(f.children):u=u.concat(f)}),u.length===1&&l&&(c=l);var p=t.canReplace(u,c);p&&this._replaceElements(u,p.replacements,l)},this),this.postExecute(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,l=s.newShape,u=c.attachers,p;u&&u.length&&(p=t.canReplace(u,l),this._replaceElements(u,p.replacements))},this),this.postExecuted(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,l=s.newShape;r.unclaimId(c.businessObject.id,c.businessObject),r.updateProperties(l,{id:c.id})})}Ee(al,ce),al.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,r=this._selection;H(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)},al.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var qP=1500,YP={width:140,height:120},Of={width:300,height:60},Df={width:60,height:300},sl={width:300,height:150},cl={width:150,height:300},bv={width:140,height:120},xv={width:100,height:40};function _v(e){e.on("resize.start",qP,function(t){var n=t.context,i=n.shape,r=n.direction,o=n.balanced;(C(i,"bpmn:Lane")||C(i,"bpmn:Participant"))&&(n.resizeConstraints=JP(i,r,o)),C(i,"bpmn:SubProcess")&&at(i)&&(n.minDimensions=bv),C(i,"bpmn:TextAnnotation")&&(n.minDimensions=xv)})}_v.$inject=["eventBus"];var kr=Math.abs,KP=Math.min,XP=Math.max;function wv(e,t,n,i){var r=e[t];e[t]=r===void 0?n:i(n,r)}function na(e,t,n){return wv(e,t,n,KP)}function ia(e,t,n){return wv(e,t,n,XP)}var ZP={top:20,left:50,right:20,bottom:20},QP={top:50,left:20,right:20,bottom:20};function JP(e,t,n){var i=hi(e),r=!0,o=!0,a=Qc(i,[i]),s=Ie(e),c={},l={},u=gn(e),p=u?Of:Df;/n/.test(t)?l.top=s.bottom-p.height:/e/.test(t)?l.right=s.left+p.width:/s/.test(t)?l.bottom=s.top+p.height:/w/.test(t)&&(l.left=s.right-p.width),a.forEach(function(h){var m=Ie(h);u?(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&&kr(s.top-m.bottom)<10&&ia(c,"top",m.top+p.height),kr(s.top-m.top)<5&&na(l,"top",m.bottom-p.height)),/e/.test(t)&&(n&&kr(s.right-m.left)<10&&na(c,"right",m.right-p.width),kr(s.right-m.right)<5&&ia(l,"right",m.left+p.width)),/s/.test(t)&&(n&&kr(s.bottom-m.top)<10&&na(c,"bottom",m.bottom-p.height),kr(s.bottom-m.bottom)<5&&ia(l,"bottom",m.top+p.height)),/w/.test(t)&&(n&&kr(s.left-m.right)<10&&ia(c,"left",m.left+p.width),kr(s.left-m.left)<5&&na(l,"left",m.right-p.width))});var f=i.children.filter(function(h){return!h.hidden&&!h.waypoints&&(C(h,"bpmn:FlowElement")||C(h,"bpmn:Artifact"))}),d=u?ZP:QP;return f.forEach(function(h){var m=Ie(h);/n/.test(t)&&(!u||r)&&na(l,"top",m.top-d.top),/e/.test(t)&&(u||o)&&ia(l,"right",m.right+d.right),/s/.test(t)&&(!u||o)&&ia(l,"bottom",m.bottom+d.bottom),/w/.test(t)&&(u||r)&&na(l,"left",m.left-d.left)}),{min:l,max:c}}function Ev(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function ra(e){return e.originalEvent||e.srcEvent}function Lf(e){Ev(e),Ev(ra(e))}function uo(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 Sv(){return/mac/i.test(navigator.platform)}function Rv(e,t){return(ra(e)||e).button===t}function Or(e){return Rv(e,0)}function eT(e){return Rv(e,1)}function rs(e){var t=ra(e)||e;return Or(e)?Sv()?t.metaKey:t.ctrlKey:!1}function ll(e){var t=ra(e)||e;return Or(e)&&t.shiftKey}var Cv=1001;function Av(e,t){e.on("resize.start",Cv+500,function(n){var i=n.context,r=i.shape;(C(r,"bpmn:Lane")||C(r,"bpmn:Participant"))&&(i.balanced=!rs(n))}),e.on("resize.end",Cv,function(n){var i=n.context,r=i.shape,o=i.canExecute,a=i.newBounds;if(C(r,"bpmn:Lane")||C(r,"bpmn:Participant"))return o&&(a=ny(a),t.resizeLane(r,a,i.balanced)),!1})}Av.$inject=["eventBus","modeling"];var tT=500;function If(e,t,n,i,r){n.invoke(ce,this);function o(u){return et(u,["bpmn:ReceiveTask","bpmn:SendTask"])||nT(u,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(u){var p=e.getDefinitions(),f=p.get("rootElements");return!!Tt(f,Oo({id:u.id}))}function s(u){if(C(u,"bpmn:ErrorEventDefinition"))return"errorRef";if(C(u,"bpmn:EscalationEventDefinition"))return"escalationRef";if(C(u,"bpmn:MessageEventDefinition"))return"messageRef";if(C(u,"bpmn:SignalEventDefinition"))return"signalRef"}function c(u){if(et(u,["bpmn:ReceiveTask","bpmn:SendTask"]))return u.get("messageRef");var p=u.get("eventDefinitions"),f=p[0];return f.get(s(f))}function l(u,p){if(et(u,["bpmn:ReceiveTask","bpmn:SendTask"]))return u.set("messageRef",p);var f=u.get("eventDefinitions"),d=f[0];return d.set(s(d),p)}this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],function(u){var p=u.shape||u.element;if(o(p)){var f=ue(p),d=c(f),h;d&&!a(d)&&(h=e.getDefinitions().get("rootElements"),qt(h,d),u.addedRootElement=d)}},!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],function(u){var p=u.addedRootElement;if(p){var f=e.getDefinitions().get("rootElements");Wt(f,p)}},!0),t.on("copyPaste.copyElement",function(u){var p=u.descriptor,f=u.element;if(!(f.labelTarget||!o(f))){var d=ue(f),h=c(d);h&&(p.referencedRootElement=h)}}),t.on("copyPaste.pasteElement",tT,function(u){var p=u.descriptor,f=p.businessObject,d=p.referencedRootElement;d&&(a(d)||(d=i.copyElement(d,r.create(d.$type))),l(f,d),delete p.referencedRootElement)})}If.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],Ee(If,ce);function nT(e,t){return Fe(t)||(t=[t]),yr(t,function(n){return Ko(e,n)})}var Mv=Math.max;function Pv(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,r=t.start,o={};return H(n,function(a){var s=a.id;C(a,"bpmn:Participant")&&(o[s]=rT(a,i,r)),C(a,"bpmn:Lane")&&(o[s]=gn(a)?Of:Df),C(a,"bpmn:SubProcess")&&at(a)&&(o[s]=bv),C(a,"bpmn:TextAnnotation")&&(o[s]=xv),C(a,"bpmn:Group")&&(o[s]=YP)}),o})}Pv.$inject=["eventBus"];function iT(e){return e==="x"}function rT(e,t,n){var i=gn(e);if(!sT(e))return i?sl:cl;var r=iT(t),o={};return r?i?o=sl:o={width:aT(e,n,r),height:cl.height}:i?o={width:sl.width,height:oT(e,n,r)}:o=cl,o}function oT(e,t,n){var i;return i=cT(e,t,n),Mv(sl.height,i)}function aT(e,t,n){var i;return i=lT(e,t,n),Mv(cl.width,i)}function sT(e){return!!Tr(e).length}function cT(e,t,n){var i=Tr(e),r;return r=Bf(i,t,n),e.height-r.height+Of.height}function lT(e,t,n){var i=Tr(e),r;return r=Bf(i,t,n),e.width-r.width+Df.width}function Bf(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=Tr(r),o.length?Bf(o,t,n):r}var Tv="_plane";function kv(e){var t=e.id;return uT(t)}function Gi(e){var t=e.id;return C(e,"bpmn:SubProcess")?Ov(t):t}function po(e){return Ov(e)}function ul(e){var t=pt(e);return C(t,"bpmndi:BPMNPlane")}function Ov(e){return e+Tv}function uT(e){return e.replace(new RegExp(Tv+"$"),"")}var Dv=400,pT=600,Lv={x:180,y:160};function or(e,t,n,i,r,o,a){ce.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 C(p,"bpmn:SubProcess")&&!at(p)}function l(p){var f=p.shape,d=p.newRootElement,h=ue(f);d=s._addDiagram(d||h),p.newRootElement=e.addRootElement(d)}function u(p){var f=p.shape,d=ue(f);s._removeDiagram(d);var h=p.newRootElement=a.get(Gi(d));e.removeRootElement(h)}this.executed("shape.create",function(p){var f=p.shape;c(f)&&l(p)},!0),this.postExecuted("elements.create",function(p){var f=p.elements;H(f,function(d){if(c(d)){var h=a.get(Gi(d));if(!(!h||!d.children||!d.children.length)){var m=Iv(d);s._showRecursively(m),s._moveChildrenToShape(m,h)}}})},!0),this.reverted("shape.create",function(p){var f=p.shape;c(f)&&u(p)},!0),this.preExecute("shape.delete",function(p){var f=p.shape;!C(f,"bpmn:SubProcess")||!at(f)||H(Ya([f]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(p){var f=p.shape;if(c(f)){var d=a.get(Gi(f));d&&n.removeElements(d.children.slice())}},!0),this.executed("shape.delete",function(p){var f=p.shape;c(f)&&u(p)},!0),this.reverted("shape.delete",function(p){var f=p.shape;c(f)&&l(p)},!0),this.preExecuted("shape.replace",function(p){var f=p.oldShape,d=p.newShape;!c(f)||!c(d)||(p.oldRoot=e.removeRootElement(Gi(f)))},!0),this.postExecuted("shape.replace",function(p){var f=p.newShape,d=p.oldRoot,h=e.findRoot(Gi(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(C(f,"bpmn:SubProcess")){var d=p.properties,h=p.oldProperties,m=h.id,v=d.id;if(m!==v){if(ul(f)){a.updateId(f,po(v)),a.updateId(m,v);return}var w=a.get(po(m));w&&a.updateId(po(m),po(v))}}},!0),this.reverted("element.updateProperties",function(p){var f=p.element;if(C(f,"bpmn:SubProcess")){var d=p.properties,h=p.oldProperties,m=h.id,v=d.id;if(m!==v){if(ul(f)){a.updateId(f,po(m)),a.updateId(v,m);return}var w=a.get(po(v));w&&a.updateId(w,po(m))}}},!0),t.on("element.changed",function(p){var f=p.element;if(ul(f)){var d=f,h=a.get(kv(d));!h||h===d||t.fire("element.changed",{element:h})}}),this.executed("shape.toggleCollapse",Dv,function(p){var f=p.shape;C(f,"bpmn:SubProcess")&&(at(f)?u(p):(l(p),s._showRecursively(f.children)))},!0),this.reverted("shape.toggleCollapse",Dv,function(p){var f=p.shape;C(f,"bpmn:SubProcess")&&(at(f)?u(p):(l(p),s._showRecursively(f.children)))},!0),this.postExecuted("shape.toggleCollapse",pT,function(p){var f=p.shape;if(C(f,"bpmn:SubProcess")){var d=p.newRootElement;if(d)if(at(f))s._moveChildrenToShape(d.children.slice(),f),H(Ya(f.children),m=>{n.moveShape(m.annotation,{x:0,y:0},f.parent),H(m.associations,v=>{n.moveConnection(v,{x:0,y:0},f.parent)})});else{s._disconnectSharedAnnotations(f);var h=Iv(f);s._moveChildrenToShape(h,d)}}},!0),t.on("copyPaste.createTree",function(p){var f=p.element,d=p.children;if(c(f)){var h=Gi(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,v=C(pt(m),"bpmndi:BPMNPlane");if(v){var w=kv(m),x=Tt(h,function(g){return g.id===w});x&&(f.parent=x.id)}}),t.on("copyPaste.pasteElement",function(p){var f=p.descriptor;f.parent&&(c(f.parent)||f.parent.hidden)&&(f.hidden=!0)})}Ee(or,ce),or.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=Jt(i),o;if(!t.x)o={x:Lv.x-r.x,y:Lv.y-r.y};else{var a=je(t),s=je(r);o={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,o,t,{autoResize:!1})}},or.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(Ry(e).map(i=>i.annotation));n.size&&H(Ya(e.children),i=>{n.has(i.annotation)&&H(i.associations,r=>{t.removeConnection(r)})})},or.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},or.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},or.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:Gi(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return o},or.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=Tt(n,function(r){return r.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},or.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function fT(e){var t=[];return H(Ya(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function Iv(e){return e.children.slice().concat(fT(e.children)).concat(dT(e))}function dT(e){return jp(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function Nf(e,t){e.invoke(ce,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,r=n.context.newShape;if(!(!C(r,"bpmn:SubProcess")||C(r,"bpmn:AdHocSubProcess")||!(C(i,"bpmn:Task")||C(i,"bpmn:CallActivity"))||!at(r))){var o=hT(r);t.createShape({type:"bpmn:StartEvent"},o,r)}})}Nf.$inject=["injector","modeling"],Ee(Nf,ce);function hT(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function $f(e,t){ce.call(this,e),this.preExecute("connection.create",function(n){const{target:i}=n;C(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&&C(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(!(!C(r,"bpmn:TextAnnotation")||o.autoResize)){var a=i.newBounds,s=t.getTextAnnotationBounds(a,li(r)||""),c=a.y!==r.y&&Math.abs(a.y+a.height-(r.y+r.height))<=1,l=r.y+r.height;i.newBounds={width:a.width,height:s.height,x:a.x,y:c?l-s.height:a.y}}})}Ee($f,ce),$f.$inject=["eventBus","textRenderer"];function Ff(e,t){ce.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(at(i))return;var r=za(i);r.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();H(s,function(l){o(l,!0)}),H(c,function(l){o(l,!1)})});function o(a,s){r.indexOf(a.source)!==-1&&r.indexOf(a.target)!==-1||C(a,"bpmn:Association")&&(C(a.source,"bpmn:TextAnnotation")||C(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,i,je(i)):t.reconnectStart(a,i,je(i)))}},!0)}Ee(Ff,ce),Ff.$inject=["eventBus","modeling"];var jf=500;function Hf(e,t,n){ce.call(this,e);function i(a){a.length&&a.forEach(function(s){s.type==="label"&&!s.businessObject.name&&(s.hidden=!0)})}function r(a,s){var c=a.children,l=s,u,p;return u=mT(c).concat([a]),p=Gy(u),p?(l.width=Math.max(p.width,l.width),l.height=Math.max(p.height,l.height),l.x=p.x+(p.width-l.width)/2,l.y=p.y+(p.height-l.height)/2):(l.x=a.x+(a.width-l.width)/2,l.y=a.y+(a.height-l.height)/2),l}function o(a,s){return{x:a.x+(a.width-s.width)/2,y:a.y+(a.height-s.height)/2,width:s.width,height:s.height}}this.executed(["shape.toggleCollapse"],jf,function(a){var s=a.context,c=s.shape;C(c,"bpmn:SubProcess")&&(c.collapsed?pt(c).isExpanded=!1:(i(c.children),pt(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],jf,function(a){var s=a.context,c=s.shape;c.collapsed?pt(c).isExpanded=!1:pt(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],jf,function(a){var s=a.context.shape,c=t.getDefaultSize(s),l;s.collapsed?l=o(s,c):l=r(s,c),n.resizeShape(s,l,null,{autoResize:s.collapsed?!1:"nwse"})})}Ee(Hf,ce),Hf.$inject=["eventBus","elementFactory","modeling"];function mT(e){return e.filter(function(t){return!t.hidden})}function zf(e,t,n,i){t.invoke(ce,this),this.preExecute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.businessObject;Je(a)||(C(a,"bpmn:Participant")&&at(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;C(r,"bpmn:Collaboration")&&n.ids.unclaim(o.id)})}Ee(zf,ce),zf.$inject=["canvas","injector","moddle","modeling"];function Gf(e,t){ce.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,r=i.connection,o=r.source;gT(r,o)&&t.updateProperties(o,{default:null})})}Ee(Gf,ce),Gf.$inject=["eventBus","modeling"];function gT(e,t){if(!C(e,"bpmn:SequenceFlow"))return!1;var n=ue(t),i=ue(e);return n.get("default")===i}var yT=500,vT=5e3,Bv=["shape.create","shape.delete","shape.move","shape.resize"],Nv=[...Bv,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function Vf(e,t){ce.call(this,e);var n;function i(){return n=n||new bT,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(Nv,vT,function(){i()}),this.postExecuted(Nv,yT,function(){o()}),this.preExecute(Bv,function(a){var s=a.context,c=s.shape,l=r();!c||c.labelTarget||(C(c,"bpmn:Lane")&&l.addLane(c),C(c,"bpmn:FlowNode")&&l.addFlowNode(c))})}Vf.$inject=["eventBus","modeling"],Ee(Vf,ce);function bT(){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 xT=500,_T=5e3,$v=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],Fv=[...$v,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function Wf(e,t){ce.call(this,e);var n;function i(){return n=n||new wT,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(Fv,_T,function(){i()}),this.postExecuted(Fv,xT,function(){o()}),this.preExecute($v,function(a){var s=a.context.connection||a.context.shape,c=r();!s||s.labelTarget||(C(s,"bpmn:FlowElement")&&c.addFlowElement(s),C(s,"bpmn:Group")&&c.addGroup(s))}),this.preExecute("label.create",function(a){var s=a.context.labelTarget;C(s,"bpmn:Group")&&r().addGroup(s)})}Wf.$inject=["eventBus","modeling"],Ee(Wf,ce);function wT(){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 Uf(e,t){ce.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,r=i.elements;for(const o of r)ET(o)&&!RT(o)&&t.updateProperties(o,{isForCompensation:void 0})})}Ee(Uf,ce),Uf.$inject=["eventBus","modeling"];function ET(e){const t=ue(e);return t&&t.isForCompensation}function ST(e){return e&&C(e,"bpmn:BoundaryEvent")&&Ko(e,"bpmn:CompensateEventDefinition")}function RT(e){return e.incoming.filter(n=>ST(n.source)).length>0}const CT={__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",Jp],appendBehavior:["type",ef],associationBehavior:["type",nf],attachEventBehavior:["type",Wc],artifactBehavior:["type",tf],boundaryEventBehavior:["type",rf],categoryRootElementReferenceBehavior:["type",of],compensateBoundaryEventBehaviour:["type",af],createBehavior:["type",sf],createDataObjectBehavior:["type",cf],createParticipantBehavior:["type",pf],dataInputAssociationBehavior:["type",ff],dataStoreBehavior:["type",df],deleteLaneBehavior:["type",hf],detachEventBehavior:["type",Jc],dropOnFlowBehavior:["type",gf],eventBasedGatewayBehavior:["type",yf],fixHoverBehavior:["type",Xy],groupBehavior:["type",vf],importDockingFix:["type",Qy],isHorizontalFix:["type",xf],labelBehavior:["type",wf],layoutConnectionBehavior:["type",Ef],messageFlowBehavior:["type",Cf],nonInterruptingBehavior:["type",Af],removeElementBehavior:["type",Pf],removeEmbeddedLabelBoundsBehavior:["type",Mf],removeParticipantBehavior:["type",Tf],replaceConnectionBehavior:["type",kf],replaceElementBehaviour:["type",al],resizeBehavior:["type",_v],resizeLaneBehavior:["type",Av],rootElementReferenceBehavior:["type",If],spaceToolBehavior:["type",Pv],subProcessPlaneBehavior:["type",or],subProcessStartEventBehavior:["type",Nf],textAnnotationBehavior:["type",$f],toggleCollapseConnectionBehaviour:["type",Ff],toggleElementCollapseBehaviour:["type",Hf],unclaimIdBehavior:["type",zf],unsetDefaultFlowBehavior:["type",Gf],updateFlowNodeRefsBehavior:["type",Vf],updateCategoryValueRefsBehavior:["type",Wf],setCompensationActivityAfterPasteBehavior:["type",Uf]};function qf(e){this._commandStack=e.get("commandStack",!1)}qf.$inject=["injector"],qf.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const Vi={__init__:["rules"],rules:["type",qf]};function mi(e){ce.call(this,e),this.init()}mi.$inject=["eventBus"],Ee(mi,ce),mi.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)})},mi.prototype.init=function(){};function jv(e,t){var n=Sn(e,t,-15);return n!=="intersect"?n:null}function Cn(e){mi.call(this,e)}Ee(Cn,mi),Cn.$inject=["eventBus"],Cn.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return AT(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 fl(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return fl(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 Jv(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return Ct(i)&&!dl(t,i)?!1:Jr(t,function(r){return Ct(r)?fl(r.source,r.target,r):r.host?os(r,r.host,null,n):Zf(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 qv(a)&&!n.includes(a.host)})?!1:os(n,t,null,i)||Zv(n,t,i)||Qv(n,t)||dl(n,t)}),this.addRule("shape.create",function(e){return Zf(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return os(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return rb(n,t)})},Cn.prototype.canConnectMessageFlow=nb,Cn.prototype.canConnectSequenceFlow=ib,Cn.prototype.canConnectDataAssociation=Qf,Cn.prototype.canConnectAssociation=eb,Cn.prototype.canConnectCompensationAssociation=tb,Cn.prototype.canMove=Qv,Cn.prototype.canAttach=os,Cn.prototype.canReplace=Zv,Cn.prototype.canDrop=oa,Cn.prototype.canInsert=dl,Cn.prototype.canCreate=Zf,Cn.prototype.canConnect=fl,Cn.prototype.canResize=Jv,Cn.prototype.canCopy=rb;function AT(e){return Yf(e)?null:et(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function Yf(e){return!e||Je(e)}function Hv(e){do{if(C(e,"bpmn:Process"))return ue(e);if(C(e,"bpmn:Participant"))return ue(e).processRef||ue(e)}while(e=e.parent)}function Kf(e){return C(e,"bpmn:TextAnnotation")}function Xf(e){return C(e,"bpmn:Group")&&!e.labelTarget}function zv(e){return C(e,"bpmn:BoundaryEvent")&&Wi(e,"bpmn:CompensateEventDefinition")}function pl(e){return ue(e).isForCompensation}function MT(e,t){var n=Hv(e),i=Hv(t);return n===i}function PT(e){return C(e,"bpmn:InteractionNode")&&!C(e,"bpmn:BoundaryEvent")&&(!C(e,"bpmn:Event")||C(e,"bpmn:ThrowEvent")&&Wv(e,"bpmn:MessageEventDefinition"))}function TT(e){return C(e,"bpmn:InteractionNode")&&!pl(e)&&(!C(e,"bpmn:Event")||C(e,"bpmn:CatchEvent")&&Wv(e,"bpmn:MessageEventDefinition"))&&!(C(e,"bpmn:BoundaryEvent")&&!Wi(e,"bpmn:MessageEventDefinition"))}function Gv(e){for(var t=e;t=t.parent;){if(C(t,"bpmn:FlowElementsContainer"))return ue(t);if(C(t,"bpmn:Participant"))return ue(t).processRef}return null}function Vv(e,t){var n=Gv(e),i=Gv(t);return n===i}function Wi(e,t){var n=ue(e);return!!Tt(n.eventDefinitions||[],function(i){return C(i,t)})}function Wv(e,t){var n=ue(e);return(n.eventDefinitions||[]).every(function(i){return C(i,t)})}function kT(e){return C(e,"bpmn:FlowNode")&&!C(e,"bpmn:EndEvent")&&!Dn(e)&&!(C(e,"bpmn:IntermediateThrowEvent")&&Wi(e,"bpmn:LinkEventDefinition"))&&!zv(e)&&!pl(e)}function OT(e){return C(e,"bpmn:FlowNode")&&!C(e,"bpmn:StartEvent")&&!C(e,"bpmn:BoundaryEvent")&&!Dn(e)&&!(C(e,"bpmn:IntermediateCatchEvent")&&Wi(e,"bpmn:LinkEventDefinition"))&&!pl(e)}function DT(e){return C(e,"bpmn:ReceiveTask")||C(e,"bpmn:IntermediateCatchEvent")&&(Wi(e,"bpmn:MessageEventDefinition")||Wi(e,"bpmn:TimerEventDefinition")||Wi(e,"bpmn:ConditionalEventDefinition")||Wi(e,"bpmn:SignalEventDefinition"))}function LT(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function Uv(e,t){var n=LT(t);return n.indexOf(e)!==-1}function fl(e,t,n){if(Yf(e)||Yf(t))return null;if(!C(n,"bpmn:DataAssociation")){if(nb(e,t))return{type:"bpmn:MessageFlow"};if(ib(e,t))return{type:"bpmn:SequenceFlow"}}var i=Qf(e,t);return i||(tb(e,t)?{type:"bpmn:Association",associationDirection:"One"}:eb(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function oa(e,t){return Je(e)||Xf(e)?!0:C(t,"bpmn:Participant")&&!at(t)?!1:C(e,"bpmn:Participant")?C(t,"bpmn:Process")||C(t,"bpmn:Collaboration"):et(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:C(e,"bpmn:Lane")?C(t,"bpmn:Participant")||C(t,"bpmn:Lane"):C(e,"bpmn:BoundaryEvent")&&!IT(e)?!1:C(e,"bpmn:FlowElement")&&!C(e,"bpmn:DataStoreReference")?C(t,"bpmn:FlowElementsContainer")?at(t):et(t,["bpmn:Participant","bpmn:Lane"]):C(e,"bpmn:DataStoreReference")&&C(t,"bpmn:Collaboration")?yr(ue(t).get("participants"),function(n){return!!n.get("processRef")}):et(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?et(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):C(e,"bpmn:MessageFlow")?C(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function IT(e){return ue(e).cancelActivity&&(Yv(e)||Kv(e))}function qv(e){return!Je(e)&&C(e,"bpmn:BoundaryEvent")}function BT(e){return C(e,"bpmn:Lane")}function NT(e){return qv(e)||C(e,"bpmn:IntermediateThrowEvent")&&Yv(e)?!0:C(e,"bpmn:IntermediateCatchEvent")&&Kv(e)}function Yv(e){var t=ue(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function Kv(e){return Xv(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function Xv(e,t){return t.some(function(n){return Wi(e,n)})}function $T(e){return C(e,"bpmn:ReceiveTask")&&Tt(e.incoming,function(t){return C(t.source,"bpmn:EventBasedGateway")})}function os(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var r=e[0];return Je(r)||!NT(r)||Dn(t)||!C(t,"bpmn:Activity")||pl(t)||i&&!jv(i,t)||$T(t)?!1:"attach"}function Zv(e,t,n){if(!t)return!1;var i={replacements:[]};return H(e,function(r){Dn(t)||C(r,"bpmn:StartEvent")&&r.type!=="label"&&oa(r,t)&&(qA(r)||i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),(YA(r)||KA(r)||XA(r))&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),Xv(r,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&C(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"})),C(t,"bpmn:Transaction")||Wi(r,"bpmn:CancelEventDefinition")&&r.type!=="label"&&(C(r,"bpmn:EndEvent")&&oa(r,t)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:EndEvent"}),C(r,"bpmn:BoundaryEvent")&&os(r,t,null,n)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function Qv(e,t){return yr(e,BT)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return oa(n,t)})}function Zf(e,t,n,i){return t?Je(e)||Xf(e)?!0:oa(e,t)||dl(e,t):!1}function Jv(e,t,n){return C(e,"bpmn:SubProcess")?at(e)&&(!t||t.width>=100&&t.height>=80):C(e,"bpmn:Lane")||C(e,"bpmn:Participant")?!0:Kf(e)?n?n==="e"||n==="w":!0:Xf(e)?!0:Je(e)?n?n==="e"||n==="w":!0:!1}function FT(e,t){var n=Kf(e),i=Kf(t);return(n||i)&&n!==i}function eb(e,t){return Uv(t,e)||Uv(e,t)?!1:FT(e,t)?!0:!!Qf(e,t)}function tb(e,t){return Vv(e,t)&&zv(e)&&C(t,"bpmn:Activity")&&!HT(t,e)&&!Dn(t)}function nb(e,t){return ab(e)&&!ab(t)?!1:PT(e)&&TT(t)&&!MT(e,t)}function ib(e,t){return kT(e)&&OT(t)&&Vv(e,t)&&!(C(e,"bpmn:EventBasedGateway")&&!DT(t))}function Qf(e,t){return et(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&et(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:et(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&et(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function dl(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:et(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!Je(t)&&C(e,"bpmn:FlowNode")&&!C(e,"bpmn:BoundaryEvent")&&oa(e,t.parent)}function Jf(e,t){return e&&t&&e.indexOf(t)!==-1}function rb(e,t){return Je(t)?!0:!(C(t,"bpmn:Lane")&&!Jf(e,t.parent)||C(t,"bpmn:MessageFlow")&&!jT(e,t))}function jT(e,t){var n=ob(t.source),i=ob(t.target);return Jf(e,n)&&Jf(e,i)}function ob(e){for(;e;e=e.parent)if(C(e,"bpmn:Participant"))return e;return null}function ab(e){return Qo(e,"bpmn:Process")||Qo(e,"bpmn:Collaboration")}function HT(e,t){return e.attachers.includes(t)}const zT={__depends__:[Vi],__init__:["bpmnRules"],bpmnRules:["type",Cn]};var GT=2e3;function sb(e,t){e.on("saveXML.start",GT,n);function n(){var i=t.getRootElements();H(i,function(r){var o=pt(r),a,s;a=za([r]),a=tt(a,function(c){return c!==r&&!c.labelTarget}),s=Mn(a,pt),o.set("planeElement",s)})}}sb.$inject=["eventBus","canvas"];const VT={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",sb]};function hl(e){ce.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)})}hl.prototype.getOrdering=function(e,t){return null},Ee(hl,ce);function ed(e,t){hl.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=Tt(n,function(c){return et(a,[c.type])});return s&&s.order||{level:1}}function r(a){var s=a.order;if(s||(a.order=s=i(a)),!s)throw new Error(`no order for <${a.id}>`);return s}function o(a,s,c){for(var l=s;l&&!et(l,c);)l=l.parent;if(!l)throw new Error(`no parent for <${a.id}> in <${s&&s.id}>`);return l}this.getOrdering=function(a,s){if(a.labelTarget||C(a,"bpmn:TextAnnotation"))return{parent:t.findRoot(s)||t.getRootElement(),index:-1};var c=r(a);c.containers&&(s=o(a,s,c.containers));var l=s.children.indexOf(a),u=jh(s.children,function(p){return!a.labelTarget&&p.labelTarget?!1:c.level<r(p).level});return u!==-1&&l!==-1&&l<u&&(u-=1),{index:u,parent:s}}}ed.$inject=["eventBus","canvas"],Ee(ed,hl);const WT={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",ed]};function as(){}as.prototype.get=function(){return this._data},as.prototype.set=function(e){this._data=e},as.prototype.clear=function(){var e=this._data;return delete this._data,e},as.prototype.isEmpty=function(){return!this._data};const UT={clipboard:["type",as]};var cb=1500;function lb(e,t,n){var i=this,r=n.get("dragging",!1);function o(a){if(!a.hover){var s=a.originalEvent,c=i._findTargetGfx(s),l=c&&e.get(c);c&&l&&(a.stopPropagation(),r.hover({element:l,gfx:c}),r.move(s))}}r&&t.on("drag.start",function(a){t.once("drag.move",cb,function(s){o(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",cb,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=uo(a),c=document.elementFromPoint(s.x,s.y),qT(c)}}lb.$inject=["elementRegistry","eventBus","injector"];function qT(e){return ro(e,"svg, .djs-element",!0)}const YT={__init__:["hoverFix"],hoverFix:["type",lb]};function KT(e){return!0}function ml(e){return Or(e)||eT(e)}var ub=500;function pb(e,t,n){var i=this;function r(k,I,P){if(!s(k,I)){var O,F,Z;P?F=t.getGraphics(P):(O=I.delegateTarget||I.target,O&&(F=O,P=t.get(F))),!(!F||!P)&&(Z=e.fire(k,{element:P,gfx:F,originalEvent:I}),Z===!1&&(I.stopPropagation(),I.preventDefault()))}}var o={};function a(k){return o[k]}function s(k,I){var P=l[k]||Or;return!P(I)}var c={click:"element.click",contextmenu:"element.contextmenu",dblclick:"element.dblclick",mousedown:"element.mousedown",mousemove:"element.mousemove",mouseover:"element.hover",mouseout:"element.out",mouseup:"element.mouseup"},l={"element.contextmenu":KT,"element.mousedown":ml,"element.mouseup":ml,"element.click":ml,"element.dblclick":ml};function u(k,I,P){var O=c[k];if(!O)throw new Error("unmapped DOM event name <"+k+">");return r(O,I,P)}var p="svg, .djs-element";function f(k,I,P,O){var F=o[P]=function(Z){r(P,Z)};O&&(l[P]=O),F.$delegate=Un.bind(k,p,I,F)}function d(k,I,P){var O=a(P);O&&Un.unbind(k,I,O.$delegate)}function h(k){H(c,function(I,P){f(k,P,I)})}function m(k){H(c,function(I,P){d(k,P,I)})}e.on("canvas.destroy",function(k){m(k.svg)}),e.on("canvas.init",function(k){h(k.svg)}),e.on(["shape.added","connection.added"],function(k){var I=k.element,P=k.gfx;e.fire("interactionEvents.createHit",{element:I,gfx:P})}),e.on(["shape.changed","connection.changed"],ub,function(k){var I=k.element,P=k.gfx;e.fire("interactionEvents.updateHit",{element:I,gfx:P})}),e.on("interactionEvents.createHit",ub,function(k){var I=k.element,P=k.gfx;i.createDefaultHit(I,P)}),e.on("interactionEvents.updateHit",function(k){var I=k.element,P=k.gfx;i.updateDefaultHit(I,P)});var v=S("djs-hit djs-hit-stroke"),w=S("djs-hit djs-hit-click-stroke"),x=S("djs-hit djs-hit-all"),g=S("djs-hit djs-hit-no-move"),y={all:x,"click-stroke":w,stroke:v,"no-move":g};function S(k,I){return I=W({stroke:"white",strokeWidth:15},I||{}),n.cls(k,["no-fill","no-border"],I)}function E(k,I){var P=y[I];if(!P)throw new Error("invalid hit type <"+I+">");return Se(k,P),k}function T(k,I){qe(k,I)}this.removeHits=function(k){var I=Cc(".djs-hit",k);H(I,cn)},this.createDefaultHit=function(k,I){var P=k.waypoints,O=k.isFrame,F;return P?this.createWaypointsHit(I,P):(F=O?"stroke":"all",this.createBoxHit(I,F,{width:k.width,height:k.height}))},this.createWaypointsHit=function(k,I){var P=Ha(I);return E(P,"stroke"),T(k,P),P},this.createBoxHit=function(k,I,P){P=W({x:0,y:0},P);var O=De("rect");return E(O,I),Se(O,P),T(k,O),O},this.updateDefaultHit=function(k,I){var P=St(".djs-hit",I);if(P)return k.waypoints?Fp(P,k.waypoints):Se(P,{width:k.width,height:k.height}),P},this.fire=r,this.triggerMouseEvent=u,this.mouseHandler=a,this.registerEvent=f,this.unregisterEvent=d}pb.$inject=["eventBus","elementRegistry","styles"];const gl={__init__:["interactionEvents"],interactionEvents:["type",pb]};function aa(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)})}aa.$inject=["eventBus","canvas"],aa.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()})}},aa.prototype.get=function(){return Array.from(this._selectedElements)},aa.prototype.isSelected=function(e){return this._selectedElements.has(e)},aa.prototype.select=function(e,t){var n=this.get();Fe(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?H(e,o=>{this._selectedElements.add(o)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var fb="hover",db="selected";function hb(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,fb)}),t.on("element.out",function(r){i(r.element,fb)}),t.on("selection.changed",function(r){function o(l){i(l,db)}function a(l){n(l,db)}var s=new Set(r.oldSelection),c=new Set(r.newSelection);for(let l of s)c.has(l)||o(l);for(let l of c)s.has(l)||a(l)})}hb.$inject=["canvas","eventBus"];function mb(e,t,n,i){e.on("create.end",500,function(r){var o=r.context,a=o.canExecute,s=o.elements,c=o.hints||{},l=c.autoSelect;if(a){if(l===!1)return;Fe(l)?t.select(l):t.select(s.filter(XT))}}),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=Tt(o,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(r){if(Or(r)){var o=r.element;o===n.getRootElement()&&(o=null);var a=t.isSelected(o),s=t.get().length>1,c=ll(r);if(a&&s)return c?t.deselect(o):t.select(o);a?t.deselect(o):t.select(o,c)}})}mb.$inject=["eventBus","selection","canvas","elementRegistry"];function XT(e){return!e.hidden}const gi={__init__:["selectionVisuals","selectionBehavior"],__depends__:[gl],selection:["type",aa],selectionVisuals:["type",hb],selectionBehavior:["type",mb]};var ZT=/^djs-cursor-.*$/;function yl(e){var t=Bt(document.body);t.removeMatching(ZT),e&&t.add("djs-cursor-"+e)}function gb(){yl(null)}var QT=5e3;function yb(e,t){t=t||"element.click";function n(){return!1}return e.once(t,QT,n),function(){e.off(t,n)}}var JT=["c","C"],ek=["v","V"],tk=["d","D"],nk=["x","X"],ik=["y","Y"],vb=["z","Z"];function rk(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Kn(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function ln(e,t){return e=Fe(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function td(e){return e.shiftKey}function ok(e){return Kn(e)&&ln(JT,e)}function ak(e){return Kn(e)&&ln(ek,e)}function sk(e){return Kn(e)&&ln(tk,e)}function ck(e){return Kn(e)&&ln(nk,e)}function lk(e){return Kn(e)&&!td(e)&&ln(vb,e)}function uk(e){return Kn(e)&&(ln(ik,e)||ln(vb,e)&&td(e))}var sa=Math.round,bb="djs-drag-active";function fo(e){e.preventDefault()}function pk(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function fk(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function xb(e,t,n,i){var r={threshold:5,trapClick:!0},o;function a(g){var y=t.viewbox(),S=t._container.getBoundingClientRect();return{x:y.x+(g.x-S.left)/y.scale,y:y.y+(g.y-S.top)/y.scale}}function s(g,y){y=y||o;var S=e.createEvent(W({},y.payload,y.data,{isTouch:y.isTouch}));return e.fire("drag."+g,S)===!1?!1:e.fire(y.prefix+"."+g,S)}function c(g){var y=g.filter(function(S){return i.get(S.id)});y.length&&n.select(y)}function l(g,y){var S=o.payload,E=o.displacement,T=o.globalStart,k=uo(g),I=Mi(k,T),P=o.localStart,O=a(k),F=Mi(O,P);if(!o.active&&(y||fk(I)>o.threshold)){if(W(S,{x:sa(P.x+E.x),y:sa(P.y+E.y),dx:0,dy:0},{originalEvent:g}),s("start")===!1)return v();o.active=!0,o.keepSelection||(S.previousSelection=n.get(),n.select(null)),o.cursor&&yl(o.cursor),t.addMarker(t.getRootElement(),bb)}Lf(g),o.active&&(W(S,{x:sa(O.x+E.x),y:sa(O.y+E.y),dx:sa(F.x),dy:sa(F.y)},{originalEvent:g}),s("move"))}function u(g){var y,S=!0;o.active&&(g&&(o.payload.originalEvent=g,Lf(g)),S=s("end")),S===!1&&s("rejected"),y=w(S!==!0),s("ended",y)}function p(g){ln("Escape",g)&&(fo(g),v())}function f(g){var y;o.active&&(y=yb(e),setTimeout(y,400),fo(g)),u(g)}function d(g){l(g)}function h(g){var y=o.payload;y.hoverGfx=g.gfx,y.hover=g.element,s("hover")}function m(g){s("out");var y=o.payload;y.hoverGfx=null,y.hover=null}function v(g){var y;if(o){var S=o.active;S&&s("cancel"),y=w(g),S&&s("canceled",y)}}function w(g){var y,S;s("cleanup"),gb(),o.trapClick?S=f:S=u,Ve.unbind(document,"mousemove",l),Ve.unbind(document,"dragstart",fo),Ve.unbind(document,"selectstart",fo),Ve.unbind(document,"mousedown",S,!0),Ve.unbind(document,"mouseup",S,!0),Ve.unbind(document,"keyup",p),Ve.unbind(document,"touchstart",d,!0),Ve.unbind(document,"touchcancel",v,!0),Ve.unbind(document,"touchmove",l,!0),Ve.unbind(document,"touchend",u,!0),e.off("element.hover",h),e.off("element.out",m),t.removeMarker(t.getRootElement(),bb);var E=o.payload.previousSelection;return g!==!1&&E&&!n.get().length&&c(E),y=o,o=null,y}function x(g,y,S,E){o&&v(!1),typeof y=="string"&&(E=S,S=y,y=null),E=W({},r,E||{});var T=E.data||{},k,I,P,O,F;if(E.trapClick?O=f:O=u,g?(k=ra(g)||g,I=uo(g),Lf(g),k.type==="dragstart"&&fo(k)):(k=null,I={x:0,y:0}),P=a(I),y||(y=P),F=pk(k),o=W({prefix:S,data:T,payload:{},globalStart:I,displacement:Mi(y,P),localStart:P,isTouch:F},E),E.manual||(F?(Ve.bind(document,"touchstart",d,!0),Ve.bind(document,"touchcancel",v,!0),Ve.bind(document,"touchmove",l,!0),Ve.bind(document,"touchend",u,!0)):(Ve.bind(document,"mousemove",l),Ve.bind(document,"dragstart",fo),Ve.bind(document,"selectstart",fo),Ve.bind(document,"mousedown",O,!0),Ve.bind(document,"mouseup",O,!0)),Ve.bind(document,"keyup",p),e.on("element.hover",h),e.on("element.out",m)),s("init")===!1)return v(),!1;E.autoActivate&&l(g,!0)}e.on("diagram.destroy",v),this.init=x,this.move=l,this.hover=h,this.out=m,this.end=u,this.cancel=v,this.context=function(){return o},this.setOptions=function(g){W(r,g)}}xb.$inject=["eventBus","canvas","selection","elementRegistry"];const ar={__depends__:[YT,gi],dragging:["type",xb]};function ca(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}ca.prototype.next=function(){return this._prefix+ ++this._counter};const dk=new ca("ps");var hk=["marker-start","marker-mid","marker-end"],mk=["circle","ellipse","line","path","polygon","polyline","path","rect"];function Dr(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}Dr.$inject=["elementRegistry","eventBus","canvas","styles"],Dr.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")},Dr.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},Dr.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var r=Dg(n);return this._cloneMarkers(so(r),i),Se(r,this._styles.cls(i,[])),qe(t,r),Se(r,"data-preview-support-element-id",e.id),r},Dr.prototype.addFrame=function(e,t){var n=De("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return qe(t,n),Se(n,"data-preview-support-element-id",e.id),n},Dr.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(r=>{i._cloneMarkers(r,t,n)}),bk(e)&&hk.forEach(function(r){if(Se(e,r)){var o=gk(e,r,i._canvas.getContainer());o&&i._cloneMarker(n,e,o,r,t)}})},Dr.prototype._cloneMarker=function(e,t,n,i,r="djs-dragger"){var o=[n.id,r,dk.next()].join("-"),a=St("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||Dg(n);s.id=o,ct(s).add(r);var c=St(":scope > defs",e);c||(c=De("defs"),qe(e,c)),qe(c,s);var l=vk(s.id);Se(t,i,l)};function gk(e,t,n){var i=yk(Se(e,t));return St("marker#"+i,n||document)}function yk(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function vk(e){return"url(#"+e+")"}function bk(e){return mk.indexOf(e.nodeName)!==-1}const la={__init__:["previewSupport"],previewSupport:["type",Dr]};var xk="drop-ok",_b="drop-not-ok",wb="attach-ok",Eb="new-parent",Sb="create",_k=2e3;function Rb(e,t,n,i,r){function o(c,l,u,p,f){if(!l)return!1;c=tt(c,function(x){var g=x.labelTarget;return!x.parent&&!(Je(x)&&c.indexOf(g)!==-1)});var d=Tt(c,function(x){return!Ct(x)}),h=!1,m=!1,v=!1;Ab(c)&&(h=r.allowed("shape.attach",{position:u,shape:d,target:l})),h||(Ab(c)?v=r.allowed("shape.create",{position:u,shape:d,source:p,target:l}):v=r.allowed("elements.create",{elements:c,position:u,target:l}));var w=f.connectionTarget;return v||h?(d&&p&&(m=r.allowed("connection.create",{source:w===p?d:p,target:w===p?p:d,hints:{targetParent:l,targetAttach:h}})),{attach:h,connect:m}):v===null||h===null?null:!1}function a(c,l){[wb,xk,_b,Eb].forEach(function(u){u===l?e.addMarker(c,u):e.removeMarker(c,u)})}n.on(["create.move","create.hover"],function(c){var l=c.context,u=l.elements,p=c.hover,f=l.source,d=l.hints||{};if(!p){l.canExecute=!1,l.target=null;return}Cb(c);var h={x:c.x,y:c.y},m=l.canExecute=p&&o(u,p,h,f,d);p&&m!==null&&(l.target=p,m&&m.attach?a(p,wb):a(p,m?Eb:_b))}),n.on(["create.end","create.out","create.cleanup"],function(c){var l=c.hover;l&&a(l,null)}),n.on("create.end",function(c){var l=c.context,u=l.source,p=l.shape,f=l.elements,d=l.target,h=l.canExecute,m=h&&h.attach,v=h&&h.connect,w=l.hints||{};if(h===!1||!d)return!1;Cb(c);var x={x:c.x,y:c.y};v?p=i.appendShape(u,p,x,d,{attach:m,connection:v===!0?{}:v,connectionTarget:w.connectionTarget}):(f=i.createElements(f,x,d,W({},w,{attach:m})),p=Tt(f,function(g){return!Ct(g)})),W(l,{elements:f,shape:p}),W(c,{elements:f,shape:p})});function s(){var c=t.context();c&&c.prefix===Sb&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],_k,function(){n.off("elements.changed",s)})}),this.start=function(c,l,u){Fe(l)||(l=[l]);var p=Tt(l,function(h){return!Ct(h)});if(p){u=W({elements:l,hints:{},shape:p},u||{}),H(l,function(h){Ge(h.x)||(h.x=0),Ge(h.y)||(h.y=0)});var f=tt(l,function(h){return!h.hidden}),d=Jt(f);H(l,function(h){Ct(h)&&(h.waypoints=Mn(h.waypoints,function(m){return{x:m.x-d.x-d.width/2,y:m.y-d.y-d.height/2}})),W(h,{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2})}),t.init(c,Sb,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:l,context:u}})}}}Rb.$inject=["canvas","dragging","eventBus","modeling","rules"];function Cb(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 Ab(e){return e&&e.length===1&&!Ct(e[0])}var wk=750;function Mb(e,t,n,i,r){function o(a){var s=De("g");Se(s,r.cls("djs-drag-group",["no-events"]));var c=De("g");return a.forEach(function(l){var u;l.hidden||(l.waypoints?(u=n._createContainer("connection",c),n.drawConnection(so(u),l)):(u=n._createContainer("shape",c),n.drawShape(so(u),l),Rn(u,l.x,l.y)),i.addDragger(l,s,u))}),s}t.on("create.move",wk,function(a){var s=a.hover,c=a.context,l=c.elements,u=c.dragGroup;u||(u=c.dragGroup=o(l));var p;s?(u.parentNode||(p=e.getActiveLayer(),qe(p,u)),Rn(u,a.x,a.y)):cn(u)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&cn(c)})}Mb.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const vl={__depends__:[ar,la,Vi,gi],__init__:["create","createPreview"],create:["type",Rb],createPreview:["type",Mb]};function nd(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)})}nd.$inject=["eventBus"],nd.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||Ek(0,0)};function Ek(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 ss={__init__:["mouse"],mouse:["type",nd]};var Pb=2e3;function Xn(e,t,n,i,r,o,a,s){this._canvas=e,this._create=t,this._elementFactory=i,this._eventBus=r,this._modeling=o,this._mouse=a,this._rules=s,r.on("copyPaste.copyElement",function(c){var l=c.descriptor,u=c.element,p=c.elementsSet;l.priority=1,l.id=u.id,p.has(u.parent)&&(l.parent=u.parent.id),Sk(u)&&(l.priority=2,l.host=u.host.id),Ct(u)&&(l.priority=3,l.source=u.source.id,l.target=u.target.id,l.waypoints=Rk(u)),Je(u)&&(l.priority=4,l.labelTarget=u.labelTarget.id),H(["x","y","width","height"],function(f){Ge(u[f])&&(l[f]=u[f])}),l.hidden=u.hidden,l.collapsed=u.collapsed}),r.on("copyPaste.elementsCopied",Pb,function(c){var l;((l=c.hints)==null?void 0:l.clip)!==!1&&n.set(c.tree)}),r.on("copyPaste.pasteElements",Pb,function(c){c.tree||(c.tree=n.get())}),r.on("copyPaste.pasteElements",function(c){var l=c.hints;W(l,{createElementsBehavior:!1})})}Xn.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],Xn.prototype.copy=function(e,t={}){var n,i;return Fe(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(Fe(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},Xn.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})}}},Xn.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},Xn.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},Xn.prototype._getElementIdsFromTree=function(e){var t={};return H(e,function(n){H(n,function(i){i.id&&(t[i.id]=!0)})}),t},Xn.prototype._paste=function(e,t,n,i){H(e,function(o){Ge(o.x)||(o.x=0),Ge(o.y)||(o.y=0)});var r=Jt(e);return H(e,function(o){Ct(o)&&(o.waypoints=Mn(o.waypoints,function(a){return{x:a.x-r.x-r.width/2,y:a.y-r.y-r.height/2}})),W(o,{x:o.x-r.x-r.width/2,y:o.y-r.y-r.height/2})}),this._modeling.createElements(e,n,t,W({},i))},Xn.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return H(e,function(o,a){o=Oi(o,"priority"),H(o,function(s){var c=W({},Di(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var l;if(Ct(c)){c.source=i[s.source],c.target=i[s.target],l=i[s.id]=t.createConnection(c),r.push(l);return}if(Je(c)){c.labelTarget=i[c.labelTarget],l=i[s.id]=t.createLabel(c),r.push(l);return}c.host&&(c.host=i[c.host]),l=i[s.id]=t.createShape(c),r.push(l)})}),r},Xn.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(Di(e,["id"]));return t},Xn.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(Di(e,["id"]));return t},Xn.prototype.createShape=function(e){var t=this._elementFactory.createShape(Di(e,["id"]));return t},Xn.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(Ct(e)&&(!n.has(e.source)||!n.has(e.target))||Je(e)&&!n.has(e.labelTarget))},Xn.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[],o=new Map,a=Tc(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=l(d,r);var m={element:d.element,depth:f};r.push(m),o.set(p,m)}}function l(p,f){var d=f.indexOf(p);return d!==-1&&f.splice(d,1),f}ao(a,function(p,f,d){if(Je(p))return;H(p.labels,function(v){c(v,d)});function h(v){v&&v.length&&H(v,function(w){H(w.labels,function(x){c(x,d)}),c(w,d)})}H([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=Mn(r,function(p){return p.element});var u=new Set(e);return r=Mn(r,function(p){return p.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:p.descriptor,element:p.element,elements:e,elementsSet:u}),p}),r=Oi(r,function(p){return p.descriptor.priority}),e=Mn(r,function(p){return p.element}),H(r,function(p){var f=p.depth;if(!n.hasRelations(p.element,e,u)){kb(p.element,e),u.delete(p.element);return}if(!s(p.element,e)){kb(p.element,e),u.delete(p.element);return}i[f]||(i[f]=[]),i[f].push(p.descriptor)}),i};function Sk(e){return!!e.host}function Rk(e){return Mn(e.waypoints,function(t){return t=Tb(t),t.original&&(t.original=Tb(t.original)),t})}function Tb(e){return W({},e)}function kb(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const Ck={__depends__:[UT,vl,ss,Vi],__init__:["copyPaste"],copyPaste:["type",Xn]};function id(e,t,n){Fe(n)||(n=[n]),H(n,function(i){Qr(e[i])||(t[i]=e[i])})}var rd=750;function Ob(e,t,n){function i(c,l){var u=e.create(c.$type);return n.copyElement(c,u,null,l)}t.on("copyPaste.copyElement",rd,function(c){var l=c.descriptor,u=c.element,p=ue(u);if(Je(u))return l;var f=l.businessObject=i(p,!0),d=l.di=i(pt(u),!0);d.bpmnElement=f,id(f,l,"name"),id(d,l,"isExpanded"),p.default&&(l.default=p.default.id)});var r="-bpmn-js-refs";function o(c){return c[r]=c[r]||{}}function a(c,l){c[r]=l}function s(c,l,u){var p=ue(c);return c.default&&(u[c.default]={element:p,property:"default"}),c.host&&(ue(c).attachedToRef=ue(l[c.host])),Di(u,Wn(u,function(f,d,h){var m=d.element,v=d.property;return h===c.id&&(m.set(v,p),f.push(c.id)),f},[]))}t.on("copyPaste.pasteElement",function(c){var l=c.cache,u=c.descriptor,p=u.businessObject,f=u.di;if(Je(u)){u.businessObject=ue(l[u.labelTarget]),u.di=pt(l[u.labelTarget]);return}p=u.businessObject=i(p),f=u.di=i(f),f.bpmnElement=p,id(u,p,["isExpanded","name"]),u.type=p.$type}),t.on("copyPaste.copyElement",rd,function(c){var l=c.descriptor,u=c.element;if(C(u,"bpmn:Participant")){var p=ue(u);p.processRef&&(l.processRef=i(p.processRef,!0))}}),t.on("copyPaste.pasteElement",function(c){var l=c.descriptor,u=l.processRef;u&&(l.processRef=i(u))}),t.on("copyPaste.createTree",function(c){var l=c.element,u=c.children;C(l,"bpmn:SubProcess")&&H(Ya(u),p=>{u.push(p.annotation)})}),t.on("copyPaste.pasteElement",rd,function(c){var l=c.cache,u=c.descriptor;a(l,s(u,l,o(l)))})}Ob.$inject=["bpmnFactory","eventBus","moddleCopy"];const Ak=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],Mk=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function cs(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 Oi(r,o=>o==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:r,property:o,propertyName:a}=i,s=dn(r)&&r.$descriptor;if(a&&Mk.includes(a))return o;if(a&&Ak.includes(a)||a&&s&&!Tt(s.properties,Oo({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",i=>{const{property:r}=i;if(C(r,"bpmn:ExtensionElements")&&(!r.values||!r.values.length))return!1})}cs.$inject=["eventBus","bpmnFactory","moddle"],cs.prototype.copyElement=function(e,t,n,i=!1){n&&!Fe(n)&&(n=[n]),n=n||od(e.$descriptor);const r=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return r===!1||(Fe(r)&&(n=r),H(n,o=>{let a;Vn(e,o)&&(a=e.get(o));const s=this.copyProperty(a,t,o,i);!an(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:o})===!1||t.set(o,s)})),t},cs.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 dn(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):Fe(e)?Wn(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):dn(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},cs.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 od(e,t){return Wn(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const Db={__depends__:[Ck],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",Ob],moddleCopy:["type",cs]};var Lb=Math.round;function ad(e,t){this._modeling=e,this._eventBus=t}ad.$inject=["modeling","eventBus"],ad.prototype.replaceElement=function(e,t,n){if(e.waypoints)return null;var i=this._modeling,r=this._eventBus;r.fire("replace.start",{element:e,attrs:t,hints:n});var o=t.width||e.width,a=t.height||e.height,s=t.x||e.x,c=t.y||e.y,l=Lb(s+o/2),u=Lb(c+a/2),p=i.replaceShape(e,W({},t,{x:l,y:u,width:o,height:a}),n);return r.fire("replace.end",{element:e,newElement:p,hints:n}),p};function Ib(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:r={}}=n;r.select!==!1&&e.select(i)})}Ib.$inject=["selection","eventBus"];const Pk={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",Ib],replace:["type",ad]};function Tk(e,t,n){Fe(n)||(n=[n]),H(n,function(i){Qr(e[i])||(t[i]=e[i])})}var kk=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function Ok(e,t){var n=e&&Vn(e,"collapsed")?e.collapsed:!at(e),i;return t&&(Vn(t,"collapsed")||Vn(t,"isExpanded"))?i=Vn(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function Bb(e,t,n,i,r,o){function a(s,c,l){l=l||{};var u=c.type,p=s.businessObject;if(bl(p)&&(u==="bpmn:SubProcess"||u==="bpmn:AdHocSubProcess")&&Ok(s,c))return i.toggleCollapse(s),s;var f=e.create(u),d={type:u,businessObject:f};d.di={},u==="bpmn:ExclusiveGateway"&&(d.di.isMarkerVisible=!0),Tk(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var h=od(p.$descriptor),m=od(f.$descriptor,!0),v=Dk(h,m);W(f,Ci(c,kk));var w=tt(v,function(y){return y==="eventDefinitions"?Nb(s,c.eventDefinitionType):y==="loopCharacteristics"?!Dn(f):Vn(f,y)||y==="processRef"&&c.isExpanded===!1||y==="triggeredByEvent"?!1:y==="isForCompensation"?!Dn(f):!0});if(f=n.copyElement(p,f,w),c.eventDefinitionType&&(Nb(f,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),C(p,"bpmn:Activity")){if(bl(p))d.isExpanded=at(s);else if(c&&Vn(c,"isExpanded")){d.isExpanded=c.isExpanded;var x=t.getDefaultSize(f,{isExpanded:d.isExpanded});d.width=x.width,d.height=x.height,d.x=s.x-(d.width-s.width)/2,d.y=s.y-(d.height-s.height)/2}at(s)&&!C(p,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(bl(p)&&!bl(f)&&(l.moveChildren=!1),C(p,"bpmn:Participant")){c.isExpanded===!0?f.processRef=e.create("bpmn:Process"):l.moveChildren=!1;var g=gn(s);pt(s).isHorizontal||(pt(d).isHorizontal=g),d.width=g?s.width:t.getDefaultSize(d).width,d.height=g?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,et(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&et(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(f.default=p.default),c.host&&!C(p,"bpmn:BoundaryEvent")&&C(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,{...l,targetElement:c})}this.replaceElement=a}Bb.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function bl(e){return C(e,"bpmn:SubProcess")}function Nb(e,t){var n=ue(e);return t&&n.get("eventDefinitions").some(function(i){return C(i,t)})}function Dk(e,t){return e.filter(function(n){return t.includes(n)})}const $b={__depends__:[Db,Pk,gi],bpmnReplace:["type",Bb]};var Lk=250;function ho(e){this._eventBus=e,this._tools=[],this._active=null}ho.$inject=["eventBus"],ho.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)},ho.prototype.isActive=function(e){return e&&this._active===e},ho.prototype.length=function(e){return this._tools.length},ho.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},ho.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),H(t,function(r){i.push(r+".ended"),i.push(r+".canceled")}),n.on(i,Lk,function(r){this._active&&(Ik(r)||this.setActive(null))},this)};function Ik(e){var t=e.originalEvent&&e.originalEvent.target;return t&&ro(t,'.group[data-group="tools"]')}const xl={__depends__:[ar],__init__:["toolManager"],toolManager:["type",ho]};function Bk(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 Nk(e,t){var n=[],i=new Set(e);H(t,function(o){i.add(o)});var r=new Set;return i.forEach(function(o){var a=o.incoming,s=o.outgoing;H(a.concat(s),function(c){var l=c.source,u=c.target;(i.has(l)||i.has(u))&&(r.has(c)||(r.add(c),n.push(c)))})}),n}function $k(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 sd=Math.abs,Fk=Math.round,sr={x:"width",y:"height"},Fb="crosshair",Lr={n:"top",w:"left",s:"bottom",e:"right"},jk=1500,_l={n:"s",w:"e",s:"n",e:"w"},wl=20;function yi(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",jk,function(c){var l=c.context,u=l.initialized;u||(u=l.initialized=s.init(c,l)),u&&Hb(c)}),n.on("spaceTool.end",function(c){var l=c.context,u=l.axis,p=l.direction,f=l.movingShapes,d=l.resizingShapes,h=l.start;if(l.initialized){Hb(c);var m={x:0,y:0};m[u]=Fk(c["d"+u]),s.makeSpace(f,d,m,p,h),n.once("spaceTool.ended",function(v){s.activateSelection(v.originalEvent,!0,!0)})}})}yi.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],yi.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:Fb,data:{context:{reactivate:n}},trapClick:!1})},yi.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:Fb,data:{context:{}}})},yi.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},yi.prototype.init=function(e,t){var n=sd(e.dx)>sd(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(sd(i)<5)return!1;i<0&&(i*=-1),rs(e)&&(i*=-1);var o=Bk(n,i),a=this._canvas.getRootElement();!ll(e)&&e.hover&&(a=e.hover);var s=[...za(a),...a.attachers||[]],c=this.calculateAdjustments(s,n,i,r),l=this._eventBus.fire("spaceTool.getMinDimensions",{axis:n,direction:o,shapes:c.resizingShapes,start:r}),u=Hk(c,n,o,r,l);return W(t,c,{axis:n,direction:o,spaceToolConstraints:u,start:r}),yl("resize-"+(n==="x"?"ew":"ns")),!0},yi.prototype.calculateAdjustments=function(e,t,n,i){var r=this._rules,o=[],a=[],s=new Set,c=new Set,l=[],u=[];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 H(e,function(d){if(!(!d.parent||Je(d))){if(Ct(d)){u.push(d);return}var h=d[t],m=h+d[sr[t]];if(zk(d)&&(n>0&&je(d)[t]>i||n<0&&je(d)[t]<i)){l.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}}}),H(o,function(d){var h=d.attachers;h&&H(h,function(m){p(m)})}),H(l,function(d){var h=d.host;(s.has(h)||c.has(h))&&p(d)}),H(u,function(d){var h=d.source,m=d.target,v=d.label;(s.has(h)||c.has(h))&&(s.has(m)||c.has(m))&&v&&p(v)}),{movingShapes:o,resizingShapes:a}},yi.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},yi.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function jb(e){return{top:e.top-wl,right:e.right+wl,bottom:e.bottom+wl,left:e.left-wl}}function Hb(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,r;Ge(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),Ge(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),Ge(n.top)&&(r=Math.max(e.y,n.top),e.dy=e.dy+r-e.y,e.y=r),Ge(n.bottom)&&(r=Math.min(e.y,n.bottom),e.dy=e.dy+r-e.y,e.y=r)}}function Hk(e,t,n,i,r){var o=e.movingShapes,a=e.resizingShapes;if(a.length){var s={},c,l,u=new Set(o),p=new Set(a);return H(a,function(f){var d=f.attachers,h=f.children,m=Ie(f),v=tt(h,function(F){return!Ct(F)&&!Je(F)&&!u.has(F)&&!p.has(F)}),w=tt(h,function(F){return!Ct(F)&&!Je(F)&&u.has(F)}),x,g,y,S=[],E=[],T,k,I,P;v.length&&(g=jb(Ie(Jt(v))),x=i-m[Lr[n]]+g[Lr[n]],n==="n"?s.bottom=l=Ge(l)?Math.min(l,x):x:n==="w"?s.right=l=Ge(l)?Math.min(l,x):x:n==="s"?s.top=c=Ge(c)?Math.max(c,x):x:n==="e"&&(s.left=c=Ge(c)?Math.max(c,x):x)),w.length&&(y=jb(Ie(Jt(w))),x=i-y[Lr[_l[n]]]+m[Lr[_l[n]]],n==="n"?s.bottom=l=Ge(l)?Math.min(l,x):x:n==="w"?s.right=l=Ge(l)?Math.min(l,x):x:n==="s"?s.top=c=Ge(c)?Math.max(c,x):x:n==="e"&&(s.left=c=Ge(c)?Math.max(c,x):x)),d&&d.length&&(d.forEach(function(F){u.has(F)?S.push(F):E.push(F)}),S.length&&(T=Ie(Jt(S.map(je))),k=m[Lr[_l[n]]]-(T[Lr[_l[n]]]-i)),E.length&&(I=Ie(Jt(E.map(je))),P=I[Lr[n]]-(m[Lr[n]]-i)),n==="n"?(x=Math.min(k||1/0,P||1/0),s.bottom=l=Ge(l)?Math.min(l,x):x):n==="w"?(x=Math.min(k||1/0,P||1/0),s.right=l=Ge(l)?Math.min(l,x):x):n==="s"?(x=Math.max(k||-1/0,P||-1/0),s.top=c=Ge(c)?Math.max(c,x):x):n==="e"&&(x=Math.max(k||-1/0,P||-1/0),s.left=c=Ge(c)?Math.max(c,x):x));var O=r&&r[f.id];O&&(n==="n"?(x=i+f[sr[t]]-O[sr[t]],s.bottom=l=Ge(l)?Math.min(l,x):x):n==="w"?(x=i+f[sr[t]]-O[sr[t]],s.right=l=Ge(l)?Math.min(l,x):x):n==="s"?(x=i-f[sr[t]]+O[sr[t]],s.top=c=Ge(c)?Math.max(c,x):x):n==="e"&&(x=i-f[sr[t]]+O[sr[t]],s.left=c=Ge(c)?Math.max(c,x):x))}),s}}function zk(e){return!!e.host}var cd="djs-dragging",zb="djs-resizing",Gk=250,El=Math.max;function Gb(e,t,n,i,r){function o(a,s){H(a,function(c){r.addDragger(c,s),n.addMarker(c,cd)})}e.on("spaceTool.selection.start",function(a){var s=n.getLayer("space"),c=a.context,l={x:"M 0,-10000 L 0,10000",y:"M -10000,0 L 10000,0"},u=De("g");Se(u,i.cls("djs-crosshair-group",["no-events"])),qe(s,u);var p=De("path");Se(p,"d",l.x),ct(p).add("djs-crosshair"),qe(u,p);var f=De("path");Se(f,"d",l.y),ct(f).add("djs-crosshair"),qe(u,f),c.crosshairGroup=u}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;Rn(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&cn(c)}),e.on("spaceTool.move",Gk,function(a){var s=a.context,c=s.line,l=s.axis,u=s.movingShapes,p=s.resizingShapes;if(s.initialized){if(!s.dragGroup){var f=n.getLayer("space");c=De("path"),Se(c,"d","M0,0 L0,0"),ct(c).add("djs-crosshair"),qe(f,c),s.line=c;var d=De("g");Se(d,i.cls("djs-drag-group",["no-events"])),qe(n.getActiveLayer(),d),o(u,d);var h=new Set(u);H(p,function(E){h.add(E)});var m=new Set,v=s.movingConnections=[];h.forEach(function(E){H(E.outgoing,function(T){m.has(T)||!Ct(T)||!h.has(T.target)||(m.add(T),v.push(T))})}),o(v,d),s.dragGroup=d}if(!s.frameGroup){var w=De("g");Se(w,i.cls("djs-frame-group",["no-events"])),qe(n.getActiveLayer(),w);var x=[];H(p,function(E){var T=r.addFrame(E,w),k=T.getBBox();x.push({element:T,initialBounds:k}),n.addMarker(E,zb)}),s.frameGroup=w,s.frames=x}var g={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};Se(c,{d:g[l]});var y={x:"y",y:"x"},S={x:a.dx,y:a.dy};S[y[s.axis]]=0,Rn(s.dragGroup,S.x,S.y),H(s.frames,function(E){var T=E.element,k=E.initialBounds,I,P;s.direction==="e"?Se(T,{width:El(k.width+S.x,5)}):(I=El(k.width-S.x,5),Se(T,{width:I,x:k.x+k.width-I})),s.direction==="s"?Se(T,{height:El(k.height+S.y,5)}):(P=El(k.height-S.y,5),Se(T,{height:P,y:k.y+k.height-P}))})}}),e.on("spaceTool.cleanup",function(a){var s=a.context,c=s.movingShapes,l=s.movingConnections,u=s.resizingShapes,p=s.line,f=s.dragGroup,d=s.frameGroup;H(c,function(h){n.removeMarker(h,cd)}),H(l,function(h){n.removeMarker(h,cd)}),f&&(cn(p),cn(f)),H(u,function(h){n.removeMarker(h,zb)}),d&&cn(d)})}Gb.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const Vk={__init__:["spaceToolPreview"],__depends__:[ar,Vi,xl,la,ss],spaceTool:["type",yi],spaceToolPreview:["type",Gb]};function Sl(e,t){e.invoke(yi,this),this._canvas=t}Sl.$inject=["injector","canvas"],Ee(Sl,yi),Sl.prototype.calculateAdjustments=function(e,t,n,i){var r=this._canvas.getRootElement(),o=e[0]===r?null:e[0],a=[];o&&(a=To(Wo(r.children.filter(l=>C(l,"bpmn:Artifact")),Jt(o))));const s=[...e,...a];var c=yi.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(l){return!(C(l,"bpmn:TextAnnotation")||Wk(l)&&(t==="y"&&gn(l)||t==="x"&&!gn(l)))}),c};function Wk(e){return C(e,"bpmn:Participant")&&!ue(e).processRef}const Vb={__depends__:[Vk],spaceTool:["type",Sl]};function jt(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)}jt.$inject=["eventBus","injector"],jt.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()},jt.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},jt.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},jt.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()}},jt.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()}},jt.prototype.register=function(e,t){this._setHandler(e,t)},jt.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)},jt.prototype.canUndo=function(){return!!this._getUndoAction()},jt.prototype.canRedo=function(){return!!this._getRedoAction()},jt.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},jt.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},jt.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)})},jt.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},jt.prototype._createId=function(){return this._uid++},jt.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},jt.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()},jt.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)},jt.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:Hh("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},jt.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=Fe(e)?e:[e],t.dirty=t.dirty.concat(e))},jt.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},jt.prototype._revertedAction=function(e){this._stackIdx--},jt.prototype._getHandler=function(e){return this._handlerMap[e]},jt.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 Uk={commandStack:["type",jt]};function Ir(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 qk=250,Wb=1400;function ld(e,t,n){ce.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",Wb,function(r){var o=r.context,a=o.shapes,s=o.validatedShapes;o.shapes=Ub(a),o.validatedShapes=Ub(s)}),i&&t.on("shape.move.start",qk,function(r){var o=r.context,a=new Set(o.shapes),s=new Set;for(const c of a)for(const l of c.labels)!l.hidden&&!a.has(l)&&s.add(l),c.labelTarget&&s.add(c);for(const c of s)i.makeDraggable(o,c,!0)}),this.preExecuted("elements.move",Wb,function(r){var o=r.context,a=o.closure,s=a.enclosedElements,c=[];H(s,function(l){H(l.labels,function(u){s[u.id]||c.push(u)})}),a.addAll(c)}),this.preExecute(["connection.delete","shape.delete"],function(r){var o=r.context,a=o.connection||o.shape;Ir(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=Hp(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&&(qt(s.labels,a,c),a.labelTarget=s)})}Ee(ld,ce),ld.$inject=["injector","eventBus","modeling"];function Ub(e){var t=new Set(e);return tt(e,function(n){return!t.has(n.labelTarget)})}const Yk={__init__:["labelSupport"],labelSupport:["type",ld]};var Kk=251,qb=1401,Yb="attach-ok";function ud(e,t,n,i,r){ce.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",qb,function(a){var s=a.context,c=s.shapes,l=s.validatedShapes;s.shapes=Xk(c),s.validatedShapes=Zk(l)}),o&&t.on("shape.move.start",Kk,function(a){var s=a.context,c=s.shapes,l=pd(c);H(l,function(u){o.makeDraggable(s,u,!0),H(u.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 l=c[0],u=l.host;u&&(n.addMarker(u,Yb),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(u,Yb)}))}}),this.preExecuted("elements.move",qb,function(a){var s=a.context,c=s.closure,l=s.shapes,u=pd(l);H(u,function(p){c.add(p,c.topLevel[p.host.id])})}),this.postExecuted("elements.move",function(a){var s=a.context,c=s.shapes,l=s.newHost,u;l&&c.length!==1||(l?u=c:u=tt(c,function(p){var f=p.host;return Qk(p)&&!Jk(c,f)}),H(u,function(p){r.updateAttachment(p,l)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;H(s,function(c){H(c.attachers,function(l){H(l.outgoing.slice(),function(u){var p=i.allowed("connection.reconnect",{connection:u,source:u.source,target:u.target});p||r.removeConnection(u)}),H(l.incoming.slice(),function(u){var p=i.allowed("connection.reconnect",{connection:u,source:u.source,target:u.target});p||r.removeConnection(u)})})})}),this.postExecute("shape.create",function(a){var s=a.context,c=s.shape,l=s.host;l&&r.updateAttachment(c,l)}),this.postExecute("shape.replace",function(a){var s=a.context,c=s.oldShape,l=s.newShape;Ir(c.attachers,function(u){var p=i.allowed("elements.move",{target:l,shapes:[u]});p==="attach"?r.updateAttachment(u,l):r.removeShape(u)}),l.attachers.length&&H(l.attachers,function(u){var p=fv(u,c,l);r.moveShape(u,p,u.parent)})}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.oldBounds,u=s.newBounds,p=c.attachers,f=s.hints||{};f.attachSupport!==!1&&H(p,function(d){var h=fv(d,l,u);r.moveShape(d,h,d.parent),H(d.labels,function(m){r.moveShape(m,h,m.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;Ir(s.attachers,function(c){r.removeShape(c)}),s.host&&r.updateAttachment(s,null)})}Ee(ud,ce),ud.$inject=["injector","eventBus","canvas","rules","modeling"];function pd(e){return Wu(Mn(e,function(t){return t.attachers||[]}))}function Xk(e){var t=pd(e);return FE("id",e,t)}function Zk(e){var t=ko(e,"id");return tt(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function Qk(e){return!!e.host}function Jk(e,t){return e.indexOf(t)!==-1}const e2={__depends__:[Vi],__init__:["attachSupport"],attachSupport:["type",ud]};function Kb(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(Hg(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)})}Kb.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const fd={__init__:["changeSupport"],changeSupport:["type",Kb]};function vi(e){this._model=e}vi.$inject=["moddle"],vi.prototype._needsId=function(e){return et(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"])},vi.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;C(e,"bpmn:Activity")?t="Activity":C(e,"bpmn:Event")?t="Event":C(e,"bpmn:Gateway")?t="Gateway":et(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))},vi.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},vi.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},vi.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",W({bpmnElement:e,bounds:this.createDiBounds()},t))},vi.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},vi.prototype.createDiWaypoints=function(e){var t=this;return Mn(e,function(n){return t.createDiWaypoint(n)})},vi.prototype.createDiWaypoint=function(e){return this.create("dc:Point",Ci(e,["x","y"]))},vi.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",W({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},vi.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",W({bpmnElement:e},t))};function Zn(e,t,n){ce.call(this,e),this._bpmnFactory=t;var i=this;function r(d){var h=d.context,m=h.hints||{},v;!h.cropped&&m.createElementsBehavior!==!1&&(v=h.connection,v.waypoints=n.getCroppedWaypoints(v),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,v=h.parent||h.newParent;i.updateParent(m,v)}this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],Qn(o)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],Qn(a));function s(d){var h=d.context,m=h.oldRoot,v=m.children;H(v,function(w){C(w,"bpmn:BaseElement")&&i.updateParent(w)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(d){var h=d.context.shape;C(h,"bpmn:BaseElement")&&i.updateBounds(h)}this.executed(["shape.move","shape.create","shape.resize"],Qn(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],Qn(function(d){d.context.shape.type!=="label"&&c(d)})),e.on("shape.changed",function(d){d.element.type==="label"&&c({context:{shape:d.element}})});function l(d){i.updateConnection(d.context)}this.executed(["connection.create","connection.move","connection.delete","connection.reconnect"],Qn(l)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],Qn(l));function u(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],Qn(u)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],Qn(u)),this.executed("connection.reconnect",Qn(function(d){var h=d.context,m=h.connection,v=h.oldSource,w=h.newSource,x=ue(m),g=ue(v),y=ue(w);x.conditionExpression&&!et(y,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(h.oldConditionExpression=x.conditionExpression,delete x.conditionExpression),v!==w&&g.default===x&&(h.oldDefault=g.default,delete g.default)})),this.reverted("connection.reconnect",Qn(function(d){var h=d.context,m=h.connection,v=h.oldSource,w=h.newSource,x=ue(m),g=ue(v),y=ue(w);h.oldConditionExpression&&(x.conditionExpression=h.oldConditionExpression),h.oldDefault&&(g.default=h.oldDefault,delete y.default)}));function p(d){i.updateAttachment(d.context)}this.executed(["element.updateAttachment"],Qn(p)),this.reverted(["element.updateAttachment"],Qn(p)),this.executed("element.updateLabel",Qn(f)),this.reverted("element.updateLabel",Qn(f));function f(d){const{element:h}=d.context,m=li(h),v=pt(h),w=v&&v.get("label");Mr(h)||ul(h)||(m&&!w?v.set("label",t.create("bpmndi:BPMNLabel")):!m&&w&&v.set("label",void 0))}}Ee(Zn,ce),Zn.$inject=["eventBus","bpmnFactory","connectionDocking"],Zn.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},Zn.prototype.updateParent=function(e,t){if(!Je(e)&&!(C(e,"bpmn:DataStoreReference")&&e.parent&&C(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=pt(e),o=n&&n.businessObject,a=pt(n);C(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,o,t&&t.businessObject),C(e,"bpmn:DataOutputAssociation")&&(e.source?o=e.source.businessObject:o=null),C(e,"bpmn:DataInputAssociation")&&(e.target?o=e.target.businessObject:o=null),this.updateSemanticParent(i,o),C(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,o),this.updateDiParent(r,a)}},Zn.prototype.updateBounds=function(e){var t=pt(e),n=n2(e);if(n){var i=Mi(n,t.get("bounds"));W(n,{x:e.x+i.x,y:e.y+i.y})}var r=Je(e)?this._getLabel(t):t,o=r.bounds;o||(o=this._bpmnFactory.createDiBounds(),r.set("bounds",o)),W(o,{x:e.x,y:e.y,width:e.width,height:e.height})},Zn.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,r;C(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),Wt(i,e)),C(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),qt(r,e))}},Zn.prototype.updateDiConnection=function(e,t,n){var i=pt(e),r=pt(t),o=pt(n);i.sourceElement&&i.sourceElement.bpmnElement!==ue(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==ue(n)&&(i.targetElement=n&&o)},Zn.prototype.updateDiParent=function(e,t){if(t&&!C(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(Wt(n,e),e.$parent=null)}};function t2(e){for(;e&&!C(e,"bpmn:Definitions");)e=e.$parent;return e}Zn.prototype.getLaneSet=function(e){var t,n;return C(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(C(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)},Zn.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&!((C(e,"bpmn:DataInput")||C(e,"bpmn:DataOutput"))&&(C(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(C(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(C(e,"bpmn:FlowElement")){if(t){if(C(t,"bpmn:Participant"))t=t.processRef;else if(C(t,"bpmn:Lane"))do t=t.$parent.$parent;while(C(t,"bpmn:Lane"))}i="flowElements"}else if(C(e,"bpmn:Artifact")){for(;t&&!C(t,"bpmn:Process")&&!C(t,"bpmn:SubProcess")&&!C(t,"bpmn:Collaboration");)if(C(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;i="artifacts"}else if(C(e,"bpmn:MessageFlow"))i="messageFlows";else if(C(e,"bpmn:Participant")){i="participants";var r=e.processRef,o;r&&(o=t2(e.$parent||t),e.$parent&&(Wt(o.get("rootElements"),r),r.$parent=null),t&&(qt(o.get("rootElements"),r),r.$parent=o))}else C(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":C(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),Wt(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);Wt(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},Zn.prototype.updateConnectionWaypoints=function(e){var t=pt(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},Zn.prototype.updateConnection=function(e){var t=e.connection,n=ue(t),i=t.source,r=ue(i),o=t.target,a=ue(t.target),s;if(C(n,"bpmn:DataAssociation"))C(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=r,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):C(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||r,this.updateSemanticParent(n,r,s),n.targetRef=a);else{var c=C(n,"bpmn:SequenceFlow");n.sourceRef!==r&&(c&&(Wt(n.sourceRef&&n.sourceRef.get("outgoing"),n),r&&r.get("outgoing")&&r.get("outgoing").push(n)),n.sourceRef=r),n.targetRef!==a&&(c&&(Wt(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)},Zn.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function Qn(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;C(i,"bpmn:BaseElement")&&e(t)}}function n2(e){if(C(e,"bpmn:Activity")){var t=pt(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function Br(e,t){nr.call(this),this._bpmnFactory=e,this._moddle=t}Ee(Br,nr),Br.$inject=["bpmnFactory","moddle"],Br.prototype._baseCreate=nr.prototype.create,Br.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,W({type:"label",di:n},co,t))}return this.createElement(e,t)},Br.prototype.createElement=function(e,t){t=W({},t||{});var n,i=t.businessObject,r=t.di;if(!i){if(!t.type)throw new Error("no shape type specified");i=this._bpmnFactory.create(t.type)}if(!r2(r)){var o=W({},r||{},{id:i.id+"_di"});e==="root"?r=this._bpmnFactory.createDiPlane(i,o):e==="connection"?r=this._bpmnFactory.createDiEdge(i,o):r=this._bpmnFactory.createDiShape(i,o)}C(i,"bpmn:Group")&&(t=W({isFrame:!0},t)),t=i2(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=dd(r,t,"isExpanded")),et(i,["bpmn:Lane","bpmn:Participant"])&&(t=dd(r,t,"isHorizontal")),C(i,"bpmn:SubProcess")&&(t.collapsed=!at(i,r)),C(i,"bpmn:ExclusiveGateway")&&(Vn(r,"isMarkerVisible")?r.isMarkerVisible===void 0&&(r.isMarkerVisible=!1):r.isMarkerVisible=!0),an(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),an(t.cancelActivity)&&(i.cancelActivity=t.cancelActivity,delete t.cancelActivity);var a,s;return t.eventDefinitionType&&(a=i.get("eventDefinitions")||[],s=this._bpmnFactory.create(t.eventDefinitionType,t.eventDefinitionAttrs),t.eventDefinitionType==="bpmn:ConditionalEventDefinition"&&(s.condition=this._bpmnFactory.create("bpmn:FormalExpression")),a.push(s),s.$parent=i,i.eventDefinitions=a,delete t.eventDefinitionType),n=this.getDefaultSize(i,r),t=W({id:i.id},n,t,{businessObject:i,di:r}),this._baseCreate(e,t)},Br.prototype.getDefaultSize=function(e,t){var n=ue(e);if(t=t||pt(e),C(n,"bpmn:SubProcess"))return at(n,t)?{width:350,height:200}:{width:100,height:80};if(C(n,"bpmn:Task"))return{width:100,height:80};if(C(n,"bpmn:Gateway"))return{width:50,height:50};if(C(n,"bpmn:Event"))return{width:36,height:36};if(C(n,"bpmn:Participant")){var i=t.isHorizontal===void 0||t.isHorizontal===!0;return at(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return C(n,"bpmn:Lane")?{width:400,height:100}:C(n,"bpmn:DataObjectReference")?{width:36,height:50}:C(n,"bpmn:DataStoreReference")?{width:50,height:50}:C(n,"bpmn:TextAnnotation")?{width:100,height:40}:C(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},Br.prototype.createParticipantShape=function(e){return dn(e)||(e={isExpanded:e}),e=W({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function i2(e,t,n){return H(n,function(i){t=dd(e,t,i)}),t}function dd(e,t,n){return t[n]===void 0?t:(e[n]=t[n],Di(t,[n]))}function r2(e){return et(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function Rl(e,t){this._modeling=e,this._canvas=t}Rl.$inject=["modeling","canvas"],Rl.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;H(n,function(r){var o={x:0,y:0};an(i.left)?o.x=i.left-r.x:an(i.right)?o.x=i.right-r.width-r.x:an(i.center)?o.x=i.center-Math.round(r.width/2)-r.x:an(i.top)?o.y=i.top-r.y:an(i.bottom)?o.y=i.bottom-r.height-r.y:an(i.middle)&&(o.y=i.middle-Math.round(r.height/2)-r.y),t.moveElements([r],o,r.parent)})},Rl.prototype.postExecute=function(e){};function Cl(e){this._modeling=e}Cl.$inject=["modeling"],Cl.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},Cl.prototype.postExecute=function(e){var t=e.hints||{};o2(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 o2(e,t){return yr(e.outgoing,function(n){return n.target===t})}function Al(e,t){this._canvas=e,this._layouter=t}Al.$inject=["canvas","layouter"],Al.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},Al.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var Ml=Math.round;function hd(e){this._modeling=e}hd.$inject=["modeling"],hd.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,r=e.position,o=e.hints,a=this._modeling;H(t,function(p){Ge(p.x)||(p.x=0),Ge(p.y)||(p.y=0)});var s=tt(t,function(p){return!p.hidden}),c=Jt(s);H(t,function(p){Ct(p)&&(p.waypoints=Mn(p.waypoints,function(f){return{x:Ml(f.x-c.x-c.width/2+r.x),y:Ml(f.y-c.y-c.height/2+r.y)}})),W(p,{x:Ml(p.x-c.x-c.width/2+r.x),y:Ml(p.y-c.y-c.height/2+r.y)})});var l=new Set(Tc(t)),u={};H(t,function(p){if(Ct(p)){u[p.id]=Ge(i)?a.createConnection(u[p.source.id],u[p.target.id],i,p,p.parent||n,o):a.createConnection(u[p.source.id],u[p.target.id],p,p.parent||n,o);return}var f=W({},o);l.has(p)||(f.autoResize=!1),Je(p)&&(f=Di(f,["attach"])),u[p.id]=Ge(i)?a.createShape(p,Ci(p,["x","y","width","height"]),p.parent||n,i,f):a.createShape(p,Ci(p,["x","y","width","height"]),p.parent||n,f)}),e.elements=To(u)};var Xb=Math.round;function Nr(e){this._canvas=e}Nr.$inject=["canvas"],Nr.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,r=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return n.width!==void 0?W(t,n):W(t,{x:n.x-Xb(t.width/2),y:n.y-Xb(t.height/2)}),this._canvas.addShape(t,i,r),t},Nr.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function ls(e){Nr.call(this,e)}Ee(ls,Nr),ls.$inject=["canvas"];var a2=Nr.prototype.execute;ls.prototype.execute=function(e){var t=e.shape;return c2(t),t.labelTarget=e.labelTarget,a2.call(this,e)};var s2=Nr.prototype.revert;ls.prototype.revert=function(e){return e.shape.labelTarget=null,s2.call(this,e)};function c2(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function us(e,t){this._canvas=e,this._modeling=t}us.$inject=["canvas","modeling"],us.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;Ir(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),Ir(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},us.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=Hp(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},us.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,qt(n.children,t,i),this._canvas.addConnection(t,n),t};function md(e,t){this._modeling=e,this._elementRegistry=t}md.$inject=["modeling","elementRegistry"],md.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;H(i,function(r){n.get(r.id)&&(r.waypoints?t.removeConnection(r):t.removeShape(r))})};function ps(e,t){this._canvas=e,this._modeling=t}ps.$inject=["canvas","modeling"],ps.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;Ir(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),Ir(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),Ir(n.children,function(i){Ct(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},ps.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=Hp(i.children,n),t.removeShape(n),n},ps.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return qt(i.children,n,r),t.addShape(n,i),n};function Pl(e){this._modeling=e}Pl.$inject=["modeling"];var Zb={x:"y",y:"x"};Pl.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(v,w){v.range.min=Math.min(w[i],v.range.min),v.range.max=Math.max(w[i]+w[r],v.range.max)}function a(v){return v[i]+v[r]/2}function s(v){return v.length-1}function c(v){return v.max-v.min}function l(v,w){var x={y:0};x[i]=v-a(w),x[i]&&(x[Zb[i]]=0,t.moveElements([w],x,w.parent))}var u=n[0],p=s(n),f=n[p],d,h,m=0;H(n,function(v,w){var x,g,y;if(v.elements.length<2){w&&w!==n.length-1&&(o(v,v.elements[0]),m+=c(v.range));return}x=Oi(v.elements,i),g=x[0],w===p&&(g=x[s(x)]),y=a(g),v.range=null,H(x,function(S){if(l(y,S),v.range===null){v.range={min:S[i],max:S[i]+S[r]};return}o(v,S)}),w&&w!==n.length-1&&(m+=c(v.range))}),h=Math.abs(f.range.min-u.range.max),d=Math.round((h-m)/(n.length-1)),!(d<n.length-1)&&H(n,function(v,w){var x={},g;v===u||v===f||(g=n[w-1],v.range.max=0,H(v.elements,function(y,S){x[Zb[i]]=0,x[i]=g.range.max-y[i]+d,v.range.min!==y[i]&&(x[i]+=y[i]-v.range.min),x[i]&&t.moveElements([y],x,y.parent),v.range.max=Math.max(y[i]+y[r],S?v.range.max:0)}))})},Pl.prototype.postExecute=function(e){};function Tl(e,t){this._layouter=e,this._canvas=t}Tl.$inject=["layouter","canvas"],Tl.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return W(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},Tl.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function gd(){}gd.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=Wt(o.children,t),qt(i.children,t,r),t.parent=i,H(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},gd.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return Wt(n.children,t),qt(i.children,t,r),t.parent=i,H(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 yd(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}yd.prototype.add=function(e,t){return this.addAll([e],t)},yd.prototype.addAll=function(e,t){var n=$C(e,!!t,this);return W(this,n),this};function fs(e){this._modeling=e}fs.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},fs.prototype.moveClosure=function(e,t,n,i,r){var o=this._modeling,a=e.allShapes,s=e.allConnections,c=e.enclosedConnections,l=e.topLevel,u=!1;r&&r.parent===n&&(u=!0),H(a,function(p){o.moveShape(p,t,l[p.id]&&!u&&n,{recurse:!1,layout:!1})}),H(s,function(p){var f=!!a[p.source.id],d=!!a[p.target.id];c[p.id]&&f&&d?o.moveConnection(p,t,l[p.id]&&!u&&n):o.layoutConnection(p,{connectionStart:f&&Sf(p,p.source,t),connectionEnd:d&&Rf(p,p.target,t)})})},fs.prototype.getClosure=function(e){return new yd().addAll(e,!0)};function kl(e){this._helper=new fs(e)}kl.$inject=["modeling"],kl.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},kl.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 mo(e){this._modeling=e,this._helper=new fs(e)}mo.$inject=["modeling"],mo.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=Ci(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=Wt(o.children,t),qt(i.children,t,r),W(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},mo.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,r=this._modeling;i.layout!==!1&&(H(t.incoming,function(o){r.layoutConnection(o,{connectionEnd:Rf(o,t,n)})}),H(t.outgoing,function(o){r.layoutConnection(o,{connectionStart:Sf(o,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},mo.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return qt(n.children,t,i),W(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},mo.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},mo.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function ds(e){this._modeling=e}ds.$inject=["modeling"],ds.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 Fe(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},ds.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||Qb(Fe(r)?r[0]:r)),i&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||Qb(Fe(r)?r[r.length-1]:r)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},ds.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 Qb(e){return e.original||e}function cr(e,t){this._modeling=e,this._rules=t}cr.$inject=["modeling","rules"],cr.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,v){return i.allowed("connection.reconnect",{connection:v,source:h,target:m})}var l={x:o.x,y:o.y},u={x:r.x,y:r.y,width:r.width,height:r.height};s=e.newShape=e.newShape||t.createShape(o,l,r.parent,a),r.host&&n.updateAttachment(s,r.host);var 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();H(f,function(h){var m=h.source,v=c(m,s,h);v&&t.reconnectEnd(h,s,rl(h,s,u),a)}),H(d,function(h){var m=h.target,v=c(s,m,h);v&&t.reconnectStart(h,s,il(h,s,u),a)})},cr.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},cr.prototype.execute=function(e){},cr.prototype.revert=function(e){},cr.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},cr.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},cr.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function hs(e){this._modeling=e}hs.$inject=["modeling"],hs.prototype.execute=function(e){var t=e.shape,n=e.newBounds,i=e.minBounds;if(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)throw new Error("newBounds must have {x, y, width, height} properties");if(i&&(n.width<i.width||n.height<i.height))throw new Error("width and height cannot be less than minimum height and width");if(!i&&n.width<10||n.height<10)throw new Error("width and height cannot be less than 10px");return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},W(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},hs.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,r=e.hints||{};r.layout!==!1&&(H(n.incoming,function(o){t.layoutConnection(o,{connectionEnd:rl(o,n,i)})}),H(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:il(o,n,i)})}))},hs.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return W(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function $r(e){this._modeling=e}$r.$inject=["modeling"],$r.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),H(r,function(s){a[s.id]=u2(s)}),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(Nk(i,r),t,n,o,i,r,a)},$r.prototype.execute=function(){},$r.prototype.revert=function(){},$r.prototype.moveShapes=function(e,t){var n=this;H(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},$r.prototype.resizeShapes=function(e,t,n){var i=this;H(e,function(r){var o=$k(r,n,t);i._modeling.resizeShape(r,o,null,{attachSupport:!1,autoResize:!1,layout:!1})})},$r.prototype.updateConnectionWaypoints=function(e,t,n,i,r,o,a){var s=this,c=new Set(r),l=new Set(o);H(e,function(u){var p=u.source,f=u.target,d=l2(u),h=ex(n),m={},v=c.has(p)||l.has(p),w=c.has(f)||l.has(f);v&&w?(d=Mn(d,function(x){return tx(x,i,n)&&(x[h]=x[h]+t[h]),x.original&&tx(x.original,i,n)&&(x.original[h]=x.original[h]+t[h]),x}),s._modeling.updateWaypoints(u,d,{labelBehavior:!1})):(v||w)&&(c.has(p)?m.connectionStart=Sf(u,p,t):c.has(f)?m.connectionEnd=Rf(u,f,t):l.has(p)?m.connectionStart=il(u,p,a[p.id]):l.has(f)&&(m.connectionEnd=rl(u,f,a[f.id])),s._modeling.layoutConnection(u,m))})};function Jb(e){return W({},e)}function l2(e){return Mn(e.waypoints,function(t){return t=Jb(t),t.original&&(t.original=Jb(t.original)),t})}function ex(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function tx(e,t,n){var i=ex(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function u2(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function Ol(e){this._modeling=e}Ol.$inject=["modeling"],Ol.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=nx(n),t.collapsed=!t.collapsed;var i=ix(n,t.collapsed);return[t].concat(i)},Ol.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,r=rx(i,n);return t.collapsed=!t.collapsed,[t].concat(r)};function nx(e){var t={};return H(e,function(n){t[n.id]=n.hidden,n.children&&(t=W({},t,nx(n.children)))}),t}function ix(e,t){var n=[];return H(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(ix(i.children,i.collapsed||t)))}),n}function rx(e,t){var n=[];return H(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(rx(i.children,t)))}),n}function Dl(e){this._modeling=e}Dl.$inject=["modeling"],Dl.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=ox(i,t),ax(n,t),t.host=n,t},Dl.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,ox(n,t),ax(i,t,r),t};function ox(e,t){return Wt(e&&e.attachers,t)}function ax(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),qt(i,t,n)}}function vd(){}vd.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},vd.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function At(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}At.$inject=["eventBus","elementFactory","commandStack"],At.prototype.getHandlers=function(){return{"shape.append":Cl,"shape.create":Nr,"shape.delete":ps,"shape.move":mo,"shape.resize":hs,"shape.replace":cr,"shape.toggleCollapse":Ol,spaceTool:$r,"label.create":ls,"connection.create":Al,"connection.delete":us,"connection.move":gd,"connection.layout":Tl,"connection.updateWaypoints":vd,"connection.reconnect":ds,"elements.create":hd,"elements.move":kl,"elements.delete":md,"elements.distribute":Pl,"elements.align":Rl,"element.updateAttachment":Dl}},At.prototype.registerHandlers=function(e){H(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},At.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)},At.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},At.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)},At.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)},At.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},At.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},At.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},At.prototype.createElements=function(e,t,n,i,r){Fe(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},At.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},At.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},At.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},At.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},At.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},At.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},At.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},At.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},At.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},At.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)},At.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},At.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)},At.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,W(i,{docking:"source"}))},At.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,W(i,{docking:"target"}))},At.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},At.prototype._create=function(e,t){return EA(t)?t:this._elementFactory.create(e,t)},At.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function ms(e){this._elementRegistry=e}ms.$inject=["elementRegistry"],ms.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||p2(n,Ks(i));return sx(n,i),e.oldProperties=o,e.changed=r,r},ms.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return sx(n,t),i},ms.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return C(e,"bpmn:DataObject")?f2(e,t):[]};function p2(e,t){return Wn(t,function(n,i){return n[i]=e.get(i),n},{})}function sx(e,t){H(t,function(n,i){e.set(i,n)})}function f2(e,t){return t.filter(function(n){return C(n,"bpmn:DataObjectReference")&&ue(n).dataObjectRef===e})}var gs="default",lr="id",cx="di",d2={width:0,height:0};function ys(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}ys.$inject=["elementRegistry","moddle","modeling","textRenderer"],ys.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=v2(e.properties),s=e.oldProperties||h2(t,a);return lx(a,o)&&(r.unclaim(o[lr]),i.updateId(t,a[lr]),r.claim(a[lr],o)),gs in a&&(a[gs]&&n.push(i.get(a[gs].id)),o[gs]&&n.push(i.get(o[gs].id))),ux(t,a),e.oldProperties=s,e.changed=n,n},ys.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&ue(n).name;if(i){var r=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,r,d2)}},ys.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 ux(t,i),lx(n,r)&&(a.unclaim(n[lr]),o.updateId(t,i[lr]),a.claim(i[lr],r)),e.changed};function lx(e,t){return lr in e&&e[lr]!==t[lr]}function h2(e,t){var n=Ks(t),i=e.businessObject,r=pt(e);return Wn(n,function(o,a){return a!==cx?o[a]=i.get(a):o[a]=m2(r,Ks(t.di)),o},{})}function m2(e,t){return Wn(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function ux(e,t){var n=e.businessObject,i=pt(e);H(t,function(r,o){o!==cx?n.set(o,r):i&&g2(i,r)})}function g2(e,t){H(t,function(n,i){e.set(i,n)})}var y2=["default"];function v2(e){var t=W({},e);return y2.forEach(function(n){n in e&&(t[n]=ue(t[n]))}),t}function Ll(e,t){this._canvas=e,this._modeling=t}Ll.$inject=["canvas","modeling"],Ll.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=pt(r);return t.setRootElement(n),t.removeRootElement(r),qt(a.rootElements,i),i.$parent=a,Wt(a.rootElements,o),o.$parent=null,r.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=r,[]},Ll.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,a=i.$parent,s=pt(n);return t.setRootElement(r),t.removeRootElement(n),Wt(a.rootElements,i),i.$parent=null,qt(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,r.di=s,[]};function bd(e,t){this._modeling=e,this._spaceTool=t}bd.$inject=["modeling","spaceTool"],bd.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=hi(i),a=o===i,s=a?i:i.parent,c=Tr(s),l=gn(i);if(l?r==="left"?r="top":r==="right"&&(r="bottom"):r==="top"?r="left":r==="bottom"&&(r="right"),!c.length){var u=l?{x:i.x+di,y:i.y,width:i.width-di,height:i.height}:{x:i.x,y:i.y+di,width:i.width,height:i.height-di};n.createShape({type:"bpmn:Lane",isHorizontal:l},u,s)}var p=[];ao(o,function(y){return p.push(y),y.label&&p.push(y.label),y===i?[]:tt(y.children,function(S){return S!==i})});var f,d,h,m,v;r==="top"?(f=-120,d=i.y,h=d+10,m="n",v="y"):r==="left"?(f=-120,d=i.x,h=d+10,m="w",v="x"):r==="bottom"?(f=120,d=i.y+i.height,h=d-10,m="s",v="y"):r==="right"&&(f=120,d=i.x+i.width,h=d-10,m="e",v="x");var w=t.calculateAdjustments(p,v,f,h),x=l?{x:0,y:f}:{x:f,y:0};t.makeSpace(w.movingShapes,w.resizingShapes,x,m,h);var g=l?{x:i.x+(a?di:0),y:d-(r==="top"?120:0),width:i.width-(a?di:0),height:120}:{x:d-(r==="left"?120:0),y:i.y+(a?di:0),width:120,height:i.height-(a?di:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:l},g,s)};function xd(e){this._modeling=e}xd.$inject=["modeling"],xd.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=Tr(n),o=r.length;if(o>i)throw new Error(`more than <${i}> child lanes`);var a=gn(n),s=a?n.height:n.width,c=Math.round(s/i),l,u,p,f;for(f=0;f<i;f++)f===i-1?l=s-c*f:l=c,u=a?{x:n.x+di,y:n.y+f*c,width:n.width-di,height:l}:{x:n.x+f*c,y:n.y+di,width:l,height:n.height-di},f<o?t.resizeShape(r[f],u):(p={type:"bpmn:Lane",isHorizontal:a},t.createShape(p,u,n))};function vs(e,t){this._modeling=e,this._spaceTool=t}vs.$inject=["modeling","spaceTool"],vs.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},vs.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=fP(e,t);n.resizeShape(e,t),i.forEach(function(r){n.resizeShape(r.shape,r.newBounds)})},vs.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=Ie(e),r=Ie(t),o=zy(r,i),a=hi(e),s=[],c=[];ao(a,function(h){return s.push(h),(C(h,"bpmn:Lane")||C(h,"bpmn:Participant"))&&c.push(h),h.children});var l,u,p,f,d;(o.bottom||o.top)&&(l=o.bottom||o.top,u=e.y+(o.bottom?e.height:0)+(o.bottom?-10:10),p=o.bottom?"s":"n",f=o.top>0||o.bottom<0?-l:l,d=n.calculateAdjustments(s,"y",f,u),n.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:l},p)),(o.left||o.right)&&(l=o.right||o.left,u=e.x+(o.right?e.width:0)+(o.right?-10:100),p=o.right?"e":"w",f=o.left>0||o.right<0?-l:l,d=n.calculateAdjustments(c,"x",f,u),n.makeSpace(d.movingShapes,d.resizingShapes,{x:l,y:0},p))};var bs="flowNodeRef",_d="lanes";function Il(){}Il.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},o=[];function a(u,p){var f=Ie(p),d={x:u.x+u.width/2,y:u.y+u.height/2};return d.x>f.left&&d.x<f.right&&d.y>f.top&&d.y<f.bottom}function s(u){n.indexOf(u)===-1&&(o.push(u),n.push(u))}function c(u){var p=hi(u);return r[p.id]||(r[p.id]=Qc(p)),r[p.id]}function l(u){if(!u.parent)return[];var p=c(u);return p.filter(function(f){return a(u,f)}).map(function(f){return f.businessObject})}return t.forEach(function(u){var p=hi(u);if(!(!p||n.indexOf(p)!==-1)){var f=p.children.filter(function(d){return C(d,"bpmn:FlowNode")});f.forEach(s),n.push(p)}}),e.forEach(s),o.forEach(function(u){var p=u.businessObject,f=p.get(_d),d=f.slice(),h=l(u);i.push({flowNode:p,remove:d,add:h})}),t.forEach(function(u){var p=u.businessObject;u.parent||p.get(bs).forEach(function(f){i.push({flowNode:f,remove:[p],add:[]})})}),i},Il.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(_d);n.remove.forEach(function(o){Wt(r,o),Wt(o.get(bs),i)}),n.add.forEach(function(o){qt(r,o),qt(o.get(bs),i)})}),[]},Il.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,r=i.get(_d);n.add.forEach(function(o){Wt(r,o),Wt(o.get(bs),i)}),n.remove.forEach(function(o){qt(r,o),qt(o.get(bs),i)})}),[]};var wd="categoryValueRef";function xs(e,t){this._bpmnFactory=e,this._elementRegistry=t}xs.$inject=["bpmnFactory","elementRegistry"],xs.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,r=new Map,o=[],a=new Map;function s(x,g,y){if(g){var S=a.get(x);S||(S={},a.set(x,S)),!(y&&S.present)&&(!y&&S.past||(y?S.present={categoryValue:g,root:Ed(x)}:S.past={categoryValue:g}))}}function c(x){r.set(x,ue(x))}function l(){n.filter(function(x){return C(x,"bpmn:FlowElement")&&!Je(x)&&x.parent}).forEach(c)}function u(x){var g=ue(x),y=g.get("categoryValueRef");return y||(y=Ny(i,g),o.push(b2(x,y))),y}function p(x){return x.reduce(function(g,y){var S=Ed(y),E=g.get(S);return E||(E=[],g.set(S,E)),E.push(y),g},new Map)}e=Array.from(e||[]);var f=p(e);t.length&&l(),e.forEach(c),n.filter(function(x){return C(x,"bpmn:Group")&&!Je(x)&&x.parent}).forEach(function(x){var g=ue(x).get("categoryValueRef");if(!g){var y=Ed(x),S=f.get(y)||[],E=Wo(S,x),T=Object.keys(E).length>0;T&&(g=u(x))}s(x,g,!0)}),t.forEach(function(x){s(x.groupShape,x.categoryValue,!1)}),o.length&&l();var d=Array.from(r.keys()),h=Array.from(a.values()).reduce(function(x,g){return g.present&&x.add(g.present.categoryValue),g.past&&x.add(g.past.categoryValue),x},new Set),m=new Map,v=p(d);a.forEach(function(x,g){var y=x.present;if(y){var S=v.get(y.root)||[],E=Wo(S,g);S.forEach(function(T){if(E[T.id]){var k=m.get(T);k||(k=new Set,m.set(T,k)),k.add(y.categoryValue)}})}});var w=d.reduce(function(x,g){var y=r.get(g),S=y.get(wd),E=new Set(S),T=m.get(g)||new Set,k=Array.from(T).filter(function(P){return!E.has(P)}),I=S.filter(function(P){return h.has(P)&&!T.has(P)});return(k.length||I.length)&&x.push({businessObject:y,categoryValuesToAdd:k,categoryValuesToRemove:I}),x},[]);return{flowElements:w,groups:o}},xs.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),x2(t.groups),w2(t.flowElements),[]},xs.prototype.revert=function(e){var t=e.updates;return E2(t.flowElements),_2(t.groups),[]};function b2(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function x2(e){e.forEach(function(t){ue(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function _2(e){e.forEach(function(t){ue(t.groupShape).categoryValueRef=null})}function w2(e){e.forEach(function(t){var n=t.businessObject,i=n.get(wd);t.categoryValuesToRemove.forEach(function(r){Wt(i,r)}),t.categoryValuesToAdd.forEach(function(r){qt(i,r,!0)})})}function E2(e){e.forEach(function(t){var n=t.businessObject,i=n.get(wd);t.categoryValuesToAdd.forEach(function(r){Wt(i,r)}),t.categoryValuesToRemove.forEach(function(r){qt(i,r,!0)})})}function Ed(e){for(;e.parent;)e=e.parent;return e}function Bl(e){this._moddle=e}Bl.$inject=["moddle"],Bl.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),[]},Bl.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 S2={fill:void 0,stroke:void 0};function Sd(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(Gn(t)){var n=R2(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}Sd.$inject=["commandStack"],Sd.prototype.postExecute=function(e){var t=e.elements,n=e.colors||S2,i=this,r={};"fill"in n&&W(r,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&W(r,{"border-color":this._normalizeColor(n.stroke)}),H(t,function(o){var a=Ct(o)?Ci(r,["border-color"]):r,s=pt(o);if(C2(a),Je(o)){if(!s||!C(s.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:o,moddleElement:s.label,properties:{color:r["border-color"]}})}else{if(!et(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:o,properties:{di:a}})}})};function R2(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 C2(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var A2={width:0,height:0};function px(e,t,n){function i(c,l){var u=c.label||c,p=c.labelTarget||c;return tM(u,l),[u,p]}function r(c){var l=c.element,u=l.businessObject,p=c.newLabel;if(!Je(l)&&Mr(l)&&!Fc(l)&&!fx(p)){var f=7,d=qp(l);d={x:d.x,y:d.y+f},e.createLabel(l,d,{id:u.id+"_label",businessObject:u,di:l.di})}}function o(c){return c.oldLabel=li(c.element),i(c.element,c.newLabel)}function a(c){return i(c.element,c.oldLabel)}function s(c){var l=c.element,u=l.label||l,p=c.newLabel,f=c.newBounds,d=c.hints||{};if(!(!Je(u)&&!C(u,"bpmn:TextAnnotation"))){if(Je(u)&&fx(p)){d.removeShape!==!1&&e.removeShape(u,{unsetLabel:!1});return}var h=li(l);typeof f>"u"&&(f=t.getExternalLabelBounds(u,h)),f&&e.resizeShape(u,f,A2)}}this.preExecute=r,this.execute=o,this.revert=a,this.postExecute=s}px.$inject=["modeling","textRenderer","bpmnFactory"];function fx(e){return!e||!e.trim()}function An(e,t,n,i){At.call(this,e,t,n),this._bpmnRules=i}Ee(An,At),An.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],An.prototype.getHandlers=function(){var e=At.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=ms,e["element.updateProperties"]=ys,e["canvas.updateRoot"]=Ll,e["lane.add"]=bd,e["lane.resize"]=vs,e["lane.split"]=xd,e["lane.updateRefs"]=Il,e["group.updateRefs"]=xs,e["id.updateClaim"]=Bl,e["element.setColor"]=Sd,e["element.updateLabel"]=px,e},An.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},An.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)},An.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},An.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},An.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},An.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},An.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},An.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},An.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},An.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},An.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},An.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},An.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},An.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function dx(){}dx.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||je(t.source||e.source),t.connectionEnd||je(t.target||e.target)]};var Nl=20,M2=5,$l=Math.round,hx=20,P2={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function T2(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function k2(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function mx(e,t,n){var i=Sn(t,e,M2),r=n.split(":")[0],o=$l((t.x-e.x)/2+e.x),a=$l((t.y-e.y)/2+e.y),s,c,l=k2(r,i),u=/h|r|l/.test(r),p=!1,f=!1;return l?(s=u?{x:o,y:e.y}:{x:e.x,y:a},c=u?"h:h":"v:v"):(p=T2(i,r),c=u?"h:v":"v:h",p?u?(f=a===e.y,s={x:e.x+Nl*(/l/.test(r)?-1:1),y:f?a+Nl:a}):(f=o===e.x,s={x:f?o+Nl:o,y:e.y+Nl*(/t/.test(r)?-1:1)}):s={x:o,y:a}),{waypoints:Rd(e,s,c).concat(s),directions:c,turnNextDirections:f}}function O2(e,t,n){return mx(e,t,n)}function D2(e,t,n){var i=mx(t,e,gx(n));return{waypoints:i.waypoints.slice().reverse(),directions:gx(i.directions),turnNextDirections:i.turnNextDirections}}function L2(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=Rd(e.waypoints[e.waypoints.length-1],t.waypoints[0],r);return{waypoints:o,directions:r}}function gx(e){return e.split(":").reverse().join(":")}function I2(e,t,n){var i=$l((t.x-e.x)/2+e.x),r=$l((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 Rd(e,t,n){if(n=n||"h:h",!V2(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(vx(n)){var i=O2(e,t,n),r=D2(e,t,n),o=L2(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return I2(e,t,n)}function B2(e,t,n){var i=Rd(e,t,n);return i.unshift(e),i.push(t),xx(i)}function N2(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=NE(o,"straight")[0]||"h:h",s=P2[a]||0,c=Sn(e,t,s),l=G2(c,a);n=n||je(e),i=i||je(t);var u=l.split(":"),p=bx(n,e,u[0],W2(c)),f=bx(i,t,u[1],c);return B2(p,f,l)}function $2(e,t,n,i,r,o){Fe(n)&&(r=n,o=i,n=je(e),i=je(t)),o=W({preferredLayouts:[]},o),r=r||[];var a=o.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&j2(e,t,n,i,o),c||(c=o.connectionEnd&&z2(t,e,i,r),c)||(c=o.connectionStart&&H2(e,t,n,r),c)?c:!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:N2(e,t,n,i,o)}function F2(e,t,n){return e>=t&&e<=n}function yx(e,t,n){var i={x:"width",y:"height"};return F2(t[e],n[e],n[e]+n[i[e]])}function j2(e,t,n,i,r){var o={},a,s;return s=Sn(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),r.preserveDocking==="target"?yx(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:yx(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 H2(e,t,n,i){return Cd(e,t,n,i)}function z2(e,t,n,i){var r=i.slice().reverse();return r=Cd(e,t,n,r),r?r.reverse():null}function Cd(e,t,n,i){function r(u){return u.length<3?!0:u.length>4?!1:!!Tt(u,function(p,f){var d=u[f-1];return d&&Va(p,d)<3})}function o(u,p,f){var d=er(p,u);switch(d){case"v":return{x:f.x,y:u.y};case"h":return{x:u.x,y:f.y}}return{x:u.x,y:u.y}}function a(u,p,f){var d;for(d=u.length-2;d!==0;d--)if(Gg(u[d],p,hx)||Gg(u[d],f,hx))return u.slice(d);return u}if(r(i))return null;var s=i[0],c=i.slice(),l;return c[0]=n,c[1]=o(c[1],s,n),l=a(c,e,t),l!==c&&(c=Cd(e,t,n,l)),c&&er(c)?null:c}function G2(e,t){if(vx(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 V2(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function vx(e){return e&&/t|r|b|l/.test(e)}function W2(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 bx(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 xx(e){return e.reduce(function(t,n,i){var r=t[t.length-1],o=e[i+1];return zp(r,o,n,0)||t.push(n),t},[])}var U2=-10,q2=40,Y2={default:["h:h"],fromGateway:["v:h"],toGateway:["h:v"],loop:{fromTop:["t:r"],fromRight:["r:b"],fromLeft:["l:t"],fromBottom:["b:l"]},boundaryLoop:{alternateHorizontalSide:"b",alternateVerticalSide:"l",default:"v"},messageFlow:["straight","v:v"],subProcess:["straight","h:h"],isHorizontal:!0},K2={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},Ad={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},_s={top:"t",right:"r",bottom:"b",left:"l"};function Fl(e){this._elementRegistry=e}Ee(Fl,dx),Fl.prototype.layoutConnection=function(e,t){t||(t={});var n=t.source||e.source,i=t.target||e.target,r=t.waypoints||e.waypoints,o=t.connectionStart,a=t.connectionEnd,s=this._elementRegistry,c,l;if(o||(o=_x(r&&r[0],n)),a||(a=_x(r&&r[r.length-1],i)),(C(e,"bpmn:Association")||C(e,"bpmn:DataAssociation"))&&r&&!wx(n,i))return[].concat([o],r.slice(1,-1),[a]);var u=Dy(n,s)?Y2:K2;return C(e,"bpmn:MessageFlow")?c=Z2(n,i,u):(C(e,"bpmn:SequenceFlow")||wx(n,i))&&(n===i?c={preferredLayouts:iO(n,e,u)}:C(n,"bpmn:BoundaryEvent")?c={preferredLayouts:rO(n,i,a,u)}:ws(n)||ws(i)?c={preferredLayouts:u.subProcess,preserveDocking:J2(n)}:C(n,"bpmn:Gateway")?c={preferredLayouts:u.fromGateway}:C(i,"bpmn:Gateway")?c={preferredLayouts:u.toGateway}:c={preferredLayouts:u.default}),c&&(c=W(c,t),l=xx($2(n,i,o,a,r,c))),l||[o,a]};function X2(e){var t=e.host;return Sn(je(e),t,U2)}function Z2(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:Q2(e,t)}}function Q2(e,t){return C(t,"bpmn:Participant")?"source":C(e,"bpmn:Participant")?"target":ws(t)?"source":ws(e)||C(t,"bpmn:Event")?"target":C(e,"bpmn:Event")?"source":null}function J2(e){return ws(e)?"target":"source"}function _x(e,t){return e?e.original||e:je(t)}function wx(e,t){return C(t,"bpmn:Activity")&&C(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function ws(e){return C(e,"bpmn:SubProcess")&&at(e)}function go(e,t){return e===t}function eO(e,t){return t.indexOf(e)!==-1}function ua(e){var t=/right|left/.exec(e);return t&&t[0]}function pa(e){var t=/top|bottom/.exec(e);return t&&t[0]}function Ex(e,t){return Ad[e]===t}function tO(e,t){var n=ua(e),i=Ad[n];return t.indexOf(i)!==-1}function nO(e,t){var n=pa(e),i=Ad[n];return t.indexOf(i)!==-1}function Sx(e){return e==="right"||e==="left"}function iO(e,t,n){var i=t.waypoints,r=i&&i.length&&Sn(i[0],e);return r==="top"?n.loop.fromTop:r==="right"?n.loop.fromRight:r==="left"?n.loop.fromLeft:n.loop.fromBottom}function rO(e,t,n,i){var r=je(e),o=je(t),a=X2(e),s,c,l=go(e.host,t),u=eO(a,["top","right","bottom","left"]),p=Sn(o,r,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return l?oO(a,u,e,t,n,i):(s=aO(a,p,u,i.isHorizontal),c=sO(a,p,u,i.isHorizontal),[s+":"+c])}function oO(e,t,n,i,r,o){var a=t?e:o.isHorizontal?pa(e):ua(e),s=_s[a],c;return t?Sx(e)?c=Rx("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:c=Rx("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function Rx(e,t,n,i){var r=q2;return!(Md(e,i,n,r)||Md(e,i,{x:n.x+n.width,y:n.y+n.height},r)||Md(e,i,je(t),r))}function Md(e,t,n,i){return Math.abs(t[e]-n[e])<i}function aO(e,t,n,i){if(n)return _s[e];var r=pa(e),o=ua(e),a=pa(t),s=ua(t);if(i){if(go(r,a)||Ex(o,s))return _s[r]}else if(go(o,s)||Ex(r,a))return _s[o];return _s[i?o:r]}function sO(e,t,n,i){if(n)return Sx(e)?tO(e,t)||go(e,t)?"h":"v":nO(e,t)||go(e,t)?"v":"h";var r=pa(e),o=ua(e),a=pa(t),s=ua(t);return a&&!s?"v":s&&!a?"h":i?go(r,a)?"h":"v":go(o,s)?"v":"h"}Fl.$inject=["elementRegistry"];function Cx(e){return W({original:e.point.original||e.point},e.actual)}function Fr(e,t){this._elementRegistry=e,this._graphicsFactory=t}Fr.$inject=["elementRegistry","graphicsFactory"],Fr.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(Cx(i)),o.push(Cx(r)),o},Fr.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}},Fr.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return Wa(i,r,n)},Fr.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},Fr.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},Fr.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const Pd={__init__:["modeling","bpmnUpdater"],__depends__:[CT,zT,VT,WT,$b,Uk,Yk,e2,gi,fd,Vb],bpmnFactory:["type",vi],bpmnUpdater:["type",Zn],elementFactory:["type",Br],modeling:["type",An],layouter:["type",Fl],connectionDocking:["type",Fr]};var cO=10,Ax=50,lO=250;function Td(e,t,n,i){for(var r;r=uO(e,n,t);)n=i(t,n,r);return n}function kd(e){return function(t,n,i){var r={x:n.x,y:n.y};return["x","y"].forEach(function(o){var a=e[o];if(a){var s=o==="x"?"width":"height",c=a.margin,l=a.minDistance;c<0?r[o]=Math.min(i[o]+c-t[s]/2,n[o]-l+c):r[o]=Math.max(i[o]+i[s]+c+t[s]/2,n[o]+l+c)}}),r}}function uO(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=fO(e);return Tt(r,function(o){if(o===n)return!1;var a=Sn(o,i,cO);return a==="intersect"})}function pO(e,t){t||(t={});function n(h){return h.source===e?1:-1}var i=t.defaultDistance||Ax,r=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||lO,c=t.reference||"start";o||(o=mO);function l(h,m){return r==="n"?c==="start"?Ie(h).top-Ie(m).bottom:c==="center"?Ie(h).top-je(m).y:Ie(h).top-Ie(m).top:r==="w"?c==="start"?Ie(h).left-Ie(m).right:c==="center"?Ie(h).left-je(m).x:Ie(h).left-Ie(m).left:r==="s"?c==="start"?Ie(m).top-Ie(h).bottom:c==="center"?je(m).y-Ie(h).bottom:Ie(m).bottom-Ie(h).bottom:c==="start"?Ie(m).left-Ie(h).right:c==="center"?je(m).x-Ie(h).right:Ie(m).right-Ie(h).right}var u=e.incoming.filter(o).map(function(h){var m=a(h),v=m<0?l(h.source,e):l(e,h.source);return{id:h.source.id,distance:v,weight:m}}),p=e.outgoing.filter(o).map(function(h){var m=a(h),v=m>0?l(e,h.target):l(h.target,e);return{id:h.target.id,distance:v,weight:m}}),f=u.concat(p).reduce(function(h,m){return h[m.id+"__weight_"+m.weight]=m,h},{}),d=Wn(f,function(h,m){var v=m.distance,w=m.weight;return v<0||v>s||(h[String(v)]||(h[String(v)]=0),h[String(v)]+=1*w,(!h.distance||h[h.distance]<h[String(v)])&&(h.distance=v)),h},{});return d.distance||i}function fO(e){var t=Od(e);return e.host&&(t=t.concat(Od(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(Od(i))},[]))),t}function Od(e){return hO(e).concat(dO(e))}function dO(e){return e.incoming.map(function(t){return t.source})}function hO(e){return e.outgoing.map(function(t){return t.target})}function mO(){return!0}var gO=100;function Mx(e,t,n){e.on("autoPlace",gO,function(i){var r=i.shape,o=i.source;return yO(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}}Mx.$inject=["eventBus","modeling","canvas"];function yO(e,t,n){n||(n={});var i=n.defaultDistance||Ax,r=je(e),o=Ie(e);return{x:o.right+i+t.width/2,y:r.y}}function Px(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}Px.$inject=["eventBus","selection"];const vO={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",Mx],autoPlaceSelectionBehavior:["type",Px]};function Tx(e,t,n){var i=Dy(e,n);if(C(t,"bpmn:TextAnnotation"))return xO(e,t,i);if(et(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return _O(e,t,i);if(C(t,"bpmn:FlowNode"))return bO(e,t,i)}function bO(e,t,n){var i=Ie(e),r=je(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=pO(e,{filter:function(d){return C(d,"bpmn:SequenceFlow")},direction:o.directionHint}),s=30,c=o.minDistance,l=o.baseOrientation;C(e,"bpmn:BoundaryEvent")&&(l=Sn(e,e.host,-25),l.indexOf(o.boundaryOrientation)!==-1&&(s*=-1));var u=n?{x:i.right+a+t.width/2,y:r.y+kx(l,c,o)}:{x:r.x+kx(l,c,o),y:i.bottom+a+t.height/2},p={margin:s,minDistance:c},f=n?{y:p}:{x:p};return Td(e,t,u,kd(f))}function kx(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function xO(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};Ct(e)&&(r=je(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 Td(e,t,r,kd(a))}function _O(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 Td(e,t,r,kd(a))}function Ox(e,t){e.on("autoPlace",function(n){var i=n.shape,r=n.source;return Tx(r,i,t)})}Ox.$inject=["eventBus","elementRegistry"];const jl={__depends__:[vO],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",Ox]},Dx=[ky,Za,Pd,jl];function wO(e={}){pm(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new Yo({container:t,moddleExtensions:e.moddleExtensions??rc,additionalModules:[...Dx,...e.additionalModules??[]]})}const Lx={"edge-crosses-shape":"연결","edge-crosses-subprocess":"연결","edge-endpoint-detached":"연결","edge-overlap-opposite":"겹침","edge-overlap-mixed":"겹침","edge-overlap-unrelated":"겹침","shape-overlap":"겹침","shape-outside-container":"소속","label-on-shared-segment":"라벨","label-over-line":"라벨","label-over-shape":"라벨","annotation-over-label":"라벨","pool-name-over-label":"라벨","group-overlap-unintended":"그룹","group-overlap-unreadable":"그룹","group-stack-unreadable":"그룹","group-on-container-boundary":"그룹","group-on-group-boundary":"그룹","group-cuts-shape":"그룹","edge-along-group-boundary":"그룹","pool-overlap":"풀","CHK-FLOW-1":"구조","CHK-POOL-1":"풀"},EO={이:["이","가"],을:["을","를"],와:["과","와"]};function SO(e,t){const[n,i]=EO[t],r=e.at(-1)??"",o=r.charCodeAt(0);return o>=44032&&o<=55203?e+((o-44032)%28===0?i:n):r>="0"&&r<="9"?e+("013678".includes(r)?n:i):e+`${n}(${i})`}const RO={"bpmn:StartEvent":"시작 이벤트","bpmn:EndEvent":"종료 이벤트","bpmn:IntermediateCatchEvent":"중간 이벤트","bpmn:IntermediateThrowEvent":"중간 이벤트","bpmn:BoundaryEvent":"경계 이벤트","bpmn:Task":"작업","bpmn:UserTask":"작업","bpmn:ServiceTask":"작업","bpmn:SendTask":"작업","bpmn:ReceiveTask":"작업","bpmn:ManualTask":"작업","bpmn:ScriptTask":"작업","bpmn:BusinessRuleTask":"작업","bpmn:CallActivity":"작업","bpmn:SubProcess":"서브프로세스","bpmn:ExclusiveGateway":"게이트웨이","bpmn:ParallelGateway":"게이트웨이","bpmn:InclusiveGateway":"게이트웨이","bpmn:EventBasedGateway":"게이트웨이","bpmn:ComplexGateway":"게이트웨이","bpmn:Participant":"풀","bpmn:Lane":"레인","bpmn:TextAnnotation":"주석","bpmn:Group":"그룹","bpmn:DataStoreReference":"데이터 저장소","bpmn:DataObjectReference":"데이터 객체","bpmn:SequenceFlow":"연결선","bpmn:MessageFlow":"메시지 연결선","bpmn:Association":"연관선"},CO="요소";function Dd(e){return(e&&RO[e.type])??CO}const Ix=20;function AO(e){const t=e.replace(/\s+/g," ").trim();return t.length>Ix?`${t.slice(0,Ix)}…`:t}function Hl(e,t,n,i=""){const r=e(t),o=(r==null?void 0:r.name)===void 0?void 0:AO(r.name),a=o===void 0?i+Dd(r):o,s=o===void 0?a:`「${o}」`;return n?s+SO(a,n).slice(a.length):s}function MO(e,t,n,i,r){const[o,a]=[e(t),e(n)],s=(o==null?void 0:o.name)===void 0&&(a==null?void 0:a.name)===void 0&&Dd(o)===Dd(a);return[Hl(e,t,i),Hl(e,n,r,s?"다른 ":"")]}function PO(e){switch(e.kind){case"shape-overlap":return e.identical?"error":"warning";case"shape-outside-container":return"error";case"edge-endpoint-detached":return"error";case"pool-overlap":return e.contained?"error":"warning";case"group-cuts-shape":return"error";default:return"warning"}}function TO(e){switch(e.kind){case"edge-crosses-shape":return[e.edge,e.shape];case"edge-crosses-subprocess":return[e.edge,e.subProcess];case"edge-endpoint-detached":return[e.edge,e.shape];case"shape-overlap":return[...e.shapes];case"shape-outside-container":return[e.shape,e.container];case"edge-overlap-opposite":case"edge-overlap-mixed":case"edge-overlap-unrelated":return[...e.edges];case"label-on-shared-segment":return[e.edge,e.other];case"label-over-line":return[e.edge,e.line];case"label-over-shape":return[e.edge,e.shape];case"annotation-over-label":return[e.annotation,e.label];case"group-overlap-unintended":return e.container?[e.container,...e.groups.filter(t=>t!==e.container)]:[...e.groups];case"group-overlap-unreadable":return e.reason==="orphan"?[...e.groups,...e.shapes]:[e.group,...e.shapes];case"group-stack-unreadable":return[...e.groups,...e.shapes];case"group-on-container-boundary":return[e.group,e.container];case"group-on-group-boundary":return[...e.groups];case"group-cuts-shape":return[e.group,e.shape];case"edge-along-group-boundary":return[e.edge,e.group];case"pool-name-over-label":return[e.pool,e.label];case"pool-overlap":return[...e.pools]}}const zl={top:"위",bottom:"아래",left:"왼쪽",right:"오른쪽"};function kO(e,t){const n=(r,o)=>Hl(t,r,o),i=(r,o,a,s)=>MO(t,r,o,a,s);switch(e.kind){case"edge-crosses-shape":return`${n(e.edge,"이")} ${n(e.shape,"을")} 가로지릅니다.`;case"edge-crosses-subprocess":return`${n(e.edge,"이")} 서브프로세스 ${n(e.subProcess)} 안을 지나갑니다.`;case"edge-endpoint-detached":return`${n(e.edge)}의 끝이 ${n(e.shape)}에서 ${Math.round(e.distance)}px 떨어져 연결이 끊겨 보입니다.`;case"shape-overlap":{const[r,o]=i(e.shapes[0],e.shapes[1],"와","이");return e.identical?`${r} ${o} 완전히 같은 자리에 겹쳐 하나가 가려집니다.`:`${r} ${o} 겹칩니다.`}case"shape-outside-container":return`${n(e.shape,"이")} ${n(e.container)} 경계 밖에 놓여 다른 소속으로 읽힙니다.`;case"edge-overlap-opposite":{const[r,o]=i(e.edges[0],e.edges[1],"와","이");return`${r} ${o} 같은 선 위를 ${Math.round(e.length)}px 서로 반대 방향으로 흐릅니다.`}case"edge-overlap-mixed":{const[r,o]=i(e.edges[0],e.edges[1],"와","이");return`${r} ${o} 종류가 다른 선인데 ${Math.round(e.length)}px 겹쳐 흐릅니다.`}case"edge-overlap-unrelated":{const[r,o]=i(e.edges[0],e.edges[1],"와","이");return`${r} ${o} ${Math.round(e.length)}px 한 선처럼 겹쳐 흐르는데 만나는 지점이 없습니다.`}case"label-on-shared-segment":{const[r,o]=i(e.edge,e.other,void 0,"와");return`${r}의 라벨이 ${o} 공유하는 구간 위에 있어 어느 선의 것인지 모호합니다.`}case"label-over-line":return`${n(e.edge)}의 라벨을 선이 가로지릅니다.`;case"label-over-shape":return`${n(e.edge)}의 라벨이 ${n(e.shape)} 위에 ${e.depth}px 겹쳐 있습니다.`;case"annotation-over-label":return`주석 ${n(e.annotation,"이")} ${n(e.label)}의 이름 라벨을 덮습니다.`;case"group-overlap-unintended":{if(e.container)return`${n(e.container,"이")} 다른 그룹을 통째로 덮습니다.`;const[r,o]=i(e.groups[0],e.groups[1],"와","이");return`${r} ${o} 공유 멤버 없이 겹쳐 의도인지 알 수 없습니다.`}case"group-overlap-unreadable":switch(e.reason){case"orphan":{const[r,o]=i(e.groups[0],e.groups[1],"와");return`${r} ${o}의 겹친 영역에 어느 그룹에도 속하지 않은 요소가 ${e.shapes.length}개 있습니다.`}case"minority":return`${n(e.group)} 상자 안에서 자기 멤버가 과반이 아닙니다(다른 요소 ${e.shapes.length}개).`;case"throughpass":return`${n(e.group)} 상자를 자기 멤버가 아닌 요소 ${e.shapes.length}개가 지나갑니다.`}case"group-stack-unreadable":return`그룹 ${e.groups.length}개가 겹쳐 쌓여 요소 ${e.shapes.length}개가 어느 단계인지 읽히지 않습니다.`;case"group-on-container-boundary":return`${n(e.group)} 테두리가 ${n(e.container)}의 ${zl[e.side]} 경계선과 겹쳐 흐릅니다.`;case"group-on-group-boundary":{const[r,o]=i(e.groups[0],e.groups[1],"와");return`${r} ${o}의 테두리가 같은 선 위에 겹칩니다.`}case"group-cuts-shape":return`${n(e.group)} 테두리가 ${n(e.shape)}의 ${zl[e.side]}을(를) ${Math.round(e.depth)}px 가릅니다.`;case"edge-along-group-boundary":return e.distance===0?`${n(e.edge,"이")} ${n(e.group)}의 ${zl[e.side]} 테두리 위를 ${e.length}px 겹쳐 흐릅니다.`:`${n(e.edge,"이")} ${n(e.group)}의 ${zl[e.side]} 테두리 ${e.inside?"안쪽":"바깥쪽"} ${e.distance}px 에 ${e.length}px 나란히 흘러 테두리와 구분되지 않습니다.`;case"pool-name-over-label":return`${n(e.pool)}의 이름 밴드가 ${n(e.label)}의 라벨을 덮습니다.`;case"pool-overlap":{const[r,o]=i(e.pools[0],e.pools[1],"와","이");return e.contained?`${r} ${o} 중 하나가 다른 하나 안에 들어가 있습니다.`:`${r} ${o} 겹칩니다.`}}}function OO(e,t){switch(e.ruleId){case"CHK-FLOW-1":return`${Hl(t,e.targetRefs[0])}에 연결된 선이 하나도 없습니다 — 분기·합류가 없는 게이트웨이는 의미가 정해지지 않습니다.`;case"CHK-POOL-1":return`이 문서에 내용이 없는 풀 ${e.targetRefs.length}개가 펼친 형태로 그려져 있습니다 — 이 문서에서 내용을 그리지 않는 풀은 접힌 형태(블랙박스)가 의미에 맞습니다.`;default:return e.ruleId}}const Bx="기타",Ld={error:0,warning:1,info:2};function Nx(e,t){const n=[];for(const i of e.geometry)n.push({key:`g:${ft(i)}`,source:"geometry",code:i.kind,severity:PO(i),targetRefs:TO(i),category:Lx[i.kind]??Bx,message:kO(i,t)});for(const i of e.semantic)n.push({key:`s:${i.ruleId}|${i.targetRefs.join(",")}`,source:"semantic",code:i.ruleId,severity:i.severity,targetRefs:[...i.targetRefs],category:Lx[i.ruleId]??Bx,message:OO(i,t)});return n}function $x(e){const t={error:0,warning:0,info:0};for(const n of e)t[n.severity]++;return t}function fa(e,t){return t!==void 0&&e.targetRefs.some(n=>t.has(n))}function Id(e,t){if(t===void 0||e.length===0)return!1;const n=fa(e[0],t);return e.some(i=>fa(i,t)!==n)}function Fx(e,t){const n=Id(e,t);return e.slice().sort((i,r)=>(n?Number(fa(r,t))-Number(fa(i,t)):0)||Ld[i.severity]-Ld[r.severity])}const jx="i18n-untranslated",Hx="i18n-review-requested",zx=[["untranslated",jx],["reviewRequested",Hx]];class Bd{constructor(t,n,i,r,o,a,s,c){ki(this,"config");ki(this,"displayLocale");this.elementRegistry=n,this.canvas=a,this.textRenderer=s,this.graphicsFactory=c,i.registerHandler(Qs,Yu);const l=r.drawShape.bind(r);r.drawShape=(f,d,h)=>this.withDisplayText(d,()=>l(f,d,h),f);const u=o.activate.bind(o);o.activate=f=>this.withDisplayText(f,()=>u(f));const p=o.update.bind(o);o.update=(f,d,h,m)=>{const v=this.resolve(f);if(!v||v.native)return p(f,d,h,m);(d??"").trim()!==(h??"").trim()&&i.execute(Qs,{element:f.labelTarget??f,locale:this.displayLocale,text:d,designLocale:this.config.designLocale,locales:this.locales(),rootLang:this.rootLang()})},t.on("commandStack.element.updateLabel.postExecute",f=>{if(!this.config)return;const{element:d,newLabel:h,oldLabel:m}=f.context;(h??"")!==(m??"")&&i.execute(Qs,{element:d.labelTarget??d,locale:this.displayLocale,text:h??"",designLocale:this.config.designLocale,locales:this.locales(),rootLang:this.rootLang(),nameChangedFrom:m??""})})}configure(t){!t&&!this.config||(this.config=t,this.displayLocale=t==null?void 0:t.designLocale,this.rerenderAll())}locales(){if(!this.config)return[];const{designLocale:t,companionLocales:n}=this.config;return[t,...n.filter(i=>i!==t)]}setDisplayLocale(t){if(this.config)return this.displayLocale=this.locales().includes(t)?t:this.config.designLocale,this.rerenderAll(),this.displayLocale}getDisplayLocale(){return this.displayLocale}rootLang(){var i,r,o;const t=(i=this.canvas.getRootElement())==null?void 0:i.businessObject,n=(t==null?void 0:t.$parent)??t;return((r=n==null?void 0:n.get)==null?void 0:r.call(n,"xml:lang"))??((o=n==null?void 0:n.$attrs)==null?void 0:o["xml:lang"])}resolve(t){if(!this.config||!this.displayLocale)return;const n=(t.labelTarget??t).businessObject,i=Ta(n);if(!i)return;const r=this.displayLocale,o=i.target[i.key]??"",a=Zs(n).filter(f=>ni(f)),s=f=>f.body??"",c=a.find(f=>ni(f)===r&&s(f)),l=ka(n).some(f=>f.locale===r)?"reviewRequested":"ok";if(!o)return c?{text:s(c),status:l,native:!1}:void 0;const u=a.filter(f=>s(f)===o).map(ni);return(u.length?u:[this.rootLang()??this.config.designLocale]).includes(r)?{text:o,status:l,native:!0}:c?{text:s(c),status:l,native:!1}:{text:o,status:"untranslated",native:!1}}untranslatedCount(t){return this.countStatus(t,"untranslated")}reviewRequestedCount(t){return this.countStatus(t,"reviewRequested")}countStatus(t,n){var o;if(!this.config)return 0;const i=this.displayLocale;this.displayLocale=t;let r=0;try{for(const a of this.elementRegistry.getAll())a.type!=="label"&&((o=this.resolve(a))==null?void 0:o.status)===n&&r++}finally{this.displayLocale=i}return r}withDisplayText(t,n,i){var f;if(!this.config)return n();const r=this.resolve(t),o=(f=i==null?void 0:i.parentNode)==null?void 0:f.classList;if(o)for(const[d,h]of zx)o.toggle(h,(r==null?void 0:r.status)===d);if(!r||r.native)return n();const{target:a,key:s}=Ta((t.labelTarget??t).businessObject),c=Object.prototype.hasOwnProperty.call(a,s),l=a[s];if(l===r.text)return n();a[s]=r.text;const u=this.config.adaptiveExternalLabel??!0,p=t.type==="label"&&u?this.widen(t,r.text):void 0;try{const d=n();return p&&(d!=null&&d.setAttribute)&&d.setAttribute("transform",`translate(${p.dx}, 0)`),d}finally{c?a[s]=l:delete a[s],p==null||p.restore()}}widen(t,n){const{width:i,height:r}=t,o=this.textRenderer.getExternalLabelBounds(t,n);return t.width=o.width,t.height=o.height,{dx:(i-o.width)/2,restore:()=>(t.width=i,t.height=r)}}rerenderAll(){const t=this.canvas.getRootElement();for(const n of this.elementRegistry.getAll()){if(n===t)continue;const i=this.elementRegistry.getGraphics(n);if(i){if(!this.config)for(const[,r]of zx)i.classList.remove(r);this.graphicsFactory.update(n.waypoints?"connection":"shape",n,i)}}}}ki(Bd,"$inject",["eventBus","elementRegistry","commandStack","bpmnRenderer","labelEditingProvider","canvas","textRenderer","graphicsFactory"]);const Gx={__init__:["i18nDisplay"],i18nDisplay:["type",Bd]};var DO=new ca("ov"),LO=500;function vn(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=DO,this._overlayDefaults=W({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=IO(n.getContainer()),this._init()}vn.$inject=["config.overlays","eventBus","canvas","elementRegistry"],vn.prototype.get=function(e){if(Gn(e)&&(e={id:e}),Gn(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?tt(t.overlays,Oo({type:e.type})):t.overlays.slice():[]}else return e.type?tt(this._overlays,Oo({type:e.type})):e.id?this._overlays[e.id]:null},vn.prototype.add=function(e,t,n){if(dn(t)&&(n=t,t=null),e.id||(e=this._elementRegistry.get(e)),!n.position)throw new Error("must specifiy overlay position");if(!n.html)throw new Error("must specifiy overlay html");if(!e)throw new Error("invalid element specified");var i=this._ids.next();return n=W({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},vn.prototype.remove=function(e){var t=this.get(e)||[];Fe(t)||(t=[t]);var n=this;H(t,function(i){var r=n._getOverlayContainer(i.element,!0);if(i&&($i(i.html),$i(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)}})},vn.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},vn.prototype.show=function(){Gl(this._overlayRoot)},vn.prototype.hide=function(){Gl(this._overlayRoot,!1)},vn.prototype.clear=function(){this._overlays={},this._overlayContainers=[],Sc(this._overlayRoot)},vn.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=Jt(t);i=o.x,r=o.y}Vx(n,i,r),kn(e.html,"data-container-id",t.id)},vn.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=Jt(i).width:a=i.width,r=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=Jt(i).height:s=i.height,o=t.bottom*-1+s}Vx(n,r||0,o||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},vn.prototype._createOverlayContainer=function(e){var t=Ot('<div class="djs-overlays" />');In(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},vn.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";Wx(this._overlayRoot,n)},vn.prototype._getOverlayContainer=function(e,t){var n=Tt(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},vn.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)),Gn(i)&&(i=Ot(i)),o=this._getOverlayContainer(n),r=Ot('<div class="djs-overlay" data-overlay-id="'+t+'">'),In(r,{position:"absolute"}),r.appendChild(i),e.type&&Bt(r).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();Gl(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())},vn.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&&(an(r)&&r>t.scale||an(o)&&o<t.scale))&&(c=!1),Gl(a,c),this._updateOverlayScale(e,t)},vn.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),an(i)&&t.scale<i&&(a=(1/t.scale||1)*i),an(r)&&t.scale>r&&(a=(1/t.scale||1)*r)),an(a)&&(s="scale("+a+","+a+")"),Wx(o,s)},vn.prototype._updateOverlaysVisibilty=function(e){var t=this;H(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},vn.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});H(o,function(c){t.remove(c.id)});var a=t._getOverlayContainer(r);if(a){$i(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",LO,function(i){var r=i.element,o=t._getOverlayContainer(r,!0);o&&(H(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&&Bt(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 IO(e){var t=Ot('<div class="djs-overlay-container" />');return In(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function Vx(e,t,n){In(e,{left:t+"px",top:n+"px"})}function Gl(e,t){e.style.display=t===!1?"none":""}function Wx(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const Vl={__init__:["overlays"],overlays:["type",vn]};function Nd(e,t){t.invoke(ce,this),this.executed(function(n){var i=n.context;i.rootElement?e.setRootElement(i.rootElement):i.rootElement=e.getRootElement()}),this.revert(function(n){var i=n.context;i.rootElement&&e.setRootElement(i.rootElement)})}Ee(Nd,ce),Nd.$inject=["canvas","injector"];const BO={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",Nd]};function Es(e){return CSS.escape(e)}var NO={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function Ux(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return NO[t]})}var $O="bjs-breadcrumbs-shown";function qx(e,t,n){var i=Ot('<ul class="bjs-breadcrumbs"></ul>'),r=n.getContainer(),o=Bt(r);r.appendChild(i);var a=[];e.on("element.changed",function(c){var l=c.element,u=ue(l),p=Tt(a,function(f){return f===u});p&&s()});function s(c){c&&(a=FO(c));var l=a.flatMap(function(p){var f=n.findRoot(Gi(p))||n.findRoot(p.id);if(!f&&C(p,"bpmn:Process")){var d=t.find(function(v){var w=ue(v);return w&&w.get("processRef")===p});f=d&&n.findRoot(d.id)}if(!f)return[];var h=Ux(p.name||p.id),m=Ot('<li><span class="bjs-crumb"><a title="'+h+'">'+h+"</a></span></li>");return m.addEventListener("click",function(){n.setRootElement(f)}),m});i.innerHTML="";var u=l.length>1;o.toggle($O,u),l.forEach(function(p){i.appendChild(p)})}e.on("root.set",function(c){s(c.element)})}qx.$inject=["eventBus","elementRegistry","canvas"];function FO(e){for(var t=ue(e),n=[],i=t;i;i=i.$parent)(C(i,"bpmn:SubProcess")||C(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function Yx(e,t){var n=null,i=new jO;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,!(!C(o,"bpmn:SubProcess")&&!s)){s=s||{x:0,y:0,zoom:1};var c=(a.x-s.x)*a.scale,l=(a.y-s.y)*a.scale;(c!==0||l!==0)&&t.scroll({dx:c,dy:l}),s.zoom!==a.scale&&t.zoom(s.zoom,{x:0,y:0})}}),e.on("diagram.clear",function(){i.clear(),n=null})}Yx.$inject=["eventBus","canvas"];function jO(){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 Kx={x:180,y:160};function yo(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,r){n._handleImport(r.definitions)})}yo.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)})}},yo.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;C(a,"bpmn:SubProcess")&&!o.isExpanded&&n.push(a),zO(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},yo.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=HO(e),i={x:n.x-Kx.x,y:n.y-Kx.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)})},yo.prototype._moveToDiPlane=function(e,t){var n=Xx(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},yo.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},yo.$inject=["eventBus","moddle"];function Xx(e){return C(e,"bpmndi:BPMNDiagram")?e:Xx(e.$parent)}function HO(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)}}),Dc(t)}function zO(e,t){var n=e.$parent;return!(!C(n,"bpmn:SubProcess")||n===t.bpmnElement||et(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var Wl=250,GO='<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>',VO="bjs-drilldown-empty";function jr(e,t,n,i,r){ce.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",Wl,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",Wl,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],Wl,function(a){var s=a.oldParent,c=a.newParent||a.parent,l=a.shape;o._canDrillDown(l)&&o._addOverlay(l),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(l)},!0),this.reverted(["shape.create","shape.move","shape.delete"],Wl,function(a){var s=a.oldParent,c=a.newParent||a.parent,l=a.shape;o._canDrillDown(l)&&o._addOverlay(l),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(l)},!0),t.on("import.render.complete",function(){n.filter(function(a){return o._canDrillDown(a)}).map(function(a){o._addOverlay(a)})})}Ee(jr,ce),jr.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},jr.prototype._canDrillDown=function(e){var t=this._canvas;return C(e,"bpmn:SubProcess")&&t.findRoot(Gi(e))},jr.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=ue(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var r=n&&n.get("flowElements")&&n.get("flowElements").length;Bt(i.html).toggle(VO,!r)}},jr.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=ue(e),r=n.get({element:e,type:"drilldown"});r.length&&this._removeOverlay(e);var o=Ot('<button type="button" class="bjs-drilldown">'+GO+"</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(Gi(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:o}),this._updateOverlayVisibility(e)},jr.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},jr.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const WO={__depends__:[Vl,fd,BO],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",qx],drilldownCentering:["type",Yx],drilldownOverlayBehavior:["type",jr],subprocessCompatibility:["type",yo]};function Hr(e){Ft.call(this,e)}Ee(Hr,Ft),Hr.prototype._modules=[ky,WO,Vl,gi,Za],Hr.prototype._moddleExtensions={};var Ul="keyboard.keydown",UO="keyboard.keyup",qO=1e3,Zx="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 Bn(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(Zx));var i=e&&e.bind!==!1;t.on("canvas.init",function(r){n._target=r.svg,i&&n.bind(),n._fire("init")})}Bn.$inject=["config.keyboard","eventBus"],Bn.prototype._keydownHandler=function(e){this._keyHandler(e,Ul)},Bn.prototype._keyupHandler=function(e){this._keyHandler(e,UO)},Bn.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||Ul,i),n&&e.preventDefault()}},Bn.prototype._isEventIgnored=function(e){return!1},Bn.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(Zx)),this.unbind(),e=this._node=this._target,Ve.bind(e,"keydown",this._keydownHandler),Ve.bind(e,"keyup",this._keyupHandler),this._fire("bind")},Bn.prototype.getBinding=function(){return this._node},Bn.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),Ve.unbind(e,"keydown",this._keydownHandler),Ve.unbind(e,"keyup",this._keyupHandler)),this._node=null},Bn.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},Bn.prototype.addListener=function(e,t,n){hn(e)&&(n=t,t=e,e=qO),this._eventBus.on(n||Ul,e,t)},Bn.prototype.removeListener=function(e,t){this._eventBus.off(t||Ul,e)},Bn.prototype.hasModifier=rk,Bn.prototype.isCmd=Kn,Bn.prototype.isShift=td,Bn.prototype.isKey=ln;var YO=500;function da(e,t){var n=this;e.on("editorActions.init",YO,function(i){var r=i.editorActions;n.registerBindings(t,r)})}da.$inject=["eventBus","keyboard"],da.prototype.registerBindings=function(e,t){function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("undo",function(i){var r=i.keyEvent;if(lk(r))return t.trigger("undo"),!0}),n("redo",function(i){var r=i.keyEvent;if(uk(r))return t.trigger("redo"),!0}),n("copy",function(i){var r=i.keyEvent;if(ok(r))return t.trigger("copy"),!0}),n("paste",function(i){var r=i.keyEvent;if(ak(r))return t.trigger("paste"),!0}),n("duplicate",function(i){var r=i.keyEvent;if(sk(r))return t.trigger("duplicate"),!0}),n("cut",function(i){var r=i.keyEvent;if(ck(r))return t.trigger("cut"),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(ln(["+","Add","="],r)&&Kn(r))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(ln(["-","Subtract"],r)&&Kn(r))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var r=i.keyEvent;if(ln("0",r)&&Kn(r))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var r=i.keyEvent;if(ln(["Backspace","Delete","Del"],r))return t.trigger("removeSelection"),!0})};const $d={__init__:["keyboard","keyboardBindings"],keyboard:["type",Bn],keyboardBindings:["type",da]};var KO={moveSpeed:50,moveSpeedAccelerated:200};function Qx(e,t,n){var i=this;this._config=W({},KO,e||{}),t.addListener(r);function r(o){var a=o.keyEvent,s=i._config;if(t.isCmd(a)&&t.isKey(["ArrowLeft","Left","ArrowUp","Up","ArrowDown","Down","ArrowRight","Right"],a)){var c=t.isShift(a)?s.moveSpeedAccelerated:s.moveSpeed,l;switch(a.key){case"ArrowLeft":case"Left":l="left";break;case"ArrowUp":case"Up":l="up";break;case"ArrowRight":case"Right":l="right";break;case"ArrowDown":case"Down":l="down";break}return i.moveCanvas({speed:c,direction:l}),!0}}this.moveCanvas=function(o){var a=0,s=0,c=o.speed,l=c/Math.min(Math.sqrt(n.viewbox().scale),1);switch(o.direction){case"left":a=l;break;case"up":s=l;break;case"right":a=-l;break;case"down":s=-l;break}n.scroll({dx:a,dy:s})}}Qx.$inject=["config.keyboardMove","keyboard","canvas"];const Jx={__depends__:[$d],__init__:["keyboardMove"],keyboardMove:["type",Qx]};var XO=15;function e_(e,t){var n;function i(s){return a(s.originalEvent)}e.on("canvas.focus.changed",function(s){s.focused?e.on("element.mousedown",500,i):e.off("element.mousedown",i)});function r(s){var c=n.start,l=n.button,u=uo(s),p=Mi(u,c);if(!n.dragging&&ZO(p)>XO&&(n.dragging=!0,l===0&&yb(e),yl("grab")),n.dragging){var f=n.last||n.start;p=Mi(u,f),t.scroll({dx:p.x,dy:p.y}),n.last=u}s.preventDefault()}function o(s){Ve.unbind(document,"mousemove",r),Ve.unbind(document,"mouseup",o),n=null,gb()}function a(s){if(!ro(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:uo(s)},Ve.bind(document,"mousemove",r),Ve.bind(document,"mouseup",o),!0}}this.isActive=function(){return!!n}}e_.$inject=["eventBus","canvas"];function ZO(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const t_={__init__:["moveCanvas"],moveCanvas:["type",e_]};function n_(e,t){var n=Zp(e.min),i=Zp(e.max),r=Math.abs(n)+Math.abs(i);return r/t}function QO(e,t){return Math.max(e.min,Math.min(e.max,t))}var JO=Math.sign||function(e){return e>=0?1:-1},Fd={min:.2,max:4},i_=10,eD=.1,tD=.75;function Ui(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=Fn(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||tD;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}Ui.$inject=["config.zoomScroll","eventBus","canvas"],Ui.prototype.scroll=function(t){this._canvas.scroll(t)},Ui.prototype.reset=function(){this._canvas.zoom("fit-viewport")},Ui.prototype.zoom=function(t,n){var i=n_(Fd,i_*2);this._totalDelta+=t,Math.abs(this._totalDelta)>eD&&(this._zoom(t,n,i),this._totalDelta=0)},Ui.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||Sv()&&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))*JO(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)}},Ui.prototype.stepZoom=function(t,n){var i=n_(Fd,i_);this._zoom(t,n,i)},Ui.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=Zp(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(QO(Fd,s),t)},Ui.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,r=this._enabled;return typeof t>"u"&&(t=!r),r!==t&&Ve[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},Ui.prototype._init=function(e){this.toggle(e)};const r_={__init__:["zoomScroll"],zoomScroll:["type",Ui]};function Ss(e){Hr.call(this,e)}Ee(Ss,Hr),Ss.prototype._navigationModules=[Jx,t_,r_],Ss.prototype._modules=[].concat(Hr.prototype._modules,Ss.prototype._navigationModules);function jd(e){return e&&e[e.length-1]}function o_(e){return e.y}function a_(e){return e.x}var nD={left:a_,center:a_,right:function(e){return e.x+e.width},top:o_,middle:o_,bottom:function(e){return e.y+e.height}};function ha(e,t){this._modeling=e,this._rules=t}ha.$inject=["modeling","rules"],ha.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}},ha.prototype._isType=function(e,t){return t.indexOf(e)!==-1},ha.prototype._alignmentPosition=function(e,t){var n=this._getOrientationDetails(e),i=n.axis,r=n.dimension,o={},a={},s=!1,c,l,u;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"]))u=jd(t),o[e]=u[i]+u[r];else if(this._isType(e,["center","middle"])){if(H(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=Oi(a,function(f){return f.elements.length>1&&(s=!0),f.elements.length}),s)return o[e]=jd(c).center,o;l=t[0],t=Oi(t,function(f){return f[i]+f[r]}),u=jd(t),o[e]=p(l,u)}return o},ha.prototype.trigger=function(e,t){var n=this._modeling,i,r=tt(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:r}),Fe(i)&&(r=i),!(r.length<2||!i)){var o=nD[t],a=Oi(r,o),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const iD={__init__:["alignElements"],alignElements:["type",ha]},rD=new ca;function ma(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}ma.$inject=["eventBus"],ma.prototype.schedule=function(e,t=rD.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},ma.prototype._schedule=function(e,t){const n=oD();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}},ma.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},ma.prototype._cancel=function(e){clearTimeout(e.executionId)};function oD(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const aD={scheduler:["type",ma]};var sD="djs-element-hidden",ql=".entry",cD=1e3,s_=8,lD=300;function tn(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}tn.$inject=["canvas","elementRegistry","eventBus","scheduler"],tn.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=Fe(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=Fe(i.target)?i.target:[i.target];r.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},tn.prototype._createContainer=function(){var e=Ot('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},tn.prototype.registerProvider=function(e,t){t||(t=e,e=cD),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},tn.prototype.getEntries=function(e){var t=this._getProviders(),n=Fe(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return H(t,function(r){if(hn(r[n])){var o=r[n](e);hn(o)?i=o(i):H(o,function(a,s){i[s]=a})}}),i},tn.prototype.trigger=function(e,t,n){var i=this,r,o,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(r=kn(a,"data-action"),o=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(r,"hover",o,n)},lD);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(r,e,o,n)},tn.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(hn(s)){if(t==="click")return s(n,r,i)}else if(s[t])return s[t](n,r,i);n.preventDefault()}}}},tn.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))}},tn.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},tn.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),i;H(t,function(r,o){var a=r.group||"default",s=Ot(r.html||'<div class="entry" draggable="true"></div>'),c;kn(s,"data-action",o),c=St("[data-group="+Es(a)+"]",n),c||(c=Ot('<div class="group"></div>'),kn(c,"data-group",a),n.appendChild(c)),c.appendChild(s),r.className&&uD(s,r.className),r.title&&kn(s,"title",r.title),r.imageUrl&&(i=Ot("<img>"),kn(i,"src",r.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),Bt(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},tn.prototype._createHtml=function(e){var t=this,n=Ot('<div class="djs-context-pad"></div>');return Un.bind(n,ql,"click",function(i){t.trigger("click",i)}),Un.bind(n,ql,"dragstart",function(i){t.trigger("dragstart",i)}),Un.bind(n,ql,"mouseover",function(i){t.trigger("mouseover",i)}),Un.bind(n,ql,"mouseout",function(i){t.trigger("mouseout",i)}),Ve.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},tn.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()&&fD(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},tn.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},tn.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return Fe(e)!==Fe(n)?!1:Fe(e)?e.length===n.length&&Jr(e,function(i){return n.includes(i)}):n===e},tn.prototype.isShown=function(){return this.isOpen()&&Bt(this._current.html).has("open")},tn.prototype.show=function(){this.isOpen()&&(Bt(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},tn.prototype.hide=function(){this.isOpen()&&(Bt(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},tn.prototype._getPosition=function(e){if(!Fe(e)&&Ct(e)){var t=this._canvas.viewbox(),n=pD(e),i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale;return{left:i+s_*this._canvas.zoom(),top:r}}var o=this._canvas.getContainer(),a=o.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+s_*this._canvas.zoom(),top:s.top-a.top}},tn.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")},tn.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=Fe(n)?n:[n],r=i.some(function(o){return t._canvas.hasMarker(o,sD)});r?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},tn.prototype._getTargetBounds=function(e){var t=this,n=Fe(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 uD(e,t){var n=Bt(e);t=Fe(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function pD(e){return e.waypoints[e.waypoints.length-1]}function fD(e,t){return e=Fe(e)?e:[e],t=Fe(t)?t:[t],e.length===t.length&&Jr(e,function(n){return t.includes(n)})}const c_={__depends__:[gl,aD,Vl],contextPad:["type",tn]};var Yl,Ht,l_,zr,u_,p_,f_,Hd,Kl,Rs,d_,zd,Gd,Vd,Xl={},Zl=[],dD=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Ql=Array.isArray;function ur(e,t){for(var n in t)e[n]=t[n];return e}function Wd(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function h_(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?Yl.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 Jl(e,a,i,r,null)}function Jl(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??++l_,__i:-1,__u:0};return r==null&&Ht.vnode!=null&&Ht.vnode(o),o}function eu(e){return e.children}function tu(e,t){this.props=e,this.context=t}function vo(e,t){if(t==null)return e.__?vo(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"?vo(e):null}function hD(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],r=[],o=ur({},t);o.__v=t.__v+1,Ht.vnode&&Ht.vnode(o),Ud(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??vo(t),!!(32&t.__u),r),o.__v=t.__v,o.__.__k[o.__i]=o,w_(i,o,r),t.__e=t.__=null,o.__e!=n&&m_(o)}}function m_(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}),m_(e)}function g_(e){(!e.__d&&(e.__d=!0)&&zr.push(e)&&!nu.__r++||u_!=Ht.debounceRendering)&&((u_=Ht.debounceRendering)||p_)(nu)}function nu(){try{for(var e,t=1;zr.length;)zr.length>t&&zr.sort(f_),e=zr.shift(),t=zr.length,hD(e)}finally{zr.length=nu.__r=0}}function y_(e,t,n,i,r,o,a,s,c,l,u){var p,f,d,h,m,v,w=i&&i.__k||Zl,x=t.length;for(c=mD(n,t,w,c,x),p=0;p<x;p++)(d=n.__k[p])!=null&&(f=d.__i!=-1&&w[d.__i]||Xl,d.__i=p,v=Ud(e,d,f,r,o,a,s,c,l,u),h=d.__e,d.ref&&f.ref!=d.ref&&(f.ref&&qd(f.ref,null,d),u.push(d.ref,d.__c||h,d)),m==null&&h!=null&&(m=h),4&d.__u?(c=v_(d,c,e),f.__e&&(f.__e=null)):typeof d.type=="function"&&v!==void 0?c=v:h&&(c=h.nextSibling),d.__u&=-7);return n.__e=m,c}function mD(e,t,n,i,r){var o,a,s,c,l,u=n.length,p=u,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]=Jl(null,a,null,null,null):Ql(a)?a=e.__k[o]=Jl(eu,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=Jl(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,(l=a.__i=gD(a,n,c,p))!=-1&&(p--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(r>u?f--:r<u&&f++),typeof a.type!="function"&&(a.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,a.__u|=4))):e.__k[o]=null;if(p)for(o=0;o<u;o++)(s=n[o])!=null&&(2&s.__u)==0&&(s.__e==i&&(i=vo(s)),S_(s,s));return i}function v_(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=v_(i[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=vo(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function gD(e,t,n,i){var r,o,a,s=e.key,c=e.type,l=t[n],u=l!=null&&(2&l.__u)==0;if(l===null&&s==null||u&&s==l.key&&c==l.type)return n;if(i>(u?1:0)){for(r=n-1,o=n+1;r>=0||o<t.length;)if((l=t[a=r>=0?r--:o++])!=null&&(2&l.__u)==0&&s==l.key&&c==l.type)return a}return-1}function b_(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||dD.test(t)?n:n+"px"}function iu(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||b_(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||b_(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(d_,"$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[Rs]=i[Rs]:(n[Rs]=zd,e.addEventListener(t,o?Vd:Gd,o)):e.removeEventListener(t,o?Vd:Gd,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 x_(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Kl]==null)t[Kl]=zd++;else if(t[Kl]<n[Rs])return;return n(Ht.event?Ht.event(t):t)}}}function Ud(e,t,n,i,r,o,a,s,c,l){var u,p,f,d,h,m,v,w,x,g,y,S,E,T,k,I,P=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[s=t.__e=n.__e]),(u=Ht.__b)&&u(t);e:if(typeof P=="function"){p=a.length;try{if(x=t.props,g=P.prototype&&P.prototype.render,y=(u=P.contextType)&&i[u.__c],S=u?y?y.props.value:u.__:i,n.__c?w=(f=t.__c=n.__c).__=f.__E:(g?t.__c=f=new P(x,S):(t.__c=f=new tu(x,S),f.constructor=P,f.render=vD),y&&y.sub(f),f.state||(f.state={}),f.__n=i,d=f.__d=!0,f.__h=[],f._sb=[]),g&&f.__s==null&&(f.__s=f.state),g&&P.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=ur({},f.__s)),ur(f.__s,P.getDerivedStateFromProps(x,f.__s))),h=f.props,m=f.state,f.__v=t,d)g&&P.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),g&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(g&&P.getDerivedStateFromProps==null&&x!==h&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(x,S),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(x,f.__s,S)===!1){t.__v!=n.__v&&(f.props=x,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(O){O&&(O.__=t)}),Zl.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&a.push(f),s=vo(n);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(x,f.__s,S),g&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(h,m,v)})}if(f.context=S,f.props=x,f.__P=e,f.__e=!1,E=Ht.__r,T=0,g)f.state=f.__s,f.__d=!1,E&&E(t),u=f.render(f.props,f.state,f.context),Zl.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,E&&E(t),u=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++T<25);f.state=f.__s,f.getChildContext!=null&&(i=ur(ur({},i),f.getChildContext())),g&&!d&&f.getSnapshotBeforeUpdate!=null&&(v=f.getSnapshotBeforeUpdate(h,m)),k=u!=null&&u.type===eu&&u.key==null?E_(u.props.children):u,s=y_(e,Ql(k)?k:[k],t,n,i,r,o,a,s,c,l),f.base=t.__e,t.__u&=-161,f.__h.length&&a.push(f),w&&(f.__E=f.__=null)}catch(O){if(a.length=p,t.__v=null,c||o!=null){if(O.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(I=o.length;I--;)Wd(o[I])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),O.then||__(t),Ht.__e(O,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=yD(n.__e,t,n,i,r,o,a,c,l);return(u=Ht.diffed)&&u(t),128&t.__u?void 0:s}function __(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(__))}function w_(e,t,n){for(var i=0;i<n.length;i++)qd(n[i],n[++i],n[++i]);Ht.__c&&Ht.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){Ht.__e(o,r.__v)}})}function E_(e){return typeof e!="object"||e==null||e.__b>0?e:Ql(e)?e.map(E_):e.constructor!==void 0?null:ur({},e)}function yD(e,t,n,i,r,o,a,s,c){var l,u,p,f,d,h,m,v=n.props||Xl,w=t.props,x=t.type;if(x=="svg"?r="http://www.w3.org/2000/svg":x=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),o!=null){for(l=0;l<o.length;l++)if((d=o[l])&&"setAttribute"in d==!!x&&(x?d.localName==x:d.nodeType==3)){e=d,o[l]=null;break}}if(e==null){if(x==null)return document.createTextNode(w);e=document.createElementNS(r,x,w.is&&w),s&&(Ht.__m&&Ht.__m(t,o),s=!1),o=null}if(x==null)v===w||s&&e.data==w||(e.data=w);else{if(o=x=="textarea"&&w.defaultValue!=null?null:o&&Yl.call(e.childNodes),!s&&o!=null)for(v={},l=0;l<e.attributes.length;l++)v[(d=e.attributes[l]).name]=d.value;for(l in v)d=v[l],l=="dangerouslySetInnerHTML"?p=d:l=="children"||l in w||l=="value"&&"defaultValue"in w||l=="checked"&&"defaultChecked"in w||iu(e,l,null,d,r);for(l in w)d=w[l],l=="children"?f=d:l=="dangerouslySetInnerHTML"?u=d:l=="value"?h=d:l=="checked"?m=d:s&&typeof d!="function"||v[l]===d||iu(e,l,d,v[l],r);if(u)s||p&&(u.__html==p.__html||u.__html==e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(p&&(e.innerHTML=""),y_(t.type=="template"?e.content:e,Ql(f)?f:[f],t,n,i,x=="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,a,o?o[0]:n.__k&&vo(n,0),s,c),o!=null)for(l=o.length;l--;)Wd(o[l]);s&&x!="textarea"||(l="value",x=="progress"&&h==null?e.removeAttribute("value"):h!=null&&(h!==e[l]||x=="progress"&&!h||x=="option"&&h!=v[l])&&iu(e,l,h,v[l],r),l="checked",m!=null&&m!=e[l]&&iu(e,l,m,v[l],r))}return e}function qd(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){Ht.__e(r,n)}}function S_(e,t,n){var i,r;if(Ht.unmount&&Ht.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||qd(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){Ht.__e(o,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&S_(i[r],t,n||typeof e.type!="function");n||Wd(e.__e),e.__c=e.__=e.__e=void 0}function vD(e,t,n){return this.constructor(e,n)}function R_(e,t,n){var i,r,o,a;t==document&&(t=document.documentElement),Ht.__&&Ht.__(e,t),r=(i=!1)?null:t.__k,o=[],a=[],Ud(t,e=t.__k=h_(eu,null,[e]),r||Xl,Xl,t.namespaceURI,r?null:t.firstChild?Yl.call(t.childNodes):null,o,r?r.__e:t.firstChild,i,a),w_(o,e,a),e.props.children=null}Yl=Zl.slice,Ht={__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}},l_=0,tu.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=ur({},this.state),typeof e=="function"&&(e=e(ur({},n),this.props)),e&&ur(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),g_(this))},tu.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),g_(this))},tu.prototype.render=eu,zr=[],p_=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,f_=function(e,t){return e.__v.__b-t.__v.__b},nu.__r=0,Hd=Math.random().toString(8),Kl="__d"+Hd,Rs="__a"+Hd,d_=/(PointerCapture)$|Capture$/i,zd=0,Gd=x_(!1),Vd=x_(!0);var C_=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,C_(e,s,n,["",null])),i.push(r),s[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(s)}return i},A_=new Map;function bD(e){var t=A_.get(this);return t||(t=new Map,A_.set(this,t)),(t=C_(this,t.get(e)||(t.set(e,t=(function(n){for(var i,r,o=1,a="",s="",c=[0],l=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=""},u=0;u<n.length;u++){u&&(o===1&&l(),l(u));for(var p=0;p<n[u].length;p++)i=n[u][p],o===1?i==="<"?(l(),c=[c],o=3):a+=i:o===4?a==="--"&&i===">"?(o=1,a=""):a=i+a[0]:s?i===s?s="":a+=i:i==='"'||i==="'"?s=i:i===">"?(l(),o=1):o&&(i==="="?(o=5,r=a,a=""):i==="/"&&(o<5||n[u][p+1]===">")?(l(),o===3&&(c=c[0]),o=c,(c=c[0]).push(2,0,o),o=0):i===" "||i===" "||i===`
11
- `||i==="\r"?(l(),o=2):a+=i),o===3&&a==="!--"&&(o=4,c=c[0])}return l(),c})(e)),t),arguments,[])).length>1?t:t[0]}var Mt=bD.bind(h_),ga,nn,Yd,M_,Cs=0,P_=[],un=Ht,T_=un.__b,k_=un.__r,O_=un.diffed,D_=un.__c,L_=un.unmount,I_=un.__;function ru(e,t){un.__h&&un.__h(nn,e,Cs||t),Cs=0;var n=nn.__H||(nn.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function Kd(e){return Cs=1,xD(N_,e)}function xD(e,t,n){var i=ru(ga++,2);if(i.t=e,!i.__c&&(i.__=[N_(void 0,t),function(s){var c=i.__N?i.__N[0]:i.__[0],l=i.t(c,s);c!==l&&(i.__N=[l,i.__[1]],i.__c.setState({}))}],i.__c=nn,!nn.__f)){var r=function(s,c,l){if(!i.__c.__H)return!0;var u=!1,p=i.__c.props!==s;if(i.__c.__H.__.some(function(d){if(d.__N){u=!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,l);return u?f||p:f}return!u||p};nn.__f=!0;var o=nn.shouldComponentUpdate,a=nn.componentWillUpdate;nn.componentWillUpdate=function(s,c,l){if(this.__e){var u=o;o=void 0,r(s,c,l),o=u}a&&a.call(this,s,c,l)},nn.shouldComponentUpdate=r}return i.__N||i.__}function ou(e,t){var n=ru(ga++,3);!un.__s&&Qd(n.__H,t)&&(n.__=e,n.u=t,nn.__H.__h.push(n))}function Xd(e,t){var n=ru(ga++,4);!un.__s&&Qd(n.__H,t)&&(n.__=e,n.u=t,nn.__h.push(n))}function au(e){return Cs=5,pr(function(){return{current:e}},[])}function pr(e,t){var n=ru(ga++,7);return Qd(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function As(e,t){return Cs=8,pr(function(){return e},t)}function _D(){for(var e;e=P_.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(su),t.__h.some(Zd),t.__h=[]}catch(n){t.__h=[],un.__e(n,e.__v)}}}un.__b=function(e){nn=null,T_&&T_(e)},un.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),I_&&I_(e,t)},un.__r=function(e){k_&&k_(e),ga=0;var t=(nn=e.__c).__H;t&&(Yd===nn?(t.__h=[],nn.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(su),t.__h.some(Zd),t.__h=[],ga=0)),Yd=nn},un.diffed=function(e){O_&&O_(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(P_.push(t)!==1&&M_===un.requestAnimationFrame||((M_=un.requestAnimationFrame)||wD)(_D)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),Yd=nn=null},un.__c=function(e,t){t.some(function(n){try{n.__h.some(su),n.__h=n.__h.filter(function(i){return!i.__||Zd(i)})}catch(i){t.some(function(r){r.__h&&(r.__h=[])}),t=[],un.__e(i,n.__v)}}),D_&&D_(e,t)},un.unmount=function(e){L_&&L_(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{su(i)}catch(r){t=r}}),n.__H=void 0,t&&un.__e(t,n.__v))};var B_=typeof requestAnimationFrame=="function";function wD(e){var t,n=function(){clearTimeout(i),B_&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);B_&&(t=requestAnimationFrame(n))}function su(e){var t=nn,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),nn=t}function Zd(e){var t=nn;e.__c=e.__(),nn=t}function Qd(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function N_(e,t){return typeof t=="function"?t(e):t}function ED(e){const{navigationStack:t,setNavigationStack:n}=e,i=pr(()=>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 Mt`
10
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="`+f+'" height="'+d+'" viewBox="'+u+" "+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}},Ft.prototype._setDefinitions=function(e){this._definitions=e},Ft.prototype.getModules=function(){return this._modules},Ft.prototype.clear=function(){this.getDefinitions()&&Pr.prototype.clear.call(this)},Ft.prototype.destroy=function(){Pr.prototype.destroy.call(this),Fi(this._container)},Ft.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},Ft.prototype.off=function(e,t){this.get("eventBus").off(e,t)},Ft.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=St(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},Ft.prototype.getDefinitions=function(){return this._definitions},Ft.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},Ft.prototype._init=function(e,t,n){const i=n.modules||this.getModules(n),r=n.additionalModules||[],o=[{bpmnjs:["value",this],moddle:["value",t]}],a=[].concat(o,i,r),s=W(Li(n,["additionalModules"]),{canvas:W({},n.canvas,{container:e}),modules:a});Pr.call(this,s),n&&n.container&&this.attachTo(n.container)},Ft.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},Ft.prototype._createContainer=function(e){const t=Ot('<div class="bjs-container"></div>');return Bn(t,{width:Ly(e.width),height:Ly(e.height),position:e.position}),t},Ft.prototype._createModdle=function(e){const t=W({},this._moddleExtensions,e.moddleExtensions);return new bm(t)},Ft.prototype._modules=[];function Gc(e,t){return e.warnings=t,e}function cM(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 lM={width:"100%",height:"100%",position:"relative"};function Ly(e){return e+(ze(e)?"px":"")}function uM(e,t){return t&&Tt(e.diagrams,function(n){return n.id===t})||null}function pM(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+Ty+"</a>",i=Ot(n);Bn(St("svg",i),ky),Bn(i,Oy,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),Ge.bind(i,"click",function(r){sM(),r.preventDefault()})}function Jo(e){Ft.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)}we(Jo,Ft),Jo.prototype._createModdle=function(e){var t=Ft.prototype._createModdle.call(this,e);return t.ids=new $i([32,36,1]),t},Jo.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 at(e,t){return C(e,"bpmn:CallActivity")?!1:C(e,"bpmn:SubProcess")?(t=t||pt(e),t&&C(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):C(e,"bpmn:Participant")?!!ue(e).processRef:!0}function gn(e){if(!(!C(e,"bpmn:Participant")&&!C(e,"bpmn:Lane"))){var t=pt(e).isHorizontal;return t===void 0?!0:t}}function fM(e){return e&&ue(e).isInterrupting!==!1}function Ln(e){return e&&!!ue(e).triggeredByEvent}function ea(e,t){var n=ue(e).eventDefinitions;return vr(n,function(i){return C(i,t)})}function dM(e){return ea(e,"bpmn:ErrorEventDefinition")}function hM(e){return ea(e,"bpmn:EscalationEventDefinition")}function mM(e){return ea(e,"bpmn:CompensateEventDefinition")}var po={width:90,height:20},Iy=15;function Tr(e){return C(e,"bpmn:Event")||C(e,"bpmn:Gateway")||C(e,"bpmn:DataStoreReference")||C(e,"bpmn:DataObjectReference")||C(e,"bpmn:DataInput")||C(e,"bpmn:DataOutput")||C(e,"bpmn:SequenceFlow")||C(e,"bpmn:MessageFlow")||C(e,"bpmn:Group")}function Vc(e){return Je(e.label)}function gM(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=yM(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-=Iy:a+=Iy,{x:a,y:s}}function yM(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 of(e){return e.waypoints?gM(e.waypoints):C(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+po.height/2}:{x:e.x+e.width/2,y:e.y+e.height+po.height/2}}function vM(e,t){var n,i,r,o=e.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(po.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=of(t),i=po),W({x:n.x-i.width/2,y:n.y-i.height/2},i)}function By(e){if(C(e,"bpmn:FlowElement")||C(e,"bpmn:Participant")||C(e,"bpmn:Lane")||C(e,"bpmn:SequenceFlow")||C(e,"bpmn:MessageFlow")||C(e,"bpmn:DataInput")||C(e,"bpmn:DataOutput"))return"name";if(C(e,"bpmn:TextAnnotation"))return"text";if(C(e,"bpmn:Group"))return"categoryValueRef"}function bM(e){var t=e.categoryValueRef;return t&&t.value||""}function li(e){var t=e.businessObject,n=By(t);if(n)return n==="categoryValueRef"?bM(t):t[n]||""}function xM(e,t){var n=e.businessObject,i=By(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function _M(e){return Je(e)&&Tr(e.labelTarget)}var ta=7;function Ny(e){let t=[];return H(e.incoming,n=>{C(n,"bpmn:Association")&&C(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),H(e.outgoing,n=>{C(n,"bpmn:Association")&&C(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function Qa(e){const t=new Map;return H(Zp(e),n=>{H(Ny(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 af="hsl(225, 10%, 15%)",wM="white";function Gi(e,t){return vr(e.eventDefinitions,function(n){return n.$type===t})}function EM(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function SM(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function it(e,t,n){var i=pt(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||wM}function xe(e,t,n){var i=pt(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||af}function Ja(e,t,n,i){var r=pt(e),o=r.get("label");return i||o&&o.get("color:color")||t||xe(e,n)}function $y(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 co(r)}function sf(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 co(a)}function RM(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 co(s)}function CM(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 co(o)}function es(e,t={}){return{width:hi(e,t),height:Kn(e,t)}}function hi(e,t={}){return Wn(t,"width")?t.width:e.width}function Kn(e,t={}){return Wn(t,"height")?t.height:e.height}var AM=new $i,MM=10,Wc=3,PM=1.5,Uc=10,TM=4,na=.95,kM=1,OM=.25;function fo(e,t,n,i,r,o,a){er.call(this,t,a);var s=e&&e.defaultFillColor,c=e&&e.defaultStrokeColor,l=e&&e.defaultLabelColor;function u(B){return n.computeStyle(B,{strokeLinecap:"round",strokeLinejoin:"round",stroke:af,strokeWidth:2,fill:"white"})}function p(B){return n.computeStyle(B,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:af,strokeWidth:2})}function f(B,S){var{ref:w={x:0,y:0},scale:G=1,element:V,parentGfx:ee=r._svg}=S,Se=Oe("marker",{id:B,viewBox:"0 0 20 20",refX:w.x,refY:w.y,markerWidth:20*G,markerHeight:20*G,orient:"auto"});Ue(Se,V);var Ze=St(":scope > defs",ee);Ze||(Ze=Oe("defs"),Ue(ee,Ze)),Ue(Ze,Se)}function d(B,S,w,G){var V=AM.nextPrefixed("marker-");return g(B,V,S,w,G),"url(#"+V+")"}function g(B,S,w,G,V){if(w==="sequenceflow-end"){var ee=Oe("path",{d:"M 1 5 L 11 10 L 1 15 Z",...u({fill:V,stroke:V,strokeWidth:1})});f(S,{element:ee,ref:{x:11,y:10},scale:.5,parentGfx:B})}if(w==="messageflow-start"){var Se=Oe("circle",{cx:6,cy:6,r:3.5,...u({fill:G,stroke:V,strokeWidth:1,strokeDasharray:[1e4,1]})});f(S,{element:Se,ref:{x:6,y:6},parentGfx:B})}if(w==="messageflow-end"){var Ze=Oe("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...u({fill:G,stroke:V,strokeWidth:1,strokeDasharray:[1e4,1]})});f(S,{element:Ze,ref:{x:8.5,y:5},parentGfx:B})}if(w==="association-start"){var ht=Oe("path",{d:"M 11 5 L 1 10 L 11 15",...p({fill:"none",stroke:V,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(S,{element:ht,ref:{x:1,y:10},scale:.5,parentGfx:B})}if(w==="association-end"){var Gt=Oe("path",{d:"M 1 5 L 11 10 L 1 15",...p({fill:"none",stroke:V,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(S,{element:Gt,ref:{x:11,y:10},scale:.5,parentGfx:B})}if(w==="conditional-flow-marker"){var _t=Oe("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...u({fill:G,stroke:V})});f(S,{element:_t,ref:{x:-1,y:10},scale:.5,parentGfx:B})}if(w==="conditional-default-flow-marker"){var pn=Oe("path",{d:"M 6 4 L 10 16",...u({stroke:V,fill:"none"})});f(S,{element:pn,ref:{x:0,y:10},scale:.5,parentGfx:B})}}function h(B,S,w,G,V={}){dn(G)&&(V=G,G=0),G=G||0,V=u(V);var ee=S/2,Se=w/2,Ze=Oe("circle",{cx:ee,cy:Se,r:Math.round((S+w)/4-G),...V});return Ue(B,Ze),Ze}function y(B,S,w,G,V,ee){dn(V)&&(ee=V,V=0),V=V||0,ee=u(ee);var Se=Oe("rect",{x:V,y:V,width:S-V*2,height:w-V*2,rx:G,ry:G,...ee});return Ue(B,Se),Se}function R(B,S,w,G){var V=S/2,ee=w/2,Se=[{x:V,y:0},{x:S,y:ee},{x:V,y:w},{x:0,y:ee}],Ze=Se.map(function(Gt){return Gt.x+","+Gt.y}).join(" ");G=u(G);var ht=Oe("polygon",{...G,points:Ze});return Ue(B,ht),ht}function x(B,S,w,G){w=p(w);var V=Wa(S,w,G);return Ue(B,V),V}function m(B,S,w){return x(B,S,w,5)}function v(B,S,w){w=p(w);var G=Oe("path",{...w,d:S});return Ue(B,G),G}function _(B,S,w,G){return v(S,w,W({"data-marker":B},G))}function E(B){return Te[B]}function T(B){return function(S,w,G){return E(B)(S,w,G)}}var k={"bpmn:MessageEventDefinition":function(B,S,w={},G){var V=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:w.width||S.width,containerHeight:w.height||S.height,position:{mx:.235,my:.315}}),ee=G?xe(S,c,w.stroke):it(S,s,w.fill),Se=G?it(S,s,w.fill):xe(S,c,w.stroke),Ze=v(B,V,{fill:ee,stroke:Se,strokeWidth:1});return Ze},"bpmn:TimerEventDefinition":function(B,S,w={}){var G=w.width||S.width,V=w.height||S.height,ee=w.width?1:2,Se=h(B,G,V,.2*V,{fill:it(S,s,w.fill),stroke:xe(S,c,w.stroke),strokeWidth:ee}),Ze=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:G,containerHeight:V,position:{mx:.5,my:.5}});v(B,Ze,{stroke:xe(S,c,w.stroke),strokeWidth:ee});for(var ht=0;ht<12;ht++){var Gt=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:G,containerHeight:V,position:{mx:.5,my:.5}}),_t=G/2,pn=V/2;v(B,Gt,{strokeWidth:1,stroke:xe(S,c,w.stroke),transform:"rotate("+ht*30+","+pn+","+_t+")"})}return Se},"bpmn:EscalationEventDefinition":function(B,S,w={},G){var V=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width||S.width,containerHeight:w.height||S.height,position:{mx:.5,my:.2}}),ee=G?xe(S,c,w.stroke):it(S,s,w.fill);return v(B,V,{fill:ee,stroke:xe(S,c,w.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(B,S,w={}){var G=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width||S.width,containerHeight:w.height||S.height,position:{mx:.5,my:.222}});return v(B,G,{fill:it(S,s,w.fill),stroke:xe(S,c,w.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(B,S,w={},G){var V=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:S.width,containerHeight:S.height,position:{mx:.57,my:.263}}),ee=G?xe(S,c,w.stroke):it(S,s,w.fill);return v(B,V,{fill:ee,stroke:xe(S,c,w.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(B,S,w={},G){var V=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:w.width||S.width,containerHeight:w.height||S.height,position:{mx:.2,my:.722}}),ee=G?xe(S,c,w.stroke):it(S,s,w.fill);return v(B,V,{fill:ee,stroke:xe(S,c,w.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(B,S,w={},G){var V=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:S.width,containerHeight:S.height,position:{mx:.638,my:-.055}}),ee=G?xe(S,c,w.stroke):"none",Se=v(B,V,{fill:ee,stroke:xe(S,c,w.stroke),strokeWidth:1});return My(Se,45),Se},"bpmn:CompensateEventDefinition":function(B,S,w={},G){var V=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width||S.width,containerHeight:w.height||S.height,position:{mx:.22,my:.5}}),ee=G?xe(S,c,w.stroke):it(S,s,w.fill);return v(B,V,{fill:ee,stroke:xe(S,c,w.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(B,S,w={},G){var V=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:w.width||S.width,containerHeight:w.height||S.height,position:{mx:.5,my:.2}}),ee=G?xe(S,c,w.stroke):it(S,s,w.fill);return v(B,V,{strokeWidth:1,fill:ee,stroke:xe(S,c,w.stroke)})},"bpmn:MultipleEventDefinition":function(B,S,w={},G){var V=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:w.width||S.width,containerHeight:w.height||S.height,position:{mx:.211,my:.36}}),ee=G?xe(S,c,w.stroke):it(S,s,w.fill);return v(B,V,{fill:ee,stroke:xe(S,c,w.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(B,S,w={}){var G=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:w.width||S.width,containerHeight:w.height||S.height,position:{mx:.458,my:.194}});return v(B,G,{fill:it(S,s,w.fill),stroke:xe(S,c,w.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(B,S,w={}){var G=h(B,S.width,S.height,8,{fill:xe(S,c,w.stroke),stroke:xe(S,c,w.stroke),strokeWidth:4});return G}};function I(B,S,w={},G){var V=ue(B),ee=EM(V),Se=G||B;return V.get("eventDefinitions")&&V.get("eventDefinitions").length>1?V.get("parallelMultiple")?k["bpmn:ParallelMultipleEventDefinition"](S,Se,w,ee):k["bpmn:MultipleEventDefinition"](S,Se,w,ee):Gi(V,"bpmn:MessageEventDefinition")?k["bpmn:MessageEventDefinition"](S,Se,w,ee):Gi(V,"bpmn:TimerEventDefinition")?k["bpmn:TimerEventDefinition"](S,Se,w,ee):Gi(V,"bpmn:ConditionalEventDefinition")?k["bpmn:ConditionalEventDefinition"](S,Se,w,ee):Gi(V,"bpmn:SignalEventDefinition")?k["bpmn:SignalEventDefinition"](S,Se,w,ee):Gi(V,"bpmn:EscalationEventDefinition")?k["bpmn:EscalationEventDefinition"](S,Se,w,ee):Gi(V,"bpmn:LinkEventDefinition")?k["bpmn:LinkEventDefinition"](S,Se,w,ee):Gi(V,"bpmn:ErrorEventDefinition")?k["bpmn:ErrorEventDefinition"](S,Se,w,ee):Gi(V,"bpmn:CancelEventDefinition")?k["bpmn:CancelEventDefinition"](S,Se,w,ee):Gi(V,"bpmn:CompensateEventDefinition")?k["bpmn:CompensateEventDefinition"](S,Se,w,ee):Gi(V,"bpmn:TerminateEventDefinition")?k["bpmn:TerminateEventDefinition"](S,Se,w,ee):null}var P={ParticipantMultiplicityMarker:function(B,S,w={}){var G=hi(S,w),V=Kn(S,w),ee=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:V,position:{mx:(G/2-6)/G,my:(V-15)/V}});_("participant-multiplicity",B,ee,{strokeWidth:2,fill:it(S,s,w.fill),stroke:xe(S,c,w.stroke)})},SubProcessMarker:function(B,S,w={}){var G=y(B,14,14,0,{strokeWidth:1,fill:it(S,s,w.fill),stroke:xe(S,c,w.stroke)});Cn(G,S.width/2-7.5,S.height-20);var V=i.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:S.width,containerHeight:S.height,position:{mx:(S.width/2-7.5)/S.width,my:(S.height-20)/S.height}});_("sub-process",B,V,{fill:it(S,s,w.fill),stroke:xe(S,c,w.stroke)})},ParallelMarker:function(B,S,w){var G=hi(S,w),V=Kn(S,w),ee=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:V,position:{mx:(G/2+w.parallel)/G,my:(V-20)/V}});_("parallel",B,ee,{fill:it(S,s,w.fill),stroke:xe(S,c,w.stroke)})},SequentialMarker:function(B,S,w){var G=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:S.width,containerHeight:S.height,position:{mx:(S.width/2+w.seq)/S.width,my:(S.height-19)/S.height}});_("sequential",B,G,{fill:it(S,s,w.fill),stroke:xe(S,c,w.stroke)})},CompensationMarker:function(B,S,w){var G=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:S.width,containerHeight:S.height,position:{mx:(S.width/2+w.compensation)/S.width,my:(S.height-13)/S.height}});_("compensation",B,G,{strokeWidth:1,fill:it(S,s,w.fill),stroke:xe(S,c,w.stroke)})},LoopMarker:function(B,S,w){var G=hi(S,w),V=Kn(S,w),ee=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:V,position:{mx:(G/2+w.loop)/G,my:(V-7)/V}});_("loop",B,ee,{strokeWidth:1.5,fill:"none",stroke:xe(S,c,w.stroke),strokeMiterlimit:.5})},AdhocMarker:function(B,S,w){var G=hi(S,w),V=Kn(S,w),ee=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:V,position:{mx:(G/2+w.adhoc)/G,my:(V-15)/V}});_("adhoc",B,ee,{strokeWidth:1,fill:xe(S,c,w.stroke),stroke:xe(S,c,w.stroke)})}};function O(B,S,w,G){P[B](S,w,G)}function F(B,S,w=[],G={}){G={fill:G.fill,stroke:G.stroke,width:hi(S,G),height:Kn(S,G)};var V=ue(S),ee=w.includes("SubProcessMarker");ee?G={...G,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:G={...G,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},V.get("isForCompensation")&&w.push("CompensationMarker"),C(V,"bpmn:AdHocSubProcess")&&(w.push("AdhocMarker"),ee||W(G,{compensation:G.compensation-18}));var Se=V.get("loopCharacteristics"),Ze=Se&&Se.get("isSequential");Se&&(W(G,{compensation:G.compensation-18}),w.includes("AdhocMarker")&&W(G,{seq:-23,loop:-18,parallel:-24}),Ze===void 0&&w.push("LoopMarker"),Ze===!1&&w.push("ParallelMarker"),Ze===!0&&w.push("SequentialMarker")),w.includes("CompensationMarker")&&w.length===1&&W(G,{compensation:-8}),H(w,function(ht){O(ht,B,S,G)})}function J(B,S,w={}){w=W({size:{width:100}},w);var G=o.createText(S||"",w);return ct(G).add("djs-label"),Ue(B,G),G}function he(B,S,w,G={}){var V=ue(S),ee=es({x:S.x,y:S.y,width:S.width,height:S.height},G);return J(B,V.name,{align:w,box:ee,padding:7,style:{fill:Ja(S,l,c,G.stroke)}})}function Pe(B,S,w={}){var G={width:S.width,height:S.height,x:S.width/2+S.x,y:S.height/2+S.y};return J(B,li(S),{box:G,style:W({},o.getExternalStyle(),{fill:Ja(S,l,c,w.stroke)})})}function De(B,S,w,G={}){var V=gn(w),ee=J(B,S,{box:{height:30,width:V?Kn(w,G):hi(w,G)},align:"center-middle",style:{fill:Ja(w,l,c,G.stroke)}});if(V){var Se=-1*Kn(w,G);Hc(ee,0,-Se,270)}}function Ke(B,S,w={}){var{width:G,height:V}=es(S,w);return y(B,G,V,Uc,{...w,fill:it(S,s,w.fill),fillOpacity:na,stroke:xe(S,c,w.stroke)})}function rt(B,S,w={}){var G=ue(S),V=it(S,s,w.fill),ee=xe(S,c,w.stroke);return(G.get("associationDirection")==="One"||G.get("associationDirection")==="Both")&&(w.markerEnd=d(B,"association-end",V,ee)),G.get("associationDirection")==="Both"&&(w.markerStart=d(B,"association-start",V,ee)),w=dt(w,["markerStart","markerEnd"]),m(B,S.waypoints,{...w,stroke:ee,strokeDasharray:"0, 5"})}function Ce(B,S,w={}){var G=it(S,s,w.fill),V=xe(S,c,w.stroke),ee=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:S.width,containerHeight:S.height,position:{mx:.474,my:.296}}),Se=v(B,ee,{fill:G,fillOpacity:na,stroke:V}),Ze=ue(S);if(SM(Ze)){var ht=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:S.width,containerHeight:S.height,position:{mx:.33,my:(S.height-18)/S.height}});v(B,ht,{strokeWidth:2,fill:G,stroke:V})}return Se}function X(B,S,w={}){return h(B,S.width,S.height,{fillOpacity:na,...w,fill:it(S,s,w.fill),stroke:xe(S,c,w.stroke)})}function te(B,S,w={}){return R(B,S.width,S.height,{fill:it(S,s,w.fill),fillOpacity:na,stroke:xe(S,c,w.stroke)})}function U(B,S,w={}){var G=y(B,hi(S,w),Kn(S,w),0,{fill:it(S,s,w.fill),fillOpacity:w.fillOpacity||na,stroke:xe(S,c,w.stroke),strokeWidth:1.5}),V=ue(S);if(C(V,"bpmn:Lane")){var ee=V.get("name");De(B,ee,S,w)}return G}function K(B,S,w={}){var G=Ke(B,S,w),V=at(S);if(Ln(S)&&(Ee(G,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!V)){var ee=ue(S).flowElements||[],Se=ee.filter(Ze=>C(Ze,"bpmn:StartEvent"));Se.length===1&&ie(Se[0],B,w,S)}return he(B,S,V?"center-top":"center-middle",w),V?F(B,S,void 0,w):F(B,S,["SubProcessMarker"],w),G}function ie(B,S,w,G){var V=22,ee={fill:it(G,s,w.fill),stroke:xe(G,c,w.stroke),width:V,height:V},Se=ue(B).isInterrupting,Ze=Se?0:3,ht=Se?1:1.2,Gt=20,_t=(V-Gt)/2,pn="translate("+_t+","+_t+")";h(S,Gt,Gt,{fill:ee.fill,stroke:ee.stroke,strokeWidth:ht,strokeDasharray:Ze,transform:pn}),I(B,S,ee,G)}function pe(B,S,w={}){var G=Ke(B,S,w);return he(B,S,"center-middle",w),F(B,S,void 0,w),G}var Te=this.handlers={"bpmn:AdHocSubProcess":function(B,S,w={}){return at(S)?w=dt(w,["fill","stroke","width","height"]):w=dt(w,["fill","stroke"]),K(B,S,w)},"bpmn:Association":function(B,S,w={}){return w=dt(w,["fill","stroke"]),rt(B,S,w)},"bpmn:BoundaryEvent":function(B,S,w={}){var{renderIcon:G=!0}=w;w=dt(w,["fill","stroke"]);var V=ue(S),ee=V.get("cancelActivity");w={strokeWidth:1.5,fill:it(S,s,w.fill),fillOpacity:kM,stroke:xe(S,c,w.stroke)},ee||(w.strokeDasharray="6");var Se=X(B,S,w);return h(B,S.width,S.height,Wc,{...w,fill:"none"}),G&&I(S,B,w),Se},"bpmn:BusinessRuleTask":function(B,S,w={}){w=dt(w,["fill","stroke"]);var G=pe(B,S,w),V=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),ee=v(B,V);Ee(ee,{fill:it(S,s,w.fill),stroke:xe(S,c,w.stroke),strokeWidth:1});var Se=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),Ze=v(B,Se);return Ee(Ze,{fill:xe(S,c,w.stroke),stroke:xe(S,c,w.stroke),strokeWidth:1}),G},"bpmn:CallActivity":function(B,S,w={}){return w=dt(w,["fill","stroke"]),K(B,S,{strokeWidth:5,...w})},"bpmn:ComplexGateway":function(B,S,w={}){w=dt(w,["fill","stroke"]);var G=te(B,S,w),V=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:S.width,containerHeight:S.height,position:{mx:.46,my:.26}});return v(B,V,{fill:xe(S,c,w.stroke),stroke:xe(S,c,w.stroke),strokeWidth:1}),G},"bpmn:DataInput":function(B,S,w={}){w=dt(w,["fill","stroke"]);var G=i.getRawPath("DATA_ARROW"),V=Ce(B,S,w);return v(B,G,{fill:"none",stroke:xe(S,c,w.stroke),strokeWidth:1}),V},"bpmn:DataInputAssociation":function(B,S,w={}){return w=dt(w,["fill","stroke"]),rt(B,S,{...w,markerEnd:d(B,"association-end",it(S,s,w.fill),xe(S,c,w.stroke))})},"bpmn:DataObject":function(B,S,w={}){return w=dt(w,["fill","stroke"]),Ce(B,S,w)},"bpmn:DataObjectReference":T("bpmn:DataObject"),"bpmn:DataOutput":function(B,S,w={}){w=dt(w,["fill","stroke"]);var G=i.getRawPath("DATA_ARROW"),V=Ce(B,S,w);return v(B,G,{strokeWidth:1,fill:xe(S,c,w.stroke),stroke:xe(S,c,w.stroke)}),V},"bpmn:DataOutputAssociation":function(B,S,w={}){return w=dt(w,["fill","stroke"]),rt(B,S,{...w,markerEnd:d(B,"association-end",it(S,s,w.fill),xe(S,c,w.stroke))})},"bpmn:DataStoreReference":function(B,S,w={}){w=dt(w,["fill","stroke"]);var G=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:S.width,containerHeight:S.height,position:{mx:0,my:.133}});return v(B,G,{fill:it(S,s,w.fill),fillOpacity:na,stroke:xe(S,c,w.stroke),strokeWidth:2})},"bpmn:EndEvent":function(B,S,w={}){var{renderIcon:G=!0}=w;w=dt(w,["fill","stroke"]);var V=X(B,S,{...w,strokeWidth:4});return G&&I(S,B,w),V},"bpmn:EventBasedGateway":function(B,S,w={}){w=dt(w,["fill","stroke"]);var G=ue(S),V=te(B,S,w);h(B,S.width,S.height,S.height*.2,{fill:it(S,"none",w.fill),stroke:xe(S,c,w.stroke),strokeWidth:1});var ee=G.get("eventGatewayType"),Se=!!G.get("instantiate");function Ze(){var Gt=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:S.width,containerHeight:S.height,position:{mx:.36,my:.44}});v(B,Gt,{fill:"none",stroke:xe(S,c,w.stroke),strokeWidth:2})}if(ee==="Parallel"){var ht=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:S.width,containerHeight:S.height,position:{mx:.474,my:.296}});v(B,ht,{fill:"none",stroke:xe(S,c,w.stroke),strokeWidth:1})}else ee==="Exclusive"&&(Se||h(B,S.width,S.height,S.height*.26,{fill:"none",stroke:xe(S,c,w.stroke),strokeWidth:1}),Ze());return V},"bpmn:ExclusiveGateway":function(B,S,w={}){w=dt(w,["fill","stroke"]);var G=te(B,S,w),V=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:S.width,containerHeight:S.height,position:{mx:.32,my:.3}}),ee=pt(S);return ee.get("isMarkerVisible")&&v(B,V,{fill:xe(S,c,w.stroke),stroke:xe(S,c,w.stroke),strokeWidth:1}),G},"bpmn:Gateway":function(B,S,w={}){return w=dt(w,["fill","stroke"]),te(B,S,w)},"bpmn:Group":function(B,S,w={}){return w=dt(w,["fill","stroke","width","height"]),y(B,S.width,S.height,Uc,{stroke:xe(S,c,w.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:hi(S,w),height:Kn(S,w)})},"bpmn:InclusiveGateway":function(B,S,w={}){w=dt(w,["fill","stroke"]);var G=te(B,S,w);return h(B,S.width,S.height,S.height*.24,{fill:it(S,s,w.fill),stroke:xe(S,c,w.stroke),strokeWidth:2.5}),G},"bpmn:IntermediateEvent":function(B,S,w={}){var{renderIcon:G=!0}=w;w=dt(w,["fill","stroke"]);var V=X(B,S,{...w,strokeWidth:1.5});return h(B,S.width,S.height,Wc,{fill:"none",stroke:xe(S,c,w.stroke),strokeWidth:1.5}),G&&I(S,B,w),V},"bpmn:IntermediateCatchEvent":T("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":T("bpmn:IntermediateEvent"),"bpmn:Lane":function(B,S,w={}){return w=dt(w,["fill","stroke","width","height"]),U(B,S,{...w,fillOpacity:OM})},"bpmn:ManualTask":function(B,S,w={}){w=dt(w,["fill","stroke"]);var G=pe(B,S,w),V=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return v(B,V,{fill:it(S,s,w.fill),stroke:xe(S,c,w.stroke),strokeWidth:.5}),G},"bpmn:MessageFlow":function(B,S,w={}){w=dt(w,["fill","stroke"]);var G=ue(S),V=pt(S),ee=it(S,s,w.fill),Se=xe(S,c,w.stroke),Ze=m(B,S.waypoints,{markerEnd:d(B,"messageflow-end",ee,Se),markerStart:d(B,"messageflow-start",ee,Se),stroke:Se,strokeDasharray:"10, 11",strokeWidth:1.5});if(G.get("messageRef")){var ht=Ze.getPointAtLength(Ze.getTotalLength()/2),Gt=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:ht.x,y:ht.y}}),_t={strokeWidth:1};V.get("messageVisibleKind")==="initiating"?(_t.fill=ee,_t.stroke=Se):(_t.fill=Se,_t.stroke=ee);var pn=v(B,Gt,_t),bn=G.get("messageRef"),xn=bn.get("name"),wt=J(B,xn,{align:"center-top",fitBox:!0,style:{fill:Se}}),fn=pn.getBBox(),yn=wt.getBBox(),Ro=ht.x-yn.width/2,ti=ht.y+fn.height/2+MM;Hc(wt,Ro,ti,0)}return Ze},"bpmn:ParallelGateway":function(B,S,w={}){w=dt(w,["fill","stroke"]);var G=te(B,S,w),V=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:S.width,containerHeight:S.height,position:{mx:.46,my:.2}});return v(B,V,{fill:xe(S,c,w.stroke),stroke:xe(S,c,w.stroke),strokeWidth:1}),G},"bpmn:Participant":function(B,S,w={}){w=dt(w,["fill","stroke","width","height"]);var G=U(B,S,w),V=at(S),ee=gn(S),Se=ue(S),Ze=Se.get("name");if(V){var ht=ee?[{x:30,y:0},{x:30,y:Kn(S,w)}]:[{x:0,y:30},{x:hi(S,w),y:30}];x(B,ht,{stroke:xe(S,c,w.stroke),strokeWidth:PM}),De(B,Ze,S,w)}else{var Gt=es(S,w);ee||(Gt.height=hi(S,w),Gt.width=Kn(S,w));var _t=J(B,Ze,{box:Gt,align:"center-middle",style:{fill:Ja(S,l,c,w.stroke)}});if(!ee){var pn=-1*Kn(S,w);Hc(_t,0,-pn,270)}}return Se.get("participantMultiplicity")&&O("ParticipantMultiplicityMarker",B,S,w),G},"bpmn:ReceiveTask":function(B,S,w={}){w=dt(w,["fill","stroke"]);var G=ue(S),V=pe(B,S,w),ee;return G.get("instantiate")?(h(B,28,28,20*.22,{fill:it(S,s,w.fill),stroke:xe(S,c,w.stroke),strokeWidth:1}),ee=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):ee=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),v(B,ee,{fill:it(S,s,w.fill),stroke:xe(S,c,w.stroke),strokeWidth:1}),V},"bpmn:ScriptTask":function(B,S,w={}){w=dt(w,["fill","stroke"]);var G=pe(B,S,w),V=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return v(B,V,{fill:it(S,s,w.fill),stroke:xe(S,c,w.stroke),strokeWidth:1}),G},"bpmn:SendTask":function(B,S,w={}){w=dt(w,["fill","stroke"]);var G=pe(B,S,w),V=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return v(B,V,{fill:xe(S,c,w.stroke),stroke:it(S,s,w.fill),strokeWidth:1}),G},"bpmn:SequenceFlow":function(B,S,w={}){w=dt(w,["fill","stroke"]);var G=it(S,s,w.fill),V=xe(S,c,w.stroke),ee=m(B,S.waypoints,{markerEnd:d(B,"sequenceflow-end",G,V),stroke:V}),Se=ue(S),{source:Ze}=S;if(Ze){var ht=ue(Ze);Se.get("conditionExpression")&&C(ht,"bpmn:Activity")&&Ee(ee,{markerStart:d(B,"conditional-flow-marker",G,V)}),ht.get("default")&&(C(ht,"bpmn:Gateway")||C(ht,"bpmn:Activity"))&&ht.get("default")===Se&&Ee(ee,{markerStart:d(B,"conditional-default-flow-marker",G,V)})}return ee},"bpmn:ServiceTask":function(B,S,w={}){w=dt(w,["fill","stroke"]);var G=pe(B,S,w);h(B,10,10,{fill:it(S,s,w.fill),stroke:"none",transform:"translate(6, 6)"});var V=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});v(B,V,{fill:it(S,s,w.fill),stroke:xe(S,c,w.stroke),strokeWidth:1}),h(B,10,10,{fill:it(S,s,w.fill),stroke:"none",transform:"translate(11, 10)"});var ee=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return v(B,ee,{fill:it(S,s,w.fill),stroke:xe(S,c,w.stroke),strokeWidth:1}),G},"bpmn:StartEvent":function(B,S,w={}){var{renderIcon:G=!0}=w;w=dt(w,["fill","stroke"]);var V=ue(S);V.get("isInterrupting")||(w={...w,strokeDasharray:"6"});var ee=X(B,S,w);return G&&I(S,B,w),ee},"bpmn:SubProcess":function(B,S,w={}){return at(S)?w=dt(w,["fill","stroke","width","height"]):w=dt(w,["fill","stroke"]),K(B,S,w)},"bpmn:Task":function(B,S,w={}){return w=dt(w,["fill","stroke"]),pe(B,S,w)},"bpmn:TextAnnotation":function(B,S,w={}){w=dt(w,["fill","stroke"]);var{width:G,height:V}=es(S,w),ee=y(B,G,V,0,0,{fill:"none",stroke:"none"}),Se=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:V,position:{mx:0,my:0}});v(B,Se,{stroke:xe(S,c,w.stroke)});var Ze=ue(S),ht=Ze.get("text")||"";return J(B,ht,{align:"left-top",box:es(S,w),padding:ta,style:{fill:Ja(S,l,c,w.stroke)}}),ee},"bpmn:Transaction":function(B,S,w={}){at(S)?w=dt(w,["fill","stroke","width","height"]):w=dt(w,["fill","stroke"]);var G=K(B,S,{strokeWidth:1.5,...w}),V=n.style(["no-fill","no-events"],{stroke:xe(S,c,w.stroke),strokeWidth:1.5}),ee=at(S);return ee||(w={}),y(B,hi(S,w),Kn(S,w),Uc-Wc,Wc,V),G},"bpmn:UserTask":function(B,S,w={}){w=dt(w,["fill","stroke"]);var G=pe(B,S,w),V=15,ee=12,Se=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:V,y:ee}});v(B,Se,{fill:it(S,s,w.fill),stroke:xe(S,c,w.stroke),strokeWidth:.5});var Ze=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:V,y:ee}});v(B,Ze,{fill:it(S,s,w.fill),stroke:xe(S,c,w.stroke),strokeWidth:.5});var ht=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:V,y:ee}});return v(B,ht,{fill:xe(S,c,w.stroke),stroke:xe(S,c,w.stroke),strokeWidth:.5}),G},label:function(B,S,w={}){return Pe(B,S,w)}};this._drawPath=v,this._renderer=E}we(fo,er),fo.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],fo.prototype.canRender=function(e){return C(e,"bpmn:BaseElement")},fo.prototype.drawShape=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},fo.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},fo.prototype.getShapePath=function(e){return Je(e)?sf(e,TM):C(e,"bpmn:Event")?$y(e):C(e,"bpmn:Activity")?sf(e,Uc):C(e,"bpmn:Gateway")?RM(e):CM(e)};function dt(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var DM=0,LM={width:150,height:50};function IM(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function BM(e){return dn(e)?W({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var cf=null;function NM(){return cf||(cf=document.createElement("canvas").getContext("2d")),cf}function $M(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(Fy(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function Fy(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function FM(e,t){var n=NM();if(!n)return{width:0,height:0};n.font=$M(t),"letterSpacing"in n&&(n.letterSpacing=Fy(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 jM(e,t,n){for(var i=e.shift(),r=i,o;;){if(o=FM(r,n),o.width=r?o.width:0,r===" "||r===""||o.width<Math.round(t)||r.length<2)return HM(e,r,i,o);r=GM(r,o.width,t)}}function HM(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 jy="­";function zM(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===jy)&&r.pop();break}var a=r[r.length-1];return a&&a===jy&&(r[r.length-1]="-"),r.join("")}function GM(e,t,n){var i=Math.max(e.length*(n/t),1),r=zM(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function qc(e){this._config=W({},{size:LM,padding:DM,style:{},align:"center-top"},e||{})}qc.prototype.createText=function(e,t){return this.layoutText(e,t).element},qc.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},qc.prototype.layoutText=function(e,t){for(var n=W({},this._config.size,t.box),i=W({},this._config.style,t.style),r=IM(t.align||this._config.align),o=BM(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=VM(i),c=e.split(/\u00AD?\r?\n/),l=[],u=n.width-o.left-o.right;c.length;)l.push(jM(c,u,i));r.vertical==="middle"&&(o.top=o.bottom=0);var p=Un(l,function(y,R,x){return y+(s||R.height)},0)+o.top+o.bottom,f=Un(l,function(y,R,x){return R.width>y?R.width:y},0),d=o.top;r.vertical==="middle"&&(d+=(n.height-p)/2),d-=(s||l[0].height)/4;var g=Oe("text");Ee(g,i),H(l,function(y){var R;switch(d+=s||y.height,r.horizontal){case"left":R=o.left;break;case"right":R=(a?f:u)-o.right-y.width;break;default:R=Math.max(((a?f:u)-y.width)/2+o.left,0)}var x=Oe("tspan");Ee(x,{x:R,y:d}),x.textContent=y.text,Ue(g,x)});var h={width:f,height:p};return{dimensions:h,element:g}};function VM(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var WM=12,UM=1.2,qM=40;function Hy(e){var t=W({fontFamily:"Arial, sans-serif",fontSize:WM,fontWeight:"normal",lineHeight:UM},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=W({},t,{fontSize:n},e&&e.externalStyle||{}),r=new qc({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,po.width),height:30},l=o(s,c,{style:i});return{x:Math.round(a.x+a.width/2-l.width/2),y:a.y,width:Math.ceil(l.width),height:Math.ceil(l.height)}},this.getTextAnnotationBounds=function(a,s){var c=o(s,a,{style:t,align:"left-top",padding:ta});return{x:a.x,y:a.y,width:a.width,height:Math.max(qM,Math.round(c.height))}},this.getDimensions=function(a,s){return r.getDimensions(a,s||{})};function o(a,s,c){return r.getDimensions(a,W({box:s},c))}this.createText=function(a,s){return r.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}Hy.$inject=["config.textRenderer"];function YM(){this.pathMap={EVENT_MESSAGE:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:36,width:36,heightElements:[6,14],widthElements:[10.5,21]},EVENT_SIGNAL:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x1},0 Z",height:36,width:36,heightElements:[18],widthElements:[10,20]},EVENT_ESCALATION:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x0},-{e.y1} l -{e.x0},{e.y1} Z",height:36,width:36,heightElements:[20,7],widthElements:[8]},EVENT_CONDITIONAL:{d:"M {e.x0},{e.y0} l {e.x1},0 l 0,{e.y2} l -{e.x1},0 Z M {e.x2},{e.y3} l {e.x0},0 M {e.x2},{e.y4} l {e.x0},0 M {e.x2},{e.y5} l {e.x0},0 M {e.x2},{e.y6} l {e.x0},0 M {e.x2},{e.y7} l {e.x0},0 M {e.x2},{e.y8} l {e.x0},0 ",height:36,width:36,heightElements:[8.5,14.5,18,11.5,14.5,17.5,20.5,23.5,26.5],widthElements:[10.5,14.5,12.5]},EVENT_LINK:{d:"m {mx},{my} 0,{e.y0} -{e.x1},0 0,{e.y1} {e.x1},0 0,{e.y0} {e.x0},-{e.y2} -{e.x0},-{e.y2} z",height:36,width:36,heightElements:[4.4375,6.75,7.8125],widthElements:[9.84375,13.5]},EVENT_ERROR:{d:"m {mx},{my} {e.x0},-{e.y0} {e.x1},-{e.y1} {e.x2},{e.y2} {e.x3},-{e.y3} -{e.x4},{e.y4} -{e.x5},-{e.y5} z",height:36,width:36,heightElements:[.023,8.737,8.151,16.564,10.591,8.714],widthElements:[.085,6.672,6.97,4.273,5.337,6.636]},EVENT_CANCEL_45:{d:"m {mx},{my} -{e.x1},0 0,{e.x0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:36,width:36,heightElements:[4.75,8.5],widthElements:[4.75,8.5]},EVENT_COMPENSATION:{d:"m {mx},{my} {e.x0},-{e.y0} 0,{e.y1} z m {e.x1},-{e.y2} {e.x2},-{e.y3} 0,{e.y1} -{e.x2},-{e.y3} z",height:36,width:36,heightElements:[6.5,13,.4,6.1],widthElements:[9,9.3,8.7]},EVENT_TIMER_WH:{d:"M {mx},{my} l {e.x0},-{e.y0} m -{e.x0},{e.y0} l {e.x1},{e.y1} ",height:36,width:36,heightElements:[10,2],widthElements:[3,7]},EVENT_TIMER_LINE:{d:"M {mx},{my} m {e.x0},{e.y0} l -{e.x1},{e.y1} ",height:36,width:36,heightElements:[10,3],widthElements:[0,0]},EVENT_MULTIPLE:{d:"m {mx},{my} {e.x1},-{e.y0} {e.x1},{e.y0} -{e.x0},{e.y1} -{e.x2},0 z",height:36,width:36,heightElements:[6.28099,12.56199],widthElements:[3.1405,9.42149,12.56198]},EVENT_PARALLEL_MULTIPLE:{d:"m {mx},{my} {e.x0},0 0,{e.y1} {e.x1},0 0,{e.y0} -{e.x1},0 0,{e.y1} -{e.x0},0 0,-{e.y1} -{e.x1},0 0,-{e.y0} {e.x1},0 z",height:36,width:36,heightElements:[2.56228,7.68683],widthElements:[2.56228,7.68683]},GATEWAY_EXCLUSIVE:{d:"m {mx},{my} {e.x0},{e.y0} {e.x1},{e.y0} {e.x2},0 {e.x4},{e.y2} {e.x4},{e.y1} {e.x2},0 {e.x1},{e.y3} {e.x0},{e.y3} {e.x3},0 {e.x5},{e.y1} {e.x5},{e.y2} {e.x3},0 z",height:17.5,width:17.5,heightElements:[8.5,6.5312,-6.5312,-8.5],widthElements:[6.5,-6.5,3,-3,5,-5]},GATEWAY_PARALLEL:{d:"m {mx},{my} 0,{e.y1} -{e.x1},0 0,{e.y0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:30,width:30,heightElements:[5,12.5],widthElements:[5,12.5]},GATEWAY_EVENT_BASED:{d:"m {mx},{my} {e.x0},{e.y0} {e.x0},{e.y1} {e.x1},{e.y2} {e.x2},0 z",height:11,width:11,heightElements:[-6,6,12,-12],widthElements:[9,-3,-12]},GATEWAY_COMPLEX:{d:"m {mx},{my} 0,{e.y0} -{e.x0},-{e.y1} -{e.x1},{e.y2} {e.x0},{e.y1} -{e.x2},0 0,{e.y3} {e.x2},0 -{e.x0},{e.y1} l {e.x1},{e.y2} {e.x0},-{e.y1} 0,{e.y0} {e.x3},0 0,-{e.y0} {e.x0},{e.y1} {e.x1},-{e.y2} -{e.x0},-{e.y1} {e.x2},0 0,-{e.y3} -{e.x2},0 {e.x0},-{e.y1} -{e.x1},-{e.y2} -{e.x0},{e.y1} 0,-{e.y0} -{e.x3},0 z",height:17.125,width:17.125,heightElements:[4.875,3.4375,2.125,3],widthElements:[3.4375,2.125,4.875,3]},DATA_OBJECT_PATH:{d:"m 0,0 {e.x1},0 {e.x0},{e.y0} 0,{e.y1} -{e.x2},0 0,-{e.y2} {e.x1},0 0,{e.y0} {e.x0},0",height:61,width:51,heightElements:[10,50,60],widthElements:[10,40,50,60]},DATA_OBJECT_COLLECTION_PATH:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},DATA_ARROW:{d:"m 5,9 9,0 0,-3 5,5 -5,5 0,-3 -9,0 z",height:61,width:51,heightElements:[],widthElements:[]},DATA_STORE:{d:"m {mx},{my} l 0,{e.y2} c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 l 0,-{e.y2} c -{e.x0},-{e.y1} -{e.x1},-{e.y1} -{e.x2},0c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0",height:61,width:61,heightElements:[7,10,45],widthElements:[2,58,60]},TEXT_ANNOTATION:{d:"m {mx}, {my} m 10,0 l -10,0 l 0,{e.y0} l 10,0",height:30,width:10,heightElements:[30],widthElements:[10]},MARKER_SUB_PROCESS:{d:"m{mx},{my} m 7,2 l 0,10 m -5,-5 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_PARALLEL:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},MARKER_SEQUENTIAL:{d:"m{mx},{my} m 0,3 l 10,0 m -10,3 l 10,0 m -10,3 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_COMPENSATION:{d:"m {mx},{my} 7,-5 0,10 z m 7.1,-0.3 6.9,-4.7 0,10 -6.9,-4.7 z",height:10,width:21,heightElements:[],widthElements:[]},MARKER_LOOP:{d:"m {mx},{my} c 3.526979,0 6.386161,-2.829858 6.386161,-6.320661 0,-3.490806 -2.859182,-6.320661 -6.386161,-6.320661 -3.526978,0 -6.38616,2.829855 -6.38616,6.320661 0,1.745402 0.714797,3.325567 1.870463,4.469381 0.577834,0.571908 1.265885,1.034728 2.029916,1.35457 l -0.718163,-3.909793 m 0.718163,3.909793 -3.885211,0.802902",height:13.9,width:13.7,heightElements:[],widthElements:[]},MARKER_ADHOC:{d:"m {mx},{my} m 0.84461,2.64411 c 1.05533,-1.23780996 2.64337,-2.07882 4.29653,-1.97997996 2.05163,0.0805 3.85579,1.15803 5.76082,1.79107 1.06385,0.34139996 2.24454,0.1438 3.18759,-0.43767 0.61743,-0.33642 1.2775,-0.64078 1.7542,-1.17511 0,0.56023 0,1.12046 0,1.6807 -0.98706,0.96237996 -2.29792,1.62393996 -3.6918,1.66181996 -1.24459,0.0927 -2.46671,-0.2491 -3.59505,-0.74812 -1.35789,-0.55965 -2.75133,-1.33436996 -4.27027,-1.18121996 -1.37741,0.14601 -2.41842,1.13685996 -3.44288,1.96782996 z",height:4,width:15,heightElements:[],widthElements:[]},TASK_TYPE_SEND:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:14,width:21,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_SCRIPT:{d:"m {mx},{my} c 9.966553,-6.27276 -8.000926,-7.91932 2.968968,-14.938 l -8.802728,0 c -10.969894,7.01868 6.997585,8.66524 -2.968967,14.938 z m -7,-12 l 5,0 m -4.5,3 l 4.5,0 m -3,3 l 5,0m -4,3 l 5,0",height:15,width:12.6,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_USER_1:{d:"m {mx},{my} c 0.909,-0.845 1.594,-2.049 1.594,-3.385 0,-2.554 -1.805,-4.62199999 -4.357,-4.62199999 -2.55199998,0 -4.28799998,2.06799999 -4.28799998,4.62199999 0,1.348 0.974,2.562 1.89599998,3.405 -0.52899998,0.187 -5.669,2.097 -5.794,4.7560005 v 6.718 h 17 v -6.718 c 0,-2.2980005 -5.5279996,-4.5950005 -6.0509996,-4.7760005 zm -8,6 l 0,5.5 m 11,0 l 0,-5"},TASK_TYPE_USER_2:{d:"m {mx},{my} m 2.162,1.009 c 0,2.4470005 -2.158,4.4310005 -4.821,4.4310005 -2.66499998,0 -4.822,-1.981 -4.822,-4.4310005 "},TASK_TYPE_USER_3:{d:"m {mx},{my} m -6.9,-3.80 c 0,0 2.25099998,-2.358 4.27399998,-1.177 2.024,1.181 4.221,1.537 4.124,0.965 -0.098,-0.57 -0.117,-3.79099999 -4.191,-4.13599999 -3.57499998,0.001 -4.20799998,3.36699999 -4.20699998,4.34799999 z"},TASK_TYPE_MANUAL:{d:"m {mx},{my} c 0.234,-0.01 5.604,0.008 8.029,0.004 0.808,0 1.271,-0.172 1.417,-0.752 0.227,-0.898 -0.334,-1.314 -1.338,-1.316 -2.467,-0.01 -7.886,-0.004 -8.108,-0.004 -0.014,-0.079 0.016,-0.533 0,-0.61 0.195,-0.042 8.507,0.006 9.616,0.002 0.877,-0.007 1.35,-0.438 1.353,-1.208 0.003,-0.768 -0.479,-1.09 -1.35,-1.091 -2.968,-0.002 -9.619,-0.013 -9.619,-0.013 v -0.591 c 0,0 5.052,-0.016 7.225,-0.016 0.888,-0.002 1.354,-0.416 1.351,-1.193 -0.006,-0.761 -0.492,-1.196 -1.361,-1.196 -3.473,-0.005 -10.86,-0.003 -11.0829995,-0.003 -0.022,-0.047 -0.045,-0.094 -0.069,-0.139 0.3939995,-0.319 2.0409995,-1.626 2.4149995,-2.017 0.469,-0.4870005 0.519,-1.1650005 0.162,-1.6040005 -0.414,-0.511 -0.973,-0.5 -1.48,-0.236 -1.4609995,0.764 -6.5999995,3.6430005 -7.7329995,4.2710005 -0.9,0.499 -1.516,1.253 -1.882,2.19 -0.37000002,0.95 -0.17,2.01 -0.166,2.979 0.004,0.718 -0.27300002,1.345 -0.055,2.063 0.629,2.087 2.425,3.312 4.859,3.318 4.6179995,0.014 9.2379995,-0.139 13.8569995,-0.158 0.755,-0.004 1.171,-0.301 1.182,-1.033 0.012,-0.754 -0.423,-0.969 -1.183,-0.973 -1.778,-0.01 -5.824,-0.004 -6.04,-0.004 10e-4,-0.084 0.003,-0.586 10e-4,-0.67 z"},TASK_TYPE_INSTANTIATING_SEND:{d:"m {mx},{my} l 0,8.4 l 12.6,0 l 0,-8.4 z l 6.3,3.6 l 6.3,-3.6"},TASK_TYPE_SERVICE:{d:"m {mx},{my} v -1.71335 c 0.352326,-0.0705 0.703932,-0.17838 1.047628,-0.32133 0.344416,-0.14465 0.665822,-0.32133 0.966377,-0.52145 l 1.19431,1.18005 1.567487,-1.57688 -1.195028,-1.18014 c 0.403376,-0.61394 0.683079,-1.29908 0.825447,-2.01824 l 1.622133,-0.01 v -2.2196 l -1.636514,0.01 c -0.07333,-0.35153 -0.178319,-0.70024 -0.323564,-1.04372 -0.145244,-0.34406 -0.321407,-0.6644 -0.522735,-0.96217 l 1.131035,-1.13631 -1.583305,-1.56293 -1.129598,1.13589 c -0.614052,-0.40108 -1.302883,-0.68093 -2.022633,-0.82247 l 0.0093,-1.61852 h -2.241173 l 0.0042,1.63124 c -0.353763,0.0736 -0.705369,0.17977 -1.049785,0.32371 -0.344415,0.14437 -0.665102,0.32092 -0.9635006,0.52046 l -1.1698628,-1.15823 -1.5667691,1.5792 1.1684265,1.15669 c -0.4026573,0.61283 -0.68308,1.29797 -0.8247287,2.01713 l -1.6588041,0.003 v 2.22174 l 1.6724648,-0.006 c 0.073327,0.35077 0.1797598,0.70243 0.3242851,1.04472 0.1452428,0.34448 0.3214064,0.6644 0.5227339,0.96066 l -1.1993431,1.19723 1.5840256,1.56011 1.1964668,-1.19348 c 0.6140517,0.40346 1.3028827,0.68232 2.0233517,0.82331 l 7.19e-4,1.69892 h 2.226848 z m 0.221462,-3.9957 c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_SERVICE_FILL:{d:"m {mx},{my} c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_BUSINESS_RULE_HEADER:{d:"m {mx},{my} 0,4 20,0 0,-4 z"},TASK_TYPE_BUSINESS_RULE_MAIN:{d:"m {mx},{my} 0,12 20,0 0,-12 zm 0,8 l 20,0 m -13,-4 l 0,8"},MESSAGE_FLOW_MARKER:{d:"m {mx},{my} m -10.5 ,-7 l 0,14 l 21,0 l 0,-14 z l 10.5,6 l 10.5,-6"}},this.getRawPath=function(t){return this.pathMap[t].d},this.getScaledPath=function(t,n){var i=this.pathMap[t],r,o;n.abspos?(r=n.abspos.x,o=n.abspos.y):(r=n.containerWidth*n.position.mx,o=n.containerHeight*n.position.my);var a={};if(n.position){for(var s=n.containerHeight/i.height*n.yScaleFactor,c=n.containerWidth/i.width*n.xScaleFactor,l=0;l<i.heightElements.length;l++)a["y"+l]=i.heightElements[l]*s;for(var u=0;u<i.widthElements.length;u++)a["x"+u]=i.widthElements[u]*c}var p=QM(i.d,{mx:r,my:o,e:a});return p}}var KM=/\{([^{}]+)\}/g,XM=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function ZM(e,t,n){var i=n;return t.replace(XM,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 QM(e,t){return String(e).replace(KM,function(n,i){return ZM(n,i,t)})}const JM={__init__:["bpmnRenderer"],bpmnRenderer:["type",fo],textRenderer:["type",Hy],pathMap:["type",YM]};function eP(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const ts={translate:["value",eP]};function Yc(e,t,n){return W({id:e.id,type:e.$type,businessObject:e,di:t},n)}function tP(e,t,n){var i=e.waypoint;return!i||i.length<2?[Fe(t),Fe(n)]:i.map(function(r){return{x:r.x,y:r.y}})}function zy(e,t,n){return new Error(`element ${Dn(t)} referenced by ${Dn(e)}#${n} not yet drawn`)}function rr(e,t,n,i,r){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=r}rr.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],rr.prototype.add=function(e,t,n){var i,r,o;if(C(t,"bpmndi:BPMNPlane")){var a=C(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(Yc(e,t,a)),this._canvas.addRootElement(i)}else if(C(t,"bpmndi:BPMNShape")){var s=!at(e,t),c=iP(e);r=n&&(n.hidden||n.collapsed);var l=t.bounds;i=this._elementFactory.createShape(Yc(e,t,{collapsed:s,hidden:r,x:Math.round(l.x),y:Math.round(l.y),width:Math.round(l.width),height:Math.round(l.height),isFrame:c})),C(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),C(e,"bpmn:Lane")&&(o=0),C(e,"bpmn:DataStoreReference")&&(nP(n,Fe(l))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,o)}else if(C(t,"bpmndi:BPMNEdge")){var u=this._getSource(e),p=this._getTarget(e);r=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(Yc(e,t,{hidden:r,source:u,target:p,waypoints:tP(t,u,p)})),C(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,o)}else throw new Error(`unknown di ${Dn(t)} for element ${Dn(e)}`);return Tr(e)&&li(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},rr.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${Dn(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),r=i&&i.attachers;if(!i)throw zy(e,n,"attachedToRef");t.host=i,r||(i.attachers=r=[]),r.indexOf(t)===-1&&r.push(t)},rr.prototype.addLabel=function(e,t,n){var i,r,o;return i=vM(t,n),r=li(n),r&&(i=this._textRenderer.getExternalLabelBounds(i,r)),o=this._elementFactory.createLabel(Yc(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!li(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)},rr.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?zy(e,i,t+"Ref"):new Error(`${Dn(e)}#${t} Ref not specified`)},rr.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},rr.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},rr.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function nP(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 iP(e){return C(e,"bpmn:Group")}const Gy={__depends__:[JM,{__depends__:[ts],bpmnImporter:["type",rr]}]};function ns(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Ti(e,t){return{x:e.x-t.x,y:e.y-t.y}}function lf(e){return Math.log(e)/Math.log(10)}var rP=1e3;function ce(e){this._eventBus=e}ce.$inject=["eventBus"];function oP(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}ce.prototype.on=function(e,t,n,i,r,o){if((hn(t)||ze(t))&&(o=r,r=i,i=n,n=t,t=null),hn(n)&&(o=r,r=i,i=n,n=rP),dn(r)&&(o=r,r=!1),!hn(i))throw new Error("handlerFn must be a function");$e(e)||(e=[e]);var a=this._eventBus;H(e,function(s){var c=["commandStack",s,t].filter(function(l){return l}).join(".");a.on(c,n,r?oP(i,o):i,o)})},ce.prototype.canExecute=or("canExecute"),ce.prototype.preExecute=or("preExecute"),ce.prototype.preExecuted=or("preExecuted"),ce.prototype.execute=or("execute"),ce.prototype.executed=or("executed"),ce.prototype.postExecute=or("postExecute"),ce.prototype.postExecuted=or("postExecuted"),ce.prototype.revert=or("revert"),ce.prototype.reverted=or("reverted");function or(e){return function(n,i,r,o,a){(hn(n)||ze(n))&&(a=o,o=r,r=i,i=n,n=null),this.on(n,e,i,r,o,a)}}var uf=["top","bottom","left","right"],Kc=10;function pf(e,t){ce.call(this,e),this.postExecuted(["connection.create","connection.layout","connection.updateWaypoints"],function(r){var o=r.context,a=o.connection,s=a.source,c=a.target,l=o.hints||{};l.createElementsBehavior!==!1&&(n(s),n(c))}),this.postExecuted(["label.create"],function(r){var o=r.context,a=o.shape,s=o.hints||{};s.createElementsBehavior!==!1&&n(a.labelTarget)}),this.postExecuted(["elements.create"],function(r){var o=r.context,a=o.elements,s=o.hints||{};s.createElementsBehavior!==!1&&a.forEach(function(c){n(c)})});function n(r){if(Vc(r)&&!Ct(r)){var o=cP(r);o&&i(r,o)}}function i(r,o){var a=Fe(r),s=r.label,c=Fe(s);if(s.parent){var l=Ie(r),u;switch(o){case"top":u={x:a.x,y:l.top-Kc-s.height/2};break;case"left":u={x:l.left-Kc-s.width/2,y:a.y};break;case"bottom":u={x:a.x,y:l.bottom+Kc+s.height/2};break;case"right":u={x:l.right+Kc+s.width/2,y:a.y};break}var p=Ti(u,c);t.moveShape(s,p)}}}we(pf,ce),pf.$inject=["eventBus","modeling"];function aP(e){var t=e.host,n=Fe(e),i=Rn(n,t),r;i.indexOf("-")>=0?r=i.split("-"):r=[i];var o=uf.filter(function(a){return r.indexOf(a)===-1});return o}function sP(e){var t=Fe(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 Vy(t,i)});return n}function cP(e){var t=Fe(e.label),n=Fe(e),i=Vy(n,t);if(lP(i)){var r=sP(e);if(e.host){var o=aP(e);r=r.concat(o)}var a=uf.filter(function(s){return r.indexOf(s)===-1});return a.indexOf(i)!==-1?Rn(e.label,e)!=="intersect"?void 0:i:a[0]}}function Vy(e,t){return Rn(t,e,5)}function lP(e){return uf.indexOf(e)!==-1}function ff(e){ce.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,i=t.shape;t.position||(C(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)}we(ff,ce),ff.$inject=["eventBus"];var uP=1500;function df(e,t,n){e.invoke(ce,this),this.preExecute("elements.delete",uP,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=tt(r,l=>C(l,"bpmn:Participant")||C(l,"bpmn:SubProcess"));if(!o.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(l=>C(l,"bpmn:Artifact"))),c=new Set;return H(o,l=>{const u=new Set(Do(Xo(Array.from(s),Jt(l))));c=c.union(u),s=s.difference(u)}),Array.from(c)}}we(df,ce),df.$inject=["injector","eventBus","canvas"];function hf(e,t){e.invoke(ce,this),this.postExecute("shape.move",function(n){var i=n.newParent,r=n.shape,o=tt(r.incoming.concat(r.outgoing),function(a){return C(a,"bpmn:Association")});H(o,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}we(hf,ce),hf.$inject=["injector","modeling"];function ia(e,t){for(Vn(t)&&(t=[t]);e=e.parent;)if(et(e,t))return e;return null}function Wy(e,t){var n=ia(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=ia(e,i),n)return gn(n);if(et(e,i))return gn(e);var r;for(r=ue(e);r&&!C(r,"bpmn:Process");r=r.$parent);if(!t)return!0;var o=t.find(function(a){var s=ue(a);return s&&s.get("processRef")===r});return o?gn(o):!0}var Uy=500;function Xc(e,t){t.invoke(ce,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Uy,function(i){var r=i.elements;r=r.filter(function(o){var a=o.host;return qy(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",Uy,function(i){var r=i.shapes,o=i.newHost;if(r.length===1){var a=r[0];qy(a,o)&&(i.shapes=[n._replaceShape(a,o)])}},!0)}Xc.$inject=["bpmnReplace","injector"],we(Xc,ce),Xc.prototype._replaceShape=function(e,t){var n=pP(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function pP(e){var t=ue(e),n=t.eventDefinitions;return n&&n[0]}function qy(e,t){return!Je(e)&&et(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function mf(e,t){ce.call(this,e);function n(i){return tt(i.attachers,function(r){return C(r,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var r=i.context.source,o=i.context.target,a=n(o);C(r,"bpmn:EventBasedGateway")&&C(o,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var r=i.context.oldSource,o=i.context.newSource;C(r,"bpmn:Gateway")&&C(o,"bpmn:EventBasedGateway")&&H(o.outgoing,function(a){var s=a.target,c=n(s);C(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}mf.$inject=["eventBus","modeling"],we(mf,ce);function Yy(e){return e.create("bpmn:Category")}function fP(e){return e.create("bpmn:CategoryValue")}function Ky(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=fP(e)),n.$parent||(n.$parent=Yy(e)),n}function dP(e,t,n){return qt(t.get("categoryValue"),e),e.$parent=t,qt(n.get("rootElements"),t),t.$parent=n,e}function hP(e){var t=e.$parent;return t&&(Wt(t.get("categoryValue"),e),e.$parent=null),e}function mP(e){var t=e.$parent;return t&&(Wt(t.get("rootElements"),e),e.$parent=null),e}var gP=500;function gf(e,t,n){n.invoke(ce,this);function i(c){return t.filter(function(l){return C(l,"bpmn:Group")&&!l.labelTarget}).map(ue).filter(function(l){return l!==c})}function r(c,l){return i(l).some(function(u){return u.get("categoryValueRef")===c})}function o(c,l){return i(l).some(function(u){var p=u.get("categoryValueRef");return p&&p.$parent===c})}function a(c,l){c&&l&&dP(c,l,e.getDefinitions())}function s(c,l,u){l&&!o(l,u)&&mP(l),c&&!r(c,u)&&hP(c)}this.executed(["shape.create","label.create"],function(c){var l=c.labelTarget||c.shape;!C(l,"bpmn:Group")||l.labelTarget||a(c.categoryValue,c.category)},!0),this.reverted(["shape.create","label.create"],function(c){var l=c.labelTarget||c.shape;!C(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,ue(l))},!0),this.executed(["shape.move","shape.resize"],gP,function(c){a(c.categoryValue,c.category)},!0),this.reverted(["shape.move","shape.resize"],function(c){var l=c.shape;c.categoryValue&&s(c.categoryValue,c.category,ue(l))},!0),this.executed("group.updateRefs",function(c){Xy(c).forEach(function(l){a(l.categoryValue,l.category)})},!0),this.reverted("group.updateRefs",function(c){Xy(c).forEach(function(l){s(l.categoryValue,l.category,ue(l.groupShape))})},!0),this.executed("shape.delete",function(c){var l=c.shape;!C(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,ue(l))},!0),this.reverted("shape.delete",function(c){var l=c.shape;!C(l,"bpmn:Group")||l.labelTarget||a(c.categoryValue,c.category)},!0)}gf.$inject=["bpmnjs","elementRegistry","injector"],we(gf,ce);function Xy(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function yf(e,t,n){ce.call(this,e),this.preExecute("shape.replace",s,!0),this.postExecuted("shape.replace",c,!0),this.preExecute("connection.create",r,!0),this.postExecuted("connection.delete",i,!0),this.postExecuted("connection.reconnect",o,!0),this.postExecuted("element.updateProperties",a,!0);function i(y){const R=y.source,x=y.target;ra(R)&&is(x)&&u(x)}function r(y){const R=y.connection,x=y.source,m=y.target;ra(x)&&Zc(m)&&(l(m),f(x,[R]))}function o(y){const R=y.newTarget,x=y.oldSource,m=y.oldTarget;if(m!==R){const v=x;is(m)&&u(m),ra(v)&&Zc(R)&&l(R)}}function a(y){const{element:R}=y;is(R)?(p(R),d(R)):Zc(R)&&g(R)}function s(y){const{newData:R,oldShape:x}=y;if(ra(y.oldShape)&&R.eventDefinitionType!=="bpmn:CompensateEventDefinition"||R.type!=="bpmn:BoundaryEvent"){const m=x.outgoing.find(({target:v})=>is(v));m&&m.target&&(y._connectionTarget=m.target)}else if(!ra(y.oldShape)&&R.eventDefinitionType==="bpmn:CompensateEventDefinition"&&R.type==="bpmn:BoundaryEvent"){const m=x.outgoing.find(({target:v})=>Zc(v));m&&m.target&&(y._connectionTarget=m.target),h(x)}}function c(y){const{_connectionTarget:R,newShape:x}=y;R&&t.connect(x,R)}function l(y){t.updateProperties(y,{isForCompensation:!0})}function u(y){t.updateProperties(y,{isForCompensation:void 0})}function p(y){for(const R of y.incoming)n.canConnect(R.source,y)||t.removeConnection(R);for(const R of y.outgoing)n.canConnect(y,R.target)||t.removeConnection(R)}function f(y,R){y.outgoing.filter(v=>C(v,"bpmn:Association")).filter(v=>is(v.target)&&!R.includes(v)).forEach(v=>t.removeConnection(v))}function d(y){const R=y.attachers.slice();R.length&&t.removeElements(R)}function g(y){const R=y.incoming.filter(x=>ra(x.source));t.removeElements(R)}function h(y){const R=y.outgoing.filter(x=>C(x,"bpmn:SequenceFlow"));t.removeElements(R)}}we(yf,ce),yf.$inject=["eventBus","modeling","bpmnRules"];function is(e){const t=ue(e);return t&&t.get("isForCompensation")}function ra(e){return e&&C(e,"bpmn:BoundaryEvent")&&ea(e,"bpmn:CompensateEventDefinition")}function Zc(e){return e&&C(e,"bpmn:Activity")&&!Ln(e)}function vf(e){e.invoke(ce,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,r=n.shape;C(i,"bpmn:Lane")&&!C(r,"bpmn:Lane")&&(n.parent=ia(i,"bpmn:Participant"))})}vf.$inject=["injector"],we(vf,ce);function bf(e,t){ce.call(this,e),this.preExecute("shape.create",function(n){var a;var i=n.context,r=i.shape;if(C(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}})}bf.$inject=["eventBus","bpmnFactory"],we(bf,ce);var xf=20,_f=20,Zy=30,Qc=2e3;function wf(e,t,n){ce.call(this,t),t.on(["create.start","shape.move.start"],Qc,function(r){var o=r.context,a=o.shape,s=e.getRootElement();if(!(!C(a,"bpmn:Participant")||!C(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(p){return!C(p,"bpmn:Group")&&!Je(p)&&!Ct(p)});if(c.length){var l=Jt(c),u=yP(a,l);W(a,u),o.createConstraints=vP(a,l)}}}),t.on("create.start",Qc,function(r){var o=r.context,a=o.shape,s=e.getRootElement(),c=e.getGraphics(s);function l(u){u.element=s,u.gfx=c}C(a,"bpmn:Participant")&&C(s,"bpmn:Process")&&(t.on("element.hover",Qc,l),t.once("create.cleanup",function(){t.off("element.hover",l)}))});function i(){var r=e.getRootElement();return C(r,"bpmn:Collaboration")?r:n.makeCollaboration()}this.preExecute("elements.create",Qc,function(r){var o=r.elements,a=r.parent,s=bP(o),c;s&&C(a,"bpmn:Process")&&(r.parent=i(),c=r.hints=r.hints||{},c.participant=s,c.process=a,c.processRef=ue(s).get("processRef"))},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;C(a,"bpmn:Participant")&&C(o,"bpmn:Process")&&(r.parent=i(),r.process=o,r.processRef=ue(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)&&ue(s).set("processRef",ue(a))},!0),this.revert("shape.create",function(r){var o=r.hints||{},a=r.process||o.process,s=r.processRef||o.processRef,c=r.shape,l=o.participant;a&&(!l||c===l)&&ue(c).set("processRef",s)},!0),this.postExecute("shape.create",function(r){var o=r.hints||{},a=r.process||r.hints.process,s=r.shape,c=o.participant;if(a){var l=a.children.slice();c?s===c&&n.moveElements(l,{x:0,y:0},c):n.moveElements(l,{x:0,y:0},s)}},!0)}wf.$inject=["canvas","eventBus","modeling"],we(wf,ce);function yP(e,t){t={width:t.width+xf*2+Zy,height:t.height+_f*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 vP(e,t){return t=Ie(t),{bottom:t.top+e.height/2-_f,left:t.right-e.width/2+xf,top:t.bottom-e.height/2+_f,right:t.left+e.width/2-xf-Zy}}function bP(e){return Tt(e,function(t){return C(t,"bpmn:Participant")})}var Qy="__targetRef_placeholder";function Ef(e,t){ce.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],Jy(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],Jy(o));function n(a,s,c){var l=a.get("dataInputAssociations");return Tt(l,function(u){return u!==c&&u.targetRef===s})}function i(a,s){var c=a.get("properties"),l=Tt(c,function(u){return u.name===Qy});return!l&&s&&(l=t.create("bpmn:Property",{name:Qy}),qt(c,l)),l}function r(a,s){var c=i(a);c&&(n(a,c,s)||Wt(a.get("properties"),c))}function o(a){var s=a.context,c=s.connection,l=c.businessObject,u=c.target,p=u&&u.businessObject,f=s.newTarget,d=f&&f.businessObject,g=s.oldTarget||s.target,h=g&&g.businessObject,y=c.businessObject,R;h&&h!==p&&r(h,l),d&&d!==p&&r(d,l),p?(R=i(p,!0),y.targetRef=R):y.targetRef=null}}Ef.$inject=["eventBus","bpmnFactory"],we(Ef,ce);function Jy(e){return function(t){var n=t.context,i=n.connection;if(C(i,"bpmn:DataInputAssociation"))return e(t)}}function Jc(e){this._bpmnUpdater=e}Jc.$inject=["bpmnUpdater"],Jc.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),[]},Jc.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 Sf(e,t,n,i){ce.call(this,i),t.registerHandler("dataStore.updateContainment",Jc);function r(){return n.filter(function(s){return C(s,"bpmn:Participant")&&ue(s).processRef})[0]}function o(s){return s.children.filter(function(c){return C(c,"bpmn:DataStoreReference")&&!c.labelTarget})}function a(s,c){var l=s.businessObject||s;if(c=c||r(),c){var u=c.businessObject||c;t.execute("dataStore.updateContainment",{dataStoreBo:l,dataStoreDi:pt(s),newSemanticParent:u.processRef||u,newDiParent:pt(c)})}}this.preExecute("shape.create",function(s){var c=s.context,l=c.shape;C(l,"bpmn:DataStoreReference")&&l.type!=="label"&&(c.hints||(c.hints={}),c.hints.autoResize=!1)}),this.preExecute("elements.move",function(s){var c=s.context,l=c.shapes,u=l.filter(function(p){return C(p,"bpmn:DataStoreReference")});u.length&&(c.hints||(c.hints={}),c.hints.autoResize=l.filter(function(p){return!C(p,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,l=c.shape,u=l.parent;C(l,"bpmn:DataStoreReference")&&l.type!=="label"&&C(u,"bpmn:Collaboration")&&a(l)}),this.postExecute("shape.move",function(s){var c=s.context,l=c.shape,u=c.oldParent,p=l.parent;if(!C(u,"bpmn:Collaboration")&&C(l,"bpmn:DataStoreReference")&&l.type!=="label"&&C(p,"bpmn:Collaboration")){var f=C(u,"bpmn:Participant")?u:_P(u,"bpmn:Participant");a(l,f)}}),this.postExecute("shape.delete",function(s){var c=s.context,l=c.shape,u=e.getRootElement();et(l,["bpmn:Participant","bpmn:SubProcess"])&&C(u,"bpmn:Collaboration")&&o(u).filter(function(p){return xP(p,l)}).forEach(function(p){a(p)})}),this.postExecute("canvas.updateRoot",function(s){var c=s.context,l=c.oldRoot,u=c.newRoot,p=o(l);p.forEach(function(f){C(u,"bpmn:Process")&&a(f,u)})})}Sf.$inject=["canvas","commandStack","elementRegistry","eventBus"],we(Sf,ce);function xP(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 _P(e,t){for(;e.parent;){if(C(e.parent,t))return e.parent;e=e.parent}}var el=Math.max,tl=Math.min,wP=20;function ev(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function EP(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 SP(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 nl(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return ze(r)&&(i=(/top|left/.test(e)?tl:el)(i,r)),ze(o)&&(i=(/top|left/.test(e)?el:tl)(i,o)),i}function RP(e,t){if(!t)return e;var n=Ie(e);return $c({top:nl("top",n,t),right:nl("right",n,t),bottom:nl("bottom",n,t),left:nl("left",n,t)})}function CP(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:tl(o.top,a.top),left:tl(o.left,a.left),bottom:el(o.bottom,a.bottom),right:el(o.right,a.right)};return $c(s)}function rs(e,t){return typeof e<"u"?e:wP}function AP(e,t){var n,i,r,o;return typeof t=="object"?(n=rs(t.left),i=rs(t.right),r=rs(t.top),o=rs(t.bottom)):n=i=r=o=rs(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function MP(e){return!(e.waypoints||e.type==="label")}function tv(e,t){var n;if(e.length===void 0?n=tt(e.children,MP):n=e,n.length)return AP(Jt(n),t)}var kr=Math.abs;function PP(e,t){return ev(Ie(t),Ie(e))}var TP=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],mi=30;function il(e,t){return t=t||[],e.children.filter(function(n){C(n,"bpmn:Lane")&&(il(n,t),t.push(n))}),t}function Or(e){return e.children.filter(function(t){return C(t,"bpmn:Lane")})}function gi(e){return ia(e,TP)||e}function kP(e,t){var n=gi(e),i=C(n,"bpmn:Process")?[]:[n],r=il(n,i),o=Ie(e),a=Ie(t),s=PP(e,t),c=[],l=gn(e);return r.forEach(function(u){if(u!==e){var p=l?0:s.top,f=l?s.right:0,d=l?0:s.bottom,g=l?s.left:0,h=Ie(u);s.top&&(kr(h.bottom-o.top)<10&&(d=a.top-h.bottom),kr(h.top-o.top)<5&&(p=a.top-h.top)),s.left&&(kr(h.right-o.left)<10&&(f=a.left-h.right),kr(h.left-o.left)<5&&(g=a.left-h.left)),s.bottom&&(kr(h.top-o.bottom)<10&&(p=a.bottom-h.top),kr(h.bottom-o.bottom)<5&&(d=a.bottom-h.bottom)),s.right&&(kr(h.left-o.right)<10&&(g=a.right-h.left),kr(h.right-o.right)<5&&(f=a.right-h.right)),(p||f||d||g)&&c.push({shape:u,newBounds:SP(u,{top:p,right:f,bottom:d,left:g})})}}),c}var OP=500;function Rf(e,t){ce.call(this,e);function n(i,r){var o=gn(i),a=Or(r),s=[],c=[],l=[],u=[];if(lo(a,function(y){return o?y.y>i.y?c.push(y):s.push(y):y.x>i.x?u.push(y):l.push(y),y.children}),!!a.length){var p;o?c.length&&s.length?p=i.height/2:p=i.height:u.length&&l.length?p=i.width/2:p=i.width;var f,d,g,h;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")),l.length&&(g=t.calculateAdjustments(l,"x",p,i.x-10),t.makeSpace(g.movingShapes,g.resizingShapes,{x:p,y:0},"e")),u.length&&(h=t.calculateAdjustments(u,"x",-p,i.x+i.width+10),t.makeSpace(h.movingShapes,h.resizingShapes,{x:-p,y:0},"w"))}}this.postExecuted("shape.delete",OP,function(i){var r=i.context,o=r.hints,a=r.shape,s=r.oldParent;C(a,"bpmn:Lane")&&(o&&o.nested||n(a,s))})}Rf.$inject=["eventBus","spaceTool"],we(Rf,ce);var nv=500;function rl(e,t){t.invoke(ce,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",nv,function(i){var r=i.elements;r.filter(function(o){var a=o.host;return iv(o,a)}).map(function(o){return r.indexOf(o)}).forEach(function(o){i.elements[o]=n._replaceShape(r[o])})},!0),this.preExecute("elements.move",nv,function(i){var r=i.shapes,o=i.newHost;r.forEach(function(a,s){var c=a.host;iv(a,LP(r,c)?c:o)&&(r[s]=n._replaceShape(a))})},!0)}rl.$inject=["bpmnReplace","injector"],we(rl,ce),rl.prototype._replaceShape=function(e){var t=DP(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function DP(e){var t=ue(e),n=t.eventDefinitions;return n&&n[0]}function iv(e,t){return!Je(e)&&C(e,"bpmn:BoundaryEvent")&&!t}function LP(e,t){return e.indexOf(t)!==-1}var ol=Math.round,IP=Math.max;function BP(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 NP(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var rv=10;function $P(e,t){var n,i;for(n=0;i=e[n];n++)if(Ya(i,t)<=rv)return{point:e[n],bendpoint:!0,index:n};return null}function FP(e,t){var n=ly(BP(t,rv),NP(e)),i=n[0],r=n[n.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=IP(i.segment2,r.segment2)-1,{point:e[o],bendpoint:!0,index:o}):{point:{x:ol(i.x+r.x)/2,y:ol(i.y+r.y)/2},index:i.segment2}:{point:{x:ol(i.x),y:ol(i.y)},index:i.segment2}:null}function Cf(e,t){return $P(e,t)||FP(e,t)}function Af(e,t,n){ce.call(this,e);function i(r,o,a){var s=o.waypoints,c,l,u,p,f,d,g,h=r.outgoing.slice(),y=r.incoming.slice(),R;ze(a.width)?R=Fe(a):R=a;var x=Cf(s,R);if(x){if(c=s.slice(0,x.index),l=s.slice(x.index+(x.bendpoint?1:0)),!c.length||!l.length)return;u=x.bendpoint?s[x.index]:R,(c.length===1||!ov(r,c[c.length-1]))&&c.push(av(u)),(l.length===1||!ov(r,l[0]))&&l.unshift(av(u))}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?g=n.connect(r,f,{type:o.type,waypoints:l}):(n.reconnectStart(o,r,l||R),g=o));var m=[].concat(d&&tt(y,function(v){return v.source===d.source})||[],g&&tt(h,function(v){return v.target===g.target})||[]);m.length&&n.removeElements(m)}this.preExecute("elements.move",function(r){var o=r.newParent,a=r.shapes,s=r.delta,c=a[0];if(!(!c||!o)){o&&o.waypoints&&(r.newParent=o=o.parent);var l=Fe(c),u={x:l.x+s.x,y:l.y+s.y},p=Tt(o.children,function(f){var d=t.canInsert(a,f);return d&&Cf(f.waypoints,u)});p&&(r.targetFlow=p,r.position=u)}},!0),this.postExecuted("elements.move",function(r){var o=r.shapes,a=r.targetFlow,s=r.position;a&&i(o[0],a,s)},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;t.canInsert(a,o)&&(r.targetFlow=o,r.parent=o.parent)},!0),this.postExecuted("shape.create",function(r){var o=r.shape,a=r.targetFlow,s=r.position;a&&i(o,a,s)},!0)}we(Af,ce),Af.$inject=["eventBus","bpmnRules","modeling"];function ov(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 av(e){return W({},e)}function Mf(e,t){ce.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)&&oa(r)){var c=[];C(o,"bpmn:EventBasedGateway")?c=a.incoming.filter(l=>l!==r&&oa(l)):c=a.incoming.filter(l=>l!==r&&oa(l)&&C(l.source,"bpmn:EventBasedGateway")),c.forEach(function(l){t.removeConnection(l)})}}),this.preExecuted("shape.replace",function(n){var i=n.context,r=i.newShape;if(C(r,"bpmn:EventBasedGateway")){var o=r.outgoing.filter(oa).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);o.forEach(function(a){a.incoming.filter(oa).forEach(function(s){const c=a.incoming.filter(oa).filter(function(l){return l.source===r});(s.source!==r||c.length>1)&&t.removeConnection(s)})})}})}Mf.$inject=["eventBus","modeling"],we(Mf,ce);function oa(e){return C(e,"bpmn:SequenceFlow")}var al=1500,sv=2e3;function cv(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"],al,function(i){var r=i.context,o=r.shape||i.shape,a=i.hover;C(a,"bpmn:Lane")&&!et(o,["bpmn:Lane","bpmn:Participant"])&&(i.hover=gi(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(o.labelTarget||et(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"],al,function(i){var r=i.hover;C(r,"bpmn:Lane")&&(i.hover=gi(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],al,function(i){var r=i.context,o=i.hover,a=r.type;C(o,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=gi(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],al,function(i){var r=i.context,o=r.start;C(o,"bpmn:Lane")&&(r.start=gi(o)||o)}),t.on("shape.move.start",sv,function(i){var r=i.shape;C(r,"bpmn:Lane")&&(i.shape=gi(r)||r)}),t.on("spaceTool.move",sv,function(i){var r=i.hover;r&&C(r,"bpmn:Lane")&&(i.hover=gi(r))})}cv.$inject=["elementRegistry","eventBus","canvas"];var lv=770;function Pf(e,t,n,i){n.invoke(ce,this);function r(s,c){var l=ue(s),u=c.categoryValue||l.categoryValueRef;u||(u=Ky(e,l));var p=c.category||u.$parent||Yy(e);l.categoryValueRef=u,u.$parent=p,c.categoryValue=u,c.category=p}function o(s,c){var l=ue(s),u=c.categoryValue||l.categoryValueRef,p=c.category||u&&u.$parent;u&&(c.categoryValue=u,c.category=p,l.categoryValueRef=null)}this.execute("label.create",function(s){var c=s.context,l=c.labelTarget;C(l,"bpmn:Group")&&r(l,c)}),this.revert("label.create",function(s){var c=s.context,l=c.labelTarget;C(l,"bpmn:Group")&&o(l,c)}),this.execute("shape.delete",function(s){var c=s.context,l=c.shape,u=ue(l);if(!(!C(l,"bpmn:Group")||l.labelTarget)){var p=c.categoryValue=u.categoryValueRef;p&&(c.category=p.$parent,u.categoryValueRef=null)}}),this.reverted("shape.delete",function(s){var c=s.context,l=c.shape;if(!(!C(l,"bpmn:Group")||l.labelTarget)){var u=c.category,p=c.categoryValue,f=ue(l);p&&(f.categoryValueRef=p,p.$parent=u)}}),this.execute("shape.create",function(s){var c=s.context,l=c.shape,u=c.hints||{};!C(l,"bpmn:Group")||l.labelTarget||u.createElementsBehavior===!1&&!ue(l).categoryValueRef&&!c.categoryValue||r(l,c)}),this.reverted("shape.create",function(s){var c=s.context,l=c.shape,u=c.hints||{};!C(l,"bpmn:Group")||l.labelTarget||u.createElementsBehavior===!1&&!ue(l).categoryValueRef&&!c.categoryValue||o(l,c)}),this.executed(["shape.move","shape.resize"],function(s){var c=s.context,l=c.shape;!C(l,"bpmn:Group")||l.labelTarget||ue(l).categoryValueRef||r(l,c)}),this.reverted(["shape.move","shape.resize"],function(s){var c=s.context,l=c.shape;!C(l,"bpmn:Group")||l.labelTarget||!c.categoryValue||o(l,c)});function a(s,c){var l=e.create(s.$type);return i.copyElement(s,l,null,c)}t.on("copyPaste.copyElement",lv,function(s){var c=s.descriptor,l=s.element;if(!(!C(l,"bpmn:Group")||l.labelTarget)){var u=ue(l);if(u.categoryValueRef){var p=u.categoryValueRef;c.categoryValue=a(p,!0),p.$parent&&(c.category=a(p.$parent,!0))}}}),t.on("copyPaste.pasteElement",lv,function(s){var c=s.descriptor,l=c.businessObject,u=c.categoryValue,p=c.category;u&&(u=l.categoryValueRef=a(u)),p&&(u.$parent=a(p)),delete c.category,delete c.categoryValue})}Pf.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],we(Pf,ce);function Tf(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 uv(e){function t(i,r,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=Tf(i,r,o,a),l=Tf(i,r,o,s),u;c&&l?pv(c,o)>pv(l,o)?u=l:u=c:u=c||l,i.original=u}function n(i){var r=i.waypoints;t(r[0],r[1],Fe(i.source)),t(r[r.length-1],r[r.length-2],Fe(i.target))}e.on("bpmnElement.added",function(i){var r=i.element;r.waypoints&&n(r)})}uv.$inject=["eventBus"];function pv(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function kf(e){ce.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=ue(i),o=pt(i);if(et(r,t)){var a=o.get("isHorizontal");a===void 0&&(a=!0),o.set("isHorizontal",a)}})}kf.$inject=["eventBus"],we(kf,ce);function fv(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function dv(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function jP(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 HP(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 Of(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=HP([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 hv(e,t){var n=Of(e,t),i={x:n.x-e.x,y:n.y-e.y};return fv(i)}function os(e,t){return fv({x:e.x-t.x,y:e.y-t.y})}var mv=Math.sqrt,gv=Math.min,zP=Math.max,yv=Math.abs;function vv(e){return Math.pow(e,2)}function as(e,t){return mv(vv(e.x-t.x)+vv(e.y-t.y))}function GP(e,t){var n=0,i,r,o,a,s,c,l,u,p,f,d;for(n=0;n<t.length-1;n++){if(i=t[n],r=t[n+1],xv(i,r)?l=[i]:(o=as(e,i),a=as(e,r),c=gv(o,a),l=VP(i,r,e,c)),l.length<1)throw new Error("expected between [1, 2] circle -> line intersections");l.length===1&&(u={type:"bendpoint",position:l[0],segmentIndex:n,bendpointIndex:xv(i,l[0])?n:n+1}),l.length===2&&(s=UP(l[0],l[1]),u={type:"segment",position:s,segmentIndex:n,relativeLocation:as(i,s)/as(i,r)}),p=as(u.position,e),(!d||f>p)&&(d=u,f=p)}return d}function VP(e,t,n,i){var r=t.x-e.x,o=t.y-e.y,a=n.x-e.x,s=n.y-e.y,c=r*r+o*o,l=r*a+o*s,u=a*a+s*s-i*i,p=l/c,f=u/c,d=p*p-f;if(d<0&&d>-1e-6&&(d=0),d<0)return[];var g=mv(d),h=-p+g,y=-p-g,R={x:e.x-r*h,y:e.y-o*h};if(d===0)return[R];var x={x:e.x-r*y,y:e.y-o*y};return[R,x].filter(function(m){return WP(m,e,t)})}function WP(e,t,n){return bv(e.x,t.x,n.x)&&bv(e.y,t.y,n.y)}function bv(e,t,n){return e>=gv(t,n)-sl&&e<=zP(t,n)+sl}function UP(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var sl=.1;function xv(e,t){return yv(e.x-t.x)<=sl&&yv(e.y-t.y)<=sl}function qP(e,t,n,i){var r=n.segmentIndex,o=t.length-e.length;if(i.segmentMove){var a=i.segmentMove.segmentStartIndex,s=i.segmentMove.newSegmentStartIndex;return r===a?s:r>=s?r+o<s?s:r+o:r}if(i.bendpointMove){var c=i.bendpointMove.insert,l=i.bendpointMove.bendpointIndex,u;if(o===0)return r;if(r>=l&&(u=c?r+1:r-1),r<l&&(u=r,c&&n.type!=="bendpoint"&&l-1===r)){var p=wv(t,l);p<n.relativeLocation&&u++}return u}return o===0?r:i.connectionStart&&r===0?0:i.connectionEnd&&r===e.length-2?t.length-2:Math.floor((t.length-2)/2)}function _v(e,t,n,i){var r=0,o=0,a={point:e,delta:{x:0,y:0}},s=GP(e,n),c=s.segmentIndex,l=qP(n,t,s,i);if(l<0||l>t.length-2||l===null)return a;var u=Ev(n,c),p=Ev(t,l),f=s.position,d=KP(u,f),g=YP(u,p);if(s.type==="bendpoint"){var h=t.length-n.length,y=s.bendpointIndex,R=n[y];if(t.indexOf(R)!==-1)return a;if(h===0){var x=t[y];return r=x.x-s.position.x,o=x.y-s.position.y,{delta:{x:r,y:o},point:{x:e.x+r,y:e.y+o}}}h<0&&y!==0&&y<n.length-1&&(d=wv(n,y))}var m={x:(p[1].x-p[0].x)*d+p[0].x,y:(p[1].y-p[0].y)*d+p[0].y},v=jP({x:e.x-f.x,y:e.y-f.y},g);return r=m.x+v.x-e.x,o=m.y+v.y-e.y,{point:nr(m),delta:nr({x:r,y:o})}}function wv(e,t){var n=os(e[t-1],e[t]),i=os(e[t],e[t+1]),r=n/(n+i);return r}function YP(e,t){var n=dv(e),i=dv(t);return i-n}function Ev(e,t){return[e[t],e[t+1]]}function KP(e,t){var n=os(e[0],e[1]),i=os(e[0],t);return n===0?0:i/n}function XP(e,t,n,i){var r=Fe(e);return _v(r,t,n,i).delta}function ss(e,t,n){var i=ns(t),r=ns(n),o=Ti(e,i),a={x:o.x*(n.width/t.width),y:o.y*(n.height/t.height)};return nr({x:r.x+a.x,y:r.y+a.y})}function Sv(e,t,n){var i=ns(e),r=ns(t),o=ns(n),a=Ti(e,i),s=Ti(i,r),c=ZP(i,t,n);if(c)return c;var l={x:s.x*(n.width/t.width),y:s.y*(n.height/t.height)},u={x:o.x+l.x,y:o.y+l.y};return nr({x:u.x+a.x-e.x,y:u.y+a.y-e.y})}function ZP(e,t,n){var i=Ie(t),r=Ie(n);if(QP(i,r))return null;var o=Rn(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=Rn(n,s),c!==o?null:a}function QP(e,t){return JP(e,t)||eT(e,t)}function JP(e,t){return e.right!==t.right&&e.left!==t.left}function eT(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var Rv="name",Cv="text";function Df(e,t,n,i){ce.call(this,e),this.postExecute("element.updateProperties",r),this.postExecute("element.updateModdleProperties",a=>{ue(a.context.element)===a.context.moddleElement&&r(a)});function r(a){var s=a.context,c=s.element,l=s.properties;if(Rv in l&&t.updateLabel(c,l[Rv]),Cv in l&&C(c,"bpmn:TextAnnotation")){var u=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},l[Cv]||"");t.updateLabel(c,l.text,u)}}this.postExecute(["shape.create","connection.create"],function(a){var s=a.context,c=s.hints||{};if(c.createElementsBehavior!==!1){var l=s.shape||s.connection;Je(l)||!Tr(l)||li(l)&&t.updateLabel(l,li(l))}}),this.postExecute("shape.delete",function(a){var s=a.context,c=s.labelTarget,l=s.hints||{};c&&l.unsetLabel!==!1&&t.updateLabel(c,null,null,{removeShape:!1})});function o(a){var s=a.context,c=s.connection,l=c.label,u=W({},s.hints),p=s.newWaypoints||c.waypoints,f=s.oldWaypoints;return typeof u.startChanged>"u"&&(u.startChanged=!!u.connectionStart),typeof u.endChanged>"u"&&(u.endChanged=!!u.connectionEnd),XP(l,p,f,u)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(a){var s=a.context,c=s.hints||{};if(c.labelBehavior!==!1){var l=s.connection,u=l.label,p;!u||!u.parent||(p=o(a),t.moveShape(u,p))}}),this.postExecute(["shape.replace"],function(a){var s=a.context,c=s.newShape,l=s.oldShape,u=ue(c);u&&Tr(u)&&l.label&&c.label&&(c.label.x=l.label.x,c.label.y=l.label.y)}),this.preExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.hints||{};if(!(!Je(c)||l.autoResize)){var u=s.newBounds,p=i.getDimensions(li(c)||"",{box:u,style:i.getExternalStyle()}),f=Math.ceil(p.height),d=u.y!==c.y,g=c.y+c.height;s.newBounds={width:u.width,height:f,x:u.x,y:d?g-f:u.y}}}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.newBounds,u=s.oldBounds;if(Vc(c)){var p=c.label,f=Fe(p),d=iT(u),g=nT(f,d),h=tT(g,u,l);t.moveShape(p,h)}})}we(Df,ce),Df.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function tT(e,t,n){var i=ss(e,t,n);return nr(Ti(i,e))}function nT(e,t){if(t.length){var n=rT(e,t);return Of(e,n)}}function iT(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 rT(e,t){var n=t.map(function(r){return{line:r,distance:hv(e,r)}}),i=Di(n,"distance");return i[0].line}function oT(e,t,n,i){return _v(e,t,n,i).point}function Lf(e,t){ce.call(this,e);function n(i,r){var o=i.context,a=o.connection,s=W({},o.hints),c=o.newWaypoints||a.waypoints,l=o.oldWaypoints;return typeof s.startChanged>"u"&&(s.startChanged=!!s.connectionStart),typeof s.endChanged>"u"&&(s.endChanged=!!s.connectionEnd),oT(r,c,l,s)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(i){var r=i.context,o=r.connection,a=o.outgoing,s=o.incoming;s.forEach(function(c){var l=c.waypoints[c.waypoints.length-1],u=n(i,l),p=[].concat(c.waypoints.slice(0,-1),[u]);t.updateWaypoints(c,p)}),a.forEach(function(c){var l=c.waypoints[0],u=n(i,l),p=[].concat([u],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(l){var u=l.waypoints[l.waypoints.length-1],p={x:u.x+c.x,y:u.y+c.y},f=[].concat(l.waypoints.slice(0,-1),[p]);t.updateWaypoints(l,f)}),a.forEach(function(l){var u=l.waypoints[0],p={x:u.x+c.x,y:u.y+c.y},f=[].concat([p],l.waypoints.slice(1));t.updateWaypoints(l,f)})})}we(Lf,ce),Lf.$inject=["eventBus","modeling"];function cl(e,t,n){var i=ul(e),r=Mv(i,t),o=i[0];return r.length?r[r.length-1]:ss(o.original||o,n,t)}function ll(e,t,n){var i=ul(e),r=Mv(i,t),o=i[i.length-1];return r.length?r[0]:ss(o.original||o,n,t)}function If(e,t,n){var i=ul(e),r=Av(t,n),o=i[0];return ss(o.original||o,r,t)}function Bf(e,t,n){var i=ul(e),r=Av(t,n),o=i[i.length-1];return ss(o.original||o,r,t)}function Av(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function ul(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Mv(e,t){var n=Pn(e,sT);return tt(n,function(i){return aT(i,t)})}function aT(e,t){return Rn(t,e,1)==="intersect"}function sT(e){return e.original||e}function Nf(e,t){ce.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,r=n.newShape;if(cT(i,r)){var o=lT(i);o.incoming.forEach(function(a){var s=ll(a,r,i);t.reconnectEnd(a,r,s)}),o.outgoing.forEach(function(a){var s=cl(a,r,i);t.reconnectStart(a,r,s)})}},!0)}Nf.$inject=["eventBus","modeling"],we(Nf,ce);function cT(e,t){return C(e,"bpmn:Participant")&&at(e)&&C(t,"bpmn:Participant")&&!at(t)}function lT(e){var t=Ua([e]),n=[],i=[];return t.forEach(function(r){r!==e&&(r.incoming.forEach(function(o){C(o,"bpmn:MessageFlow")&&n.push(o)}),r.outgoing.forEach(function(o){C(o,"bpmn:MessageFlow")&&i.push(o)}))},[]),{incoming:n,outgoing:i}}const uT=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function Pv(e){const t=ue(e);if(!C(t,"bpmn:BoundaryEvent")&&!(C(t,"bpmn:StartEvent")&&Ln(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:uT.some(i=>C(n[0],i))}function Tv(e){return C(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function $f(e,t){e.invoke(ce,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,r=n.context.newShape,o=n.context.hints;if(!Pv(r))return;const a=Tv(r);if(o.targetElement&&o.targetElement[a]!==void 0)return;const c=ue(i).get(a),l=ue(r).get(a);c!==l&&t.updateProperties(r,{[a]:c})})}$f.$inject=["injector","modeling"],we($f,ce);function Ff(e,t){ce.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,r=pt(i),o=r&&r.get("label"),a=o&&o.get("bounds");a&&t.updateModdleProperties(i,o,{bounds:void 0})},!0)}we(Ff,ce),Ff.$inject=["eventBus","modeling"];function jf(e,t,n){ce.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(!(!C(o,"bpmn:SequenceFlow")||!C(a,"bpmn:SequenceFlow"))&&t.canConnect(o.source,a.target,o)){var s=pT(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}we(jf,ce),jf.$inject=["eventBus","bpmnRules","modeling"];function aa(e){return e.original||e}function pT(e,t){var n=Tf(aa(e[e.length-2]),aa(e[e.length-1]),aa(t[1]),aa(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[aa(e[0]),aa(t[t.length-1])]}function Hf(e,t){ce.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,r=i.parent;C(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)}Hf.$inject=["eventBus","modeling"],we(Hf,ce);function zf(e,t,n,i){ce.call(this,e);var r=i.get("dragging",!1);function o(c){var l=c.source,u=c.target,p=c.parent;if(p){var f,d;C(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(l,u)||(d=!0),n.canConnectMessageFlow(l,u)&&(f="bpmn:MessageFlow")),C(c,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(l,u)||(d=!0),n.canConnectSequenceFlow(l,u)&&(f="bpmn:SequenceFlow")),d&&t.removeConnection(c),f&&t.connect(l,u,{type:f,waypoints:c.waypoints.slice()})}}function a(c){var l=c.context,u=l.connection,p=l.newSource||u.source,f=l.newTarget||u.target,d,g;d=n.canConnect(p,f),!(!d||d.type===u.type)&&(g=t.connect(p,f,{type:d.type,associationDirection:d.associationDirection,waypoints:u.waypoints.slice()}),u.parent&&t.removeConnection(u),l.connection=g,r&&s(u,g))}function s(c,l){var u=r.context(),p=u&&u.payload.previousSelection,f;!p||!p.length||(f=p.indexOf(c),f!==-1&&p.splice(f,1,l))}this.postExecuted("elements.move",function(c){var l=c.closure,u=l.allConnections;H(u,o)},!0),this.preExecute("connection.reconnect",a),this.postExecuted("element.updateProperties",function(c){var l=c.context,u=l.properties,p=l.element,f=p.businessObject,d;u.default&&(d=Tt(p.outgoing,Io({id:p.businessObject.default.id})),d&&t.updateProperties(d,{conditionExpression:void 0})),u.conditionExpression&&f.sourceRef.default===f&&t.updateProperties(p.source,{default:void 0})})}we(zf,ce),zf.$inject=["eventBus","modeling","bpmnRules","injector"];function pl(e,t,n,i,r,o){i.invoke(ce,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=o,this.postExecuted(["elements.create"],500,function(a){var s=a.context,c=s.parent,l=s.elements,u=Un(l,function(p,f){var d=t.canReplace([f],f.host||f.parent||c);return d?p.concat(d.replacements):p},[]);u.length&&this._replaceElements(l,u)},this),this.postExecuted(["elements.move"],500,function(a){var s=a.context,c=s.newParent,l=s.newHost,u=[];H(s.closure.topLevel,function(f){Ln(f)?u=u.concat(f.children):u=u.concat(f)}),u.length===1&&l&&(c=l);var p=t.canReplace(u,c);p&&this._replaceElements(u,p.replacements,l)},this),this.postExecute(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,l=s.newShape,u=c.attachers,p;u&&u.length&&(p=t.canReplace(u,l),this._replaceElements(u,p.replacements))},this),this.postExecuted(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,l=s.newShape;r.unclaimId(c.businessObject.id,c.businessObject),r.updateProperties(l,{id:c.id})})}we(pl,ce),pl.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,r=this._selection;H(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)},pl.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var fT=1500,dT={width:140,height:120},Gf={width:300,height:60},Vf={width:60,height:300},fl={width:300,height:150},dl={width:150,height:300},kv={width:140,height:120},Ov={width:100,height:40};function Dv(e){e.on("resize.start",fT,function(t){var n=t.context,i=n.shape,r=n.direction,o=n.balanced;(C(i,"bpmn:Lane")||C(i,"bpmn:Participant"))&&(n.resizeConstraints=vT(i,r,o)),C(i,"bpmn:SubProcess")&&at(i)&&(n.minDimensions=kv),C(i,"bpmn:TextAnnotation")&&(n.minDimensions=Ov)})}Dv.$inject=["eventBus"];var Dr=Math.abs,hT=Math.min,mT=Math.max;function Lv(e,t,n,i){var r=e[t];e[t]=r===void 0?n:i(n,r)}function sa(e,t,n){return Lv(e,t,n,hT)}function ca(e,t,n){return Lv(e,t,n,mT)}var gT={top:20,left:50,right:20,bottom:20},yT={top:50,left:20,right:20,bottom:20};function vT(e,t,n){var i=gi(e),r=!0,o=!0,a=il(i,[i]),s=Ie(e),c={},l={},u=gn(e),p=u?Gf:Vf;/n/.test(t)?l.top=s.bottom-p.height:/e/.test(t)?l.right=s.left+p.width:/s/.test(t)?l.bottom=s.top+p.height:/w/.test(t)&&(l.left=s.right-p.width),a.forEach(function(g){var h=Ie(g);u?(h.top<s.top-10&&(r=!1),h.bottom>s.bottom+10&&(o=!1)):(h.left<s.left-10&&(r=!1),h.right>s.right+10&&(o=!1)),/n/.test(t)&&(n&&Dr(s.top-h.bottom)<10&&ca(c,"top",h.top+p.height),Dr(s.top-h.top)<5&&sa(l,"top",h.bottom-p.height)),/e/.test(t)&&(n&&Dr(s.right-h.left)<10&&sa(c,"right",h.right-p.width),Dr(s.right-h.right)<5&&ca(l,"right",h.left+p.width)),/s/.test(t)&&(n&&Dr(s.bottom-h.top)<10&&sa(c,"bottom",h.bottom-p.height),Dr(s.bottom-h.bottom)<5&&ca(l,"bottom",h.top+p.height)),/w/.test(t)&&(n&&Dr(s.left-h.right)<10&&ca(c,"left",h.left+p.width),Dr(s.left-h.left)<5&&sa(l,"left",h.right-p.width))});var f=i.children.filter(function(g){return!g.hidden&&!g.waypoints&&(C(g,"bpmn:FlowElement")||C(g,"bpmn:Artifact"))}),d=u?gT:yT;return f.forEach(function(g){var h=Ie(g);/n/.test(t)&&(!u||r)&&sa(l,"top",h.top-d.top),/e/.test(t)&&(u||o)&&ca(l,"right",h.right+d.right),/s/.test(t)&&(!u||o)&&ca(l,"bottom",h.bottom+d.bottom),/w/.test(t)&&(u||r)&&sa(l,"left",h.left-d.left)}),{min:l,max:c}}function Iv(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function la(e){return e.originalEvent||e.srcEvent}function Wf(e){Iv(e),Iv(la(e))}function ho(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 Bv(){return/mac/i.test(navigator.platform)}function Nv(e,t){return(la(e)||e).button===t}function Lr(e){return Nv(e,0)}function bT(e){return Nv(e,1)}function cs(e){var t=la(e)||e;return Lr(e)?Bv()?t.metaKey:t.ctrlKey:!1}function hl(e){var t=la(e)||e;return Lr(e)&&t.shiftKey}var $v=1001;function Fv(e,t){e.on("resize.start",$v+500,function(n){var i=n.context,r=i.shape;(C(r,"bpmn:Lane")||C(r,"bpmn:Participant"))&&(i.balanced=!cs(n))}),e.on("resize.end",$v,function(n){var i=n.context,r=i.shape,o=i.canExecute,a=i.newBounds;if(C(r,"bpmn:Lane")||C(r,"bpmn:Participant"))return o&&(a=hy(a),t.resizeLane(r,a,i.balanced)),!1})}Fv.$inject=["eventBus","modeling"];var xT=500;function Uf(e,t,n,i,r){n.invoke(ce,this);function o(u){return et(u,["bpmn:ReceiveTask","bpmn:SendTask"])||_T(u,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(u){var p=e.getDefinitions(),f=p.get("rootElements");return!!Tt(f,Io({id:u.id}))}function s(u){if(C(u,"bpmn:ErrorEventDefinition"))return"errorRef";if(C(u,"bpmn:EscalationEventDefinition"))return"escalationRef";if(C(u,"bpmn:MessageEventDefinition"))return"messageRef";if(C(u,"bpmn:SignalEventDefinition"))return"signalRef"}function c(u){if(et(u,["bpmn:ReceiveTask","bpmn:SendTask"]))return u.get("messageRef");var p=u.get("eventDefinitions"),f=p[0];return f.get(s(f))}function l(u,p){if(et(u,["bpmn:ReceiveTask","bpmn:SendTask"]))return u.set("messageRef",p);var f=u.get("eventDefinitions"),d=f[0];return d.set(s(d),p)}this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],function(u){var p=u.shape||u.element;if(o(p)){var f=ue(p),d=c(f),g;d&&!a(d)&&(g=e.getDefinitions().get("rootElements"),qt(g,d),u.addedRootElement=d)}},!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],function(u){var p=u.addedRootElement;if(p){var f=e.getDefinitions().get("rootElements");Wt(f,p)}},!0),t.on("copyPaste.copyElement",function(u){var p=u.descriptor,f=u.element;if(!(f.labelTarget||!o(f))){var d=ue(f),g=c(d);g&&(p.referencedRootElement=g)}}),t.on("copyPaste.pasteElement",xT,function(u){var p=u.descriptor,f=p.businessObject,d=p.referencedRootElement;d&&(a(d)||(d=i.copyElement(d,r.create(d.$type))),l(f,d),delete p.referencedRootElement)})}Uf.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],we(Uf,ce);function _T(e,t){return $e(t)||(t=[t]),vr(t,function(n){return ea(e,n)})}var jv=Math.max;function Hv(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,r=t.start,o={};return H(n,function(a){var s=a.id;C(a,"bpmn:Participant")&&(o[s]=ET(a,i,r)),C(a,"bpmn:Lane")&&(o[s]=gn(a)?Gf:Vf),C(a,"bpmn:SubProcess")&&at(a)&&(o[s]=kv),C(a,"bpmn:TextAnnotation")&&(o[s]=Ov),C(a,"bpmn:Group")&&(o[s]=dT)}),o})}Hv.$inject=["eventBus"];function wT(e){return e==="x"}function ET(e,t,n){var i=gn(e);if(!CT(e))return i?fl:dl;var r=wT(t),o={};return r?i?o=fl:o={width:RT(e,n,r),height:dl.height}:i?o={width:fl.width,height:ST(e,n,r)}:o=dl,o}function ST(e,t,n){var i;return i=AT(e,t,n),jv(fl.height,i)}function RT(e,t,n){var i;return i=MT(e,t,n),jv(dl.width,i)}function CT(e){return!!Or(e).length}function AT(e,t,n){var i=Or(e),r;return r=qf(i,t,n),e.height-r.height+Gf.height}function MT(e,t,n){var i=Or(e),r;return r=qf(i,t,n),e.width-r.width+Vf.width}function qf(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=Or(r),o.length?qf(o,t,n):r}var zv="_plane";function Gv(e){var t=e.id;return PT(t)}function Vi(e){var t=e.id;return C(e,"bpmn:SubProcess")?Vv(t):t}function mo(e){return Vv(e)}function ml(e){var t=pt(e);return C(t,"bpmndi:BPMNPlane")}function Vv(e){return e+zv}function PT(e){return e.replace(new RegExp(zv+"$"),"")}var Wv=400,TT=600,Uv={x:180,y:160};function ar(e,t,n,i,r,o,a){ce.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 C(p,"bpmn:SubProcess")&&!at(p)}function l(p){var f=p.shape,d=p.newRootElement,g=ue(f);d=s._addDiagram(d||g),p.newRootElement=e.addRootElement(d)}function u(p){var f=p.shape,d=ue(f);s._removeDiagram(d);var g=p.newRootElement=a.get(Vi(d));e.removeRootElement(g)}this.executed("shape.create",function(p){var f=p.shape;c(f)&&l(p)},!0),this.postExecuted("elements.create",function(p){var f=p.elements;H(f,function(d){if(c(d)){var g=a.get(Vi(d));if(!(!g||!d.children||!d.children.length)){var h=qv(d);s._showRecursively(h),s._moveChildrenToShape(h,g)}}})},!0),this.reverted("shape.create",function(p){var f=p.shape;c(f)&&u(p)},!0),this.preExecute("shape.delete",function(p){var f=p.shape;!C(f,"bpmn:SubProcess")||!at(f)||H(Qa([f]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(p){var f=p.shape;if(c(f)){var d=a.get(Vi(f));d&&n.removeElements(d.children.slice())}},!0),this.executed("shape.delete",function(p){var f=p.shape;c(f)&&u(p)},!0),this.reverted("shape.delete",function(p){var f=p.shape;c(f)&&l(p)},!0),this.preExecuted("shape.replace",function(p){var f=p.oldShape,d=p.newShape;!c(f)||!c(d)||(p.oldRoot=e.removeRootElement(Vi(f)))},!0),this.postExecuted("shape.replace",function(p){var f=p.newShape,d=p.oldRoot,g=e.findRoot(Vi(f));if(!(!d||!g)){var h=d.children;n.moveElements(h,{x:0,y:0},g)}},!0),this.executed("element.updateProperties",function(p){var f=p.element;if(C(f,"bpmn:SubProcess")){var d=p.properties,g=p.oldProperties,h=g.id,y=d.id;if(h!==y){if(ml(f)){a.updateId(f,mo(y)),a.updateId(h,y);return}var R=a.get(mo(h));R&&a.updateId(mo(h),mo(y))}}},!0),this.reverted("element.updateProperties",function(p){var f=p.element;if(C(f,"bpmn:SubProcess")){var d=p.properties,g=p.oldProperties,h=g.id,y=d.id;if(h!==y){if(ml(f)){a.updateId(f,mo(h)),a.updateId(y,h);return}var R=a.get(mo(y));R&&a.updateId(R,mo(h))}}},!0),t.on("element.changed",function(p){var f=p.element;if(ml(f)){var d=f,g=a.get(Gv(d));!g||g===d||t.fire("element.changed",{element:g})}}),this.executed("shape.toggleCollapse",Wv,function(p){var f=p.shape;C(f,"bpmn:SubProcess")&&(at(f)?u(p):(l(p),s._showRecursively(f.children)))},!0),this.reverted("shape.toggleCollapse",Wv,function(p){var f=p.shape;C(f,"bpmn:SubProcess")&&(at(f)?u(p):(l(p),s._showRecursively(f.children)))},!0),this.postExecuted("shape.toggleCollapse",TT,function(p){var f=p.shape;if(C(f,"bpmn:SubProcess")){var d=p.newRootElement;if(d)if(at(f))s._moveChildrenToShape(d.children.slice(),f),H(Qa(f.children),h=>{n.moveShape(h.annotation,{x:0,y:0},f.parent),H(h.associations,y=>{n.moveConnection(y,{x:0,y:0},f.parent)})});else{s._disconnectSharedAnnotations(f);var g=qv(f);s._moveChildrenToShape(g,d)}}},!0),t.on("copyPaste.createTree",function(p){var f=p.element,d=p.children;if(c(f)){var g=Vi(f),h=a.get(g);h&&d.push.apply(d,h.children)}}),t.on("copyPaste.copyElement",function(p){var f=p.descriptor,d=p.element,g=p.elements,h=d.parent,y=C(pt(h),"bpmndi:BPMNPlane");if(y){var R=Gv(h),x=Tt(g,function(m){return m.id===R});x&&(f.parent=x.id)}}),t.on("copyPaste.pasteElement",function(p){var f=p.descriptor;f.parent&&(c(f.parent)||f.parent.hidden)&&(f.hidden=!0)})}we(ar,ce),ar.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=Jt(i),o;if(!t.x)o={x:Uv.x-r.x,y:Uv.y-r.y};else{var a=Fe(t),s=Fe(r);o={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,o,t,{autoResize:!1})}},ar.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(Ny(e).map(i=>i.annotation));n.size&&H(Qa(e.children),i=>{n.has(i.annotation)&&H(i.associations,r=>{t.removeConnection(r)})})},ar.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},ar.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},ar.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:Vi(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return o},ar.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=Tt(n,function(r){return r.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},ar.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function kT(e){var t=[];return H(Qa(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function qv(e){return e.children.slice().concat(kT(e.children)).concat(OT(e))}function OT(e){return Zp(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function Yf(e,t){e.invoke(ce,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,r=n.context.newShape;if(!(!C(r,"bpmn:SubProcess")||C(r,"bpmn:AdHocSubProcess")||!(C(i,"bpmn:Task")||C(i,"bpmn:CallActivity"))||!at(r))){var o=DT(r);t.createShape({type:"bpmn:StartEvent"},o,r)}})}Yf.$inject=["injector","modeling"],we(Yf,ce);function DT(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function Kf(e,t){ce.call(this,e),this.preExecute("connection.create",function(n){const{target:i}=n;C(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&&C(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(!(!C(r,"bpmn:TextAnnotation")||o.autoResize)){var a=i.newBounds,s=t.getTextAnnotationBounds(a,li(r)||""),c=a.y!==r.y&&Math.abs(a.y+a.height-(r.y+r.height))<=1,l=r.y+r.height;i.newBounds={width:a.width,height:s.height,x:a.x,y:c?l-s.height:a.y}}})}we(Kf,ce),Kf.$inject=["eventBus","textRenderer"];function Xf(e,t){ce.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(at(i))return;var r=Ua(i);r.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();H(s,function(l){o(l,!0)}),H(c,function(l){o(l,!1)})});function o(a,s){r.indexOf(a.source)!==-1&&r.indexOf(a.target)!==-1||C(a,"bpmn:Association")&&(C(a.source,"bpmn:TextAnnotation")||C(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,i,Fe(i)):t.reconnectStart(a,i,Fe(i)))}},!0)}we(Xf,ce),Xf.$inject=["eventBus","modeling"];var Zf=500;function Qf(e,t,n){ce.call(this,e);function i(a){a.length&&a.forEach(function(s){s.type==="label"&&!s.businessObject.name&&(s.hidden=!0)})}function r(a,s){var c=a.children,l=s,u,p;return u=LT(c).concat([a]),p=tv(u),p?(l.width=Math.max(p.width,l.width),l.height=Math.max(p.height,l.height),l.x=p.x+(p.width-l.width)/2,l.y=p.y+(p.height-l.height)/2):(l.x=a.x+(a.width-l.width)/2,l.y=a.y+(a.height-l.height)/2),l}function o(a,s){return{x:a.x+(a.width-s.width)/2,y:a.y+(a.height-s.height)/2,width:s.width,height:s.height}}this.executed(["shape.toggleCollapse"],Zf,function(a){var s=a.context,c=s.shape;C(c,"bpmn:SubProcess")&&(c.collapsed?pt(c).isExpanded=!1:(i(c.children),pt(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],Zf,function(a){var s=a.context,c=s.shape;c.collapsed?pt(c).isExpanded=!1:pt(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],Zf,function(a){var s=a.context.shape,c=t.getDefaultSize(s),l;s.collapsed?l=o(s,c):l=r(s,c),n.resizeShape(s,l,null,{autoResize:s.collapsed?!1:"nwse"})})}we(Qf,ce),Qf.$inject=["eventBus","elementFactory","modeling"];function LT(e){return e.filter(function(t){return!t.hidden})}function Jf(e,t,n,i){t.invoke(ce,this),this.preExecute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.businessObject;Je(a)||(C(a,"bpmn:Participant")&&at(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;C(r,"bpmn:Collaboration")&&n.ids.unclaim(o.id)})}we(Jf,ce),Jf.$inject=["canvas","injector","moddle","modeling"];function ed(e,t){ce.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,r=i.connection,o=r.source;IT(r,o)&&t.updateProperties(o,{default:null})})}we(ed,ce),ed.$inject=["eventBus","modeling"];function IT(e,t){if(!C(e,"bpmn:SequenceFlow"))return!1;var n=ue(t),i=ue(e);return n.get("default")===i}var BT=500,NT=5e3,Yv=["shape.create","shape.delete","shape.move","shape.resize"],Kv=[...Yv,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function td(e,t){ce.call(this,e);var n;function i(){return n=n||new $T,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(Kv,NT,function(){i()}),this.postExecuted(Kv,BT,function(){o()}),this.preExecute(Yv,function(a){var s=a.context,c=s.shape,l=r();!c||c.labelTarget||(C(c,"bpmn:Lane")&&l.addLane(c),C(c,"bpmn:FlowNode")&&l.addFlowNode(c))})}td.$inject=["eventBus","modeling"],we(td,ce);function $T(){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 FT=500,jT=5e3,Xv=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],Zv=[...Xv,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function nd(e,t){ce.call(this,e);var n;function i(){return n=n||new HT,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(Zv,jT,function(){i()}),this.postExecuted(Zv,FT,function(){o()}),this.preExecute(Xv,function(a){var s=a.context.connection||a.context.shape,c=r();!s||s.labelTarget||(C(s,"bpmn:FlowElement")&&c.addFlowElement(s),C(s,"bpmn:Group")&&c.addGroup(s))}),this.preExecute("label.create",function(a){var s=a.context.labelTarget;C(s,"bpmn:Group")&&r().addGroup(s)})}nd.$inject=["eventBus","modeling"],we(nd,ce);function HT(){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 id(e,t){ce.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,r=i.elements;for(const o of r)zT(o)&&!VT(o)&&t.updateProperties(o,{isForCompensation:void 0})})}we(id,ce),id.$inject=["eventBus","modeling"];function zT(e){const t=ue(e);return t&&t.isForCompensation}function GT(e){return e&&C(e,"bpmn:BoundaryEvent")&&ea(e,"bpmn:CompensateEventDefinition")}function VT(e){return e.incoming.filter(n=>GT(n.source)).length>0}const WT={__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",pf],appendBehavior:["type",ff],associationBehavior:["type",hf],attachEventBehavior:["type",Xc],artifactBehavior:["type",df],boundaryEventBehavior:["type",mf],categoryRootElementReferenceBehavior:["type",gf],compensateBoundaryEventBehaviour:["type",yf],createBehavior:["type",vf],createDataObjectBehavior:["type",bf],createParticipantBehavior:["type",wf],dataInputAssociationBehavior:["type",Ef],dataStoreBehavior:["type",Sf],deleteLaneBehavior:["type",Rf],detachEventBehavior:["type",rl],dropOnFlowBehavior:["type",Af],eventBasedGatewayBehavior:["type",Mf],fixHoverBehavior:["type",cv],groupBehavior:["type",Pf],importDockingFix:["type",uv],isHorizontalFix:["type",kf],labelBehavior:["type",Df],layoutConnectionBehavior:["type",Lf],messageFlowBehavior:["type",Nf],nonInterruptingBehavior:["type",$f],removeElementBehavior:["type",jf],removeEmbeddedLabelBoundsBehavior:["type",Ff],removeParticipantBehavior:["type",Hf],replaceConnectionBehavior:["type",zf],replaceElementBehaviour:["type",pl],resizeBehavior:["type",Dv],resizeLaneBehavior:["type",Fv],rootElementReferenceBehavior:["type",Uf],spaceToolBehavior:["type",Hv],subProcessPlaneBehavior:["type",ar],subProcessStartEventBehavior:["type",Yf],textAnnotationBehavior:["type",Kf],toggleCollapseConnectionBehaviour:["type",Xf],toggleElementCollapseBehaviour:["type",Qf],unclaimIdBehavior:["type",Jf],unsetDefaultFlowBehavior:["type",ed],updateFlowNodeRefsBehavior:["type",td],updateCategoryValueRefsBehavior:["type",nd],setCompensationActivityAfterPasteBehavior:["type",id]};function rd(e){this._commandStack=e.get("commandStack",!1)}rd.$inject=["injector"],rd.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const Wi={__init__:["rules"],rules:["type",rd]};function yi(e){ce.call(this,e),this.init()}yi.$inject=["eventBus"],we(yi,ce),yi.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)})},yi.prototype.init=function(){};function Qv(e,t){var n=Rn(e,t,-15);return n!=="intersect"?n:null}function An(e){yi.call(this,e)}we(An,yi),An.$inject=["eventBus"],An.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return UT(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 yl(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return yl(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 pb(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return Ct(i)&&!vl(t,i)?!1:to(t,function(r){return Ct(r)?yl(r.source,r.target,r):r.host?ls(r,r.host,null,n):cd(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 ob(a)&&!n.includes(a.host)})?!1:ls(n,t,null,i)||lb(n,t,i)||ub(n,t)||vl(n,t)}),this.addRule("shape.create",function(e){return cd(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return ls(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return gb(n,t)})},An.prototype.canConnectMessageFlow=hb,An.prototype.canConnectSequenceFlow=mb,An.prototype.canConnectDataAssociation=ld,An.prototype.canConnectAssociation=fb,An.prototype.canConnectCompensationAssociation=db,An.prototype.canMove=ub,An.prototype.canAttach=ls,An.prototype.canReplace=lb,An.prototype.canDrop=ua,An.prototype.canInsert=vl,An.prototype.canCreate=cd,An.prototype.canConnect=yl,An.prototype.canResize=pb,An.prototype.canCopy=gb;function UT(e){return od(e)?null:et(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function od(e){return!e||Je(e)}function Jv(e){do{if(C(e,"bpmn:Process"))return ue(e);if(C(e,"bpmn:Participant"))return ue(e).processRef||ue(e)}while(e=e.parent)}function ad(e){return C(e,"bpmn:TextAnnotation")}function sd(e){return C(e,"bpmn:Group")&&!e.labelTarget}function eb(e){return C(e,"bpmn:BoundaryEvent")&&Ui(e,"bpmn:CompensateEventDefinition")}function gl(e){return ue(e).isForCompensation}function qT(e,t){var n=Jv(e),i=Jv(t);return n===i}function YT(e){return C(e,"bpmn:InteractionNode")&&!C(e,"bpmn:BoundaryEvent")&&(!C(e,"bpmn:Event")||C(e,"bpmn:ThrowEvent")&&ib(e,"bpmn:MessageEventDefinition"))}function KT(e){return C(e,"bpmn:InteractionNode")&&!gl(e)&&(!C(e,"bpmn:Event")||C(e,"bpmn:CatchEvent")&&ib(e,"bpmn:MessageEventDefinition"))&&!(C(e,"bpmn:BoundaryEvent")&&!Ui(e,"bpmn:MessageEventDefinition"))}function tb(e){for(var t=e;t=t.parent;){if(C(t,"bpmn:FlowElementsContainer"))return ue(t);if(C(t,"bpmn:Participant"))return ue(t).processRef}return null}function nb(e,t){var n=tb(e),i=tb(t);return n===i}function Ui(e,t){var n=ue(e);return!!Tt(n.eventDefinitions||[],function(i){return C(i,t)})}function ib(e,t){var n=ue(e);return(n.eventDefinitions||[]).every(function(i){return C(i,t)})}function XT(e){return C(e,"bpmn:FlowNode")&&!C(e,"bpmn:EndEvent")&&!Ln(e)&&!(C(e,"bpmn:IntermediateThrowEvent")&&Ui(e,"bpmn:LinkEventDefinition"))&&!eb(e)&&!gl(e)}function ZT(e){return C(e,"bpmn:FlowNode")&&!C(e,"bpmn:StartEvent")&&!C(e,"bpmn:BoundaryEvent")&&!Ln(e)&&!(C(e,"bpmn:IntermediateCatchEvent")&&Ui(e,"bpmn:LinkEventDefinition"))&&!gl(e)}function QT(e){return C(e,"bpmn:ReceiveTask")||C(e,"bpmn:IntermediateCatchEvent")&&(Ui(e,"bpmn:MessageEventDefinition")||Ui(e,"bpmn:TimerEventDefinition")||Ui(e,"bpmn:ConditionalEventDefinition")||Ui(e,"bpmn:SignalEventDefinition"))}function JT(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function rb(e,t){var n=JT(t);return n.indexOf(e)!==-1}function yl(e,t,n){if(od(e)||od(t))return null;if(!C(n,"bpmn:DataAssociation")){if(hb(e,t))return{type:"bpmn:MessageFlow"};if(mb(e,t))return{type:"bpmn:SequenceFlow"}}var i=ld(e,t);return i||(db(e,t)?{type:"bpmn:Association",associationDirection:"One"}:fb(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function ua(e,t){return Je(e)||sd(e)?!0:C(t,"bpmn:Participant")&&!at(t)?!1:C(e,"bpmn:Participant")?C(t,"bpmn:Process")||C(t,"bpmn:Collaboration"):et(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:C(e,"bpmn:Lane")?C(t,"bpmn:Participant")||C(t,"bpmn:Lane"):C(e,"bpmn:BoundaryEvent")&&!ek(e)?!1:C(e,"bpmn:FlowElement")&&!C(e,"bpmn:DataStoreReference")?C(t,"bpmn:FlowElementsContainer")?at(t):et(t,["bpmn:Participant","bpmn:Lane"]):C(e,"bpmn:DataStoreReference")&&C(t,"bpmn:Collaboration")?vr(ue(t).get("participants"),function(n){return!!n.get("processRef")}):et(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?et(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):C(e,"bpmn:MessageFlow")?C(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function ek(e){return ue(e).cancelActivity&&(ab(e)||sb(e))}function ob(e){return!Je(e)&&C(e,"bpmn:BoundaryEvent")}function tk(e){return C(e,"bpmn:Lane")}function nk(e){return ob(e)||C(e,"bpmn:IntermediateThrowEvent")&&ab(e)?!0:C(e,"bpmn:IntermediateCatchEvent")&&sb(e)}function ab(e){var t=ue(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function sb(e){return cb(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function cb(e,t){return t.some(function(n){return Ui(e,n)})}function ik(e){return C(e,"bpmn:ReceiveTask")&&Tt(e.incoming,function(t){return C(t.source,"bpmn:EventBasedGateway")})}function ls(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var r=e[0];return Je(r)||!nk(r)||Ln(t)||!C(t,"bpmn:Activity")||gl(t)||i&&!Qv(i,t)||ik(t)?!1:"attach"}function lb(e,t,n){if(!t)return!1;var i={replacements:[]};return H(e,function(r){Ln(t)||C(r,"bpmn:StartEvent")&&r.type!=="label"&&ua(r,t)&&(fM(r)||i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),(dM(r)||hM(r)||mM(r))&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),cb(r,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&C(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"})),C(t,"bpmn:Transaction")||Ui(r,"bpmn:CancelEventDefinition")&&r.type!=="label"&&(C(r,"bpmn:EndEvent")&&ua(r,t)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:EndEvent"}),C(r,"bpmn:BoundaryEvent")&&ls(r,t,null,n)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function ub(e,t){return vr(e,tk)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return ua(n,t)})}function cd(e,t,n,i){return t?Je(e)||sd(e)?!0:ua(e,t)||vl(e,t):!1}function pb(e,t,n){return C(e,"bpmn:SubProcess")?at(e)&&(!t||t.width>=100&&t.height>=80):C(e,"bpmn:Lane")||C(e,"bpmn:Participant")?!0:ad(e)?n?n==="e"||n==="w":!0:sd(e)?!0:Je(e)?n?n==="e"||n==="w":!0:!1}function rk(e,t){var n=ad(e),i=ad(t);return(n||i)&&n!==i}function fb(e,t){return rb(t,e)||rb(e,t)?!1:rk(e,t)?!0:!!ld(e,t)}function db(e,t){return nb(e,t)&&eb(e)&&C(t,"bpmn:Activity")&&!ak(t,e)&&!Ln(t)}function hb(e,t){return vb(e)&&!vb(t)?!1:YT(e)&&KT(t)&&!qT(e,t)}function mb(e,t){return XT(e)&&ZT(t)&&nb(e,t)&&!(C(e,"bpmn:EventBasedGateway")&&!QT(t))}function ld(e,t){return et(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&et(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:et(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&et(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function vl(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:et(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!Je(t)&&C(e,"bpmn:FlowNode")&&!C(e,"bpmn:BoundaryEvent")&&ua(e,t.parent)}function ud(e,t){return e&&t&&e.indexOf(t)!==-1}function gb(e,t){return Je(t)?!0:!(C(t,"bpmn:Lane")&&!ud(e,t.parent)||C(t,"bpmn:MessageFlow")&&!ok(e,t))}function ok(e,t){var n=yb(t.source),i=yb(t.target);return ud(e,n)&&ud(e,i)}function yb(e){for(;e;e=e.parent)if(C(e,"bpmn:Participant"))return e;return null}function vb(e){return ia(e,"bpmn:Process")||ia(e,"bpmn:Collaboration")}function ak(e,t){return e.attachers.includes(t)}const sk={__depends__:[Wi],__init__:["bpmnRules"],bpmnRules:["type",An]};var ck=2e3;function bb(e,t){e.on("saveXML.start",ck,n);function n(){var i=t.getRootElements();H(i,function(r){var o=pt(r),a,s;a=Ua([r]),a=tt(a,function(c){return c!==r&&!c.labelTarget}),s=Pn(a,pt),o.set("planeElement",s)})}}bb.$inject=["eventBus","canvas"];const lk={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",bb]};function bl(e){ce.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)})}bl.prototype.getOrdering=function(e,t){return null},we(bl,ce);function pd(e,t){bl.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=Tt(n,function(c){return et(a,[c.type])});return s&&s.order||{level:1}}function r(a){var s=a.order;if(s||(a.order=s=i(a)),!s)throw new Error(`no order for <${a.id}>`);return s}function o(a,s,c){for(var l=s;l&&!et(l,c);)l=l.parent;if(!l)throw new Error(`no parent for <${a.id}> in <${s&&s.id}>`);return l}this.getOrdering=function(a,s){if(a.labelTarget||C(a,"bpmn:TextAnnotation"))return{parent:t.findRoot(s)||t.getRootElement(),index:-1};var c=r(a);c.containers&&(s=o(a,s,c.containers));var l=s.children.indexOf(a),u=Zh(s.children,function(p){return!a.labelTarget&&p.labelTarget?!1:c.level<r(p).level});return u!==-1&&l!==-1&&l<u&&(u-=1),{index:u,parent:s}}}pd.$inject=["eventBus","canvas"],we(pd,bl);const uk={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",pd]};function us(){}us.prototype.get=function(){return this._data},us.prototype.set=function(e){this._data=e},us.prototype.clear=function(){var e=this._data;return delete this._data,e},us.prototype.isEmpty=function(){return!this._data};const pk={clipboard:["type",us]};var xb=1500;function _b(e,t,n){var i=this,r=n.get("dragging",!1);function o(a){if(!a.hover){var s=a.originalEvent,c=i._findTargetGfx(s),l=c&&e.get(c);c&&l&&(a.stopPropagation(),r.hover({element:l,gfx:c}),r.move(s))}}r&&t.on("drag.start",function(a){t.once("drag.move",xb,function(s){o(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",xb,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=ho(a),c=document.elementFromPoint(s.x,s.y),fk(c)}}_b.$inject=["elementRegistry","eventBus","injector"];function fk(e){return so(e,"svg, .djs-element",!0)}const dk={__init__:["hoverFix"],hoverFix:["type",_b]};function hk(e){return!0}function xl(e){return Lr(e)||bT(e)}var wb=500;function Eb(e,t,n){var i=this;function r(k,I,P){if(!s(k,I)){var O,F,J;P?F=t.getGraphics(P):(O=I.delegateTarget||I.target,O&&(F=O,P=t.get(F))),!(!F||!P)&&(J=e.fire(k,{element:P,gfx:F,originalEvent:I}),J===!1&&(I.stopPropagation(),I.preventDefault()))}}var o={};function a(k){return o[k]}function s(k,I){var P=l[k]||Lr;return!P(I)}var c={click:"element.click",contextmenu:"element.contextmenu",dblclick:"element.dblclick",mousedown:"element.mousedown",mousemove:"element.mousemove",mouseover:"element.hover",mouseout:"element.out",mouseup:"element.mouseup"},l={"element.contextmenu":hk,"element.mousedown":xl,"element.mouseup":xl,"element.click":xl,"element.dblclick":xl};function u(k,I,P){var O=c[k];if(!O)throw new Error("unmapped DOM event name <"+k+">");return r(O,I,P)}var p="svg, .djs-element";function f(k,I,P,O){var F=o[P]=function(J){r(P,J)};O&&(l[P]=O),F.$delegate=qn.bind(k,p,I,F)}function d(k,I,P){var O=a(P);O&&qn.unbind(k,I,O.$delegate)}function g(k){H(c,function(I,P){f(k,P,I)})}function h(k){H(c,function(I,P){d(k,P,I)})}e.on("canvas.destroy",function(k){h(k.svg)}),e.on("canvas.init",function(k){g(k.svg)}),e.on(["shape.added","connection.added"],function(k){var I=k.element,P=k.gfx;e.fire("interactionEvents.createHit",{element:I,gfx:P})}),e.on(["shape.changed","connection.changed"],wb,function(k){var I=k.element,P=k.gfx;e.fire("interactionEvents.updateHit",{element:I,gfx:P})}),e.on("interactionEvents.createHit",wb,function(k){var I=k.element,P=k.gfx;i.createDefaultHit(I,P)}),e.on("interactionEvents.updateHit",function(k){var I=k.element,P=k.gfx;i.updateDefaultHit(I,P)});var y=_("djs-hit djs-hit-stroke"),R=_("djs-hit djs-hit-click-stroke"),x=_("djs-hit djs-hit-all"),m=_("djs-hit djs-hit-no-move"),v={all:x,"click-stroke":R,stroke:y,"no-move":m};function _(k,I){return I=W({stroke:"white",strokeWidth:15},I||{}),n.cls(k,["no-fill","no-border"],I)}function E(k,I){var P=v[I];if(!P)throw new Error("invalid hit type <"+I+">");return Ee(k,P),k}function T(k,I){Ue(k,I)}this.removeHits=function(k){var I=kc(".djs-hit",k);H(I,cn)},this.createDefaultHit=function(k,I){var P=k.waypoints,O=k.isFrame,F;return P?this.createWaypointsHit(I,P):(F=O?"stroke":"all",this.createBoxHit(I,F,{width:k.width,height:k.height}))},this.createWaypointsHit=function(k,I){var P=Wa(I);return E(P,"stroke"),T(k,P),P},this.createBoxHit=function(k,I,P){P=W({x:0,y:0},P);var O=Oe("rect");return E(O,I),Ee(O,P),T(k,O),O},this.updateDefaultHit=function(k,I){var P=St(".djs-hit",I);if(P)return k.waypoints?Xp(P,k.waypoints):Ee(P,{width:k.width,height:k.height}),P},this.fire=r,this.triggerMouseEvent=u,this.mouseHandler=a,this.registerEvent=f,this.unregisterEvent=d}Eb.$inject=["eventBus","elementRegistry","styles"];const _l={__init__:["interactionEvents"],interactionEvents:["type",Eb]};function pa(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)})}pa.$inject=["eventBus","canvas"],pa.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()})}},pa.prototype.get=function(){return Array.from(this._selectedElements)},pa.prototype.isSelected=function(e){return this._selectedElements.has(e)},pa.prototype.select=function(e,t){var n=this.get();$e(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?H(e,o=>{this._selectedElements.add(o)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var Sb="hover",Rb="selected";function Cb(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,Sb)}),t.on("element.out",function(r){i(r.element,Sb)}),t.on("selection.changed",function(r){function o(l){i(l,Rb)}function a(l){n(l,Rb)}var s=new Set(r.oldSelection),c=new Set(r.newSelection);for(let l of s)c.has(l)||o(l);for(let l of c)s.has(l)||a(l)})}Cb.$inject=["canvas","eventBus"];function Ab(e,t,n,i){e.on("create.end",500,function(r){var o=r.context,a=o.canExecute,s=o.elements,c=o.hints||{},l=c.autoSelect;if(a){if(l===!1)return;$e(l)?t.select(l):t.select(s.filter(mk))}}),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=Tt(o,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(r){if(Lr(r)){var o=r.element;o===n.getRootElement()&&(o=null);var a=t.isSelected(o),s=t.get().length>1,c=hl(r);if(a&&s)return c?t.deselect(o):t.select(o);a?t.deselect(o):t.select(o,c)}})}Ab.$inject=["eventBus","selection","canvas","elementRegistry"];function mk(e){return!e.hidden}const vi={__init__:["selectionVisuals","selectionBehavior"],__depends__:[_l],selection:["type",pa],selectionVisuals:["type",Cb],selectionBehavior:["type",Ab]};var gk=/^djs-cursor-.*$/;function wl(e){var t=Bt(document.body);t.removeMatching(gk),e&&t.add("djs-cursor-"+e)}function Mb(){wl(null)}var yk=5e3;function Pb(e,t){t=t||"element.click";function n(){return!1}return e.once(t,yk,n),function(){e.off(t,n)}}var vk=["c","C"],bk=["v","V"],xk=["d","D"],_k=["x","X"],wk=["y","Y"],Tb=["z","Z"];function Ek(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Xn(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function ln(e,t){return e=$e(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function fd(e){return e.shiftKey}function Sk(e){return Xn(e)&&ln(vk,e)}function Rk(e){return Xn(e)&&ln(bk,e)}function Ck(e){return Xn(e)&&ln(xk,e)}function Ak(e){return Xn(e)&&ln(_k,e)}function Mk(e){return Xn(e)&&!fd(e)&&ln(Tb,e)}function Pk(e){return Xn(e)&&(ln(wk,e)||ln(Tb,e)&&fd(e))}var fa=Math.round,kb="djs-drag-active";function go(e){e.preventDefault()}function Tk(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function kk(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Ob(e,t,n,i){var r={threshold:5,trapClick:!0},o;function a(m){var v=t.viewbox(),_=t._container.getBoundingClientRect();return{x:v.x+(m.x-_.left)/v.scale,y:v.y+(m.y-_.top)/v.scale}}function s(m,v){v=v||o;var _=e.createEvent(W({},v.payload,v.data,{isTouch:v.isTouch}));return e.fire("drag."+m,_)===!1?!1:e.fire(v.prefix+"."+m,_)}function c(m){var v=m.filter(function(_){return i.get(_.id)});v.length&&n.select(v)}function l(m,v){var _=o.payload,E=o.displacement,T=o.globalStart,k=ho(m),I=Ti(k,T),P=o.localStart,O=a(k),F=Ti(O,P);if(!o.active&&(v||kk(I)>o.threshold)){if(W(_,{x:fa(P.x+E.x),y:fa(P.y+E.y),dx:0,dy:0},{originalEvent:m}),s("start")===!1)return y();o.active=!0,o.keepSelection||(_.previousSelection=n.get(),n.select(null)),o.cursor&&wl(o.cursor),t.addMarker(t.getRootElement(),kb)}Wf(m),o.active&&(W(_,{x:fa(O.x+E.x),y:fa(O.y+E.y),dx:fa(F.x),dy:fa(F.y)},{originalEvent:m}),s("move"))}function u(m){var v,_=!0;o.active&&(m&&(o.payload.originalEvent=m,Wf(m)),_=s("end")),_===!1&&s("rejected"),v=R(_!==!0),s("ended",v)}function p(m){ln("Escape",m)&&(go(m),y())}function f(m){var v;o.active&&(v=Pb(e),setTimeout(v,400),go(m)),u(m)}function d(m){l(m)}function g(m){var v=o.payload;v.hoverGfx=m.gfx,v.hover=m.element,s("hover")}function h(m){s("out");var v=o.payload;v.hoverGfx=null,v.hover=null}function y(m){var v;if(o){var _=o.active;_&&s("cancel"),v=R(m),_&&s("canceled",v)}}function R(m){var v,_;s("cleanup"),Mb(),o.trapClick?_=f:_=u,Ge.unbind(document,"mousemove",l),Ge.unbind(document,"dragstart",go),Ge.unbind(document,"selectstart",go),Ge.unbind(document,"mousedown",_,!0),Ge.unbind(document,"mouseup",_,!0),Ge.unbind(document,"keyup",p),Ge.unbind(document,"touchstart",d,!0),Ge.unbind(document,"touchcancel",y,!0),Ge.unbind(document,"touchmove",l,!0),Ge.unbind(document,"touchend",u,!0),e.off("element.hover",g),e.off("element.out",h),t.removeMarker(t.getRootElement(),kb);var E=o.payload.previousSelection;return m!==!1&&E&&!n.get().length&&c(E),v=o,o=null,v}function x(m,v,_,E){o&&y(!1),typeof v=="string"&&(E=_,_=v,v=null),E=W({},r,E||{});var T=E.data||{},k,I,P,O,F;if(E.trapClick?O=f:O=u,m?(k=la(m)||m,I=ho(m),Wf(m),k.type==="dragstart"&&go(k)):(k=null,I={x:0,y:0}),P=a(I),v||(v=P),F=Tk(k),o=W({prefix:_,data:T,payload:{},globalStart:I,displacement:Ti(v,P),localStart:P,isTouch:F},E),E.manual||(F?(Ge.bind(document,"touchstart",d,!0),Ge.bind(document,"touchcancel",y,!0),Ge.bind(document,"touchmove",l,!0),Ge.bind(document,"touchend",u,!0)):(Ge.bind(document,"mousemove",l),Ge.bind(document,"dragstart",go),Ge.bind(document,"selectstart",go),Ge.bind(document,"mousedown",O,!0),Ge.bind(document,"mouseup",O,!0)),Ge.bind(document,"keyup",p),e.on("element.hover",g),e.on("element.out",h)),s("init")===!1)return y(),!1;E.autoActivate&&l(m,!0)}e.on("diagram.destroy",y),this.init=x,this.move=l,this.hover=g,this.out=h,this.end=u,this.cancel=y,this.context=function(){return o},this.setOptions=function(m){W(r,m)}}Ob.$inject=["eventBus","canvas","selection","elementRegistry"];const sr={__depends__:[dk,vi],dragging:["type",Ob]};function da(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}da.prototype.next=function(){return this._prefix+ ++this._counter};const Ok=new da("ps");var Dk=["marker-start","marker-mid","marker-end"],Lk=["circle","ellipse","line","path","polygon","polyline","path","rect"];function Ir(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}Ir.$inject=["elementRegistry","eventBus","canvas","styles"],Ir.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")},Ir.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},Ir.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var r=Wg(n);return this._cloneMarkers(uo(r),i),Ee(r,this._styles.cls(i,[])),Ue(t,r),Ee(r,"data-preview-support-element-id",e.id),r},Ir.prototype.addFrame=function(e,t){var n=Oe("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return Ue(t,n),Ee(n,"data-preview-support-element-id",e.id),n},Ir.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(r=>{i._cloneMarkers(r,t,n)}),$k(e)&&Dk.forEach(function(r){if(Ee(e,r)){var o=Ik(e,r,i._canvas.getContainer());o&&i._cloneMarker(n,e,o,r,t)}})},Ir.prototype._cloneMarker=function(e,t,n,i,r="djs-dragger"){var o=[n.id,r,Ok.next()].join("-"),a=St("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||Wg(n);s.id=o,ct(s).add(r);var c=St(":scope > defs",e);c||(c=Oe("defs"),Ue(e,c)),Ue(c,s);var l=Nk(s.id);Ee(t,i,l)};function Ik(e,t,n){var i=Bk(Ee(e,t));return St("marker#"+i,n||document)}function Bk(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function Nk(e){return"url(#"+e+")"}function $k(e){return Lk.indexOf(e.nodeName)!==-1}const ha={__init__:["previewSupport"],previewSupport:["type",Ir]};var Fk="drop-ok",Db="drop-not-ok",Lb="attach-ok",Ib="new-parent",Bb="create",jk=2e3;function Nb(e,t,n,i,r){function o(c,l,u,p,f){if(!l)return!1;c=tt(c,function(x){var m=x.labelTarget;return!x.parent&&!(Je(x)&&c.indexOf(m)!==-1)});var d=Tt(c,function(x){return!Ct(x)}),g=!1,h=!1,y=!1;Fb(c)&&(g=r.allowed("shape.attach",{position:u,shape:d,target:l})),g||(Fb(c)?y=r.allowed("shape.create",{position:u,shape:d,source:p,target:l}):y=r.allowed("elements.create",{elements:c,position:u,target:l}));var R=f.connectionTarget;return y||g?(d&&p&&(h=r.allowed("connection.create",{source:R===p?d:p,target:R===p?p:d,hints:{targetParent:l,targetAttach:g}})),{attach:g,connect:h}):y===null||g===null?null:!1}function a(c,l){[Lb,Fk,Db,Ib].forEach(function(u){u===l?e.addMarker(c,u):e.removeMarker(c,u)})}n.on(["create.move","create.hover"],function(c){var l=c.context,u=l.elements,p=c.hover,f=l.source,d=l.hints||{};if(!p){l.canExecute=!1,l.target=null;return}$b(c);var g={x:c.x,y:c.y},h=l.canExecute=p&&o(u,p,g,f,d);p&&h!==null&&(l.target=p,h&&h.attach?a(p,Lb):a(p,h?Ib:Db))}),n.on(["create.end","create.out","create.cleanup"],function(c){var l=c.hover;l&&a(l,null)}),n.on("create.end",function(c){var l=c.context,u=l.source,p=l.shape,f=l.elements,d=l.target,g=l.canExecute,h=g&&g.attach,y=g&&g.connect,R=l.hints||{};if(g===!1||!d)return!1;$b(c);var x={x:c.x,y:c.y};y?p=i.appendShape(u,p,x,d,{attach:h,connection:y===!0?{}:y,connectionTarget:R.connectionTarget}):(f=i.createElements(f,x,d,W({},R,{attach:h})),p=Tt(f,function(m){return!Ct(m)})),W(l,{elements:f,shape:p}),W(c,{elements:f,shape:p})});function s(){var c=t.context();c&&c.prefix===Bb&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],jk,function(){n.off("elements.changed",s)})}),this.start=function(c,l,u){$e(l)||(l=[l]);var p=Tt(l,function(g){return!Ct(g)});if(p){u=W({elements:l,hints:{},shape:p},u||{}),H(l,function(g){ze(g.x)||(g.x=0),ze(g.y)||(g.y=0)});var f=tt(l,function(g){return!g.hidden}),d=Jt(f);H(l,function(g){Ct(g)&&(g.waypoints=Pn(g.waypoints,function(h){return{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2}})),W(g,{x:g.x-d.x-d.width/2,y:g.y-d.y-d.height/2})}),t.init(c,Bb,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:l,context:u}})}}}Nb.$inject=["canvas","dragging","eventBus","modeling","rules"];function $b(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 Fb(e){return e&&e.length===1&&!Ct(e[0])}var Hk=750;function jb(e,t,n,i,r){function o(a){var s=Oe("g");Ee(s,r.cls("djs-drag-group",["no-events"]));var c=Oe("g");return a.forEach(function(l){var u;l.hidden||(l.waypoints?(u=n._createContainer("connection",c),n.drawConnection(uo(u),l)):(u=n._createContainer("shape",c),n.drawShape(uo(u),l),Cn(u,l.x,l.y)),i.addDragger(l,s,u))}),s}t.on("create.move",Hk,function(a){var s=a.hover,c=a.context,l=c.elements,u=c.dragGroup;u||(u=c.dragGroup=o(l));var p;s?(u.parentNode||(p=e.getActiveLayer(),Ue(p,u)),Cn(u,a.x,a.y)):cn(u)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&cn(c)})}jb.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const El={__depends__:[sr,ha,Wi,vi],__init__:["create","createPreview"],create:["type",Nb],createPreview:["type",jb]};function dd(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)})}dd.$inject=["eventBus"],dd.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||zk(0,0)};function zk(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 ps={__init__:["mouse"],mouse:["type",dd]};var Hb=2e3;function Zn(e,t,n,i,r,o,a,s){this._canvas=e,this._create=t,this._elementFactory=i,this._eventBus=r,this._modeling=o,this._mouse=a,this._rules=s,r.on("copyPaste.copyElement",function(c){var l=c.descriptor,u=c.element,p=c.elementsSet;l.priority=1,l.id=u.id,p.has(u.parent)&&(l.parent=u.parent.id),Gk(u)&&(l.priority=2,l.host=u.host.id),Ct(u)&&(l.priority=3,l.source=u.source.id,l.target=u.target.id,l.waypoints=Vk(u)),Je(u)&&(l.priority=4,l.labelTarget=u.labelTarget.id),H(["x","y","width","height"],function(f){ze(u[f])&&(l[f]=u[f])}),l.hidden=u.hidden,l.collapsed=u.collapsed}),r.on("copyPaste.elementsCopied",Hb,function(c){var l;((l=c.hints)==null?void 0:l.clip)!==!1&&n.set(c.tree)}),r.on("copyPaste.pasteElements",Hb,function(c){c.tree||(c.tree=n.get())}),r.on("copyPaste.pasteElements",function(c){var l=c.hints;W(l,{createElementsBehavior:!1})})}Zn.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],Zn.prototype.copy=function(e,t={}){var n,i;return $e(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree($e(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},Zn.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})}}},Zn.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},Zn.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},Zn.prototype._getElementIdsFromTree=function(e){var t={};return H(e,function(n){H(n,function(i){i.id&&(t[i.id]=!0)})}),t},Zn.prototype._paste=function(e,t,n,i){H(e,function(o){ze(o.x)||(o.x=0),ze(o.y)||(o.y=0)});var r=Jt(e);return H(e,function(o){Ct(o)&&(o.waypoints=Pn(o.waypoints,function(a){return{x:a.x-r.x-r.width/2,y:a.y-r.y-r.height/2}})),W(o,{x:o.x-r.x-r.width/2,y:o.y-r.y-r.height/2})}),this._modeling.createElements(e,n,t,W({},i))},Zn.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return H(e,function(o,a){o=Di(o,"priority"),H(o,function(s){var c=W({},Li(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var l;if(Ct(c)){c.source=i[s.source],c.target=i[s.target],l=i[s.id]=t.createConnection(c),r.push(l);return}if(Je(c)){c.labelTarget=i[c.labelTarget],l=i[s.id]=t.createLabel(c),r.push(l);return}c.host&&(c.host=i[c.host]),l=i[s.id]=t.createShape(c),r.push(l)})}),r},Zn.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(Li(e,["id"]));return t},Zn.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(Li(e,["id"]));return t},Zn.prototype.createShape=function(e){var t=this._elementFactory.createShape(Li(e,["id"]));return t},Zn.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(Ct(e)&&(!n.has(e.source)||!n.has(e.target))||Je(e)&&!n.has(e.labelTarget))},Zn.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[],o=new Map,a=Ic(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 g={element:p,depth:f};r.push(g),o.set(p,g);return}if(d.depth<f){r=l(d,r);var h={element:d.element,depth:f};r.push(h),o.set(p,h)}}function l(p,f){var d=f.indexOf(p);return d!==-1&&f.splice(d,1),f}lo(a,function(p,f,d){if(Je(p))return;H(p.labels,function(y){c(y,d)});function g(y){y&&y.length&&H(y,function(R){H(R.labels,function(x){c(x,d)}),c(R,d)})}H([p.attachers,p.incoming,p.outgoing],g),c(p,d);var h=[];return p.children&&(h=p.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:p,children:h}),h}),e=Pn(r,function(p){return p.element});var u=new Set(e);return r=Pn(r,function(p){return p.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:p.descriptor,element:p.element,elements:e,elementsSet:u}),p}),r=Di(r,function(p){return p.descriptor.priority}),e=Pn(r,function(p){return p.element}),H(r,function(p){var f=p.depth;if(!n.hasRelations(p.element,e,u)){Gb(p.element,e),u.delete(p.element);return}if(!s(p.element,e)){Gb(p.element,e),u.delete(p.element);return}i[f]||(i[f]=[]),i[f].push(p.descriptor)}),i};function Gk(e){return!!e.host}function Vk(e){return Pn(e.waypoints,function(t){return t=zb(t),t.original&&(t.original=zb(t.original)),t})}function zb(e){return W({},e)}function Gb(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const Wk={__depends__:[pk,El,ps,Wi],__init__:["copyPaste"],copyPaste:["type",Zn]};function hd(e,t,n){$e(n)||(n=[n]),H(n,function(i){eo(e[i])||(t[i]=e[i])})}var md=750;function Vb(e,t,n){function i(c,l){var u=e.create(c.$type);return n.copyElement(c,u,null,l)}t.on("copyPaste.copyElement",md,function(c){var l=c.descriptor,u=c.element,p=ue(u);if(Je(u))return l;var f=l.businessObject=i(p,!0),d=l.di=i(pt(u),!0);d.bpmnElement=f,hd(f,l,"name"),hd(d,l,"isExpanded"),p.default&&(l.default=p.default.id)});var r="-bpmn-js-refs";function o(c){return c[r]=c[r]||{}}function a(c,l){c[r]=l}function s(c,l,u){var p=ue(c);return c.default&&(u[c.default]={element:p,property:"default"}),c.host&&(ue(c).attachedToRef=ue(l[c.host])),Li(u,Un(u,function(f,d,g){var h=d.element,y=d.property;return g===c.id&&(h.set(y,p),f.push(c.id)),f},[]))}t.on("copyPaste.pasteElement",function(c){var l=c.cache,u=c.descriptor,p=u.businessObject,f=u.di;if(Je(u)){u.businessObject=ue(l[u.labelTarget]),u.di=pt(l[u.labelTarget]);return}p=u.businessObject=i(p),f=u.di=i(f),f.bpmnElement=p,hd(u,p,["isExpanded","name"]),u.type=p.$type}),t.on("copyPaste.copyElement",md,function(c){var l=c.descriptor,u=c.element;if(C(u,"bpmn:Participant")){var p=ue(u);p.processRef&&(l.processRef=i(p.processRef,!0))}}),t.on("copyPaste.pasteElement",function(c){var l=c.descriptor,u=l.processRef;u&&(l.processRef=i(u))}),t.on("copyPaste.createTree",function(c){var l=c.element,u=c.children;C(l,"bpmn:SubProcess")&&H(Qa(u),p=>{u.push(p.annotation)})}),t.on("copyPaste.pasteElement",md,function(c){var l=c.cache,u=c.descriptor;a(l,s(u,l,o(l)))})}Vb.$inject=["bpmnFactory","eventBus","moddleCopy"];const Uk=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],qk=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function fs(e,t,n){this._bpmnFactory=t,this._eventBus=e,this._moddle=n,e.on("moddleCopy.canCopyProperties",i=>{const{propertyNames:r}=i;if(!(!r||!r.length))return Di(r,o=>o==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:r,property:o,propertyName:a}=i,s=dn(r)&&r.$descriptor;if(a&&qk.includes(a))return o;if(a&&Uk.includes(a)||a&&s&&!Tt(s.properties,Io({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",i=>{const{property:r}=i;if(C(r,"bpmn:ExtensionElements")&&(!r.values||!r.values.length))return!1})}fs.$inject=["eventBus","bpmnFactory","moddle"],fs.prototype.copyElement=function(e,t,n,i=!1){n&&!$e(n)&&(n=[n]),n=n||gd(e.$descriptor);const r=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return r===!1||($e(r)&&(n=r),H(n,o=>{let a;Wn(e,o)&&(a=e.get(o));const s=this.copyProperty(a,t,o,i);!an(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:o})===!1||t.set(o,s)})),t},fs.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 dn(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):$e(e)?Un(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):dn(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},fs.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 gd(e,t){return Un(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const Wb={__depends__:[Wk],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",Vb],moddleCopy:["type",fs]};var Ub=Math.round;function yd(e,t){this._modeling=e,this._eventBus=t}yd.$inject=["modeling","eventBus"],yd.prototype.replaceElement=function(e,t,n){if(e.waypoints)return null;var i=this._modeling,r=this._eventBus;r.fire("replace.start",{element:e,attrs:t,hints:n});var o=t.width||e.width,a=t.height||e.height,s=t.x||e.x,c=t.y||e.y,l=Ub(s+o/2),u=Ub(c+a/2),p=i.replaceShape(e,W({},t,{x:l,y:u,width:o,height:a}),n);return r.fire("replace.end",{element:e,newElement:p,hints:n}),p};function qb(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:r={}}=n;r.select!==!1&&e.select(i)})}qb.$inject=["selection","eventBus"];const Yk={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",qb],replace:["type",yd]};function Kk(e,t,n){$e(n)||(n=[n]),H(n,function(i){eo(e[i])||(t[i]=e[i])})}var Xk=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function Zk(e,t){var n=e&&Wn(e,"collapsed")?e.collapsed:!at(e),i;return t&&(Wn(t,"collapsed")||Wn(t,"isExpanded"))?i=Wn(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function Yb(e,t,n,i,r,o){function a(s,c,l){l=l||{};var u=c.type,p=s.businessObject;if(Sl(p)&&(u==="bpmn:SubProcess"||u==="bpmn:AdHocSubProcess")&&Zk(s,c))return i.toggleCollapse(s),s;var f=e.create(u),d={type:u,businessObject:f};d.di={},u==="bpmn:ExclusiveGateway"&&(d.di.isMarkerVisible=!0),Kk(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var g=gd(p.$descriptor),h=gd(f.$descriptor,!0),y=Qk(g,h);W(f,Mi(c,Xk));var R=tt(y,function(v){return v==="eventDefinitions"?Kb(s,c.eventDefinitionType):v==="loopCharacteristics"?!Ln(f):Wn(f,v)||v==="processRef"&&c.isExpanded===!1||v==="triggeredByEvent"?!1:v==="isForCompensation"?!Ln(f):!0});if(f=n.copyElement(p,f,R),c.eventDefinitionType&&(Kb(f,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),C(p,"bpmn:Activity")){if(Sl(p))d.isExpanded=at(s);else if(c&&Wn(c,"isExpanded")){d.isExpanded=c.isExpanded;var x=t.getDefaultSize(f,{isExpanded:d.isExpanded});d.width=x.width,d.height=x.height,d.x=s.x-(d.width-s.width)/2,d.y=s.y-(d.height-s.height)/2}at(s)&&!C(p,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(Sl(p)&&!Sl(f)&&(l.moveChildren=!1),C(p,"bpmn:Participant")){c.isExpanded===!0?f.processRef=e.create("bpmn:Process"):l.moveChildren=!1;var m=gn(s);pt(s).isHorizontal||(pt(d).isHorizontal=m),d.width=m?s.width:t.getDefaultSize(d).width,d.height=m?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,et(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&et(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(f.default=p.default),c.host&&!C(p,"bpmn:BoundaryEvent")&&C(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,{...l,targetElement:c})}this.replaceElement=a}Yb.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function Sl(e){return C(e,"bpmn:SubProcess")}function Kb(e,t){var n=ue(e);return t&&n.get("eventDefinitions").some(function(i){return C(i,t)})}function Qk(e,t){return e.filter(function(n){return t.includes(n)})}const Xb={__depends__:[Wb,Yk,vi],bpmnReplace:["type",Yb]};var Jk=250;function yo(e){this._eventBus=e,this._tools=[],this._active=null}yo.$inject=["eventBus"],yo.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)},yo.prototype.isActive=function(e){return e&&this._active===e},yo.prototype.length=function(e){return this._tools.length},yo.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},yo.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),H(t,function(r){i.push(r+".ended"),i.push(r+".canceled")}),n.on(i,Jk,function(r){this._active&&(e2(r)||this.setActive(null))},this)};function e2(e){var t=e.originalEvent&&e.originalEvent.target;return t&&so(t,'.group[data-group="tools"]')}const Rl={__depends__:[sr],__init__:["toolManager"],toolManager:["type",yo]};function t2(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 n2(e,t){var n=[],i=new Set(e);H(t,function(o){i.add(o)});var r=new Set;return i.forEach(function(o){var a=o.incoming,s=o.outgoing;H(a.concat(s),function(c){var l=c.source,u=c.target;(i.has(l)||i.has(u))&&(r.has(c)||(r.add(c),n.push(c)))})}),n}function i2(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 vd=Math.abs,r2=Math.round,cr={x:"width",y:"height"},Zb="crosshair",Br={n:"top",w:"left",s:"bottom",e:"right"},o2=1500,Cl={n:"s",w:"e",s:"n",e:"w"},Al=20;function bi(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",o2,function(c){var l=c.context,u=l.initialized;u||(u=l.initialized=s.init(c,l)),u&&Jb(c)}),n.on("spaceTool.end",function(c){var l=c.context,u=l.axis,p=l.direction,f=l.movingShapes,d=l.resizingShapes,g=l.start;if(l.initialized){Jb(c);var h={x:0,y:0};h[u]=r2(c["d"+u]),s.makeSpace(f,d,h,p,g),n.once("spaceTool.ended",function(y){s.activateSelection(y.originalEvent,!0,!0)})}})}bi.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],bi.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:Zb,data:{context:{reactivate:n}},trapClick:!1})},bi.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:Zb,data:{context:{}}})},bi.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},bi.prototype.init=function(e,t){var n=vd(e.dx)>vd(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(vd(i)<5)return!1;i<0&&(i*=-1),cs(e)&&(i*=-1);var o=t2(n,i),a=this._canvas.getRootElement();!hl(e)&&e.hover&&(a=e.hover);var s=[...Ua(a),...a.attachers||[]],c=this.calculateAdjustments(s,n,i,r),l=this._eventBus.fire("spaceTool.getMinDimensions",{axis:n,direction:o,shapes:c.resizingShapes,start:r}),u=a2(c,n,o,r,l);return W(t,c,{axis:n,direction:o,spaceToolConstraints:u,start:r}),wl("resize-"+(n==="x"?"ew":"ns")),!0},bi.prototype.calculateAdjustments=function(e,t,n,i){var r=this._rules,o=[],a=[],s=new Set,c=new Set,l=[],u=[];function p(d){s.has(d)||(s.add(d),o.push(d));var g=d.label;g&&!s.has(g)&&(s.add(g),o.push(g))}function f(d){c.has(d)||(c.add(d),a.push(d))}return H(e,function(d){if(!(!d.parent||Je(d))){if(Ct(d)){u.push(d);return}var g=d[t],h=g+d[cr[t]];if(s2(d)&&(n>0&&Fe(d)[t]>i||n<0&&Fe(d)[t]<i)){l.push(d);return}if(n>0&&g>i||n<0&&h<i){p(d);return}if(g<i&&h>i&&r.allowed("shape.resize",{shape:d})){f(d);return}}}),H(o,function(d){var g=d.attachers;g&&H(g,function(h){p(h)})}),H(l,function(d){var g=d.host;(s.has(g)||c.has(g))&&p(d)}),H(u,function(d){var g=d.source,h=d.target,y=d.label;(s.has(g)||c.has(g))&&(s.has(h)||c.has(h))&&y&&p(y)}),{movingShapes:o,resizingShapes:a}},bi.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},bi.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function Qb(e){return{top:e.top-Al,right:e.right+Al,bottom:e.bottom+Al,left:e.left-Al}}function Jb(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,r;ze(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),ze(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),ze(n.top)&&(r=Math.max(e.y,n.top),e.dy=e.dy+r-e.y,e.y=r),ze(n.bottom)&&(r=Math.min(e.y,n.bottom),e.dy=e.dy+r-e.y,e.y=r)}}function a2(e,t,n,i,r){var o=e.movingShapes,a=e.resizingShapes;if(a.length){var s={},c,l,u=new Set(o),p=new Set(a);return H(a,function(f){var d=f.attachers,g=f.children,h=Ie(f),y=tt(g,function(F){return!Ct(F)&&!Je(F)&&!u.has(F)&&!p.has(F)}),R=tt(g,function(F){return!Ct(F)&&!Je(F)&&u.has(F)}),x,m,v,_=[],E=[],T,k,I,P;y.length&&(m=Qb(Ie(Jt(y))),x=i-h[Br[n]]+m[Br[n]],n==="n"?s.bottom=l=ze(l)?Math.min(l,x):x:n==="w"?s.right=l=ze(l)?Math.min(l,x):x:n==="s"?s.top=c=ze(c)?Math.max(c,x):x:n==="e"&&(s.left=c=ze(c)?Math.max(c,x):x)),R.length&&(v=Qb(Ie(Jt(R))),x=i-v[Br[Cl[n]]]+h[Br[Cl[n]]],n==="n"?s.bottom=l=ze(l)?Math.min(l,x):x:n==="w"?s.right=l=ze(l)?Math.min(l,x):x:n==="s"?s.top=c=ze(c)?Math.max(c,x):x:n==="e"&&(s.left=c=ze(c)?Math.max(c,x):x)),d&&d.length&&(d.forEach(function(F){u.has(F)?_.push(F):E.push(F)}),_.length&&(T=Ie(Jt(_.map(Fe))),k=h[Br[Cl[n]]]-(T[Br[Cl[n]]]-i)),E.length&&(I=Ie(Jt(E.map(Fe))),P=I[Br[n]]-(h[Br[n]]-i)),n==="n"?(x=Math.min(k||1/0,P||1/0),s.bottom=l=ze(l)?Math.min(l,x):x):n==="w"?(x=Math.min(k||1/0,P||1/0),s.right=l=ze(l)?Math.min(l,x):x):n==="s"?(x=Math.max(k||-1/0,P||-1/0),s.top=c=ze(c)?Math.max(c,x):x):n==="e"&&(x=Math.max(k||-1/0,P||-1/0),s.left=c=ze(c)?Math.max(c,x):x));var O=r&&r[f.id];O&&(n==="n"?(x=i+f[cr[t]]-O[cr[t]],s.bottom=l=ze(l)?Math.min(l,x):x):n==="w"?(x=i+f[cr[t]]-O[cr[t]],s.right=l=ze(l)?Math.min(l,x):x):n==="s"?(x=i-f[cr[t]]+O[cr[t]],s.top=c=ze(c)?Math.max(c,x):x):n==="e"&&(x=i-f[cr[t]]+O[cr[t]],s.left=c=ze(c)?Math.max(c,x):x))}),s}}function s2(e){return!!e.host}var bd="djs-dragging",ex="djs-resizing",c2=250,Ml=Math.max;function tx(e,t,n,i,r){function o(a,s){H(a,function(c){r.addDragger(c,s),n.addMarker(c,bd)})}e.on("spaceTool.selection.start",function(a){var s=n.getLayer("space"),c=a.context,l={x:"M 0,-10000 L 0,10000",y:"M -10000,0 L 10000,0"},u=Oe("g");Ee(u,i.cls("djs-crosshair-group",["no-events"])),Ue(s,u);var p=Oe("path");Ee(p,"d",l.x),ct(p).add("djs-crosshair"),Ue(u,p);var f=Oe("path");Ee(f,"d",l.y),ct(f).add("djs-crosshair"),Ue(u,f),c.crosshairGroup=u}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;Cn(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&cn(c)}),e.on("spaceTool.move",c2,function(a){var s=a.context,c=s.line,l=s.axis,u=s.movingShapes,p=s.resizingShapes;if(s.initialized){if(!s.dragGroup){var f=n.getLayer("space");c=Oe("path"),Ee(c,"d","M0,0 L0,0"),ct(c).add("djs-crosshair"),Ue(f,c),s.line=c;var d=Oe("g");Ee(d,i.cls("djs-drag-group",["no-events"])),Ue(n.getActiveLayer(),d),o(u,d);var g=new Set(u);H(p,function(E){g.add(E)});var h=new Set,y=s.movingConnections=[];g.forEach(function(E){H(E.outgoing,function(T){h.has(T)||!Ct(T)||!g.has(T.target)||(h.add(T),y.push(T))})}),o(y,d),s.dragGroup=d}if(!s.frameGroup){var R=Oe("g");Ee(R,i.cls("djs-frame-group",["no-events"])),Ue(n.getActiveLayer(),R);var x=[];H(p,function(E){var T=r.addFrame(E,R),k=T.getBBox();x.push({element:T,initialBounds:k}),n.addMarker(E,ex)}),s.frameGroup=R,s.frames=x}var m={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};Ee(c,{d:m[l]});var v={x:"y",y:"x"},_={x:a.dx,y:a.dy};_[v[s.axis]]=0,Cn(s.dragGroup,_.x,_.y),H(s.frames,function(E){var T=E.element,k=E.initialBounds,I,P;s.direction==="e"?Ee(T,{width:Ml(k.width+_.x,5)}):(I=Ml(k.width-_.x,5),Ee(T,{width:I,x:k.x+k.width-I})),s.direction==="s"?Ee(T,{height:Ml(k.height+_.y,5)}):(P=Ml(k.height-_.y,5),Ee(T,{height:P,y:k.y+k.height-P}))})}}),e.on("spaceTool.cleanup",function(a){var s=a.context,c=s.movingShapes,l=s.movingConnections,u=s.resizingShapes,p=s.line,f=s.dragGroup,d=s.frameGroup;H(c,function(g){n.removeMarker(g,bd)}),H(l,function(g){n.removeMarker(g,bd)}),f&&(cn(p),cn(f)),H(u,function(g){n.removeMarker(g,ex)}),d&&cn(d)})}tx.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const l2={__init__:["spaceToolPreview"],__depends__:[sr,Wi,Rl,ha,ps],spaceTool:["type",bi],spaceToolPreview:["type",tx]};function Pl(e,t){e.invoke(bi,this),this._canvas=t}Pl.$inject=["injector","canvas"],we(Pl,bi),Pl.prototype.calculateAdjustments=function(e,t,n,i){var r=this._canvas.getRootElement(),o=e[0]===r?null:e[0],a=[];o&&(a=Do(Xo(r.children.filter(l=>C(l,"bpmn:Artifact")),Jt(o))));const s=[...e,...a];var c=bi.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(l){return!(C(l,"bpmn:TextAnnotation")||u2(l)&&(t==="y"&&gn(l)||t==="x"&&!gn(l)))}),c};function u2(e){return C(e,"bpmn:Participant")&&!ue(e).processRef}const nx={__depends__:[l2],spaceTool:["type",Pl]};function jt(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)}jt.$inject=["eventBus","injector"],jt.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()},jt.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},jt.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},jt.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()}},jt.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()}},jt.prototype.register=function(e,t){this._setHandler(e,t)},jt.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)},jt.prototype.canUndo=function(){return!!this._getUndoAction()},jt.prototype.canRedo=function(){return!!this._getRedoAction()},jt.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},jt.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},jt.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)})},jt.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},jt.prototype._createId=function(){return this._uid++},jt.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},jt.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()},jt.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)},jt.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:Qh("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},jt.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=$e(e)?e:[e],t.dirty=t.dirty.concat(e))},jt.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},jt.prototype._revertedAction=function(e){this._stackIdx--},jt.prototype._getHandler=function(e){return this._handlerMap[e]},jt.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 p2={commandStack:["type",jt]};function Nr(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 f2=250,ix=1400;function xd(e,t,n){ce.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",ix,function(r){var o=r.context,a=o.shapes,s=o.validatedShapes;o.shapes=rx(a),o.validatedShapes=rx(s)}),i&&t.on("shape.move.start",f2,function(r){var o=r.context,a=new Set(o.shapes),s=new Set;for(const c of a)for(const l of c.labels)!l.hidden&&!a.has(l)&&s.add(l),c.labelTarget&&s.add(c);for(const c of s)i.makeDraggable(o,c,!0)}),this.preExecuted("elements.move",ix,function(r){var o=r.context,a=o.closure,s=a.enclosedElements,c=[];H(s,function(l){H(l.labels,function(u){s[u.id]||c.push(u)})}),a.addAll(c)}),this.preExecute(["connection.delete","shape.delete"],function(r){var o=r.context,a=o.connection||o.shape;Nr(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=Qp(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&&(qt(s.labels,a,c),a.labelTarget=s)})}we(xd,ce),xd.$inject=["injector","eventBus","modeling"];function rx(e){var t=new Set(e);return tt(e,function(n){return!t.has(n.labelTarget)})}const d2={__init__:["labelSupport"],labelSupport:["type",xd]};var h2=251,ox=1401,ax="attach-ok";function _d(e,t,n,i,r){ce.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",ox,function(a){var s=a.context,c=s.shapes,l=s.validatedShapes;s.shapes=m2(c),s.validatedShapes=g2(l)}),o&&t.on("shape.move.start",h2,function(a){var s=a.context,c=s.shapes,l=wd(c);H(l,function(u){o.makeDraggable(s,u,!0),H(u.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 l=c[0],u=l.host;u&&(n.addMarker(u,ax),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(u,ax)}))}}),this.preExecuted("elements.move",ox,function(a){var s=a.context,c=s.closure,l=s.shapes,u=wd(l);H(u,function(p){c.add(p,c.topLevel[p.host.id])})}),this.postExecuted("elements.move",function(a){var s=a.context,c=s.shapes,l=s.newHost,u;l&&c.length!==1||(l?u=c:u=tt(c,function(p){var f=p.host;return y2(p)&&!v2(c,f)}),H(u,function(p){r.updateAttachment(p,l)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;H(s,function(c){H(c.attachers,function(l){H(l.outgoing.slice(),function(u){var p=i.allowed("connection.reconnect",{connection:u,source:u.source,target:u.target});p||r.removeConnection(u)}),H(l.incoming.slice(),function(u){var p=i.allowed("connection.reconnect",{connection:u,source:u.source,target:u.target});p||r.removeConnection(u)})})})}),this.postExecute("shape.create",function(a){var s=a.context,c=s.shape,l=s.host;l&&r.updateAttachment(c,l)}),this.postExecute("shape.replace",function(a){var s=a.context,c=s.oldShape,l=s.newShape;Nr(c.attachers,function(u){var p=i.allowed("elements.move",{target:l,shapes:[u]});p==="attach"?r.updateAttachment(u,l):r.removeShape(u)}),l.attachers.length&&H(l.attachers,function(u){var p=Sv(u,c,l);r.moveShape(u,p,u.parent)})}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.oldBounds,u=s.newBounds,p=c.attachers,f=s.hints||{};f.attachSupport!==!1&&H(p,function(d){var g=Sv(d,l,u);r.moveShape(d,g,d.parent),H(d.labels,function(h){r.moveShape(h,g,h.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;Nr(s.attachers,function(c){r.removeShape(c)}),s.host&&r.updateAttachment(s,null)})}we(_d,ce),_d.$inject=["injector","eventBus","canvas","rules","modeling"];function wd(e){return Ku(Pn(e,function(t){return t.attachers||[]}))}function m2(e){var t=wd(e);return QE("id",e,t)}function g2(e){var t=Lo(e,"id");return tt(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function y2(e){return!!e.host}function v2(e,t){return e.indexOf(t)!==-1}const b2={__depends__:[Wi],__init__:["attachSupport"],attachSupport:["type",_d]};function sx(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(Jg(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)})}sx.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const Ed={__init__:["changeSupport"],changeSupport:["type",sx]};function xi(e){this._model=e}xi.$inject=["moddle"],xi.prototype._needsId=function(e){return et(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"])},xi.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;C(e,"bpmn:Activity")?t="Activity":C(e,"bpmn:Event")?t="Event":C(e,"bpmn:Gateway")?t="Gateway":et(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))},xi.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},xi.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},xi.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",W({bpmnElement:e,bounds:this.createDiBounds()},t))},xi.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},xi.prototype.createDiWaypoints=function(e){var t=this;return Pn(e,function(n){return t.createDiWaypoint(n)})},xi.prototype.createDiWaypoint=function(e){return this.create("dc:Point",Mi(e,["x","y"]))},xi.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",W({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},xi.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",W({bpmnElement:e},t))};function Qn(e,t,n){ce.call(this,e),this._bpmnFactory=t;var i=this;function r(d){var g=d.context,h=g.hints||{},y;!g.cropped&&h.createElementsBehavior!==!1&&(y=g.connection,y.waypoints=n.getCroppedWaypoints(y),g.cropped=!0)}this.executed(["connection.layout","connection.create"],r),this.reverted(["connection.layout"],function(d){delete d.context.cropped});function o(d){var g=d.context;i.updateParent(g.shape||g.connection,g.oldParent)}function a(d){var g=d.context,h=g.shape||g.connection,y=g.parent||g.newParent;i.updateParent(h,y)}this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],Jn(o)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],Jn(a));function s(d){var g=d.context,h=g.oldRoot,y=h.children;H(y,function(R){C(R,"bpmn:BaseElement")&&i.updateParent(R)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(d){var g=d.context.shape;C(g,"bpmn:BaseElement")&&i.updateBounds(g)}this.executed(["shape.move","shape.create","shape.resize"],Jn(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],Jn(function(d){d.context.shape.type!=="label"&&c(d)})),e.on("shape.changed",function(d){d.element.type==="label"&&c({context:{shape:d.element}})});function l(d){i.updateConnection(d.context)}this.executed(["connection.create","connection.move","connection.delete","connection.reconnect"],Jn(l)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],Jn(l));function u(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],Jn(u)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],Jn(u)),this.executed("connection.reconnect",Jn(function(d){var g=d.context,h=g.connection,y=g.oldSource,R=g.newSource,x=ue(h),m=ue(y),v=ue(R);x.conditionExpression&&!et(v,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(g.oldConditionExpression=x.conditionExpression,delete x.conditionExpression),y!==R&&m.default===x&&(g.oldDefault=m.default,delete m.default)})),this.reverted("connection.reconnect",Jn(function(d){var g=d.context,h=g.connection,y=g.oldSource,R=g.newSource,x=ue(h),m=ue(y),v=ue(R);g.oldConditionExpression&&(x.conditionExpression=g.oldConditionExpression),g.oldDefault&&(m.default=g.oldDefault,delete v.default)}));function p(d){i.updateAttachment(d.context)}this.executed(["element.updateAttachment"],Jn(p)),this.reverted(["element.updateAttachment"],Jn(p)),this.executed("element.updateLabel",Jn(f)),this.reverted("element.updateLabel",Jn(f));function f(d){const{element:g}=d.context,h=li(g),y=pt(g),R=y&&y.get("label");Tr(g)||ml(g)||(h&&!R?y.set("label",t.create("bpmndi:BPMNLabel")):!h&&R&&y.set("label",void 0))}}we(Qn,ce),Qn.$inject=["eventBus","bpmnFactory","connectionDocking"],Qn.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},Qn.prototype.updateParent=function(e,t){if(!Je(e)&&!(C(e,"bpmn:DataStoreReference")&&e.parent&&C(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=pt(e),o=n&&n.businessObject,a=pt(n);C(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,o,t&&t.businessObject),C(e,"bpmn:DataOutputAssociation")&&(e.source?o=e.source.businessObject:o=null),C(e,"bpmn:DataInputAssociation")&&(e.target?o=e.target.businessObject:o=null),this.updateSemanticParent(i,o),C(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,o),this.updateDiParent(r,a)}},Qn.prototype.updateBounds=function(e){var t=pt(e),n=_2(e);if(n){var i=Ti(n,t.get("bounds"));W(n,{x:e.x+i.x,y:e.y+i.y})}var r=Je(e)?this._getLabel(t):t,o=r.bounds;o||(o=this._bpmnFactory.createDiBounds(),r.set("bounds",o)),W(o,{x:e.x,y:e.y,width:e.width,height:e.height})},Qn.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,r;C(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),Wt(i,e)),C(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),qt(r,e))}},Qn.prototype.updateDiConnection=function(e,t,n){var i=pt(e),r=pt(t),o=pt(n);i.sourceElement&&i.sourceElement.bpmnElement!==ue(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==ue(n)&&(i.targetElement=n&&o)},Qn.prototype.updateDiParent=function(e,t){if(t&&!C(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(Wt(n,e),e.$parent=null)}};function x2(e){for(;e&&!C(e,"bpmn:Definitions");)e=e.$parent;return e}Qn.prototype.getLaneSet=function(e){var t,n;return C(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(C(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)},Qn.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&!((C(e,"bpmn:DataInput")||C(e,"bpmn:DataOutput"))&&(C(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(C(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(C(e,"bpmn:FlowElement")){if(t){if(C(t,"bpmn:Participant"))t=t.processRef;else if(C(t,"bpmn:Lane"))do t=t.$parent.$parent;while(C(t,"bpmn:Lane"))}i="flowElements"}else if(C(e,"bpmn:Artifact")){for(;t&&!C(t,"bpmn:Process")&&!C(t,"bpmn:SubProcess")&&!C(t,"bpmn:Collaboration");)if(C(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;i="artifacts"}else if(C(e,"bpmn:MessageFlow"))i="messageFlows";else if(C(e,"bpmn:Participant")){i="participants";var r=e.processRef,o;r&&(o=x2(e.$parent||t),e.$parent&&(Wt(o.get("rootElements"),r),r.$parent=null),t&&(qt(o.get("rootElements"),r),r.$parent=o))}else C(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":C(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),Wt(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);Wt(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},Qn.prototype.updateConnectionWaypoints=function(e){var t=pt(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},Qn.prototype.updateConnection=function(e){var t=e.connection,n=ue(t),i=t.source,r=ue(i),o=t.target,a=ue(t.target),s;if(C(n,"bpmn:DataAssociation"))C(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=r,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):C(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||r,this.updateSemanticParent(n,r,s),n.targetRef=a);else{var c=C(n,"bpmn:SequenceFlow");n.sourceRef!==r&&(c&&(Wt(n.sourceRef&&n.sourceRef.get("outgoing"),n),r&&r.get("outgoing")&&r.get("outgoing").push(n)),n.sourceRef=r),n.targetRef!==a&&(c&&(Wt(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)},Qn.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function Jn(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;C(i,"bpmn:BaseElement")&&e(t)}}function _2(e){if(C(e,"bpmn:Activity")){var t=pt(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function $r(e,t){ir.call(this),this._bpmnFactory=e,this._moddle=t}we($r,ir),$r.$inject=["bpmnFactory","moddle"],$r.prototype._baseCreate=ir.prototype.create,$r.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,W({type:"label",di:n},po,t))}return this.createElement(e,t)},$r.prototype.createElement=function(e,t){t=W({},t||{});var n,i=t.businessObject,r=t.di;if(!i){if(!t.type)throw new Error("no shape type specified");i=this._bpmnFactory.create(t.type)}if(!E2(r)){var o=W({},r||{},{id:i.id+"_di"});e==="root"?r=this._bpmnFactory.createDiPlane(i,o):e==="connection"?r=this._bpmnFactory.createDiEdge(i,o):r=this._bpmnFactory.createDiShape(i,o)}C(i,"bpmn:Group")&&(t=W({isFrame:!0},t)),t=w2(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=Sd(r,t,"isExpanded")),et(i,["bpmn:Lane","bpmn:Participant"])&&(t=Sd(r,t,"isHorizontal")),C(i,"bpmn:SubProcess")&&(t.collapsed=!at(i,r)),C(i,"bpmn:ExclusiveGateway")&&(Wn(r,"isMarkerVisible")?r.isMarkerVisible===void 0&&(r.isMarkerVisible=!1):r.isMarkerVisible=!0),an(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),an(t.cancelActivity)&&(i.cancelActivity=t.cancelActivity,delete t.cancelActivity);var a,s;return t.eventDefinitionType&&(a=i.get("eventDefinitions")||[],s=this._bpmnFactory.create(t.eventDefinitionType,t.eventDefinitionAttrs),t.eventDefinitionType==="bpmn:ConditionalEventDefinition"&&(s.condition=this._bpmnFactory.create("bpmn:FormalExpression")),a.push(s),s.$parent=i,i.eventDefinitions=a,delete t.eventDefinitionType),n=this.getDefaultSize(i,r),t=W({id:i.id},n,t,{businessObject:i,di:r}),this._baseCreate(e,t)},$r.prototype.getDefaultSize=function(e,t){var n=ue(e);if(t=t||pt(e),C(n,"bpmn:SubProcess"))return at(n,t)?{width:350,height:200}:{width:100,height:80};if(C(n,"bpmn:Task"))return{width:100,height:80};if(C(n,"bpmn:Gateway"))return{width:50,height:50};if(C(n,"bpmn:Event"))return{width:36,height:36};if(C(n,"bpmn:Participant")){var i=t.isHorizontal===void 0||t.isHorizontal===!0;return at(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return C(n,"bpmn:Lane")?{width:400,height:100}:C(n,"bpmn:DataObjectReference")?{width:36,height:50}:C(n,"bpmn:DataStoreReference")?{width:50,height:50}:C(n,"bpmn:TextAnnotation")?{width:100,height:40}:C(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},$r.prototype.createParticipantShape=function(e){return dn(e)||(e={isExpanded:e}),e=W({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function w2(e,t,n){return H(n,function(i){t=Sd(e,t,i)}),t}function Sd(e,t,n){return t[n]===void 0?t:(e[n]=t[n],Li(t,[n]))}function E2(e){return et(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function Tl(e,t){this._modeling=e,this._canvas=t}Tl.$inject=["modeling","canvas"],Tl.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;H(n,function(r){var o={x:0,y:0};an(i.left)?o.x=i.left-r.x:an(i.right)?o.x=i.right-r.width-r.x:an(i.center)?o.x=i.center-Math.round(r.width/2)-r.x:an(i.top)?o.y=i.top-r.y:an(i.bottom)?o.y=i.bottom-r.height-r.y:an(i.middle)&&(o.y=i.middle-Math.round(r.height/2)-r.y),t.moveElements([r],o,r.parent)})},Tl.prototype.postExecute=function(e){};function kl(e){this._modeling=e}kl.$inject=["modeling"],kl.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},kl.prototype.postExecute=function(e){var t=e.hints||{};S2(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 S2(e,t){return vr(e.outgoing,function(n){return n.target===t})}function Ol(e,t){this._canvas=e,this._layouter=t}Ol.$inject=["canvas","layouter"],Ol.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},Ol.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var Dl=Math.round;function Rd(e){this._modeling=e}Rd.$inject=["modeling"],Rd.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,r=e.position,o=e.hints,a=this._modeling;H(t,function(p){ze(p.x)||(p.x=0),ze(p.y)||(p.y=0)});var s=tt(t,function(p){return!p.hidden}),c=Jt(s);H(t,function(p){Ct(p)&&(p.waypoints=Pn(p.waypoints,function(f){return{x:Dl(f.x-c.x-c.width/2+r.x),y:Dl(f.y-c.y-c.height/2+r.y)}})),W(p,{x:Dl(p.x-c.x-c.width/2+r.x),y:Dl(p.y-c.y-c.height/2+r.y)})});var l=new Set(Ic(t)),u={};H(t,function(p){if(Ct(p)){u[p.id]=ze(i)?a.createConnection(u[p.source.id],u[p.target.id],i,p,p.parent||n,o):a.createConnection(u[p.source.id],u[p.target.id],p,p.parent||n,o);return}var f=W({},o);l.has(p)||(f.autoResize=!1),Je(p)&&(f=Li(f,["attach"])),u[p.id]=ze(i)?a.createShape(p,Mi(p,["x","y","width","height"]),p.parent||n,i,f):a.createShape(p,Mi(p,["x","y","width","height"]),p.parent||n,f)}),e.elements=Do(u)};var cx=Math.round;function Fr(e){this._canvas=e}Fr.$inject=["canvas"],Fr.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,r=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return n.width!==void 0?W(t,n):W(t,{x:n.x-cx(t.width/2),y:n.y-cx(t.height/2)}),this._canvas.addShape(t,i,r),t},Fr.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function ds(e){Fr.call(this,e)}we(ds,Fr),ds.$inject=["canvas"];var R2=Fr.prototype.execute;ds.prototype.execute=function(e){var t=e.shape;return A2(t),t.labelTarget=e.labelTarget,R2.call(this,e)};var C2=Fr.prototype.revert;ds.prototype.revert=function(e){return e.shape.labelTarget=null,C2.call(this,e)};function A2(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function hs(e,t){this._canvas=e,this._modeling=t}hs.$inject=["canvas","modeling"],hs.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;Nr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),Nr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},hs.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=Qp(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},hs.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,qt(n.children,t,i),this._canvas.addConnection(t,n),t};function Cd(e,t){this._modeling=e,this._elementRegistry=t}Cd.$inject=["modeling","elementRegistry"],Cd.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;H(i,function(r){n.get(r.id)&&(r.waypoints?t.removeConnection(r):t.removeShape(r))})};function ms(e,t){this._canvas=e,this._modeling=t}ms.$inject=["canvas","modeling"],ms.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;Nr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),Nr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),Nr(n.children,function(i){Ct(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},ms.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=Qp(i.children,n),t.removeShape(n),n},ms.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return qt(i.children,n,r),t.addShape(n,i),n};function Ll(e){this._modeling=e}Ll.$inject=["modeling"];var lx={x:"y",y:"x"};Ll.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(y,R){y.range.min=Math.min(R[i],y.range.min),y.range.max=Math.max(R[i]+R[r],y.range.max)}function a(y){return y[i]+y[r]/2}function s(y){return y.length-1}function c(y){return y.max-y.min}function l(y,R){var x={y:0};x[i]=y-a(R),x[i]&&(x[lx[i]]=0,t.moveElements([R],x,R.parent))}var u=n[0],p=s(n),f=n[p],d,g,h=0;H(n,function(y,R){var x,m,v;if(y.elements.length<2){R&&R!==n.length-1&&(o(y,y.elements[0]),h+=c(y.range));return}x=Di(y.elements,i),m=x[0],R===p&&(m=x[s(x)]),v=a(m),y.range=null,H(x,function(_){if(l(v,_),y.range===null){y.range={min:_[i],max:_[i]+_[r]};return}o(y,_)}),R&&R!==n.length-1&&(h+=c(y.range))}),g=Math.abs(f.range.min-u.range.max),d=Math.round((g-h)/(n.length-1)),!(d<n.length-1)&&H(n,function(y,R){var x={},m;y===u||y===f||(m=n[R-1],y.range.max=0,H(y.elements,function(v,_){x[lx[i]]=0,x[i]=m.range.max-v[i]+d,y.range.min!==v[i]&&(x[i]+=v[i]-y.range.min),x[i]&&t.moveElements([v],x,v.parent),y.range.max=Math.max(v[i]+v[r],_?y.range.max:0)}))})},Ll.prototype.postExecute=function(e){};function Il(e,t){this._layouter=e,this._canvas=t}Il.$inject=["layouter","canvas"],Il.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return W(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},Il.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function Ad(){}Ad.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=Wt(o.children,t),qt(i.children,t,r),t.parent=i,H(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},Ad.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return Wt(n.children,t),qt(i.children,t,r),t.parent=i,H(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 Md(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}Md.prototype.add=function(e,t){return this.addAll([e],t)},Md.prototype.addAll=function(e,t){var n=iA(e,!!t,this);return W(this,n),this};function gs(e){this._modeling=e}gs.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},gs.prototype.moveClosure=function(e,t,n,i,r){var o=this._modeling,a=e.allShapes,s=e.allConnections,c=e.enclosedConnections,l=e.topLevel,u=!1;r&&r.parent===n&&(u=!0),H(a,function(p){o.moveShape(p,t,l[p.id]&&!u&&n,{recurse:!1,layout:!1})}),H(s,function(p){var f=!!a[p.source.id],d=!!a[p.target.id];c[p.id]&&f&&d?o.moveConnection(p,t,l[p.id]&&!u&&n):o.layoutConnection(p,{connectionStart:f&&If(p,p.source,t),connectionEnd:d&&Bf(p,p.target,t)})})},gs.prototype.getClosure=function(e){return new Md().addAll(e,!0)};function Bl(e){this._helper=new gs(e)}Bl.$inject=["modeling"],Bl.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},Bl.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 vo(e){this._modeling=e,this._helper=new gs(e)}vo.$inject=["modeling"],vo.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=Mi(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=Wt(o.children,t),qt(i.children,t,r),W(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},vo.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,r=this._modeling;i.layout!==!1&&(H(t.incoming,function(o){r.layoutConnection(o,{connectionEnd:Bf(o,t,n)})}),H(t.outgoing,function(o){r.layoutConnection(o,{connectionStart:If(o,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},vo.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return qt(n.children,t,i),W(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},vo.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},vo.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function ys(e){this._modeling=e}ys.$inject=["modeling"],ys.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 $e(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},ys.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||ux($e(r)?r[0]:r)),i&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||ux($e(r)?r[r.length-1]:r)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},ys.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 ux(e){return e.original||e}function lr(e,t){this._modeling=e,this._rules=t}lr.$inject=["modeling","rules"],lr.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(g,h,y){return i.allowed("connection.reconnect",{connection:y,source:g,target:h})}var l={x:o.x,y:o.y},u={x:r.x,y:r.y,width:r.width,height:r.height};s=e.newShape=e.newShape||t.createShape(o,l,r.parent,a),r.host&&n.updateAttachment(s,r.host);var 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();H(f,function(g){var h=g.source,y=c(h,s,g);y&&t.reconnectEnd(g,s,ll(g,s,u),a)}),H(d,function(g){var h=g.target,y=c(s,h,g);y&&t.reconnectStart(g,s,cl(g,s,u),a)})},lr.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},lr.prototype.execute=function(e){},lr.prototype.revert=function(e){},lr.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},lr.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},lr.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function vs(e){this._modeling=e}vs.$inject=["modeling"],vs.prototype.execute=function(e){var t=e.shape,n=e.newBounds,i=e.minBounds;if(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)throw new Error("newBounds must have {x, y, width, height} properties");if(i&&(n.width<i.width||n.height<i.height))throw new Error("width and height cannot be less than minimum height and width");if(!i&&n.width<10||n.height<10)throw new Error("width and height cannot be less than 10px");return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},W(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},vs.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,r=e.hints||{};r.layout!==!1&&(H(n.incoming,function(o){t.layoutConnection(o,{connectionEnd:ll(o,n,i)})}),H(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:cl(o,n,i)})}))},vs.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return W(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function jr(e){this._modeling=e}jr.$inject=["modeling"],jr.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),H(r,function(s){a[s.id]=P2(s)}),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(n2(i,r),t,n,o,i,r,a)},jr.prototype.execute=function(){},jr.prototype.revert=function(){},jr.prototype.moveShapes=function(e,t){var n=this;H(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},jr.prototype.resizeShapes=function(e,t,n){var i=this;H(e,function(r){var o=i2(r,n,t);i._modeling.resizeShape(r,o,null,{attachSupport:!1,autoResize:!1,layout:!1})})},jr.prototype.updateConnectionWaypoints=function(e,t,n,i,r,o,a){var s=this,c=new Set(r),l=new Set(o);H(e,function(u){var p=u.source,f=u.target,d=M2(u),g=fx(n),h={},y=c.has(p)||l.has(p),R=c.has(f)||l.has(f);y&&R?(d=Pn(d,function(x){return dx(x,i,n)&&(x[g]=x[g]+t[g]),x.original&&dx(x.original,i,n)&&(x.original[g]=x.original[g]+t[g]),x}),s._modeling.updateWaypoints(u,d,{labelBehavior:!1})):(y||R)&&(c.has(p)?h.connectionStart=If(u,p,t):c.has(f)?h.connectionEnd=Bf(u,f,t):l.has(p)?h.connectionStart=cl(u,p,a[p.id]):l.has(f)&&(h.connectionEnd=ll(u,f,a[f.id])),s._modeling.layoutConnection(u,h))})};function px(e){return W({},e)}function M2(e){return Pn(e.waypoints,function(t){return t=px(t),t.original&&(t.original=px(t.original)),t})}function fx(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function dx(e,t,n){var i=fx(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function P2(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function Nl(e){this._modeling=e}Nl.$inject=["modeling"],Nl.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=hx(n),t.collapsed=!t.collapsed;var i=mx(n,t.collapsed);return[t].concat(i)},Nl.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,r=gx(i,n);return t.collapsed=!t.collapsed,[t].concat(r)};function hx(e){var t={};return H(e,function(n){t[n.id]=n.hidden,n.children&&(t=W({},t,hx(n.children)))}),t}function mx(e,t){var n=[];return H(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(mx(i.children,i.collapsed||t)))}),n}function gx(e,t){var n=[];return H(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(gx(i.children,t)))}),n}function $l(e){this._modeling=e}$l.$inject=["modeling"],$l.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=yx(i,t),vx(n,t),t.host=n,t},$l.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,yx(n,t),vx(i,t,r),t};function yx(e,t){return Wt(e&&e.attachers,t)}function vx(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),qt(i,t,n)}}function Pd(){}Pd.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},Pd.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function At(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}At.$inject=["eventBus","elementFactory","commandStack"],At.prototype.getHandlers=function(){return{"shape.append":kl,"shape.create":Fr,"shape.delete":ms,"shape.move":vo,"shape.resize":vs,"shape.replace":lr,"shape.toggleCollapse":Nl,spaceTool:jr,"label.create":ds,"connection.create":Ol,"connection.delete":hs,"connection.move":Ad,"connection.layout":Il,"connection.updateWaypoints":Pd,"connection.reconnect":ys,"elements.create":Rd,"elements.move":Bl,"elements.delete":Cd,"elements.distribute":Ll,"elements.align":Tl,"element.updateAttachment":$l}},At.prototype.registerHandlers=function(e){H(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},At.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)},At.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},At.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)},At.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)},At.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},At.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},At.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},At.prototype.createElements=function(e,t,n,i,r){$e(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},At.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},At.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},At.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},At.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},At.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},At.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},At.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},At.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},At.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},At.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)},At.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},At.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)},At.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,W(i,{docking:"source"}))},At.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,W(i,{docking:"target"}))},At.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},At.prototype._create=function(e,t){return zA(t)?t:this._elementFactory.create(e,t)},At.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function bs(e){this._elementRegistry=e}bs.$inject=["elementRegistry"],bs.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||T2(n,tc(i));return bx(n,i),e.oldProperties=o,e.changed=r,r},bs.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return bx(n,t),i},bs.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return C(e,"bpmn:DataObject")?k2(e,t):[]};function T2(e,t){return Un(t,function(n,i){return n[i]=e.get(i),n},{})}function bx(e,t){H(t,function(n,i){e.set(i,n)})}function k2(e,t){return t.filter(function(n){return C(n,"bpmn:DataObjectReference")&&ue(n).dataObjectRef===e})}var xs="default",ur="id",xx="di",O2={width:0,height:0};function _s(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}_s.$inject=["elementRegistry","moddle","modeling","textRenderer"],_s.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=N2(e.properties),s=e.oldProperties||D2(t,a);return _x(a,o)&&(r.unclaim(o[ur]),i.updateId(t,a[ur]),r.claim(a[ur],o)),xs in a&&(a[xs]&&n.push(i.get(a[xs].id)),o[xs]&&n.push(i.get(o[xs].id))),wx(t,a),e.oldProperties=s,e.changed=n,n},_s.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&ue(n).name;if(i){var r=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,r,O2)}},_s.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 wx(t,i),_x(n,r)&&(a.unclaim(n[ur]),o.updateId(t,i[ur]),a.claim(i[ur],r)),e.changed};function _x(e,t){return ur in e&&e[ur]!==t[ur]}function D2(e,t){var n=tc(t),i=e.businessObject,r=pt(e);return Un(n,function(o,a){return a!==xx?o[a]=i.get(a):o[a]=L2(r,tc(t.di)),o},{})}function L2(e,t){return Un(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function wx(e,t){var n=e.businessObject,i=pt(e);H(t,function(r,o){o!==xx?n.set(o,r):i&&I2(i,r)})}function I2(e,t){H(t,function(n,i){e.set(i,n)})}var B2=["default"];function N2(e){var t=W({},e);return B2.forEach(function(n){n in e&&(t[n]=ue(t[n]))}),t}function Fl(e,t){this._canvas=e,this._modeling=t}Fl.$inject=["canvas","modeling"],Fl.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=pt(r);return t.setRootElement(n),t.removeRootElement(r),qt(a.rootElements,i),i.$parent=a,Wt(a.rootElements,o),o.$parent=null,r.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=r,[]},Fl.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,a=i.$parent,s=pt(n);return t.setRootElement(r),t.removeRootElement(n),Wt(a.rootElements,i),i.$parent=null,qt(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,r.di=s,[]};function Td(e,t){this._modeling=e,this._spaceTool=t}Td.$inject=["modeling","spaceTool"],Td.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=gi(i),a=o===i,s=a?i:i.parent,c=Or(s),l=gn(i);if(l?r==="left"?r="top":r==="right"&&(r="bottom"):r==="top"?r="left":r==="bottom"&&(r="right"),!c.length){var u=l?{x:i.x+mi,y:i.y,width:i.width-mi,height:i.height}:{x:i.x,y:i.y+mi,width:i.width,height:i.height-mi};n.createShape({type:"bpmn:Lane",isHorizontal:l},u,s)}var p=[];lo(o,function(v){return p.push(v),v.label&&p.push(v.label),v===i?[]:tt(v.children,function(_){return _!==i})});var f,d,g,h,y;r==="top"?(f=-120,d=i.y,g=d+10,h="n",y="y"):r==="left"?(f=-120,d=i.x,g=d+10,h="w",y="x"):r==="bottom"?(f=120,d=i.y+i.height,g=d-10,h="s",y="y"):r==="right"&&(f=120,d=i.x+i.width,g=d-10,h="e",y="x");var R=t.calculateAdjustments(p,y,f,g),x=l?{x:0,y:f}:{x:f,y:0};t.makeSpace(R.movingShapes,R.resizingShapes,x,h,g);var m=l?{x:i.x+(a?mi:0),y:d-(r==="top"?120:0),width:i.width-(a?mi:0),height:120}:{x:d-(r==="left"?120:0),y:i.y+(a?mi:0),width:120,height:i.height-(a?mi:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:l},m,s)};function kd(e){this._modeling=e}kd.$inject=["modeling"],kd.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=Or(n),o=r.length;if(o>i)throw new Error(`more than <${i}> child lanes`);var a=gn(n),s=a?n.height:n.width,c=Math.round(s/i),l,u,p,f;for(f=0;f<i;f++)f===i-1?l=s-c*f:l=c,u=a?{x:n.x+mi,y:n.y+f*c,width:n.width-mi,height:l}:{x:n.x+f*c,y:n.y+mi,width:l,height:n.height-mi},f<o?t.resizeShape(r[f],u):(p={type:"bpmn:Lane",isHorizontal:a},t.createShape(p,u,n))};function ws(e,t){this._modeling=e,this._spaceTool=t}ws.$inject=["modeling","spaceTool"],ws.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},ws.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=kP(e,t);n.resizeShape(e,t),i.forEach(function(r){n.resizeShape(r.shape,r.newBounds)})},ws.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=Ie(e),r=Ie(t),o=ev(r,i),a=gi(e),s=[],c=[];lo(a,function(g){return s.push(g),(C(g,"bpmn:Lane")||C(g,"bpmn:Participant"))&&c.push(g),g.children});var l,u,p,f,d;(o.bottom||o.top)&&(l=o.bottom||o.top,u=e.y+(o.bottom?e.height:0)+(o.bottom?-10:10),p=o.bottom?"s":"n",f=o.top>0||o.bottom<0?-l:l,d=n.calculateAdjustments(s,"y",f,u),n.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:l},p)),(o.left||o.right)&&(l=o.right||o.left,u=e.x+(o.right?e.width:0)+(o.right?-10:100),p=o.right?"e":"w",f=o.left>0||o.right<0?-l:l,d=n.calculateAdjustments(c,"x",f,u),n.makeSpace(d.movingShapes,d.resizingShapes,{x:l,y:0},p))};var Es="flowNodeRef",Od="lanes";function jl(){}jl.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},o=[];function a(u,p){var f=Ie(p),d={x:u.x+u.width/2,y:u.y+u.height/2};return d.x>f.left&&d.x<f.right&&d.y>f.top&&d.y<f.bottom}function s(u){n.indexOf(u)===-1&&(o.push(u),n.push(u))}function c(u){var p=gi(u);return r[p.id]||(r[p.id]=il(p)),r[p.id]}function l(u){if(!u.parent)return[];var p=c(u);return p.filter(function(f){return a(u,f)}).map(function(f){return f.businessObject})}return t.forEach(function(u){var p=gi(u);if(!(!p||n.indexOf(p)!==-1)){var f=p.children.filter(function(d){return C(d,"bpmn:FlowNode")});f.forEach(s),n.push(p)}}),e.forEach(s),o.forEach(function(u){var p=u.businessObject,f=p.get(Od),d=f.slice(),g=l(u);i.push({flowNode:p,remove:d,add:g})}),t.forEach(function(u){var p=u.businessObject;u.parent||p.get(Es).forEach(function(f){i.push({flowNode:f,remove:[p],add:[]})})}),i},jl.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(Od);n.remove.forEach(function(o){Wt(r,o),Wt(o.get(Es),i)}),n.add.forEach(function(o){qt(r,o),qt(o.get(Es),i)})}),[]},jl.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,r=i.get(Od);n.add.forEach(function(o){Wt(r,o),Wt(o.get(Es),i)}),n.remove.forEach(function(o){qt(r,o),qt(o.get(Es),i)})}),[]};var Dd="categoryValueRef";function Ss(e,t){this._bpmnFactory=e,this._elementRegistry=t}Ss.$inject=["bpmnFactory","elementRegistry"],Ss.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,r=new Map,o=[],a=new Map;function s(x,m,v){if(m){var _=a.get(x);_||(_={},a.set(x,_)),!(v&&_.present)&&(!v&&_.past||(v?_.present={categoryValue:m,root:Ld(x)}:_.past={categoryValue:m}))}}function c(x){r.set(x,ue(x))}function l(){n.filter(function(x){return C(x,"bpmn:FlowElement")&&!Je(x)&&x.parent}).forEach(c)}function u(x){var m=ue(x),v=m.get("categoryValueRef");return v||(v=Ky(i,m),o.push($2(x,v))),v}function p(x){return x.reduce(function(m,v){var _=Ld(v),E=m.get(_);return E||(E=[],m.set(_,E)),E.push(v),m},new Map)}e=Array.from(e||[]);var f=p(e);t.length&&l(),e.forEach(c),n.filter(function(x){return C(x,"bpmn:Group")&&!Je(x)&&x.parent}).forEach(function(x){var m=ue(x).get("categoryValueRef");if(!m){var v=Ld(x),_=f.get(v)||[],E=Xo(_,x),T=Object.keys(E).length>0;T&&(m=u(x))}s(x,m,!0)}),t.forEach(function(x){s(x.groupShape,x.categoryValue,!1)}),o.length&&l();var d=Array.from(r.keys()),g=Array.from(a.values()).reduce(function(x,m){return m.present&&x.add(m.present.categoryValue),m.past&&x.add(m.past.categoryValue),x},new Set),h=new Map,y=p(d);a.forEach(function(x,m){var v=x.present;if(v){var _=y.get(v.root)||[],E=Xo(_,m);_.forEach(function(T){if(E[T.id]){var k=h.get(T);k||(k=new Set,h.set(T,k)),k.add(v.categoryValue)}})}});var R=d.reduce(function(x,m){var v=r.get(m),_=v.get(Dd),E=new Set(_),T=h.get(m)||new Set,k=Array.from(T).filter(function(P){return!E.has(P)}),I=_.filter(function(P){return g.has(P)&&!T.has(P)});return(k.length||I.length)&&x.push({businessObject:v,categoryValuesToAdd:k,categoryValuesToRemove:I}),x},[]);return{flowElements:R,groups:o}},Ss.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),F2(t.groups),H2(t.flowElements),[]},Ss.prototype.revert=function(e){var t=e.updates;return z2(t.flowElements),j2(t.groups),[]};function $2(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function F2(e){e.forEach(function(t){ue(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function j2(e){e.forEach(function(t){ue(t.groupShape).categoryValueRef=null})}function H2(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Dd);t.categoryValuesToRemove.forEach(function(r){Wt(i,r)}),t.categoryValuesToAdd.forEach(function(r){qt(i,r,!0)})})}function z2(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Dd);t.categoryValuesToAdd.forEach(function(r){Wt(i,r)}),t.categoryValuesToRemove.forEach(function(r){qt(i,r,!0)})})}function Ld(e){for(;e.parent;)e=e.parent;return e}function Hl(e){this._moddle=e}Hl.$inject=["moddle"],Hl.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),[]},Hl.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 G2={fill:void 0,stroke:void 0};function Id(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(Vn(t)){var n=V2(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}Id.$inject=["commandStack"],Id.prototype.postExecute=function(e){var t=e.elements,n=e.colors||G2,i=this,r={};"fill"in n&&W(r,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&W(r,{"border-color":this._normalizeColor(n.stroke)}),H(t,function(o){var a=Ct(o)?Mi(r,["border-color"]):r,s=pt(o);if(W2(a),Je(o)){if(!s||!C(s.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:o,moddleElement:s.label,properties:{color:r["border-color"]}})}else{if(!et(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:o,properties:{di:a}})}})};function V2(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 W2(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var U2={width:0,height:0};function Ex(e,t,n){function i(c,l){var u=c.label||c,p=c.labelTarget||c;return xM(u,l),[u,p]}function r(c){var l=c.element,u=l.businessObject,p=c.newLabel;if(!Je(l)&&Tr(l)&&!Vc(l)&&!Sx(p)){var f=7,d=of(l);d={x:d.x,y:d.y+f},e.createLabel(l,d,{id:u.id+"_label",businessObject:u,di:l.di})}}function o(c){return c.oldLabel=li(c.element),i(c.element,c.newLabel)}function a(c){return i(c.element,c.oldLabel)}function s(c){var l=c.element,u=l.label||l,p=c.newLabel,f=c.newBounds,d=c.hints||{};if(!(!Je(u)&&!C(u,"bpmn:TextAnnotation"))){if(Je(u)&&Sx(p)){d.removeShape!==!1&&e.removeShape(u,{unsetLabel:!1});return}var g=li(l);typeof f>"u"&&(f=t.getExternalLabelBounds(u,g)),f&&e.resizeShape(u,f,U2)}}this.preExecute=r,this.execute=o,this.revert=a,this.postExecute=s}Ex.$inject=["modeling","textRenderer","bpmnFactory"];function Sx(e){return!e||!e.trim()}function Mn(e,t,n,i){At.call(this,e,t,n),this._bpmnRules=i}we(Mn,At),Mn.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],Mn.prototype.getHandlers=function(){var e=At.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=bs,e["element.updateProperties"]=_s,e["canvas.updateRoot"]=Fl,e["lane.add"]=Td,e["lane.resize"]=ws,e["lane.split"]=kd,e["lane.updateRefs"]=jl,e["group.updateRefs"]=Ss,e["id.updateClaim"]=Hl,e["element.setColor"]=Id,e["element.updateLabel"]=Ex,e},Mn.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},Mn.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)},Mn.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},Mn.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},Mn.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},Mn.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},Mn.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},Mn.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Mn.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Mn.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},Mn.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},Mn.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},Mn.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},Mn.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function Rx(){}Rx.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||Fe(t.source||e.source),t.connectionEnd||Fe(t.target||e.target)]};var zl=20,q2=5,Gl=Math.round,Cx=20,Y2={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function K2(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function X2(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function Ax(e,t,n){var i=Rn(t,e,q2),r=n.split(":")[0],o=Gl((t.x-e.x)/2+e.x),a=Gl((t.y-e.y)/2+e.y),s,c,l=X2(r,i),u=/h|r|l/.test(r),p=!1,f=!1;return l?(s=u?{x:o,y:e.y}:{x:e.x,y:a},c=u?"h:h":"v:v"):(p=K2(i,r),c=u?"h:v":"v:h",p?u?(f=a===e.y,s={x:e.x+zl*(/l/.test(r)?-1:1),y:f?a+zl:a}):(f=o===e.x,s={x:f?o+zl:o,y:e.y+zl*(/t/.test(r)?-1:1)}):s={x:o,y:a}),{waypoints:Bd(e,s,c).concat(s),directions:c,turnNextDirections:f}}function Z2(e,t,n){return Ax(e,t,n)}function Q2(e,t,n){var i=Ax(t,e,Mx(n));return{waypoints:i.waypoints.slice().reverse(),directions:Mx(i.directions),turnNextDirections:i.turnNextDirections}}function J2(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=Bd(e.waypoints[e.waypoints.length-1],t.waypoints[0],r);return{waypoints:o,directions:r}}function Mx(e){return e.split(":").reverse().join(":")}function eO(e,t,n){var i=Gl((t.x-e.x)/2+e.x),r=Gl((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 Bd(e,t,n){if(n=n||"h:h",!lO(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(Tx(n)){var i=Z2(e,t,n),r=Q2(e,t,n),o=J2(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return eO(e,t,n)}function tO(e,t,n){var i=Bd(e,t,n);return i.unshift(e),i.push(t),Ox(i)}function nO(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=XE(o,"straight")[0]||"h:h",s=Y2[a]||0,c=Rn(e,t,s),l=cO(c,a);n=n||Fe(e),i=i||Fe(t);var u=l.split(":"),p=kx(n,e,u[0],uO(c)),f=kx(i,t,u[1],c);return tO(p,f,l)}function iO(e,t,n,i,r,o){$e(n)&&(r=n,o=i,n=Fe(e),i=Fe(t)),o=W({preferredLayouts:[]},o),r=r||[];var a=o.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&oO(e,t,n,i,o),c||(c=o.connectionEnd&&sO(t,e,i,r),c)||(c=o.connectionStart&&aO(e,t,n,r),c)?c:!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:nO(e,t,n,i,o)}function rO(e,t,n){return e>=t&&e<=n}function Px(e,t,n){var i={x:"width",y:"height"};return rO(t[e],n[e],n[e]+n[i[e]])}function oO(e,t,n,i,r){var o={},a,s;return s=Rn(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),r.preserveDocking==="target"?Px(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:Px(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 aO(e,t,n,i){return Nd(e,t,n,i)}function sO(e,t,n,i){var r=i.slice().reverse();return r=Nd(e,t,n,r),r?r.reverse():null}function Nd(e,t,n,i){function r(u){return u.length<3?!0:u.length>4?!1:!!Tt(u,function(p,f){var d=u[f-1];return d&&Ya(p,d)<3})}function o(u,p,f){var d=tr(p,u);switch(d){case"v":return{x:f.x,y:u.y};case"h":return{x:u.x,y:f.y}}return{x:u.x,y:u.y}}function a(u,p,f){var d;for(d=u.length-2;d!==0;d--)if(ty(u[d],p,Cx)||ty(u[d],f,Cx))return u.slice(d);return u}if(r(i))return null;var s=i[0],c=i.slice(),l;return c[0]=n,c[1]=o(c[1],s,n),l=a(c,e,t),l!==c&&(c=Nd(e,t,n,l)),c&&tr(c)?null:c}function cO(e,t){if(Tx(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 lO(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function Tx(e){return e&&/t|r|b|l/.test(e)}function uO(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 kx(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 Ox(e){return e.reduce(function(t,n,i){var r=t[t.length-1],o=e[i+1];return Jp(r,o,n,0)||t.push(n),t},[])}var pO=-10,fO=40,dO={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},hO={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},$d={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},Rs={top:"t",right:"r",bottom:"b",left:"l"};function Vl(e){this._elementRegistry=e}we(Vl,Rx),Vl.prototype.layoutConnection=function(e,t){t||(t={});var n=t.source||e.source,i=t.target||e.target,r=t.waypoints||e.waypoints,o=t.connectionStart,a=t.connectionEnd,s=this._elementRegistry,c,l;if(o||(o=Dx(r&&r[0],n)),a||(a=Dx(r&&r[r.length-1],i)),(C(e,"bpmn:Association")||C(e,"bpmn:DataAssociation"))&&r&&!Lx(n,i))return[].concat([o],r.slice(1,-1),[a]);var u=Wy(n,s)?dO:hO;return C(e,"bpmn:MessageFlow")?c=gO(n,i,u):(C(e,"bpmn:SequenceFlow")||Lx(n,i))&&(n===i?c={preferredLayouts:wO(n,e,u)}:C(n,"bpmn:BoundaryEvent")?c={preferredLayouts:EO(n,i,a,u)}:Cs(n)||Cs(i)?c={preferredLayouts:u.subProcess,preserveDocking:vO(n)}:C(n,"bpmn:Gateway")?c={preferredLayouts:u.fromGateway}:C(i,"bpmn:Gateway")?c={preferredLayouts:u.toGateway}:c={preferredLayouts:u.default}),c&&(c=W(c,t),l=Ox(iO(n,i,o,a,r,c))),l||[o,a]};function mO(e){var t=e.host;return Rn(Fe(e),t,pO)}function gO(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:yO(e,t)}}function yO(e,t){return C(t,"bpmn:Participant")?"source":C(e,"bpmn:Participant")?"target":Cs(t)?"source":Cs(e)||C(t,"bpmn:Event")?"target":C(e,"bpmn:Event")?"source":null}function vO(e){return Cs(e)?"target":"source"}function Dx(e,t){return e?e.original||e:Fe(t)}function Lx(e,t){return C(t,"bpmn:Activity")&&C(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function Cs(e){return C(e,"bpmn:SubProcess")&&at(e)}function bo(e,t){return e===t}function bO(e,t){return t.indexOf(e)!==-1}function ma(e){var t=/right|left/.exec(e);return t&&t[0]}function ga(e){var t=/top|bottom/.exec(e);return t&&t[0]}function Ix(e,t){return $d[e]===t}function xO(e,t){var n=ma(e),i=$d[n];return t.indexOf(i)!==-1}function _O(e,t){var n=ga(e),i=$d[n];return t.indexOf(i)!==-1}function Bx(e){return e==="right"||e==="left"}function wO(e,t,n){var i=t.waypoints,r=i&&i.length&&Rn(i[0],e);return r==="top"?n.loop.fromTop:r==="right"?n.loop.fromRight:r==="left"?n.loop.fromLeft:n.loop.fromBottom}function EO(e,t,n,i){var r=Fe(e),o=Fe(t),a=mO(e),s,c,l=bo(e.host,t),u=bO(a,["top","right","bottom","left"]),p=Rn(o,r,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return l?SO(a,u,e,t,n,i):(s=RO(a,p,u,i.isHorizontal),c=CO(a,p,u,i.isHorizontal),[s+":"+c])}function SO(e,t,n,i,r,o){var a=t?e:o.isHorizontal?ga(e):ma(e),s=Rs[a],c;return t?Bx(e)?c=Nx("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:c=Nx("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function Nx(e,t,n,i){var r=fO;return!(Fd(e,i,n,r)||Fd(e,i,{x:n.x+n.width,y:n.y+n.height},r)||Fd(e,i,Fe(t),r))}function Fd(e,t,n,i){return Math.abs(t[e]-n[e])<i}function RO(e,t,n,i){if(n)return Rs[e];var r=ga(e),o=ma(e),a=ga(t),s=ma(t);if(i){if(bo(r,a)||Ix(o,s))return Rs[r]}else if(bo(o,s)||Ix(r,a))return Rs[o];return Rs[i?o:r]}function CO(e,t,n,i){if(n)return Bx(e)?xO(e,t)||bo(e,t)?"h":"v":_O(e,t)||bo(e,t)?"v":"h";var r=ga(e),o=ma(e),a=ga(t),s=ma(t);return a&&!s?"v":s&&!a?"h":i?bo(r,a)?"h":"v":bo(o,s)?"v":"h"}Vl.$inject=["elementRegistry"];function $x(e){return W({original:e.point.original||e.point},e.actual)}function Hr(e,t){this._elementRegistry=e,this._graphicsFactory=t}Hr.$inject=["elementRegistry","graphicsFactory"],Hr.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($x(i)),o.push($x(r)),o},Hr.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}},Hr.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return Ka(i,r,n)},Hr.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},Hr.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},Hr.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const jd={__init__:["modeling","bpmnUpdater"],__depends__:[WT,sk,lk,uk,Xb,p2,d2,b2,vi,Ed,nx],bpmnFactory:["type",xi],bpmnUpdater:["type",Qn],elementFactory:["type",$r],modeling:["type",Mn],layouter:["type",Vl],connectionDocking:["type",Hr]};var AO=10,Fx=50,MO=250;function Hd(e,t,n,i){for(var r;r=PO(e,n,t);)n=i(t,n,r);return n}function zd(e){return function(t,n,i){var r={x:n.x,y:n.y};return["x","y"].forEach(function(o){var a=e[o];if(a){var s=o==="x"?"width":"height",c=a.margin,l=a.minDistance;c<0?r[o]=Math.min(i[o]+c-t[s]/2,n[o]-l+c):r[o]=Math.max(i[o]+i[s]+c+t[s]/2,n[o]+l+c)}}),r}}function PO(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=kO(e);return Tt(r,function(o){if(o===n)return!1;var a=Rn(o,i,AO);return a==="intersect"})}function TO(e,t){t||(t={});function n(g){return g.source===e?1:-1}var i=t.defaultDistance||Fx,r=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||MO,c=t.reference||"start";o||(o=LO);function l(g,h){return r==="n"?c==="start"?Ie(g).top-Ie(h).bottom:c==="center"?Ie(g).top-Fe(h).y:Ie(g).top-Ie(h).top:r==="w"?c==="start"?Ie(g).left-Ie(h).right:c==="center"?Ie(g).left-Fe(h).x:Ie(g).left-Ie(h).left:r==="s"?c==="start"?Ie(h).top-Ie(g).bottom:c==="center"?Fe(h).y-Ie(g).bottom:Ie(h).bottom-Ie(g).bottom:c==="start"?Ie(h).left-Ie(g).right:c==="center"?Fe(h).x-Ie(g).right:Ie(h).right-Ie(g).right}var u=e.incoming.filter(o).map(function(g){var h=a(g),y=h<0?l(g.source,e):l(e,g.source);return{id:g.source.id,distance:y,weight:h}}),p=e.outgoing.filter(o).map(function(g){var h=a(g),y=h>0?l(e,g.target):l(g.target,e);return{id:g.target.id,distance:y,weight:h}}),f=u.concat(p).reduce(function(g,h){return g[h.id+"__weight_"+h.weight]=h,g},{}),d=Un(f,function(g,h){var y=h.distance,R=h.weight;return y<0||y>s||(g[String(y)]||(g[String(y)]=0),g[String(y)]+=1*R,(!g.distance||g[g.distance]<g[String(y)])&&(g.distance=y)),g},{});return d.distance||i}function kO(e){var t=Gd(e);return e.host&&(t=t.concat(Gd(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(Gd(i))},[]))),t}function Gd(e){return DO(e).concat(OO(e))}function OO(e){return e.incoming.map(function(t){return t.source})}function DO(e){return e.outgoing.map(function(t){return t.target})}function LO(){return!0}var IO=100;function jx(e,t,n){e.on("autoPlace",IO,function(i){var r=i.shape,o=i.source;return BO(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}}jx.$inject=["eventBus","modeling","canvas"];function BO(e,t,n){n||(n={});var i=n.defaultDistance||Fx,r=Fe(e),o=Ie(e);return{x:o.right+i+t.width/2,y:r.y}}function Hx(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}Hx.$inject=["eventBus","selection"];const NO={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",jx],autoPlaceSelectionBehavior:["type",Hx]};function zx(e,t,n){var i=Wy(e,n);if(C(t,"bpmn:TextAnnotation"))return FO(e,t,i);if(et(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return jO(e,t,i);if(C(t,"bpmn:FlowNode"))return $O(e,t,i)}function $O(e,t,n){var i=Ie(e),r=Fe(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=TO(e,{filter:function(d){return C(d,"bpmn:SequenceFlow")},direction:o.directionHint}),s=30,c=o.minDistance,l=o.baseOrientation;C(e,"bpmn:BoundaryEvent")&&(l=Rn(e,e.host,-25),l.indexOf(o.boundaryOrientation)!==-1&&(s*=-1));var u=n?{x:i.right+a+t.width/2,y:r.y+Gx(l,c,o)}:{x:r.x+Gx(l,c,o),y:i.bottom+a+t.height/2},p={margin:s,minDistance:c},f=n?{y:p}:{x:p};return Hd(e,t,u,zd(f))}function Gx(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function FO(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};Ct(e)&&(r=Fe(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 Hd(e,t,r,zd(a))}function jO(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 Hd(e,t,r,zd(a))}function Vx(e,t){e.on("autoPlace",function(n){var i=n.shape,r=n.source;return zx(r,i,t)})}Vx.$inject=["eventBus","elementRegistry"];const Wl={__depends__:[NO],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",Vx]},Wx=[Gy,ts,jd,Wl,op];function HO(e={}){wm(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new Jo({container:t,moddleExtensions:e.moddleExtensions??lc,additionalModules:[...Wx,...e.additionalModules??[]]})}const Ux={"edge-crosses-shape":"연결","edge-crosses-subprocess":"연결","edge-endpoint-detached":"연결","edge-overlap-opposite":"겹침","edge-overlap-mixed":"겹침","edge-overlap-unrelated":"겹침","shape-overlap":"겹침","shape-outside-container":"소속","label-on-shared-segment":"라벨","label-over-line":"라벨","label-over-shape":"라벨","annotation-over-label":"라벨","pool-name-over-label":"라벨","group-overlap-unintended":"그룹","group-overlap-unreadable":"그룹","group-stack-unreadable":"그룹","group-on-container-boundary":"그룹","group-on-group-boundary":"그룹","group-cuts-shape":"그룹","edge-along-group-boundary":"그룹","pool-overlap":"풀","CHK-FLOW-1":"구조","CHK-POOL-1":"풀"},zO={이:["이","가"],을:["을","를"],와:["과","와"]};function GO(e,t){const[n,i]=zO[t],r=e.at(-1)??"",o=r.charCodeAt(0);return o>=44032&&o<=55203?e+((o-44032)%28===0?i:n):r>="0"&&r<="9"?e+("013678".includes(r)?n:i):e+`${n}(${i})`}const VO={"bpmn:StartEvent":"시작 이벤트","bpmn:EndEvent":"종료 이벤트","bpmn:IntermediateCatchEvent":"중간 이벤트","bpmn:IntermediateThrowEvent":"중간 이벤트","bpmn:BoundaryEvent":"경계 이벤트","bpmn:Task":"작업","bpmn:UserTask":"작업","bpmn:ServiceTask":"작업","bpmn:SendTask":"작업","bpmn:ReceiveTask":"작업","bpmn:ManualTask":"작업","bpmn:ScriptTask":"작업","bpmn:BusinessRuleTask":"작업","bpmn:CallActivity":"작업","bpmn:SubProcess":"서브프로세스","bpmn:ExclusiveGateway":"게이트웨이","bpmn:ParallelGateway":"게이트웨이","bpmn:InclusiveGateway":"게이트웨이","bpmn:EventBasedGateway":"게이트웨이","bpmn:ComplexGateway":"게이트웨이","bpmn:Participant":"풀","bpmn:Lane":"레인","bpmn:TextAnnotation":"주석","bpmn:Group":"그룹","bpmn:DataStoreReference":"데이터 저장소","bpmn:DataObjectReference":"데이터 객체","bpmn:SequenceFlow":"연결선","bpmn:MessageFlow":"메시지 연결선","bpmn:Association":"연관선"},WO="요소";function Vd(e){return(e&&VO[e.type])??WO}const qx=20;function UO(e){const t=e.replace(/\s+/g," ").trim();return t.length>qx?`${t.slice(0,qx)}…`:t}function Ul(e,t,n,i=""){const r=e(t),o=(r==null?void 0:r.name)===void 0?void 0:UO(r.name),a=o===void 0?i+Vd(r):o,s=o===void 0?a:`「${o}」`;return n?s+GO(a,n).slice(a.length):s}function qO(e,t,n,i,r){const[o,a]=[e(t),e(n)],s=(o==null?void 0:o.name)===void 0&&(a==null?void 0:a.name)===void 0&&Vd(o)===Vd(a);return[Ul(e,t,i),Ul(e,n,r,s?"다른 ":"")]}function YO(e){switch(e.kind){case"shape-overlap":return e.identical?"error":"warning";case"shape-outside-container":return"error";case"edge-endpoint-detached":return"error";case"pool-overlap":return e.contained?"error":"warning";case"group-cuts-shape":return"error";default:return"warning"}}function KO(e){switch(e.kind){case"edge-crosses-shape":return[e.edge,e.shape];case"edge-crosses-subprocess":return[e.edge,e.subProcess];case"edge-endpoint-detached":return[e.edge,e.shape];case"shape-overlap":return[...e.shapes];case"shape-outside-container":return[e.shape,e.container];case"edge-overlap-opposite":case"edge-overlap-mixed":case"edge-overlap-unrelated":return[...e.edges];case"label-on-shared-segment":return[e.edge,e.other];case"label-over-line":return[e.edge,e.line];case"label-over-shape":return[e.edge,e.shape];case"annotation-over-label":return[e.annotation,e.label];case"group-overlap-unintended":return e.container?[e.container,...e.groups.filter(t=>t!==e.container)]:[...e.groups];case"group-overlap-unreadable":return e.reason==="orphan"?[...e.groups,...e.shapes]:[e.group,...e.shapes];case"group-stack-unreadable":return[...e.groups,...e.shapes];case"group-on-container-boundary":return[e.group,e.container];case"group-on-group-boundary":return[...e.groups];case"group-cuts-shape":return[e.group,e.shape];case"edge-along-group-boundary":return[e.edge,e.group];case"pool-name-over-label":return[e.pool,e.label];case"pool-overlap":return[...e.pools]}}const ql={top:"위",bottom:"아래",left:"왼쪽",right:"오른쪽"};function XO(e,t){const n=(r,o)=>Ul(t,r,o),i=(r,o,a,s)=>qO(t,r,o,a,s);switch(e.kind){case"edge-crosses-shape":return`${n(e.edge,"이")} ${n(e.shape,"을")} 가로지릅니다.`;case"edge-crosses-subprocess":return`${n(e.edge,"이")} 서브프로세스 ${n(e.subProcess)} 안을 지나갑니다.`;case"edge-endpoint-detached":return`${n(e.edge)}의 끝이 ${n(e.shape)}에서 ${Math.round(e.distance)}px 떨어져 연결이 끊겨 보입니다.`;case"shape-overlap":{const[r,o]=i(e.shapes[0],e.shapes[1],"와","이");return e.identical?`${r} ${o} 완전히 같은 자리에 겹쳐 하나가 가려집니다.`:`${r} ${o} 겹칩니다.`}case"shape-outside-container":return`${n(e.shape,"이")} ${n(e.container)} 경계 밖에 놓여 다른 소속으로 읽힙니다.`;case"edge-overlap-opposite":{const[r,o]=i(e.edges[0],e.edges[1],"와","이");return`${r} ${o} 같은 선 위를 ${Math.round(e.length)}px 서로 반대 방향으로 흐릅니다.`}case"edge-overlap-mixed":{const[r,o]=i(e.edges[0],e.edges[1],"와","이");return`${r} ${o} 종류가 다른 선인데 ${Math.round(e.length)}px 겹쳐 흐릅니다.`}case"edge-overlap-unrelated":{const[r,o]=i(e.edges[0],e.edges[1],"와","이");return`${r} ${o} ${Math.round(e.length)}px 한 선처럼 겹쳐 흐르는데 만나는 지점이 없습니다.`}case"label-on-shared-segment":{const[r,o]=i(e.edge,e.other,void 0,"와");return`${r}의 라벨이 ${o} 공유하는 구간 위에 있어 어느 선의 것인지 모호합니다.`}case"label-over-line":return`${n(e.edge)}의 라벨을 선이 가로지릅니다.`;case"label-over-shape":return`${n(e.edge)}의 라벨이 ${n(e.shape)} 위에 ${e.depth}px 겹쳐 있습니다.`;case"annotation-over-label":return`주석 ${n(e.annotation,"이")} ${n(e.label)}의 이름 라벨을 덮습니다.`;case"group-overlap-unintended":{if(e.container)return`${n(e.container,"이")} 다른 그룹을 통째로 덮습니다.`;const[r,o]=i(e.groups[0],e.groups[1],"와","이");return`${r} ${o} 공유 멤버 없이 겹쳐 의도인지 알 수 없습니다.`}case"group-overlap-unreadable":switch(e.reason){case"orphan":{const[r,o]=i(e.groups[0],e.groups[1],"와");return`${r} ${o}의 겹친 영역에 어느 그룹에도 속하지 않은 요소가 ${e.shapes.length}개 있습니다.`}case"minority":return`${n(e.group)} 상자 안에서 자기 멤버가 과반이 아닙니다(다른 요소 ${e.shapes.length}개).`;case"throughpass":return`${n(e.group)} 상자를 자기 멤버가 아닌 요소 ${e.shapes.length}개가 지나갑니다.`}case"group-stack-unreadable":return`그룹 ${e.groups.length}개가 겹쳐 쌓여 요소 ${e.shapes.length}개가 어느 단계인지 읽히지 않습니다.`;case"group-on-container-boundary":return`${n(e.group)} 테두리가 ${n(e.container)}의 ${ql[e.side]} 경계선과 겹쳐 흐릅니다.`;case"group-on-group-boundary":{const[r,o]=i(e.groups[0],e.groups[1],"와");return`${r} ${o}의 테두리가 같은 선 위에 겹칩니다.`}case"group-cuts-shape":return`${n(e.group)} 테두리가 ${n(e.shape)}의 ${ql[e.side]}을(를) ${Math.round(e.depth)}px 가릅니다.`;case"edge-along-group-boundary":return e.distance===0?`${n(e.edge,"이")} ${n(e.group)}의 ${ql[e.side]} 테두리 위를 ${e.length}px 겹쳐 흐릅니다.`:`${n(e.edge,"이")} ${n(e.group)}의 ${ql[e.side]} 테두리 ${e.inside?"안쪽":"바깥쪽"} ${e.distance}px 에 ${e.length}px 나란히 흘러 테두리와 구분되지 않습니다.`;case"pool-name-over-label":return`${n(e.pool)}의 이름 밴드가 ${n(e.label)}의 라벨을 덮습니다.`;case"pool-overlap":{const[r,o]=i(e.pools[0],e.pools[1],"와","이");return e.contained?`${r} ${o} 중 하나가 다른 하나 안에 들어가 있습니다.`:`${r} ${o} 겹칩니다.`}}}function ZO(e,t){switch(e.ruleId){case"CHK-FLOW-1":return`${Ul(t,e.targetRefs[0])}에 연결된 선이 하나도 없습니다 — 분기·합류가 없는 게이트웨이는 의미가 정해지지 않습니다.`;case"CHK-POOL-1":return`이 문서에 내용이 없는 풀 ${e.targetRefs.length}개가 펼친 형태로 그려져 있습니다 — 이 문서에서 내용을 그리지 않는 풀은 접힌 형태(블랙박스)가 의미에 맞습니다.`;default:return e.ruleId}}const Yx="기타",Wd={error:0,warning:1,info:2};function Kx(e,t){const n=[];for(const i of e.geometry)n.push({key:`g:${ft(i)}`,source:"geometry",code:i.kind,severity:YO(i),targetRefs:KO(i),category:Ux[i.kind]??Yx,message:XO(i,t)});for(const i of e.semantic)n.push({key:`s:${i.ruleId}|${i.targetRefs.join(",")}`,source:"semantic",code:i.ruleId,severity:i.severity,targetRefs:[...i.targetRefs],category:Ux[i.ruleId]??Yx,message:ZO(i,t)});return n}function Xx(e){const t={error:0,warning:0,info:0};for(const n of e)t[n.severity]++;return t}function ya(e,t){return t!==void 0&&e.targetRefs.some(n=>t.has(n))}function Ud(e,t){if(t===void 0||e.length===0)return!1;const n=ya(e[0],t);return e.some(i=>ya(i,t)!==n)}function Zx(e,t){const n=Ud(e,t);return e.slice().sort((i,r)=>(n?Number(ya(r,t))-Number(ya(i,t)):0)||Wd[i.severity]-Wd[r.severity])}const Qx="i18n-untranslated",Jx="i18n-review-requested",e_=[["untranslated",Qx],["reviewRequested",Jx]];class qd{constructor(t,n,i,r,o,a,s,c){ui(this,"config");ui(this,"displayLocale");this.elementRegistry=n,this.canvas=a,this.textRenderer=s,this.graphicsFactory=c;const l=r.drawShape.bind(r);r.drawShape=(f,d,g)=>this.withDisplayText(d,()=>l(f,d,g),f);const u=o.activate.bind(o);o.activate=f=>this.withDisplayText(f,()=>u(f));const p=o.update.bind(o);o.update=(f,d,g,h)=>{const y=this.resolve(f);if(!y||y.native)return p(f,d,g,h);(d??"").trim()!==(g??"").trim()&&i.execute(ic,{element:f.labelTarget??f,locale:this.displayLocale,text:d,designLocale:this.config.designLocale,locales:this.locales(),rootLang:this.rootLang()})},t.on("commandStack.element.updateLabel.postExecute",f=>{if(!this.config)return;const{element:d,newLabel:g,oldLabel:h}=f.context;(g??"")!==(h??"")&&i.execute(ic,{element:d.labelTarget??d,locale:this.displayLocale,text:g??"",designLocale:this.config.designLocale,locales:this.locales(),rootLang:this.rootLang(),nameChangedFrom:h??""})})}configure(t){!t&&!this.config||(this.config=t,this.displayLocale=t==null?void 0:t.designLocale,this.rerenderAll())}locales(){if(!this.config)return[];const{designLocale:t,companionLocales:n}=this.config;return[t,...n.filter(i=>i!==t)]}setDisplayLocale(t){if(this.config)return this.displayLocale=this.locales().includes(t)?t:this.config.designLocale,this.rerenderAll(),this.displayLocale}getDisplayLocale(){return this.displayLocale}rootLang(){var i,r,o;const t=(i=this.canvas.getRootElement())==null?void 0:i.businessObject,n=(t==null?void 0:t.$parent)??t;return((r=n==null?void 0:n.get)==null?void 0:r.call(n,"xml:lang"))??((o=n==null?void 0:n.$attrs)==null?void 0:o["xml:lang"])}resolve(t){if(!this.config||!this.displayLocale)return;const n=(t.labelTarget??t).businessObject,i=no(n);if(!i)return;const r=this.displayLocale,o=i.target[i.key]??"",a=No(n).filter(f=>Tn(f)),s=f=>f.body??"",c=a.find(f=>Tn(f)===r&&s(f)),l=br(n).some(f=>f.locale===r)?"reviewRequested":"ok";if(!o)return c?{text:s(c),status:l,native:!1}:void 0;const u=a.filter(f=>s(f)===o).map(Tn);return(u.length?u:[this.rootLang()??this.config.designLocale]).includes(r)?{text:o,status:l,native:!0}:c?{text:s(c),status:l,native:!1}:{text:o,status:"untranslated",native:!1}}untranslatedCount(t){return this.countStatus(t,"untranslated")}reviewRequestedCount(t){return this.countStatus(t,"reviewRequested")}countStatus(t,n){var o;if(!this.config)return 0;const i=this.displayLocale;this.displayLocale=t;let r=0;try{for(const a of this.elementRegistry.getAll())a.type!=="label"&&((o=this.resolve(a))==null?void 0:o.status)===n&&r++}finally{this.displayLocale=i}return r}withDisplayText(t,n,i){var f;if(!this.config)return n();const r=this.resolve(t),o=(f=i==null?void 0:i.parentNode)==null?void 0:f.classList;if(o)for(const[d,g]of e_)o.toggle(g,(r==null?void 0:r.status)===d);if(!r||r.native)return n();const{target:a,key:s}=no((t.labelTarget??t).businessObject),c=Object.prototype.hasOwnProperty.call(a,s),l=a[s];if(l===r.text)return n();a[s]=r.text;const u=this.config.adaptiveExternalLabel??!0,p=t.type==="label"&&u?this.widen(t,r.text):void 0;try{const d=n();return p&&(d!=null&&d.setAttribute)&&d.setAttribute("transform",`translate(${p.dx}, 0)`),d}finally{c?a[s]=l:delete a[s],p==null||p.restore()}}widen(t,n){const{width:i,height:r}=t,o=this.textRenderer.getExternalLabelBounds(t,n);return t.width=o.width,t.height=o.height,{dx:(i-o.width)/2,restore:()=>(t.width=i,t.height=r)}}rerenderAll(){const t=this.canvas.getRootElement();for(const n of this.elementRegistry.getAll()){if(n===t)continue;const i=this.elementRegistry.getGraphics(n);if(i){if(!this.config)for(const[,r]of e_)i.classList.remove(r);this.graphicsFactory.update(n.waypoints?"connection":"shape",n,i)}}}}ui(qd,"$inject",["eventBus","elementRegistry","commandStack","bpmnRenderer","labelEditingProvider","canvas","textRenderer","graphicsFactory"]);const t_={__depends__:[op],__init__:["i18nDisplay"],i18nDisplay:["type",qd]};var QO=new da("ov"),JO=500;function vn(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=QO,this._overlayDefaults=W({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=eD(n.getContainer()),this._init()}vn.$inject=["config.overlays","eventBus","canvas","elementRegistry"],vn.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?tt(t.overlays,Io({type:e.type})):t.overlays.slice():[]}else return e.type?tt(this._overlays,Io({type:e.type})):e.id?this._overlays[e.id]:null},vn.prototype.add=function(e,t,n){if(dn(t)&&(n=t,t=null),e.id||(e=this._elementRegistry.get(e)),!n.position)throw new Error("must specifiy overlay position");if(!n.html)throw new Error("must specifiy overlay html");if(!e)throw new Error("invalid element specified");var i=this._ids.next();return n=W({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},vn.prototype.remove=function(e){var t=this.get(e)||[];$e(t)||(t=[t]);var n=this;H(t,function(i){var r=n._getOverlayContainer(i.element,!0);if(i&&(Fi(i.html),Fi(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)}})},vn.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},vn.prototype.show=function(){Yl(this._overlayRoot)},vn.prototype.hide=function(){Yl(this._overlayRoot,!1)},vn.prototype.clear=function(){this._overlays={},this._overlayContainers=[],Pc(this._overlayRoot)},vn.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=Jt(t);i=o.x,r=o.y}n_(n,i,r),On(e.html,"data-container-id",t.id)},vn.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=Jt(i).width:a=i.width,r=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=Jt(i).height:s=i.height,o=t.bottom*-1+s}n_(n,r||0,o||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},vn.prototype._createOverlayContainer=function(e){var t=Ot('<div class="djs-overlays" />');Bn(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},vn.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";i_(this._overlayRoot,n)},vn.prototype._getOverlayContainer=function(e,t){var n=Tt(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},vn.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=Ot(i)),o=this._getOverlayContainer(n),r=Ot('<div class="djs-overlay" data-overlay-id="'+t+'">'),Bn(r,{position:"absolute"}),r.appendChild(i),e.type&&Bt(r).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();Yl(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())},vn.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&&(an(r)&&r>t.scale||an(o)&&o<t.scale))&&(c=!1),Yl(a,c),this._updateOverlayScale(e,t)},vn.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),an(i)&&t.scale<i&&(a=(1/t.scale||1)*i),an(r)&&t.scale>r&&(a=(1/t.scale||1)*r)),an(a)&&(s="scale("+a+","+a+")"),i_(o,s)},vn.prototype._updateOverlaysVisibilty=function(e){var t=this;H(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},vn.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});H(o,function(c){t.remove(c.id)});var a=t._getOverlayContainer(r);if(a){Fi(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",JO,function(i){var r=i.element,o=t._getOverlayContainer(r,!0);o&&(H(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&&Bt(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 eD(e){var t=Ot('<div class="djs-overlay-container" />');return Bn(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function n_(e,t,n){Bn(e,{left:t+"px",top:n+"px"})}function Yl(e,t){e.style.display=t===!1?"none":""}function i_(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const Kl={__init__:["overlays"],overlays:["type",vn]};function Yd(e,t){t.invoke(ce,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)})}we(Yd,ce),Yd.$inject=["canvas","injector"];const tD={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",Yd]};function As(e){return CSS.escape(e)}var nD={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function r_(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return nD[t]})}var iD="bjs-breadcrumbs-shown";function o_(e,t,n){var i=Ot('<ul class="bjs-breadcrumbs"></ul>'),r=n.getContainer(),o=Bt(r);r.appendChild(i);var a=[];e.on("element.changed",function(c){var l=c.element,u=ue(l),p=Tt(a,function(f){return f===u});p&&s()});function s(c){c&&(a=rD(c));var l=a.flatMap(function(p){var f=n.findRoot(Vi(p))||n.findRoot(p.id);if(!f&&C(p,"bpmn:Process")){var d=t.find(function(y){var R=ue(y);return R&&R.get("processRef")===p});f=d&&n.findRoot(d.id)}if(!f)return[];var g=r_(p.name||p.id),h=Ot('<li><span class="bjs-crumb"><a title="'+g+'">'+g+"</a></span></li>");return h.addEventListener("click",function(){n.setRootElement(f)}),h});i.innerHTML="";var u=l.length>1;o.toggle(iD,u),l.forEach(function(p){i.appendChild(p)})}e.on("root.set",function(c){s(c.element)})}o_.$inject=["eventBus","elementRegistry","canvas"];function rD(e){for(var t=ue(e),n=[],i=t;i;i=i.$parent)(C(i,"bpmn:SubProcess")||C(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function a_(e,t){var n=null,i=new oD;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,!(!C(o,"bpmn:SubProcess")&&!s)){s=s||{x:0,y:0,zoom:1};var c=(a.x-s.x)*a.scale,l=(a.y-s.y)*a.scale;(c!==0||l!==0)&&t.scroll({dx:c,dy:l}),s.zoom!==a.scale&&t.zoom(s.zoom,{x:0,y:0})}}),e.on("diagram.clear",function(){i.clear(),n=null})}a_.$inject=["eventBus","canvas"];function oD(){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 s_={x:180,y:160};function xo(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,r){n._handleImport(r.definitions)})}xo.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)})}},xo.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;C(a,"bpmn:SubProcess")&&!o.isExpanded&&n.push(a),sD(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},xo.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=aD(e),i={x:n.x-s_.x,y:n.y-s_.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)})},xo.prototype._moveToDiPlane=function(e,t){var n=c_(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},xo.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},xo.$inject=["eventBus","moddle"];function c_(e){return C(e,"bpmndi:BPMNDiagram")?e:c_(e.$parent)}function aD(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)}}),$c(t)}function sD(e,t){var n=e.$parent;return!(!C(n,"bpmn:SubProcess")||n===t.bpmnElement||et(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var Xl=250,cD='<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>',lD="bjs-drilldown-empty";function zr(e,t,n,i,r){ce.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",Xl,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",Xl,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],Xl,function(a){var s=a.oldParent,c=a.newParent||a.parent,l=a.shape;o._canDrillDown(l)&&o._addOverlay(l),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(l)},!0),this.reverted(["shape.create","shape.move","shape.delete"],Xl,function(a){var s=a.oldParent,c=a.newParent||a.parent,l=a.shape;o._canDrillDown(l)&&o._addOverlay(l),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(l)},!0),t.on("import.render.complete",function(){n.filter(function(a){return o._canDrillDown(a)}).map(function(a){o._addOverlay(a)})})}we(zr,ce),zr.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},zr.prototype._canDrillDown=function(e){var t=this._canvas;return C(e,"bpmn:SubProcess")&&t.findRoot(Vi(e))},zr.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=ue(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var r=n&&n.get("flowElements")&&n.get("flowElements").length;Bt(i.html).toggle(lD,!r)}},zr.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=ue(e),r=n.get({element:e,type:"drilldown"});r.length&&this._removeOverlay(e);var o=Ot('<button type="button" class="bjs-drilldown">'+cD+"</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(Vi(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:o}),this._updateOverlayVisibility(e)},zr.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},zr.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const uD={__depends__:[Kl,Ed,tD],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",o_],drilldownCentering:["type",a_],drilldownOverlayBehavior:["type",zr],subprocessCompatibility:["type",xo]};function Gr(e){Ft.call(this,e)}we(Gr,Ft),Gr.prototype._modules=[Gy,uD,Kl,vi,ts],Gr.prototype._moddleExtensions={};var Zl="keyboard.keydown",pD="keyboard.keyup",fD=1e3,l_="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 Nn(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(l_));var i=e&&e.bind!==!1;t.on("canvas.init",function(r){n._target=r.svg,i&&n.bind(),n._fire("init")})}Nn.$inject=["config.keyboard","eventBus"],Nn.prototype._keydownHandler=function(e){this._keyHandler(e,Zl)},Nn.prototype._keyupHandler=function(e){this._keyHandler(e,pD)},Nn.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||Zl,i),n&&e.preventDefault()}},Nn.prototype._isEventIgnored=function(e){return!1},Nn.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(l_)),this.unbind(),e=this._node=this._target,Ge.bind(e,"keydown",this._keydownHandler),Ge.bind(e,"keyup",this._keyupHandler),this._fire("bind")},Nn.prototype.getBinding=function(){return this._node},Nn.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),Ge.unbind(e,"keydown",this._keydownHandler),Ge.unbind(e,"keyup",this._keyupHandler)),this._node=null},Nn.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},Nn.prototype.addListener=function(e,t,n){hn(e)&&(n=t,t=e,e=fD),this._eventBus.on(n||Zl,e,t)},Nn.prototype.removeListener=function(e,t){this._eventBus.off(t||Zl,e)},Nn.prototype.hasModifier=Ek,Nn.prototype.isCmd=Xn,Nn.prototype.isShift=fd,Nn.prototype.isKey=ln;var dD=500;function va(e,t){var n=this;e.on("editorActions.init",dD,function(i){var r=i.editorActions;n.registerBindings(t,r)})}va.$inject=["eventBus","keyboard"],va.prototype.registerBindings=function(e,t){function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("undo",function(i){var r=i.keyEvent;if(Mk(r))return t.trigger("undo"),!0}),n("redo",function(i){var r=i.keyEvent;if(Pk(r))return t.trigger("redo"),!0}),n("copy",function(i){var r=i.keyEvent;if(Sk(r))return t.trigger("copy"),!0}),n("paste",function(i){var r=i.keyEvent;if(Rk(r))return t.trigger("paste"),!0}),n("duplicate",function(i){var r=i.keyEvent;if(Ck(r))return t.trigger("duplicate"),!0}),n("cut",function(i){var r=i.keyEvent;if(Ak(r))return t.trigger("cut"),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(ln(["+","Add","="],r)&&Xn(r))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(ln(["-","Subtract"],r)&&Xn(r))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var r=i.keyEvent;if(ln("0",r)&&Xn(r))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var r=i.keyEvent;if(ln(["Backspace","Delete","Del"],r))return t.trigger("removeSelection"),!0})};const Kd={__init__:["keyboard","keyboardBindings"],keyboard:["type",Nn],keyboardBindings:["type",va]};var hD={moveSpeed:50,moveSpeedAccelerated:200};function u_(e,t,n){var i=this;this._config=W({},hD,e||{}),t.addListener(r);function r(o){var a=o.keyEvent,s=i._config;if(t.isCmd(a)&&t.isKey(["ArrowLeft","Left","ArrowUp","Up","ArrowDown","Down","ArrowRight","Right"],a)){var c=t.isShift(a)?s.moveSpeedAccelerated:s.moveSpeed,l;switch(a.key){case"ArrowLeft":case"Left":l="left";break;case"ArrowUp":case"Up":l="up";break;case"ArrowRight":case"Right":l="right";break;case"ArrowDown":case"Down":l="down";break}return i.moveCanvas({speed:c,direction:l}),!0}}this.moveCanvas=function(o){var a=0,s=0,c=o.speed,l=c/Math.min(Math.sqrt(n.viewbox().scale),1);switch(o.direction){case"left":a=l;break;case"up":s=l;break;case"right":a=-l;break;case"down":s=-l;break}n.scroll({dx:a,dy:s})}}u_.$inject=["config.keyboardMove","keyboard","canvas"];const p_={__depends__:[Kd],__init__:["keyboardMove"],keyboardMove:["type",u_]};var mD=15;function f_(e,t){var n;function i(s){return a(s.originalEvent)}e.on("canvas.focus.changed",function(s){s.focused?e.on("element.mousedown",500,i):e.off("element.mousedown",i)});function r(s){var c=n.start,l=n.button,u=ho(s),p=Ti(u,c);if(!n.dragging&&gD(p)>mD&&(n.dragging=!0,l===0&&Pb(e),wl("grab")),n.dragging){var f=n.last||n.start;p=Ti(u,f),t.scroll({dx:p.x,dy:p.y}),n.last=u}s.preventDefault()}function o(s){Ge.unbind(document,"mousemove",r),Ge.unbind(document,"mouseup",o),n=null,Mb()}function a(s){if(!so(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:ho(s)},Ge.bind(document,"mousemove",r),Ge.bind(document,"mouseup",o),!0}}this.isActive=function(){return!!n}}f_.$inject=["eventBus","canvas"];function gD(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const d_={__init__:["moveCanvas"],moveCanvas:["type",f_]};function h_(e,t){var n=lf(e.min),i=lf(e.max),r=Math.abs(n)+Math.abs(i);return r/t}function yD(e,t){return Math.max(e.min,Math.min(e.max,t))}var vD=Math.sign||function(e){return e>=0?1:-1},Xd={min:.2,max:4},m_=10,bD=.1,xD=.75;function qi(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=jn(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||xD;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}qi.$inject=["config.zoomScroll","eventBus","canvas"],qi.prototype.scroll=function(t){this._canvas.scroll(t)},qi.prototype.reset=function(){this._canvas.zoom("fit-viewport")},qi.prototype.zoom=function(t,n){var i=h_(Xd,m_*2);this._totalDelta+=t,Math.abs(this._totalDelta)>bD&&(this._zoom(t,n,i),this._totalDelta=0)},qi.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||Bv()&&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))*vD(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)}},qi.prototype.stepZoom=function(t,n){var i=h_(Xd,m_);this._zoom(t,n,i)},qi.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=lf(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(yD(Xd,s),t)},qi.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,r=this._enabled;return typeof t>"u"&&(t=!r),r!==t&&Ge[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},qi.prototype._init=function(e){this.toggle(e)};const g_={__init__:["zoomScroll"],zoomScroll:["type",qi]};function Ms(e){Gr.call(this,e)}we(Ms,Gr),Ms.prototype._navigationModules=[p_,d_,g_],Ms.prototype._modules=[].concat(Gr.prototype._modules,Ms.prototype._navigationModules);function Zd(e){return e&&e[e.length-1]}function y_(e){return e.y}function v_(e){return e.x}var _D={left:v_,center:v_,right:function(e){return e.x+e.width},top:y_,middle:y_,bottom:function(e){return e.y+e.height}};function ba(e,t){this._modeling=e,this._rules=t}ba.$inject=["modeling","rules"],ba.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}},ba.prototype._isType=function(e,t){return t.indexOf(e)!==-1},ba.prototype._alignmentPosition=function(e,t){var n=this._getOrientationDetails(e),i=n.axis,r=n.dimension,o={},a={},s=!1,c,l,u;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"]))u=Zd(t),o[e]=u[i]+u[r];else if(this._isType(e,["center","middle"])){if(H(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=Di(a,function(f){return f.elements.length>1&&(s=!0),f.elements.length}),s)return o[e]=Zd(c).center,o;l=t[0],t=Di(t,function(f){return f[i]+f[r]}),u=Zd(t),o[e]=p(l,u)}return o},ba.prototype.trigger=function(e,t){var n=this._modeling,i,r=tt(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:r}),$e(i)&&(r=i),!(r.length<2||!i)){var o=_D[t],a=Di(r,o),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const wD={__init__:["alignElements"],alignElements:["type",ba]},ED=new da;function xa(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}xa.$inject=["eventBus"],xa.prototype.schedule=function(e,t=ED.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},xa.prototype._schedule=function(e,t){const n=SD();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}},xa.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},xa.prototype._cancel=function(e){clearTimeout(e.executionId)};function SD(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const RD={scheduler:["type",xa]};var CD="djs-element-hidden",Ql=".entry",AD=1e3,b_=8,MD=300;function tn(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}tn.$inject=["canvas","elementRegistry","eventBus","scheduler"],tn.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=$e(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=$e(i.target)?i.target:[i.target];r.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},tn.prototype._createContainer=function(){var e=Ot('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},tn.prototype.registerProvider=function(e,t){t||(t=e,e=AD),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},tn.prototype.getEntries=function(e){var t=this._getProviders(),n=$e(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return H(t,function(r){if(hn(r[n])){var o=r[n](e);hn(o)?i=o(i):H(o,function(a,s){i[s]=a})}}),i},tn.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)},MD);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(r,e,o,n)},tn.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(hn(s)){if(t==="click")return s(n,r,i)}else if(s[t])return s[t](n,r,i);n.preventDefault()}}}},tn.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))}},tn.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},tn.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),i;H(t,function(r,o){var a=r.group||"default",s=Ot(r.html||'<div class="entry" draggable="true"></div>'),c;On(s,"data-action",o),c=St("[data-group="+As(a)+"]",n),c||(c=Ot('<div class="group"></div>'),On(c,"data-group",a),n.appendChild(c)),c.appendChild(s),r.className&&PD(s,r.className),r.title&&On(s,"title",r.title),r.imageUrl&&(i=Ot("<img>"),On(i,"src",r.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),Bt(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},tn.prototype._createHtml=function(e){var t=this,n=Ot('<div class="djs-context-pad"></div>');return qn.bind(n,Ql,"click",function(i){t.trigger("click",i)}),qn.bind(n,Ql,"dragstart",function(i){t.trigger("dragstart",i)}),qn.bind(n,Ql,"mouseover",function(i){t.trigger("mouseover",i)}),qn.bind(n,Ql,"mouseout",function(i){t.trigger("mouseout",i)}),Ge.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},tn.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()&&kD(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},tn.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},tn.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return $e(e)!==$e(n)?!1:$e(e)?e.length===n.length&&to(e,function(i){return n.includes(i)}):n===e},tn.prototype.isShown=function(){return this.isOpen()&&Bt(this._current.html).has("open")},tn.prototype.show=function(){this.isOpen()&&(Bt(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},tn.prototype.hide=function(){this.isOpen()&&(Bt(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},tn.prototype._getPosition=function(e){if(!$e(e)&&Ct(e)){var t=this._canvas.viewbox(),n=TD(e),i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale;return{left:i+b_*this._canvas.zoom(),top:r}}var o=this._canvas.getContainer(),a=o.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+b_*this._canvas.zoom(),top:s.top-a.top}},tn.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")},tn.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=$e(n)?n:[n],r=i.some(function(o){return t._canvas.hasMarker(o,CD)});r?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},tn.prototype._getTargetBounds=function(e){var t=this,n=$e(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 PD(e,t){var n=Bt(e);t=$e(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function TD(e){return e.waypoints[e.waypoints.length-1]}function kD(e,t){return e=$e(e)?e:[e],t=$e(t)?t:[t],e.length===t.length&&to(e,function(n){return t.includes(n)})}const x_={__depends__:[_l,RD,Kl],contextPad:["type",tn]};var Jl,Ht,__,Vr,w_,E_,S_,Qd,eu,Ps,R_,Jd,eh,th,tu={},nu=[],OD=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,iu=Array.isArray;function pr(e,t){for(var n in t)e[n]=t[n];return e}function nh(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function C_(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?Jl.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 ru(e,a,i,r,null)}function ru(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??++__,__i:-1,__u:0};return r==null&&Ht.vnode!=null&&Ht.vnode(o),o}function ou(e){return e.children}function au(e,t){this.props=e,this.context=t}function _o(e,t){if(t==null)return e.__?_o(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"?_o(e):null}function DD(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],r=[],o=pr({},t);o.__v=t.__v+1,Ht.vnode&&Ht.vnode(o),ih(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??_o(t),!!(32&t.__u),r),o.__v=t.__v,o.__.__k[o.__i]=o,L_(i,o,r),t.__e=t.__=null,o.__e!=n&&A_(o)}}function A_(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}),A_(e)}function M_(e){(!e.__d&&(e.__d=!0)&&Vr.push(e)&&!su.__r++||w_!=Ht.debounceRendering)&&((w_=Ht.debounceRendering)||E_)(su)}function su(){try{for(var e,t=1;Vr.length;)Vr.length>t&&Vr.sort(S_),e=Vr.shift(),t=Vr.length,DD(e)}finally{Vr.length=su.__r=0}}function P_(e,t,n,i,r,o,a,s,c,l,u){var p,f,d,g,h,y,R=i&&i.__k||nu,x=t.length;for(c=LD(n,t,R,c,x),p=0;p<x;p++)(d=n.__k[p])!=null&&(f=d.__i!=-1&&R[d.__i]||tu,d.__i=p,y=ih(e,d,f,r,o,a,s,c,l,u),g=d.__e,d.ref&&f.ref!=d.ref&&(f.ref&&rh(f.ref,null,d),u.push(d.ref,d.__c||g,d)),h==null&&g!=null&&(h=g),4&d.__u?(c=T_(d,c,e),f.__e&&(f.__e=null)):typeof d.type=="function"&&y!==void 0?c=y:g&&(c=g.nextSibling),d.__u&=-7);return n.__e=h,c}function LD(e,t,n,i,r){var o,a,s,c,l,u=n.length,p=u,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]=ru(null,a,null,null,null):iu(a)?a=e.__k[o]=ru(ou,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=ru(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,(l=a.__i=ID(a,n,c,p))!=-1&&(p--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(r>u?f--:r<u&&f++),typeof a.type!="function"&&(a.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,a.__u|=4))):e.__k[o]=null;if(p)for(o=0;o<u;o++)(s=n[o])!=null&&(2&s.__u)==0&&(s.__e==i&&(i=_o(s)),B_(s,s));return i}function T_(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=T_(i[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=_o(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function ID(e,t,n,i){var r,o,a,s=e.key,c=e.type,l=t[n],u=l!=null&&(2&l.__u)==0;if(l===null&&s==null||u&&s==l.key&&c==l.type)return n;if(i>(u?1:0)){for(r=n-1,o=n+1;r>=0||o<t.length;)if((l=t[a=r>=0?r--:o++])!=null&&(2&l.__u)==0&&s==l.key&&c==l.type)return a}return-1}function k_(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||OD.test(t)?n:n+"px"}function cu(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||k_(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||k_(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(R_,"$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[Ps]=i[Ps]:(n[Ps]=Jd,e.addEventListener(t,o?th:eh,o)):e.removeEventListener(t,o?th:eh,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 O_(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[eu]==null)t[eu]=Jd++;else if(t[eu]<n[Ps])return;return n(Ht.event?Ht.event(t):t)}}}function ih(e,t,n,i,r,o,a,s,c,l){var u,p,f,d,g,h,y,R,x,m,v,_,E,T,k,I,P=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[s=t.__e=n.__e]),(u=Ht.__b)&&u(t);e:if(typeof P=="function"){p=a.length;try{if(x=t.props,m=P.prototype&&P.prototype.render,v=(u=P.contextType)&&i[u.__c],_=u?v?v.props.value:u.__:i,n.__c?R=(f=t.__c=n.__c).__=f.__E:(m?t.__c=f=new P(x,_):(t.__c=f=new au(x,_),f.constructor=P,f.render=ND),v&&v.sub(f),f.state||(f.state={}),f.__n=i,d=f.__d=!0,f.__h=[],f._sb=[]),m&&f.__s==null&&(f.__s=f.state),m&&P.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=pr({},f.__s)),pr(f.__s,P.getDerivedStateFromProps(x,f.__s))),g=f.props,h=f.state,f.__v=t,d)m&&P.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),m&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(m&&P.getDerivedStateFromProps==null&&x!==g&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(x,_),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(x,f.__s,_)===!1){t.__v!=n.__v&&(f.props=x,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(O){O&&(O.__=t)}),nu.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&a.push(f),s=_o(n);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(x,f.__s,_),m&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(g,h,y)})}if(f.context=_,f.props=x,f.__P=e,f.__e=!1,E=Ht.__r,T=0,m)f.state=f.__s,f.__d=!1,E&&E(t),u=f.render(f.props,f.state,f.context),nu.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,E&&E(t),u=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++T<25);f.state=f.__s,f.getChildContext!=null&&(i=pr(pr({},i),f.getChildContext())),m&&!d&&f.getSnapshotBeforeUpdate!=null&&(y=f.getSnapshotBeforeUpdate(g,h)),k=u!=null&&u.type===ou&&u.key==null?I_(u.props.children):u,s=P_(e,iu(k)?k:[k],t,n,i,r,o,a,s,c,l),f.base=t.__e,t.__u&=-161,f.__h.length&&a.push(f),R&&(f.__E=f.__=null)}catch(O){if(a.length=p,t.__v=null,c||o!=null){if(O.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(I=o.length;I--;)nh(o[I])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),O.then||D_(t),Ht.__e(O,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=BD(n.__e,t,n,i,r,o,a,c,l);return(u=Ht.diffed)&&u(t),128&t.__u?void 0:s}function D_(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(D_))}function L_(e,t,n){for(var i=0;i<n.length;i++)rh(n[i],n[++i],n[++i]);Ht.__c&&Ht.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){Ht.__e(o,r.__v)}})}function I_(e){return typeof e!="object"||e==null||e.__b>0?e:iu(e)?e.map(I_):e.constructor!==void 0?null:pr({},e)}function BD(e,t,n,i,r,o,a,s,c){var l,u,p,f,d,g,h,y=n.props||tu,R=t.props,x=t.type;if(x=="svg"?r="http://www.w3.org/2000/svg":x=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),o!=null){for(l=0;l<o.length;l++)if((d=o[l])&&"setAttribute"in d==!!x&&(x?d.localName==x:d.nodeType==3)){e=d,o[l]=null;break}}if(e==null){if(x==null)return document.createTextNode(R);e=document.createElementNS(r,x,R.is&&R),s&&(Ht.__m&&Ht.__m(t,o),s=!1),o=null}if(x==null)y===R||s&&e.data==R||(e.data=R);else{if(o=x=="textarea"&&R.defaultValue!=null?null:o&&Jl.call(e.childNodes),!s&&o!=null)for(y={},l=0;l<e.attributes.length;l++)y[(d=e.attributes[l]).name]=d.value;for(l in y)d=y[l],l=="dangerouslySetInnerHTML"?p=d:l=="children"||l in R||l=="value"&&"defaultValue"in R||l=="checked"&&"defaultChecked"in R||cu(e,l,null,d,r);for(l in R)d=R[l],l=="children"?f=d:l=="dangerouslySetInnerHTML"?u=d:l=="value"?g=d:l=="checked"?h=d:s&&typeof d!="function"||y[l]===d||cu(e,l,d,y[l],r);if(u)s||p&&(u.__html==p.__html||u.__html==e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(p&&(e.innerHTML=""),P_(t.type=="template"?e.content:e,iu(f)?f:[f],t,n,i,x=="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,a,o?o[0]:n.__k&&_o(n,0),s,c),o!=null)for(l=o.length;l--;)nh(o[l]);s&&x!="textarea"||(l="value",x=="progress"&&g==null?e.removeAttribute("value"):g!=null&&(g!==e[l]||x=="progress"&&!g||x=="option"&&g!=y[l])&&cu(e,l,g,y[l],r),l="checked",h!=null&&h!=e[l]&&cu(e,l,h,y[l],r))}return e}function rh(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){Ht.__e(r,n)}}function B_(e,t,n){var i,r;if(Ht.unmount&&Ht.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||rh(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){Ht.__e(o,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&B_(i[r],t,n||typeof e.type!="function");n||nh(e.__e),e.__c=e.__=e.__e=void 0}function ND(e,t,n){return this.constructor(e,n)}function N_(e,t,n){var i,r,o,a;t==document&&(t=document.documentElement),Ht.__&&Ht.__(e,t),r=(i=!1)?null:t.__k,o=[],a=[],ih(t,e=t.__k=C_(ou,null,[e]),r||tu,tu,t.namespaceURI,r?null:t.firstChild?Jl.call(t.childNodes):null,o,r?r.__e:t.firstChild,i,a),L_(o,e,a),e.props.children=null}Jl=nu.slice,Ht={__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}},__=0,au.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=pr({},this.state),typeof e=="function"&&(e=e(pr({},n),this.props)),e&&pr(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),M_(this))},au.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),M_(this))},au.prototype.render=ou,Vr=[],E_=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,S_=function(e,t){return e.__v.__b-t.__v.__b},su.__r=0,Qd=Math.random().toString(8),eu="__d"+Qd,Ps="__a"+Qd,R_=/(PointerCapture)$|Capture$/i,Jd=0,eh=O_(!1),th=O_(!0);var $_=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,$_(e,s,n,["",null])),i.push(r),s[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(s)}return i},F_=new Map;function $D(e){var t=F_.get(this);return t||(t=new Map,F_.set(this,t)),(t=$_(this,t.get(e)||(t.set(e,t=(function(n){for(var i,r,o=1,a="",s="",c=[0],l=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=""},u=0;u<n.length;u++){u&&(o===1&&l(),l(u));for(var p=0;p<n[u].length;p++)i=n[u][p],o===1?i==="<"?(l(),c=[c],o=3):a+=i:o===4?a==="--"&&i===">"?(o=1,a=""):a=i+a[0]:s?i===s?s="":a+=i:i==='"'||i==="'"?s=i:i===">"?(l(),o=1):o&&(i==="="?(o=5,r=a,a=""):i==="/"&&(o<5||n[u][p+1]===">")?(l(),o===3&&(c=c[0]),o=c,(c=c[0]).push(2,0,o),o=0):i===" "||i===" "||i===`
11
+ `||i==="\r"?(l(),o=2):a+=i),o===3&&a==="!--"&&(o=4,c=c[0])}return l(),c})(e)),t),arguments,[])).length>1?t:t[0]}var Mt=$D.bind(C_),_a,nn,oh,j_,Ts=0,H_=[],un=Ht,z_=un.__b,G_=un.__r,V_=un.diffed,W_=un.__c,U_=un.unmount,q_=un.__;function lu(e,t){un.__h&&un.__h(nn,e,Ts||t),Ts=0;var n=nn.__H||(nn.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function ah(e){return Ts=1,FD(K_,e)}function FD(e,t,n){var i=lu(_a++,2);if(i.t=e,!i.__c&&(i.__=[K_(void 0,t),function(s){var c=i.__N?i.__N[0]:i.__[0],l=i.t(c,s);c!==l&&(i.__N=[l,i.__[1]],i.__c.setState({}))}],i.__c=nn,!nn.__f)){var r=function(s,c,l){if(!i.__c.__H)return!0;var u=!1,p=i.__c.props!==s;if(i.__c.__H.__.some(function(d){if(d.__N){u=!0;var g=d.__[0];d.__=d.__N,d.__N=void 0,g!==d.__[0]&&(p=!0)}}),o){var f=o.call(this,s,c,l);return u?f||p:f}return!u||p};nn.__f=!0;var o=nn.shouldComponentUpdate,a=nn.componentWillUpdate;nn.componentWillUpdate=function(s,c,l){if(this.__e){var u=o;o=void 0,r(s,c,l),o=u}a&&a.call(this,s,c,l)},nn.shouldComponentUpdate=r}return i.__N||i.__}function uu(e,t){var n=lu(_a++,3);!un.__s&&lh(n.__H,t)&&(n.__=e,n.u=t,nn.__H.__h.push(n))}function sh(e,t){var n=lu(_a++,4);!un.__s&&lh(n.__H,t)&&(n.__=e,n.u=t,nn.__h.push(n))}function pu(e){return Ts=5,fr(function(){return{current:e}},[])}function fr(e,t){var n=lu(_a++,7);return lh(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function ks(e,t){return Ts=8,fr(function(){return e},t)}function jD(){for(var e;e=H_.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(fu),t.__h.some(ch),t.__h=[]}catch(n){t.__h=[],un.__e(n,e.__v)}}}un.__b=function(e){nn=null,z_&&z_(e)},un.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),q_&&q_(e,t)},un.__r=function(e){G_&&G_(e),_a=0;var t=(nn=e.__c).__H;t&&(oh===nn?(t.__h=[],nn.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(fu),t.__h.some(ch),t.__h=[],_a=0)),oh=nn},un.diffed=function(e){V_&&V_(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(H_.push(t)!==1&&j_===un.requestAnimationFrame||((j_=un.requestAnimationFrame)||HD)(jD)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),oh=nn=null},un.__c=function(e,t){t.some(function(n){try{n.__h.some(fu),n.__h=n.__h.filter(function(i){return!i.__||ch(i)})}catch(i){t.some(function(r){r.__h&&(r.__h=[])}),t=[],un.__e(i,n.__v)}}),W_&&W_(e,t)},un.unmount=function(e){U_&&U_(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{fu(i)}catch(r){t=r}}),n.__H=void 0,t&&un.__e(t,n.__v))};var Y_=typeof requestAnimationFrame=="function";function HD(e){var t,n=function(){clearTimeout(i),Y_&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);Y_&&(t=requestAnimationFrame(n))}function fu(e){var t=nn,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),nn=t}function ch(e){var t=nn;e.__c=e.__(),nn=t}function lh(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function K_(e,t){return typeof t=="function"?t(e):t}function zD(e){const{navigationStack:t,setNavigationStack:n}=e,i=fr(()=>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 Mt`
12
12
  <div class="djs-popup-breadcrumbs">
13
13
  ${r&&Mt`
14
14
  <button
@@ -41,7 +41,7 @@
41
41
  </span>
42
42
  `}
43
43
  </div>
44
- `}function $_(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=$_(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function cu(){for(var e,t,n=0,i="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=$_(e))&&(i&&(i+=" "),i+=t);return i}function SD(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:r,title:o}=e,a=pr(()=>RD(t),[t]),s=l=>l.action&&!l.disabled,c=(l,u)=>{if(s(u))return n(l,u)};return Mt`
44
+ `}function X_(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=X_(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function du(){for(var e,t,n=0,i="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=X_(e))&&(i&&(i+=" "),i+=t);return i}function GD(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:r,title:o}=e,a=fr(()=>VD(t),[t]),s=l=>l.action&&!l.disabled,c=(l,u)=>{if(s(u))return n(l,u)};return Mt`
45
45
  <div class="djs-popup-header">
46
46
  <h3 class="djs-popup-title" title=${o}>${o}</h3>
47
47
  ${a.map(l=>Mt`
@@ -50,7 +50,7 @@
50
50
  ${l.entries.map(u=>Mt`
51
51
  <li key=${u.id}>
52
52
  <${s(u)?"button":"span"}
53
- class=${CD(u,u===i)}
53
+ class=${WD(u,u===i)}
54
54
  onClick=${p=>c(p,u)}
55
55
  title=${u.title||u.label}
56
56
  data-id=${u.id}
@@ -70,11 +70,11 @@
70
70
  </ul>
71
71
  `)}
72
72
  </div>
73
- `}function RD(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 CD(e,t){return cu("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function F_(e,t){return`${e}-entry-${t.id}`}function AD(e){const{idPrefix:t,entry:n,selected:i,onMouseEnter:r,onMouseLeave:o,onAction:a}=e,s=(l,u)=>{if(!n.disabled)return a(l,n,u)},c=!n.entries;return Mt`
73
+ `}function VD(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 WD(e,t){return du("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function Z_(e,t){return`${e}-entry-${t.id}`}function UD(e){const{idPrefix:t,entry:n,selected:i,onMouseEnter:r,onMouseLeave:o,onAction:a}=e,s=(l,u)=>{if(!n.disabled)return a(l,n,u)},c=!n.entries;return Mt`
74
74
  <li
75
- class=${cu("entry",{selected:i,disabled:n.disabled})}
75
+ class=${du("entry",{selected:i,disabled:n.disabled})}
76
76
  data-id=${n.id}
77
- id=${F_(t,n)}
77
+ id=${Z_(t,n)}
78
78
  role="option"
79
79
  aria-selected=${i||void 0}
80
80
  aria-haspopup=${n.entries?"true":void 0}
@@ -88,7 +88,7 @@
88
88
  >
89
89
  <div class="djs-popup-entry-content">
90
90
  <span
91
- class=${cu("djs-popup-entry-name",n.className)}
91
+ class=${du("djs-popup-entry-name",n.className)}
92
92
  >
93
93
  ${n.imageUrl&&Mt`<img class="djs-popup-entry-icon" src=${n.imageUrl} alt="" />`||n.imageHtml&&Mt`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:n.imageHtml}} />`}
94
94
 
@@ -131,7 +131,7 @@
131
131
  </div>
132
132
  `}
133
133
  </li>
134
- `}function MD(e){const{selectedEntry:t,setSelectedEntry:n,groupedEntries:i,keyboardSelection:r,idPrefix:o,id:a,ariaLabel:s,tabIndex:c,ariaActivedescendant:l,...u}=e,p=au();Xd(()=>{if(!r||!r.current)return;const m=p.current;if(!m)return;const v=m.querySelector(".selected");v&&PD(v)},[t]);const f=()=>{r.current=!1},d=m=>{r.current||n(m)},h=()=>{r.current||n(null)};return Mt`
134
+ `}function qD(e){const{selectedEntry:t,setSelectedEntry:n,groupedEntries:i,keyboardSelection:r,idPrefix:o,id:a,ariaLabel:s,tabIndex:c,ariaActivedescendant:l,...u}=e,p=pu();sh(()=>{if(!r||!r.current)return;const h=p.current;if(!h)return;const y=h.querySelector(".selected");y&&YD(y)},[t]);const f=()=>{r.current=!1},d=h=>{r.current||n(h)},g=()=>{r.current||n(null)};return Mt`
135
135
  <div
136
136
  class="djs-popup-results"
137
137
  ref=${p}
@@ -142,45 +142,45 @@
142
142
  aria-activedescendant=${l}
143
143
  onMouseMove=${f}
144
144
  >
145
- ${i.map(m=>Mt`
146
- ${m.name&&Mt`
147
- <div key=${m.id} id=${j_(o,m)} class="entry-header" title=${m.name}>
148
- ${m.name}
145
+ ${i.map(h=>Mt`
146
+ ${h.name&&Mt`
147
+ <div key=${h.id} id=${Q_(o,h)} class="entry-header" title=${h.name}>
148
+ ${h.name}
149
149
  </div>
150
150
  `}
151
151
  <ul
152
152
  class="djs-popup-group"
153
- data-group=${m.id}
153
+ data-group=${h.id}
154
154
  role="group"
155
- aria-labelledby=${m.name?j_(o,m):void 0}
155
+ aria-labelledby=${h.name?Q_(o,h):void 0}
156
156
  >
157
- ${m.entries.map(v=>Mt`
158
- <${AD}
159
- key=${v.id}
157
+ ${h.entries.map(y=>Mt`
158
+ <${UD}
159
+ key=${y.id}
160
160
  idPrefix=${o}
161
- entry=${v}
162
- selected=${v===t}
163
- onMouseEnter=${()=>d(v)}
164
- onMouseLeave=${h}
161
+ entry=${y}
162
+ selected=${y===t}
163
+ onMouseEnter=${()=>d(y)}
164
+ onMouseLeave=${g}
165
165
  ...${u}
166
166
  />
167
167
  `)}
168
168
  </ul>
169
169
  `)}
170
170
  </div>
171
- `}function j_(e,t){return`${e}-group-${t.id}`}function PD(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const TD=new ca("djs-popup");function kD(e){const{onClose:t,onSelect:n,className:i,headerEntries:r,position:o,title:a,width:s,scale:c,search:l,emptyPlaceholder:u,searchFn:p,entries:f,onOpened:d,onClosed:h}=e,[m,v]=Kd([]);ou(()=>{v([])},[f]);const[w,x]=Kd(""),g=w.trim().length>0,y=pr(()=>LD(f),[f]),S=pr(()=>an(l)?y.length>5:!1,[l,y]),E=pr(()=>{const K=m.length?m[m.length-1].entries:f;return S?g?p(y.filter(({searchable:V})=>V!==!1),w,{keys:["label","search","description"]}).map(({item:V})=>V):K.filter(({rank:V=0})=>V>=0):K},[S,g,y,w,p,m,f]),T=pr(()=>g?E.length?[{id:"default",entries:E}]:[]:ID(E),[E,g]),[k,I]=Kd(E[0]),P=au(null),O=au(!1),F=pr(()=>TD.next(),[]),Z=`${F}-results`,he=k&&F_(F,k);ou(()=>{const K=P.current;K&&E.includes(K)?I(K):I(E[0]),P.current=null},[E]);const Me=As(K=>{const V=DD(T);let Te=V.indexOf(k)+K;Te<0&&(Te=V.length-1),Te>=V.length&&(Te=0),O.current=!0,I(V[Te])},[T,k]),Be=As(K=>{K>0&&k&&k.entries&&(O.current=!0,v(V=>[...V,k])),K<0&&m.length>0&&(O.current=!0,P.current=m[m.length+K],v(V=>V.slice(0,K)))},[k,m]),nt=As((K,V,ie)=>{if(!(!V||V.disabled))return V.entries?(K.preventDefault(),Be(1)):n(K,V,ie)},[n,Be]),J=As(K=>{if(K.key==="Enter"&&k){const V=K.target;return!!ro(V,"a, button",!0)||k.disabled?void 0:nt(K,k)}if(K.key==="Backspace"){const V=K.target;if(!(Tp(V,"input")&&V.value!==""))return Be(-1),K.preventDefault()}if(K.key==="ArrowUp")return Me(-1),K.preventDefault();if(K.key==="ArrowDown")return Me(1),K.preventDefault();if(K.key==="ArrowRight")return Be(1),K.preventDefault();if(K.key==="ArrowLeft")return Be(-1),K.preventDefault()},[k,Me,Be,nt]),te=As(K=>{Tp(K.target,"input")&&x(()=>K.target.value)},[x]);ou(()=>(d(),()=>{h()}),[]);const pe=!g&&m.length>0,xe=(a||r.length>0)&&!pe;return Mt`
172
- <${H_}
171
+ `}function Q_(e,t){return`${e}-group-${t.id}`}function YD(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const KD=new da("djs-popup");function XD(e){const{onClose:t,onSelect:n,className:i,headerEntries:r,position:o,title:a,width:s,scale:c,search:l,emptyPlaceholder:u,searchFn:p,entries:f,onOpened:d,onClosed:g}=e,[h,y]=ah([]);uu(()=>{y([])},[f]);const[R,x]=ah(""),m=R.trim().length>0,v=fr(()=>JD(f),[f]),_=fr(()=>an(l)?v.length>5:!1,[l,v]),E=fr(()=>{const U=h.length?h[h.length-1].entries:f;return _?m?p(v.filter(({searchable:K})=>K!==!1),R,{keys:["label","search","description"]}).map(({item:K})=>K):U.filter(({rank:K=0})=>K>=0):U},[_,m,v,R,p,h,f]),T=fr(()=>m?E.length?[{id:"default",entries:E}]:[]:eL(E),[E,m]),[k,I]=ah(E[0]),P=pu(null),O=pu(!1),F=fr(()=>KD.next(),[]),J=`${F}-results`,he=k&&Z_(F,k);uu(()=>{const U=P.current;U&&E.includes(U)?I(U):I(E[0]),P.current=null},[E]);const Pe=ks(U=>{const K=QD(T);let pe=K.indexOf(k)+U;pe<0&&(pe=K.length-1),pe>=K.length&&(pe=0),O.current=!0,I(K[pe])},[T,k]),De=ks(U=>{U>0&&k&&k.entries&&(O.current=!0,y(K=>[...K,k])),U<0&&h.length>0&&(O.current=!0,P.current=h[h.length+U],y(K=>K.slice(0,U)))},[k,h]),Ke=ks((U,K,ie)=>{if(!(!K||K.disabled))return K.entries?(U.preventDefault(),De(1)):n(U,K,ie)},[n,De]),rt=ks(U=>{if(U.key==="Enter"&&k){const K=U.target;return!!so(K,"a, button",!0)||k.disabled?void 0:Ke(U,k)}if(U.key==="Backspace"){const K=U.target;if(!(Hp(K,"input")&&K.value!==""))return De(-1),U.preventDefault()}if(U.key==="ArrowUp")return Pe(-1),U.preventDefault();if(U.key==="ArrowDown")return Pe(1),U.preventDefault();if(U.key==="ArrowRight")return De(1),U.preventDefault();if(U.key==="ArrowLeft")return De(-1),U.preventDefault()},[k,Pe,De,Ke]),Ce=ks(U=>{Hp(U.target,"input")&&x(()=>U.target.value)},[x]);uu(()=>(d(),()=>{g()}),[]);const X=!m&&h.length>0,te=(a||r.length>0)&&!X;return Mt`
172
+ <${J_}
173
173
  onClose=${t}
174
- onKeyup=${te}
175
- onKeydown=${J}
174
+ onKeyup=${Ce}
175
+ onKeydown=${rt}
176
176
  className=${i}
177
177
  position=${o}
178
178
  width=${s}
179
179
  scale=${c}
180
- navigationStack=${m}
180
+ navigationStack=${h}
181
181
  >
182
- ${xe&&Mt`
183
- <${SD}
182
+ ${te&&Mt`
183
+ <${GD}
184
184
  headerEntries=${r}
185
185
  onSelect=${n}
186
186
  selectedEntry=${k}
@@ -188,16 +188,16 @@
188
188
  title=${a}
189
189
  />
190
190
  `}
191
- ${pe&&Mt`
192
- <${ED}
193
- navigationStack=${m}
194
- setNavigationStack=${v}
191
+ ${X&&Mt`
192
+ <${zD}
193
+ navigationStack=${h}
194
+ setNavigationStack=${y}
195
195
  />
196
196
  `}
197
197
  ${f.length>0&&Mt`
198
198
  <div class="djs-popup-body">
199
199
 
200
- ${S&&Mt`
200
+ ${_&&Mt`
201
201
  <div class="djs-popup-search">
202
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">
203
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"/>
@@ -208,30 +208,30 @@
208
208
  role="combobox"
209
209
  aria-label="${a||"Search"}"
210
210
  aria-expanded="true"
211
- aria-controls=${Z}
211
+ aria-controls=${J}
212
212
  aria-activedescendant=${he||void 0}
213
213
  aria-autocomplete="list"
214
214
  />
215
215
  </div>
216
216
  `}
217
217
 
218
- ${g&&Mt`
218
+ ${m&&Mt`
219
219
  <div class="djs-popup-search-count" aria-live="polite">
220
220
  ${E.length} ${E.length===1?"result":"results"} found
221
221
  </div>
222
222
  `}
223
223
 
224
- <${MD}
224
+ <${qD}
225
225
  groupedEntries=${T}
226
226
  selectedEntry=${k}
227
227
  setSelectedEntry=${I}
228
228
  keyboardSelection=${O}
229
- onAction=${nt}
229
+ onAction=${Ke}
230
230
  idPrefix=${F}
231
- id=${Z}
231
+ id=${J}
232
232
  ariaLabel=${a||"Results"}
233
- tabIndex=${S?-1:0}
234
- ariaActivedescendant=${S?void 0:he||void 0}
233
+ tabIndex=${_?-1:0}
234
+ ariaActivedescendant=${_?void 0:he||void 0}
235
235
  />
236
236
 
237
237
  ${k&&k.documentationRef&&Mt`
@@ -239,7 +239,7 @@
239
239
  <a
240
240
  class="djs-popup-footer-docs"
241
241
  href=${k.documentationRef}
242
- onClick=${K=>K.stopPropagation()}
242
+ onClick=${U=>U.stopPropagation()}
243
243
  aria-label=${k.label?`Open entry documentation for ${k.label}`:"Open entry documentation"}
244
244
  target="_blank"
245
245
  rel="noopener"
@@ -255,13 +255,13 @@
255
255
  </div>
256
256
  `}
257
257
  ${u&&E.length===0&&Mt`
258
- <div class="djs-popup-no-results">${hn(u)?u(w):u}</div>
258
+ <div class="djs-popup-no-results">${hn(u)?u(R):u}</div>
259
259
  `}
260
- </${H_}>
261
- `}function H_(e){const{onClose:t,onKeydown:n,onKeyup:i,className:r,children:o,navigationStack:a,position:s}=e,c=au();return Xd(()=>{if(typeof s!="function")return;const l=c.current,u=s(l);l.style.left=`${u.x}px`,l.style.top=`${u.y}px`},[c.current,s]),Xd(()=>{const l=c.current;if(!l)return;(l.querySelector("input")||l.querySelector('[role="listbox"]')||l).focus()},[a]),ou(()=>{const l=p=>{if(p.key==="Escape")return p.preventDefault(),t()},u=p=>{if(!ro(p.target,".djs-popup",!0))return t()};return document.documentElement.addEventListener("keydown",l),document.body.addEventListener("click",u,!0),()=>{document.documentElement.removeEventListener("keydown",l),document.body.removeEventListener("click",u,!0)}},[]),Mt`
260
+ </${J_}>
261
+ `}function J_(e){const{onClose:t,onKeydown:n,onKeyup:i,className:r,children:o,navigationStack:a,position:s}=e,c=pu();return sh(()=>{if(typeof s!="function")return;const l=c.current,u=s(l);l.style.left=`${u.x}px`,l.style.top=`${u.y}px`},[c.current,s]),sh(()=>{const l=c.current;if(!l)return;(l.querySelector("input")||l.querySelector('[role="listbox"]')||l).focus()},[a]),uu(()=>{const l=p=>{if(p.key==="Escape")return p.preventDefault(),t()},u=p=>{if(!so(p.target,".djs-popup",!0))return t()};return document.documentElement.addEventListener("keydown",l),document.body.addEventListener("click",u,!0),()=>{document.documentElement.removeEventListener("keydown",l),document.body.removeEventListener("click",u,!0)}},[]),Mt`
262
262
  <div
263
- class=${cu("djs-popup",r)}
264
- style=${OD(e)}
263
+ class=${du("djs-popup",r)}
264
+ style=${ZD(e)}
265
265
  onKeydown=${n}
266
266
  onKeyup=${i}
267
267
  ref=${c}
@@ -269,10 +269,10 @@
269
269
  >
270
270
  ${o}
271
271
  </div>
272
- `}function OD(e){const{width:t}=e,n=typeof t=="number"?`${t}px`:t;return{transform:`scale(${e.scale})`,width:an(t)?n:void 0,maxWidth:an(t)?"unset":void 0,"transform-origin":"top left"}}function DD(e){const t=[];return e.forEach(n=>{n.entries.forEach(i=>{t.push(i)})}),t}function LD(e){const t=[];function n(i){i.forEach(r=>{if(r.entries){n(r.entries);return}t.push(r)})}return n(e),t}function ID(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 BD="data-id",z_=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],ND=1e3;function zt(e,t,n,i){this._eventBus=t,this._canvas=n,this._search=i,this._current=null;var r=an(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()})}zt.$inject=["config.popupMenu","eventBus","canvas","search"],zt.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:i,emptyPlaceholder:r,options:o}=this._current,a=G_(n),s=Object.entries(i).map(([f,d])=>({id:f,...d})),c=e&&(f=>this._ensureVisible(f,e)),l=this._updateScale(this._current.container);R_(Mt`
273
- <${kD}
272
+ `}function ZD(e){const{width:t}=e,n=typeof t=="number"?`${t}px`:t;return{transform:`scale(${e.scale})`,width:an(t)?n:void 0,maxWidth:an(t)?"unset":void 0,"transform-origin":"top left"}}function QD(e){const t=[];return e.forEach(n=>{n.entries.forEach(i=>{t.push(i)})}),t}function JD(e){const t=[];function n(i){i.forEach(r=>{if(r.entries){n(r.entries);return}t.push(r)})}return n(e),t}function eL(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 tL="data-id",ew=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],nL=1e3;function zt(e,t,n,i){this._eventBus=t,this._canvas=n,this._search=i,this._current=null;var r=an(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()})}zt.$inject=["config.popupMenu","eventBus","canvas","search"],zt.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:i,emptyPlaceholder:r,options:o}=this._current,a=tw(n),s=Object.entries(i).map(([f,d])=>({id:f,...d})),c=e&&(f=>this._ensureVisible(f,e)),l=this._updateScale(this._current.container);N_(Mt`
273
+ <${XD}
274
274
  onClose=${f=>this.close(f)}
275
- onSelect=${(f,d,h)=>this.trigger(f,d,h)}
275
+ onSelect=${(f,d,g)=>this.trigger(f,d,g)}
276
276
  position=${c}
277
277
  className=${t}
278
278
  entries=${a}
@@ -284,7 +284,7 @@
284
284
  searchFn=${this._search}
285
285
  ...${{...o}}
286
286
  />
287
- `,this._current.container)},zt.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()},zt.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()},zt.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)}},zt.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},zt.prototype.reset=function(){const e=this._current.container;R_(null,e),$i(e)},zt.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},zt.prototype._onOpened=function(){this._emit("opened")},zt.prototype._onClosed=function(){this._emit("closed")},zt.prototype._createContainer=function(e){var t=this._canvas,n=t.getContainer();const i=Ot(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return n.appendChild(i),i},zt.prototype._bindAutoClose=function(){this._eventBus.once(z_,this.close,this)},zt.prototype._unbindAutoClose=function(){this._eventBus.off(z_,this.close,this)},zt.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),an(n)&&e<n&&(r=n),an(i)&&e>i&&(r=i)),r},zt.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}},zt.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},zt.prototype.registerProvider=function(e,t,n){n||(n=t,t=ND),this._eventBus.on("popupMenu.getProviders."+e,t,function(i){i.providers.push(n)})},zt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},zt.prototype._getEntries=function(e,t){var n={};return H(t,function(i){if(!i.getPopupMenuEntries){H(i.getEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=Di(o,["id"])});return}var r=i.getPopupMenuEntries(e);hn(r)?n=r(n):H(r,function(o,a){n[a]=o})}),n},zt.prototype._getHeaderEntries=function(e,t){var n={};return H(t,function(i){if(!i.getPopupMenuHeaderEntries){if(!i.getHeaderEntries)return;H(i.getHeaderEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=Di(o,["id"])});return}var r=i.getPopupMenuHeaderEntries(e);hn(r)?n=r(n):H(r,function(o,a){n[a]=o})}),n},zt.prototype._getEmptyPlaceholder=function(e){const t=e.find(n=>hn(n.getEmptyPlaceholder));return t&&t.getEmptyPlaceholder()},zt.prototype.isOpen=function(){return!!this._current},zt.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let r=ro(e.delegateTarget||e.target,".entry",!0),o=kn(r,BD);t={id:o,...this._getEntry(o)}}const i=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(hn(i)){if(n==="click")return i(e,t)}else if(i[n])return i[n](e,t)}},zt.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 G_(e,t=[]){return Object.entries(e).map(([n,i])=>{const r={id:n,...i};return r.entries?r.entries=G_(r.entries,[...t,...V_(r.search)]):t.length&&(r.search=[...t,...V_(r.search)]),r})}function V_(e){return e?Fe(e)?e:[e]:[]}function $D(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=FD(o,r,i);return a?{item:o,tokens:a}:[]}).sort(jD(i))}function FD(e,t,n){const{matchedWords:i,tokens:r}=n.reduce((o,a)=>{const s=e[a],{tokens:c,matchedWords:l}=Fe(s)?s.reduce((u,p)=>{const{tokens:f,matchedWords:d}=K_(p,t);return{tokens:[...u.tokens,f],matchedWords:{...u.matchedWords,...d}}},{matchedWords:{},tokens:[]}):K_(s,t);return{tokens:{...o.tokens,[a]:c},matchedWords:{...o.matchedWords,...l}}},{matchedWords:{},tokens:{}});return Object.keys(i).length!==t.length?null:r}function jD(e){return(t,n)=>{let i=0,r=1;for(const o of e){const a=HD(t.tokens[o],n.tokens[o]);if(a!==0){i+=a*r,r*=W_;continue}const s=zD(t.item[o],n.item[o]);if(s!==0){i+=s*r,r*=W_;continue}}return i}}function HD(e,t){return U_(t)-U_(e)}const W_=.5,ya={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+q_(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 q_(e){if(Fe(e))return Math.max(...e.map(q_));const t=Math.log(e.value.length);return e.match?(e.start?e.end?ya.FULL:e.wordEnd?ya.START_FULL_WORD:ya.START_WORD_PART:e.wordStart?ya.WORD_START:ya.WORD_PART)*t:ya.NO_MATCH*t}function Y_(e=""){return Fe(e)?e.join(", "):e}function zD(e,t){return Y_(e).localeCompare(Y_(t))}function K_(e,t){var l;if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},r=t.map(GD),o=[`(?<all>${r.join("\\s+")})`,...r].join("|"),a=new RegExp(o,"ig");let s,c=0;for(;s=a.exec(e);){const[u]=s,p=s.index,f=s.index+u.length,d=p===0,h=f===e.length,m=!!((l=s.groups)!=null&&l.all),v=d||/\s/.test(e.charAt(p-1)),w=h||/\s/.test(e.charAt(f));s.index>c&&n.push({value:e.slice(c,s.index),index:c}),n.push({value:u,index:s.index,match:!0,wordStart:v,wordEnd:w,start:d,end:h,all:m});const x=m?t:[u];for(const g of x)i[g.toLowerCase()]=!0;c=s.index+u.length}return c<e.length&&n.push({value:e.slice(c),index:c}),{tokens:n,matchedWords:i}}function GD(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}const X_={search:["value",$D]},Jd={__depends__:[X_],__init__:["popupMenu"],popupMenu:["type",zt]};var Z_={align:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2000 2000">
287
+ `,this._current.container)},zt.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()},zt.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()},zt.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)}},zt.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},zt.prototype.reset=function(){const e=this._current.container;N_(null,e),Fi(e)},zt.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},zt.prototype._onOpened=function(){this._emit("opened")},zt.prototype._onClosed=function(){this._emit("closed")},zt.prototype._createContainer=function(e){var t=this._canvas,n=t.getContainer();const i=Ot(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return n.appendChild(i),i},zt.prototype._bindAutoClose=function(){this._eventBus.once(ew,this.close,this)},zt.prototype._unbindAutoClose=function(){this._eventBus.off(ew,this.close,this)},zt.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),an(n)&&e<n&&(r=n),an(i)&&e>i&&(r=i)),r},zt.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}},zt.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},zt.prototype.registerProvider=function(e,t,n){n||(n=t,t=nL),this._eventBus.on("popupMenu.getProviders."+e,t,function(i){i.providers.push(n)})},zt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},zt.prototype._getEntries=function(e,t){var n={};return H(t,function(i){if(!i.getPopupMenuEntries){H(i.getEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=Li(o,["id"])});return}var r=i.getPopupMenuEntries(e);hn(r)?n=r(n):H(r,function(o,a){n[a]=o})}),n},zt.prototype._getHeaderEntries=function(e,t){var n={};return H(t,function(i){if(!i.getPopupMenuHeaderEntries){if(!i.getHeaderEntries)return;H(i.getHeaderEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=Li(o,["id"])});return}var r=i.getPopupMenuHeaderEntries(e);hn(r)?n=r(n):H(r,function(o,a){n[a]=o})}),n},zt.prototype._getEmptyPlaceholder=function(e){const t=e.find(n=>hn(n.getEmptyPlaceholder));return t&&t.getEmptyPlaceholder()},zt.prototype.isOpen=function(){return!!this._current},zt.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let r=so(e.delegateTarget||e.target,".entry",!0),o=On(r,tL);t={id:o,...this._getEntry(o)}}const i=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(hn(i)){if(n==="click")return i(e,t)}else if(i[n])return i[n](e,t)}},zt.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 tw(e,t=[]){return Object.entries(e).map(([n,i])=>{const r={id:n,...i};return r.entries?r.entries=tw(r.entries,[...t,...nw(r.search)]):t.length&&(r.search=[...t,...nw(r.search)]),r})}function nw(e){return e?$e(e)?e:[e]:[]}function iL(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=rL(o,r,i);return a?{item:o,tokens:a}:[]}).sort(oL(i))}function rL(e,t,n){const{matchedWords:i,tokens:r}=n.reduce((o,a)=>{const s=e[a],{tokens:c,matchedWords:l}=$e(s)?s.reduce((u,p)=>{const{tokens:f,matchedWords:d}=sw(p,t);return{tokens:[...u.tokens,f],matchedWords:{...u.matchedWords,...d}}},{matchedWords:{},tokens:[]}):sw(s,t);return{tokens:{...o.tokens,[a]:c},matchedWords:{...o.matchedWords,...l}}},{matchedWords:{},tokens:{}});return Object.keys(i).length!==t.length?null:r}function oL(e){return(t,n)=>{let i=0,r=1;for(const o of e){const a=aL(t.tokens[o],n.tokens[o]);if(a!==0){i+=a*r,r*=iw;continue}const s=sL(t.item[o],n.item[o]);if(s!==0){i+=s*r,r*=iw;continue}}return i}}function aL(e,t){return rw(t)-rw(e)}const iw=.5,wa={FULL:131.9,START_FULL_WORD:8,START_WORD_PART:7.87,WORD_START:2.19,WORD_PART:1,NO_MATCH:-.07};function rw(e){const t=e.reduce((s,c)=>s+ow(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 ow(e){if($e(e))return Math.max(...e.map(ow));const t=Math.log(e.value.length);return e.match?(e.start?e.end?wa.FULL:e.wordEnd?wa.START_FULL_WORD:wa.START_WORD_PART:e.wordStart?wa.WORD_START:wa.WORD_PART)*t:wa.NO_MATCH*t}function aw(e=""){return $e(e)?e.join(", "):e}function sL(e,t){return aw(e).localeCompare(aw(t))}function sw(e,t){var l;if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},r=t.map(cL),o=[`(?<all>${r.join("\\s+")})`,...r].join("|"),a=new RegExp(o,"ig");let s,c=0;for(;s=a.exec(e);){const[u]=s,p=s.index,f=s.index+u.length,d=p===0,g=f===e.length,h=!!((l=s.groups)!=null&&l.all),y=d||/\s/.test(e.charAt(p-1)),R=g||/\s/.test(e.charAt(f));s.index>c&&n.push({value:e.slice(c,s.index),index:c}),n.push({value:u,index:s.index,match:!0,wordStart:y,wordEnd:R,start:d,end:g,all:h});const x=h?t:[u];for(const m of x)i[m.toLowerCase()]=!0;c=s.index+u.length}return c<e.length&&n.push({value:e.slice(c),index:c}),{tokens:n,matchedWords:i}}function cL(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}const cw={search:["value",iL]},uh={__depends__:[cw],__init__:["popupMenu"],popupMenu:["type",zt]};var lw={align:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2000 2000">
288
288
  <line x1="200" y1="150" x2="200" y2="1850" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>
289
289
  <rect x="500" y="150" width="1300" height="700" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
290
290
  <rect x="500" y="1150" width="700" height="700" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
@@ -312,8 +312,8 @@
312
312
  <line x1="150" y1="900" x2="1650" y2="900" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>
313
313
  <rect x="150" y="250" width="600" height="1300" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
314
314
  <rect x="1050" y="500" width="600" height="800" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
315
- </svg>`},VD=900;function va(e,t,n,i){e.registerProvider(VD,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}va.$inject=["contextPad","popupMenu","translate","canvas"],va.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&W(t,this._getEntries(e)),t},va.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},va.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${Z_.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);W(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},va.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 WD=["left","center","right","top","middle","bottom"];function Ms(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}Ms.$inject=["popupMenu","alignElements","translate","rules"],Ms.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&W(t,this._getEntries(e)),t},Ms.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},Ms.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return H(WD,function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:Z_[o],action:function(){t.trigger(e,o),i.close()}}}),r};function lu(e){mi.call(this,e)}lu.$inject=["eventBus"],Ee(lu,mi),lu.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=tt(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=Tc(n),n.length<2?!1:n})};const UD={__depends__:[iD,c_,Jd],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",va],alignElementsMenuProvider:["type",Ms],bpmnAlignElements:["type",lu]};function fr(e,t,n,i){ce.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,l=a.parent||a.newParent;s.autoResize!==!1&&r._expand([c],l)}),this.postExecuted(["elements.move"],function(o){var a=o.context,s=Wu(To(a.closure.topLevel)),c=a.hints,l=c?c.autoResize:!0;if(l!==!1){var u=ko(s,function(p){return p.parent.id});H(u,function(p,f){Fe(l)&&(p=p.filter(function(d){return Tt(l,Oo({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,l=c.parent;s&&s.autoResize===!1||l&&r._expand([c],l)})}fr.$inject=["eventBus","elementRegistry","modeling","rules"],Ee(fr,ce),fr.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=Ie(Jt(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),Dc(W({},o,a))},fr.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(qD(i,t)){var r=YD(Ci(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:r});var o=t.parent;o&&this._expand([t],o)}}},fr.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},fr.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},fr.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function qD(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function YD(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 uu(e){e.invoke(fr,this)}uu.$inject=["injector"],Ee(uu,fr),uu.prototype.resize=function(e,t,n){C(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};function Ps(e){mi.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}Ps.$inject=["eventBus"],Ee(Ps,mi),Ps.prototype.canResize=function(e,t){return!1};function pu(e,t){Ps.call(this,e),this._modeling=t}Ee(pu,Ps),pu.$inject=["eventBus","modeling"],pu.prototype.canResize=function(e,t){if(C(t.di,"bpmndi:BPMNPlane")||!C(t,"bpmn:Participant")&&!C(t,"bpmn:Lane")&&!C(t,"bpmn:SubProcess"))return!1;var n=!0;return H(e,function(i){if(C(i,"bpmn:Lane")||Je(i)){n=!1;return}}),n};const KD={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",uu],bpmnAutoResizeProvider:["type",pu]};function ba(e,t,n){this._canvas=n,this._opts=W({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()})}ba.$inject=["config.autoScroll","eventBus","canvas"],ba.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++)XD(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 XD(e,t,n){return t<e&&e<n}ba.prototype.stopScroll=function(){clearTimeout(this._scrolling)},ba.prototype.setOptions=function(e){this._opts=W({},this._opts,e)},ba.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=uo(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const ZD={__depends__:[ar],__init__:["autoScroll"],autoScroll:["type",ba]};var Q_="djs-bendpoint",J_="djs-segment-dragger";function QD(e,t){var n=uo(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 eh(e,t,n){var i=QD(e,n),r=mf(t,i);return r}function th(e,t){var n=De("g");ct(n).add(Q_),qe(e,n);var i=De("circle");Se(i,{cx:0,cy:0,r:4}),ct(i).add("djs-visual"),qe(n,i);var r=De("circle");return Se(r,{cx:0,cy:0,r:10}),ct(r).add("djs-hit"),qe(n,r),t&&ct(n).add(t),n}function JD(e,t,n,i){var r=De("g");qe(e,r);var o=18,a=6,s=11,c=tL(t,n,i),l=a+s,u=De("rect");Se(u,{x:-o/2,y:-a/2,width:o,height:a}),ct(u).add("djs-visual"),qe(r,u);var p=De("rect");return Se(p,{x:-c/2,y:-l/2,width:c,height:l}),ct(p).add("djs-hit"),qe(r,p),gy(r,i==="v"?90:0),r}function ew(e,t,n){var i=De("g"),r=Gp(t,n),o=er(t,n);return qe(e,i),JD(i,t,n,o),ct(i).add(J_),ct(i).add(o==="h"?"horizontal":"vertical"),Rn(i,r.x,r.y),i}function nh(e){return Math.abs(Math.round(e*2/3))}function eL(e,t){var n=nL(e,t);return _f(e,n)}function tL(e,t,n){var i=t.x-e.x,r=t.y-e.y;return nh(n==="h"?i:r)}function nL(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=nv(e,[a,s]);c<i&&(i=c,r=o)}return[n[r],n[r+1]]}function tw(e,t,n,i,r){function o(g,y,S){var E=g.index,T=g.point,k,I,P,O,F,Z;return E<=0||g.bendpoint?!1:(k=y[E-1],I=y[E],P=Gp(k,I),O=er(k,I),F=Math.abs(T.x-P.x),Z=Math.abs(T.y-P.y),O&&F<=S&&Z<=S)}function a(g,y){var S=g.waypoints,E,T,k,I;return y.index<=0||y.bendpoint||(E={start:S[y.index-1],end:S[y.index]},T=er(E.start,E.end),!T)?null:(T==="h"?k=E.end.x-E.start.x:k=E.end.y-E.start.y,I=nh(k)/2,I)}function s(g,y){var S=y.waypoints,E=eh(t,S,g),T;if(E){T=a(y,E);var k;if(o(E,S,T)?k=r.start(g,y,E.index):k=i.start(g,y,E.index,!E.bendpoint),k!==!1)return!0}}function c(g,y,S){Ve.bind(g,y,function(E){n.triggerMouseEvent(y,E,S),E.stopPropagation()})}function l(g,y){var S=t.getLayer("overlays"),E=St('.djs-bendpoints[data-element-id="'+Es(g.id)+'"]',S);return!E&&y&&(E=De("g"),Se(E,{"data-element-id":g.id}),ct(E).add("djs-bendpoints"),qe(S,E),c(E,"mousedown",g),c(E,"click",g),c(E,"dblclick",g)),E}function u(g,y){return St('.djs-segment-dragger[data-segment-idx="'+g+'"]',y)}function p(g,y){y.waypoints.forEach(function(S,E){var T=th(g);qe(g,T),Rn(T,S.x,S.y)}),th(g,"floating")}function f(g,y){for(var S=y.waypoints,E,T,k,I=1;I<S.length;I++)E=S[I-1],T=S[I],er(E,T)&&(k=ew(g,E,T),Se(k,{"data-segment-idx":I}),c(k,"mousemove",y))}function d(g){H(Cc("."+Q_,g),function(y){cn(y)})}function h(g){H(Cc("."+J_,g),function(y){cn(y)})}function m(g){var y=l(g);return y||(y=l(g,!0),p(y,g),f(y,g)),y}function v(g){var y=l(g);y&&(h(y),d(y),f(y,g),p(y,g))}function w(g,y){var S=St(".floating",g),E=y.point;S&&(Rn(S,E.x,E.y),ct(S).add("positioned"))}function x(g,y,S){var E=u(y.index,g),T=S[y.index-1],k=S[y.index],I=y.point,P=Gp(T,k),O=er(T,k),F,Z;E&&(F=iL(E),Z={x:I.x-P.x,y:I.y-P.y},O==="v"&&(Z={x:Z.y,y:Z.x}),Rn(F,Z.x,Z.y))}e.on("connection.changed",function(g){v(g.element)}),e.on("connection.remove",function(g){var y=l(g.element);y&&cn(y)}),e.on("element.marker.update",function(g){var y=g.element,S;y.waypoints&&(S=m(y),g.add?ct(S).add(g.marker):ct(S).remove(g.marker))}),e.on("element.mousemove",function(g){var y=g.element,S=y.waypoints,E,T;if(S){if(E=l(y,!0),T=eh(t,S,g.originalEvent),!T)return;w(E,T),T.bendpoint||x(E,T,S)}}),e.on("element.mousedown",function(g){if(Or(g)){var y=g.originalEvent,S=g.element;if(S.waypoints)return s(y,S)}}),e.on("selection.changed",function(g){var y=g.newSelection,S=y[0];S&&S.waypoints&&m(S)}),e.on("element.hover",function(g){var y=g.element;y.waypoints&&m(y)}),e.on("element.out",function(g){var y=g.element;if(y.waypoints){var S=l(y);if(S){var E=St(".floating",S);E&&ct(E).remove("positioned")}}}),e.on("element.updateId",function(g){var y=g.element,S=g.newId;if(y.waypoints){var E=l(y);E&&Se(E,{"data-element-id":S})}}),this.addHandles=m,this.updateHandles=v,this.getBendpointsContainer=l,this.getSegmentDragger=u}tw.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function iL(e){return St(".djs-visual",e)}var nw=Math.round,bo="reconnectStart",xo="reconnectEnd",Ts="updateWaypoints";function ih(e,t,n,i,r,o){this._injector=e,this.start=function(a,s,c,l){var u=n.getGraphics(s),p=s.source,f=s.target,d=s.waypoints,h;!l&&c===0?h=bo:!l&&c===d.length-1?h=xo:h=Ts;var m=h===Ts?"connection.updateWaypoints":"connection.reconnect",v=r.allowed(m,{connection:s,source:p,target:f});if(v===!1&&(v=r.allowed(m,{connection:s,source:f,target:p})),v!==!1)return i.init(a,"bendpoint.move",{data:{connection:s,connectionGfx:u,context:{allowed:v,bendpointIndex:c,connection:s,source:p,target:f,insert:l,type:h}}})},t.on("bendpoint.move.hover",function(a){var s=a.context,c=s.connection,l=c.source,u=c.target,p=a.hover,f=s.type;s.hover=p;var d;if(p){var h=f===Ts?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=r.allowed(h,{connection:c,source:f===bo?p:l,target:f===xo?p:u}),d){s.source=f===bo?p:l,s.target=f===xo?p:u;return}d===!1&&(d=s.allowed=r.allowed(h,{connection:c,source:f===xo?p:u,target:f===bo?p:l})),d&&(s.source=f===xo?p:u,s.target=f===bo?p:l)}}),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!==Ts&&(s.allowed=!1)}),t.on("bendpoint.move.end",function(a){var s=a.context,c=s.allowed,l=s.bendpointIndex,u=s.connection,p=s.insert,f=u.waypoints.slice(),d=s.source,h=s.target,m=s.type,v=s.hints||{},w={x:nw(a.x),y:nw(a.y)};if(!c)return!1;m===Ts?(p?f.splice(l,0,w):f[l]=w,v.bendpointMove={insert:p,bendpointIndex:l},f=this.cropWaypoints(u,f),o.updateWaypoints(u,uA(f),v)):(m===bo?(v.docking="source",fu(s)&&(v.docking="target",v.newWaypoints=f.reverse())):m===xo&&(v.docking="target",fu(s)&&(v.docking="source",v.newWaypoints=f.reverse())),o.reconnect(u,d,h,w,v))},this)}ih.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],ih.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 fu(e){var t=e.hover,n=e.source,i=e.target,r=e.type;if(r===bo)return t&&i&&t===i&&n!==i;if(r===xo)return t&&n&&t===n&&n!==i}var rL="reconnectStart",oL="reconnectEnd",iw="updateWaypoints",ks="connect-ok",du="connect-not-ok",rw="connect-hover",ow="djs-updating",aw="djs-dragging",sw=1100;function cw(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,l=a.insert,u=c.waypoints,p=u.slice();a.waypoints=u,l&&p.splice(s,0,{x:o.x,y:o.y}),c.waypoints=p;var f=a.draggerGfx=th(i.getLayer("overlays"));ct(f).add("djs-dragging"),i.addMarker(c,aw),i.addMarker(c,ow)}),n.on("bendpoint.move.hover",function(o){var a=o.context,s=a.allowed,c=a.hover,l=a.type;if(c){if(i.addMarker(c,rw),l===iw)return;s?(i.removeMarker(c,du),i.addMarker(c,ks)):s===!1&&(i.removeMarker(c,ks),i.addMarker(c,du))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],sw,function(o){var a=o.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,rw),i.removeMarker(s,c?ks:du))}),n.on("bendpoint.move.move",function(o){var a=o.context,s=a.allowed,c=a.bendpointIndex,l=a.draggerGfx,u=a.hover,p=a.type,f=a.connection,d=f.source,h=f.target,m=f.waypoints.slice(),v={x:o.x,y:o.y},w=a.hints||{},x={};r&&(w.connectionStart&&(x.connectionStart=w.connectionStart),w.connectionEnd&&(x.connectionEnd=w.connectionEnd),p===rL?fu(a)?(x.connectionEnd=x.connectionEnd||v,x.source=h,x.target=u||d,m=m.reverse()):(x.connectionStart=x.connectionStart||v,x.source=u||d,x.target=h):p===oL?fu(a)?(x.connectionStart=x.connectionStart||v,x.source=u||h,x.target=d,m=m.reverse()):(x.connectionEnd=x.connectionEnd||v,x.source=d,x.target=u||h):(x.noCropping=!0,x.noLayout=!0,m[c]=v),p===iw&&(m=e.cropWaypoints(f,m)),x.waypoints=m,r.drawPreview(a,s,x)),Rn(l,o.x,o.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],sw,function(o){var a=o.context,s=a.connection,c=a.draggerGfx,l=a.hover,u=a.target,p=a.waypoints;s.waypoints=p,cn(c),i.removeMarker(s,ow),i.removeMarker(s,aw),l&&(i.removeMarker(l,ks),i.removeMarker(l,u?ks:du)),r&&r.cleanUp(a)})}cw.$inject=["bendpointMove","injector","eventBus","canvas"];var lw="connect-hover",uw="djs-updating";function pw(e,t,n){return rh(e,t,e[t]+n)}function rh(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function aL(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 rh(t,i,s)}function fw(e){return e==="x"?"y":"x"}function dw(e,t,n){var i,r;return e.original?e.original:(i=je(t),r=fw(n),rh(e,r,i[r]))}function hw(e,t,n,i,r,o){var a=e.get("connectionDocking",!1);this.start=function(p,f,d){var h,m=n.getGraphics(f),v=d-1,w=d,x=f.waypoints,g=x[v],y=x[w],S=eh(n,x,p),E,T,k;if(E=er(g,y),!!E)return T=E==="v"?"x":"y",v===0&&(g=dw(g,f.source,T)),w===x.length-1&&(y=dw(y,f.target,T)),S?k=S.point:k={x:(g.x+y.x)/2,y:(g.y+y.y)/2},h={connection:f,segmentStartIndex:v,segmentEndIndex:w,segmentStart:g,segmentEnd:y,axis:T,dragPosition:k},i.init(p,k,"connectionSegment.move",{cursor:T==="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 l(p,f,d){var h=p.newWaypoints,m=p.segmentStartIndex+f,v=h[m],w=p.segmentEndIndex+f,x=h[w],g=fw(p.axis),y=aL(d,v,x,g);Rn(p.draggerGfx,y.x,y.y)}function u(p,f){var d=0,h=p.filter(function(m,v){return zp(p[v-1],p[v+1],m)?(d=v<=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=ew(h,f.segmentStart,f.segmentEnd),ct(f.draggerGfx).add("djs-dragging"),n.addMarker(d,uw)}),t.on("connectionSegment.move.move",function(p){var f=p.context,d=f.connection,h=f.segmentStartIndex,m=f.segmentEndIndex,v=f.segmentStart,w=f.segmentEnd,x=f.axis,g=f.originalWaypoints.slice(),y=pw(v,x,p["d"+x]),S=pw(w,x,p["d"+x]),E=g.length,T=0;g[h]=y,g[m]=S;var k,I;h<2&&(k=Sn(d.source,y),h===1?k==="intersect"&&(g.shift(),g[0]=y,T--):k!=="intersect"&&(g.unshift(v),T++)),m>E-3&&(I=Sn(d.target,S),m===E-2?I==="intersect"&&(g.pop(),g[g.length-1]=S):I!=="intersect"&&g.push(w)),f.newWaypoints=d.waypoints=s(d,g),l(f,T,p),f.newSegmentStartIndex=h+T,c(p)}),t.on("connectionSegment.move.hover",function(p){p.context.hover=p.hover,n.addMarker(p.hover,lw)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var f=p.context.hover;f&&n.removeMarker(f,lw)}),t.on("connectionSegment.move.cleanup",function(p){var f=p.context,d=f.connection;f.draggerGfx&&cn(f.draggerGfx),n.removeMarker(d,uw)}),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(S){return{original:S.original,x:Math.round(S.x),y:Math.round(S.y)}});var v=u(h,m),w=v.waypoints,x=s(d,w),g=v.segmentOffset,y={segmentMove:{segmentStartIndex:f.segmentStartIndex,newSegmentStartIndex:m+g}};o.updateWaypoints(d,x,y)})}hw.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var sL=Math.abs,mw=Math.round;function cL(e,t,n){n=n===void 0?10:n;var i,r;for(i=0;i<t.length;i++)if(r=t[i],sL(r-e)<=n)return r}function gw(e){return{x:e.x,y:e.y}}function yw(e){return{x:e.x+e.width,y:e.y+e.height}}function bi(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:mw(e.x+e.width/2),y:mw(e.y+e.height/2)}}function xa(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function rn(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 vw(e){return e.children||[]}var lL=Math.abs,bw=Math.round,oh=10;function xw(e){function t(o,a){if(Fe(o)){for(var s=o.length;s--;)if(lL(o[s]-a)<=oh)return o[s]}else{o=+o;var c=a%o;if(c<oh)return a-c;if(c>o-oh)return a-c+o}return a}function n(o,a){if(o.waypoints)return eL(a,o);if(o.width)return{x:bw(o.width/2+o.x),y:bw(o.height/2+o.y)}}function i(o){var a=o.context,s=a.snapPoints,c=a.connection,l=c.waypoints,u=a.segmentStart,p=a.segmentStartIndex,f=a.segmentEnd,d=a.segmentEndIndex,h=a.axis;if(s)return s;var m=[l[p-1],u,f,l[d+1]];return p<2&&m.unshift(n(c.source,o)),d>l.length-3&&m.unshift(n(c.target,o)),a.snapPoints=s={horizontal:[],vertical:[]},H(m,function(v){v&&(v=v.original||v,h==="y"&&s.horizontal.push(v.y),h==="x"&&s.vertical.push(v.x))}),s}e.on("connectionSegment.move.move",1500,function(o){var a=i(o),s=o.x,c=o.y,l,u;if(a){l=t(a.vertical,s),u=t(a.horizontal,c);var p=s-l,f=c-u;W(o,{dx:o.dx-p,dy:o.dy-f,x:l,y:u}),(p||a.vertical.indexOf(s)!==-1)&&rn(o,"x",l),(f||a.horizontal.indexOf(c)!==-1)&&rn(o,"y",u)}});function r(o){var a=o.snapPoints,s=o.connection.waypoints,c=o.bendpointIndex;if(a)return a;var l=[s[c-1],s[c+1]];return o.snapPoints=a={horizontal:[],vertical:[]},H(l,function(u){u&&(u=u.original||u,a.horizontal.push(u.y),a.vertical.push(u.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);!Ct(s)||!c||!c.x||!c.y||(rn(o,"x",c.x),rn(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,l=c&&n(c,o),u=o.x,p=o.y,f,d;if(s){f=t(l?s.vertical.concat([l.x]):s.vertical,u),d=t(l?s.horizontal.concat([l.y]):s.horizontal,p);var h=u-f,m=p-d;W(o,{dx:o.dx-h,dy:o.dy-m,x:o.x-h,y:o.y-m}),(h||s.vertical.indexOf(u)!==-1)&&rn(o,"x",f),(m||s.horizontal.indexOf(p)!==-1)&&rn(o,"y",d)}})}xw.$inject=["eventBus"];const uL={__depends__:[ar,Vi],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",tw],bendpointMove:["type",ih],bendpointMovePreview:["type",cw],connectionSegmentMove:["type",hw],bendpointSnapping:["type",xw]};function _w(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,l=a.hover,u;if(s.hover=l,u=s.canExecute=r(c,l),!Po(u)){if(u!==!1){s.source=c,s.target=l;return}u=s.canExecute=o(c,l),!Po(u)&&u!==!1&&(s.source=l,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,l=s.connectionStart,u={x:a.x,y:a.y},p=s.source,f=s.target;if(!c)return!1;var d=null,h={connectionStart:ah(s)?u:l,connectionEnd:ah(s)?l:u};dn(c)&&(d=c),s.connection=n.connect(p,f,d,h)}),this.start=function(a,s,c,l){dn(c)||(l=c,c=je(s)),t.init(a,"connect",{autoActivate:l,data:{shape:s,context:{start:s,connectionStart:c}}})}}_w.$inject=["eventBus","dragging","modeling","rules"];function ah(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var pL=1100,fL=900,ww="connect-ok",Ew="connect-not-ok";function Sw(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,l=o.start,u=o.startPosition,p=o.target,f=o.connectionStart||u,d=o.connectionEnd||{x:r.x,y:r.y},h=f,m=d;ah(o)&&(h=d,m=f),i.drawPreview(o,a,{source:c||l,target:p||s,connectionStart:h,connectionEnd:m})}),t.on("connect.hover",fL,function(r){var o=r.context,a=r.hover,s=o.canExecute;s!==null&&n.addMarker(a,s?ww:Ew)}),t.on(["connect.out","connect.cleanup"],pL,function(r){var o=r.hover;o&&(n.removeMarker(o,ww),n.removeMarker(o,Ew))}),i&&t.on("connect.cleanup",function(r){i.cleanUp(r.context)})}Sw.$inject=["injector","eventBus","canvas"];const sh={__depends__:[gi,Vi,ar],__init__:["connectPreview"],connect:["type",_w],connectPreview:["type",Sw]};var dL="djs-dragger";function dr(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)}dr.$inject=["injector","canvas","graphicsFactory","elementFactory"],dr.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,l=n.connectionEnd,u=n.noLayout,p=n.noCropping,f=n.noNoop,d,h=this;if(i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),Ac(i),r||(r=e.getConnection=hL(function(m,v,w){return h.getConnection(m,v,w)})),t&&(d=r(t,o,a)),!d){!f&&this.drawNoopPreview(i,n);return}d.waypoints=s||[],this._layouter&&!u&&(d.waypoints=this._layouter.layoutConnection(d,{source:o,target:a,connectionStart:c,connectionEnd:l,waypoints:n.waypoints||d.waypoints})),(!d.waypoints||!d.waypoints.length)&&(d.waypoints=[o?je(o):c,a?je(a):l]),this._connectionDocking&&(o||a)&&!p&&(d.waypoints=this._connectionDocking.getCroppedWaypoints(d,o,a)),this._graphicsFactory.drawConnection(i,d,{stroke:"var(--element-dragger-color)"})},dr.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||je(n),o=t.connectionEnd||je(i),a=this.cropWaypoints(r,o,n,i),s=this.createNoopConnection(a[0],a[1]);qe(e,s)},dr.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&&Wa(o,s,!0)||e,t=i&&Wa(a,s,!1)||t,[e,t]},dr.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&cn(e.connectionPreviewGfx)},dr.prototype.getConnection=function(e){var t=mL(e);return this._elementFactory.createConnection(t)},dr.prototype.createConnectionPreviewGfx=function(){var e=De("g");return Se(e,{pointerEvents:"none"}),ct(e).add(dL),qe(this._canvas.getActiveLayer(),e),e},dr.prototype.createNoopConnection=function(e,t){return Ha([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function hL(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 mL(e){return dn(e)?e:{}}const gL={__init__:["connectionPreview"],connectionPreview:["type",dr]},hu="complex-preview";class Rw{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(hu);n.filter(s=>!yL(s)).forEach(s=>{let c;Ct(s)?(c=this._graphicsFactory._createContainer("connection",De("g")),this._graphicsFactory.drawConnection(so(c),s)):(c=this._graphicsFactory._createContainer("shape",De("g")),this._graphicsFactory.drawShape(so(c),s),Rn(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 l=this._previewSupport.addDragger(s,a);Ct(s)?Rn(l,c.x,c.y):Rn(l,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 l=this._graphicsFactory._createContainer("shape",De("g"));this._graphicsFactory.drawShape(so(l),s,{width:c.width,height:c.height}),Rn(l,c.x,c.y),this._previewSupport.addDragger(s,a,l)})}cleanUp(){Ac(this._canvas.getLayer(hu)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(hu)}hide(){this._canvas.hideLayer(hu)}}Rw.$inject=["canvas","graphicsFactory","previewSupport"];function yL(e){return e.hidden}const vL={__depends__:[la],__init__:["complexPreview"],complexPreview:["type",Rw]},Cw=Math.round;function mu(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}mu.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,l=o.createShape(W({type:t},n)),u=a.fire("autoPlace",{source:e,shape:l});if(!u)return;W(l,{x:u.x-Cw(l.width/2),y:u.y-Cw(l.height/2)});const p=c.allowed("connection.create",{source:e,target:l,hints:{targetParent:e.parent}});let f=null;p&&(f=o.createConnection(p),f.waypoints=s.layoutConnection(f,{source:e,target:l}),f.waypoints=r.getCroppedWaypoints(f,e,l)),i.create({created:[l,f].filter(d=>!Po(d))})},mu.prototype.cleanUp=function(){this._complexPreview.cleanUp()},mu.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const bL={__depends__:[jl,vL,Pd],__init__:["appendPreview"],appendPreview:["type",mu]};var Aw=Math.min,Mw=Math.max;function ch(e){e.preventDefault()}function Os(e){e.stopPropagation()}function xL(e){return e.nodeType===Node.TEXT_NODE}function _L(e){return[].slice.call(e)}function Pi(e){this.container=e.container,this.parent=Ot('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=St("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=Fn(this.autoResize,this),this.handlePaste=Fn(this.handlePaste,this)}Pi.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=Ci(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);W(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 l=Ci(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return W(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},l),i.centerVertically&&W(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},l),a.innerText=n,Ve.bind(a,"keydown",this.keyHandler),Ve.bind(a,"mousedown",Os),Ve.bind(a,"paste",r.handlePaste),Ve.bind(a,"focusout",this.focusoutHandler),i.autoResize&&Ve.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(o),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),o},Pi.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)}},Pi.prototype.insertText=function(e){e=wL(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},Pi.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,r=t.startOffset,o=t.endOffset,a=t.commonAncestorContainer,s=_L(a.childNodes),c,l;if(xL(a)){var u=n.textContent;n.textContent=u.substring(0,r)+e+u.substring(o),c=n,l=r+e.length}else if(n===this.content&&i===this.content){var p=document.createTextNode(e);this.content.insertBefore(p,s[r]),c=p,l=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&&$i(h)}),c=n,l=r+e.length}c&&l!==void 0&&setTimeout(function(){self.setSelection(c,l)})},Pi.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})}},Pi.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=Ot('<div class="djs-direct-editing-resize-handle"></div>');var s,c,l,u,p=function(h){ch(h),Os(h),s=h.clientX,c=h.clientY;var m=t.getBoundingClientRect();l=m.width,u=m.height,Ve.bind(document,"mousemove",f),Ve.bind(document,"mouseup",d)},f=function(h){ch(h),Os(h);var m=Aw(Mw(l+h.clientX-s,i),o),v=Aw(Mw(u+h.clientY-c,r),a);t.style.width=m+"px",t.style.height=v+"px",e.resizeHandler({width:l,height:u,dx:h.clientX-s,dy:h.clientY-c})},d=function(h){ch(h),Os(h),Ve.unbind(document,"mousemove",f,!1),Ve.unbind(document,"mouseup",d,!1)};Ve.bind(n,"mousedown",p)}W(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)},Pi.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),Ve.unbind(t,"keydown",this.keyHandler),Ve.unbind(t,"mousedown",Os),Ve.unbind(t,"input",this.autoResize),Ve.unbind(t,"paste",this.handlePaste),Ve.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),$i(n)),$i(e)},Pi.prototype.getValue=function(){return this.content.innerText.trim()},Pi.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},Pi.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 wL(e){return e.replace(/\r\n|\r|\n/g,`
316
- `)}function Jn(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new Pi({container:t.getContainer(),keyHandler:Fn(this._handleKey,this),resizeHandler:Fn(this._handleResize,this),focusoutHandler:Fn(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}Jn.$inject=["eventBus","canvas"],Jn.prototype.registerProvider=function(e){this._providers.push(e)},Jn.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},Jn.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},Jn.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},Jn.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},Jn.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},Jn.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()}},Jn.prototype.getValue=function(){return this._textbox.getValue()},Jn.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()},Jn.prototype._handleResize=function(e){this._fire("resize",e)},Jn.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},Jn.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=Tt(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 Pw={__depends__:[gl],__init__:["directEditing"],directEditing:["type",Jn]};function EL(e){return function(t){var n=t.target,i=ue(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===at(e);return!o||!a||!s||!c}}const SL={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 ae(e,t={}){var n=SL[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var RL=[ae("none-start-event",{actionName:"replace-with-none-start"}),ae("none-intermediate-throwing"),ae("none-end-event",{actionName:"replace-with-none-end"}),ae("message-start"),ae("timer-start"),ae("conditional-start"),ae("signal-start")],CL=[ae("none-start-event",{actionName:"replace-with-none-start"}),ae("none-intermediate-throwing"),ae("none-end-event",{actionName:"replace-with-none-end"})],AL=[ae("none-start-event",{actionName:"replace-with-none-start"}),ae("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),ae("none-end-event",{actionName:"replace-with-none-end"}),ae("message-intermediate-catch"),ae("message-intermediate-throw"),ae("timer-intermediate-catch"),ae("escalation-intermediate-throw"),ae("conditional-intermediate-catch"),ae("link-intermediate-catch"),ae("link-intermediate-throw"),ae("compensation-intermediate-throw"),ae("signal-intermediate-catch"),ae("signal-intermediate-throw")],ML=[ae("none-start-event",{actionName:"replace-with-none-start"}),ae("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),ae("none-end-event",{actionName:"replace-with-none-end"}),ae("message-end"),ae("escalation-end"),ae("error-end"),ae("cancel-end"),ae("compensation-end"),ae("signal-end"),ae("terminate-end")],PL=[ae("exclusive-gateway"),ae("parallel-gateway"),ae("inclusive-gateway"),ae("complex-gateway"),ae("event-based-gateway")],TL=[ae("transaction"),ae("event-subprocess"),ae("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),ae("collapsed-subprocess")],kL=[ae("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),ae("transaction"),ae("event-subprocess"),ae("collapsed-ad-hoc-subprocess")],Tw=[ae("transaction"),ae("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),ae("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),ae("event-subprocess")],OL=Tw,kw=[ae("task"),ae("user-task"),ae("service-task"),ae("send-task"),ae("receive-task"),ae("manual-task"),ae("rule-task"),ae("script-task"),ae("call-activity"),ae("collapsed-subprocess"),ae("expanded-subprocess"),ae("collapsed-ad-hoc-subprocess"),ae("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],DL=[ae("data-store-reference")],LL=[ae("data-object-reference")],IL=[ae("message-boundary"),ae("timer-boundary"),ae("escalation-boundary"),ae("conditional-boundary"),ae("error-boundary"),ae("cancel-boundary"),ae("signal-boundary"),ae("compensation-boundary"),ae("non-interrupting-message-boundary"),ae("non-interrupting-timer-boundary"),ae("non-interrupting-escalation-boundary"),ae("non-interrupting-conditional-boundary"),ae("non-interrupting-signal-boundary")],BL=[ae("message-start"),ae("timer-start"),ae("conditional-start"),ae("signal-start"),ae("error-start"),ae("escalation-start"),ae("compensation-start"),ae("non-interrupting-message-start"),ae("non-interrupting-timer-start"),ae("non-interrupting-conditional-start"),ae("non-interrupting-signal-start"),ae("non-interrupting-escalation-start")],NL=[{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"}],$L=[ae("expanded-pool"),ae("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],FL={"bpmn:MessageEventDefinition":[ae("message-start"),ae("message-intermediate-catch"),ae("message-intermediate-throw"),ae("message-end")],"bpmn:TimerEventDefinition":[ae("timer-start"),ae("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[ae("conditional-start"),ae("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[ae("signal-start"),ae("signal-intermediate-catch"),ae("signal-intermediate-throw"),ae("signal-end")],"bpmn:ErrorEventDefinition":[ae("error-start"),ae("error-end")],"bpmn:EscalationEventDefinition":[ae("escalation-start"),ae("escalation-intermediate-throw"),ae("escalation-end")],"bpmn:CompensateEventDefinition":[ae("compensation-start"),ae("compensation-intermediate-throw"),ae("compensation-end")]};const Ow={"start-event-non-interrupting":`
315
+ </svg>`},lL=900;function Ea(e,t,n,i){e.registerProvider(lL,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}Ea.$inject=["contextPad","popupMenu","translate","canvas"],Ea.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&W(t,this._getEntries(e)),t},Ea.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},Ea.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${lw.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);W(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},Ea.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 uL=["left","center","right","top","middle","bottom"];function Os(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}Os.$inject=["popupMenu","alignElements","translate","rules"],Os.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&W(t,this._getEntries(e)),t},Os.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},Os.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return H(uL,function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:lw[o],action:function(){t.trigger(e,o),i.close()}}}),r};function hu(e){yi.call(this,e)}hu.$inject=["eventBus"],we(hu,yi),hu.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=tt(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=Ic(n),n.length<2?!1:n})};const pL={__depends__:[wD,x_,uh],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",Ea],alignElementsMenuProvider:["type",Os],bpmnAlignElements:["type",hu]};function dr(e,t,n,i){ce.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,l=a.parent||a.newParent;s.autoResize!==!1&&r._expand([c],l)}),this.postExecuted(["elements.move"],function(o){var a=o.context,s=Ku(Do(a.closure.topLevel)),c=a.hints,l=c?c.autoResize:!0;if(l!==!1){var u=Lo(s,function(p){return p.parent.id});H(u,function(p,f){$e(l)&&(p=p.filter(function(d){return Tt(l,Io({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,l=c.parent;s&&s.autoResize===!1||l&&r._expand([c],l)})}dr.$inject=["eventBus","elementRegistry","modeling","rules"],we(dr,ce),dr.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=Ie(Jt(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),$c(W({},o,a))},dr.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(fL(i,t)){var r=dL(Mi(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:r});var o=t.parent;o&&this._expand([t],o)}}},dr.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},dr.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},dr.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function fL(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function dL(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 mu(e){e.invoke(dr,this)}mu.$inject=["injector"],we(mu,dr),mu.prototype.resize=function(e,t,n){C(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};function Ds(e){yi.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}Ds.$inject=["eventBus"],we(Ds,yi),Ds.prototype.canResize=function(e,t){return!1};function gu(e,t){Ds.call(this,e),this._modeling=t}we(gu,Ds),gu.$inject=["eventBus","modeling"],gu.prototype.canResize=function(e,t){if(C(t.di,"bpmndi:BPMNPlane")||!C(t,"bpmn:Participant")&&!C(t,"bpmn:Lane")&&!C(t,"bpmn:SubProcess"))return!1;var n=!0;return H(e,function(i){if(C(i,"bpmn:Lane")||Je(i)){n=!1;return}}),n};const hL={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",mu],bpmnAutoResizeProvider:["type",gu]};function Sa(e,t,n){this._canvas=n,this._opts=W({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()})}Sa.$inject=["config.autoScroll","eventBus","canvas"],Sa.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++)mL(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 mL(e,t,n){return t<e&&e<n}Sa.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Sa.prototype.setOptions=function(e){this._opts=W({},this._opts,e)},Sa.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=ho(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const gL={__depends__:[sr],__init__:["autoScroll"],autoScroll:["type",Sa]};var uw="djs-bendpoint",pw="djs-segment-dragger";function yL(e,t){var n=ho(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 ph(e,t,n){var i=yL(e,n),r=Cf(t,i);return r}function fh(e,t){var n=Oe("g");ct(n).add(uw),Ue(e,n);var i=Oe("circle");Ee(i,{cx:0,cy:0,r:4}),ct(i).add("djs-visual"),Ue(n,i);var r=Oe("circle");return Ee(r,{cx:0,cy:0,r:10}),ct(r).add("djs-hit"),Ue(n,r),t&&ct(n).add(t),n}function vL(e,t,n,i){var r=Oe("g");Ue(e,r);var o=18,a=6,s=11,c=xL(t,n,i),l=a+s,u=Oe("rect");Ee(u,{x:-o/2,y:-a/2,width:o,height:a}),ct(u).add("djs-visual"),Ue(r,u);var p=Oe("rect");return Ee(p,{x:-c/2,y:-l/2,width:c,height:l}),ct(p).add("djs-hit"),Ue(r,p),My(r,i==="v"?90:0),r}function fw(e,t,n){var i=Oe("g"),r=ef(t,n),o=tr(t,n);return Ue(e,i),vL(i,t,n,o),ct(i).add(pw),ct(i).add(o==="h"?"horizontal":"vertical"),Cn(i,r.x,r.y),i}function dh(e){return Math.abs(Math.round(e*2/3))}function bL(e,t){var n=_L(e,t);return Of(e,n)}function xL(e,t,n){var i=t.x-e.x,r=t.y-e.y;return dh(n==="h"?i:r)}function _L(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=hv(e,[a,s]);c<i&&(i=c,r=o)}return[n[r],n[r+1]]}function dw(e,t,n,i,r){function o(m,v,_){var E=m.index,T=m.point,k,I,P,O,F,J;return E<=0||m.bendpoint?!1:(k=v[E-1],I=v[E],P=ef(k,I),O=tr(k,I),F=Math.abs(T.x-P.x),J=Math.abs(T.y-P.y),O&&F<=_&&J<=_)}function a(m,v){var _=m.waypoints,E,T,k,I;return v.index<=0||v.bendpoint||(E={start:_[v.index-1],end:_[v.index]},T=tr(E.start,E.end),!T)?null:(T==="h"?k=E.end.x-E.start.x:k=E.end.y-E.start.y,I=dh(k)/2,I)}function s(m,v){var _=v.waypoints,E=ph(t,_,m),T;if(E){T=a(v,E);var k;if(o(E,_,T)?k=r.start(m,v,E.index):k=i.start(m,v,E.index,!E.bendpoint),k!==!1)return!0}}function c(m,v,_){Ge.bind(m,v,function(E){n.triggerMouseEvent(v,E,_),E.stopPropagation()})}function l(m,v){var _=t.getLayer("overlays"),E=St('.djs-bendpoints[data-element-id="'+As(m.id)+'"]',_);return!E&&v&&(E=Oe("g"),Ee(E,{"data-element-id":m.id}),ct(E).add("djs-bendpoints"),Ue(_,E),c(E,"mousedown",m),c(E,"click",m),c(E,"dblclick",m)),E}function u(m,v){return St('.djs-segment-dragger[data-segment-idx="'+m+'"]',v)}function p(m,v){v.waypoints.forEach(function(_,E){var T=fh(m);Ue(m,T),Cn(T,_.x,_.y)}),fh(m,"floating")}function f(m,v){for(var _=v.waypoints,E,T,k,I=1;I<_.length;I++)E=_[I-1],T=_[I],tr(E,T)&&(k=fw(m,E,T),Ee(k,{"data-segment-idx":I}),c(k,"mousemove",v))}function d(m){H(kc("."+uw,m),function(v){cn(v)})}function g(m){H(kc("."+pw,m),function(v){cn(v)})}function h(m){var v=l(m);return v||(v=l(m,!0),p(v,m),f(v,m)),v}function y(m){var v=l(m);v&&(g(v),d(v),f(v,m),p(v,m))}function R(m,v){var _=St(".floating",m),E=v.point;_&&(Cn(_,E.x,E.y),ct(_).add("positioned"))}function x(m,v,_){var E=u(v.index,m),T=_[v.index-1],k=_[v.index],I=v.point,P=ef(T,k),O=tr(T,k),F,J;E&&(F=wL(E),J={x:I.x-P.x,y:I.y-P.y},O==="v"&&(J={x:J.y,y:J.x}),Cn(F,J.x,J.y))}e.on("connection.changed",function(m){y(m.element)}),e.on("connection.remove",function(m){var v=l(m.element);v&&cn(v)}),e.on("element.marker.update",function(m){var v=m.element,_;v.waypoints&&(_=h(v),m.add?ct(_).add(m.marker):ct(_).remove(m.marker))}),e.on("element.mousemove",function(m){var v=m.element,_=v.waypoints,E,T;if(_){if(E=l(v,!0),T=ph(t,_,m.originalEvent),!T)return;R(E,T),T.bendpoint||x(E,T,_)}}),e.on("element.mousedown",function(m){if(Lr(m)){var v=m.originalEvent,_=m.element;if(_.waypoints)return s(v,_)}}),e.on("selection.changed",function(m){var v=m.newSelection,_=v[0];_&&_.waypoints&&h(_)}),e.on("element.hover",function(m){var v=m.element;v.waypoints&&h(v)}),e.on("element.out",function(m){var v=m.element;if(v.waypoints){var _=l(v);if(_){var E=St(".floating",_);E&&ct(E).remove("positioned")}}}),e.on("element.updateId",function(m){var v=m.element,_=m.newId;if(v.waypoints){var E=l(v);E&&Ee(E,{"data-element-id":_})}}),this.addHandles=h,this.updateHandles=y,this.getBendpointsContainer=l,this.getSegmentDragger=u}dw.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function wL(e){return St(".djs-visual",e)}var hw=Math.round,wo="reconnectStart",Eo="reconnectEnd",Ls="updateWaypoints";function hh(e,t,n,i,r,o){this._injector=e,this.start=function(a,s,c,l){var u=n.getGraphics(s),p=s.source,f=s.target,d=s.waypoints,g;!l&&c===0?g=wo:!l&&c===d.length-1?g=Eo:g=Ls;var h=g===Ls?"connection.updateWaypoints":"connection.reconnect",y=r.allowed(h,{connection:s,source:p,target:f});if(y===!1&&(y=r.allowed(h,{connection:s,source:f,target:p})),y!==!1)return i.init(a,"bendpoint.move",{data:{connection:s,connectionGfx:u,context:{allowed:y,bendpointIndex:c,connection:s,source:p,target:f,insert:l,type:g}}})},t.on("bendpoint.move.hover",function(a){var s=a.context,c=s.connection,l=c.source,u=c.target,p=a.hover,f=s.type;s.hover=p;var d;if(p){var g=f===Ls?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=r.allowed(g,{connection:c,source:f===wo?p:l,target:f===Eo?p:u}),d){s.source=f===wo?p:l,s.target=f===Eo?p:u;return}d===!1&&(d=s.allowed=r.allowed(g,{connection:c,source:f===Eo?p:u,target:f===wo?p:l})),d&&(s.source=f===Eo?p:u,s.target=f===wo?p:l)}}),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!==Ls&&(s.allowed=!1)}),t.on("bendpoint.move.end",function(a){var s=a.context,c=s.allowed,l=s.bendpointIndex,u=s.connection,p=s.insert,f=u.waypoints.slice(),d=s.source,g=s.target,h=s.type,y=s.hints||{},R={x:hw(a.x),y:hw(a.y)};if(!c)return!1;h===Ls?(p?f.splice(l,0,R):f[l]=R,y.bendpointMove={insert:p,bendpointIndex:l},f=this.cropWaypoints(u,f),o.updateWaypoints(u,PA(f),y)):(h===wo?(y.docking="source",yu(s)&&(y.docking="target",y.newWaypoints=f.reverse())):h===Eo&&(y.docking="target",yu(s)&&(y.docking="source",y.newWaypoints=f.reverse())),o.reconnect(u,d,g,R,y))},this)}hh.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],hh.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 yu(e){var t=e.hover,n=e.source,i=e.target,r=e.type;if(r===wo)return t&&i&&t===i&&n!==i;if(r===Eo)return t&&n&&t===n&&n!==i}var EL="reconnectStart",SL="reconnectEnd",mw="updateWaypoints",Is="connect-ok",vu="connect-not-ok",gw="connect-hover",yw="djs-updating",vw="djs-dragging",bw=1100;function xw(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,l=a.insert,u=c.waypoints,p=u.slice();a.waypoints=u,l&&p.splice(s,0,{x:o.x,y:o.y}),c.waypoints=p;var f=a.draggerGfx=fh(i.getLayer("overlays"));ct(f).add("djs-dragging"),i.addMarker(c,vw),i.addMarker(c,yw)}),n.on("bendpoint.move.hover",function(o){var a=o.context,s=a.allowed,c=a.hover,l=a.type;if(c){if(i.addMarker(c,gw),l===mw)return;s?(i.removeMarker(c,vu),i.addMarker(c,Is)):s===!1&&(i.removeMarker(c,Is),i.addMarker(c,vu))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],bw,function(o){var a=o.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,gw),i.removeMarker(s,c?Is:vu))}),n.on("bendpoint.move.move",function(o){var a=o.context,s=a.allowed,c=a.bendpointIndex,l=a.draggerGfx,u=a.hover,p=a.type,f=a.connection,d=f.source,g=f.target,h=f.waypoints.slice(),y={x:o.x,y:o.y},R=a.hints||{},x={};r&&(R.connectionStart&&(x.connectionStart=R.connectionStart),R.connectionEnd&&(x.connectionEnd=R.connectionEnd),p===EL?yu(a)?(x.connectionEnd=x.connectionEnd||y,x.source=g,x.target=u||d,h=h.reverse()):(x.connectionStart=x.connectionStart||y,x.source=u||d,x.target=g):p===SL?yu(a)?(x.connectionStart=x.connectionStart||y,x.source=u||g,x.target=d,h=h.reverse()):(x.connectionEnd=x.connectionEnd||y,x.source=d,x.target=u||g):(x.noCropping=!0,x.noLayout=!0,h[c]=y),p===mw&&(h=e.cropWaypoints(f,h)),x.waypoints=h,r.drawPreview(a,s,x)),Cn(l,o.x,o.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],bw,function(o){var a=o.context,s=a.connection,c=a.draggerGfx,l=a.hover,u=a.target,p=a.waypoints;s.waypoints=p,cn(c),i.removeMarker(s,yw),i.removeMarker(s,vw),l&&(i.removeMarker(l,Is),i.removeMarker(l,u?Is:vu)),r&&r.cleanUp(a)})}xw.$inject=["bendpointMove","injector","eventBus","canvas"];var _w="connect-hover",ww="djs-updating";function Ew(e,t,n){return mh(e,t,e[t]+n)}function mh(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function RL(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 mh(t,i,s)}function Sw(e){return e==="x"?"y":"x"}function Rw(e,t,n){var i,r;return e.original?e.original:(i=Fe(t),r=Sw(n),mh(e,r,i[r]))}function Cw(e,t,n,i,r,o){var a=e.get("connectionDocking",!1);this.start=function(p,f,d){var g,h=n.getGraphics(f),y=d-1,R=d,x=f.waypoints,m=x[y],v=x[R],_=ph(n,x,p),E,T,k;if(E=tr(m,v),!!E)return T=E==="v"?"x":"y",y===0&&(m=Rw(m,f.source,T)),R===x.length-1&&(v=Rw(v,f.target,T)),_?k=_.point:k={x:(m.x+v.x)/2,y:(m.y+v.y)/2},g={connection:f,segmentStartIndex:y,segmentEndIndex:R,segmentStart:m,segmentEnd:v,axis:T,dragPosition:k},i.init(p,k,"connectionSegment.move",{cursor:T==="x"?"resize-ew":"resize-ns",data:{connection:f,connectionGfx:h,context:g}})};function s(p,f){if(!a)return f;var d=p.waypoints,g;return p.waypoints=f,g=a.getCroppedWaypoints(p),p.waypoints=d,g}function c(p){r.update("connection",p.connection,p.connectionGfx)}function l(p,f,d){var g=p.newWaypoints,h=p.segmentStartIndex+f,y=g[h],R=p.segmentEndIndex+f,x=g[R],m=Sw(p.axis),v=RL(d,y,x,m);Cn(p.draggerGfx,v.x,v.y)}function u(p,f){var d=0,g=p.filter(function(h,y){return Jp(p[y-1],p[y+1],h)?(d=y<=f?d-1:d,!1):!0});return{waypoints:g,segmentOffset:d}}t.on("connectionSegment.move.start",function(p){var f=p.context,d=p.connection,g=n.getLayer("overlays");f.originalWaypoints=d.waypoints.slice(),f.draggerGfx=fw(g,f.segmentStart,f.segmentEnd),ct(f.draggerGfx).add("djs-dragging"),n.addMarker(d,ww)}),t.on("connectionSegment.move.move",function(p){var f=p.context,d=f.connection,g=f.segmentStartIndex,h=f.segmentEndIndex,y=f.segmentStart,R=f.segmentEnd,x=f.axis,m=f.originalWaypoints.slice(),v=Ew(y,x,p["d"+x]),_=Ew(R,x,p["d"+x]),E=m.length,T=0;m[g]=v,m[h]=_;var k,I;g<2&&(k=Rn(d.source,v),g===1?k==="intersect"&&(m.shift(),m[0]=v,T--):k!=="intersect"&&(m.unshift(y),T++)),h>E-3&&(I=Rn(d.target,_),h===E-2?I==="intersect"&&(m.pop(),m[m.length-1]=_):I!=="intersect"&&m.push(R)),f.newWaypoints=d.waypoints=s(d,m),l(f,T,p),f.newSegmentStartIndex=g+T,c(p)}),t.on("connectionSegment.move.hover",function(p){p.context.hover=p.hover,n.addMarker(p.hover,_w)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var f=p.context.hover;f&&n.removeMarker(f,_w)}),t.on("connectionSegment.move.cleanup",function(p){var f=p.context,d=f.connection;f.draggerGfx&&cn(f.draggerGfx),n.removeMarker(d,ww)}),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,g=f.newWaypoints,h=f.newSegmentStartIndex;g=g.map(function(_){return{original:_.original,x:Math.round(_.x),y:Math.round(_.y)}});var y=u(g,h),R=y.waypoints,x=s(d,R),m=y.segmentOffset,v={segmentMove:{segmentStartIndex:f.segmentStartIndex,newSegmentStartIndex:h+m}};o.updateWaypoints(d,x,v)})}Cw.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var CL=Math.abs,Aw=Math.round;function AL(e,t,n){n=n===void 0?10:n;var i,r;for(i=0;i<t.length;i++)if(r=t[i],CL(r-e)<=n)return r}function Mw(e){return{x:e.x,y:e.y}}function Pw(e){return{x:e.x+e.width,y:e.y+e.height}}function _i(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:Aw(e.x+e.width/2),y:Aw(e.y+e.height/2)}}function Ra(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function rn(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 Tw(e){return e.children||[]}var ML=Math.abs,kw=Math.round,gh=10;function Ow(e){function t(o,a){if($e(o)){for(var s=o.length;s--;)if(ML(o[s]-a)<=gh)return o[s]}else{o=+o;var c=a%o;if(c<gh)return a-c;if(c>o-gh)return a-c+o}return a}function n(o,a){if(o.waypoints)return bL(a,o);if(o.width)return{x:kw(o.width/2+o.x),y:kw(o.height/2+o.y)}}function i(o){var a=o.context,s=a.snapPoints,c=a.connection,l=c.waypoints,u=a.segmentStart,p=a.segmentStartIndex,f=a.segmentEnd,d=a.segmentEndIndex,g=a.axis;if(s)return s;var h=[l[p-1],u,f,l[d+1]];return p<2&&h.unshift(n(c.source,o)),d>l.length-3&&h.unshift(n(c.target,o)),a.snapPoints=s={horizontal:[],vertical:[]},H(h,function(y){y&&(y=y.original||y,g==="y"&&s.horizontal.push(y.y),g==="x"&&s.vertical.push(y.x))}),s}e.on("connectionSegment.move.move",1500,function(o){var a=i(o),s=o.x,c=o.y,l,u;if(a){l=t(a.vertical,s),u=t(a.horizontal,c);var p=s-l,f=c-u;W(o,{dx:o.dx-p,dy:o.dy-f,x:l,y:u}),(p||a.vertical.indexOf(s)!==-1)&&rn(o,"x",l),(f||a.horizontal.indexOf(c)!==-1)&&rn(o,"y",u)}});function r(o){var a=o.snapPoints,s=o.connection.waypoints,c=o.bendpointIndex;if(a)return a;var l=[s[c-1],s[c+1]];return o.snapPoints=a={horizontal:[],vertical:[]},H(l,function(u){u&&(u=u.original||u,a.horizontal.push(u.y),a.vertical.push(u.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);!Ct(s)||!c||!c.x||!c.y||(rn(o,"x",c.x),rn(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,l=c&&n(c,o),u=o.x,p=o.y,f,d;if(s){f=t(l?s.vertical.concat([l.x]):s.vertical,u),d=t(l?s.horizontal.concat([l.y]):s.horizontal,p);var g=u-f,h=p-d;W(o,{dx:o.dx-g,dy:o.dy-h,x:o.x-g,y:o.y-h}),(g||s.vertical.indexOf(u)!==-1)&&rn(o,"x",f),(h||s.horizontal.indexOf(p)!==-1)&&rn(o,"y",d)}})}Ow.$inject=["eventBus"];const PL={__depends__:[sr,Wi],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",dw],bendpointMove:["type",hh],bendpointMovePreview:["type",xw],connectionSegmentMove:["type",Cw],bendpointSnapping:["type",Ow]};function Dw(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,l=a.hover,u;if(s.hover=l,u=s.canExecute=r(c,l),!Oo(u)){if(u!==!1){s.source=c,s.target=l;return}u=s.canExecute=o(c,l),!Oo(u)&&u!==!1&&(s.source=l,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,l=s.connectionStart,u={x:a.x,y:a.y},p=s.source,f=s.target;if(!c)return!1;var d=null,g={connectionStart:yh(s)?u:l,connectionEnd:yh(s)?l:u};dn(c)&&(d=c),s.connection=n.connect(p,f,d,g)}),this.start=function(a,s,c,l){dn(c)||(l=c,c=Fe(s)),t.init(a,"connect",{autoActivate:l,data:{shape:s,context:{start:s,connectionStart:c}}})}}Dw.$inject=["eventBus","dragging","modeling","rules"];function yh(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var TL=1100,kL=900,Lw="connect-ok",Iw="connect-not-ok";function Bw(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,l=o.start,u=o.startPosition,p=o.target,f=o.connectionStart||u,d=o.connectionEnd||{x:r.x,y:r.y},g=f,h=d;yh(o)&&(g=d,h=f),i.drawPreview(o,a,{source:c||l,target:p||s,connectionStart:g,connectionEnd:h})}),t.on("connect.hover",kL,function(r){var o=r.context,a=r.hover,s=o.canExecute;s!==null&&n.addMarker(a,s?Lw:Iw)}),t.on(["connect.out","connect.cleanup"],TL,function(r){var o=r.hover;o&&(n.removeMarker(o,Lw),n.removeMarker(o,Iw))}),i&&t.on("connect.cleanup",function(r){i.cleanUp(r.context)})}Bw.$inject=["injector","eventBus","canvas"];const vh={__depends__:[vi,Wi,sr],__init__:["connectPreview"],connect:["type",Dw],connectPreview:["type",Bw]};var OL="djs-dragger";function hr(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)}hr.$inject=["injector","canvas","graphicsFactory","elementFactory"],hr.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,l=n.connectionEnd,u=n.noLayout,p=n.noCropping,f=n.noNoop,d,g=this;if(i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),Oc(i),r||(r=e.getConnection=DL(function(h,y,R){return g.getConnection(h,y,R)})),t&&(d=r(t,o,a)),!d){!f&&this.drawNoopPreview(i,n);return}d.waypoints=s||[],this._layouter&&!u&&(d.waypoints=this._layouter.layoutConnection(d,{source:o,target:a,connectionStart:c,connectionEnd:l,waypoints:n.waypoints||d.waypoints})),(!d.waypoints||!d.waypoints.length)&&(d.waypoints=[o?Fe(o):c,a?Fe(a):l]),this._connectionDocking&&(o||a)&&!p&&(d.waypoints=this._connectionDocking.getCroppedWaypoints(d,o,a)),this._graphicsFactory.drawConnection(i,d,{stroke:"var(--element-dragger-color)"})},hr.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||Fe(n),o=t.connectionEnd||Fe(i),a=this.cropWaypoints(r,o,n,i),s=this.createNoopConnection(a[0],a[1]);Ue(e,s)},hr.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&&Ka(o,s,!0)||e,t=i&&Ka(a,s,!1)||t,[e,t]},hr.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&cn(e.connectionPreviewGfx)},hr.prototype.getConnection=function(e){var t=LL(e);return this._elementFactory.createConnection(t)},hr.prototype.createConnectionPreviewGfx=function(){var e=Oe("g");return Ee(e,{pointerEvents:"none"}),ct(e).add(OL),Ue(this._canvas.getActiveLayer(),e),e},hr.prototype.createNoopConnection=function(e,t){return Wa([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function DL(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 LL(e){return dn(e)?e:{}}const IL={__init__:["connectionPreview"],connectionPreview:["type",hr]},bu="complex-preview";class Nw{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(bu);n.filter(s=>!BL(s)).forEach(s=>{let c;Ct(s)?(c=this._graphicsFactory._createContainer("connection",Oe("g")),this._graphicsFactory.drawConnection(uo(c),s)):(c=this._graphicsFactory._createContainer("shape",Oe("g")),this._graphicsFactory.drawShape(uo(c),s),Cn(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 l=this._previewSupport.addDragger(s,a);Ct(s)?Cn(l,c.x,c.y):Cn(l,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 l=this._graphicsFactory._createContainer("shape",Oe("g"));this._graphicsFactory.drawShape(uo(l),s,{width:c.width,height:c.height}),Cn(l,c.x,c.y),this._previewSupport.addDragger(s,a,l)})}cleanUp(){Oc(this._canvas.getLayer(bu)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(bu)}hide(){this._canvas.hideLayer(bu)}}Nw.$inject=["canvas","graphicsFactory","previewSupport"];function BL(e){return e.hidden}const NL={__depends__:[ha],__init__:["complexPreview"],complexPreview:["type",Nw]},$w=Math.round;function xu(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}xu.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,l=o.createShape(W({type:t},n)),u=a.fire("autoPlace",{source:e,shape:l});if(!u)return;W(l,{x:u.x-$w(l.width/2),y:u.y-$w(l.height/2)});const p=c.allowed("connection.create",{source:e,target:l,hints:{targetParent:e.parent}});let f=null;p&&(f=o.createConnection(p),f.waypoints=s.layoutConnection(f,{source:e,target:l}),f.waypoints=r.getCroppedWaypoints(f,e,l)),i.create({created:[l,f].filter(d=>!Oo(d))})},xu.prototype.cleanUp=function(){this._complexPreview.cleanUp()},xu.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const $L={__depends__:[Wl,NL,jd],__init__:["appendPreview"],appendPreview:["type",xu]};var Fw=Math.min,jw=Math.max;function bh(e){e.preventDefault()}function Bs(e){e.stopPropagation()}function FL(e){return e.nodeType===Node.TEXT_NODE}function jL(e){return[].slice.call(e)}function ki(e){this.container=e.container,this.parent=Ot('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=St("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=jn(this.autoResize,this),this.handlePaste=jn(this.handlePaste,this)}ki.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=Mi(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);W(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 l=Mi(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return W(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},l),i.centerVertically&&W(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},l),a.innerText=n,Ge.bind(a,"keydown",this.keyHandler),Ge.bind(a,"mousedown",Bs),Ge.bind(a,"paste",r.handlePaste),Ge.bind(a,"focusout",this.focusoutHandler),i.autoResize&&Ge.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(o),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),o},ki.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)}},ki.prototype.insertText=function(e){e=HL(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},ki.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,r=t.startOffset,o=t.endOffset,a=t.commonAncestorContainer,s=jL(a.childNodes),c,l;if(FL(a)){var u=n.textContent;n.textContent=u.substring(0,r)+e+u.substring(o),c=n,l=r+e.length}else if(n===this.content&&i===this.content){var p=document.createTextNode(e);this.content.insertBefore(p,s[r]),c=p,l=p.textContent.length}else{var f=s.indexOf(n),d=s.indexOf(i);s.forEach(function(g,h){h===f?g.textContent=n.textContent.substring(0,r)+e+i.textContent.substring(o):h>f&&h<=d&&Fi(g)}),c=n,l=r+e.length}c&&l!==void 0&&setTimeout(function(){self.setSelection(c,l)})},ki.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})}},ki.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=Ot('<div class="djs-direct-editing-resize-handle"></div>');var s,c,l,u,p=function(g){bh(g),Bs(g),s=g.clientX,c=g.clientY;var h=t.getBoundingClientRect();l=h.width,u=h.height,Ge.bind(document,"mousemove",f),Ge.bind(document,"mouseup",d)},f=function(g){bh(g),Bs(g);var h=Fw(jw(l+g.clientX-s,i),o),y=Fw(jw(u+g.clientY-c,r),a);t.style.width=h+"px",t.style.height=y+"px",e.resizeHandler({width:l,height:u,dx:g.clientX-s,dy:g.clientY-c})},d=function(g){bh(g),Bs(g),Ge.unbind(document,"mousemove",f,!1),Ge.unbind(document,"mouseup",d,!1)};Ge.bind(n,"mousedown",p)}W(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)},ki.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),Ge.unbind(t,"keydown",this.keyHandler),Ge.unbind(t,"mousedown",Bs),Ge.unbind(t,"input",this.autoResize),Ge.unbind(t,"paste",this.handlePaste),Ge.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),Fi(n)),Fi(e)},ki.prototype.getValue=function(){return this.content.innerText.trim()},ki.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},ki.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 HL(e){return e.replace(/\r\n|\r|\n/g,`
316
+ `)}function ei(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new ki({container:t.getContainer(),keyHandler:jn(this._handleKey,this),resizeHandler:jn(this._handleResize,this),focusoutHandler:jn(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}ei.$inject=["eventBus","canvas"],ei.prototype.registerProvider=function(e){this._providers.push(e)},ei.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},ei.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},ei.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},ei.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},ei.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},ei.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()}},ei.prototype.getValue=function(){return this._textbox.getValue()},ei.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()},ei.prototype._handleResize=function(e){this._fire("resize",e)},ei.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},ei.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=Tt(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 Hw={__depends__:[_l],__init__:["directEditing"],directEditing:["type",ei]};function zL(e){return function(t){var n=t.target,i=ue(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===at(e);return!o||!a||!s||!c}}const GL={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 ae(e,t={}){var n=GL[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var VL=[ae("none-start-event",{actionName:"replace-with-none-start"}),ae("none-intermediate-throwing"),ae("none-end-event",{actionName:"replace-with-none-end"}),ae("message-start"),ae("timer-start"),ae("conditional-start"),ae("signal-start")],WL=[ae("none-start-event",{actionName:"replace-with-none-start"}),ae("none-intermediate-throwing"),ae("none-end-event",{actionName:"replace-with-none-end"})],UL=[ae("none-start-event",{actionName:"replace-with-none-start"}),ae("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),ae("none-end-event",{actionName:"replace-with-none-end"}),ae("message-intermediate-catch"),ae("message-intermediate-throw"),ae("timer-intermediate-catch"),ae("escalation-intermediate-throw"),ae("conditional-intermediate-catch"),ae("link-intermediate-catch"),ae("link-intermediate-throw"),ae("compensation-intermediate-throw"),ae("signal-intermediate-catch"),ae("signal-intermediate-throw")],qL=[ae("none-start-event",{actionName:"replace-with-none-start"}),ae("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),ae("none-end-event",{actionName:"replace-with-none-end"}),ae("message-end"),ae("escalation-end"),ae("error-end"),ae("cancel-end"),ae("compensation-end"),ae("signal-end"),ae("terminate-end")],YL=[ae("exclusive-gateway"),ae("parallel-gateway"),ae("inclusive-gateway"),ae("complex-gateway"),ae("event-based-gateway")],KL=[ae("transaction"),ae("event-subprocess"),ae("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),ae("collapsed-subprocess")],XL=[ae("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),ae("transaction"),ae("event-subprocess"),ae("collapsed-ad-hoc-subprocess")],zw=[ae("transaction"),ae("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),ae("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),ae("event-subprocess")],ZL=zw,Gw=[ae("task"),ae("user-task"),ae("service-task"),ae("send-task"),ae("receive-task"),ae("manual-task"),ae("rule-task"),ae("script-task"),ae("call-activity"),ae("collapsed-subprocess"),ae("expanded-subprocess"),ae("collapsed-ad-hoc-subprocess"),ae("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],QL=[ae("data-store-reference")],JL=[ae("data-object-reference")],eI=[ae("message-boundary"),ae("timer-boundary"),ae("escalation-boundary"),ae("conditional-boundary"),ae("error-boundary"),ae("cancel-boundary"),ae("signal-boundary"),ae("compensation-boundary"),ae("non-interrupting-message-boundary"),ae("non-interrupting-timer-boundary"),ae("non-interrupting-escalation-boundary"),ae("non-interrupting-conditional-boundary"),ae("non-interrupting-signal-boundary")],tI=[ae("message-start"),ae("timer-start"),ae("conditional-start"),ae("signal-start"),ae("error-start"),ae("escalation-start"),ae("compensation-start"),ae("non-interrupting-message-start"),ae("non-interrupting-timer-start"),ae("non-interrupting-conditional-start"),ae("non-interrupting-signal-start"),ae("non-interrupting-escalation-start")],nI=[{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"}],iI=[ae("expanded-pool"),ae("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],rI={"bpmn:MessageEventDefinition":[ae("message-start"),ae("message-intermediate-catch"),ae("message-intermediate-throw"),ae("message-end")],"bpmn:TimerEventDefinition":[ae("timer-start"),ae("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[ae("conditional-start"),ae("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[ae("signal-start"),ae("signal-intermediate-catch"),ae("signal-intermediate-throw"),ae("signal-end")],"bpmn:ErrorEventDefinition":[ae("error-start"),ae("error-end")],"bpmn:EscalationEventDefinition":[ae("escalation-start"),ae("escalation-intermediate-throw"),ae("escalation-end")],"bpmn:CompensateEventDefinition":[ae("compensation-start"),ae("compensation-intermediate-throw"),ae("compensation-end")]};const Vw={"start-event-non-interrupting":`
317
317
  <svg viewBox="0 0 2048 2048" xmlns="http://www.w3.org/2000/svg">
318
318
  <g transform="translate(0 995.64)">
319
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"/>
@@ -324,7 +324,7 @@
324
324
  <circle cx="1024" cy="28.357" r="875" stroke-dasharray="418.310422, 361.2328165" stroke-width="100"/>
325
325
  <circle cx="1024" cy="28.357" r="685" stroke-dasharray="348.31044857,261.23283643" stroke-dashoffset="500" stroke-width="100"/>
326
326
  </g>
327
- </svg>`};function xi(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()}xi.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],xi.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},xi.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],r,o=[];if(Fe(e)||!n.allowed("shape.replace",{element:e}))return{};var a=EL(e);return C(t,"bpmn:DataObjectReference")?this._createEntries(e,DL):C(t,"bpmn:DataStoreReference")&&!C(e.parent,"bpmn:Collaboration")?this._createEntries(e,LL):(C(t,"bpmn:Event")&&!C(t,"bpmn:BoundaryEvent")&&(r=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=FL[r]||[],!Dn(t.$parent)&&C(t.$parent,"bpmn:SubProcess")&&(i=tt(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),C(t,"bpmn:StartEvent")&&!C(t.$parent,"bpmn:SubProcess")?(o=tt(RL.concat(i),a),this._createEntries(e,o)):C(t,"bpmn:Participant")?(o=tt($L,function(c){return at(e)!==c.target.isExpanded}),this._createEntries(e,o)):C(t,"bpmn:StartEvent")&&Dn(t.$parent)?(o=tt(BL.concat(i),function(c){var l=c.target,u=l.isInterrupting!==!1,p=t.isInterrupting===u;return a(c)||!a(c)&&!p}),this._createEntries(e,o)):C(t,"bpmn:StartEvent")&&!Dn(t.$parent)&&C(t.$parent,"bpmn:SubProcess")?(o=tt(CL.concat(i),a),this._createEntries(e,o)):C(t,"bpmn:EndEvent")?(o=tt(ML.concat(i),function(c){var l=c.target;return l.eventDefinitionType=="bpmn:CancelEventDefinition"&&!C(t.$parent,"bpmn:Transaction")?!1:a(c)}),this._createEntries(e,o)):C(t,"bpmn:BoundaryEvent")?(o=tt(IL,function(c){var l=c.target;if(l.eventDefinitionType=="bpmn:CancelEventDefinition"&&!C(t.attachedToRef,"bpmn:Transaction"))return!1;var u=l.cancelActivity!==!1,p=t.cancelActivity==u;return a(c)||!a(c)&&!p}),this._createEntries(e,o)):C(t,"bpmn:IntermediateCatchEvent")||C(t,"bpmn:IntermediateThrowEvent")?(o=tt(AL.concat(i),a),this._createEntries(e,o)):C(t,"bpmn:Gateway")?(o=tt(PL,a),this._createEntries(e,o)):C(t,"bpmn:Transaction")?(o=tt(Tw,a),this._createEntries(e,o)):Dn(t)&&at(e)?(o=tt(OL,a),this._createEntries(e,o)):C(t,"bpmn:AdHocSubProcess")&&at(e)?(o=tt(kL,a),this._createEntries(e,o)):C(t,"bpmn:SubProcess")&&at(e)?(o=tt(TL,a),this._createEntries(e,o)):C(t,"bpmn:SubProcess")&&!at(e)?(o=tt(kw,function(c){var l=c.target.type===e.type,u=c.target.isExpanded===!0;return l===u}),this._createEntries(e,o)):C(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,NL):C(t,"bpmn:FlowNode")?(o=tt(kw,a),this._createEntries(e,o)):{})},xi.prototype.getPopupMenuHeaderEntries=function(e){var t={};return C(e,"bpmn:Activity")&&!Dn(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),C(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),C(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),yv(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},xi.prototype._createEntries=function(e,t){var n={},i=this;return H(t,function(r){n[r.actionName]=i._createEntry(r,e)}),n},xi.prototype._createSequenceFlowEntries=function(e,t){var n=ue(e),i={},r=this._modeling,o=this._moddle,a=this;return H(t,function(s){switch(s.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(C(n.sourceRef,"bpmn:ExclusiveGateway")||C(n.sourceRef,"bpmn:InclusiveGateway")||C(n.sourceRef,"bpmn:ComplexGateway")||C(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&&C(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:C(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e,{conditionExpression:void 0})})}),(C(n.sourceRef,"bpmn:ExclusiveGateway")||C(n.sourceRef,"bpmn:InclusiveGateway")||C(n.sourceRef,"bpmn:ComplexGateway")||C(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},xi.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}},xi.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function i(l,u){if(u.active){t._modeling.updateProperties(e,{loopCharacteristics:void 0});return}var p=e.businessObject.get("loopCharacteristics");p&&C(p,u.options.loopCharacteristics)?t._modeling.updateModdleProperties(e,p,{isSequential:u.options.isSequential}):(p=t._moddle.create(u.options.loopCharacteristics,{isSequential:u.options.isSequential}),t._modeling.updateProperties(e,{loopCharacteristics:p}))}var r=ue(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"}}}},xi.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}}},xi.prototype._getParticipantMultiplicityHeaderEntries=function(e){var t=this,n=this._bpmnFactory,i=this._translate;function r(a,s){var c=s.active,l;c||(l=n.create("bpmn:ParticipantMultiplicity")),t._modeling.updateProperties(e,{participantMultiplicity:l})}var o=e.businessObject.participantMultiplicity;return{"toggle-participant-multiplicity":{className:"bpmn-icon-parallel-mi-marker",title:i("Participant multiplicity"),active:!!o,action:r}}},xi.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=ue(e),i=this,r=vv(e),o=C(e,"bpmn:BoundaryEvent")?Ow["intermediate-event-non-interrupting"]:Ow["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 jL={__depends__:[Jd,$b,jl],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",xi]};function Ds(e,t,n,i,r,o,a,s,c,l,u,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=l,this._rules=u,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(!(!rs(d)||!i.isOpen(m))){var v=i.getEntries(m);v.replace&&v.replace.action.click(d,m)}}),n.on("contextPad.close",function(){f.cleanUp()})}Ds.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],Ds.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&W(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,r){t.removeElements(r.slice())}}}}),n},Ds.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return Fe(t)?Jr(e,n=>t.includes(n)):t},Ds.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,l=this._appendPreview,u={};if(e.type==="label")return this._isDeleteAllowed([e])&&W(u,h()),u;var p=e.businessObject;function f(g,y){r.start(g,y)}function d(g,y){n.removeElements([y])}function h(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:d}}}}function m(g){var y=5,S=t.getPad(g).html,E=S.getBoundingClientRect(),T={x:E.left,y:E.bottom+y};return T}function v(g,y,S,E){function T(P,O){var F=i.createShape(W({type:g},E));o.start(P,F,{source:O})}var k=s?function(P,O){var F=i.createShape(W({type:g},E));s.append(O,F)}:T,I=s?function(P,O){return l.create(O,g,E),()=>{l.cleanUp()}}:null;return{group:"model",className:y,title:S,action:{dragstart:T,click:k,hover:I}}}function w(g){return function(y,S){n.splitLane(S,g),t.open(S,!0)}}if(et(p,["bpmn:Lane","bpmn:Participant"])&&at(e)){var x=Tr(e);W(u,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add lane above"),action:{click:function(g,y){n.addLane(y,"top")}}}}),x.length<2&&((gn(e)?e.height>=120:e.width>=120)&&W(u,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:w(2)}}}),(gn(e)?e.height>=180:e.width>=180)&&W(u,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:w(3)}}})),W(u,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add lane below"),action:{click:function(g,y){n.addLane(y,"bottom")}}}})}return C(p,"bpmn:FlowNode")&&(C(p,"bpmn:EventBasedGateway")?W(u,{"append.receive-task":v("bpmn:ReceiveTask","bpmn-icon-receive-task",c("Append receive task")),"append.message-intermediate-event":v("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",c("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":v("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",c("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":v("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",c("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":v("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",c("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):Dw(p,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?W(u,{"append.compensation-activity":v("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!C(p,"bpmn:EndEvent")&&!p.isForCompensation&&!Dw(p,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!Dn(p)&&W(u,{"append.end-event":v("bpmn:EndEvent","bpmn-icon-end-event-none",c("Append end event")),"append.gateway":v("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",c("Append gateway")),"append.append-task":v("bpmn:Task","bpmn-icon-task",c("Append task")),"append.intermediate-event":v("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",c("Append intermediate/boundary event"))})),a.isEmpty(e,"bpmn-replace")||W(u,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(g,y){var S=W(m(y),{cursor:{x:g.x,y:g.y}});a.open(y,"bpmn-replace",S,{title:c("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),C(p,"bpmn:SequenceFlow")&&W(u,{"append.text-annotation":v("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),C(p,"bpmn:MessageFlow")&&W(u,{"append.text-annotation":v("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),et(p,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&W(u,{"append.text-annotation":v("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}}}),C(p,"bpmn:TextAnnotation")&&W(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:f,dragstart:f}}}),et(p,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&W(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using data input association"),action:{click:f,dragstart:f}}}),C(p,"bpmn:Group")&&W(u,{"append.text-annotation":v("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&W(u,h()),u};function Dw(e,t,n){var i=e.$instanceOf(t),r=!1,o=e.eventDefinitions||[];return H(o,function(a){a.$type===n&&(r=!0)}),i&&r}const HL={__depends__:[bL,Pw,c_,gi,sh,vl,jL],__init__:["contextPadProvider"],contextPadProvider:["type",Ds]};var zL={horizontal:["x","width"],vertical:["y","height"]},Lw=5;function hr(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return Fe(i)?i:i?n:[]})}hr.$inject=["modeling","rules"],hr.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},hr.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},hr.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(H(t,function(o){r=o(r,n,i)}),r):e},hr.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=Oi(e,i);return H(o,function(a,s){var c=n._findRange(a,i,r),l,u=t[t.length-1];u&&n._hasIntersection(u.range,c)?t[t.length-1].elements.push(a):(l={range:c,elements:[a]},t.push(l))}),t},hr.prototype._setOrientation=function(e){var t=zL[e];this._axis=t[0],this._dimension=t[1]},hr.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)},hr.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+Lw,max:t+n-Lw}};const GL={__init__:["distributeElements"],distributeElements:["type",hr]};function gu(e){mi.call(this,e)}gu.$inject=["eventBus"],Ee(gu,mi),gu.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=tt(t,function(n){var i=et(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=Tc(t),t.length<3?!1:t})};var Iw={horizontal:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
327
+ </svg>`};function wi(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()}wi.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],wi.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},wi.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],r,o=[];if($e(e)||!n.allowed("shape.replace",{element:e}))return{};var a=zL(e);return C(t,"bpmn:DataObjectReference")?this._createEntries(e,QL):C(t,"bpmn:DataStoreReference")&&!C(e.parent,"bpmn:Collaboration")?this._createEntries(e,JL):(C(t,"bpmn:Event")&&!C(t,"bpmn:BoundaryEvent")&&(r=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=rI[r]||[],!Ln(t.$parent)&&C(t.$parent,"bpmn:SubProcess")&&(i=tt(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),C(t,"bpmn:StartEvent")&&!C(t.$parent,"bpmn:SubProcess")?(o=tt(VL.concat(i),a),this._createEntries(e,o)):C(t,"bpmn:Participant")?(o=tt(iI,function(c){return at(e)!==c.target.isExpanded}),this._createEntries(e,o)):C(t,"bpmn:StartEvent")&&Ln(t.$parent)?(o=tt(tI.concat(i),function(c){var l=c.target,u=l.isInterrupting!==!1,p=t.isInterrupting===u;return a(c)||!a(c)&&!p}),this._createEntries(e,o)):C(t,"bpmn:StartEvent")&&!Ln(t.$parent)&&C(t.$parent,"bpmn:SubProcess")?(o=tt(WL.concat(i),a),this._createEntries(e,o)):C(t,"bpmn:EndEvent")?(o=tt(qL.concat(i),function(c){var l=c.target;return l.eventDefinitionType=="bpmn:CancelEventDefinition"&&!C(t.$parent,"bpmn:Transaction")?!1:a(c)}),this._createEntries(e,o)):C(t,"bpmn:BoundaryEvent")?(o=tt(eI,function(c){var l=c.target;if(l.eventDefinitionType=="bpmn:CancelEventDefinition"&&!C(t.attachedToRef,"bpmn:Transaction"))return!1;var u=l.cancelActivity!==!1,p=t.cancelActivity==u;return a(c)||!a(c)&&!p}),this._createEntries(e,o)):C(t,"bpmn:IntermediateCatchEvent")||C(t,"bpmn:IntermediateThrowEvent")?(o=tt(UL.concat(i),a),this._createEntries(e,o)):C(t,"bpmn:Gateway")?(o=tt(YL,a),this._createEntries(e,o)):C(t,"bpmn:Transaction")?(o=tt(zw,a),this._createEntries(e,o)):Ln(t)&&at(e)?(o=tt(ZL,a),this._createEntries(e,o)):C(t,"bpmn:AdHocSubProcess")&&at(e)?(o=tt(XL,a),this._createEntries(e,o)):C(t,"bpmn:SubProcess")&&at(e)?(o=tt(KL,a),this._createEntries(e,o)):C(t,"bpmn:SubProcess")&&!at(e)?(o=tt(Gw,function(c){var l=c.target.type===e.type,u=c.target.isExpanded===!0;return l===u}),this._createEntries(e,o)):C(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,nI):C(t,"bpmn:FlowNode")?(o=tt(Gw,a),this._createEntries(e,o)):{})},wi.prototype.getPopupMenuHeaderEntries=function(e){var t={};return C(e,"bpmn:Activity")&&!Ln(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),C(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),C(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),Pv(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},wi.prototype._createEntries=function(e,t){var n={},i=this;return H(t,function(r){n[r.actionName]=i._createEntry(r,e)}),n},wi.prototype._createSequenceFlowEntries=function(e,t){var n=ue(e),i={},r=this._modeling,o=this._moddle,a=this;return H(t,function(s){switch(s.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(C(n.sourceRef,"bpmn:ExclusiveGateway")||C(n.sourceRef,"bpmn:InclusiveGateway")||C(n.sourceRef,"bpmn:ComplexGateway")||C(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&&C(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:C(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e,{conditionExpression:void 0})})}),(C(n.sourceRef,"bpmn:ExclusiveGateway")||C(n.sourceRef,"bpmn:InclusiveGateway")||C(n.sourceRef,"bpmn:ComplexGateway")||C(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},wi.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}},wi.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function i(l,u){if(u.active){t._modeling.updateProperties(e,{loopCharacteristics:void 0});return}var p=e.businessObject.get("loopCharacteristics");p&&C(p,u.options.loopCharacteristics)?t._modeling.updateModdleProperties(e,p,{isSequential:u.options.isSequential}):(p=t._moddle.create(u.options.loopCharacteristics,{isSequential:u.options.isSequential}),t._modeling.updateProperties(e,{loopCharacteristics:p}))}var r=ue(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"}}}},wi.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}}},wi.prototype._getParticipantMultiplicityHeaderEntries=function(e){var t=this,n=this._bpmnFactory,i=this._translate;function r(a,s){var c=s.active,l;c||(l=n.create("bpmn:ParticipantMultiplicity")),t._modeling.updateProperties(e,{participantMultiplicity:l})}var o=e.businessObject.participantMultiplicity;return{"toggle-participant-multiplicity":{className:"bpmn-icon-parallel-mi-marker",title:i("Participant multiplicity"),active:!!o,action:r}}},wi.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=ue(e),i=this,r=Tv(e),o=C(e,"bpmn:BoundaryEvent")?Vw["intermediate-event-non-interrupting"]:Vw["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 oI={__depends__:[uh,Xb,Wl],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",wi]};function Ns(e,t,n,i,r,o,a,s,c,l,u,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=l,this._rules=u,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 g=d.context,h=g.shape;if(!(!cs(d)||!i.isOpen(h))){var y=i.getEntries(h);y.replace&&y.replace.action.click(d,h)}}),n.on("contextPad.close",function(){f.cleanUp()})}Ns.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],Ns.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&W(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,r){t.removeElements(r.slice())}}}}),n},Ns.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return $e(t)?to(e,n=>t.includes(n)):t},Ns.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,l=this._appendPreview,u={};if(e.type==="label")return this._isDeleteAllowed([e])&&W(u,g()),u;var p=e.businessObject;function f(m,v){r.start(m,v)}function d(m,v){n.removeElements([v])}function g(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:d}}}}function h(m){var v=5,_=t.getPad(m).html,E=_.getBoundingClientRect(),T={x:E.left,y:E.bottom+v};return T}function y(m,v,_,E){function T(P,O){var F=i.createShape(W({type:m},E));o.start(P,F,{source:O})}var k=s?function(P,O){var F=i.createShape(W({type:m},E));s.append(O,F)}:T,I=s?function(P,O){return l.create(O,m,E),()=>{l.cleanUp()}}:null;return{group:"model",className:v,title:_,action:{dragstart:T,click:k,hover:I}}}function R(m){return function(v,_){n.splitLane(_,m),t.open(_,!0)}}if(et(p,["bpmn:Lane","bpmn:Participant"])&&at(e)){var x=Or(e);W(u,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add lane above"),action:{click:function(m,v){n.addLane(v,"top")}}}}),x.length<2&&((gn(e)?e.height>=120:e.width>=120)&&W(u,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:R(2)}}}),(gn(e)?e.height>=180:e.width>=180)&&W(u,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:R(3)}}})),W(u,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add lane below"),action:{click:function(m,v){n.addLane(v,"bottom")}}}})}return C(p,"bpmn:FlowNode")&&(C(p,"bpmn:EventBasedGateway")?W(u,{"append.receive-task":y("bpmn:ReceiveTask","bpmn-icon-receive-task",c("Append receive task")),"append.message-intermediate-event":y("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",c("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":y("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",c("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":y("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",c("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":y("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",c("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):Ww(p,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?W(u,{"append.compensation-activity":y("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!C(p,"bpmn:EndEvent")&&!p.isForCompensation&&!Ww(p,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!Ln(p)&&W(u,{"append.end-event":y("bpmn:EndEvent","bpmn-icon-end-event-none",c("Append end event")),"append.gateway":y("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",c("Append gateway")),"append.append-task":y("bpmn:Task","bpmn-icon-task",c("Append task")),"append.intermediate-event":y("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",c("Append intermediate/boundary event"))})),a.isEmpty(e,"bpmn-replace")||W(u,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(m,v){var _=W(h(v),{cursor:{x:m.x,y:m.y}});a.open(v,"bpmn-replace",_,{title:c("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),C(p,"bpmn:SequenceFlow")&&W(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),C(p,"bpmn:MessageFlow")&&W(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),et(p,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&W(u,{"append.text-annotation":y("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}}}),C(p,"bpmn:TextAnnotation")&&W(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:f,dragstart:f}}}),et(p,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&W(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using data input association"),action:{click:f,dragstart:f}}}),C(p,"bpmn:Group")&&W(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&W(u,g()),u};function Ww(e,t,n){var i=e.$instanceOf(t),r=!1,o=e.eventDefinitions||[];return H(o,function(a){a.$type===n&&(r=!0)}),i&&r}const aI={__depends__:[$L,Hw,x_,vi,vh,El,oI],__init__:["contextPadProvider"],contextPadProvider:["type",Ns]};var sI={horizontal:["x","width"],vertical:["y","height"]},Uw=5;function mr(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return $e(i)?i:i?n:[]})}mr.$inject=["modeling","rules"],mr.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},mr.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},mr.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(H(t,function(o){r=o(r,n,i)}),r):e},mr.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=Di(e,i);return H(o,function(a,s){var c=n._findRange(a,i,r),l,u=t[t.length-1];u&&n._hasIntersection(u.range,c)?t[t.length-1].elements.push(a):(l={range:c,elements:[a]},t.push(l))}),t},mr.prototype._setOrientation=function(e){var t=sI[e];this._axis=t[0],this._dimension=t[1]},mr.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)},mr.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+Uw,max:t+n-Uw}};const cI={__init__:["distributeElements"],distributeElements:["type",mr]};function _u(e){yi.call(this,e)}_u.$inject=["eventBus"],we(_u,yi),_u.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=tt(t,function(n){var i=et(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=Ic(t),t.length<3?!1:t})};var qw={horizontal:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
328
328
  <polyline points="450 400 450 150 1350 150 1350 400" style="fill:none;stroke:currentColor;stroke-width:100;stroke-linejoin:round;"/>
329
329
  <rect x="150" y="450" width="600" height="1200" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
330
330
  <rect x="1050" y="450" width="600" height="800" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
@@ -332,7 +332,7 @@
332
332
  <polyline points="400 1350 150 1350 150 450 400 450" style="fill:none;stroke:currentColor;stroke-width:100;stroke-linejoin:round;"/>
333
333
  <rect x="450" y="150" width="1200" height="600" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
334
334
  <rect x="450" y="1050" width="800" height="600" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
335
- </svg>`},VL=900;function Ls(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",VL,this)}Ls.$inject=["popupMenu","distributeElements","translate","rules"],Ls.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&W(t,this._getEntries(e)),t},Ls.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},Ls.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:Iw.horizontal,action:function(o,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:Iw.vertical,action:function(o,a){t.trigger(e,"vertical"),i.close()}}};return r};const WL={__depends__:[Jd,GL],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",gu],distributeElementsMenuProvider:["type",Ls]};var Bw="is not a registered action",UL="is already registered";function _i(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}_i.$inject=["eventBus","injector"],_i.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),l=e.get("keyboardMoveSelection",!1);t&&(this.register("undo",function(){t.undo()}),this.register("redo",function(){t.redo()})),o&&i&&this.register("copy",function(){var u=i.get();if(u.length)return o.copy(u)}),o&&i&&this.register("duplicate",function(){var u=i.get();if(u.length)return o.duplicate(u)}),o&&this.register("paste",function(){o.paste()}),o&&i&&s&&this.register("cut",function(){var u=i.get();if(u.length){var p=s.allowed("elements.delete",{elements:u});if(p!==!1){var f=Fe(p)?p:u;return o.cut(f.slice())}}}),r&&this.register("stepZoom",function(u){r.stepZoom(u.value)}),a&&this.register("zoom",function(u){a.zoom(u.value)}),n&&i&&s&&this.register("removeSelection",function(){var u=i.get();if(u.length){var p=s.allowed("elements.delete",{elements:u}),f;p!==!1&&(Fe(p)?f=p:f=u,f.length&&n.removeElements(f.slice()))}}),c&&this.register("moveCanvas",function(u){c.moveCanvas(u)}),l&&this.register("moveSelection",function(u){l.moveSelection(u.direction,u.accelerated)})},_i.prototype.trigger=function(e,t){if(!this._actions[e])throw lh(e,Bw);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},_i.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);H(e,function(i,r){n._registerAction(r,i)})},_i.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw lh(e,UL);this._actions[e]=t},_i.prototype.unregister=function(e){if(!this.isRegistered(e))throw lh(e,Bw);this._actions[e]=void 0},_i.prototype.getActions=function(){return Object.keys(this._actions)},_i.prototype.isRegistered=function(e){return!!this._actions[e]};function lh(e,t){return new Error(e+" "+t)}const qL={__init__:["editorActions"],editorActions:["type",_i]};function yu(e){e.invoke(_i,this)}Ee(yu,_i),yu.$inject=["injector"],yu.prototype._registerDefaultActions=function(e){_i.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),l=e.get("alignElements",!1),u=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(v){return v!==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(),v=h.type;m.length&&c.trigger(m,v)}),i&&l&&this._registerAction("alignElements",function(h){var m=i.get(),v=[],w=h.type;m.length&&(v=tt(m,function(x){return!C(x,"bpmn:Lane")}),l.trigger(v,w))}),i&&f&&this._registerAction("setColor",function(h){var m=i.get();m.length&&f.setColor(m,h)}),i&&u&&this._registerAction("directEditing",function(){var h=i.get();h.length&&u.activate(h[0])}),p&&this._registerAction("find",function(){p.toggle()}),t&&f&&this._registerAction("moveToOrigin",function(){var h=t.getRootElement(),m,v;C(h,"bpmn:Collaboration")?v=n.filter(function(w){return C(w.parent,"bpmn:Collaboration")}):v=n.filter(function(w){return w!==h&&!C(w.parent,"bpmn:SubProcess")}),m=Jt(v),f.moveElements(v,{x:-m.x,y:-m.y},h)}),i&&d&&this._registerAction("replaceElement",function(h){d.triggerEntry("replace","click",h)})};const YL={__depends__:[qL],editorActions:["type",yu]};function Nw(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;et(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}Nw.$inject=["eventBus"];function _o(e,t){ce.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;Gn(a)?r.newBounds=n.snapComplex(c,a):r.newBounds=n.snapSimple(s,c)}})}_o.$inject=["eventBus","gridSnapping","modeling"],Ee(_o,ce),_o.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},_o.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},_o.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),W(e,o),e},_o.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),W(e,o),e};var KL=2e3;function $w(e,t){e.on(["spaceTool.move","spaceTool.end"],KL,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)}})}$w.$inject=["eventBus","gridSnapping"];const XL={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",_o],gridSnappingSpaceToolBehavior:["type",$w]};var vu=10;function uh(e,t,n){return n||(n="round"),Math[n](e/t)*t}var ZL=1200,QL=800;function Gr(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var r=this;t.on("diagram.init",QL,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"],ZL,function(o){var a=o.originalEvent;if(!(!r.active||a&&Kn(a))){var s=o.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(l){var u={},p=eI(o,l,e);p&&(u.offset=p);var f=JL(o,l);f&&W(u,f),xa(o,l)||r.snapEvent(o,l,u)})}})}Gr.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);rn(e,t,i)},Gr.prototype.getGridSpacing=function(){return vu},Gr.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=uh(e,vu);var i,r;return t&&t.min&&(i=t.min,Ge(i)&&(i=uh(i+n,vu,"ceil"),e=Math.max(e,i))),t&&t.max&&(r=t.max,Ge(r)&&(r=uh(r+n,vu,"floor"),e=Math.min(e,r))),e-=n,e},Gr.prototype.isActive=function(){return this.active},Gr.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},Gr.prototype.toggleActive=function(){this.setActive(!this.active)},Gr.$inject=["elementRegistry","eventBus","config.gridSnapping"];function JL(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&&(bu(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,l=r.max;return c&&(bu(t)?jw(s)?a.x.max=c.left:a.x.min=c.right:Fw(s)?a.y.max=c.top:a.y.min=c.bottom),l&&(bu(t)?jw(s)?a.x.min=l.left:a.x.max=l.right:Fw(s)?a.y.min=l.top:a.y.max=l.bottom),a[t]}function eI(e,t,n){var i=e.context,r=e.shape,o=i.gridSnappingContext,a=o.snapLocation,s=o.snapOffset;return s&&Ge(s[t])||(s||(s=o.snapOffset={}),Ge(s[t])||(s[t]=0),!r)||(n.get(r.id)||(bu(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 bu(e){return e==="x"}function Fw(e){return e.indexOf("n")!==-1}function jw(e){return e.indexOf("w")!==-1}const tI={__depends__:[XL],__init__:["gridSnapping"],gridSnapping:["type",Gr]};var nI=2e3;function Hw(e,t,n){e.on("autoPlace",nI,function(i){var r=i.source,o=je(r),a=i.shape,s=Tx(r,a,n);return["x","y"].forEach(function(c){var l={};s[c]!==o[c]&&(s[c]>o[c]?l.min=s[c]:l.max=s[c],C(a,"bpmn:TextAnnotation")&&(iI(c)?l.offset=-a.width/2:l.offset=-a.height/2),s[c]=t.snapValue(s[c],l))}),s})}Hw.$inject=["eventBus","gridSnapping","elementRegistry"];function iI(e){return e==="x"}var rI=1750;function zw(e,t,n){t.on(["create.start","shape.move.start"],rI,function(i){var r=i.context,o=r.shape,a=e.getRootElement();if(!(!C(o,"bpmn:Participant")||!C(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}))}})}zw.$inject=["canvas","eventBus","gridSnapping"];var oI=3e3;function xu(e,t,n){ce.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],oI,function(r){var o=r.context,a=o.connection,s=o.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||aI(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}xu.$inject=["eventBus","gridSnapping","modeling"],Ee(xu,ce),xu.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=lI(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function aI(e){return e.length>3}function sI(e){return e==="h"}function cI(e){return e==="v"}function lI(e,t,n){var i=er(t,n),r={};return sI(i)&&(r.y=e.snapValue(t.y)),cI(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=W({},t,r),n=W({},n,r)),[t,n]}const uI={__depends__:[tI,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",Hw],gridSnappingParticipantBehavior:["type",zw],gridSnappingLayoutConnectionBehavior:["type",xu]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",Nw]};var pI=30,Gw=30;function Is(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var r=i.element,o=i.gfx;if(C(r,"bpmn:Lane"))return n._createParticipantHit(r,o);if(C(r,"bpmn:Participant"))return at(r)?n._createParticipantHit(r,o):n._createDefaultHit(r,o);if(C(r,"bpmn:SubProcess"))return at(r)?n._createSubProcessHit(r,o):n._createDefaultHit(r,o)})}Is.$inject=["eventBus","interactionEvents"],Is.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},Is.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=gn(e)?{width:pI,height:e.height}:{width:e.width,height:Gw};return this._interactionEvents.createBoxHit(t,"all",n),!0},Is.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:Gw}),!0};const fI={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",Is]};function _u(e){e.invoke(da,this)}Ee(_u,da),_u.$inject=["injector"],_u.prototype.registerBindings=function(e,t){da.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 dI={__depends__:[$d],__init__:["keyboardBindings"],keyboardBindings:["type",_u]};var hI={moveSpeed:1,moveSpeedAccelerated:10},mI=1500,Vw="left",Ww="up",Uw="right",qw="down",gI={ArrowLeft:Vw,Left:Vw,ArrowUp:Ww,Up:Ww,ArrowRight:Uw,Right:Uw,ArrowDown:qw,Down:qw},yI={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 Yw(e,t,n,i,r){var o=this;this._config=W({},hI,e||{}),t.addListener(mI,function(a){var s=a.keyEvent,c=gI[s.key];if(c&&!t.isCmd(s)){var l=t.isShift(s);return o.moveSelection(c,l),!0}}),this.moveSelection=function(a,s){var c=r.get();if(c.length){var l=this._config[s?"moveSpeedAccelerated":"moveSpeed"],u=yI[a](l),p=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});p&&n.moveElements(c,u)}}}Yw.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const vI={__depends__:[$d,gi],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",Yw]};var Kw=10;function Bs(e,t,n,i){this._dragging=i,this._rules=t;var r=this;function o(c,l){var u=c.shape,p=c.direction,f=c.resizeConstraints,d;c.delta=l,d=rP(u,p,l),c.newBounds=aP(d,f),c.canExecute=r.canResize(c)}function a(c){var l=c.resizeConstraints,u=c.minBounds;l===void 0&&(u===void 0&&(u=r.computeMinResizeBox(c)),c.resizeConstraints={min:Ie(u)})}function s(c){var l=c.shape,u=c.canExecute,p=c.newBounds;if(u){if(p=ny(p),!bI(l,p))return;n.resizeShape(l,p)}}e.on("resize.start",function(c){a(c.context)}),e.on("resize.move",function(c){var l={x:c.dx,y:c.dy};o(c.context,l)}),e.on("resize.end",function(c){s(c.context)})}Bs.prototype.canResize=function(e){var t=this._rules,n=Ci(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},Bs.prototype.activate=function(e,t,n){var i=this._dragging,r,o;if(typeof n=="string"&&(n={direction:n}),r=W({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,Xw(t,o),"resize",{autoActivate:!0,cursor:xI(o),data:{shape:t,context:r}})},Bs.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,r;return i=e.minDimensions||{width:Kw,height:Kw},r=Gy(t,e.childrenBoxPadding),sP(n,t,i,r)},Bs.$inject=["eventBus","rules","modeling","dragging"];function bI(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function Xw(e,t){var n=je(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 xI(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 Zw="djs-resizing",Qw="resize-not-ok",_I=500;function Jw(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,Zw)),s.width>5&&Se(c,{x:s.x,width:s.width}),s.height>5&&Se(c,{y:s.y,height:s.height}),o.canExecute?ct(c).remove(Qw):ct(c).add(Qw)}function r(o){var a=o.shape,s=o.frame;s&&cn(o.frame),t.removeMarker(a,Zw)}e.on("resize.move",_I,function(o){i(o.context)}),e.on("resize.cleanup",function(o){r(o.context)})}Jw.$inject=["eventBus","canvas","previewSupport"];var wu=-6,Eu=8,Su=20,Ns="djs-resizer",wI=["n","w","s","e","nw","ne","se","sw"];function Vr(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&&H(a,Fn(r.addResizer,r))}),e.on("shape.changed",function(o){var a=o.element;n.isSelected(a)&&(r.removeResizers(),r.addResizer(a))})}Vr.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(o){Or(o)&&i.activate(o,e,n)}Ve.bind(t,"mousedown",r),Ve.bind(t,"touchstart",r)},Vr.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=EI(i),a=De("g");ct(a).add(Ns),ct(a).add(Ns+"-"+e.id),ct(a).add(Ns+"-"+i),qe(r,a);var s=De("rect");Se(s,{x:-Eu/2+o.x,y:-Eu/2+o.y,width:Eu,height:Eu}),ct(s).add(Ns+"-visual"),qe(a,s);var c=De("rect");return Se(c,{x:-Su/2+o.x,y:-Su/2+o.y,width:Su,height:Su}),ct(c).add(Ns+"-hit"),qe(a,c),Bc(a,t,n),a},Vr.prototype.createResizer=function(e,t){var n=Xw(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},Vr.prototype.addResizer=function(e){var t=this;Ct(e)||H(wI,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},Vr.prototype.removeResizers=function(){var e=this._getResizersParent();Ac(e)},Vr.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},Vr.$inject=["eventBus","canvas","selection","resize"];function EI(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-wu:e.indexOf("w")!==-1&&(t.x=wu),e.indexOf("s")!==-1?t.y=-wu:e.indexOf("n")!==-1&&(t.y=wu),t}const e0={__depends__:[Vi,ar,la],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Bs],resizePreview:["type",Jw],resizeHandles:["type",Vr]};var SI=2e3;function $s(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"],SI,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 l=c.context,u=l.shape,p=c.context.canExecute,f=c.isTouch;f||p&&(l.hints&&l.hints.createElementsBehavior===!1||s(u))}),e.on("autoPlace.end",500,function(c){s(c.shape)});function s(c,l){(l||et(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}$s.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],$s.prototype.activate=function(e){var t=li(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);W(n,i);var r={},o=n.style||{};return W(o,{backgroundColor:null,border:null}),(et(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||t0(e))&&W(r,{centerVertically:!0}),Mr(e)&&(W(r,{resizable:!0,autoResize:!0}),W(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),C(e,"bpmn:TextAnnotation")&&(W(r,{resizable:!0,autoResize:!0}),W(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),W(n,{options:r,style:o}),n}},$s.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(),l=c.fontSize*a,u=c.lineHeight,p=s.fontSize*a,f=s.lineHeight,d={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(C(e,"bpmn:Lane")||AI(e)){var h=gn(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};W(o,m),W(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(CI(e)){var v=gn(e),w=v?{width:i.width,height:i.height}:{width:i.height,height:i.width,x:r.x-i.height/2,y:r.y-i.width/2};W(o,w),W(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:v?null:"rotate(-90deg)"})}(et(e,["bpmn:Task","bpmn:CallActivity"])||t0(e))&&(W(o,{width:i.width,height:i.height}),W(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),RI(e)&&(W(o,{width:i.width,x:i.x}),W(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var x=1,g=i.width+2*x;if(n.labelTarget&&(W(o,{width:g,height:i.height+2*x,x:i.x-x,y:i.y-x}),W(d,{fontSize:l+"px",lineHeight:u})),Mr(n)&&!Fc(n)&&!Je(n)){var y=qp(e),S=t.getAbsoluteBBox({x:y.x,y:y.y,width:0,height:0}),E=l,T=co.width*a+2*x;W(o,{width:T,height:E+2*x,x:S.x-T/2,y:S.y-E/2-x}),W(d,{fontSize:l+"px",lineHeight:u})}return C(e,"bpmn:TextAnnotation")&&(W(o,{width:i.width+2*x,height:i.height+2*x,x:i.x-x,y:i.y-x,minWidth:30*a,minHeight:10*a}),W(d,{textAlign:"left",paddingTop:Xo*a+"px",paddingBottom:Xo*a+"px",paddingLeft:Xo*a+"px",paddingRight:Xo*a+"px",fontSize:p+"px",lineHeight:f})),{bounds:o,style:d}},$s.prototype.update=function(e,t,n,i){var r,o;C(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}),MI(t)&&(t=null),this._modeling.updateLabel(e,t,r)};function t0(e){return C(e,"bpmn:SubProcess")&&!at(e)}function RI(e){return C(e,"bpmn:SubProcess")&&at(e)}function CI(e){return C(e,"bpmn:Participant")&&!at(e)}function AI(e){return C(e,"bpmn:Participant")&&at(e)}function MI(e){return!e||!e.trim()}var n0="djs-element-hidden",i0="djs-label-hidden";function r0(e,t,n){var i=this,r=t.getDefaultLayer(),o,a,s;e.on("directEditing.activate",function(c){var l=c.active;if(o=l.element.label||l.element,C(o,"bpmn:TextAnnotation")){a=t.getAbsoluteBBox(o),s=De("g");var u=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:o.height,position:{mx:0,my:0}}),p=i.path=De("path");Se(p,{d:u,strokeWidth:2,stroke:PI(o)}),qe(s,p),qe(r,s),Rn(s,o.x,o.y)}C(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,n0):(C(o,"bpmn:Task")||C(o,"bpmn:CallActivity")||C(o,"bpmn:SubProcess")||C(o,"bpmn:Participant")||C(o,"bpmn:Lane"))&&t.addMarker(o,i0)}),e.on("directEditing.resize",function(c){if(C(o,"bpmn:TextAnnotation")){var l=c.height,u=c.dy,p=Math.max(o.height/a.height*(l+u),0),f=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:p,position:{mx:0,my:0}});Se(i.path,{d:f})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var l=c.active;l&&(t.removeMarker(l.element.label||l.element,n0),t.removeMarker(o,i0)),o=void 0,a=void 0,s&&(cn(s),s=void 0)})}r0.$inject=["eventBus","canvas","pathMap"];function PI(e,t){var n=pt(e);return n.get("stroke")||t||"black"}const TI={__depends__:[fd,e0,Pw],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",$s],labelEditingPreview:["type",r0]};var kI=500,OI=1e3;function qi(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){aA(o)||i.createOutline(o)}e.on("element.hover",function(o){r(o.element)}),e.on("selection.changed",function(o){H(o.newSelection,r)}),e.on(["shape.changed","connection.changed"],kI,function(o){var a=o.element,s=o.gfx,c=St(".djs-outline",s);c&&i.updateOutline(a,c)})}qi.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=St(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),qe(t,n),this.updateOutline(e,n)),n},qi.prototype._createOutlineGfx=function(){var e=De("rect");return Se(e,W({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},qi.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},qi.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&H(i,function(r){n=n||r.updateOutline(t,e)}),n||Se(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},qi.prototype.updateConnectionOutline=function(e,t){var n=Jt(t);Se(e,{x:n.x-this._outlineOffset,y:n.y-this._outlineOffset,width:n.width+this._outlineOffset*2,height:n.height+this._outlineOffset*2})},qi.prototype.registerProvider=function(e,t){t||(t=e,e=OI),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},qi.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},qi.prototype.getOutline=function(e){var t,n=this._getProviders();return H(n,function(i){hn(i.getOutline)&&(t=t||i.getOutline(e))}),t},qi.$inject=["eventBus","styles","elementRegistry"];var Ru=6;function ph(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)})}ph.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");Ac(t);var n=e.length>1,i=this._canvas.getContainer();if(ct(i)[n?"add":"remove"]("djs-multi-select"),!!n){var r=DI(Jt(e)),o=De("rect");Se(o,W({rx:3},r)),ct(o).add("djs-selection-outline"),qe(t,o)}},ph.$inject=["eventBus","canvas","selection"];function DI(e){return{x:e.x-Ru,y:e.y-Ru,width:e.width+Ru*2,height:e.height+Ru*2}}const fh={__depends__:[gi],__init__:["outline","multiSelectionOutline"],outline:["type",qi],multiSelectionOutline:["type",ph]},o0=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],a0={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},LI=15,Cu=2;function s0(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=>et(h,o0));if(f.length===1){const h=f[0];Je(h)?a(h,h.labelTarget):(d=h.labels)!=null&&d.length&&a(h.labels[0],h)}if(f.length===2){const h=f.find(Je),m=f.find(v=>{var w;return(w=v.labels)==null?void 0:w.includes(h)});h&&m&&a(h,m)}}),e.on("shape.changed",function({element:p}){var f;!et(p,o0)||!u(p)||(Je(p)?a(p,p.labelTarget):(f=p.labels)!=null&&f.length&&a(p.labels[0],p))});function a(p,f){const d=Ha([je(f),je(p)],a0),h=d.getAttribute("d"),v=r.isSelected(p)?c(p):l(p),w=Wa(v,h);if(!w)return;const g=r.isSelected(f)?c(f):l(f),y=Wa(g,h)||je(f);ts(y,w)<LI||(Fp(d,[y,w]),qe(o,d))}function s(){Cc(`.${a0.class}`,o).forEach(cn)}function c(p){const f=i.getOutline(p);if(!f)return l(p);if(f.x){const d={x:p.x+Wr(f,"x")-Cu,y:p.y+Wr(f,"y")-Cu,width:Wr(f,"width")+Cu*2,height:Wr(f,"height")+Cu*2};return Kp(d,Wr(f,"rx"))}if(f.cx){const d=Wr(f,"r"),h={x:p.x+Wr(f,"cx")-d,y:p.y+Wr(f,"cy")-d,width:d*2,height:d*2};return Cy(h)}}function l(p){return n.getShapePath(p)}function u(p){return r.isSelected(p)}}s0.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function Wr(e,t){return parseFloat(Se(e,t)||0)}const II={__depends__:[gi,fh],__init__:["labelLink"],labelLink:["type",s0]};var BI=new ca("tt");function NI(e){var t=Ot('<div class="djs-tooltip-container" />');return In(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function $I(e,t,n){In(e,{left:t+"px",top:n+"px"})}function dh(e,t){e.style.display=t===!1?"none":""}var c0="djs-tooltip",hh="."+c0;function Hn(e,t){this._eventBus=e,this._canvas=t,this._ids=BI,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=NI(t.getContainer());var n=this;Un.bind(this._tooltipRoot,hh,"mousedown",function(i){i.stopPropagation()}),Un.bind(this._tooltipRoot,hh,"mouseover",function(i){n.trigger("mouseover",i)}),Un.bind(this._tooltipRoot,hh,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}Hn.$inject=["eventBus","canvas"],Hn.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=W({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},Hn.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(kn(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},Hn.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},Hn.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},Hn.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)}},Hn.prototype.remove=function(e){var t=this.get(e);t&&($i(t.html),$i(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},Hn.prototype.show=function(){dh(this._tooltipRoot)},Hn.prototype.hide=function(){dh(this._tooltipRoot,!1)},Hn.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},Hn.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)),Gn(n)&&(n=Ot(n)),i=Ot('<div data-tooltip-id="'+t+'" class="'+c0+'">'),In(i,{position:"absolute"}),i.appendChild(n),e.type&&Bt(i).add("djs-tooltip-"+e.type),e.className&&Bt(i).add(e.className),e.htmlContainer=i,r.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},Hn.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;$I(n,t.x,t.y)},Hn.prototype._updateTooltipVisibilty=function(e){H(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,r=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(r=!1),dh(i,r))})},Hn.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 FI={__init__:["tooltips"],tooltips:["type",Hn]};var jI="flow elements must be children of pools/participants",HI="Data object must be placed within a pool/participant.";function l0(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;C(s,"bpmn:Collaboration")&&(C(a,"bpmn:FlowNode")?i(r,n(jI)):C(a,"bpmn:DataObjectReference")&&i(r,n(HI)))})}l0.$inject=["eventBus","tooltips","translate"];const zI={__depends__:[FI],__init__:["modelingFeedback"],modelingFeedback:["type",l0]};var GI=500,VI=1250,WI=1500,Au=Math.round;function UI(e){return{x:e.x+Au(e.width/2),y:e.y+Au(e.height/2)}}function u0(e,t,n,i,r){function o(s,c,l,u){return r.allowed("elements.move",{shapes:s,delta:c,position:l,target:u})}e.on("shape.move.start",WI,function(s){var c=s.context,l=s.shape,u=i.get().slice();u.indexOf(l)===-1&&(u=[l]),u=qI(u),W(c,{shapes:u,validatedShapes:u,shape:l})}),e.on("shape.move.start",VI,function(s){var c=s.context,l=c.validatedShapes,u;if(u=c.canExecute=o(l),!u)return!1}),e.on("shape.move.move",GI,function(s){var c=s.context,l=c.validatedShapes,u=s.hover,p={x:s.dx,y:s.dy},f={x:s.x,y:s.y},d;if(d=o(l,p,f,u),c.delta=p,c.canExecute=d,d===null){c.target=null;return}c.target=u}),e.on("shape.move.end",function(s){var c=s.context,l=c.delta,u=c.canExecute,p=u==="attach",f=c.shapes;if(u===!1)return!1;l.x=Au(l.x),l.y=Au(l.y),!(l.x===0&&l.y===0)&&n.moveElements(f,l,c.target,{primaryShape:c.shape,attach:p})}),e.on("element.mousedown",function(s){if(Or(s)){var c=ra(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,l,u){if(dn(l)&&(u=l,l=!1),!(c.waypoints||!c.parent)&&!ct(s.target).has("djs-hit-no-move")){var p=UI(c),f=t.init(s,p,"shape.move",{cursor:"grabbing",autoActivate:l,data:{shape:c,context:u||{}}});if(f!==!1)return!0}}this.start=a}u0.$inject=["eventBus","dragging","modeling","selection","rules"];function qI(e){var t=ko(e,"id");return tt(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var p0=499,mh="djs-dragging",f0="drop-ok",d0="drop-not-ok",h0="new-parent",m0="attach-ok";function g0(e,t,n,i){function r(c){var l=o(c),u=YI(l);return u}function o(c){var l=za(c),u=l.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),p=l.concat(u),f=[...new Set(p)];return f}function a(c,l){[m0,f0,d0,h0].forEach(function(u){u===l?t.addMarker(c,u):t.removeMarker(c,u)})}function s(c,l,u){i.addDragger(l,c.dragGroup),u&&t.addMarker(l,mh),c.allDraggedElements?c.allDraggedElements.push(l):c.allDraggedElements=[l]}e.on("shape.move.start",p0,function(c){var l=c.context,u=l.shapes,p=l.allDraggedElements,f=r(u);if(!l.dragGroup){var d=De("g");Se(d,n.cls("djs-drag-group",["no-events"]));var h=t.getActiveLayer();qe(h,d),l.dragGroup=d}f.forEach(function(m){i.addDragger(m,l.dragGroup)}),p?p=Wu([p,o(u)]):p=o(u),H(p,function(m){t.addMarker(m,mh)}),l.allDraggedElements=p,l.differentParents=KI(u)}),e.on("shape.move.move",p0,function(c){var l=c.context,u=l.dragGroup,p=l.target,f=l.shape.parent,d=l.canExecute;p&&(d==="attach"?a(p,m0):l.canExecute&&f&&p.id!==f.id?a(p,h0):a(p,l.canExecute?f0:d0)),Rn(u,c.dx,c.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(c){var l=c.context,u=l.target;u&&a(u,null)}),e.on("shape.move.cleanup",function(c){var l=c.context,u=l.allDraggedElements,p=l.dragGroup;H(u,function(f){t.removeMarker(f,mh)}),p&&cn(p)}),this.makeDraggable=s}g0.$inject=["eventBus","canvas","styles","previewSupport"];function YI(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=tt(e,function(i){return Ct(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function KI(e){return $E(ko(e,function(t){return t.parent&&t.parent.id}))!==1}const XI={__depends__:[gl,gi,fh,Vi,ar,la],__init__:["move","movePreview"],move:["type",u0],movePreview:["type",g0]};var y0=".djs-palette-toggle",v0=".entry",ZI=y0+", "+v0,gh="djs-palette-",QI="shown",yh="open",b0="two-column",JI=1e3;function on(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()})}on.$inject=["eventBus","canvas"],on.prototype.registerProvider=function(e,t){t||(t=e,e=JI),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},on.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(tB,{})},on.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},on.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=Ot(on.HTML_MARKUP);n.appendChild(i),Bt(n).add(gh+QI),Un.bind(i,ZI,"click",function(r){var o=r.delegateTarget;if(Tp(o,y0))return e.toggle();e.trigger("click",r)}),Ve.bind(i,"mousedown",function(r){r.stopPropagation()}),Un.bind(i,v0,"dragstart",function(r){e.trigger("dragstart",r)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},on.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},on.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,r,o=Bt(n),a=Bt(t);"twoColumn"in e?r=e.twoColumn:r=this._needsCollapse(t.clientHeight,this._entries||{}),o.toggle(b0,r),a.toggle(gh+b0,r),"open"in e&&(o.toggle(yh,e.open),a.toggle(gh+yh,e.open)),i.fire("palette.changed",{twoColumn:r,open:this.isOpen()})},on.prototype._update=function(){var e=St(".djs-palette-entries",this._container),t=this._entries=this.getEntries();Sc(e),H(t,function(n,i){var r=n.group||"default",o=St("[data-group="+Es(r)+"]",e);o||(o=Ot('<div class="group"></div>'),kn(o,"data-group",r),e.appendChild(o));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=Ot(a);if(o.appendChild(s),!n.separator&&(kn(s,"data-action",i),n.title&&kn(s,"title",n.title),n.className&&eB(s,n.className),n.imageUrl)){var c=Ot("<img>");kn(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},on.prototype.trigger=function(e,t,n){var i,r,o=t.delegateTarget||t.target;return o?(i=kn(o,"data-action"),r=t.originalEvent||t,this.triggerEntry(i,e,r,n)):t.preventDefault()},on.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(hn(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},on.prototype._layoutChanged=function(){this._toggleState({})},on.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},on.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},on.prototype.open=function(){this._toggleState({open:!0})},on.prototype.toggle=function(){this.isOpen()?this.close():this.open()},on.prototype.isActiveTool=function(e){return e&&this._activeTool===e},on.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=St(".djs-palette-entries",this._container),this._toolsContainer=St("[data-group=tools]",t)),n=this._toolsContainer,H(n.children,function(i){var r=i.getAttribute("data-action");if(r){var o=Bt(i);r=r.replace("-tool",""),o.contains("entry")&&r===e?o.add("highlighted-entry"):o.remove("highlighted-entry")}})},on.prototype.isOpen=function(){return Bt(this._container).has(yh)},on.prototype._getParentContainer=function(){return this._canvas.getContainer()},on.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function eB(e,t){var n=Bt(e),i=Fe(t)?t:t.split(/\s+/g);i.forEach(function(r){n.add(r)})}function tB(e,t){var n=t.getPaletteEntries();return hn(n)?n(e):(H(n,function(i,r){e[r]=i}),e)}const nB={__init__:["palette"],palette:["type",on]};var x0="crosshair",_0="selected",iB="djs-dragging-active-lasso";function Ur(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=De("rect");Se(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),qe(f,d),l(!0),this.update(p)},update:function(p){var f=p.frame,d=p.bbox;f&&d&&Se(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 v of m)h.has(v)||t.removeMarker(v,_0);for(const v of h)m.has(v)||t.addMarker(v,_0)}},remove:function(p){this.update(p),p.frame&&cn(p.frame),l(!1)}};function l(p){ct(t.getContainer()).toggle(iB,p)}function u(p){var f=i.getAll();return new Set(To(Wo(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=w0(p),f.add=ll(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=w0(p),h=u(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(ll(p))return s.activateLasso(p.originalEvent),!0})}Ur.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],Ur.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:x0,data:{context:{}},keepSelection:!0})},Ur.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:x0,data:{context:{}},keepSelection:!0})},Ur.prototype._select=function(e){this._selection.select(e)},Ur.prototype.select=function(e,t,n=[]){var i=To(Wo(e,t));this._select([...n,...i])},Ur.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Ur.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function w0(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 rB={__depends__:[xl,ss],__init__:["lassoTool"],lassoTool:["type",Ur]};var vh=1500,E0="grab";function _a(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",vh,function(c){if(rs(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(vh,function(c){if(!(!S0(c.keyEvent)||a.isActive())){var l=a._mouse.getLastMoveEvent();a.activateMove(l,!!l)}},"keyboard.keydown"),s&&s.addListener(vh,function(c){!S0(c.keyEvent)||!a.isActive()||a.toggle()},"keyboard.keyup"),e.on("hand.end",function(c){var l=c.originalEvent.target;if(!c.hover&&!(l instanceof SVGElement))return!1;e.once("hand.ended",function(){a.activateMove(c.originalEvent,{reactivate:!0})})}),e.on("hand.move.move",function(c){var l=t.viewbox().scale;t.scroll({dx:c.dx*l,dy:c.dy*l})}),e.on("hand.move.end",function(c){var l=c.context,u=l.reactivate;return!rs(c)&&u&&e.once("hand.move.ended",function(p){a.activateHand(p.originalEvent,!0,!0)}),!1})}_a.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],_a.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:E0,data:{context:n||{}}})},_a.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:E0,data:{context:{reactivate:n}}})},_a.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},_a.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function S0(e){return ln("Space",e)}const oB={__depends__:[xl,ss],__init__:["handTool"],handTool:["type",_a]};var R0="connect-ok",C0="connect-not-ok";function wa(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 l=c.context,u=c.hover,p=l.canStartConnect=s.canStartConnect(u);p!==null&&(l.startTarget=u,i.addMarker(u,p?R0:C0))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var l=c.context.startTarget,u=c.context.canStartConnect;l&&i.removeMarker(l,u?R0:C0)}),e.on(["global-connect.ended"],function(c){var l=c.context,u=l.startTarget,p={x:c.x,y:c.y},f=s.canStartConnect(u);if(f)return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),n.start(null,u,p)}),!1})}wa.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],wa.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},wa.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},wa.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},wa.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const aB={__depends__:[sh,Vi,ar,xl,ss],globalConnect:["type",wa]};function bh(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)}bh.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],bh.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 v(w){var x=n.createShape(W({type:p},m));t.start(w,x)}return{group:f,className:d,title:h,action:{dragstart:v,click:v}}}function l(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 u(p){t.start(p,n.createParticipantShape())}return W(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:l,click:l}},"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:s("Create pool/participant"),action:{dragstart:u,click:u}},"create.group":c("bpmn:Group","artifact","bpmn-icon-group",s("Create group"))}),e};const sB={__depends__:[nB,vl,Vb,rB,oB,aB,Za],__init__:["paletteProvider"],paletteProvider:["type",bh]};var cB=250;function xh(e,t,n,i,r){ce.call(this,e);function o(s){var c=s.canExecute.replacements;H(c,function(l){var u=l.oldElementId,p={type:l.newElementType};if(!s.visualReplacements[u]){var f=t.get(u);W(p,{x:f.x,y:f.y});var d=n.createShape(p);i.addShape(d,f.parent);var h=St('[data-element-id="'+Es(f.id)+'"]',s.dragGroup);h&&Se(h,{display:"none"});var m=r.addDragger(d,s.dragGroup);s.visualReplacements[u]=m,i.removeShape(d)}})}function a(s){var c=s.visualReplacements;H(c,function(l,u){var p=St('[data-element-id="'+Es(u)+'"]',s.dragGroup);p&&Se(p,{display:"inline"}),l.remove(),c[u]&&delete c[u]})}e.on("shape.move.move",cB,function(s){var c=s.context,l=c.canExecute;c.visualReplacements||(c.visualReplacements={}),l&&l.replacements?o(c):a(c)})}xh.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],Ee(xh,ce);const lB={__depends__:[la],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",xh]};var uB=1250,_h=40,pB=20,fB=10,A0=20,M0=["x","y"],dB=Math.abs;function P0(e){e.on(["connect.hover","connect.move","connect.end"],uB,function(t){var n=t.context,i=n.canExecute,r=n.start,o=n.hover,a=n.source,s=n.target;t.originalEvent&&Kn(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&o&&hB(t,o,vB(o)),o&&yB(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=bi(r),et(o,["bpmn:Event","bpmn:Gateway"])&&T0(t,bi(o)),et(o,["bpmn:Task","bpmn:SubProcess"])&&mB(t,o),C(a,"bpmn:BoundaryEvent")&&s===a.host&&gB(t)):k0(i,"bpmn:MessageFlow")?(C(r,"bpmn:Event")&&(n.connectionStart=bi(r)),C(o,"bpmn:Event")&&T0(t,bi(o))):n.connectionStart=n.initialConnectionStart)})}P0.$inject=["eventBus"];function hB(e,t,n){M0.forEach(function(i){var r=O0(i,t);e[i]<t[i]+n?rn(e,i,t[i]+n):e[i]>t[i]+r-n&&rn(e,i,t[i]+r-n)})}function mB(e,t){var n=bi(t);M0.forEach(function(i){bB(e,t,i)&&rn(e,i,n[i])})}function gB(e){var t=e.context,n=t.source,i=t.target;if(!xB(t)){var r=bi(n),o=Sn(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],l;dB(c-r[s])<_h&&(c>r[s]?l=r[s]+_h:l=r[s]-_h,rn(e,s,l))})}}function T0(e,t){rn(e,"x",t.x),rn(e,"y",t.y)}function k0(e,t){return e&&e.type===t}function yB(e,t){return yr(t,function(n){return k0(e,n)})}function O0(e,t){return e==="x"?t.width:t.height}function vB(e){return C(e,"bpmn:Task")?fB:pB}function bB(e,t,n){return e[n]>t[n]+A0&&e[n]<t[n]+O0(n,t)-A0}function xB(e){var t=e.hover,n=e.source;return t&&n&&t===n}function qr(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}qr.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},qr.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},qr.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},qr.prototype.getSnapLocations=function(){return this._snapLocations},qr.prototype.setSnapLocations=function(e){this._snapLocations=e},qr.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new Mu,n.initDefaults(this._defaultSnaps)),n};function Mu(){this._snapValues={}}Mu.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)},Mu.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&cL(e[n],r[n],i)},Mu.prototype.initDefaults=function(e){var t=this;H(e||{},function(n,i){H(n,function(r){t.add(i,r)})})};var _B=1250;function Yi(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"],_B,function(r){var o=r.context,a=o.shape,s=o.snapContext,c=o.target;if(!(r.originalEvent&&Kn(r.originalEvent))&&!(xa(r)||!c)){var l=s.pointsForTarget(c);l.initialized||(l=i.addSnapTargetPoints(l,a,c),l.initialized=!0),n.snap(r,l)}}),t.on(["create.cleanup","shape.move.cleanup"],function(){n.hide()})}Yi.$inject=["elementRegistry","eventBus","snapping"],Yi.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,r=n.snapContext;r||(r=n.snapContext=new qr);var o;t.get(i.id)?o=bi(i,e):o={x:e.x+bi(i).x,y:e.y+bi(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}),Je(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},Yi.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return H(i,function(r){if(Je(r)){Je(t)&&e.add("mid",bi(r));return}if(Ct(r)){if(r.waypoints.length<3)return;var o=r.waypoints.slice(1,-1);H(o,function(a){e.add("mid",a)});return}e.add("mid",bi(r))}),!Ge(t.x)||!Ge(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",bi(t)),e},Yi.prototype.getSnapTargets=function(e,t){return vw(t).filter(function(n){return!wB(n)})};function wB(e){return!!e.hidden}var D0=1500;function Ea(e,t){t.invoke(Yi,this),e.on(["create.move","create.end"],D0,CB),e.on(["create.move","create.end","shape.move.move","shape.move.end"],D0,function(n){var i=n.context,r=i.canExecute,o=i.target,a=r&&(r==="attach"||r.attach);a&&!xa(n)&&EB(n,o)})}Ee(Ea,Yi),Ea.$inject=["eventBus","injector"],Ea.prototype.initSnap=function(e){var t=Yi.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return H(n.outgoing,function(r){var o=r.waypoints[0];o=o.original||o,t.setSnapOrigin(r.id+"-docking",I0(o,i,e))}),H(n.incoming,function(r){var o=r.waypoints[r.waypoints.length-1];o=o.original||o,t.setSnapOrigin(r.id+"-docking",I0(o,i,e))}),C(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},Ea.prototype.addSnapTargetPoints=function(e,t,n){Yi.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);H(i,function(o){(RB(o)||SB([t,o],"bpmn:TextAnnotation"))&&(e.add("top-left",gw(o)),e.add("bottom-right",yw(o)))});var r=this._elementRegistry;return H(t.incoming,function(o){if(r.get(t.id)){L0(i,o.source)||e.add("mid",je(o.source));var a=o.waypoints[0];e.add(o.id+"-docking",a.original||a)}}),H(t.outgoing,function(o){if(r.get(t.id)){L0(i,o.target)||e.add("mid",je(o.target));var a=o.waypoints[o.waypoints.length-1];e.add(o.id+"-docking",a.original||a)}}),C(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},Ea.prototype.getSnapTargets=function(e,t){return Yi.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!C(n,"bpmn:Lane")})};function EB(e,t){var n=Ie(t),i=jv(e,t),r=e.context,o=r.shape,a;o.parent?a={x:0,y:0}:a=je(o),/top/.test(i)?rn(e,"y",n.top-a.y):/bottom/.test(i)&&rn(e,"y",n.bottom-a.y),/left/.test(i)?rn(e,"x",n.left-a.x):/right/.test(i)&&rn(e,"x",n.right-a.x)}function SB(e,t){return e.every(function(n){return C(n,t)})}function RB(e){return C(e,"bpmn:SubProcess")&&at(e)?!0:C(e,"bpmn:Participant")}function CB(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)&&rn(e,"x",e.x),(i&&i>=e.y||o&&o<=e.y)&&rn(e,"y",e.y)}}function L0(e,t){return e.indexOf(t)!==-1}function I0(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var AB=1250;function Fs(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],AB,function(i){var r=i.context,o=r.shape,a=o.parent,s=r.direction,c=r.snapContext;if(!(i.originalEvent&&Kn(i.originalEvent))&&!xa(i)){var l=c.pointsForTarget(a);l.initialized||(l=n.addSnapTargetPoints(l,o,a,s),l.initialized=!0),TB(s)&&rn(i,"x",i.x),kB(s)&&rn(i,"y",i.y),t.snap(i,l)}}),e.on(["resize.cleanup"],function(){t.hide()})}Fs.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new qr);var o=B0(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},Fs.prototype.addSnapTargetPoints=function(e,t,n,i){var r=this.getSnapTargets(t,n);return H(r,function(o){e.add("corner",yw(o)),e.add("corner",gw(o))}),e.add("corner",B0(t,i)),e},Fs.$inject=["eventBus","snapping"],Fs.prototype.getSnapTargets=function(e,t){return vw(t).filter(function(n){return!MB(n,e)&&!Ct(n)&&!PB(n)&&!Je(n)})};function B0(e,t){var n=je(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 MB(e,t){return e.host===t}function PB(e){return!!e.hidden}function TB(e){return e==="n"||e==="s"}function kB(e){return e==="e"||e==="w"}var OB=7,DB=1e3;function Yr(e){this._canvas=e,this._asyncHide=qu(Fn(this.hide,this),DB)}Yr.$inject=["canvas"],Yr.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,r=i.getSnapLocations(),o={x:xa(e,"x"),y:xa(e,"y")};H(r,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(H(["x","y"],function(l){var u;o[l]||(u=t.snap(c,a,l,OB),u!==void 0&&(o[l]={value:u,originValue:u-s[l]}))}),o.x&&o.y)return!1}),this.showSnapLine("vertical",o.x&&o.x.value),this.showSnapLine("horizontal",o.y&&o.y.value),H(["x","y"],function(a){var s=o[a];dn(s)&&rn(e,a,s.originValue)})},Yr.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=De("path");return Se(n,{d:"M0,0 L0,0"}),ct(n).add("djs-snap-line"),qe(t,n),{update:function(i){Ge(i)?e==="horizontal"?Se(n,{d:"M-100000,"+i+" L+100000,"+i,display:""}):Se(n,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):Se(n,{display:"none"})}}},Yr.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},Yr.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},Yr.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},Yr.prototype.hide=function(){H(this._snapLines,function(e){e.update()})};const LB={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",Yi],resizeSnapping:["type",Fs],snapping:["type",Yr]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",P0],createMoveSnapping:["type",Ea]};var N0=300;function Ye(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=St(Ye.INPUT_SELECTOR,this._container),this._resultsContainer=St(Ye.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}Ye.$inject=["canvas","eventBus","selection","translate"],Ye.prototype._bindEvents=function(){var e=this;function t(n,i,r,o){e._eventMaps.push({el:n,type:r,listener:Un.bind(n,i,r,o)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,Ye.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,Ye.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,Ye.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,Ye.INPUT_SELECTOR,"keydown",function(n){ln("ArrowUp",n)&&n.preventDefault(),ln("ArrowDown",n)&&n.preventDefault()}),t(this._container,Ye.INPUT_SELECTOR,"keyup",function(n){if(ln("Escape",n))return e.close();if(ln("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(ln("ArrowUp",n))return e._scrollToDirection(!0);if(ln("ArrowDown",n))return e._scrollToDirection();ln(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},Ye.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){Un.unbind(e.el,e.type,e.listener)})},Ye.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=St(Ye.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},Ye.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},Ye.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)}},Ye.prototype._clearResults=function(){Sc(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},Ye.prototype._getCurrentResult=function(){return St(Ye.RESULT_SELECTED_SELECTOR,this._resultsContainer)},Ye.prototype._createResultNode=function(e,t){var n=Ot(Ye.RESULT_HTML);return e.primaryTokens.length>0&&$0(n,e.primaryTokens,Ye.RESULT_PRIMARY_HTML),$0(n,e.secondaryTokens,Ye.RESULT_SECONDARY_HTML),kn(n,Ye.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},Ye.prototype.registerProvider=function(e){this._searchProvider=e},Ye.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,Bt(this._canvas.getContainer()).add("djs-search-open"),Bt(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},Ye.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,Bt(this._canvas.getContainer()).remove("djs-search-open"),Bt(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},Ye.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Ye.prototype.isOpen=function(){return this._open},Ye.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&Bt(t).remove(Ye.RESULT_SELECTED_CLASS);var n=kn(e,Ye.RESULT_ID_ATTRIBUTE),i=this._results[n].element;Bt(e).add(Ye.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:N0}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},Ye.prototype._select=function(e){var t=kn(e,Ye.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:N0}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},Ye.prototype._getBoxHtml=function(){const e=Ot(Ye.BOX_HTML),t=St(Ye.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function $0(e,t,n){var i=IB(t),r=Ot(n);r.innerHTML=i,e.appendChild(r)}function IB(e){var t="";return e.forEach(function(n){var i=Ux(n.value||n.matched||n.normal),r=n.match||n.matched;r?t+='<b class="'+Ye.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}Ye.CONTAINER_SELECTOR=".djs-search-container",Ye.INPUT_SELECTOR=".djs-search-input input",Ye.RESULTS_CONTAINER_SELECTOR=".djs-search-results",Ye.RESULT_SELECTOR=".djs-search-result",Ye.RESULT_SELECTED_CLASS="djs-search-result-selected",Ye.RESULT_SELECTED_SELECTOR="."+Ye.RESULT_SELECTED_CLASS,Ye.RESULT_ID_ATTRIBUTE="data-result-id",Ye.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",Ye.BOX_HTML=`<div class="djs-search-container djs-scrollable">
335
+ </svg>`},lI=900;function $s(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",lI,this)}$s.$inject=["popupMenu","distributeElements","translate","rules"],$s.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&W(t,this._getEntries(e)),t},$s.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},$s.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:qw.horizontal,action:function(o,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:qw.vertical,action:function(o,a){t.trigger(e,"vertical"),i.close()}}};return r};const uI={__depends__:[uh,cI],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",_u],distributeElementsMenuProvider:["type",$s]};var Yw="is not a registered action",pI="is already registered";function Ei(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}Ei.$inject=["eventBus","injector"],Ei.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),l=e.get("keyboardMoveSelection",!1);t&&(this.register("undo",function(){t.undo()}),this.register("redo",function(){t.redo()})),o&&i&&this.register("copy",function(){var u=i.get();if(u.length)return o.copy(u)}),o&&i&&this.register("duplicate",function(){var u=i.get();if(u.length)return o.duplicate(u)}),o&&this.register("paste",function(){o.paste()}),o&&i&&s&&this.register("cut",function(){var u=i.get();if(u.length){var p=s.allowed("elements.delete",{elements:u});if(p!==!1){var f=$e(p)?p:u;return o.cut(f.slice())}}}),r&&this.register("stepZoom",function(u){r.stepZoom(u.value)}),a&&this.register("zoom",function(u){a.zoom(u.value)}),n&&i&&s&&this.register("removeSelection",function(){var u=i.get();if(u.length){var p=s.allowed("elements.delete",{elements:u}),f;p!==!1&&($e(p)?f=p:f=u,f.length&&n.removeElements(f.slice()))}}),c&&this.register("moveCanvas",function(u){c.moveCanvas(u)}),l&&this.register("moveSelection",function(u){l.moveSelection(u.direction,u.accelerated)})},Ei.prototype.trigger=function(e,t){if(!this._actions[e])throw xh(e,Yw);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},Ei.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);H(e,function(i,r){n._registerAction(r,i)})},Ei.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw xh(e,pI);this._actions[e]=t},Ei.prototype.unregister=function(e){if(!this.isRegistered(e))throw xh(e,Yw);this._actions[e]=void 0},Ei.prototype.getActions=function(){return Object.keys(this._actions)},Ei.prototype.isRegistered=function(e){return!!this._actions[e]};function xh(e,t){return new Error(e+" "+t)}const fI={__init__:["editorActions"],editorActions:["type",Ei]};function wu(e){e.invoke(Ei,this)}we(wu,Ei),wu.$inject=["injector"],wu.prototype._registerDefaultActions=function(e){Ei.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),l=e.get("alignElements",!1),u=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 g=t.getRootElement(),h=n.filter(function(y){return y!==g});return i.select(h),h}),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(g){var h=i.get(),y=g.type;h.length&&c.trigger(h,y)}),i&&l&&this._registerAction("alignElements",function(g){var h=i.get(),y=[],R=g.type;h.length&&(y=tt(h,function(x){return!C(x,"bpmn:Lane")}),l.trigger(y,R))}),i&&f&&this._registerAction("setColor",function(g){var h=i.get();h.length&&f.setColor(h,g)}),i&&u&&this._registerAction("directEditing",function(){var g=i.get();g.length&&u.activate(g[0])}),p&&this._registerAction("find",function(){p.toggle()}),t&&f&&this._registerAction("moveToOrigin",function(){var g=t.getRootElement(),h,y;C(g,"bpmn:Collaboration")?y=n.filter(function(R){return C(R.parent,"bpmn:Collaboration")}):y=n.filter(function(R){return R!==g&&!C(R.parent,"bpmn:SubProcess")}),h=Jt(y),f.moveElements(y,{x:-h.x,y:-h.y},g)}),i&&d&&this._registerAction("replaceElement",function(g){d.triggerEntry("replace","click",g)})};const dI={__depends__:[fI],editorActions:["type",wu]};function Kw(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;et(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}Kw.$inject=["eventBus"];function So(e,t){ce.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)}})}So.$inject=["eventBus","gridSnapping","modeling"],we(So,ce),So.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},So.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},So.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),W(e,o),e},So.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),W(e,o),e};var hI=2e3;function Xw(e,t){e.on(["spaceTool.move","spaceTool.end"],hI,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)}})}Xw.$inject=["eventBus","gridSnapping"];const mI={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",So],gridSnappingSpaceToolBehavior:["type",Xw]};var Eu=10;function _h(e,t,n){return n||(n="round"),Math[n](e/t)*t}var gI=1200,yI=800;function Wr(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var r=this;t.on("diagram.init",yI,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"],gI,function(o){var a=o.originalEvent;if(!(!r.active||a&&Xn(a))){var s=o.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(l){var u={},p=bI(o,l,e);p&&(u.offset=p);var f=vI(o,l);f&&W(u,f),Ra(o,l)||r.snapEvent(o,l,u)})}})}Wr.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);rn(e,t,i)},Wr.prototype.getGridSpacing=function(){return Eu},Wr.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=_h(e,Eu);var i,r;return t&&t.min&&(i=t.min,ze(i)&&(i=_h(i+n,Eu,"ceil"),e=Math.max(e,i))),t&&t.max&&(r=t.max,ze(r)&&(r=_h(r+n,Eu,"floor"),e=Math.min(e,r))),e-=n,e},Wr.prototype.isActive=function(){return this.active},Wr.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},Wr.prototype.toggleActive=function(){this.setActive(!this.active)},Wr.$inject=["elementRegistry","eventBus","config.gridSnapping"];function vI(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&&(Su(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,l=r.max;return c&&(Su(t)?Qw(s)?a.x.max=c.left:a.x.min=c.right:Zw(s)?a.y.max=c.top:a.y.min=c.bottom),l&&(Su(t)?Qw(s)?a.x.min=l.left:a.x.max=l.right:Zw(s)?a.y.min=l.top:a.y.max=l.bottom),a[t]}function bI(e,t,n){var i=e.context,r=e.shape,o=i.gridSnappingContext,a=o.snapLocation,s=o.snapOffset;return s&&ze(s[t])||(s||(s=o.snapOffset={}),ze(s[t])||(s[t]=0),!r)||(n.get(r.id)||(Su(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 Su(e){return e==="x"}function Zw(e){return e.indexOf("n")!==-1}function Qw(e){return e.indexOf("w")!==-1}const xI={__depends__:[mI],__init__:["gridSnapping"],gridSnapping:["type",Wr]};var _I=2e3;function Jw(e,t,n){e.on("autoPlace",_I,function(i){var r=i.source,o=Fe(r),a=i.shape,s=zx(r,a,n);return["x","y"].forEach(function(c){var l={};s[c]!==o[c]&&(s[c]>o[c]?l.min=s[c]:l.max=s[c],C(a,"bpmn:TextAnnotation")&&(wI(c)?l.offset=-a.width/2:l.offset=-a.height/2),s[c]=t.snapValue(s[c],l))}),s})}Jw.$inject=["eventBus","gridSnapping","elementRegistry"];function wI(e){return e==="x"}var EI=1750;function e0(e,t,n){t.on(["create.start","shape.move.start"],EI,function(i){var r=i.context,o=r.shape,a=e.getRootElement();if(!(!C(o,"bpmn:Participant")||!C(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}))}})}e0.$inject=["canvas","eventBus","gridSnapping"];var SI=3e3;function Ru(e,t,n){ce.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],SI,function(r){var o=r.context,a=o.connection,s=o.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||RI(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}Ru.$inject=["eventBus","gridSnapping","modeling"],we(Ru,ce),Ru.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=MI(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function RI(e){return e.length>3}function CI(e){return e==="h"}function AI(e){return e==="v"}function MI(e,t,n){var i=tr(t,n),r={};return CI(i)&&(r.y=e.snapValue(t.y)),AI(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=W({},t,r),n=W({},n,r)),[t,n]}const PI={__depends__:[xI,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",Jw],gridSnappingParticipantBehavior:["type",e0],gridSnappingLayoutConnectionBehavior:["type",Ru]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",Kw]};var TI=30,t0=30;function Fs(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var r=i.element,o=i.gfx;if(C(r,"bpmn:Lane"))return n._createParticipantHit(r,o);if(C(r,"bpmn:Participant"))return at(r)?n._createParticipantHit(r,o):n._createDefaultHit(r,o);if(C(r,"bpmn:SubProcess"))return at(r)?n._createSubProcessHit(r,o):n._createDefaultHit(r,o)})}Fs.$inject=["eventBus","interactionEvents"],Fs.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},Fs.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=gn(e)?{width:TI,height:e.height}:{width:e.width,height:t0};return this._interactionEvents.createBoxHit(t,"all",n),!0},Fs.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:t0}),!0};const kI={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",Fs]};function Cu(e){e.invoke(va,this)}we(Cu,va),Cu.$inject=["injector"],Cu.prototype.registerBindings=function(e,t){va.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 OI={__depends__:[Kd],__init__:["keyboardBindings"],keyboardBindings:["type",Cu]};var DI={moveSpeed:1,moveSpeedAccelerated:10},LI=1500,n0="left",i0="up",r0="right",o0="down",II={ArrowLeft:n0,Left:n0,ArrowUp:i0,Up:i0,ArrowRight:r0,Right:r0,ArrowDown:o0,Down:o0},BI={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 a0(e,t,n,i,r){var o=this;this._config=W({},DI,e||{}),t.addListener(LI,function(a){var s=a.keyEvent,c=II[s.key];if(c&&!t.isCmd(s)){var l=t.isShift(s);return o.moveSelection(c,l),!0}}),this.moveSelection=function(a,s){var c=r.get();if(c.length){var l=this._config[s?"moveSpeedAccelerated":"moveSpeed"],u=BI[a](l),p=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});p&&n.moveElements(c,u)}}}a0.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const NI={__depends__:[Kd,vi],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",a0]};var s0=10;function js(e,t,n,i){this._dragging=i,this._rules=t;var r=this;function o(c,l){var u=c.shape,p=c.direction,f=c.resizeConstraints,d;c.delta=l,d=EP(u,p,l),c.newBounds=RP(d,f),c.canExecute=r.canResize(c)}function a(c){var l=c.resizeConstraints,u=c.minBounds;l===void 0&&(u===void 0&&(u=r.computeMinResizeBox(c)),c.resizeConstraints={min:Ie(u)})}function s(c){var l=c.shape,u=c.canExecute,p=c.newBounds;if(u){if(p=hy(p),!$I(l,p))return;n.resizeShape(l,p)}}e.on("resize.start",function(c){a(c.context)}),e.on("resize.move",function(c){var l={x:c.dx,y:c.dy};o(c.context,l)}),e.on("resize.end",function(c){s(c.context)})}js.prototype.canResize=function(e){var t=this._rules,n=Mi(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},js.prototype.activate=function(e,t,n){var i=this._dragging,r,o;if(typeof n=="string"&&(n={direction:n}),r=W({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,c0(t,o),"resize",{autoActivate:!0,cursor:FI(o),data:{shape:t,context:r}})},js.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,r;return i=e.minDimensions||{width:s0,height:s0},r=tv(t,e.childrenBoxPadding),CP(n,t,i,r)},js.$inject=["eventBus","rules","modeling","dragging"];function $I(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function c0(e,t){var n=Fe(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 FI(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 l0="djs-resizing",u0="resize-not-ok",jI=500;function p0(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,l0)),s.width>5&&Ee(c,{x:s.x,width:s.width}),s.height>5&&Ee(c,{y:s.y,height:s.height}),o.canExecute?ct(c).remove(u0):ct(c).add(u0)}function r(o){var a=o.shape,s=o.frame;s&&cn(o.frame),t.removeMarker(a,l0)}e.on("resize.move",jI,function(o){i(o.context)}),e.on("resize.cleanup",function(o){r(o.context)})}p0.$inject=["eventBus","canvas","previewSupport"];var Au=-6,Mu=8,Pu=20,Hs="djs-resizer",HI=["n","w","s","e","nw","ne","se","sw"];function Ur(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&&H(a,jn(r.addResizer,r))}),e.on("shape.changed",function(o){var a=o.element;n.isSelected(a)&&(r.removeResizers(),r.addResizer(a))})}Ur.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(o){Lr(o)&&i.activate(o,e,n)}Ge.bind(t,"mousedown",r),Ge.bind(t,"touchstart",r)},Ur.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=zI(i),a=Oe("g");ct(a).add(Hs),ct(a).add(Hs+"-"+e.id),ct(a).add(Hs+"-"+i),Ue(r,a);var s=Oe("rect");Ee(s,{x:-Mu/2+o.x,y:-Mu/2+o.y,width:Mu,height:Mu}),ct(s).add(Hs+"-visual"),Ue(a,s);var c=Oe("rect");return Ee(c,{x:-Pu/2+o.x,y:-Pu/2+o.y,width:Pu,height:Pu}),ct(c).add(Hs+"-hit"),Ue(a,c),Hc(a,t,n),a},Ur.prototype.createResizer=function(e,t){var n=c0(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},Ur.prototype.addResizer=function(e){var t=this;Ct(e)||H(HI,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},Ur.prototype.removeResizers=function(){var e=this._getResizersParent();Oc(e)},Ur.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},Ur.$inject=["eventBus","canvas","selection","resize"];function zI(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-Au:e.indexOf("w")!==-1&&(t.x=Au),e.indexOf("s")!==-1?t.y=-Au:e.indexOf("n")!==-1&&(t.y=Au),t}const f0={__depends__:[Wi,sr,ha],__init__:["resize","resizePreview","resizeHandles"],resize:["type",js],resizePreview:["type",p0],resizeHandles:["type",Ur]};var GI=2e3;function zs(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"],GI,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 l=c.context,u=l.shape,p=c.context.canExecute,f=c.isTouch;f||p&&(l.hints&&l.hints.createElementsBehavior===!1||s(u))}),e.on("autoPlace.end",500,function(c){s(c.shape)});function s(c,l){(l||et(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}zs.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],zs.prototype.activate=function(e){var t=li(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);W(n,i);var r={},o=n.style||{};return W(o,{backgroundColor:null,border:null}),(et(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||d0(e))&&W(r,{centerVertically:!0}),Tr(e)&&(W(r,{resizable:!0,autoResize:!0}),W(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),C(e,"bpmn:TextAnnotation")&&(W(r,{resizable:!0,autoResize:!0}),W(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),W(n,{options:r,style:o}),n}},zs.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(),l=c.fontSize*a,u=c.lineHeight,p=s.fontSize*a,f=s.lineHeight,d={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(C(e,"bpmn:Lane")||UI(e)){var g=gn(e),h=g?{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};W(o,h),W(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:g?"rotate(-90deg)":null})}if(WI(e)){var y=gn(e),R=y?{width:i.width,height:i.height}:{width:i.height,height:i.width,x:r.x-i.height/2,y:r.y-i.width/2};W(o,R),W(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:y?null:"rotate(-90deg)"})}(et(e,["bpmn:Task","bpmn:CallActivity"])||d0(e))&&(W(o,{width:i.width,height:i.height}),W(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),VI(e)&&(W(o,{width:i.width,x:i.x}),W(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var x=1,m=i.width+2*x;if(n.labelTarget&&(W(o,{width:m,height:i.height+2*x,x:i.x-x,y:i.y-x}),W(d,{fontSize:l+"px",lineHeight:u})),Tr(n)&&!Vc(n)&&!Je(n)){var v=of(e),_=t.getAbsoluteBBox({x:v.x,y:v.y,width:0,height:0}),E=l,T=po.width*a+2*x;W(o,{width:T,height:E+2*x,x:_.x-T/2,y:_.y-E/2-x}),W(d,{fontSize:l+"px",lineHeight:u})}return C(e,"bpmn:TextAnnotation")&&(W(o,{width:i.width+2*x,height:i.height+2*x,x:i.x-x,y:i.y-x,minWidth:30*a,minHeight:10*a}),W(d,{textAlign:"left",paddingTop:ta*a+"px",paddingBottom:ta*a+"px",paddingLeft:ta*a+"px",paddingRight:ta*a+"px",fontSize:p+"px",lineHeight:f})),{bounds:o,style:d}},zs.prototype.update=function(e,t,n,i){var r,o;C(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}),qI(t)&&(t=null),this._modeling.updateLabel(e,t,r)};function d0(e){return C(e,"bpmn:SubProcess")&&!at(e)}function VI(e){return C(e,"bpmn:SubProcess")&&at(e)}function WI(e){return C(e,"bpmn:Participant")&&!at(e)}function UI(e){return C(e,"bpmn:Participant")&&at(e)}function qI(e){return!e||!e.trim()}var h0="djs-element-hidden",m0="djs-label-hidden";function g0(e,t,n){var i=this,r=t.getDefaultLayer(),o,a,s;e.on("directEditing.activate",function(c){var l=c.active;if(o=l.element.label||l.element,C(o,"bpmn:TextAnnotation")){a=t.getAbsoluteBBox(o),s=Oe("g");var u=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:o.height,position:{mx:0,my:0}}),p=i.path=Oe("path");Ee(p,{d:u,strokeWidth:2,stroke:YI(o)}),Ue(s,p),Ue(r,s),Cn(s,o.x,o.y)}C(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,h0):(C(o,"bpmn:Task")||C(o,"bpmn:CallActivity")||C(o,"bpmn:SubProcess")||C(o,"bpmn:Participant")||C(o,"bpmn:Lane"))&&t.addMarker(o,m0)}),e.on("directEditing.resize",function(c){if(C(o,"bpmn:TextAnnotation")){var l=c.height,u=c.dy,p=Math.max(o.height/a.height*(l+u),0),f=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:p,position:{mx:0,my:0}});Ee(i.path,{d:f})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var l=c.active;l&&(t.removeMarker(l.element.label||l.element,h0),t.removeMarker(o,m0)),o=void 0,a=void 0,s&&(cn(s),s=void 0)})}g0.$inject=["eventBus","canvas","pathMap"];function YI(e,t){var n=pt(e);return n.get("stroke")||t||"black"}const KI={__depends__:[Ed,f0,Hw],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",zs],labelEditingPreview:["type",g0]};var XI=500,ZI=1e3;function Yi(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){RA(o)||i.createOutline(o)}e.on("element.hover",function(o){r(o.element)}),e.on("selection.changed",function(o){H(o.newSelection,r)}),e.on(["shape.changed","connection.changed"],XI,function(o){var a=o.element,s=o.gfx,c=St(".djs-outline",s);c&&i.updateOutline(a,c)})}Yi.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=St(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),Ue(t,n),this.updateOutline(e,n)),n},Yi.prototype._createOutlineGfx=function(){var e=Oe("rect");return Ee(e,W({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},Yi.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},Yi.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&H(i,function(r){n=n||r.updateOutline(t,e)}),n||Ee(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},Yi.prototype.updateConnectionOutline=function(e,t){var n=Jt(t);Ee(e,{x:n.x-this._outlineOffset,y:n.y-this._outlineOffset,width:n.width+this._outlineOffset*2,height:n.height+this._outlineOffset*2})},Yi.prototype.registerProvider=function(e,t){t||(t=e,e=ZI),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},Yi.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Yi.prototype.getOutline=function(e){var t,n=this._getProviders();return H(n,function(i){hn(i.getOutline)&&(t=t||i.getOutline(e))}),t},Yi.$inject=["eventBus","styles","elementRegistry"];var Tu=6;function wh(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)})}wh.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");Oc(t);var n=e.length>1,i=this._canvas.getContainer();if(ct(i)[n?"add":"remove"]("djs-multi-select"),!!n){var r=QI(Jt(e)),o=Oe("rect");Ee(o,W({rx:3},r)),ct(o).add("djs-selection-outline"),Ue(t,o)}},wh.$inject=["eventBus","canvas","selection"];function QI(e){return{x:e.x-Tu,y:e.y-Tu,width:e.width+Tu*2,height:e.height+Tu*2}}const Eh={__depends__:[vi],__init__:["outline","multiSelectionOutline"],outline:["type",Yi],multiSelectionOutline:["type",wh]},y0=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],v0={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},JI=15,ku=2;function b0(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(g=>et(g,y0));if(f.length===1){const g=f[0];Je(g)?a(g,g.labelTarget):(d=g.labels)!=null&&d.length&&a(g.labels[0],g)}if(f.length===2){const g=f.find(Je),h=f.find(y=>{var R;return(R=y.labels)==null?void 0:R.includes(g)});g&&h&&a(g,h)}}),e.on("shape.changed",function({element:p}){var f;!et(p,y0)||!u(p)||(Je(p)?a(p,p.labelTarget):(f=p.labels)!=null&&f.length&&a(p.labels[0],p))});function a(p,f){const d=Wa([Fe(f),Fe(p)],v0),g=d.getAttribute("d"),y=r.isSelected(p)?c(p):l(p),R=Ka(y,g);if(!R)return;const m=r.isSelected(f)?c(f):l(f),v=Ka(m,g)||Fe(f);os(v,R)<JI||(Xp(d,[v,R]),Ue(o,d))}function s(){kc(`.${v0.class}`,o).forEach(cn)}function c(p){const f=i.getOutline(p);if(!f)return l(p);if(f.x){const d={x:p.x+qr(f,"x")-ku,y:p.y+qr(f,"y")-ku,width:qr(f,"width")+ku*2,height:qr(f,"height")+ku*2};return sf(d,qr(f,"rx"))}if(f.cx){const d=qr(f,"r"),g={x:p.x+qr(f,"cx")-d,y:p.y+qr(f,"cy")-d,width:d*2,height:d*2};return $y(g)}}function l(p){return n.getShapePath(p)}function u(p){return r.isSelected(p)}}b0.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function qr(e,t){return parseFloat(Ee(e,t)||0)}const eB={__depends__:[vi,Eh],__init__:["labelLink"],labelLink:["type",b0]};var tB=new da("tt");function nB(e){var t=Ot('<div class="djs-tooltip-container" />');return Bn(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function iB(e,t,n){Bn(e,{left:t+"px",top:n+"px"})}function Sh(e,t){e.style.display=t===!1?"none":""}var x0="djs-tooltip",Rh="."+x0;function zn(e,t){this._eventBus=e,this._canvas=t,this._ids=tB,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=nB(t.getContainer());var n=this;qn.bind(this._tooltipRoot,Rh,"mousedown",function(i){i.stopPropagation()}),qn.bind(this._tooltipRoot,Rh,"mouseover",function(i){n.trigger("mouseover",i)}),qn.bind(this._tooltipRoot,Rh,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}zn.$inject=["eventBus","canvas"],zn.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=W({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},zn.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)))},zn.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},zn.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},zn.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)}},zn.prototype.remove=function(e){var t=this.get(e);t&&(Fi(t.html),Fi(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},zn.prototype.show=function(){Sh(this._tooltipRoot)},zn.prototype.hide=function(){Sh(this._tooltipRoot,!1)},zn.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},zn.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=Ot(n)),i=Ot('<div data-tooltip-id="'+t+'" class="'+x0+'">'),Bn(i,{position:"absolute"}),i.appendChild(n),e.type&&Bt(i).add("djs-tooltip-"+e.type),e.className&&Bt(i).add(e.className),e.htmlContainer=i,r.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},zn.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;iB(n,t.x,t.y)},zn.prototype._updateTooltipVisibilty=function(e){H(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,r=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(r=!1),Sh(i,r))})},zn.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 rB={__init__:["tooltips"],tooltips:["type",zn]};var oB="flow elements must be children of pools/participants",aB="Data object must be placed within a pool/participant.";function _0(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;C(s,"bpmn:Collaboration")&&(C(a,"bpmn:FlowNode")?i(r,n(oB)):C(a,"bpmn:DataObjectReference")&&i(r,n(aB)))})}_0.$inject=["eventBus","tooltips","translate"];const sB={__depends__:[rB],__init__:["modelingFeedback"],modelingFeedback:["type",_0]};var cB=500,lB=1250,uB=1500,Ou=Math.round;function pB(e){return{x:e.x+Ou(e.width/2),y:e.y+Ou(e.height/2)}}function w0(e,t,n,i,r){function o(s,c,l,u){return r.allowed("elements.move",{shapes:s,delta:c,position:l,target:u})}e.on("shape.move.start",uB,function(s){var c=s.context,l=s.shape,u=i.get().slice();u.indexOf(l)===-1&&(u=[l]),u=fB(u),W(c,{shapes:u,validatedShapes:u,shape:l})}),e.on("shape.move.start",lB,function(s){var c=s.context,l=c.validatedShapes,u;if(u=c.canExecute=o(l),!u)return!1}),e.on("shape.move.move",cB,function(s){var c=s.context,l=c.validatedShapes,u=s.hover,p={x:s.dx,y:s.dy},f={x:s.x,y:s.y},d;if(d=o(l,p,f,u),c.delta=p,c.canExecute=d,d===null){c.target=null;return}c.target=u}),e.on("shape.move.end",function(s){var c=s.context,l=c.delta,u=c.canExecute,p=u==="attach",f=c.shapes;if(u===!1)return!1;l.x=Ou(l.x),l.y=Ou(l.y),!(l.x===0&&l.y===0)&&n.moveElements(f,l,c.target,{primaryShape:c.shape,attach:p})}),e.on("element.mousedown",function(s){if(Lr(s)){var c=la(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,l,u){if(dn(l)&&(u=l,l=!1),!(c.waypoints||!c.parent)&&!ct(s.target).has("djs-hit-no-move")){var p=pB(c),f=t.init(s,p,"shape.move",{cursor:"grabbing",autoActivate:l,data:{shape:c,context:u||{}}});if(f!==!1)return!0}}this.start=a}w0.$inject=["eventBus","dragging","modeling","selection","rules"];function fB(e){var t=Lo(e,"id");return tt(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var E0=499,Ch="djs-dragging",S0="drop-ok",R0="drop-not-ok",C0="new-parent",A0="attach-ok";function M0(e,t,n,i){function r(c){var l=o(c),u=dB(l);return u}function o(c){var l=Ua(c),u=l.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),p=l.concat(u),f=[...new Set(p)];return f}function a(c,l){[A0,S0,R0,C0].forEach(function(u){u===l?t.addMarker(c,u):t.removeMarker(c,u)})}function s(c,l,u){i.addDragger(l,c.dragGroup),u&&t.addMarker(l,Ch),c.allDraggedElements?c.allDraggedElements.push(l):c.allDraggedElements=[l]}e.on("shape.move.start",E0,function(c){var l=c.context,u=l.shapes,p=l.allDraggedElements,f=r(u);if(!l.dragGroup){var d=Oe("g");Ee(d,n.cls("djs-drag-group",["no-events"]));var g=t.getActiveLayer();Ue(g,d),l.dragGroup=d}f.forEach(function(h){i.addDragger(h,l.dragGroup)}),p?p=Ku([p,o(u)]):p=o(u),H(p,function(h){t.addMarker(h,Ch)}),l.allDraggedElements=p,l.differentParents=hB(u)}),e.on("shape.move.move",E0,function(c){var l=c.context,u=l.dragGroup,p=l.target,f=l.shape.parent,d=l.canExecute;p&&(d==="attach"?a(p,A0):l.canExecute&&f&&p.id!==f.id?a(p,C0):a(p,l.canExecute?S0:R0)),Cn(u,c.dx,c.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(c){var l=c.context,u=l.target;u&&a(u,null)}),e.on("shape.move.cleanup",function(c){var l=c.context,u=l.allDraggedElements,p=l.dragGroup;H(u,function(f){t.removeMarker(f,Ch)}),p&&cn(p)}),this.makeDraggable=s}M0.$inject=["eventBus","canvas","styles","previewSupport"];function dB(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=tt(e,function(i){return Ct(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function hB(e){return ZE(Lo(e,function(t){return t.parent&&t.parent.id}))!==1}const mB={__depends__:[_l,vi,Eh,Wi,sr,ha],__init__:["move","movePreview"],move:["type",w0],movePreview:["type",M0]};var P0=".djs-palette-toggle",T0=".entry",gB=P0+", "+T0,Ah="djs-palette-",yB="shown",Mh="open",k0="two-column",vB=1e3;function on(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()})}on.$inject=["eventBus","canvas"],on.prototype.registerProvider=function(e,t){t||(t=e,e=vB),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},on.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(xB,{})},on.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},on.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=Ot(on.HTML_MARKUP);n.appendChild(i),Bt(n).add(Ah+yB),qn.bind(i,gB,"click",function(r){var o=r.delegateTarget;if(Hp(o,P0))return e.toggle();e.trigger("click",r)}),Ge.bind(i,"mousedown",function(r){r.stopPropagation()}),qn.bind(i,T0,"dragstart",function(r){e.trigger("dragstart",r)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},on.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},on.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,r,o=Bt(n),a=Bt(t);"twoColumn"in e?r=e.twoColumn:r=this._needsCollapse(t.clientHeight,this._entries||{}),o.toggle(k0,r),a.toggle(Ah+k0,r),"open"in e&&(o.toggle(Mh,e.open),a.toggle(Ah+Mh,e.open)),i.fire("palette.changed",{twoColumn:r,open:this.isOpen()})},on.prototype._update=function(){var e=St(".djs-palette-entries",this._container),t=this._entries=this.getEntries();Pc(e),H(t,function(n,i){var r=n.group||"default",o=St("[data-group="+As(r)+"]",e);o||(o=Ot('<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=Ot(a);if(o.appendChild(s),!n.separator&&(On(s,"data-action",i),n.title&&On(s,"title",n.title),n.className&&bB(s,n.className),n.imageUrl)){var c=Ot("<img>");On(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},on.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()},on.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(hn(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},on.prototype._layoutChanged=function(){this._toggleState({})},on.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},on.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},on.prototype.open=function(){this._toggleState({open:!0})},on.prototype.toggle=function(){this.isOpen()?this.close():this.open()},on.prototype.isActiveTool=function(e){return e&&this._activeTool===e},on.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=St(".djs-palette-entries",this._container),this._toolsContainer=St("[data-group=tools]",t)),n=this._toolsContainer,H(n.children,function(i){var r=i.getAttribute("data-action");if(r){var o=Bt(i);r=r.replace("-tool",""),o.contains("entry")&&r===e?o.add("highlighted-entry"):o.remove("highlighted-entry")}})},on.prototype.isOpen=function(){return Bt(this._container).has(Mh)},on.prototype._getParentContainer=function(){return this._canvas.getContainer()},on.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function bB(e,t){var n=Bt(e),i=$e(t)?t:t.split(/\s+/g);i.forEach(function(r){n.add(r)})}function xB(e,t){var n=t.getPaletteEntries();return hn(n)?n(e):(H(n,function(i,r){e[r]=i}),e)}const _B={__init__:["palette"],palette:["type",on]};var O0="crosshair",D0="selected",wB="djs-dragging-active-lasso";function Yr(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=Oe("rect");Ee(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),Ue(f,d),l(!0),this.update(p)},update:function(p){var f=p.frame,d=p.bbox;f&&d&&Ee(f,{x:d.x,y:d.y,width:d.width,height:d.height});var g=p.marked,h=p.lastMarked;if(g&&h){for(const y of h)g.has(y)||t.removeMarker(y,D0);for(const y of g)h.has(y)||t.addMarker(y,D0)}},remove:function(p){this.update(p),p.frame&&cn(p.frame),l(!1)}};function l(p){ct(t.getContainer()).toggle(wB,p)}function u(p){var f=i.getAll();return new Set(Do(Xo(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=L0(p),f.add=hl(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=L0(p),g=u(d),h=f.initialMarked.union(g);f.lastMarked=f.marked,f.marked=h,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(hl(p))return s.activateLasso(p.originalEvent),!0})}Yr.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],Yr.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:O0,data:{context:{}},keepSelection:!0})},Yr.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:O0,data:{context:{}},keepSelection:!0})},Yr.prototype._select=function(e){this._selection.select(e)},Yr.prototype.select=function(e,t,n=[]){var i=Do(Xo(e,t));this._select([...n,...i])},Yr.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Yr.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function L0(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 EB={__depends__:[Rl,ps],__init__:["lassoTool"],lassoTool:["type",Yr]};var Ph=1500,I0="grab";function Ca(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",Ph,function(c){if(cs(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(Ph,function(c){if(!(!B0(c.keyEvent)||a.isActive())){var l=a._mouse.getLastMoveEvent();a.activateMove(l,!!l)}},"keyboard.keydown"),s&&s.addListener(Ph,function(c){!B0(c.keyEvent)||!a.isActive()||a.toggle()},"keyboard.keyup"),e.on("hand.end",function(c){var l=c.originalEvent.target;if(!c.hover&&!(l instanceof SVGElement))return!1;e.once("hand.ended",function(){a.activateMove(c.originalEvent,{reactivate:!0})})}),e.on("hand.move.move",function(c){var l=t.viewbox().scale;t.scroll({dx:c.dx*l,dy:c.dy*l})}),e.on("hand.move.end",function(c){var l=c.context,u=l.reactivate;return!cs(c)&&u&&e.once("hand.move.ended",function(p){a.activateHand(p.originalEvent,!0,!0)}),!1})}Ca.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Ca.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:I0,data:{context:n||{}}})},Ca.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:I0,data:{context:{reactivate:n}}})},Ca.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Ca.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function B0(e){return ln("Space",e)}const SB={__depends__:[Rl,ps],__init__:["handTool"],handTool:["type",Ca]};var N0="connect-ok",$0="connect-not-ok";function Aa(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 l=c.context,u=c.hover,p=l.canStartConnect=s.canStartConnect(u);p!==null&&(l.startTarget=u,i.addMarker(u,p?N0:$0))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var l=c.context.startTarget,u=c.context.canStartConnect;l&&i.removeMarker(l,u?N0:$0)}),e.on(["global-connect.ended"],function(c){var l=c.context,u=l.startTarget,p={x:c.x,y:c.y},f=s.canStartConnect(u);if(f)return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),n.start(null,u,p)}),!1})}Aa.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],Aa.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},Aa.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},Aa.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Aa.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const RB={__depends__:[vh,Wi,sr,Rl,ps],globalConnect:["type",Aa]};function Th(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)}Th.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],Th.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,g,h){function y(R){var x=n.createShape(W({type:p},h));t.start(R,x)}return{group:f,className:d,title:g,action:{dragstart:y,click:y}}}function l(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 u(p){t.start(p,n.createParticipantShape())}return W(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:l,click:l}},"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:s("Create pool/participant"),action:{dragstart:u,click:u}},"create.group":c("bpmn:Group","artifact","bpmn-icon-group",s("Create group"))}),e};const CB={__depends__:[_B,El,nx,EB,SB,RB,ts],__init__:["paletteProvider"],paletteProvider:["type",Th]};var AB=250;function kh(e,t,n,i,r){ce.call(this,e);function o(s){var c=s.canExecute.replacements;H(c,function(l){var u=l.oldElementId,p={type:l.newElementType};if(!s.visualReplacements[u]){var f=t.get(u);W(p,{x:f.x,y:f.y});var d=n.createShape(p);i.addShape(d,f.parent);var g=St('[data-element-id="'+As(f.id)+'"]',s.dragGroup);g&&Ee(g,{display:"none"});var h=r.addDragger(d,s.dragGroup);s.visualReplacements[u]=h,i.removeShape(d)}})}function a(s){var c=s.visualReplacements;H(c,function(l,u){var p=St('[data-element-id="'+As(u)+'"]',s.dragGroup);p&&Ee(p,{display:"inline"}),l.remove(),c[u]&&delete c[u]})}e.on("shape.move.move",AB,function(s){var c=s.context,l=c.canExecute;c.visualReplacements||(c.visualReplacements={}),l&&l.replacements?o(c):a(c)})}kh.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],we(kh,ce);const MB={__depends__:[ha],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",kh]};var PB=1250,Oh=40,TB=20,kB=10,F0=20,j0=["x","y"],OB=Math.abs;function H0(e){e.on(["connect.hover","connect.move","connect.end"],PB,function(t){var n=t.context,i=n.canExecute,r=n.start,o=n.hover,a=n.source,s=n.target;t.originalEvent&&Xn(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&o&&DB(t,o,NB(o)),o&&BB(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=_i(r),et(o,["bpmn:Event","bpmn:Gateway"])&&z0(t,_i(o)),et(o,["bpmn:Task","bpmn:SubProcess"])&&LB(t,o),C(a,"bpmn:BoundaryEvent")&&s===a.host&&IB(t)):G0(i,"bpmn:MessageFlow")?(C(r,"bpmn:Event")&&(n.connectionStart=_i(r)),C(o,"bpmn:Event")&&z0(t,_i(o))):n.connectionStart=n.initialConnectionStart)})}H0.$inject=["eventBus"];function DB(e,t,n){j0.forEach(function(i){var r=V0(i,t);e[i]<t[i]+n?rn(e,i,t[i]+n):e[i]>t[i]+r-n&&rn(e,i,t[i]+r-n)})}function LB(e,t){var n=_i(t);j0.forEach(function(i){$B(e,t,i)&&rn(e,i,n[i])})}function IB(e){var t=e.context,n=t.source,i=t.target;if(!FB(t)){var r=_i(n),o=Rn(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],l;OB(c-r[s])<Oh&&(c>r[s]?l=r[s]+Oh:l=r[s]-Oh,rn(e,s,l))})}}function z0(e,t){rn(e,"x",t.x),rn(e,"y",t.y)}function G0(e,t){return e&&e.type===t}function BB(e,t){return vr(t,function(n){return G0(e,n)})}function V0(e,t){return e==="x"?t.width:t.height}function NB(e){return C(e,"bpmn:Task")?kB:TB}function $B(e,t,n){return e[n]>t[n]+F0&&e[n]<t[n]+V0(n,t)-F0}function FB(e){var t=e.hover,n=e.source;return t&&n&&t===n}function Kr(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}Kr.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},Kr.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},Kr.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},Kr.prototype.getSnapLocations=function(){return this._snapLocations},Kr.prototype.setSnapLocations=function(e){this._snapLocations=e},Kr.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new Du,n.initDefaults(this._defaultSnaps)),n};function Du(){this._snapValues={}}Du.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)},Du.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&AL(e[n],r[n],i)},Du.prototype.initDefaults=function(e){var t=this;H(e||{},function(n,i){H(n,function(r){t.add(i,r)})})};var jB=1250;function Ki(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"],jB,function(r){var o=r.context,a=o.shape,s=o.snapContext,c=o.target;if(!(r.originalEvent&&Xn(r.originalEvent))&&!(Ra(r)||!c)){var l=s.pointsForTarget(c);l.initialized||(l=i.addSnapTargetPoints(l,a,c),l.initialized=!0),n.snap(r,l)}}),t.on(["create.cleanup","shape.move.cleanup"],function(){n.hide()})}Ki.$inject=["elementRegistry","eventBus","snapping"],Ki.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,r=n.snapContext;r||(r=n.snapContext=new Kr);var o;t.get(i.id)?o=_i(i,e):o={x:e.x+_i(i).x,y:e.y+_i(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}),Je(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},Ki.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return H(i,function(r){if(Je(r)){Je(t)&&e.add("mid",_i(r));return}if(Ct(r)){if(r.waypoints.length<3)return;var o=r.waypoints.slice(1,-1);H(o,function(a){e.add("mid",a)});return}e.add("mid",_i(r))}),!ze(t.x)||!ze(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",_i(t)),e},Ki.prototype.getSnapTargets=function(e,t){return Tw(t).filter(function(n){return!HB(n)})};function HB(e){return!!e.hidden}var W0=1500;function Ma(e,t){t.invoke(Ki,this),e.on(["create.move","create.end"],W0,WB),e.on(["create.move","create.end","shape.move.move","shape.move.end"],W0,function(n){var i=n.context,r=i.canExecute,o=i.target,a=r&&(r==="attach"||r.attach);a&&!Ra(n)&&zB(n,o)})}we(Ma,Ki),Ma.$inject=["eventBus","injector"],Ma.prototype.initSnap=function(e){var t=Ki.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return H(n.outgoing,function(r){var o=r.waypoints[0];o=o.original||o,t.setSnapOrigin(r.id+"-docking",q0(o,i,e))}),H(n.incoming,function(r){var o=r.waypoints[r.waypoints.length-1];o=o.original||o,t.setSnapOrigin(r.id+"-docking",q0(o,i,e))}),C(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},Ma.prototype.addSnapTargetPoints=function(e,t,n){Ki.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);H(i,function(o){(VB(o)||GB([t,o],"bpmn:TextAnnotation"))&&(e.add("top-left",Mw(o)),e.add("bottom-right",Pw(o)))});var r=this._elementRegistry;return H(t.incoming,function(o){if(r.get(t.id)){U0(i,o.source)||e.add("mid",Fe(o.source));var a=o.waypoints[0];e.add(o.id+"-docking",a.original||a)}}),H(t.outgoing,function(o){if(r.get(t.id)){U0(i,o.target)||e.add("mid",Fe(o.target));var a=o.waypoints[o.waypoints.length-1];e.add(o.id+"-docking",a.original||a)}}),C(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},Ma.prototype.getSnapTargets=function(e,t){return Ki.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!C(n,"bpmn:Lane")})};function zB(e,t){var n=Ie(t),i=Qv(e,t),r=e.context,o=r.shape,a;o.parent?a={x:0,y:0}:a=Fe(o),/top/.test(i)?rn(e,"y",n.top-a.y):/bottom/.test(i)&&rn(e,"y",n.bottom-a.y),/left/.test(i)?rn(e,"x",n.left-a.x):/right/.test(i)&&rn(e,"x",n.right-a.x)}function GB(e,t){return e.every(function(n){return C(n,t)})}function VB(e){return C(e,"bpmn:SubProcess")&&at(e)?!0:C(e,"bpmn:Participant")}function WB(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)&&rn(e,"x",e.x),(i&&i>=e.y||o&&o<=e.y)&&rn(e,"y",e.y)}}function U0(e,t){return e.indexOf(t)!==-1}function q0(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var UB=1250;function Gs(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],UB,function(i){var r=i.context,o=r.shape,a=o.parent,s=r.direction,c=r.snapContext;if(!(i.originalEvent&&Xn(i.originalEvent))&&!Ra(i)){var l=c.pointsForTarget(a);l.initialized||(l=n.addSnapTargetPoints(l,o,a,s),l.initialized=!0),KB(s)&&rn(i,"x",i.x),XB(s)&&rn(i,"y",i.y),t.snap(i,l)}}),e.on(["resize.cleanup"],function(){t.hide()})}Gs.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new Kr);var o=Y0(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},Gs.prototype.addSnapTargetPoints=function(e,t,n,i){var r=this.getSnapTargets(t,n);return H(r,function(o){e.add("corner",Pw(o)),e.add("corner",Mw(o))}),e.add("corner",Y0(t,i)),e},Gs.$inject=["eventBus","snapping"],Gs.prototype.getSnapTargets=function(e,t){return Tw(t).filter(function(n){return!qB(n,e)&&!Ct(n)&&!YB(n)&&!Je(n)})};function Y0(e,t){var n=Fe(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 qB(e,t){return e.host===t}function YB(e){return!!e.hidden}function KB(e){return e==="n"||e==="s"}function XB(e){return e==="e"||e==="w"}var ZB=7,QB=1e3;function Xr(e){this._canvas=e,this._asyncHide=Zu(jn(this.hide,this),QB)}Xr.$inject=["canvas"],Xr.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,r=i.getSnapLocations(),o={x:Ra(e,"x"),y:Ra(e,"y")};H(r,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(H(["x","y"],function(l){var u;o[l]||(u=t.snap(c,a,l,ZB),u!==void 0&&(o[l]={value:u,originValue:u-s[l]}))}),o.x&&o.y)return!1}),this.showSnapLine("vertical",o.x&&o.x.value),this.showSnapLine("horizontal",o.y&&o.y.value),H(["x","y"],function(a){var s=o[a];dn(s)&&rn(e,a,s.originValue)})},Xr.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=Oe("path");return Ee(n,{d:"M0,0 L0,0"}),ct(n).add("djs-snap-line"),Ue(t,n),{update:function(i){ze(i)?e==="horizontal"?Ee(n,{d:"M-100000,"+i+" L+100000,"+i,display:""}):Ee(n,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):Ee(n,{display:"none"})}}},Xr.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},Xr.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},Xr.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},Xr.prototype.hide=function(){H(this._snapLines,function(e){e.update()})};const JB={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",Ki],resizeSnapping:["type",Gs],snapping:["type",Xr]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",H0],createMoveSnapping:["type",Ma]};var K0=300;function qe(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=St(qe.INPUT_SELECTOR,this._container),this._resultsContainer=St(qe.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}qe.$inject=["canvas","eventBus","selection","translate"],qe.prototype._bindEvents=function(){var e=this;function t(n,i,r,o){e._eventMaps.push({el:n,type:r,listener:qn.bind(n,i,r,o)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,qe.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,qe.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,qe.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,qe.INPUT_SELECTOR,"keydown",function(n){ln("ArrowUp",n)&&n.preventDefault(),ln("ArrowDown",n)&&n.preventDefault()}),t(this._container,qe.INPUT_SELECTOR,"keyup",function(n){if(ln("Escape",n))return e.close();if(ln("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(ln("ArrowUp",n))return e._scrollToDirection(!0);if(ln("ArrowDown",n))return e._scrollToDirection();ln(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},qe.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){qn.unbind(e.el,e.type,e.listener)})},qe.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=St(qe.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},qe.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},qe.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)}},qe.prototype._clearResults=function(){Pc(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},qe.prototype._getCurrentResult=function(){return St(qe.RESULT_SELECTED_SELECTOR,this._resultsContainer)},qe.prototype._createResultNode=function(e,t){var n=Ot(qe.RESULT_HTML);return e.primaryTokens.length>0&&X0(n,e.primaryTokens,qe.RESULT_PRIMARY_HTML),X0(n,e.secondaryTokens,qe.RESULT_SECONDARY_HTML),On(n,qe.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},qe.prototype.registerProvider=function(e){this._searchProvider=e},qe.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,Bt(this._canvas.getContainer()).add("djs-search-open"),Bt(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},qe.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,Bt(this._canvas.getContainer()).remove("djs-search-open"),Bt(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},qe.prototype.toggle=function(){this.isOpen()?this.close():this.open()},qe.prototype.isOpen=function(){return this._open},qe.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&Bt(t).remove(qe.RESULT_SELECTED_CLASS);var n=On(e,qe.RESULT_ID_ATTRIBUTE),i=this._results[n].element;Bt(e).add(qe.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:K0}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},qe.prototype._select=function(e){var t=On(e,qe.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:K0}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},qe.prototype._getBoxHtml=function(){const e=Ot(qe.BOX_HTML),t=St(qe.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function X0(e,t,n){var i=eN(t),r=Ot(n);r.innerHTML=i,e.appendChild(r)}function eN(e){var t="";return e.forEach(function(n){var i=r_(n.value||n.matched||n.normal),r=n.match||n.matched;r?t+='<b class="'+qe.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}qe.CONTAINER_SELECTOR=".djs-search-container",qe.INPUT_SELECTOR=".djs-search-input input",qe.RESULTS_CONTAINER_SELECTOR=".djs-search-results",qe.RESULT_SELECTOR=".djs-search-result",qe.RESULT_SELECTED_CLASS="djs-search-result-selected",qe.RESULT_SELECTED_SELECTOR="."+qe.RESULT_SELECTED_CLASS,qe.RESULT_ID_ATTRIBUTE="data-result-id",qe.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",qe.BOX_HTML=`<div class="djs-search-container djs-scrollable">
336
336
  <div class="djs-search-input">
337
337
  <svg class="djs-search-icon" width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
338
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"/>
@@ -340,4 +340,4 @@
340
340
  <input type="text" spellcheck="false" />
341
341
  </div>
342
342
  <div class="djs-search-results" />
343
- </div>`,Ye.RESULT_HTML='<div class="djs-search-result"></div>',Ye.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',Ye.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const BB={__depends__:[Za,Vl,gi],searchPad:["type",Ye]};function wh(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}wh.$inject=["elementRegistry","searchPad","canvas","search"],wh.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!Je(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:li(i),id:i.id})),e,{keys:["label","id"]}).map(NB)};function NB(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const $B={__depends__:[BB,X_],__init__:["bpmnSearch"],bpmnSearch:["type",wh]},FB="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",jB="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",HB={width:36,height:50},zB={width:50,height:50};function F0(e,t,n){return De("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const wi=5;function Pu(e,t){this._styles=t,e.registerProvider(this)}Pu.$inject=["outline","styles"],Pu.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(nM(e))return n=De("rect"),Se(n,W({x:-wi,y:-wi,rx:4,width:e.width+wi*2,height:e.height+wi*2},t)),n;if(!Je(e))return C(e,"bpmn:Gateway")?(n=De("rect"),W(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),Se(n,W({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):et(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=De("rect"),Se(n,W({x:-wi,y:-wi,rx:14,width:e.width+wi*2,height:e.height+wi*2},t))):C(e,"bpmn:EndEvent")?(n=De("circle"),Se(n,W({cx:e.width/2,cy:e.height/2,r:e.width/2+wi+1},t))):C(e,"bpmn:Event")?(n=De("circle"),Se(n,W({cx:e.width/2,cy:e.height/2,r:e.width/2+wi},t))):C(e,"bpmn:DataObjectReference")&&j0(e,"bpmn:DataObjectReference")?n=F0(FB,{x:-6,y:-6},t):C(e,"bpmn:DataStoreReference")&&j0(e,"bpmn:DataStoreReference")&&(n=F0(jB,{x:-6,y:-6},t)),n},Pu.prototype.updateOutline=function(e,t){if(!Je(e))return et(e,["bpmn:SubProcess","bpmn:Group"])?(Se(t,{width:e.width+wi*2,height:e.height+wi*2}),!0):!!et(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function j0(e,t){var n;return t==="bpmn:DataObjectReference"?n=HB:t==="bpmn:DataStoreReference"&&(n=zB),e.width===n.width&&e.height===n.height}const GB={__depends__:[fh],__init__:["outlineProvider"],outlineProvider:["type",Pu]};var VB='<?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 Ki(e){Yo.call(this,e)}Ee(Ki,Yo),Ki.Viewer=Hr,Ki.NavigatedViewer=Ss,Ki.prototype.createDiagram=function(){return this.importXML(VB)},Ki.prototype._interactionModules=[Jx,t_,r_],Ki.prototype._modelingModules=[UD,jl,ZD,KD,uL,sh,gL,HL,Db,vl,WL,YL,uI,fI,dI,vI,TI,II,Pd,zI,XI,sB,lB,e0,LB,$B,GB],Ki.prototype._modules=[].concat(Hr.prototype._modules,Ki.prototype._interactionModules,Ki.prototype._modelingModules);const WB=de.defineComponent({__name:"BpmnModelerView",props:{xml:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,r=n,o=de.ref();let a;async function s(l){if(!a)throw new Error("modeler not mounted");try{const{warnings:u}=await a.importXML(l),p=sp(u);return r("imported",p),{warnings:p}}catch(u){throw r("import-error",u),u}}async function c(){if(!a)throw new Error("modeler not mounted");const{xml:l}=await a.saveXML({format:!0});return l??""}return de.onMounted(async()=>{a=new Ki({container:o.value,moddleExtensions:rc,additionalModules:[Gx]}),i.xml&&await s(i.xml),r("ready")}),de.watch(()=>i.xml,l=>{l&&a&&s(l)}),de.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(l,u)=>(de.openBlock(),de.createElementBlock("div",{ref_key:"container",ref:o,class:"bpmn-modeler-view"},null,512))}}),Eh=(e,t)=>{const n=e.__vccOpts||e;for(const[i,r]of t)n[i]=r;return n},UB=Eh(WB,[["__scopeId","data-v-07ee17c9"]]),qB=["title","aria-expanded"],YB=["title","onClick"],KB={viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},XB={key:0,d:"M5.6 5.6l4.8 4.8M10.4 5.6l-4.8 4.8",stroke:"currentColor","stroke-width":"1.5"},ZB={key:1,d:"M8 4.6v0.2M8 7v4.4",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round"},QB={key:0,class:"bwl-validation__body"},JB={key:0,class:"bwl-validation__empty"},eN={key:1,class:"bwl-validation__empty"},tN={key:2,class:"bwl-validation__list"},nN=["onClick"],iN={key:0,class:"bwl-validation__scope",title:"이번 변경이 만들거나 건드린 요소"},rN={class:"bwl-validation__msg"},oN=["title"],aN=Eh(de.defineComponent({__name:"BpmnValidationPanel",props:{controller:{}},setup(e){const n=e.controller,i=de.computed(()=>Nx(n.issues.value,n.describeElement)),r=de.computed(()=>$x(i.value)),o=h=>fa(h,n.changeScope.value),a=de.computed(()=>Id(i.value,n.changeScope.value)),s=de.ref({error:!0,warning:!0,info:!0}),c=de.computed(()=>Fx(i.value.filter(h=>s.value[h.severity]),n.changeScope.value)),l=de.ref(!1),u=["error","warning","info"],p={error:"오류",warning:"경고",info:"정보"};function f(h){if(!l.value){l.value=!0;return}s.value[h]=!s.value[h]}function d(h){const m=h.targetRefs[0];m&&n.requestFocus(m)}return(h,m)=>(de.openBlock(),de.createElementBlock("section",{class:de.normalizeClass(["bwl-validation",{"is-open":l.value}])},[de.createElementVNode("header",{class:"bwl-validation__head",onClick:m[1]||(m[1]=v=>l.value=!l.value)},[de.createElementVNode("button",{type:"button",class:"bwl-validation__toggle",title:l.value?"접기":"펼치기","aria-expanded":l.value},[(de.openBlock(),de.createElementBlock("svg",{class:de.normalizeClass(["bwl-validation__chevron",{"is-open":l.value}]),viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},[...m[2]||(m[2]=[de.createElementVNode("path",{d:"M6 3l5 5-5 5",fill:"none",stroke:"currentColor","stroke-width":"1.6"},null,-1)])],2)),m[3]||(m[3]=de.createElementVNode("span",null,"검증",-1))],8,qB),de.createElementVNode("div",{class:"bwl-validation__counts",onClick:m[0]||(m[0]=de.withModifiers(()=>{},["stop"]))},[(de.openBlock(),de.createElementBlock(de.Fragment,null,de.renderList(u,v=>de.createElementVNode("button",{key:v,type:"button",class:de.normalizeClass(["bwl-validation__count",[`is-${v}`,{"is-off":!s.value[v]}]]),title:l.value?`${p[v]} ${s.value[v]?"숨기기":"보이기"}`:"검증 패널 펼치기",onClick:w=>f(v)},[(de.openBlock(),de.createElementBlock("svg",KB,[m[4]||(m[4]=de.createElementVNode("circle",{cx:"8",cy:"8",r:"6.4",fill:"none",stroke:"currentColor","stroke-width":"1.5"},null,-1)),v==="error"?(de.openBlock(),de.createElementBlock("path",XB)):(de.openBlock(),de.createElementBlock("path",ZB))])),de.createElementVNode("span",null,de.toDisplayString(r.value[v]),1)],10,YB)),64))])]),l.value?(de.openBlock(),de.createElementBlock("div",QB,[i.value.length===0?(de.openBlock(),de.createElementBlock("p",JB,"발견된 문제가 없습니다.")):c.value.length===0?(de.openBlock(),de.createElementBlock("p",eN," 선택한 심각도에 해당하는 항목이 없습니다. ")):(de.openBlock(),de.createElementBlock("ul",tN,[(de.openBlock(!0),de.createElementBlock(de.Fragment,null,de.renderList(c.value,v=>(de.openBlock(),de.createElementBlock("li",{key:v.key,class:de.normalizeClass(["bwl-validation__item",[`is-${v.severity}`,{"is-clickable":v.targetRefs.length>0}]]),onClick:w=>d(v)},[m[5]||(m[5]=de.createElementVNode("span",{class:"bwl-validation__dot","aria-hidden":"true"},null,-1)),a.value&&o(v)?(de.openBlock(),de.createElementBlock("span",iN,"이번 변경")):de.createCommentVNode("",!0),de.createElementVNode("span",rN,de.toDisplayString(v.message),1),de.createElementVNode("span",{class:"bwl-validation__cat",title:v.code},de.toDisplayString(v.category),9,oN)],10,nN))),128))]))])):de.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-60e8b1a9"]]),sN={key:0,class:"bwl-locale",role:"radiogroup","aria-label":"표시 언어"},cN=["aria-checked","title","data-locale","onClick"],lN={class:"bwl-locale__label"},uN={key:0,class:"bwl-locale__badge"},pN=Eh(de.defineComponent({__name:"BpmnDisplayLocaleSwitcher",props:{controller:{}},setup(e){const n=e.controller;function i(o){try{return new Intl.DisplayNames([o],{type:"language"}).of(o)??o}catch{return o}}const r=de.computed(()=>{const o=n.i18n.value;return o?o.locales.map(a=>{const s=o.counts[a]??{untranslated:0,reviewRequested:0},c=a===o.designLocale?"설계 언어":"병기 언어";return{locale:a,label:i(a),active:a===o.displayLocale,design:a===o.designLocale,pending:s.untranslated+s.reviewRequested,title:`${c} — 미번역 ${s.untranslated} · 확인 요청 ${s.reviewRequested}`}}):[]});return(o,a)=>r.value.length?(de.openBlock(),de.createElementBlock("div",sN,[(de.openBlock(!0),de.createElementBlock(de.Fragment,null,de.renderList(r.value,s=>(de.openBlock(),de.createElementBlock("button",{key:s.locale,type:"button",role:"radio",class:de.normalizeClass(["bwl-locale__item",{"is-active":s.active,"is-design":s.design}]),"aria-checked":s.active,title:s.title,"data-locale":s.locale,onClick:c=>de.unref(n).setDisplayLocale(s.locale)},[de.createElementVNode("span",lN,de.toDisplayString(s.label),1),s.pending>0?(de.openBlock(),de.createElementBlock("span",uN,de.toDisplayString(s.pending),1)):de.createCommentVNode("",!0)],10,cN))),128))])):de.createCommentVNode("",!0)}}),[["__scopeId","data-v-04311925"]]);X.ADDABLE_FLOW_NODE_TYPES=Us,X.APPLY_BPMN_OPS_SCHEMA=o1,X.BPMN_EVENT_DEFINITION_TYPES=Ys,X.BPMN_MODDLE_EXTENSIONS=rc,X.BWL_MODDLE_SCHEMA=Nh,X.BWL_NS=Bh,X.BWL_PREFIX=Hu,X.BWL_REVIEW_REQUEST_TYPE=Gu,X.BWL_SIDES=zu,X.BpmnDisplayLocaleSwitcher=pN,X.BpmnModelerView=UB,X.BpmnValidationPanel=aN,X.EDITOR=XR,X.FLOW_LABEL_INDENT=ym,X.GROUP_BORDER_MIN_RUN=cp,X.GROUP_BORDER_NEAR=$o,X.HEADLESS_BPMN_MODULES=Dx,X.HEADLESS_TEXT_METRICS=Bo,X.I18N_NS=GE,X.I18N_PREFIX=zh,X.I18N_REVIEW_REQUESTED_CLASS=Hx,X.I18N_TRANSLATION_TYPE=Pa,X.I18N_UNTRANSLATED_CLASS=jx,X.I18nDisplay=Bd,X.I18nDisplayModule=Gx,X.IR_EVENT_DEFINITIONS=qs,X.IR_FLOW_NODE_TYPES=Zr,X.LABEL_FORK_MARGIN=pp,X.LABEL_SHAPE_MIN_DEPTH=Pm,X.SEVERITY_ORDER=Ld,X.SYMBOLIC_OP_KINDS=Gh,X.SYMBOLIC_OP_SCHEMA=Vh,X.UNDO_EPISODE_COMMAND=Vu,X.UPDATE_TRANSLATION_COMMAND=Qs,X.UpdateTranslationHandler=Yu,X.applyBpmnOpBatch=Sg,X.applyBpmnOps=gg,X.applyLocaleBackfill=nC,X.approximateTextWidth=No,X.auditBpmnGeometry=Om,X.auditBpmnGeometryXml=tR,X.auditBpmnSemantics=Cp,X.auditBpmnSemanticsXml=HR,X.auditGeometry=mt,X.auditTargetsOf=ai,X.axisSegmentsOf=mn,X.blackBoxNameRect=lp,X.buildBpmnOpBatch=KR,X.buildRegistryIndex=Lm,X.containerBoundarySegments=Ho,X.countBySeverity=$x,X.createBpmnEditorController=ZR,X.createBpmnModdle=lm,X.createHeadlessBpmnModeler=wO,X.crossedShapesOf=_n,X.crossingCost=oi,X.describeProcess=xg,X.describeProcessXml=IR,X.diffBpmnElements=Eg,X.diffBpmnElementsXml=qR,X.edgeCrossCount=Ba,X.edgeCrossingPairsOf=pc,X.edgeCrossingStatsOf=Sm,X.executeAsUndoEpisode=Fh,X.followMovedEdgeLabels=tg,X.forwardThreePointCandidates=dc,X.geometryFindingKey=ft,X.inferScriptLocale=Mp,X.installHeadlessBpmnDom=pm,X.irEventDefinitionOf=ju,X.isAddableFlowNodeType=Lh,X.isChangeScopeMixed=Id,X.isEdgeOverlapFinding=up,X.isInChangeScope=fa,X.isIrEventDefinition=Ih,X.isIrFlowNodeType=Dh,X.labelRectsOf=io,X.labelShapeDepth=Tm,X.labelSlot=Ta,X.lineCrossesLabel=Ii,X.lineThroughLabel=bm,X.lineThroughShapeLabel=Mm,X.loadBpmnXml=Io,X.lowerOps=hg,X.oppositeOverlapCount=HS,X.oppositeOverlapOf=gm,X.planBackEdgeBoundaryClearance=Gm,X.planCrossPoolRoute=jm,X.planEdgeRepair=mp,X.planLabelLineClearance=xp,X.planLabelPlacement=Qm,X.planLocaleBackfill=tC,X.planMiddleSegmentShifts=Bm,X.planOppositeOverlapRepair=Wm,X.planSegmentDetours=fc,X.planShapeLabelClearance=rg,X.redockIntroducedDetachedEndpoints=ag,X.repairIntroducedBoundaryHugging=Vm,X.repairIntroducedCrossings=gp,X.repairIntroducedEdgeCrossings=$m,X.repairIntroducedFakeMerges=qm,X.repairIntroducedLabelLines=ng,X.repairIntroducedOppositeOverlaps=Zm,X.repairIntroducedShapeLabelLines=og,X.repairIntroducedSharedSegmentLabels=ig,X.rerouteIntroducedCrossPoolEdges=Hm,X.resolverServicesOf=ug,X.reviewRequestsOf=ka,X.saveBpmnXml=PS,X.sceneCrossingCost=Em,X.sceneFromDefinitions=km,X.sceneFromRegistry=Xe,X.segmentShapeClearance=uc,X.shapesUnderLabel=Na,X.sharedSegmentUnderLabel=lc,X.sharedSpansOf=cc,X.sortPanelIssues=Fx,X.toPanelIssues=Nx,X.touchedElements=YR,X.translationLocale=ni,X.translationsOf=Zs,X.unreadableOverlapCount=ri,X.unreadableOverlapOf=Fo,X.validateOps=lg,X.warningMessages=sp,Object.defineProperty(X,Symbol.toStringTag,{value:"Module"})}));
343
+ </div>`,qe.RESULT_HTML='<div class="djs-search-result"></div>',qe.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',qe.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const tN={__depends__:[ts,Kl,vi],searchPad:["type",qe]};function Dh(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}Dh.$inject=["elementRegistry","searchPad","canvas","search"],Dh.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!Je(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:li(i),id:i.id})),e,{keys:["label","id"]}).map(nN)};function nN(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const iN={__depends__:[tN,cw],__init__:["bpmnSearch"],bpmnSearch:["type",Dh]},rN="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",oN="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",aN={width:36,height:50},sN={width:50,height:50};function Z0(e,t,n){return Oe("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const Si=5;function Lu(e,t){this._styles=t,e.registerProvider(this)}Lu.$inject=["outline","styles"],Lu.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(_M(e))return n=Oe("rect"),Ee(n,W({x:-Si,y:-Si,rx:4,width:e.width+Si*2,height:e.height+Si*2},t)),n;if(!Je(e))return C(e,"bpmn:Gateway")?(n=Oe("rect"),W(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),Ee(n,W({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):et(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=Oe("rect"),Ee(n,W({x:-Si,y:-Si,rx:14,width:e.width+Si*2,height:e.height+Si*2},t))):C(e,"bpmn:EndEvent")?(n=Oe("circle"),Ee(n,W({cx:e.width/2,cy:e.height/2,r:e.width/2+Si+1},t))):C(e,"bpmn:Event")?(n=Oe("circle"),Ee(n,W({cx:e.width/2,cy:e.height/2,r:e.width/2+Si},t))):C(e,"bpmn:DataObjectReference")&&Q0(e,"bpmn:DataObjectReference")?n=Z0(rN,{x:-6,y:-6},t):C(e,"bpmn:DataStoreReference")&&Q0(e,"bpmn:DataStoreReference")&&(n=Z0(oN,{x:-6,y:-6},t)),n},Lu.prototype.updateOutline=function(e,t){if(!Je(e))return et(e,["bpmn:SubProcess","bpmn:Group"])?(Ee(t,{width:e.width+Si*2,height:e.height+Si*2}),!0):!!et(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function Q0(e,t){var n;return t==="bpmn:DataObjectReference"?n=aN:t==="bpmn:DataStoreReference"&&(n=sN),e.width===n.width&&e.height===n.height}const cN={__depends__:[Eh],__init__:["outlineProvider"],outlineProvider:["type",Lu]};var lN='<?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){Jo.call(this,e)}we(Xi,Jo),Xi.Viewer=Gr,Xi.NavigatedViewer=Ms,Xi.prototype.createDiagram=function(){return this.importXML(lN)},Xi.prototype._interactionModules=[p_,d_,g_],Xi.prototype._modelingModules=[pL,Wl,gL,hL,PL,vh,IL,aI,Wb,El,uI,dI,PI,kI,OI,NI,KI,eB,jd,sB,mB,CB,MB,f0,JB,iN,cN],Xi.prototype._modules=[].concat(Gr.prototype._modules,Xi.prototype._interactionModules,Xi.prototype._modelingModules);const uN=de.defineComponent({__name:"BpmnModelerView",props:{xml:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,r=n,o=de.ref();let a;async function s(l){if(!a)throw new Error("modeler not mounted");try{const{warnings:u}=await a.importXML(l),p=vp(u);return r("imported",p),{warnings:p}}catch(u){throw r("import-error",u),u}}async function c(){if(!a)throw new Error("modeler not mounted");const{xml:l}=await a.saveXML({format:!0});return l??""}return de.onMounted(async()=>{a=new Xi({container:o.value,moddleExtensions:lc,additionalModules:[t_]}),i.xml&&await s(i.xml),r("ready")}),de.watch(()=>i.xml,l=>{l&&a&&s(l)}),de.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(l,u)=>(de.openBlock(),de.createElementBlock("div",{ref_key:"container",ref:o,class:"bpmn-modeler-view"},null,512))}}),Lh=(e,t)=>{const n=e.__vccOpts||e;for(const[i,r]of t)n[i]=r;return n},pN=Lh(uN,[["__scopeId","data-v-07ee17c9"]]),fN=["title","aria-expanded"],dN=["title","onClick"],hN={viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},mN={key:0,d:"M5.6 5.6l4.8 4.8M10.4 5.6l-4.8 4.8",stroke:"currentColor","stroke-width":"1.5"},gN={key:1,d:"M8 4.6v0.2M8 7v4.4",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round"},yN={key:0,class:"bwl-validation__body"},vN={key:0,class:"bwl-validation__empty"},bN={key:1,class:"bwl-validation__empty"},xN={key:2,class:"bwl-validation__list"},_N=["onClick"],wN={key:0,class:"bwl-validation__scope",title:"이번 변경이 만들거나 건드린 요소"},EN={class:"bwl-validation__msg"},SN=["title"],RN=Lh(de.defineComponent({__name:"BpmnValidationPanel",props:{controller:{}},setup(e){const n=e.controller,i=de.computed(()=>Kx(n.issues.value,n.describeElement)),r=de.computed(()=>Xx(i.value)),o=g=>ya(g,n.changeScope.value),a=de.computed(()=>Ud(i.value,n.changeScope.value)),s=de.ref({error:!0,warning:!0,info:!0}),c=de.computed(()=>Zx(i.value.filter(g=>s.value[g.severity]),n.changeScope.value)),l=de.ref(!1),u=["error","warning","info"],p={error:"오류",warning:"경고",info:"정보"};function f(g){if(!l.value){l.value=!0;return}s.value[g]=!s.value[g]}function d(g){const h=g.targetRefs[0];h&&n.requestFocus(h)}return(g,h)=>(de.openBlock(),de.createElementBlock("section",{class:de.normalizeClass(["bwl-validation",{"is-open":l.value}])},[de.createElementVNode("header",{class:"bwl-validation__head",onClick:h[1]||(h[1]=y=>l.value=!l.value)},[de.createElementVNode("button",{type:"button",class:"bwl-validation__toggle",title:l.value?"접기":"펼치기","aria-expanded":l.value},[(de.openBlock(),de.createElementBlock("svg",{class:de.normalizeClass(["bwl-validation__chevron",{"is-open":l.value}]),viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},[...h[2]||(h[2]=[de.createElementVNode("path",{d:"M6 3l5 5-5 5",fill:"none",stroke:"currentColor","stroke-width":"1.6"},null,-1)])],2)),h[3]||(h[3]=de.createElementVNode("span",null,"검증",-1))],8,fN),de.createElementVNode("div",{class:"bwl-validation__counts",onClick:h[0]||(h[0]=de.withModifiers(()=>{},["stop"]))},[(de.openBlock(),de.createElementBlock(de.Fragment,null,de.renderList(u,y=>de.createElementVNode("button",{key:y,type:"button",class:de.normalizeClass(["bwl-validation__count",[`is-${y}`,{"is-off":!s.value[y]}]]),title:l.value?`${p[y]} ${s.value[y]?"숨기기":"보이기"}`:"검증 패널 펼치기",onClick:R=>f(y)},[(de.openBlock(),de.createElementBlock("svg",hN,[h[4]||(h[4]=de.createElementVNode("circle",{cx:"8",cy:"8",r:"6.4",fill:"none",stroke:"currentColor","stroke-width":"1.5"},null,-1)),y==="error"?(de.openBlock(),de.createElementBlock("path",mN)):(de.openBlock(),de.createElementBlock("path",gN))])),de.createElementVNode("span",null,de.toDisplayString(r.value[y]),1)],10,dN)),64))])]),l.value?(de.openBlock(),de.createElementBlock("div",yN,[i.value.length===0?(de.openBlock(),de.createElementBlock("p",vN,"발견된 문제가 없습니다.")):c.value.length===0?(de.openBlock(),de.createElementBlock("p",bN," 선택한 심각도에 해당하는 항목이 없습니다. ")):(de.openBlock(),de.createElementBlock("ul",xN,[(de.openBlock(!0),de.createElementBlock(de.Fragment,null,de.renderList(c.value,y=>(de.openBlock(),de.createElementBlock("li",{key:y.key,class:de.normalizeClass(["bwl-validation__item",[`is-${y.severity}`,{"is-clickable":y.targetRefs.length>0}]]),onClick:R=>d(y)},[h[5]||(h[5]=de.createElementVNode("span",{class:"bwl-validation__dot","aria-hidden":"true"},null,-1)),a.value&&o(y)?(de.openBlock(),de.createElementBlock("span",wN,"이번 변경")):de.createCommentVNode("",!0),de.createElementVNode("span",EN,de.toDisplayString(y.message),1),de.createElementVNode("span",{class:"bwl-validation__cat",title:y.code},de.toDisplayString(y.category),9,SN)],10,_N))),128))]))])):de.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-60e8b1a9"]]),CN={key:0,class:"bwl-locale",role:"radiogroup","aria-label":"표시 언어"},AN=["aria-checked","title","data-locale","onClick"],MN={class:"bwl-locale__label"},PN={key:0,class:"bwl-locale__badge"},TN=Lh(de.defineComponent({__name:"BpmnDisplayLocaleSwitcher",props:{controller:{}},setup(e){const n=e.controller;function i(o){try{return new Intl.DisplayNames([o],{type:"language"}).of(o)??o}catch{return o}}const r=de.computed(()=>{const o=n.i18n.value;return o?o.locales.map(a=>{const s=o.counts[a]??{untranslated:0,reviewRequested:0},c=a===o.designLocale?"설계 언어":"병기 언어";return{locale:a,label:i(a),active:a===o.displayLocale,design:a===o.designLocale,pending:s.untranslated+s.reviewRequested,title:`${c} — 미번역 ${s.untranslated} · 확인 요청 ${s.reviewRequested}`}}):[]});return(o,a)=>r.value.length?(de.openBlock(),de.createElementBlock("div",CN,[(de.openBlock(!0),de.createElementBlock(de.Fragment,null,de.renderList(r.value,s=>(de.openBlock(),de.createElementBlock("button",{key:s.locale,type:"button",role:"radio",class:de.normalizeClass(["bwl-locale__item",{"is-active":s.active,"is-design":s.design}]),"aria-checked":s.active,title:s.title,"data-locale":s.locale,onClick:c=>de.unref(n).setDisplayLocale(s.locale)},[de.createElementVNode("span",MN,de.toDisplayString(s.label),1),s.pending>0?(de.openBlock(),de.createElementBlock("span",PN,de.toDisplayString(s.pending),1)):de.createCommentVNode("",!0)],10,AN))),128))])):de.createCommentVNode("",!0)}}),[["__scopeId","data-v-04311925"]]);Z.ADDABLE_FLOW_NODE_TYPES=Xs,Z.APPLY_BPMN_OPS_SCHEMA=x1,Z.BPMN_EVENT_DEFINITION_TYPES=Qs,Z.BPMN_MODDLE_EXTENSIONS=lc,Z.BWL_MODDLE_SCHEMA=Yh,Z.BWL_NS=qh,Z.BWL_PREFIX=Uu,Z.BWL_REVIEW_REQUEST_TYPE=ec,Z.BWL_SIDES=qu,Z.BpmnDisplayLocaleSwitcher=TN,Z.BpmnModelerView=pN,Z.BpmnValidationPanel=RN,Z.EDITOR=mC,Z.FLOW_LABEL_INDENT=Mm,Z.GROUP_BORDER_MIN_RUN=bp,Z.GROUP_BORDER_NEAR=Go,Z.HEADLESS_BPMN_MODULES=Wx,Z.HEADLESS_TEXT_METRICS=Ho,Z.I18N_NS=n1,Z.I18N_PREFIX=Jh,Z.I18N_REVIEW_REQUESTED_CLASS=Jx,Z.I18N_TRANSLATION_TYPE=Bo,Z.I18N_UNTRANSLATED_CLASS=Qx,Z.I18nDisplay=qd,Z.I18nDisplayModule=t_,Z.IR_EVENT_DEFINITIONS=Zs,Z.IR_FLOW_NODE_TYPES=Jr,Z.IR_TEXT_LOCALES=Js,Z.LABEL_FORK_MARGIN=wp,Z.LABEL_SHAPE_MIN_DEPTH=jm,Z.SET_TRANSLATIONS_COMMAND=tp,Z.SEVERITY_ORDER=Wd,Z.SYMBOLIC_OP_KINDS=em,Z.SYMBOLIC_OP_SCHEMA=tm,Z.SetTranslationsHandler=np,Z.TranslationCommands=rp,Z.TranslationCommandsModule=op,Z.UNDO_EPISODE_COMMAND=Yu,Z.UPDATE_TRANSLATION_COMMAND=ic,Z.UpdateTranslationHandler=ep,Z.applyBpmnOpBatch=Bg,Z.applyBpmnOps=Mg,Z.applyLocaleBackfill=_C,Z.approximateTextWidth=zo,Z.auditBpmnGeometry=Gm,Z.auditBpmnGeometryXml=gR,Z.auditBpmnSemantics=Np,Z.auditBpmnSemanticsXml=aC,Z.auditGeometry=mt,Z.auditTargetsOf=ai,Z.axisSegmentsOf=mn,Z.blackBoxNameRect=xp,Z.buildBpmnOpBatch=hC,Z.buildRegistryIndex=Wm,Z.containerBoundarySegments=Uo,Z.countBySeverity=Xx,Z.createBpmnEditorController=gC,Z.createBpmnModdle=xm,Z.createHeadlessBpmnModeler=HO,Z.crossedShapesOf=wn,Z.crossingCost=oi,Z.describeProcess=Og,Z.describeProcessXml=eC,Z.diffBpmnElements=Ig,Z.diffBpmnElementsXml=fC,Z.documentLocalesOf=La,Z.edgeCrossCount=Fa,Z.edgeCrossingPairsOf=gc,Z.edgeCrossingStatsOf=Im,Z.executeAsUndoEpisode=Xh,Z.followMovedEdgeLabels=fg,Z.forwardThreePointCandidates=vc,Z.geometryFindingKey=ft,Z.inferScriptLocale=Fp,Z.installHeadlessBpmnDom=wm,Z.irEventDefinitionOf=Wu,Z.isAddableFlowNodeType=Wh,Z.isChangeScopeMixed=Ud,Z.isEdgeOverlapFinding=_p,Z.isInChangeScope=ya,Z.isIrEventDefinition=Uh,Z.isIrFlowNodeType=Vh,Z.isIrTextLocale=UE,Z.labelRectsOf=ao,Z.labelShapeDepth=Hm,Z.labelSlot=no,Z.lineCrossesLabel=Bi,Z.lineThroughLabel=Tm,Z.lineThroughShapeLabel=Fm,Z.loadBpmnXml=jo,Z.localeTextsOf=Ju,Z.lowerOps=Cg,Z.oppositeOverlapCount=nR,Z.oppositeOverlapOf=Am,Z.planBackEdgeBoundaryClearance=eg,Z.planCrossPoolRoute=Zm,Z.planEdgeRepair=Cp,Z.planLabelLineClearance=kp,Z.planLabelPlacement=lg,Z.planLocaleBackfill=xC,Z.planMiddleSegmentShifts=qm,Z.planOppositeOverlapRepair=ng,Z.planSegmentDetours=yc,Z.planShapeLabelClearance=mg,Z.redockIntroducedDetachedEndpoints=yg,Z.repairIntroducedBoundaryHugging=tg,Z.repairIntroducedCrossings=Ap,Z.repairIntroducedEdgeCrossings=Km,Z.repairIntroducedFakeMerges=rg,Z.repairIntroducedLabelLines=dg,Z.repairIntroducedOppositeOverlaps=cg,Z.repairIntroducedShapeLabelLines=gg,Z.repairIntroducedSharedSegmentLabels=hg,Z.rerouteIntroducedCrossPoolEdges=Qm,Z.resolverServicesOf=wg,Z.reviewRequestValuesOf=ip,Z.reviewRequestsOf=br,Z.rootLangOf=Qu,Z.saveBpmnXml=VS,Z.sceneCrossingCost=Lm,Z.sceneFromDefinitions=zm,Z.sceneFromRegistry=Xe,Z.segmentShapeClearance=mc,Z.shapesUnderLabel=ja,Z.sharedSegmentUnderLabel=hc,Z.sharedSpansOf=dc,Z.sortPanelIssues=Zx,Z.toPanelIssues=Kx,Z.touchedElements=dC,Z.translationLocale=Tn,Z.translationsOf=No,Z.unreadableOverlapCount=ri,Z.unreadableOverlapOf=Vo,Z.validateOps=_g,Z.warningMessages=vp,Object.defineProperty(Z,Symbol.toStringTag,{value:"Module"})}));