@g1cloud/bpmn-modeler-next 5.0.0-beta.1 → 5.0.0-beta.100

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.
Files changed (41) hide show
  1. package/dist/adapter/annotationImportDocking.d.ts +28 -0
  2. package/dist/adapter/i18n.d.ts +50 -6
  3. package/dist/adapter/i18nBackfill.d.ts +72 -0
  4. package/dist/adapter/translationLocaleCopy.d.ts +11 -0
  5. package/dist/adapter/translationLocaleRestore.d.ts +86 -0
  6. package/dist/agent/agentBatch.d.ts +17 -1
  7. package/dist/agent/agentReplay.d.ts +36 -0
  8. package/dist/agent/describeProcess.d.ts +35 -2
  9. package/dist/agent/generatedIds.d.ts +18 -0
  10. package/dist/agent/geometryAudit.d.ts +95 -1
  11. package/dist/agent/resolver/annotationSize.d.ts +12 -0
  12. package/dist/agent/resolver/documentIndex.d.ts +12 -0
  13. package/dist/agent/resolver/index.d.ts +28 -2
  14. package/dist/agent/resolver/issues.d.ts +53 -0
  15. package/dist/agent/resolver/localeTexts.d.ts +24 -0
  16. package/dist/agent/resolver/lower.d.ts +103 -11
  17. package/dist/agent/resolver/routeRepair.d.ts +233 -8
  18. package/dist/agent/resolver/validate.d.ts +10 -1
  19. package/dist/agent/symbolicOp.d.ts +20 -2
  20. package/dist/bpmn-modeler-next.css +1 -1
  21. package/dist/bpmn-modeler.js +18728 -14837
  22. package/dist/bpmn-modeler.umd.cjs +105 -106
  23. package/dist/command/annotationExactResize.d.ts +30 -0
  24. package/dist/command/commandSeam.d.ts +2 -1
  25. package/dist/command/setTranslations.d.ts +42 -0
  26. package/dist/command/translationCommands.d.ts +11 -0
  27. package/dist/command/undoEpisode.d.ts +7 -0
  28. package/dist/command/updateTranslation.d.ts +31 -0
  29. package/dist/core/hints.d.ts +29 -0
  30. package/dist/core/ir.d.ts +48 -1
  31. package/dist/editor/controller.d.ts +43 -1
  32. package/dist/editor/editLock.d.ts +9 -0
  33. package/dist/headless/dom.d.ts +2 -0
  34. package/dist/headless/modeler.d.ts +22 -2
  35. package/dist/index.d.ts +11 -0
  36. package/dist/view/BpmnDisplayLocaleSwitcher.vue.d.ts +6 -0
  37. package/dist/view/BpmnModelerView.vue.d.ts +7 -0
  38. package/dist/view/headlessReplay.d.ts +63 -0
  39. package/dist/view/i18nDisplay.d.ts +114 -0
  40. package/dist/view/minimap.d.ts +25 -0
  41. package/package.json +3 -2
@@ -1,29 +1,28 @@
1
- (function(te,xe){typeof exports=="object"&&typeof module<"u"?xe(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],xe):(te=typeof globalThis<"u"?globalThis:te||self,xe(te.BpmnModeler={},te.Vue))})(this,(function(te,xe){"use strict";var sN=Object.defineProperty;var cN=(te,xe,Kr)=>xe in te?sN(te,xe,{enumerable:!0,configurable:!0,writable:!0,value:Kr}):te[xe]=Kr;var Ro=(te,xe,Kr)=>cN(te,typeof xe!="symbol"?xe+"":xe,Kr);const Kr=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","subProcess","boundaryEvent","intermediateCatchEvent"],js=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","intermediateCatchEvent"];function vh(e){return Kr.includes(e)}function bh(e){return js.includes(e)}const Hs=["timer"],zs={timer:"bpmn:TimerEventDefinition"};function xh(e){return typeof e=="string"&&Hs.includes(e)}function Pu(e){if(e.length===1)return Hs.find(t=>zs[t]===e[0])}const _h="http://g1project.net/spec/bpmn/bwl/1.0",Tu="bwl",ku=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],wh={name:"bwl-hints",uri:_h,prefix:Tu,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"}]}]},Ou="bwl.undoEpisode",Eh=new WeakSet;function hE(e){Eh.has(e)||(e.register(Ou,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),Eh.add(e))}function Sh(e,t){hE(e);const n={run:t};if(e.execute(Ou,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}const Rh=["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"],mE={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},gE={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},yE={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},vE={type:"string",enum:[...Hs],description:"이벤트 정의. **type 이 intermediateCatchEvent 일 때만 쓰고, 그때는 반드시 준다**(다른 타입에 주거나 빠뜨리면 거부). timer = 시한 대기(「30분 경과」·「확정 기간 경과」처럼 시간이 지나야 다음으로 가는 자리). 시한 값은 name 에 쓴다 — 표현식 필드는 없다."},bE={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다. ⚠ type 집합은 **읽을 수 있는 것보다 좁다** — describe 는 subProcess·boundaryEvent 도 노드로 내지만 그 둘을 새로 만드는 배치는 미실증이라 여기서 받지 않는다(B-87 ⓐ). intermediateCatchEvent 는 eventDefinition 과 짝으로만 받는다.",properties:{id:{type:"string"},type:{type:"string",enum:[...js]},eventDefinition:{$ref:"#/$defs/eventDefinition"},name:{type:"string"},participant:{type:"string",description:"소속 풀 id(협업 문서)."},lane:{type:"string",description:"소속 레인 id(풀 정의에 선언된 것)."}},required:["id","type"],additionalProperties:!1},xE={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},_E={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},wE={type:"object",description:"메시지 플로우(풀 경계를 넘는 연결 — 노드 또는 블랙박스 풀 자체가 끝점).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"}},required:["id","source","target"],additionalProperties:!1},EE={type:"object",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},SE={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},RE={type:"object",properties:{id:{type:"string"},text:{type:"string"}},required:["id","text"],additionalProperties:!1},CE={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},ME={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},AE={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...ku]},offset:{type:"number",description:"앵커 가장자리 → 주석 가장자리 간격(px). 생략 시 50."}},required:["anchor","side"],additionalProperties:!1};function Cn(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const PE={"participant.add":Cn("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트 — **작을수록 위**(생략 시 op 순서가 곧 배치 순서). 값은 상대 순서만 쓰므로 1,2,3… 연속이든 10,20,30 간격이든 같다.",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":Cn("participant.update",{description:"풀 이름/레인 갱신. lanes 는 전체 재선언(생략 = 보존) — 기존 레인을 유지하려면 함께 다시 나열한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"]}),"node.add":Cn("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":Cn("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:[...js]},eventDefinition:{$ref:"#/$defs/eventDefinition"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["id"]}),"sequenceFlow.add":Cn("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":Cn("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":Cn("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":Cn("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataStore.add":Cn("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":Cn("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataAssociation.add":Cn("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":Cn("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":Cn("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":Cn("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":Cn("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":Cn("group.update",{description:"그룹 이름/멤버 갱신. members 는 전체 재선언(생략 = 보존).",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},members:{type:"array",items:{type:"string"}}},required:["id"]}),"element.remove":Cn("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},Ch={anyOf:Rh.map(e=>PE[e])},TE={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:gE,irParticipant:yE,irNode:bE,irFlowCondition:xE,irSequenceFlow:_E,irMessageFlow:wE,irDataStore:EE,irDataAssociation:SE,irTextAnnotation:RE,irAssociation:CE,irGroup:ME,bwlPlacement:AE,eventDefinition:vE,nullableString:mE,symbolicOp:Ch}};function Du(e){return Array.prototype.concat.apply([],e)}const Ca=Object.prototype.toString,kE=Object.prototype.hasOwnProperty;function Xr(e){return e===void 0}function rn(e){return e!==void 0}function Co(e){return e==null}function Ne(e){return Ca.call(e)==="[object Array]"}function pn(e){return Ca.call(e)==="[object Object]"}function ze(e){return Ca.call(e)==="[object Number]"}function fn(e){const t=Ca.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function jn(e){return Ca.call(e)==="[object String]"}function OE(e){if(!Ne(e))throw new Error("must supply array")}function Hn(e,t){return!Co(e)&&kE.call(e,t)}function kt(e,t){const n=Vs(t);let i;return z(e,function(r,o){if(n(r,o))return i=r,!1}),i}function Mh(e,t){const n=Vs(t);let i=Ne(e)?-1:void 0;return z(e,function(r,o){if(n(r,o))return i=o,!1}),i}function nt(e,t){const n=Vs(t);let i=[];return z(e,function(r,o){n(r,o)&&i.push(r)}),i}function z(e,t){let n,i;if(Xr(e))return;const r=Ne(e)?NE:BE;for(let o in e)if(Hn(e,o)&&(n=e[o],i=t(n,r(o)),i===!1))return n}function DE(e,t){if(Xr(e))return[];OE(e);const n=Vs(t);return e.filter(function(i,r){return!n(i,r)})}function zn(e,t,n){return z(e,function(i,r){n=t(n,i,r)}),n}function Zr(e,t){return!!zn(e,function(n,i,r){return n&&t(i,r)},!0)}function hr(e,t){return!!kt(e,t)}function Mn(e,t){let n=[];return z(e,function(i,r){n.push(t(i,r))}),n}function Gs(e){return e&&Object.keys(e)||[]}function IE(e){return Gs(e).length}function Mo(e){return Mn(e,t=>t)}function Ao(e,t,n={}){return t=Iu(t),z(e,function(i){let r=t(i)||"_",o=n[r];o||(o=n[r]=[]),o.push(i)}),n}function Ah(e,...t){e=Iu(e);let n={};return z(t,r=>Ao(r,e,n)),Mn(n,function(r,o){return r[0]})}const LE=Ah;function Pi(e,t){t=Iu(t);let n=[];return z(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 Po(e){return function(t){return Zr(e,function(n,i){return t[i]===n})}}function Iu(e){return fn(e)?e:t=>t[e]}function Vs(e){return fn(e)?e:t=>t===e}function BE(e){return e}function NE(e){return Number(e)}function Lu(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 Nn(e,t){return e.bind(t)}function U(e,...t){return Object.assign(e,...t)}function $E(e,t,n){let i=e;return z(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];rn(a)&&Co(s)&&(s=i[r]=isNaN(+a)?{}:[]),Xr(a)?Xr(n)?delete i[r]:i[r]=n:i=s}),e}function Si(e,t){let n={},i=Object(e);return z(t,function(r){r in i&&(n[r]=e[r])}),n}function Ti(e,t){let n={},i=Object(e);return z(i,function(r,o){t.indexOf(o)===-1&&(n[o]=r)}),n}function Bu(){}Bu.prototype.get=function(e){return this.$model.properties.get(this,e)},Bu.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function Ph(e,t){this.model=e,this.properties=t}Ph.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(Bu.prototype);z(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}),z(a,Nn(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 FE=U(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),Th=U(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 Nu(e,t){var n=Th[e];return n?n(t):t}function $u(e){return!!FE[e]}function kh(e){return!!Th[e]}function An(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 Jn(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}Jn.prototype.build=function(){return Si(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},Jn.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)},Jn.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},Jn.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=An(r[0],i),a=An(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},Jn.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},Jn.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},Jn.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},Jn.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},Jn.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},Jn.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")},Jn.prototype.hasProperty=function(e){return this.propertiesByName[e]},Jn.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,r=e.name;r in n||(z(e.properties,Nn(function(o){o=U({},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 mr(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,z(e,Nn(this.registerPackage,this))}mr.prototype.getPackage=function(e){return this.packageMap[e]},mr.prototype.getPackages=function(){return this.packages},mr.prototype.registerPackage=function(e){e=U({},e);var t=this.packageMap;Oh(t,e,"prefix"),Oh(t,e,"uri"),z(e.types,Nn(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},mr.prototype.registerType=function(e,t){e=U({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:U({},e.meta||{})});var n=An(e.name,t.prefix),i=n.name,r=Object.create(null);z(e.properties,Nn(function(o){var a=An(o.name,n.prefix),s=a.name;$u(o.type)||(o.type=An(o.type,a.prefix).name),U(o,{ns:a,name:s}),r[s]=o},this)),U(e,{ns:n,name:i,propertiesByName:r}),z(e.extends,Nn(function(o){var a=An(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},mr.prototype.mapTypes=function(e,t,n){var i=$u(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(c,l){var u=An(c,$u(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+">");z(i.superClass,n?a:s),t(i,!n),z(i.traits,a)},mr.prototype.getEffectiveDescriptor=function(e){var t=An(e),n=new Jn(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},mr.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function Oh(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function Qr(e){this.model=e}Qr.prototype.set=function(e,t,n){if(!jn(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),r=i&&i.name;jE(n)?i?delete e[r]:delete e.$attrs[Fu(t)]:i?r in e?e[r]=n:Dh(e,i,n):e.$attrs[Fu(t)]=n},Qr.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[Fu(t)];var i=n.name;return!e[i]&&n.isMany&&Dh(e,n,[]),e[i]},Qr.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=U({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},Qr.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},Qr.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},Qr.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 jE(e){return typeof e>"u"}function Dh(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function Fu(e){return e.replace(/^:/,"")}function si(e,t={}){this.properties=new Qr(this),this.factory=new Ph(this,this.properties),this.registry=new mr(e,this.properties),this.typeCache=Object.create(null),this.config=t}si.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},si.prototype.getType=function(e){var t=this.typeCache,n=jn(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},si.prototype.createAny=function(e,t,n){var i=An(e),r={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){$E(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}),z(n,function(a,s){pn(a)&&a.value!==void 0?r[a.name]=a.value:r[s]=a}),r},si.prototype.getPackage=function(e){return this.registry.getPackage(e)},si.prototype.getPackages=function(){return this.registry.getPackages()},si.prototype.getElementDescriptor=function(e){return e.$descriptor},si.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},si.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},si.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var Ih=String.fromCharCode,HE=Object.prototype.hasOwnProperty,zE=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,Ma={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(Ma).forEach(function(e){Ma[e.toUpperCase()]=Ma[e]});function GE(e,t,n,i){return i?HE.call(Ma,i)?Ma[i]:"&"+i+";":Ih(t||parseInt(n,16))}function Jr(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(zE,GE):e}var Lh="non-whitespace outside of root node";function gr(e){return new Error(e)}function VE(e){return"missing namespace for prefix <"+e+">"}function Ws(e){return{get:e,enumerable:!0}}function WE(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var Bh=Symbol("nameCache");function ju(e){return e+"$uri"}function UE(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 Us(){return{line:0,column:0}}function YE(e){throw e}function Nh(e){if(!this)return new Nh(e);var t=e&&e.proxy,n,i,r,o,a=YE,s,c,l,u,p=Us,f=!1,d=!1,h="",m=!1,b=!1,E=null,_=!1,g,y,S,w;function P(D){D instanceof Error||(D=gr(D)),E=D,a(D,p)}function T(D){s&&(D instanceof Error||(D=gr(D)),s(D,p))}this.on=function(D,H){if(typeof H!="function")throw gr("required args <name, cb>");switch(D){case"openTag":i=H;break;case"text":n=H;break;case"closeTag":r=H;break;case"error":a=H;break;case"warn":s=H;break;case"cdata":o=H;break;case"attention":u=H;break;case"question":l=H;break;case"comment":c=H;break;default:throw gr("unsupported event: "+D)}return this},this.ns=function(D){if(typeof D>"u"&&(D={}),typeof D!="object")throw gr("required args <nsMap={}>");var H=Object.create(null),Q;for(Q in D)H[Q]=D[Q];return b=!0,w=H,this};function $(){g=b?[]:null,y=b?UE(w):null,S=[],p=Us,_=!1,E=null,d=!1,h=""}this.parse=function(D){if(typeof D!="string")throw gr("required args <xml=string>");if(f)throw gr("parse during stream; call end() first");return $(),k(D),p=Us,_=!1,E},this.write=function(D){if(typeof D!="string")throw gr("required args <xml=string>");return f||($(),f=!0),E||(h=k(h+D,!0)||""),this},this.end=function(){return f||$(),f=!1,E||k(h),h="",p=Us,_=!1,E},this.stop=function(){_=!0};function k(D,H=!1){var Q=null,fe=null,Me,Be=0,it=!1,X=!1,ee=0,ue=0,be,q,V,ie,Pe,Te,B,R,x,G="",Y=0,Z;function Re(wt,ln){var yn=wt.indexOf(":");if(yn===-1)return wt;var vn=y[wt.substring(0,yn)];return vn?ln===vn?wt.substr(yn+1):vn+wt.substr(yn):(T(VE(wt.substring(0,yn))),null)}function Ze(){if(Z!==null)return Z;var wt,ln,yn=b&&y.xmlns,vn=b&&m?[]:null,Et=Y,un=G,mn=un.length,xo,Zn,xi,_i,Kt,wi={},_a=new Set,Qn,ct,xt;e:for(;Et<mn;Et++)if(Qn=!1,ct=un.charCodeAt(Et),!(ct===32||ct<14&&ct>8)){for((ct<65||ct>122||ct>90&&ct<97)&&ct!==95&&ct!==58&&(T("illegal first char attribute name"),Qn=!0),xt=Et+1;xt<mn;xt++)if(ct=un.charCodeAt(xt),!(ct>96&&ct<123||ct>64&&ct<91||ct>47&&ct<59||ct===46||ct===45||ct===95)){if(ct===32||ct<14&&ct>8){T("missing attribute value"),Et=xt;continue e}if(ct===61)break;T("illegal attribute name char"),Qn=!0}if(Kt=un.substring(Et,xt),Kt==="xmlns:xmlns"&&(T("illegal declaration of xmlns"),Qn=!0),ct=un.charCodeAt(xt+1),ct===34)xt=un.indexOf('"',Et=xt+2),xt===-1&&(xt=un.indexOf("'",Et),xt!==-1&&(T("attribute value quote missmatch"),Qn=!0));else if(ct===39)xt=un.indexOf("'",Et=xt+2),xt===-1&&(xt=un.indexOf('"',Et),xt!==-1&&(T("attribute value quote missmatch"),Qn=!0));else for(T("missing attribute value quotes"),Qn=!0,xt=xt+1;xt<mn&&(ct=un.charCodeAt(xt+1),!(ct===32||ct<14&&ct>8));xt++);for(xt===-1&&(T("missing closing quotes"),xt=mn,Qn=!0),Qn||(xi=un.substring(Et,xt)),Et=xt;xt+1<mn&&(ct=un.charCodeAt(xt+1),!(ct===32||ct<14&&ct>8));xt++)Et===xt&&(T("illegal character after attribute end"),Qn=!0);if(Et=xt+1,Qn)continue e;if(_a.has(Kt)){T("attribute <"+Kt+"> already defined");continue}if(_a.add(Kt),!b){wi[Kt]=xi;continue}if(m){if(Zn=Kt==="xmlns"?"xmlns":Kt.charCodeAt(0)===120&&Kt.substr(0,6)==="xmlns:"?Kt.substr(6):null,Zn!==null){if(wt=Jr(xi),ln=ju(Zn),_i=w[wt],!_i){if(Zn==="xmlns"||ln in y&&y[ln]!==wt)do _i="ns"+Be++;while(typeof y[_i]<"u");else _i=Zn;w[wt]=_i}y[Zn]!==_i&&(xo||(y=WE(y),xo=!0),y[Zn]=_i,Zn==="xmlns"&&(y[ju(_i)]=wt,yn=_i),y[ln]=wt),wi[Kt]=xi;continue}vn.push(Kt,xi);continue}Kt=Re(Kt,yn),Kt!==null&&(wi[Kt]=xi)}if(m)for(Et=0,mn=vn.length;Et<mn;Et++)Kt=Re(vn[Et++],yn),xi=vn[Et],Kt!==null&&(wi[Kt]=xi);return Z=wi}function mt(){for(var wt=/(\r\n|\r|\n)/g,ln=0,yn=0,vn=0,Et=ue,un,mn;ee>=vn&&(un=wt.exec(D),!(!un||(Et=un[0].length+un.index,Et>ee)));)ln+=1,vn=Et;return ee==-1?(yn=Et,mn=D.substring(ue)):ue===0?mn=D.substring(ue,ee):(yn=ee-vn,mn=ue==-1?D.substring(ee):D.substring(ee,ue+1)),{data:mn,line:ln,column:yn}}for(p=mt,t&&(x=Object.create({},{name:Ws(function(){return B}),originalName:Ws(function(){return R}),attrs:Ws(Ze),ns:Ws(function(){return y})}));ue!==-1;){if(D.charCodeAt(ue)===60?ee=ue:ee=D.indexOf("<",ue),ee===-1){if(H)return D.substring(ue);if(S.length)return P("unexpected end of file");if(!d)return P("missing start tag");ue<D.length&&D.substring(ue).trim()&&T(Lh);return}if(d||(d=!0),ue!==ee){if(S.length){if(n&&(n(D.substring(ue,ee),Jr,p),_))return}else if(D.substring(ue,ee).trim()&&(T(Lh),_))return}if(ie=D.charCodeAt(ee+1),ie===33){if(V=D.charCodeAt(ee+2),V===91&&D.substr(ee+3,6)==="CDATA["){if(ue=D.indexOf("]]>",ee),ue===-1)return H?D.substring(ee):P("unclosed cdata");if(o&&(o(D.substring(ee+9,ue),p),_))return;ue+=3;continue}if(V===45&&D.charCodeAt(ee+3)===45){if(ue=D.indexOf("-->",ee),ue===-1)return H?D.substring(ee):P("unclosed comment");if(c&&(c(D.substring(ee+4,ue),Jr,p),_))return;ue+=3;continue}}if(ie===63){if(ue=D.indexOf("?>",ee),ue===-1)return H?D.substring(ee):P("unclosed question");if(l&&(l(D.substring(ee,ue+2),p),_))return;ue+=2;continue}for(be=ee+1;;be++){if(Pe=D.charCodeAt(be),isNaN(Pe))return H?D.substring(ee):(ue=-1,P("unclosed tag"));if(Pe===34)V=D.indexOf('"',be+1),be=V!==-1?V:be;else if(Pe===39)V=D.indexOf("'",be+1),be=V!==-1?V:be;else if(Pe===62){ue=be;break}}if(ie===33){if(u&&(u(D.substring(ee,ue+1),Jr,p),_))return;ue+=1;continue}if(Z={},ie===47){if(it=!1,X=!0,!S.length)return P("missing open tag");if(be=B=S.pop(),V=ee+2+be.length,D.substring(ee+2,V)!==be)return P("closing tag mismatch");for(;V<ue;V++)if(ie=D.charCodeAt(V),!(ie===32||ie>8&&ie<14))return P("close tag")}else{if(D.charCodeAt(ue-1)===47?(be=B=D.substring(ee+1,ue-1),it=!0,X=!0):(be=B=D.substring(ee+1,ue),it=!0,X=!1),!(ie>96&&ie<123||ie>64&&ie<91||ie===95||ie===58))return P("illegal first char nodeName");for(V=1,q=be.length;V<q;V++)if(ie=be.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){B=be.substring(0,V),Z=null;break}return P("invalid nodeName")}X||S.push(B)}if(b){Me=y,it&&(X||g.push(Me),Z===null&&(m=be.indexOf("xmlns",V)!==-1)&&(Y=V,G=be,Ze(),m=!1)),R=B,fe!==y&&(Q=y[Bh],Q===void 0&&(Q=y[Bh]=Object.create(null)),fe=y);var Vt=Q[B];if(Vt!==void 0)B=Vt;else{if(ie=B.indexOf(":"),ie!==-1){if(Te=y[B.substring(0,ie)],!Te)return P("missing namespace on <"+R+">");B=B.substr(ie+1)}else Te=y.xmlns;Te&&(B=Te+":"+B),Q[R]=B}}if(it&&(Y=V,G=be,i&&(t?i(x,Jr,X,p):i(B,Ze,Jr,X,p),_)))return;if(X){if(r&&(r(t?x:B,Jr,it,p),_))return;b&&(it?y=Me:y=g.pop())}ue+=1}}}function $h(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var Hu={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},Fh="property";function jh(e){return e.xml&&e.xml.serialize}function qE(e){const t=jh(e);return t!==Fh&&(t||null)}function KE(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Hh(e,t){return $h(t)?e.prefix+":"+KE(e.localName):e.name}function XE(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 ZE(e,t,n){const i=An(e,t.xmlns),r=`${t[i.prefix]||i.prefix}:${i.localName}`,o=An(r);var a=n.getPackage(o.prefix);return XE(o,a)}function yr(e){return new Error(e)}function qi(e){return e.$descriptor}function QE(e){U(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw yr("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 yr("duplicate ID <"+o+">");n[o]=t}},this.addWarning=function(t){this.warnings.push(t)}}function Aa(){}Aa.prototype.handleEnd=function(){},Aa.prototype.handleText=function(){},Aa.prototype.handleNode=function(){};function zu(){}zu.prototype=Object.create(Aa.prototype),zu.prototype.handleNode=function(){return this};function To(){}To.prototype=Object.create(Aa.prototype),To.prototype.handleText=function(e){this.body=(this.body||"")+e};function Pa(e,t){this.property=e,this.context=t}Pa.prototype=Object.create(To.prototype),Pa.prototype.handleNode=function(e){if(this.element)throw yr("expected no sub nodes");return this.element=this.createReference(e),this},Pa.prototype.handleEnd=function(){this.element.id=this.body},Pa.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function Gu(e,t){this.element=t,this.propertyDesc=e}Gu.prototype=Object.create(To.prototype),Gu.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=Nu(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function Ys(){}Ys.prototype=Object.create(To.prototype),Ys.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 Dn(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}Dn.prototype=Object.create(Ys.prototype),Dn.prototype.addReference=function(e){this.context.addReference(e)},Dn.prototype.handleText=function(e){var t=this.element,n=qi(t),i=n.bodyProperty;if(!i)throw yr("unexpected body text <"+e+">");To.prototype.handleText.call(this,e)},Dn.prototype.handleEnd=function(){var e=this.body,t=this.element,n=qi(t),i=n.bodyProperty;i&&e!==void 0&&(e=Nu(i.type,e),t.set(i.name,e))},Dn.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 z(t,function(c,l){var u=i.propertiesByName[l],p;u&&u.isReference?u.isMany?(p=c.split(" "),z(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=Nu(u.type,c):l==="xmlns"?l=":"+l:(s=An(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},Dn.prototype.getPropertyForNode=function(e){var t=e.name,n=An(t),i=this.type,r=this.model,o=qi(i),a=n.name,s=o.propertiesByName[a];if(s&&!s.isAttr){const l=qE(s);if(l){const u=e.attributes[l];if(u){const p=ZE(u,e.ns,r),f=r.getType(p);return U({},s,{effectiveType:qi(f).name})}}return s}var c=r.getPackage(n.prefix);if(c){const l=Hh(n,c),u=r.getType(l);if(s=kt(o.properties,function(p){return!p.isVirtual&&!p.isReference&&!p.isAttribute&&u.hasType(p.type)}),s)return U({},s,{effectiveType:qi(u).name})}else if(s=kt(o.properties,function(l){return!l.isReference&&!l.isAttribute&&l.type==="Element"}),s)return s;throw yr("unrecognized element <"+n.name+">")},Dn.prototype.toString=function(){return"ElementDescriptor["+qi(this.type).name+"]"},Dn.prototype.valueHandler=function(e,t){return new Gu(e,t)},Dn.prototype.referenceHandler=function(e){return new Pa(e,this.context)},Dn.prototype.handler=function(e){return e==="Element"?new ko(this.model,e,this.context):new Dn(this.model,e,this.context)},Dn.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,kh(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?(U(o,{element:i}),this.context.addReference(o)):o.$parent=i),r};function Vu(e,t,n){Dn.call(this,e,t,n)}Vu.prototype=Object.create(Dn.prototype),Vu.prototype.createElement=function(e){var t=e.name,n=An(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&Hh(n,o)||t;if(!r.hasType(a))throw yr("unexpected element <"+e.originalName+">");return Dn.prototype.createElement.call(this,e)};function ko(e,t,n){this.model=e,this.context=n}ko.prototype=Object.create(Ys.prototype),ko.prototype.createElement=function(e){var t=e.name,n=An(t),i=n.prefix,r=e.ns[i+"$uri"],o=e.attributes;return this.model.createAny(t,r,o)},ko.prototype.handleChild=function(e){var t=new ko(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},ko.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function Wu(e){e instanceof si&&(e={model:e}),U(this,{lax:!1},e)}Wu.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof Dn?(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 QE(U({},t,{rootHandler:i})),s=new Nh({proxy:!0}),c=JE();i.context=a,c.push(i);function l(S,w,P){var T=w(),$=T.line,k=T.column,D=T.data;D.charAt(0)==="<"&&D.indexOf(" ")!==-1&&(D=D.slice(0,D.indexOf(" "))+">");var H="unparsable content "+(D?D+" ":"")+`detected
2
- line: `+$+`
3
- column: `+k+`
4
- nested error: `+S.message;if(P)return a.addWarning({message:H,error:S}),!0;throw yr(H)}function u(S,w){return l(S,w,!0)}function p(){var S=a.elementsById,w=a.references,P,T;for(P=0;T=w[P];P++){var $=T.element,k=S[T.id],D=qi($).propertiesByName[T.property];if(k||a.addWarning({message:"unresolved reference <"+T.id+">",element:T.element,property:T.property,value:T.id}),D.isMany){var H=$.get(D.name),Q=H.indexOf(T);Q===-1&&(Q=H.length),k?H[Q]=k:H.splice(Q,1)}else $.set(D.name,k)}}function f(){c.pop().handleEnd()}var d=/^<\?xml /i,h=/ encoding="([^"]+)"/i,m=/^utf-8$/i;function b(S){if(d.test(S)){var w=h.exec(S),P=w&&w[1];!P||m.test(P)||a.addWarning({message:"unsupported document encoding <"+P+">, falling back to UTF-8"})}}function E(S,w){var P=c.peek();try{c.push(P.handleNode(S))}catch(T){l(T,w,o)&&c.push(new zu)}}function _(S,w){try{c.peek().handleText(S)}catch(P){u(P,w)}}function g(S,w){S.trim()&&_(S,w)}var y=r.getPackages().reduce(function(S,w){return S[w.uri]=w.prefix,S},Object.entries(Hu).reduce(function(S,[w,P]){return S[P]=w,S},r.config&&r.config.nsMap||{}));return s.ns(y).on("openTag",function(S,w,P,T){var $=S.attrs||{},k=Object.keys($).reduce(function(H,Q){var fe=w($[Q]);return H[Q]=fe,H},{}),D={name:S.name,originalName:S.originalName,attributes:k,ns:S.ns};E(D,T)}).on("question",b).on("closeTag",f).on("cdata",_).on("text",function(S,w,P){g(w(S),P)}).on("error",l).on("warn",u),new Promise(function(S,w){var P;try{s.parse(e),p()}catch(H){P=H}var T=i.element;!P&&!T&&(P=yr("failed to parse document as <"+i.type.$descriptor.name+">"));var $=a.warnings,k=a.references,D=a.elementsById;return P?(P.warnings=$,w(P)):S({rootElement:T,elementsById:D,references:k,warnings:$})})},Wu.prototype.handler=function(e){return new Vu(this.model,e)};function JE(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var e1=`<?xml version="1.0" encoding="UTF-8"?>
5
- `,t1=/<|>|'|"|&|\n\r|\n/g,zh=/<|>|&/g;function ki(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}ki.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},ki.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},ki.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},ki.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)},ki.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},ki.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},ki.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri},ki.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},ki.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 n1(e){return e.charAt(0).toLowerCase()+e.slice(1)}function i1(e,t){return $h(t)?n1(e):e}function Gh(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function Vh(e){return jn(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 o1(e,t){return t.isGeneric?U({localName:t.ns.localName},e):U({localName:i1(t.ns.localName,t.$pkg)},e)}function a1(e,t){return U({localName:t.ns.localName},e)}function s1(e){var t=e.$descriptor;return nt(t.properties,function(n){var i=n.name;if(n.isVirtual||!Hn(e,i))return!1;var r=e[i];return r===n.default||r===null?!1:n.isMany?r.length:!0})}var c1={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},l1={"<":"lt",">":"gt","&":"amp"};function Wh(e,t,n){return e=jn(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function u1(e){return Wh(e,t1,c1)}function p1(e){return Wh(e,zh,l1)}function f1(e){return nt(e,function(t){return t.isAttr})}function d1(e){return nt(e,function(t){return!t.isAttr})}function Uu(e){this.tagName=e}Uu.prototype.build=function(e){return this.element=e,this},Uu.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()};function eo(){}eo.prototype.serializeValue=eo.prototype.serializeTo=function(e){e.append(this.escape?p1(this.value):this.value)},eo.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(zh)!==-1&&(this.escape=!0),this};function Yu(e){this.tagName=e}Gh(Yu,eo),Yu.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()};function Nt(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}Nt.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=s1(e),this.parseAttributes(f1(r)),this.parseContainments(d1(r))),this.parseGenericAttributes(e,i),this},Nt.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return o1(t,e)},Nt.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return a1(t,e)},Nt.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},Nt.prototype.nsAttributeName=function(e){var t;if(jn(e)?t=An(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}:U({localName:t.localName},n)},Nt.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}))},Nt.prototype.parseGenericContainments=function(e){var t=e.$body;t&&this.body.push(new eo().build({type:"String"},t));var n=e.$children;n&&z(n,i=>{this.body.push(new Nt(this).build(i))})},Nt.prototype.parseNsAttribute=function(e,t,n){var i=e.$model,r=An(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)}},Nt.prototype.parseNsAttributes=function(e){var t=this,n=e.$attrs,i=[];return z(n,function(r,o){var a=t.parseNsAttribute(e,o,r);a&&i.push(a)}),i},Nt.prototype.parseGenericAttributes=function(e,t){var n=this;z(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)}})},Nt.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;z(e,function(r){var o=i.get(r.name),a=r.isReference,s=r.isMany;if(s||(o=[o]),r.isBody)n.push(new eo().build(r,o[0]));else if(kh(r.type))z(o,function(l){n.push(new Yu(t.addTagName(t.nsPropertyTagName(r))).build(r,l))});else if(a)z(o,function(l){n.push(new Uu(t.addTagName(t.nsPropertyTagName(r))).build(l))});else{var c=jh(r);z(o,function(l){var u;c?c===Fh?u=new Nt(t,r):u=new qs(t,r,c):u=new Nt(t),n.push(u.build(l))})}})},Nt.prototype.getNamespaces=function(e){var t=this.namespaces,n=this.parent,i;return t||(i=n&&n.getNamespaces(),e||!i?this.namespaces=t=new ki(i):t=i),t},Nt.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},Nt.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},Nt.prototype.parseAttributes=function(e){var t=this,n=this.element;z(e,function(i){var r=n.get(i.name);if(i.isReference)if(!i.isMany)r=r.id;else{var o=[];z(r,function(a){o.push(a.id)}),r=o.join(" ")}t.addAttribute(t.nsAttributeName(i),r)})},Nt.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),Vh(e)},Nt.prototype.addAttribute=function(e,t){var n=this.attrs;jn(t)&&(t=u1(t));var i=Mh(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)},Nt.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=r1(n).concat(t)),z(t,function(i){e.append(" ").append(Vh(i.name)).append('="').append(i.value).append('"')})},Nt.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==eo;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),z(this.body,function(i){i.serializeTo(e)}),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()};function qs(e,t,n){Nt.call(this,e,t),this.serialization=n}Gh(qs,Nt),qs.prototype.parseNsAttributes=function(e){var t=Nt.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},qs.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function h1(){this.value="",this.write=function(e){this.value+=e}}function m1(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 g1(e){e=U({format:!1,preamble:!0},e||{});function t(n,i){var r=i||new h1,o=new m1(r,e.format);e.preamble&&o.append(e1);var a=new Nt,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(y1(s)),a.build(n).serializeTo(o),!i)return r.value}return{toXML:t}}function y1(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in Hu)n[i]=Hu[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 Ks(e,t){si.call(this,e,t)}Ks.prototype=Object.create(si.prototype),Ks.prototype.fromXML=function(e,t,n){jn(t)||(n=t,t="bpmn:Definitions");var i=new Wu(U({model:this,lax:!0},n)),r=i.handler(t);return i.fromXML(e,r)},Ks.prototype.toXML=function(e,t){var n=new g1(t);return new Promise(function(i,r){try{var o=n.toXML(e);return i({xml:o})}catch(a){return r(a)}})};var v1="BPMN20",b1="http://www.omg.org/spec/BPMN/20100524/MODEL",x1="bpmn",_1=[],w1=[{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"}]}],E1=[{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"}]}],S1={tagAlias:"lowerCase",typePrefix:"t"},R1={name:v1,uri:b1,prefix:x1,associations:_1,types:w1,enumerations:E1,xml:S1},C1="BPMNDI",M1="http://www.omg.org/spec/BPMN/20100524/DI",A1="bpmndi",P1=[{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"]}],T1=[{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"}]}],k1=[],O1={name:C1,uri:M1,prefix:A1,types:P1,enumerations:T1,associations:k1},D1="DC",I1="http://www.omg.org/spec/DD/20100524/DC",L1="dc",B1=[{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}]}],N1=[],$1={name:D1,uri:I1,prefix:L1,types:B1,associations:N1},F1="DI",j1="http://www.omg.org/spec/DD/20100524/DI",H1="di",z1=[{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"}]}],G1=[],V1={tagAlias:"lowerCase"},W1={name:F1,uri:j1,prefix:H1,types:z1,associations:G1,xml:V1},U1="bpmn.io colors for BPMN",Y1="http://bpmn.io/schema/bpmn/biocolor/1.0",q1="bioc",K1=[{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"}]}],X1=[],Z1=[],Q1={name:U1,uri:Y1,prefix:q1,types:K1,enumerations:X1,associations:Z1},J1="BPMN in Color",eS="http://www.omg.org/spec/BPMN/non-normative/color/1.0",tS="color",nS=[{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"}]}],iS=[],rS=[],oS={name:J1,uri:eS,prefix:tS,types:nS,enumerations:iS,associations:rS};const aS={bpmn:R1,bpmndi:O1,dc:$1,di:W1,bioc:Q1,color:oS};function Uh(e,t){const n=U({},aS,e);return new Ks(n,t)}const sS={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"}},cS="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",Yh="i18n",Xs={[Yh]:sS,[Tu]:wh};function qh(){return Uh(Xs)}const Kh=qh();async function Oo(e){const{rootElement:t,warnings:n}=await Kh.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function lS(e){const{xml:t}=await Kh.toXML(e,{format:!0});return t}function qu(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const Do={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},uS=/[ᄀ-ᇿ -〿぀-ヿ㐀-鿿가-힯＀-⦆]/;function pS(e){const t=Do;return uS.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 Io(e,t){let n=0;for(const i of e)n+=t*pS(i);return n}function Xh(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&fS(e),dS(e),hS(e),mS(e)}function fS(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:Io(r,o),fontBoundingBoxAscent:o*Do.ascentEm,fontBoundingBoxDescent:o*Do.descentEm,actualBoundingBoxAscent:o*Do.ascentEm,actualBoundingBoxDescent:o*Do.descentEm}}};t.getContext=()=>n}function dS(e){if(e.SVGMatrix)return;class t{constructor(){Ro(this,"a",1);Ro(this,"b",0);Ro(this,"c",0);Ro(this,"d",1);Ro(this,"e",0);Ro(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 hS(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 mS(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:Io(n,12),height:14}})}const Zs=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),gS=new Set(["bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),yS=1,Qs=new Set(["bpmn:TextAnnotation","bpmn:DataStoreReference","bpmn:DataObjectReference","bpmn:DataInput","bpmn:DataOutput"]),vS=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 Zh=20,Js=5,Qh=3,bS=8,Lo=15,Ku=50,Jh=12,xS=Jh*1.2;function Xu(e,t){const n=t.split(/\r?\n/),i=Math.max(...n.map(o=>Io(o,Jh))),r=n.length*xS;return{x:e.x+e.width/2-i/2,y:e.y+e.height/2-r/2,width:i,height:r}}const em=1;function dn(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 Bo(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 dn(e))for(const s of dn(t)){if(a.axis!==s.axis||Math.abs(a.at-s.at)>em)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>=Zh&&(!n||l>n.length)&&(n={axis:a.axis,length:l,kind:c})}return n}function Zu(e){return e.kind==="edge-overlap-opposite"||e.kind==="edge-overlap-mixed"||e.kind==="edge-overlap-unrelated"}function tm(e,t){const n=Bo(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function _S(e,t){let n=0;for(const i of t)i.id!==e.id&&tm(e,i)&&n++;return n}function ei(e,t){let n=0;for(const i of t)i.id!==e.id&&Bo(e,i)&&n++;return n}const nm=15,im=20;function wS(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-im||t.at>n[1]+im)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 Qu=20;function ec(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>em)continue;const r=Math.max(e.lo,i.lo),o=Math.min(e.hi,i.hi);o-r<Zh||n.push([r-Qu,o+Qu])}return n}function tc(e,t){const n=e.label;if(!n)return null;let i=null;for(const r of dn(e)){const o=wS(n,r);if(o){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of ec(r,dn(a)))if(Math.min(c,o[1])>Math.max(s,o[0])){i={other:a.id,axis:r.axis};break}}}}return i}const ES=10,SS=1,RS=(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 CS(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 Ju(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 MS=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,No=1;function Oi(e,t){const n=e.x+No,i=e.x+e.width-No,r=e.y+No,o=e.y+e.height-No;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 $o(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 rm(e,t){const n=e.label;if(!n)return null;if(dn(e).some(i=>Oi(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(dn(i).some(r=>Oi(n,r)))return i.id;for(const i of t.shapes.filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if($o(i).some(r=>Oi(n,r)))return i.id;return null}function bn(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(CS(e.waypoints[o],e.waypoints[o+1],r,vS)){i.push(r);break}}return i}const Ta=(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))},AS=(e,t,n,i)=>am(e,t,n,i)?0:Math.min(Ta(e,n,i),Ta(t,n,i),Ta(n,e,t),Ta(i,e,t)),om=(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 nc(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,Ta({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(om(e,s)||om(t,s))return 0;let c=1/0;for(let l=0;l<s.length;l++)c=Math.min(c,AS(e,t,s[l],s[(l+1)%s.length]));return c}function am(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 sm=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function ka(e,t){let n=0;for(const i of t){if(i.id===e.id||sm(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++)am(e.waypoints[o],e.waypoints[o+1],i.waypoints[a],i.waypoints[a+1])&&(r=!0);r&&n++}return n}function ti(e,t){let n=0;for(const i of t)i.id===e.id||sm(e,i)||ka(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function cm(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++)ka(n[i],[n[r]])>0&&(t+=n[i].type===n[r].type?2:1);return t}function ic(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)if(ka(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 lm(e){const t=ic(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:PS(e)}}function PS(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 um(e,t,n){const i=new Set(t.flatMap(r=>[...r.members]));return e.shapes.filter(r=>!r.container&&!Qs.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 pm(e){var n;const t=(n=Lt(e==null?void 0:e.extensionElements))==null?void 0:n.values;if(Array.isArray(t))for(const i of t){const r=Lt(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 fm=e=>e?{members:e}:{},ni=e=>e.shapes.filter(t=>!t.container);function TS(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 kS(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 dm(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(dn(i).some(r=>Oi(n,r)))return i.id;for(const i of[...t.shapes].filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if($o(i).some(r=>Oi(n,r)))return i.id;return null}function to(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 hm=3;function mm(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 Oa(e,t){const n=[];for(const i of t.shapes){if(i.container||Qs.has(i.type))continue;const r=mm(e,i);r>=hm&&n.push({shape:i.id,depth:r})}return n.sort((i,r)=>i.shape.localeCompare(r.shape))}function gt(e,t={}){const n=[],i=e.shapes.filter(g=>!g.container);for(const g of e.edges)for(const y of bn(g,i))n.push({kind:"edge-crosses-shape",edge:g.id,shape:y.id});const r=e.shapes.filter(g=>g.container&&gS.has(g.type));if(r.length){const g=(y,S)=>{const w=e.shapes.find(P=>P.id===S);return!!w&&w.x>=y.x&&w.y>=y.y&&w.x+w.width<=y.x+y.width&&w.y+w.height<=y.y+y.height};for(const y of e.edges)for(const S of bn(y,r))y.endpoints.includes(S.id)||y.endpoints.some(w=>g(S,w))||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,w]of y){if(!S)continue;const P=e.shapes.find(D=>D.id===S);if(!P||P.container)continue;const T=Math.max(P.x-w.x,w.x-(P.x+P.width),0),$=Math.max(P.y-w.y,w.y-(P.y+P.height),0),k=Math.hypot(T,$);k>ES&&n.push({kind:"edge-endpoint-detached",edge:g.id,shape:S,distance:Math.round(k)})}}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],w=o[y];if(S.x+S.width<=w.x||w.x+w.width<=S.x||S.y+S.height<=w.y||w.y+w.height<=S.y)continue;const P=(T,$)=>T.x<=$.x&&T.y<=$.y&&T.x+T.width>=$.x+$.width&&T.y+T.height>=$.y+$.height;n.push({kind:"pool-overlap",pools:[S.id,w.id],contained:P(S,w)||P(w,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],w=a[y];if(!Ju(S,w,yS))continue;const P=S.id<w.id?[S.id,w.id]:[w.id,S.id];n.push({kind:"shape-overlap",shapes:P,identical:MS(S,w)})}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],w=s[y],P=Math.min(S.x+S.width,w.x+w.width)-Math.max(S.x,w.x),T=Math.min(S.y+S.height,w.y+w.height)-Math.max(S.y,w.y);if(P<=Js||T<=Js)continue;const $=S.id<w.id?[S.id,w.id]:[w.id,S.id],k=new Set(w.members);if(S.members.some(H=>k.has(H))){const H=um(e,s,{x:Math.max(S.x,w.x),y:Math.max(S.y,w.y),right:Math.min(S.x+S.width,w.x+w.width),bottom:Math.min(S.y+S.height,w.y+w.height)});H.length&&n.push({kind:"group-overlap-unreadable",reason:"orphan",groups:$,shapes:H});continue}const D=S.x<=w.x&&S.y<=w.y&&S.x+S.width>=w.x+w.width&&S.y+S.height>=w.y+w.height?S.id:w.x<=S.x&&w.y<=S.y&&w.x+w.width>=S.x+S.width&&w.y+w.height>=S.y+S.height?w.id:void 0;n.push({kind:"group-overlap-unintended",groups:$,...D?{container:D}:{}})}const c=new Set(s.flatMap(g=>[...g.members])),l=g=>e.shapes.filter(y=>!y.container&&!Qs.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),w=y.filter(P=>!S.has(P.id));w.some(P=>c.has(P.id))&&(w.length*2<y.length||n.push({kind:"group-overlap-unreadable",reason:"minority",group:g.id,shapes:w.map(P=>P.id).sort()}))}for(const g of s){const y=new Set(l(g).map(k=>k.id)),S=new Set(g.members),w=new Set([...y].filter(k=>!S.has(k)&&c.has(k)));if(!w.size)continue;let P=!1,T=!1,$=!1;for(const k of e.edges){if(k.type!=="bpmn:SequenceFlow"||!k.source||!k.target)continue;const D=w.has(k.source),H=w.has(k.target);!D&&H&&!y.has(k.source)?P=!0:D&&!H&&!y.has(k.target)?T=!0:D&&H&&($=!0)}P&&T&&$&&n.push({kind:"group-overlap-unreadable",reason:"throughpass",group:g.id,shapes:[...w].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 w=[u[g],u[y],u[S]],P={x:Math.max(...w.map(k=>k.x)),y:Math.max(...w.map(k=>k.y)),right:Math.min(...w.map(k=>k.x+k.width)),bottom:Math.min(...w.map(k=>k.y+k.height))};if(P.right-P.x<=Js||P.bottom-P.y<=Js)continue;const T=um(e,[],P);if(!T.length)continue;const $=w.map(k=>k.id).sort();n.push({kind:"group-stack-unreadable",groups:$,shapes:T})}for(const g of e.shapes.filter(y=>y.type==="bpmn:Group"))for(const y of e.shapes){if(y.container||y.attached||Qs.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[w,P,T,$,k]of S){const D=T==="h"?y.x:y.y,H=T==="h"?y.x+y.width:y.y+y.height;if(!(D<k&&$<H))continue;const Q=T==="h"?y.y:y.x,fe=T==="h"?y.y+y.height:y.x+y.width;if(!(Q<P&&P<fe))continue;const Me=Math.min(P-Q,fe-P);Me<bS||n.push({kind:"group-cuts-shape",group:g.id,shape:y.id,side:w,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=dn(y);if(S.length)for(const w of p){const P=w.x+w.width,T=w.y+w.height,$=y.endpoints.some(D=>{const H=g.get(D);return!!H&&w.x<H.x&&H.x<P&&w.y<H.y&&H.y<T});let k=null;for(const D of S){const[H,Q,fe]=D.axis==="v"?[w.y,T,[["left",w.x],["right",P]]]:[w.x,P,[["top",w.y],["bottom",T]]],Me=Math.min(D.hi,Q)-Math.max(D.lo,H);if(Me<Ku)continue;const Be=D.axis==="v"?w.x<D.at&&D.at<P:w.y<D.at&&D.at<T;if(!(Be&&$))for(const[it,X]of fe){const ee=Math.abs(D.at-X);ee<=Lo&&(!k||ee<k.distance)&&(k={side:it,inside:Be,distance:ee,length:Me})}}k&&n.push({kind:"edge-along-group-boundary",edge:y.id,group:w.id,side:k.side,inside:k.inside,distance:Math.round(k.distance),length:Math.round(k.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,w=g.y<y.y+y.height&&y.y<g.y+g.height,P=[["top",g.y,y.y,S],["bottom",g.y+g.height,y.y+y.height,S],["left",g.x,y.x,w],["right",g.x+g.width,y.x+y.width,w]];for(const[T,$,k,D]of P)D&&Math.abs($-k)<=Qh&&n.push({kind:"group-on-container-boundary",group:g.id,container:y.id,side:T})}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],w=d[y],P=S.x<w.x+w.width&&w.x<S.x+S.width,T=S.y<w.y+w.height&&w.y<S.y+S.height,$=[["x",S.x+S.width,w.x,T],["x",w.x+w.width,S.x,T],["y",S.y+S.height,w.y,P],["y",w.y+w.height,S.y,P]];for(const[k,D,H,Q]of $)if(Q&&Math.abs(D-H)<=Qh){n.push({kind:"group-on-group-boundary",groups:S.id<w.id?[S.id,w.id]:[w.id,S.id],axis:k});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],w=e.edges[y],P=Bo(S,w);if(!P)continue;const T=S.id<w.id?[S.id,w.id]:[w.id,S.id];n.push({kind:P.kind==="opposite"?"edge-overlap-opposite":P.kind==="mixed"?"edge-overlap-mixed":"edge-overlap-unrelated",edges:T,axis:P.axis,length:Math.round(P.length)})}for(const g of e.edges){if(!g.label)continue;const y=tc(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=rm(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 Oa(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=dm(g,e);y&&n.push({kind:"label-over-line",edge:g.id,line:y})}const b=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 to(e))y===g.id||b.has(y)||Ju(g.label,S,No)&&n.push({kind:"pool-name-over-label",pool:g.id,label:y});const E=to(e);for(const g of i)if(g.type==="bpmn:TextAnnotation")for(const{owner:y,rect:S}of E)y!==g.id&&Ju(g,S,No)&&n.push({kind:"annotation-over-label",annotation:g.id,label:y});const _=new Map(e.shapes.map(g=>[g.id,g]));for(const g of i){const y=g.parent??TS(g,e,_);if(!y)continue;const S=_.get(y);!S||!S.container||RS(S,g,SS)||g.type==="bpmn:TextAnnotation"&&!kS(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 Lt=e=>typeof e=="object"&&e!==null?e:void 0,Wt=e=>typeof e=="number"?e:0,Ki=e=>{const t=Lt(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function OS(e){const t=Lt(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=Ki(o);a&&n.push(a)}}return n}function DS(e){const t=Lt(e);if(!t)return{};const n=Array.isArray(t.sourceRef)?void 0:Ki(t.sourceRef),i=Array.isArray(t.targetRef)?void 0:Ki(t.targetRef);return n&&i?{source:n,target:i}:{}}function IS(e,t){const n=Lt(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const r=Ki(n);return r?t.get(r):void 0}if(Zs.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return Ki(n)}function gm(e){var a,s,c,l,u;const t=[],n=[],i=((a=Lt(e))==null?void 0:a.diagrams)??[],r=new Map,o=new Set;for(const p of((s=Lt(e))==null?void 0:s.rootElements)??[]){const f=Lt(p);if((f==null?void 0:f.$type)==="bpmn:Collaboration")for(const d of f.participants??[]){const h=Lt(d),m=Ki(h),b=Ki(h==null?void 0:h.processRef);m&&b?r.set(b,m):m&&o.add(m)}}for(const p of i){const f=Lt((c=Lt(p))==null?void 0:c.plane),d=(f==null?void 0:f.planeElement)??[];for(const h of d){const m=Lt(h);if(!m)continue;const b=Lt(m.bpmnElement),E=typeof(b==null?void 0:b.id)=="string"?b.id:void 0;if(!E)continue;const _=typeof(b==null?void 0:b.$type)=="string"?b.$type:"",g=Lt(m.bounds);if(g){const S=m.isExpanded===!1&&_!=="bpmn:Participant",w=Lt((l=Lt(m.label))==null?void 0:l.bounds),P={id:E,type:_,x:Wt(g.x),y:Wt(g.y),width:Wt(g.width),height:Wt(g.height),container:Zs.has(_)&&!S,attached:(b==null?void 0:b.attachedToRef)!==void 0,...b?{parent:IS(b,r)}:{},...w?{label:{x:Wt(w.x),y:Wt(w.y),width:Wt(w.width),height:Wt(w.height)}}:{},..._==="bpmn:Group"?fm(pm(b)):{}},T=m.isHorizontal!==!1,$=typeof(b==null?void 0:b.name)=="string"?b.name:"";o.has(E)&&T&&$&&(P.label=Xu(P,$)),t.push(P);continue}const y=m.waypoint;if(Array.isArray(y)){const S=Lt((u=Lt(m.label))==null?void 0:u.bounds);n.push({id:E,type:_,waypoints:y.map(w=>{var P,T;return{x:Wt((P=Lt(w))==null?void 0:P.x),y:Wt((T=Lt(w))==null?void 0:T.y)}}),endpoints:OS(b),...DS(b),...S?{label:{x:Wt(S.x),y:Wt(S.y),width:Wt(S.width),height:Wt(S.height)}}:{}})}}}return{shapes:t,edges:n}}function ym(e){return gt(gm(e),{includeObservationOnly:!0})}async function LS(e){const{definitions:t,warnings:n}=await Oo(e);return{findings:ym(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=Lt(o.label),b=Ki(o.source),E=Ki(o.target);n.push({id:o.id,type:a,waypoints:s.map(_=>({x:Wt(_.x),y:Wt(_.y)})),endpoints:[b,E].filter(_=>!!_),...b&&E?{source:b,target:E}:{},...m&&typeof m.x=="number"?{label:{x:m.x,y:Wt(m.y),width:Wt(m.width),height:Wt(m.height)}}:{}});continue}if(typeof o.x!="number"||typeof o.y!="number")continue;const c=Lt(o.businessObject),l=Lt(o.label);let u=Lt(o.parent);for(;u&&u.type==="bpmn:Lane";)u=Lt(u.parent);const p=typeof(u==null?void 0:u.type)=="string"?u.type:"",f=u&&Zs.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:Wt(o.width),height:Wt(o.height),container:Zs.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:Wt(l.y),width:Wt(l.width),height:Wt(l.height)}}:{},...a==="bpmn:Group"?fm(pm(c)):{}},h=typeof(c==null?void 0:c.name)=="string"?c.name:"";a==="bpmn:Participant"&&!(c!=null&&c.processRef)&&h&&((i=Lt(o.di))==null?void 0:i.isHorizontal)!==!1&&(d.label=Xu(d,h)),t.push(d)}return{shapes:t,edges:n}}const BS={"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 NS(e,t){const n=BS[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 bm(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 NS(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 Pu(r)}}}const ep=20,$S=4,Dt=(e,t)=>Math.abs(e-t)<.5;function rc(e,t,n,i=ep){if(Dt(e.y,t.y)&&!Dt(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(Dt(e.x,t.x)&&!Dt(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 xm(e,t,n,i=ep){if(n.length<2)return null;if(Dt(e.y,t.y)&&!Dt(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(Dt(e.x,t.x)&&!Dt(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 _m(e,t,n=ep){if(e.length!==4)return null;const[i,r,o,a]=e;if(Dt(i.y,r.y)&&Dt(r.x,o.x)&&Dt(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(Dt(i.x,r.x)&&Dt(r.y,o.y)&&Dt(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 oc(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 wm=30,FS=[0,-25,25,-40,40];function jS(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+wm:s-wm,l=a?i.y+i.height:i.y,u=n.x+n.width/2,p=i.x+i.width/2;return FS.map(f=>[{x:u,y:s},{x:u,y:c},{x:p+f,y:c},{x:p+f,y:l}])}const tp=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],Fo=(e,t,n)=>bn({...e,waypoints:t},n).length;function np(e,t,n,i){let r=[...e.waypoints],o=Fo(e,r,t);if(o===0)return null;let a=!1;for(const p of oc(e,t))if(Fo(e,p,t)===0)return p;const s=(i??[]).filter(p=>p.id!==e.id).flatMap(dn),c=p=>dn({...e,waypoints:p}).some(f=>ec(f,s).length>0),l=jS(e,t).filter(p=>Fo(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&&Dt(p.y+p.height/2,f.y+f.height/2)){const d=[r[0],r[r.length-1]];if(Dt(d[0].y,d[1].y)&&!Dt(d[0].x,d[1].x)){const h=t.filter(_=>!e.endpoints.includes(_.id)&&bn({...e,waypoints:d},[_]).length>0),m=h.length>=2?xm(d[0],d[1],h):null,E=(m?m.map(_=>[d[0],..._,d[1]]):h.length===1?(rc(d[0],d[1],h[0])??[]).map(_=>[d[0],..._,d[1]]):h.length===0?[d]:[]).filter(_=>Fo(e,_,t)===0&&_.length<=r.length).sort((_,g)=>Number(u(g))-Number(u(_)));if(E.length)return E.find(_=>!c(_))??E[0]}}}for(let p=0;p+1<r.length;p++){const f=r[p],d=r[p+1],h=t.filter(E=>!e.endpoints.includes(E.id)&&bn({...e,waypoints:[f,d]},[E]).length>0);if(h.length<2)continue;const m=xm(f,d,h);if(!m)continue;const b=m.map(E=>tp(r,p,E)).filter(E=>Fo(e,E,t)===0).sort((E,_)=>Number(u(_))-Number(u(E)));if(b.length)return b.find(E=>!c(E))??b[0]}for(let p=0;p<$S&&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 b of t){if(e.endpoints.includes(b.id)||bn({...e,waypoints:[h,m]},[b]).length===0)continue;const E=rc(h,m,b),_=E?E.map(y=>tp(r,d,y)):_m(r,b)??[];if(!_.length)continue;const g=[..._].sort((y,S)=>Number(u(S))-Number(u(y)));for(const y of g){const S=Fo(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 ip(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Xe(i),a=ni(o),s=new Set,c=gt(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=np(p,a,h,o.edges);if(!m){bn(p,a).some(g=>g.type==="bpmn:TextAnnotation")&&s.add(u);continue}const b=o.edges.filter(g=>g.id!==u),E=ei(p,b);ei({...p,waypoints:m},b)>E||r.updateWaypoints(f,m)}return s}const HS=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},rp=(e,t)=>ka(e,[t])>0;function Em(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Xe(i),a=ni(o);let s=o;const c=new Set(gt(o).map(ft));for(const[l,u]of ic(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($=>$.id===p),h=s.edges.find($=>$.id===f);if(!d||!h)continue;const m=i.get(p);if(!m)continue;const b=m.parent,E=b&&typeof b.x=="number"&&typeof b.width=="number"?{x:b.x,y:b.y,width:b.width,height:b.height}:void 0,_=HS(h),g=[...oc(d,a)??[]],y=np(d,[...a,..._],E,o.edges);y&&g.push(y);for(let $=0;$+1<d.waypoints.length;$++)for(const k of _)for(const D of rc(d.waypoints[$],d.waypoints[$+1],k)??[])g.push(tp(d.waypoints,$,D));const S=s.edges.filter($=>$.id!==p),w=$=>({...s,edges:s.edges.map(k=>k.id===p?{...k,waypoints:$}:k)}),P=$=>!E||$.every(k=>k.x>=E.x&&k.x<=E.x+E.width&&k.y>=E.y&&k.y<=E.y+E.height),T=g.find($=>{const k={...d,waypoints:$};return rp(k,h)||!P($)||S.some(D=>D.id!==f&&!rp(d,D)&&rp(k,D))?!1:gt(w($)).every(D=>c.has(ft(D)))});if(T){r.updateWaypoints(m,T),s=w(T);break}}}const zS=10;function Sm(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 Rm(e,t){if(e.waypoints.length<2||e.endpoints.length!==2)return null;const n=t.shapes.filter(H=>H.type==="bpmn:Participant"&&H.container),i=t.shapes.find(H=>H.id===e.endpoints[0]),r=t.shapes.find(H=>H.id===e.endpoints[1]);if(!i||!r)return null;const o=Sm(i,n),a=Sm(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(H=>H.id!==o.id&&H.id!==a.id&&H.y>=c.y+c.height&&H.y+H.height<=l.y).sort((H,Q)=>H.y-Q.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,b=s?h:d,E=e.waypoints[0],_=e.waypoints[e.waypoints.length-1],g=ni(t),y=t.edges.filter(H=>H.id!==e.id),S=ti(e,y),w=bn(e,g).length;if(S===0&&w===0||w===0&&e.waypoints.length===2)return null;const P=Math.min(...u.map(H=>H.x)),T=Math.max(...u.map(H=>H.x+H.width)),$=(E.x+_.x)/2,k=H=>H.filter((Q,fe)=>fe===0||!(Dt(Q.x,H[fe-1].x)&&Dt(Q.y,H[fe-1].y)));let D;for(let H=P;H<=T;H+=zS){const Q=k([E,{x:E.x,y:m},{x:H,y:m},{x:H,y:b},{x:_.x,y:b},_]),fe={...e,waypoints:Q};if(bn(fe,g).length>0)continue;const Me=ti(fe,y),Be=Math.abs(H-$);(!D||Me<D.cross||Me===D.cross&&Be<D.detour)&&(D={pts:Q,cross:Me,detour:Be})}return D&&(w>0?D.cross<=S:D.cross<S)?D.pts:null}function Cm(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=Rm(s,a);if(!c)continue;const l=n.get(o.id);l&&i.updateWaypoints(l,c)}}const Di=[25,-25,40,-40],jo=35;function GS(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)-jo:Math.max(e.y+e.height,t.y+t.height)+jo;for(const l of[0,...Di])if(!(Math.abs(l)>=e.width/2-5))for(const u of[0,...Di]){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 ac(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 GS(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-jo:n.y+n.height+jo,p=[];for(const _ of[0,...Di]){if(Math.abs(_)>=i.width/2-5)continue;const g=o+_;p.push({pts:[{x:n.x,y:r},{x:g,y:r},{x:g,y:c}],cost:Math.abs(_)});for(const y of[0,...Di]){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(_)+Math.abs(y)})}}const f=50,d=i.y+i.height/2,h=s?n.y+n.height:n.y;for(const _ of[0,...Di]){if(Math.abs(_)>=n.width/2-5)continue;const g=a+_;p.push({pts:[{x:g,y:h},{x:g,y:d},{x:i.x+i.width,y:d}],cost:f+Math.abs(_)})}const m=60,b=s?i.y+i.height:i.y,E=s?i.y+i.height+jo:i.y-jo;for(const _ of[0,...Di]){if(Math.abs(_)>=i.width/2-5)continue;const g=o+_;for(const y of[0,...Di]){if(Math.abs(y)>=n.width/2-5)continue;const S=a+y;p.push({pts:[{x:S,y:h},{x:S,y:E},{x:g,y:E},{x:g,y:b}],cost:m+Math.abs(_)+Math.abs(y)})}}return p}const sc=30;function Mm(e,t){for(let n=1;n<e.length-2;n++){const i=e[n],r=e[n+1],o=Dt(i.y,r.y)&&!Dt(i.x,r.x),a=Dt(i.x,r.x)&&!Dt(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)<sc||Math.abs(i.y-(s.y+s.height))<sc)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)<sc||Math.abs(i.x-(s.x+s.width))<sc)return!0}}return!1}const cc=40;function VS(e,t,n){let i=0;for(const r of t){if(r.container||n.includes(r.id))continue;const o=r.x-cc,a=r.x+r.width+cc,s=r.y-cc,c=r.y+r.height+cc;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 Am(e,t){if(e.type!=="bpmn:SequenceFlow")return null;const n=t.shapes.filter(w=>w.container),i=new Map(t.shapes.map(w=>[w.id,w])),r=ni(t),o=t.edges.filter(w=>w.id!==e.id),a=ei(e,o),s=ti(e,o),c=w=>VS(w,t.shapes,e.endpoints)+(Mm(w,n)?1:0),l=c(e.waypoints),u=w=>{if(!w)return;const P=w.x+w.width/2,T=w.y+w.height/2;return n.find($=>$.type==="bpmn:Lane"&&P>=$.x&&P<=$.x+$.width&&T>=$.y&&T<=$.y+$.height)},p=u(i.get(e.endpoints[0]??"")),f=u(i.get(e.endpoints[1]??"")),d=!!p&&!!f&&p.id!==f.id,h=w=>{if(!d||!f)return!1;for(let P=1;P<w.length-2;P++){const T=w[P],$=w[P+1];if(Dt(T.y,$.y)&&!Dt(T.x,$.x)&&T.y>f.y&&T.y<f.y+f.height)return!0}return!1},m=h(e.waypoints),E=(w=>{if(!w)return;const P=w.x+w.width/2,T=w.y+w.height/2;return n.filter($=>$.type==="bpmn:Participant"&&P>=$.x&&P<=$.x+$.width&&T>=$.y&&T<=$.y+$.height).sort(($,k)=>$.width*$.height-k.width*k.height)[0]})(i.get(e.endpoints[0]??"")),_=w=>{if(!E)return 0;let P=0;for(let T=1;T<w.length-1;T++){const $=w[T];($.x<E.x||$.x>E.x+E.width||$.y<E.y||$.y>E.y+E.height)&&P++}return P},g=_(e.waypoints);if(!Mm(e.waypoints,n)&&!(d&&!m)&&g===0)return null;const y=w=>w.reduce((P,T,$)=>$?P+Math.abs(T.x-w[$-1].x)+Math.abs(T.y-w[$-1].y):0,0);let S;for(const{pts:w,cost:P}of ac(e,i)){const T={...e,waypoints:w};if(bn(T,r).length>0)continue;const $=ei(T,o);if($>a)continue;const k=_(w);if(k>g)continue;const D=k<g&&$===0;if(!D&&ti(T,o)>s)continue;const H=c(w),Q=h(w);if(!D&&!(Q&&!m)&&H>=l)continue;const Me=Q?0:1,Be=y(w);(!S||k<S.out||k===S.out&&(Me<S.lane||Me===S.lane&&($<S.opp||$===S.opp&&(H<S.sc||H===S.sc&&(P<S.cost||P===S.cost&&Be<S.len)))))&&(S={pts:w,out:k,sc:H,lane:Me,opp:$,cost:P,len:Be})}return(S==null?void 0:S.pts)??null}function WS(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 US(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(b=>b.id===a);if(!c||c.waypoints.length<4)continue;const l=ni(s),u=s.edges.filter(b=>b.id!==a),p=bn(c,l).length,f=ei(c,u),d=ti(c,u),h=n.has(a)?new Set(gt(s).map(ft)):null,m=oc(c,s.shapes);m.length===2&&WS(c,s)&&m.reverse();for(const b of m){if(b.length>=c.waypoints.length)continue;const E={...c,waypoints:b};if(bn(E,l).length>p||ei(E,u)>f||ti(E,u)>d)continue;if(h){const g=new Set(gt({...s,edges:s.edges.map(w=>w.id===a?E:w)}).map(ft)),y=[...g].filter(w=>!h.has(w)).length,S=[...h].filter(w=>!g.has(w)).length;if(y>S)continue}const _=i.get(a);_&&r.updateWaypoints(_,b);break}}}function Pm(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=Am(s,a);if(!c)continue;const l=n.get(o);l&&i.updateWaypoints(l,c)}}function op(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=Dt(n[0].x,n[1].x)&&!Dt(n[0].y,n[1].y),s=Dt(n[n.length-1].x,n[n.length-2].x)&&!Dt(n[n.length-1].y,n[n.length-2].y);for(const c of Di){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 YS(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,b=[];for(const E of[0,...Di])Math.abs(E)<i.width/2-5&&b.push({pts:[{x:f,y:l},{x:u+E,y:l},{x:u+E,y:m}],cost:Math.abs(E)}),Math.abs(E)<i.height/2-5&&b.push({pts:[{x:c,y:d},{x:c,y:p+E},{x:h,y:p+E}],cost:Math.abs(E)});return b}function ap(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,...Di]){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 Tm(e,t){const n=new Map(t.shapes.map(d=>[d.id,d])),i=ni(t),r=t.edges.filter(d=>d.id!==e.id),o=ei(e,r);if(o===0)return null;const a=ti(e,r);let s;const c=d=>d.reduce((h,m,b)=>b?h+Math.abs(m.x-d[b-1].x)+Math.abs(m.y-d[b-1].y):0,0),l=3,u=d=>{const h=d[0],m=d[d.length-1],b=Math.hypot(m.x-h.x,m.y-h.y);return b>=1&&c(d)/b>=l?1:0},p=u(e.waypoints),f=[...ac(e,n),...ap(e,n),...op(e,n)];for(const{pts:d,cost:h}of f){const m={...e,waypoints:d};if(bn(m,i).length>0)continue;const b=ei(m,r),E=ti(m,r),_=o-b+(p-u(d));if(b>=o||E-a>_)continue;const g=c(d);(!s||b<s.opposite||b===s.opposite&&(E<s.cross||E===s.cross&&(h<s.cost||h===s.cost&&g<s.len)))&&(s={pts:d,opposite:b,cross:E,cost:h,len:g})}return(s==null?void 0:s.pts)??null}function km(e,t){var i;let n=0;for(const r of t)r.id!==e.id&&((i=Bo(e,r))==null?void 0:i.kind)==="unrelated"&&n++;return n}function qS(e,t){const n=new Map(t.shapes.map(f=>[f.id,f])),i=ni(t),r=t.edges.filter(f=>f.id!==e.id),o=km(e,r);if(o===0)return null;const a=ei(e,r),s=ti(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=[...ac(e,n),...ap(e,n),...YS(e,n),...op(e,n)];for(const{pts:f,cost:d}of p){const h={...e,waypoints:f};if(bn(h,i).length>0)continue;const m=km(h,r);if(m>=o)continue;const b=ei(h,r);if(b-m>a-o)continue;const E=ti(h,r);if(E-s>(o-m)*l)continue;const _=c(f);(!u||m<u.fake||m===u.fake&&(b<u.unreadable||b===u.unreadable&&(E<u.cross||E===u.cross&&(d<u.cost||d===u.cost&&_<u.length))))&&(u={pts:f,fake:m,unreadable:b,cross:E,cost:d,length:_})}return(u==null?void 0:u.pts)??null}function Om(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=gt(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=qS(l,c);if(!u)continue;const p=i.get(s);p&&r.updateWaypoints(p,u)}}function Dm(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 Im(e,t,n){var l;if(e.type!=="bpmn:SequenceFlow"||t.type!=="bpmn:SequenceFlow"||((l=Bo(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:Dm(e,n)&&Dm(t,n)}function Lm(e,t,n){let i=0;for(const r of t)r.id!==e.id&&Im(e,r,n)&&i++;return i}function KS(e,t){const n=new Map(t.shapes.map(f=>[f.id,f])),i=ni(t),r=t.edges.filter(f=>f.id!==e.id),o=Lm(e,r,n);if(o===0)return null;const a=ei(e,r),s=ti(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=[...ac(e,n),...ap(e,n),...op(e,n)];for(const{pts:f,cost:d}of p){const h={...e,waypoints:f};if(bn(h,i).length>0)continue;const m=Lm(h,r,n);if(m>=o)continue;const b=ei(h,r);if(b-m>a-o)continue;const E=ti(h,r);if(E-s>(o-m)*l)continue;const _=c(f);(!u||m<u.chain||m===u.chain&&(b<u.unreadable||b===u.unreadable&&(E<u.cross||E===u.cross&&(d<u.cost||d===u.cost&&_<u.length))))&&(u={pts:f,chain:m,unreadable:b,cross:E,cost:d,length:_})}return(u==null?void 0:u.pts)??null}function XS(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Xe(i),a=new Map(o.shapes.map(l=>[l.id,l])),s=gt(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||!Im(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=KS(p,u);if(!f)continue;const d=i.get(l);d&&r.updateWaypoints(d,f)}}function Bm(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Xe(i),a=gt(o).filter(u=>Zu(u)&&!t.has(ft(u)));if(!a.length)return;const s=new Set;for(const u of a)if(Zu(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=Tm(f,p);if(!d)continue;const h=i.get(u);h&&r.updateWaypoints(h,d)}}const ZS=10,QS=(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 Nm(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!tc(e,i))return null;const r=ni(t),o=i.flatMap(dn);for(const a of dn(e)){let s=[[a.lo,a.hi]];for(const[d,h]of ec(a,o))s=s.flatMap(([m,b])=>{const E=[];return d>m&&E.push([m,Math.min(b,d)]),h<b&&E.push([Math.max(m,h),b]),E.filter(([_,g])=>g>_)});const c=a.axis==="h"?n.width:n.height,l=s.find(([d,h])=>h-d>=c+ZS*2);if(!l)continue;const u=(l[0]+l[1])/2,p=a.axis==="h"?{x:u,y:a.at-nm}:{x:a.at+xn+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(!tc({...e,label:f},i)&&!r.some(d=>!e.endpoints.includes(d.id)&&QS(f,d)))return f}return null}const xn=8;function sp(e,t){const n=e.label;if(!n)return null;const i=dn(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(dn),...t.shapes.filter(f=>f.container).flatMap($o)],l=f=>!c.some(d=>Oi(f,d));if(l(n))return null;const u=(s.axis==="v"?n.height:n.width)+xn,p=[0,-u,u,-2*u,2*u];if(s.axis==="v")for(const f of[s.at+xn,s.at-xn-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-xn-n.height,s.at+xn])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 $m=30,JS=(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},Fm=(e,t)=>JS({x:e.x+e.width/2,y:e.y+e.height/2},t);function eR(e,t){const n=e.label;if(!n)return null;const i=dn(e);if(!i.length)return null;const r=[...i,...t.edges.filter(c=>c.id!==e.id).flatMap(dn),...t.shapes.filter(c=>c.container).flatMap($o)],o=to(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=>Oi(c,l))&&!Oa(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+xn,c.at-xn-n.height].map(p=>({...n,x:l-n.width/2,y:p})):[c.at+xn,c.at-xn-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 jm(e,t){var a,s;const{elementRegistry:n}=e,i=e.modeling;let r=Xe(n),o=new Set(gt(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((w,P)=>w.x-u[P].x===d&&w.y-u[P].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 w=r.edges.find(D=>D.id===c);if(!(w!=null&&w.label)||!Oa(w.label,r).length)continue;let P={...w.label,x:l.label.x,y:l.label.y};if((Oa(P,r).length||Fm(P,w.waypoints)>$m)&&(P=null),!P&&Fm(w.label,w.waypoints)>$m&&(P=eR(w,r)),!P)continue;const T=P,$={...r,edges:r.edges.map(D=>D.id===c?{...D,label:T}:D)},k=gt($);if(k.some(D=>!o.has(ft(D))))continue;i.moveElements([f],{x:T.x-f.x,y:T.y-f.y}),r=$,o=new Set(k.map(ft));continue}const b=l.label.x+d-f.x,E=l.label.y+h-f.y;if(b===0&&E===0)continue;const _=r.edges.find(w=>w.id===c);if(!(_!=null&&_.label))continue;const g={..._.label,x:_.label.x+b,y:_.label.y+E},y={...r,edges:r.edges.map(w=>w.id===c?{...w,label:g}:w)},S=gt(y);S.some(w=>!o.has(ft(w)))||(i.moveElements([f],{x:b,y:E}),r=y,o=new Set(S.map(ft)))}}function Hm(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Xe(n);for(const o of r.edges){if(!o.label||t.has(o.id))continue;const a=sp(o,r);if(!a)continue;const s=n.get(o.id),c=s==null?void 0:s.label;c&&i.moveElements([c],{x:a.x-c.x,y:a.y-c.y})}}function zm(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Xe(i),a=gt(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=Nm(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 Gm(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(dn),...t.shapes.filter(f=>f.container).flatMap($o)],r=i.filter(f=>Oi(n,f));if(!r.length)return null;const o=t.shapes.filter(f=>!f.container&&f.id!==e.id),a=to(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=>Oi(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-xn-n.height},{...n,y:f.at+xn}):l.push({...n,x:f.at-xn-n.width},{...n,x:f.at+xn});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+xn},{...n,x:u-n.width/2,y:e.y-xn-n.height},{...n,x:e.x+e.width+xn,y:p-n.height/2},{...n,x:e.x-xn-n.width,y:p-n.height/2}),l.find(c)??null}function Vm(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=Gm(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 tR(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 Wm(e,t){const{elementRegistry:n}=e,i=e.modeling;let r=Xe(n),o=new Set(gt(r).map(ft));const a=[...new Set(gt(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,b]of u){const E=m?r.shapes.find(g=>g.id===m):void 0;if(!E)continue;const _=tR(E,l[b]);_.x===l[b].x&&_.y===l[b].y||(l[b]=_,p=!0)}if(!p)continue;const f={...r,edges:r.edges.map(m=>m.id===s?{...m,waypoints:l}:m)},d=gt(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 nR=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,Um=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),Ym={"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}]},lc=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),cp=e=>typeof e=="string"&&e!=="";function iR(e){const t=[];function n(i,r,o,a){if(a===null){cp(o)||t.push({kind:"payload-invalid",opIndex:i,field:r});return}if(!lc(o)){t.push({kind:"payload-invalid",opIndex:i,field:r});return}for(const s of a)cp(o[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${r}.${s}`})}return e.forEach((i,r)=>{var o,a,s;if(!lc(i)||!cp(i.kind)||!(i.kind in Ym)){t.push({kind:"payload-invalid",opIndex:r,field:"kind"});return}for(const c of Ym[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(!lc(f))break;f=f[h]}if(!lc(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"&&!bh(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&&!xh(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 qm(e,t){const n=iR(e);if(n.length>0)return n;const i=[],r=new Map,o=new Map;function a(h,m,b){if(!nR.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,{...b,opIndex:h})}e.forEach((h,m)=>{var b;switch(h.kind){case"participant.add":a(m,h.participant.id,{category:"participant",lanes:(h.participant.lanes??[]).map(E=>E.id)});for(const E of h.participant.lanes??[])a(m,E.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 E of h.associations??[])E.id&&a(m,E.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"}),(b=h.association)!=null&&b.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(E=>E.id));for(const E of h.lanes)t.categoryOf(E.id)===void 0&&a(m,E.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,b,E){const _=s(m);if(_===void 0){i.push({kind:"ref-missing",opIndex:h,ref:m,role:b});return}if(E&&!E.includes(_)){i.push({kind:"ref-category",opIndex:h,ref:m,role:b,expected:E.join("|"),actual:_});return}return _}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 b;switch(h.kind){case"participant.add":break;case"node.add":{const{participant:E,lane:_}=h.node;if(E===void 0){(u||_!==void 0)&&i.push({kind:"participant-required",opIndex:m,id:h.node.id});break}if(l(m,E,"participant",["participant"])===void 0)break;_!==void 0&&((((b=r.get(E))==null?void 0:b.lanes)??o.get(E)??t.lanesOf(E)).includes(_)||i.push({kind:"lane-unknown",opIndex:m,lane:_,participant:E}));break}case"sequenceFlow.add":{const{id:E,source:_,target:g,name:y,condition:S}=h.flow,w=l(m,_,"source",["flowNode"]),P=l(m,g,"target",["flowNode"]);w&&P&&c(_)!==c(g)&&i.push({kind:"flow-cross-pool",opIndex:m,id:E}),y!==void 0&&S!==void 0&&i.push({kind:"condition-name-conflict",opIndex:m,id:E});break}case"messageFlow.add":{const{id:E,source:_,target:g}=h.flow,y=l(m,_,"source",["flowNode","participant"]),S=l(m,g,"target",["flowNode","participant"]);if(y&&S){const w=c(_),P=c(g);w!==void 0&&w===P&&i.push({kind:"message-flow-same-pool",opIndex:m,id:E})}for(const w of[_,g])f(w)&&i.push({kind:"message-flow-timer-endpoint",opIndex:m,id:E,ref:w});break}case"dataStore.add":{for(const E of h.associations??[]){if([E.source,E.target].filter(y=>y===h.dataStore.id).length!==1){i.push({kind:"data-association-ends",opIndex:m,source:E.source,target:E.target});continue}const g=E.source===h.dataStore.id?E.target:E.source;l(m,g,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:E,target:_}=h.association,g=l(m,E,"source"),y=l(m,_,"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:E,target:_})}break}case"association.add":{const{id:E,source:_,target:g}=h.association,y=l(m,_,"source"),S=l(m,g,"target");y&&S&&y!=="annotation"&&S!=="annotation"&&i.push({kind:"association-detached",opIndex:m,annotation:E??`${_}->${g}`});break}case"annotation.add":{if(h.association){const{source:E,target:_}=h.association;if(E!==h.annotation.id&&_!==h.annotation.id)i.push({kind:"association-detached",opIndex:m,annotation:h.annotation.id});else{const g=E===h.annotation.id?_:E;l(m,g,"association")}}h.placement&&l(m,h.placement.anchor,"anchor");break}case"group.add":{for(const E of h.group.members??[]){const _=l(m,E,"member");_&&Um.has(_)&&i.push({kind:"ref-category",opIndex:m,ref:E,role:"member",expected:"shape",actual:_})}break}case"participant.update":{if(d(m,h.id,"participant")===void 0)break;if(h.lanes){const E=t.lanesOf(h.id),_=h.lanes.map(y=>y.id);for(const y of E)_.includes(y)||i.push({kind:"lane-shrink-unsupported",opIndex:m,participant:h.id,lane:y});for(const y of _)t.categoryOf(y)!==void 0&&!E.includes(y)&&i.push({kind:"id-duplicate",opIndex:m,id:y});const g=_.filter(y=>E.includes(y));g.length===E.length&&g.some((y,S)=>y!==E[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 E=t.participantOf(h.id);(E?o.get(E)??t.lanesOf(E):[]).includes(h.lane)||i.push({kind:"lane-unknown",opIndex:m,lane:h.lane,participant:E??""})}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 E=h.source===void 0||l(m,h.source,"source",["flowNode"])!==void 0,_=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);E&&_&&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 E of h.members??[]){const _=l(m,E,"member");_&&Um.has(_)&&i.push({kind:"ref-category",opIndex:m,ref:E,role:"member",expected:"shape",actual:_})}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,b){if(r.has(m)){i.push({kind:"target-added-in-batch",opIndex:h,id:m});return}const E=t.categoryOf(m);if(E===void 0){i.push({kind:"ref-missing",opIndex:h,ref:m,role:"target"});return}if(b&&E!==b){i.push({kind:"ref-category",opIndex:h,ref:m,role:"target",expected:b,actual:E});return}return E}}function Km(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 uc(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const pc={"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]},_n=10,rR=300,oR=160,Xm=20,Zm=40,aR=10;function lp(e,t,n,i,r){const o=n,a=(k,D)=>{const[H,Q]=pc[k];let fe={x:t.x+t.width/2+H*(t.width/2+o.width/2+D),y:t.y+t.height/2+Q*(t.height/2+o.height/2+D)};const Me=i.x+_n+o.width/2,Be=i.x+i.width-_n-o.width/2,it=i.y+_n+o.height/2,X=i.y+i.height-_n-o.height/2,ee={x:Math.min(Be,Math.max(Me,fe.x)),y:Math.min(X,Math.max(it,fe.y))};return(ee.x!==fe.x||ee.y!==fe.y)&&(fe=Math.abs(ee.x-(t.x+t.width/2))<(t.width+o.width)/2+_n&&Math.abs(ee.y-(t.y+t.height/2))<(t.height+o.height)/2+_n?{x:t.x+t.width+_n+o.width/2,y:ee.y}:ee),fe},s=(i.children??[]).filter(k=>!("waypoints"in k&&k.waypoints)&&k.type!=="bpmn:Lane"&&k.type!=="label"&&typeof k.x=="number"&&k.id!==r.selfId),c=Xe(e),l=k=>{var H,Q;if(!r.selfId)return!1;const D=e.get(k);return!!D&&(((H=D.source)==null?void 0:H.id)===r.selfId||((Q=D.target)==null?void 0:Q.id)===r.selfId)},u=c.edges.filter(k=>!l(k.id)).flatMap(dn),p=to(c).filter(k=>k.owner!==r.selfId).map(k=>k.rect),f=k=>({x0:k.x-o.width/2-_n,x1:k.x+o.width/2+_n,y0:k.y-o.height/2-_n,y1:k.y+o.height/2+_n}),d=k=>{const D=f(k);return s.some(H=>D.x0<H.x+H.width&&D.x1>H.x&&D.y0<H.y+H.height&&D.y1>H.y)},h=k=>{const D=f(k);return u.some(H=>H.axis==="h"?H.at>D.y0&&H.at<D.y1&&H.lo<D.x1&&H.hi>D.x0:H.at>D.x0&&H.at<D.x1&&H.lo<D.y1&&H.hi>D.y0)},m=k=>{const D=f(k);return p.some(H=>D.x0<H.x+H.width&&D.x1>H.x&&D.y0<H.y+H.height&&D.y1>H.y)},b=c.shapes.filter(k=>k.type==="bpmn:Group").flatMap(k=>[{axis:"h",at:k.y,lo:k.x,hi:k.x+k.width},{axis:"h",at:k.y+k.height,lo:k.x,hi:k.x+k.width},{axis:"v",at:k.x,lo:k.y,hi:k.y+k.height},{axis:"v",at:k.x+k.width,lo:k.y,hi:k.y+k.height}]),E=k=>{const D=f(k);return b.some(H=>H.axis==="h"?H.at>D.y0&&H.at<D.y1&&H.lo<D.x1&&H.hi>D.x0:H.at>D.x0&&H.at<D.x1&&H.lo<D.y1&&H.hi>D.y0)},_=k=>d(k)||h(k)||m(k)||E(k),g=k=>k.x-o.width/2>=i.x&&k.x+o.width/2<=i.x+i.width&&k.y-o.height/2>=i.y&&k.y+o.height/2<=i.y+i.height;if(r.placement){const k=Be=>Be.startsWith("top")?Be.replace(/^top/,"bottom"):Be.replace(/^bottom/,"top"),D=Be=>Be.endsWith("left")?Be.replace(/left$/,"right"):Be.replace(/right$/,"left"),H=r.placement.side,Q=[H,k(H),D(H),k(D(H)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],fe=r.placement.offset??50;let Me=a(H,fe);if(_(Me)){const Be=new Set;for(const it of Q){if(Be.has(it))continue;Be.add(it);const X=a(it,fe);if(g(X)&&!_(X)){Me=X;break}}}return Me}const y=r.from,S=i.x+_n+o.width/2,w=i.x+i.width-_n-o.width/2,P=i.y+_n+o.height/2,T=i.y+i.height-_n-o.height/2;let $={x:Math.min(w,Math.max(S,y.x)),y:Math.min(T,Math.max(P,y.y))};if(_($)){const k=(t.width+o.width)/2+_n,H=[{x:$.x+k,y:$.y},{x:$.x-k,y:$.y},{x:$.x,y:$.y-o.height-_n},{x:$.x,y:$.y+o.height+_n}].filter(g).find(Q=>!_(Q));H&&($=H)}return $}function Xt(e,t){return e.filter(n=>n.kind===t)}class Qm extends Error{constructor(t){super(t.kind),this.issue=t,this.name="LowerIssueError"}}function Jm(e,t){var W0,U0,Y0,q0,K0,X0,Z0,Q0,J0,eE,tE,nE,iE,rE,oE,aE,sE,cE,lE,uE,pE,fE,dE;const{modeling:n,bpmnFactory:i,elementFactory:r,elementRegistry:o,canvas:a,autoPlace:s,bpmnReplace:c,spaceTool:l}=t,u=()=>a.getRootElement(),p=v=>o.get(v),f=v=>{const C=p(v);if(!C)throw new Error(`하강 참조 해소 실패: ${v}`);return C},d=v=>{let C=v.parent;for(;C;){if(C.type==="bpmn:Participant")return C;C=C.parent}},h=new Map;for(const v of o.filter(C=>!("waypoints"in C&&C.waypoints)&&C.type!=="bpmn:Lane"&&C.type!=="label"&&typeof C.x=="number"))h.set(v.id,{x:v.x,y:v.y});const m=Xt(e,"participant.add"),b=Xt(e,"node.add"),E=Xt(e,"sequenceFlow.add"),_=Xt(e,"messageFlow.add"),g=Xt(e,"dataStore.add"),y=Xt(e,"dataAssociation.add"),S=Xt(e,"annotation.add"),w=Xt(e,"group.add"),P=new Map(b.map(v=>[v.node.id,v])),T=(v,C,A)=>{var F;const O=v.businessObject,N=(((F=O.extensionElements)==null?void 0:F.values)??[]).filter(L=>L.$type!==C),I=A?[...N,i.create(C,A)]:N;if(!I.length){O.extensionElements&&n.updateProperties(v,{extensionElements:void 0});return}const j=i.create("bpmn:ExtensionElements",{values:I});I.forEach(L=>{L.$parent=j}),n.updateProperties(v,{extensionElements:j})},$=v=>({anchor:v.anchor,side:v.side,...v.offset!==void 0?{offset:v.offset}:{}});for(const v of Xt(e,"element.remove")){const C=p(v.id);C&&n.removeElements([C])}const k=v=>o.filter(C=>{var A;return C.type==="bpmn:Lane"&&((A=d(C))==null?void 0:A.id)===v}).sort((C,A)=>C.y-A.y);for(const v of Xt(e,"participant.update")){const C=f(v.id);if(v.name!==void 0&&n.updateProperties(C,{name:v.name??void 0}),!v.lanes)continue;const A=k(v.id);if(!A.length){n.splitLane(C,v.lanes.length),k(v.id).forEach((N,I)=>{const j=v.lanes[I];j&&n.updateProperties(N,{id:j.id,name:j.name})});continue}const O=new Set(A.map(N=>N.id));v.lanes.forEach((N,I)=>{if(O.has(N.id)){n.updateProperties(f(N.id),{name:N.name});return}const j=I===0?n.addLane(k(v.id)[0],"top"):n.addLane(f(v.lanes[I-1].id),"bottom");n.updateProperties(j,{id:N.id,name:N.name})})}const D=150,H=130,Q=80,fe=90,Me=180,Be=30,it=30,X=(v,C,A,O,N)=>{const I=A-C.width/2,j=O-C.height/2;return(v.children??[]).find(F=>!("waypoints"in F&&F.waypoints)&&F.type!=="bpmn:Lane"&&F.type!=="label"&&!(N!=null&&N.has(F.id))&&typeof F.x=="number"&&I<F.x+F.width+it&&I+C.width+it>F.x&&j<F.y+F.height&&j+C.height>F.y)},ee=new Set;for(const v of m){ee.add(`pool:${v.participant.id}`);for(const C of v.participant.lanes??[])ee.add(C.id)}const ue=new Map;for(const v of b){const C=v.node.lane??`pool:${v.node.participant??""}`;let A=ue.get(C);A||ue.set(C,A=new Set([0])),v.band!==void 0&&A.add(v.band)}const be=new Map;for(const[v,C]of ue){if(!ee.has(v))continue;const A=[...C].sort((I,j)=>I-j),O=A.map((I,j)=>j===0?0:j%2===1?Math.ceil(j/2):-(j/2)),N=Math.min(...O);be.set(v,new Map(A.map((I,j)=>[I,O[j]-N])))}{const v=new Map;for(const C of m)(C.participant.lanes??[]).forEach((A,O)=>v.set(A.id,O));for(const[C,A]of be){if(!v.has(C)||A.size<2)continue;const O=v.get(C),N=A.get(0)??0,I=new Set;for(const J of b){if(J.node.lane!==C||(J.band??0)!==0||!J.node.type.endsWith("Gateway"))continue;const he={in:new Set,out:new Set,cross:new Set};for(const ye of E){const Ce=ye.flow.source===J.node.id;if(!Ce&&ye.flow.target!==J.node.id)continue;const pt=P.get(Ce?ye.flow.target:ye.flow.source);if(!pt||pt.node.participant!==J.node.participant||!pt.node.lane)continue;let Oe,K=!1;if(pt.node.lane!==C){const ce=v.get(pt.node.lane);if(ce===void 0)continue;Oe=ce>O?"down":"up",K=!0}else{const ce=A.get(pt.band??0)??N;Oe=ce>N?"down":ce<N?"up":void 0}Oe&&(he[Ce?"out":"in"].add(Oe),K&&he.cross.add(Oe))}for(const ye of["up","down"])he.in.has(ye)&&he.out.has(ye)&&he.cross.has(ye)&&I.add(ye)}if(I.size!==1)continue;const[j]=I,F=Math.max(...A.values()),L=j==="down"?F:0;if(N===L)continue;const W=[...A.entries()].filter(([J])=>J!==0).sort((J,he)=>J[1]-he[1]),re=[...Array(F+1).keys()].filter(J=>J!==L),pe=new Map([[0,L]]);W.forEach(([J],he)=>pe.set(J,re[he])),be.set(C,pe)}}const q=v=>{var C;return(((C=ue.get(v))==null?void 0:C.size)??0)>1},V=v=>v.band??(v.node.lane||!q(`pool:${v.node.participant??""}`)?void 0:0),ie=new Map,Pe=v=>ie.get(v.node.id)??V(v),Te=new Set,B=new Set;{const v=new Map;for(const O of E)v.set(O.flow.target,(v.get(O.flow.target)??0)+1);const C=O=>{const N=[],I=new Set([O]),j=[O];for(;j.length;){const F=j.shift();N.push(F);for(const L of E)L.flow.source!==F||I.has(L.flow.target)||(v.get(L.flow.target)??0)!==1||(I.add(L.flow.target),j.push(L.flow.target))}return N},A=(O,N)=>{var I;return((I=be.get(O))==null?void 0:I.get(N))??N};for(const O of b){if(!O.node.type.endsWith("Gateway"))continue;const N=O.node.lane??`pool:${O.node.participant??""}`,I=be.get(N);if(!I||I.size<2)continue;const j=Pe(O);if(j===void 0||A(N,j)!==A(N,0))continue;const F=A(N,j),L=E.filter(ye=>ye.flow.source===O.node.id).map(ye=>P.get(ye.flow.target)).filter(ye=>!!ye&&(ye.node.lane??`pool:${ye.node.participant??""}`)===N),W=L.filter(ye=>{const Ce=Pe(ye);return Ce!==void 0&&A(N,Ce)===F&&(v.get(ye.node.id)??0)===1}),re=L.some(ye=>{const Ce=Pe(ye);return Ce!==void 0&&A(N,Ce)>F});if(W.length!==1||!re)continue;const pe=new Set(L.flatMap(ye=>C(ye.node.id)));if(!E.some(ye=>ye.flow.target===O.node.id&&pe.has(ye.flow.source)))continue;const he=new Map;for(const[ye,Ce]of I)he.set(ye,Ce+1);he.set(-1,0),be.set(N,he);for(const ye of C(W[0].node.id))P.has(ye)&&(ie.set(ye,-1),B.add(ye));Te.add(O.node.id)}}const R=(v,C)=>{var A;return((A=be.get(v))==null?void 0:A.get(C))??C},x=(v,C,A,O)=>{const N=v?p(v):C?p(C):void 0;if(!N)return!1;const I=v?N.y+Math.min(N.height/2,fe):N.y+Q;return Math.abs(I+R(v??`pool:${C??""}`,A)*D-O)<=D/2},G=new Map;for(const[v,C]of ue){let A=0;for(const O of C)A=Math.max(A,R(v,O));G.set(v,A)}const Y=v=>Me+D*v,Z=(v,C,A)=>{const O=u().children.filter(N=>!("waypoints"in N&&N.waypoints)&&N.id!==C&&typeof N.y=="number"&&N.y>=v);O.length&&n.moveElements(O,{x:0,y:A})},Re=(v,C,A)=>{const O=v.type==="bpmn:Participant"?v:void 0;if(!O||O.children.some(F=>F.type==="bpmn:Lane"))return;const N=A+C.height/2+Be-O.y;if(O.height>=N)return;const I=N-O.height,j=O.y+O.height;n.resizeShape(O,{x:O.x,y:O.y,width:O.width,height:N}),Z(j,O.id,I)},Ze=(v,C)=>{const A=C-v.height;if(A<=0)return;const O=d(v)??v,N=[],I=L=>{N.push(L);for(const W of L.children??[])I(W)};I(O);const j=v.y+v.height-10,F=l.calculateAdjustments(N,"y",A,j);l.makeSpace(F.movingShapes,F.resizingShapes,{x:0,y:A},"s",j)},mt=(v,C,A)=>{if(v){const j=f(v),F=Y(C);if(j.height>=F)return;const L=F-j.height,W=d(j),re=W?W.y+W.height:j.y+j.height;Ze(j,F),Z(re,W==null?void 0:W.id,L);return}if(!A)return;const O=D*(C+1);if(A.height>=O)return;const N=O-A.height,I=A.y+A.height;n.resizeShape(A,{x:A.x,y:A.y,width:A.width,height:O}),Z(I,A.id,N)},Vt=new Map;for(const v of E)Vt.set(v.flow.target,(Vt.get(v.flow.target)??0)+1);const wt=v=>(Vt.get(v)??0)<=1,ln=(v,C)=>{if(!v)return;const A=p(v);if(!A||A.height>=Y(C))return;const O=A.y+A.height-10,N=d(A);if(N)return new Set((N.children??[]).filter(I=>I.type!=="bpmn:Lane"&&typeof I.y=="number"&&I.y>O).map(I=>I.id))},yn=(v,C,A)=>{if(!v)return!0;const O=p(v);return O?A-C.height/2>=O.y&&A+C.height/2<=O.y+O.height:!0},vn=m.map((v,C)=>({op:v,declared:C}));vn.sort((v,C)=>{const A=v.op.order??Number.POSITIVE_INFINITY,O=C.op.order??Number.POSITIVE_INFINITY;return A!==O?A-O:v.declared-C.declared});let Et=80;for(const v of o.getAll())v.parent===u()&&"height"in v&&typeof v.y=="number"&&(Et=Math.max(Et,v.y+v.height+60));for(const{op:v}of vn){const C=v.participant,A=b.filter(J=>J.node.participant===C.id).length,O=((W0=C.lanes)==null?void 0:W0.length)??0,N=Math.max(1200,A*160+300),I=(C.lanes??[]).map(J=>Y(G.get(J.id)??0)),j=I.reduce((J,he)=>J+he,0);O&&j<300&&(I[O-1]+=300-j);const F=Math.max(300,D*((G.get(`pool:${C.id}`)??0)+1)),L=C.blackBox||A+O===0?120:O?Math.max(300,j):F,W=r.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:C.id,name:C.name,...v.order!==void 0?{"bwl:poolOrder":v.order}:{},...C.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:N,height:L,isExpanded:!0}),re=n.createShape(W,{x:100+N/2,y:Et+L/2},u()),pe=C.lanes??[];if(pe.length&&n.splitLane(re,pe.length),pe.length){const J=o.filter(he=>{var ye;return he.type==="bpmn:Lane"&&((ye=d(he))==null?void 0:ye.id)===C.id}).sort((he,ye)=>he.y-ye.y);if(J.forEach((he,ye)=>{const Ce=pe[ye];Ce&&n.updateProperties(he,{id:Ce.id,name:Ce.name})}),I.some(he=>he!==re.height/O)){let he=re.y;J.forEach((ye,Ce)=>{const pt=I[Ce];n.resizeShape(ye,{x:ye.x,y:he,width:ye.width,height:pt}),he+=pt})}}Et=re.y+re.height+60}const un=v=>{var O;const C=P.get(v);if(C)return C.node.participant??"";const A=p(v);return A?A.type==="bpmn:Participant"?A.id:((O=d(A))==null?void 0:O.id)??"":""},mn=new Map,xo=v=>{let C=mn.get(v);return C||mn.set(v,C={nodes:[],flows:[]}),C};for(const v of b)xo(v.node.participant??"").nodes.push(v);for(const v of E)xo(un(v.flow.source)).flows.push(v);const Zn=v=>{var C;return i.create("bpmn:SequenceFlow",{id:v.id,name:v.name??((C=v.condition)==null?void 0:C.label)})},xi=(v,C,A)=>r.createShape({type:uc(v.type),...v.eventDefinition?{eventDefinitionType:zs[v.eventDefinition]}:{},businessObject:i.create(uc(v.type),{id:v.id,name:v.name,...C!==void 0?{"bwl:band":C}:{},...A!==void 0?{"bwl:afterColumn":A}:{}})}),_i=[...vn.map(({op:v})=>v.participant.id).filter(v=>mn.has(v)),...[...mn.keys()].filter(v=>!m.some(C=>C.participant.id===v))],Kt=v=>v.endsWith("Gateway");for(const v of _i){const C=mn.get(v),A=v?f(v):void 0,O=A?A.x+150:250;let N=A?A.y+80:120;const I=(K,ce,ne)=>{if(K){const me=f(K);return me.y+Math.min(me.height/2,fe)+R(K,ce??0)*D}return ce!==void 0&&A?A.y+Q+R(`pool:${v}`,ce)*D:ne},j=(K,ce,ne)=>{if(K){const me=f(K);return me.y+Math.min(me.height/2,fe)+ce*D}return A?A.y+Q+ce*D:ne},F=K=>K.participant?f(K.participant):u(),L=(K,ce,ne,me,Ve,We,Ct)=>{const Ft=ne!==void 0||me!==void 0,ge=R(ne??`pool:${v}`,me??0);if((me===void 0||x(ne,v,me,Ct??Number.NaN))&&Ct!==void 0&&yn(ne,ce,Ct)&&!X(K,ce,Ve,Ct))return{x:Ve,y:Ct};if(Ft)for(let de=0;de<4;de++){const Ie=j(ne,ge+de,We);if(!X(K,ce,Ve,Ie,ln(ne,ge+de)))return mt(ne,ge+de,A),{x:Ve,y:Ie}}const ve=I(ne,me,We);Ft?mt(ne,ge,A):Re(K,ce,ve);let oe=Ve;for(let de=0;de<64;de++){const Ie=X(K,ce,oe,ve);if(!Ie)break;oe=Ie.x+Ie.width+H+ce.width/2}return{x:oe,y:ve}},W=new Set(C.flows.map(K=>K.flow.target)),re=new Map,pe=K=>{if(K===void 0)return;const ce=o.get(K);if(!(!ce||typeof ce.x!="number"||typeof ce.width!="number"))return ce.x+ce.width+H};for(const K of C.nodes){if(W.has(K.node.id))continue;const ce=xi(K.node,K.band,K.afterColumn),ne=V(K),me=K.node.lane?`${K.node.lane}|${ne??""}`:ne!==void 0?`band:${ne}`:"",Ve=F(K.node),We=re.get(me)??O,Ct=pe(K.afterColumn),Ft=Ct===void 0?We:Math.max(We,Ct),ge=L(Ve,ce,K.node.lane,ne,Ft,N);n.createShape(ce,ge,Ve),re.set(me,ge.x+ce.width+H),!K.node.lane&&ne===void 0&&(N+=160)}const J=new Set,he=new Map,ye=new Map,Ce=new Map;if(v&&ee.has(`pool:${v}`)){const K=new Map;for(const ge of C.flows)K.set(ge.flow.target,(K.get(ge.flow.target)??0)+1);const ce=ge=>I(ge.node.lane,Pe(ge),Number.NaN),ne=new Set,me=ge=>{var de;const ve=(de=P.get(ge))==null?void 0:de.node.participant;if(ve)return p(ve);const oe=p(ge);if(oe)return oe.type==="bpmn:Participant"?oe:d(oe)},Ve=ge=>{const ve=[],oe=new Set([ge]),de=[ge];for(;de.length;){const Ie=de.shift(),qe=P.get(Ie);qe&&ve.push(qe);for(const ke of C.flows)ke.flow.source!==Ie||oe.has(ke.flow.target)||(K.get(ke.flow.target)??0)!==1||(oe.add(ke.flow.target),de.push(ke.flow.target))}return ve},We=ge=>{if(!A)return;const ve=new Set(ge.map(Ie=>Ie.node.id));let oe=!1,de=!1;for(const Ie of _){if(!ve.has(Ie.flow.source))continue;const qe=me(Ie.flow.target);!qe||qe.id===A.id||(qe.y<A.y?oe=!0:de=!0)}return oe&&!de?"up":de&&!oe?"down":void 0};for(const ge of C.nodes){if(!Kt(ge.node.type))continue;const ve=I(ge.node.lane,V(ge),Number.NaN);if(Number.isNaN(ve))continue;const oe=[];for(const ke of C.flows){if(ke.flow.source!==ge.node.id)continue;const He=P.get(ke.flow.target);if(!He||He.node.lane!==ge.node.lane||(K.get(He.node.id)??0)!==1)continue;const Qe=V(He);if(Qe===void 0)continue;const we=I(He.node.lane,Qe,Number.NaN);if(Number.isNaN(we))continue;const lt=Ve(He.node.id),Ae=We(lt);Ae&&oe.push({subtree:lt,band:Qe,row:we,dir:Ae})}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 Ie=[...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=Ie[He].band;if(Qe!==ke.band){ne.add(ge.node.id);for(const we of ke.subtree)V(we)===ke.band&&ie.set(we.node.id,Qe)}})}const Ct=ge=>{if(!A)return;const ve=new Set(ge.map(Ie=>Ie.node.id));let oe=!1,de=!1;for(const Ie of _){if(!ve.has(Ie.flow.target))continue;const qe=me(Ie.flow.source);!qe||qe.id===A.id||(qe.y<A.y?oe=!0:de=!0)}return oe&&!de?"up":de&&!oe?"down":void 0};for(const ge of C.nodes){if(!Kt(ge.node.type))continue;const ve=ge.node.lane??`pool:${v}`,oe=be.get(ve);if(!oe||oe.size<2)continue;const de=oe.get(0);if(de===void 0)continue;const Ie=Math.max(...oe.values()),qe=de===Ie&&de!==0?"down":void 0;if(!qe)continue;const ke=[];for(const Ae of C.flows){if(Ae.flow.source!==ge.node.id)continue;const St=P.get(Ae.flow.target);if(!St||St.node.lane!==ge.node.lane||(K.get(St.node.id)??0)!==1)continue;const _t=Pe(St);_t!==void 0&&ke.push({t:St,subtree:Ve(St.node.id),band:_t})}const He=ke.find(Ae=>(oe.get(Ae.band)??Ae.band)===de);if(!He||Ct(He.subtree)===qe||We(He.subtree)===qe)continue;const Qe=ke.find(Ae=>Ae!==He&&Ct(Ae.subtree)===qe);if(!Qe)continue;const we=He.band,lt=Qe.band;for(const Ae of He.subtree)Pe(Ae)===we&&ie.set(Ae.node.id,lt);for(const Ae of Qe.subtree)Pe(Ae)===lt&&ie.set(Ae.node.id,we);ne.add(ge.node.id)}for(const ge of C.nodes){if(!Kt(ge.node.type))continue;const ve=ce(ge);if(Number.isNaN(ve)||S.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))===ge.node.id&&((Qe=ke.placement)==null?void 0:Qe.side.startsWith("bottom"))}))continue;let de,Ie=!1,qe;for(const ke of C.flows){if(ke.flow.source!==ge.node.id)continue;const He=P.get(ke.flow.target);if(!He||!He.node.lane&&V(He)===void 0)continue;const Qe=ce(He);Number.isNaN(Qe)||(Math.abs(Qe-ve)<.5&&(Ie=!0),Qe>ve?!de||Qe>de.row?de={id:He.node.id,row:Qe,count:1}:Qe===de.row&&de.count++:Qe<ve&&He.node.lane===ge.node.lane&&(!qe||Qe>qe.row?qe={op:He,row:Qe,count:1}:Qe===qe.row&&qe.count++))}de&&de.count===1&&(K.get(de.id)??0)===1&&!ne.has(ge.node.id)&&J.add(de.id),!Ie&&qe&&qe.count===1&&(K.get(qe.op.node.id)??0)===1&&!Te.has(ge.node.id)&&he.set(qe.op.node.id,{lane:ge.node.lane,band:Pe(ge)})}const Ft=new Map;for(const ge of _)Ft.set(ge.flow.target,[...Ft.get(ge.flow.target)??[],ge]);for(const ge of C.nodes){const ve=Ft.get(ge.node.id);if(!ve||ve.length!==1||!K.get(ge.node.id)||!ge.node.lane&&V(ge)===void 0||B.has(ge.node.id))continue;const oe=(U0=P.get(ve[0].flow.source))==null?void 0:U0.node.participant,de=oe?p(oe):void 0;if(!de||!A||de.id===A.id)continue;const Ie=ge.node.lane??`pool:${v}`,qe=be.get(Ie);if(!qe)continue;const ke=qe.get(0)??0,He=(qe.get(Pe(ge)??0)??ke)-ke;if(He===0)continue;const Qe=de.y<A.y;if(Qe&&He<0||!Qe&&He>0)continue;let we;for(const[lt,Ae]of qe){const St=Ae-ke;(Qe&&St<0&&(!we||St<we.row)||!Qe&&St>0&&(!we||St>we.row))&&(we={band:lt,row:St})}we&&ye.set(ge.node.id,{lane:ge.node.lane,band:we.band})}}const pt=new Set;let Oe=0;for(;Oe++<C.nodes.length+2;){for(let ne=0;ne<C.nodes.length+C.flows.length+2;ne++){let me=!1;for(const Ve of C.flows){const We=Ve.flow;if(pt.has(We.id))continue;const Ct=p(We.source);if(!Ct)continue;const Ft=p(We.target),ge=P.get(We.target);if(!Ft&&ge){const ve=xi(ge.node,ge.band),oe=Pe(ge);if(ge.node.lane||oe!==void 0){const de=F(ge.node),Ie=Ct,qe=Ie.x+(Ce.get(We.source)??0)+Ie.width+H,ke=he.get(We.target)??ye.get(We.target),He=L(de,ve,ke?ke.lane:ge.node.lane,ke?ke.band:oe,J.has(We.target)?Ie.x+Ie.width/2:qe,Number.NaN,ke||!wt(We.target)?void 0:Ie.y+Ie.height/2),Qe=n.createShape(ve,He,de);J.has(We.target)&&Ce.set(We.target,qe-(Qe.x+Qe.width/2)),n.connect(Ct,Qe,{type:"bpmn:SequenceFlow",businessObject:Zn(We)})}else s.append(Ct,ve,{connection:{type:"bpmn:SequenceFlow",businessObject:Zn(We)}})}else if(Ft)n.connect(Ct,Ft,{type:"bpmn:SequenceFlow",businessObject:Zn(We)});else continue;pt.add(We.id),me=!0}if(!me)break}const K=C.nodes.filter(ne=>!p(ne.node.id));if(!K.length)break;const ce=K[0];{const ne=xi(ce.node,ce.band),me=F(ce.node),Ve=V(ce);n.createShape(ne,L(me,ne,ce.node.lane,Ve,O,N),me),!ce.node.lane&&Ve===void 0&&(N+=160)}}}const wi=40,_a=v=>{const C=()=>new Set(gt(Xe(o)).map(W=>ft(W))),A=C(),O=v.waypoints.map(W=>({x:W.x,y:W.y})),N=v.label,I=N&&{x:N.x,y:N.y};n.layoutConnection(v,{waypoints:[]});const j=C(),F=[...j].filter(W=>!A.has(W)).length,L=[...A].filter(W=>!j.has(W)).length;F<=L||(n.updateWaypoints(v,O),N&&I&&(N.x!==I.x||N.y!==I.y)&&n.moveElements([N],{x:I.x-N.x,y:I.y-N.y}))},Qn=5,ct=10,xt=200,wu=new Set([...E.map(v=>v.flow.id),..._.map(v=>v.flow.id),...Xt(e,"sequenceFlow.update").map(v=>v.id),...Xt(e,"messageFlow.update").map(v=>v.id)].filter(v=>!!v)),BB=(v,C,A,O,N,I)=>{const j=new Set(v.map(K=>K.id)),F=Math.min(...v.map(K=>K.x))+C-ct,L=Math.max(...v.map(K=>K.x+K.width))+C+xt+ct,W=Math.min(...v.map(K=>K.y+Math.min(0,...A)))-ct,re=Math.max(...v.map(K=>K.y+K.height+Math.max(0,...A)))+ct,pe=o.getAll().filter(K=>{if(K.type!=="bpmn:SequenceFlow"&&K.type!=="bpmn:MessageFlow")return!1;const ce=K;return wu.has(ce.id)||!ce.waypoints||ce.waypoints.length<2||[ce.source,ce.target].some(me=>!me||j.has(me.id)||me.x>=O)?!1:ce.waypoints.some((me,Ve)=>{const We=ce.waypoints[Ve+1];return!!We&&Math.max(me.x,We.x)>=F&&Math.min(me.x,We.x)<=L&&Math.max(me.y,We.y)>=W&&Math.min(me.y,We.y)<=re})});if(!pe.length)return 0;const J=K=>{const ce=new Map;for(const ne of v)for(const me of A){const Ve={id:ne.id,type:ne.type,x:ne.x+C+K,y:ne.y+me,width:ne.width,height:ne.height};for(const We of pe){let Ct=1/0;for(let ge=0;ge+1<We.waypoints.length;ge++)Ct=Math.min(Ct,nc(We.waypoints[ge],We.waypoints[ge+1],Ve));const Ft=`${We.id}|${ne.id}`;ce.set(Ft,Math.min(ce.get(Ft)??1/0,Ct))}}return ce},he=[...J(0)].filter(([,K])=>K<=Qn).map(([K])=>K);if(!he.length)return 0;let ye=0;for(let K=1;K<=xt;K++){const ce=J(K);if([...ce.values()].every(ne=>ne>Qn)&&he.every(ne=>(ce.get(ne)??1/0)>=ct)){ye=K;break}}if(!ye)return 0;const Ce=Math.min(...v.map(K=>K.x))+C+ye,pt=new Set(he.map(K=>K.slice(0,K.indexOf("|"))));return pe.some(K=>K.type==="bpmn:SequenceFlow"&&pt.has(K.id)&&K.waypoints.some((ce,ne)=>{const me=K.waypoints[ne+1];if(!me||Math.min(ce.y,me.y)>I||Math.max(ce.y,me.y)<I||ce.y===me.y)return!1;const Ve=ce.x+(I-ce.y)*(me.x-ce.x)/(me.y-ce.y);return Ve>N&&Ve<Ce}))?0:ye},_o=(v,C=()=>!0)=>{const A=p(v);if(!A)return[];const O=[A],N=new Set([v]);for(let I=0;I<O.length;I++){const j=O[I].id;for(const F of E){const L=F.flow.target;if(F.flow.source!==j||N.has(L)||!P.has(L))continue;N.add(L);const W=p(L);W&&C(W)&&O.push(W)}}return O},NB=(v,C=()=>!0)=>{const A=p(v);if(!A)return[];const O=[A],N=new Set([v]);for(let I=0;I<O.length;I++){const j=O[I].id;for(const F of E){const L=F.flow.source;if(F.flow.target!==j||N.has(L)||!P.has(L))continue;N.add(L);const W=p(L);W&&C(W)&&O.push(W)}}return O},Yi=30,fr=v=>!("waypoints"in v&&v.waypoints)&&v.type!=="bpmn:Lane"&&v.type!=="label"&&typeof v.x=="number",Eu=(v,C)=>pp(n,v,C),Is=(v,C,A=!1)=>{const O=new Set(v.flatMap(L=>L.subtree.map(W=>W.id)));for(const L of v){const W=(L.pool.children??[]).filter(fr).filter(pe=>!O.has(pe.id));if(L.subtree.some(pe=>W.some(J=>pe.x+C<J.x+J.width+Yi&&pe.x+C+pe.width+Yi>J.x&&pe.y<J.y+J.height&&pe.y+pe.height>J.y)))return null}const N=v.map(L=>L.pool.width),I=A?o.filter(L=>Array.isArray(L.waypoints)).map(L=>({c:L,wps:L.waypoints.map(W=>({x:W.x,y:W.y}))})):[],j=o.filter(L=>L.type==="label").map(L=>({label:L,x:L.x,y:L.y}));n.moveElements(v.flatMap(L=>L.subtree),{x:C,y:0});const F=v.map(L=>{const re=Math.max(...L.subtree.map(pe=>pe.x+pe.width))+eg-(L.pool.x+L.pool.width);return re>0&&Eu(L.pool,L.pool.width+re),re});return()=>{n.moveElements(v.flatMap(L=>L.subtree),{x:-C,y:0}),v.forEach((L,W)=>{F[W]>0&&Eu(L.pool,N[W])});for(const{c:L,wps:W}of I){const re=L.waypoints??[];re.length===W.length&&re.every((J,he)=>Math.abs(J.x-W[he].x)<=.5&&Math.abs(J.y-W[he].y)<=.5)||n.updateWaypoints(L,W.map(J=>({x:J.x,y:J.y})))}for(let L=0;L<3;L++){let W=0;for(const re of j){const pe=re.x-re.label.x,J=re.y-re.label.y;Math.abs(pe)<=.5&&Math.abs(J)<=.5||(n.moveElements([re.label],{x:pe,y:J}),W++)}if(!W)break}}},ch=v=>{var N,I;const C=new Map,A=new Map;for(const j of o.getAll()){if(j.type!=="bpmn:Participant")continue;const F=j;(F.children??[]).length||(C.set(F.id,F),A.set(F.id,[]))}for(const j of o.getAll()){if(j.type!=="bpmn:MessageFlow")continue;const F=j,L=(N=F.source)==null?void 0:N.id,W=(I=F.target)==null?void 0:I.id;L&&W&&A.has(L)&&A.get(L).push(W),L&&W&&A.has(W)&&A.get(W).push(L)}const O=[];for(const[j,F]of A)F.length&&F.every(L=>v.has(L))&&O.push(C.get(j));return O},_0=(v,C)=>{if(!v.length)return null;const A=new Set(v.map(j=>j.id)),O=o.getAll().filter(j=>j.type==="bpmn:Participant"&&!A.has(j.id));if(v.some(j=>O.some(F=>j.x+C<F.x+F.width+Yi&&j.x+C+j.width+Yi>F.x&&j.y<F.y+F.height&&j.y+j.height>F.y)))return null;const I=o.filter(j=>j.type==="label").map(j=>({label:j,x:j.x,y:j.y}));return n.moveElements(v,{x:C,y:0}),()=>{n.moveElements(v,{x:-C,y:0});for(let j=0;j<3;j++){let F=0;for(const L of I){const W=L.x-L.label.x,re=L.y-L.label.y;Math.abs(W)<=.5&&Math.abs(re)<=.5||(n.moveElements([L.label],{x:W,y:re}),F++)}if(!F)break}}},w0=()=>{let v=0;for(const C of o.getAll()){if(C.type!=="bpmn:DataInputAssociation"&&C.type!=="bpmn:DataOutputAssociation")continue;const A=C.waypoints??[];for(let O=1;O<A.length;O++)v+=Math.hypot(A[O].x-A[O-1].x,A[O].y-A[O-1].y)}return v},E0=()=>{let v=0;for(const C of o.getAll()){if(C.type!=="bpmn:Association")continue;const A=C.waypoints??[];for(let O=1;O<A.length;O++)v+=Math.hypot(A[O].x-A[O-1].x,A[O].y-A[O-1].y)}return v},$B=v=>{const C=[];for(const A of o.getAll()){if(A.type!=="bpmn:TextAnnotation")continue;const O=A;if(v.has(O.id))continue;const I=[...O.incoming??[],...O.outgoing??[]].filter(L=>L.type==="bpmn:Association").map(L=>L.source===O?L.target:L.source);if(!I.length||I.some(L=>L===void 0))continue;const j=L=>{if(!("waypoints"in L&&L.waypoints))return[L.id];const W=L,re=[W.source,W.target];return re.some(pe=>!pe)?[]:re.map(pe=>pe.id)},F=I.flatMap(L=>j(L));F.length&&F.every(L=>v.has(L))&&C.push(O)}return C},S0=()=>gt(Xe(o)).filter(v=>v.kind==="edge-crosses-shape").length,R0=v=>{const C=(v.children??[]).filter(fr);let A=0;for(let O=0;O<C.length;O++)for(let N=O+1;N<C.length;N++){const I=C[O],j=C[N];I.x<j.x+j.width&&I.x+I.width>j.x&&I.y<j.y+j.height&&I.y+I.height>j.y&&A++}return A},wa=()=>{const v=Xe(o),C=A=>A.length>=2&&(A.every(O=>Math.abs(O.x-A[0].x)<.01)||A.every(O=>Math.abs(O.y-A[0].y)<.01));return{messages:v.edges.filter(A=>A.type==="bpmn:MessageFlow"&&A.waypoints.length===2).length,lines:v.edges.filter(A=>C(A.waypoints)).length}},C0=v=>{const C=new Map;for(const O of o.getAll()){if(O.type!=="bpmn:MessageFlow")continue;const N=O;if(!N.waypoints||N.waypoints.length!==2)continue;const I=N.source,j=N.target;if(!I||!j)continue;const F=v.has(I.id);if(F===v.has(j.id))continue;const L=F?j:I,W=d(L);if(!W||v.has(L.id))continue;const re=C.get(W.id);re?L.x<re.minX&&(re.minX=L.x):C.set(W.id,{pool:W,minX:L.x})}const A=[];for(const{pool:O,minX:N}of C.values()){const I=(O.children??[]).filter(j=>fr(j)&&!v.has(j.id)&&j.x>=N);I.length&&A.push({subtree:I,pool:O})}return A},FB=(v,C,A)=>{const O=new Map(C.map(j=>[j.pool.id,{subtree:[...j.subtree],pool:j.pool}])),N=new Set(v);for(const j of C)for(const F of j.subtree)N.add(F.id);let I=!1;for(;;){let j=0;for(const F of C0(N)){if(F.pool===A)continue;const L=O.get(F.pool.id);L?L.subtree.push(...F.subtree):O.set(F.pool.id,{subtree:[...F.subtree],pool:F.pool});for(const W of F.subtree)N.add(W.id);j+=F.subtree.length}if(!j)break;I=!0}return I?[...O.values()]:null},M0=new Map;for(const v of Xt(e,"sequenceFlow.update")){if(v.target===void 0)continue;const C=P.get(v.target);if(!C)continue;const A=p(v.target),O=p(v.id);if(!A||!O)continue;const N=v.source!==void 0?p(v.source):O.source,I=O.target;if(!N||!I||I.id===A.id)continue;const j=O.waypoints&&O.waypoints.length>=3&&Math.abs(O.waypoints[0].x-O.waypoints[1].x)<1&&Math.abs(O.waypoints[0].y-O.waypoints[1].y)>1?{x:O.waypoints[0].x,y:O.waypoints[0].y}:void 0,F=j?O.waypoints[1].y:void 0,L=j&&O.label?{x:O.label.x,y:O.label.y}:void 0,W=L&&O.label&&Math.abs(L.y+O.label.height/2-F)<=D/5&&L.x+O.label.width>j.x?L.x+O.label.width+6:void 0,re=(N.outgoing??[]).filter(we=>we.type==="bpmn:SequenceFlow"&&we.id!==O.id&&we.target&&!wu.has(we.id)),pe=new Set(re.map(we=>we.target.id)),J=we=>{const lt={type:"bpmn:Task",x:we.x+2,y:we.y+2,width:we.width-4,height:we.height-4};return re.find(Ae=>(Ae.waypoints??[]).some((St,_t)=>!!Ae.waypoints[_t+1]&&nc(St,Ae.waypoints[_t+1],lt)===0))},he=_o(v.target),ye=new Set(he.map(we=>we.id)),Ce=Math.min(...he.map(we=>we.x)),pt=Math.max(...he.map(we=>we.x+we.width)),Oe=N.x+N.width,K=A.y+A.height/2,ce=BB(he,Oe+wi-Ce,[0,N.y+N.height/2-K,I.y+I.height/2-K],I.x,Oe,N.y+N.height/2),ne=Oe+wi+ce,me=(()=>{if(W===void 0)return 0;const we=Oe+wi,lt=N.y+N.height/2-A.height/2,Ae={x:we,y:lt,width:pt-Ce,height:A.height},St=d(N);return((St==null?void 0:St.children)??[]).some(vt=>fr(vt)&&!ye.has(vt.id)&&vt.id!==N.id&&vt.id!==I.id&&vt.type!=="bpmn:Group"&&vt.type!=="bpmn:Participant"&&vt.x<Ae.x+Ae.width&&vt.x+vt.width>Ae.x&&vt.y<Ae.y+Ae.height&&vt.y+vt.height>Ae.y)||J(Ae)?Math.max(0,W-we):0})(),Ve=pt-Ce+wi*2+ce+me-(I.x-Oe);let We=[];if(Ve>0){const we=d(A),lt=(we==null?void 0:we.children)??[],Ae=rt=>rt.type==="bpmn:Lane";We=(()=>{const rt=new Set;for(const bt of lt)fr(bt)&&!ye.has(bt.id)&&bt.id!==N.id&&bt.x>=I.x&&rt.add(bt.id);const et=[];for(const bt of lt){if(bt.type!=="bpmn:DataStoreReference"&&bt.type!=="bpmn:DataObjectReference")continue;const Ke=bt,On=[...Ke.incoming??[],...Ke.outgoing??[]].filter(Yt=>Yt.type==="bpmn:DataInputAssociation"||Yt.type==="bpmn:DataOutputAssociation").map(Yt=>Yt.source===Ke?Yt.target:Yt.source);On.length&&On.every(Yt=>Yt!==void 0&&rt.has(Yt.id))&&et.push(Ke)}return et})();const _t=lt.filter(rt=>!("waypoints"in rt&&rt.waypoints)&&!Ae(rt)&&!ye.has(rt.id)&&rt.id!==N.id&&rt.x>=I.x),vt=we?[we,...lt.filter(rt=>Ae(rt))]:[];if(_t.length){const rt=new Set(_t.map(Bt=>Bt.id)),et=C0(rt),bt=et.length?FB(rt,et,we):null,Ke=Bt=>{const je=new Set(rt);for(const yt of Bt)for(const Tt of yt.subtree)je.add(Tt.id);return $B(je)},Ot=Ke(et),On=bt?Ke(bt):Ot,Yt=ch(rt),Ei=new Set(rt);for(const Bt of et)for(const je of Bt.subtree)Ei.add(je.id);const gh=et.length?ch(Ei):Yt,Au=(()=>{if(!bt)return[];const Bt=new Set(rt);for(const je of bt)for(const yt of je.subtree)Bt.add(yt.id);return ch(Bt)})();n.createSpace(_t,vt,{x:Ve,y:0},"e",I.x-1);const Ns=(Bt,je)=>{const yt=wa(),Tt=Is(Bt,Ve);if(!Tt)return!1;const Bn=je.length?_0(je,Ve):null,dr=wa();return dr.messages>yt.messages&&dr.lines>=yt.lines?!0:(Bn==null||Bn(),Tt(),!1)},$s=bt?Ns(bt,Au):!1;let Fs=$s;!Fs&&et.length&&(Fs=Ns(et,gh));const Ra=$s?On:Ot;if(!Fs){for(const Bt of et){const je=wa(),yt=Is([Bt],Ve);if(!yt)continue;const Tt=wa();(Tt.messages<=je.messages||Tt.lines<je.lines)&&yt()}if(Yt.length){const Bt=wa(),je=_0(Yt,Ve);if(je){const yt=wa();(yt.messages<=Bt.messages||yt.lines<Bt.lines)&&je()}}}if(Ra.length){const Bt=()=>new Set(gt(Xe(o)).map(yt=>ft(yt))),je=yt=>{const Tt=E0(),Bn=Bt(),dr=yt.map(ot=>({a:ot,x:ot.x,y:ot.y})),qr=o.filter(ot=>ot.type==="label").map(ot=>({label:ot,x:ot.x,y:ot.y}));n.moveElements(yt,{x:Ve,y:0});const yh=[...Bt()].filter(ot=>!Bn.has(ot));if(E0()<Tt&&yh.length===0)return!0;for(const{a:ot,x:ai,y:Ai}of dr)(ot.x!==ai||ot.y!==Ai)&&n.moveElements([ot],{x:ai-ot.x,y:Ai-ot.y});for(const ot of qr){const ai=ot.x-ot.label.x,Ai=ot.y-ot.label.y;(ai!==0||Ai!==0)&&n.moveElements([ot.label],{x:ai,y:Ai})}return!1};if(!je(Ra)&&Ra.length>1)for(const yt of Ra)je([yt])}}}const Ct=C.node.lane!==void 0?p(C.node.lane):C.node.participant!==void 0?p(C.node.participant):void 0,Ft=we=>{if(!Ct)return!0;const lt=we.y+we.height/2;return lt>=Ct.y&&lt<=Ct.y+Ct.height},ge=!Ft(N)&&Ft(I)?I:N,ve=ge.y+ge.height/2,oe=ve-(A.y+A.height/2),de=C.band!==void 0,Ie=de?[A]:he,qe=(C.band===void 0||x(C.node.lane,C.node.participant,C.band,ve))&&wt(v.target)&&Ie.every(we=>{var lt;return yn((lt=P.get(we.id))==null?void 0:lt.node.lane,we,we.y+we.height/2+oe)}),ke=we=>Math.abs(we.y+we.height/2-(A.y+A.height/2))<=D/2;if(qe&&de){const we=Math.abs(oe)<=D/2?he.filter(lt=>lt.id!==A.id&&ke(lt)):[];if(n.moveElements(he,{x:ne-Ce,y:0}),n.moveElements([A],{x:0,y:oe}),we.length){const lt=()=>new Set(gt(Xe(o)).map(et=>ft(et))),Ae=lt(),St=o.filter(et=>et.type==="label").map(et=>({label:et,x:et.x,y:et.y}));n.moveElements(we,{x:0,y:oe});const _t=lt(),vt=[..._t].filter(et=>!Ae.has(et)).length,rt=[...Ae].filter(et=>!_t.has(et)).length;if(vt>rt){n.moveElements(we,{x:0,y:-oe});for(const et of St){const bt=et.x-et.label.x,Ke=et.y-et.label.y;(bt!==0||Ke!==0)&&n.moveElements([et.label],{x:bt,y:Ke})}}}}else n.moveElements(he,{x:ne-Ce,y:qe?oe:0});const He=d(A);if(!qe&&C.node.lane===void 0&&C.band!==void 0&&He){const we=He.y+Q+R(`pool:${C.node.participant??""}`,C.band)*D,lt=we-(A.y+A.height/2);lt!==0&&!X(He,A,A.x+A.width/2,we,ye)&&n.moveElements([A],{x:0,y:lt})}if(He){const we=(He.children??[]).filter(_t=>fr(_t)&&!ye.has(_t.id)&&_t.type!=="bpmn:Group"&&_t.type!=="bpmn:Participant"),lt=(_t,vt,rt,et,bt)=>_t.x+vt<bt.x+bt.width+et&&_t.x+vt+_t.width+et>bt.x&&_t.y+rt<bt.y+bt.height+et&&_t.y+rt+_t.height+et>bt.y,Ae=we.find(_t=>lt(A,0,0,0,_t)),St=Ae?void 0:J(A);if(Ae||St){const _t=["bpmn:SequenceFlow","bpmn:MessageFlow","bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation"],vt=o.getAll().filter(je=>{if(!_t.includes(je.type))return!1;const yt=je;return wu.has(yt.id)||!yt.waypoints||yt.waypoints.length<2?!1:![yt.source,yt.target].some(Tt=>!Tt||ye.has(Tt.id))}),rt=(je,yt,Tt)=>{var Bn;return yn((Bn=P.get(je.id))==null?void 0:Bn.node.lane,je,je.y+Tt+je.height/2)&&je.x+yt>=He.x&&je.x+yt+je.width<=He.x+He.width&&je.y+Tt>=He.y&&je.y+Tt+je.height<=He.y+He.height},et=(je,yt)=>he.every(Tt=>rt(Tt,je,yt)&&!we.some(Bn=>lt(Tt,je,yt,ct,Bn))&&vt.every(Bn=>{const dr={id:Tt.id,type:Tt.type,x:Tt.x+je,y:Tt.y+yt,width:Tt.width,height:Tt.height};for(let qr=0;qr+1<Bn.waypoints.length;qr++)if(nc(Bn.waypoints[qr],Bn.waypoints[qr+1],dr)<ct)return!1;return!0})),bt=A.y+A.height/2,Ke=[F,I.y+I.height/2].filter(je=>je!==void 0&&Math.abs(je-bt)>=1),Ot=Ae&&pe.has(Ae.id)?Ae:St==null?void 0:St.target,On=Ot?Ot.x-A.x:0,Yt=Math.max(...he.map(je=>je.x+je.width)),Ei=[...On!==0?[On]:[],...ce!==0?[-ce]:[],0],gh=W===void 0?[]:Ei.map(je=>Math.max(je,W-A.x)),Au=je=>Yt+je+wi<=I.x,Ns=[...new Set([...gh,...Ei])].filter(Au),$s=Ae&&pe.has(Ae.id)?[Ae.x+Ae.width+wi-A.x]:[],Fs=W===void 0?[]:$s.map(je=>Math.max(je,W-A.x)),Ra=[...new Set([...Fs,...$s])].filter(je=>Au(je)&&!Ns.includes(je));let Bt;for(const je of[Ns,Ra]){for(const yt of Ke){for(const Tt of je)if(et(Tt,yt-bt)){Bt={dx:Tt,dy:yt-bt};break}if(Bt)break}if(Bt)break}if(Bt){const je=ot=>{const ai=ot;return[ai.edge,ai.other,...Array.isArray(ai.edges)?ai.edges:[]].some(Ai=>typeof Ai=="string"&&wu.has(Ai))},yt=()=>new Set(gt(Xe(o)).filter(ot=>!je(ot)).map(ot=>ft(ot))),Tt=yt(),Bn=o.filter(ot=>ot.type==="label").map(ot=>({label:ot,x:ot.x,y:ot.y}));n.moveElements(he,{x:Bt.dx,y:Bt.dy});const dr=yt(),qr=[...dr].filter(ot=>!Tt.has(ot)).length,yh=[...Tt].filter(ot=>!dr.has(ot)).length;if(qr>yh){n.moveElements(he,{x:-Bt.dx,y:-Bt.dy});for(const ot of Bn){const ai=ot.x-ot.label.x,Ai=ot.y-ot.label.y;(ai!==0||Ai!==0)&&n.moveElements([ot.label],{x:ai,y:Ai})}}else j&&M0.set(O.id,{exit:j,channelY:F,label:L})}}}{const we=new Set(he.map(vt=>vt.id)),lt=new Set(E.map(vt=>vt.flow.id)),Ae=20,St=vt=>{const rt=vt.source,et=vt.target,bt=Math.min(rt.x,et.x)-Ae,Ke=Math.max(rt.x+rt.width,et.x+et.width)+Ae,Ot=Math.min(rt.y,et.y)-Ae,On=Math.max(rt.y+rt.height,et.y+et.height)+Ae;return vt.waypoints.some(Yt=>Yt.x<bt||Yt.x>Ke||Yt.y<Ot||Yt.y>On)},_t=new Map;for(const vt of he)for(const rt of[...vt.incoming??[],...vt.outgoing??[]])rt.id!==v.id&&lt.has(rt.id)&&!(we.has(rt.source.id)&&we.has(rt.target.id))&&_t.set(rt.id,rt);for(const vt of _t.values())St(vt)&&_a(vt)}const Qe=We.length?d(We[0]):void 0;if(Qe){const we={assoc:w0(),overlaps:R0(Qe),crosses:S0()},lt=We.map(Ke=>({st:Ke,x:Ke.x})),Ae=o.filter(Ke=>Ke.type==="label").map(Ke=>({label:Ke,x:Ke.x,y:Ke.y})),St=Math.min(...We.flatMap(Ke=>[...Ke.incoming??[],...Ke.outgoing??[]].filter(Ot=>Ot.type==="bpmn:DataInputAssociation"||Ot.type==="bpmn:DataOutputAssociation").map(Ot=>(Ot.source===Ke?Ot.target:Ot.source).x))),_t=new Set(We.map(Ke=>Ke.id)),vt=(Qe.children??[]).filter(fr).filter(Ke=>!_t.has(Ke.id));let rt=St;for(const Ke of[...We].sort((Ot,On)=>Ot.x-On.x)){let Ot=rt;for(let On=0;On<100;On++){const Yt=vt.find(Ei=>Ot<Ei.x+Ei.width+Yi&&Ot+Ke.width+Yi>Ei.x&&Ke.y<Ei.y+Ei.height&&Ke.y+Ke.height>Ei.y);if(!Yt)break;Ot=Yt.x+Yt.width+Yi}Ot!==Ke.x&&n.moveElements([Ke],{x:Ot-Ke.x,y:0}),rt=Ot+Ke.width+Yi}const et=rt+150-(Qe.x+Qe.width);et>0&&Eu(Qe,Qe.width+et);const bt={assoc:w0(),overlaps:R0(Qe),crosses:S0()};if(bt.assoc>=we.assoc||bt.overlaps>we.overlaps||bt.crosses>we.crosses){for(const{st:Ke,x:Ot}of lt)Ke.x!==Ot&&n.moveElements([Ke],{x:Ot-Ke.x,y:0});et>0&&Eu(Qe,Qe.width-et);for(const Ke of Ae){const Ot=Ke.x-Ke.label.x,On=Ke.y-Ke.label.y;(Ot!==0||On!==0)&&n.moveElements([Ke.label],{x:Ot,y:On})}}}}const A0=(v,C)=>{const A=C.target===v,O=f(C.source),N=f(C.target),I=A?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(O,N,C.id?{type:I,businessObject:i.create(I,{id:C.id})}:{type:I})},P0=100,T0=v=>{for(const C of m){if(!C.participant.blackBox)continue;const A=p(C.participant.id);if(!A)continue;const O=[];for(const I of _){const j=I.flow.source===C.participant.id?I.flow.target:I.flow.target===C.participant.id?I.flow.source:void 0,F=j?p(j):void 0;F&&typeof F.x=="number"&&F.type!=="bpmn:Participant"&&O.push(F)}if(!O.length)continue;if(!v&&C.order===void 0){const I=(()=>{var F;const j=new Map;for(const L of O){const W=d(L);if(!W)continue;const re=j.get(W.id);re?re.n+=1:j.set(W.id,{shape:W,n:1})}return(F=[...j.values()].sort((L,W)=>W.n-L.n)[0])==null?void 0:F.shape})();if(I){const j=W=>W.reduce((re,pe)=>re+pe,0)/W.length,F=j(O.map(W=>W.y+W.height/2))<I.y+I.height/2,L=o.filter(W=>W.type==="bpmn:Participant"&&W.id!==C.participant.id&&W.id!==I.id).filter(W=>F?W.y+W.height<=I.y+5:W.y>=I.y+I.height-5);if(L.length){const W=[...L.reduce((ne,me)=>ne.set(me.y,(ne.get(me.y)??0)+1),new Map)].sort((ne,me)=>me[1]-ne[1]||(F?me[0]-ne[0]:ne[0]-me[0]))[0][0],re=Math.min(A.width,rR),pe=oR,J=O.map(ne=>ne.x+ne.width/2),he=Math.round(j(J)-re/2),ye=Math.max(...J)+P0,Ce=ne=>({x:ne,width:Math.max(re,ye-ne)}),pt=L.filter(ne=>Math.min(ne.y+ne.height,W+pe)-Math.max(ne.y,W)>0),Oe=ne=>{const me=Ce(ne);return pt.some(Ve=>Ve.x<me.x+me.width&&me.x<Ve.x+Ve.width)},K=ne=>{const me=Ce(ne);return J.filter(Ve=>Ve>=me.x+10&&Ve<=me.x+me.width-10).length},ce=(()=>{if(!Oe(he))return he;const ne=K(he);return pt.flatMap(me=>[me.x+me.width+Xm,me.x-Xm-re]).map(me=>Math.round(me)).filter(me=>!Oe(me)&&K(me)>=ne).sort((me,Ve)=>Math.abs(me-he)-Math.abs(Ve-he))[0]??he})();if(ce!==A.x||W!==A.y||re!==A.width||pe!==A.height){const ne=()=>new Set(gt(Xe(o)).map(ge=>ft(ge))),me=ne(),Ve={x:A.x,y:A.y,width:A.width,height:A.height};n.resizeShape(A,{x:ce,y:W,width:re,height:pe});const We=ne(),Ct=[...We].filter(ge=>!me.has(ge)).length,Ft=[...me].filter(ge=>!We.has(ge)).length;Ct>Ft&&n.resizeShape(A,Ve)}}}}const N=Math.max(...O.map(I=>I.x+I.width/2))+P0;if(N>A.x+A.width&&n.resizeShape(A,{x:A.x,y:A.y,width:N-A.x,height:A.height}),!!v)for(const I of _){const j=p(I.flow.id),F=I.flow.source===C.participant.id?I.flow.target:I.flow.target===C.participant.id?I.flow.source:void 0,L=F?p(F):void 0;if(!j||!L||L.type==="bpmn:Participant")continue;const W=L.x+L.width/2;if(W<A.x+10||W>A.x+A.width-10)continue;const re=A.y>L.y,pe=re?L.y+L.height:L.y,J=re?A.y:A.y+A.height,he=I.flow.source===C.participant.id?[{x:W,y:J},{x:W,y:pe}]:[{x:W,y:pe},{x:W,y:J}],ye=Xe(o),Ce={...ye.edges.find(pt=>pt.id===I.flow.id),waypoints:he};bn(Ce,ni(ye)).length||n.updateWaypoints(j,he)}}};T0(!1);for(const v of _){const C=v.flow;n.connect(f(C.source),f(C.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:C.id,name:C.name})})}{const A=new Set([...E.map(L=>L.flow.id),..._.map(L=>L.flow.id)].filter(L=>!!L)),O=o.filter(L=>!!L.waypoints),N=(L,W)=>Math.abs(W.x-L.x)<2?"L":Math.abs(W.x-(L.x+L.width))<2?"R":Math.abs(W.y-L.y)<2?"T":Math.abs(W.y-(L.y+L.height))<2?"B":void 0,I=new Map,j=(L,W,re)=>{if(!L||!W||typeof L.x!="number")return;const pe=N(L,W);if(!pe)return;let J=I.get(L.id);J||I.set(L.id,J=new Map),J.set(pe,[...J.get(pe)??[],re])};for(const L of O){const W=L.waypoints;!W||W.length<2||(j(L.source,W[0],{id:L.id,dir:"out"}),j(L.target,W[W.length-1],{id:L.id,dir:"in"}))}const F=new Set;for(const[L,W]of I){const re=p(L);if(!re||typeof re.x!="number"||![...W.values()].some(K=>{const ce=K.filter(ne=>ne.dir==="in");return K.length>=3&&ce.length>=1&&K.some(ne=>ne.dir==="out")&&ce.some(ne=>A.has(ne.id))}))continue;const J=d(re);if(!J||F.has(J.id)||(J.children??[]).some(K=>K.type==="bpmn:Lane"))continue;const he=(Y0=W.get("T"))!=null&&Y0.length?(q0=W.get("B"))!=null&&q0.length?void 0:"B":"T";if(!he||(he==="T"?re.y-J.y:J.y+J.height-(re.y+re.height))>=D)continue;const Ce=(J.children??[]).filter(K=>!("waypoints"in K&&K.waypoints)&&K.type!=="label"&&typeof K.x=="number"),pt=J.y+J.height;n.resizeShape(J,{x:J.x,y:J.y,width:J.width,height:J.height+D});const Oe=u().children.filter(K=>!("waypoints"in K&&K.waypoints)&&K.id!==J.id&&typeof K.y=="number"&&K.y>=pt);Oe.length&&n.moveElements(Oe,{x:0,y:D}),he==="T"&&Ce.length&&n.moveElements(Ce,{x:0,y:D}),F.add(J.id)}}const lh=20,k0=4,jB=2,HB=[10,30,80],Ur=()=>{const v=Xe(o);return{bad:gt(v).filter(C=>C.kind==="edge-crosses-shape"||C.kind==="edge-overlap-opposite"||C.kind==="edge-overlap-mixed").length,crossings:cm(v),straight:v.edges.filter(C=>C.type==="bpmn:MessageFlow"&&C.waypoints.length===2).length}},Ea=v=>{const C=Xe(o),A=C.edges.find(O=>O.id===v);return A?bn(A,ni(C)).length:0},Su=v=>Ea(v)>0,Ru=v=>Xe(o).edges.filter(C=>C.type==="bpmn:MessageFlow"&&C.id!==v&&C.waypoints.length===2).length,zB=(v,C,A)=>Is([{subtree:v,pool:C}],A),O0=(v,C)=>C.bad>v.bad||C.crossings>v.crossings&&C.straight<=v.straight&&C.bad>=v.bad,Sa=(v,C)=>O0(v,C)||C.straight<v.straight,wo=(v,C,A=()=>!0,O=O0,N=!1)=>{const I=Ur(),j=Is(v,C,N);if(!j)return!1;const F=Ur();return O(I,F)||!A()?(j(),!1):!0},GB=(v,C,A,O=()=>!0)=>wo([{subtree:v,pool:C}],A,O),Eo=v=>{var C;return!!((C=P.get(v))!=null&&C.node.participant)},Ls=new Map;for(const v of _){if(!Eo(v.flow.target))continue;const C=Ls.get(v.flow.target)??[];C.push(v),Ls.set(v.flow.target,C)}const Cu=[...Ls.keys()],uh=new Set(E.map(v=>v.flow.target)),D0=v=>vn.findIndex(({op:C})=>C.participant.id===v);Cu.sort((v,C)=>{var N,I;const A=uh.has(v)?1:0,O=uh.has(C)?1:0;return A!==O?A-O:D0((N=P.get(v))==null?void 0:N.node.participant)-D0((I=P.get(C))==null?void 0:I.node.participant)});const Yr=v=>v.x+v.width/2,VB=v=>{const C=new Map;for(const N of o.getAll()){const I=N;if(!I.waypoints||!I.source||!I.target)continue;(C.get(I.source.id)??C.set(I.source.id,[]).get(I.source.id)).push(I.target.id)}const A=new Set([v]),O=[v];for(let N=0;N<O.length;N++)for(const I of C.get(O[N])??[])A.has(I)||(A.add(I),O.push(I));return A},WB=(v,C)=>{const A=VB(C);let O;for(const N of o.getAll()){const I=N;if(I.type!=="bpmn:MessageFlow"||!I.source||!I.target||I.target.id!==v||A.has(I.source.id))continue;const j=I.source;if(typeof j.x!="number"||j.type==="bpmn:Participant")continue;const F=Yr(j);(O===void 0||F>O)&&(O=F)}return O},ph=(v,C)=>{const A=p(v.flow.source);if(A)return A.type==="bpmn:Participant"?WB(A.id,C):Yr(A)},I0=v=>{let C;for(const A of Ls.get(v)??[]){const O=ph(A,v);O!==void 0&&(!C||O>C.cx)&&(C={op:A,cx:O})}return C==null?void 0:C.op},UB=v=>{const C=I0(v),A=p(v),O=C?ph(C,v):void 0;return A&&O!==void 0?O-Yr(A):void 0},YB=v=>{const C=UB(v);return C!==void 0&&Math.abs(C)<lh},fh=(v,C,A,O,N)=>{var I;for(let j=!0;j;){j=!1;for(const F of _){if(F.flow.id===A)continue;const L=C.has(F.flow.source),W=C.has(F.flow.target);if(L===W||O(L?F.flow.source:F.flow.target))continue;const re=L?F.flow.target:F.flow.source;if(N(re)||!Eo(re))continue;const pe=p(F.flow.id);if(!(pe!=null&&pe.waypoints)||pe.waypoints.length!==2)continue;const J=p(re),he=(I=P.get(re))==null?void 0:I.node.participant;if(!J||!he)continue;const ye=_o(re,Ce=>Ce.x>=J.x).filter(Ce=>!C.has(Ce.id));if(!(!ye.length||ye.some(Ce=>N(Ce.id)))){for(const Ce of ye)C.add(Ce.id);v.set(he,[...v.get(he)??[],...ye]),j=!0}}}return[...v].map(([j,F])=>({subtree:F,pool:f(j)}))},L0=(v,C,A,O,N)=>fh(new Map([[C,[...v]]]),new Set(v.map(I=>I.id)),O,I=>I===A,I=>I===N),dh=v=>{const C=I0(v);if(!C)return null;const A=p(v),O=p(C.flow.source),N=ph(C,v);if(!A||!O||N===void 0)return null;const I=N-Yr(A);if(I>=lh){const j=P.get(v).node.participant,F=_o(v,L=>L.x>=A.x);return{groups:L0(F,j,v,C.flow.id,C.flow.source),dx:I}}if(-I>=lh&&Eo(C.flow.source)){const j=P.get(C.flow.source).node.participant,F=_o(C.flow.source,L=>L.x>=O.x&&!YB(L.id));return{groups:L0(F,j,C.flow.source,C.flow.id,v),dx:-I}}return null},B0=()=>Cu.map(v=>({id:v,plan:dh(v)})).filter(v=>!!v.plan).sort((v,C)=>Math.min(...v.plan.groups.flatMap(A=>A.subtree.map(O=>O.x)))-Math.min(...C.plan.groups.flatMap(A=>A.subtree.map(O=>O.x)))).map(v=>v.id);for(let v=0;v<3;v++){const C=Ur(),A=[];for(const N of B0()){const I=dh(N);if(!I)continue;const j=Is(I.groups,I.dx);j&&A.push(j)}if(!A.length)break;if(!Sa(C,Ur()))continue;for(const N of A.reverse())N();let O=!1;for(const N of B0()){const I=dh(N);I&&wo(I.groups,I.dx,()=>!0,Sa)&&(O=!0)}if(!O)break}for(const v of Cu){if(uh.has(v))continue;const C=P.get(v);if(!C||C.node.lane!==void 0)continue;const A=V(C);if(A===void 0)continue;const O=p(v),N=O?d(O):void 0;if(!O||!N)continue;const I=N.y+Q+R(`pool:${C.node.participant??""}`,A)*D,j=I-(O.y+O.height/2);j!==0&&!X(N,O,O.x+O.width/2,I)&&n.moveElements([O],{x:0,y:j})}for(const v of Cu.flatMap(C=>Ls.get(C)??[])){if(!Su(v.flow.id))continue;const C=p(v.flow.target);if(!C)continue;const A=f(P.get(v.flow.target).node.participant),O=_o(v.flow.target,F=>F.x>=C.x),N=C.width+H,I=Ea(v.flow.id),j=Ru(v.flow.id);for(let F=1;F<=k0;F++){const L=()=>Ea(v.flow.id)<I&&Ru(v.flow.id)>=j;if(GB(O,A,N*F,L))break}}const hh=_.map(v=>({id:v.flow.id,source:v.flow.source,target:v.flow.target,preexisting:!1})),N0=new Set(hh.map(v=>v.id));for(const v of o.filter(C=>C.type==="bpmn:MessageFlow"))N0.has(v.id)||!v.source||!v.target||v.source.type==="bpmn:Participant"!=(v.target.type==="bpmn:Participant")&&hh.push({id:v.id,source:v.source.id,target:v.target.id,preexisting:!0});for(const v of hh){if(!Su(v.id))continue;const C=p(v.source),A=p(v.target);if(!C||!A)continue;let O,N,I;if(v.preexisting){const[F,L]=C.type==="bpmn:Participant"?[A,C]:[C,A];if(O=Yr(F),O<L.x||O>L.x+L.width)continue;[N,I]=F.y<L.y?[F.y+F.height,L.y]:[L.y+L.height,F.y]}else{if(C.type==="bpmn:Participant"||A.type==="bpmn:Participant"||(O=C.x+C.width/2,Math.abs(O-(A.x+A.width/2))>15))continue;[N,I]=C.y<A.y?[C.y+C.height,A.y]:[A.y+A.height,C.y]}const j=[...P.values()].map(F=>p(F.node.id)).filter(F=>!!F&&F.id!==C.id&&F.id!==A.id).filter(F=>F.x<=O&&O<=F.x+F.width&&F.y+F.height>N&&F.y<I).sort((F,L)=>F.x-L.x);for(const F of j){const L=(K0=P.get(F.id))==null?void 0:K0.node.participant,W=L?p(L):void 0;if(!L||!W)continue;const re=[...P.values()].filter(ce=>ce.node.participant===L).map(ce=>ce.node.id),pe=ce=>ce.map(ne=>p(ne)).filter(ne=>!!ne),he=[NB(F.id,ce=>{var ne;return((ne=P.get(ce.id))==null?void 0:ne.node.participant)===L}),pe(re)].filter(ce=>ce.length).map(ce=>[{subtree:ce,pool:W}]);if(v.preexisting){const ce=pe(re);ce.length&&he.push(fh(new Map([[L,[...ce]]]),new Set(ce.map(ne=>ne.id)),v.id,()=>!1,ne=>ne===C.id||ne===A.id))}const ye=F.width+H,Ce=Ea(v.id),pt=Ru(v.id),Oe=()=>Ea(v.id)<Ce&&Ru(v.id)>=pt;let K=!1;for(const ce of he){for(let ne=1;ne<=k0;ne++)if(wo(ce,ye*ne,Oe)){K=!0;break}if(K)break}if(!Su(v.id))break}}const Mu=()=>{var C;const v=new Set;for(const A of gt(Xe(o)))A.kind!=="edge-crosses-shape"||N0.has(A.edge)||((C=p(A.edge))==null?void 0:C.type)==="bpmn:MessageFlow"&&v.add(`${A.edge}>${A.shape}`);return v},qB=(v,C)=>Ur().bad>=v&&[...Mu()].some(A=>!C.has(A)),$0=v=>{var C,A;return Ea(v)===0&&((A=(C=p(v))==null?void 0:C.waypoints)==null?void 0:A.length)===2},KB=(v,C,A)=>{const O=new Set(v.flatMap(I=>I.subtree.map(j=>j.id))),N=[...Mu()].filter(I=>!A.has(I)).map(I=>I.split(">")[1]);return[...new Set(N)].filter(I=>O.has(I)&&I!==C.source&&I!==C.target)},XB=(v,C,A,O,N)=>{const I=v.map(W=>({...W,subtree:W.subtree.filter(re=>!N.includes(re.id))})).filter(W=>W.subtree.length),j=new Set(I.flatMap(W=>W.subtree.map(re=>re.id))),F=()=>N.every(W=>{const re=p(W);return!!re&&E.filter(pe=>pe.flow.target===W&&j.has(pe.flow.source)).every(pe=>{const J=p(pe.flow.source);return!!J&&J.x+J.width<=re.x})});return wo(I,C,()=>$0(A.id)&&[...Mu()].every(W=>O.has(W))&&F(),Sa,!0)};for(const v of _){if(!Su(v.flow.id))continue;const C=p(v.flow.id);if(((X0=C==null?void 0:C.waypoints)==null?void 0:X0.length)!==2)continue;const A=p(v.flow.source),O=p(v.flow.target);if(!A||!O||A.type==="bpmn:Participant"||O.type==="bpmn:Participant"||!Eo(v.flow.source)||!Eo(v.flow.target)||Math.abs(Yr(A)-Yr(O))>jB)continue;const N=Yr(A),I=C.waypoints.map(Ce=>Ce.y),[j,F]=[Math.min(...I),Math.max(...I)],L=ni(Xe(o)).filter(Ce=>Ce.id!==A.id&&Ce.id!==O.id&&Ce.x<N&&N<Ce.x+Ce.width&&j<Ce.y+Ce.height&&Ce.y<F);if(!L.length)continue;const W=(Z0=P.get(v.flow.source))==null?void 0:Z0.node.participant,re=(Q0=P.get(v.flow.target))==null?void 0:Q0.node.participant;if(!W||!re)continue;const pe=new Map;for(const[Ce,pt,Oe]of[[v.flow.source,A,W],[v.flow.target,O,re]]){const K=pe.get(Oe)??[],ce=_o(Ce,ne=>ne.x>=pt.x).filter(ne=>!K.some(me=>me.id===ne.id));pe.set(Oe,[...K,...ce])}const J=new Set([...pe.values()].flat().map(Ce=>Ce.id)),he=fh(pe,J,v.flow.id,Ce=>Ce===v.flow.source||Ce===v.flow.target,()=>!1),ye=Math.max(...L.map(Ce=>Ce.x+Ce.width));for(const Ce of HB){const pt=ye+Ce-N;if(pt<=0)continue;const Oe=Ur().bad,K=Mu();let ce=[],ne=!0;const me=()=>!$0(v.flow.id)||ne&&(ce=KB(he,v.flow,K),ce.length)?!1:!qB(Oe,K);if(wo(he,pt,me,Sa))break;if(ce.length&&(XB(he,pt,v.flow,K,ce)||(ne=!1,wo(he,pt,me,Sa))))break}}{const v=A=>A.y+A.height/2,C=[];for(const A of P.keys()){if(!Eo(A))continue;const O=E.filter(j=>j.flow.target===A);if(O.length!==1)continue;const N=p(O[0].flow.source),I=p(A);!N||!I||!P.has(N.id)||Math.abs(v(N)-v(I))>1||I.x-(N.x+N.width)<=H+1||C.push({id:A,pred:N,node:I})}C.sort((A,O)=>A.node.x-O.node.x);for(const{id:A}of C){const O=P.get(A),N=p(A),I=p(E.find(J=>J.flow.target===A).flow.source);if(!N||!I)continue;const j=N.x-(I.x+I.width);if(j<=H+1)continue;const F=f(O.node.participant),L=_o(A,J=>J.x>=N.x),W=Ur(),re=zB(L,F,-(j-H));if(!re)continue;const pe=Ur();(pe.bad>W.bad||pe.crossings>=W.crossings||pe.straight<W.straight)&&re()}}T0(!0);const ZB=10,QB=400,JB=v=>[...v.incoming??[],...v.outgoing??[]].filter(C=>C.type==="bpmn:DataInputAssociation"||C.type==="bpmn:DataOutputAssociation").map(C=>C.source===v?C.target:C.source).filter(C=>!!C&&typeof C.y=="number"),eN=o.filter(v=>v.type==="bpmn:DataStoreReference"&&h.has(v.id)),tN=(v,C)=>{const A=v.x+v.width/2,O=v.y+v.height/2;let N;for(const I of eN){if((d(I)??u())!==C||I.y<v.y+v.height)continue;const j=Math.abs(I.x+I.width/2-A);j>QB||j<I.width||!JB(I).some(L=>L.height===v.height&&Math.abs(L.y+L.height/2-O)<=ZB&&I.y>=L.y+L.height)||(!N||j<N.dx||j===N.dx&&I.id<N.id)&&(N={dx:j,id:I.id,cy:I.y+I.height/2})}return N==null?void 0:N.cy};for(const v of g){const C=v.associations??[],A=C.map(I=>I.source===v.dataStore.id?I.target:I.source).map(p).find(Boolean),O=A?d(A)??u():u(),N=A?{x:A.x+A.width/2,y:tN(A,O)??A.y+A.height+110}:{x:200,y:Et+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:v.dataStore.id,name:v.dataStore.name})},N,O);for(const I of C)A0(v.dataStore.id,I)}for(const v of y){const A=f(v.association.target).type==="bpmn:DataStoreReference"?v.association.target:v.association.source;A0(A,v.association)}let F0=0;const So=10,j0=40,nN=(v,C)=>{const A=C.map(L=>d(L)).filter(L=>!!L);for(const L of A){const W=So,re=L.y,pe=L.y+L.height,J=L.x,he=L.x+L.width;if(Math.abs(v.y-re)<W){const ye=re+W-v.y;v.y+=ye,v.height-=ye}if(Math.abs(v.y+v.height-pe)<W&&(v.height=pe-W-v.y),Math.abs(v.x-J)<W){const ye=J+W-v.x;v.x+=ye,v.width-=ye}Math.abs(v.x+v.width-he)<W&&(v.width=he-W-v.x)}if(!A.length)return;const O=Math.min(...A.map(L=>L.y)),N=Math.max(...A.map(L=>L.y+L.height)),I=O-v.y,j=v.y+v.height-N,F=j0-So;if(I>0!=j>0)if(I>0&&I<F){const L=I+So;v.y+=L,v.height-=L}else j>0&&j<F&&(v.height-=j+So)},iN=(v,C)=>{const A=So,O=30,N=o.filter(I=>I.type==="bpmn:Group"&&I.id!==C);for(const I of N){const j=I.x,F=I.x+I.width,L=I.y,W=I.y+I.height,re=v.y<W&&L<v.y+v.height,pe=v.x<F&&j<v.x+v.width;if(re){if(Math.abs(v.x-F)<A){const J=Math.min(F+A-v.x,O);J>0&&v.width-J>0&&(v.x+=J,v.width-=J)}if(Math.abs(v.x+v.width-j)<A){const J=Math.min(v.x+v.width-(j-A),O);J>0&&v.width-J>0&&(v.width-=J)}}if(pe){if(Math.abs(v.y-W)<A){const J=Math.min(W+A-v.y,O);J>0&&v.height-J>0&&(v.y+=J,v.height-=J)}if(Math.abs(v.y+v.height-L)<A){const J=Math.min(v.y+v.height-(L-A),O);J>0&&v.height-J>0&&(v.height-=J)}}}},mh=(v,C)=>{const A=j0,O=Math.min(...v.map(L=>L.x))-A,N=Math.min(...v.map(L=>L.y))-A,I=Math.max(...v.map(L=>L.x+L.width))+A,j=Math.max(...v.map(L=>L.y+L.height))+A,F={x:O,y:N,width:I-O,height:j-N};return nN(F,v),iN(F,C),F};for(const v of w){const C=(v.group.members??[]).map(p).filter(N=>!!N);let A;C.length?A=mh(C,v.group.id):(A={x:300+F0*350,y:40,width:300,height:200},F0++);const O=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:v.group.id}),width:A.width,height:A.height},{x:A.x+A.width/2,y:A.y+A.height/2},u());v.group.name&&n.updateLabel(O,v.group.name),(J0=v.group.members)!=null&&J0.length&&T(O,"bwl:Members",{refs:v.group.members.join(" ")})}{const v=o.filter(N=>!!N.waypoints),C=new Map,A=(N,I)=>{!N||!I||(C.has(N)||C.set(N,new Set),C.get(N).add(I))};for(const N of v){const I=(eE=N.source)==null?void 0:eE.id,j=(tE=N.target)==null?void 0:tE.id;A(I,j),((nE=N.type)!=null&&nE.includes("DataOutputAssociation")||(iE=N.type)!=null&&iE.includes("DataInputAssociation")||N.type==="bpmn:Association")&&A(j,I)}const O=o.filter(N=>N.type==="bpmn:Group");for(const N of O){const j=(((rE=N.businessObject.extensionElements)==null?void 0:rE.values)??[]).find(Oe=>Oe.$type==="bwl:Members"),F=((j==null?void 0:j.refs)??"").split(" ").filter(Boolean);if(!F.length)continue;const L=new Set(F),W=[...F];for(;W.length;){const Oe=W.shift();for(const K of C.get(Oe)??[])L.has(K)||(L.add(K),W.push(K))}const re=N.x,pe=N.x+N.width,J=N.y,he=N.y+N.height,ye=Oe=>E.filter(K=>K.flow.target===Oe).length,Ce=Oe=>{var ce;const K=((ce=p(Oe))==null?void 0:ce.type)??"";if(K==="bpmn:StartEvent"&&ye(Oe)===0)return!1;if(K.endsWith("Gateway")){const ne=E.filter(me=>me.flow.target===Oe).map(me=>me.flow.source);if(ne.length&&ne.every(me=>{var Ve;return((Ve=p(me))==null?void 0:Ve.type)==="bpmn:StartEvent"&&ye(me)===0}))return!1}return!0},pt=o.filter(Oe=>fr(Oe)).filter(Oe=>Oe.type!=="bpmn:Group"&&Oe.type!=="bpmn:Participant"&&Oe.type!=="bpmn:TextAnnotation"&&!L.has(Oe.id)&&Eo(Oe.id)&&Ce(Oe.id)&&Oe.x<pe&&Oe.x+Oe.width>re&&Oe.y<he&&Oe.y+Oe.height>J);if(pt.length)for(const Oe of[-1,1]){const K=pt.filter(ve=>(ve.x+ve.width-re<=pe-ve.x?-1:1)===Oe);if(!K.length)continue;const ce=[];for(const ve of K){const oe=ce.find(de=>de.some(Ie=>ve.y<Ie.y+Ie.height&&ve.y+ve.height>Ie.y));oe?oe.push(ve):ce.push([ve])}const ne=new Map;for(const ve of ce){let oe=Oe<0?re-So:pe+So;for(const de of[...ve].sort((Ie,qe)=>Oe<0?qe.x-Ie.x:Ie.x-qe.x)){const Ie=Oe<0?Math.min(de.x,oe-de.width):Math.max(de.x,oe);oe=Oe<0?Ie-Yi:Ie+de.width+Yi,Ie!==de.x&&Math.sign(Ie-de.x)===Oe&&ne.set(de.id,Ie-de.x)}}const me=new Map,Ve=ve=>me.get(ve)===ve||!me.get(ve)?ve:Ve(me.get(ve));for(const ve of K)me.set(ve.id,ve.id);for(const ve of _){const oe=ne.has(ve.flow.source)?ve.flow.source:void 0,de=ne.has(ve.flow.target)?ve.flow.target:void 0;if(!oe||!de)continue;const Ie=p(ve.flow.id);((oE=Ie==null?void 0:Ie.waypoints)==null?void 0:oE.length)===2&&me.set(Ve(oe),Ve(de))}const We=new Map;for(const ve of K){if(!ne.has(ve.id))continue;const oe=Ve(ve.id);We.set(oe,[...We.get(oe)??[],ve])}const Ct=[...We.values()].sort((ve,oe)=>Oe<0?Math.min(...ve.map(de=>de.x))-Math.min(...oe.map(de=>de.x)):Math.max(...oe.map(de=>de.x))-Math.max(...ve.map(de=>de.x))),Ft=[];let ge=!0;for(const ve of Ct){const oe=ve.map(qe=>ne.get(qe.id)??0).reduce((qe,ke)=>Math.abs(ke)>Math.abs(qe)?ke:qe,0),de=new Map;let Ie=!0;for(const qe of ve){const ke=d(qe);if(!ke){Ie=!1;break}de.has(ke.id)||de.set(ke.id,{subtree:[],pool:ke}),de.get(ke.id).subtree.push(qe)}Ie&&wo([...de.values()],oe,()=>!0,Sa)?Ft.push({shapes:ve,dx:oe}):ge=!1}if(!ge)for(const ve of Ft.reverse())n.moveElements(ve.shapes,{x:-ve.dx,y:0})}}}{const v=new Set([...w.map(C=>C.group.id),...Xt(e,"group.update").map(C=>C.id)]);for(const C of o.filter(A=>A.type==="bpmn:Group")){if(v.has(C.id))continue;const O=(((aE=C.businessObject.extensionElements)==null?void 0:aE.values)??[]).find(F=>F.$type==="bwl:Members"),N=((O==null?void 0:O.refs)??"").split(" ").filter(Boolean).map(p).filter(F=>!!F);!N.length||!N.some(F=>{const L=h.get(F.id);return!L||L.x!==F.x||L.y!==F.y})||!N.some(F=>F.x<C.x||F.y<C.y||F.x+F.width>C.x+C.width||F.y+F.height>C.y+C.height)||n.resizeShape(C,mh(N,C.id))}}{const C=new Map(to(Xe(o)).map(F=>[F.owner,F.rect])),A=o.filter(F=>!!F.waypoints),O=new Map,N=(F,L)=>{!F||!L||(O.has(F)||O.set(F,new Set),O.get(F).add(L))};for(const F of A){const L=(sE=F.source)==null?void 0:sE.id,W=(cE=F.target)==null?void 0:cE.id;N(L,W),((lE=F.type)!=null&&lE.includes("DataOutputAssociation")||(uE=F.type)!=null&&uE.includes("DataInputAssociation")||F.type==="bpmn:Association")&&N(W,L)}const I=F=>E.filter(L=>L.flow.target===F).length,j=F=>{var W;const L=((W=p(F))==null?void 0:W.type)??"";if(L==="bpmn:StartEvent"&&I(F)===0)return!1;if(L.endsWith("Gateway")){const re=E.filter(pe=>pe.flow.target===F).map(pe=>pe.flow.source);if(re.length&&re.every(pe=>{var J;return((J=p(pe))==null?void 0:J.type)==="bpmn:StartEvent"&&I(pe)===0}))return!1}return!0};for(const F of o.filter(L=>L.type==="bpmn:Group")){const W=(((pE=F.businessObject.extensionElements)==null?void 0:pE.values)??[]).find(oe=>oe.$type==="bwl:Members"),re=((W==null?void 0:W.refs)??"").split(" ").filter(Boolean);if(!re.length)continue;const pe=re.map(p).filter(oe=>!!oe);if(!pe.length||!(w.some(oe=>oe.group.id===F.id)||Xt(e,"group.update").some(oe=>oe.id===F.id)||pe.some(oe=>{const de=h.get(oe.id);return!de||de.x!==oe.x||de.y!==oe.y})))continue;const he=new Set(re),ye=[...re];for(;ye.length;){const oe=ye.shift();for(const de of O.get(oe)??[])he.has(de)||(he.add(de),ye.push(de))}const Ce=F.x,pt=F.x+F.width,Oe=F.y,K=F.y+F.height,ce=oe=>{const de=C.get(oe.id),Ie={x:oe.x,y:oe.y,width:oe.width,height:oe.height};return de?[Ie,{x:de.x,y:de.y,width:de.width,height:de.height}]:[Ie]},ne=pe.flatMap(ce),me=Math.min(...ne.map(oe=>oe.x)),Ve=Math.max(...ne.map(oe=>oe.x+oe.width)),We=Math.min(...ne.map(oe=>oe.y)),Ct=Math.max(...ne.map(oe=>oe.y+oe.height)),Ft={L:me-Ce,R:pt-Ve,T:We-Oe,B:K-Ct},ge=o.filter(oe=>fr(oe)).filter(oe=>oe.type!=="bpmn:Group"&&oe.type!=="bpmn:Participant"&&oe.type!=="bpmn:TextAnnotation"&&!he.has(oe.id)&&j(oe.id)&&oe.x<pt&&oe.x+oe.width>Ce&&oe.y<K&&oe.y+oe.height>Oe);if(!ge.length)continue;const ve={L:0,R:0,T:0,B:0};for(const oe of ge){const de=ce(oe),Ie=Math.min(...de.map(Ae=>Ae.x)),qe=Math.max(...de.map(Ae=>Ae.x+Ae.width)),ke=Math.min(...de.map(Ae=>Ae.y)),He=Math.max(...de.map(Ae=>Ae.y+Ae.height)),Qe={L:qe-Ce,R:pt-Ie,T:He-Oe,B:K-ke},we=["L","R","T","B"].filter(Ae=>Qe[Ae]<=Ft[Ae]+.001);if(!we.length)continue;const lt=we.reduce((Ae,St)=>Qe[St]<Qe[Ae]?St:Ae,we[0]);ve[lt]=Math.max(ve[lt],Math.min(Qe[lt]+10,Ft[lt]))}!ve.L&&!ve.R&&!ve.T&&!ve.B||n.resizeShape(F,{x:F.x+ve.L,y:F.y+ve.T,width:F.width-ve.L-ve.R,height:F.height-ve.T-ve.B})}}const H0=v=>{const C=v.waypoints;if(C!=null&&C.length){const O=C[Math.floor((C.length-1)/2)];return{x:O.x,y:O.y,width:0,height:0}}const A=v;return{x:A.x,y:A.y,width:A.width,height:A.height}};let Bs=0;const z0=12,G0=14,rN=15,oN=300,aN=v=>{const C=v.split(`
7
- `),A=Math.max(...C.map(I=>Io(I,z0))),O=Math.max(100,Math.min(oN,Math.ceil(A)+G0)),N=C.reduce((I,j)=>I+Math.max(1,Math.ceil((Io(j,z0)+G0)/O)),0);return{width:O,height:Math.max(30,N*rN+10)}};for(const v of S){const C=v.association,A=((fE=v.placement)==null?void 0:fE.anchor)??(C?C.source===v.annotation.id?C.target:C.source:void 0),O=A?p(A):void 0,N=O?H0(O):void 0,I=aN(v.annotation.text??"");let j;if(N&&v.placement){const[re,pe]=pc[v.placement.side],J=v.placement.offset??50;j={x:N.x+N.width/2+re*(N.width/2+I.width/2+J),y:N.y+N.height/2+pe*(N.height/2+I.height/2+J)}}else N?(j={x:N.x+N.width/2+180+Bs%3*260,y:N.y-110-Bs%2*95},Bs++):(j={x:300+Bs*260,y:60},Bs++);const F=O?d(O)??u():u(),L=F;N&&typeof L.x=="number"&&typeof L.width=="number"&&L.type==="bpmn:Participant"&&(j=lp(o,N,I,L,v.placement?{placement:v.placement}:{from:j}));const W=n.createShape({type:"bpmn:TextAnnotation",width:I.width,height:I.height,businessObject:i.create("bpmn:TextAnnotation",{id:v.annotation.id,text:v.annotation.text})},j,F);if(C){const re=pe=>pe===v.annotation.id?W:f(pe);n.connect(re(C.source),re(C.target),C.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:C.id})}:{type:"bpmn:Association"})}v.placement&&T(W,"bwl:Placement",$(v.placement))}for(const v of Xt(e,"association.add")){const C=v.association;n.connect(f(C.source),f(C.target),C.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:C.id})}:{type:"bpmn:Association"})}const V0=()=>new Set(o.getAll().filter(v=>v.type!=="label").map(v=>v.id));for(const v of Xt(e,"node.update")){let C=f(v.id);if(v.type&&uc(v.type)!==C.type){const A=C.x+C.width/2,O=C.y+C.height/2,N=V0();C=c.replaceElement(C,{type:uc(v.type),...v.eventDefinition?{eventDefinitionType:zs[v.eventDefinition]}:{}});const I=V0(),j=[...N].filter(W=>W!==v.id&&!I.has(W));if(j.length)throw new Qm({kind:"type-change-drops-elements",opIndex:e.indexOf(v),id:v.id,type:v.type,dropped:j});const F=Math.round(A-(C.x+C.width/2)),L=Math.round(O-(C.y+C.height/2));if(F!==0||L!==0){n.moveShape(C,{x:F,y:L});for(const W of[...C.incoming??[],...C.outgoing??[]])_a(W)}}if(v.name!==void 0&&n.updateProperties(C,{name:v.name??void 0}),v.lane||v.band!==void 0){v.band!==void 0&&n.updateProperties(C,{"bwl:band":v.band});const A=C.y+C.height/2,O=d(C),N=v.lane?f(v.lane):((O==null?void 0:O.children)??[]).find(j=>j.type==="bpmn:Lane"&&A>=j.y&&A<=j.y+j.height);v.band!==void 0&&mt(N==null?void 0:N.id,v.band,O);const I=N?N.y+(v.band===void 0?N.height/2:Math.min(N.height/2,fe)+R(N.id,v.band)*D):v.band!==void 0&&O?O.y+Q+R(`pool:${O.id}`,v.band)*D:void 0;if(I!==void 0){const j=I-A;j!==0&&n.moveElements([C],{x:0,y:j})}}}for(const v of Xt(e,"sequenceFlow.update")){const C=f(v.id);if(v.source!==void 0||v.target!==void 0){const A=C,O=v.source!==void 0?f(v.source):A.source,N=v.target!==void 0?f(v.target):A.target,I=L=>({x:L.x+L.width/2,y:L.y+L.height/2});n.reconnect(A,O,N,[I(O),I(N)]);const j=M0.get(A.id),F=N.y+N.height/2;if(j&&N.x>j.exit.x&&Math.abs(F-j.exit.y)>1){n.updateWaypoints(A,[j.exit,{x:j.exit.x,y:F},{x:N.x,y:F}]);const L=A.label;if(L&&j.label){const re=Math.abs(j.label.y+L.height/2-j.channelY)<=D/5&&j.label.x+L.width>j.exit.x,pe=j.exit.x+6,J=N.x-6-L.width,he=re?J>=pe?{x:Math.max(pe,Math.min(j.label.x,J)),y:j.label.y+(F-j.channelY)}:void 0:j.label;he&&(he.x!==L.x||he.y!==L.y)&&n.moveElements([L],{x:he.x-L.x,y:he.y-L.y})}}else Math.abs(F-(O.y+O.height/2))>1&&_a(A)}v.name!==void 0&&n.updateProperties(C,{name:v.name??void 0}),v.condition!==void 0&&n.updateProperties(C,{name:((dE=v.condition)==null?void 0:dE.label)??void 0})}for(const v of Xt(e,"messageFlow.update"))v.name!==void 0&&n.updateProperties(f(v.id),{name:v.name??void 0});for(const v of Xt(e,"dataStore.update"))v.name!==void 0&&n.updateProperties(f(v.id),{name:v.name??void 0});for(const v of Xt(e,"annotation.update")){const C=f(v.id);if(v.text!==void 0&&n.updateProperties(C,{text:v.text}),v.placement===null)T(C,"bwl:Placement",null);else if(v.placement){const A=f(v.placement.anchor),O=H0(A),N=d(A)??u(),I=typeof N.x=="number"&&typeof N.width=="number"&&N.type==="bpmn:Participant",[j,F]=pc[v.placement.side],L=v.placement.offset??50,W={x:O.x+O.width/2+j*(O.width/2+C.width/2+L),y:O.y+O.height/2+F*(O.height/2+C.height/2+L)},re=I?lp(o,O,{width:C.width,height:C.height},N,{placement:v.placement,selfId:v.id}):W;n.moveElements([C],{x:re.x-(C.x+C.width/2),y:re.y-(C.y+C.height/2)}),T(C,"bwl:Placement",$(v.placement))}}for(const v of Xt(e,"group.update")){const C=f(v.id);if(v.name!==void 0&&n.updateLabel(C,v.name??""),v.members){const A=v.members.map(p).filter(O=>!!O);A.length&&n.resizeShape(C,mh(A,v.id)),T(C,"bwl:Members",{refs:v.members.join(" ")})}}}function up(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 sR(e,t,n){var u,p;const{elementRegistry:i}=e,r=e.modeling,o=f=>gt(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(up))].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 fe=d.x+d.width/2,Me=d.y+d.height/2;m=i.getAll().find(Be=>{if(Be.type!=="bpmn:Participant")return!1;const it=Be;return typeof it.x=="number"&&typeof it.width=="number"&&fe>=it.x&&fe<=it.x+it.width&&Me>=it.y&&Me<=it.y+it.height})}if(!m||typeof m.x!="number"||typeof m.width!="number")continue;const E=(((u=d.businessObject.extensionElements)==null?void 0:u.values)??[]).find(fe=>fe.$type==="bwl:Placement"),_=[...d.incoming??[],...d.outgoing??[]].find(fe=>fe.type==="bpmn:Association"),g=(E!=null&&E.anchor?i.get(E.anchor):void 0)??(_?((p=_.source)==null?void 0:p.id)===f?_.target:_.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},w={width:d.width,height:d.height},P={x:d.x+d.width/2,y:d.y+d.height/2},T=E==null?void 0:E.side,$=[];T&&T in pc&&$.push(lp(i,S,w,m,{placement:{side:T,offset:(E==null?void 0:E.offset)??null},selfId:f}));for(const[fe,Me]of[[-1,0],[1,0],[0,-1],[0,1]])for(let Be=1;Be<=aR;Be++)$.push({x:P.x+fe*Zm*Be,y:P.y+Me*Zm*Be});const k={...s,edges:s.edges.filter(fe=>fe.id!==(_==null?void 0:_.id))},D=o(k),H=D.filter(fe=>up(fe).includes(f)).length;if(!H)continue;let Q;for(const fe of $){const Me=fe.x-P.x,Be=fe.y-P.y;if(!Me&&!Be||fe.x-w.width/2<m.x||fe.x+w.width/2>m.x+m.width||fe.y-w.height/2<m.y||fe.y+w.height/2>m.y+m.height)continue;const it={...k,shapes:k.shapes.map(be=>be.id===f?{...be,x:be.x+Me,y:be.y+Be}:be)},X=o(it),ee=X.filter(be=>up(be).includes(f)).length;if(ee>=H||X.length>D.length)continue;const ue=Math.abs(Me)+Math.abs(Be);if((!Q||ee<Q.mine||ee===Q.mine&&(X.length<Q.all||X.length===Q.all&&ue<Q.dist))&&(Q={x:fe.x,y:fe.y,mine:ee,all:X.length,dist:ue}),Q.mine===0&&Q.all<D.length)break}Q&&r.moveElements([d],{x:Q.x-P.x,y:Q.y-P.y})}}const cR=60;function pp(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 lR(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=u=>gt(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 b=!1;for(const E of n.shapes)E.type!=="bpmn:Group"||f.has(E.id)||[...d].some(_=>{const g=s.get(_);return g&&c(E,g)})&&(f.add(E.id),b=!0);for(const E of n.shapes)E.type!=="bpmn:Participant"||d.has(E.id)||[...f].some(_=>{const g=s.get(_);return g&&c(g,E)})&&(d.add(E.id),b=!0);if(!b)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(b=>{const E=s.get(b);return E&&c(E,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,w]=y.pools,P=h.get(S),T=h.get(w);if(!P||!T)continue;const[$,k]=P.x<=T.x?[P,T]:[T,P];if(y.contained)continue;const D=s.get($.id),H=s.get(k.id),Q=D&&H?Math.max(H.x-(D.x+D.width),0):cR,fe=$.x+$.width+Q-k.x;if(fe<=0)continue;const Me=l(k.id).filter(Be=>i.get(Be));Me.length&&(!m||fe>m.dx)&&(m={movers:Me,dx:fe})}if(!m)return;const b=m.movers.map(y=>i.get(y)).filter(y=>!!y&&typeof y.x=="number");if(!b.length)return;const E=f.length,_=d.length;r.moveElements(b,{x:m.dx,y:0});const g=o(Xe(i));if(!(a(g).length<_&&g.length<=E)){r.moveElements(b,{x:-m.dx,y:0});return}}}const fc=.5,eg=150;function uR(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)>fc)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))>fc))return;const l=s.map(g=>g.x+g.width);if(Math.max(...l)-Math.min(...l)<=fc)return;const u=g=>g.x+g.width,p=g=>!!g&&typeof g.width=="number",f=g=>{const y={shapes:[],edges:[],lanes:[]},S=w=>{for(const P of w.children??[]){if("waypoints"in P&&P.waypoints){y.edges.push(P);continue}P.type!=="label"&&(P.type==="bpmn:Lane"?y.lanes.push(P):y.shapes.push(P),S(P))}};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(w=>[u(w),...p(w.label)?[u(w.label)]:[]]);S.length&&(h=Math.max(h,Math.max(...S)+eg))}const m=s.filter(g=>Math.abs(u(g)-h)>fc);if(!m.length)return;for(const g of m){const y=u(g),{shapes:S,edges:w,lanes:P}=d.get(g.id);if([...S.flatMap(k=>[u(k),...p(k.label)?[u(k.label)]:[]]),...w.flatMap(k=>[...k.waypoints.map(D=>D.x),...p(k.label)?[u(k.label)]:[]])].some(k=>k>h)||[...(g.incoming??[]).map(k=>k.waypoints[k.waypoints.length-1]),...(g.outgoing??[]).map(k=>k.waypoints[0])].some(k=>!k||k.x>h||Math.abs(k.x-y)<1))return;if(h>y){const k={x:y,y:g.y,width:h-y,height:g.height},D=new Set([g.id,...S.map(Q=>Q.id),...w.map(Q=>Q.id),...P.map(Q=>Q.id)]);if(n.getAll().some(Q=>{var Be;if("waypoints"in Q&&Q.waypoints||Q.type==="bpmn:Group"||!p(Q))return!1;const fe=Q.type==="label"?(Be=Q.labelTarget)==null?void 0:Be.id:Q.id;if(!fe||D.has(fe)||D.has(Q.id))return!1;const Me=Q;return Me.x<k.x+k.width&&Me.x+Me.width>k.x&&Me.y<k.y+k.height&&Me.y+Me.height>k.y}))return}}const b=()=>new Set(gt(Xe(n)).map(ft)),E=b(),_=m.map(g=>g.width);for(const g of m)pp(i,g,h-g.x,{layout:!1});[...b()].every(g=>E.has(g))||m.forEach((g,y)=>pp(i,g,_[y],{layout:!1}))}function pR(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=l=>gt(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(w=>w.id!==l.id&&w.type!=="bpmn:Group"&&a(l,w));if(!p.length)continue;const f=p.map(w=>i.get(w.id)).filter(w=>!!w&&typeof w.x=="number");if(f.length!==p.length)continue;const d=s(p),h=s(f),m=h.l+(l.x-d.l),b=h.t+(l.y-d.t),E=h.r+(l.x+l.width-d.r),_=h.b+(l.y+l.height-d.b),g={x:m,y:b,width:E-m,height:_-b};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 dc=20,hc=10;function fR(e,t,n,i){var p,f;const{elementRegistry:r}=e,o=e.modeling,a=d=>new Set(gt(d,{includeObservationOnly:!0}).filter(h=>h.kind==="edge-along-group-boundary").map(ft)),s=Xe(r),c=gt(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(Te=>Te.id===d);if(!((p=m==null?void 0:m.members)!=null&&p.length))continue;const b=l.get(d);if(!(!b||Math.abs(b.x-m.x)>=.5||Math.abs(b.y-m.y)>=.5||Math.abs(b.width-m.width)>=.5||Math.abs(b.height-m.height)>=.5))continue;const _=m.members.map(Te=>r.get(Te)).filter(Te=>!!Te&&typeof Te.x=="number");if(!_.length)continue;const g=Math.min(..._.map(Te=>Te.x)),y=Math.min(..._.map(Te=>Te.y)),S=Math.max(..._.map(Te=>Te.x+Te.width)),w=Math.max(..._.map(Te=>Te.y+Te.height)),P=m.x,T=m.y,$=m.x+m.width,k=m.y+m.height;let D=P,H=T,Q=$,fe=k;for(const Te of h){const B=s.edges.find(x=>x.id===Te.edge);if(!B)continue;const R=B.endpoints.some(x=>{const G=s.shapes.find(Re=>Re.id===x);if(!G||G.container)return!1;const Y=G.x+G.width/2,Z=G.y+G.height/2;return P<Y&&Y<$&&T<Z&&Z<k});for(const x of dn(B)){const G=x.axis==="v"?[T,k]:[P,$];Math.min(x.hi,G[1])-Math.max(x.lo,G[0])<Ku||(x.axis==="v"?P<x.at&&x.at<$:T<x.at&&x.at<k)&&R||(x.axis==="v"?(Math.abs(x.at-P)<=Lo&&(D=Math.max(D,x.at+dc)),Math.abs(x.at-$)<=Lo&&(Q=Math.min(Q,x.at-dc))):(Math.abs(x.at-T)<=Lo&&(H=Math.max(H,x.at+dc)),Math.abs(x.at-k)<=Lo&&(fe=Math.min(fe,x.at-dc))))}}if(D>g-hc&&(D=P),H>y-hc&&(H=T),Q<S+hc&&(Q=$),fe<w+hc&&(fe=k),D===P&&H===T&&Q===$&&fe===k)continue;const Me=r.get(d),Be={x:Me.x,y:Me.y,width:Me.width,height:Me.height},it=Xe(r),X=new Set(gt(it).map(ft)),ee=a(it);o.resizeShape(Me,{x:D,y:H,width:Q-D,height:fe-H});let ue=Xe(r),be=gt(ue).filter(Te=>!X.has(ft(Te)));const q=[];if(be.length>0&&be.every(Te=>Te.kind==="label-over-line"&&!i.has(Te.edge)&&ue.edges.some(B=>B.id===Te.edge))){for(const Te of be){if(Te.kind!=="label-over-line")continue;const B=ue.edges.find(Z=>Z.id===Te.edge),R=B&&sp(B,ue),x=(f=r.get(Te.edge))==null?void 0:f.label;if(!R||!x)continue;const G=R.x-x.x,Y=R.y-x.y;o.moveElements([x],{x:G,y:Y}),q.push({label:x,dx:G,dy:Y})}ue=Xe(r),be=gt(ue).filter(Te=>!X.has(ft(Te)))}const ie=a(ue),Pe=[...ie].some(Te=>!ee.has(Te));if(be.length||Pe||ie.size>=ee.size){for(const Te of q.reverse())o.moveElements([Te.label],{x:-Te.dx,y:-Te.dy});o.resizeShape(Me,Be)}}}function tg(e,t,n=Jm){var y,S;const i=Km(e),r=qm(t,bm(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(gt(a).map(ft)),c=new Set(gt(a,{includeObservationOnly:!0}).map(ft)),l=new Set(a.edges.map(w=>w.id)),u=new Set(t.flatMap(w=>w.kind==="sequenceFlow.update"&&(w.source!==void 0||w.target!==void 0)?[w.id]:[])),p=new Set(a.shapes.map(w=>w.id)),f=ic(a),d=f.length,h=new Set(f.map(([w,P])=>`${w}|${P}`)),m=new Map;for(const w of i.elementRegistry.filter(P=>"waypoints"in P&&!!P.waypoints))w.label&&m.set(w.id,{wps:w.waypoints.map(P=>({x:P.x,y:P.y})),label:{x:w.label.x,y:w.label.y},source:(y=w.source)==null?void 0:y.id,target:(S=w.target)==null?void 0:S.id});const b=e.get("commandStack");try{Sh(b,()=>{n(t,i),lR(i,s,a),uR(i,a),pR(i,s,a),Cm(i,l);const w=ip(i,s);Em(i,h,l),Bm(i,s,l),Pm(i,l),US(i,l,u),Om(i,s,l),XS(i,s,l),zm(i,s,l),Hm(i,l),Vm(i,p),sR(i,s,p),ip(i,s,w),fR(i,c,a,l),Wm(i,s),jm(i,m)})}catch(w){return{ok:!1,issues:[w instanceof Qm?w.issue:{kind:"lower-failed",message:w instanceof Error?w.message:String(w)}],findings:[],stats:o}}const E=Xe(i.elementRegistry),_=gt(E,{includeObservationOnly:!0}).filter(w=>!c.has(ft(w))),g=lm(E);return{ok:!0,issues:[],findings:_,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 ng(e,t){return typeof e.get=="function"?e.get(t):e[t]}function ig(e,t){const n=ng(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function rg(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(r=>(r==null?void 0:r.$type)===t)}function hR(e){return typeof e=="string"&&ku.includes(e)}function Ri(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){const t=e.rootElements??[],n=t.find(X=>X.$type==="bpmn:Collaboration"),i=new Map(t.filter(X=>X.$type==="bpmn:Process").map(X=>[X.id,X])),r=[],o=[],a=[],s=[],c=[],l=[],u={poolOrders:{},bands:{},placements:{},afterColumns:{}},p=[],f=[],d=[],h=[],m=[],b=[],E=[],_=new Set,g=new Set,y=X=>{X&&_.add(X)},S=X=>{_.add(X),g.add(X)},w=X=>{const ee=rg(X,"bwl:Placement");if(!ee)return;const ue=typeof ee.anchor=="string"?ee.anchor:void 0;if(!ue||!hR(ee.side))return;const be=typeof ee.offset=="number"?ee.offset:void 0;m.push({owner:X.id,anchor:ue,side:ee.side,...be!==void 0?{offset:be}:{}})},P=X=>{const ee=rg(X,"bwl:Members"),ue=typeof(ee==null?void 0:ee.refs)=="string"?ee.refs.split(/\s+/).filter(Boolean):[];ue.length&&E.push({owner:X.id,refs:ue})},T=X=>{var ee;for(const ue of X)switch(y(ue.id),ue.$type){case"bpmn:TextAnnotation":S(ue.id),s.push({id:ue.id,text:typeof ue.text=="string"?ue.text:""}),w(ue);break;case"bpmn:Association":d.push({id:ue.id,type:ue.$type,source:Ri(ue.sourceRef),target:Ri(ue.targetRef)});break;case"bpmn:Group":{S(ue.id);const be=(ee=ue.categoryValueRef)==null?void 0:ee.value;c.push({id:ue.id,...typeof be=="string"&&be?{name:be}:{}}),P(ue);break}default:l.push({id:ue.id,type:ue.$type,reason:"type-outside-mvp"})}},$=X=>{for(const ee of X.flowElements??[])y(ee.id),l.push({id:ee.id,type:ee.$type,reason:"inside-container"}),(ee.flowElements??[]).length&&$(ee);for(const ee of X.artifacts??[])y(ee.id),l.push({id:ee.id,type:ee.$type,reason:"inside-container"})},k=(X,ee)=>{const ue=X.flowElements??[],be=(X.laneSets??[]).flatMap(V=>V.lanes??[]),q=new Map;for(const V of be){y(V.id);for(const ie of V.flowNodeRef??[]){const Pe=Ri(ie);Pe&&q.set(Pe,V.id)}}for(const V of ue){if(y(V.id),V.$type==="bpmn:SequenceFlow"){p.push({id:V.id,source:Ri(V.sourceRef),target:Ri(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),Pe=ie==="intermediateCatchEvent"?Pu((V.eventDefinitions??[]).map(x=>x.$type)):void 0;if(!vh(ie)||ie==="intermediateCatchEvent"&&!Pe){l.push({id:V.id,type:V.$type,reason:"type-outside-mvp"});continue}S(V.id);const Te=ie==="boundaryEvent"?Ri(V.attachedToRef):void 0;o.push({id:V.id,type:ie,...V.name?{name:V.name}:{},...ee?{participant:ee}:{},...q.has(V.id)?{lane:q.get(V.id)}:{},...Te?{attachedTo:Te}:{},...Pe?{eventDefinition:Pe}:{}}),ie==="subProcess"&&$(V);const B=ig(V,"bwl:band");B!==void 0&&(u.bands[V.id]=B);const R=ng(V,"bwl:afterColumn");typeof R=="string"&&R!==""&&b.push([V.id,R]);for(const x of V.dataOutputAssociations??[])y(x.id),h.push({id:x.id,type:x.$type,source:V.id,target:Ri(x.targetRef)});for(const x of V.dataInputAssociations??[])y(x.id),h.push({id:x.id,type:x.$type,source:Ri((x.sourceRef??[])[0]),target:V.id})}T(X.artifacts??[])};if(n){const X=new Set;for(const ee of n.participants??[]){S(ee.id);const ue=Ri(ee.processRef);ue&&X.add(ue);const be=ue?i.get(ue):void 0,q=((be==null?void 0:be.laneSets)??[]).flatMap(Te=>Te.lanes??[]),V=q.map(Te=>({id:Te.id,...Te.name?{name:Te.name}:{}}));for(const Te of V)S(Te.id);const ie=!be||(be.flowElements??[]).length===0&&q.length===0&&(be.artifacts??[]).length===0;r.push({id:ee.id,...ee.name?{name:ee.name}:{},...ie?{blackBox:!0}:{},...V.length?{lanes:V}:{}});const Pe=ig(ee,"bwl:poolOrder");Pe!==void 0&&(u.poolOrders[ee.id]=Pe),be&&k(be,ee.id)}for(const ee of n.messageFlows??[])y(ee.id),f.push({id:ee.id,source:Ri(ee.sourceRef),target:Ri(ee.targetRef),...typeof ee.name=="string"&&ee.name?{name:ee.name}:{}});T(n.artifacts??[]);for(const[ee,ue]of i)!X.has(ee)&&(ue.flowElements??[]).length>0&&l.push({id:ee,type:ue.$type,reason:"unreachable-process"})}else for(const X of i.values())k(X);const D=[],H=[],Q=[],fe=[],Me=(X,ee)=>!!X&&!!ee&&g.has(X)&&g.has(ee);for(const X of p){if(!Me(X.source,X.target)){l.push({id:X.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}D.push({id:X.id,source:X.source,target:X.target,...X.name?{name:X.name}:{}}),g.add(X.id)}for(const X of f){if(!Me(X.source,X.target)){l.push({id:X.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}H.push({id:X.id,source:X.source,target:X.target,...X.name?{name:X.name}:{}}),g.add(X.id)}for(const X of h){if(!Me(X.source,X.target)){l.push({id:X.id??"",type:X.type,reason:"endpoint-outside-mvp"});continue}fe.push({...X.id?{id:X.id}:{},source:X.source,target:X.target}),X.id&&g.add(X.id)}for(const X of d){if(!Me(X.source,X.target)){l.push({id:X.id??"",type:X.type,reason:"endpoint-outside-mvp"});continue}Q.push({...X.id?{id:X.id}:{},source:X.source,target:X.target})}const Be=new Map(c.map(X=>[X.id,X]));for(const{owner:X,refs:ee}of E){const ue=ee.filter(q=>_.has(q)),be=Be.get(X);be&&ue.length&&(be.members=ue)}for(const X of m)_.has(X.anchor)&&(u.placements[X.owner]={anchor:X.anchor,side:X.side,...X.offset!==void 0?{offset:X.offset}:{}});for(const[X,ee]of b)_.has(ee)&&(u.afterColumns[X]=ee);return{definition:{...r.length?{participants:r}:{},nodes:o,sequenceFlows:D,...H.length?{messageFlows:H}:{},...a.length?{dataStores:a}:{},...fe.length?{dataAssociations:fe}:{},...s.length?{annotations:s}:{},...Q.length?{associations:Q}:{},...c.length?{groups:c}:{}},hints:u,omitted:l}}async function mR(e){const{definitions:t,warnings:n}=await Oo(e);return{...og(t),warnings:n}}const gR=new Set(["bpmn:ExclusiveGateway","bpmn:ParallelGateway","bpmn:InclusiveGateway","bpmn:EventBasedGateway","bpmn:ComplexGateway"]);function fp(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function yR(e){return fp(e.processRef)!==void 0}function vR(e){const t=new Set,n=r=>{const o=fp(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 bR(e){const t=[],n=i=>{for(const r of i.flowElements??[])gR.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 xR(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 dp(e){const t=[],n=e.rootElements??[],i=vR(e);for(const o of bR(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??[])yR(s)&&xR(o.get(fp(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 _R(e){const{definitions:t,warnings:n}=await Oo(e);return{issues:dp(t),warnings:n}}const wR=.5,ER=8,SR=new Set(["bpmn:Definitions","bpmn:Collaboration","bpmn:Process","bpmn:LaneSet","bpmn:ExtensionElements","bpmn:Documentation","bpmn:Relationship","bpmn:Property","bpmn:Category","bpmn:CategoryValue"]),Ho=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 RR(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 CR(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?[Ho(s.x),Ho(s.y),Ho(s.width),Ho(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=>[Ho(f.x),Ho(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 ag(e){const t=CR(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:")&&!SR.has(s)&&n.set(c,{type:s,props:RR(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 sg(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 cg(e,t,n={}){const i=n.moveTolerance??wR,r=ag(e),o=ag(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||sg(p.geometry,u.geometry,i)||sg(p.label,u.label,n.labelTolerance??ER))&&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 MR(e,t,n={}){const[i,r]=await Promise.all([Oo(e),Oo(t)]);return{...cg(i.definitions,r.definitions,n),warnings:[...i.warnings,...r.warnings]}}function AR(e){return new Set([...e.added,...e.modified])}function PR(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function lg(e,t,{currentVersion:n}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const i=tg(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 TR=Symbol("bpmn-editor"),hp={geometry:[],semantic:[]};function kR(){const e=xe.ref(!1),t=xe.ref(!0),n=xe.ref(!1),i=xe.shallowRef(hp),r=xe.shallowRef(void 0);let o,a;const s=()=>{if(!o){i.value=hp;return}const f=gt(Xe(o.get("elementRegistry")),{includeObservationOnly:!0}),d=o.getDefinitions();i.value={geometry:f,semantic:d?dp(d):[]}},c=()=>{e.value=!0,s()};function l(f,d){f.get("canvas").getContainer().style.pointerEvents=d?"":"none";const h=f.get("keyboard");d?(a&&h.bind(a),a=void 0):a||(a=h.getBinding(),h.unbind())}function u(){if(!o)throw new Error("modeler not attached — 뷰 @ready 후 attach() 필요");return o}function p(){return o==null?void 0:o.get("commandStack")}return{dirty:e,editable:t,agentBusy:n,issues:i,revalidate:s,changeScope:r,setChangeScope(f){r.value=f===void 0?void 0:new Set(f)},requestFocus(f){if(!o)return;const d=o.get("elementRegistry").get(f);d&&(o.get("canvas").scrollToElement(d,180),o.get("selection").select(d))},describeElement(f){const d=o==null?void 0:o.get("elementRegistry").get(f),h=d==null?void 0:d.businessObject;if(!h)return;const m=typeof h.name=="string"&&h.name.trim()!==""?h.name:h.text;return{name:typeof m=="string"&&m.trim()!==""?m.trim():void 0,type:typeof h.$type=="string"?h.$type:""}},attach(f){o&&this.detach(),o=f,o.get("eventBus").on("commandStack.changed",c),t.value||l(o,!1),s()},detach(){o==null||o.get("eventBus").off("commandStack.changed",c),o&&!t.value&&l(o,!0),a=void 0,o=void 0,i.value=hp,r.value=void 0},setEditable(f){t.value=f,o&&l(o,f)},async applyAgentBatch(f,d){const h=u();n.value=!0;try{const m=await lg(h,f,{currentVersion:d});return m.status==="applied"&&(e.value=!1),m}finally{n.value=!1}},async importXml(f){const{warnings:d}=await u().importXML(f);return e.value=!1,r.value=void 0,s(),{warnings:qu(d)}},async saveXml(){const{xml:f}=await u().saveXML({format:!0});return e.value=!1,f??""},undo:()=>{var f;return(f=p())==null?void 0:f.undo()},redo:()=>{var f;return(f=p())==null?void 0:f.redo()},canUndo:()=>{var f;return((f=p())==null?void 0:f.canUndo())??!1},canRedo:()=>{var f;return((f=p())==null?void 0:f.canRedo())??!1}}}function Ee(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function OR(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var mp={exports:{}},ug;function DR(){if(ug)return mp.exports;ug=1;var e=mp.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},mp.exports}var IR=DR(),LR=OR(IR);function Ii(e){if(!(this instanceof Ii))return new Ii(e);e=e||[128,36,1],this._seed=e.length?LR.rack(e[0],e[1],e[2]):e}Ii.prototype.next=function(e){return this._seed(e||!0)},Ii.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},Ii.prototype.claim=function(e,t){this._seed.set(e,t||!0)},Ii.prototype.assigned=function(e){return this._seed.get(e)||!1},Ii.prototype.unclaim=function(e){delete this._seed.hats[e]},Ii.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const on={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};on.td=on.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],on.option=on.optgroup=[1,'<select multiple="multiple">',"</select>"],on.thead=on.tbody=on.colgroup=on.caption=on.tfoot=[1,"<table>","</table>"],on.polyline=on.ellipse=on.polygon=on.circle=on.text=on.line=on.path=on.rect=on.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function It(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(on,i)?on[i]:on._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 BR(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 z(t,function(i){i&&z(i,function(r,o){n[o]=r})}),e}function Pn(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const NR=Object.prototype.toString;function $t(e){return new vr(e)}function vr(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}vr.prototype.add=function(e){return this.list.add(e),this},vr.prototype.remove=function(e){return NR.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},vr.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},vr.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},vr.prototype.array=function(){return Array.from(this.list)},vr.prototype.has=vr.prototype.contains=function(e){return this.list.contains(e)};function gc(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function no(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function $R(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var yc={},pg;function FR(){if(pg)return yc;pg=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return yc.bind=function(r,o,a,s){return e||i(),r[e](n+o,a,s||!1),a},yc.unbind=function(r,o,a,s){return t||i(),r[t](n+o,a,s||!1),a},yc}var fg=FR(),jR=$R(fg),Ge=BR({__proto__:null,default:jR},[fg]),dg=["focus","blur"];function HR(e,t,n,i,r){return dg.indexOf(n)!==-1&&(r=!0),Ge.bind(e,n,function(o){var a=o.target||o.srcElement;o.delegateTarget=no(a,t,!0),o.delegateTarget&&i.call(e,o)},r)}function zR(e,t,n,i){return dg.indexOf(t)!==-1&&(i=!0),Ge.unbind(e,t,n,i)}var Gn={bind:HR,unbind:zR};function gp(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function Rt(e,t){return t=t||document,t.querySelector(e)}function vc(e,t){return t=t||document,t.querySelectorAll(e)}function Li(e){e.parentNode&&e.parentNode.removeChild(e)}function GR(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function VR(e,t){return t.appendChild(GR(e,t))}function Ue(e,t){return VR(t,e),e}var yp=2,hg={"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":yp,"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":yp,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function WR(e,t){return hg[t]?e.style[t]:e.getAttributeNS(null,t)}function mg(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=hg[i];r?(r===yp&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function UR(e,t){var n=Object.keys(t),i,r;for(i=0,r;r=n[i];i++)mg(e,r,t[r])}function Se(e,t,n){if(typeof t=="string")if(n!==void 0)mg(e,t,n);else return WR(e,t);else UR(e,t);return e}const YR=Object.prototype.toString;function ut(e){return new br(e)}function br(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}br.prototype.add=function(e){return this.list.add(e),this},br.prototype.remove=function(e){return YR.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},br.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},br.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},br.prototype.array=function(){return Array.from(this.list)},br.prototype.has=br.prototype.contains=function(e){return this.list.contains(e)};function bc(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function gg(e){return e.cloneNode(!0)}var vp={svg:"http://www.w3.org/2000/svg"},yg='<svg xmlns="'+vp.svg+'"';function qR(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(vp.svg)===-1&&(e=yg+e.substring(4)):(e=yg+">"+e+"</svg>",t=!0);var n=KR(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function KR(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=qR(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(vp.svg,e),t&&Se(n,t),n}var bp=null;function vg(){return bp===null&&(bp=De("svg")),bp}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 XR(e,t,n,i,r,o){var a=vg().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 Da(e){return vg().createSVGTransform()}var xg=/([&<>]{1})/g,ZR=/([&<>\n\r"]{1})/g,QR={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"'"};function xp(e,t){function n(i,r){return QR[r]||r}return e.replace(t,n)}function _g(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(xp(e.textContent,xg));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,'="',xp(o.value,ZR),'"');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("<!--",xp(e.nodeValue,xg),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function JR(e){for(var t=e.firstChild,n=[];t;)_g(t,n),t=t.nextSibling;return n.join("")}function wg(e,t){return JR(e)}function an(e){var t=e.parentNode;return t&&t.removeChild(e),e}function eC(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function tC(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(eC(e,i))}function Ia(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),tC(n,t)),n.consolidate()}const nC=/^class[ {]/;function iC(e){return nC.test(e.toString())}function _p(e){return Array.isArray(e)}function wp(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function xc(...e){e.length===1&&_p(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const rC=/constructor\s*[^(]*\(\s*([^)]*)\)/m,oC=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,aC=/\/\*([^*]*)\*\//m;function sC(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(iC(e)?rC:oC);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const r=i.match(aC);return(r&&r[1]||i).trim()})||[]}function Eg(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 w=c(S.shift());for(;S.length;)w=w[S.shift()];return w}if(wp(o,g))return o[g];if(wp(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(_p(g))g=xc(g.slice());else throw s(`Cannot invoke "${g}". Expected a function!`);const w=(g.$inject||sC(g)).map(P=>wp(y,P)?y[P]:c(P));return{fn:g,dependencies:w}}function u(g){const{fn:y,dependencies:S}=l(g),w=Function.prototype.bind.call(y,null,...S);return new w}function p(g,y,S){const{fn:w,dependencies:P}=l(g,S);return w.apply(y,P)}function f(g){return xc(y=>g.get(y))}function d(g,y){if(y&&y.length){const S=Object.create(null),w=Object.create(null),P=[],T=[],$=[];let k,D,H,Q;for(let fe in r)k=r[fe],y.indexOf(fe)!==-1&&(k[2]==="private"?(D=P.indexOf(k[3]),D===-1?(H=k[3].createChild([],y),Q=f(H),P.push(k[3]),T.push(H),$.push(Q),S[fe]=[Q,fe,"private",H]):S[fe]=[$[D],fe,"private",T[D]]):S[fe]=[k[2],k[1]],w[fe]=!0),(k[2]==="factory"||k[2]==="type")&&k[1].$scope&&y.forEach(Me=>{k[1].$scope.indexOf(Me)!==-1&&(S[fe]=[k[2],k[1]],w[Me]=!0)});y.forEach(fe=>{if(!w[fe])throw new Error('No provider for "'+fe+'". Cannot use provider from the parent!')}),g.unshift(S)}return new Eg(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(w=>{typeof w=="string"?y.get(w):y.invoke(w)})}}function b(g){const y=g.__exports__;if(y){const S=g.__modules__,w=Object.keys(g).reduce((D,H)=>(H!=="__exports__"&&H!=="__modules__"&&H!=="__init__"&&H!=="__depends__"&&(D[H]=g[H]),D),Object.create(null)),P=(S||[]).concat(w),T=d(P),$=xc(function(D){return T.get(D)});y.forEach(function(D){r[D]=[$,D,"private",T]});const k=(g.__init__||[]).slice();return k.unshift(function(){T.init()}),g=Object.assign({},g,{__init__:k}),m(g,T)}return Object.keys(g).forEach(function(S){if(S==="__init__"||S==="__depends__")return;const w=g[S];if(w[2]==="private"){r[S]=w;return}const P=w[0],T=w[1];r[S]=[h[P],cC(P,T),P]}),m(g,a)}function E(g,y){return g.indexOf(y)!==-1||(g=(y.__depends__||[]).reduce(E,g),g.indexOf(y)!==-1)?g:g.concat(y)}function _(g){const y=g.reduce(E,[]).map(b);let S=!1;return function(){S||(S=!0,y.forEach(w=>w()))}}this.get=c,this.invoke=p,this.instantiate=u,this.createChild=d,this.init=_(e)}function cC(e,t){return e!=="value"&&_p(t)&&(t=xc(t.slice())),t}var lC=1e3;function Xi(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)})}Xi.prototype.canRender=function(e){},Xi.prototype.drawShape=function(e,t){},Xi.prototype.drawConnection=function(e,t){},Xi.prototype.getShapePath=function(e){},Xi.prototype.getConnectionPath=function(e){};function io(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function uC(e){return["M",e.x,e.y]}function Ep(e){return["L",e.x,e.y]}function pC(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function fC(e,t){const n=e.length,i=[uC(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(Ep(a));continue}const c=Math.min(t,Sp(a.x-o.x,a.y-o.y),Sp(s.x-a.x,s.y-a.y));if(!c){i.push(Ep(a));continue}const l=_c(a,o,c),u=_c(a,o,c*.5),p=_c(a,s,c),f=_c(a,s,c*.5);i.push(Ep(l)),i.push(pC(u,f,p))}return i}function _c(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=Sp(i,r),a=n/o;return{x:e.x+i*a,y:e.y+r*a}}function Sp(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function La(e,t,n){ze(t)&&(n=t,t=null),t||(t={});const i=De("path",t);return ze(n)&&(i.dataset.cornerRadius=String(n)),Rp(i,e)}function Rp(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return Se(e,{d:io(fC(t,n))}),e}function wc(e){var t=new Set(e);return nt(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function ro(e,t,n){n=n||0,Ne(e)||(e=[e]),z(e,function(i,r){var o=t(i,r,n);Ne(o)&&o.length&&ro(o,t,n+1)})}function Cp(e,t,n){var i=new Set,r=new Set;return ro(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 Ba(e,t){return Cp(e)}function dC(e,t,n){Xr(t)&&(t=!0),pn(t)&&(n=t,t=!0),n=n||{};var i=Na(n.allShapes),r=Na(n.allConnections),o=Na(n.enclosedElements),a=Na(n.enclosedConnections),s=Na(n.topLevel,t&&Ao(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,z(u.incoming,c),z(u.outgoing,c),u.children}return ro(e,l),{allShapes:i,allConnections:r,topLevel:s,enclosedConnections:a,enclosedElements:o}}function Zt(e,t){t=!!t,Ne(e)||(e=[e]);var n,i,r,o;return z(e,function(a){var s=a;a.waypoints&&!t&&(s=Zt(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 zo(e,t){var n={};return z(e,function(i){var r=i;r.waypoints&&(r=Zt(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 Sg(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function Rg(e){return!!(e&&e.isFrame)}function Na(e,t){return U({},e||{},t||{})}var hC=1;function xr(e,t){Xi.call(this,e,hC),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(xr,Xi),xr.prototype.canRender=function(){return!0},xr.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}),Rg(n)?Se(r,U({},this.FRAME_STYLE,i||{})):Se(r,U({},this.SHAPE_STYLE,i||{})),Ue(t,r),r},xr.prototype.drawConnection=function(t,n,i){var r=La(n.waypoints,U({},this.CONNECTION_STYLE,i||{}));return Ue(t,r),r},xr.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 io(a)},xr.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 io(o)},xr.$inject=["eventBus","styles"];function mC(){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 U(o,{class:n})},this.style=function(n,i){!Ne(n)&&!i&&(i=n,n=[]);var r=zn(n,function(o,a){return U(o,e[a]||{})},{});return i?U(r,i):r},this.computeStyle=function(n,i,r){return Ne(i)||(r=i,i=[]),t.style(i||[],U({},r,n||{}))}}const gC={__init__:["defaultRenderer"],defaultRenderer:["type",xr],styles:["type",mC]};function Ut(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 Mp(e,t){return!e||!t?-1:e.indexOf(t)}function $a(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Ap(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=$a(e,t);return Math.abs(r/o)<=i}var yC=2;function Zi(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[r,o]of Object.entries(i))if(vC(r,n))return o;return!1}function vC(e,t){const n=t[0];return Zr(t,function(i){return Math.abs(n[e]-i[e])<=yC})}function Cg(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 Pp(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var bC=/,?([a-z]),?/gi,Mg=parseFloat,Qt=Math,_r=Qt.PI,Bi=Qt.min,Ni=Qt.max,Ag=Qt.pow,wr=Qt.abs,xC=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,_C=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,Pg=Array.isArray||function(e){return e instanceof Array};function wC(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function EC(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 SC(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 wC(r,i)?(EC(o,i),r[i]):(o.length>=1e3&&delete r[o.shift()],o.push(i),r[i]=e(...arguments),r[i])}return t}function RC(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(xC,function(i,r,o){var a=[],s=r.toLowerCase();for(o.replace(_C,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=kp,n}function CC(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 MC(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 Tp(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 kp(){return this.join(",").replace(bC,"$1")}function AC(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=kp,t}function Tg(e,t,n,i,r,o,a,s,c){var l=1-c,u=Ag(l,3),p=Ag(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:Ec(h),y:Ec(m)}}function kg(e){var t=IC(...e);return Tp(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function Er(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function PC(e,t){return e=Tp(e),t=Tp(t),Er(t,e.x,e.y)||Er(t,e.x2,e.y)||Er(t,e.x,e.y2)||Er(t,e.x2,e.y2)||Er(e,t.x,t.y)||Er(e,t.x2,t.y)||Er(e,t.x,t.y2)||Er(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 Og(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 Dg(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,b=Og(m,e,n,r,a),E=Og(m,t,i,o,s),_=b*b+E*E;d+=f[h]*Qt.sqrt(_)}return l*d}function TC(e,t,n,i,r,o,a,s){if(!(Ni(e,n)<Bi(r,a)||Bi(e,n)>Ni(r,a)||Ni(t,i)<Bi(o,s)||Bi(t,i)>Ni(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=Ec(c/u),f=Ec(l/u),d=+p.toFixed(2),h=+f.toFixed(2);if(!(d<+Bi(e,n).toFixed(2)||d>+Ni(e,n).toFixed(2)||d<+Bi(r,a).toFixed(2)||d>+Ni(r,a).toFixed(2)||h<+Bi(t,i).toFixed(2)||h>+Ni(t,i).toFixed(2)||h<+Bi(o,s).toFixed(2)||h>+Ni(o,s).toFixed(2)))return{x:p,y:f}}}}function Ec(e){return Math.round(e*1e11)/1e11}function kC(e,t,n){var i=kg(e),r=kg(t);if(!PC(i,r))return[];var o=Dg(...e),a=Dg(...t),s=Lg(e)?1:~~(o/5)||1,c=Lg(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=Tg(...e,d/s);l[d]={x:m.x,y:m.y,t:d/s}}for(d=0;d<c+1;d++)m=Tg(...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 b=l[d],E=l[d+1],_=u[h],g=u[h+1],y=wr(E.x-b.x)<.01?"y":"x",S=wr(g.x-_.x)<.01?"y":"x",w=TC(b.x,b.y,E.x,E.y,_.x,_.y,g.x,g.y),P;if(w){if(P=w.x.toFixed(9)+"#"+w.y.toFixed(9),p[P])continue;p[P]=!0;var T=b.t+wr((w[y]-b[y])/(E[y]-b[y]))*(E.t-b.t),$=_.t+wr((w[S]-_[S])/(g[S]-_[S]))*(g.t-_.t);T>=0&&T<=1&&$>=0&&$<=1&&f.push({x:w.x,y:w.y,t1:T,t2:$})}}return f}function Ig(e,t,n){e=$g(e),t=$g(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 b=e[h];if(b[0]=="M")i=s=b[1],r=c=b[2];else{b[0]=="C"?(p=[i,r,...b.slice(1)],i=p[6],r=p[7]):(p=[i,r,i,r,s,c,s,c],i=s,r=c);for(var E=0,_=t.length;E<_;E++){var g=t[E];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=kC(p,f);{for(var S=0,w=y.length;S<w;S++)y[S].segment1=h,y[S].segment2=E,y[S].bez1=p,y[S].bez2=f;d=d.concat(y)}}}}}return d}function OC(e){return Pg(e)&&Pg(e[0])}function DC(e){if(CC(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=kp,t}function Lg(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function Sc(e,t,n,i){return[e,t,n,i,n,i]}function Bg(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 Ng(e,t,n,i,r,o,a,s,c,l){var u=_r*120/180,p=_r/180*(+r||0),f=[],d,h=SC(function(B,R,x){var G=B*Qt.cos(x)-R*Qt.sin(x),Y=B*Qt.sin(x)+R*Qt.cos(x);return{x:G,y:Y}});if(l)P=l[0],T=l[1],S=l[2],w=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,b=(t-c)/2,E=m*m/(n*n)+b*b/(i*i);E>1&&(E=Qt.sqrt(E),n=E*n,i=E*i);var _=n*n,g=i*i,y=(o==a?-1:1)*Qt.sqrt(wr((_*g-_*b*b-g*m*m)/(_*b*b+g*m*m))),S=y*n*b/i+(e+s)/2,w=y*-i*m/n+(t+c)/2,P=Qt.asin(((t-w)/i).toFixed(9)),T=Qt.asin(((c-w)/i).toFixed(9));P=e<S?_r-P:P,T=s<S?_r-T:T,P<0&&(P=_r*2+P),T<0&&(T=_r*2+T),a&&P>T&&(P=P-_r*2),!a&&T>P&&(T=T-_r*2)}var $=T-P;if(wr($)>u){var k=T,D=s,H=c;T=P+u*(a&&T>P?1:-1),s=S+n*Qt.cos(T),c=w+i*Qt.sin(T),f=Ng(s,c,n,i,r,0,a,D,H,[T,k,S,w])}$=T-P;var Q=Qt.cos(P),fe=Qt.sin(P),Me=Qt.cos(T),Be=Qt.sin(T),it=Qt.tan($/4),X=4/3*n*it,ee=4/3*i*it,ue=[e,t],be=[e+X*fe,t-ee*Q],q=[s+X*Be,c-ee*Me],V=[s,c];if(be[0]=2*ue[0]-be[0],be[1]=2*ue[1]-be[1],l)return[be,q,V].concat(f);f=[be,q,V].concat(f).join().split(",");for(var ie=[],Pe=0,Te=f.length;Pe<Te;Pe++)ie[Pe]=Pe%2?h(f[Pe-1],f[Pe],p).y:h(f[Pe],f[Pe+1],p).x;return ie}function IC(e,t,n,i,r,o,a,s){for(var c=[],l=[[],[]],u,p,f,d,h,m,b,E,_=0;_<2;++_){if(_==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),wr(u)<1e-12){if(wr(p)<1e-12)continue;d=-f/p,0<d&&d<1&&c.push(d);continue}b=p*p-4*f*u,E=Qt.sqrt(b),!(b<0)&&(h=(-p+E)/(2*u),0<h&&h<1&&c.push(h),m=(-p-E)/(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:Bi(...l[0]),y0:Bi(...l[1]),x1:Ni(...l[0]),y1:Ni(...l[1])}}function $g(e){if(OC(e)||(e=RC(e)),MC(e))return e;for(var t=AC(DC(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,b;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",...Ng(d.x,d.y,...f.slice(1))];break;case"S":h=="C"||h=="S"?(m=d.x*2-d.bx,b=d.y*2-d.by):(m=d.x,b=d.y),f=["C",m,b,...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",...Bg(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",...Bg(d.x,d.y,f[1],f[2],f[3],f[4])];break;case"L":f=["C",...Sc(d.x,d.y,f[1],f[2])];break;case"H":f=["C",...Sc(d.x,d.y,f[1],d.y)];break;case"V":f=["C",...Sc(d.x,d.y,d.x,f[1])];break;case"Z":f=["C",...Sc(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=Mg(u[p-4])||n.x,n.by=Mg(u[p-3])||n.y}return t}function Mt(e){return pn(e)&&Hn(e,"waypoints")}function Je(e){return pn(e)&&Hn(e,"labelTarget")}function LC(e){return pn(e)&&Co(e.parent)}function Fg(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function Qi(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function Le(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function Rc(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function BC(e){return Qi({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function NC(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=jC(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 $e(e){return Mt(e)?NC(e):BC(e)}function wn(e,t,n){n=n||0,pn(n)||(n={x:n,y:n});var i=Le(e),r=Le(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 Fa(e,t,n){var i=$C(e,t);return i.length===1||i.length===2&&$a(i[0],i[1])<1?Qi(i[0]):i.length>1?(i=Pi(i,function(r){var o=Math.floor(r.t2*100)||1;return o=100-o,o=(o<10?"0":"")+o,r.segment2+"#"+o}),Qi(i[n?0:i.length-1])):null}function $C(e,t){return Ig(e,t)}function FC(e){e=e.slice();for(var t=0,n,i,r;e[t];)n=e[t],i=e[t-1],r=e[t+1],$a(n,r)===0||Ap(i,r,n)?e.splice(t,1):t++;return e}function jC(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Cc(e,t){return Math.round(e*t)/t}function jg(e){return ze(e)?e+"px":e}function HC(e){for(;e.parent;)e=e.parent;return e}function zC(e){e=U({},{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:jg(e.width),height:jg(e.height)}),t.appendChild(n),n}function Hg(e,t,n){const i=De("g");ut(i).add(t);const r=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}const GC="base",zg=0,VC=1,WC={shape:["x","y","width","height"],connection:["waypoints"]};function Fe(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||{})}Fe.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],Fe.prototype._init=function(e){const t=this._eventBus,n=this._container=zC(e),i=this._svg=De("svg");Se(i,{width:"100%",height:"100%"}),Pn(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=Hg(i,"viewport");e.deferUpdate&&(this._viewboxChanged=Lu(this._viewboxChanged,300)),this._restoreFocus=Lu(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)},Fe.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},Fe.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},Fe.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=Sg(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},Fe.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},Fe.prototype.restoreFocus=function(){this._restoreFocus()},Fe.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},Fe.prototype.isFocused=function(){return this._focused},Fe.prototype.getDefaultLayer=function(){return this.getLayer(GC,zg)},Fe.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},Fe.prototype._getChildIndex=function(e){return zn(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},Fe.prototype._createLayer=function(e,t){typeof t>"u"&&(t=VC);const n=this._getChildIndex(t);return{group:Hg(this._viewport,"layer-"+e,n),index:t,visible:!0}},Fe.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},Fe.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&&(an(n),t.visible=!1),n},Fe.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],an(t.group))},Fe.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},Fe.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const r=this._findPlaneForRoot(HC(i));if(!r||n&&r.rootElement!==n)return;n=r.rootElement}return n},Fe.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},Fe.prototype._findPlaneForRoot=function(e){return kt(this._planes,function(t){return t.rootElement===e})},Fe.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},Fe.prototype._resolveElements=function(e){return Ne(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},Fe.prototype.getContainer=function(){return this._container},Fe.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&&(z([i.gfx,i.secondaryGfx],function(r){r&&(n?(e.markers.add(t),ut(r).add(t)):(e.markers.delete(t),ut(r).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},Fe.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},Fe.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},Fe.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},Fe.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},Fe.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},Fe.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,zg);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},Fe.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},Fe.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},Fe.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)},Fe.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})},Fe.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})},Fe.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=WC[e];if(!Zr(n,function(r){return typeof t[r]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},Fe.prototype._setParent=function(e,t,n){qt(t.children,e,n),e.parent=t},Fe.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},Fe.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},Fe.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},Fe.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),Ut(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},Fe.prototype.removeShape=function(e){return this._removeElement(e,"shape")},Fe.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},Fe.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},Fe.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},Fe.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},Fe.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);Ia(t,u)});else return o=this._rootElement?this.getActiveLayer():null,i=o&&o.getBBox()||{},a=Ia(t),r=a?a.matrix:XR(),s=Cc(r.a,1e3),c=Cc(-r.e||0,1e3),l=Cc(-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},Fe.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=U({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),Gg(t,n)}),{x:n.e,y:n.f}},Fe.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=Zt(o),s=Le(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=Le(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),b=Math.max(0,s.bottom-f.bottom),E=Math.min(0,s.top-f.top);u=h||m,p=b||E}this.scroll({dx:-u*l,dy:-p*l})},Fe.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)}),Cc(i.a,1e3)};function Gg(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}Fe.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},Fe.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=U(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),Gg(this._viewport,u),u},Fe.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},Fe.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}},Fe.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var Go="data-element-id";function ii(e){this._elements={},this._eventBus=e}ii.$inject=["eventBus"],ii.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),Se(t,Go,i),n&&Se(n,Go,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},ii.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(Se(i.gfx,Go,""),i.secondaryGfx&&Se(i.secondaryGfx,Go,""),delete t[n])},ii.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)},ii.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,Go,i),t},ii.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&Se(e,Go);var n=this._elements[t];return n&&n.element},ii.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},ii.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}},ii.prototype.getAll=function(){return this.filter(function(e){return e})},ii.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)})},ii.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},ii.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 UC(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 YC(e){return e.__refs_collection===!0}function qC(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function Vg(e,t,n){var i=UC(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 KC(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 ci(e,t){if(!(this instanceof ci))return new ci(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}ci.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?Vg(this,t,e):KC(this,t,e)},ci.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return YC(n)||Vg(this,t,e),n},ci.prototype.ensureBound=function(e,t){qC(e,t)||this.bind(e,t)},ci.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},ci.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var Op=new ci({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Wg=new ci({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Ug=new ci({name:"attachers",collection:!0},{name:"host"}),Yg=new ci({name:"outgoing",collection:!0},{name:"source"}),qg=new ci({name:"incoming",collection:!0},{name:"target"});function Vo(){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)}}),Op.bind(this,"parent"),Wg.bind(this,"labels"),Yg.bind(this,"outgoing"),qg.bind(this,"incoming")}function ja(){Vo.call(this),Op.bind(this,"children"),Ug.bind(this,"host"),Ug.bind(this,"attachers")}Ee(ja,Vo);function Kg(){Vo.call(this),Op.bind(this,"children")}Ee(Kg,ja);function Xg(){ja.call(this),Wg.bind(this,"labelTarget")}Ee(Xg,ja);function Zg(){Vo.call(this),Yg.bind(this,"source"),qg.bind(this,"target")}Ee(Zg,Vo);var XC={connection:Zg,shape:ja,label:Xg,root:Kg};function ZC(e,t){var n=XC[e];if(!n)throw new Error("unknown type: <"+e+">");return U(new n,t)}function QC(e){return e instanceof Vo}function Ji(){this._uid=12}Ji.prototype.createRoot=function(e){return this.create("root",e)},Ji.prototype.createLabel=function(e){return this.create("label",e)},Ji.prototype.createShape=function(e){return this.create("shape",e)},Ji.prototype.createConnection=function(e){return this.create("connection",e)},Ji.prototype.create=function(e,t){return t=U({},t||{}),t.id||(t.id=e+"_"+this._uid++),ZC(e,t)};var Mc="__fn",Qg=1e3,JC=Array.prototype.slice;function Vn(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}Vn.prototype.on=function(e,t,n,i){if(e=Ne(e)?e:[e],fn(t)&&(i=n,n=t,t=Qg),!ze(t))throw new Error("priority must be a number");var r=n;i&&(r=Nn(n,i),r[Mc]=n[Mc]||n);var o=this;e.forEach(function(a){o._addListener(a,{priority:t,callback:r,next:null})})},Vn.prototype.once=function(e,t,n,i){var r=this;if(fn(t)&&(i=n,n=t,t=Qg),!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[Mc]=n,this.on(e,t,o)},Vn.prototype.off=function(e,t){e=Ne(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},Vn.prototype.createEvent=function(e){var t=new Ha;return t.init(e),t},Vn.prototype.fire=function(e,t){var n,i,r,o;if(o=JC.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 Ha?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}},Vn.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},Vn.prototype._destroy=function(){this._listeners={}},Vn.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},Vn.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=eM(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},Vn.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},Vn.prototype._getListeners=function(e){return this._listeners[e]},Vn.prototype._setListeners=function(e,t){this._listeners[e]=t},Vn.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[Mc]===t)&&(r?r.next=i:this._setListeners(e,i)),r=n,n=i};function Ha(){}Ha.prototype.stopPropagation=function(){this.cancelBubble=!0},Ha.prototype.preventDefault=function(){this.defaultPrevented=!0},Ha.prototype.init=function(e){U(this,e||{})};function eM(e,t){return e.apply(null,t)}function oo(e){return e.childNodes[0]}function tM(e){return e.parentNode.childNodes[1]}function Ac(e,t,n,i,r){var o=Da();o.setTranslate(t,n);var a=Da();a.setRotate(i||0,0,0);var s=Da();s.setScale(1,1),Ia(e,[o,a,s])}function En(e,t,n){var i=Da();i.setTranslate(t,n),Ia(e,i)}function Jg(e,t){var n=Da();n.setRotate(t,0,0),Ia(e,n)}function ri(e,t){this._eventBus=e,this._elementRegistry=t}ri.$inject=["eventBus","elementRegistry"],ri.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=tM(t),n||(n=De("g"),ut(n).add("djs-children"),Ue(t.parentNode,n))):n=t,n},ri.prototype._clear=function(e){var t=oo(e);return gc(t),t},ri.prototype._createContainer=function(e,t,n,i){var r=De("g");ut(r).add("djs-group"),typeof n<"u"?nM(r,t,t.childNodes[n]):Ue(t,r);var o=De("g");ut(o).add("djs-element"),ut(o).add("djs-"+e),i&&ut(o).add("djs-frame"),Ue(r,o);var a=De("g");return ut(a).add("djs-visual"),Ue(o,a),o},ri.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,Rg(t))},ri.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=zn(e,function(r,o){return o.parent&&(r[o.parent.id]=o.parent),r},{}),z(i,function(r){var o=r.children;if(o){var a=t._getChildrenContainer(r),s=a.firstChild;z(o,function(c){var l=n.getGraphics(c).parentNode;l===s?s=s.nextSibling:a.insertBefore(l,s)})}})},ri.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},ri.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},ri.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},ri.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},ri.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),En(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")}},ri.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);an(t.parentNode)};function nM(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const iM={__depends__:[gC],__init__:["canvas"],canvas:["type",Fe],elementRegistry:["type",ii],elementFactory:["type",Ji],eventBus:["type",Vn],graphicsFactory:["type",ri]};function rM(e){var t=new Eg(e);return t.init(),t}function oM(e){e=e||{};var t={config:["value",e]},n=[t,iM].concat(e.modules||[]);return rM(n)}function Sr(e,t){this._injector=t||oM(e),this.get("eventBus").fire("diagram.init")}Sr.prototype.get=function(e,t){return this._injector.get(e,t)},Sr.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},Sr.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},Sr.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function Tn(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function $n(e,t){return e.$instanceOf(t)}function aM(e){return kt(e.rootElements,function(t){return $n(t,"bpmn:Process")||$n(t,"bpmn:Collaboration")})}function sM(e){var t={},n=[],i={};function r(q,V){return function(ie){q(ie,V)}}function o(q){t[q.id]=q}function a(q){return t[q.id]}function s(q,V){var ie=q.gfx;if(ie)throw new Error(`already rendered ${Tn(q)}`);return e.element(q,i[q.id],V)}function c(q,V){return e.root(q,i[q.id],V)}function l(q,V){try{var ie=i[q.id]&&s(q,V);return o(q),ie}catch(Pe){u(Pe.message,{element:q,error:Pe}),console.error(`failed to import ${Tn(q)}`,Pe)}}function u(q,V){e.error(q,V)}var p=this.registerDi=function(V){var ie=V.bpmnElement;ie?i[ie.id]?u(`multiple DI elements defined for ${Tn(ie)}`,{element:ie}):i[ie.id]=V:u(`no bpmnElement referenced in ${Tn(V)}`,{element:V})};function f(q){d(q.plane)}function d(q){p(q),z(q.planeElement,h)}function h(q){p(q)}this.handleDefinitions=function(V,ie){var Pe=V.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 ${Tn(ie)}`);var B=Te.bpmnElement;if(!B)if(B=aM(V),B)u(`correcting missing bpmnElement on ${Tn(Te)} to ${Tn(B)}`),Te.bpmnElement=B,p(Te);else throw new Error("no process or collaboration to display");var R=c(B,Te);if($n(B,"bpmn:Process")||$n(B,"bpmn:SubProcess"))b(B,R);else if($n(B,"bpmn:Collaboration"))ue(B,R),E(V.rootElements,R);else throw new Error(`unsupported bpmnElement for ${Tn(Te)}: ${Tn(B)}`);m(n)};var m=this.handleDeferred=function(){for(var V;n.length;)V=n.shift(),V()};function b(q,V){it(q,V),$(q.ioSpecification,V),T(q.artifacts,V),o(q)}function E(q,V){var ie=nt(q,function(Pe){return!a(Pe)&&$n(Pe,"bpmn:Process")&&Pe.laneSets});ie.forEach(r(b,V))}function _(q,V){l(q,V)}function g(q,V){z(q,r(_,V))}function y(q,V){l(q,V)}function S(q,V){l(q,V)}function w(q,V){l(q,V)}function P(q,V){l(q,V)}function T(q,V){z(q,function(ie){$n(ie,"bpmn:Association")?n.push(function(){P(ie,V)}):P(ie,V)})}function $(q,V){q&&(z(q.dataInputs,r(S,V)),z(q.dataOutputs,r(w,V)))}var k=this.handleSubProcess=function(V,ie){it(V,ie),T(V.artifacts,ie)};function D(q,V){var ie=l(q,V);$n(q,"bpmn:SubProcess")&&k(q,ie||V),$n(q,"bpmn:Activity")&&$(q.ioSpecification,V),n.push(function(){z(q.dataInputAssociations,r(y,V)),z(q.dataOutputAssociations,r(y,V))})}function H(q,V){l(q,V)}function Q(q,V){l(q,V)}function fe(q,V){n.push(function(){var ie=l(q,V);q.childLaneSet&&Me(q.childLaneSet,ie||V),be(q)})}function Me(q,V){z(q.lanes,r(fe,V))}function Be(q,V){z(q,r(Me,V))}function it(q,V){X(q.flowElements,V),q.laneSets&&Be(q.laneSets,V)}function X(q,V){z(q,function(ie){$n(ie,"bpmn:SequenceFlow")?n.push(function(){H(ie,V)}):$n(ie,"bpmn:BoundaryEvent")?n.unshift(function(){D(ie,V)}):$n(ie,"bpmn:FlowNode")?D(ie,V):$n(ie,"bpmn:DataObject")||($n(ie,"bpmn:DataStoreReference")||$n(ie,"bpmn:DataObjectReference")?Q(ie,V):u(`unrecognized flowElement ${Tn(ie)} in context ${Tn(V&&V.businessObject)}`,{element:ie,context:V}))})}function ee(q,V){var ie=l(q,V),Pe=q.processRef;Pe&&b(Pe,ie||V)}function ue(q,V){z(q.participants,r(ee,V)),n.push(function(){g(q.messageFlows,V)}),T(q.artifacts,V)}function be(q){z(q.flowNodeRef,function(V){var ie=V.get("lanes");ie&&ie.push(q)})}}function M(e,t){var n=le(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function tt(e,t){return hr(t,function(n){return M(e,n)})}function le(e){return e&&e.businessObject||e}function dt(e){return e&&e.di}function cM(e,t,n){var i,r,o,a,s=[];function c(l,u){var p={root:function(m,b){return i.add(m,b)},element:function(m,b,E){return i.add(m,b,E)},error:function(m,b){s.push({message:m,context:b})}},f=new sM(p);u=u||l.diagrams&&l.diagrams[0];var d=lM(l,u);if(!d)throw new Error("no diagram to display");z(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 lM(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!M(n,"bpmn:Process")&&!M(n,"bpmn:Collaboration")&&(i=uM(n));var r;M(i,"bpmn:Collaboration")?r=i:r=kt(e.rootElements,function(l){if(M(l,"bpmn:Collaboration"))return kt(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=ey(o),s=[t],c=[n];return z(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 ey(e){var t=[];return z(e,function(n){n&&(t.push(n),t=t.concat(ey(n.flowElements)))}),t}function uM(e){for(var t=e;t;){if(M(t,"bpmn:Process"))return t;t=t.$parent}}var pM='<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=pM,ny={verticalAlign:"middle"},iy={color:"#404040"},fM={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},dM={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},hM={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"},mM='<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>',$i;function gM(){$i=It(mM),In($i,fM),In(Rt("svg",$i),ny),In(Rt(".backdrop",$i),dM),In(Rt(".notice",$i),hM),In(Rt(".link",$i),iy,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function yM(){$i||(gM(),Gn.bind($i,".backdrop","click",function(e){document.body.removeChild($i)})),document.body.appendChild($i)}const Pc=5,ry="djs-outline-hidden";function jt(e){e=U({},bM,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),_M(this._container)}Ee(jt,Sr),jt.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||[]),Tc(s,o),s=vM(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},jt.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},jt.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const o=new Error("no XML imported");throw Tc(o,[]),o}if(typeof t=="string"&&(i=xM(n,t),!i)){const o=new Error("BPMNDiagram <"+t+"> not found");throw Tc(o,[]),o}try{this.clear()}catch(o){throw Tc(o,[]),o}const{warnings:r}=await cM(this,n,i);return{warnings:r}},jt.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},jt.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),r=i.getActiveLayer(),o=Rt(":scope > defs",i._svg),a=wg(r),s=o?"<defs>"+wg(o)+"</defs>":"",c=i.getContainer();$t(c).add(ry);let l;try{l=r.getBBox()}finally{$t(c).remove(ry)}const u=l.x-Pc,p=l.y-Pc,f=l.width+Pc*2,d=l.height+Pc*2;t=`<?xml version="1.0" encoding="utf-8"?>
1
+ (function(ue,Ce){typeof exports=="object"&&typeof module<"u"?Ce(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],Ce):(ue=typeof globalThis<"u"?globalThis:ue||self,Ce(ue.BpmnModeler={},ue.Vue))})(this,(function(ue,Ce){"use strict";var Qj=Object.defineProperty;var e6=(ue,Ce,$r)=>Ce in ue?Qj(ue,Ce,{enumerable:!0,configurable:!0,writable:!0,value:$r}):ue[Ce]=$r;var on=(ue,Ce,$r)=>e6(ue,typeof Ce!="symbol"?Ce+"":Ce,$r);const $r=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","subProcess","boundaryEvent","intermediateCatchEvent"],qc=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","intermediateCatchEvent"];function Pm(e){return $r.includes(e)}function km(e){return qc.includes(e)}const Yc=["timer"],Kc={timer:"bpmn:TimerEventDefinition"};function Om(e){return typeof e=="string"&&Yc.includes(e)}function Up(e){if(e.length===1)return Yc.find(t=>Kc[t]===e[0])}const Xc=["ko","en","ja","zh"];function ZR(e){return typeof e=="string"&&Xc.includes(e)}const Dm="http://g1project.net/spec/bpmn/bwl/1.0",qp="bwl",Yp=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],Zc="bwl:ReviewRequest",Lm={name:"bwl-hints",uri:Dm,prefix:qp,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"}]}]},Kp="bwl.undoEpisode",Im=new WeakSet;function JR(e){Im.has(e)||(e.register(Kp,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),Im.add(e))}function Bm(e,t){JR(e);const n={run:t};if(e.execute(Kp,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}function Nm(e){return e._stackIdx+1}function $m(e,t){const{_stack:n,_stackIdx:i}=e;if(i<t)return 0;const o=n[t].id;for(let r=t;r<=i;r++)n[r].id=o;return i-t+1}function Xp(e){return Array.prototype.concat.apply([],e)}const vs=Object.prototype.toString,QR=Object.prototype.hasOwnProperty;function Fr(e){return e===void 0}function En(e){return e!==void 0}function xa(e){return e==null}function et(e){return vs.call(e)==="[object Array]"}function Sn(e){return vs.call(e)==="[object Object]"}function tt(e){return vs.call(e)==="[object Number]"}function An(e){const t=vs.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function ai(e){return vs.call(e)==="[object String]"}function eM(e){if(!et(e))throw new Error("must supply array")}function si(e,t){return!xa(e)&&QR.call(e,t)}function Ht(e,t){const n=Qc(t);let i;return K(e,function(o,r){if(n(o,r))return i=o,!1}),i}function Fm(e,t){const n=Qc(t);let i=et(e)?-1:void 0;return K(e,function(o,r){if(n(o,r))return i=r,!1}),i}function gt(e,t){const n=Qc(t);let i=[];return K(e,function(o,r){n(o,r)&&i.push(o)}),i}function K(e,t){let n,i;if(Fr(e))return;const o=et(e)?rM:oM;for(let r in e)if(si(e,r)&&(n=e[r],i=t(n,o(r)),i===!1))return n}function tM(e,t){if(Fr(e))return[];eM(e);const n=Qc(t);return e.filter(function(i,o){return!n(i,o)})}function ci(e,t,n){return K(e,function(i,o){n=t(n,i,o)}),n}function Xo(e,t){return!!ci(e,function(n,i,o){return n&&t(i,o)},!0)}function Zo(e,t){return!!Ht(e,t)}function Wn(e,t){let n=[];return K(e,function(i,o){n.push(t(i,o))}),n}function Jc(e){return e&&Object.keys(e)||[]}function nM(e){return Jc(e).length}function ba(e){return Wn(e,t=>t)}function wa(e,t,n={}){return t=Zp(t),K(e,function(i){let o=t(i)||"_",r=n[o];r||(r=n[o]=[]),r.push(i)}),n}function jm(e,...t){e=Zp(e);let n={};return K(t,o=>wa(o,e,n)),Wn(n,function(o,r){return o[0]})}const iM=jm;function io(e,t){t=Zp(t);let n=[];return K(e,function(i,o){let r=t(i,o),a={d:r,v:i};for(var s=0;s<n.length;s++){let{d:c}=n[s];if(r<c){n.splice(s,0,a);return}}n.push(a)}),Wn(n,i=>i.v)}function _a(e){return function(t){return Xo(e,function(n,i){return t[i]===n})}}function Zp(e){return An(e)?e:t=>t[e]}function Qc(e){return An(e)?e:t=>t===e}function oM(e){return e}function rM(e){return Number(e)}function Jp(e,t){let n,i,o,r;function a(p){let d=Date.now(),f=p?0:r+t-d;if(f>0)return s(f);e.apply(o,i),c()}function s(p){n=setTimeout(a,p)}function c(){n&&clearTimeout(n),n=r=i=o=void 0}function l(){n&&a(!0),c()}function u(...p){r=Date.now(),i=p,o=this,n||s(t)}return u.flush=l,u.cancel=c,u}function ti(e,t){return e.bind(t)}function te(e,...t){return Object.assign(e,...t)}function aM(e,t,n){let i=e;return K(t,function(o,r){if(typeof o!="number"&&typeof o!="string")throw new Error("illegal key type: "+typeof o+". Key should be of type number or string.");if(o==="constructor")throw new Error("illegal key: constructor");if(o==="__proto__")throw new Error("illegal key: __proto__");let a=t[r+1],s=i[o];En(a)&&xa(s)&&(s=i[o]=isNaN(+a)?{}:[]),Fr(a)?Fr(n)?delete i[o]:i[o]=n:i=s}),e}function Wi(e,t){let n={},i=Object(e);return K(t,function(o){o in i&&(n[o]=e[o])}),n}function oo(e,t){let n={},i=Object(e);return K(i,function(o,r){t.indexOf(r)===-1&&(n[r]=o)}),n}function T(e,t){var n=Ee(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function ht(e,t){return Zo(t,function(n){return T(e,n)})}function Ee(e){return e&&e.businessObject||e}function wt(e){return e&&e.di}const sM="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",Hm="i18n",jr="i18n:Translation";function Jo(e){if(e){if(T(e,"bpmn:TextAnnotation"))return{target:e,key:"text"};if(T(e,"bpmn:Group"))return e.categoryValueRef?{target:e.categoryValueRef,key:"value"}:void 0;if(T(e,"bpmn:FlowElement")||T(e,"bpmn:Participant")||T(e,"bpmn:Lane")||T(e,"bpmn:MessageFlow")||T(e,"bpmn:DataInput")||T(e,"bpmn:DataOutput"))return{target:e,key:"name"}}}function Ui(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,jr)})}function ln(e){return e.get("xml:lang")}function Qo(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,Zc)})}function xs(e){const{designLocale:t,companionLocales:n}=e;return[t,...n.filter((i,o,r)=>i!==t&&r.indexOf(i)===o)]}function Qp(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}const cM=/^[\t\n\r\x20-\x7E]+$/;function bs(e,t,n,i){if(!e)return[];const o=t.filter(a=>(a.body??"")===e).map(ln),r=o.length?o:[i??n];return!r.includes(n)&&cM.test(e)&&!t.some(a=>ln(a)===n&&a.body)?[...r,n]:r}function ed(e,t,n){const i=Jo(e);if(!i)return{};const o=i.target[i.key]??"",r=Ui(e).filter(l=>ln(l)),a=l=>l.body??"",s=bs(o,r,t.designLocale,n),c={};for(const l of xs(t)){if(s.includes(l)){c[l]=o;continue}const u=r.find(p=>ln(p)===l&&a(p));u&&(c[l]=a(u))}return c}const el="bwl.updateTranslation";class td{constructor(t){this.moddle=t}execute(t){const{element:n,text:i,designLocale:o,locales:r,rootLang:a,nameChangedFrom:s}=t,c=n.businessObject,l=Jo(c),u=[];t.undo=u;const p=Ui(c).filter(A=>ln(A)),d=s??(l?l.target[l.key]??"":""),f=a??o,m=bs(d,p,o,a),h=s!==void 0&&d&&!m.includes(t.locale)?m[0]:t.locale,y=A=>{var I;return((I=p.find(H=>ln(H)===A&&H.body))==null?void 0:I.body)??(m.includes(A)?d:"")},w=A=>Qo(c).some(I=>I.locale===A),g=y(h);if(g===i)return[];const v=!!g&&!w(h),b=v?r.filter(A=>A!==h&&y(A)&&!w(A)):[],S=()=>{let A=c.extensionElements;return A||(A=this.moddle.create("bpmn:ExtensionElements",{values:[]}),A.$parent=c,c.extensionElements=A,u.push(()=>delete c.extensionElements)),A.get("values")},M=(A,I)=>{const H=S();let V=H.find(G=>{var ie;return((ie=G.$instanceOf)==null?void 0:ie.call(G,jr))&&ln(G)===A});if(V){const G=V.body;V.body=I,u.push(()=>V.body=G)}else V=this.moddle.create(jr,{body:I}),V.set("xml:lang",A),V.$parent=c.extensionElements,H.push(V),u.push(()=>H.splice(H.indexOf(V),1))},B=A=>{const I=S(),H=I.indexOf(A);I.splice(H,1),u.push(()=>I.splice(H,0,A))};if(s===void 0){if(h===o&&l){if(d&&!p.some(I=>I.body===d)){const I=a&&a!==o?a:void 0;I&&M(I,d)}const A=Object.prototype.hasOwnProperty.call(l.target,l.key);l.target[l.key]=i,u.push(()=>{A?l.target[l.key]=d:delete l.target[l.key]})}M(h,i)}else(p.some(A=>ln(A)===h)||!d&&h!==f)&&M(h,i);if(!v)for(const A of Qo(c).filter(I=>I.locale===h))B(A);for(const A of b){const I=S(),H=this.moddle.create(Zc,{locale:A,sourceLocale:h,previous:g});H.$parent=c.extensionElements,I.push(H),u.push(()=>I.splice(I.indexOf(H),1))}for(const A of Qo(c).filter(I=>I.sourceLocale===h&&(I.previous??"")===i))B(A);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):[]}}on(td,"$inject",["moddle"]);const tl="bwl.setTranslations",lM=(e,t)=>e.locale===t.locale&&(e.sourceLocale??void 0)===t.sourceLocale&&(e.previous??"")===t.previous;class nd{constructor(t){this.moddle=t}execute(t){const{element:n,texts:i,confirm:o=[],designLocale:r,locales:a,rootLang:s,before:c}=t,l=n.businessObject,u=[];if(t.undo=u,!Jo(l))return[];const p=()=>{let w=l.extensionElements;return w||(w=this.moddle.create("bpmn:ExtensionElements",{values:[]}),w.$parent=l,l.extensionElements=w,u.push(()=>delete l.extensionElements)),w.get("values")},d=w=>{const g=p(),v=g.indexOf(w);v<0||(g.splice(v,1),u.push(()=>g.splice(v,0,w)))},f=w=>Ui(l).find(g=>ln(g)===w);if(i===null)for(const w of a){const g=f(w);g&&d(g)}else if(i)for(const w of a){const g=i[w];if(g===void 0)continue;const v=f(w);if(v){if(v.body===g)continue;const M=v.body;v.body=g,u.push(()=>v.body=M);continue}if(w===r&&(s??r)===r)continue;const b=p(),S=this.moddle.create(jr,{body:g});S.set("xml:lang",w),S.$parent=l.extensionElements,b.push(S),u.push(()=>b.splice(b.indexOf(S),1))}const h=[...i===null?[]:c.requests.filter(w=>!o.includes(w.locale)&&!(i&&i[w.locale]!==void 0&&i[w.locale]!==c.texts[w.locale])&&!(i&&w.sourceLocale&&i[w.sourceLocale]===w.previous))];for(const w of Qo(l)){const g=h.findIndex(v=>lM(w,v));g>=0?h.splice(g,1):d(w)}for(const w of h){const g=p(),v=this.moddle.create(Zc,{locale:w.locale,...w.sourceLocale?{sourceLocale:w.sourceLocale}:{},previous:w.previous});v.$parent=l.extensionElements,g.push(v),u.push(()=>g.splice(g.indexOf(v),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):[]}}on(nd,"$inject",["moddle"]);function id(e){return Qo(e).map(t=>({locale:t.locale,...t.sourceLocale?{sourceLocale:t.sourceLocale}:{},previous:t.previous??""}))}class od{constructor(t){t.registerHandler(el,td),t.registerHandler(tl,nd)}}on(od,"$inject",["commandStack"]);const rd={__init__:["translationCommands"],translationCommands:["type",od]},Gm=["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"],uM={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},pM={type:"object",description:"다국어 그룹의 문구 — 로케일 → 문구. **그 문서의 문서 언어(설계 + 병기 · describe 의 i18n) 전부**를 담는다(빠지거나 밖의 언어면 거부). 평문 name/text 와 함께 주면 거부. 문서 언어 설정이 없는 문서(describe 에 i18n 이 없다)는 이것 대신 평문을 쓴다.",properties:Object.fromEntries(Xc.map(e=>[e,{type:"string"}])),additionalProperties:!1},dM={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},fM={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},hM={type:"string",enum:[...Yc],description:"이벤트 정의. **type 이 intermediateCatchEvent 일 때만 쓰고, 그때는 반드시 준다**(다른 타입에 주거나 빠뜨리면 거부). timer = 시한 대기(「30분 경과」·「확정 기간 경과」처럼 시간이 지나야 다음으로 가는 자리). 시한 값은 name 에 쓴다 — 표현식 필드는 없다."},gM={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다. ⚠ type 집합은 **읽을 수 있는 것보다 좁다** — describe 는 subProcess·boundaryEvent 도 노드로 내지만 그 둘을 새로 만드는 배치는 미실증이라 여기서 받지 않는다(B-87 ⓐ). intermediateCatchEvent 는 eventDefinition 과 짝으로만 받는다.",properties:{id:{type:"string"},type:{type:"string",enum:[...qc]},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},mM={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만. ⚠ 다국어 그룹(describe 에 i18n 이 있다)에서는 쓰지 않는다 — 조건 라벨도 그 플로우의 names 로 준다.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},yM={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},vM={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},xM={type:"object",properties:{id:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},bM={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},wM={type:"object",description:"텍스트 주석. 본문은 text(평문) 또는 texts(다국어 그룹) 중 하나를 반드시 준다.",properties:{id:{type:"string"},text:{type:"string"},texts:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},_M={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},EM={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},SM={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...Yp]},offset:{type:"number",description:"앵커 가장자리 → 주석 가장자리 간격(px). 생략 시 50."}},required:["anchor","side"],additionalProperties:!1};function Nn(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const RM={"participant.add":Nn("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트 — **작을수록 위**(생략 시 op 순서가 곧 배치 순서). 값은 상대 순서만 쓰므로 1,2,3… 연속이든 10,20,30 간격이든 같다.",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":Nn("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":Nn("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":Nn("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:[...qc]},eventDefinition:{$ref:"#/$defs/eventDefinition"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["id"]}),"sequenceFlow.add":Nn("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":Nn("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":Nn("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":Nn("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"}},required:["id"]}),"dataStore.add":Nn("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":Nn("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"}},required:["id"]}),"dataAssociation.add":Nn("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":Nn("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":Nn("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":Nn("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":Nn("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":Nn("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":Nn("translation.confirm",{description:"확인만 — 그 요소의 locale 칸에 걸린 확인 요청(describe 의 i18n.reviewRequests)을 문구를 바꾸지 않고 해소한다. 다른 언어가 고쳐졌지만(sourceLocale · previous → 지금 문구) 이 칸의 번역이 여전히 맞을 때(오타 수준) 쓴다. 번역을 고쳐야 하면 이것 대신 그 요소의 update 에 names/texts(문서 언어 전부)를 준다 — 문구가 실제로 바뀐 칸의 표식만 해소된다. 다국어 그룹에서만 받고, 그 칸에 표식이 없으면 거부한다.",properties:{id:{type:"string",description:"확인 요청이 걸린 요소 id."},locale:{type:"string",enum:[...Xc],description:"확인 요청을 받은 칸의 언어(reviewRequests 의 locale)."}},required:["id","locale"]}),"element.remove":Nn("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},zm={anyOf:Gm.map(e=>RM[e])},MM={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:dM,irParticipant:fM,irNode:gM,irFlowCondition:mM,irSequenceFlow:yM,irMessageFlow:vM,irDataStore:xM,irDataAssociation:bM,irTextAnnotation:wM,irAssociation:_M,irGroup:EM,bwlPlacement:SM,eventDefinition:hM,localeTexts:pM,nullableString:uM,symbolicOp:zm}};function ad(){}ad.prototype.get=function(e){return this.$model.properties.get(this,e)},ad.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function Vm(e,t){this.model=e,this.properties=t}Vm.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(ad.prototype);K(e.properties,function(a){!a.isMany&&a.default!==void 0&&(i[a.name]=a.default)}),n.defineModel(i,t),n.defineDescriptor(i,e);var o=e.ns.name;function r(a){n.define(this,"$type",{value:o,enumerable:!0}),n.define(this,"$attrs",{value:{}}),n.define(this,"$parent",{writable:!0}),K(a,ti(function(s,c){this.set(c,s)},this))}return r.prototype=i,r.hasType=i.$instanceOf=this.model.hasType,n.defineModel(r,t),n.defineDescriptor(r,e),r};var CM=te(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),Wm=te(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 sd(e,t){var n=Wm[e];return n?n(t):t}function cd(e){return!!CM[e]}function Um(e){return!!Wm[e]}function Un(e,t){var n=e.split(/:/),i,o;if(n.length===1)i=e,o=t;else if(n.length===2)i=n[1],o=n[0];else throw new Error("expected <prefix:localName> or <localName>, got "+e);return e=(o?o+":":"")+i,{name:e,prefix:o,localName:i}}function xi(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}xi.prototype.build=function(){return Wi(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},xi.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)},xi.prototype.replaceProperty=function(e,t,n){var i=e.ns,o=this.properties,r=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=o.indexOf(e);if(s===-1)throw new Error("property <"+i.name+"> not found in property list");o.splice(s,1),this.addProperty(t,n?void 0:s,a),r[i.name]=r[i.localName]=t},xi.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,o=t.split("#"),r=Un(o[0],i),a=Un(o[1],r.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},xi.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},xi.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},xi.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},xi.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},xi.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},xi.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")},xi.prototype.hasProperty=function(e){return this.propertiesByName[e]},xi.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,o=e.name;o in n||(K(e.properties,ti(function(r){r=te({},r,{name:r.ns.localName,inherited:t}),Object.defineProperty(r,"definedBy",{value:e});var a=r.replaces,s=r.redefines;a||s?this.redefineProperty(r,a||s,a):(r.isBody&&this.setBodyProperty(r),r.isId&&this.setIdProperty(r),this.addProperty(r))},this)),i.push(e),n[o]=e)};function er(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,K(e,ti(this.registerPackage,this))}er.prototype.getPackage=function(e){return this.packageMap[e]},er.prototype.getPackages=function(){return this.packages},er.prototype.registerPackage=function(e){e=te({},e);var t=this.packageMap;qm(t,e,"prefix"),qm(t,e,"uri"),K(e.types,ti(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},er.prototype.registerType=function(e,t){e=te({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:te({},e.meta||{})});var n=Un(e.name,t.prefix),i=n.name,o=Object.create(null);K(e.properties,ti(function(r){var a=Un(r.name,n.prefix),s=a.name;cd(r.type)||(r.type=Un(r.type,a.prefix).name),te(r,{ns:a,name:s}),o[s]=r},this)),te(e,{ns:n,name:i,propertiesByName:o}),K(e.extends,ti(function(r){var a=Un(r,n.prefix),s=this.typeMap[a.name];s.traits=s.traits||[],s.traits.push(i)},this)),this.definePackage(e,t),this.typeMap[i]=e},er.prototype.mapTypes=function(e,t,n){var i=cd(e.name)?{name:e.name}:this.typeMap[e.name],o=this;function r(c,l){var u=Un(c,cd(c)?"":e.prefix);o.mapTypes(u,t,l)}function a(c){return r(c,!0)}function s(c){return r(c,!1)}if(!i)throw new Error("unknown type <"+e.name+">");K(i.superClass,n?a:s),t(i,!n),K(i.traits,a)},er.prototype.getEffectiveDescriptor=function(e){var t=Un(e),n=new xi(t);this.mapTypes(t,function(o,r){n.addTrait(o,r)});var i=n.build();return this.definePackage(i,i.allTypes[i.allTypes.length-1].$pkg),i},er.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function qm(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function Hr(e){this.model=e}Hr.prototype.set=function(e,t,n){if(!ai(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),o=i&&i.name;AM(n)?i?delete e[o]:delete e.$attrs[ld(t)]:i?o in e?e[o]=n:Ym(e,i,n):e.$attrs[ld(t)]=n},Hr.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[ld(t)];var i=n.name;return!e[i]&&n.isMany&&Ym(e,n,[]),e[i]},Hr.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=te({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},Hr.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},Hr.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},Hr.prototype.getProperty=function(e,t){var n=this.model,i=n.getPropertyDescriptor(e,t);if(i)return i;if(t.includes(":"))return null;const o=n.config.strict;if(typeof o<"u"){const r=new TypeError(`unknown property <${t}> on <${e.$type}>`);if(o)throw r;typeof console<"u"&&console.warn(r)}return null};function AM(e){return typeof e>"u"}function Ym(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function ld(e){return e.replace(/^:/,"")}function Ei(e,t={}){this.properties=new Hr(this),this.factory=new Vm(this,this.properties),this.registry=new er(e,this.properties),this.typeCache=Object.create(null),this.config=t}Ei.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},Ei.prototype.getType=function(e){var t=this.typeCache,n=ai(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},Ei.prototype.createAny=function(e,t,n){var i=Un(e),o={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){aM(this,[a],s)}},r={name:e,isGeneric:!0,ns:{prefix:i.prefix,localName:i.localName,uri:t}};return this.properties.defineDescriptor(o,r),this.properties.defineModel(o,this),this.properties.define(o,"get",{enumerable:!1,writable:!0}),this.properties.define(o,"set",{enumerable:!1,writable:!0}),this.properties.define(o,"$parent",{enumerable:!1,writable:!0}),this.properties.define(o,"$instanceOf",{enumerable:!1,writable:!0}),K(n,function(a,s){Sn(a)&&a.value!==void 0?o[a.name]=a.value:o[s]=a}),o},Ei.prototype.getPackage=function(e){return this.registry.getPackage(e)},Ei.prototype.getPackages=function(){return this.registry.getPackages()},Ei.prototype.getElementDescriptor=function(e){return e.$descriptor},Ei.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},Ei.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},Ei.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var Km=String.fromCharCode,TM=Object.prototype.hasOwnProperty,PM=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,ws={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(ws).forEach(function(e){ws[e.toUpperCase()]=ws[e]});function kM(e,t,n,i){return i?TM.call(ws,i)?ws[i]:"&"+i+";":Km(t||parseInt(n,16))}function Gr(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(PM,kM):e}var Xm="non-whitespace outside of root node";function tr(e){return new Error(e)}function OM(e){return"missing namespace for prefix <"+e+">"}function nl(e){return{get:e,enumerable:!0}}function DM(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var Zm=Symbol("nameCache");function ud(e){return e+"$uri"}function LM(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[ud(i)]=n;return t}function il(){return{line:0,column:0}}function IM(e){throw e}function Jm(e){if(!this)return new Jm(e);var t=e&&e.proxy,n,i,o,r,a=IM,s,c,l,u,p=il,d=!1,f=!1,m="",h=!1,y=!1,w=null,g=!1,v,b,S,M;function B(V){V instanceof Error||(V=tr(V)),w=V,a(V,p)}function A(V){s&&(V instanceof Error||(V=tr(V)),s(V,p))}this.on=function(V,G){if(typeof G!="function")throw tr("required args <name, cb>");switch(V){case"openTag":i=G;break;case"text":n=G;break;case"closeTag":o=G;break;case"error":a=G;break;case"warn":s=G;break;case"cdata":r=G;break;case"attention":u=G;break;case"question":l=G;break;case"comment":c=G;break;default:throw tr("unsupported event: "+V)}return this},this.ns=function(V){if(typeof V>"u"&&(V={}),typeof V!="object")throw tr("required args <nsMap={}>");var G=Object.create(null),ie;for(ie in V)G[ie]=V[ie];return y=!0,M=G,this};function I(){v=y?[]:null,b=y?LM(M):null,S=[],p=il,g=!1,w=null,f=!1,m=""}this.parse=function(V){if(typeof V!="string")throw tr("required args <xml=string>");if(d)throw tr("parse during stream; call end() first");return I(),H(V),p=il,g=!1,w},this.write=function(V){if(typeof V!="string")throw tr("required args <xml=string>");return d||(I(),d=!0),w||(m=H(m+V,!0)||""),this},this.end=function(){return d||I(),d=!1,w||H(m),m="",p=il,g=!1,w},this.stop=function(){g=!0};function H(V,G=!1){var ie=null,pe=null,Y,Te=0,Pe=!1,ke=!1,ve=0,W=0,de,z,ee,he,se,Ae,F,C,R,J="",ne=0,ge;function $e(bt,qt){var Kt=bt.indexOf(":");if(Kt===-1)return bt;var Ln=b[bt.substring(0,Kt)];return Ln?qt===Ln?bt.substr(Kt+1):Ln+bt.substr(Kt):(A(OM(bt.substring(0,Kt))),null)}function rt(){if(ge!==null)return ge;var bt,qt,Kt=y&&b.xmlns,Ln=y&&h?[]:null,Bt=ne,sn=J,zn=sn.length,pa,ri,In,Bn,dn,Eo={},Fi=new Set,yi,St,Pt;e:for(;Bt<zn;Bt++)if(yi=!1,St=sn.charCodeAt(Bt),!(St===32||St<14&&St>8)){for((St<65||St>122||St>90&&St<97)&&St!==95&&St!==58&&(A("illegal first char attribute name"),yi=!0),Pt=Bt+1;Pt<zn;Pt++)if(St=sn.charCodeAt(Pt),!(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){A("missing attribute value"),Bt=Pt;continue e}if(St===61)break;A("illegal attribute name char"),yi=!0}if(dn=sn.substring(Bt,Pt),dn==="xmlns:xmlns"&&(A("illegal declaration of xmlns"),yi=!0),St=sn.charCodeAt(Pt+1),St===34)Pt=sn.indexOf('"',Bt=Pt+2),Pt===-1&&(Pt=sn.indexOf("'",Bt),Pt!==-1&&(A("attribute value quote missmatch"),yi=!0));else if(St===39)Pt=sn.indexOf("'",Bt=Pt+2),Pt===-1&&(Pt=sn.indexOf('"',Bt),Pt!==-1&&(A("attribute value quote missmatch"),yi=!0));else for(A("missing attribute value quotes"),yi=!0,Pt=Pt+1;Pt<zn&&(St=sn.charCodeAt(Pt+1),!(St===32||St<14&&St>8));Pt++);for(Pt===-1&&(A("missing closing quotes"),Pt=zn,yi=!0),yi||(In=sn.substring(Bt,Pt)),Bt=Pt;Pt+1<zn&&(St=sn.charCodeAt(Pt+1),!(St===32||St<14&&St>8));Pt++)Bt===Pt&&(A("illegal character after attribute end"),yi=!0);if(Bt=Pt+1,yi)continue e;if(Fi.has(dn)){A("attribute <"+dn+"> already defined");continue}if(Fi.add(dn),!y){Eo[dn]=In;continue}if(h){if(ri=dn==="xmlns"?"xmlns":dn.charCodeAt(0)===120&&dn.substr(0,6)==="xmlns:"?dn.substr(6):null,ri!==null){if(bt=Gr(In),qt=ud(ri),Bn=M[bt],!Bn){if(ri==="xmlns"||qt in b&&b[qt]!==bt)do Bn="ns"+Te++;while(typeof b[Bn]<"u");else Bn=ri;M[bt]=Bn}b[ri]!==Bn&&(pa||(b=DM(b),pa=!0),b[ri]=Bn,ri==="xmlns"&&(b[ud(Bn)]=bt,Kt=Bn),b[qt]=bt),Eo[dn]=In;continue}Ln.push(dn,In);continue}dn=$e(dn,Kt),dn!==null&&(Eo[dn]=In)}if(h)for(Bt=0,zn=Ln.length;Bt<zn;Bt++)dn=$e(Ln[Bt++],Kt),In=Ln[Bt],dn!==null&&(Eo[dn]=In);return ge=Eo}function pt(){for(var bt=/(\r\n|\r|\n)/g,qt=0,Kt=0,Ln=0,Bt=W,sn,zn;ve>=Ln&&(sn=bt.exec(V),!(!sn||(Bt=sn[0].length+sn.index,Bt>ve)));)qt+=1,Ln=Bt;return ve==-1?(Kt=Bt,zn=V.substring(W)):W===0?zn=V.substring(W,ve):(Kt=ve-Ln,zn=W==-1?V.substring(ve):V.substring(ve,W+1)),{data:zn,line:qt,column:Kt}}for(p=pt,t&&(R=Object.create({},{name:nl(function(){return F}),originalName:nl(function(){return C}),attrs:nl(rt),ns:nl(function(){return b})}));W!==-1;){if(V.charCodeAt(W)===60?ve=W:ve=V.indexOf("<",W),ve===-1){if(G)return V.substring(W);if(S.length)return B("unexpected end of file");if(!f)return B("missing start tag");W<V.length&&V.substring(W).trim()&&A(Xm);return}if(f||(f=!0),W!==ve){if(S.length){if(n&&(n(V.substring(W,ve),Gr,p),g))return}else if(V.substring(W,ve).trim()&&(A(Xm),g))return}if(he=V.charCodeAt(ve+1),he===33){if(ee=V.charCodeAt(ve+2),ee===91&&V.substr(ve+3,6)==="CDATA["){if(W=V.indexOf("]]>",ve),W===-1)return G?V.substring(ve):B("unclosed cdata");if(r&&(r(V.substring(ve+9,W),p),g))return;W+=3;continue}if(ee===45&&V.charCodeAt(ve+3)===45){if(W=V.indexOf("-->",ve),W===-1)return G?V.substring(ve):B("unclosed comment");if(c&&(c(V.substring(ve+4,W),Gr,p),g))return;W+=3;continue}}if(he===63){if(W=V.indexOf("?>",ve),W===-1)return G?V.substring(ve):B("unclosed question");if(l&&(l(V.substring(ve,W+2),p),g))return;W+=2;continue}for(de=ve+1;;de++){if(se=V.charCodeAt(de),isNaN(se))return G?V.substring(ve):(W=-1,B("unclosed tag"));if(se===34)ee=V.indexOf('"',de+1),de=ee!==-1?ee:de;else if(se===39)ee=V.indexOf("'",de+1),de=ee!==-1?ee:de;else if(se===62){W=de;break}}if(he===33){if(u&&(u(V.substring(ve,W+1),Gr,p),g))return;W+=1;continue}if(ge={},he===47){if(Pe=!1,ke=!0,!S.length)return B("missing open tag");if(de=F=S.pop(),ee=ve+2+de.length,V.substring(ve+2,ee)!==de)return B("closing tag mismatch");for(;ee<W;ee++)if(he=V.charCodeAt(ee),!(he===32||he>8&&he<14))return B("close tag")}else{if(V.charCodeAt(W-1)===47?(de=F=V.substring(ve+1,W-1),Pe=!0,ke=!0):(de=F=V.substring(ve+1,W),Pe=!0,ke=!1),!(he>96&&he<123||he>64&&he<91||he===95||he===58))return B("illegal first char nodeName");for(ee=1,z=de.length;ee<z;ee++)if(he=de.charCodeAt(ee),!(he>96&&he<123||he>64&&he<91||he>47&&he<59||he===45||he===95||he==46)){if(he===32||he<14&&he>8){F=de.substring(0,ee),ge=null;break}return B("invalid nodeName")}ke||S.push(F)}if(y){Y=b,Pe&&(ke||v.push(Y),ge===null&&(h=de.indexOf("xmlns",ee)!==-1)&&(ne=ee,J=de,rt(),h=!1)),C=F,pe!==b&&(ie=b[Zm],ie===void 0&&(ie=b[Zm]=Object.create(null)),pe=b);var pn=ie[F];if(pn!==void 0)F=pn;else{if(he=F.indexOf(":"),he!==-1){if(Ae=b[F.substring(0,he)],!Ae)return B("missing namespace on <"+C+">");F=F.substr(he+1)}else Ae=b.xmlns;Ae&&(F=Ae+":"+F),ie[C]=F}}if(Pe&&(ne=ee,J=de,i&&(t?i(R,Gr,ke,p):i(F,rt,Gr,ke,p),g)))return;if(ke){if(o&&(o(t?R:F,Gr,Pe,p),g))return;y&&(Pe?b=Y:b=v.pop())}W+=1}}}function Qm(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var pd={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},ey="property";function ty(e){return e.xml&&e.xml.serialize}function BM(e){const t=ty(e);return t!==ey&&(t||null)}function NM(e){return e.charAt(0).toUpperCase()+e.slice(1)}function ny(e,t){return Qm(t)?e.prefix+":"+NM(e.localName):e.name}function $M(e,t){var n=e.name,i=e.localName,o=t&&t.xml&&t.xml.typePrefix;return o&&i.indexOf(o)===0?e.prefix+":"+i.slice(o.length):n}function FM(e,t,n){const i=Un(e,t.xmlns),o=`${t[i.prefix]||i.prefix}:${i.localName}`,r=Un(o);var a=n.getPackage(r.prefix);return $M(r,a)}function nr(e){return new Error(e)}function To(e){return e.$descriptor}function jM(e){te(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw nr("expected element");var n=this.elementsById,i=To(t),o=i.idProperty,r;if(o&&(r=t.get(o.name),r)){if(!/^([a-z][\w-.]*:)?[a-z_][\w-.]*$/i.test(r))throw new Error("illegal ID <"+r+">");if(n[r])throw nr("duplicate ID <"+r+">");n[r]=t}},this.addWarning=function(t){this.warnings.push(t)}}function _s(){}_s.prototype.handleEnd=function(){},_s.prototype.handleText=function(){},_s.prototype.handleNode=function(){};function dd(){}dd.prototype=Object.create(_s.prototype),dd.prototype.handleNode=function(){return this};function Ea(){}Ea.prototype=Object.create(_s.prototype),Ea.prototype.handleText=function(e){this.body=(this.body||"")+e};function Es(e,t){this.property=e,this.context=t}Es.prototype=Object.create(Ea.prototype),Es.prototype.handleNode=function(e){if(this.element)throw nr("expected no sub nodes");return this.element=this.createReference(e),this},Es.prototype.handleEnd=function(){this.element.id=this.body},Es.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function fd(e,t){this.element=t,this.propertyDesc=e}fd.prototype=Object.create(Ea.prototype),fd.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=sd(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function ol(){}ol.prototype=Object.create(Ea.prototype),ol.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 Xn(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}Xn.prototype=Object.create(ol.prototype),Xn.prototype.addReference=function(e){this.context.addReference(e)},Xn.prototype.handleText=function(e){var t=this.element,n=To(t),i=n.bodyProperty;if(!i)throw nr("unexpected body text <"+e+">");Ea.prototype.handleText.call(this,e)},Xn.prototype.handleEnd=function(){var e=this.body,t=this.element,n=To(t),i=n.bodyProperty;i&&e!==void 0&&(e=sd(i.type,e),t.set(i.name,e))},Xn.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=To(n),o=this.context,r=new n({}),a=this.model,s;return K(t,function(c,l){var u=i.propertiesByName[l],p;u&&u.isReference?u.isMany?(p=c.split(" "),K(p,function(d){o.addReference({element:r,property:u.ns.name,id:d})})):o.addReference({element:r,property:u.ns.name,id:c}):(u?c=sd(u.type,c):l==="xmlns"?l=":"+l:(s=Un(l,i.ns.prefix),a.getPackage(s.prefix)&&o.addWarning({message:"unknown attribute <"+l+">",element:r,property:l,value:c})),r.set(l,c))}),r},Xn.prototype.getPropertyForNode=function(e){var t=e.name,n=Un(t),i=this.type,o=this.model,r=To(i),a=n.name,s=r.propertiesByName[a];if(s&&!s.isAttr){const l=BM(s);if(l){const u=e.attributes[l];if(u){const p=FM(u,e.ns,o),d=o.getType(p);return te({},s,{effectiveType:To(d).name})}}return s}var c=o.getPackage(n.prefix);if(c){const l=ny(n,c),u=o.getType(l);if(s=Ht(r.properties,function(p){return!p.isVirtual&&!p.isReference&&!p.isAttribute&&u.hasType(p.type)}),s)return te({},s,{effectiveType:To(u).name})}else if(s=Ht(r.properties,function(l){return!l.isReference&&!l.isAttribute&&l.type==="Element"}),s)return s;throw nr("unrecognized element <"+n.name+">")},Xn.prototype.toString=function(){return"ElementDescriptor["+To(this.type).name+"]"},Xn.prototype.valueHandler=function(e,t){return new fd(e,t)},Xn.prototype.referenceHandler=function(e){return new Es(e,this.context)},Xn.prototype.handler=function(e){return e==="Element"?new Sa(this.model,e,this.context):new Xn(this.model,e,this.context)},Xn.prototype.handleChild=function(e){var t,n,i,o;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,Um(n))return this.valueHandler(t,i);t.isReference?o=this.referenceHandler(t).handleNode(e):o=this.handler(n).handleNode(e);var r=o.element;return r!==void 0&&(t.isMany?i.get(t.name).push(r):i.set(t.name,r),t.isReference?(te(r,{element:i}),this.context.addReference(r)):r.$parent=i),o};function hd(e,t,n){Xn.call(this,e,t,n)}hd.prototype=Object.create(Xn.prototype),hd.prototype.createElement=function(e){var t=e.name,n=Un(t),i=this.model,o=this.type,r=i.getPackage(n.prefix),a=r&&ny(n,r)||t;if(!o.hasType(a))throw nr("unexpected element <"+e.originalName+">");return Xn.prototype.createElement.call(this,e)};function Sa(e,t,n){this.model=e,this.context=n}Sa.prototype=Object.create(ol.prototype),Sa.prototype.createElement=function(e){var t=e.name,n=Un(t),i=n.prefix,o=e.ns[i+"$uri"],r=e.attributes;return this.model.createAny(t,o,r)},Sa.prototype.handleChild=function(e){var t=new Sa(this.model,"Element",this.context).handleNode(e),n=this.element,i=t.element,o;return i!==void 0&&(o=n.$children=n.$children||[],o.push(i),i.$parent=n),t},Sa.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function gd(e){e instanceof Ei&&(e={model:e}),te(this,{lax:!1},e)}gd.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof Xn?(i=t,t={}):typeof t=="string"?(i=this.handler(t),t={}):typeof i=="string"&&(i=this.handler(i));var o=this.model,r=this.lax,a=new jM(te({},t,{rootHandler:i})),s=new Jm({proxy:!0}),c=HM();i.context=a,c.push(i);function l(S,M,B){var A=M(),I=A.line,H=A.column,V=A.data;V.charAt(0)==="<"&&V.indexOf(" ")!==-1&&(V=V.slice(0,V.indexOf(" "))+">");var G="unparsable content "+(V?V+" ":"")+`detected
2
+ line: `+I+`
3
+ column: `+H+`
4
+ nested error: `+S.message;if(B)return a.addWarning({message:G,error:S}),!0;throw nr(G)}function u(S,M){return l(S,M,!0)}function p(){var S=a.elementsById,M=a.references,B,A;for(B=0;A=M[B];B++){var I=A.element,H=S[A.id],V=To(I).propertiesByName[A.property];if(H||a.addWarning({message:"unresolved reference <"+A.id+">",element:A.element,property:A.property,value:A.id}),V.isMany){var G=I.get(V.name),ie=G.indexOf(A);ie===-1&&(ie=G.length),H?G[ie]=H:G.splice(ie,1)}else I.set(V.name,H)}}function d(){c.pop().handleEnd()}var f=/^<\?xml /i,m=/ encoding="([^"]+)"/i,h=/^utf-8$/i;function y(S){if(f.test(S)){var M=m.exec(S),B=M&&M[1];!B||h.test(B)||a.addWarning({message:"unsupported document encoding <"+B+">, falling back to UTF-8"})}}function w(S,M){var B=c.peek();try{c.push(B.handleNode(S))}catch(A){l(A,M,r)&&c.push(new dd)}}function g(S,M){try{c.peek().handleText(S)}catch(B){u(B,M)}}function v(S,M){S.trim()&&g(S,M)}var b=o.getPackages().reduce(function(S,M){return S[M.uri]=M.prefix,S},Object.entries(pd).reduce(function(S,[M,B]){return S[B]=M,S},o.config&&o.config.nsMap||{}));return s.ns(b).on("openTag",function(S,M,B,A){var I=S.attrs||{},H=Object.keys(I).reduce(function(G,ie){var pe=M(I[ie]);return G[ie]=pe,G},{}),V={name:S.name,originalName:S.originalName,attributes:H,ns:S.ns};w(V,A)}).on("question",y).on("closeTag",d).on("cdata",g).on("text",function(S,M,B){v(M(S),B)}).on("error",l).on("warn",u),new Promise(function(S,M){var B;try{s.parse(e),p()}catch(G){B=G}var A=i.element;!B&&!A&&(B=nr("failed to parse document as <"+i.type.$descriptor.name+">"));var I=a.warnings,H=a.references,V=a.elementsById;return B?(B.warnings=I,M(B)):S({rootElement:A,elementsById:V,references:H,warnings:I})})},gd.prototype.handler=function(e){return new hd(this.model,e)};function HM(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var GM=`<?xml version="1.0" encoding="UTF-8"?>
5
+ `,zM=/<|>|'|"|&|\n\r|\n/g,iy=/<|>|&/g;function ro(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}ro.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},ro.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},ro.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},ro.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)},ro.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},ro.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},ro.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri},ro.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},ro.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 VM(e){return e.charAt(0).toLowerCase()+e.slice(1)}function WM(e,t){return Qm(t)?VM(e):e}function oy(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function ry(e){return ai(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function UM(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 qM(e,t){return t.isGeneric?te({localName:t.ns.localName},e):te({localName:WM(t.ns.localName,t.$pkg)},e)}function YM(e,t){return te({localName:t.ns.localName},e)}function KM(e){var t=e.$descriptor;return gt(t.properties,function(n){var i=n.name;if(n.isVirtual||!si(e,i))return!1;var o=e[i];return o===n.default||o===null?!1:n.isMany?o.length:!0})}var XM={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},ZM={"<":"lt",">":"gt","&":"amp"};function ay(e,t,n){return e=ai(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function JM(e){return ay(e,zM,XM)}function QM(e){return ay(e,iy,ZM)}function eC(e){return gt(e,function(t){return t.isAttr})}function tC(e){return gt(e,function(t){return!t.isAttr})}function md(e){this.tagName=e}md.prototype.build=function(e){return this.element=e,this},md.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()};function zr(){}zr.prototype.serializeValue=zr.prototype.serializeTo=function(e){e.append(this.escape?QM(this.value):this.value)},zr.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(iy)!==-1&&(this.escape=!0),this};function yd(e){this.tagName=e}oy(yd,zr),yd.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()};function Yt(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}Yt.prototype.build=function(e){this.element=e;var t=e.$descriptor,n=this.propertyDescriptor,i,o,r=t.isGeneric;return r?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),r?this.parseGenericContainments(e):(o=KM(e),this.parseAttributes(eC(o)),this.parseContainments(tC(o))),this.parseGenericAttributes(e,i),this},Yt.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return qM(t,e)},Yt.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return YM(t,e)},Yt.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},Yt.prototype.nsAttributeName=function(e){var t;if(ai(e)?t=Un(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}:te({localName:t.localName},n)},Yt.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}))},Yt.prototype.parseGenericContainments=function(e){var t=e.$body;t&&this.body.push(new zr().build({type:"String"},t));var n=e.$children;n&&K(n,i=>{this.body.push(new Yt(this).build(i))})},Yt.prototype.parseNsAttribute=function(e,t,n){var i=e.$model,o=Un(t),r;if(o.prefix==="xmlns"&&(r={prefix:o.localName,uri:n}),!o.prefix&&o.localName==="xmlns"&&(r={uri:n}),!r)return{name:t,value:n};if(i&&i.getPackage(n))this.logNamespace(r,!0,!0);else{var a=this.logNamespaceUsed(r,!0);this.getNamespaces().logUsed(a)}},Yt.prototype.parseNsAttributes=function(e){var t=this,n=e.$attrs,i=[];return K(n,function(o,r){var a=t.parseNsAttribute(e,r,o);a&&i.push(a)}),i},Yt.prototype.parseGenericAttributes=function(e,t){var n=this;K(t,function(i){try{n.addAttribute(n.nsAttributeName(i.name),i.value)}catch(o){typeof console<"u"&&console.warn(`missing namespace information for <${i.name}=${i.value}> on`,e,o)}})},Yt.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;K(e,function(o){var r=i.get(o.name),a=o.isReference,s=o.isMany;if(s||(r=[r]),o.isBody)n.push(new zr().build(o,r[0]));else if(Um(o.type))K(r,function(l){n.push(new yd(t.addTagName(t.nsPropertyTagName(o))).build(o,l))});else if(a)K(r,function(l){n.push(new md(t.addTagName(t.nsPropertyTagName(o))).build(l))});else{var c=ty(o);K(r,function(l){var u;c?c===ey?u=new Yt(t,o):u=new rl(t,o,c):u=new Yt(t),n.push(u.build(l))})}})},Yt.prototype.getNamespaces=function(e){var t=this.namespaces,n=this.parent,i;return t||(i=n&&n.getNamespaces(),e||!i?this.namespaces=t=new ro(i):t=i),t},Yt.prototype.logNamespace=function(e,t,n){var i=this.getNamespaces(n),o=e.uri,r=e.prefix,a=i.byUri(o);return(!a||n)&&i.add(e,t),i.mapPrefix(r,o),e},Yt.prototype.logNamespaceUsed=function(e,t){var n=this.getNamespaces(t),i=e.prefix,o=e.uri,r,a,s;if(!i&&!o)return{localName:e.localName};if(s=n.defaultUriByPrefix(i),o=o||s||n.uriByPrefix(i),!o)throw new Error("no namespace uri given for prefix <"+i+">");if(e=n.byUri(o),!e&&!i&&(e=this.logNamespace({uri:o},s===o,!0)),!e){for(r=i,a=1;n.uriByPrefix(r);)r=i+"_"+a++;e=this.logNamespace({prefix:r,uri:o},s===o)}return i&&n.mapPrefix(i,o),e},Yt.prototype.parseAttributes=function(e){var t=this,n=this.element;K(e,function(i){var o=n.get(i.name);if(i.isReference)if(!i.isMany)o=o.id;else{var r=[];K(o,function(a){r.push(a.id)}),o=r.join(" ")}t.addAttribute(t.nsAttributeName(i),o)})},Yt.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),ry(e)},Yt.prototype.addAttribute=function(e,t){var n=this.attrs;ai(t)&&(t=JM(t));var i=Fm(n,function(r){return r.name.localName===e.localName&&r.name.uri===e.uri&&r.name.prefix===e.prefix}),o={name:e,value:t};i!==-1?n.splice(i,1,o):n.push(o)},Yt.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=UM(n).concat(t)),K(t,function(i){e.append(" ").append(ry(i.name)).append('="').append(i.value).append('"')})},Yt.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==zr;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),K(this.body,function(i){i.serializeTo(e)}),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()};function rl(e,t,n){Yt.call(this,e,t),this.serialization=n}oy(rl,Yt),rl.prototype.parseNsAttributes=function(e){var t=Yt.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 o=e.$model.getPackage(i.uri),r=o.xml&&o.xml.typePrefix||"";return this.addAttribute(this.nsAttributeName(this.serialization),(i.prefix?i.prefix+":":"")+r+n.ns.localName),t},rl.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function nC(){this.value="",this.write=function(e){this.value+=e}}function iC(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 oC(e){e=te({format:!1,preamble:!0},e||{});function t(n,i){var o=i||new nC,r=new iC(o,e.format);e.preamble&&r.append(GM);var a=new Yt,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(rC(s)),a.build(n).serializeTo(r),!i)return o.value}return{toXML:t}}function rC(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in pd)n[i]=pd[i];for(const i in t){const o=t[i];n[o]=i}for(const i of e.getPackages())n[i.prefix]=i.uri;return n}function al(e,t){Ei.call(this,e,t)}al.prototype=Object.create(Ei.prototype),al.prototype.fromXML=function(e,t,n){ai(t)||(n=t,t="bpmn:Definitions");var i=new gd(te({model:this,lax:!0},n)),o=i.handler(t);return i.fromXML(e,o)},al.prototype.toXML=function(e,t){var n=new oC(t);return new Promise(function(i,o){try{var r=n.toXML(e);return i({xml:r})}catch(a){return o(a)}})};var aC="BPMN20",sC="http://www.omg.org/spec/BPMN/20100524/MODEL",cC="bpmn",lC=[],uC=[{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"}]}],pC=[{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"}]}],dC={tagAlias:"lowerCase",typePrefix:"t"},fC={name:aC,uri:sC,prefix:cC,associations:lC,types:uC,enumerations:pC,xml:dC},hC="BPMNDI",gC="http://www.omg.org/spec/BPMN/20100524/DI",mC="bpmndi",yC=[{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"]}],vC=[{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"}]}],xC=[],bC={name:hC,uri:gC,prefix:mC,types:yC,enumerations:vC,associations:xC},wC="DC",_C="http://www.omg.org/spec/DD/20100524/DC",EC="dc",SC=[{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}]}],RC=[],MC={name:wC,uri:_C,prefix:EC,types:SC,associations:RC},CC="DI",AC="http://www.omg.org/spec/DD/20100524/DI",TC="di",PC=[{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"}]}],kC=[],OC={tagAlias:"lowerCase"},DC={name:CC,uri:AC,prefix:TC,types:PC,associations:kC,xml:OC},LC="bpmn.io colors for BPMN",IC="http://bpmn.io/schema/bpmn/biocolor/1.0",BC="bioc",NC=[{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"}]}],$C=[],FC=[],jC={name:LC,uri:IC,prefix:BC,types:NC,enumerations:$C,associations:FC},HC="BPMN in Color",GC="http://www.omg.org/spec/BPMN/non-normative/color/1.0",zC="color",VC=[{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"}]}],WC=[],UC=[],qC={name:HC,uri:GC,prefix:zC,types:VC,enumerations:WC,associations:UC};const YC={bpmn:fC,bpmndi:bC,dc:MC,di:DC,bioc:jC,color:qC};function sy(e,t){const n=te({},YC,e);return new al(n,t)}const KC={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"}},Ss={[Hm]:KC,[qp]:Lm};function cy(){return sy(Ss)}const ly=cy();async function Ra(e){const{rootElement:t,warnings:n}=await ly.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function XC(e){const{xml:t}=await ly.toXML(e,{format:!0});return t}function vd(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const ao={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},uy=/[ᄀ-ᇿ -〿぀-ヿ㐀-鿿가-힯＀-⦆]/;function ZC(e){return uy.test(e)}function JC(e){const t=ao;return uy.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 Vr(e,t){let n=0;for(const i of e)n+=t*JC(i);return n}function py(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&QC(e),eA(e),tA(e),nA(e)}function QC(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(o){var a;const r=Number.parseFloat(((a=String(n.font).match(/(\d+(?:\.\d+)?)px/))==null?void 0:a[1])??"12");return{width:Vr(o,r),fontBoundingBoxAscent:r*ao.ascentEm,fontBoundingBoxDescent:r*ao.descentEm,actualBoundingBoxAscent:r*ao.ascentEm,actualBoundingBoxDescent:r*ao.descentEm}}};t.getContext=()=>n}function eA(e){if(e.SVGMatrix)return;class t{constructor(){on(this,"a",1);on(this,"b",0);on(this,"c",0);on(this,"d",1);on(this,"e",0);on(this,"f",0)}static of(i,o,r,a,s,c){return Object.assign(new t,{a:i,b:o,c:r,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,o){return this.multiply(t.of(1,0,0,1,i,o))}scale(i,o=i){return this.multiply(t.of(i,0,0,o,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 tA(e){var r;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),d=Math.sin(u);a.a=p,a.b=d,a.c=-d,a.d=p,a.e=c-p*c+d*l,a.f=l-d*c-p*l},setMatrix(s){Object.assign(a,s)}}},n=a=>{const s=t();return Object.assign(s.matrix,a),s},i=(r=e.SVGSVGElement)==null?void 0:r.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 o=e.SVGElement.prototype;Object.getOwnPropertyDescriptor(o,"transform")||Object.defineProperty(o,"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 nA(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:Vr(n,12),height:14}})}const sl=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),iA=new Set(["bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),oA=1,cl=new Set(["bpmn:TextAnnotation","bpmn:DataStoreReference","bpmn:DataObjectReference","bpmn:DataInput","bpmn:DataOutput"]),ir=2;function ct(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}`;case"merge-before-predecessor":return`mb|${e.merge}|${e.edge}`;case"edge-crosses-own-endpoint":return`xo|${e.edge}|${e.shape}`;case"message-detours-own-pool-shape":return`md|${e.edge}|${e.shape}`}}const dy=20,ll=5,fy=3,rA=8,Ma=15,xd=50,hy=12,aA=hy*1.2;function bd(e,t){const n=t.split(/\r?\n/),i=Math.max(...n.map(r=>Vr(r,hy))),o=n.length*aA;return{x:e.x+e.width/2-i/2,y:e.y+e.height/2-o/2,width:i,height:o}}const gy=1;function fn(e){const t=[];for(let n=0;n+1<e.waypoints.length;n++){const i=e.waypoints[n],o=e.waypoints[n+1];Math.abs(i.y-o.y)<.5&&Math.abs(i.x-o.x)>=.5?t.push({axis:"h",at:i.y,lo:Math.min(i.x,o.x),hi:Math.max(i.x,o.x),dir:o.x>i.x?1:-1}):Math.abs(i.x-o.x)<.5&&Math.abs(i.y-o.y)>=.5&&t.push({axis:"v",at:i.x,lo:Math.min(i.y,o.y),hi:Math.max(i.y,o.y),dir:o.y>i.y?1:-1})}return t}function or(e,t){let n=null;const i=e.type!==t.type,r=!!(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 fn(e))for(const s of fn(t)){if(a.axis!==s.axis||Math.abs(a.at-s.at)>gy)continue;const c=a.dir!==s.dir?"opposite":i?"mixed":r?"unrelated":null;if(!c)continue;const l=Math.min(a.hi,s.hi)-Math.max(a.lo,s.lo);l>=dy&&(!n||l>n.length)&&(n={axis:a.axis,length:l,kind:c})}return n}function wd(e){return e.kind==="edge-overlap-opposite"||e.kind==="edge-overlap-mixed"||e.kind==="edge-overlap-unrelated"}function my(e,t){const n=or(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function sA(e,t){let n=0;for(const i of t)i.id!==e.id&&my(e,i)&&n++;return n}function qn(e,t){let n=0;for(const i of t)i.id!==e.id&&or(e,i)&&n++;return n}const yy=15,vy=20;function cA(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-vy||t.at>n[1]+vy)return null;const i=t.axis==="v"?[e.y,e.y+e.height]:[e.x,e.x+e.width],o=Math.max(i[0],t.lo),r=Math.min(i[1],t.hi);return r>o?[o,r]:null}const _d=20;function ul(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>gy)continue;const o=Math.max(e.lo,i.lo),r=Math.min(e.hi,i.hi);r-o<dy||n.push([o-_d,r+_d])}return n}function Ca(e,t){const n=e.label;if(!n)return null;let i=null;for(const o of fn(e)){const r=cA(n,o);if(r){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of ul(o,fn(a)))if(Math.min(c,r[1])>Math.max(s,r[0])){i={other:a.id,axis:o.axis};break}}}}return i}const lA=10,uA=1,pA=(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 dA(e,t,n,i){const o=n.x+i,r=n.y+i,a=n.x+n.width-i,s=n.y+n.height-i;if(a<=o||s<=r)return!1;const c=t.x-e.x,l=t.y-e.y;let u=0,p=1;const d=(f,m)=>{if(m===0)return f<=0;const h=f/m;if(m>0){if(h>p)return!1;h>u&&(u=h)}else{if(h<u)return!1;h<p&&(p=h)}return!0};return d(o-e.x,c)&&d(e.x-a,-c)&&d(r-e.y,l)&&d(e.y-s,-l)&&p>u}function Ed(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 fA=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,Aa=1;function qi(e,t){const n=e.x+Aa,i=e.x+e.width-Aa,o=e.y+Aa,r=e.y+e.height-Aa;return t.axis==="h"?t.at>o&&t.at<r&&t.lo<i&&t.hi>n:t.at>n&&t.at<i&&t.lo<r&&t.hi>o}function Ta(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 xy(e,t){const n=e.label;if(!n)return null;if(fn(e).some(i=>qi(n,i)))return e.id;for(const i of[...t.edges].filter(o=>o.id!==e.id).sort((o,r)=>o.id.localeCompare(r.id)))if(fn(i).some(o=>qi(n,o)))return i.id;for(const i of t.shapes.filter(o=>o.container).sort((o,r)=>o.id.localeCompare(r.id)))if(Ta(i).some(o=>qi(n,o)))return i.id;return null}function Tt(e,t){const n=new Set(e.endpoints),i=[];for(const o of t)if(!n.has(o.id)){for(let r=0;r+1<e.waypoints.length;r++)if(dA(e.waypoints[r],e.waypoints[r+1],o,ir)){i.push(o);break}}return i}const hA=/Participant|Lane|SubProcess|TextAnnotation|Group/;function Sd(e,t){for(const n of t){if(!n||hA.test(n.type))continue;const i=n.x+n.width/2,o=n.y+n.height/2,r=(a,s)=>{if(/Gateway$/.test(n.type)){const c=n.width/2-ir,l=n.height/2-ir;return c>0&&l>0&&Math.abs(a-i)/c+Math.abs(s-o)/l<1}return/Event$/.test(n.type)?Math.hypot(a-i,s-o)<Math.min(n.width,n.height)/2-ir:a>n.x+ir&&a<n.x+n.width-ir&&s>n.y+ir&&s<n.y+n.height-ir};for(let a=0;a+1<e.length;a++){const s=e[a],c=e[a+1],l=Math.max(1,Math.ceil(Math.hypot(c.x-s.x,c.y-s.y)/2));for(let u=0;u<=l;u++)if(r(s.x+(c.x-s.x)*u/l,s.y+(c.y-s.y)*u/l))return!0}}return!1}const Rs=(e,t,n)=>{const i=n.x-t.x,o=n.y-t.y,r=i*i+o*o,a=r===0?0:Math.max(0,Math.min(1,((e.x-t.x)*i+(e.y-t.y)*o)/r));return Math.hypot(e.x-(t.x+a*i),e.y-(t.y+a*o))},gA=(e,t,n,i)=>wy(e,t,n,i)?0:Math.min(Rs(e,n,i),Rs(t,n,i),Rs(n,e,t),Rs(i,e,t)),by=(e,t)=>{let n=!1;for(let i=0,o=t.length-1;i<t.length;o=i++){const r=t[i],a=t[o];r.y>e.y!=a.y>e.y&&e.x<(a.x-r.x)*(e.y-r.y)/(a.y-r.y)+r.x&&(n=!n)}return n};function Po(e,t,n){const{x:i,y:o,width:r,height:a}=n;if(/Event$/.test(n.type)){const l=Math.min(r,a)/2;return Math.max(0,Rs({x:i+r/2,y:o+a/2},e,t)-l)}const s=/Gateway$/.test(n.type)?[{x:i+r/2,y:o},{x:i+r,y:o+a/2},{x:i+r/2,y:o+a},{x:i,y:o+a/2}]:[{x:i,y:o},{x:i+r,y:o},{x:i+r,y:o+a},{x:i,y:o+a}];if(by(e,s)||by(t,s))return 0;let c=1/0;for(let l=0;l<s.length;l++)c=Math.min(c,gA(e,t,s[l],s[(l+1)%s.length]));return c}function wy(e,t,n,i){const o=(l,u,p)=>(u.x-l.x)*(p.y-l.y)-(u.y-l.y)*(p.x-l.x),r=o(n,i,e),a=o(n,i,t),s=o(e,t,n),c=o(e,t,i);return r*a<0&&s*c<0}const Rd=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function _y(e,t){for(let n=0;n+1<e.waypoints.length;n++)for(let i=0;i+1<t.waypoints.length;i++)if(wy(e.waypoints[n],e.waypoints[n+1],t.waypoints[i],t.waypoints[i+1]))return!0;return!1}function Pa(e,t){let n=0;for(const i of t)i.id===e.id||Rd(e,i)||_y(e,i)&&n++;return n}function kn(e,t){let n=0;for(const i of t)i.id===e.id||Rd(e,i)||Pa(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function Ey(e){let t=0;const n=e.edges;for(let i=0;i<n.length;i++)for(let o=i+1;o<n.length;o++)Pa(n[i],[n[o]])>0&&(t+=n[i].type===n[o].type?2:1);return t}function Si(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let o=i+1;o<n.length;o++)if(Pa(n[i],[n[o]])>0){const r=n[i].id,a=n[o].id;t.push(r<a?[r,a]:[a,r])}return t.sort((i,o)=>`${i[0]}|${i[1]}`.localeCompare(`${o[0]}|${o[1]}`))}function Ri(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let o=i+1;o<n.length;o++)if(Rd(n[i],n[o])&&_y(n[i],n[o])){const r=n[i].id,a=n[o].id;t.push(r<a?[r,a]:[a,r])}return t.sort((i,o)=>`${i[0]}|${i[1]}`.localeCompare(`${o[0]}|${o[1]}`))}function Sy(e){const t=Si(e),n=a=>a==="bpmn:MessageFlow"||a.endsWith("Association")?"dashed":"solid",i=new Map(e.edges.map(a=>[a.id,a]));let o=0,r=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"?o++:u==="dashed"&&p==="dashed"&&r++}return{pairs:t,solidPairs:o,dashedPairs:r,mixedPairs:t.length-o-r,crossPoolMessages:mA(e)}}function mA(e){const t=e.shapes.filter(o=>o.type==="bpmn:Participant");if(t.length<3)return 0;const n=o=>{const r=e.shapes.find(a=>a.id===o);if(r)return t.find(a=>r.x>=a.x&&r.y>=a.y&&r.x+r.width<=a.x+a.width&&r.y+r.height<=a.y+a.height)};let i=0;for(const o of e.edges){if(o.type!=="bpmn:MessageFlow"||o.endpoints.length<2)continue;const r=n(o.endpoints[0]),a=n(o.endpoints[1]);if(!r||!a||r.id===a.id)continue;const s=Math.min(r.y,a.y),c=Math.max(r.y+r.height,a.y+a.height);t.some(l=>l.id!==r.id&&l.id!==a.id&&l.y>s&&l.y+l.height<c)&&i++}return i}function Ry(e,t,n){const i=new Set(t.flatMap(o=>[...o.members]));return e.shapes.filter(o=>!o.container&&!cl.has(o.type)&&!i.has(o.id)&&o.x>=n.x&&o.y>=n.y&&o.x+o.width<=n.right&&o.y+o.height<=n.bottom).map(o=>o.id).sort()}function My(e){var n;const t=(n=Ut(e==null?void 0:e.extensionElements))==null?void 0:n.values;if(Array.isArray(t))for(const i of t){const o=Ut(i);if((o==null?void 0:o.$type)!=="bwl:Members"||typeof o.refs!="string")continue;const r=o.refs.split(/\s+/).filter(Boolean);return r.length?r:void 0}}const Cy=e=>e?{members:e}:{},hn=e=>e.shapes.filter(t=>!t.container);function yA(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 o=i.endpoints.find(a=>a!==e.id),r=o?n.get(o):void 0;if(r&&r.type!=="bpmn:Group"){if(r.container)return r.id;if(r.parent)return r.parent}}}function vA(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 o=e.x+e.width/2,r=e.y+e.height/2;return n.shapes.some(a=>a.container&&a.id!==t.id&&a.id!==e.id&&a.type!=="bpmn:Group"&&o>=a.x&&o<=a.x+a.width&&r>=a.y&&r<=a.y+a.height)}function Ay(e,t){const n=e.label;if(!n)return null;for(const i of[...t.edges].sort((o,r)=>o.id.localeCompare(r.id)))if(fn(i).some(o=>qi(n,o)))return i.id;for(const i of[...t.shapes].filter(o=>o.container).sort((o,r)=>o.id.localeCompare(r.id)))if(Ta(i).some(o=>qi(n,o)))return i.id;return null}function rr(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 Ty=3;function Py(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 o=/Event$/.test(t.type);if(!o&&!/Gateway$/.test(t.type))return Math.min(n,i);const r=t.x+t.width/2,a=t.y+t.height/2,s=Math.min(Math.max(r,e.x),e.x+e.width),c=Math.min(Math.max(a,e.y),e.y+e.height);if(o)return Math.max(0,t.width/2-Math.hypot(s-r,c-a));const l=t.width/2,u=t.height/2;return Math.max(0,(1-(Math.abs(s-r)/l+Math.abs(c-a)/u))*Math.min(l,u))}function ka(e,t){const n=[];for(const i of t.shapes){if(i.container||cl.has(i.type))continue;const o=Py(e,i);o>=Ty&&n.push({shape:i.id,depth:o})}return n.sort((i,o)=>i.shape.localeCompare(o.shape))}function Md(e){const t=[],n=e.filter(o=>o.type==="bpmn:Participant"),i=(o,r)=>o.x<=r.x&&o.y<=r.y&&o.x+o.width>=r.x+r.width&&o.y+o.height>=r.y+r.height;for(let o=0;o<n.length;o++)for(let r=o+1;r<n.length;r++){const a=n[o],s=n[r];a.x+a.width<=s.x||s.x+s.width<=a.x||a.y+a.height<=s.y||s.y+s.height<=a.y||t.push({pools:[a.id,s.id],contained:i(a,s)||i(s,a)})}return t}function xA(e){const t=new Map,n=new Set;for(const d of e)t.set(d.source,[...t.get(d.source)??[],d.target]),n.add(d.target);const i=[...e.map(d=>d.source).filter(d=>!n.has(d)),...e.map(d=>d.source)],o=new Map,r=new Set,a=d=>{o.set(d,"open");for(const f of t.get(d)??[]){const m=o.get(f);m==="open"?r.add(`${d}>${f}`):m||a(f)}o.set(d,"done")};for(const d of i)o.has(d)||a(d);const s=(d,f)=>!r.has(`${d}>${f}`),c=[],l=new Set,u=d=>{l.add(d);for(const f of t.get(d)??[])s(d,f)&&!l.has(f)&&u(f);c.push(d)};for(const d of i)l.has(d)||u(d);const p=new Map;for(const d of c.reverse()){const f=p.get(d)??0;p.set(d,f);for(const m of t.get(d)??[])s(d,m)&&(p.get(m)??-1)<f+1&&p.set(m,f+1)}return p}function bA(e){const t=e.edges.filter(l=>l.type==="bpmn:SequenceFlow"&&!!l.source&&!!l.target),n=new Map,i=new Map;for(const l of t)n.set(l.source,[...n.get(l.source)??[],l.target]),i.set(l.target,[...i.get(l.target)??[],l.source]);const o=new Map(n);for(const l of e.shapes)l.host!==void 0&&o.set(l.host,[...o.get(l.host)??[],l.id]);const r=(l,u)=>{const p=new Set([l]),d=[l];for(;d.length;)for(const f of u.get(d.pop())??[])p.has(f)||(p.add(f),d.push(f));return p},a=xA(t),s=new Map(e.shapes.map(l=>[l.id,l])),c=[];for(const[l,u]of i){const p=s.get(l);if(!p)continue;const d=r(l,o),f=[...new Set(u)].filter(y=>!d.has(y)&&s.has(y));if(f.length<2)continue;const m=f.map(y=>r(y,i)),h=[...m[0]].some(y=>m.every(w=>w.has(y)));for(const y of f){if(p.x+p.width/2>=s.get(y).x)continue;const w=a.get(y)??0;if(!(!h&&!f.some(g=>g!==y&&w>=(a.get(g)??0)+2)))for(const g of t)g.source===y&&g.target===l&&c.push({kind:"merge-before-predecessor",merge:l,edge:g.id})}}return c}function wA(e){const t=new Map(e.shapes.map(i=>[i.id,i])),n=[];for(const i of e.edges)if(!(i.type!=="bpmn:SequenceFlow"&&i.type!=="bpmn:MessageFlow"))for(const o of new Set(i.endpoints)){const r=t.get(o);r&&!r.container&&Sd(i.waypoints,[r])&&n.push({kind:"edge-crosses-own-endpoint",edge:i.id,shape:o})}return n}function _A(e){const t=new Map(e.shapes.map(o=>[o.id,o])),n=o=>{for(let r=t.get(o);r;r=r.parent?t.get(r.parent):void 0)if(r.type==="bpmn:Participant")return r.id},i=[];for(const o of e.edges){if(o.type!=="bpmn:MessageFlow"||o.waypoints.length<4)continue;const[r,a]=[o.source??o.endpoints[0],o.target??o.endpoints[1]].map(h=>h?t.get(h):void 0);if(!r||!a||r.type==="bpmn:Participant"==(a.type==="bpmn:Participant"))continue;const[s,c]=r.type==="bpmn:Participant"?[r,a]:[a,r];if(c.container)continue;const l=c.x+c.width/2;if(l<s.x+10||l>s.x+s.width-10)continue;const u=n(c.id);if(!u)continue;const p=s.y>c.y,[d,f]=p?[c.y+c.height,s.y]:[s.y+s.height,c.y],m=e.shapes.filter(h=>h.id!==c.id&&!h.container&&!h.attached&&h.type!=="bpmn:TextAnnotation"&&h.x<l&&l<h.x+h.width&&h.y<f&&h.y+h.height>d&&n(h.id)===u).sort((h,y)=>p?h.y-y.y:y.y-h.y);m.length&&i.push({kind:"message-detours-own-pool-shape",edge:o.id,shape:m[0].id})}return i}function ut(e,t={}){const n=[],i=e.shapes.filter(g=>!g.container);for(const g of e.edges)for(const v of Tt(g,i))n.push({kind:"edge-crosses-shape",edge:g.id,shape:v.id});const o=e.shapes.filter(g=>g.container&&iA.has(g.type));if(o.length){const g=(v,b)=>{const S=e.shapes.find(M=>M.id===b);return!!S&&S.x>=v.x&&S.y>=v.y&&S.x+S.width<=v.x+v.width&&S.y+S.height<=v.y+v.height};for(const v of e.edges)for(const b of Tt(v,o))v.endpoints.includes(b.id)||v.endpoints.some(S=>g(b,S))||n.push({kind:"edge-crosses-subprocess",edge:v.id,subProcess:b.id})}for(const g of e.edges){if(g.waypoints.length<2)continue;const v=[[g.source,g.waypoints[0]],[g.target,g.waypoints[g.waypoints.length-1]]];for(const[b,S]of v){if(!b)continue;const M=e.shapes.find(H=>H.id===b);if(!M||M.container)continue;const B=Math.max(M.x-S.x,S.x-(M.x+M.width),0),A=Math.max(M.y-S.y,S.y-(M.y+M.height),0),I=Math.hypot(B,A);I>lA&&n.push({kind:"edge-endpoint-detached",edge:g.id,shape:b,distance:Math.round(I)})}}for(const g of Md(e.shapes))n.push({kind:"pool-overlap",...g});const r=i.filter(g=>!g.attached);for(let g=0;g<r.length;g++)for(let v=g+1;v<r.length;v++){const b=r[g],S=r[v];if(!Ed(b,S,oA))continue;const M=b.id<S.id?[b.id,S.id]:[S.id,b.id];n.push({kind:"shape-overlap",shapes:M,identical:fA(b,S)})}const a=e.shapes.filter(g=>g.type==="bpmn:Group"&&Array.isArray(g.members)&&g.members.length>0);for(let g=0;g<a.length;g++)for(let v=g+1;v<a.length;v++){const b=a[g],S=a[v],M=Math.min(b.x+b.width,S.x+S.width)-Math.max(b.x,S.x),B=Math.min(b.y+b.height,S.y+S.height)-Math.max(b.y,S.y);if(M<=ll||B<=ll)continue;const A=b.id<S.id?[b.id,S.id]:[S.id,b.id],I=new Set(S.members);if(b.members.some(V=>I.has(V))){const V=Ry(e,a,{x:Math.max(b.x,S.x),y:Math.max(b.y,S.y),right:Math.min(b.x+b.width,S.x+S.width),bottom:Math.min(b.y+b.height,S.y+S.height)});V.length&&n.push({kind:"group-overlap-unreadable",reason:"orphan",groups:A,shapes:V});continue}const H=b.x<=S.x&&b.y<=S.y&&b.x+b.width>=S.x+S.width&&b.y+b.height>=S.y+S.height?b.id:S.x<=b.x&&S.y<=b.y&&S.x+S.width>=b.x+b.width&&S.y+S.height>=b.y+b.height?S.id:void 0;n.push({kind:"group-overlap-unintended",groups:A,...H?{container:H}:{}})}const s=new Set(a.flatMap(g=>[...g.members])),c=g=>e.shapes.filter(v=>!v.container&&!cl.has(v.type)&&v.x>=g.x&&v.y>=g.y&&v.x+v.width<=g.x+g.width&&v.y+v.height<=g.y+g.height);for(const g of a){const v=c(g);if(!v.length)continue;const b=new Set(g.members),S=v.filter(M=>!b.has(M.id));S.some(M=>s.has(M.id))&&(S.length*2<v.length||n.push({kind:"group-overlap-unreadable",reason:"minority",group:g.id,shapes:S.map(M=>M.id).sort()}))}for(const g of a){const v=new Set(c(g).map(I=>I.id)),b=new Set(g.members),S=new Set([...v].filter(I=>!b.has(I)&&s.has(I)));if(!S.size)continue;let M=!1,B=!1,A=!1;for(const I of e.edges){if(I.type!=="bpmn:SequenceFlow"||!I.source||!I.target)continue;const H=S.has(I.source),V=S.has(I.target);!H&&V&&!v.has(I.source)?M=!0:H&&!V&&!v.has(I.target)?B=!0:H&&V&&(A=!0)}M&&B&&A&&n.push({kind:"group-overlap-unreadable",reason:"throughpass",group:g.id,shapes:[...S].sort()})}const l=e.shapes.filter(g=>g.type==="bpmn:Group");for(let g=0;g<l.length;g++)for(let v=g+1;v<l.length;v++)for(let b=v+1;b<l.length;b++){const S=[l[g],l[v],l[b]],M={x:Math.max(...S.map(I=>I.x)),y:Math.max(...S.map(I=>I.y)),right:Math.min(...S.map(I=>I.x+I.width)),bottom:Math.min(...S.map(I=>I.y+I.height))};if(M.right-M.x<=ll||M.bottom-M.y<=ll)continue;const B=Ry(e,[],M);if(!B.length)continue;const A=S.map(I=>I.id).sort();n.push({kind:"group-stack-unreadable",groups:A,shapes:B})}for(const g of e.shapes.filter(v=>v.type==="bpmn:Group"))for(const v of e.shapes){if(v.container||v.attached||cl.has(v.type)||v.width<=0||v.height<=0)continue;const b=[["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[S,M,B,A,I]of b){const H=B==="h"?v.x:v.y,V=B==="h"?v.x+v.width:v.y+v.height;if(!(H<I&&A<V))continue;const G=B==="h"?v.y:v.x,ie=B==="h"?v.y+v.height:v.x+v.width;if(!(G<M&&M<ie))continue;const pe=Math.min(M-G,ie-M);pe<rA||n.push({kind:"group-cuts-shape",group:g.id,shape:v.id,side:S,depth:pe})}}const u=t.includeObservationOnly?e.shapes.filter(g=>g.type==="bpmn:Group"&&g.width>0&&g.height>0):[];if(u.length){const g=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 b=fn(v);if(b.length)for(const S of u){const M=S.x+S.width,B=S.y+S.height,A=v.endpoints.some(H=>{const V=g.get(H);return!!V&&S.x<V.x&&V.x<M&&S.y<V.y&&V.y<B});let I=null;for(const H of b){const[V,G,ie]=H.axis==="v"?[S.y,B,[["left",S.x],["right",M]]]:[S.x,M,[["top",S.y],["bottom",B]]],pe=Math.min(H.hi,G)-Math.max(H.lo,V);if(pe<xd)continue;const Y=H.axis==="v"?S.x<H.at&&H.at<M:S.y<H.at&&H.at<B;if(!(Y&&A))for(const[Te,Pe]of ie){const ke=Math.abs(H.at-Pe);ke<=Ma&&(!I||ke<I.distance)&&(I={side:Te,inside:Y,distance:ke,length:pe})}}I&&n.push({kind:"edge-along-group-boundary",edge:v.id,group:S.id,side:I.side,inside:I.inside,distance:Math.round(I.distance),length:Math.round(I.length)})}}}const p=e.shapes.filter(g=>g.container&&g.type!=="bpmn:Group"&&g.type!=="bpmn:Lane");for(const g of e.shapes.filter(v=>v.type==="bpmn:Group"))for(const v of p){const b=g.x<v.x+v.width&&v.x<g.x+g.width,S=g.y<v.y+v.height&&v.y<g.y+g.height,M=[["top",g.y,v.y,b],["bottom",g.y+g.height,v.y+v.height,b],["left",g.x,v.x,S],["right",g.x+g.width,v.x+v.width,S]];for(const[B,A,I,H]of M)H&&Math.abs(A-I)<=fy&&n.push({kind:"group-on-container-boundary",group:g.id,container:v.id,side:B})}const d=e.shapes.filter(g=>g.type==="bpmn:Group");for(let g=0;g<d.length;g++)for(let v=g+1;v<d.length;v++){const b=d[g],S=d[v],M=b.x<S.x+S.width&&S.x<b.x+b.width,B=b.y<S.y+S.height&&S.y<b.y+b.height,A=[["x",b.x+b.width,S.x,B],["x",S.x+S.width,b.x,B],["y",b.y+b.height,S.y,M],["y",S.y+S.height,b.y,M]];for(const[I,H,V,G]of A)if(G&&Math.abs(H-V)<=fy){n.push({kind:"group-on-group-boundary",groups:b.id<S.id?[b.id,S.id]:[S.id,b.id],axis:I});break}}for(let g=0;g<e.edges.length;g++)for(let v=g+1;v<e.edges.length;v++){const b=e.edges[g],S=e.edges[v],M=or(b,S);if(!M)continue;const B=b.id<S.id?[b.id,S.id]:[S.id,b.id];n.push({kind:M.kind==="opposite"?"edge-overlap-opposite":M.kind==="mixed"?"edge-overlap-mixed":"edge-overlap-unrelated",edges:B,axis:M.axis,length:Math.round(M.length)})}for(const g of e.edges){if(!g.label)continue;const v=Ca(g,e.edges);v&&n.push({kind:"label-on-shared-segment",edge:g.id,other:v.other,axis:v.axis})}for(const g of e.edges){if(!g.label)continue;const v=xy(g,e);v&&n.push({kind:"label-over-line",edge:g.id,line:v})}if(t.includeObservationOnly){for(const g of e.edges)if(!(!g.label||g.type!=="bpmn:SequenceFlow"))for(const{shape:v,depth:b}of ka(g.label,e))n.push({kind:"label-over-shape",edge:g.id,shape:v,depth:Math.round(b)})}t.includeObservationOnly&&n.push(...bA(e)),t.includeObservationOnly&&n.push(...wA(e)),t.includeObservationOnly&&n.push(..._A(e));const f=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(v=>!f.has(v.id))]){if(!g.label)continue;const v=Ay(g,e);v&&n.push({kind:"label-over-line",edge:g.id,line:v})}const h=new Set(e.shapes.filter(g=>g.type==="bpmn:TextAnnotation").map(g=>g.id));for(const g of m)for(const{owner:v,rect:b}of rr(e))v===g.id||h.has(v)||Ed(g.label,b,Aa)&&n.push({kind:"pool-name-over-label",pool:g.id,label:v});const y=rr(e);for(const g of i)if(g.type==="bpmn:TextAnnotation")for(const{owner:v,rect:b}of y)v!==g.id&&Ed(g,b,Aa)&&n.push({kind:"annotation-over-label",annotation:g.id,label:v});const w=new Map(e.shapes.map(g=>[g.id,g]));for(const g of i){const v=g.parent??yA(g,e,w);if(!v)continue;const b=w.get(v);!b||!b.container||pA(b,g,uA)||g.type==="bpmn:TextAnnotation"&&!vA(g,b,e)||n.push({kind:"shape-outside-container",shape:g.id,container:b.id})}return n.sort((g,v)=>ct(g).localeCompare(ct(v)))}const Ut=e=>typeof e=="object"&&e!==null?e:void 0,rn=e=>typeof e=="number"?e:0,Yi=e=>{const t=Ut(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function EA(e){const t=Ut(e);if(!t)return[];const n=[];for(const i of["sourceRef","targetRef"]){const o=t[i];for(const r of Array.isArray(o)?o:[o]){const a=Yi(r);a&&n.push(a)}}return n}function SA(e){const t=Ut(e);if(!t)return{};const n=Array.isArray(t.sourceRef)?void 0:Yi(t.sourceRef),i=Array.isArray(t.targetRef)?void 0:Yi(t.targetRef);return n&&i?{source:n,target:i}:{}}function RA(e,t){const n=Ut(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const o=Yi(n);return o?t.get(o):void 0}if(sl.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return Yi(n)}function ky(e){var a,s,c,l,u;const t=[],n=[],i=((a=Ut(e))==null?void 0:a.diagrams)??[],o=new Map,r=new Set;for(const p of((s=Ut(e))==null?void 0:s.rootElements)??[]){const d=Ut(p);if((d==null?void 0:d.$type)==="bpmn:Collaboration")for(const f of d.participants??[]){const m=Ut(f),h=Yi(m),y=Yi(m==null?void 0:m.processRef);h&&y?o.set(y,h):h&&r.add(h)}}for(const p of i){const d=Ut((c=Ut(p))==null?void 0:c.plane),f=(d==null?void 0:d.planeElement)??[];for(const m of f){const h=Ut(m);if(!h)continue;const y=Ut(h.bpmnElement),w=typeof(y==null?void 0:y.id)=="string"?y.id:void 0;if(!w)continue;const g=typeof(y==null?void 0:y.$type)=="string"?y.$type:"",v=Ut(h.bounds);if(v){const S=h.isExpanded===!1&&g!=="bpmn:Participant",M=Ut((l=Ut(h.label))==null?void 0:l.bounds),B=Yi(y==null?void 0:y.attachedToRef),A={id:w,type:g,x:rn(v.x),y:rn(v.y),width:rn(v.width),height:rn(v.height),container:sl.has(g)&&!S,attached:(y==null?void 0:y.attachedToRef)!==void 0,...B!==void 0?{host:B}:{},...y?{parent:RA(y,o)}:{},...M?{label:{x:rn(M.x),y:rn(M.y),width:rn(M.width),height:rn(M.height)}}:{},...g==="bpmn:Group"?Cy(My(y)):{}},I=h.isHorizontal!==!1,H=typeof(y==null?void 0:y.name)=="string"?y.name:"";r.has(w)&&I&&H&&(A.label=bd(A,H)),t.push(A);continue}const b=h.waypoint;if(Array.isArray(b)){const S=Ut((u=Ut(h.label))==null?void 0:u.bounds);n.push({id:w,type:g,waypoints:b.map(M=>{var B,A;return{x:rn((B=Ut(M))==null?void 0:B.x),y:rn((A=Ut(M))==null?void 0:A.y)}}),endpoints:EA(y),...SA(y),...S?{label:{x:rn(S.x),y:rn(S.y),width:rn(S.width),height:rn(S.height)}}:{}})}}}return{shapes:t,edges:n}}function Oy(e){return ut(ky(e),{includeObservationOnly:!0})}async function MA(e){const{definitions:t,warnings:n}=await Ra(e);return{findings:Oy(t),warnings:n}}function Ge(e){var i;const t=[],n=[];for(const o of e.getAll()){const r=o;if(r.type==="label"||r.labelTarget)continue;const a=typeof r.type=="string"?r.type:"";if(a==="bpmn:Definitions"||a.startsWith("bpmndi:"))continue;const s=r.waypoints;if(s){const y=Ut(r.label),w=Yi(r.source),g=Yi(r.target);n.push({id:r.id,type:a,waypoints:s.map(v=>({x:rn(v.x),y:rn(v.y)})),endpoints:[w,g].filter(v=>!!v),...w&&g?{source:w,target:g}:{},...y&&typeof y.x=="number"?{label:{x:y.x,y:rn(y.y),width:rn(y.width),height:rn(y.height)}}:{}});continue}if(typeof r.x!="number"||typeof r.y!="number")continue;const c=Ut(r.businessObject),l=Yi(c==null?void 0:c.attachedToRef),u=Ut(r.label);let p=Ut(r.parent);for(;p&&p.type==="bpmn:Lane";)p=Ut(p.parent);const d=typeof(p==null?void 0:p.type)=="string"?p.type:"",f=p&&sl.has(d)&&d!=="bpmn:Group"&&typeof p.id=="string"?p.id:void 0,m={id:r.id,type:a,x:r.x,y:r.y,width:rn(r.width),height:rn(r.height),container:sl.has(a)&&(a==="bpmn:Participant"||r.collapsed!==!0),attached:(c==null?void 0:c.attachedToRef)!==void 0,...l!==void 0?{host:l}:{},...f!==void 0?{parent:f}:{},...u&&typeof u.x=="number"?{label:{x:u.x,y:rn(u.y),width:rn(u.width),height:rn(u.height)}}:{},...a==="bpmn:Group"?Cy(My(c)):{}},h=typeof(c==null?void 0:c.name)=="string"?c.name:"";a==="bpmn:Participant"&&!(c!=null&&c.processRef)&&h&&((i=Ut(r.di))==null?void 0:i.isHorizontal)!==!1&&(m.label=bd(m,h)),t.push(m)}return{shapes:t,edges:n}}const CA={"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 AA(e,t){const n=CA[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function Dy(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function Ly(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 AA(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&Dy(i)===n).sort((i,o)=>i.y-o.y).map(i=>i.id),laneDeclarationOrderOf:n=>{var s;const i=e.get(n),o=(s=i==null?void 0:i.businessObject)==null?void 0:s.processRef,r=[],a=c=>{for(const l of c??[])for(const u of l.lanes??[])r.push(u.id),a(u.childLaneSet?[u.childLaneSet]:void 0)};return a(o==null?void 0:o.laneSets),r},participantOf:n=>{const i=e.get(n);return i?Dy(i):void 0},endpointsOf:n=>{var o,r;const i=e.get(n);if(!(!i||i.type==="label")&&"waypoints"in i)return{source:(o=i.source)==null?void 0:o.id,target:(r=i.target)==null?void 0:r.id}},eventDefinitionOf:n=>{var r;const i=e.get(n);if(!i||i.type!=="bpmn:IntermediateCatchEvent")return;const o=(((r=i.businessObject)==null?void 0:r.eventDefinitions)??[]).map(a=>a.$type);return Up(o)},reviewRequestLocalesOf:n=>{const i=e.get(n);return!i||i.type==="label"?[]:Qo(i.businessObject).map(o=>o.locale)}}}const Wr=20,TA=4,He=(e,t)=>Math.abs(e-t)<.5,PA=15;function Cd(e,t,n){let i=1/0;for(const o of t)if(!n.includes(o.id))for(let r=1;r<e.length;r++)i=Math.min(i,Po(e[r-1],e[r],o));return i}function kA(e,t,n=PA){if(e.type!=="bpmn:MessageFlow"||e.waypoints.length!==2)return[];const[i,o]=e.waypoints,r=He(i.x,o.x)&&!He(i.y,o.y),a=He(i.y,o.y)&&!He(i.x,o.x);if(!r&&!a)return[];const s=e.endpoints,c=w=>{const g=w?t.find(v=>v.id===w):void 0;return g?r?[g.x+10,g.x+g.width-10]:[g.y+10,g.y+g.height-10]:[-1/0,1/0]},[l,u]=c(s[0]),[p,d]=c(s[1]),f=Math.max(l,p),m=Math.min(u,d);if(!(m>=f))return[];const h=r?i.x:i.y,y=[];for(let w=5;w<=400;w+=5)for(const g of[-1,1]){const v=h+g*w;if(v<f||v>m)continue;const b=r?[{x:v,y:i.y},{x:v,y:o.y}]:[{x:i.x,y:v},{x:o.x,y:v}];Tt({...e,waypoints:b},t).length||Cd(b,t,s)<n||y.push(b)}return y}function Ad(e,t,n,i,o){const r=e.edges.filter(y=>y.id!==t.id),a={...t,waypoints:n},s={...t,waypoints:[...i]};if(kn(a,r)>kn(s,r)||qn(a,r)>qn(s,r))return!1;const c=`L|${t.id}|${t.id}`,l=y=>({...e,edges:e.edges.map(w=>w.id===t.id?{...w,waypoints:y}:w)}),u=y=>ut(y).filter(w=>ct(w)!==c),p=l(n);let d=u(p);const f=o?OA(p,d,t,o):null;f&&(d=u(f));const m=`"${t.id}"`;if(d.some(y=>JSON.stringify(y).includes(m)))return!1;const h=new Set(u(l([...i])).map(ct));return d.every(y=>h.has(ct(y)))}function OA(e,t,n,i){const o=t.filter(s=>s.kind==="label-over-line"&&s.line===n.id&&n.endpoints.includes(s.edge)&&!i.has(s.edge));if(o.length!==1)return null;const r=e.shapes.find(s=>s.id===o[0].edge);if(!r||!/Gateway$|Event$/.test(r.type))return null;const a=Wd(r,e);return a?{...e,shapes:e.shapes.map(s=>s.id===r.id?{...s,label:a}:s)}:null}function Iy(e,t,n,i){for(const o of kA(t,n))if(Ad(e,t,o,i))return o;return null}const DA=120;function By(e,t,n,i,o){if(e.type!=="bpmn:SequenceFlow"||e.endpoints.length!==2)return[];const r=t.find(c=>c.id===e.endpoints[0]),a=t.find(c=>c.id===e.endpoints[1]);if(!r||!a)return[];if(a.x<r.x+r.width)return[];if(Math.min(r.y+r.height,a.y+a.height)-Math.max(r.y,a.y)<10)return[];const s=[];for(const[c,l]of[[0,0],[0,-25],[0,25],[-25,0],[25,0]])for(let u=Wr;u<=DA;u+=5)for(const p of["top","bottom"]){const d=p==="top"?r.y:r.y+r.height,f=p==="top"?a.y:a.y+a.height,m=p==="top"?Math.min(d,f)-u:Math.max(d,f)+u,h=r.x+r.width/2+c,y=a.x+a.width/2+l,w=[{x:h,y:d},{x:h,y:m},{x:y,y:m},{x:y,y:f}];if(!gl(w,i)||Tt({...e,waypoints:w},t).length||Tt({...e,endpoints:[],waypoints:w},[r,a]).length||Cd(w,t,e.endpoints)<Wr)continue;const g=Fd(w,n);(o===void 0?g<Bd:g>=Bd||g<o)||s.push(w)}return s}function Ny(e,t,n,i,o,r){const a=e.shapes.filter(u=>u.type==="bpmn:Participant"||u.type==="bpmn:Lane"),s=By(t,n,a,o),c=$y(e,t,i,s,r);if(c)return c;const l=Math.max(Fd(i,a),Wr);return $y(e,t,i,By(t,n,a,o,l),r)}function $y(e,t,n,i,o){const r=new Map;for(const l of i){const u=l[1].y<l[0].y?"top":"bottom";if(!r.has(u)&&(Ad(e,t,l,n,o)&&r.set(u,l),r.size===2))break}const a=e.edges.filter(l=>l.id!==t.id);let s=null,c=1/0;for(const l of["top","bottom"]){const u=r.get(l);if(!u)continue;const p=kn({...t,waypoints:u},a);p<c&&(s=u,c=p)}return s}function pl(e,t,n,i=Wr){if(He(e.y,t.y)&&!He(e.x,t.x)){const o=Math.min(e.x,t.x),r=Math.max(e.x,t.x);if(!(o<n.x-i&&n.x+n.width+i<r))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(He(e.x,t.x)&&!He(e.y,t.y)){const o=Math.min(e.y,t.y),r=Math.max(e.y,t.y);if(!(o<n.y-i&&n.y+n.height+i<r))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 Fy(e,t,n,i=Wr){if(n.length<2)return null;if(He(e.y,t.y)&&!He(e.x,t.x)){const o=Math.min(e.x,t.x),r=Math.max(e.x,t.x),a=Math.min(...n.map(f=>f.x))-i,s=Math.max(...n.map(f=>f.x+f.width))+i;if(!(o<a&&s<r))return null;const c=e.x<t.x?a:s,l=e.x<t.x?s:a,u=Math.min(...n.map(f=>f.y))-i,p=Math.max(...n.map(f=>f.y+f.height))+i,d=f=>[{x:c,y:e.y},{x:c,y:f},{x:l,y:f},{x:l,y:e.y}];return[d(u),d(p)]}if(He(e.x,t.x)&&!He(e.y,t.y)){const o=Math.min(e.y,t.y),r=Math.max(e.y,t.y),a=Math.min(...n.map(f=>f.y))-i,s=Math.max(...n.map(f=>f.y+f.height))+i;if(!(o<a&&s<r))return null;const c=e.y<t.y?a:s,l=e.y<t.y?s:a,u=Math.min(...n.map(f=>f.x))-i,p=Math.max(...n.map(f=>f.x+f.width))+i,d=f=>[{x:e.x,y:c},{x:f,y:c},{x:f,y:l},{x:e.x,y:l}];return[d(u),d(p)]}return null}function jy(e,t,n=Wr){if(e.length!==4)return null;const[i,o,r,a]=e;if(He(i.y,o.y)&&He(o.x,r.x)&&He(r.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(He(i.x,o.x)&&He(o.y,r.y)&&He(r.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 dl(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 o=n.y+n.height/2,r=i.y+i.height/2;if(o>=i.y&&o<=i.y+i.height)return[];const a=i.x+i.width/2,s=n.x+n.width/2,c=o>r,l=[{x:n.x+n.width,y:o},{x:a,y:o},{x:a,y:c?i.y+i.height:i.y}],u=[{x:s,y:c?n.y:n.y+n.height},{x:s,y:r},{x:i.x,y:r}];return[l,u]}const fl=30,LA=[0,-25,25,-40,40];function IA(e,t){if(e.type!=="bpmn:MessageFlow"||e.endpoints.length!==2)return[];const n=t.find(d=>d.id===e.endpoints[0]),i=t.find(d=>d.id===e.endpoints[1]);if(!n||!i)return[];const o=n.y+n.height/2,r=i.y+i.height/2;if(i.y<n.y+n.height&&i.y+i.height>n.y)return[];const a=r<o,s=a?n.y+n.height:n.y,c=a?s+fl:s-fl,l=a?i.y+i.height:i.y,u=n.x+n.width/2,p=i.x+i.width/2;return LA.map(d=>[{x:u,y:s},{x:u,y:c},{x:p+d,y:c},{x:p+d,y:l}]).filter(d=>Tt({...e,endpoints:[],waypoints:d},[n]).length===0)}const Td=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],ar=(e,t,n)=>Tt({...e,waypoints:t},n).length,BA=25;function Hy(e,t,n){const i=n.x-t.x,o=n.y-t.y,r=i*i+o*o,a=r?Math.max(0,Math.min(1,((e.x-t.x)*i+(e.y-t.y)*o)/r)):0;return{x:t.x+a*i,y:t.y+a*o}}function NA(e,t,n,i){const r=(d,f,m)=>(f.x-d.x)*(m.y-d.y)-(f.y-d.y)*(m.x-d.x),a=r(n,i,e),s=r(n,i,t);if(Math.abs(a)<1e-6&&Math.abs(s)<1e-6){const d=Hy(i,e,t),f=Hy(d,n,i);return Math.hypot(d.x-f.x,d.y-f.y)<1e-6?d:null}const c=r(e,t,n),l=r(e,t,i);if(a*s>1e-6||c*l>1e-6)return null;const u=(e.x-t.x)*(n.y-i.y)-(e.y-t.y)*(n.x-i.x);if(Math.abs(u)<1e-6)return null;const p=((e.x-n.x)*(n.y-i.y)-(e.y-n.y)*(n.x-i.x))/u;return{x:e.x+p*(t.x-e.x),y:e.y+p*(t.y-e.y)}}function $A(e,t,n){let i=0;for(const o of n){if(o.id===t.id||o.waypoints.length<2||o.target!==void 0&&o.target===t.target)continue;const r=o.waypoints[o.waypoints.length-1],a=o.waypoints[o.waypoints.length-2];for(let s=0;s+1<e.length;s++){const c=NA(e[s],e[s+1],a,r);if(c&&Math.hypot(c.x-r.x,c.y-r.y)<=BA){i++;break}}}return i}function hl(e,t,n,i,o){let r=[...e.waypoints],a=ar(e,r,t);if(a===0)return null;let s=!1;for(const d of dl(e,t))if(ar(e,d,t)===0)return d;const c=(i??[]).filter(d=>d.id!==e.id).flatMap(fn),l=d=>fn({...e,waypoints:d}).some(f=>ul(f,c).length>0),u=IA(e,t).filter(d=>ar(e,d,t)===0&&!(o&&Nd(d,o)));if(u.length)return u.find(d=>!l(d))??u[0];const p=d=>!n||d.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 d=t.find(m=>m.id===e.endpoints[0]),f=t.find(m=>m.id===e.endpoints[1]);if(d&&f&&He(d.y+d.height/2,f.y+f.height/2)){const m=[r[0],r[r.length-1]];if(He(m[0].y,m[1].y)&&!He(m[0].x,m[1].x)){const h=t.filter(v=>!e.endpoints.includes(v.id)&&Tt({...e,waypoints:m},[v]).length>0),y=h.length>=2?Fy(m[0],m[1],h):null,g=(y?y.map(v=>[m[0],...v,m[1]]):h.length===1?(pl(m[0],m[1],h[0])??[]).map(v=>[m[0],...v,m[1]]):h.length===0?[m]:[]).filter(v=>ar(e,v,t)===0&&v.length<=r.length).sort((v,b)=>Number(p(b))-Number(p(v)));if(g.length)return g.find(v=>!l(v))??g[0]}}}for(let d=0;d+1<r.length;d++){const f=r[d],m=r[d+1],h=t.filter(g=>!e.endpoints.includes(g.id)&&Tt({...e,waypoints:[f,m]},[g]).length>0);if(h.length<2)continue;const y=Fy(f,m,h);if(!y)continue;const w=y.map(g=>Td(r,d,g)).filter(g=>ar(e,g,t)===0).sort((g,v)=>Number(p(v))-Number(p(g)));if(w.length)return w.find(g=>!l(g))??w[0]}for(let d=0;d<TA&&a>0;d++){let f=!1;for(let m=0;m+1<r.length&&!f;m++){const h=r[m],y=r[m+1];for(const w of t){if(e.endpoints.includes(w.id)||Tt({...e,waypoints:[h,y]},[w]).length===0)continue;const g=pl(h,y,w),b=[...(jy(r,w)??[]).map((M,B)=>({pts:M,k:B,cross:ar(e,M,t),tip:$A(M,e,i??[])})).sort((M,B)=>M.cross-B.cross||M.tip-B.tip||M.k-B.k).map(M=>M.pts),...g?g.map(M=>Td(r,m,M)):[]];if(!b.length)continue;const S=[...b].sort((M,B)=>Number(p(B))-Number(p(M)));for(const M of S){const B=ar(e,M,t);if(B<a){r=M,a=B,f=!0,s=!0;break}}if(f)break}}if(!f)break}return s&&a===0?r:null}const FA=40;function jA(e,t,n,i){if(t.length!==4||!e.target||e.label)return null;const[o,r,a,s]=t,c=He(o.y,r.y)&&He(r.x,a.x)&&He(a.y,s.y)&&!He(r.y,a.y),l=He(o.x,r.x)&&He(r.y,a.y)&&He(a.x,s.x)&&!He(r.x,a.x);if(!c&&!l)return null;const u=b=>c?b.x:b.y,p=b=>c?b.y:b.x,d=u(r),f=Math.sign(p(a)-p(r)),m=Math.min(u(o),u(s)),h=Math.max(u(o),u(s)),y=n.filter(b=>b.id!==e.id);let w=null;for(const b of y){if(b.type!==e.type||b.target!==e.target||b.waypoints.length<3)continue;const[S,M,B]=b.waypoints.slice(-3);if(!He(B.x,s.x)||!He(B.y,s.y)||!He(p(M),p(B))||!He(u(S),u(M))||Math.sign(p(M)-p(S))!==f)continue;const A=u(M),I=Math.abs(A-d);if(I<1||I>FA||A<=m||A>=h)continue;const H=c?[o,{x:A,y:o.y},{x:A,y:s.y},s]:[o,{x:o.x,y:A},{x:s.x,y:A},s];ar(e,H,i)===0&&(!w||I<w.gap)&&(w={pts:H,gap:I})}if(!w)return null;const g={...e,waypoints:[...t]},v={...e,waypoints:w.pts};if(qn(v,y)>qn(g,y)||kn(v,y)>kn(g,y))return null;for(const b of y){if(!b.label||b.target!==e.target)continue;const S=y.filter(M=>M.id!==b.id);if(!Ca(b,[...S,g])&&Ca(b,[...S,v]))return null}return w.pts}function Pd(e,t,n,i){const{elementRegistry:o}=e,r=e.modeling,a=Ge(o),s=hn(a),c=new Set,l=ut(a).filter(p=>p.kind==="edge-crosses-shape"&&!t.has(ct(p)));if(!l.length)return c;const u=new Map;for(const p of l){if(p.kind!=="edge-crosses-shape"||u.has(p.edge))continue;const d=a.edges.find(f=>f.id===p.edge);d&&u.set(p.edge,d)}for(const[p,d]of u){if(i&&!i.has(p))continue;const f=o.get(p);if(!f)continue;const m=f.parent,h=m&&typeof m.x=="number"&&typeof m.width=="number"?{x:m.x,y:m.y,width:m.width,height:m.height}:void 0,y=Tt(d,s);if(!i&&y.length&&y.every(A=>A.type==="bpmn:TextAnnotation")){c.add(p);continue}let w=hl(d,s,h,a.edges,$d(a));const g=Iy(a,d,s,w??d.waypoints);g&&(w=g);const v=Ny(a,d,s,w??d.waypoints,h,n);if(v&&kn({...d,waypoints:v},a.edges.filter(A=>A.id!==p))===0&&(w=v),!w){y.some(A=>A.type==="bpmn:TextAnnotation")&&c.add(p);continue}const b=jA(d,w,a.edges,s);b&&(w=b);const S=a.edges.filter(A=>A.id!==p),M=qn(d,S);qn({...d,waypoints:w},S)>M||r.updateWaypoints(f,w)}return c}function HA(e,t,n,i){var f,m;const o=new Set;if(!t.length)return o;const{elementRegistry:r}=e,a=e.modeling,s=h=>{const y=Ge(r);return[...Si(y),...Ri(y)].filter(([w,g])=>w===h||g===h).length},c=(h,y)=>h.kind==="label-over-line"||h.kind==="label-over-shape"||h.kind==="label-on-shared-segment"?h.edge===y:h.kind==="annotation-over-label"||h.kind==="pool-name-over-label"?h.label===y:!1,l=h=>new Set(ut(Ge(r)).filter(y=>!c(y,h)).map(ct)),u=(h,y)=>Math.abs(h-y)<=1,p=(h,y,w,g,v)=>{const b=hn(Ge(r));for(let S=0;S+3<h.length;S++){const[M,B,A,I]=[h[S],h[S+1],h[S+2],h[S+3]],H=u(M.y,I.y)&&u(M.x,B.x)&&u(A.x,I.x)&&u(B.y,A.y)&&Math.abs(B.y-M.y)>=5,V=u(M.x,I.x)&&u(M.y,B.y)&&u(A.y,I.y)&&u(B.x,A.x)&&Math.abs(B.x-M.x)>=5;if(!H&&!V)continue;const G={waypoints:[M,I],endpoints:w};if(Tt(G,[y]).length&&!Tt(G,b).length)return S}return-1},d=(h,y)=>[...h.slice(0,y+1),...h.slice(y+3)].filter((w,g,v)=>g===0||g===v.length-1||!(u(v[g-1].x,w.x)&&u(v[g+1].x,w.x)||u(v[g-1].y,w.y)&&u(v[g+1].y,w.y)));for(const h of t){const y=r.get(h.id);if(!y)continue;const w=new Set([...y.incoming??[],...y.outgoing??[]].map(b=>b.id)),g={...h,type:y.type,container:!1,attached:!1},v=r.getAll().filter(b=>{var S;return(b.type==="bpmn:SequenceFlow"||b.type==="bpmn:MessageFlow")&&n.has(b.id)&&!i.has(b.id)&&!w.has(b.id)&&(((S=b.waypoints)==null?void 0:S.length)??0)>=4}).sort((b,S)=>b.id.localeCompare(S.id));for(const b of v){const S=[(f=b.source)==null?void 0:f.id,(m=b.target)==null?void 0:m.id].filter(M=>!!M);for(;;){const M=b.waypoints.map(Y=>({x:Y.x,y:Y.y})),B=p(M,g,S,b.id,b.type);if(B<0)break;const A=b.label,I=A&&{x:A.x,y:A.y},H=l(b.id),V=s(b.id);if(a.updateWaypoints(b,d(M,B)),A&&I){const Y={x:I.x+A.width/2,y:I.y+A.height/2},Te=(ke,ve)=>{const W=ve.x-ke.x,de=ve.y-ke.y,z=W*W+de*de,ee=z===0?0:Math.max(0,Math.min(1,((Y.x-ke.x)*W+(Y.y-ke.y)*de)/z));return Math.hypot(Y.x-(ke.x+ee*W),Y.y-(ke.y+ee*de))};let Pe=0;for(let ke=1;ke+1<M.length;ke++)Te(M[ke],M[ke+1])<Te(M[Pe],M[Pe+1])&&(Pe=ke);(Pe<B||Pe>B+2)&&(A.x!==I.x||A.y!==I.y)&&a.moveElements([A],{x:I.x-A.x,y:I.y-A.y})}const G=l(b.id),ie=[...G].filter(Y=>!H.has(Y)).length,pe=[...H].filter(Y=>!G.has(Y)).length;if(ie<=pe&&s(b.id)<=V){o.add(b.id);continue}a.updateWaypoints(b,M),A&&I&&(A.x!==I.x||A.y!==I.y)&&a.moveElements([A],{x:I.x-A.x,y:I.y-A.y});break}}}return o}const GA=e=>{const t=[];for(let n=0;n+1<e.waypoints.length;n++){const i=e.waypoints[n],o=e.waypoints[n+1];t.push({id:`__ghost:${e.id}:${n}`,type:"bpmn:Task",x:Math.min(i.x,o.x)-1,y:Math.min(i.y,o.y)-1,width:Math.max(2,Math.abs(o.x-i.x)+2),height:Math.max(2,Math.abs(o.y-i.y)+2),container:!1,attached:!1})}return t};function Ms(e){const t=e.parent;return t&&typeof t.x=="number"&&typeof t.width=="number"?{x:t.x,y:t.y,width:t.width,height:t.height}:void 0}const gl=(e,t)=>!t||e.every(n=>n.x>=t.x&&n.x<=t.x+t.width&&n.y>=t.y&&n.y<=t.y+t.height),kd=(e,t)=>Pa(e,[t])>0;function Gy(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ge(i),a=hn(r);let s=r;const c=new Set(ut(r).map(ct));for(const[l,u]of Si(r))if(!t.has(`${l}|${u}`))for(const[p,d]of[[l,u],[u,l]]){if(n.has(p))continue;const f=s.edges.find(B=>B.id===p),m=s.edges.find(B=>B.id===d);if(!f||!m)continue;const h=i.get(p);if(!h)continue;const y=Ms(h),w=GA(m),g=[...dl(f,a)??[]],v=hl(f,[...a,...w],y,r.edges,$d(r));v&&g.push(v);for(let B=0;B+1<f.waypoints.length;B++)for(const A of w)for(const I of pl(f.waypoints[B],f.waypoints[B+1],A)??[])g.push(Td(f.waypoints,B,I));const b=s.edges.filter(B=>B.id!==p),S=B=>({...s,edges:s.edges.map(A=>A.id===p?{...A,waypoints:B}:A)}),M=g.find(B=>{const A={...f,waypoints:B};return kd(A,m)||!gl(B,y)||b.some(I=>I.id!==d&&!kd(f,I)&&kd(A,I))?!1:ut(S(B)).every(I=>c.has(ct(I)))});if(M){o.updateWaypoints(h,M),s=S(M);break}}}const zA=["top","bottom","left","right"],zy={top:{x:0,y:-1},bottom:{x:0,y:1},left:{x:-1,y:0},right:{x:1,y:0}},Cs=20,VA=20;function WA(e,t){const n=e.x>=t.x-.5&&e.x<=t.x+t.width+.5,i=e.y>=t.y-.5&&e.y<=t.y+t.height+.5,o=[];return n&&He(e.y,t.y)&&o.push("top"),n&&He(e.y,t.y+t.height)&&o.push("bottom"),i&&He(e.x,t.x)&&o.push("left"),i&&He(e.x,t.x+t.width)&&o.push("right"),o.length===1?o[0]:null}const UA=(e,t)=>t==="top"?{x:e.x+e.width/2,y:e.y}:t==="bottom"?{x:e.x+e.width/2,y:e.y+e.height}:t==="left"?{x:e.x,y:e.y+e.height/2}:{x:e.x+e.width,y:e.y+e.height/2};function Vy(e,t,n,i){const o=zy[t],r=zy[i],a=o.x===0,s=r.x===0;if(a===s){const p=a?"y":"x",d=a?"x":"y",f=o[p],m=r[p];if(He(e[d],n[d]))return f===-m&&f*(n[p]-e[p])>=Cs?[e,n]:null;let h;if(f===-m){const w=e[p]+f*Cs,g=n[p]-f*Cs;if(f*(g-w)<0)return null;h=Math.round((e[p]+n[p])/2)}else h=f>0?Math.max(e[p],n[p])+fl:Math.min(e[p],n[p])-fl;const y=(w,g)=>a?{x:g,y:w}:{x:w,y:g};return[e,y(h,e[d]),y(h,n[d]),n]}const c=a?{x:e.x,y:n.y}:{x:n.x,y:e.y},l=a?o.y*(c.y-e.y):o.x*(c.x-e.x),u=s?r.y*(c.y-n.y):r.x*(c.x-n.x);return l>=Cs&&u>=Cs?[e,c,n]:null}function qA(e,t,n){const i=e.waypoints;if(i.length<2||!e.source||!e.target||e.source===e.target)return[];const o=e.source===t.id,r=n.get(o?e.target:e.source),a=o?i[i.length-1]:i[0],s=r?WA(a,r):null;if(!s)return[];const c=[];for(const l of zA){const u=UA(t,l),p=o?Vy(u,l,a,s):Vy(a,s,u,l);p&&c.push(p)}return c}const Wy=e=>e.slice(1).reduce((t,n,i)=>t+Math.abs(n.x-e[i].x)+Math.abs(n.y-e[i].y),0);function YA(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ge(i),a=new Map(r.shapes.map(l=>[l.id,l])),s=new Set(ut(r).map(ct));let c=r;for(const[l,u]of Ri(r)){if(t.has(`${l}|${u}`))continue;const p=c.edges.find(I=>I.id===l),d=c.edges.find(I=>I.id===u);if(!p||!d||p.type!=="bpmn:SequenceFlow"||d.type!=="bpmn:SequenceFlow"||n.has(l)&&n.has(u)||!Ri({edges:[p,d]}).length)continue;const f=p.endpoints.find(I=>d.endpoints.includes(I)),m=f?a.get(f):void 0;if(!m||m.container)continue;const h=i.get(l),y=i.get(u);if(!h||!y)continue;const w=I=>n.has(I.id)?[I.waypoints]:[I.waypoints,...qA(I,m,a)],g=I=>I.length-2,v=w(p).flatMap(I=>w(d).map(H=>({pa:I,pb:H}))).filter(({pa:I,pb:H})=>I!==p.waypoints||H!==d.waypoints).map(I=>({...I,cost:Wy(I.pa)+Wy(I.pb)+VA*(g(I.pa)+g(I.pb))})).sort((I,H)=>I.cost-H.cost),b=Ms(h),S=Ms(y),M=Ri(c).length,B=new Set(Si(c).map(([I,H])=>`${I}|${H}`)),A=v.find(({pa:I,pb:H})=>{const V={...p,waypoints:I},G={...d,waypoints:H};if(Ri({edges:[V,G]}).length||or(V,G)||!gl(I,b)||!gl(H,S))return!1;const ie={...c,edges:c.edges.map(pe=>pe.id===l?V:pe.id===u?G:pe)};return Ri(ie).length>=M||Si(ie).some(([pe,Y])=>!B.has(`${pe}|${Y}`))?!1:ut(ie).every(pe=>s.has(ct(pe)))});A&&(A.pa!==p.waypoints&&o.updateWaypoints(h,A.pa),A.pb!==d.waypoints&&o.updateWaypoints(y,A.pb),c={...c,edges:c.edges.map(I=>I.id===l?{...p,waypoints:A.pa}:I.id===u?{...d,waypoints:A.pb}:I)})}}const KA=40,XA=20;function ZA(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=l=>{const u=Ge(i),p=Ri(u);return{keys:new Set(ut(u).map(ct)),crossings:Si(u).length,shared:p.length,mine:p.filter(([d,f])=>d===l||f===l).length}},a=(l,u)=>{const p=Ge(i),d=p.edges.find(f=>f.id===l);return d?new Set(Tt({...d,waypoints:u},hn(p)).map(f=>f.id)):null},s=l=>!!l&&l.type==="bpmn:Participant"&&!(l.children??[]).length&&n.has(l.id),c=i.getAll().filter(l=>l.type==="bpmn:MessageFlow"&&!t.has(l.id));for(const l of c){const u=l.source,p=l.target,d=s(u)?u:s(p)?p:void 0;if(!d)continue;const f=d===u?p:u;if(!f||f.type==="bpmn:Participant")continue;const m=f.x+f.width/2;if(m>=d.x+10&&m<=d.x+d.width-10)continue;const h=m>d.x+d.width,y=d.y>f.y,w=y?f.y+f.height:f.y,g=y?d.y:d.y+d.height,v=Math.round((w+g)/2),b=H=>d===u?[...H].reverse():H,S=(l.waypoints??[]).map(H=>({x:H.x,y:H.y})),M=r(l.id),B=a(l.id,S)??new Set,A=h?d.x+d.width:d.x,I=d.x+d.width/2;for(let H=Math.min(KA,d.width/4);h?A-H>I:A+H<I;H+=XA){const V=Math.round(h?A-H:A+H),G=b([{x:m,y:w},{x:m,y:v},{x:V,y:v},{x:V,y:g}]),ie=a(l.id,G);if(!ie||[...ie].some(Y=>!B.has(Y)))continue;o.updateWaypoints(l,G);const pe=r(l.id);if(pe.crossings<=M.crossings&&pe.shared<=M.shared&&pe.mine<=M.mine&&[...pe.keys].every(Y=>M.keys.has(Y)))break;o.updateWaypoints(l,S)}}}const JA=10;function Uy(e,t){if(e.parent){const o=t.find(r=>r.id===e.parent);if(o)return o}const n=e.x+e.width/2,i=e.y+e.height/2;return t.find(o=>n>=o.x&&n<=o.x+o.width&&i>=o.y&&i<=o.y+o.height)}function qy(e,t){if(e.waypoints.length<2||e.endpoints.length!==2)return null;const n=t.shapes.filter(pe=>pe.type==="bpmn:Participant"&&pe.container),i=t.shapes.find(pe=>pe.id===e.endpoints[0]),o=t.shapes.find(pe=>pe.id===e.endpoints[1]);if(!i||!o)return null;const r=Uy(i,n),a=Uy(o,n);if(!r||!a||r.id===a.id)return null;const s=a.y>r.y,c=s?r:a,l=s?a:r,u=n.filter(pe=>pe.id!==r.id&&pe.id!==a.id&&pe.y>=c.y+c.height&&pe.y+pe.height<=l.y).sort((pe,Y)=>pe.y-Y.y);if(!u.length)return null;const p=u[0],d=u[u.length-1],f=(c.y+c.height+p.y)/2,m=(d.y+d.height+l.y)/2,h=s?f:m,y=s?m:f,w=e.waypoints[0],g=e.waypoints[e.waypoints.length-1],v=hn(t),b=t.edges.filter(pe=>pe.id!==e.id),S=kn(e,b),M=Tt(e,v).length;if(S===0&&M===0||M===0&&e.waypoints.length===2)return null;const B=Math.min(...u.map(pe=>pe.x)),A=Math.max(...u.map(pe=>pe.x+pe.width)),I=(w.x+g.x)/2,H=pe=>pe.filter((Y,Te)=>Te===0||!(He(Y.x,pe[Te-1].x)&&He(Y.y,pe[Te-1].y)));let V,G;for(let pe=B;pe<=A;pe+=JA){const Y=H([w,{x:w.x,y:h},{x:pe,y:h},{x:pe,y},{x:g.x,y},g]),Te={...e,waypoints:Y};if(Tt(Te,v).length>0)continue;const Pe=kn(Te,b),ke=Math.abs(pe-I);(!V||Pe<V.cross||Pe===V.cross&&ke<V.detour)&&(V={pts:Y,cross:Pe,detour:ke}),Cd(Y,v,e.endpoints)>=Wr&&(!G||Pe<G.cross||Pe===G.cross&&ke<G.detour)&&(G={pts:Y,cross:Pe,detour:ke})}G&&V&&G!==V&&Ad(t,e,G.pts,V.pts)&&(V=G);const ie=V&&(M>0?V.cross<=S:V.cross<S)?V.pts:null;if(M>0){const pe=Iy(t,e,v,ie??e.waypoints);if(pe)return pe}return ie}const QA=new Set(["bpmn:SequenceFlow","bpmn:MessageFlow"]);function eT(e,t,n){var l,u;const{elementRegistry:i}=e,o=e.modeling,r=new Map(t.shapes.map(p=>[p.id,p])),a=Ge(i),s=new Map(a.shapes.map(p=>[p.id,p])),c=hn(a);for(const p of t.edges){if(!QA.has(p.type)||!p.source||!p.target||n.has(p.id))continue;const d=i.get(p.id);if(!(d!=null&&d.waypoints)||((l=d.source)==null?void 0:l.id)!==p.source||((u=d.target)==null?void 0:u.id)!==p.target)continue;const f=r.get(p.source),m=r.get(p.target),h=s.get(p.source),y=s.get(p.target);if(!f||!m||!h||!y||!He(f.width,h.width)||!He(f.height,h.height)||!He(m.width,y.width)||!He(m.height,y.height))continue;const w=h.x-f.x,g=h.y-f.y;if(He(w,0)&&He(g,0)||!He(y.x-m.x,w)||!He(y.y-m.y,g))continue;const v=p.waypoints.map(M=>({x:M.x+w,y:M.y+g})),b=d.waypoints.map(M=>({x:M.x,y:M.y}));b.length===v.length&&b.every((M,B)=>He(M.x,v[B].x)&&He(M.y,v[B].y))||b.length===2&&(He(b[0].x,b[1].x)||He(b[0].y,b[1].y))&&Tt({...p,waypoints:b},c).length===0||Tt({...p,waypoints:v},c).length>0||o.updateWaypoints(d,v)}}function Yy(e,t){const{elementRegistry:n}=e,i=e.modeling,o=Ge(n);for(const r of o.edges){if(r.type!=="bpmn:MessageFlow"||t.has(r.id))continue;const a=Ge(n),s=a.edges.find(u=>u.id===r.id);if(!s)continue;const c=qy(s,a);if(!c)continue;const l=n.get(r.id);l&&i.updateWaypoints(l,c)}}const Od=20,Ky=10,Ki=10,Dd=40,tT=6,nT=40,Xy=50;function iT(e,t){return t.some(n=>{const[i,o,r,a]=e.axis==="h"?[n.x,n.x+n.width,n.y,n.y+n.height]:[n.y,n.y+n.height,n.x,n.x+n.width];if(e.hi<=i||e.lo>=o||e.at>r&&e.at<a)return!1;const s=Math.min(Math.abs(e.at-r),Math.abs(e.at-a));return s>0&&s<=tT})}function Ld(e,t,n){let i=0;for(let o=1;o<e.length;o++){const r=e[o-1],a=e[o];if(He(r.y,a.y))for(const s of n)t.has(s.id)||r.y<=s.y+1||r.y>=s.y+s.height-1||(i+=Math.max(0,Math.min(Math.max(r.x,a.x),s.x+s.width)-Math.max(Math.min(r.x,a.x),s.x)))}return i}function oT(e,t){if(e.axis!=="h")return!1;const n=(i,o)=>e.lo<o&&e.hi>i;return t.some(i=>{const o=i.label;return!o||i.container||!n(i.x,i.x+i.width)||!n(o.x,o.x+o.width)?!1:o.y>=i.y+i.height?e.at>=i.y+i.height&&e.at<=o.y:o.y+o.height<=i.y?e.at>=o.y+o.height&&e.at<=i.y:!1})}function Id(e,t,n){if(t>n)return[];const i=[Math.min(Math.max(e,t),n)];for(let o=Ky;o<=n-t;o+=Ky)e+o<=n&&i.push(e+o),e-o>=t&&i.push(e-o);return i}function rT(e,t,n,i,o){const r=[],a=e.type==="bpmn:Participant",s=t.type==="bpmn:Participant",c=t.y>=e.y+e.height;if(!c&&t.y+t.height>e.y)return{inPools:r,outside:[]};const l=c?e.y+e.height:e.y,u=c?t.y:t.y+t.height,p=e.x+e.width/2,d=t.x+t.width/2,f=(Y,Te)=>Te>Y.x+Ki&&Te<Y.x+Y.width-Ki,m=(Y,Te)=>Y.width<=2*Dd?Y.x+Y.width/2:Math.min(Math.max(Te,Y.x+Dd),Y.x+Y.width-Dd),h=Math.max(e.x,t.x)+Ki,y=Math.min(e.x+e.width,t.x+t.width)-Ki;if(h<=y){const Y=!a&&f(t,p)?p:!s&&f(e,d)?d:Math.round((h+y)/2);r.push([{x:Y,y:l},{x:Y,y:u}])}const w=s?m(t,p):d,g=a?m(e,d):p;if(!a&&!f(e,w)){const Y=w<e.x?e.x:e.x+e.width;for(const Te of Id(e.y+e.height/2,e.y+Ki,e.y+e.height-Ki))r.push([{x:Y,y:Te},{x:w,y:Te},{x:w,y:u}])}if(!s&&!f(t,g)){const Y=g<t.x?t.x:t.x+t.width;for(const Te of Id(t.y+t.height/2,t.y+Ki,t.y+t.height-Ki))r.push([{x:g,y:l},{x:g,y:Te},{x:Y,y:Te}])}const v=(Y,Te)=>{if(Math.abs(Te-Y)<2*Ki)return[];const Pe=Math.min(Y,Te)+Ki,ke=Math.max(Y,Te)-Ki;return Id(Math.round((Y+Te)/2),Pe,ke)};if(!a&&n)for(const Y of v(l,c?n.y+n.height:n.y))r.push([{x:p,y:l},{x:p,y:Y},{x:w,y:Y},{x:w,y:u}]);if(!s&&i)for(const Y of v(u,c?i.y:i.y+i.height))r.push([{x:g,y:l},{x:g,y:Y},{x:d,y:Y},{x:d,y:u}]);const b=Math.min(g,w),S=Math.max(g,w),M=[];for(const[Y,Te]of o.filter(Pe=>Pe.x<S&&Pe.x+Pe.width>b).map(Pe=>[Pe.y,Pe.y+Pe.height]).sort((Pe,ke)=>Pe[0]-ke[0])){const Pe=M[M.length-1];Pe&&Y<=Pe[1]?Pe[1]=Math.max(Pe[1],Te):M.push([Y,Te])}const B=[];for(let Y=1;Y<M.length;Y++)M[Y][0]-M[Y-1][1]>=nT&&B.push(Math.round((M[Y-1][1]+M[Y][0])/2));M.length&&B.push(M[0][0]-Xy,M[M.length-1][1]+Xy);const A=(Y,Te)=>Te<Y.y?Y.y:Te>Y.y+Y.height?Y.y+Y.height:void 0,I=new Set([a?e.id:n==null?void 0:n.id,s?t.id:i==null?void 0:i.id].filter(Y=>!!Y)),H=e.y+e.height/2,V=t.y+t.height/2,G=V>H?1:-1,ie=(Y,Te,Pe)=>o.some(ke=>!I.has(ke.id)&&ke.x<Y&&Y<ke.x+ke.width&&ke.y<Math.max(Te,Pe)-1&&ke.y+ke.height>Math.min(Te,Pe)+1),pe=[];for(const Y of B){const Te=A(e,Y),Pe=A(t,Y);Te===void 0||Pe===void 0||(Y-H)*G<0&&ie(g,Te,Y)||(Y-V)*G>0&&ie(w,Pe,Y)||pe.push({pts:[{x:g,y:Te},{x:g,y:Y},{x:w,y:Y},{x:w,y:Pe}],len:Math.abs(Y-Te)+(S-b)+Math.abs(Pe-Y)})}return{inPools:r,outside:pe.sort((Y,Te)=>Y.len-Te.len).map(Y=>Y.pts)}}function aT(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=new Map(n.edges.map(f=>[f.id,f.waypoints])),a=n.shapes.filter(f=>f.type==="bpmn:Participant"),s=f=>{let m=f;for(;m&&m.type!=="bpmn:Participant";)m=m.parent;return m==null?void 0:m.id},c=()=>{const f=Ge(i);return{keys:new Set(ut(f).map(ct)),crossings:Si(f).length,shared:Ri(f).length}},l=(f,m)=>f.length===m.length&&f.every((h,y)=>He(h.x,m[y].x)&&He(h.y,m[y].y)),u=f=>{const m=f.source,h=f.target;if(!m||!h)return"skip";const y=Ge(i),w=new Map(y.shapes.map(W=>[W.id,W])),g=s(m),v=s(h),b=new Set([g,v].filter(W=>!!W)),S=y.shapes.filter(W=>W.type==="bpmn:Participant"),M=(f.waypoints??[]).map(W=>({x:W.x,y:W.y})),B=Ld(M,b,S);if(B<Od)return"skip";if(t.has(f.id)){const W=r.get(f.id);if(W&&l(W,M)||B-(W?Ld(W,b,a):0)<Od)return"skip"}const A=w.get(m.id),I=w.get(h.id),H=y.edges.find(W=>W.id===f.id);if(!A||!I||!H)return"skip";const V=hn(y),G=new Set(Tt(H,V).map(W=>W.id)),ie=rr(y).filter(W=>W.owner!==f.id&&W.owner!==A.id&&W.owner!==I.id),pe=[...y.shapes.filter(W=>!W.container&&W.id!==A.id&&W.id!==I.id),...ie.map(W=>W.rect)],Y=W=>fn({...H,waypoints:W}).some(de=>iT(de,pe)),Te=rT(A,I,g?w.get(g):void 0,v?w.get(v):void 0,S),Pe=W=>W.map((de,z)=>({pts:de,i:z,key:de.length*2+(Y(de)?1:0)})).sort((de,z)=>de.key-z.key||de.i-z.i).map(de=>de.pts),ke=[...Pe(Te.inPools),...Pe(Te.outside)],ve=c();for(const W of ke){if(Ld(W,b,S)>=Od)continue;const de={...H,waypoints:W};if(Tt(de,V).some(he=>!G.has(he.id))||fn(de).some(he=>oT(he,y.shapes)||ie.some(se=>qi(se.rect,he))))continue;o.updateWaypoints(f,W);const ee=c();if(ee.crossings<=ve.crossings&&ee.shared<=ve.shared&&[...ee.keys].every(he=>ve.keys.has(he)))return"fixed";o.updateWaypoints(f,M)}return"stuck"},p=i.getAll().filter(f=>f.type==="bpmn:MessageFlow"),d=[];for(const f of p)u(f)==="stuck"&&d.push(f);for(const f of d)u(f)}const Xi=[25,-25,40,-40],Oa=35;function sT(e,t,n=[]){const i=e.x+e.width/2,o=t.x+t.width/2,r=[],a=n.filter(s=>!s.container&&s.id!==e.id&&s.id!==t.id&&s.label).map(s=>({...s.label,id:`${s.id}:label`,type:"label",container:!1,attached:!1}));for(const s of[!0,!1]){const c=s?e.y:e.y+e.height,l=s?t.y:t.y+t.height,u=s?Math.min(e.y,t.y)-Oa:Math.max(e.y+e.height,t.y+t.height)+Oa,p=lT(e,t,s,u,n),d=p===null?[[u,0]]:[[u,0],[p,cT]];for(const[f,m]of d)for(const h of[0,...Xi])if(!(Math.abs(h)>=e.width/2-5))for(const y of[0,...Xi]){if(Math.abs(y)>=t.width/2-5)continue;const w=i+h,g=o+y,v=[{x:w,y:c},{x:w,y:f},{x:g,y:f},{x:g,y:l}];m&&Tt({endpoints:[],waypoints:v},a).length||r.push({pts:v,cost:m+Math.abs(y)+Math.abs(h)})}}return r}const cT=45,ml=20;function lT(e,t,n,i,o){if(!o.length)return null;const r=e.x+e.width/2,a=t.x+t.width/2,s=Math.min(r,a),c=Math.max(r,a),l=n?Math.min(e.y,t.y):Math.max(e.y+e.height,t.y+t.height),u=o.filter(y=>y.container&&(y.type==="bpmn:Lane"||y.type==="bpmn:Participant")&&r>=y.x&&r<=y.x+y.width&&e.y>=y.y&&e.y+e.height<=y.y+y.height).sort((y,w)=>y.width*y.height-w.width*w.height)[0];if(!u)return null;const p=o.filter(y=>!y.container&&y.id!==e.id&&y.id!==t.id),d=p.filter(y=>y.x<c&&y.x+y.width>s&&(n?y.y<l&&y.y+y.height>i:y.y+y.height>l&&y.y<i));if(!d.length)return null;const f=[...p,...p.flatMap(y=>y.label?[y.label]:[])].filter(y=>y.x<c&&y.x+y.width>s);if(n){let y=Math.min(...d.map(g=>g.y));for(let g=!0;g;){g=!1;for(const v of f)v.y<y&&v.y<l&&v.y+v.height>y-ml&&(y=v.y,g=!0)}const w=Math.max(u.y,...f.filter(g=>g.y+g.height<=y).map(g=>g.y+g.height));return y-w>=ml?Math.round((y+w)/2):null}let m=Math.max(...d.map(y=>y.y+y.height));for(let y=!0;y;){y=!1;for(const w of f)w.y+w.height>m&&w.y+w.height>l&&w.y<m+ml&&(m=w.y+w.height,y=!0)}const h=Math.min(u.y+u.height,...f.filter(y=>y.y>=m).map(y=>y.y));return h-m>=ml?Math.round((m+h)/2):null}function yl(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 o=n.y+n.height/2;if(o>=i.y&&o<=i.y+i.height)return sT(n,i,[...t.values()]);const r=i.x+i.width/2,a=n.x+n.width/2,s=o<i.y,c=s?i.y:i.y+i.height,l=s?n.y:n.y+n.height,u=s?n.y-Oa:n.y+n.height+Oa,p=[];for(const g of[0,...Xi]){if(Math.abs(g)>=i.width/2-5)continue;const v=r+g;p.push({pts:[{x:n.x,y:o},{x:v,y:o},{x:v,y:c}],cost:Math.abs(g)});for(const b of[0,...Xi]){if(Math.abs(b)>=n.width/2-5)continue;const S=a+b;p.push({pts:[{x:S,y:l},{x:S,y:u},{x:v,y:u},{x:v,y:c}],cost:Math.abs(g)+Math.abs(b)})}}const d=50,f=i.y+i.height/2,m=s?n.y+n.height:n.y;for(const g of[0,...Xi]){if(Math.abs(g)>=n.width/2-5)continue;const v=a+g;p.push({pts:[{x:v,y:m},{x:v,y:f},{x:i.x+i.width,y:f}],cost:d+Math.abs(g)})}const h=60,y=s?i.y+i.height:i.y,w=s?i.y+i.height+Oa:i.y-Oa;for(const g of[0,...Xi]){if(Math.abs(g)>=i.width/2-5)continue;const v=r+g;for(const b of[0,...Xi]){if(Math.abs(b)>=n.width/2-5)continue;const S=a+b;p.push({pts:[{x:S,y:m},{x:S,y:w},{x:v,y:w},{x:v,y}],cost:h+Math.abs(g)+Math.abs(b)})}}return p}const Bd=30;function Nd(e,t){return Fd(e,t)<Bd}function $d(e){return e.shapes.filter(t=>t.type==="bpmn:Participant"||t.type==="bpmn:Lane")}function Fd(e,t){let n=1/0;for(let i=1;i<e.length-2;i++){const o=e[i],r=e[i+1],a=He(o.y,r.y)&&!He(o.x,r.x),s=He(o.x,r.x)&&!He(o.y,r.y);if(!(!a&&!s))for(const c of t)if(a){const l=Math.min(o.x,r.x);if(Math.max(o.x,r.x)<=c.x||l>=c.x+c.width)continue;n=Math.min(n,Math.abs(o.y-c.y),Math.abs(o.y-(c.y+c.height)))}else{const l=Math.min(o.y,r.y);if(Math.max(o.y,r.y)<=c.y||l>=c.y+c.height)continue;n=Math.min(n,Math.abs(o.x-c.x),Math.abs(o.x-(c.x+c.width)))}}return n}const vl=40;function uT(e,t,n){let i=0;for(const o of t){if(o.container||n.includes(o.id))continue;const r=o.x-vl,a=o.x+o.width+vl,s=o.y-vl,c=o.y+o.height+vl;for(let l=1;l<e.length-2;l++){const u=e[l],p=e[l+1],d={x:Math.min(u.x,p.x),y:Math.min(u.y,p.y)},f={x:Math.max(u.x,p.x),y:Math.max(u.y,p.y)};if(d.x<a&&f.x>r&&d.y<c&&f.y>s){i++;break}}}return i}function Zy(e,t){if(e.type!=="bpmn:SequenceFlow")return null;const n=t.shapes.filter(M=>M.container),i=new Map(t.shapes.map(M=>[M.id,M])),o=hn(t),r=t.edges.filter(M=>M.id!==e.id),a=qn(e,r),s=kn(e,r),c=M=>uT(M,t.shapes,e.endpoints)+(Nd(M,n)?1:0),l=c(e.waypoints),u=M=>{if(!M)return;const B=M.x+M.width/2,A=M.y+M.height/2;return n.find(I=>I.type==="bpmn:Lane"&&B>=I.x&&B<=I.x+I.width&&A>=I.y&&A<=I.y+I.height)},p=u(i.get(e.endpoints[0]??"")),d=u(i.get(e.endpoints[1]??"")),f=!!p&&!!d&&p.id!==d.id,m=M=>{if(!f||!d)return!1;for(let B=1;B<M.length-2;B++){const A=M[B],I=M[B+1];if(He(A.y,I.y)&&!He(A.x,I.x)&&A.y>d.y&&A.y<d.y+d.height)return!0}return!1},h=m(e.waypoints),w=(M=>{if(!M)return;const B=M.x+M.width/2,A=M.y+M.height/2;return n.filter(I=>I.type==="bpmn:Participant"&&B>=I.x&&B<=I.x+I.width&&A>=I.y&&A<=I.y+I.height).sort((I,H)=>I.width*I.height-H.width*H.height)[0]})(i.get(e.endpoints[0]??"")),g=M=>{if(!w)return 0;let B=0;for(let A=1;A<M.length-1;A++){const I=M[A];(I.x<w.x||I.x>w.x+w.width||I.y<w.y||I.y>w.y+w.height)&&B++}return B},v=g(e.waypoints);if(!Nd(e.waypoints,n)&&!(f&&!h)&&v===0)return null;const b=M=>M.reduce((B,A,I)=>I?B+Math.abs(A.x-M[I-1].x)+Math.abs(A.y-M[I-1].y):0,0);let S;for(const{pts:M,cost:B}of yl(e,i)){const A={...e,waypoints:M};if(Tt(A,o).length>0||nv(M,e,t))continue;const I=qn(A,r);if(I>a)continue;const H=g(M);if(H>v)continue;const V=H<v&&I===0;if(!V&&kn(A,r)>s)continue;const G=c(M),ie=m(M);if(!V&&!(ie&&!h)&&G>=l)continue;const Y=ie?0:1,Te=b(M);(!S||H<S.out||H===S.out&&(Y<S.lane||Y===S.lane&&(I<S.opp||I===S.opp&&(G<S.sc||G===S.sc&&(B<S.cost||B===S.cost&&Te<S.len)))))&&(S={pts:M,out:H,sc:G,lane:Y,opp:I,cost:B,len:Te})}return(S==null?void 0:S.pts)??null}function pT(e,t){if(e.type!=="bpmn:SequenceFlow"||e.endpoints.length!==2)return!1;const[n,i]=e.endpoints,o=t.edges.filter(p=>p.type==="bpmn:SequenceFlow"&&p.endpoints.length===2),r=o.filter(p=>p.endpoints[1]===i),a=o.filter(p=>p.endpoints[0]===i);if(r.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}const dT=1;function Jy(e,t,n){if(t.type!=="bpmn:SequenceFlow"||e.length<3||!t.source)return null;const i=n.shapes.find(l=>l.id===t.source);if(!i||!i.type.endsWith("Gateway"))return null;const[o,r]=e,a=(l,u)=>Math.abs(l-u)<=dT,s=a(o.y,r.y)&&!a(o.x,r.x),c=a(o.x,r.x)&&!a(o.y,r.y);if(!s&&!c)return null;for(const l of n.edges){if(l.id===t.id||l.type!=="bpmn:SequenceFlow"||l.source!==t.source||l.waypoints.length!==2)continue;const[u,p]=l.waypoints;if(!(!a(u.x,o.x)||!a(u.y,o.y))&&(s&&a(u.y,p.y)&&Math.sign(p.x-u.x)===Math.sign(r.x-o.x)||c&&a(u.x,p.x)&&Math.sign(p.y-u.y)===Math.sign(r.y-o.y)))return l.id}return null}function fT(e,t,n,i){const{elementRegistry:o}=e,r=e.modeling,a=Ge(o).edges.filter(s=>(!t.has(s.id)||n.has(s.id))&&s.waypoints.length>=4).map(s=>s.id).sort();for(const s of a){const c=Ge(o),l=c.edges.find(g=>g.id===s);if(!l||l.waypoints.length<4)continue;const u=hn(c),p=c.edges.filter(g=>g.id!==s),d=Tt(l,u).length,f=qn(l,p),m=kn(l,p),h=n.has(s)?new Set(ut(c).map(ct)):null;if(l.waypoints.length>4){const g=o.get(s),v=g?Ny(c,l,u,l.waypoints,Ms(g),i):null;if(g&&v&&v.length<l.waypoints.length){r.updateWaypoints(g,v);continue}}const y=dl(l,c.shapes);y.length===2&&pT(l,c)&&y.reverse();const w=[...y.filter(g=>!Jy(g,l,c)),...y.filter(g=>Jy(g,l,c))];for(const g of w){if(g.length>=l.waypoints.length)continue;const v={...l,waypoints:g};if(Tt(v,u).length>d||qn(v,p)>f||kn(v,p)>m)continue;if(h){const S=new Set(ut({...c,edges:c.edges.map(A=>A.id===s?v:A)}).map(ct)),M=[...S].filter(A=>!h.has(A)).length,B=[...h].filter(A=>!S.has(A)).length;if(M>B)continue}const b=o.get(s);b&&r.updateWaypoints(b,g);break}}}function Qy(e,t){const{elementRegistry:n}=e,i=e.modeling,o=Ge(n).edges.filter(r=>r.type==="bpmn:SequenceFlow"&&!t.has(r.id)).map(r=>r.id).sort();for(const r of o){const a=Ge(n),s=a.edges.find(u=>u.id===r);if(!s)continue;const c=Zy(s,a);if(!c)continue;const l=n.get(r);l&&i.updateWaypoints(l,c)}}function jd(e,t){const n=e.waypoints;if(n.length<3)return[];const i=[],o=t.get(e.endpoints[0]??""),r=t.get(e.endpoints[1]??""),a=He(n[0].x,n[1].x)&&!He(n[0].y,n[1].y),s=He(n[n.length-1].x,n[n.length-2].x)&&!He(n[n.length-1].y,n[n.length-2].y);for(const c of Xi){if(a&&o&&Math.abs(c)<o.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&&r&&Math.abs(c)<r.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}const ev=e=>e==="bpmn:SequenceFlow"||e==="bpmn:MessageFlow";function hT(e,t,n){const i=e.waypoints;if(i.length<2||!ev(e.type))return[];const o=i[0],r=i[1],a=He(o.y,r.y)&&!He(o.x,r.x),s=He(o.x,r.x)&&!He(o.y,r.y);if(!a&&!s)return[];const c=Math.sign(a?r.x-o.x:r.y-o.y);if(!t.some(m=>{if(!ev(m.type)||m.type===e.type||m.waypoints.length<2)return!1;const h=m.waypoints[0],y=m.waypoints[1];return!He(h.x,o.x)||!He(h.y,o.y)?!1:a?He(h.y,y.y)&&Math.sign(y.x-h.x)===c:He(h.x,y.x)&&Math.sign(y.y-h.y)===c}))return[];const u=n.get(e.endpoints[0]??""),p=n.get(e.endpoints[1]??"");if(!u)return[];const d=(m,h)=>a?h>m.y+5&&h<m.y+m.height-5:h>m.x+5&&h<m.x+m.width-5,f=[];for(const m of Xi){const h=(a?o.y:o.x)+m;if(!d(u,h)||i.length===2&&(!p||!d(p,h)))continue;const y=i.map(w=>({...w}));for(const w of[y[0],y[1]])a?w.y=h:w.x=h;f.push({pts:y,cost:Math.abs(m)})}return f}function gT(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 o=i.y+i.height<=n.y,r=n.y+n.height<=i.y;if(!o&&!r)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,d=a?n.x+n.width:n.x,f=r?n.y+n.height:n.y,m=a?i.x:i.x+i.width,h=r?i.y:i.y+i.height,y=[];for(const w of[0,...Xi])Math.abs(w)<i.width/2-5&&y.push({pts:[{x:d,y:l},{x:u+w,y:l},{x:u+w,y:h}],cost:Math.abs(w)}),Math.abs(w)<i.height/2-5&&y.push({pts:[{x:c,y:f},{x:c,y:p+w},{x:m,y:p+w}],cost:Math.abs(w)});return y}const mT=[[1/2,0],[1/3,25],[2/3,25]],tv=20;function yT(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 o=n.y+n.height/2,r=i.y+i.height/2;if(Math.abs(o-r)<1)return[];const a=[],s=(c,l)=>{for(const[u,p]of mT){const d=Math.round(c+(l-c)*u);a.push({pts:[{x:c,y:o},{x:d,y:o},{x:d,y:r},{x:l,y:r}],cost:p})}};return n.x+n.width+tv<=i.x&&s(n.x+n.width,i.x),i.x+i.width+tv<=n.x&&s(n.x,i.x+i.width),a}const vT=1e3;function Hd(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 o=Math.max(n.x,i.x),r=Math.min(n.x+n.width,i.x+i.width);if(r-o<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=(o+r)/2,p=[],d=[n,i].filter(y=>/Gateway$/.test(y.type)),f=d.length?d[0].x+d[0].width/2:void 0,m=f!==void 0&&d.every(y=>Math.abs(y.x+y.width/2-f)<=.5)&&f>o&&f<r;m&&p.push({pts:[{x:f,y:c},{x:f,y:l}],cost:0});const h=d.length?vT:0;for(const y of[0,...Xi]){const w=u+y;w<=o||w>=r||m&&Math.abs(w-f)<.5||p.push({pts:[{x:w,y:c},{x:w,y:l}],cost:Math.abs(y)+h})}return p}const Gd=2,xT=3;function nv(e,t,n){if(e.length<2)return!1;for(const i of n.shapes){if(!/Gateway$/.test(i.type)||t.endpoints.includes(i.id))continue;let o=1/0;for(let a=1;a<e.length;a++)o=Math.min(o,Po(e[a-1],e[a],i));if(o>Gd)continue;const r=[{x:i.x+i.width/2,y:i.y},{x:i.x+i.width,y:i.y+i.height/2},{x:i.x+i.width/2,y:i.y+i.height},{x:i.x,y:i.y+i.height/2}].filter(a=>Vd(a,e)<=Gd);if(r.length)for(const a of n.edges){if(a.id===t.id||!a.endpoints.includes(i.id)||a.waypoints.length<2)continue;if([a.waypoints[0],a.waypoints[a.waypoints.length-1]].some(c=>r.some(l=>Math.hypot(c.x-l.x,c.y-l.y)<=xT)&&Vd(c,e)<=Gd))return!0}}return!1}function iv(e,t,n={}){const i=new Map(t.shapes.map(m=>[m.id,m])),o=hn(t),r=t.edges.filter(m=>m.id!==e.id),a=qn(e,r);if(a===0)return null;const s=kn(e,r);let c;const l=m=>m.reduce((h,y,w)=>w?h+Math.abs(y.x-m[w-1].x)+Math.abs(y.y-m[w-1].y):0,0),u=3,p=m=>{const h=m[0],y=m[m.length-1],w=Math.hypot(y.x-h.x,y.y-h.y);return w>=1&&l(m)/w>=u?1:0},d=p(e.waypoints),f=[...yl(e,i),...Hd(e,i),...jd(e,i),...hT(e,r,i),...n.sideEntry?yT(e,i):[]];for(const{pts:m,cost:h}of f){const y={...e,waypoints:m};if(Tt(y,o).length>0||nv(m,e,t))continue;const w=qn(y,r),g=kn(y,r),v=a-w+(d-p(m));if(w>=a||g-s>v)continue;const b=l(m);(!c||w<c.opposite||w===c.opposite&&(g<c.cross||g===c.cross&&(h<c.cost||h===c.cost&&b<c.len)))&&(c={pts:m,opposite:w,cross:g,cost:h,len:b})}return(c==null?void 0:c.pts)??null}function ov(e,t){var i;let n=0;for(const o of t)o.id!==e.id&&((i=or(e,o))==null?void 0:i.kind)==="unrelated"&&n++;return n}function bT(e,t){const n=new Map(t.shapes.map(d=>[d.id,d])),i=hn(t),o=t.edges.filter(d=>d.id!==e.id),r=ov(e,o);if(r===0)return null;const a=qn(e,o),s=kn(e,o),c=d=>d.reduce((f,m,h)=>h?f+Math.abs(m.x-d[h-1].x)+Math.abs(m.y-d[h-1].y):0,0),l=2;let u;const p=[...yl(e,n),...Hd(e,n),...gT(e,n),...jd(e,n)];for(const{pts:d,cost:f}of p){const m={...e,waypoints:d};if(Tt(m,i).length>0)continue;const h=ov(m,o);if(h>=r)continue;const y=qn(m,o);if(y-h>a-r)continue;const w=kn(m,o);if(w-s>(r-h)*l)continue;const g=c(d);(!u||h<u.fake||h===u.fake&&(y<u.unreadable||y===u.unreadable&&(w<u.cross||w===u.cross&&(f<u.cost||f===u.cost&&g<u.length))))&&(u={pts:d,fake:h,unreadable:y,cross:w,cost:f,length:g})}return(u==null?void 0:u.pts)??null}function rv(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=ut(Ge(i)).filter(s=>s.kind==="edge-overlap-unrelated"&&!t.has(ct(s)));if(!r.length)return;const a=new Set;for(const s of r)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=Ge(i),l=c.edges.find(d=>d.id===s);if(!l)continue;const u=bT(l,c);if(!u)continue;const p=i.get(s);p&&o.updateWaypoints(p,u)}}function av(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 sv(e,t,n){var l;if(e.type!=="bpmn:SequenceFlow"||t.type!=="bpmn:SequenceFlow"||((l=or(e,t))==null?void 0:l.kind)!=="opposite")return!1;const[i,o]=e.endpoints,[r,a]=t.endpoints,s=[i,o].filter(u=>u&&(u===r||u===a)).length;return!(!!o&&o===r||!!a&&a===i)||s!==1?!1:av(e,n)&&av(t,n)}function cv(e,t,n){let i=0;for(const o of t)o.id!==e.id&&sv(e,o,n)&&i++;return i}function wT(e,t){const n=new Map(t.shapes.map(d=>[d.id,d])),i=hn(t),o=t.edges.filter(d=>d.id!==e.id),r=cv(e,o,n);if(r===0)return null;const a=qn(e,o),s=kn(e,o),c=d=>d.reduce((f,m,h)=>h?f+Math.abs(m.x-d[h-1].x)+Math.abs(m.y-d[h-1].y):0,0),l=2;let u;const p=[...yl(e,n),...Hd(e,n),...jd(e,n)];for(const{pts:d,cost:f}of p){const m={...e,waypoints:d};if(Tt(m,i).length>0)continue;const h=cv(m,o,n);if(h>=r)continue;const y=qn(m,o);if(y-h>a-r)continue;const w=kn(m,o);if(w-s>(r-h)*l)continue;const g=c(d);(!u||h<u.chain||h===u.chain&&(y<u.unreadable||y===u.unreadable&&(w<u.cross||w===u.cross&&(f<u.cost||f===u.cost&&g<u.length))))&&(u={pts:d,chain:h,unreadable:y,cross:w,cost:f,length:g})}return(u==null?void 0:u.pts)??null}function _T(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ge(i),a=new Map(r.shapes.map(l=>[l.id,l])),s=ut(r).filter(l=>l.kind==="edge-overlap-opposite"&&!t.has(ct(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(d=>r.edges.find(f=>f.id===d));if(!(!u||!p||!sv(u,p,a)))for(const d of l.edges)n.has(d)||c.add(d)}for(const l of[...c].sort()){const u=Ge(i),p=u.edges.find(m=>m.id===l);if(!p)continue;const d=wT(p,u);if(!d)continue;const f=i.get(l);f&&o.updateWaypoints(f,d)}}function lv(e,t,n,i=new Set){const{elementRegistry:o}=e,r=e.modeling,a=new Set,s=Ge(o),c=ut(s).filter(d=>wd(d)&&!t.has(ct(d)));if(!c.length)return a;const l=new Set;for(const d of c)if(wd(d))for(const f of d.edges)n.has(f)||l.add(f);const u=d=>{var f;return((f=s.edges.find(m=>m.id===d))==null?void 0:f.type)??""},p=[...l].sort((d,f)=>{const m=u(d)==="bpmn:SequenceFlow"?0:1,h=u(f)==="bpmn:SequenceFlow"?0:1;return m!==h?m-h:d.localeCompare(f)});for(const d of p){const f=Ge(o),m=f.edges.find(w=>w.id===d);if(!m)continue;const h=iv(m,f,{sideEntry:i.has(d)});if(!h)continue;const y=o.get(d);y&&(r.updateWaypoints(y,h),a.add(d))}return a}const ET=20;function ST(e,t){var l;const{elementRegistry:n}=e,i=e.modeling,o=new Set;let r=Ge(n),a=new Set(ut(r).map(ct));const s=new Map(r.shapes.map(u=>[u.id,u])),c=r.edges.filter(u=>u.type==="bpmn:MessageFlow"&&u.waypoints.length===2&&u.endpoints.length===2).map(u=>u.id);for(let u=0;u<c.length;u++)for(let p=u+1;p<c.length;p++){const d=r.edges.find(se=>se.id===c[u]),f=r.edges.find(se=>se.id===c[p]);if(d.endpoints[0]!==f.endpoints[1]||d.endpoints[1]!==f.endpoints[0]||t.has(d.id)&&t.has(f.id)||((l=or(d,f))==null?void 0:l.kind)!=="opposite")continue;const m=d.endpoints.map(se=>s.get(se)).filter(se=>!!se);if(m.length!==2)continue;const[h,y]=d.waypoints,w=He(h.x,y.x),g=m.filter(se=>se.type!=="bpmn:Participant"),v=[...g.length?g:m].sort((se,Ae)=>w?se.y-Ae.y:se.x-Ae.x)[0],b=d.endpoints[0]===v.id?d:f,S=b===d?f:d,M=w?h.x:h.y,B=se=>m.every(Ae=>w?se>Ae.x+5&&se<Ae.x+Ae.width-5:se>Ae.y+5&&se<Ae.y+Ae.height-5),A=n.get(b.id),I=n.get(S.id);if(!A||!I)continue;const H=!t.has(b.id),V=!t.has(S.id),G=hn(r),ie=new Set([b,S].flatMap(se=>Tt(se,G).map(Ae=>Ae.id))),pe=new Set(Si(r).map(([se,Ae])=>`${se}|${Ae}`)),Y=(se,Ae,F)=>{if(!Ae)return se;const C=M+Ae,R=se.waypoints.map(ge=>w?{x:C,y:ge.y}:{x:ge.x,y:C});if(!se.label)return{...se,waypoints:R};const J=se.label,ne=w?{...J,x:F<0?C-gn-J.width:C+gn}:{...J,y:F<0?C-gn-J.height:C+gn};return{...se,waypoints:R,label:ne}},Te=ET,Pe=H?V?-Te:-2*Te:0,ke=V?H?Te:2*Te:0;if(Pe&&!B(M+Pe)||ke&&!B(M+ke))continue;const ve=Y(b,Pe,-1),W=Y(S,ke,1);if([ve,W].some(se=>Tt(se,G).some(Ae=>!ie.has(Ae.id))))continue;const de={...r,edges:r.edges.map(se=>se.id===b.id?ve:se.id===S.id?W:se)};if(Si(de).some(([se,Ae])=>!pe.has(`${se}|${Ae}`)))continue;const z=ut(de),ee=new Set([Pe?b.id:"",ke?S.id:""].filter(Boolean)),he=se=>/^(L|ls|l)\|/.test(se)&&ee.has(se.split("|")[1]);if(!z.some(se=>!a.has(ct(se))&&!he(ct(se)))){for(const[se,Ae,F]of[[A,b,ve],[I,S,W]])F!==Ae&&(i.updateWaypoints(se,F.waypoints.map(C=>({...C}))),se.label&&F.label&&i.moveElements([se.label],{x:F.label.x-se.label.x,y:F.label.y-se.label.y}),o.add(se.id));r=de,a=new Set(z.map(ct))}}return o}const RT=10,MT=(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 uv(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!Ca(e,i))return null;const o=hn(t),r=i.flatMap(fn);for(const a of fn(e)){let s=[[a.lo,a.hi]];for(const[f,m]of ul(a,r))s=s.flatMap(([h,y])=>{const w=[];return f>h&&w.push([h,Math.min(y,f)]),m<y&&w.push([Math.max(h,m),y]),w.filter(([g,v])=>v>g)});const c=a.axis==="h"?n.width:n.height,l=s.find(([f,m])=>m-f>=c+RT*2);if(!l)continue;const u=(l[0]+l[1])/2,p=a.axis==="h"?{x:u,y:a.at-yy}:{x:a.at+gn+n.width/2,y:u},d={x:p.x-n.width/2,y:p.y-n.height/2,width:n.width,height:n.height};if(!Ca({...e,label:d},i)&&!o.some(f=>!e.endpoints.includes(f.id)&&MT(d,f)))return d}return null}const gn=8;function zd(e,t){const n=e.label;if(!n)return null;const i=fn(e);if(!i.length)return null;const o=n.x+n.width/2,r=n.y+n.height/2,a=d=>{const f=d.axis==="h"?o:r,m=d.axis==="h"?r-d.at:o-d.at,h=f<d.lo?d.lo-f:f>d.hi?f-d.hi:0;return Math.hypot(m,h)},s=i.reduce((d,f)=>a(f)<a(d)?f:d,i[0]),c=[...i,...t.edges.filter(d=>d.id!==e.id).flatMap(fn),...t.shapes.filter(d=>d.container).flatMap(Ta)],l=d=>!c.some(f=>qi(d,f));if(l(n))return null;const u=(s.axis==="v"?n.height:n.width)+gn,p=[0,-u,u,-2*u,2*u];if(s.axis==="v")for(const d of[s.at+gn,s.at-gn-n.width])for(const f of p){const m=n.y+f;if(m<s.lo||m+n.height>s.hi)continue;const h={...n,x:d,y:m};if(l(h))return h}else for(const d of[s.at-gn-n.height,s.at+gn])for(const f of p){const m=n.x+f;if(m<s.lo||m+n.width>s.hi)continue;const h={...n,x:m,y:d};if(l(h))return h}return null}const pv=30,Vd=(e,t)=>{let n=1/0;for(let i=0;i+1<t.length;i++){const o=t[i],r=t[i+1],a=r.x-o.x,s=r.y-o.y,c=a*a+s*s,l=c?Math.max(0,Math.min(1,((e.x-o.x)*a+(e.y-o.y)*s)/c)):0;n=Math.min(n,Math.hypot(e.x-(o.x+l*a),e.y-(o.y+l*s)))}return n},dv=(e,t)=>Vd({x:e.x+e.width/2,y:e.y+e.height/2},t);function fv(e,t){const n=e.label;if(!n)return null;const i=fn(e);if(!i.length)return null;const o=[...i,...t.edges.filter(c=>c.id!==e.id).flatMap(fn),...t.shapes.filter(c=>c.container).flatMap(Ta)],r=rr(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=>!o.some(l=>qi(c,l))&&!ka(c,t).length&&!r.some(l=>a(c,l));for(const c of i){const l=(c.lo+c.hi)/2,u=c.axis==="h"?[c.at+gn,c.at-gn-n.height].map(p=>({...n,x:l-n.width/2,y:p})):[c.at+gn,c.at-gn-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 hv(e,t,n=new Set){var s,c;const{elementRegistry:i}=e,o=e.modeling;let r=Ge(i),a=new Set(ut(r).map(ct));for(const[l,u]of t){const p=u.wps,d=i.get(l),f=d==null?void 0:d.label;if(!f||!(d!=null&&d.waypoints))continue;const m=d.waypoints[0].x-p[0].x,h=d.waypoints[0].y-p[0].y;if(!(d.waypoints.length===p.length&&d.waypoints.every((B,A)=>B.x-p[A].x===m&&B.y-p[A].y===h))){if(((s=d.source)==null?void 0:s.id)===u.source&&((c=d.target)==null?void 0:c.id)===u.target)continue;const B=r.edges.find(G=>G.id===l);if(!(B!=null&&B.label)||!ka(B.label,r).length&&!n.has(l))continue;let A={...B.label,x:u.label.x,y:u.label.y};if((ka(A,r).length||dv(A,B.waypoints)>pv)&&(A=null),!A&&dv(B.label,B.waypoints)>pv&&(A=fv(B,r)),!A)continue;const I=A;if(I.x===f.x&&I.y===f.y)continue;const H={...r,edges:r.edges.map(G=>G.id===l?{...G,label:I}:G)},V=ut(H);if(V.some(G=>!a.has(ct(G))))continue;o.moveElements([f],{x:I.x-f.x,y:I.y-f.y}),r=H,a=new Set(V.map(ct));continue}const w=u.label.x+m-f.x,g=u.label.y+h-f.y;if(w===0&&g===0)continue;const v=r.edges.find(B=>B.id===l);if(!(v!=null&&v.label))continue;const b={...v.label,x:v.label.x+w,y:v.label.y+g},S={...r,edges:r.edges.map(B=>B.id===l?{...B,label:b}:B)},M=ut(S);M.some(B=>!a.has(ct(B)))||(o.moveElements([f],{x:w,y:g}),r=S,a=new Set(M.map(ct)))}}function gv(e,t,n=new Set,i=new Set){const{elementRegistry:o}=e,r=e.modeling,a=Ge(o);for(const s of a.edges){if(!s.label||t.has(s.id)&&!n.has(s.id))continue;const c=zd(s,a),l=i.has(s.id)&&ka(c??s.label,a).length?fv(s,a)??c:c;if(!l)continue;const u=o.get(s.id),p=u==null?void 0:u.label;p&&r.moveElements([p],{x:l.x-p.x,y:l.y-p.y})}}function mv(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ge(i),a=ut(r).filter(s=>s.kind==="label-on-shared-segment"&&!t.has(ct(s)));for(const s of a){if(s.kind!=="label-on-shared-segment"||n.has(s.edge))continue;const c=r.edges.find(d=>d.id===s.edge);if(!c)continue;const l=uv(c,r);if(!l)continue;const u=i.get(s.edge),p=u==null?void 0:u.label;p&&o.moveElements([p],{x:l.x-p.x,y:l.y-p.y})}}function Wd(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(fn),...t.shapes.filter(d=>d.container).flatMap(Ta)],o=i.filter(d=>qi(n,d));if(!o.length)return null;const r=t.shapes.filter(d=>!d.container&&d.id!==e.id),a=rr(t).filter(d=>d.owner!==e.id).map(d=>d.rect),s=(d,f)=>d.x<f.x+f.width&&f.x<d.x+d.width&&d.y<f.y+f.height&&f.y<d.y+d.height,c=d=>!i.some(f=>qi(d,f))&&!r.some(f=>s(d,f))&&!a.some(f=>s(d,f)),l=[];for(const d of o)d.axis==="h"?l.push({...n,y:d.at-gn-n.height},{...n,y:d.at+gn}):l.push({...n,x:d.at-gn-n.width},{...n,x:d.at+gn});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+gn},{...n,x:u-n.width/2,y:e.y-gn-n.height},{...n,x:e.x+e.width+gn,y:p-n.height/2},{...n,x:e.x-gn-n.width,y:p-n.height/2}),l.find(c)??null}function yv(e,t){const{elementRegistry:n}=e,i=e.modeling,o=Ge(n);for(const r of o.shapes){if(r.container||!r.label||t.has(r.id))continue;const a=Wd(r,Ge(n));if(!a)continue;const s=n.get(r.id),c=s==null?void 0:s.label;c&&i.moveElements([c],{x:a.x-c.x,y:a.y-c.y})}}function CT(e,t){const n=e.x,i=e.x+e.width,o=e.y,r=e.y+e.height;if(t.x<n||t.x>i||t.y<o||t.y>r)return{x:Math.round(Math.min(Math.max(t.x,n),i)),y:Math.round(Math.min(Math.max(t.y,o),r))};const s=[[t.x-n,{x:n,y:t.y}],[i-t.x,{x:i,y:t.y}],[t.y-o,{x:t.x,y:o}],[r-t.y,{x:t.x,y:r}]].reduce((c,l)=>l[0]<c[0]?l:c);return{x:Math.round(s[1].x),y:Math.round(s[1].y)}}function vv(e,t){const{elementRegistry:n}=e,i=e.modeling;let o=Ge(n),r=new Set(ut(o).map(ct));const a=[...new Set(ut(o).filter(s=>s.kind==="edge-endpoint-detached"&&!t.has(ct(s))).map(s=>s.edge))].sort();for(const s of a){const c=o.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 w=h?o.shapes.find(v=>v.id===h):void 0;if(!w)continue;const g=CT(w,l[y]);g.x===l[y].x&&g.y===l[y].y||(l[y]=g,p=!0)}if(!p)continue;const d={...o,edges:o.edges.map(h=>h.id===s?{...h,waypoints:l}:h)},f=ut(d);if(f.some(h=>!r.has(ct(h))))continue;const m=n.get(s);m&&(i.updateWaypoints(m,l),o=d,r=new Set(f.map(ct)))}}const Ud=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function xv(e,t){const n=(o,r,a,s="name")=>{const c=s==="text"?"texts":"names",l=u=>r?`${r}.${u}`:u;return{id:o,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((o,r)=>n(o.id,`participant.lanes[${r}]`,o))];case"participant.update":return[n(e.id,"",i),...(e.lanes??[]).map((o,r)=>({...n(o.id,`lanes[${r}]`,o),omittedMeansRemove:(t==null?void 0:t.categoryOf(o.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 AT(e,t,n){const i=[],o=n?xs(n):[];return e.forEach((r,a)=>{if(r.kind==="translation.confirm"){if(!n){i.push({kind:"locale-texts-not-enabled",opIndex:a,id:r.id,field:"locale"});return}if(!o.includes(r.locale)){i.push({kind:"locale-not-in-document",opIndex:a,id:r.id,field:"locale",locale:r.locale,locales:o});return}t.categoryOf(r.id)!==void 0&&!t.reviewRequestLocalesOf(r.id).includes(r.locale)&&i.push({kind:"review-request-missing",opIndex:a,id:r.id,locale:r.locale});return}for(const s of xv(r,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:o});continue}if(s.condition!==void 0&&s.condition!==null){i.push({kind:"locale-texts-required",opIndex:a,id:s.id,field:s.conditionField,locales:o});continue}if(!l)continue;if(!Ud(s.map)){i.push({kind:"payload-invalid",opIndex:a,field:s.mapField});continue}const u=s.map;let p=!0;for(const[f,m]of Object.entries(u))typeof m!="string"||m===""?(i.push({kind:"payload-invalid",opIndex:a,field:`${s.mapField}.${f}`}),p=!1):o.includes(f)||(i.push({kind:"locale-not-in-document",opIndex:a,id:s.id,field:s.mapField,locale:f,locales:o}),p=!1);if(!p)continue;const d=o.filter(f=>!(f in u));d.length&&i.push({kind:"locale-texts-incomplete",opIndex:a,id:s.id,field:s.mapField,missing:d})}}),i}function Mi(e,t,n){const i=t==="text"?"texts":"names",{[i]:o,...r}=e;return n===void 0?r:{...r,[t]:n}}function TT(e,t,n){const i=new Map;if(!n)return{ops:[...e],writes:i};const{designLocale:o}=n,r=c=>{let l=i.get(c);return l||i.set(c,l={}),l},a=c=>{if(Ud(c.map)){const l=c.map;return r(c.id).texts={...l},l[o]}if(c.plain===null||c.condition===null&&c.plain===void 0){r(c.id).texts=null;return}c.plain===void 0&&c.omittedMeansRemove&&(r(c.id).texts=null)},s=[];for(const c of e){if(c.kind==="translation.confirm"){const u=r(c.id);u.confirm=[...u.confirm??[],c.locale];continue}const l=xv(c,t);if(!l.length){s.push(c);continue}switch(c.kind){case"participant.add":{const[u,...p]=l,d=Mi(c.participant,"name",a(u));c.participant.lanes&&(d.lanes=c.participant.lanes.map((f,m)=>Mi(f,"name",a(p[m])))),s.push({...c,participant:d});break}case"participant.update":{const[u,...p]=l,d=Mi(c,"name",a(u));c.lanes&&(d.lanes=c.lanes.map((f,m)=>Mi(f,"name",a(p[m])))),s.push(d);break}case"node.add":s.push({...c,node:Mi(c.node,"name",a(l[0]))});break;case"sequenceFlow.add":s.push({...c,flow:Mi(c.flow,"name",a(l[0]))});break;case"messageFlow.add":s.push({...c,flow:Mi(c.flow,"name",a(l[0]))});break;case"dataStore.add":s.push({...c,dataStore:Mi(c.dataStore,"name",a(l[0]))});break;case"annotation.add":s.push({...c,annotation:Mi(c.annotation,"text",a(l[0]))});break;case"group.add":s.push({...c,group:Mi(c.group,"name",a(l[0]))});break;case"annotation.update":s.push(Mi(c,"text",a(l[0])));break;default:s.push(Ud(l[0].map)?Mi(c,"name",a(l[0])):(a(l[0]),c))}}return{ops:s,writes:i}}const PT=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,bv=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),wv={"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}]},As=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),xl=e=>typeof e=="string"&&e!=="";function kT(e){const t=[];function n(i,o,r,a){if(a===null){xl(r)||t.push({kind:"payload-invalid",opIndex:i,field:o});return}if(!As(r)){t.push({kind:"payload-invalid",opIndex:i,field:o});return}for(const s of a)xl(r[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${o}.${s}`})}return e.forEach((i,o)=>{var r,a,s;if(!As(i)||!xl(i.kind)||!(i.kind in wv)){t.push({kind:"payload-invalid",opIndex:o,field:"kind"});return}for(const c of wv[i.kind]){const l=c.path.endsWith("[]"),u=l?c.path.slice(0,-2):c.path,p=u.split(".");let d=i;for(const m of p.slice(0,-1)){if(!As(d))break;d=d[m]}if(!As(d))continue;const f=d[p[p.length-1]];if(!(f===void 0&&c.optional)&&!(f===null&&c.optional)){if(!l){n(o,c.path,f,c.shape);continue}if(!Array.isArray(f)){t.push({kind:"payload-invalid",opIndex:o,field:c.path});continue}f.forEach((m,h)=>n(o,`${u}[${h}]`,m,c.shape))}}if(i.kind==="annotation.add"){const c=i.annotation;As(c)&&!xl(c.text)&&c.texts===void 0&&t.push({kind:"payload-invalid",opIndex:o,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:o,field:"band"});const l=i.kind==="node.add"?(r=i.node)==null?void 0:r.type:i.type,u=(i.kind==="node.add"?(a=i.node)==null?void 0:a.id:i.id)??"";if(typeof l=="string"&&!km(l)){t.push({kind:"node-type-unsupported",opIndex:o,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&&!Om(p)){t.push({kind:"payload-invalid",opIndex:o,field:i.kind==="node.add"?"node.eventDefinition":"eventDefinition"});return}l==="intermediateCatchEvent"!==(p!==void 0)&&t.push({kind:"event-definition-mismatch",opIndex:o,id:u,...typeof l=="string"?{type:l}:{},...p!==void 0?{eventDefinition:p}:{}})}}),t}function _v(e,t,n={}){const i=kT(e);if(i.length>0)return i;const o=[],r=new Map,a=new Map;function s(h,y,w){if(!PT.test(y)){o.push({kind:"id-invalid",opIndex:h,id:y});return}if(t.categoryOf(y)!==void 0||r.has(y)){o.push({kind:"id-duplicate",opIndex:h,id:y});return}r.set(y,{...w,opIndex:h})}e.forEach((h,y)=>{var w;switch(h.kind){case"participant.add":s(y,h.participant.id,{category:"participant",lanes:(h.participant.lanes??[]).map(g=>g.id)});for(const g of h.participant.lanes??[])s(y,g.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 g of h.associations??[])g.id&&s(y,g.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"}),(w=h.association)!=null&&w.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(g=>g.id));for(const g of h.lanes)t.categoryOf(g.id)===void 0&&s(y,g.id,{category:"lane"})}break}});const c=h=>{var y;return((y=r.get(h))==null?void 0:y.category)??t.categoryOf(h)},l=h=>{const y=r.get(h);return y?y.category==="participant"?h:y.participant:t.categoryOf(h)==="participant"?h:t.participantOf(h)};function u(h,y,w,g){const v=c(y);if(v===void 0){o.push({kind:"ref-missing",opIndex:h,ref:y,role:w});return}if(g&&!g.includes(v)){o.push({kind:"ref-category",opIndex:h,ref:y,role:w,expected:g.join("|"),actual:v});return}return v}const p=t.isCollaboration()||e.some(h=>h.kind==="participant.add"),d=new Map;for(const h of e)h.kind==="node.add"?d.set(h.node.id,h.node.eventDefinition):h.kind==="node.update"&&h.type!==void 0&&d.set(h.id,h.eventDefinition);const f=h=>d.has(h)?d.get(h)==="timer":t.eventDefinitionOf(h)==="timer";return e.forEach((h,y)=>{var w,g;switch(h.kind){case"participant.add":break;case"node.add":{const{participant:v,lane:b}=h.node;if(v===void 0){(p||b!==void 0)&&o.push({kind:"participant-required",opIndex:y,id:h.node.id});break}if(u(y,v,"participant",["participant"])===void 0)break;b!==void 0&&((((w=r.get(v))==null?void 0:w.lanes)??a.get(v)??t.lanesOf(v)).includes(b)||o.push({kind:"lane-unknown",opIndex:y,lane:b,participant:v}));break}case"sequenceFlow.add":{const{id:v,source:b,target:S,name:M,condition:B}=h.flow,A=u(y,b,"source",["flowNode"]),I=u(y,S,"target",["flowNode"]);A&&I&&l(b)!==l(S)&&o.push({kind:"flow-cross-pool",opIndex:y,id:v}),M!==void 0&&B!==void 0&&o.push({kind:"condition-name-conflict",opIndex:y,id:v});break}case"messageFlow.add":{const{id:v,source:b,target:S}=h.flow,M=u(y,b,"source",["flowNode","participant"]),B=u(y,S,"target",["flowNode","participant"]);if(M&&B){const A=l(b),I=l(S);A!==void 0&&A===I&&o.push({kind:"message-flow-same-pool",opIndex:y,id:v})}for(const A of[b,S])f(A)&&o.push({kind:"message-flow-timer-endpoint",opIndex:y,id:v,ref:A});break}case"dataStore.add":{for(const v of h.associations??[]){if([v.source,v.target].filter(M=>M===h.dataStore.id).length!==1){o.push({kind:"data-association-ends",opIndex:y,source:v.source,target:v.target});continue}const S=v.source===h.dataStore.id?v.target:v.source;u(y,S,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:v,target:b}=h.association,S=u(y,v,"source"),M=u(y,b,"target");if(S&&M){const B=new Set([S,M]);B.has("dataStore")&&B.has("flowNode")||o.push({kind:"data-association-ends",opIndex:y,source:v,target:b})}break}case"association.add":{const{id:v,source:b,target:S}=h.association,M=u(y,b,"source"),B=u(y,S,"target");M&&B&&M!=="annotation"&&B!=="annotation"&&o.push({kind:"association-detached",opIndex:y,annotation:v??`${b}->${S}`});break}case"annotation.add":{if(h.association){const{source:v,target:b}=h.association;if(v!==h.annotation.id&&b!==h.annotation.id)o.push({kind:"association-detached",opIndex:y,annotation:h.annotation.id});else{const S=v===h.annotation.id?b:v;u(y,S,"association")}}h.placement&&u(y,h.placement.anchor,"anchor");break}case"group.add":{for(const v of h.group.members??[]){const b=u(y,v,"member");b&&bv.has(b)&&o.push({kind:"ref-category",opIndex:y,ref:v,role:"member",expected:"shape",actual:b})}break}case"participant.update":{if(m(y,h.id,"participant")===void 0)break;if(h.lanes){const v=t.lanesOf(h.id),b=h.lanes.map(A=>A.id);for(const A of v)b.includes(A)||o.push({kind:"lane-shrink-unsupported",opIndex:y,participant:h.id,lane:A});for(const A of b)t.categoryOf(A)!==void 0&&!v.includes(A)&&o.push({kind:"id-duplicate",opIndex:y,id:A});const S=b.filter(A=>v.includes(A)),M=A=>S.every((I,H)=>I===A[H]),B=(((g=t.laneDeclarationOrderOf)==null?void 0:g.call(t,h.id))??v).filter(A=>v.includes(A));S.length===v.length&&!M(v)&&!M(B)&&o.push({kind:"lane-reorder-unsupported",opIndex:y,participant:h.id})}break}case"node.update":{if(m(y,h.id,"flowNode")===void 0)break;if(h.lane!==void 0){const v=t.participantOf(h.id);(v?a.get(v)??t.lanesOf(v):[]).includes(h.lane)||o.push({kind:"lane-unknown",opIndex:y,lane:h.lane,participant:v??""})}break}case"sequenceFlow.update":{if(m(y,h.id,"sequenceFlow")===void 0)break;if(h.name!==void 0&&h.condition!==void 0&&o.push({kind:"condition-name-conflict",opIndex:y,id:h.id}),h.source!==void 0||h.target!==void 0){const v=h.source===void 0||u(y,h.source,"source",["flowNode"])!==void 0,b=h.target===void 0||u(y,h.target,"target",["flowNode"])!==void 0,S=t.endpointsOf(h.id),M=h.source??(S==null?void 0:S.source),B=h.target??(S==null?void 0:S.target);v&&b&&M!==void 0&&B!==void 0&&new Set([l(M),l(B),l(h.id)]).size>1&&o.push({kind:"flow-cross-pool",opIndex:y,id:h.id})}break}case"messageFlow.update":m(y,h.id,"messageFlow");break;case"dataStore.update":m(y,h.id,"dataStore");break;case"annotation.update":{if(m(y,h.id,"annotation")===void 0)break;h.placement&&u(y,h.placement.anchor,"anchor");break}case"group.update":{if(m(y,h.id,"group")===void 0)break;for(const v of h.members??[]){const b=u(y,v,"member");b&&bv.has(b)&&o.push({kind:"ref-category",opIndex:y,ref:v,role:"member",expected:"shape",actual:b})}break}case"translation.confirm":m(y,h.id);break;case"element.remove":{m(y,h.id)==="lane"&&o.push({kind:"ref-category",opIndex:y,ref:h.id,role:"target",expected:"removable",actual:"lane"});break}}}),o.push(...AT(e,t,n.i18n)),o;function m(h,y,w){if(r.has(y)){o.push({kind:"target-added-in-batch",opIndex:h,id:y});return}const g=t.categoryOf(y);if(g===void 0){o.push({kind:"ref-missing",opIndex:h,ref:y,role:"target"});return}if(w&&g!==w){o.push({kind:"ref-category",opIndex:h,ref:y,role:"target",expected:w,actual:g});return}return g}}const qd=12,Ev=14,OT=15,DT=100,LT=300,IT=30,BT=/[㐀-鿿]/,NT=1.1;function Sv(e){let t=0;for(const n of e)BT.test(n)?t+=qd:ZC(n)?t+=Vr(n,qd):t+=Vr(n,qd)*NT;return t}const Rv="­";function $T(e,t){const n=e.split(/(\s|-|­)/g),i=[];let o=0,r;if(n.length>1)for(;r=n.shift();)if(r.length+o<t)i.push(r),o+=r.length;else{(r==="-"||r===Rv)&&i.pop();break}return i[i.length-1]===Rv&&(i[i.length-1]="-"),i.join("")}function FT(e,t,n){const i=Math.max(e.length*(n/t),1);return $T(e,i)||e.slice(0,Math.max(Math.round(i-1),1))}const Mv=(e,t)=>e?t(e.replace(/\s+$/,"")):0;function jT(e,t,n=Sv){const i=e.split(/­?\r?\n/),o=[];for(;i.length;){const r=i.shift();let a=r;for(;;){const s=Mv(a,n);if(a===" "||a===""||s<Math.round(t)||a.length<2)break;a=FT(a,s,t)}a.length<r.length&&i.unshift(r.slice(a.length).trim()),o.push(a)}return o}function Cv(e){const t=e.length?e:[""],n=Math.max(0,...t.flatMap(r=>r.split(/­?\r?\n/).map(a=>Mv(a,Sv)))),i=Math.max(DT,Math.min(LT,Math.floor(n)+1+Ev)),o=Math.max(...t.map(r=>jT(r,i-Ev).length));return{width:i,height:Math.max(IT,o*OT+10)}}const Av="bwlExactAnnotationBounds",HT=500;class Tv{constructor(t){t.on("commandStack.shape.resize.preExecute",HT,({context:n})=>{var o,r;const i=(o=n==null?void 0:n.hints)==null?void 0:o[Av];!i||((r=n.shape)==null?void 0:r.type)!=="bpmn:TextAnnotation"||(n.newBounds={x:i.x,y:i.y,width:i.width,height:i.height})})}}on(Tv,"$inject",["eventBus"]);const Pv={__init__:["annotationExactResize"],annotationExactResize:["type",Tv]};function kv(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 bl(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const wl={"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]},Zi=10,GT=300,zT=160,Ov=20,Yd=100,Dv=40,VT=10,WT=["top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"];function Lv(e,t,n){if(!(t.width>0))return;const i=t.x+t.width/2,o=t.y+t.height/2;let r;for(const a of e.getAll()){if(a.type!=="bpmn:Lane")continue;const s=a;typeof s.x!="number"||typeof s.width!="number"||i>=s.x&&i<=s.x+s.width&&o>=s.y&&o<=s.y+s.height&&(!r||s.width*s.height<r.width*r.height)&&(r=s)}return r?{x:n.x,width:n.width,y:r.y,height:r.height}:void 0}const _l=(e,t,n)=>e.y-t.height/2>=n.y&&e.y+t.height/2<=n.y+n.height;function El(e,t,n,i,o){const r=n,a=Lv(e,t,i),s=a??i,c=(ie,pe,Y=s)=>{const[Te,Pe]=wl[ie];let ke={x:t.x+t.width/2+Te*(t.width/2+r.width/2+pe),y:t.y+t.height/2+Pe*(t.height/2+r.height/2+pe)};const ve=Y.x+Zi+r.width/2,W=Y.x+Y.width-Zi-r.width/2,de=Y.y+Zi+r.height/2,z=Y.y+Y.height-Zi-r.height/2,ee={x:Math.min(W,Math.max(ve,ke.x)),y:Math.min(z,Math.max(de,ke.y))};return(ee.x!==ke.x||ee.y!==ke.y)&&(ke=Math.abs(ee.x-(t.x+t.width/2))<(t.width+r.width)/2+Zi&&Math.abs(ee.y-(t.y+t.height/2))<(t.height+r.height)/2+Zi?{x:t.x+t.width+Zi+r.width/2,y:ee.y}:ee),ke},l=(i.children??[]).filter(ie=>!("waypoints"in ie&&ie.waypoints)&&ie.type!=="bpmn:Lane"&&ie.type!=="label"&&typeof ie.x=="number"&&ie.id!==o.selfId),u=Ge(e),p=ie=>{var Y,Te;if(!o.selfId)return!1;const pe=e.get(ie);return!!pe&&(((Y=pe.source)==null?void 0:Y.id)===o.selfId||((Te=pe.target)==null?void 0:Te.id)===o.selfId)},d=u.edges.filter(ie=>!p(ie.id)).flatMap(fn),f=rr(u).filter(ie=>ie.owner!==o.selfId).map(ie=>ie.rect),m=ie=>({x0:ie.x-r.width/2-Zi,x1:ie.x+r.width/2+Zi,y0:ie.y-r.height/2-Zi,y1:ie.y+r.height/2+Zi}),h=ie=>{const pe=m(ie);return l.some(Y=>pe.x0<Y.x+Y.width&&pe.x1>Y.x&&pe.y0<Y.y+Y.height&&pe.y1>Y.y)},y=ie=>{const pe=m(ie);return d.some(Y=>Y.axis==="h"?Y.at>pe.y0&&Y.at<pe.y1&&Y.lo<pe.x1&&Y.hi>pe.x0:Y.at>pe.x0&&Y.at<pe.x1&&Y.lo<pe.y1&&Y.hi>pe.y0)},w=ie=>{const pe=m(ie);return f.some(Y=>pe.x0<Y.x+Y.width&&pe.x1>Y.x&&pe.y0<Y.y+Y.height&&pe.y1>Y.y)},g=u.shapes.filter(ie=>ie.type==="bpmn:Group").flatMap(ie=>[{axis:"h",at:ie.y,lo:ie.x,hi:ie.x+ie.width},{axis:"h",at:ie.y+ie.height,lo:ie.x,hi:ie.x+ie.width},{axis:"v",at:ie.x,lo:ie.y,hi:ie.y+ie.height},{axis:"v",at:ie.x+ie.width,lo:ie.y,hi:ie.y+ie.height}]),v=ie=>{const pe=m(ie);return g.some(Y=>Y.axis==="h"?Y.at>pe.y0&&Y.at<pe.y1&&Y.lo<pe.x1&&Y.hi>pe.x0:Y.at>pe.x0&&Y.at<pe.x1&&Y.lo<pe.y1&&Y.hi>pe.y0)},b=ie=>h(ie)||y(ie)||w(ie)||v(ie),S=ie=>ie.x-r.width/2>=i.x&&ie.x+r.width/2<=i.x+i.width&&ie.y-r.height/2>=i.y&&ie.y+r.height/2<=i.y+i.height,M=ie=>S(ie)&&(!a||_l(ie,r,a)),B=ie=>ie.startsWith("top")?ie.replace(/^top/,"bottom"):ie.replace(/^bottom/,"top"),A=ie=>ie.endsWith("left")?ie.replace(/left$/,"right"):ie.replace(/right$/,"left"),I=o.placement.side,H=[I,B(I),A(I),B(A(I)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],V=o.placement.offset??50;let G=c(I,V);if(b(G)||a&&!_l(G,r,a)){const ie=(pe,Y)=>{const Te=new Set;for(const Pe of H){if(Te.has(Pe))continue;Te.add(Pe);const ke=c(Pe,V,pe);if(Y(ke)&&!b(ke))return G=ke,!0}return!1};!ie(s,M)&&a&&ie(i,S)}return G}function Vt(e,t){return e.filter(n=>n.kind===t)}function Iv(e,t){const n=new Map,i=new Set(Vt(e,"node.add").map(s=>s.node.id)),o=Vt(e,"sequenceFlow.update"),r=new Set(o.flatMap(s=>s.target!==void 0?[s.target]:[])),a=new Set;for(const s of o){const c=s.source;if(s.target!==void 0||c===void 0||!i.has(c)||r.has(c)||a.has(c))continue;const l=t(s.id),u=l&&Vt(e,"sequenceFlow.add").find(d=>d.flow.source===l&&d.flow.target===c);if(!u)continue;const p=JSON.stringify(u.flow.id);e.some(d=>d!==u&&JSON.stringify(d).includes(p))||(a.add(c),n.set(s.id,u))}return n}function UT(e,t,n){const i=new Map,o=new Set;for(const g of e){const v=i.get(g.source)??[];v.push(g.target),i.set(g.source,v),o.add(g.target)}const r=[...e.map(g=>g.source).filter(g=>!o.has(g)),...t,...e.map(g=>g.source)],a=new Map,s=new Set,c=g=>{a.set(g,"open");for(const v of i.get(g)??[]){const b=a.get(v);b==="open"?s.add(`${g}>${v}`):b||c(v)}a.set(g,"done")};for(const g of r)a.has(g)||c(g);const l=(g,v)=>!s.has(`${g}>${v}`),u=[],p=new Set,d=g=>{p.add(g);for(const v of i.get(g)??[])l(g,v)&&!p.has(v)&&d(v);u.push(g)};for(const g of r)p.has(g)||d(g);const f=new Map;for(const g of u.reverse()){const v=f.get(g)??0;f.set(g,v);for(const b of i.get(g)??[])l(g,b)&&(f.get(b)??-1)<v+1&&f.set(b,v+1)}const m=new Map;for(const g of e){if(!l(g.source,g.target)||!n(g.target))continue;const v=m.get(g.target)??[];v.includes(g.source)||v.push(g.source),m.set(g.target,v)}const h=new Map,y=(g,v)=>{let b=h.get(g);if(!b){b=new Set([g]);const S=[g];for(;S.length;){const M=S.pop();for(const B of i.get(M)??[])l(M,B)&&!b.has(B)&&(b.add(B),S.push(B))}h.set(g,b)}return b.has(v)},w=new Set;for(const g of e){const v=m.get(g.target);if(!v||v.length<2||!v.includes(g.source))continue;const b=f.get(g.source)??0;v.some(S=>S!==g.source&&(f.get(S)??0)>=b+2&&y(g.source,S))&&w.add(g.id)}return w}class Bv extends Error{constructor(t){super(t.kind),this.issue=t,this.name="LowerIssueError"}}const Nv=new WeakMap;function qT(e){return Nv.get(e)??new Set}const $v=new WeakMap;function YT(e,t){$v.set(e,t)}const Fv=new WeakMap;function KT(e){return Fv.get(e)??[]}const jv=new WeakMap;function XT(e){return jv.get(e)??new Set}const Hv=new WeakMap;function ZT(e){return Hv.get(e)??new Set}function Gv(e,t){var vR,xR,bR,wR,_R,ER,SR,RR,MR,CR,AR,TR,PR,kR,OR,DR,LR,IR,BR,NR,$R,FR,jR,HR,GR,zR,VR,WR,UR,qR,YR,KR,XR;const{modeling:n,bpmnFactory:i,elementFactory:o,elementRegistry:r,canvas:a,autoPlace:s,bpmnReplace:c,spaceTool:l}=t,u=new Set;Nv.set(t,u);const p=[];Fv.set(t,p);const d=new Set;jv.set(t,d);const f=new Set;Hv.set(t,f);const m=()=>a.getRootElement(),h=x=>r.get(x),y=x=>{const _=h(x);if(!_)throw new Error(`하강 참조 해소 실패: ${x}`);return _},w=x=>{let _=x.parent;for(;_;){if(_.type==="bpmn:Participant")return _;_=_.parent}},g=(x,_)=>{if(!x)return;const E=_.x+_.width/2,k=_.y+_.height/2;let D;const P=N=>{for(const O of N.children??[])if(O.type==="bpmn:Lane"){const L=O;E>=L.x&&E<=L.x+L.width&&k>=L.y&&k<=L.y+L.height&&(D=L,P(L))}};return P(x),D},v=new Map;for(const x of r.filter(_=>!("waypoints"in _&&_.waypoints)&&_.type!=="bpmn:Lane"&&_.type!=="label"&&typeof _.x=="number"))v.set(x.id,{x:x.x,y:x.y});const b=Vt(e,"participant.add"),S=Vt(e,"node.add"),M=Vt(e,"sequenceFlow.add"),B=Vt(e,"messageFlow.add"),A=Vt(e,"dataStore.add"),I=Vt(e,"dataAssociation.add"),H=Vt(e,"annotation.add"),V=Vt(e,"group.add"),G=new Map(S.map(x=>[x.node.id,x])),ie=Iv(e,x=>{var _,E;return(E=(_=h(x))==null?void 0:_.source)==null?void 0:E.id}),pe=new Set([...ie.values()].map(x=>x.flow.id)),Y=M.filter(x=>!pe.has(x.flow.id)),Te=new Set([...ie.values()].map(x=>x.flow.target)),Pe=x=>Vt(e,"sequenceFlow.update").filter(_=>_.target===x).length+(Te.has(x)?1:0),ke=(x,_,E)=>{var O;const k=x.businessObject,D=(((O=k.extensionElements)==null?void 0:O.values)??[]).filter(L=>L.$type!==_),P=E?[...D,i.create(_,E)]:D;if(!P.length){k.extensionElements&&n.updateProperties(x,{extensionElements:void 0});return}const N=i.create("bpmn:ExtensionElements",{values:P});P.forEach(L=>{L.$parent=N}),n.updateProperties(x,{extensionElements:N})},ve=x=>({anchor:x.anchor,side:x.side,...x.offset!==void 0?{offset:x.offset}:{}});for(const x of Vt(e,"element.remove")){const _=h(x.id);if(!_)continue;const E="waypoints"in _?[]:[..._.incoming??[],..._.outgoing??[]];n.removeElements([...E,_])}const W=x=>r.filter(_=>{var E;return _.type==="bpmn:Lane"&&((E=w(_))==null?void 0:E.id)===x}).sort((_,E)=>_.y-E.y),de=[];for(const x of Vt(e,"participant.update")){const _=y(x.id);if(x.name!==void 0&&n.updateProperties(_,{name:x.name??void 0}),!x.lanes)continue;const E=W(x.id);if(!E.length){n.splitLane(_,x.lanes.length),W(x.id).forEach((P,N)=>{const O=x.lanes[N];O&&n.updateProperties(P,{id:O.id,name:O.name})}),de.push({pool:x.id,lanes:new Set(x.lanes.map(P=>P.id))});continue}const k=new Set(E.map(P=>P.id)),D=x.lanes.reduce((P,N,O)=>k.has(N.id)?O:P,-1);x.lanes.forEach((P,N)=>{if(k.has(P.id)){n.updateProperties(y(P.id),{name:P.name});return}const O=N===D+1&&D>=0,L=N===0?n.addLane(W(x.id)[0],"top"):O?n.addLane(W(x.id).at(-1),"bottom"):n.addLane(y(x.lanes[N-1].id),"bottom");n.updateProperties(L,{id:P.id,name:P.name})})}const z=150,ee=130,he=80,se=90,Ae=180,F=30,C=30,R=10,J=300,ne=5,ge=(x,_,E,k,D)=>{const P=E-_.width/2,N=k-_.height/2;return(x.children??[]).find(O=>!("waypoints"in O&&O.waypoints)&&O.type!=="bpmn:Lane"&&O.type!=="label"&&!(D!=null&&D.has(O.id))&&typeof O.x=="number"&&P<O.x+O.width+C&&P+_.width+C>O.x&&N<O.y+O.height&&N+_.height>O.y)},$e=new Set;for(const x of b){$e.add(`pool:${x.participant.id}`);for(const _ of x.participant.lanes??[])$e.add(_.id)}const rt=new Map;for(const x of S){const _=x.node.lane??`pool:${x.node.participant??""}`;let E=rt.get(_);E||rt.set(_,E=new Set([0])),x.band!==void 0&&E.add(x.band)}const pt=new Map;for(const[x,_]of rt){if(!$e.has(x))continue;const E=[..._].sort((P,N)=>P-N),k=E.map((P,N)=>N===0?0:N%2===1?Math.ceil(N/2):-(N/2)),D=Math.min(...k);pt.set(x,new Map(E.map((P,N)=>[P,k[N]-D])))}{const x=new Map;for(const _ of b)(_.participant.lanes??[]).forEach((E,k)=>x.set(E.id,k));for(const[_,E]of pt){if(!x.has(_)||E.size<2)continue;const k=x.get(_),D=E.get(0)??0,P=new Set;for(const Q of S){if(Q.node.lane!==_||(Q.band??0)!==0||!Q.node.type.endsWith("Gateway"))continue;const ae={in:new Set,out:new Set,cross:new Set};for(const X of Y){const Z=X.flow.source===Q.node.id;if(!Z&&X.flow.target!==Q.node.id)continue;const ce=G.get(Z?X.flow.target:X.flow.source);if(!ce||ce.node.participant!==Q.node.participant||!ce.node.lane)continue;let re,q=!1;if(ce.node.lane!==_){const fe=x.get(ce.node.lane);if(fe===void 0)continue;re=fe>k?"down":"up",q=!0}else{const fe=E.get(ce.band??0)??D;re=fe>D?"down":fe<D?"up":void 0}re&&(ae[Z?"out":"in"].add(re),q&&ae.cross.add(re))}for(const X of["up","down"])ae.in.has(X)&&ae.out.has(X)&&ae.cross.has(X)&&P.add(X)}if(P.size!==1)continue;const[N]=P,O=Math.max(...E.values()),L=N==="down"?O:0;if(D===L)continue;const j=[...E.entries()].filter(([Q])=>Q!==0).sort((Q,ae)=>Q[1]-ae[1]),$=[...Array(O+1).keys()].filter(Q=>Q!==L),U=new Map([[0,L]]);j.forEach(([Q],ae)=>U.set(Q,$[ae])),pt.set(_,U)}}const pn=x=>{var _;return(((_=rt.get(x))==null?void 0:_.size)??0)>1},bt=x=>x.band??(x.node.lane||!pn(`pool:${x.node.participant??""}`)?void 0:0),qt=new Map,Kt=x=>qt.get(x.node.id)??bt(x),Ln=new Set,Bt=new Set,sn=new Set,zn=new Set,pa=new Set,ri=x=>H.some(_=>{var E,k;return(((E=_.placement)==null?void 0:E.anchor)??(_.association?_.association.source===_.annotation.id?_.association.target:_.association.source:void 0))===x&&((k=_.placement)==null?void 0:k.side.startsWith("bottom"))});{const x=new Map;for(const k of Y)x.set(k.flow.target,(x.get(k.flow.target)??0)+1);const _=k=>{const D=[],P=new Set([k]),N=[k];for(;N.length;){const O=N.shift();D.push(O);for(const L of Y)L.flow.source!==O||P.has(L.flow.target)||(x.get(L.flow.target)??0)!==1||(P.add(L.flow.target),N.push(L.flow.target))}return D},E=(k,D)=>{var P;return((P=pt.get(k))==null?void 0:P.get(D))??D};for(const k of S){if(!k.node.type.endsWith("Gateway"))continue;const D=k.node.lane??`pool:${k.node.participant??""}`,P=pt.get(D);if(!P||P.size<2)continue;const N=Kt(k);if(N===void 0||E(D,N)!==E(D,0))continue;const O=E(D,N),L=Y.filter(X=>X.flow.source===k.node.id).map(X=>G.get(X.flow.target)).filter(X=>!!X&&(X.node.lane??`pool:${X.node.participant??""}`)===D),j=L.filter(X=>{const Z=Kt(X);return Z!==void 0&&E(D,Z)===O&&(x.get(X.node.id)??0)===1}),$=L.some(X=>{const Z=Kt(X);return Z!==void 0&&E(D,Z)>O});if(j.length!==1||!$)continue;const U=new Set(L.flatMap(X=>_(X.node.id)));if(!Y.some(X=>X.flow.target===k.node.id&&U.has(X.flow.source)))continue;const ae=new Map;for(const[X,Z]of P)ae.set(X,Z+1);ae.set(-1,0),pt.set(D,ae);for(const X of _(j[0].node.id))G.has(X)&&(qt.set(X,-1),Bt.add(X));Ln.add(k.node.id)}}{const x=$=>$.node.lane??`pool:${$.node.participant??""}`,_=$=>Kt($)??0,E=new Map(b.map(($,U)=>({id:$.participant.id,order:$.order??Number.POSITIVE_INFINITY,declared:U})).sort(($,U)=>$.order!==U.order?$.order-U.order:$.declared-U.declared).map(($,U)=>[$.id,U])),k=$=>$===void 0?void 0:E.get($)??-1,D=$=>{var ae;const U=G.get($);if(U)return U.node.participant;if(E.has($))return $;const Q=h($);if(Q)return Q.type==="bpmn:Participant"?Q.id:(ae=w(Q))==null?void 0:ae.id},P=new Map;for(const $ of Y)P.set($.flow.target,(P.get($.flow.target)??0)+1);const N=$=>{const U=[$],Q=new Set([$.node.id]);for(let ae=0;ae<U.length;ae++)for(const X of Y){if(X.flow.source!==U[ae].node.id||Q.has(X.flow.target)||(P.get(X.flow.target)??0)!==1)continue;const Z=G.get(X.flow.target);!Z||Z.node.participant!==$.node.participant||(Q.add(Z.node.id),U.push(Z))}return U},O=$=>{const U=new Set($.map(X=>X.node.id)),Q=k($[0].node.participant);if(Q===void 0)return;const ae=new Set;for(const X of B){const Z=U.has(X.flow.source)?X.flow.target:U.has(X.flow.target)?X.flow.source:void 0;if(Z===void 0)continue;const ce=k(D(Z));ce===void 0||ce===Q||ae.add(ce<Q?"up":"down")}return ae.size===1?[...ae][0]:void 0},L=new Map;{const $=new Map;for(const Z of Y){if(!G.has(Z.flow.source)||!G.has(Z.flow.target))continue;const ce=$.get(Z.flow.source)??[];ce.push(Z.flow.target),$.set(Z.flow.source,ce)}const U=new Map,Q=[],ae=new Set,X=Z=>{U.set(Z,"open");for(const ce of $.get(Z)??[]){const re=U.get(ce);re==="open"?ae.add(`${Z}>${ce}`):re||X(ce)}U.set(Z,"done"),Q.push(Z)};for(const Z of S)U.has(Z.node.id)||X(Z.node.id);for(const Z of Q.reverse()){const ce=L.get(Z)??0;L.set(Z,ce);for(const re of $.get(Z)??[])!ae.has(`${Z}>${re}`)&&(L.get(re)??-1)<ce+1&&L.set(re,ce+1)}}let j=-1e3;for(const $ of S){if(!$.node.type.endsWith("Gateway"))continue;const U=x($),Q=pt.get(U);if(!Q)continue;const ae=Q.get(_($))??0,X=q=>(Q.get(_(q))??0)-ae,Z=Y.filter(q=>q.flow.source===$.node.id).map(q=>G.get(q.flow.target)).filter(q=>!!q&&x(q)===U&&(P.get(q.node.id)??0)===1&&!Bt.has(q.node.id)).map(q=>{const fe=N(q);return{root:q,subtree:fe,dir:O(fe)}});if(Z.some(q=>q.dir==="up")&&Z.some(q=>q.dir==="down"))continue;const ce=Y.some(q=>{const fe=q.flow.source===$.node.id?G.get(q.flow.target):void 0;return!!fe&&x(fe)===U&&X(fe)===0});let re=!1;if(!ce){const q=Y.filter(xe=>xe.flow.source===$.node.id).map(xe=>G.get(xe.flow.target)).filter(xe=>!!xe&&x(xe)===U&&(!!xe.node.lane||bt(xe)!==void 0)&&X(xe)<0),fe=q.length?Math.max(...q.map(X)):void 0,ye=q.filter(xe=>X(xe)===fe);if(!ri($.node.id)&&ye.length===1&&(P.get(ye[0].node.id)??0)===1&&!Ln.has($.node.id))continue;re=!0}for(const q of Z){const fe=q.dir;if(!fe||Z.some(Re=>Re!==q&&Re.dir===fe))continue;const ye=X(q.root);if(ye===0||(fe==="up"?ye<0:ye>0)||Y.some(Re=>{const Me=Re.flow.target===$.node.id?G.get(Re.flow.source):void 0;if(!Me||x(Me)!==U)return!1;const Ye=X(Me);return fe==="up"?Ye<0:Ye>0}))continue;const xe=[...Q].map(([Re,Me])=>({band:Re,rel:Me-ae})).filter(Re=>fe==="up"?Re.rel<0:Re.rel>0).sort((Re,Me)=>Math.abs(Me.rel)-Math.abs(Re.rel));if(!xe.length&&fe==="down")continue;const me=_(q.root),_e=q.subtree.filter(Re=>x(Re)===U&&_(Re)===me),De=new Set(q.subtree.map(Re=>Re.node.id)),Fe=_e.map(Re=>L.get(Re.node.id)??0),Ie=Math.min(...Fe)-1,Ve=Math.max(...Fe)+1,Se=Re=>!S.some(Me=>{if(De.has(Me.node.id)||x(Me)!==U||_(Me)!==Re)return!1;if(!sn.has(Re))return!0;const Ye=L.get(Me.node.id)??0;return Ye>=Ie&&Ye<=Ve});let le=re?_($):(vR=xe.find(Re=>Se(Re.band)))==null?void 0:vR.band;if(le===void 0){if(le=j--,sn.add(le),fe==="up"){const Re=new Map;for(const[Me,Ye]of Q)Re.set(Me,Ye+1);Re.set(le,0),pt.set(U,Re)}else Q.set(le,Math.max(...Q.values())+1);(xR=rt.get(U))==null||xR.add(le)}for(const Re of _e)qt.set(Re.node.id,le)}}{const $=Z=>{const ce=Y.find(re=>re.flow.target===Z.node.id);return ce?G.get(ce.flow.source):void 0},U=Z=>{const ce=$(Z);if(!ce||!ce.node.type.endsWith("Gateway")||x(ce)!==x(Z))return!1;const re=pt.get(x(ce));if(!re)return!1;const q=re.get(_(ce))??0,fe=_e=>x(_e)===x(ce)?(re.get(_(_e))??0)-q:Number.NaN,ye=Y.filter(_e=>_e.flow.source===ce.node.id).map(_e=>G.get(_e.flow.target)).filter(_e=>!!_e&&(!!_e.node.lane||bt(_e)!==void 0));if(ye.some(_e=>fe(_e)===0))return!1;const oe=ye.filter(_e=>_e.node.lane===ce.node.lane&&fe(_e)<0);if(!oe.length)return!1;const xe=Math.max(...oe.map(fe)),me=oe.filter(_e=>fe(_e)===xe);return me.length===1&&me[0]===Z&&(P.get(Z.node.id)??0)===1&&!ri(ce.node.id)&&!Ln.has(ce.node.id)},Q=new Set;for(const Z of S){if(!Z.node.type.endsWith("Gateway")||ri(Z.node.id))continue;const ce=pt.get(x(Z));if(!ce)continue;const re=ce.get(_(Z))??0;let q;for(const fe of Y){if(fe.flow.source!==Z.node.id)continue;const ye=G.get(fe.flow.target);if(!ye||x(ye)!==x(Z)||!ye.node.lane&&bt(ye)===void 0)continue;const oe=ce.get(_(ye))??0;oe<=re||(!q||oe>q.row?q={id:ye.node.id,row:oe,count:1}:oe===q.row&&q.count++)}q&&q.count===1&&(P.get(q.id)??0)===1&&Q.add(q.id)}const ae=new Set,X=[...S].sort((Z,ce)=>Number(Q.has(Z.node.id))-Number(Q.has(ce.node.id)));for(const Z of X){const ce=x(Z),re=pt.get(ce);if(!re)continue;const q=Z.node.id,fe=B.filter(Ue=>Ue.flow.target===q);if(fe.length!==1||!(P.get(q)??0)||!Z.node.lane&&bt(Z)===void 0||Bt.has(q)||zn.has(q))continue;const ye=(bR=G.get(fe[0].flow.source))==null?void 0:bR.node.participant;if(!ye||ye===Z.node.participant)continue;const oe=k(Z.node.participant),xe=k(ye);if(oe===void 0||xe===void 0||oe===xe)continue;const me=xe<oe,_e=re.get(0)??0,De=(re.get(_(Z))??_e)-_e;if(De===0||(me?De<0:De>0)||U(Z))continue;let Fe;for(const[Ue,at]of re){if(sn.has(Ue))continue;const Be=at-_e;(me?Be<0&&(!Fe||Be<Fe.row):Be>0&&(!Fe||Be>Fe.row))&&(Fe={band:Ue,row:Be})}if(!Fe)continue;const Ie=_(Z),Ve=N(Z).filter(Ue=>x(Ue)===ce&&_(Ue)===Ie&&!Bt.has(Ue.node.id)),Se=$(Z),le=Se!=null&&Se.node.type.endsWith("Gateway")?`${Se.node.id}|${ce}|${Fe.band}`:void 0,Re=Fe,Me=!!le&&Q.has(q)&&Y.some(Ue=>{if(Ue.flow.source!==Se.node.id||Ue.flow.target===q)return!1;const at=G.get(Ue.flow.target);return!!at&&x(at)===ce&&!Ve.includes(at)&&_(at)===Re.band});let Ye=Fe.band;if(le&&(ae.has(le)||Me)){if(Ye=j--,sn.add(Ye),me){const Ue=new Map;for(const[at,Be]of re)Ue.set(at,Be+1);Ue.set(Ye,0),pt.set(ce,Ue)}else re.set(Ye,Math.max(...re.values())+1);(wR=rt.get(ce))==null||wR.add(Ye)}le&&ae.add(le);for(const Ue of Ve)qt.set(Ue.node.id,Ye),zn.add(Ue.node.id);me&&Q.has(q)&&pa.add(q)}}}const In=(x,_)=>{var E;return((E=pt.get(x))==null?void 0:E.get(_))??_},Bn=(x,_,E,k)=>{const D=x?h(x):_?h(_):void 0;if(!D)return!1;const P=x?D.y+Math.min(D.height/2,se):D.y+he;return Math.abs(P+In(x??`pool:${_??""}`,E)*z-k)<=z/2},dn=new Map;for(const[x,_]of rt){let E=0;for(const k of _)E=Math.max(E,In(x,k));dn.set(x,E)}const Eo=x=>Ae+z*x,Fi=(x,_,E,k)=>{const D=m().children.filter(P=>!("waypoints"in P&&P.waypoints)&&P.type!=="label"&&P.id!==_&&!(k!=null&&k.has(P.id))&&typeof P.y=="number"&&P.y>=x);D.length&&n.moveElements(D,{x:0,y:E})},yi=(x,_,E)=>{const k=x.type==="bpmn:Participant"?x:void 0;if(!k||k.children.some(O=>O.type==="bpmn:Lane"))return;const D=E+_.height/2+F-k.y;if(k.height>=D)return;const P=D-k.height,N=k.y+k.height;n.resizeShape(k,{x:k.x,y:k.y,width:k.width,height:D}),Fi(N,k.id,P)},St=(x,_,E)=>{const k=_-x.height;if(k<=0)return new Set;const D=w(x)??x,P=[],N=j=>{if(!(E!=null&&E.has(j.id))){P.push(j);for(const $ of j.children??[])N($)}};N(D);const O=x.y+x.height-10,L=l.calculateAdjustments(P,"y",k,O);return l.makeSpace(L.movingShapes,L.resizingShapes,{x:0,y:k},"s",O),new Set(L.movingShapes.map(j=>j.id))},Pt=(x,_,E)=>{if(x){const N=y(x),O=Eo(_);if(N.height>=O)return;const L=O-N.height,j=w(N),$=j?j.y+j.height:N.y+N.height,U=St(N,O);Fi($,j==null?void 0:j.id,L,U);return}if(!E)return;const k=z*(_+1);if(E.height>=k)return;const D=k-E.height,P=E.y+E.height;n.resizeShape(E,{x:E.x,y:E.y,width:E.width,height:k}),Fi(P,E.id,D)},am=new Map;for(const x of Y)am.set(x.flow.target,(am.get(x.flow.target)??0)+1);const F1=x=>(am.get(x)??0)<=1,xj=new Set(S.map(x=>x.node.id).filter(x=>Pe(x)===1&&!Y.some(_=>_.flow.target===x||_.flow.source===x&&G.has(_.flow.target)))),sm=new Map,cm=(x,_)=>{if(!x)return;const E=h(x);if(!E||E.height>=Eo(_))return;const k=E.y+E.height-10,D=w(E);if(D)return new Set((D.children??[]).filter(P=>P.type!=="bpmn:Lane"&&typeof P.y=="number"&&P.y>k).map(P=>P.id))},Np=(x,_,E)=>{if(!x)return!0;const k=h(x);return k?E-_.height/2>=k.y&&E+_.height/2<=k.y+k.height:!0},bj=10,wj=/(Task|Event|Gateway|CallActivity|SubProcess|Transaction)$/;for(const{pool:x,lanes:_}of de){const E=h(x),k=W(x);if(!E||k.length<2)continue;const D=Eo(0),P=bj,N=new Set(Vt(e,"node.update").filter(oe=>oe.lane!==void 0&&_.has(oe.lane)).map(oe=>oe.id)),O=E.children??[],L=O.filter(oe=>!("waypoints"in oe&&oe.waypoints)&&oe.type!=="bpmn:Lane"&&oe.type!=="label"&&typeof oe.y=="number"),j=[];for(const oe of L){j.push([oe.y,oe.y+oe.height]);const xe=oe.label;xe&&j.push([xe.y,xe.y+xe.height])}for(const oe of O){const xe="waypoints"in oe&&oe.waypoints?oe.label:void 0;xe&&xe.y+xe.height>E.y&&xe.y<E.y+E.height&&j.push([xe.y,xe.y+xe.height])}for(const oe of m().children){if(oe.type!=="bpmn:TextAnnotation")continue;const xe=oe;xe.x<E.x+E.width&&xe.x+xe.width>E.x&&xe.y<E.y+E.height&&xe.y+xe.height>E.y&&j.push([xe.y,xe.y+xe.height])}j.sort((oe,xe)=>oe[0]-xe[0]);const $=E.y,U=E.y+E.height,Q=[];let ae=$;for(const[oe,xe]of j)oe>ae&&Q.push([ae,oe]),ae=Math.max(ae,xe);const X=L.filter(oe=>wj.test(oe.type)&&!N.has(oe.id)),Z=(oe,xe)=>X.some(me=>me.y+me.height/2>=oe&&me.y+me.height/2<=xe),ce=oe=>j.some(([xe,me])=>xe<oe-.5&&oe+.5<me),re=[];let q=$;for(const oe of k.slice(1).map(xe=>xe.y)){const xe=q+2*P,me=!ce(oe)&&oe>=xe&&oe<=U-2*P?[oe]:[];for(const[De,Fe]of Q){const Ie=Math.max(De+P,xe),Ve=Math.min(Fe-P,U-2*P);Ie<=Ve&&me.push(Math.min(Math.max(oe,Ie),Ve))}me.push(Math.max(ae+P,xe));let _e;for(const De of me){const Fe=!Z(q,De)&&De-q<D?L.filter(Se=>Se.y>=De).length:0,Ie=Math.abs(De-oe),Ve=_e?Math.abs(_e.y-oe):0;(!_e||Fe<_e.cost||Fe===_e.cost&&(Ie<Ve||Ie===Ve&&De>_e.y))&&(_e={y:De,cost:Fe})}re.push(_e.y),q=_e.y}const fe=re[re.length-1]+2*P-U;fe>0&&(n.resizeShape(E,{x:E.x,y:E.y,width:E.width,height:E.height+fe}),Fi(U,E.id,fe));const ye=[$,...re,E.y+E.height];k.forEach((oe,xe)=>{const me=ye[xe],_e=ye[xe+1]-me;(oe.y!==me||oe.height!==_e)&&n.resizeShape(oe,{x:oe.x,y:me,width:oe.width,height:_e})});for(const oe of k){if(oe.height>=D||Z(oe.y,oe.y+oe.height))continue;const xe=D-oe.height,me=E.y+E.height,_e=St(oe,D);Fi(me,E.id,xe,_e)}}const $p=b.map((x,_)=>({op:x,declared:_}));$p.sort((x,_)=>{const E=x.op.order??Number.POSITIVE_INFINITY,k=_.op.order??Number.POSITIVE_INFINITY;return E!==k?E-k:x.declared-_.declared});let Nc=80;for(const x of r.getAll())x.parent===m()&&"height"in x&&typeof x.y=="number"&&(Nc=Math.max(Nc,x.y+x.height+60));const lm=r.getAll().filter(x=>x.type==="bpmn:Participant"&&x.parent===m()),_j=(()=>{if(!lm.length)return;const x=lm.filter(D=>!Kd(D)),_=x.length?x:lm,E=Math.min(..._.map(D=>D.x)),k=Math.max(..._.map(D=>D.x+D.width));return k>E?{x:E,width:k-E}:void 0})();for(const{op:x}of $p){const _=x.participant,E=S.filter(Z=>Z.node.participant===_.id).length,k=((_R=_.lanes)==null?void 0:_R.length)??0,D=Math.max(zv,E*160+300),P=(_.lanes??[]).map(Z=>Eo(dn.get(Z.id)??0)),N=P.reduce((Z,ce)=>Z+ce,0);k&&N<300&&(P[k-1]+=300-N);const O=Math.max(300,z*((dn.get(`pool:${_.id}`)??0)+1)),L=_.blackBox||E+k===0?120:k?Math.max(300,N):O,j=_.blackBox?_j:void 0,$=(j==null?void 0:j.x)??100,U=(j==null?void 0:j.width)??D,Q=o.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:_.id,name:_.name,...x.order!==void 0?{"bwl:poolOrder":x.order}:{},..._.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:U,height:L,isExpanded:!0}),ae=n.createShape(Q,{x:$+U/2,y:Nc+L/2},m()),X=_.lanes??[];if(X.length&&n.splitLane(ae,X.length),X.length){const Z=r.filter(ce=>{var re;return ce.type==="bpmn:Lane"&&((re=w(ce))==null?void 0:re.id)===_.id}).sort((ce,re)=>ce.y-re.y);if(Z.forEach((ce,re)=>{const q=X[re];q&&n.updateProperties(ce,{id:q.id,name:q.name})}),P.some(ce=>ce!==ae.height/k)){let ce=ae.y;Z.forEach((re,q)=>{const fe=P[q];n.resizeShape(re,{x:re.x,y:ce,width:re.width,height:fe}),ce+=fe})}}Nc=ae.y+ae.height+60}const Ej=x=>{var k;const _=G.get(x);if(_)return _.node.participant??"";const E=h(x);return E?E.type==="bpmn:Participant"?E.id:((k=w(E))==null?void 0:k.id)??"":""},$c=new Map,j1=x=>{let _=$c.get(x);return _||$c.set(x,_={nodes:[],flows:[]}),_};for(const x of S)j1(x.node.participant??"").nodes.push(x);for(const x of Y)j1(Ej(x.flow.source)).flows.push(x);const Fp=x=>{var _;return i.create("bpmn:SequenceFlow",{id:x.id,name:x.name??((_=x.condition)==null?void 0:_.label)})},um=(x,_,E)=>o.createShape({type:bl(x.type),...x.eventDefinition?{eventDefinitionType:Kc[x.eventDefinition]}:{},businessObject:i.create(bl(x.type),{id:x.id,name:x.name,..._!==void 0?{"bwl:band":_}:{},...E!==void 0?{"bwl:afterColumn":E}:{}})}),Sj=[...$p.map(({op:x})=>x.participant.id).filter(x=>$c.has(x)),...[...$c.keys()].filter(x=>!b.some(_=>_.participant.id===x))],pm=x=>x.endsWith("Gateway");for(const x of Sj){const _=$c.get(x),E=x?y(x):void 0,k=E?E.x+150:250;let D=E?E.y+80:120;const P=(me,_e,De)=>{if(me){const Fe=y(me);return Fe.y+Math.min(Fe.height/2,se)+In(me,_e??0)*z}return _e!==void 0&&E?E.y+he+In(`pool:${x}`,_e)*z:De},N=(me,_e,De)=>{if(me){const Fe=y(me);return Fe.y+Math.min(Fe.height/2,se)+_e*z}return E?E.y+he+_e*z:De},O=me=>me.participant?y(me.participant):m(),L=new Set,j=(me,_e,De,Fe,Ie,Ve,Se,le,Re)=>{const Me=De!==void 0||Fe!==void 0,Ye=Je=>{const mt=()=>Pt(De,Je,E);le?le(mt):mt()},Ue=In(De??`pool:${x}`,Fe??0);if((Fe===void 0||Re||Bn(De,x,Fe,Se??Number.NaN))&&Se!==void 0&&Np(De,_e,Se)&&!ge(me,_e,Ie,Se))return Re&&Fe!==void 0&&!Bn(De,x,Fe,Se)&&L.add(_e.id),{x:Ie,y:Se};if(Me)for(let Je=0;Je<4;Je++){const mt=N(De,Ue+Je,Ve);if(!ge(me,_e,Ie,mt,cm(De,Ue+Je)))return Ye(Ue+Je),Je>0&&L.add(_e.id),{x:Ie,y:mt}}const at=P(De,Fe,Ve);Me?Ye(Ue):le?le(()=>yi(me,_e,_e.y+_e.height/2)):yi(me,_e,at);let Be=Ie;for(let Je=0;Je<64;Je++){const mt=ge(me,_e,Be,at);if(!mt)break;Be=mt.x+mt.width+ee+_e.width/2}return{x:Be,y:at}},$=(me,_e,De)=>{const Fe=r.getAll().filter(Ve=>{var Se;return/Association$/.test(Ve.type)&&(((Se=Ve.waypoints)==null?void 0:Se.length)??0)>=2});if(!Fe.length)return De;const Ie=Ve=>{const Se={id:_e.id,type:_e.type,x:Ve-_e.width/2,y:De.y-_e.height/2,width:_e.width,height:_e.height};return Fe.some(le=>le.waypoints.some((Re,Me)=>!!le.waypoints[Me+1]&&Po(Re,le.waypoints[Me+1],Se)<=R))};if(!Ie(De.x))return De;for(let Ve=ne;Ve<=J;Ve+=ne){const Se=De.x+Ve;if(!Ie(Se)&&!ge(me,_e,Se,De.y))return{x:Se,y:De.y}}return De},U=(me,_e,De,Fe,Ie)=>{var Be;const Ve=In(Fe??`pool:${x}`,Ie??0),Se=N(Fe,Ve,Number.NaN);if(Number.isNaN(Se))return;const le=ge(me,_e,De,Se,cm(Fe,Ve));if(!le||!G.has(le.id)||le.type!=="bpmn:EndEvent")return;const Re=Je=>(Je??[]).filter(mt=>mt.type==="bpmn:SequenceFlow"),Me=Re(le.incoming);if(Re(le.outgoing).length||Me.length>1)return;const Ye=le.y+le.height/2;if(Math.abs(Ye-Se)>1)return;const Ue=(Be=Me[0])==null?void 0:Be.source;if(!Ue||typeof Ue.x!="number"||le.x-(Ue.x+Ue.width)>ee)return;const at=N(Fe,Ve+1,Number.NaN);Number.isNaN(at)||ge(me,le,le.x+le.width/2,at,new Set([le.id]))||(Pt(Fe,Ve+1,E),n.moveShape(le,{x:0,y:at-Ye}))},Q=new Set(_.flows.map(me=>me.flow.target)),ae=new Map,X=me=>{if(me===void 0)return;const _e=r.get(me);if(!(!_e||typeof _e.x!="number"||typeof _e.width!="number"))return _e.x+_e.width+ee},Z=me=>{if(Pe(me)>0)return;const _e=_.flows.filter(Fe=>Fe.flow.source===me);if(_e.length!==1)return;const De=r.get(_e[0].flow.target);return De&&typeof De.y=="number"&&typeof De.height=="number"?De.y+De.height/2:void 0};for(const me of _.nodes){if(Q.has(me.node.id))continue;const _e=um(me.node,me.band,me.afterColumn),De=bt(me),Fe=me.node.lane?`${me.node.lane}|${De??""}`:De!==void 0?`band:${De}`:"",Ie=O(me.node),Ve=ae.get(Fe)??k,Se=X(me.afterColumn),le=Se===void 0?Ve:Math.max(Ve,Se);let Re;const Me=j(Ie,_e,me.node.lane,De,le,D,Z(me.node.id),xj.has(me.node.id)&&me.node.participant!==void 0?Ye=>Re=Ye:void 0);if(Re?n.createShape(_e,Me,Ie,{autoResize:!1}):n.createShape(_e,Me,Ie),Re){const Ye=me.node.lane?y(me.node.lane):Ie;sm.set(me.node.id,{container:Ye,relCy:Me.y-Ye.y,grow:Re})}ae.set(Fe,Me.x+_e.width+ee),!me.node.lane&&De===void 0&&(D+=160)}const ce=new Set,re=new Map,q=new Map;if(x&&$e.has(`pool:${x}`)){const me=new Map;for(const le of _.flows)me.set(le.flow.target,(me.get(le.flow.target)??0)+1);const _e=le=>P(le.node.lane,Kt(le),Number.NaN),De=new Set,Fe=le=>{var Ye;const Re=(Ye=G.get(le))==null?void 0:Ye.node.participant;if(Re)return h(Re);const Me=h(le);if(Me)return Me.type==="bpmn:Participant"?Me:w(Me)},Ie=le=>{const Re=[],Me=new Set([le]),Ye=[le];for(;Ye.length;){const Ue=Ye.shift(),at=G.get(Ue);at&&Re.push(at);for(const Be of _.flows)Be.flow.source!==Ue||Me.has(Be.flow.target)||(me.get(Be.flow.target)??0)!==1||(Me.add(Be.flow.target),Ye.push(Be.flow.target))}return Re},Ve=le=>{if(!E)return;const Re=new Set(le.map(Ue=>Ue.node.id));let Me=!1,Ye=!1;for(const Ue of B){if(!Re.has(Ue.flow.source))continue;const at=Fe(Ue.flow.target);!at||at.id===E.id||(at.y<E.y?Me=!0:Ye=!0)}return Me&&!Ye?"up":Ye&&!Me?"down":void 0};for(const le of _.nodes){if(!pm(le.node.type))continue;const Re=P(le.node.lane,bt(le),Number.NaN);if(Number.isNaN(Re))continue;const Me=[];for(const Be of _.flows){if(Be.flow.source!==le.node.id)continue;const Je=G.get(Be.flow.target);if(!Je||Je.node.lane!==le.node.lane||(me.get(Je.node.id)??0)!==1)continue;const mt=bt(Je);if(mt===void 0)continue;const Lt=P(Je.node.lane,mt,Number.NaN);if(Number.isNaN(Lt))continue;const Vi=Ie(Je.node.id),cn=Ve(Vi);cn&&Me.push({subtree:Vi,band:mt,row:Lt,dir:cn})}if(!Me.some(Be=>Be.dir==="up")||!Me.some(Be=>Be.dir==="down")||!Me.some(Be=>Be.dir==="up"&&Me.some(Je=>Je.dir==="down"&&Je.row<Be.row)))continue;const Ue=[...Me].sort((Be,Je)=>Be.row-Je.row);[...Me.filter(Be=>Be.dir==="up"),...Me.filter(Be=>Be.dir==="down")].sort((Be,Je)=>Be.dir===Je.dir?Be.row-Je.row:Be.dir==="up"?-1:1).forEach((Be,Je)=>{const mt=Ue[Je].band;if(mt!==Be.band){De.add(le.node.id);for(const Lt of Be.subtree)bt(Lt)===Be.band&&qt.set(Lt.node.id,mt)}})}const Se=le=>{if(!E)return;const Re=new Set(le.map(Ue=>Ue.node.id));let Me=!1,Ye=!1;for(const Ue of B){if(!Re.has(Ue.flow.target))continue;const at=Fe(Ue.flow.source);!at||at.id===E.id||(at.y<E.y?Me=!0:Ye=!0)}return Me&&!Ye?"up":Ye&&!Me?"down":void 0};for(const le of _.nodes){if(!pm(le.node.type))continue;const Re=le.node.lane??`pool:${x}`,Me=pt.get(Re);if(!Me||Me.size<2)continue;const Ye=Me.get(0);if(Ye===void 0)continue;const Ue=Math.max(...Me.values()),at=Ye===Ue&&Ye!==0?"down":void 0;if(!at)continue;const Be=[];for(const cn of _.flows){if(cn.flow.source!==le.node.id)continue;const Ro=G.get(cn.flow.target);if(!Ro||Ro.node.lane!==le.node.lane||(me.get(Ro.node.id)??0)!==1)continue;const Vn=Kt(Ro);Vn!==void 0&&Be.push({t:Ro,subtree:Ie(Ro.node.id),band:Vn})}const Je=Be.find(cn=>(Me.get(cn.band)??cn.band)===Ye);if(!Je||Se(Je.subtree)===at||Ve(Je.subtree)===at)continue;const mt=Be.find(cn=>cn!==Je&&Se(cn.subtree)===at);if(!mt)continue;const Lt=Je.band,Vi=mt.band;for(const cn of Je.subtree)Kt(cn)===Lt&&qt.set(cn.node.id,Vi);for(const cn of mt.subtree)Kt(cn)===Vi&&qt.set(cn.node.id,Lt);De.add(le.node.id)}for(const le of _.nodes){if(!pm(le.node.type))continue;const Re=_e(le);if(Number.isNaN(Re)||ri(le.node.id))continue;let Me,Ye=!1,Ue;for(const at of _.flows){if(at.flow.source!==le.node.id)continue;const Be=G.get(at.flow.target);if(!Be||!Be.node.lane&&bt(Be)===void 0)continue;const Je=_e(Be);Number.isNaN(Je)||(Math.abs(Je-Re)<.5&&(Ye=!0),Je>Re?!Me||Je>Me.row?Me={id:Be.node.id,row:Je,count:1}:Je===Me.row&&Me.count++:Je<Re&&Be.node.lane===le.node.lane&&!zn.has(Be.node.id)&&(!Ue||Je>Ue.row?Ue={op:Be,row:Je,count:1}:Je===Ue.row&&Ue.count++))}Me&&Me.count===1&&(me.get(Me.id)??0)===1&&!De.has(le.node.id)&&ce.add(Me.id),!Ye&&Ue&&Ue.count===1&&(me.get(Ue.op.node.id)??0)===1&&!Ln.has(le.node.id)&&re.set(Ue.op.node.id,{lane:le.node.lane,band:Kt(le)})}for(const le of pa){const Re=(ER=_.flows.find(Me=>Me.flow.target===le))==null?void 0:ER.flow.source;Re&&!De.has(Re)&&ce.add(le)}}const fe=UT(_.flows.map(me=>me.flow),_.nodes.map(me=>me.node.id),me=>G.has(me));let ye=!1;const oe=new Set;let xe=0;for(;xe++<_.nodes.length+2;){for(let De=0;De<_.nodes.length+_.flows.length+2;De++){let Fe=!1,Ie=!1;for(const Ve of _.flows){const Se=Ve.flow;if(oe.has(Se.id))continue;const le=h(Se.source);if(!le)continue;const Re=h(Se.target),Me=G.get(Se.target);if(!Re&&Me&&!ye&&fe.has(Se.id)){Ie=!0;continue}if(!Re&&Me){const Ye=um(Me.node,Me.band),Ue=Kt(Me);if(Me.node.lane||Ue!==void 0){const at=O(Me.node),Be=le,Je=Be.x+(q.get(Se.source)??0)+Be.width+ee,mt=re.get(Se.target),Lt=G.get(Se.source),Vi=!mt&&!!Lt&&Q.has(Se.source)&&Ue!==void 0&&Lt.band!==void 0&&Lt.band===Me.band&&Lt.node.lane===Me.node.lane&&Lt.node.participant===Me.node.participant&&L.has(Se.source)&&!Bn(Me.node.lane,Me.node.participant,Ue,Be.y+Be.height/2);ce.has(Se.target)&&U(at,Ye,Be.x+Be.width/2,mt?mt.lane:Me.node.lane,mt?mt.band:Ue);const cn=j(at,Ye,mt?mt.lane:Me.node.lane,mt?mt.band:Ue,ce.has(Se.target)?Be.x+Be.width/2:Je,Number.NaN,mt||!F1(Se.target)?void 0:Be.y+Be.height/2,void 0,Vi),Ro=G.has(Se.source)?cn:$(at,Ye,cn),Vn=n.createShape(Ye,Ro,at);ce.has(Se.target)&&q.set(Se.target,Je-(Vn.x+Vn.width/2)),n.connect(le,Vn,{type:"bpmn:SequenceFlow",businessObject:Fp(Se)})}else{const at=w(le),Be=at?at.y+at.height:0;s.append(le,Ye,{connection:{type:"bpmn:SequenceFlow",businessObject:Fp(Se)}}),at&&at.y+at.height-Be>.5&&Fi(Be,at.id,at.y+at.height-Be)}}else if(Re)n.connect(le,Re,{type:"bpmn:SequenceFlow",businessObject:Fp(Se)});else continue;oe.add(Se.id),Fe=!0}if(!Fe){if(Ie&&!ye){ye=!0;continue}break}ye=!1}const me=_.nodes.filter(De=>!h(De.node.id));if(!me.length)break;const _e=me[0];{const De=um(_e.node,_e.band),Fe=O(_e.node),Ie=bt(_e);n.createShape(De,j(Fe,De,_e.node.lane,Ie,k,D),Fe),!_e.node.lane&&Ie===void 0&&(D+=160)}}}const H1=new Map;for(const[x,_]of ie){const E=h(x),k=h(_.flow.target);if(!(E!=null&&E.target)||!k)continue;const D=E.label&&{x:E.label.x,y:E.label.y,width:E.label.width,height:E.label.height};H1.set(x,{waypoints:E.waypoints.map(O=>({x:O.x,y:O.y})),label:D});const P=E.target,N=O=>({x:O.x+O.width/2,y:O.y+O.height/2});n.reconnect(E,k,P,[N(k),N(P)]),n.layoutConnection(E,{waypoints:[]})}const G1=new Set;{const x=P=>P.endsWith("Task")||P==="bpmn:CallActivity"||P==="bpmn:SubProcess",_=P=>x(P)||P==="bpmn:EndEvent"||P==="bpmn:IntermediateThrowEvent"||P==="bpmn:IntermediateCatchEvent",E=P=>(P??[]).filter(N=>N.type==="bpmn:SequenceFlow"),k=Vt(e,"sequenceFlow.update"),D=(P,N)=>{var O;return(O=g(P,N))==null?void 0:O.id};for(const P of k){if(P.source===void 0&&P.target===void 0||ie.has(P.id))continue;const N=h(P.id);if(!N)continue;const O=P.source!==void 0?h(P.source):N.source,L=P.target!==void 0?h(P.target):N.target;if(!O||!L||O.id===L.id||G.has(O.id)||G.has(L.id)||!x(O.type)||!_(L.type)||O.parent!==L.parent||E(L.incoming).some(q=>q.id!==N.id)||E(L.outgoing).some(q=>q.id!==N.id)||k.some(q=>q!==P&&(q.target===L.id||q.source===L.id))||L.x>=O.x+O.width)continue;const j=O.parent,$=w(O),U=O.x+O.width+ee,Q=O.y+O.height/2,ae=L.y+L.height/2,X=D($,O)===D($,L),Z=new Set([L.id]),ce=[X?Q:ae,ae].find(q=>!ge(j,L,U,q,Z));if(ce===void 0)continue;if(n.moveElements([L],{x:U-(L.x+L.width/2),y:ce-ae}),$){const q=L.x+L.width+Sl-($.x+$.width);q>0&&Ps(n,$,$.width+q)}const re=q=>({x:q.x+q.width/2,y:q.y+q.height/2});n.reconnect(N,O,L,[re(O),re(L)]),Math.abs(re(O).y-re(L).y)>1&&n.layoutConnection(N,{waypoints:[]}),G1.add(P.id)}}const Ir=40,Rj=10,Fc=x=>{const _=$=>$.kind==="label-over-line"||$.kind==="label-over-shape"||$.kind==="label-on-shared-segment"?$.edge===x.id:$.kind==="annotation-over-label"||$.kind==="pool-name-over-label"?$.label===x.id:!1,E=()=>new Map(ut(Ge(r)).filter($=>!_($)).map($=>[ct($),$])),k=E(),D=$=>[...$].filter(([U])=>!k.has(U)).map(([,U])=>U),P=$=>D($).length<=[...k.keys()].filter(U=>!$.has(U)).length,N=x.waypoints.map($=>({x:$.x,y:$.y})),O=x.label,L=O&&{x:O.x,y:O.y};n.layoutConnection(x,{waypoints:[]});const j=E();if(!P(j)){if(D(j).every($=>$.kind==="edge-crosses-shape"&&$.edge===x.id)){const $=Ge(r),U=$.edges.find(Z=>Z.id===x.id),Q=hn($),ae=U?Tt(U,Q):[],X=U&&ae.length&&!ae.every(Z=>Z.type==="bpmn:TextAnnotation")?hl(U,Q,Ms(x),$.edges,$d($)):null;if(X&&(n.updateWaypoints(x,X),P(E())))return}n.updateWaypoints(x,N),O&&L&&(O.x!==L.x||O.y!==L.y)&&n.moveElements([O],{x:L.x-O.x,y:L.y-O.y})}},dm=5,ji=10,z1=200,jc=new Set([...Y.map(x=>x.flow.id),...B.map(x=>x.flow.id),...Vt(e,"sequenceFlow.update").map(x=>x.id),...Vt(e,"messageFlow.update").map(x=>x.id)].filter(x=>!!x)),Mj=(x,_,E,k,D,P)=>{const N=new Set(x.map(q=>q.id)),O=Math.min(...x.map(q=>q.x))+_-ji,L=Math.max(...x.map(q=>q.x+q.width))+_+z1+ji,j=Math.min(...x.map(q=>q.y+Math.min(0,...E)))-ji,$=Math.max(...x.map(q=>q.y+q.height+Math.max(0,...E)))+ji,U=r.getAll().filter(q=>{if(q.type!=="bpmn:SequenceFlow"&&q.type!=="bpmn:MessageFlow")return!1;const fe=q;return jc.has(fe.id)||!fe.waypoints||fe.waypoints.length<2||[fe.source,fe.target].some(oe=>!oe||N.has(oe.id)||oe.x>=k)?!1:fe.waypoints.some((oe,xe)=>{const me=fe.waypoints[xe+1];return!!me&&Math.max(oe.x,me.x)>=O&&Math.min(oe.x,me.x)<=L&&Math.max(oe.y,me.y)>=j&&Math.min(oe.y,me.y)<=$})});if(!U.length)return 0;const Q=q=>{const fe=new Map;for(const ye of x)for(const oe of E){const xe={id:ye.id,type:ye.type,x:ye.x+_+q,y:ye.y+oe,width:ye.width,height:ye.height};for(const me of U){let _e=1/0;for(let Fe=0;Fe+1<me.waypoints.length;Fe++)_e=Math.min(_e,Po(me.waypoints[Fe],me.waypoints[Fe+1],xe));const De=`${me.id}|${ye.id}`;fe.set(De,Math.min(fe.get(De)??1/0,_e))}}return fe},ae=[...Q(0)].filter(([,q])=>q<=dm).map(([q])=>q);if(!ae.length)return 0;let X=0;for(let q=1;q<=z1;q++){const fe=Q(q);if([...fe.values()].every(ye=>ye>dm)&&ae.every(ye=>(fe.get(ye)??1/0)>=ji)){X=q;break}}if(!X)return 0;const Z=Math.min(...x.map(q=>q.x))+_+X,ce=new Set(ae.map(q=>q.slice(0,q.indexOf("|"))));return U.some(q=>q.type==="bpmn:SequenceFlow"&&ce.has(q.id)&&q.waypoints.some((fe,ye)=>{const oe=q.waypoints[ye+1];if(!oe||Math.min(fe.y,oe.y)>P||Math.max(fe.y,oe.y)<P||fe.y===oe.y)return!1;const xe=fe.x+(P-fe.y)*(oe.x-fe.x)/(oe.y-fe.y);return xe>D&&xe<Z}))?0:X},Hi=(x,_=()=>!0)=>{const E=h(x);if(!E)return[];const k=[E],D=new Set([x]);for(let P=0;P<k.length;P++){const N=k[P].id;for(const O of Y){const L=O.flow.target;if(O.flow.source!==N||D.has(L)||!G.has(L))continue;D.add(L);const j=h(L);j&&_(j)&&k.push(j)}}return k},Cj=(x,_=()=>!0)=>{const E=h(x);if(!E)return[];const k=[E],D=new Set([x]);for(let P=0;P<k.length;P++){const N=k[P].id;for(const O of Y){const L=O.flow.source;if(O.flow.target!==N||D.has(L)||!G.has(L))continue;D.add(L);const j=h(L);j&&_(j)&&k.push(j)}}return k},Gi=30,_i=x=>!("waypoints"in x&&x.waypoints)&&x.type!=="bpmn:Lane"&&x.type!=="label"&&typeof x.x=="number",ds=(x,_)=>Ps(n,x,_),So=(x,_,E=!1)=>{const k=new Set(x.flatMap(L=>L.subtree.map(j=>j.id)));for(const L of x){const j=(L.pool.children??[]).filter(_i).filter(U=>!k.has(U.id));if(L.subtree.some(U=>j.some(Q=>U.x+_<Q.x+Q.width+Gi&&U.x+_+U.width+Gi>Q.x&&U.y<Q.y+Q.height&&U.y+U.height>Q.y)))return null}const D=x.map(L=>L.pool.width),P=E?r.filter(L=>Array.isArray(L.waypoints)).map(L=>({c:L,wps:L.waypoints.map(j=>({x:j.x,y:j.y}))})):[],N=r.filter(L=>L.type==="label").map(L=>({label:L,x:L.x,y:L.y}));n.moveElements(x.flatMap(L=>L.subtree),{x:_,y:0});const O=x.map(L=>{const $=Math.max(...L.subtree.map(U=>U.x+U.width))+Sl-(L.pool.x+L.pool.width);return $>0&&ds(L.pool,L.pool.width+$),$});return()=>{n.moveElements(x.flatMap(L=>L.subtree),{x:-_,y:0}),x.forEach((L,j)=>{O[j]>0&&ds(L.pool,D[j])});for(const{c:L,wps:j}of P){const $=L.waypoints??[];$.length===j.length&&$.every((Q,ae)=>Math.abs(Q.x-j[ae].x)<=.5&&Math.abs(Q.y-j[ae].y)<=.5)||n.updateWaypoints(L,j.map(Q=>({x:Q.x,y:Q.y})))}for(let L=0;L<3;L++){let j=0;for(const $ of N){const U=$.x-$.label.x,Q=$.y-$.label.y;Math.abs(U)<=.5&&Math.abs(Q)<=.5||(n.moveElements([$.label],{x:U,y:Q}),j++)}if(!j)break}}},fm=x=>{var D,P;const _=new Map,E=new Map;for(const N of r.getAll()){if(N.type!=="bpmn:Participant")continue;const O=N;(O.children??[]).length||(_.set(O.id,O),E.set(O.id,[]))}for(const N of r.getAll()){if(N.type!=="bpmn:MessageFlow")continue;const O=N,L=(D=O.source)==null?void 0:D.id,j=(P=O.target)==null?void 0:P.id;L&&j&&E.has(L)&&E.get(L).push(j),L&&j&&E.has(j)&&E.get(j).push(L)}const k=[];for(const[N,O]of E)O.length&&O.every(L=>x.has(L))&&k.push(_.get(N));return k},V1=(x,_)=>{if(!x.length)return null;const E=new Set(x.map($=>$.id)),k=r.getAll().filter($=>$.type==="bpmn:Participant"&&!E.has($.id)),D=Math.min(...k.filter($=>($.children??[]).length>0).map($=>$.x)),P=new Set(x.filter($=>Math.abs($.x-D)<=2).map($=>$.id));if(x.some($=>{const U=P.has($.id)?$.x:$.x+_,Q=P.has($.id)?$.width+_:$.width;return k.some(ae=>U<ae.x+ae.width+Gi&&U+Q+Gi>ae.x&&$.y<ae.y+ae.height&&$.y+$.height>ae.y)}))return null;const O=r.filter($=>$.type==="label").map($=>({label:$,x:$.x,y:$.y})),L=x.filter($=>!P.has($.id)),j=x.filter($=>P.has($.id)).map($=>({pool:$,was:{x:$.x,y:$.y,width:$.width,height:$.height}}));L.length&&n.moveElements(L,{x:_,y:0});for(const{pool:$,was:U}of j)n.resizeShape($,{...U,width:U.width+_});return()=>{for(const{pool:$,was:U}of j)n.resizeShape($,U);L.length&&n.moveElements(L,{x:-_,y:0});for(let $=0;$<3;$++){let U=0;for(const Q of O){const ae=Q.x-Q.label.x,X=Q.y-Q.label.y;Math.abs(ae)<=.5&&Math.abs(X)<=.5||(n.moveElements([Q.label],{x:ae,y:X}),U++)}if(!U)break}}},W1=(x,_,E)=>{const k=E.x+E.width/2,D=_.y>E.y,P=D?E.y+E.height:E.y,N=D?_.y:_.y+_.height,O=x.source===_?[{x:k,y:N},{x:k,y:P}]:[{x:k,y:P},{x:k,y:N}],L=Ge(r),j={...L.edges.find($=>$.id===x.id),waypoints:O};return Tt(j,hn(L)).length?!1:(n.updateWaypoints(x,O),!0)},Aj=()=>{const x=r.filter(N=>N.type==="bpmn:Participant"),_=Math.min(...x.filter(N=>(N.children??[]).length>0).map(N=>N.x)),E=N=>b.some(O=>O.participant.id===N.id),k=N=>!!N&&N.type==="bpmn:Participant"&&!(N.children??[]).length&&Math.abs(N.x-_)<=2&&!E(N),D=N=>!!N&&N.type==="bpmn:Participant"&&(N.children??[]).length>0&&!E(N),P=new Set;for(const N of r.getAll()){if(N.type!=="bpmn:MessageFlow")continue;const O=N;if((O.waypoints??[]).length!==2)continue;const L=[O.source,O.target].find(U=>k(U)||D(U)),j=L===O.source?O.target:O.source;if(!L||!j||j.type==="bpmn:Participant")continue;const $=j.x+j.width/2;D(L)&&($<L.x||$>L.x+L.width)||P.add(O.id)}return P},Tj=x=>{var E;const _=new Map;for(const k of x){const D=r.get(k);if(!D||(D.waypoints??[]).length===2)continue;const P=((E=D.source)==null?void 0:E.type)==="bpmn:Participant"?D.source:D.target,N=P===D.source?D.target:D.source;if(N.x+N.width/2<=P.x+P.width)continue;const O=_.get(P.id)??{pool:P,msgs:[]};O.msgs.push({conn:D,other:N}),_.set(P.id,O)}for(const{pool:k,msgs:D}of _.values()){const P=Math.max(...D.map(({other:X})=>X.x+X.width/2))+Yd;if(r.getAll().some(X=>{if(X.type!=="bpmn:Participant"||X.id===k.id)return!1;const Z=X;return k.x<Z.x+Z.width+Gi&&P+Gi>Z.x&&k.y<Z.y+Z.height&&k.y+k.height>Z.y}))continue;const O={x:k.x,y:k.y,width:k.width,height:k.height},L=[...k.incoming??[],...k.outgoing??[]],j=L.map(X=>({c:X,wps:(X.waypoints??[]).map(Z=>({x:Z.x,y:Z.y}))})),$=L.flatMap(X=>{const Z=X.label;return Z?[{label:Z,x:Z.x,y:Z.y}]:[]}),U=Br();ds(k,P-k.x);const Q=D.filter(({conn:X,other:Z})=>W1(X,k,Z)).length,ae=Br();if(!(Q>0&&ae.messages>U.messages&&ae.lines>=U.lines)){ds(k,O.width);for(const{c:X,wps:Z}of j){const ce=X.waypoints??[];ce.length===Z.length&&ce.every((q,fe)=>Math.abs(q.x-Z[fe].x)<=.5&&Math.abs(q.y-Z[fe].y)<=.5)||n.updateWaypoints(X,Z.map(q=>({x:q.x,y:q.y})))}for(let X=0;X<3;X++){let Z=0;for(const ce of $){const re=ce.x-ce.label.x,q=ce.y-ce.label.y;Math.abs(re)<=.5&&Math.abs(q)<=.5||(n.moveElements([ce.label],{x:re,y:q}),Z++)}if(!Z)break}}}},U1=()=>{let x=0;for(const _ of r.getAll()){if(_.type!=="bpmn:DataInputAssociation"&&_.type!=="bpmn:DataOutputAssociation")continue;const E=_.waypoints??[];for(let k=1;k<E.length;k++)x+=Math.hypot(E[k].x-E[k-1].x,E[k].y-E[k-1].y)}return x},q1=()=>{let x=0;for(const _ of r.getAll()){if(_.type!=="bpmn:Association")continue;const E=_.waypoints??[];for(let k=1;k<E.length;k++)x+=Math.hypot(E[k].x-E[k-1].x,E[k].y-E[k-1].y)}return x},Pj=x=>{const _=[];for(const E of r.getAll()){if(E.type!=="bpmn:TextAnnotation")continue;const k=E;if(x.has(k.id))continue;const P=[...k.incoming??[],...k.outgoing??[]].filter(L=>L.type==="bpmn:Association").map(L=>L.source===k?L.target:L.source);if(!P.length||P.some(L=>L===void 0))continue;const N=L=>{if(!("waypoints"in L&&L.waypoints))return[L.id];const j=L,$=[j.source,j.target];return $.some(U=>!U)?[]:$.map(U=>U.id)},O=P.flatMap(L=>N(L));O.length&&O.every(L=>x.has(L))&&_.push(k)}return _},Y1=()=>ut(Ge(r)).filter(x=>x.kind==="edge-crosses-shape").length,K1=x=>{const _=(x.children??[]).filter(_i);let E=0;for(let k=0;k<_.length;k++)for(let D=k+1;D<_.length;D++){const P=_[k],N=_[D];P.x<N.x+N.width&&P.x+P.width>N.x&&P.y<N.y+N.height&&P.y+P.height>N.y&&E++}return E},Br=()=>{const x=Ge(r),_=E=>E.length>=2&&(E.every(k=>Math.abs(k.x-E[0].x)<.01)||E.every(k=>Math.abs(k.y-E[0].y)<.01));return{messages:x.edges.filter(E=>E.type==="bpmn:MessageFlow"&&E.waypoints.length===2).length,lines:x.edges.filter(E=>_(E.waypoints)).length}},X1=x=>{const _=new Map;for(const k of r.getAll()){if(k.type!=="bpmn:MessageFlow")continue;const D=k;if(!D.waypoints||D.waypoints.length!==2)continue;const P=D.source,N=D.target;if(!P||!N)continue;const O=x.has(P.id);if(O===x.has(N.id))continue;const L=O?N:P,j=w(L);if(!j||x.has(L.id))continue;const $=_.get(j.id);$?L.x<$.minX&&($.minX=L.x):_.set(j.id,{pool:j,minX:L.x})}const E=[];for(const{pool:k,minX:D}of _.values()){const P=(k.children??[]).filter(N=>_i(N)&&!x.has(N.id)&&N.x>=D);P.length&&E.push({subtree:P,pool:k})}return E},kj=(x,_,E)=>{const k=new Map(_.map(N=>[N.pool.id,{subtree:[...N.subtree],pool:N.pool}])),D=new Set(x);for(const N of _)for(const O of N.subtree)D.add(O.id);let P=!1;for(;;){let N=0;for(const O of X1(D)){if(O.pool===E)continue;const L=k.get(O.pool.id);L?L.subtree.push(...O.subtree):k.set(O.pool.id,{subtree:[...O.subtree],pool:O.pool});for(const j of O.subtree)D.add(j.id);N+=O.subtree.length}if(!N)break;P=!0}return P?[...k.values()]:null},Oj=(x,_)=>{const E=new Map;for(const D of r.getAll()){if(D.type!=="bpmn:DataInputAssociation"&&D.type!=="bpmn:DataOutputAssociation")continue;const P=D,N=P.waypoints;if(!N||N.length<2||!N.every(ae=>Math.abs(ae.x-N[0].x)<1))continue;const O=P.source,L=P.target;if(!O||!L)continue;const j=x.has(O.id);if(j===x.has(L.id))continue;const $=j?L:O,U=w($);if(!U||U===_||U===w(j?O:L))continue;const Q=E.get(U.id);Q?$.x<Q.minX&&(Q.minX=$.x):E.set(U.id,{pool:U,minX:$.x})}const k=[];for(const{pool:D,minX:P}of E.values()){const N=(D.children??[]).filter(O=>_i(O)&&!x.has(O.id)&&O.x>=P);N.length&&k.push({subtree:N,pool:D})}return k},Z1=x=>{const _=Ge(r),E=_.shapes.filter(D=>x.has(D.id)),k=new Set;for(const D of _.edges)if(!(D.type!=="bpmn:SequenceFlow"&&D.type!=="bpmn:MessageFlow"))for(const P of Tt(D,E))k.add(`${D.id}|${P.id}`);return k},hm=new Map,Dj=Vt(e,"sequenceFlow.update").flatMap(x=>{if(x.target!==void 0)return[{id:x.id,target:x.target,source:x.source}];const _=ie.get(x.id);return _?[{id:x.id,target:_.flow.target,source:_.flow.source}]:[]});for(const x of Dj){if(x.target===void 0)continue;const _=G.get(x.target);if(!_)continue;const E=h(x.target),k=h(x.id);if(!E||!k)continue;const D=x.source!==void 0?h(x.source):k.source,P=k.target;if(!D||!P||P.id===E.id)continue;const N=H1.get(k.id)??{waypoints:k.waypoints,label:k.label},O=N.waypoints&&N.waypoints.length>=3&&Math.abs(N.waypoints[0].x-N.waypoints[1].x)<1&&Math.abs(N.waypoints[0].y-N.waypoints[1].y)>1?{x:N.waypoints[0].x,y:N.waypoints[0].y}:void 0,L=O?N.waypoints[1].y:void 0,j=O&&N.label?{x:N.label.x,y:N.label.y}:void 0,$=j&&N.label&&Math.abs(j.y+N.label.height/2-L)<=z/5&&j.x+N.label.width>O.x?j.x+N.label.width+6:void 0,U=(D.outgoing??[]).filter(Oe=>Oe.type==="bpmn:SequenceFlow"&&Oe.id!==k.id&&Oe.target&&!jc.has(Oe.id)),Q=new Set(U.map(Oe=>Oe.target.id)),ae=Oe=>{const Ot={type:"bpmn:Task",x:Oe.x+2,y:Oe.y+2,width:Oe.width-4,height:Oe.height-4};return U.find(Rt=>(Rt.waypoints??[]).some((en,ze)=>!!Rt.waypoints[ze+1]&&Po(en,Rt.waypoints[ze+1],Ot)===0))},X=Hi(x.target),Z=new Set(X.map(Oe=>Oe.id)),ce=sm.has(x.target)?{autoResize:!1}:void 0,re=Math.min(...X.map(Oe=>Oe.x)),q=Math.max(...X.map(Oe=>Oe.x+Oe.width)),fe=D.x+D.width,ye=P.x+P.width<=D.x,oe=(()=>{if(!ye)return;const Oe=w(E),Ot=((Oe==null?void 0:Oe.children)??[]).filter(qe=>_i(qe)&&!Z.has(qe.id)&&qe.type!=="bpmn:Group"&&qe.type!=="bpmn:Participant"),Rt=["bpmn:SequenceFlow","bpmn:MessageFlow","bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation"],en=r.getAll().filter(qe=>{if(!Rt.includes(qe.type))return!1;const Gt=qe;return Gt.id===k.id||jc.has(Gt.id)||!Gt.waypoints||Gt.waypoints.length<2?!1:![Gt.source,Gt.target].some(Nt=>!Nt||Z.has(Nt.id))}),ze=(qe,Gt)=>X.every(Nt=>{var ga;const Ct={id:Nt.id,type:Nt.type,x:Nt.x+qe,y:Nt.y+Gt,width:Nt.width,height:Nt.height};return Oe&&(Ct.x<Oe.x||Ct.x+Ct.width>Oe.x+Oe.width||Ct.y<Oe.y||Ct.y+Ct.height>Oe.y+Oe.height)||!Np((ga=G.get(Nt.id))==null?void 0:ga.node.lane,Nt,Nt.y+Gt+Nt.height/2)||Ot.some(ei=>Ct.x<ei.x+ei.width+ji&&Ct.x+Ct.width+ji>ei.x&&Ct.y<ei.y+ei.height+ji&&Ct.y+Ct.height+ji>ei.y)?!1:en.every(ei=>{for(let Co=0;Co+1<ei.waypoints.length;Co++)if(Po(ei.waypoints[Co],ei.waypoints[Co+1],Ct)<ji)return!1;return!0})}),Qe=D.x+D.width/2,_t=D.y+D.height/2,st=N.waypoints??[],It=st.length>=2&&Math.abs(st[0].y-st[1].y)<1&&st[1].x<st[0].x;return[...L!==void 0?[{cx:Qe,cy:L}]:[],...It?[{cx:D.x-Ir-E.width/2,cy:st[0].y}]:[],{cx:Qe,cy:_t+z},{cx:Qe,cy:_t-z}].find(qe=>ze(qe.cx-(E.x+E.width/2),qe.cy-(E.y+E.height/2)))})(),xe=ye&&!oe?fe:P.x,me=(()=>{var _t;if(O||ye)return 0;const Oe=N.label,Ot=((_t=k.businessObject)==null?void 0:_t.name)??"";if(!Oe||Oe.width==null||!Ot.trim())return 0;const Rt=fe+Ir,en=D.y+D.height/2-E.height/2;if(Math.min(Oe.y+Oe.height,en+E.height)-Math.max(Oe.y,en)<3||Oe.x+Oe.width-Rt<3)return 0;const Qe=Oe.x+Oe.width+Rj-Rt;return Qe<=E.width?Qe:0})();me>0&&u.add(k.id);const _e=E.y+E.height/2,De=Mj(X,fe+Ir+me-re,[0,D.y+D.height/2-_e,P.y+P.height/2-_e],xe,fe,D.y+D.height/2),Fe=fe+Ir+me+De,Ie=(()=>{if($===void 0)return 0;const Oe=fe+Ir,Ot=D.y+D.height/2-E.height/2,Rt={x:Oe,y:Ot,width:q-re,height:E.height},en=w(D);return((en==null?void 0:en.children)??[]).some(Qe=>_i(Qe)&&!Z.has(Qe.id)&&Qe.id!==D.id&&Qe.id!==P.id&&Qe.type!=="bpmn:Group"&&Qe.type!=="bpmn:Participant"&&Qe.x<Rt.x+Rt.width&&Qe.x+Qe.width>Rt.x&&Qe.y<Rt.y+Rt.height&&Qe.y+Qe.height>Rt.y)||ae(Rt)?Math.max(0,$-Oe):0})(),Ve=oe?0:q-re+Ir*2+De+Ie+me-(ye?0:P.x-fe);let Se=[];if(Ve>0){const Oe=w(E),Ot=(Oe==null?void 0:Oe.children)??[],Rt=st=>st.type==="bpmn:Lane";Se=(()=>{const st=new Set;for(const Xe of Ot)_i(Xe)&&!Z.has(Xe.id)&&Xe.id!==D.id&&Xe.x>=xe&&st.add(Xe.id);const It=[];for(const Xe of Ot){if(Xe.type!=="bpmn:DataStoreReference"&&Xe.type!=="bpmn:DataObjectReference")continue;const qe=Xe,Nt=[...qe.incoming??[],...qe.outgoing??[]].filter(Ct=>Ct.type==="bpmn:DataInputAssociation"||Ct.type==="bpmn:DataOutputAssociation").map(Ct=>Ct.source===qe?Ct.target:Ct.source);Nt.length&&Nt.every(Ct=>Ct!==void 0&&st.has(Ct.id))&&It.push(qe)}return It})();const ze=Ot.filter(st=>!("waypoints"in st&&st.waypoints)&&!Rt(st)&&st.type!=="label"&&!Z.has(st.id)&&st.id!==D.id&&st.x>=xe),Qe=ze.flatMap(st=>st.labels??[]),_t=Oe?[Oe,...Ot.filter(st=>Rt(st))]:[];if(ze.length){const st=new Set(ze.map(dt=>dt.id)),It=X1(st),Xe=It.length?kj(st,It,Oe):null,qe=dt=>{const At=new Set(st);for(const zt of dt)for(const Ko of zt.subtree)At.add(Ko.id);return Pj(At)},Gt=qe(It),Nt=Xe?qe(Xe):Gt,Ct=fm(st),ga=new Set(st);for(const dt of It)for(const At of dt.subtree)ga.add(At.id);const ei=It.length?fm(ga):Ct,Co=(()=>{if(!Xe)return[];const dt=new Set(st);for(const At of Xe)for(const zt of At.subtree)dt.add(zt.id);return fm(dt)})(),ms=Xe??It,ma=(()=>{const dt=new Set(st);for(const At of ms)for(const zt of At.subtree)dt.add(zt.id);return Oj(dt,Oe)})(),Tm=ma.length?qe([...ms,...ma]):Gt,no=new Set([...ze,..._t].map(dt=>dt.id)),Mt=Ot.filter(dt=>{const At=dt.labelTarget;return dt.type==="label"&&!!At&&"waypoints"in At&&!!At.source&&!!At.target&&no.has(At.source.id)&&no.has(At.target.id)}),Pn=Aj();n.createSpace([...ze,...Qe,...Mt],_t,{x:Ve,y:0},"e",xe-1);const tn=(dt,At,zt)=>{const Ko=Br(),zp=zt?Z1(zt):null,Vp=So(dt,Ve,!!zt);if(!Vp)return!1;const Wc=At.length?V1(At,Ve):null,Wp=Br(),nn=!!zt&&!!zp&&[...Z1(zt)].some(va=>!zp.has(va));return Wp.messages>Ko.messages&&Wp.lines>=Ko.lines&&!nn?!0:(Wc==null||Wc(),Vp(),!1)},vi=ma.length>0&&tn([...ms,...ma],Xe?Co:ei,new Set(ma.flatMap(dt=>dt.subtree.map(At=>At.id)))),ya=!vi&&Xe?tn(Xe,Co):!1;let Ao=vi||ya;!Ao&&It.length&&(Ao=tn(It,ei));const ys=vi?Tm:ya?Nt:Gt;if(!Ao){for(const dt of It){const At=Br(),zt=So([dt],Ve);if(!zt)continue;const Ko=Br();(Ko.messages<=At.messages||Ko.lines<At.lines)&&zt()}if(Ct.length){const dt=Br(),At=V1(Ct,Ve);if(At){const zt=Br();(zt.messages<=dt.messages||zt.lines<dt.lines)&&At()}}}if(Tj(Pn),ys.length){const dt=()=>new Set(ut(Ge(r)).map(zt=>ct(zt))),At=zt=>{const Ko=q1(),zp=dt(),Vp=zt.map(nn=>({a:nn,x:nn.x,y:nn.y})),Wc=r.filter(nn=>nn.type==="label").map(nn=>({label:nn,x:nn.x,y:nn.y}));n.moveElements(zt,{x:Ve,y:0});const Wp=[...dt()].filter(nn=>!zp.has(nn));if(q1()<Ko&&Wp.length===0)return!0;for(const{a:nn,x:va,y:Uc}of Vp)(nn.x!==va||nn.y!==Uc)&&n.moveElements([nn],{x:va-nn.x,y:Uc-nn.y});for(const nn of Wc){const va=nn.x-nn.label.x,Uc=nn.y-nn.label.y;(va!==0||Uc!==0)&&n.moveElements([nn.label],{x:va,y:Uc})}return!1};if(!At(ys)&&ys.length>1)for(const zt of ys)At([zt])}}}const le=_.node.lane!==void 0?h(_.node.lane):_.node.participant!==void 0?h(_.node.participant):void 0,Re=Oe=>{if(!le)return!0;const Ot=Oe.y+Oe.height/2;return Ot>=le.y&&Ot<=le.y+le.height},Me=!Re(D)&&Re(P),Ye=Oe=>Oe.y+Oe.height/2,Ue=()=>{const Oe=D.x+D.width,Ot=P.x,Rt=Ye(P)-E.height/2,en=Ye(P)+E.height/2;return!r.getAll().some(ze=>_i(ze)&&ze.type!=="bpmn:Participant"&&ze.type!=="bpmn:Group"&&ze.type!=="bpmn:TextAnnotation"&&ze.id!==D.id&&ze.id!==P.id&&ze.id!==E.id&&ze.x<Ot&&ze.x+ze.width>Oe&&ze.y<en&&ze.y+ze.height>Rt)},at=!Me&&_.band!==void 0&&Re(P)&&!Bn(_.node.lane,_.node.participant,_.band,Ye(D))&&Bn(_.node.lane,_.node.participant,_.band,Ye(P))&&P.x>=D.x+D.width&&Ue(),Be=Me||at?P:D,Je=Be.y+Be.height/2,mt=Je-(E.y+E.height/2),Lt=_.band!==void 0,Vi=Lt?[E]:X,cn=(_.band===void 0||Bn(_.node.lane,_.node.participant,_.band,Je))&&F1(x.target)&&Vi.every(Oe=>{var Ot;return Np((Ot=G.get(Oe.id))==null?void 0:Ot.node.lane,Oe,Oe.y+Oe.height/2+mt)}),Ro=Oe=>Math.abs(Oe.y+Oe.height/2-(E.y+E.height/2))<=z/2;if(cn&&Lt){const Oe=Math.abs(mt)<=z/2?X.filter(ze=>ze.id!==E.id&&Ro(ze)):[],Ot=E.y+E.height/2,en=_.band!==void 0&&!Bn(_.node.lane,_.node.participant,_.band,Ot)?X.filter(ze=>{var Qe,_t;return ze.id!==E.id&&!Oe.includes(ze)&&((Qe=G.get(ze.id))==null?void 0:Qe.band)===_.band&&((_t=G.get(ze.id))==null?void 0:_t.node.lane)===_.node.lane&&(Math.abs(ze.y+ze.height/2-Ot)<=z/2||Bn(_.node.lane,_.node.participant,_.band,ze.y+ze.height/2))}).map(ze=>({t:ze,dy:Je-(ze.y+ze.height/2)})).filter(({dy:ze})=>ze!==0):[];if(n.moveElements(X,{x:Fe-re,y:0},void 0,ce),n.moveElements([E],{x:0,y:mt},void 0,ce),Oe.length){const ze=()=>new Set(ut(Ge(r)).map(qe=>ct(qe))),Qe=ze(),_t=r.filter(qe=>qe.type==="label").map(qe=>({label:qe,x:qe.x,y:qe.y}));n.moveElements(Oe,{x:0,y:mt});const st=ze(),It=[...st].filter(qe=>!Qe.has(qe)).length,Xe=[...Qe].filter(qe=>!st.has(qe)).length;if(It>Xe){n.moveElements(Oe,{x:0,y:-mt});for(const qe of _t){const Gt=qe.x-qe.label.x,Nt=qe.y-qe.label.y;(Gt!==0||Nt!==0)&&n.moveElements([qe.label],{x:Gt,y:Nt})}}}if(en.length){const ze=new Set(X.map(Qe=>Qe.id));for(const{t:Qe,dy:_t}of en)ge(Qe.parent,Qe,Qe.x+Qe.width/2,Qe.y+Qe.height/2+_t,ze)||n.moveElements([Qe],{x:0,y:_t})}}else n.moveElements(X,{x:Fe-re,y:cn?mt:0},void 0,ce);const Vn=w(E);if(!cn&&_.node.lane===void 0&&_.band!==void 0&&Vn){const Oe=Vn.y+he+In(`pool:${_.node.participant??""}`,_.band)*z,Ot=Oe-(E.y+E.height/2);Ot!==0&&!ge(Vn,E,E.x+E.width/2,Oe,Z)&&n.moveElements([E],{x:0,y:Ot},void 0,ce)}if(oe)n.moveElements(X,{x:oe.cx-(E.x+E.width/2),y:oe.cy-(E.y+E.height/2)},void 0,ce);else if(Vn){const Oe=(Vn.children??[]).filter(ze=>_i(ze)&&!Z.has(ze.id)&&ze.type!=="bpmn:Group"&&ze.type!=="bpmn:Participant"),Ot=(ze,Qe,_t,st,It)=>ze.x+Qe<It.x+It.width+st&&ze.x+Qe+ze.width+st>It.x&&ze.y+_t<It.y+It.height+st&&ze.y+_t+ze.height+st>It.y,Rt=Oe.find(ze=>Ot(E,0,0,0,ze)),en=Rt?void 0:ae(E);if(Rt||en){const ze=["bpmn:SequenceFlow","bpmn:MessageFlow","bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation"],Qe=r.getAll().filter(Mt=>{if(!ze.includes(Mt.type))return!1;const Pn=Mt;return jc.has(Pn.id)||!Pn.waypoints||Pn.waypoints.length<2?!1:![Pn.source,Pn.target].some(tn=>!tn||Z.has(tn.id))}),_t=(Mt,Pn,tn)=>{var vi;return Np((vi=G.get(Mt.id))==null?void 0:vi.node.lane,Mt,Mt.y+tn+Mt.height/2)&&Mt.x+Pn>=Vn.x&&Mt.x+Pn+Mt.width<=Vn.x+Vn.width&&Mt.y+tn>=Vn.y&&Mt.y+tn+Mt.height<=Vn.y+Vn.height},st=(Mt,Pn)=>X.every(tn=>_t(tn,Mt,Pn)&&!Oe.some(vi=>Ot(tn,Mt,Pn,ji,vi))&&Qe.every(vi=>{const ya={id:tn.id,type:tn.type,x:tn.x+Mt,y:tn.y+Pn,width:tn.width,height:tn.height};for(let Ao=0;Ao+1<vi.waypoints.length;Ao++)if(Po(vi.waypoints[Ao],vi.waypoints[Ao+1],ya)<ji)return!1;return!0})),It=E.y+E.height/2,Xe=[L,P.y+P.height/2].filter(Mt=>Mt!==void 0&&Math.abs(Mt-It)>=1),qe=Rt&&Q.has(Rt.id)?Rt:en==null?void 0:en.target,Gt=qe?qe.x-E.x:0,Nt=Math.max(...X.map(Mt=>Mt.x+Mt.width)),Ct=[...Gt!==0?[Gt]:[],...De!==0?[-De]:[],0],ga=$===void 0?[]:Ct.map(Mt=>Math.max(Mt,$-E.x)),ei=Mt=>Nt+Mt+Ir<=P.x,Co=[...new Set([...ga,...Ct])].filter(ei),ms=Rt&&Q.has(Rt.id)?[Rt.x+Rt.width+Ir-E.x]:[],ma=$===void 0?[]:ms.map(Mt=>Math.max(Mt,$-E.x)),Tm=[...new Set([...ma,...ms])].filter(Mt=>ei(Mt)&&!Co.includes(Mt));let no;for(const Mt of[Co,Tm]){for(const Pn of Xe){for(const tn of Mt)if(st(tn,Pn-It)){no={dx:tn,dy:Pn-It};break}if(no)break}if(no)break}if(no){const Mt=dt=>{const At=dt;return[At.edge,At.other,...Array.isArray(At.edges)?At.edges:[]].some(zt=>typeof zt=="string"&&jc.has(zt))},Pn=()=>new Set(ut(Ge(r)).filter(dt=>!Mt(dt)).map(dt=>ct(dt))),tn=Pn(),vi=r.filter(dt=>dt.type==="label").map(dt=>({label:dt,x:dt.x,y:dt.y}));n.moveElements(X,{x:no.dx,y:no.dy},void 0,ce);const ya=Pn(),Ao=[...ya].filter(dt=>!tn.has(dt)).length,ys=[...tn].filter(dt=>!ya.has(dt)).length;if(Ao>ys){n.moveElements(X,{x:-no.dx,y:-no.dy},void 0,ce);for(const dt of vi){const At=dt.x-dt.label.x,zt=dt.y-dt.label.y;(At!==0||zt!==0)&&n.moveElements([dt.label],{x:At,y:zt})}}else O&&hm.set(k.id,{exit:O,channelY:L,label:j})}}}{const Oe=new Set(X.map(Qe=>Qe.id)),Ot=new Set(Y.map(Qe=>Qe.flow.id)),Rt=20,en=Qe=>{const _t=Qe.source,st=Qe.target,It=Math.min(_t.x,st.x)-Rt,Xe=Math.max(_t.x+_t.width,st.x+st.width)+Rt,qe=Math.min(_t.y,st.y)-Rt,Gt=Math.max(_t.y+_t.height,st.y+st.height)+Rt;return Qe.waypoints.some(Nt=>Nt.x<It||Nt.x>Xe||Nt.y<qe||Nt.y>Gt)},ze=new Map;for(const Qe of X)for(const _t of[...Qe.incoming??[],...Qe.outgoing??[]])(ie.has(_t.id)||_t.id!==x.id&&Ot.has(_t.id))&&!(Oe.has(_t.source.id)&&Oe.has(_t.target.id))&&ze.set(_t.id,_t);for(const Qe of ze.values())en(Qe)&&Fc(Qe)}const Mo=Se.length?w(Se[0]):void 0;if(Mo){const Oe={assoc:U1(),overlaps:K1(Mo),crosses:Y1()},Ot=Se.map(Xe=>({st:Xe,x:Xe.x})),Rt=r.filter(Xe=>Xe.type==="label").map(Xe=>({label:Xe,x:Xe.x,y:Xe.y})),en=Math.min(...Se.flatMap(Xe=>[...Xe.incoming??[],...Xe.outgoing??[]].filter(qe=>qe.type==="bpmn:DataInputAssociation"||qe.type==="bpmn:DataOutputAssociation").map(qe=>(qe.source===Xe?qe.target:qe.source).x))),ze=new Set(Se.map(Xe=>Xe.id)),Qe=(Mo.children??[]).filter(_i).filter(Xe=>!ze.has(Xe.id));let _t=en;for(const Xe of[...Se].sort((qe,Gt)=>qe.x-Gt.x)){let qe=_t;for(let Gt=0;Gt<100;Gt++){const Nt=Qe.find(Ct=>qe<Ct.x+Ct.width+Gi&&qe+Xe.width+Gi>Ct.x&&Xe.y<Ct.y+Ct.height&&Xe.y+Xe.height>Ct.y);if(!Nt)break;qe=Nt.x+Nt.width+Gi}qe!==Xe.x&&n.moveElements([Xe],{x:qe-Xe.x,y:0}),_t=qe+Xe.width+Gi}const st=_t+150-(Mo.x+Mo.width);st>0&&ds(Mo,Mo.width+st);const It={assoc:U1(),overlaps:K1(Mo),crosses:Y1()};if(It.assoc>=Oe.assoc||It.overlaps>Oe.overlaps||It.crosses>Oe.crosses){for(const{st:Xe,x:qe}of Ot)Xe.x!==qe&&n.moveElements([Xe],{x:qe-Xe.x,y:0});st>0&&ds(Mo,Mo.width-st);for(const Xe of Rt){const qe=Xe.x-Xe.label.x,Gt=Xe.y-Xe.label.y;(qe!==0||Gt!==0)&&n.moveElements([Xe.label],{x:qe,y:Gt})}}}}for(const[x,_]of sm){const E=h(x);if(!E)continue;const k=_.container,D=Math.abs(E.y+E.height/2-k.y-_.relCy)>=.5,P=E.label,N=Math.min(E.y,P&&!P.hidden?P.y:E.y),O=Math.max(E.y+E.height,P&&!P.hidden?P.y+P.height:0);if(D&&N>=k.y&&O<=k.y+k.height)continue;const L=E.y;_.grow(),E.y!==L&&n.moveElements([E],{x:0,y:L-E.y},void 0,{autoResize:!1})}const J1=(x,_)=>{const E=_.target===x,k=y(_.source),D=y(_.target),P=E?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(k,D,_.id?{type:P,businessObject:i.create(P,{id:_.id})}:{type:P})},gm=x=>{for(const _ of b){if(!_.participant.blackBox)continue;const E=h(_.participant.id);if(!E)continue;const k=[];for(const P of B){const N=P.flow.source===_.participant.id?P.flow.target:P.flow.target===_.participant.id?P.flow.source:void 0,O=N?h(N):void 0;O&&typeof O.x=="number"&&O.type!=="bpmn:Participant"&&k.push(O)}if(!k.length)continue;if(!x&&_.order===void 0){const P=(()=>{var O;const N=new Map;for(const L of k){const j=w(L);if(!j)continue;const $=N.get(j.id);$?$.n+=1:N.set(j.id,{shape:j,n:1})}return(O=[...N.values()].sort((L,j)=>j.n-L.n)[0])==null?void 0:O.shape})();if(P){const N=j=>j.reduce(($,U)=>$+U,0)/j.length,O=N(k.map(j=>j.y+j.height/2))<P.y+P.height/2,L=r.filter(j=>j.type==="bpmn:Participant"&&j.id!==_.participant.id&&j.id!==P.id).filter(j=>O?j.y+j.height<=P.y+5:j.y>=P.y+P.height-5);if(L.length){const j=[...L.reduce((ye,oe)=>ye.set(oe.y,(ye.get(oe.y)??0)+1),new Map)].sort((ye,oe)=>oe[1]-ye[1]||(O?oe[0]-ye[0]:ye[0]-oe[0]))[0][0],$=Math.min(E.width,GT),U=zT,Q=k.map(ye=>ye.x+ye.width/2),ae=Math.round(N(Q)-$/2),X=Math.max(...Q)+Yd,Z=ye=>({x:ye,width:Math.max($,X-ye)}),ce=L.filter(ye=>Math.min(ye.y+ye.height,j+U)-Math.max(ye.y,j)>0),re=ye=>{const oe=Z(ye);return ce.some(xe=>xe.x<oe.x+oe.width&&oe.x<xe.x+xe.width)},q=ye=>{const oe=Z(ye);return Q.filter(xe=>xe>=oe.x+10&&xe<=oe.x+oe.width-10).length},fe=(()=>{if(!re(ae))return ae;const ye=q(ae);return ce.flatMap(oe=>[oe.x+oe.width+Ov,oe.x-Ov-$]).map(oe=>Math.round(oe)).filter(oe=>!re(oe)&&q(oe)>=ye).sort((oe,xe)=>Math.abs(oe-ae)-Math.abs(xe-ae))[0]??ae})();if(fe!==E.x||j!==E.y||$!==E.width||U!==E.height){const ye=()=>new Set(ut(Ge(r)).map(Fe=>ct(Fe))),oe=ye(),xe={x:E.x,y:E.y,width:E.width,height:E.height};n.resizeShape(E,{x:fe,y:j,width:$,height:U});const me=ye(),_e=[...me].filter(Fe=>!oe.has(Fe)).length,De=[...oe].filter(Fe=>!me.has(Fe)).length;_e>De&&n.resizeShape(E,xe)}}}}const D=Math.max(...k.map(P=>P.x+P.width/2))+Yd;if(D>E.x+E.width&&n.resizeShape(E,{x:E.x,y:E.y,width:D-E.x,height:E.height}),!!x)for(const P of B){const N=h(P.flow.id),O=P.flow.source===_.participant.id?P.flow.target:P.flow.target===_.participant.id?P.flow.source:void 0,L=O?h(O):void 0;if(!N||!L||L.type==="bpmn:Participant")continue;const j=L.x+L.width/2;j<E.x+10||j>E.x+E.width-10||W1(N,E,L)}}};gm(!1);for(const x of B){const _=x.flow;n.connect(y(_.source),y(_.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:_.id,name:_.name})})}{const E=new Set([...Y.map(L=>L.flow.id),...B.map(L=>L.flow.id)].filter(L=>!!L)),k=r.filter(L=>!!L.waypoints),D=(L,j)=>Math.abs(j.x-L.x)<2?"L":Math.abs(j.x-(L.x+L.width))<2?"R":Math.abs(j.y-L.y)<2?"T":Math.abs(j.y-(L.y+L.height))<2?"B":void 0,P=new Map,N=(L,j,$)=>{if(!L||!j||typeof L.x!="number")return;const U=D(L,j);if(!U)return;let Q=P.get(L.id);Q||P.set(L.id,Q=new Map),Q.set(U,[...Q.get(U)??[],$])};for(const L of k){const j=L.waypoints;!j||j.length<2||(N(L.source,j[0],{id:L.id,dir:"out"}),N(L.target,j[j.length-1],{id:L.id,dir:"in"}))}const O=new Set;for(const[L,j]of P){const $=h(L);if(!$||typeof $.x!="number")continue;const U=q=>{var ye;const fe=(ye=h(q.id))==null?void 0:ye.source;return!!fe&&typeof fe.x=="number"&&fe.x+fe.width/2>$.x+$.width/2};if(![...j.values()].some(q=>q.length>=3&&q.some(fe=>fe.dir==="out")&&q.some(fe=>fe.dir==="in"&&E.has(fe.id)&&U(fe))))continue;const ae=w($);if(!ae||O.has(ae.id)||(ae.children??[]).some(q=>q.type==="bpmn:Lane"))continue;const X=(SR=j.get("T"))!=null&&SR.length?(RR=j.get("B"))!=null&&RR.length?void 0:"B":"T";if(!X||(X==="T"?$.y-ae.y:ae.y+ae.height-($.y+$.height))>=z)continue;const ce=(ae.children??[]).filter(q=>!("waypoints"in q&&q.waypoints)&&q.type!=="label"&&typeof q.x=="number"),re=ae.y+ae.height;n.resizeShape(ae,{x:ae.x,y:ae.y,width:ae.width,height:ae.height+z}),Fi(re,ae.id,z),X==="T"&&ce.length&&n.moveElements(ce,{x:0,y:z}),O.add(ae.id)}}const mm=20,ym=4,Lj=3,Ij=2,Q1=2,vm=[10,30,80],Qn=()=>{const x=Ge(r);return{bad:ut(x).filter(_=>_.kind==="edge-crosses-shape"||_.kind==="edge-overlap-opposite"||_.kind==="edge-overlap-mixed").length,crossings:Ey(x),straight:x.edges.filter(_=>_.type==="bpmn:MessageFlow"&&_.waypoints.length===2).length}},to=x=>{const _=Ge(r),E=_.edges.find(k=>k.id===x);return E?Tt(E,hn(_)).length:0},da=x=>to(x)>0,fa=x=>Ge(r).edges.filter(_=>_.type==="bpmn:MessageFlow"&&_.id!==x&&_.waypoints.length===2).length,eR=(x,_,E)=>So([{subtree:x,pool:_}],E),tR=(x,_)=>_.bad>x.bad||_.crossings>x.crossings&&_.straight<=x.straight&&_.bad>=x.bad,Nr=(x,_)=>tR(x,_)||_.straight<x.straight,qo=(x,_,E=()=>!0,k=tR,D=!1)=>{const P=Qn(),N=So(x,_,D);if(!N)return!1;const O=Qn();return k(P,O)||!E()?(N(),!1):!0},xm=(x,_,E,k=()=>!0)=>qo([{subtree:x,pool:_}],E,k),Yo=x=>{var _;return!!((_=G.get(x))!=null&&_.node.participant)},fs=new Map;for(const x of B){if(!Yo(x.flow.target))continue;const _=fs.get(x.flow.target)??[];_.push(x),fs.set(x.flow.target,_)}const Hc=[...fs.keys()],bm=new Set(Y.map(x=>x.flow.target)),nR=x=>$p.findIndex(({op:_})=>_.participant.id===x);Hc.sort((x,_)=>{var D,P;const E=bm.has(x)?1:0,k=bm.has(_)?1:0;return E!==k?E-k:nR((D=G.get(x))==null?void 0:D.node.participant)-nR((P=G.get(_))==null?void 0:P.node.participant)});const zi=x=>x.x+x.width/2,Bj=x=>{const _=new Map;for(const D of r.getAll()){const P=D;if(!P.waypoints||!P.source||!P.target)continue;(_.get(P.source.id)??_.set(P.source.id,[]).get(P.source.id)).push(P.target.id)}const E=new Set([x]),k=[x];for(let D=0;D<k.length;D++)for(const P of _.get(k[D])??[])E.has(P)||(E.add(P),k.push(P));return E},Nj=(x,_)=>{const E=Bj(_);let k;for(const D of r.getAll()){const P=D;if(P.type!=="bpmn:MessageFlow"||!P.source||!P.target||P.target.id!==x||E.has(P.source.id))continue;const N=P.source;if(typeof N.x!="number"||N.type==="bpmn:Participant")continue;const O=zi(N);(k===void 0||O>k)&&(k=O)}return k},wm=(x,_)=>{const E=h(x.flow.source);if(E)return E.type==="bpmn:Participant"?Nj(E.id,_):zi(E)},iR=x=>{let _;for(const E of fs.get(x)??[]){const k=wm(E,x);k!==void 0&&(!_||k>_.cx)&&(_={op:E,cx:k})}return _==null?void 0:_.op},$j=x=>{const _=iR(x),E=h(x),k=_?wm(_,x):void 0;return E&&k!==void 0?k-zi(E):void 0},oR=x=>{const _=$j(x);return _!==void 0&&Math.abs(_)<mm},Gc=(x,_,E,k,D)=>{var P;for(let N=!0;N;){N=!1;for(const O of B){if(O.flow.id===E)continue;const L=_.has(O.flow.source),j=_.has(O.flow.target);if(L===j||k(L?O.flow.source:O.flow.target))continue;const $=L?O.flow.target:O.flow.source;if(D($)||!Yo($))continue;const U=h(O.flow.id);if(!(U!=null&&U.waypoints)||U.waypoints.length!==2)continue;const Q=h($),ae=(P=G.get($))==null?void 0:P.node.participant;if(!Q||!ae)continue;const X=Hi($,Z=>Z.x>=Q.x).filter(Z=>!_.has(Z.id));if(!(!X.length||X.some(Z=>D(Z.id)))){for(const Z of X)_.add(Z.id);x.set(ae,[...x.get(ae)??[],...X]),N=!0}}}return[...x].map(([N,O])=>({subtree:O,pool:y(N)}))},_m=(x,_,E,k,D)=>Gc(new Map([[_,[...x]]]),new Set(x.map(P=>P.id)),k,P=>P===E,P=>P===D),Em=x=>{const _=iR(x);if(!_)return null;const E=h(x),k=h(_.flow.source),D=wm(_,x);if(!E||!k||D===void 0)return null;const P=D-zi(E);if(P>=mm){const N=G.get(x).node.participant,O=Hi(x,j=>j.x>=E.x),L=Hi(x,j=>j.x>=E.x&&!oR(j.id));return{groups:_m(O,N,x,_.flow.id,_.flow.source),dx:P,cut:L.length<O.length?_m(L,N,x,_.flow.id,_.flow.source):void 0}}if(-P>=mm&&Yo(_.flow.source)){const N=G.get(_.flow.source).node.participant,O=Hi(_.flow.source,L=>L.x>=k.x&&!oR(L.id));return{groups:_m(O,N,_.flow.source,_.flow.id,x),dx:-P}}return null},rR=()=>Hc.map(x=>({id:x,plan:Em(x)})).filter(x=>!!x.plan).sort((x,_)=>Math.min(...x.plan.groups.flatMap(E=>E.subtree.map(k=>k.x)))-Math.min(..._.plan.groups.flatMap(E=>E.subtree.map(k=>k.x)))).map(x=>x.id),aR=()=>{var k;const x=r.getAll().filter(_i).filter(D=>D.type!=="bpmn:Participant"&&D.type!=="bpmn:Group").map(D=>[D.x,D.x+D.width]).sort((D,P)=>D[0]-P[0]);let _=((k=x[0])==null?void 0:k[1])??0,E=0;for(const[D,P]of x.slice(1))D>_&&(E=Math.max(E,D-_)),_=Math.max(_,P);return E},sR=x=>{if(!x.cut)return So(x.groups,x.dx);const _=So(x.groups,x.dx,!0);if(!_)return null;const E=Qn(),k=aR();_();const D=So(x.cut,x.dx,!0);if(D){const P=Qn();if(P.bad<=E.bad&&P.crossings<=E.crossings&&P.straight>=E.straight&&aR()<k)return D;D()}return So(x.groups,x.dx)};for(let x=0;x<3;x++){const _=Qn(),E=[];for(const D of rR()){const P=Em(D);if(!P)continue;const N=sR(P);N&&E.push(N)}if(!E.length)break;if(!Nr(_,Qn()))continue;for(const D of E.reverse())D();let k=!1;for(const D of rR()){const P=Em(D);if(!P)continue;const N=Qn(),O=sR(P);O&&(Nr(N,Qn())?O():k=!0)}if(!k)break}for(const x of Hc){if(bm.has(x))continue;const _=G.get(x);if(!_||_.node.lane!==void 0)continue;const E=bt(_);if(E===void 0)continue;const k=h(x),D=k?w(k):void 0;if(!k||!D)continue;const P=D.y+he+In(`pool:${_.node.participant??""}`,E)*z,N=P-(k.y+k.height/2);N!==0&&!ge(D,k,k.x+k.width/2,P)&&n.moveElements([k],{x:0,y:N})}const zc=()=>{const x=r.filter(k=>k.type==="bpmn:Participant"),_=new Map(x.map(k=>[k.id,k]));let E=0;for(const{pools:[k,D]}of Md(x)){const P=_.get(k),N=_.get(D);E+=(Math.min(P.x+P.width,N.x+N.width)-Math.max(P.x,N.x))*(Math.min(P.y+P.height,N.y+N.height)-Math.max(P.y,N.y))}return E},Fj=/(Task|Event|Gateway|CallActivity|SubProcess)$/,jp=()=>{const x=Ge(r),_=new Set(ut(x).flatMap(D=>D.kind==="edge-crosses-shape"?[`${D.edge}|${D.shape}`]:[])),E=x.shapes.filter(D=>!D.container&&Fj.test(D.type)),k=new Set;for(const D of x.edges){if(D.type!=="bpmn:SequenceFlow"&&D.type!=="bpmn:MessageFlow")continue;const P=new Set(D.endpoints);for(const N of[D.waypoints[0],D.waypoints[D.waypoints.length-1]])for(const O of E)O.x-4<=N.x&&N.x<=O.x+O.width+4&&O.y-4<=N.y&&N.y<=O.y+O.height+4&&P.add(O.id);for(const N of E)if(!(P.has(N.id)||_.has(`${D.id}|${N.id}`))){for(let O=0;O+1<D.waypoints.length;O++)if(Po(D.waypoints[O],D.waypoints[O+1],N)<=dm){k.add(`${D.id}|${N.id}`);break}}}return k},Hp=()=>r.filter(x=>x.type==="bpmn:SequenceFlow").filter(x=>{const _=x.source,E=x.target;return!!_&&!!E&&E.x+E.width<_.x}).length,Vc=new Set,cR=new Set;for(let x=0,_=!0;_&&x<Lj;x++){_=!1;for(const E of Hc.flatMap(k=>fs.get(k)??[])){if(Vc.has(E.flow.id)||!da(E.flow.id))continue;const k=h(E.flow.target);if(!k)continue;const D=y(G.get(E.flow.target).node.participant),P=Hi(E.flow.target,X=>X.x>=k.x),N=k.width+ee,O=to(E.flow.id),L=fa(E.flow.id),j=zc(),$=jp(),U=h(E.flow.source),Q=U?G.get(U.id):void 0;let ae;if(U&&Q){const X=y(Q.node.participant),Z=Hi(U.id,re=>re.x>=U.x),ce=new Set(P.map(re=>re.id));X!==D&&!Z.some(re=>ce.has(re.id))&&(ae={subtree:Z,pool:X})}for(let X=1;X<=ym;X++){let Z=!1;const ce=()=>to(E.flow.id)>=O||zc()>j?!1:fa(E.flow.id)>=L?!Z&&[...jp()].some(re=>!$.has(re))?(Z=!0,!1):!0:(cR.add(E.flow.id),!1);if(xm(P,D,N*X,ce)){Vc.add(E.flow.id),_=!0;break}if(Z){if(ae){const re=Qn().crossings,q=Hp(),fe=()=>to(E.flow.id)<O&&zc()<=j&&fa(E.flow.id)>=L&&![...jp()].some(ye=>!$.has(ye))&&Hp()<=q&&Qn().crossings<=re;if(qo([{subtree:P,pool:D},ae],N*X,fe)){Vc.add(E.flow.id),_=!0;break}}if(xm(P,D,N*X,ce)){Vc.add(E.flow.id),_=!0;break}}}}}for(const x of Hc.flatMap(_=>fs.get(_)??[])){if(Vc.has(x.flow.id)||!cR.has(x.flow.id)||!da(x.flow.id))continue;const _=h(x.flow.target);if(!_)continue;const E=y(G.get(x.flow.target).node.participant),k=Hi(x.flow.target,Q=>Q.x>=_.x),D=new Set(k.map(Q=>Q.id)),P=new Map;for(const Q of r.filter(ae=>ae.type==="bpmn:MessageFlow")){if(((MR=Q.waypoints)==null?void 0:MR.length)!==2||!Q.source||!Q.target)continue;const ae=D.has(Q.source.id);if(ae===D.has(Q.target.id))continue;const X=ae?Q.target:Q.source,Z=(CR=G.get(X.id))==null?void 0:CR.node.participant;!Z||P.has(X.id)||P.set(X.id,{subtree:[X],pool:y(Z)})}if(!P.size)continue;const N=_.width+ee,O=to(x.flow.id),L=fa(x.flow.id),j=zc(),$=Hp(),U=()=>to(x.flow.id)<O&&fa(x.flow.id)>=L&&zc()<=j&&Hp()<=$;for(let Q=1;Q<=Ij&&!qo([{subtree:k,pool:E},...P.values()],N*Q,U);Q++);}const Sm=B.map(x=>({id:x.flow.id,source:x.flow.source,target:x.flow.target,preexisting:!1})),lR=new Set(Sm.map(x=>x.id));for(const x of r.filter(_=>_.type==="bpmn:MessageFlow"))lR.has(x.id)||!x.source||!x.target||x.source.type==="bpmn:Participant"!=(x.target.type==="bpmn:Participant")&&Sm.push({id:x.id,source:x.source.id,target:x.target.id,preexisting:!0});for(const x of Sm){if(!da(x.id))continue;const _=h(x.source),E=h(x.target);if(!_||!E)continue;let k,D,P,N;const O=_.type==="bpmn:Participant",L=E.type==="bpmn:Participant";if(O!==L){const[$,U]=O?[E,_]:[_,E];if(k=zi($),k<U.x||k>U.x+U.width)continue;if([D,P]=$.y<U.y?[$.y+$.height,U.y]:[U.y+U.height,$.y],!x.preexisting){const Q=w($);if(!Q)continue;N=[Math.min(Q.y,U.y),Math.max(Q.y,U.y)]}}else{if(O||(k=_.x+_.width/2,Math.abs(k-(E.x+E.width/2))>15))continue;[D,P]=_.y<E.y?[_.y+_.height,E.y]:[E.y+E.height,_.y]}const j=[...G.values()].map($=>h($.node.id)).filter($=>!!$&&$.id!==_.id&&$.id!==E.id).filter($=>$.x<=k&&k<=$.x+$.width&&$.y+$.height>D&&$.y<P).sort(($,U)=>$.x-U.x);for(const $ of j){const U=(AR=G.get($.id))==null?void 0:AR.node.participant,Q=U?h(U):void 0;if(!U||!Q||N&&!(Q.y>N[0]&&Q.y<N[1]))continue;const ae=[...G.values()].filter(xe=>xe.node.participant===U).map(xe=>xe.node.id),X=xe=>xe.map(me=>h(me)).filter(me=>!!me),ce=[Cj($.id,xe=>{var me;return((me=G.get(xe.id))==null?void 0:me.node.participant)===U}),X(ae)].filter(xe=>xe.length).map(xe=>[{subtree:xe,pool:Q}]);if(x.preexisting||N){const xe=X(ae);xe.length&&ce.push(Gc(new Map([[U,[...xe]]]),new Set(xe.map(me=>me.id)),x.id,()=>!1,me=>me===_.id||me===E.id))}const re=$.width+ee,q=to(x.id),fe=fa(x.id),ye=()=>to(x.id)<q&&fa(x.id)>=fe;let oe=!1;for(const xe of ce){for(let me=1;me<=ym;me++)if(qo(xe,re*me,ye)){oe=!0;break}if(oe)break}if(!da(x.id))break}}const hs=()=>{var _;const x=new Set;for(const E of ut(Ge(r)))E.kind!=="edge-crosses-shape"||lR.has(E.edge)||((_=h(E.edge))==null?void 0:_.type)==="bpmn:MessageFlow"&&x.add(`${E.edge}>${E.shape}`);return x},Rm=(x,_)=>Qn().bad>=x&&[...hs()].some(E=>!_.has(E)),Mm=x=>{var _,E;return to(x)===0&&((E=(_=h(x))==null?void 0:_.waypoints)==null?void 0:E.length)===2},jj=(x,_,E)=>{const k=new Set(x.flatMap(P=>P.subtree.map(N=>N.id))),D=[...hs()].filter(P=>!E.has(P)).map(P=>P.split(">")[1]);return[...new Set(D)].filter(P=>k.has(P)&&P!==_.source&&P!==_.target)},Hj=(x,_,E,k,D)=>{const P=x.map(j=>({...j,subtree:j.subtree.filter($=>!D.includes($.id))})).filter(j=>j.subtree.length),N=new Set(P.flatMap(j=>j.subtree.map($=>$.id))),O=()=>D.every(j=>{const $=h(j);return!!$&&Y.filter(U=>U.flow.target===j&&N.has(U.flow.source)).every(U=>{const Q=h(U.flow.source);return!!Q&&Q.x+Q.width<=$.x})});return qo(P,_,()=>Mm(E.id)&&[...hs()].every(j=>k.has(j))&&O(),Nr,!0)},Gp=(x,_,E,k)=>{let D=0;for(const P of x){const N=h(P.id);for(const O of[...(N==null?void 0:N.incoming)??[],...(N==null?void 0:N.outgoing)??[]]){if(O.type!=="bpmn:SequenceFlow")continue;const L=O.waypoints??[];for(let j=0;j+1<L.length;j++){const $=L[j],U=L[j+1];if(Math.abs($.y-U.y)<.5)Math.min($.x,U.x)<_&&_<Math.max($.x,U.x)&&E<$.y&&$.y<k&&D++;else if(Math.abs($.x-U.x)>=.5){const Q=(_-$.x)/(U.x-$.x);if(Q<=0||Q>=1)continue;const ae=$.y+Q*(U.y-$.y);E<ae&&ae<k&&D++}}}}return D};for(const x of B){if(!da(x.flow.id))continue;const _=h(x.flow.id);if(((TR=_==null?void 0:_.waypoints)==null?void 0:TR.length)!==2)continue;const E=h(x.flow.source),k=h(x.flow.target);if(!E||!k||E.type==="bpmn:Participant"||k.type==="bpmn:Participant"||!Yo(x.flow.source)||!Yo(x.flow.target)||Math.abs(zi(E)-zi(k))>Q1)continue;const D=zi(E),P=_.waypoints.map(re=>re.y),[N,O]=[Math.min(...P),Math.max(...P)],L=hn(Ge(r)).filter(re=>re.id!==E.id&&re.id!==k.id&&re.x<D&&D<re.x+re.width&&N<re.y+re.height&&re.y<O);if(!L.length)continue;const j=(PR=G.get(x.flow.source))==null?void 0:PR.node.participant,$=(kR=G.get(x.flow.target))==null?void 0:kR.node.participant;if(!j||!$)continue;const U=new Map;for(const[re,q,fe]of[[x.flow.source,E,j],[x.flow.target,k,$]]){const ye=U.get(fe)??[],oe=Hi(re,xe=>xe.x>=q.x).filter(xe=>!ye.some(me=>me.id===xe.id));U.set(fe,[...ye,...oe])}const Q=new Set([...U.values()].flat().map(re=>re.id)),ae=Gc(U,Q,x.flow.id,re=>re===x.flow.source||re===x.flow.target,()=>!1),X=Math.max(...L.map(re=>re.x+re.width)),Z=Math.min(...L.map(re=>re.x)),ce=vm[0];if(Gp(L,X+ce,N,O)>0&&Gp(L,Z-ce,N,O)===0){let re=!1;for(const q of vm){const fe=Z-q-D;if(fe>=0)continue;const ye=Qn().bad,oe=hs();if(re=qo(ae,fe,()=>Mm(x.flow.id)&&!Rm(ye,oe),Nr),re)break}if(re){f.add(x.flow.id);continue}}for(const re of vm){const q=X+re-D;if(q<=0)continue;const fe=Qn().bad,ye=hs();let oe=[],xe=!0;const me=()=>!Mm(x.flow.id)||xe&&(oe=jj(ae,x.flow,ye),oe.length)?!1:!Rm(fe,ye);if(qo(ae,q,me,Nr))break;if(oe.length&&(Hj(ae,q,x.flow,ye,oe)||(xe=!1,qo(ae,q,me,Nr))))break}}const uR=x=>{const _=D=>D.y+D.height/2,E=()=>({...Qn(),grazes:jp()}),k=[];for(const D of G.keys()){if(!Yo(D)||x&&!x.has(D))continue;const P=Y.filter(L=>L.flow.target===D);if(P.length!==1)continue;const N=h(P[0].flow.source),O=h(D);!N||!O||!G.has(N.id)||Math.abs(_(N)-_(O))>1||O.x-(N.x+N.width)<=ee+1||k.push({id:D,pred:N,node:O})}k.sort((D,P)=>D.node.x-P.node.x);for(const{id:D}of k){const P=G.get(D),N=h(D),O=h(Y.find(q=>q.flow.target===D).flow.source);if(!N||!O)continue;const L=N.x-(O.x+O.width);if(L<=ee+1)continue;const j=y(P.node.participant),$=Hi(D,q=>q.x>=N.x),U=-(L-ee),Q=(q,fe)=>fe.bad>q.bad||fe.crossings>q.crossings||fe.crossings===q.crossings&&fe.bad===q.bad||fe.straight<q.straight||[...fe.grazes].some(ye=>!q.grazes.has(ye)),ae=Gc(new Map([[P.node.participant,[...$]]]),new Set($.map(q=>q.id)),"",()=>!1,()=>!1),X=ae.some(q=>q.pool!==j)||ae.reduce((q,fe)=>q+fe.subtree.length,0)>$.length,Z=E(),ce=eR($,j,U);if(!ce)continue;const re=E();if(X&&!Q(Z,re)){ce();const q=So(ae,U);if(q){const fe=E();if(!Q(Z,fe)&&fe.bad<=re.bad&&fe.crossings<=re.crossings)continue;q()}eR($,j,U);continue}Q(Z,re)&&ce()}};uR(),gm(!0);const Gj=new Set(b.filter(x=>x.participant.blackBox).map(x=>x.participant.id)),pR=x=>{const _=Ge(r),E=hn(_);return _.edges.filter(k=>{if(k.type!=="bpmn:MessageFlow"||k.id===x)return!1;if(k.waypoints.length===2)return!Tt(k,E).length;const D=h(k.id),[P,N]=[D==null?void 0:D.source,D==null?void 0:D.target];if(!P||!N||P.type==="bpmn:Participant"==(N.type==="bpmn:Participant"))return!1;const[O,L]=P.type==="bpmn:Participant"?[P,N]:[N,P];if(!Gj.has(O.id))return!1;const j=zi(L);if(j<=O.x+O.width-10)return!1;const $=O.y>L.y,U=[{x:j,y:$?L.y+L.height:L.y},{x:j,y:$?O.y:O.y+O.height}];return!Tt({...k,waypoints:U},E).length}).length};let dR=!1;for(const x of B){if(!da(x.flow.id))continue;const _=h(x.flow.source),E=h(x.flow.target);if(!_||!E)continue;const k=_.type==="bpmn:Participant";if(k===(E.type==="bpmn:Participant"))continue;const[D,P]=k?[E,_]:[_,E],N=zi(D);if(N<P.x+10||N>P.x+P.width-10)continue;const O=(OR=G.get(D.id))==null?void 0:OR.node.participant;if(!O)continue;const[L,j]=D.y<P.y?[D.y+D.height,P.y]:[P.y+P.height,D.y],$=[...G.values()].filter(X=>X.node.participant===O&&X.node.id!==D.id).map(X=>h(X.node.id)).filter(X=>!!X&&X.x<N&&N<X.x+X.width&&X.y+X.height>L&&X.y<j).sort((X,Z)=>X.x-Z.x);if(!$.length)continue;const U=hn(Ge(r)).filter(X=>X.id!==D.id&&X.id!==P.id);let Q=!1;for(let X=D.x+10;X<=D.x+D.width-10&&!Q;X+=5)Q=!U.some(Z=>Z.x<X&&X<Z.x+Z.width&&Z.y<j&&Z.y+Z.height>L);if(Q)continue;const ae=y(O);for(const X of $){const Z=Hi(X.id,ye=>ye.x>=X.x);if(Z.some(ye=>ye.id===D.id))continue;const ce=X.width+ee,re=to(x.flow.id),q=pR(x.flow.id),fe=()=>to(x.flow.id)<re&&pR(x.flow.id)>=q;for(let ye=1;ye<=ym;ye++)if(xm(Z,ae,ce*ye,fe)){dR=!0;break}if(!da(x.flow.id))break}}dR&&gm(!0);const gs=40;{const E=/(Task|Event|Gateway|CallActivity|SubProcess)$/,k=O=>{var X,Z;const L=h(O),j=L==null?void 0:L.waypoints;if(!L||!j||j.length!==2||Math.abs(j[0].x-j[1].x)>.5)return[];const $=j[0].x,U=Math.min(j[0].y,j[1].y),Q=Math.max(j[0].y,j[1].y),ae=[];for(const ce of hn(Ge(r))){if(!E.test(ce.type)||ce.id===((X=L.source)==null?void 0:X.id)||ce.id===((Z=L.target)==null?void 0:Z.id))continue;const re=ce.y+ce.height/2;if(!(U<re&&re<Q))continue;let q,fe;if($<=ce.x)q="L",fe=ce.x-$;else if($>=ce.x+ce.width)q="R",fe=$-ce.x-ce.width;else continue;if(fe>80||!Gp([ce],$,U,Q))continue;const ye=q==="R"?ce.x-fe:ce.x+ce.width+fe;Gp([ce],ye,U,Q)===0&&ae.push({id:ce.id,side:q,d:fe,x:ce.x,width:ce.width,col:$})}return ae.sort((ce,re)=>ce.d-re.d)},D=()=>B.reduce((O,L)=>O+k(L.flow.id).length,0),P=O=>{const L=Ge(r),j=L.edges.find($=>$.id===O);return j?Pa(j,L.edges.filter($=>$.type==="bpmn:SequenceFlow")):0},N=()=>{var ae,X;const O=Ge(r),L=Z=>Z.map(h).filter(ce=>!!ce&&typeof ce.x=="number"),j=(Z,ce)=>{const re=Math.min(...ce.map(oe=>oe.x))-gs,q=Math.min(...ce.map(oe=>oe.y))-gs,fe=Math.max(...ce.map(oe=>oe.x+oe.width))+gs,ye=Math.max(...ce.map(oe=>oe.y+oe.height))+gs;return{id:Z,type:"bpmn:Group",x:re,y:q,width:fe-re,height:ye-q,container:!0,attached:!1}},$=[];for(const Z of V){const ce=L(Z.group.members??[]);ce.length&&$.push(j(Z.group.id,ce))}const U=new Map(Vt(e,"group.update").map(Z=>[Z.id,Z]));for(const Z of r.filter(ce=>ce.type==="bpmn:Group")){const ce=(ae=U.get(Z.id))==null?void 0:ae.members;if(ce){const oe=L(ce);oe.length&&$.push(j(Z.id,oe));continue}const q=(((X=Z.businessObject.extensionElements)==null?void 0:X.values)??[]).find(oe=>oe.$type==="bwl:Members"),fe=L(((q==null?void 0:q.refs)??"").split(" ").filter(Boolean)),ye=fe.some(oe=>oe.x<Z.x||oe.y<Z.y||oe.x+oe.width>Z.x+Z.width||oe.y+oe.height>Z.y+Z.height);$.push(fe.length&&ye?j(Z.id,fe):{id:Z.id,type:"bpmn:Group",x:Z.x,y:Z.y,width:Z.width,height:Z.height,container:!0,attached:!1})}const Q=ut({...O,shapes:[...O.shapes.filter(Z=>Z.type!=="bpmn:Group"),...$]},{includeObservationOnly:!0});return{cuts:Q.filter(Z=>Z.kind==="group-cuts-shape").length,along:Q.filter(Z=>Z.kind==="edge-along-group-boundary").length}};for(const O of B)for(let L=0;L<3;L++){const j=k(O.flow.id).filter(q=>q.d>10);if(!j.length)break;const $=h(O.flow.source),U=h(O.flow.target);if(!$||!U||$.type==="bpmn:Participant"||U.type==="bpmn:Participant"||!Yo(O.flow.source)||!Yo(O.flow.target)||Math.abs(zi($)-zi(U))>Q1)break;const Q=(DR=G.get(O.flow.source))==null?void 0:DR.node.participant,ae=(LR=G.get(O.flow.target))==null?void 0:LR.node.participant;if(!Q||!ae)break;const X=new Map;for(const[q,fe,ye]of[[O.flow.source,$,Q],[O.flow.target,U,ae]]){const oe=X.get(ye)??[],xe=Hi(q,me=>me.x>=fe.x).filter(me=>!oe.some(_e=>_e.id===me.id));X.set(ye,[...oe,...xe])}const Z=new Set([...X.values()].flat().map(q=>q.id)),ce=Gc(X,Z,O.flow.id,q=>q===O.flow.source||q===O.flow.target,()=>!1);let re=!1;for(const q of j)if(!Z.has(q.id)){for(const fe of[...new Set([Math.max(10,Math.round(q.d)),30,80])].sort((ye,oe)=>ye-oe)){const ye=q.side==="L"?q.x+q.width+fe-q.col:q.x-fe-q.col,oe=Qn(),xe=hs(),me=D(),_e=P(O.flow.id),De=N(),Fe=So(ce,ye,!0);if(!Fe)continue;if((()=>{if(Nr(oe,Qn())||k(O.flow.id).some(Se=>Se.id===q.id)||D()>=me||P(O.flow.id)>=_e||Rm(oe.bad,xe))return!0;const Ve=N();return Ve.cuts>De.cuts||Ve.along>De.along})()){Fe();continue}re=!0;break}if(re)break}if(!re)break}}{const x=O=>!("waypoints"in O&&O.waypoints)&&/(Task|Event|Gateway)$/.test(O.type)&&typeof O.x=="number",_=O=>(O??[]).filter(L=>L.type==="bpmn:SequenceFlow"),E=(O,L)=>O.y+(L.get(O.id)??0),k=(O,L,j)=>{var ae;const $=O.x+O.width/2,U=E(O,j),Q=E(L,j);return Q<=U?[]:(((ae=L.parent)==null?void 0:ae.children)??[]).filter(X=>{if(!x(X)||X.id===O.id||X.id===L.id||!(X.x<$&&$<X.x+X.width))return!1;const Z=E(X,j);return Z>=U+O.height&&Z+X.height<=Q})},D=()=>{const O=[];for(const L of Y){const j=G.get(L.flow.target);if(!j||!G.has(L.flow.source)||!$e.has(`pool:${j.node.participant??""}`))continue;const $=h(L.flow.source),U=h(L.flow.target);!$||!U||!U.parent||U.parent!==$.parent||!/Gateway$/.test($.type)||_(U.incoming).length!==1||Math.abs($.x+$.width/2-(U.x+U.width/2))>1||U.y<=$.y+$.height||O.push([$,U])}return O},P=O=>D().reduce((L,[j,$])=>L+k(j,$,O).length,0),N=O=>{const L=O.y+O.height/2,j=new Map([[O.id,O]]),$=[O];for(;$.length;){const U=$.shift();for(const Q of[..._(U.incoming),..._(U.outgoing)]){const ae=Q.source===U?Q.target:Q.source;!ae||j.has(ae.id)||!G.has(ae.id)||!x(ae)||Math.abs(ae.y+ae.height/2-L)>1||(j.set(ae.id,ae),$.push(ae))}}return j};for(const[O,L]of D()){const j=k(O,L,new Map);if(j.length!==1||!G.has(j[0].id))continue;const $=j[0],U=N($),Q=N(L);if(U.has(O.id)||Q.has(O.id)||[...Q.keys()].some(re=>U.has(re)))continue;const ae=L.y+L.height/2-($.y+$.height/2),X=new Map([...[...Q.keys()].map(re=>[re,-ae]),...[...U.keys()].map(re=>[re,ae])]),Z=new Set([...Q.keys(),...U.keys()]),ce=L.parent;[...Q.values(),...U.values()].some(re=>ge(ce,re,re.x+re.width/2,E(re,X)+re.height/2,Z))||P(X)>=P(new Map)||(n.moveElements([...U.values()],{x:0,y:ae}),n.moveElements([...Q.values()],{x:0,y:-ae}))}}const zj=10,Vj=400,Wj=x=>[...x.incoming??[],...x.outgoing??[]].filter(_=>_.type==="bpmn:DataInputAssociation"||_.type==="bpmn:DataOutputAssociation").map(_=>_.source===x?_.target:_.source).filter(_=>!!_&&typeof _.y=="number"),Uj=r.filter(x=>x.type==="bpmn:DataStoreReference"&&v.has(x.id)),qj=(x,_)=>{const E=x.x+x.width/2,k=x.y+x.height/2;let D;for(const P of Uj){if((w(P)??m())!==_||P.y<x.y+x.height)continue;const N=Math.abs(P.x+P.width/2-E);N>Vj||N<P.width||!Wj(P).some(L=>L.height===x.height&&Math.abs(L.y+L.height/2-k)<=zj&&P.y>=L.y+L.height)||(!D||N<D.dx||N===D.dx&&P.id<D.id)&&(D={dx:N,id:P.id,cy:P.y+P.height/2})}return D==null?void 0:D.cy},Yj=50,Kj=(x,_)=>{const E=w(_);if(!E||x.y<_.y+_.height)return;const k=g(E,_),D=k??E,P=x.label,N=Math.max(x.y+x.height,P?P.y+P.height:0),O=D.y+D.height;if(N<=O)return;const L=Math.ceil(N+Yj-O),j=E.y+E.height;if(k){const $=St(k,k.height+L,new Set([x.id]));Fi(j,E.id,L,$)}else n.resizeShape(E,{x:E.x,y:E.y,width:E.width,height:E.height+L}),Fi(j,E.id,L)};for(const x of A){const _=x.associations??[],E=_.map(N=>N.source===x.dataStore.id?N.target:N.source).map(h).find(Boolean),k=E?w(E)??m():m(),D=E?{x:E.x+E.width/2,y:qj(E,k)??E.y+E.height+110}:{x:200,y:Nc+60},P=n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:x.dataStore.id,name:x.dataStore.name})},D,k);E&&Kj(P,E);for(const N of _)J1(x.dataStore.id,N)}for(const x of I){const E=y(x.association.target).type==="bpmn:DataStoreReference"?x.association.target:x.association.source;J1(E,x.association)}{const x=new Set(A.map(E=>E.dataStore.id)),_=new Set;if(x.size){for(const E of ut(Ge(r)))if(E.kind==="edge-crosses-shape"&&x.has(E.shape)){const k=(IR=Y.find(D=>D.flow.id===E.edge))==null?void 0:IR.flow.target;k&&_.add(k)}else if(E.kind==="shape-overlap"&&E.shapes.some(k=>x.has(k)))for(const k of E.shapes)x.has(k)||_.add(k)}_.size&&uR(_)}let fR=0;const ha=10,Xj=(x,_)=>{const E=_.map(L=>w(L)).filter(L=>!!L);for(const L of E){const j=ha,$=L.y,U=L.y+L.height,Q=L.x,ae=L.x+L.width;if(Math.abs(x.y-$)<j){const X=$+j-x.y;x.y+=X,x.height-=X}if(Math.abs(x.y+x.height-U)<j&&(x.height=U-j-x.y),Math.abs(x.x-Q)<j){const X=Q+j-x.x;x.x+=X,x.width-=X}Math.abs(x.x+x.width-ae)<j&&(x.width=ae-j-x.x)}if(!E.length)return;const k=Math.min(...E.map(L=>L.y)),D=Math.max(...E.map(L=>L.y+L.height)),P=k-x.y,N=x.y+x.height-D,O=gs-ha;if(P>0!=N>0)if(P>0&&P<O){const L=P+ha;x.y+=L,x.height-=L}else N>0&&N<O&&(x.height-=N+ha)},Zj=(x,_)=>{const E=ha,k=30,D=r.filter(P=>P.type==="bpmn:Group"&&P.id!==_);for(const P of D){const N=P.x,O=P.x+P.width,L=P.y,j=P.y+P.height,$=x.y<j&&L<x.y+x.height,U=x.x<O&&N<x.x+x.width;if($){if(Math.abs(x.x-O)<E){const Q=Math.min(O+E-x.x,k);Q>0&&x.width-Q>0&&(x.x+=Q,x.width-=Q)}if(Math.abs(x.x+x.width-N)<E){const Q=Math.min(x.x+x.width-(N-E),k);Q>0&&x.width-Q>0&&(x.width-=Q)}}if(U){if(Math.abs(x.y-j)<E){const Q=Math.min(j+E-x.y,k);Q>0&&x.height-Q>0&&(x.y+=Q,x.height-=Q)}if(Math.abs(x.y+x.height-L)<E){const Q=Math.min(x.y+x.height-(L-E),k);Q>0&&x.height-Q>0&&(x.height-=Q)}}}},Cm=(x,_)=>{const E=gs,k=Math.min(...x.map(L=>L.x))-E,D=Math.min(...x.map(L=>L.y))-E,P=Math.max(...x.map(L=>L.x+L.width))+E,N=Math.max(...x.map(L=>L.y+L.height))+E,O={x:k,y:D,width:P-k,height:N-D};return Xj(O,x),Zj(O,_),O};for(const x of V){const _=(x.group.members??[]).map(h).filter(D=>!!D);let E;_.length?E=Cm(_,x.group.id):(E={x:300+fR*350,y:40,width:300,height:200},fR++);const k=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:x.group.id}),width:E.width,height:E.height},{x:E.x+E.width/2,y:E.y+E.height/2},m());x.group.name&&n.updateLabel(k,x.group.name),(BR=x.group.members)!=null&&BR.length&&ke(k,"bwl:Members",{refs:x.group.members.join(" ")})}{const x=r.filter(D=>!!D.waypoints),_=new Map,E=(D,P)=>{!D||!P||(_.has(D)||_.set(D,new Set),_.get(D).add(P))};for(const D of x){const P=(NR=D.source)==null?void 0:NR.id,N=($R=D.target)==null?void 0:$R.id;E(P,N),((FR=D.type)!=null&&FR.includes("DataOutputAssociation")||(jR=D.type)!=null&&jR.includes("DataInputAssociation")||D.type==="bpmn:Association")&&E(N,P)}const k=r.filter(D=>D.type==="bpmn:Group");for(const D of k){const N=(((HR=D.businessObject.extensionElements)==null?void 0:HR.values)??[]).find(re=>re.$type==="bwl:Members"),O=((N==null?void 0:N.refs)??"").split(" ").filter(Boolean);if(!O.length)continue;const L=new Set(O),j=[...O];for(;j.length;){const re=j.shift();for(const q of _.get(re)??[])L.has(q)||(L.add(q),j.push(q))}const $=D.x,U=D.x+D.width,Q=D.y,ae=D.y+D.height,X=re=>Y.filter(q=>q.flow.target===re).length,Z=re=>{var fe;const q=((fe=h(re))==null?void 0:fe.type)??"";if(q==="bpmn:StartEvent"&&X(re)===0)return!1;if(q.endsWith("Gateway")){const ye=Y.filter(oe=>oe.flow.target===re).map(oe=>oe.flow.source);if(ye.length&&ye.every(oe=>{var xe;return((xe=h(oe))==null?void 0:xe.type)==="bpmn:StartEvent"&&X(oe)===0}))return!1}return!0},ce=r.filter(re=>_i(re)).filter(re=>re.type!=="bpmn:Group"&&re.type!=="bpmn:Participant"&&re.type!=="bpmn:TextAnnotation"&&!L.has(re.id)&&Yo(re.id)&&Z(re.id)&&re.x<U&&re.x+re.width>$&&re.y<ae&&re.y+re.height>Q);if(ce.length)for(const re of[-1,1]){const q=ce.filter(Ie=>(Ie.x+Ie.width-$<=U-Ie.x?-1:1)===re);if(!q.length)continue;const fe=[];for(const Ie of q){const Ve=fe.find(Se=>Se.some(le=>Ie.y<le.y+le.height&&Ie.y+Ie.height>le.y));Ve?Ve.push(Ie):fe.push([Ie])}const ye=new Map;for(const Ie of fe){let Ve=re<0?$-ha:U+ha;for(const Se of[...Ie].sort((le,Re)=>re<0?Re.x-le.x:le.x-Re.x)){const le=re<0?Math.min(Se.x,Ve-Se.width):Math.max(Se.x,Ve);Ve=re<0?le-Gi:le+Se.width+Gi,le!==Se.x&&Math.sign(le-Se.x)===re&&ye.set(Se.id,le-Se.x)}}const oe=new Map,xe=Ie=>oe.get(Ie)===Ie||!oe.get(Ie)?Ie:xe(oe.get(Ie));for(const Ie of q)oe.set(Ie.id,Ie.id);for(const Ie of B){const Ve=ye.has(Ie.flow.source)?Ie.flow.source:void 0,Se=ye.has(Ie.flow.target)?Ie.flow.target:void 0;if(!Ve||!Se)continue;const le=h(Ie.flow.id);((GR=le==null?void 0:le.waypoints)==null?void 0:GR.length)===2&&oe.set(xe(Ve),xe(Se))}const me=new Map;for(const Ie of q){if(!ye.has(Ie.id))continue;const Ve=xe(Ie.id);me.set(Ve,[...me.get(Ve)??[],Ie])}const _e=[...me.values()].sort((Ie,Ve)=>re<0?Math.min(...Ie.map(Se=>Se.x))-Math.min(...Ve.map(Se=>Se.x)):Math.max(...Ve.map(Se=>Se.x))-Math.max(...Ie.map(Se=>Se.x))),De=[];let Fe=!0;for(const Ie of _e){const Ve=Ie.map(Re=>ye.get(Re.id)??0).reduce((Re,Me)=>Math.abs(Me)>Math.abs(Re)?Me:Re,0),Se=new Map;let le=!0;for(const Re of Ie){const Me=w(Re);if(!Me){le=!1;break}Se.has(Me.id)||Se.set(Me.id,{subtree:[],pool:Me}),Se.get(Me.id).subtree.push(Re)}le&&qo([...Se.values()],Ve,()=>!0,Nr)?De.push({shapes:Ie,dx:Ve}):Fe=!1}if(!Fe)for(const Ie of De.reverse())n.moveElements(Ie.shapes,{x:-Ie.dx,y:0})}}}{const x=new Set([...V.map(_=>_.group.id),...Vt(e,"group.update").map(_=>_.id)]);for(const _ of r.filter(E=>E.type==="bpmn:Group")){if(x.has(_.id))continue;const k=(((zR=_.businessObject.extensionElements)==null?void 0:zR.values)??[]).find(O=>O.$type==="bwl:Members"),D=((k==null?void 0:k.refs)??"").split(" ").filter(Boolean).map(h).filter(O=>!!O);!D.length||!D.some(O=>{const L=v.get(O.id);return!L||L.x!==O.x||L.y!==O.y})||!D.some(O=>O.x<_.x||O.y<_.y||O.x+O.width>_.x+_.width||O.y+O.height>_.y+_.height)||n.resizeShape(_,Cm(D,_.id))}}{const _=new Map(rr(Ge(r)).map(O=>[O.owner,O.rect])),E=r.filter(O=>!!O.waypoints),k=new Map,D=(O,L)=>{!O||!L||(k.has(O)||k.set(O,new Set),k.get(O).add(L))};for(const O of E){const L=(VR=O.source)==null?void 0:VR.id,j=(WR=O.target)==null?void 0:WR.id;D(L,j),((UR=O.type)!=null&&UR.includes("DataOutputAssociation")||(qR=O.type)!=null&&qR.includes("DataInputAssociation")||O.type==="bpmn:Association")&&D(j,L)}const P=O=>Y.filter(L=>L.flow.target===O).length,N=O=>{var j;const L=((j=h(O))==null?void 0:j.type)??"";if(L==="bpmn:StartEvent"&&P(O)===0)return!1;if(L.endsWith("Gateway")){const $=Y.filter(U=>U.flow.target===O).map(U=>U.flow.source);if($.length&&$.every(U=>{var Q;return((Q=h(U))==null?void 0:Q.type)==="bpmn:StartEvent"&&P(U)===0}))return!1}return!0};for(const O of r.filter(L=>L.type==="bpmn:Group")){const j=(((YR=O.businessObject.extensionElements)==null?void 0:YR.values)??[]).find(le=>le.$type==="bwl:Members"),$=((j==null?void 0:j.refs)??"").split(" ").filter(Boolean);if(!$.length)continue;const U=$.map(h).filter(le=>!!le);if(!U.length||!(V.some(le=>le.group.id===O.id)||Vt(e,"group.update").some(le=>le.id===O.id)||U.some(le=>{const Re=v.get(le.id);return!Re||Re.x!==le.x||Re.y!==le.y})))continue;const ae=new Set($),X=[...$];for(;X.length;){const le=X.shift();for(const Re of k.get(le)??[])ae.has(Re)||(ae.add(Re),X.push(Re))}const Z=O.x,ce=O.x+O.width,re=O.y,q=O.y+O.height,fe=le=>{const Re=_.get(le.id),Me={x:le.x,y:le.y,width:le.width,height:le.height};return Re?[Me,{x:Re.x,y:Re.y,width:Re.width,height:Re.height}]:[Me]},ye=U.flatMap(fe),oe=Math.min(...ye.map(le=>le.x)),xe=Math.max(...ye.map(le=>le.x+le.width)),me=Math.min(...ye.map(le=>le.y)),_e=Math.max(...ye.map(le=>le.y+le.height)),De={L:oe-Z,R:ce-xe,T:me-re,B:q-_e},Fe=new Set($),Ie=le=>le.x>=Z&&le.x+le.width<=ce&&le.y>=re&&le.y+le.height<=q,Ve=r.filter(le=>_i(le)).filter(le=>le.type!=="bpmn:Group"&&le.type!=="bpmn:Participant"&&le.type!=="bpmn:TextAnnotation"&&!Fe.has(le.id)&&(!ae.has(le.id)||!Ie(le))&&N(le.id)&&le.x<ce&&le.x+le.width>Z&&le.y<q&&le.y+le.height>re);if(!Ve.length)continue;const Se={L:0,R:0,T:0,B:0};for(const le of Ve){const Re=fe(le),Me=Math.min(...Re.map(Lt=>Lt.x)),Ye=Math.max(...Re.map(Lt=>Lt.x+Lt.width)),Ue=Math.min(...Re.map(Lt=>Lt.y)),at=Math.max(...Re.map(Lt=>Lt.y+Lt.height)),Be={L:Ye-Z,R:ce-Me,T:at-re,B:q-Ue},Je=["L","R","T","B"].filter(Lt=>Be[Lt]<=De[Lt]+.001);if(!Je.length)continue;const mt=Je.reduce((Lt,Vi)=>Be[Vi]<Be[Lt]?Vi:Lt,Je[0]);Se[mt]=Math.max(Se[mt],Math.min(Be[mt]+10,De[mt]))}!Se.L&&!Se.R&&!Se.T&&!Se.B||n.resizeShape(O,{x:O.x+Se.L,y:O.y+Se.T,width:O.width-Se.L-Se.R,height:O.height-Se.T-Se.B})}}const hR=x=>{const _=x.waypoints;if(_!=null&&_.length){const k=_[Math.floor((_.length-1)/2)];return{x:k.x,y:k.y,width:0,height:0}}const E=x;return{x:E.x,y:E.y,width:E.width,height:E.height}};let gR=0;const Am=$v.get(t),mR=(x,_)=>{var k;const E=(k=Am==null?void 0:Am.get(x))==null?void 0:k.texts;return E?[...new Set([_,...Object.values(E)])]:[_]};for(const x of H){const _=x.association,E=((KR=x.placement)==null?void 0:KR.anchor)??(_?_.source===x.annotation.id?_.target:_.source:void 0),k=E?h(E):void 0,D=k?hR(k):void 0,P=Cv(mR(x.annotation.id,x.annotation.text??"")),N=x.placement??(D&&E?{anchor:E,side:"top"}:void 0);let O;if(D&&N){const[U,Q]=wl[N.side],ae=N.offset??50;O={x:D.x+D.width/2+U*(D.width/2+P.width/2+ae),y:D.y+D.height/2+Q*(D.height/2+P.height/2+ae)}}else O={x:300+gR*260,y:60},gR++;const L=k?w(k)??m():m(),j=L;D&&N&&typeof j.x=="number"&&typeof j.width=="number"&&j.type==="bpmn:Participant"&&(O=El(r,D,P,j,{placement:N}));const $=n.createShape({type:"bpmn:TextAnnotation",width:P.width,height:P.height,businessObject:i.create("bpmn:TextAnnotation",{id:x.annotation.id,text:x.annotation.text})},O,L);if(_){const U=Q=>Q===x.annotation.id?$:y(Q);n.connect(U(_.source),U(_.target),_.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:_.id})}:{type:"bpmn:Association"})}x.placement&&ke($,"bwl:Placement",ve(x.placement))}for(const x of Vt(e,"association.add")){const _=x.association;n.connect(y(_.source),y(_.target),_.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:_.id})}:{type:"bpmn:Association"})}const Jj=(x,_,E,k)=>{const D=x.parent;if(!D)return k;const P=x.x+x.width/2,N=new Set([x.id]);if(!ge(D,x,P,k,N))return k;const O=_?_.y+Math.min(_.height/2,se):E?E.y+he:void 0;if(O===void 0)return k;const L=Math.floor((k-O)/z+1e-6);for(let j=1;j<=3;j++){const $=L+j,U=O+$*z,Q=cm(_==null?void 0:_.id,$);if(!ge(D,x,P,U,Q?new Set([...N,...Q]):N))return Pt(_==null?void 0:_.id,$,E),U}return k},yR=()=>new Set(r.getAll().filter(x=>x.type!=="label").map(x=>x.id));for(const x of Vt(e,"node.update")){let _=y(x.id);if(x.type&&bl(x.type)!==_.type){const E=_.x+_.width/2,k=_.y+_.height/2,D=yR();_=c.replaceElement(_,{type:bl(x.type),...x.eventDefinition?{eventDefinitionType:Kc[x.eventDefinition]}:{}});const P=yR(),N=[...D].filter(j=>j!==x.id&&!P.has(j));if(N.length)throw new Bv({kind:"type-change-drops-elements",opIndex:e.indexOf(x),id:x.id,type:x.type,dropped:N});const O=Math.round(E-(_.x+_.width/2)),L=Math.round(k-(_.y+_.height/2));if(O!==0||L!==0){n.moveShape(_,{x:O,y:L});for(const j of[..._.incoming??[],..._.outgoing??[]])Fc(j)}}if(x.name!==void 0&&n.updateProperties(_,{name:x.name??void 0}),x.lane||x.band!==void 0){x.band!==void 0&&n.updateProperties(_,{"bwl:band":x.band});const E=_.y+_.height/2,k=w(_),D=x.lane?y(x.lane):((k==null?void 0:k.children)??[]).find(N=>N.type==="bpmn:Lane"&&E>=N.y&&E<=N.y+N.height);x.band!==void 0&&Pt(D==null?void 0:D.id,x.band,k);const P=D?D.y+(x.band===void 0?D.height/2:Math.min(D.height/2,se)+In(D.id,x.band)*z):x.band!==void 0&&k?k.y+he+In(`pool:${k.id}`,x.band)*z:void 0;if(P!==void 0){const N=Jj(_,D,k,P),O=N===P?P-E:N-(_.y+_.height/2);if(O!==0){p.push({id:_.id,x:_.x,y:_.y,width:_.width,height:_.height}),n.moveElements([_],{x:0,y:O});for(const L of[..._.incoming??[],..._.outgoing??[]])L.type!=="bpmn:SequenceFlow"&&L.type!=="bpmn:MessageFlow"||Sd(L.waypoints??[],[L.source,L.target])&&(Fc(L),d.add(L.id))}}}}for(const x of Vt(e,"sequenceFlow.update")){const _=y(x.id),E=ie.get(x.id);if(E){const k=j=>({x:j.x+j.width/2,y:j.y+j.height/2}),D=y(E.flow.source),P=y(E.flow.target),N=n.connect(D,P,{type:"bpmn:SequenceFlow",businessObject:Fp(E.flow)}),O=hm.get(x.id),L=P.y+P.height/2;O&&P.x>O.exit.x&&Math.abs(L-O.exit.y)>1?n.updateWaypoints(N,[O.exit,{x:O.exit.x,y:L},{x:P.x,y:L}]):(n.reconnect(N,D,P,[k(D),k(P)]),Math.abs(L-(D.y+D.height/2))>1&&Fc(N))}else if((x.source!==void 0||x.target!==void 0)&&!G1.has(x.id)){const k=_,D=x.source!==void 0?y(x.source):k.source,P=x.target!==void 0?y(x.target):k.target,N=j=>({x:j.x+j.width/2,y:j.y+j.height/2});n.reconnect(k,D,P,[N(D),N(P)]);const O=hm.get(k.id),L=P.y+P.height/2;if(O&&P.x>O.exit.x&&Math.abs(L-O.exit.y)>1){n.updateWaypoints(k,[O.exit,{x:O.exit.x,y:L},{x:P.x,y:L}]);const j=k.label;if(j&&O.label){const U=Math.abs(O.label.y+j.height/2-O.channelY)<=z/5&&O.label.x+j.width>O.exit.x,Q=O.exit.x+6,ae=P.x-6-j.width,X=U?ae>=Q?{x:Math.max(Q,Math.min(O.label.x,ae)),y:O.label.y+(L-O.channelY)}:void 0:O.label;X&&(X.x!==j.x||X.y!==j.y)&&n.moveElements([j],{x:X.x-j.x,y:X.y-j.y})}}else Math.abs(L-(D.y+D.height/2))>1&&Fc(k)}x.name!==void 0&&n.updateProperties(_,{name:x.name??void 0}),x.condition!==void 0&&n.updateProperties(_,{name:((XR=x.condition)==null?void 0:XR.label)??void 0})}for(const x of Vt(e,"messageFlow.update"))x.name!==void 0&&n.updateProperties(y(x.id),{name:x.name??void 0});for(const x of Vt(e,"dataStore.update"))x.name!==void 0&&n.updateProperties(y(x.id),{name:x.name??void 0});for(const x of Vt(e,"annotation.update")){const _=y(x.id);if(x.text!==void 0){n.updateProperties(_,{text:x.text});const E=Cv(mR(x.id,x.text));if(E.width!==_.width||E.height!==_.height){const k={x:_.x,y:_.y,width:E.width,height:E.height};n.resizeShape(_,k,void 0,{[Av]:k})}}if(x.placement===null)ke(_,"bwl:Placement",null);else if(x.placement){const E=y(x.placement.anchor),k=hR(E),D=w(E)??m(),P=typeof D.x=="number"&&typeof D.width=="number"&&D.type==="bpmn:Participant",[N,O]=wl[x.placement.side],L=x.placement.offset??50,j={x:k.x+k.width/2+N*(k.width/2+_.width/2+L),y:k.y+k.height/2+O*(k.height/2+_.height/2+L)},$=P?El(r,k,{width:_.width,height:_.height},D,{placement:x.placement,selfId:x.id}):j;n.moveElements([_],{x:$.x-(_.x+_.width/2),y:$.y-(_.y+_.height/2)}),ke(_,"bwl:Placement",ve(x.placement))}}for(const x of Vt(e,"group.update")){const _=y(x.id);if(x.name!==void 0&&n.updateLabel(_,x.name??""),x.members){const E=x.members.map(h).filter(k=>!!k);E.length&&n.resizeShape(_,Cm(E,x.id)),ke(_,"bwl:Members",{refs:x.members.join(" ")})}}}function Ts(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 JT(e,t,n){const i=(r,a)=>{const s=r.shapes.find(l=>l.id===a);if(s)return{x:s.x+s.width/2,y:s.y+s.height/2};const c=r.edges.find(l=>l.id===a);return c!=null&&c.waypoints.length?c.waypoints[Math.floor((c.waypoints.length-1)/2)]:void 0},o=new Set;for(const r of e.shapes){if(r.type!=="bpmn:TextAnnotation")continue;const a=i(e,r.id),s=i(t,r.id);if(!a||!s)continue;const c=s.x-a.x,l=s.y-a.y;if(Math.abs(c)<=2&&Math.abs(l)<=2)continue;const u=n(r.id),p=u?i(e,u):void 0,d=u?i(t,u):void 0;p&&d&&Math.abs(d.x-p.x-c)<=2&&Math.abs(d.y-p.y-l)<=2||o.add(r.id)}return o}function QT(e,t,n,i){const{elementRegistry:o}=e,r=e.modeling,a=[...t.incoming??[],...t.outgoing??[]].filter(f=>f.type==="bpmn:Association");if(!a.length)return 0;const s=f=>f.map(m=>m.original?{x:m.x,y:m.y,original:{x:m.original.x,y:m.original.y}}:{x:m.x,y:m.y}),c=(f,m)=>f.length===m.length&&f.every((h,y)=>{var w,g,v,b;return h.x===m[y].x&&h.y===m[y].y&&((w=h.original)==null?void 0:w.x)===((g=m[y].original)==null?void 0:g.x)&&((v=h.original)==null?void 0:v.y)===((b=m[y].original)==null?void 0:b.y)}),l=a.map(f=>s(f.waypoints)),u=new Set(a.map(f=>f.id));r.moveElements([t],{x:n,y:i});const p=Ge(o),d=[...Si(p),...Ri(p)].filter(([f,m])=>u.has(f)!==u.has(m)).length;return r.moveElements([t],{x:-n,y:-i}),a.forEach((f,m)=>{c(f.waypoints,l[m])||r.updateWaypoints(f,l[m])}),d}function eP(e,t,n,i=new Set,o=new Set){var h,y;const{elementRegistry:r}=e,a=e.modeling,s=w=>ut(w).filter(g=>!t.has(ct(g))),c=w=>{var g;return((g=r.get(w))==null?void 0:g.type)==="bpmn:TextAnnotation"},l=Ge(r),u=s(l),p=w=>!n.has(w),d=w=>u.some(g=>g.kind==="edge-crosses-shape"&&g.shape===w&&i.has(g.edge)||g.kind==="shape-overlap"&&g.shapes.includes(w)&&g.shapes.every(c)),f=[...new Set(u.flatMap(Ts))].filter(w=>c(w)&&(!p(w)||d(w))),m=[...f.filter(w=>!p(w)),...f.filter(p)];if(m.length)for(const w of m){const g=r.get(w);if(!g||typeof g.x!="number"||typeof g.width!="number")continue;let v=g.parent,b;for(;v;){if(v.type==="bpmn:Participant"){b=v;break}v=v.parent}if(!b){const z=g.x+g.width/2,ee=g.y+g.height/2;b=r.getAll().find(he=>{if(he.type!=="bpmn:Participant")return!1;const se=he;return typeof se.x=="number"&&typeof se.width=="number"&&z>=se.x&&z<=se.x+se.width&&ee>=se.y&&ee<=se.y+se.height})}if(!b||typeof b.x!="number"||typeof b.width!="number")continue;const M=(((h=g.businessObject.extensionElements)==null?void 0:h.values)??[]).find(z=>z.$type==="bwl:Placement"),B=[...g.incoming??[],...g.outgoing??[]].find(z=>z.type==="bpmn:Association"),A=(M!=null&&M.anchor?r.get(M.anchor):void 0)??(B?((y=B.source)==null?void 0:y.id)===w?B.target:B.source:void 0);if(!A)continue;const I=A.waypoints,H=I!=null&&I.length?{x:I[Math.floor((I.length-1)/2)].x,y:I[Math.floor((I.length-1)/2)].y,width:0,height:0}:{x:A.x,y:A.y,width:A.width,height:A.height},V={width:g.width,height:g.height},G={x:g.x+g.width/2,y:g.y+g.height/2},ie=M==null?void 0:M.side,pe=Lv(r,H,b),Y=[];if(ie&&ie in wl&&Y.push(El(r,H,V,b,{placement:{side:ie,offset:(M==null?void 0:M.offset)??null},selfId:w})),pe&&!_l(G,V,pe))for(const z of WT)Y.push(El(r,H,V,b,{placement:{side:z,offset:null},selfId:w}));for(const[z,ee]of[[-1,0],[1,0],[0,-1],[0,1]])for(let he=1;he<=VT;he++)Y.push({x:G.x+z*Dv*he,y:G.y+ee*Dv*he});const Te=p(w)?Ge(r):l,Pe={...Te,edges:Te.edges.filter(z=>z.id!==(B==null?void 0:B.id))},ke=s(Pe),ve=ke.filter(z=>Ts(z).includes(w)).length;if(!ve)continue;let W,de=!1;for(const z of Y){const ee=z.x-G.x,he=z.y-G.y;if(!ee&&!he||z.x-V.width/2<b.x||z.x+V.width/2>b.x+b.width||z.y-V.height/2<b.y||z.y+V.height/2>b.y+b.height||pe&&!_l(z,V,pe))continue;const se={...Pe,shapes:Pe.shapes.map(R=>R.id===w?{...R,x:R.x+ee,y:R.y+he}:R)},Ae=o.has(w)?s(se):ut(se).filter(R=>!t.has(ct(R))||Ts(R).includes(w)),F=Ae.filter(R=>Ts(R).includes(w)).length;if(F>=ve||Ae.length>ke.length)continue;const C=Math.abs(ee)+Math.abs(he);if(de||((!W||F<W.mine||F===W.mine&&(Ae.length<W.all||Ae.length===W.all&&C<W.dist))&&(W={x:z.x,y:z.y,mine:F,all:Ae.length,dist:C}),W.mine===0&&W.all<ke.length&&(de=!0)),F===0&&Ae.length<ke.length&&QT(e,g,ee,he)===0){W={x:z.x,y:z.y,mine:F,all:Ae.length,dist:C};break}}W&&a.moveElements([g],{x:W.x-G.x,y:W.y-G.y})}}const tP=60;function Ps(e,t,n,i){const o=t.x+t.width,r=[],a=c=>{for(const l of c.children??[])l.type==="bpmn:Lane"&&(r.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 r)Math.abs(c.x+c.width-o)<1&&e.resizeShape(c,{x:c.x,y:c.y,width:s-c.x,height:c.height},void 0,i)}function nP(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=w=>ut(w).filter(g=>!t.has(ct(g))),a=w=>w.filter(g=>g.kind==="pool-overlap"),s=new Map(n.shapes.map(w=>[w.id,w])),c=(w,g)=>g.x>=w.x&&g.y>=w.y&&g.x+g.width<=w.x+w.width&&g.y+g.height<=w.y+w.height,l=w=>{if(!s.get(w))return[w];const v=new Set,b=new Set([w]);for(let M=0;M<4;M++){let B=!1;for(const A of n.shapes)A.type!=="bpmn:Group"||v.has(A.id)||[...b].some(I=>{const H=s.get(I);return H&&c(A,H)})&&(v.add(A.id),B=!0);for(const A of n.shapes)A.type!=="bpmn:Participant"||b.has(A.id)||[...v].some(I=>{const H=s.get(I);return H&&c(H,A)})&&(b.add(A.id),B=!0);if(!B)break}const S=n.shapes.filter(M=>!M.parent&&!b.has(M.id)&&!v.has(M.id)&&M.type!=="bpmn:Group"&&M.type!=="bpmn:Participant").filter(M=>[...v].some(B=>{const A=s.get(B);return A&&c(A,M)})).map(M=>M.id);return[...b,...v,...S]},u=r(Ge(i)),p=a(u).length;if(!p)return;const d=u.length,f=[];let m=0,h=p,y=d;for(let w=0;w<6;w++){const g=Ge(i),v=a(r(g));if(!v.length)break;const b=new Map(g.shapes.map(I=>[I.id,I]));let S=null;for(const I of v){if(I.kind!=="pool-overlap")continue;const[H,V]=I.pools,G=b.get(H),ie=b.get(V);if(!G||!ie)continue;const[pe,Y]=G.x<=ie.x?[G,ie]:[ie,G];if(I.contained)continue;const Te=s.get(pe.id),Pe=s.get(Y.id),ke=Te&&Pe?Math.max(Pe.x-(Te.x+Te.width),0):tP,ve=pe.x+pe.width+ke-Y.x;if(ve<=0)continue;const W=l(Y.id).filter(de=>i.get(de));W.length&&(!S||ve>S.dx)&&(S={movers:W,dx:ve})}if(!S)break;const M=S.movers.map(I=>i.get(I)).filter(I=>!!I&&typeof I.x=="number");if(!M.length)break;o.moveElements(M,{x:S.dx,y:0}),f.push({els:M,dx:S.dx});const B=r(Ge(i)),A=a(B).length;A<p&&B.length<=d&&(A<h||A===h&&B.length<y||m===0)&&(m=f.length,h=A,y=B.length)}for(const{els:w,dx:g}of f.slice(m).reverse())o.moveElements(w,{x:-g,y:0})}const ks=.5,Sl=150,zv=1200;function iP(e,t){const n=t.shapes.filter(i=>i.type==="bpmn:Participant");if(!(n.length<2))for(const i of rP(n))i.length<n.length&&i.some(r=>Kd(e.elementRegistry.get(r.id)))||aP(e,i)}function oP(e,t){const n=e.modeling,i=new Set(t.shapes.map(r=>r.id)),o=e.elementRegistry.getAll().filter(r=>r.type==="bpmn:Participant"&&!i.has(r.id)&&!Kd(r));for(const r of o){let a=-1/0;const s=d=>{d&&typeof d.x=="number"&&typeof d.width=="number"&&(a=Math.max(a,d.x+d.width))},c=d=>{for(const f of d.children??[]){if("waypoints"in f&&f.waypoints){for(const m of f.waypoints)a=Math.max(a,m.x);s(f.label);continue}f.type!=="label"&&(f.type!=="bpmn:Lane"&&(s(f),s(f.label)),c(f))}};if(c(r),!Number.isFinite(a))continue;const l=d=>d.x<r.x+r.width&&d.x+d.width>r.x&&d.y<r.y+r.height&&d.y+d.height>r.y;for(const d of e.elementRegistry.getAll()){if(d.type==="bpmn:Participant"||d.type==="bpmn:Lane"||d.type==="label")continue;const f="waypoints"in d&&d.waypoints?[d.label]:[d,d.label];for(const m of f)m&&typeof m.x=="number"&&typeof m.width=="number"&&l(m)&&s(m)}const u=Math.max(zv,Math.round(a+Sl-r.x));u>=r.width-1||[...r.incoming??[],...r.outgoing??[]].flatMap(d=>d.waypoints??[]).some(d=>d.x>=r.x+u-1)||Ps(n,r,u,{layout:!1})}}function rP(e){const t=[...e].sort((i,o)=>i.x+i.width-(o.x+o.width)),n=[];for(const i of t){const o=n[n.length-1],r=o==null?void 0:o[o.length-1];o&&r&&i.x+i.width-(r.x+r.width)<=ks?o.push(i):n.push([i])}return n.filter(i=>i.length>=2)}function Kd(e){var i,o,r;const t=(i=e==null?void 0:e.businessObject)==null?void 0:i.processRef;if(!t)return!0;const n=(t.laneSets??[]).reduce((a,s)=>{var c;return a+(((c=s.lanes)==null?void 0:c.length)??0)},0);return(((o=t.flowElements)==null?void 0:o.length)??0)+n+(((r=t.artifacts)==null?void 0:r.length)??0)===0}function aP(e,t){const{elementRegistry:n}=e,i=e.modeling,o=t.map(g=>g.x+g.width),r=Math.max(...o);if(r-Math.min(...o)>ks)return;const a=t.map(g=>n.get(g.id)).filter(g=>!!g&&typeof g.x=="number");if(a.length<2)return;const s=new Map(t.map(g=>[g.id,g.x]));if(a.some(g=>Math.abs(g.x-s.get(g.id))>ks))return;const c=a.map(g=>g.x+g.width);if(Math.max(...c)-Math.min(...c)<=ks)return;const l=g=>g.x+g.width,u=g=>!!g&&typeof g.width=="number",p=g=>{const v={shapes:[],edges:[],lanes:[]},b=S=>{for(const M of S.children??[]){if("waypoints"in M&&M.waypoints){v.edges.push(M);continue}M.type!=="label"&&(M.type==="bpmn:Lane"?v.lanes.push(M):v.shapes.push(M),b(M))}};return b(g),v},d=new Map(a.map(g=>[g.id,p(g)]));let f=r;for(const g of a){const{shapes:v}=d.get(g.id),b=v.flatMap(S=>[l(S),...u(S.label)?[l(S.label)]:[]]);b.length&&(f=Math.max(f,Math.max(...b)+Sl))}const m=a.filter(g=>Math.abs(l(g)-f)>ks);if(!m.length)return;for(const g of m){const v=l(g),{shapes:b,edges:S,lanes:M}=d.get(g.id);if([...b.flatMap(I=>[l(I),...u(I.label)?[l(I.label)]:[]]),...S.flatMap(I=>[...I.waypoints.map(H=>H.x),...u(I.label)?[l(I.label)]:[]])].some(I=>I>f)||[...(g.incoming??[]).map(I=>I.waypoints[I.waypoints.length-1]),...(g.outgoing??[]).map(I=>I.waypoints[0])].some(I=>!I||I.x>f||Math.abs(I.x-v)<1))return;if(f>v){const I={x:v,y:g.y,width:f-v,height:g.height},H=new Set([g.id,...b.map(G=>G.id),...S.map(G=>G.id),...M.map(G=>G.id)]);if(n.getAll().some(G=>{var Y;if("waypoints"in G&&G.waypoints||G.type==="bpmn:Group"||!u(G))return!1;const ie=G.type==="label"?(Y=G.labelTarget)==null?void 0:Y.id:G.id;if(!ie||H.has(ie)||H.has(G.id))return!1;const pe=G;return pe.x<I.x+I.width&&pe.x+pe.width>I.x&&pe.y<I.y+I.height&&pe.y+pe.height>I.y}))return}}const h=()=>new Set(ut(Ge(n)).map(ct)),y=h(),w=m.map(g=>g.width);for(const g of m)Ps(i,g,f-g.x,{layout:!1});[...h()].every(g=>y.has(g))||m.forEach((g,v)=>Ps(i,g,w[v],{layout:!1}))}function sP(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=l=>ut(l).filter(u=>!t.has(ct(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(M=>M.id!==l.id&&M.type!=="bpmn:Group"&&a(l,M));if(!p.length)continue;const d=p.map(M=>i.get(M.id)).filter(M=>!!M&&typeof M.x=="number");if(d.length!==p.length)continue;const f=s(p),m=s(d),h=m.l+(l.x-f.l),y=m.t+(l.y-f.t),w=m.r+(l.x+l.width-f.r),g=m.b+(l.y+l.height-f.b),v={x:h,y,width:w-h,height:g-y};if(v.width<=0||v.height<=0||Math.abs(v.x-u.x)<1&&Math.abs(v.y-u.y)<1&&Math.abs(v.width-u.width)<1&&Math.abs(v.height-u.height)<1)continue;const b=r(Ge(i)).length,S={x:u.x,y:u.y,width:u.width,height:u.height};o.resizeShape(u,v),r(Ge(i)).length>b&&o.resizeShape(u,S)}}const Rl=20,Ml=10;function cP(e,t,n,i){var p,d;const{elementRegistry:o}=e,r=e.modeling,a=f=>new Set(ut(f,{includeObservationOnly:!0}).filter(m=>m.kind==="edge-along-group-boundary").map(ct)),s=Ge(o),c=ut(s,{includeObservationOnly:!0}).filter(f=>f.kind==="edge-along-group-boundary"&&!t.has(ct(f)));if(!c.length)return;const l=new Map(n.shapes.map(f=>[f.id,f])),u=new Map;for(const f of c)u.set(f.group,[...u.get(f.group)??[],f]);for(const[f,m]of u){const h=s.shapes.find(Ae=>Ae.id===f);if(!((p=h==null?void 0:h.members)!=null&&p.length))continue;const y=l.get(f);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 g=h.members.map(Ae=>o.get(Ae)).filter(Ae=>!!Ae&&typeof Ae.x=="number");if(!g.length)continue;const v=Math.min(...g.map(Ae=>Ae.x)),b=Math.min(...g.map(Ae=>Ae.y)),S=Math.max(...g.map(Ae=>Ae.x+Ae.width)),M=Math.max(...g.map(Ae=>Ae.y+Ae.height)),B=h.x,A=h.y,I=h.x+h.width,H=h.y+h.height;let V=B,G=A,ie=I,pe=H;for(const Ae of m){const F=s.edges.find(R=>R.id===Ae.edge);if(!F)continue;const C=F.endpoints.some(R=>{const J=s.shapes.find($e=>$e.id===R);if(!J||J.container)return!1;const ne=J.x+J.width/2,ge=J.y+J.height/2;return B<ne&&ne<I&&A<ge&&ge<H});for(const R of fn(F)){const J=R.axis==="v"?[A,H]:[B,I];Math.min(R.hi,J[1])-Math.max(R.lo,J[0])<xd||(R.axis==="v"?B<R.at&&R.at<I:A<R.at&&R.at<H)&&C||(R.axis==="v"?(Math.abs(R.at-B)<=Ma&&(V=Math.max(V,R.at+Rl)),Math.abs(R.at-I)<=Ma&&(ie=Math.min(ie,R.at-Rl))):(Math.abs(R.at-A)<=Ma&&(G=Math.max(G,R.at+Rl)),Math.abs(R.at-H)<=Ma&&(pe=Math.min(pe,R.at-Rl))))}}if(V>v-Ml&&(V=B),G>b-Ml&&(G=A),ie<S+Ml&&(ie=I),pe<M+Ml&&(pe=H),V===B&&G===A&&ie===I&&pe===H)continue;const Y=o.get(f),Te={x:Y.x,y:Y.y,width:Y.width,height:Y.height},Pe=Ge(o),ke=new Set(ut(Pe).map(ct)),ve=a(Pe);r.resizeShape(Y,{x:V,y:G,width:ie-V,height:pe-G});let W=Ge(o),de=ut(W).filter(Ae=>!ke.has(ct(Ae)));const z=[];if(de.length>0&&de.every(Ae=>Ae.kind==="label-over-line"&&!i.has(Ae.edge)&&W.edges.some(F=>F.id===Ae.edge))){for(const Ae of de){if(Ae.kind!=="label-over-line")continue;const F=W.edges.find(ge=>ge.id===Ae.edge),C=F&&zd(F,W),R=(d=o.get(Ae.edge))==null?void 0:d.label;if(!C||!R)continue;const J=C.x-R.x,ne=C.y-R.y;r.moveElements([R],{x:J,y:ne}),z.push({label:R,dx:J,dy:ne})}W=Ge(o),de=ut(W).filter(Ae=>!ke.has(ct(Ae)))}const he=a(W),se=[...he].some(Ae=>!ve.has(Ae));if(de.length||se||he.size>=ve.size){for(const Ae of z.reverse())r.moveElements([Ae.label],{x:-Ae.dx,y:-Ae.dy});r.resizeShape(Y,Te)}}}function lP(e,t,n,i){var c;const o=n.getRootElement().businessObject,r=Qp((o==null?void 0:o.$parent)??o),a=xs(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:ed(u,i,r),requests:id(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,...r?{rootLang:r}:{},before:s.get(l)}]:[]})}}function Xd(e,t,n={}){var Pe,ke;const{i18n:i,lower:o=Gv}=n,r=kv(e),a=Ly(r.elementRegistry),s=_v(t,a,{i18n:i}),c={edgeCrossings:{before:0,after:0,pairs:[],solidPairs:0,dashedPairs:0,mixedPairs:0,crossPoolMessages:0},sharedEndpointCrossings:{before:0,after:0,pairs:[]}};if(s.length)return{ok:!1,issues:s,findings:[],stats:c};const l=TT(t,a,i),u=i&&l.writes.size?lP(l.writes,r.elementRegistry,r.canvas,i):void 0,p=Ge(r.elementRegistry),d=new Set(ut(p).map(ct)),f=new Set(ut(p,{includeObservationOnly:!0}).map(ct)),m=new Set(Iv(l.ops,ve=>{var W,de;return(de=(W=r.elementRegistry.get(ve))==null?void 0:W.source)==null?void 0:de.id}).keys()),h=new Set(p.edges.map(ve=>ve.id).filter(ve=>!m.has(ve))),y=new Set(t.flatMap(ve=>ve.kind==="sequenceFlow.update"&&(ve.source!==void 0||ve.target!==void 0)?[ve.id]:[])),w=()=>new Set(p.edges.filter(ve=>{var de;const W=(de=r.elementRegistry.get(ve.id))==null?void 0:de.waypoints;return W?!(W.length===ve.waypoints.length&&ve.waypoints.every((z,ee)=>Math.round(z.x)===Math.round(W[ee].x)&&Math.round(z.y)===Math.round(W[ee].y))):!1}).map(ve=>ve.id)),g=(ve,W)=>new Set([...ve].filter(de=>!W.has(de))),v=new Set(p.shapes.map(ve=>ve.id)),b=new Set(t.flatMap(ve=>ve.kind==="annotation.update"&&ve.placement?[ve.id]:[])),S=Si(p),M=S.length,B=new Set(S.map(([ve,W])=>`${ve}|${W}`)),A=Ri(p),I=new Set(A.map(([ve,W])=>`${ve}|${W}`)),H=new Map;for(const ve of r.elementRegistry.filter(W=>"waypoints"in W&&!!W.waypoints))ve.label&&H.set(ve.id,{wps:ve.waypoints.map(W=>({x:W.x,y:W.y})),label:{x:ve.label.x,y:ve.label.y},source:(Pe=ve.source)==null?void 0:Pe.id,target:(ke=ve.target)==null?void 0:ke.id});const V=e.get("commandStack");try{YT(r,l.writes),Bm(V,()=>{o(l.ops,r);for(const he of(u==null?void 0:u.contexts())??[])V.execute(tl,he);nP(r,d,p),iP(r,p),sP(r,d,p),eT(r,p,y),ZA(r,h,v),Yy(r,h);const ve=Pd(r,d,v),W=HA(r,KT(r),h,y);Gy(r,B,h);const de=ST(r,h),z=w(),ee=lv(r,d,g(h,z),z);Qy(r,h),fT(r,h,y,v),rv(r,d,h),_T(r,d,h),YA(r,I,h),aT(r,h,p),mv(r,d,g(h,w())),gv(r,h,new Set([...y,...ee,...de,...W,...XT(r)]),ZT(r)),yv(r,v),eP(r,d,v,ve,b),Pd(r,d,v,ve),cP(r,f,p,h),vv(r,d),hv(r,H,qT(r)),oP(r,p)})}catch(ve){return{ok:!1,issues:[ve instanceof Bv?ve.issue:{kind:"lower-failed",message:ve instanceof Error?ve.message:String(ve)}],findings:[],stats:c}}const G=Ge(r.elementRegistry),ie=JT(p,G,ve=>{var z,ee,he;const W=r.elementRegistry.get(ve),de=[...(W==null?void 0:W.incoming)??[],...(W==null?void 0:W.outgoing)??[]].find(se=>se.type==="bpmn:Association");return de&&(((z=de.source)==null?void 0:z.id)===ve?(ee=de.target)==null?void 0:ee.id:(he=de.source)==null?void 0:he.id)}),pe=ut(G,{includeObservationOnly:!0}).filter(ve=>!f.has(ct(ve))||Ts(ve).some(W=>ie.has(W))),Y=Sy(G),Te=Ri(G);return{ok:!0,issues:[],findings:pe,stats:{edgeCrossings:{before:M,after:Y.pairs.length,pairs:Y.pairs,solidPairs:Y.solidPairs,dashedPairs:Y.dashedPairs,mixedPairs:Y.mixedPairs,crossPoolMessages:Y.crossPoolMessages},sharedEndpointCrossings:{before:A.length,after:Te.length,pairs:Te}}}}function uP(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function Vv(e,t){return typeof e.get=="function"?e.get(t):e[t]}function Wv(e,t){const n=Vv(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function Uv(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(o=>(o==null?void 0:o.$type)===t)}function pP(e){return typeof e=="string"&&Yp.includes(e)}function Ji(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function qv(e,t={}){const n=e.rootElements??[],i=n.find(W=>W.$type==="bpmn:Collaboration"),o=new Map(n.filter(W=>W.$type==="bpmn:Process").map(W=>[W.id,W])),r=[],a=[],s=[],c=[],l=[],u=[],p={poolOrders:{},bands:{},placements:{},afterColumns:{}},d=[],f=[],m=[],h=[],y=[],w=[],g=[],v=new Map,b=new Set,S=new Set,M=W=>{W&&b.add(W)},B=W=>{b.add(W),S.add(W)},A=W=>{const de=Uv(W,"bwl:Placement");if(!de)return;const z=typeof de.anchor=="string"?de.anchor:void 0;if(!z||!pP(de.side))return;const ee=typeof de.offset=="number"?de.offset:void 0;y.push({owner:W.id,anchor:z,side:de.side,...ee!==void 0?{offset:ee}:{}})},I=W=>{const de=Uv(W,"bwl:Members"),z=typeof(de==null?void 0:de.refs)=="string"?de.refs.split(/\s+/).filter(Boolean):[];z.length&&g.push({owner:W.id,refs:z})},H=W=>{var de;for(const z of W)switch(M(z.id),z.$type){case"bpmn:TextAnnotation":B(z.id),v.set(z.id,z),c.push({id:z.id,text:typeof z.text=="string"?z.text:""}),A(z);break;case"bpmn:Association":m.push({id:z.id,type:z.$type,source:Ji(z.sourceRef),target:Ji(z.targetRef)});break;case"bpmn:Group":{B(z.id),v.set(z.id,z);const ee=(de=z.categoryValueRef)==null?void 0:de.value;l.push({id:z.id,...typeof ee=="string"&&ee?{name:ee}:{}}),I(z);break}default:u.push({id:z.id,type:z.$type,reason:"type-outside-mvp"})}},V=W=>{for(const de of W.flowElements??[])M(de.id),u.push({id:de.id,type:de.$type,reason:"inside-container"}),(de.flowElements??[]).length&&V(de);for(const de of W.artifacts??[])M(de.id),u.push({id:de.id,type:de.$type,reason:"inside-container"})},G=(W,de)=>{const z=W.flowElements??[],ee=(W.laneSets??[]).flatMap(se=>se.lanes??[]),he=new Map;for(const se of ee){M(se.id),v.set(se.id,se);for(const Ae of se.flowNodeRef??[]){const F=Ji(Ae);F&&he.set(F,se.id)}}for(const se of z){if(M(se.id),v.set(se.id,se),se.$type==="bpmn:SequenceFlow"){d.push({id:se.id,source:Ji(se.sourceRef),target:Ji(se.targetRef),...typeof se.name=="string"&&se.name?{name:se.name}:{}});continue}if(se.$type==="bpmn:DataStoreReference"){B(se.id),s.push({id:se.id,...se.name?{name:se.name}:{}});continue}const Ae=uP(se.$type),F=Ae==="intermediateCatchEvent"?Up((se.eventDefinitions??[]).map(ne=>ne.$type)):void 0;if(!Pm(Ae)||Ae==="intermediateCatchEvent"&&!F){u.push({id:se.id,type:se.$type,reason:"type-outside-mvp"});continue}B(se.id);const C=Ae==="boundaryEvent"?Ji(se.attachedToRef):void 0;a.push({id:se.id,type:Ae,...se.name?{name:se.name}:{},...de?{participant:de}:{},...he.has(se.id)?{lane:he.get(se.id)}:{},...C?{attachedTo:C}:{},...F?{eventDefinition:F}:{}}),Ae==="subProcess"&&V(se);const R=Wv(se,"bwl:band");R!==void 0&&(p.bands[se.id]=R);const J=Vv(se,"bwl:afterColumn");typeof J=="string"&&J!==""&&w.push([se.id,J]);for(const ne of se.dataOutputAssociations??[])M(ne.id),h.push({id:ne.id,type:ne.$type,source:se.id,target:Ji(ne.targetRef)});for(const ne of se.dataInputAssociations??[])M(ne.id),h.push({id:ne.id,type:ne.$type,source:Ji((ne.sourceRef??[])[0]),target:se.id})}H(W.artifacts??[])};if(i){const W=new Set;for(const de of i.participants??[]){B(de.id),v.set(de.id,de);const z=Ji(de.processRef);z&&W.add(z);const ee=z?o.get(z):void 0,he=((ee==null?void 0:ee.laneSets)??[]).flatMap(C=>C.lanes??[]),se=he.map(C=>({id:C.id,...C.name?{name:C.name}:{}}));for(const C of se)B(C.id);const Ae=!ee||(ee.flowElements??[]).length===0&&he.length===0&&(ee.artifacts??[]).length===0;r.push({id:de.id,...de.name?{name:de.name}:{},...Ae?{blackBox:!0}:{},...se.length?{lanes:se}:{}});const F=Wv(de,"bwl:poolOrder");F!==void 0&&(p.poolOrders[de.id]=F),ee&&G(ee,de.id)}for(const de of i.messageFlows??[])M(de.id),v.set(de.id,de),f.push({id:de.id,source:Ji(de.sourceRef),target:Ji(de.targetRef),...typeof de.name=="string"&&de.name?{name:de.name}:{}});H(i.artifacts??[]);for(const[de,z]of o)!W.has(de)&&(z.flowElements??[]).length>0&&u.push({id:de,type:z.$type,reason:"unreachable-process"})}else for(const W of o.values())G(W);const ie=[],pe=[],Y=[],Te=[],Pe=(W,de)=>!!W&&!!de&&S.has(W)&&S.has(de);for(const W of d){if(!Pe(W.source,W.target)){u.push({id:W.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}ie.push({id:W.id,source:W.source,target:W.target,...W.name?{name:W.name}:{}}),S.add(W.id)}for(const W of f){if(!Pe(W.source,W.target)){u.push({id:W.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}pe.push({id:W.id,source:W.source,target:W.target,...W.name?{name:W.name}:{}}),S.add(W.id)}for(const W of h){if(!Pe(W.source,W.target)){u.push({id:W.id??"",type:W.type,reason:"endpoint-outside-mvp"});continue}Te.push({...W.id?{id:W.id}:{},source:W.source,target:W.target}),W.id&&S.add(W.id)}for(const W of m){if(!Pe(W.source,W.target)){u.push({id:W.id??"",type:W.type,reason:"endpoint-outside-mvp"});continue}Y.push({...W.id?{id:W.id}:{},source:W.source,target:W.target})}const ke=new Map(l.map(W=>[W.id,W]));for(const{owner:W,refs:de}of g){const z=de.filter(he=>b.has(he)),ee=ke.get(W);ee&&z.length&&(ee.members=z)}for(const W of y)b.has(W.anchor)&&(p.placements[W.owner]={anchor:W.anchor,side:W.side,...W.offset!==void 0?{offset:W.offset}:{}});for(const[W,de]of w)b.has(de)&&(p.afterColumns[W]=de);const ve={...r.length?{participants:r}:{},nodes:a,sequenceFlows:ie,...pe.length?{messageFlows:pe}:{},...s.length?{dataStores:s}:{},...Te.length?{dataAssociations:Te}:{},...c.length?{annotations:c}:{},...Y.length?{associations:Y}:{},...l.length?{groups:l}:{}};return t.i18n?{definition:ve,hints:p,omitted:u,i18n:dP(ve,v,e,t.i18n)}:{definition:ve,hints:p,omitted:u}}function dP(e,t,n,i){const o=Qp(n),r=xs(i),a=[],s=(c,l)=>{const u=t.get(c.id);if(!u)return;const p=ed(u,i,o);Object.keys(p).length&&(c[l]=p);for(const d of id(u)){if(!r.includes(d.locale))continue;const f=!!d.sourceLocale&&!p[d.sourceLocale];a.push({id:c.id,...d,...f?{cleared:!0}:{}})}};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:r.slice(1),reviewRequests:a}}async function fP(e,t={}){const{definitions:n,warnings:i}=await Ra(e);return{...qv(n,t),warnings:i}}const hP=new Set(["bpmn:ExclusiveGateway","bpmn:ParallelGateway","bpmn:InclusiveGateway","bpmn:EventBasedGateway","bpmn:ComplexGateway"]);function Zd(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function gP(e){return Zd(e.processRef)!==void 0}function mP(e){const t=new Set,n=o=>{const r=Zd(o);r&&t.add(r)},i=o=>{for(const r of o.flowElements??[]){n(r.sourceRef),n(r.targetRef),r.attachedToRef&&(n(r.attachedToRef),t.add(r.id));for(const a of r.dataOutputAssociations??[])t.add(r.id),n(a.targetRef);for(const a of r.dataInputAssociations??[]){t.add(r.id);for(const s of a.sourceRef??[])n(s)}(r.flowElements??[]).length&&i(r)}for(const r of o.artifacts??[])n(r.sourceRef),n(r.targetRef)};for(const o of e.rootElements??[])if(o.$type==="bpmn:Process")i(o);else if(o.$type==="bpmn:Collaboration"){for(const r of o.messageFlows??[])n(r.sourceRef),n(r.targetRef);for(const r of o.artifacts??[])n(r.sourceRef),n(r.targetRef)}return t}function yP(e){const t=[],n=i=>{for(const o of i.flowElements??[])hP.has(o.$type)&&t.push(o),(o.flowElements??[]).length&&n(o)};for(const i of e.rootElements??[])i.$type==="bpmn:Process"&&n(i);return t}function vP(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 Jd(e){const t=[],n=e.rootElements??[],i=mP(e);for(const r of yP(e))i.has(r.id)||t.push({ruleId:"CHK-FLOW-1",severity:"warning",targetKind:"flowNode",targetRefs:[r.id],params:{type:r.$type}});const o=n.find(r=>r.$type==="bpmn:Collaboration");if(o){const r=new Map(n.filter(s=>s.$type==="bpmn:Process").map(s=>[s.id,s])),a=[];for(const s of o.participants??[])gP(s)&&vP(r.get(Zd(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 xP(e){const{definitions:t,warnings:n}=await Ra(e);return{issues:Jd(t),warnings:n}}const bP=.5,wP=8,_P=new Set(["bpmn:Definitions","bpmn:Collaboration","bpmn:Process","bpmn:LaneSet","bpmn:ExtensionElements","bpmn:Documentation","bpmn:Relationship","bpmn:Property","bpmn:Category","bpmn:CategoryValue"]),Da=e=>typeof e=="number"?e:Number(e??NaN),Cl=e=>{if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:""};function EP(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 r of["sourceRef","targetRef","attachedToRef","processRef","default"])t[r]!==void 0&&n.push(`${r}=${Cl(t[r])}`);if(String(e.$type)==="bpmn:Group"){const r=t.categoryValueRef,a=Array.isArray(r)?r:r==null?[]:[r];n.push(`cat=[${a.map(s=>`${Cl(s)}:${typeof(s==null?void 0:s.value)=="string"?s.value:""}`).sort().join(",")}]`)}Array.isArray(t.flowNodeRef)&&n.push(`lane=[${t.flowNodeRef.map(Cl).sort().join(",")}]`);const o=t.conditionExpression;return o&&typeof o.body=="string"&&n.push(`cond=${o.body}`),n.join("|")}function SP(e){const t=new Map,n=new Map,i=(a,s)=>{a&&t.set(a,[...t.get(a)??[],...s])},o=a=>{const s=a;return s?[Da(s.x),Da(s.y),Da(s.width),Da(s.height)]:[]},r=a=>{if(Array.isArray(a))return a.forEach(r);if(!a||typeof a!="object")return;const s=a,c=String(s.$type??"");if(c==="bpmndi:BPMNShape"||c==="bpmndi:BPMNEdge"){const l=Cl(s.bpmnElement);if(c==="bpmndi:BPMNShape")i(l,o(s.bounds));else{const p=Array.isArray(s.waypoint)?s.waypoint:[];i(l,p.flatMap(d=>[Da(d.x),Da(d.y)]))}const u=s.label;u!=null&&u.bounds&&l&&n.set(l,o(u.bounds).slice(0,2));return}for(const l of Object.values(s))(Array.isArray(l)||l&&typeof l=="object"&&"$type"in l)&&r(l)};return r(e.diagrams),{body:t,labels:n}}function Yv(e){const t=SP(e),n=new Map,i=new Set,o=r=>{if(Array.isArray(r))return r.forEach(o);if(!r||typeof r!="object"||i.has(r))return;i.add(r);const a=r,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:")&&!_P.has(s)&&n.set(c,{type:s,props:EP(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")&&o(l)};return o(e),n}function Kv(e,t,n){if(e===t)return!1;const i=e===""?[]:e.split(",").map(Number),o=t===""?[]:t.split(",").map(Number);return i.length!==o.length?!0:i.some((r,a)=>Math.abs(r-o[a])>n)}function Xv(e,t,n={}){const i=n.moveTolerance??bP,o=Yv(e),r=Yv(t),a=[],s=[],c=[];for(const[l,u]of r){const p=o.get(l);if(!p){a.push(l);continue}(p.type!==u.type||p.props!==u.props||Kv(p.geometry,u.geometry,i)||Kv(p.label,u.label,n.labelTolerance??wP))&&c.push(l)}for(const l of o.keys())r.has(l)||s.push(l);return{added:a.sort(),removed:s.sort(),modified:c.sort()}}async function RP(e,t,n={}){const[i,o]=await Promise.all([Ra(e),Ra(t)]);return{...Xv(i.definitions,o.definitions,n),warnings:[...i.warnings,...o.warnings]}}function MP(e){return new Set([...e.added,...e.modified])}function Zv(e){return e.get("moddle").ids}function Jv(e,t,n){const i=Object.prototype.hasOwnProperty.call(e,"nextPrefixed"),o=e.nextPrefixed;e.nextPrefixed=t;try{return n()}finally{i?e.nextPrefixed=o:delete e.nextPrefixed}}function Qv(e,t){const n=Zv(e),i=n.nextPrefixed,o=[];return{value:Jv(n,function(a,s){const c=i.call(this,a,s);return o.push(c),c},t),generatedIds:o}}function ex(e,t,n){const i=Zv(e),o=i.nextPrefixed;let r=0,a=0,s=0;return{value:Jv(i,function(l,u){const p=t[r++];return p!==void 0&&p.startsWith(l)&&!this.assigned(p)?(this.claim(p,u),a++,p):(s++,o.call(this,l,u))},n),fed:a,missed:s,remaining:Math.max(0,t.length-r)}}function CP(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function tx(e,t,{currentVersion:n,i18n:i,recordGeneratedIds:o=!1}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const r=()=>Xd(e,t.ops,{i18n:i}),{value:a,generatedIds:s}=o?Qv(e,r):{value:r(),generatedIds:void 0};if(!a.ok)return{status:"rejected",issues:a.issues};const{xml:c}=await e.saveXML({format:!0});return{status:"applied",version:n+1,xml:c??"",findings:a.findings,stats:a.stats,...s?{generatedIds:s}:{}}}const Os=()=>typeof performance>"u"?Date.now():performance.now();function AP(e){return e.slice(0,3).map(t=>`${t.kind}${"message"in t&&t.message?`: ${t.message}`:""}`).join(" / ").slice(0,300)}class Qd extends Error{constructor(t,n){super(n),this.reason=t}}async function nx(e,t,{expectedXml:n,i18n:i}){const o=Os(),r=e.get("headlessReplay",!1);if(!r)return{status:"diverged",reason:"unsupported",detail:"HeadlessReplayModule 미탑재",ms:Math.round(Os()-o)};if(!t.length)return{status:"diverged",reason:"unsupported",detail:"배치 없음",ms:Math.round(Os()-o)};const a=e.get("commandStack"),s=Nm(a),c=t.flatMap(p=>p.generatedIds);let l;try{r.run(()=>{const p=ex(e,c,()=>{t.forEach((d,f)=>{f>0&&r.atBatchBoundary();const m=Xd(e,d.ops,{...i?{i18n:i}:{}});if(!m.ok)throw new Qd("rejected",`배치 ${f+1}/${t.length} — ${AP(m.issues)}`)})});if(p.missed||p.remaining)throw new Qd("ids",`주입 ${p.fed} · 떨어짐 ${p.missed} · 남음 ${p.remaining} / ${c.length}`)})}catch(p){l=p instanceof Qd?{reason:p.reason,detail:p.message}:{reason:"error",detail:(p instanceof Error?p.message:String(p)).slice(0,300)}}const u=$m(a,s);if(!l)try{const{xml:p}=await e.saveXML({format:!0});p!==n&&(l={reason:"xml"})}catch(p){l={reason:"error",detail:(p instanceof Error?p.message:String(p)).slice(0,300)}}return l?(u&&a.undo(),{status:"diverged",...l,ms:Math.round(Os()-o)}):{status:"replayed",ms:Math.round(Os()-o)}}const TP=new Set(["lasso","lasso.selection","hand","hand.move"]),ix=1e4,PP="bwl-edit-locked",ox=new WeakMap;function kP(e){const t=ox.get(e);if(t)return t;const n=e.get("eventBus"),i=e.get("dragging",!1);let o=!1,r=!1;n.on("drag.init",ix,()=>{var s;if(o)return TP.has((s=i==null?void 0:i.context())==null?void 0:s.prefix)?void 0:!1}),n.on(["contextPad.open.allowed","contextPad.trigger","palette.trigger","element.dblclick"],ix,()=>o?!1:void 0);const a={get locked(){return o},set(s){var l,u,p;if(s===o)return;o=s,e.get("canvas").getContainer().classList.toggle(PP,s);const c=e.get("keyboard",!1);s?(i==null||i.cancel(),(l=e.get("contextPad",!1))==null||l.close(),(u=e.get("popupMenu",!1))==null||u.close(),(p=e.get("directEditing",!1))==null||p.complete(),r=!!(c!=null&&c.getBinding()),c==null||c.unbind()):r&&(c.bind(),r=!1)}};return ox.set(e,a),a}const OP=Symbol("bpmn-editor"),ef={geometry:[],semantic:[]};function DP(){const e=Ce.ref(!1),t=Ce.ref(!0),n=Ce.ref(!1),i=Ce.shallowRef(ef),o=Ce.shallowRef(void 0),r=Ce.shallowRef(void 0);let a,s,c,l=!1;const u=()=>{if(d(),!c){i.value=ef;return}const g=ut(Ge(c.get("elementRegistry")),{includeObservationOnly:!0}),v=c.getDefinitions();i.value={geometry:g,semantic:v?Jd(v):[]}};function p(){return(c==null?void 0:c.get("i18nDisplay",!1))??void 0}function d(){const g=p();if(!g||!a){r.value=void 0;return}const v=g.locales(),b={};for(const S of v)b[S]={untranslated:g.untranslatedCount(S),reviewRequested:g.reviewRequestedCount(S)};r.value={designLocale:a.designLocale,locales:v,displayLocale:g.getDisplayLocale()??a.designLocale,counts:b}}function f(){const g=p();g&&(g.configure(a),a&&s&&(s=g.setDisplayLocale(s)))}const m=()=>{l||(e.value=!0,u())};function h(g,v){kP(g).set(!v)}function y(){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:o,i18n:r,configureI18n(g){a=g,f(),d()},setDisplayLocale(g){var b;s=g;const v=(b=p())==null?void 0:b.setDisplayLocale(g);v&&(s=v),d()},setChangeScope(g){o.value=g===void 0?void 0:new Set(g)},requestFocus(g){if(!c)return;const v=c.get("elementRegistry").get(g);v&&(c.get("canvas").scrollToElement(v,180),c.get("selection").select(v))},describeElement(g){const v=c==null?void 0:c.get("elementRegistry").get(g),b=v==null?void 0:v.businessObject;if(!b)return;const S=typeof b.name=="string"&&b.name.trim()!==""?b.name:b.text;return{name:typeof S=="string"&&S.trim()!==""?S.trim():void 0,type:typeof b.$type=="string"?b.$type:""}},attach(g){c&&this.detach(),c=g,c.get("eventBus").on("commandStack.changed",m),t.value||h(c,!1),f(),u()},detach(){c==null||c.get("eventBus").off("commandStack.changed",m),c&&!t.value&&h(c,!0),c=void 0,i.value=ef,o.value=void 0,r.value=void 0},setEditable(g){t.value=g,c&&h(c,g)},async applyAgentBatch(g,v){const b=y();n.value=!0;try{const S=await tx(b,g,{currentVersion:v,...a?{i18n:{designLocale:a.designLocale,companionLocales:a.companionLocales}}:{}});return S.status==="applied"&&(e.value=!1),S}finally{n.value=!1}},async replayAgentTurn(g,v){const b=y(),S=e.value;n.value=!0,l=!0;try{const M=await nx(b,g,{expectedXml:v,...a?{i18n:{designLocale:a.designLocale,companionLocales:a.companionLocales}}:{}});return e.value=M.status==="replayed"?!1:S,M}finally{l=!1,n.value=!1,u()}},async importXml(g){const{warnings:v}=await y().importXML(g);return e.value=!1,o.value=void 0,u(),{warnings:vd(v)}},async saveXml(){const{xml:g}=await y().saveXML({format:!0});return e.value=!1,g??""},undo:()=>{var g;return(g=w())==null?void 0:g.undo()},redo:()=>{var g;return(g=w())==null?void 0:g.redo()},canUndo:()=>{var g;return((g=w())==null?void 0:g.canUndo())??!1},canRedo:()=>{var g;return((g=w())==null?void 0:g.canRedo())??!1}}}const LP=new RegExp("\\p{Script=Hangul}","u"),IP=/[\p{Script=Hiragana}\p{Script=Katakana}]/u,BP=new RegExp("\\p{Script=Han}","u");function Al(e){const t=LP.test(e),n=IP.test(e);return t&&n?{script:"mixed"}:t?{script:"hangul",locale:"ko"}:n?{script:"kana",locale:"ja"}:{script:BP.test(e)?"han":"other"}}function rx(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 ax(e){var i;const t=new Set,n=[];for(const o of(e==null?void 0:e.diagrams)??[])for(const r of((i=o==null?void 0:o.plane)==null?void 0:i.planeElement)??[]){const a=r==null?void 0:r.bpmnElement;if(!a||t.has(a))continue;t.add(a);const s=Jo(a);if(!s)continue;const c=s.target[s.key]??"";c&&n.push({bo:a,name:c,trs:Ui(a).filter(l=>ln(l))})}return n}const Ds=e=>({id:e.bo.id,type:e.bo.$type,name:e.name});function NP(e,t={}){const n=rx(e),i=ax(e);let o;const r={},a=[],s=[],c=[];for(const h of i){const y=h.trs.filter(w=>(w.body??"")===h.name).map(ln);if(y.length){const w=[...y].sort().join("+");r[w]=(r[w]??0)+1,o=o?new Set([...o].filter(g=>y.includes(g))):new Set(y)}else h.trs.some(w=>w.body)?a.push(Ds(h)):c.push({e:h,inference:Al(h.name)});for(const w of h.trs){const g=ln(w),v=w.body??"",b=Al(v);b.locale&&b.locale!==g?s.push({...Ds(h),locale:g,script:b.script}):g==="ko"&&b.script==="han"&&h.trs.some(S=>S!==w&&S.body===v)&&s.push({...Ds(h),locale:g,script:"han"})}}const l=new Set(c.map(h=>h.inference.locale).filter(Boolean));let u,p;if(n)p="kept";else if(o&&o.size===1)[u,p]=[[...o][0],"matched"];else if(o&&o.size>1){const h=l.size===1?[...l][0]:void 0;h&&o.has(h)?[u,p]=[h,"matched"]:p="ambiguous"}else o?p="mixed":l.size===1?[u,p]=[[...l][0],"script"]:p=l.size>1?"mixed":"no-evidence";u&&t.designLocale&&u!==t.designLocale&&([u,p]=[void 0,"non-design"]);const d=n??u,f=[],m=[];for(const{e:h,inference:y}of c)y.locale?y.locale!==d&&f.push({...Ds(h),locale:y.locale}):m.push({...Ds(h),script:y.script});return{root:{current:n,proposed:u,reason:p},additions:f,undecided:m,drift:a,matchedBy:r,scriptMismatch:s}}function $P(e,t){const n=e.$model;let i=0;if(t.root.proposed&&!rx(e)&&(e.set("xml:lang",t.root.proposed),i++),!t.additions.length)return i;const o=new Map(ax(e).map(r=>[r.bo.id,r]));for(const{id:r,name:a,locale:s}of t.additions){const c=o.get(r);if(!c||c.name!==a||c.trs.some(d=>d.body))continue;const l=c.trs.find(d=>ln(d)===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(jr,{body:c.name});p.set("xml:lang",s),p.$parent=u,u.get("values").push(p),i++}return i}function sx(e){var i;const t=new Set,n=[];for(const o of(e==null?void 0:e.diagrams)??[])for(const r of((i=o==null?void 0:o.plane)==null?void 0:i.planeElement)??[]){const a=r==null?void 0:r.bpmnElement;!(a!=null&&a.id)||t.has(a)||(t.add(a),n.push(a))}return n}const tf=e=>ln(e)||void 0,cx=e=>e.body??"";function lx(e){const t=new Map;for(const n of sx(e)){const i=Ui(n);i.length&&t.set(n.id,{type:n.$type,cells:i.map(o=>({locale:tf(o),body:cx(o)}))})}return t}const ux=e=>JSON.stringify(e.map(t=>t.body).sort());class FP{constructor(){on(this,"byId",new Map);on(this,"byBodies",new Map)}add(t,n,i){for(const[o,r]of i){if(!r.cells.some(s=>s.locale))continue;const a={doc:t,version:n,id:o,state:r};px(this.byId,o,a),px(this.byBodies,ux(r.cells),a)}}sameId(t){return this.byId.get(t)??[]}sameBodies(t){return this.byBodies.get(ux(t))??[]}}function px(e,t,n){const i=e.get(t);i?i.push(n):e.set(t,[n])}function jP(e,t,n){var s;const i=new Set(t.cells.filter(c=>c.locale).map(c=>c.body)),o=new Map,r=(c,l)=>(c??[]).filter(u=>!u.locale&&u.body===l).length,a=t.cells.every(c=>!c.locale);for(const c of t.cells){if(c.locale||i.has(c.body)||o.has(c.body))continue;const l=r(t.cells,c.body)-(a?0:n?r((s=n.get(e))==null?void 0:s.cells,c.body):1/0);l>0&&o.set(c.body,l)}return o}function nf(e,t){return[...t.keys()].every(n=>e.cells.some(i=>i.body===n))&&e.cells.some(n=>n.locale&&t.has(n.body))}function HP(e,t,n){const i=new Set(e.cells.filter(r=>r.locale).map(r=>r.locale)),o={cells:[],stale:[],overflow:!1};for(const[r,a]of n){const s=[...new Set(t.cells.filter(l=>l.body===r&&l.locale).map(l=>l.locale))],c=s.filter(l=>!i.has(l));for(const l of s)i.has(l)&&o.stale.push({body:r,locale:l});c.length>a&&(o.overflow=!0);for(const l of c.slice(0,a))o.cells.push({body:r,locale:l}),i.add(l)}return o}const GP=e=>JSON.stringify([...e.cells].sort((t,n)=>(t.body+t.locale).localeCompare(n.body+n.locale)));function zP(e,t){const n={restores:[],ambiguous:[],stale:[],unresolved:[]},i=lx(e),o=new Set([...i.values()].flatMap(a=>a.cells.map(s=>s.locale).filter(s=>!!s))),r=a=>!o.size||[...o].some(s=>!a.cells.some(c=>c.locale===s));for(const[a,s]of i){const c=jP(a,s,t.baseline);if(!c.size)continue;const l={id:a,type:s.type},p=[["history",t.index.sameId(a).filter(y=>y.doc===t.doc&&nf(y.state,c)).sort((y,w)=>w.version-y.version).slice(0,1).map(y=>y.state)],["lineage",t.index.sameId(a).filter(y=>y.doc!==t.doc&&nf(y.state,c)).map(y=>y.state)],["bodies",t.index.sameBodies(s.cells).filter(y=>!(y.doc===t.doc&&y.id===a)&&nf(y.state,c)).map(y=>y.state)]].find(([,y])=>y.length);if(!p){if(!r(s))continue;for(const[y,w]of c)for(let g=0;g<w;g++)n.unresolved.push({...l,body:y,script:Al(y).script});continue}const[d,f]=p,m=f.map(y=>HP(s,y,c));if(m.some(y=>y.overflow)||new Set(m.map(GP)).size>1){n.ambiguous.push({...l,source:d});continue}const[h]=m;for(const y of h.stale)n.stale.push({...l,...y});h.cells.length&&n.restores.push({...l,source:d,cells:h.cells})}return n}function VP(e,t){if(!t.restores.length)return 0;const n=new Map(sx(e).map(o=>[o.id,o]));let i=0;for(const o of t.restores){const r=n.get(o.id);if(!r)continue;const a=Ui(r),s=new Set(a.map(tf).filter(Boolean));for(const{body:c,locale:l}of o.cells){if(s.has(l))continue;const u=a.find(p=>!tf(p)&&cx(p)===c);u&&(u.set("xml:lang",l),s.add(l),i++)}}return i}function je(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function WP(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var of={exports:{}},dx;function UP(){if(dx)return of.exports;dx=1;var e=of.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),o=2;i===1/0;o*=2)i=Math.log(Math.pow(2,t/o))/Math.log(n)*o;for(var r=i-Math.floor(i),a="",o=0;o<Math.floor(i);o++){var s=Math.floor(Math.random()*n).toString(n);a=s+a}if(r){var c=Math.pow(n,r),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 o=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(r,c));return r[c]=a,c},r=o.hats={};return o.get=function(a){return o.hats[a]},o.set=function(a,s){return o.hats[a]=s,o},o.bits=t||128,o.base=n||16,o},of.exports}var qP=UP(),YP=WP(qP);function so(e){if(!(this instanceof so))return new so(e);e=e||[128,36,1],this._seed=e.length?YP.rack(e[0],e[1],e[2]):e}so.prototype.next=function(e){return this._seed(e||!0)},so.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},so.prototype.claim=function(e,t){this._seed.set(e,t||!0)},so.prototype.assigned=function(e){return this._seed.get(e)||!1},so.prototype.unclaim=function(e){delete this._seed.hats[e]},so.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const Rn={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};Rn.td=Rn.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],Rn.option=Rn.optgroup=[1,'<select multiple="multiple">',"</select>"],Rn.thead=Rn.tbody=Rn.colgroup=Rn.caption=Rn.tfoot=[1,"<table>","</table>"],Rn.polyline=Rn.ellipse=Rn.polygon=Rn.circle=Rn.text=Rn.line=Rn.path=Rn.rect=Rn.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function Wt(e,t=globalThis.document){var l;if(typeof e!="string")throw new TypeError("String expected");const n=/^<!--(.*?)-->$/s.exec(e);if(n)return t.createComment(n[1]);const i=(l=/<([\w:]+)/.exec(e))==null?void 0:l[1];if(!i)return t.createTextNode(e);if(e=e.trim(),i==="body"){const u=t.createElement("html");u.innerHTML=e;const{lastChild:p}=u;return p.remove(),p}let[o,r,a]=Object.hasOwn(Rn,i)?Rn[i]:Rn._default,s=t.createElement("div");for(s.innerHTML=r+e+a;o--;)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 KP(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 o=Object.getOwnPropertyDescriptor(n,i);Object.defineProperty(e,i,o.get?o:{enumerable:!0,get:function(){return n[i]}})}})}),Object.freeze(e)}function Zn(e,...t){const n=e.style;return K(t,function(i){i&&K(i,function(o,r){n[r]=o})}),e}function On(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const XP=Object.prototype.toString;function Dt(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 XP.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 Tl(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Ur(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function ZP(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Pl={},fx;function JP(){if(fx)return Pl;fx=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return Pl.bind=function(o,r,a,s){return e||i(),o[e](n+r,a,s||!1),a},Pl.unbind=function(o,r,a,s){return t||i(),o[t](n+r,a,s||!1),a},Pl}var hx=JP(),QP=ZP(hx),Ke=KP({__proto__:null,default:QP},[hx]),gx=["focus","blur"];function ek(e,t,n,i,o){return gx.indexOf(n)!==-1&&(o=!0),Ke.bind(e,n,function(r){var a=r.target||r.srcElement;r.delegateTarget=Ur(a,t,!0),r.delegateTarget&&i.call(e,r)},o)}function tk(e,t,n,i){return gx.indexOf(t)!==-1&&(i=!0),Ke.unbind(e,t,n,i)}var li={bind:ek,unbind:tk};function rf(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function kt(e,t){return t=t||document,t.querySelector(e)}function Ls(e,t){return t=t||document,t.querySelectorAll(e)}function co(e){e.parentNode&&e.parentNode.removeChild(e)}function nk(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function ik(e,t){return t.appendChild(nk(e,t))}function ot(e,t){return ik(t,e),e}var af=2,mx={"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":af,"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":af,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function ok(e,t){return mx[t]?e.style[t]:e.getAttributeNS(null,t)}function yx(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),o=mx[i];o?(o===af&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function rk(e,t){var n=Object.keys(t),i,o;for(i=0,o;o=n[i];i++)yx(e,o,t[o])}function Le(e,t,n){if(typeof t=="string")if(n!==void 0)yx(e,t,n);else return ok(e,t);else rk(e,t);return e}const ak=Object.prototype.toString;function vt(e){return new cr(e)}function cr(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}cr.prototype.add=function(e){return this.list.add(e),this},cr.prototype.remove=function(e){return ak.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},cr.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},cr.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},cr.prototype.array=function(){return Array.from(this.list)},cr.prototype.has=cr.prototype.contains=function(e){return this.list.contains(e)};function Is(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function sf(e){return e.cloneNode(!0)}var cf={svg:"http://www.w3.org/2000/svg"},vx='<svg xmlns="'+cf.svg+'"';function sk(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(cf.svg)===-1&&(e=vx+e.substring(4)):(e=vx+">"+e+"</svg>",t=!0);var n=ck(e);if(!t)return n;for(var i=document.createDocumentFragment(),o=n.firstChild;o.firstChild;)i.appendChild(o.firstChild);return i}function ck(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function We(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=sk(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(cf.svg,e),t&&Le(n,t),n}var lf=null;function xx(){return lf===null&&(lf=We("svg")),lf}function bx(e,t){var n,i,o=Object.keys(t);for(n=0;i=o[n];n++)e[i]=t[i];return e}function lk(e,t,n,i,o,r){var a=xx().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return bx(a,e);case 6:return bx(a,{a:e,b:t,c:n,d:i,e:o,f:r})}}function Bs(e){return xx().createSVGTransform()}var wx=/([&<>]{1})/g,uk=/([&<>\n\r"]{1})/g,pk={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"'"};function uf(e,t){function n(i,o){return pk[o]||o}return e.replace(t,n)}function _x(e,t){var n,i,o,r,a;switch(e.nodeType){case 3:t.push(uf(e.textContent,wx));break;case 1:if(t.push("<",e.tagName),e.hasAttributes())for(o=e.attributes,n=0,i=o.length;n<i;++n)r=o.item(n),t.push(" ",r.name,'="',uf(r.value,uk),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)_x(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",uf(e.nodeValue,wx),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function dk(e){for(var t=e.firstChild,n=[];t;)_x(t,n),t=t.nextSibling;return n.join("")}function Ex(e,t){return dk(e)}function mn(e){var t=e.parentNode;return t&&t.removeChild(e),e}function fk(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function hk(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(fk(e,i))}function Ns(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),hk(n,t)),n.consolidate()}const gk=/^class[ {]/;function mk(e){return gk.test(e.toString())}function pf(e){return Array.isArray(e)}function df(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function kl(...e){e.length===1&&pf(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const yk=/constructor\s*[^(]*\(\s*([^)]*)\)/m,vk=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,xk=/\/\*([^*]*)\*\//m;function bk(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(mk(e)?yk:vk);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const o=i.match(xk);return(o&&o[1]||i).trim()})||[]}function Sx(e,t){const n=t||{get:function(v,b){if(i.push(v),b===!1)return null;throw s(`No provider for "${v}"!`)}},i=[],o=this._providers=Object.create(n._providers||null),r=this._instances=Object.create(null),a=r.injector=this,s=function(v){const b=i.join(" -> ");return i.length=0,new Error(b?`${v} (Resolving: ${b})`:v)};function c(v,b){if(!o[v]&&v.includes(".")){const S=v.split(".");let M=c(S.shift());for(;S.length;)M=M[S.shift()];return M}if(df(r,v))return r[v];if(df(o,v)){if(i.indexOf(v)!==-1)throw i.push(v),s("Cannot resolve circular dependency!");return i.push(v),r[v]=o[v][0](o[v][1]),i.pop(),r[v]}return n.get(v,b)}function l(v,b){if(typeof b>"u"&&(b={}),typeof v!="function")if(pf(v))v=kl(v.slice());else throw s(`Cannot invoke "${v}". Expected a function!`);const M=(v.$inject||bk(v)).map(B=>df(b,B)?b[B]:c(B));return{fn:v,dependencies:M}}function u(v){const{fn:b,dependencies:S}=l(v),M=Function.prototype.bind.call(b,null,...S);return new M}function p(v,b,S){const{fn:M,dependencies:B}=l(v,S);return M.apply(b,B)}function d(v){return kl(b=>v.get(b))}function f(v,b){if(b&&b.length){const S=Object.create(null),M=Object.create(null),B=[],A=[],I=[];let H,V,G,ie;for(let pe in o)H=o[pe],b.indexOf(pe)!==-1&&(H[2]==="private"?(V=B.indexOf(H[3]),V===-1?(G=H[3].createChild([],b),ie=d(G),B.push(H[3]),A.push(G),I.push(ie),S[pe]=[ie,pe,"private",G]):S[pe]=[I[V],pe,"private",A[V]]):S[pe]=[H[2],H[1]],M[pe]=!0),(H[2]==="factory"||H[2]==="type")&&H[1].$scope&&b.forEach(Y=>{H[1].$scope.indexOf(Y)!==-1&&(S[pe]=[H[2],H[1]],M[Y]=!0)});b.forEach(pe=>{if(!M[pe])throw new Error('No provider for "'+pe+'". Cannot use provider from the parent!')}),v.unshift(S)}return new Sx(v,a)}const m={factory:p,type:u,value:function(v){return v}};function h(v,b){const S=v.__init__||[];return function(){S.forEach(M=>{typeof M=="string"?b.get(M):b.invoke(M)})}}function y(v){const b=v.__exports__;if(b){const S=v.__modules__,M=Object.keys(v).reduce((V,G)=>(G!=="__exports__"&&G!=="__modules__"&&G!=="__init__"&&G!=="__depends__"&&(V[G]=v[G]),V),Object.create(null)),B=(S||[]).concat(M),A=f(B),I=kl(function(V){return A.get(V)});b.forEach(function(V){o[V]=[I,V,"private",A]});const H=(v.__init__||[]).slice();return H.unshift(function(){A.init()}),v=Object.assign({},v,{__init__:H}),h(v,A)}return Object.keys(v).forEach(function(S){if(S==="__init__"||S==="__depends__")return;const M=v[S];if(M[2]==="private"){o[S]=M;return}const B=M[0],A=M[1];o[S]=[m[B],wk(B,A),B]}),h(v,a)}function w(v,b){return v.indexOf(b)!==-1||(v=(b.__depends__||[]).reduce(w,v),v.indexOf(b)!==-1)?v:v.concat(b)}function g(v){const b=v.reduce(w,[]).map(y);let S=!1;return function(){S||(S=!0,b.forEach(M=>M()))}}this.get=c,this.invoke=p,this.instantiate=u,this.createChild=f,this.init=g(e)}function wk(e,t){return e!=="value"&&pf(t)&&(t=kl(t.slice())),t}var _k=1e3;function ko(e,t){var n=this;t=t||_k,e.on(["render.shape","render.connection"],t,function(i,o){var r=i.type,a=o.element,s=o.gfx,c=o.attrs;if(n.canRender(a))return r==="render.shape"?n.drawShape(s,a,c):n.drawConnection(s,a,c)}),e.on(["render.getShapePath","render.getConnectionPath"],t,function(i,o){if(n.canRender(o))return i.type==="render.getShapePath"?n.getShapePath(o):n.getConnectionPath(o)})}ko.prototype.canRender=function(e){},ko.prototype.drawShape=function(e,t){},ko.prototype.drawConnection=function(e,t){},ko.prototype.getShapePath=function(e){},ko.prototype.getConnectionPath=function(e){};function qr(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function Ek(e){return["M",e.x,e.y]}function ff(e){return["L",e.x,e.y]}function Sk(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function Rk(e,t){const n=e.length,i=[Ek(e[0])];for(let o=1;o<n;o++){const r=e[o-1],a=e[o],s=e[o+1];if(!s||!t){i.push(ff(a));continue}const c=Math.min(t,hf(a.x-r.x,a.y-r.y),hf(s.x-a.x,s.y-a.y));if(!c){i.push(ff(a));continue}const l=Ol(a,r,c),u=Ol(a,r,c*.5),p=Ol(a,s,c),d=Ol(a,s,c*.5);i.push(ff(l)),i.push(Sk(u,d,p))}return i}function Ol(e,t,n){const i=t.x-e.x,o=t.y-e.y,r=hf(i,o),a=n/r;return{x:e.x+i*a,y:e.y+o*a}}function hf(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function $s(e,t,n){tt(t)&&(n=t,t=null),t||(t={});const i=We("path",t);return tt(n)&&(i.dataset.cornerRadius=String(n)),gf(i,e)}function gf(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return Le(e,{d:qr(Rk(t,n))}),e}function Dl(e){var t=new Set(e);return gt(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function Yr(e,t,n){n=n||0,et(e)||(e=[e]),K(e,function(i,o){var r=t(i,o,n);et(r)&&r.length&&Yr(r,t,n+1)})}function mf(e,t,n){var i=new Set,o=new Set;return Yr(e,function(r,a,s){i.add(r);var c=r.children;if(c&&!o.has(c))return o.add(c),c}),Array.from(i)}function Fs(e,t){return mf(e)}function Mk(e,t,n){Fr(t)&&(t=!0),Sn(t)&&(n=t,t=!0),n=n||{};var i=js(n.allShapes),o=js(n.allConnections),r=js(n.enclosedElements),a=js(n.enclosedConnections),s=js(n.topLevel,t&&wa(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]=r[u.id]=u),o[u.id]=u}function l(u){if(r[u.id]=u,u.waypoints)a[u.id]=o[u.id]=u;else return i[u.id]=u,K(u.incoming,c),K(u.outgoing,c),u.children}return Yr(e,l),{allShapes:i,allConnections:o,topLevel:s,enclosedConnections:a,enclosedElements:r}}function yn(e,t){t=!!t,et(e)||(e=[e]);var n,i,o,r;return K(e,function(a){var s=a;a.waypoints&&!t&&(s=yn(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>o||o===void 0)&&(o=c+p),(l+u>r||r===void 0)&&(r=l+u)}),{x:n,y:i,height:r-i,width:o-n}}function La(e,t){var n={};return K(e,function(i){var o=i;o.waypoints&&(o=yn(o)),!tt(t.y)&&o.x>t.x&&(n[i.id]=i),!tt(t.x)&&o.y>t.y&&(n[i.id]=i),o.x>t.x&&o.y>t.y&&(tt(t.width)&&tt(t.height)&&o.width+o.x<t.width+t.x&&o.height+o.y<t.height+t.y||!tt(t.width)||!tt(t.height))&&(n[i.id]=i)}),n}function Rx(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function Mx(e){return!!(e&&e.isFrame)}function js(e,t){return te({},e||{},t||{})}var Ck=1;function lr(e,t){ko.call(this,e,Ck),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})}je(lr,ko),lr.prototype.canRender=function(){return!0},lr.prototype.drawShape=function(t,n,i){var o=We("rect");return Le(o,{x:0,y:0,width:n.width||0,height:n.height||0}),Mx(n)?Le(o,te({},this.FRAME_STYLE,i||{})):Le(o,te({},this.SHAPE_STYLE,i||{})),ot(t,o),o},lr.prototype.drawConnection=function(t,n,i){var o=$s(n.waypoints,te({},this.CONNECTION_STYLE,i||{}));return ot(t,o),o},lr.prototype.getShapePath=function(t){var n=t.x,i=t.y,o=t.width,r=t.height,a=[["M",n,i],["l",o,0],["l",0,r],["l",-o,0],["z"]];return qr(a)},lr.prototype.getConnectionPath=function(t){var n=t.waypoints,i,o,r=[];for(i=0;o=n[i];i++)o=o.original||o,r.push([i===0?"M":"L",o.x,o.y]);return qr(r)},lr.$inject=["eventBus","styles"];function Ak(){var e={"no-fill":{fill:"none"},"no-border":{strokeOpacity:0},"no-events":{pointerEvents:"none"}},t=this;this.cls=function(n,i,o){var r=this.style(i,o);return te(r,{class:n})},this.style=function(n,i){!et(n)&&!i&&(i=n,n=[]);var o=ci(n,function(r,a){return te(r,e[a]||{})},{});return i?te(o,i):o},this.computeStyle=function(n,i,o){return et(i)||(o=i,i=[]),t.style(i||[],te({},o,n||{}))}}const Tk={__init__:["defaultRenderer"],defaultRenderer:["type",lr],styles:["type",Ak]};function an(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function un(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 yf(e,t){return!e||!t?-1:e.indexOf(t)}function Hs(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function vf(e,t,n,i){if(typeof i>"u"&&(i=5),!e||!t||!n)return!1;var o=(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),r=Hs(e,t);return Math.abs(o/r)<=i}var Pk=2;function Oo(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[o,r]of Object.entries(i))if(kk(o,n))return r;return!1}function kk(e,t){const n=t[0];return Xo(t,function(i){return Math.abs(n[e]-i[e])<=Pk})}function Cx(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 xf(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var Ok=/,?([a-z]),?/gi,Ax=parseFloat,vn=Math,ur=vn.PI,lo=vn.min,uo=vn.max,Tx=vn.pow,pr=vn.abs,Dk=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,Lk=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,Px=Array.isArray||function(e){return e instanceof Array};function Ik(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Bk(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 Nk(e){function t(){var n=Array.prototype.slice.call(arguments,0),i=n.join("␀"),o=t.cache=t.cache||{},r=t.count=t.count||[];return Ik(o,i)?(Bk(r,i),o[i]):(r.length>=1e3&&delete o[r.shift()],r.push(i),o[i]=e(...arguments),o[i])}return t}function $k(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(Dk,function(i,o,r){var a=[],s=o.toLowerCase();for(r.replace(Lk,function(c,l){l&&a.push(+l)}),s=="m"&&a.length>2&&(n.push([o,...a.splice(0,2)]),s="l",o=o=="m"?"l":"L");a.length>=t[s]&&(n.push([o,...a.splice(0,t[s])]),!!t[s]););}),n.toString=wf,n}function Fk(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 jk(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 bf(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 wf(){return this.join(",").replace(Ok,"$1")}function Hk(e){for(var t=new Array(e.length),n=0,i=e.length;n<i;n++)for(var o=e[n],r=t[n]=new Array(o.length),a=0,s=o.length;a<s;a++)r[a]=o[a];return t.toString=wf,t}function kx(e,t,n,i,o,r,a,s,c){var l=1-c,u=Tx(l,3),p=Tx(l,2),d=c*c,f=d*c,m=u*e+p*3*c*n+l*3*c*c*o+f*a,h=u*t+p*3*c*i+l*3*c*c*r+f*s;return{x:Ll(m),y:Ll(h)}}function Ox(e){var t=qk(...e);return bf(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function dr(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function Gk(e,t){return e=bf(e),t=bf(t),dr(t,e.x,e.y)||dr(t,e.x2,e.y)||dr(t,e.x,e.y2)||dr(t,e.x2,e.y2)||dr(e,t.x,t.y)||dr(e,t.x2,t.y)||dr(e,t.x,t.y2)||dr(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 Dx(e,t,n,i,o){var r=-3*t+9*n-9*i+3*o,a=e*r+6*t-12*n+6*i;return e*a-3*t+3*n}function Lx(e,t,n,i,o,r,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],d=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],f=0,m=0;m<u;m++){var h=l*p[m]+l,y=Dx(h,e,n,o,a),w=Dx(h,t,i,r,s),g=y*y+w*w;f+=d[m]*vn.sqrt(g)}return l*f}function zk(e,t,n,i,o,r,a,s){if(!(uo(e,n)<lo(o,a)||lo(e,n)>uo(o,a)||uo(t,i)<lo(r,s)||lo(t,i)>uo(r,s))){var c=(e*i-t*n)*(o-a)-(e-n)*(o*s-r*a),l=(e*i-t*n)*(r-s)-(t-i)*(o*s-r*a),u=(e-n)*(r-s)-(t-i)*(o-a);if(u){var p=Ll(c/u),d=Ll(l/u),f=+p.toFixed(2),m=+d.toFixed(2);if(!(f<+lo(e,n).toFixed(2)||f>+uo(e,n).toFixed(2)||f<+lo(o,a).toFixed(2)||f>+uo(o,a).toFixed(2)||m<+lo(t,i).toFixed(2)||m>+uo(t,i).toFixed(2)||m<+lo(r,s).toFixed(2)||m>+uo(r,s).toFixed(2)))return{x:p,y:d}}}}function Ll(e){return Math.round(e*1e11)/1e11}function Vk(e,t,n){var i=Ox(e),o=Ox(t);if(!Gk(i,o))return[];var r=Lx(...e),a=Lx(...t),s=Bx(e)?1:~~(r/5)||1,c=Bx(t)?1:~~(a/5)||1,l=new Array(s+1),u=new Array(c+1),p={},d=[],f,m;for(f=0;f<s+1;f++){var h=kx(...e,f/s);l[f]={x:h.x,y:h.y,t:f/s}}for(f=0;f<c+1;f++)h=kx(...t,f/c),u[f]={x:h.x,y:h.y,t:f/c};for(f=0;f<s;f++)for(m=0;m<c;m++){var y=l[f],w=l[f+1],g=u[m],v=u[m+1],b=pr(w.x-y.x)<.01?"y":"x",S=pr(v.x-g.x)<.01?"y":"x",M=zk(y.x,y.y,w.x,w.y,g.x,g.y,v.x,v.y),B;if(M){if(B=M.x.toFixed(9)+"#"+M.y.toFixed(9),p[B])continue;p[B]=!0;var A=y.t+pr((M[b]-y[b])/(w[b]-y[b]))*(w.t-y.t),I=g.t+pr((M[S]-g[S])/(v[S]-g[S]))*(v.t-g.t);A>=0&&A<=1&&I>=0&&I<=1&&d.push({x:M.x,y:M.y,t1:A,t2:I})}}return d}function Ix(e,t,n){e=Fx(e),t=Fx(t);for(var i,o,r,a,s,c,l,u,p,d,f=n?0:[],m=0,h=e.length;m<h;m++){var y=e[m];if(y[0]=="M")i=s=y[1],o=c=y[2];else{y[0]=="C"?(p=[i,o,...y.slice(1)],i=p[6],o=p[7]):(p=[i,o,i,o,s,c,s,c],i=s,o=c);for(var w=0,g=t.length;w<g;w++){var v=t[w];if(v[0]=="M")r=l=v[1],a=u=v[2];else{v[0]=="C"?(d=[r,a,...v.slice(1)],r=d[6],a=d[7]):(d=[r,a,r,a,l,u,l,u],r=l,a=u);var b=Vk(p,d);{for(var S=0,M=b.length;S<M;S++)b[S].segment1=m,b[S].segment2=w,b[S].bez1=p,b[S].bez2=d;f=f.concat(b)}}}}}return f}function Wk(e){return Px(e)&&Px(e[0])}function Uk(e){if(Fk(e))return e;var t=new Array(e.length),n=0,i=0,o=0,r=0,a=0,s;e[0][0]=="M"&&(n=+e[0][1],i=+e[0][2],o=n,r=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":o=+l[1]+n,r=+l[2]+i;default:for(var d=1,f=l.length;d<f;d++)c[d]=+l[d]+(d%2?n:i)}else for(var m=0,h=l.length;m<h;m++)c[m]=l[m];switch(s=s.toUpperCase(),c[0]){case"Z":n=+o,i=+r;break;case"H":n=c[1];break;case"V":i=c[1];break;case"M":o=c[c.length-2],r=c[c.length-1];default:n=c[c.length-2],i=c[c.length-1]}}return t.toString=wf,t}function Bx(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function Il(e,t,n,i){return[e,t,n,i,n,i]}function Nx(e,t,n,i,o,r){var a=.3333333333333333,s=2/3;return[a*e+s*n,a*t+s*i,a*o+s*n,a*r+s*i,o,r]}function $x(e,t,n,i,o,r,a,s,c,l){var u=ur*120/180,p=ur/180*(+o||0),d=[],f,m=Nk(function(F,C,R){var J=F*vn.cos(R)-C*vn.sin(R),ne=F*vn.sin(R)+C*vn.cos(R);return{x:J,y:ne}});if(l)B=l[0],A=l[1],S=l[2],M=l[3];else{f=m(e,t,-p),e=f.x,t=f.y,f=m(s,c,-p),s=f.x,c=f.y;var h=(e-s)/2,y=(t-c)/2,w=h*h/(n*n)+y*y/(i*i);w>1&&(w=vn.sqrt(w),n=w*n,i=w*i);var g=n*n,v=i*i,b=(r==a?-1:1)*vn.sqrt(pr((g*v-g*y*y-v*h*h)/(g*y*y+v*h*h))),S=b*n*y/i+(e+s)/2,M=b*-i*h/n+(t+c)/2,B=vn.asin(((t-M)/i).toFixed(9)),A=vn.asin(((c-M)/i).toFixed(9));B=e<S?ur-B:B,A=s<S?ur-A:A,B<0&&(B=ur*2+B),A<0&&(A=ur*2+A),a&&B>A&&(B=B-ur*2),!a&&A>B&&(A=A-ur*2)}var I=A-B;if(pr(I)>u){var H=A,V=s,G=c;A=B+u*(a&&A>B?1:-1),s=S+n*vn.cos(A),c=M+i*vn.sin(A),d=$x(s,c,n,i,o,0,a,V,G,[A,H,S,M])}I=A-B;var ie=vn.cos(B),pe=vn.sin(B),Y=vn.cos(A),Te=vn.sin(A),Pe=vn.tan(I/4),ke=4/3*n*Pe,ve=4/3*i*Pe,W=[e,t],de=[e+ke*pe,t-ve*ie],z=[s+ke*Te,c-ve*Y],ee=[s,c];if(de[0]=2*W[0]-de[0],de[1]=2*W[1]-de[1],l)return[de,z,ee].concat(d);d=[de,z,ee].concat(d).join().split(",");for(var he=[],se=0,Ae=d.length;se<Ae;se++)he[se]=se%2?m(d[se-1],d[se],p).y:m(d[se],d[se+1],p).x;return he}function qk(e,t,n,i,o,r,a,s){for(var c=[],l=[[],[]],u,p,d,f,m,h,y,w,g=0;g<2;++g){if(g==0?(p=6*e-12*n+6*o,u=-3*e+9*n-9*o+3*a,d=3*n-3*e):(p=6*t-12*i+6*r,u=-3*t+9*i-9*r+3*s,d=3*i-3*t),pr(u)<1e-12){if(pr(p)<1e-12)continue;f=-d/p,0<f&&f<1&&c.push(f);continue}y=p*p-4*d*u,w=vn.sqrt(y),!(y<0)&&(m=(-p+w)/(2*u),0<m&&m<1&&c.push(m),h=(-p-w)/(2*u),0<h&&h<1&&c.push(h))}for(var v=c.length,b=v,S;v--;)f=c[v],S=1-f,l[0][v]=S*S*S*e+3*S*S*f*n+3*S*f*f*o+f*f*f*a,l[1][v]=S*S*S*t+3*S*S*f*i+3*S*f*f*r+f*f*f*s;return l[0][b]=e,l[1][b]=t,l[0][b+1]=a,l[1][b+1]=s,l[0].length=l[1].length=b+2,{x0:lo(...l[0]),y0:lo(...l[1]),x1:uo(...l[0]),y1:uo(...l[1])}}function Fx(e){if(Wk(e)||(e=$k(e)),jk(e))return e;for(var t=Hk(Uk(e)),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i=function(d,f,m){var h,y;if(!d)return["C",f.x,f.y,f.x,f.y,f.x,f.y];switch(!(d[0]in{T:1,Q:1})&&(f.qx=f.qy=null),d[0]){case"M":f.X=d[1],f.Y=d[2];break;case"A":d=["C",...$x(f.x,f.y,...d.slice(1))];break;case"S":m=="C"||m=="S"?(h=f.x*2-f.bx,y=f.y*2-f.by):(h=f.x,y=f.y),d=["C",h,y,...d.slice(1)];break;case"T":m=="Q"||m=="T"?(f.qx=f.x*2-f.qx,f.qy=f.y*2-f.qy):(f.qx=f.x,f.qy=f.y),d=["C",...Nx(f.x,f.y,f.qx,f.qy,d[1],d[2])];break;case"Q":f.qx=d[1],f.qy=d[2],d=["C",...Nx(f.x,f.y,d[1],d[2],d[3],d[4])];break;case"L":d=["C",...Il(f.x,f.y,d[1],d[2])];break;case"H":d=["C",...Il(f.x,f.y,d[1],f.y)];break;case"V":d=["C",...Il(f.x,f.y,f.x,d[1])];break;case"Z":d=["C",...Il(f.x,f.y,f.X,f.Y)];break}return d},o=function(d,f){if(d[f].length>7){d[f].shift();for(var m=d[f];m.length;)r[f]="A",d.splice(f++,0,["C",...m.splice(0,6)]);d.splice(f,1),l=t.length}},r=[],a="",s="",c=0,l=t.length;c<l;c++){t[c]&&(a=t[c][0]),a!="C"&&(r[c]=a,c&&(s=r[c-1])),t[c]=i(t[c],n,s),r[c]!="A"&&a=="C"&&(r[c]="C"),o(t,c);var u=t[c],p=u.length;n.x=u[p-2],n.y=u[p-1],n.bx=Ax(u[p-4])||n.x,n.by=Ax(u[p-3])||n.y}return t}function $t(e){return Sn(e)&&si(e,"waypoints")}function ft(e){return Sn(e)&&si(e,"labelTarget")}function Yk(e){return Sn(e)&&xa(e.parent)}function jx(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function Do(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function Ze(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function Bl(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function Kk(e){return Do({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function Xk(e){for(var t=e.waypoints,n=t.reduce(function(l,u,p){var d=t[p-1];if(d){var f=l[l.length-1],m=f&&f.endLength||0,h=Qk(d,u);l.push({start:d,end:u,startLength:m,endLength:m+h,length:h})}return l},[]),i=n.reduce(function(l,u){return l+u.length},0),o=i/2,r=0,a=n[r];a.endLength<o;)a=n[++r];var s=(o-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 nt(e){return $t(e)?Xk(e):Kk(e)}function $n(e,t,n){n=n||0,Sn(n)||(n={x:n,y:n});var i=Ze(e),o=Ze(t),r=i.bottom+n.y<=o.top,a=i.left-n.x>=o.right,s=i.top-n.y>=o.bottom,c=i.right+n.x<=o.left,l=r?"top":s?"bottom":null,u=c?"left":a?"right":null;return u&&l?l+"-"+u:u||l||"intersect"}function Gs(e,t,n){var i=Zk(e,t);return i.length===1||i.length===2&&Hs(i[0],i[1])<1?Do(i[0]):i.length>1?(i=io(i,function(o){var r=Math.floor(o.t2*100)||1;return r=100-r,r=(r<10?"0":"")+r,o.segment2+"#"+r}),Do(i[n?0:i.length-1])):null}function Zk(e,t){return Ix(e,t)}function Jk(e){e=e.slice();for(var t=0,n,i,o;e[t];)n=e[t],i=e[t-1],o=e[t+1],Hs(n,o)===0||vf(i,o,n)?e.splice(t,1):t++;return e}function Qk(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Nl(e,t){return Math.round(e*t)/t}function Hx(e){return tt(e)?e+"px":e}function e2(e){for(;e.parent;)e=e.parent;return e}function t2(e){e=te({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),Zn(n,{position:"relative",overflow:"hidden",width:Hx(e.width),height:Hx(e.height)}),t.appendChild(n),n}function Gx(e,t,n){const i=We("g");vt(i).add(t);const o=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[o]||null),i}const n2="base",zx=0,i2=1,o2={shape:["x","y","width","height"],connection:["waypoints"]};function it(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||{})}it.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],it.prototype._init=function(e){const t=this._eventBus,n=this._container=t2(e),i=this._svg=We("svg");Le(i,{width:"100%",height:"100%"}),On(i,"tabindex",0),e.autoFocus&&t.on("element.hover",()=>{this.restoreFocus()}),t.on("element.mousedown",500,r=>{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")}),ot(n,i);const o=this._viewport=Gx(i,"viewport");e.deferUpdate&&(this._viewboxChanged=Jp(this._viewboxChanged,300)),this._restoreFocus=Jp(this._restoreFocus,0),t.on("diagram.init",()=>{t.fire("canvas.init",{svg:i,viewport:o})}),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)},it.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},it.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},it.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=Rx(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},it.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},it.prototype.restoreFocus=function(){this._restoreFocus()},it.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},it.prototype.isFocused=function(){return this._focused},it.prototype.getDefaultLayer=function(){return this.getLayer(n2,zx)},it.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},it.prototype._getChildIndex=function(e){return ci(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},it.prototype._createLayer=function(e,t){typeof t>"u"&&(t=i2);const n=this._getChildIndex(t);return{group:Gx(this._viewport,"layer-"+e,n),index:t,visible:!0}},it.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,o=t.index;if(t.visible)return i;const r=this._getChildIndex(o);return n.insertBefore(i,n.childNodes[r]||null),t.visible=!0,i},it.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&&(mn(n),t.visible=!1),n},it.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],mn(t.group))},it.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},it.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const o=this._findPlaneForRoot(e2(i));if(!o||n&&o.rootElement!==n)return;n=o.rootElement}return n},it.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},it.prototype._findPlaneForRoot=function(e){return Ht(this._planes,function(t){return t.rootElement===e})},it.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},it.prototype._resolveElements=function(e){return et(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},it.prototype.getContainer=function(){return this._container},it.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&&(K([i.gfx,i.secondaryGfx],function(o){o&&(n?(e.markers.add(t),vt(o).add(t)):(e.markers.delete(t),vt(o).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},it.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},it.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},it.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},it.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},it.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},it.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,zx);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},it.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},it.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},it.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)},it.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})},it.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})},it.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=o2[e];if(!Xo(n,function(o){return typeof t[o]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},it.prototype._setParent=function(e,t,n){un(t.children,e,n),e.parent=t},it.prototype._addElement=function(e,t,n,i){n=n||this.getRootElement();const o=this._eventBus,r=this._graphicsFactory;this._ensureValid(e,t),o.fire(e+".add",{element:t,parent:n}),this._setParent(t,n,i);const a=r.create(e,t,i);return this._elementRegistry.add(t,a),r.update(e,t,a),o.fire(e+".added",{element:t,gfx:a}),t},it.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},it.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},it.prototype._removeElement=function(e,t){const n=this._elementRegistry,i=this._graphicsFactory,o=this._eventBus;if(e=n.get(e.id||e),!!e)return o.fire(t+".remove",{element:e}),i.remove(e),an(e.parent&&e.parent.children,e),e.parent=null,o.fire(t+".removed",{element:e}),n.remove(e),e},it.prototype.removeShape=function(e){return this._removeElement(e,"shape")},it.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},it.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},it.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},it.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},it.prototype.viewbox=function(e){if(e===void 0&&this._cachedViewbox)return structuredClone(this._cachedViewbox);const t=this._viewport,n=this.getSize();let i,o,r,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);Ns(t,u)});else return r=this._rootElement?this.getActiveLayer():null,i=r&&r.getBBox()||{},a=Ns(t),o=a?a.matrix:lk(),s=Nl(o.a,1e3),c=Nl(-o.e||0,1e3),l=Nl(-o.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},it.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=te({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),Vx(t,n)}),{x:n.e,y:n.f}},it.prototype.scrollToElement=function(e,t){let n=100;const i=this._resolveElements(e);if(!i.length)return;const o=this.findRoot(i);if(!o)return;o!==this.getRootElement()&&this.setRootElement(o);const r=i.filter(m=>m!=o);if(!r.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=yn(r),s=Ze(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 d=Ze(c);if(!(a.width<c.width&&a.height<c.height))u=a.x-c.x,p=a.y-c.y;else{const m=Math.max(0,s.right-d.right),h=Math.min(0,s.left-d.left),y=Math.max(0,s.bottom-d.bottom),w=Math.min(0,s.top-d.top);u=m||h,p=y||w}this.scroll({dx:-u*l,dy:-p*l})},it.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)}),Nl(i.a,1e3)};function Vx(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}it.prototype._fitViewport=function(e){const t=this.viewbox(),n=t.outer,i=t.inner;let o,r;return i.x>=0&&i.y>=0&&i.x+i.width<=n.width&&i.y+i.height<=n.height&&!e?r={x:0,y:0,width:Math.max(i.width+i.x,n.width),height:Math.max(i.height+i.y,n.height)}:(o=Math.min(1,n.width/i.width,n.height/i.height),r={x:i.x+(e?i.width/2-n.width/o/2:0),y:i.y+(e?i.height/2-n.height/o/2:0),width:n.width/o,height:n.height/o}),this.viewbox(r),this.viewbox(!1).scale},it.prototype._setZoom=function(e,t){const n=this._svg,i=this._viewport,o=n.createSVGMatrix(),r=n.createSVGPoint();let a,s,c,l,u;c=i.getCTM();const p=c.a;return t?(a=te(r,t),s=a.matrixTransform(c.inverse()),l=o.translate(s.x,s.y).scale(1/p*e).translate(-s.x,-s.y),u=c.multiply(l)):u=o.scale(e),Vx(this._viewport,u),u},it.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},it.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,o=n.y*t.scale-t.y*t.scale,r=n.width*t.scale,a=n.height*t.scale;return{x:i,y:o,width:r,height:a}},it.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var Ia="data-element-id";function bi(e){this._elements={},this._eventBus=e}bi.$inject=["eventBus"],bi.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),Le(t,Ia,i),n&&Le(n,Ia,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},bi.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(Le(i.gfx,Ia,""),i.secondaryGfx&&Le(i.secondaryGfx,Ia,""),delete t[n])},bi.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)},bi.prototype.updateGraphics=function(e,t,n){var i=e.id||e,o=this._elements[i];return n?o.secondaryGfx=t:o.gfx=t,t&&Le(t,Ia,i),t},bi.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&Le(e,Ia);var n=this._elements[t];return n&&n.element},bi.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},bi.prototype.find=function(e){for(var t=this._elements,n=Object.keys(t),i=0;i<n.length;i++){var o=n[i],r=t[o],a=r.element,s=r.gfx;if(e(a,s))return a}},bi.prototype.getAll=function(){return this.filter(function(e){return e})},bi.prototype.forEach=function(e){var t=this._elements;Object.keys(t).forEach(function(n){var i=t[n],o=i.element,r=i.gfx;return e(o,r)})},bi.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},bi.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 r2(e,t,n,i){var o=n.inverse;return Object.defineProperty(e,"remove",{value:function(r){var a=this.indexOf(r);return a!==-1&&(this.splice(a,1),t.unset(r,o,i)),r}}),Object.defineProperty(e,"contains",{value:function(r){return this.indexOf(r)!==-1}}),Object.defineProperty(e,"add",{value:function(r,a){var s=this.indexOf(r);if(typeof a>"u"){if(s!==-1)return;a=this.length}s!==-1&&this.splice(s,1),this.splice(a,0,r),s===-1&&t.set(r,o,i)}}),Object.defineProperty(e,"__refs_collection",{value:!0}),e}function a2(e){return e.__refs_collection===!0}function s2(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function Wx(e,t,n){var i=r2(n[t.name]||[],e,t,n);Object.defineProperty(n,t.name,{enumerable:t.enumerable,value:i}),i.length&&i.forEach(function(o){e.set(o,t.inverse,n)})}function c2(e,t,n){var i=t.inverse,o=n[t.name];Object.defineProperty(n,t.name,{configurable:t.configurable,enumerable:t.enumerable,get:function(){return o},set:function(r){if(r!==o){var a=o;o=null,a&&e.unset(a,i,n),o=r,e.set(o,i,n)}}})}function Ci(e,t){if(!(this instanceof Ci))return new Ci(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}Ci.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?Wx(this,t,e):c2(this,t,e)},Ci.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return a2(n)||Wx(this,t,e),n},Ci.prototype.ensureBound=function(e,t){s2(e,t)||this.bind(e,t)},Ci.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},Ci.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var _f=new Ci({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Ux=new Ci({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),qx=new Ci({name:"attachers",collection:!0},{name:"host"}),Yx=new Ci({name:"outgoing",collection:!0},{name:"source"}),Kx=new Ci({name:"incoming",collection:!0},{name:"target"});function Ba(){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)}}),_f.bind(this,"parent"),Ux.bind(this,"labels"),Yx.bind(this,"outgoing"),Kx.bind(this,"incoming")}function zs(){Ba.call(this),_f.bind(this,"children"),qx.bind(this,"host"),qx.bind(this,"attachers")}je(zs,Ba);function Xx(){Ba.call(this),_f.bind(this,"children")}je(Xx,zs);function Zx(){zs.call(this),Ux.bind(this,"labelTarget")}je(Zx,zs);function Jx(){Ba.call(this),Yx.bind(this,"source"),Kx.bind(this,"target")}je(Jx,Ba);var l2={connection:Jx,shape:zs,label:Zx,root:Xx};function u2(e,t){var n=l2[e];if(!n)throw new Error("unknown type: <"+e+">");return te(new n,t)}function p2(e){return e instanceof Ba}function Lo(){this._uid=12}Lo.prototype.createRoot=function(e){return this.create("root",e)},Lo.prototype.createLabel=function(e){return this.create("label",e)},Lo.prototype.createShape=function(e){return this.create("shape",e)},Lo.prototype.createConnection=function(e){return this.create("connection",e)},Lo.prototype.create=function(e,t){return t=te({},t||{}),t.id||(t.id=e+"_"+this._uid++),u2(e,t)};var $l="__fn",Qx=1e3,d2=Array.prototype.slice;function ui(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}ui.prototype.on=function(e,t,n,i){if(e=et(e)?e:[e],An(t)&&(i=n,n=t,t=Qx),!tt(t))throw new Error("priority must be a number");var o=n;i&&(o=ti(n,i),o[$l]=n[$l]||n);var r=this;e.forEach(function(a){r._addListener(a,{priority:t,callback:o,next:null})})},ui.prototype.once=function(e,t,n,i){var o=this;if(An(t)&&(i=n,n=t,t=Qx),!tt(t))throw new Error("priority must be a number");function r(){r.__isTomb=!0;var a=n.apply(i,arguments);return o.off(e,r),a}r[$l]=n,this.on(e,t,r)},ui.prototype.off=function(e,t){e=et(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},ui.prototype.createEvent=function(e){var t=new Vs;return t.init(e),t},ui.prototype.fire=function(e,t){var n,i,o,r;if(r=d2.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 Vs?n=t:n=this.createEvent(t),r[0]=n;var a=n.type;e!==a&&(n.type=e);try{o=this._invokeListeners(n,r,i)}finally{e!==a&&(n.type=a)}return o===void 0&&n.defaultPrevented&&(o=!1),o}},ui.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},ui.prototype._destroy=function(){this._listeners={}},ui.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},ui.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=f2(n.callback,t),i!==void 0&&(e.returnValue=i,e.stopPropagation()),i===!1&&e.preventDefault()}catch(o){if(!this.handleError(o))throw console.error("unhandled error in event listener",o),o}return i},ui.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},ui.prototype._getListeners=function(e){return this._listeners[e]},ui.prototype._setListeners=function(e,t){this._listeners[e]=t},ui.prototype._removeListener=function(e,t){var n=this._getListeners(e),i,o,r;if(!t){this._setListeners(e,null);return}for(;n;)i=n.next,r=n.callback,(r===t||r[$l]===t)&&(o?o.next=i:this._setListeners(e,i)),o=n,n=i};function Vs(){}Vs.prototype.stopPropagation=function(){this.cancelBubble=!0},Vs.prototype.preventDefault=function(){this.defaultPrevented=!0},Vs.prototype.init=function(e){te(this,e||{})};function f2(e,t){return e.apply(null,t)}function fr(e){return e.childNodes[0]}function h2(e){return e.parentNode.childNodes[1]}function Fl(e,t,n,i,o){var r=Bs();r.setTranslate(t,n);var a=Bs();a.setRotate(i||0,0,0);var s=Bs();s.setScale(1,1),Ns(e,[r,a,s])}function Fn(e,t,n){var i=Bs();i.setTranslate(t,n),Ns(e,i)}function eb(e,t){var n=Bs();n.setRotate(t,0,0),Ns(e,n)}function wi(e,t){this._eventBus=e,this._elementRegistry=t}wi.$inject=["eventBus","elementRegistry"],wi.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=h2(t),n||(n=We("g"),vt(n).add("djs-children"),ot(t.parentNode,n))):n=t,n},wi.prototype._clear=function(e){var t=fr(e);return Tl(t),t},wi.prototype._createContainer=function(e,t,n,i){var o=We("g");vt(o).add("djs-group"),typeof n<"u"?g2(o,t,t.childNodes[n]):ot(t,o);var r=We("g");vt(r).add("djs-element"),vt(r).add("djs-"+e),i&&vt(r).add("djs-frame"),ot(o,r);var a=We("g");return vt(a).add("djs-visual"),ot(r,a),r},wi.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,Mx(t))},wi.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=ci(e,function(o,r){return r.parent&&(o[r.parent.id]=r.parent),o},{}),K(i,function(o){var r=o.children;if(r){var a=t._getChildrenContainer(o),s=a.firstChild;K(r,function(c){var l=n.getGraphics(c).parentNode;l===s?s=s.nextSibling:a.insertBefore(l,s)})}})},wi.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},wi.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},wi.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},wi.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},wi.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),Fn(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?Le(n,"display","none"):Le(n,"display","block")}},wi.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);mn(t.parentNode)};function g2(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const m2={__depends__:[Tk],__init__:["canvas"],canvas:["type",it],elementRegistry:["type",bi],elementFactory:["type",Lo],eventBus:["type",ui],graphicsFactory:["type",wi]};function y2(e){var t=new Sx(e);return t.init(),t}function v2(e){e=e||{};var t={config:["value",e]},n=[t,m2].concat(e.modules||[]);return y2(n)}function hr(e,t){this._injector=t||v2(e),this.get("eventBus").fire("diagram.init")}hr.prototype.get=function(e,t){return this._injector.get(e,t)},hr.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},hr.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},hr.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function Yn(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function ni(e,t){return e.$instanceOf(t)}function x2(e){return Ht(e.rootElements,function(t){return ni(t,"bpmn:Process")||ni(t,"bpmn:Collaboration")})}function b2(e){var t={},n=[],i={};function o(z,ee){return function(he){z(he,ee)}}function r(z){t[z.id]=z}function a(z){return t[z.id]}function s(z,ee){var he=z.gfx;if(he)throw new Error(`already rendered ${Yn(z)}`);return e.element(z,i[z.id],ee)}function c(z,ee){return e.root(z,i[z.id],ee)}function l(z,ee){try{var he=i[z.id]&&s(z,ee);return r(z),he}catch(se){u(se.message,{element:z,error:se}),console.error(`failed to import ${Yn(z)}`,se)}}function u(z,ee){e.error(z,ee)}var p=this.registerDi=function(ee){var he=ee.bpmnElement;he?i[he.id]?u(`multiple DI elements defined for ${Yn(he)}`,{element:he}):i[he.id]=ee:u(`no bpmnElement referenced in ${Yn(ee)}`,{element:ee})};function d(z){f(z.plane)}function f(z){p(z),K(z.planeElement,m)}function m(z){p(z)}this.handleDefinitions=function(ee,he){var se=ee.diagrams;if(he&&se.indexOf(he)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!he&&se&&se.length&&(he=se[0]),!he)throw new Error("no diagram to display");i={},d(he);var Ae=he.plane;if(!Ae)throw new Error(`no plane for ${Yn(he)}`);var F=Ae.bpmnElement;if(!F)if(F=x2(ee),F)u(`correcting missing bpmnElement on ${Yn(Ae)} to ${Yn(F)}`),Ae.bpmnElement=F,p(Ae);else throw new Error("no process or collaboration to display");var C=c(F,Ae);if(ni(F,"bpmn:Process")||ni(F,"bpmn:SubProcess"))y(F,C);else if(ni(F,"bpmn:Collaboration"))W(F,C),w(ee.rootElements,C);else throw new Error(`unsupported bpmnElement for ${Yn(Ae)}: ${Yn(F)}`);h(n)};var h=this.handleDeferred=function(){for(var ee;n.length;)ee=n.shift(),ee()};function y(z,ee){Pe(z,ee),I(z.ioSpecification,ee),A(z.artifacts,ee),r(z)}function w(z,ee){var he=gt(z,function(se){return!a(se)&&ni(se,"bpmn:Process")&&se.laneSets});he.forEach(o(y,ee))}function g(z,ee){l(z,ee)}function v(z,ee){K(z,o(g,ee))}function b(z,ee){l(z,ee)}function S(z,ee){l(z,ee)}function M(z,ee){l(z,ee)}function B(z,ee){l(z,ee)}function A(z,ee){K(z,function(he){ni(he,"bpmn:Association")?n.push(function(){B(he,ee)}):B(he,ee)})}function I(z,ee){z&&(K(z.dataInputs,o(S,ee)),K(z.dataOutputs,o(M,ee)))}var H=this.handleSubProcess=function(ee,he){Pe(ee,he),A(ee.artifacts,he)};function V(z,ee){var he=l(z,ee);ni(z,"bpmn:SubProcess")&&H(z,he||ee),ni(z,"bpmn:Activity")&&I(z.ioSpecification,ee),n.push(function(){K(z.dataInputAssociations,o(b,ee)),K(z.dataOutputAssociations,o(b,ee))})}function G(z,ee){l(z,ee)}function ie(z,ee){l(z,ee)}function pe(z,ee){n.push(function(){var he=l(z,ee);z.childLaneSet&&Y(z.childLaneSet,he||ee),de(z)})}function Y(z,ee){K(z.lanes,o(pe,ee))}function Te(z,ee){K(z,o(Y,ee))}function Pe(z,ee){ke(z.flowElements,ee),z.laneSets&&Te(z.laneSets,ee)}function ke(z,ee){K(z,function(he){ni(he,"bpmn:SequenceFlow")?n.push(function(){G(he,ee)}):ni(he,"bpmn:BoundaryEvent")?n.unshift(function(){V(he,ee)}):ni(he,"bpmn:FlowNode")?V(he,ee):ni(he,"bpmn:DataObject")||(ni(he,"bpmn:DataStoreReference")||ni(he,"bpmn:DataObjectReference")?ie(he,ee):u(`unrecognized flowElement ${Yn(he)} in context ${Yn(ee&&ee.businessObject)}`,{element:he,context:ee}))})}function ve(z,ee){var he=l(z,ee),se=z.processRef;se&&y(se,he||ee)}function W(z,ee){K(z.participants,o(ve,ee)),n.push(function(){v(z.messageFlows,ee)}),A(z.artifacts,ee)}function de(z){K(z.flowNodeRef,function(ee){var he=ee.get("lanes");he&&he.push(z)})}}function tb(e,t,n){var i,o,r,a,s=[];function c(l,u){var p={root:function(h,y){return i.add(h,y)},element:function(h,y,w){return i.add(h,y,w)},error:function(h,y){s.push({message:h,context:y})}},d=new b2(p);u=u||l.diagrams&&l.diagrams[0];var f=w2(l,u);if(!f)throw new Error("no diagram to display");K(f,function(h){d.handleDefinitions(l,h)});var m=u.plane.bpmnElement.id;r.setRootElement(r.findRoot(m+"_plane")||r.findRoot(m))}return new Promise(function(l,u){try{return i=e.get("bpmnImporter"),o=e.get("eventBus"),r=e.get("canvas"),o.fire("import.render.start",{definitions:t}),c(t,n),o.fire("import.render.complete",{error:a,warnings:s}),l({warnings:s})}catch(p){return p.warnings=s,u(p)}})}function w2(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!T(n,"bpmn:Process")&&!T(n,"bpmn:Collaboration")&&(i=_2(n));var o;T(i,"bpmn:Collaboration")?o=i:o=Ht(e.rootElements,function(l){if(T(l,"bpmn:Collaboration"))return Ht(l.participants,function(u){return u.processRef===i})});var r=[i];o&&(r=Wn(o.participants,function(l){return l.processRef}),r.push(o));var a=nb(r),s=[t],c=[n];return K(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 nb(e){var t=[];return K(e,function(n){n&&(t.push(n),t=t.concat(nb(n.flowElements)))}),t}function _2(e){for(var t=e;t;){if(T(t,"bpmn:Process"))return t;t=t.$parent}}var E2='<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>',ib=E2,ob={verticalAlign:"middle"},rb={color:"#404040"},S2={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},R2={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},M2={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"},C2='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+ib+'</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>',po;function A2(){po=Wt(C2),Zn(po,S2),Zn(kt("svg",po),ob),Zn(kt(".backdrop",po),R2),Zn(kt(".notice",po),M2),Zn(kt(".link",po),rb,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function T2(){po||(A2(),li.bind(po,".backdrop","click",function(e){document.body.removeChild(po)})),document.body.appendChild(po)}const jl=5,ab="djs-outline-hidden";function Xt(e){e=te({},k2,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),D2(this._container)}je(Xt,hr),Xt.prototype.importXML=async function(t,n){const i=this;function o(a){return i.get("eventBus").createEvent(a)}let r=[];try{t=this._emit("import.parse.start",{xml:t})||t;let a;try{a=await this._moddle.fromXML(t,"bpmn:Definitions")}catch(d){throw this._emit("import.parse.complete",{error:d}),d}let s=a.rootElement;const c=a.references,l=a.warnings,u=a.elementsById;r=r.concat(l),s=this._emit("import.parse.complete",o({error:null,definitions:s,elementsById:u,references:c,warnings:r}))||s;const p=await this.importDefinitions(s,n);return r=r.concat(p.warnings),this._emit("import.done",{error:null,warnings:r}),{warnings:r}}catch(a){let s=a;throw r=r.concat(s.warnings||[]),Hl(s,r),s=P2(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},Xt.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},Xt.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const r=new Error("no XML imported");throw Hl(r,[]),r}if(typeof t=="string"&&(i=O2(n,t),!i)){const r=new Error("BPMNDiagram <"+t+"> not found");throw Hl(r,[]),r}try{this.clear()}catch(r){throw Hl(r,[]),r}const{warnings:o}=await tb(this,n,i);return{warnings:o}},Xt.prototype.saveXML=async function(t){t=t||{};let n=this._definitions,i,o;try{if(!n)throw new Error("no definitions loaded");n=this._emit("saveXML.start",{definitions:n})||n,o=(await this._moddle.toXML(n,t)).xml,o=this._emit("saveXML.serialized",{xml:o})||o}catch(a){i=a}const r=i?{error:i}:{xml:o};if(this._emit("saveXML.done",r),i)throw i;return r},Xt.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),o=i.getActiveLayer(),r=kt(":scope > defs",i._svg),a=Ex(o),s=r?"<defs>"+Ex(r)+"</defs>":"",c=i.getContainer();Dt(c).add(ab);let l;try{l=o.getBBox()}finally{Dt(c).remove(ab)}const u=l.x-jl,p=l.y-jl,d=l.width+jl*2,f=l.height+jl*2;t=`<?xml version="1.0" encoding="utf-8"?>
8
7
  <!-- created with bpmn-js / http://bpmn.io -->
9
8
  <!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}},jt.prototype._setDefinitions=function(e){this._definitions=e},jt.prototype.getModules=function(){return this._modules},jt.prototype.clear=function(){this.getDefinitions()&&Sr.prototype.clear.call(this)},jt.prototype.destroy=function(){Sr.prototype.destroy.call(this),Li(this._container)},jt.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},jt.prototype.off=function(e,t){this.get("eventBus").off(e,t)},jt.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=Rt(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},jt.prototype.getDefinitions=function(){return this._definitions},jt.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},jt.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=U(Ti(n,["additionalModules"]),{canvas:U({},n.canvas,{container:e}),modules:a});Sr.call(this,s),n&&n.container&&this.attachTo(n.container)},jt.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},jt.prototype._createContainer=function(e){const t=It('<div class="bjs-container"></div>');return In(t,{width:oy(e.width),height:oy(e.height),position:e.position}),t},jt.prototype._createModdle=function(e){const t=U({},this._moddleExtensions,e.moddleExtensions);return new Uh(t)},jt.prototype._modules=[];function Tc(e,t){return e.warnings=t,e}function vM(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 bM={width:"100%",height:"100%",position:"relative"};function oy(e){return e+(ze(e)?"px":"")}function xM(e,t){return t&&kt(e.diagrams,function(n){return n.id===t})||null}function _M(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+ty+"</a>",i=It(n);In(Rt("svg",i),ny),In(i,iy,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),Ge.bind(i,"click",function(r){yM(),r.preventDefault()})}function Wo(e){jt.call(this,e),this.on("import.parse.complete",function(t){t.error||this._collectIds(t.definitions,t.elementsById)},this),this.on("diagram.destroy",function(){this.get("moddle").ids.clear()},this)}Ee(Wo,jt),Wo.prototype._createModdle=function(e){var t=jt.prototype._createModdle.call(this,e);return t.ids=new Ii([32,36,1]),t},Wo.prototype._collectIds=function(e,t){var n=e.$model,i=n.ids,r;i.clear();for(r in t)i.claim(r,t[r])};function st(e,t){return M(e,"bpmn:CallActivity")?!1:M(e,"bpmn:SubProcess")?(t=t||dt(e),t&&M(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):M(e,"bpmn:Participant")?!!le(e).processRef:!0}function hn(e){if(!(!M(e,"bpmn:Participant")&&!M(e,"bpmn:Lane"))){var t=dt(e).isHorizontal;return t===void 0?!0:t}}function wM(e){return e&&le(e).isInterrupting!==!1}function kn(e){return e&&!!le(e).triggeredByEvent}function Uo(e,t){var n=le(e).eventDefinitions;return hr(n,function(i){return M(i,t)})}function EM(e){return Uo(e,"bpmn:ErrorEventDefinition")}function SM(e){return Uo(e,"bpmn:EscalationEventDefinition")}function RM(e){return Uo(e,"bpmn:CompensateEventDefinition")}var ao={width:90,height:20},ay=15;function Rr(e){return M(e,"bpmn:Event")||M(e,"bpmn:Gateway")||M(e,"bpmn:DataStoreReference")||M(e,"bpmn:DataObjectReference")||M(e,"bpmn:DataInput")||M(e,"bpmn:DataOutput")||M(e,"bpmn:SequenceFlow")||M(e,"bpmn:MessageFlow")||M(e,"bpmn:Group")}function kc(e){return Je(e.label)}function CM(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=MM(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-=ay:a+=ay,{x:a,y:s}}function MM(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 Dp(e){return e.waypoints?CM(e.waypoints):M(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+ao.height/2}:{x:e.x+e.width/2,y:e.y+e.height+ao.height/2}}function AM(e,t){var n,i,r,o=e.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(ao.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=Dp(t),i=ao),U({x:n.x-i.width/2,y:n.y-i.height/2},i)}function sy(e){if(M(e,"bpmn:FlowElement")||M(e,"bpmn:Participant")||M(e,"bpmn:Lane")||M(e,"bpmn:SequenceFlow")||M(e,"bpmn:MessageFlow")||M(e,"bpmn:DataInput")||M(e,"bpmn:DataOutput"))return"name";if(M(e,"bpmn:TextAnnotation"))return"text";if(M(e,"bpmn:Group"))return"categoryValueRef"}function PM(e){var t=e.categoryValueRef;return t&&t.value||""}function oi(e){var t=e.businessObject,n=sy(t);if(n)return n==="categoryValueRef"?PM(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 kM(e){return Je(e)&&Rr(e.labelTarget)}var Yo=7;function cy(e){let t=[];return z(e.incoming,n=>{M(n,"bpmn:Association")&&M(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),z(e.outgoing,n=>{M(n,"bpmn:Association")&&M(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function za(e){const t=new Map;return z(Cp(e),n=>{z(cy(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 Ip="hsl(225, 10%, 15%)",OM="white";function Fi(e,t){return hr(e.eventDefinitions,function(n){return n.$type===t})}function DM(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function IM(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function at(e,t,n){var i=dt(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||OM}function _e(e,t,n){var i=dt(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||Ip}function Ga(e,t,n,i){var r=dt(e),o=r.get("label");return i||o&&o.get("color:color")||t||_e(e,n)}function ly(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 io(r)}function Lp(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 io(a)}function LM(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 io(s)}function BM(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 io(o)}function Va(e,t={}){return{width:li(e,t),height:Wn(e,t)}}function li(e,t={}){return Hn(t,"width")?t.width:e.width}function Wn(e,t={}){return Hn(t,"height")?t.height:e.height}var NM=new Ii,$M=10,Oc=3,FM=1.5,Dc=10,jM=4,qo=.95,HM=1,zM=.25;function so(e,t,n,i,r,o,a){Xi.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:Ip,strokeWidth:2,fill:"white"})}function p(B){return n.computeStyle(B,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:Ip,strokeWidth:2})}function f(B,R){var{ref:x={x:0,y:0},scale:G=1,element:Y,parentGfx:Z=r._svg}=R,Re=De("marker",{id:B,viewBox:"0 0 20 20",refX:x.x,refY:x.y,markerWidth:20*G,markerHeight:20*G,orient:"auto"});Ue(Re,Y);var Ze=Rt(":scope > defs",Z);Ze||(Ze=De("defs"),Ue(Z,Ze)),Ue(Ze,Re)}function d(B,R,x,G){var Y=NM.nextPrefixed("marker-");return h(B,Y,R,x,G),"url(#"+Y+")"}function h(B,R,x,G,Y){if(x==="sequenceflow-end"){var Z=De("path",{d:"M 1 5 L 11 10 L 1 15 Z",...u({fill:Y,stroke:Y,strokeWidth:1})});f(R,{element:Z,ref:{x:11,y:10},scale:.5,parentGfx:B})}if(x==="messageflow-start"){var Re=De("circle",{cx:6,cy:6,r:3.5,...u({fill:G,stroke:Y,strokeWidth:1,strokeDasharray:[1e4,1]})});f(R,{element:Re,ref:{x:6,y:6},parentGfx:B})}if(x==="messageflow-end"){var Ze=De("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...u({fill:G,stroke:Y,strokeWidth:1,strokeDasharray:[1e4,1]})});f(R,{element:Ze,ref:{x:8.5,y:5},parentGfx:B})}if(x==="association-start"){var mt=De("path",{d:"M 11 5 L 1 10 L 11 15",...p({fill:"none",stroke:Y,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(R,{element:mt,ref:{x:1,y:10},scale:.5,parentGfx:B})}if(x==="association-end"){var Vt=De("path",{d:"M 1 5 L 11 10 L 1 15",...p({fill:"none",stroke:Y,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(R,{element:Vt,ref:{x:11,y:10},scale:.5,parentGfx:B})}if(x==="conditional-flow-marker"){var wt=De("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...u({fill:G,stroke:Y})});f(R,{element:wt,ref:{x:-1,y:10},scale:.5,parentGfx:B})}if(x==="conditional-default-flow-marker"){var ln=De("path",{d:"M 6 4 L 10 16",...u({stroke:Y,fill:"none"})});f(R,{element:ln,ref:{x:0,y:10},scale:.5,parentGfx:B})}}function m(B,R,x,G,Y={}){pn(G)&&(Y=G,G=0),G=G||0,Y=u(Y);var Z=R/2,Re=x/2,Ze=De("circle",{cx:Z,cy:Re,r:Math.round((R+x)/4-G),...Y});return Ue(B,Ze),Ze}function b(B,R,x,G,Y,Z){pn(Y)&&(Z=Y,Y=0),Y=Y||0,Z=u(Z);var Re=De("rect",{x:Y,y:Y,width:R-Y*2,height:x-Y*2,rx:G,ry:G,...Z});return Ue(B,Re),Re}function E(B,R,x,G){var Y=R/2,Z=x/2,Re=[{x:Y,y:0},{x:R,y:Z},{x:Y,y:x},{x:0,y:Z}],Ze=Re.map(function(Vt){return Vt.x+","+Vt.y}).join(" ");G=u(G);var mt=De("polygon",{...G,points:Ze});return Ue(B,mt),mt}function _(B,R,x,G){x=p(x);var Y=La(R,x,G);return Ue(B,Y),Y}function g(B,R,x){return _(B,R,x,5)}function y(B,R,x){x=p(x);var G=De("path",{...x,d:R});return Ue(B,G),G}function S(B,R,x,G){return y(R,x,U({"data-marker":B},G))}function w(B){return Te[B]}function P(B){return function(R,x,G){return w(B)(R,x,G)}}var T={"bpmn:MessageEventDefinition":function(B,R,x={},G){var Y=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:x.width||R.width,containerHeight:x.height||R.height,position:{mx:.235,my:.315}}),Z=G?_e(R,c,x.stroke):at(R,s,x.fill),Re=G?at(R,s,x.fill):_e(R,c,x.stroke),Ze=y(B,Y,{fill:Z,stroke:Re,strokeWidth:1});return Ze},"bpmn:TimerEventDefinition":function(B,R,x={}){var G=x.width||R.width,Y=x.height||R.height,Z=x.width?1:2,Re=m(B,G,Y,.2*Y,{fill:at(R,s,x.fill),stroke:_e(R,c,x.stroke),strokeWidth:Z}),Ze=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:G,containerHeight:Y,position:{mx:.5,my:.5}});y(B,Ze,{stroke:_e(R,c,x.stroke),strokeWidth:Z});for(var mt=0;mt<12;mt++){var Vt=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:G,containerHeight:Y,position:{mx:.5,my:.5}}),wt=G/2,ln=Y/2;y(B,Vt,{strokeWidth:1,stroke:_e(R,c,x.stroke),transform:"rotate("+mt*30+","+ln+","+wt+")"})}return Re},"bpmn:EscalationEventDefinition":function(B,R,x={},G){var Y=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:x.width||R.width,containerHeight:x.height||R.height,position:{mx:.5,my:.2}}),Z=G?_e(R,c,x.stroke):at(R,s,x.fill);return y(B,Y,{fill:Z,stroke:_e(R,c,x.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(B,R,x={}){var G=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:x.width||R.width,containerHeight:x.height||R.height,position:{mx:.5,my:.222}});return y(B,G,{fill:at(R,s,x.fill),stroke:_e(R,c,x.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(B,R,x={},G){var Y=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width,containerHeight:R.height,position:{mx:.57,my:.263}}),Z=G?_e(R,c,x.stroke):at(R,s,x.fill);return y(B,Y,{fill:Z,stroke:_e(R,c,x.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(B,R,x={},G){var Y=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:x.width||R.width,containerHeight:x.height||R.height,position:{mx:.2,my:.722}}),Z=G?_e(R,c,x.stroke):at(R,s,x.fill);return y(B,Y,{fill:Z,stroke:_e(R,c,x.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(B,R,x={},G){var Y=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width,containerHeight:R.height,position:{mx:.638,my:-.055}}),Z=G?_e(R,c,x.stroke):"none",Re=y(B,Y,{fill:Z,stroke:_e(R,c,x.stroke),strokeWidth:1});return Jg(Re,45),Re},"bpmn:CompensateEventDefinition":function(B,R,x={},G){var Y=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:x.width||R.width,containerHeight:x.height||R.height,position:{mx:.22,my:.5}}),Z=G?_e(R,c,x.stroke):at(R,s,x.fill);return y(B,Y,{fill:Z,stroke:_e(R,c,x.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(B,R,x={},G){var Y=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:x.width||R.width,containerHeight:x.height||R.height,position:{mx:.5,my:.2}}),Z=G?_e(R,c,x.stroke):at(R,s,x.fill);return y(B,Y,{strokeWidth:1,fill:Z,stroke:_e(R,c,x.stroke)})},"bpmn:MultipleEventDefinition":function(B,R,x={},G){var Y=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:x.width||R.width,containerHeight:x.height||R.height,position:{mx:.211,my:.36}}),Z=G?_e(R,c,x.stroke):at(R,s,x.fill);return y(B,Y,{fill:Z,stroke:_e(R,c,x.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(B,R,x={}){var G=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:x.width||R.width,containerHeight:x.height||R.height,position:{mx:.458,my:.194}});return y(B,G,{fill:at(R,s,x.fill),stroke:_e(R,c,x.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(B,R,x={}){var G=m(B,R.width,R.height,8,{fill:_e(R,c,x.stroke),stroke:_e(R,c,x.stroke),strokeWidth:4});return G}};function $(B,R,x={},G){var Y=le(B),Z=DM(Y),Re=G||B;return Y.get("eventDefinitions")&&Y.get("eventDefinitions").length>1?Y.get("parallelMultiple")?T["bpmn:ParallelMultipleEventDefinition"](R,Re,x,Z):T["bpmn:MultipleEventDefinition"](R,Re,x,Z):Fi(Y,"bpmn:MessageEventDefinition")?T["bpmn:MessageEventDefinition"](R,Re,x,Z):Fi(Y,"bpmn:TimerEventDefinition")?T["bpmn:TimerEventDefinition"](R,Re,x,Z):Fi(Y,"bpmn:ConditionalEventDefinition")?T["bpmn:ConditionalEventDefinition"](R,Re,x,Z):Fi(Y,"bpmn:SignalEventDefinition")?T["bpmn:SignalEventDefinition"](R,Re,x,Z):Fi(Y,"bpmn:EscalationEventDefinition")?T["bpmn:EscalationEventDefinition"](R,Re,x,Z):Fi(Y,"bpmn:LinkEventDefinition")?T["bpmn:LinkEventDefinition"](R,Re,x,Z):Fi(Y,"bpmn:ErrorEventDefinition")?T["bpmn:ErrorEventDefinition"](R,Re,x,Z):Fi(Y,"bpmn:CancelEventDefinition")?T["bpmn:CancelEventDefinition"](R,Re,x,Z):Fi(Y,"bpmn:CompensateEventDefinition")?T["bpmn:CompensateEventDefinition"](R,Re,x,Z):Fi(Y,"bpmn:TerminateEventDefinition")?T["bpmn:TerminateEventDefinition"](R,Re,x,Z):null}var k={ParticipantMultiplicityMarker:function(B,R,x={}){var G=li(R,x),Y=Wn(R,x),Z=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:Y,position:{mx:(G/2-6)/G,my:(Y-15)/Y}});S("participant-multiplicity",B,Z,{strokeWidth:2,fill:at(R,s,x.fill),stroke:_e(R,c,x.stroke)})},SubProcessMarker:function(B,R,x={}){var G=b(B,14,14,0,{strokeWidth:1,fill:at(R,s,x.fill),stroke:_e(R,c,x.stroke)});En(G,R.width/2-7.5,R.height-20);var Y=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",B,Y,{fill:at(R,s,x.fill),stroke:_e(R,c,x.stroke)})},ParallelMarker:function(B,R,x){var G=li(R,x),Y=Wn(R,x),Z=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:Y,position:{mx:(G/2+x.parallel)/G,my:(Y-20)/Y}});S("parallel",B,Z,{fill:at(R,s,x.fill),stroke:_e(R,c,x.stroke)})},SequentialMarker:function(B,R,x){var G=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width,containerHeight:R.height,position:{mx:(R.width/2+x.seq)/R.width,my:(R.height-19)/R.height}});S("sequential",B,G,{fill:at(R,s,x.fill),stroke:_e(R,c,x.stroke)})},CompensationMarker:function(B,R,x){var G=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width,containerHeight:R.height,position:{mx:(R.width/2+x.compensation)/R.width,my:(R.height-13)/R.height}});S("compensation",B,G,{strokeWidth:1,fill:at(R,s,x.fill),stroke:_e(R,c,x.stroke)})},LoopMarker:function(B,R,x){var G=li(R,x),Y=Wn(R,x),Z=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:Y,position:{mx:(G/2+x.loop)/G,my:(Y-7)/Y}});S("loop",B,Z,{strokeWidth:1.5,fill:"none",stroke:_e(R,c,x.stroke),strokeMiterlimit:.5})},AdhocMarker:function(B,R,x){var G=li(R,x),Y=Wn(R,x),Z=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:Y,position:{mx:(G/2+x.adhoc)/G,my:(Y-15)/Y}});S("adhoc",B,Z,{strokeWidth:1,fill:_e(R,c,x.stroke),stroke:_e(R,c,x.stroke)})}};function D(B,R,x,G){k[B](R,x,G)}function H(B,R,x=[],G={}){G={fill:G.fill,stroke:G.stroke,width:li(R,G),height:Wn(R,G)};var Y=le(R),Z=x.includes("SubProcessMarker");Z?G={...G,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:G={...G,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},Y.get("isForCompensation")&&x.push("CompensationMarker"),M(Y,"bpmn:AdHocSubProcess")&&(x.push("AdhocMarker"),Z||U(G,{compensation:G.compensation-18}));var Re=Y.get("loopCharacteristics"),Ze=Re&&Re.get("isSequential");Re&&(U(G,{compensation:G.compensation-18}),x.includes("AdhocMarker")&&U(G,{seq:-23,loop:-18,parallel:-24}),Ze===void 0&&x.push("LoopMarker"),Ze===!1&&x.push("ParallelMarker"),Ze===!0&&x.push("SequentialMarker")),x.includes("CompensationMarker")&&x.length===1&&U(G,{compensation:-8}),z(x,function(mt){D(mt,B,R,G)})}function Q(B,R,x={}){x=U({size:{width:100}},x);var G=o.createText(R||"",x);return ut(G).add("djs-label"),Ue(B,G),G}function fe(B,R,x,G={}){var Y=le(R),Z=Va({x:R.x,y:R.y,width:R.width,height:R.height},G);return Q(B,Y.name,{align:x,box:Z,padding:7,style:{fill:Ga(R,l,c,G.stroke)}})}function Me(B,R,x={}){var G={width:R.width,height:R.height,x:R.width/2+R.x,y:R.height/2+R.y};return Q(B,oi(R),{box:G,style:U({},o.getExternalStyle(),{fill:Ga(R,l,c,x.stroke)})})}function Be(B,R,x,G={}){var Y=hn(x),Z=Q(B,R,{box:{height:30,width:Y?Wn(x,G):li(x,G)},align:"center-middle",style:{fill:Ga(x,l,c,G.stroke)}});if(Y){var Re=-1*Wn(x,G);Ac(Z,0,-Re,270)}}function it(B,R,x={}){var{width:G,height:Y}=Va(R,x);return b(B,G,Y,Dc,{...x,fill:at(R,s,x.fill),fillOpacity:qo,stroke:_e(R,c,x.stroke)})}function X(B,R,x={}){var G=le(R),Y=at(R,s,x.fill),Z=_e(R,c,x.stroke);return(G.get("associationDirection")==="One"||G.get("associationDirection")==="Both")&&(x.markerEnd=d(B,"association-end",Y,Z)),G.get("associationDirection")==="Both"&&(x.markerStart=d(B,"association-start",Y,Z)),x=ht(x,["markerStart","markerEnd"]),g(B,R.waypoints,{...x,stroke:Z,strokeDasharray:"0, 5"})}function ee(B,R,x={}){var G=at(R,s,x.fill),Y=_e(R,c,x.stroke),Z=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width,containerHeight:R.height,position:{mx:.474,my:.296}}),Re=y(B,Z,{fill:G,fillOpacity:qo,stroke:Y}),Ze=le(R);if(IM(Ze)){var mt=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(B,mt,{strokeWidth:2,fill:G,stroke:Y})}return Re}function ue(B,R,x={}){return m(B,R.width,R.height,{fillOpacity:qo,...x,fill:at(R,s,x.fill),stroke:_e(R,c,x.stroke)})}function be(B,R,x={}){return E(B,R.width,R.height,{fill:at(R,s,x.fill),fillOpacity:qo,stroke:_e(R,c,x.stroke)})}function q(B,R,x={}){var G=b(B,li(R,x),Wn(R,x),0,{fill:at(R,s,x.fill),fillOpacity:x.fillOpacity||qo,stroke:_e(R,c,x.stroke),strokeWidth:1.5}),Y=le(R);if(M(Y,"bpmn:Lane")){var Z=Y.get("name");Be(B,Z,R,x)}return G}function V(B,R,x={}){var G=it(B,R,x),Y=st(R);if(kn(R)&&(Se(G,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!Y)){var Z=le(R).flowElements||[],Re=Z.filter(Ze=>M(Ze,"bpmn:StartEvent"));Re.length===1&&ie(Re[0],B,x,R)}return fe(B,R,Y?"center-top":"center-middle",x),Y?H(B,R,void 0,x):H(B,R,["SubProcessMarker"],x),G}function ie(B,R,x,G){var Y=22,Z={fill:at(G,s,x.fill),stroke:_e(G,c,x.stroke),width:Y,height:Y},Re=le(B).isInterrupting,Ze=Re?0:3,mt=Re?1:1.2,Vt=20,wt=(Y-Vt)/2,ln="translate("+wt+","+wt+")";m(R,Vt,Vt,{fill:Z.fill,stroke:Z.stroke,strokeWidth:mt,strokeDasharray:Ze,transform:ln}),$(B,R,Z,G)}function Pe(B,R,x={}){var G=it(B,R,x);return fe(B,R,"center-middle",x),H(B,R,void 0,x),G}var Te=this.handlers={"bpmn:AdHocSubProcess":function(B,R,x={}){return st(R)?x=ht(x,["fill","stroke","width","height"]):x=ht(x,["fill","stroke"]),V(B,R,x)},"bpmn:Association":function(B,R,x={}){return x=ht(x,["fill","stroke"]),X(B,R,x)},"bpmn:BoundaryEvent":function(B,R,x={}){var{renderIcon:G=!0}=x;x=ht(x,["fill","stroke"]);var Y=le(R),Z=Y.get("cancelActivity");x={strokeWidth:1.5,fill:at(R,s,x.fill),fillOpacity:HM,stroke:_e(R,c,x.stroke)},Z||(x.strokeDasharray="6");var Re=ue(B,R,x);return m(B,R.width,R.height,Oc,{...x,fill:"none"}),G&&$(R,B,x),Re},"bpmn:BusinessRuleTask":function(B,R,x={}){x=ht(x,["fill","stroke"]);var G=Pe(B,R,x),Y=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),Z=y(B,Y);Se(Z,{fill:at(R,s,x.fill),stroke:_e(R,c,x.stroke),strokeWidth:1});var Re=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),Ze=y(B,Re);return Se(Ze,{fill:_e(R,c,x.stroke),stroke:_e(R,c,x.stroke),strokeWidth:1}),G},"bpmn:CallActivity":function(B,R,x={}){return x=ht(x,["fill","stroke"]),V(B,R,{strokeWidth:5,...x})},"bpmn:ComplexGateway":function(B,R,x={}){x=ht(x,["fill","stroke"]);var G=be(B,R,x),Y=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:R.width,containerHeight:R.height,position:{mx:.46,my:.26}});return y(B,Y,{fill:_e(R,c,x.stroke),stroke:_e(R,c,x.stroke),strokeWidth:1}),G},"bpmn:DataInput":function(B,R,x={}){x=ht(x,["fill","stroke"]);var G=i.getRawPath("DATA_ARROW"),Y=ee(B,R,x);return y(B,G,{fill:"none",stroke:_e(R,c,x.stroke),strokeWidth:1}),Y},"bpmn:DataInputAssociation":function(B,R,x={}){return x=ht(x,["fill","stroke"]),X(B,R,{...x,markerEnd:d(B,"association-end",at(R,s,x.fill),_e(R,c,x.stroke))})},"bpmn:DataObject":function(B,R,x={}){return x=ht(x,["fill","stroke"]),ee(B,R,x)},"bpmn:DataObjectReference":P("bpmn:DataObject"),"bpmn:DataOutput":function(B,R,x={}){x=ht(x,["fill","stroke"]);var G=i.getRawPath("DATA_ARROW"),Y=ee(B,R,x);return y(B,G,{strokeWidth:1,fill:_e(R,c,x.stroke),stroke:_e(R,c,x.stroke)}),Y},"bpmn:DataOutputAssociation":function(B,R,x={}){return x=ht(x,["fill","stroke"]),X(B,R,{...x,markerEnd:d(B,"association-end",at(R,s,x.fill),_e(R,c,x.stroke))})},"bpmn:DataStoreReference":function(B,R,x={}){x=ht(x,["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(B,G,{fill:at(R,s,x.fill),fillOpacity:qo,stroke:_e(R,c,x.stroke),strokeWidth:2})},"bpmn:EndEvent":function(B,R,x={}){var{renderIcon:G=!0}=x;x=ht(x,["fill","stroke"]);var Y=ue(B,R,{...x,strokeWidth:4});return G&&$(R,B,x),Y},"bpmn:EventBasedGateway":function(B,R,x={}){x=ht(x,["fill","stroke"]);var G=le(R),Y=be(B,R,x);m(B,R.width,R.height,R.height*.2,{fill:at(R,"none",x.fill),stroke:_e(R,c,x.stroke),strokeWidth:1});var Z=G.get("eventGatewayType"),Re=!!G.get("instantiate");function Ze(){var Vt=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:R.width,containerHeight:R.height,position:{mx:.36,my:.44}});y(B,Vt,{fill:"none",stroke:_e(R,c,x.stroke),strokeWidth:2})}if(Z==="Parallel"){var mt=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:R.width,containerHeight:R.height,position:{mx:.474,my:.296}});y(B,mt,{fill:"none",stroke:_e(R,c,x.stroke),strokeWidth:1})}else Z==="Exclusive"&&(Re||m(B,R.width,R.height,R.height*.26,{fill:"none",stroke:_e(R,c,x.stroke),strokeWidth:1}),Ze());return Y},"bpmn:ExclusiveGateway":function(B,R,x={}){x=ht(x,["fill","stroke"]);var G=be(B,R,x),Y=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:R.width,containerHeight:R.height,position:{mx:.32,my:.3}}),Z=dt(R);return Z.get("isMarkerVisible")&&y(B,Y,{fill:_e(R,c,x.stroke),stroke:_e(R,c,x.stroke),strokeWidth:1}),G},"bpmn:Gateway":function(B,R,x={}){return x=ht(x,["fill","stroke"]),be(B,R,x)},"bpmn:Group":function(B,R,x={}){return x=ht(x,["fill","stroke","width","height"]),b(B,R.width,R.height,Dc,{stroke:_e(R,c,x.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:li(R,x),height:Wn(R,x)})},"bpmn:InclusiveGateway":function(B,R,x={}){x=ht(x,["fill","stroke"]);var G=be(B,R,x);return m(B,R.width,R.height,R.height*.24,{fill:at(R,s,x.fill),stroke:_e(R,c,x.stroke),strokeWidth:2.5}),G},"bpmn:IntermediateEvent":function(B,R,x={}){var{renderIcon:G=!0}=x;x=ht(x,["fill","stroke"]);var Y=ue(B,R,{...x,strokeWidth:1.5});return m(B,R.width,R.height,Oc,{fill:"none",stroke:_e(R,c,x.stroke),strokeWidth:1.5}),G&&$(R,B,x),Y},"bpmn:IntermediateCatchEvent":P("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":P("bpmn:IntermediateEvent"),"bpmn:Lane":function(B,R,x={}){return x=ht(x,["fill","stroke","width","height"]),q(B,R,{...x,fillOpacity:zM})},"bpmn:ManualTask":function(B,R,x={}){x=ht(x,["fill","stroke"]);var G=Pe(B,R,x),Y=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return y(B,Y,{fill:at(R,s,x.fill),stroke:_e(R,c,x.stroke),strokeWidth:.5}),G},"bpmn:MessageFlow":function(B,R,x={}){x=ht(x,["fill","stroke"]);var G=le(R),Y=dt(R),Z=at(R,s,x.fill),Re=_e(R,c,x.stroke),Ze=g(B,R.waypoints,{markerEnd:d(B,"messageflow-end",Z,Re),markerStart:d(B,"messageflow-start",Z,Re),stroke:Re,strokeDasharray:"10, 11",strokeWidth:1.5});if(G.get("messageRef")){var mt=Ze.getPointAtLength(Ze.getTotalLength()/2),Vt=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:mt.x,y:mt.y}}),wt={strokeWidth:1};Y.get("messageVisibleKind")==="initiating"?(wt.fill=Z,wt.stroke=Re):(wt.fill=Re,wt.stroke=Z);var ln=y(B,Vt,wt),yn=G.get("messageRef"),vn=yn.get("name"),Et=Q(B,vn,{align:"center-top",fitBox:!0,style:{fill:Re}}),un=ln.getBBox(),mn=Et.getBBox(),xo=mt.x-mn.width/2,Zn=mt.y+un.height/2+$M;Ac(Et,xo,Zn,0)}return Ze},"bpmn:ParallelGateway":function(B,R,x={}){x=ht(x,["fill","stroke"]);var G=be(B,R,x),Y=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:R.width,containerHeight:R.height,position:{mx:.46,my:.2}});return y(B,Y,{fill:_e(R,c,x.stroke),stroke:_e(R,c,x.stroke),strokeWidth:1}),G},"bpmn:Participant":function(B,R,x={}){x=ht(x,["fill","stroke","width","height"]);var G=q(B,R,x),Y=st(R),Z=hn(R),Re=le(R),Ze=Re.get("name");if(Y){var mt=Z?[{x:30,y:0},{x:30,y:Wn(R,x)}]:[{x:0,y:30},{x:li(R,x),y:30}];_(B,mt,{stroke:_e(R,c,x.stroke),strokeWidth:FM}),Be(B,Ze,R,x)}else{var Vt=Va(R,x);Z||(Vt.height=li(R,x),Vt.width=Wn(R,x));var wt=Q(B,Ze,{box:Vt,align:"center-middle",style:{fill:Ga(R,l,c,x.stroke)}});if(!Z){var ln=-1*Wn(R,x);Ac(wt,0,-ln,270)}}return Re.get("participantMultiplicity")&&D("ParticipantMultiplicityMarker",B,R,x),G},"bpmn:ReceiveTask":function(B,R,x={}){x=ht(x,["fill","stroke"]);var G=le(R),Y=Pe(B,R,x),Z;return G.get("instantiate")?(m(B,28,28,20*.22,{fill:at(R,s,x.fill),stroke:_e(R,c,x.stroke),strokeWidth:1}),Z=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):Z=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),y(B,Z,{fill:at(R,s,x.fill),stroke:_e(R,c,x.stroke),strokeWidth:1}),Y},"bpmn:ScriptTask":function(B,R,x={}){x=ht(x,["fill","stroke"]);var G=Pe(B,R,x),Y=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return y(B,Y,{fill:at(R,s,x.fill),stroke:_e(R,c,x.stroke),strokeWidth:1}),G},"bpmn:SendTask":function(B,R,x={}){x=ht(x,["fill","stroke"]);var G=Pe(B,R,x),Y=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return y(B,Y,{fill:_e(R,c,x.stroke),stroke:at(R,s,x.fill),strokeWidth:1}),G},"bpmn:SequenceFlow":function(B,R,x={}){x=ht(x,["fill","stroke"]);var G=at(R,s,x.fill),Y=_e(R,c,x.stroke),Z=g(B,R.waypoints,{markerEnd:d(B,"sequenceflow-end",G,Y),stroke:Y}),Re=le(R),{source:Ze}=R;if(Ze){var mt=le(Ze);Re.get("conditionExpression")&&M(mt,"bpmn:Activity")&&Se(Z,{markerStart:d(B,"conditional-flow-marker",G,Y)}),mt.get("default")&&(M(mt,"bpmn:Gateway")||M(mt,"bpmn:Activity"))&&mt.get("default")===Re&&Se(Z,{markerStart:d(B,"conditional-default-flow-marker",G,Y)})}return Z},"bpmn:ServiceTask":function(B,R,x={}){x=ht(x,["fill","stroke"]);var G=Pe(B,R,x);m(B,10,10,{fill:at(R,s,x.fill),stroke:"none",transform:"translate(6, 6)"});var Y=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});y(B,Y,{fill:at(R,s,x.fill),stroke:_e(R,c,x.stroke),strokeWidth:1}),m(B,10,10,{fill:at(R,s,x.fill),stroke:"none",transform:"translate(11, 10)"});var Z=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return y(B,Z,{fill:at(R,s,x.fill),stroke:_e(R,c,x.stroke),strokeWidth:1}),G},"bpmn:StartEvent":function(B,R,x={}){var{renderIcon:G=!0}=x;x=ht(x,["fill","stroke"]);var Y=le(R);Y.get("isInterrupting")||(x={...x,strokeDasharray:"6"});var Z=ue(B,R,x);return G&&$(R,B,x),Z},"bpmn:SubProcess":function(B,R,x={}){return st(R)?x=ht(x,["fill","stroke","width","height"]):x=ht(x,["fill","stroke"]),V(B,R,x)},"bpmn:Task":function(B,R,x={}){return x=ht(x,["fill","stroke"]),Pe(B,R,x)},"bpmn:TextAnnotation":function(B,R,x={}){x=ht(x,["fill","stroke"]);var{width:G,height:Y}=Va(R,x),Z=b(B,G,Y,0,0,{fill:"none",stroke:"none"}),Re=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:Y,position:{mx:0,my:0}});y(B,Re,{stroke:_e(R,c,x.stroke)});var Ze=le(R),mt=Ze.get("text")||"";return Q(B,mt,{align:"left-top",box:Va(R,x),padding:Yo,style:{fill:Ga(R,l,c,x.stroke)}}),Z},"bpmn:Transaction":function(B,R,x={}){st(R)?x=ht(x,["fill","stroke","width","height"]):x=ht(x,["fill","stroke"]);var G=V(B,R,{strokeWidth:1.5,...x}),Y=n.style(["no-fill","no-events"],{stroke:_e(R,c,x.stroke),strokeWidth:1.5}),Z=st(R);return Z||(x={}),b(B,li(R,x),Wn(R,x),Dc-Oc,Oc,Y),G},"bpmn:UserTask":function(B,R,x={}){x=ht(x,["fill","stroke"]);var G=Pe(B,R,x),Y=15,Z=12,Re=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:Y,y:Z}});y(B,Re,{fill:at(R,s,x.fill),stroke:_e(R,c,x.stroke),strokeWidth:.5});var Ze=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:Y,y:Z}});y(B,Ze,{fill:at(R,s,x.fill),stroke:_e(R,c,x.stroke),strokeWidth:.5});var mt=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:Y,y:Z}});return y(B,mt,{fill:_e(R,c,x.stroke),stroke:_e(R,c,x.stroke),strokeWidth:.5}),G},label:function(B,R,x={}){return Me(B,R,x)}};this._drawPath=y,this._renderer=w}Ee(so,Xi),so.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],so.prototype.canRender=function(e){return M(e,"bpmn:BaseElement")},so.prototype.drawShape=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},so.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},so.prototype.getShapePath=function(e){return Je(e)?Lp(e,jM):M(e,"bpmn:Event")?ly(e):M(e,"bpmn:Activity")?Lp(e,Dc):M(e,"bpmn:Gateway")?LM(e):BM(e)};function ht(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var GM=0,VM={width:150,height:50};function WM(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function UM(e){return pn(e)?U({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var Bp=null;function YM(){return Bp||(Bp=document.createElement("canvas").getContext("2d")),Bp}function qM(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(uy(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function uy(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function KM(e,t){var n=YM();if(!n)return{width:0,height:0};n.font=qM(t),"letterSpacing"in n&&(n.letterSpacing=uy(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 XM(e,t,n){for(var i=e.shift(),r=i,o;;){if(o=KM(r,n),o.width=r?o.width:0,r===" "||r===""||o.width<Math.round(t)||r.length<2)return ZM(e,r,i,o);r=JM(r,o.width,t)}}function ZM(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 py="­";function QM(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===py)&&r.pop();break}var a=r[r.length-1];return a&&a===py&&(r[r.length-1]="-"),r.join("")}function JM(e,t,n){var i=Math.max(e.length*(n/t),1),r=QM(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function Ic(e){this._config=U({},{size:VM,padding:GM,style:{},align:"center-top"},e||{})}Ic.prototype.createText=function(e,t){return this.layoutText(e,t).element},Ic.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Ic.prototype.layoutText=function(e,t){for(var n=U({},this._config.size,t.box),i=U({},this._config.style,t.style),r=WM(t.align||this._config.align),o=UM(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=eA(i),c=e.split(/\u00AD?\r?\n/),l=[],u=n.width-o.left-o.right;c.length;)l.push(XM(c,u,i));r.vertical==="middle"&&(o.top=o.bottom=0);var p=zn(l,function(b,E,_){return b+(s||E.height)},0)+o.top+o.bottom,f=zn(l,function(b,E,_){return E.width>b?E.width:b},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),z(l,function(b){var E;switch(d+=s||b.height,r.horizontal){case"left":E=o.left;break;case"right":E=(a?f:u)-o.right-b.width;break;default:E=Math.max(((a?f:u)-b.width)/2+o.left,0)}var _=De("tspan");Se(_,{x:E,y:d}),_.textContent=b.text,Ue(h,_)});var m={width:f,height:p};return{dimensions:m,element:h}};function eA(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var tA=12,nA=1.2,iA=40;function fy(e){var t=U({fontFamily:"Arial, sans-serif",fontSize:tA,fontWeight:"normal",lineHeight:nA},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=U({},t,{fontSize:n},e&&e.externalStyle||{}),r=new Ic({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,ao.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:Yo});return{x:a.x,y:a.y,width:a.width,height:Math.max(iA,Math.round(c.height))}},this.getDimensions=function(a,s){return r.getDimensions(a,s||{})};function o(a,s,c){return r.getDimensions(a,U({box:s},c))}this.createText=function(a,s){return r.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}fy.$inject=["config.textRenderer"];function rA(){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=cA(i.d,{mx:r,my:o,e:a});return p}}var oA=/\{([^{}]+)\}/g,aA=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function sA(e,t,n){var i=n;return t.replace(aA,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 cA(e,t){return String(e).replace(oA,function(n,i){return sA(n,i,t)})}const lA={__init__:["bpmnRenderer"],bpmnRenderer:["type",so],textRenderer:["type",fy],pathMap:["type",rA]};function uA(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const Wa={translate:["value",uA]};function Lc(e,t,n){return U({id:e.id,type:e.$type,businessObject:e,di:t},n)}function pA(e,t,n){var i=e.waypoint;return!i||i.length<2?[$e(t),$e(n)]:i.map(function(r){return{x:r.x,y:r.y}})}function dy(e,t,n){return new Error(`element ${Tn(t)} referenced by ${Tn(e)}#${n} not yet drawn`)}function er(e,t,n,i,r){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=r}er.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],er.prototype.add=function(e,t,n){var i,r,o;if(M(t,"bpmndi:BPMNPlane")){var a=M(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(Lc(e,t,a)),this._canvas.addRootElement(i)}else if(M(t,"bpmndi:BPMNShape")){var s=!st(e,t),c=dA(e);r=n&&(n.hidden||n.collapsed);var l=t.bounds;i=this._elementFactory.createShape(Lc(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})),M(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),M(e,"bpmn:Lane")&&(o=0),M(e,"bpmn:DataStoreReference")&&(fA(n,$e(l))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,o)}else if(M(t,"bpmndi:BPMNEdge")){var u=this._getSource(e),p=this._getTarget(e);r=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(Lc(e,t,{hidden:r,source:u,target:p,waypoints:pA(t,u,p)})),M(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,o)}else throw new Error(`unknown di ${Tn(t)} for element ${Tn(e)}`);return Rr(e)&&oi(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},er.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${Tn(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),r=i&&i.attachers;if(!i)throw dy(e,n,"attachedToRef");t.host=i,r||(i.attachers=r=[]),r.indexOf(t)===-1&&r.push(t)},er.prototype.addLabel=function(e,t,n){var i,r,o;return i=AM(t,n),r=oi(n),r&&(i=this._textRenderer.getExternalLabelBounds(i,r)),o=this._elementFactory.createLabel(Lc(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!oi(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)},er.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?dy(e,i,t+"Ref"):new Error(`${Tn(e)}#${t} Ref not specified`)},er.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},er.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},er.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function fA(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 dA(e){return M(e,"bpmn:Group")}const hy={__depends__:[lA,{__depends__:[Wa],bpmnImporter:["type",er]}]};function Ua(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Ci(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Np(e){return Math.log(e)/Math.log(10)}var hA=1e3;function se(e){this._eventBus=e}se.$inject=["eventBus"];function mA(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}se.prototype.on=function(e,t,n,i,r,o){if((fn(t)||ze(t))&&(o=r,r=i,i=n,n=t,t=null),fn(n)&&(o=r,r=i,i=n,n=hA),pn(r)&&(o=r,r=!1),!fn(i))throw new Error("handlerFn must be a function");Ne(e)||(e=[e]);var a=this._eventBus;z(e,function(s){var c=["commandStack",s,t].filter(function(l){return l}).join(".");a.on(c,n,r?mA(i,o):i,o)})},se.prototype.canExecute=tr("canExecute"),se.prototype.preExecute=tr("preExecute"),se.prototype.preExecuted=tr("preExecuted"),se.prototype.execute=tr("execute"),se.prototype.executed=tr("executed"),se.prototype.postExecute=tr("postExecute"),se.prototype.postExecuted=tr("postExecuted"),se.prototype.revert=tr("revert"),se.prototype.reverted=tr("reverted");function tr(e){return function(n,i,r,o,a){(fn(n)||ze(n))&&(a=o,o=r,r=i,i=n,n=null),this.on(n,e,i,r,o,a)}}var $p=["top","bottom","left","right"],Bc=10;function Fp(e,t){se.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(kc(r)&&!Mt(r)){var o=vA(r);o&&i(r,o)}}function i(r,o){var a=$e(r),s=r.label,c=$e(s);if(s.parent){var l=Le(r),u;switch(o){case"top":u={x:a.x,y:l.top-Bc-s.height/2};break;case"left":u={x:l.left-Bc-s.width/2,y:a.y};break;case"bottom":u={x:a.x,y:l.bottom+Bc+s.height/2};break;case"right":u={x:l.right+Bc+s.width/2,y:a.y};break}var p=Ci(u,c);t.moveShape(s,p)}}}Ee(Fp,se),Fp.$inject=["eventBus","modeling"];function gA(e){var t=e.host,n=$e(e),i=wn(n,t),r;i.indexOf("-")>=0?r=i.split("-"):r=[i];var o=$p.filter(function(a){return r.indexOf(a)===-1});return o}function yA(e){var t=$e(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 my(t,i)});return n}function vA(e){var t=$e(e.label),n=$e(e),i=my(n,t);if(bA(i)){var r=yA(e);if(e.host){var o=gA(e);r=r.concat(o)}var a=$p.filter(function(s){return r.indexOf(s)===-1});return a.indexOf(i)!==-1?wn(e.label,e)!=="intersect"?void 0:i:a[0]}}function my(e,t){return wn(t,e,5)}function bA(e){return $p.indexOf(e)!==-1}function jp(e){se.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,i=t.shape;t.position||(M(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(jp,se),jp.$inject=["eventBus"];var xA=1500;function Hp(e,t,n){e.invoke(se,this),this.preExecute("elements.delete",xA,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=nt(r,l=>M(l,"bpmn:Participant")||M(l,"bpmn:SubProcess"));if(!o.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(l=>M(l,"bpmn:Artifact"))),c=new Set;return z(o,l=>{const u=new Set(Mo(zo(Array.from(s),Zt(l))));c=c.union(u),s=s.difference(u)}),Array.from(c)}}Ee(Hp,se),Hp.$inject=["injector","eventBus","canvas"];function zp(e,t){e.invoke(se,this),this.postExecute("shape.move",function(n){var i=n.newParent,r=n.shape,o=nt(r.incoming.concat(r.outgoing),function(a){return M(a,"bpmn:Association")});z(o,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}Ee(zp,se),zp.$inject=["injector","modeling"];function Ko(e,t){for(jn(t)&&(t=[t]);e=e.parent;)if(tt(e,t))return e;return null}function gy(e,t){var n=Ko(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=Ko(e,i),n)return hn(n);if(tt(e,i))return hn(e);var r;for(r=le(e);r&&!M(r,"bpmn:Process");r=r.$parent);if(!t)return!0;var o=t.find(function(a){var s=le(a);return s&&s.get("processRef")===r});return o?hn(o):!0}var yy=500;function Nc(e,t){t.invoke(se,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",yy,function(i){var r=i.elements;r=r.filter(function(o){var a=o.host;return vy(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",yy,function(i){var r=i.shapes,o=i.newHost;if(r.length===1){var a=r[0];vy(a,o)&&(i.shapes=[n._replaceShape(a,o)])}},!0)}Nc.$inject=["bpmnReplace","injector"],Ee(Nc,se),Nc.prototype._replaceShape=function(e,t){var n=_A(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function _A(e){var t=le(e),n=t.eventDefinitions;return n&&n[0]}function vy(e,t){return!Je(e)&&tt(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function Gp(e,t){se.call(this,e);function n(i){return nt(i.attachers,function(r){return M(r,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var r=i.context.source,o=i.context.target,a=n(o);M(r,"bpmn:EventBasedGateway")&&M(o,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var r=i.context.oldSource,o=i.context.newSource;M(r,"bpmn:Gateway")&&M(o,"bpmn:EventBasedGateway")&&z(o.outgoing,function(a){var s=a.target,c=n(s);M(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}Gp.$inject=["eventBus","modeling"],Ee(Gp,se);function by(e){return e.create("bpmn:Category")}function wA(e){return e.create("bpmn:CategoryValue")}function xy(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=wA(e)),n.$parent||(n.$parent=by(e)),n}function EA(e,t,n){return qt(t.get("categoryValue"),e),e.$parent=t,qt(n.get("rootElements"),t),t.$parent=n,e}function SA(e){var t=e.$parent;return t&&(Ut(t.get("categoryValue"),e),e.$parent=null),e}function RA(e){var t=e.$parent;return t&&(Ut(t.get("rootElements"),e),e.$parent=null),e}var CA=500;function Vp(e,t,n){n.invoke(se,this);function i(c){return t.filter(function(l){return M(l,"bpmn:Group")&&!l.labelTarget}).map(le).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&&EA(c,l,e.getDefinitions())}function s(c,l,u){l&&!o(l,u)&&RA(l),c&&!r(c,u)&&SA(c)}this.executed(["shape.create","label.create"],function(c){var l=c.labelTarget||c.shape;!M(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;!M(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,le(l))},!0),this.executed(["shape.move","shape.resize"],CA,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,le(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,le(l.groupShape))})},!0),this.executed("shape.delete",function(c){var l=c.shape;!M(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,le(l))},!0),this.reverted("shape.delete",function(c){var l=c.shape;!M(l,"bpmn:Group")||l.labelTarget||a(c.categoryValue,c.category)},!0)}Vp.$inject=["bpmnjs","elementRegistry","injector"],Ee(Vp,se);function _y(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function Wp(e,t,n){se.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(b){const E=b.source,_=b.target;Xo(E)&&Ya(_)&&u(_)}function r(b){const E=b.connection,_=b.source,g=b.target;Xo(_)&&$c(g)&&(l(g),f(_,[E]))}function o(b){const E=b.newTarget,_=b.oldSource,g=b.oldTarget;if(g!==E){const y=_;Ya(g)&&u(g),Xo(y)&&$c(E)&&l(E)}}function a(b){const{element:E}=b;Ya(E)?(p(E),d(E)):$c(E)&&h(E)}function s(b){const{newData:E,oldShape:_}=b;if(Xo(b.oldShape)&&E.eventDefinitionType!=="bpmn:CompensateEventDefinition"||E.type!=="bpmn:BoundaryEvent"){const g=_.outgoing.find(({target:y})=>Ya(y));g&&g.target&&(b._connectionTarget=g.target)}else if(!Xo(b.oldShape)&&E.eventDefinitionType==="bpmn:CompensateEventDefinition"&&E.type==="bpmn:BoundaryEvent"){const g=_.outgoing.find(({target:y})=>$c(y));g&&g.target&&(b._connectionTarget=g.target),m(_)}}function c(b){const{_connectionTarget:E,newShape:_}=b;E&&t.connect(_,E)}function l(b){t.updateProperties(b,{isForCompensation:!0})}function u(b){t.updateProperties(b,{isForCompensation:void 0})}function p(b){for(const E of b.incoming)n.canConnect(E.source,b)||t.removeConnection(E);for(const E of b.outgoing)n.canConnect(b,E.target)||t.removeConnection(E)}function f(b,E){b.outgoing.filter(y=>M(y,"bpmn:Association")).filter(y=>Ya(y.target)&&!E.includes(y)).forEach(y=>t.removeConnection(y))}function d(b){const E=b.attachers.slice();E.length&&t.removeElements(E)}function h(b){const E=b.incoming.filter(_=>Xo(_.source));t.removeElements(E)}function m(b){const E=b.outgoing.filter(_=>M(_,"bpmn:SequenceFlow"));t.removeElements(E)}}Ee(Wp,se),Wp.$inject=["eventBus","modeling","bpmnRules"];function Ya(e){const t=le(e);return t&&t.get("isForCompensation")}function Xo(e){return e&&M(e,"bpmn:BoundaryEvent")&&Uo(e,"bpmn:CompensateEventDefinition")}function $c(e){return e&&M(e,"bpmn:Activity")&&!kn(e)}function Up(e){e.invoke(se,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,r=n.shape;M(i,"bpmn:Lane")&&!M(r,"bpmn:Lane")&&(n.parent=Ko(i,"bpmn:Participant"))})}Up.$inject=["injector"],Ee(Up,se);function Yp(e,t){se.call(this,e),this.preExecute("shape.create",function(n){var a;var i=n.context,r=i.shape;if(M(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}})}Yp.$inject=["eventBus","bpmnFactory"],Ee(Yp,se);var qp=20,Kp=20,wy=30,Fc=2e3;function Xp(e,t,n){se.call(this,t),t.on(["create.start","shape.move.start"],Fc,function(r){var o=r.context,a=o.shape,s=e.getRootElement();if(!(!M(a,"bpmn:Participant")||!M(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(p){return!M(p,"bpmn:Group")&&!Je(p)&&!Mt(p)});if(c.length){var l=Zt(c),u=MA(a,l);U(a,u),o.createConstraints=AA(a,l)}}}),t.on("create.start",Fc,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}M(a,"bpmn:Participant")&&M(s,"bpmn:Process")&&(t.on("element.hover",Fc,l),t.once("create.cleanup",function(){t.off("element.hover",l)}))});function i(){var r=e.getRootElement();return M(r,"bpmn:Collaboration")?r:n.makeCollaboration()}this.preExecute("elements.create",Fc,function(r){var o=r.elements,a=r.parent,s=PA(o),c;s&&M(a,"bpmn:Process")&&(r.parent=i(),c=r.hints=r.hints||{},c.participant=s,c.process=a,c.processRef=le(s).get("processRef"))},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;M(a,"bpmn:Participant")&&M(o,"bpmn:Process")&&(r.parent=i(),r.process=o,r.processRef=le(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)&&le(s).set("processRef",le(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)&&le(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)}Xp.$inject=["canvas","eventBus","modeling"],Ee(Xp,se);function MA(e,t){t={width:t.width+qp*2+wy,height:t.height+Kp*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 AA(e,t){return t=Le(t),{bottom:t.top+e.height/2-Kp,left:t.right-e.width/2+qp,top:t.bottom-e.height/2+Kp,right:t.left+e.width/2-qp-wy}}function PA(e){return kt(e,function(t){return M(t,"bpmn:Participant")})}var Ey="__targetRef_placeholder";function Zp(e,t){se.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],Sy(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],Sy(o));function n(a,s,c){var l=a.get("dataInputAssociations");return kt(l,function(u){return u!==c&&u.targetRef===s})}function i(a,s){var c=a.get("properties"),l=kt(c,function(u){return u.name===Ey});return!l&&s&&(l=t.create("bpmn:Property",{name:Ey}),qt(c,l)),l}function r(a,s){var c=i(a);c&&(n(a,c,s)||Ut(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,b=c.businessObject,E;m&&m!==p&&r(m,l),d&&d!==p&&r(d,l),p?(E=i(p,!0),b.targetRef=E):b.targetRef=null}}Zp.$inject=["eventBus","bpmnFactory"],Ee(Zp,se);function Sy(e){return function(t){var n=t.context,i=n.connection;if(M(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 Qp(e,t,n,i){se.call(this,i),t.registerHandler("dataStore.updateContainment",jc);function r(){return n.filter(function(s){return M(s,"bpmn:Participant")&&le(s).processRef})[0]}function o(s){return s.children.filter(function(c){return M(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:dt(s),newSemanticParent:u.processRef||u,newDiParent:dt(c)})}}this.preExecute("shape.create",function(s){var c=s.context,l=c.shape;M(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 M(p,"bpmn:DataStoreReference")});u.length&&(c.hints||(c.hints={}),c.hints.autoResize=l.filter(function(p){return!M(p,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,l=c.shape,u=l.parent;M(l,"bpmn:DataStoreReference")&&l.type!=="label"&&M(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(!M(u,"bpmn:Collaboration")&&M(l,"bpmn:DataStoreReference")&&l.type!=="label"&&M(p,"bpmn:Collaboration")){var f=M(u,"bpmn:Participant")?u:kA(u,"bpmn:Participant");a(l,f)}}),this.postExecute("shape.delete",function(s){var c=s.context,l=c.shape,u=e.getRootElement();tt(l,["bpmn:Participant","bpmn:SubProcess"])&&M(u,"bpmn:Collaboration")&&o(u).filter(function(p){return TA(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){M(u,"bpmn:Process")&&a(f,u)})})}Qp.$inject=["canvas","commandStack","elementRegistry","eventBus"],Ee(Qp,se);function TA(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 kA(e,t){for(;e.parent;){if(M(e.parent,t))return e.parent;e=e.parent}}var Hc=Math.max,zc=Math.min,OA=20;function Ry(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function DA(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 IA(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 Gc(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)?zc:Hc)(i,r)),ze(o)&&(i=(/top|left/.test(e)?Hc:zc)(i,o)),i}function LA(e,t){if(!t)return e;var n=Le(e);return Rc({top:Gc("top",n,t),right:Gc("right",n,t),bottom:Gc("bottom",n,t),left:Gc("left",n,t)})}function BA(e,t,n,i){var r=Le(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?Le(i):o,s={top:zc(o.top,a.top),left:zc(o.left,a.left),bottom:Hc(o.bottom,a.bottom),right:Hc(o.right,a.right)};return Rc(s)}function qa(e,t){return typeof e<"u"?e:OA}function NA(e,t){var n,i,r,o;return typeof t=="object"?(n=qa(t.left),i=qa(t.right),r=qa(t.top),o=qa(t.bottom)):n=i=r=o=qa(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function $A(e){return!(e.waypoints||e.type==="label")}function Cy(e,t){var n;if(e.length===void 0?n=nt(e.children,$A):n=e,n.length)return NA(Zt(n),t)}var Cr=Math.abs;function FA(e,t){return Ry(Le(t),Le(e))}var jA=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],ui=30;function Vc(e,t){return t=t||[],e.children.filter(function(n){M(n,"bpmn:Lane")&&(Vc(n,t),t.push(n))}),t}function Mr(e){return e.children.filter(function(t){return M(t,"bpmn:Lane")})}function pi(e){return Ko(e,jA)||e}function HA(e,t){var n=pi(e),i=M(n,"bpmn:Process")?[]:[n],r=Vc(n,i),o=Le(e),a=Le(t),s=FA(e,t),c=[],l=hn(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=Le(u);s.top&&(Cr(m.bottom-o.top)<10&&(d=a.top-m.bottom),Cr(m.top-o.top)<5&&(p=a.top-m.top)),s.left&&(Cr(m.right-o.left)<10&&(f=a.left-m.right),Cr(m.left-o.left)<5&&(h=a.left-m.left)),s.bottom&&(Cr(m.top-o.bottom)<10&&(p=a.bottom-m.top),Cr(m.bottom-o.bottom)<5&&(d=a.bottom-m.bottom)),s.right&&(Cr(m.left-o.right)<10&&(h=a.right-m.left),Cr(m.right-o.right)<5&&(f=a.right-m.right)),(p||f||d||h)&&c.push({shape:u,newBounds:IA(u,{top:p,right:f,bottom:d,left:h})})}}),c}var zA=500;function Jp(e,t){se.call(this,e);function n(i,r){var o=hn(i),a=Mr(r),s=[],c=[],l=[],u=[];if(ro(a,function(b){return o?b.y>i.y?c.push(b):s.push(b):b.x>i.x?u.push(b):l.push(b),b.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",zA,function(i){var r=i.context,o=r.hints,a=r.shape,s=r.oldParent;M(a,"bpmn:Lane")&&(o&&o.nested||n(a,s))})}Jp.$inject=["eventBus","spaceTool"],Ee(Jp,se);var My=500;function Wc(e,t){t.invoke(se,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",My,function(i){var r=i.elements;r.filter(function(o){var a=o.host;return Ay(o,a)}).map(function(o){return r.indexOf(o)}).forEach(function(o){i.elements[o]=n._replaceShape(r[o])})},!0),this.preExecute("elements.move",My,function(i){var r=i.shapes,o=i.newHost;r.forEach(function(a,s){var c=a.host;Ay(a,VA(r,c)?c:o)&&(r[s]=n._replaceShape(a))})},!0)}Wc.$inject=["bpmnReplace","injector"],Ee(Wc,se),Wc.prototype._replaceShape=function(e){var t=GA(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function GA(e){var t=le(e),n=t.eventDefinitions;return n&&n[0]}function Ay(e,t){return!Je(e)&&M(e,"bpmn:BoundaryEvent")&&!t}function VA(e,t){return e.indexOf(t)!==-1}var Uc=Math.round,WA=Math.max;function UA(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 YA(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var Py=10;function qA(e,t){var n,i;for(n=0;i=e[n];n++)if($a(i,t)<=Py)return{point:e[n],bendpoint:!0,index:n};return null}function KA(e,t){var n=Ig(UA(t,Py),YA(e)),i=n[0],r=n[n.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=WA(i.segment2,r.segment2)-1,{point:e[o],bendpoint:!0,index:o}):{point:{x:Uc(i.x+r.x)/2,y:Uc(i.y+r.y)/2},index:i.segment2}:{point:{x:Uc(i.x),y:Uc(i.y)},index:i.segment2}:null}function ef(e,t){return qA(e,t)||KA(e,t)}function tf(e,t,n){se.call(this,e);function i(r,o,a){var s=o.waypoints,c,l,u,p,f,d,h,m=r.outgoing.slice(),b=r.incoming.slice(),E;ze(a.width)?E=$e(a):E=a;var _=ef(s,E);if(_){if(c=s.slice(0,_.index),l=s.slice(_.index+(_.bendpoint?1:0)),!c.length||!l.length)return;u=_.bendpoint?s[_.index]:E,(c.length===1||!Ty(r,c[c.length-1]))&&c.push(ky(u)),(l.length===1||!Ty(r,l[0]))&&l.unshift(ky(u))}p=o.source,f=o.target,t.canConnect(p,r,o)&&(n.reconnectEnd(o,r,c||E),d=o),t.canConnect(r,f,o)&&(d?h=n.connect(r,f,{type:o.type,waypoints:l}):(n.reconnectStart(o,r,l||E),h=o));var g=[].concat(d&&nt(b,function(y){return y.source===d.source})||[],h&&nt(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=$e(c),u={x:l.x+s.x,y:l.y+s.y},p=kt(o.children,function(f){var d=t.canInsert(a,f);return d&&ef(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(tf,se),tf.$inject=["eventBus","bpmnRules","modeling"];function Ty(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 ky(e){return U({},e)}function nf(e,t){se.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)&&Zo(r)){var c=[];M(o,"bpmn:EventBasedGateway")?c=a.incoming.filter(l=>l!==r&&Zo(l)):c=a.incoming.filter(l=>l!==r&&Zo(l)&&M(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(M(r,"bpmn:EventBasedGateway")){var o=r.outgoing.filter(Zo).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);o.forEach(function(a){a.incoming.filter(Zo).forEach(function(s){const c=a.incoming.filter(Zo).filter(function(l){return l.source===r});(s.source!==r||c.length>1)&&t.removeConnection(s)})})}})}nf.$inject=["eventBus","modeling"],Ee(nf,se);function Zo(e){return M(e,"bpmn:SequenceFlow")}var Yc=1500,Oy=2e3;function Dy(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"],Yc,function(i){var r=i.context,o=r.shape||i.shape,a=i.hover;M(a,"bpmn:Lane")&&!tt(o,["bpmn:Lane","bpmn:Participant"])&&(i.hover=pi(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(o.labelTarget||tt(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"],Yc,function(i){var r=i.hover;M(r,"bpmn:Lane")&&(i.hover=pi(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],Yc,function(i){var r=i.context,o=i.hover,a=r.type;M(o,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=pi(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],Yc,function(i){var r=i.context,o=r.start;M(o,"bpmn:Lane")&&(r.start=pi(o)||o)}),t.on("shape.move.start",Oy,function(i){var r=i.shape;M(r,"bpmn:Lane")&&(i.shape=pi(r)||r)}),t.on("spaceTool.move",Oy,function(i){var r=i.hover;r&&M(r,"bpmn:Lane")&&(i.hover=pi(r))})}Dy.$inject=["elementRegistry","eventBus","canvas"];var Iy=770;function rf(e,t,n,i){n.invoke(se,this);function r(s,c){var l=le(s),u=c.categoryValue||l.categoryValueRef;u||(u=xy(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=le(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;M(l,"bpmn:Group")&&r(l,c)}),this.revert("label.create",function(s){var c=s.context,l=c.labelTarget;M(l,"bpmn:Group")&&o(l,c)}),this.execute("shape.delete",function(s){var c=s.context,l=c.shape,u=le(l);if(!(!M(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(!(!M(l,"bpmn:Group")||l.labelTarget)){var u=c.category,p=c.categoryValue,f=le(l);p&&(f.categoryValueRef=p,p.$parent=u)}}),this.execute("shape.create",function(s){var c=s.context,l=c.shape,u=c.hints||{};!M(l,"bpmn:Group")||l.labelTarget||u.createElementsBehavior===!1&&!le(l).categoryValueRef&&!c.categoryValue||r(l,c)}),this.reverted("shape.create",function(s){var c=s.context,l=c.shape,u=c.hints||{};!M(l,"bpmn:Group")||l.labelTarget||u.createElementsBehavior===!1&&!le(l).categoryValueRef&&!c.categoryValue||o(l,c)}),this.executed(["shape.move","shape.resize"],function(s){var c=s.context,l=c.shape;!M(l,"bpmn:Group")||l.labelTarget||le(l).categoryValueRef||r(l,c)}),this.reverted(["shape.move","shape.resize"],function(s){var c=s.context,l=c.shape;!M(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",Iy,function(s){var c=s.descriptor,l=s.element;if(!(!M(l,"bpmn:Group")||l.labelTarget)){var u=le(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",Iy,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})}rf.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],Ee(rf,se);function of(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 Ly(e){function t(i,r,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=of(i,r,o,a),l=of(i,r,o,s),u;c&&l?By(c,o)>By(l,o)?u=l:u=c:u=c||l,i.original=u}function n(i){var r=i.waypoints;t(r[0],r[1],$e(i.source)),t(r[r.length-1],r[r.length-2],$e(i.target))}e.on("bpmnElement.added",function(i){var r=i.element;r.waypoints&&n(r)})}Ly.$inject=["eventBus"];function By(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function af(e){se.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=le(i),o=dt(i);if(tt(r,t)){var a=o.get("isHorizontal");a===void 0&&(a=!0),o.set("isHorizontal",a)}})}af.$inject=["eventBus"],Ee(af,se);function Ny(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function $y(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function XA(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 ZA(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 sf(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=ZA([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 Fy(e,t){var n=sf(e,t),i={x:n.x-e.x,y:n.y-e.y};return Ny(i)}function Ka(e,t){return Ny({x:e.x-t.x,y:e.y-t.y})}var jy=Math.sqrt,Hy=Math.min,QA=Math.max,zy=Math.abs;function Gy(e){return Math.pow(e,2)}function Xa(e,t){return jy(Gy(e.x-t.x)+Gy(e.y-t.y))}function JA(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],Wy(i,r)?l=[i]:(o=Xa(e,i),a=Xa(e,r),c=Hy(o,a),l=eP(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:Wy(i,l[0])?n:n+1}),l.length===2&&(s=nP(l[0],l[1]),u={type:"segment",position:s,segmentIndex:n,relativeLocation:Xa(i,s)/Xa(i,r)}),p=Xa(u.position,e),(!d||f>p)&&(d=u,f=p)}return d}function eP(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=jy(d),m=-p+h,b=-p-h,E={x:e.x-r*m,y:e.y-o*m};if(d===0)return[E];var _={x:e.x-r*b,y:e.y-o*b};return[E,_].filter(function(g){return tP(g,e,t)})}function tP(e,t,n){return Vy(e.x,t.x,n.x)&&Vy(e.y,t.y,n.y)}function Vy(e,t,n){return e>=Hy(t,n)-qc&&e<=QA(t,n)+qc}function nP(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var qc=.1;function Wy(e,t){return zy(e.x-t.x)<=qc&&zy(e.y-t.y)<=qc}function iP(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=Yy(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 Uy(e,t,n,i){var r=0,o=0,a={point:e,delta:{x:0,y:0}},s=JA(e,n),c=s.segmentIndex,l=iP(n,t,s,i);if(l<0||l>t.length-2||l===null)return a;var u=qy(n,c),p=qy(t,l),f=s.position,d=oP(u,f),h=rP(u,p);if(s.type==="bendpoint"){var m=t.length-n.length,b=s.bendpointIndex,E=n[b];if(t.indexOf(E)!==-1)return a;if(m===0){var _=t[b];return r=_.x-s.position.x,o=_.y-s.position.y,{delta:{x:r,y:o},point:{x:e.x+r,y:e.y+o}}}m<0&&b!==0&&b<n.length-1&&(d=Yy(n,b))}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=XA({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:Qi(g),delta:Qi({x:r,y:o})}}function Yy(e,t){var n=Ka(e[t-1],e[t]),i=Ka(e[t],e[t+1]),r=n/(n+i);return r}function rP(e,t){var n=$y(e),i=$y(t);return i-n}function qy(e,t){return[e[t],e[t+1]]}function oP(e,t){var n=Ka(e[0],e[1]),i=Ka(e[0],t);return n===0?0:i/n}function aP(e,t,n,i){var r=$e(e);return Uy(r,t,n,i).delta}function Za(e,t,n){var i=Ua(t),r=Ua(n),o=Ci(e,i),a={x:o.x*(n.width/t.width),y:o.y*(n.height/t.height)};return Qi({x:r.x+a.x,y:r.y+a.y})}function Ky(e,t,n){var i=Ua(e),r=Ua(t),o=Ua(n),a=Ci(e,i),s=Ci(i,r),c=sP(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 Qi({x:u.x+a.x-e.x,y:u.y+a.y-e.y})}function sP(e,t,n){var i=Le(t),r=Le(n);if(cP(i,r))return null;var o=wn(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=wn(n,s),c!==o?null:a}function cP(e,t){return lP(e,t)||uP(e,t)}function lP(e,t){return e.right!==t.right&&e.left!==t.left}function uP(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var Xy="name",Zy="text";function cf(e,t,n,i){se.call(this,e),this.postExecute("element.updateProperties",r),this.postExecute("element.updateModdleProperties",a=>{le(a.context.element)===a.context.moddleElement&&r(a)});function r(a){var s=a.context,c=s.element,l=s.properties;if(Xy in l&&t.updateLabel(c,l[Xy]),Zy in l&&M(c,"bpmn:TextAnnotation")){var u=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},l[Zy]||"");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)||!Rr(l)||oi(l)&&t.updateLabel(l,oi(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=U({},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),aP(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=le(c);u&&Rr(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(oi(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(kc(c)){var p=c.label,f=$e(p),d=dP(u),h=fP(f,d),m=pP(h,u,l);t.moveShape(p,m)}})}Ee(cf,se),cf.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function pP(e,t,n){var i=Za(e,t,n);return Qi(Ci(i,e))}function fP(e,t){if(t.length){var n=hP(e,t);return sf(e,n)}}function dP(e){return[[{x:e.x,y:e.y},{x:e.x+(e.width||0),y:e.y}],[{x:e.x+(e.width||0),y:e.y},{x:e.x+(e.width||0),y:e.y+(e.height||0)}],[{x:e.x,y:e.y+(e.height||0)},{x:e.x+(e.width||0),y:e.y+(e.height||0)}],[{x:e.x,y:e.y},{x:e.x,y:e.y+(e.height||0)}]]}function hP(e,t){var n=t.map(function(r){return{line:r,distance:Fy(e,r)}}),i=Pi(n,"distance");return i[0].line}function mP(e,t,n,i){return Uy(e,t,n,i).point}function lf(e,t){se.call(this,e);function n(i,r){var o=i.context,a=o.connection,s=U({},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),mP(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(lf,se),lf.$inject=["eventBus","modeling"];function Kc(e,t,n){var i=Zc(e),r=Jy(i,t),o=i[0];return r.length?r[r.length-1]:Za(o.original||o,n,t)}function Xc(e,t,n){var i=Zc(e),r=Jy(i,t),o=i[i.length-1];return r.length?r[0]:Za(o.original||o,n,t)}function uf(e,t,n){var i=Zc(e),r=Qy(t,n),o=i[0];return Za(o.original||o,r,t)}function pf(e,t,n){var i=Zc(e),r=Qy(t,n),o=i[i.length-1];return Za(o.original||o,r,t)}function Qy(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function Zc(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Jy(e,t){var n=Mn(e,yP);return nt(n,function(i){return gP(i,t)})}function gP(e,t){return wn(t,e,1)==="intersect"}function yP(e){return e.original||e}function ff(e,t){se.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,r=n.newShape;if(vP(i,r)){var o=bP(i);o.incoming.forEach(function(a){var s=Xc(a,r,i);t.reconnectEnd(a,r,s)}),o.outgoing.forEach(function(a){var s=Kc(a,r,i);t.reconnectStart(a,r,s)})}},!0)}ff.$inject=["eventBus","modeling"],Ee(ff,se);function vP(e,t){return M(e,"bpmn:Participant")&&st(e)&&M(t,"bpmn:Participant")&&!st(t)}function bP(e){var t=Ba([e]),n=[],i=[];return t.forEach(function(r){r!==e&&(r.incoming.forEach(function(o){M(o,"bpmn:MessageFlow")&&n.push(o)}),r.outgoing.forEach(function(o){M(o,"bpmn:MessageFlow")&&i.push(o)}))},[]),{incoming:n,outgoing:i}}const xP=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function ev(e){const t=le(e);if(!M(t,"bpmn:BoundaryEvent")&&!(M(t,"bpmn:StartEvent")&&kn(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:xP.some(i=>M(n[0],i))}function tv(e){return M(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function df(e,t){e.invoke(se,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,r=n.context.newShape,o=n.context.hints;if(!ev(r))return;const a=tv(r);if(o.targetElement&&o.targetElement[a]!==void 0)return;const c=le(i).get(a),l=le(r).get(a);c!==l&&t.updateProperties(r,{[a]:c})})}df.$inject=["injector","modeling"],Ee(df,se);function hf(e,t){se.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,r=dt(i),o=r&&r.get("label"),a=o&&o.get("bounds");a&&t.updateModdleProperties(i,o,{bounds:void 0})},!0)}Ee(hf,se),hf.$inject=["eventBus","modeling"];function mf(e,t,n){se.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(!(!M(o,"bpmn:SequenceFlow")||!M(a,"bpmn:SequenceFlow"))&&t.canConnect(o.source,a.target,o)){var s=_P(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}Ee(mf,se),mf.$inject=["eventBus","bpmnRules","modeling"];function Qo(e){return e.original||e}function _P(e,t){var n=of(Qo(e[e.length-2]),Qo(e[e.length-1]),Qo(t[1]),Qo(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[Qo(e[0]),Qo(t[t.length-1])]}function gf(e,t){se.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,r=i.parent;M(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)}gf.$inject=["eventBus","modeling"],Ee(gf,se);function yf(e,t,n,i){se.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;M(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(l,u)||(d=!0),n.canConnectMessageFlow(l,u)&&(f="bpmn:MessageFlow")),M(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;z(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=kt(p.outgoing,Po({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(yf,se),yf.$inject=["eventBus","modeling","bpmnRules","injector"];function Qc(e,t,n,i,r,o){i.invoke(se,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=zn(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=[];z(s.closure.topLevel,function(f){kn(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(Qc,se),Qc.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,r=this._selection;z(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)},Qc.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var wP=1500,EP={width:140,height:120},vf={width:300,height:60},bf={width:60,height:300},Jc={width:300,height:150},el={width:150,height:300},nv={width:140,height:120},iv={width:100,height:40};function rv(e){e.on("resize.start",wP,function(t){var n=t.context,i=n.shape,r=n.direction,o=n.balanced;(M(i,"bpmn:Lane")||M(i,"bpmn:Participant"))&&(n.resizeConstraints=AP(i,r,o)),M(i,"bpmn:SubProcess")&&st(i)&&(n.minDimensions=nv),M(i,"bpmn:TextAnnotation")&&(n.minDimensions=iv)})}rv.$inject=["eventBus"];var Ar=Math.abs,SP=Math.min,RP=Math.max;function ov(e,t,n,i){var r=e[t];e[t]=r===void 0?n:i(n,r)}function Jo(e,t,n){return ov(e,t,n,SP)}function ea(e,t,n){return ov(e,t,n,RP)}var CP={top:20,left:50,right:20,bottom:20},MP={top:50,left:20,right:20,bottom:20};function AP(e,t,n){var i=pi(e),r=!0,o=!0,a=Vc(i,[i]),s=Le(e),c={},l={},u=hn(e),p=u?vf:bf;/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=Le(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&&Ar(s.top-m.bottom)<10&&ea(c,"top",m.top+p.height),Ar(s.top-m.top)<5&&Jo(l,"top",m.bottom-p.height)),/e/.test(t)&&(n&&Ar(s.right-m.left)<10&&Jo(c,"right",m.right-p.width),Ar(s.right-m.right)<5&&ea(l,"right",m.left+p.width)),/s/.test(t)&&(n&&Ar(s.bottom-m.top)<10&&Jo(c,"bottom",m.bottom-p.height),Ar(s.bottom-m.bottom)<5&&ea(l,"bottom",m.top+p.height)),/w/.test(t)&&(n&&Ar(s.left-m.right)<10&&ea(c,"left",m.left+p.width),Ar(s.left-m.left)<5&&Jo(l,"left",m.right-p.width))});var f=i.children.filter(function(h){return!h.hidden&&!h.waypoints&&(M(h,"bpmn:FlowElement")||M(h,"bpmn:Artifact"))}),d=u?CP:MP;return f.forEach(function(h){var m=Le(h);/n/.test(t)&&(!u||r)&&Jo(l,"top",m.top-d.top),/e/.test(t)&&(u||o)&&ea(l,"right",m.right+d.right),/s/.test(t)&&(!u||o)&&ea(l,"bottom",m.bottom+d.bottom),/w/.test(t)&&(u||r)&&Jo(l,"left",m.left-d.left)}),{min:l,max:c}}function av(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function ta(e){return e.originalEvent||e.srcEvent}function xf(e){av(e),av(ta(e))}function co(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 cv(e,t){return(ta(e)||e).button===t}function Pr(e){return cv(e,0)}function PP(e){return cv(e,1)}function Qa(e){var t=ta(e)||e;return Pr(e)?sv()?t.metaKey:t.ctrlKey:!1}function tl(e){var t=ta(e)||e;return Pr(e)&&t.shiftKey}var lv=1001;function uv(e,t){e.on("resize.start",lv+500,function(n){var i=n.context,r=i.shape;(M(r,"bpmn:Lane")||M(r,"bpmn:Participant"))&&(i.balanced=!Qa(n))}),e.on("resize.end",lv,function(n){var i=n.context,r=i.shape,o=i.canExecute,a=i.newBounds;if(M(r,"bpmn:Lane")||M(r,"bpmn:Participant"))return o&&(a=Fg(a),t.resizeLane(r,a,i.balanced)),!1})}uv.$inject=["eventBus","modeling"];var TP=500;function _f(e,t,n,i,r){n.invoke(se,this);function o(u){return tt(u,["bpmn:ReceiveTask","bpmn:SendTask"])||kP(u,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(u){var p=e.getDefinitions(),f=p.get("rootElements");return!!kt(f,Po({id:u.id}))}function s(u){if(M(u,"bpmn:ErrorEventDefinition"))return"errorRef";if(M(u,"bpmn:EscalationEventDefinition"))return"escalationRef";if(M(u,"bpmn:MessageEventDefinition"))return"messageRef";if(M(u,"bpmn:SignalEventDefinition"))return"signalRef"}function c(u){if(tt(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(tt(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=le(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");Ut(f,p)}},!0),t.on("copyPaste.copyElement",function(u){var p=u.descriptor,f=u.element;if(!(f.labelTarget||!o(f))){var d=le(f),h=c(d);h&&(p.referencedRootElement=h)}}),t.on("copyPaste.pasteElement",TP,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)})}_f.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],Ee(_f,se);function kP(e,t){return Ne(t)||(t=[t]),hr(t,function(n){return Uo(e,n)})}var pv=Math.max;function fv(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,r=t.start,o={};return z(n,function(a){var s=a.id;M(a,"bpmn:Participant")&&(o[s]=DP(a,i,r)),M(a,"bpmn:Lane")&&(o[s]=hn(a)?vf:bf),M(a,"bpmn:SubProcess")&&st(a)&&(o[s]=nv),M(a,"bpmn:TextAnnotation")&&(o[s]=iv),M(a,"bpmn:Group")&&(o[s]=EP)}),o})}fv.$inject=["eventBus"];function OP(e){return e==="x"}function DP(e,t,n){var i=hn(e);if(!BP(e))return i?Jc:el;var r=OP(t),o={};return r?i?o=Jc:o={width:LP(e,n,r),height:el.height}:i?o={width:Jc.width,height:IP(e,n,r)}:o=el,o}function IP(e,t,n){var i;return i=NP(e,t,n),pv(Jc.height,i)}function LP(e,t,n){var i;return i=$P(e,t,n),pv(el.width,i)}function BP(e){return!!Mr(e).length}function NP(e,t,n){var i=Mr(e),r;return r=wf(i,t,n),e.height-r.height+vf.height}function $P(e,t,n){var i=Mr(e),r;return r=wf(i,t,n),e.width-r.width+bf.width}function wf(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=Mr(r),o.length?wf(o,t,n):r}var dv="_plane";function hv(e){var t=e.id;return FP(t)}function ji(e){var t=e.id;return M(e,"bpmn:SubProcess")?mv(t):t}function lo(e){return mv(e)}function nl(e){var t=dt(e);return M(t,"bpmndi:BPMNPlane")}function mv(e){return e+dv}function FP(e){return e.replace(new RegExp(dv+"$"),"")}var gv=400,jP=600,yv={x:180,y:160};function nr(e,t,n,i,r,o,a){se.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 M(p,"bpmn:SubProcess")&&!st(p)}function l(p){var f=p.shape,d=p.newRootElement,h=le(f);d=s._addDiagram(d||h),p.newRootElement=e.addRootElement(d)}function u(p){var f=p.shape,d=le(f);s._removeDiagram(d);var h=p.newRootElement=a.get(ji(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;z(f,function(d){if(c(d)){var h=a.get(ji(d));if(!(!h||!d.children||!d.children.length)){var m=vv(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;!M(f,"bpmn:SubProcess")||!st(f)||z(za([f]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(p){var f=p.shape;if(c(f)){var d=a.get(ji(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(ji(f)))},!0),this.postExecuted("shape.replace",function(p){var f=p.newShape,d=p.oldRoot,h=e.findRoot(ji(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(M(f,"bpmn:SubProcess")){var d=p.properties,h=p.oldProperties,m=h.id,b=d.id;if(m!==b){if(nl(f)){a.updateId(f,lo(b)),a.updateId(m,b);return}var E=a.get(lo(m));E&&a.updateId(lo(m),lo(b))}}},!0),this.reverted("element.updateProperties",function(p){var f=p.element;if(M(f,"bpmn:SubProcess")){var d=p.properties,h=p.oldProperties,m=h.id,b=d.id;if(m!==b){if(nl(f)){a.updateId(f,lo(m)),a.updateId(b,m);return}var E=a.get(lo(b));E&&a.updateId(E,lo(m))}}},!0),t.on("element.changed",function(p){var f=p.element;if(nl(f)){var d=f,h=a.get(hv(d));!h||h===d||t.fire("element.changed",{element:h})}}),this.executed("shape.toggleCollapse",gv,function(p){var f=p.shape;M(f,"bpmn:SubProcess")&&(st(f)?u(p):(l(p),s._showRecursively(f.children)))},!0),this.reverted("shape.toggleCollapse",gv,function(p){var f=p.shape;M(f,"bpmn:SubProcess")&&(st(f)?u(p):(l(p),s._showRecursively(f.children)))},!0),this.postExecuted("shape.toggleCollapse",jP,function(p){var f=p.shape;if(M(f,"bpmn:SubProcess")){var d=p.newRootElement;if(d)if(st(f))s._moveChildrenToShape(d.children.slice(),f),z(za(f.children),m=>{n.moveShape(m.annotation,{x:0,y:0},f.parent),z(m.associations,b=>{n.moveConnection(b,{x:0,y:0},f.parent)})});else{s._disconnectSharedAnnotations(f);var h=vv(f);s._moveChildrenToShape(h,d)}}},!0),t.on("copyPaste.createTree",function(p){var f=p.element,d=p.children;if(c(f)){var h=ji(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,b=M(dt(m),"bpmndi:BPMNPlane");if(b){var E=hv(m),_=kt(h,function(g){return g.id===E});_&&(f.parent=_.id)}}),t.on("copyPaste.pasteElement",function(p){var f=p.descriptor;f.parent&&(c(f.parent)||f.parent.hidden)&&(f.hidden=!0)})}Ee(nr,se),nr.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=Zt(i),o;if(!t.x)o={x:yv.x-r.x,y:yv.y-r.y};else{var a=$e(t),s=$e(r);o={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,o,t,{autoResize:!1})}},nr.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(cy(e).map(i=>i.annotation));n.size&&z(za(e.children),i=>{n.has(i.annotation)&&z(i.associations,r=>{t.removeConnection(r)})})},nr.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},nr.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},nr.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:ji(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return o},nr.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=kt(n,function(r){return r.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},nr.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function HP(e){var t=[];return z(za(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function vv(e){return e.children.slice().concat(HP(e.children)).concat(zP(e))}function zP(e){return Cp(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function Ef(e,t){e.invoke(se,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,r=n.context.newShape;if(!(!M(r,"bpmn:SubProcess")||M(r,"bpmn:AdHocSubProcess")||!(M(i,"bpmn:Task")||M(i,"bpmn:CallActivity"))||!st(r))){var o=GP(r);t.createShape({type:"bpmn:StartEvent"},o,r)}})}Ef.$inject=["injector","modeling"],Ee(Ef,se);function GP(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function Sf(e,t){se.call(this,e),this.preExecute("connection.create",function(n){const{target:i}=n;M(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&&M(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(!(!M(r,"bpmn:TextAnnotation")||o.autoResize)){var a=i.newBounds,s=t.getTextAnnotationBounds(a,oi(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(Sf,se),Sf.$inject=["eventBus","textRenderer"];function Rf(e,t){se.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(st(i))return;var r=Ba(i);r.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();z(s,function(l){o(l,!0)}),z(c,function(l){o(l,!1)})});function o(a,s){r.indexOf(a.source)!==-1&&r.indexOf(a.target)!==-1||M(a,"bpmn:Association")&&(M(a.source,"bpmn:TextAnnotation")||M(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,i,$e(i)):t.reconnectStart(a,i,$e(i)))}},!0)}Ee(Rf,se),Rf.$inject=["eventBus","modeling"];var Cf=500;function Mf(e,t,n){se.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=VP(c).concat([a]),p=Cy(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"],Cf,function(a){var s=a.context,c=s.shape;M(c,"bpmn:SubProcess")&&(c.collapsed?dt(c).isExpanded=!1:(i(c.children),dt(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],Cf,function(a){var s=a.context,c=s.shape;c.collapsed?dt(c).isExpanded=!1:dt(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],Cf,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(Mf,se),Mf.$inject=["eventBus","elementFactory","modeling"];function VP(e){return e.filter(function(t){return!t.hidden})}function Af(e,t,n,i){t.invoke(se,this),this.preExecute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.businessObject;Je(a)||(M(a,"bpmn:Participant")&&st(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;M(r,"bpmn:Collaboration")&&n.ids.unclaim(o.id)})}Ee(Af,se),Af.$inject=["canvas","injector","moddle","modeling"];function Pf(e,t){se.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,r=i.connection,o=r.source;WP(r,o)&&t.updateProperties(o,{default:null})})}Ee(Pf,se),Pf.$inject=["eventBus","modeling"];function WP(e,t){if(!M(e,"bpmn:SequenceFlow"))return!1;var n=le(t),i=le(e);return n.get("default")===i}var UP=500,YP=5e3,bv=["shape.create","shape.delete","shape.move","shape.resize"],xv=[...bv,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function Tf(e,t){se.call(this,e);var n;function i(){return n=n||new qP,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(xv,YP,function(){i()}),this.postExecuted(xv,UP,function(){o()}),this.preExecute(bv,function(a){var s=a.context,c=s.shape,l=r();!c||c.labelTarget||(M(c,"bpmn:Lane")&&l.addLane(c),M(c,"bpmn:FlowNode")&&l.addFlowNode(c))})}Tf.$inject=["eventBus","modeling"],Ee(Tf,se);function qP(){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 KP=500,XP=5e3,_v=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],wv=[..._v,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function kf(e,t){se.call(this,e);var n;function i(){return n=n||new ZP,n.enter(),n}function r(){if(!n)throw new Error("out of bounds release");return n}function o(){if(!n)throw new Error("out of bounds release");var a=n.leave();return a&&(t.updateCategoryValueRefs(Array.from(n.affectedFlowElements),Array.from(n.affectedGroupEntries.values())),n=null),a}this.preExecute(wv,XP,function(){i()}),this.postExecuted(wv,KP,function(){o()}),this.preExecute(_v,function(a){var s=a.context.connection||a.context.shape,c=r();!s||s.labelTarget||(M(s,"bpmn:FlowElement")&&c.addFlowElement(s),M(s,"bpmn:Group")&&c.addGroup(s))}),this.preExecute("label.create",function(a){var s=a.context.labelTarget;M(s,"bpmn:Group")&&r().addGroup(s)})}kf.$inject=["eventBus","modeling"],Ee(kf,se);function ZP(){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 Of(e,t){se.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,r=i.elements;for(const o of r)QP(o)&&!eT(o)&&t.updateProperties(o,{isForCompensation:void 0})})}Ee(Of,se),Of.$inject=["eventBus","modeling"];function QP(e){const t=le(e);return t&&t.isForCompensation}function JP(e){return e&&M(e,"bpmn:BoundaryEvent")&&Uo(e,"bpmn:CompensateEventDefinition")}function eT(e){return e.incoming.filter(n=>JP(n.source)).length>0}const tT={__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",Fp],appendBehavior:["type",jp],associationBehavior:["type",zp],attachEventBehavior:["type",Nc],artifactBehavior:["type",Hp],boundaryEventBehavior:["type",Gp],categoryRootElementReferenceBehavior:["type",Vp],compensateBoundaryEventBehaviour:["type",Wp],createBehavior:["type",Up],createDataObjectBehavior:["type",Yp],createParticipantBehavior:["type",Xp],dataInputAssociationBehavior:["type",Zp],dataStoreBehavior:["type",Qp],deleteLaneBehavior:["type",Jp],detachEventBehavior:["type",Wc],dropOnFlowBehavior:["type",tf],eventBasedGatewayBehavior:["type",nf],fixHoverBehavior:["type",Dy],groupBehavior:["type",rf],importDockingFix:["type",Ly],isHorizontalFix:["type",af],labelBehavior:["type",cf],layoutConnectionBehavior:["type",lf],messageFlowBehavior:["type",ff],nonInterruptingBehavior:["type",df],removeElementBehavior:["type",mf],removeEmbeddedLabelBoundsBehavior:["type",hf],removeParticipantBehavior:["type",gf],replaceConnectionBehavior:["type",yf],replaceElementBehaviour:["type",Qc],resizeBehavior:["type",rv],resizeLaneBehavior:["type",uv],rootElementReferenceBehavior:["type",_f],spaceToolBehavior:["type",fv],subProcessPlaneBehavior:["type",nr],subProcessStartEventBehavior:["type",Ef],textAnnotationBehavior:["type",Sf],toggleCollapseConnectionBehaviour:["type",Rf],toggleElementCollapseBehaviour:["type",Mf],unclaimIdBehavior:["type",Af],unsetDefaultFlowBehavior:["type",Pf],updateFlowNodeRefsBehavior:["type",Tf],updateCategoryValueRefsBehavior:["type",kf],setCompensationActivityAfterPasteBehavior:["type",Of]};function Df(e){this._commandStack=e.get("commandStack",!1)}Df.$inject=["injector"],Df.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const Hi={__init__:["rules"],rules:["type",Df]};function fi(e){se.call(this,e),this.init()}fi.$inject=["eventBus"],Ee(fi,se),fi.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)})},fi.prototype.init=function(){};function Ev(e,t){var n=wn(e,t,-15);return n!=="intersect"?n:null}function Sn(e){fi.call(this,e)}Ee(Sn,fi),Sn.$inject=["eventBus"],Sn.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return nT(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 rl(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return rl(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 Bv(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return Mt(i)&&!ol(t,i)?!1:Zr(t,function(r){return Mt(r)?rl(r.source,r.target,r):r.host?Ja(r,r.host,null,n):Nf(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 Tv(a)&&!n.includes(a.host)})?!1:Ja(n,t,null,i)||Iv(n,t,i)||Lv(n,t)||ol(n,t)}),this.addRule("shape.create",function(e){return Nf(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return Ja(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return Hv(n,t)})},Sn.prototype.canConnectMessageFlow=Fv,Sn.prototype.canConnectSequenceFlow=jv,Sn.prototype.canConnectDataAssociation=$f,Sn.prototype.canConnectAssociation=Nv,Sn.prototype.canConnectCompensationAssociation=$v,Sn.prototype.canMove=Lv,Sn.prototype.canAttach=Ja,Sn.prototype.canReplace=Iv,Sn.prototype.canDrop=na,Sn.prototype.canInsert=ol,Sn.prototype.canCreate=Nf,Sn.prototype.canConnect=rl,Sn.prototype.canResize=Bv,Sn.prototype.canCopy=Hv;function nT(e){return If(e)?null:tt(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function If(e){return!e||Je(e)}function Sv(e){do{if(M(e,"bpmn:Process"))return le(e);if(M(e,"bpmn:Participant"))return le(e).processRef||le(e)}while(e=e.parent)}function Lf(e){return M(e,"bpmn:TextAnnotation")}function Bf(e){return M(e,"bpmn:Group")&&!e.labelTarget}function Rv(e){return M(e,"bpmn:BoundaryEvent")&&zi(e,"bpmn:CompensateEventDefinition")}function il(e){return le(e).isForCompensation}function iT(e,t){var n=Sv(e),i=Sv(t);return n===i}function rT(e){return M(e,"bpmn:InteractionNode")&&!M(e,"bpmn:BoundaryEvent")&&(!M(e,"bpmn:Event")||M(e,"bpmn:ThrowEvent")&&Av(e,"bpmn:MessageEventDefinition"))}function oT(e){return M(e,"bpmn:InteractionNode")&&!il(e)&&(!M(e,"bpmn:Event")||M(e,"bpmn:CatchEvent")&&Av(e,"bpmn:MessageEventDefinition"))&&!(M(e,"bpmn:BoundaryEvent")&&!zi(e,"bpmn:MessageEventDefinition"))}function Cv(e){for(var t=e;t=t.parent;){if(M(t,"bpmn:FlowElementsContainer"))return le(t);if(M(t,"bpmn:Participant"))return le(t).processRef}return null}function Mv(e,t){var n=Cv(e),i=Cv(t);return n===i}function zi(e,t){var n=le(e);return!!kt(n.eventDefinitions||[],function(i){return M(i,t)})}function Av(e,t){var n=le(e);return(n.eventDefinitions||[]).every(function(i){return M(i,t)})}function aT(e){return M(e,"bpmn:FlowNode")&&!M(e,"bpmn:EndEvent")&&!kn(e)&&!(M(e,"bpmn:IntermediateThrowEvent")&&zi(e,"bpmn:LinkEventDefinition"))&&!Rv(e)&&!il(e)}function sT(e){return M(e,"bpmn:FlowNode")&&!M(e,"bpmn:StartEvent")&&!M(e,"bpmn:BoundaryEvent")&&!kn(e)&&!(M(e,"bpmn:IntermediateCatchEvent")&&zi(e,"bpmn:LinkEventDefinition"))&&!il(e)}function cT(e){return M(e,"bpmn:ReceiveTask")||M(e,"bpmn:IntermediateCatchEvent")&&(zi(e,"bpmn:MessageEventDefinition")||zi(e,"bpmn:TimerEventDefinition")||zi(e,"bpmn:ConditionalEventDefinition")||zi(e,"bpmn:SignalEventDefinition"))}function lT(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function Pv(e,t){var n=lT(t);return n.indexOf(e)!==-1}function rl(e,t,n){if(If(e)||If(t))return null;if(!M(n,"bpmn:DataAssociation")){if(Fv(e,t))return{type:"bpmn:MessageFlow"};if(jv(e,t))return{type:"bpmn:SequenceFlow"}}var i=$f(e,t);return i||($v(e,t)?{type:"bpmn:Association",associationDirection:"One"}:Nv(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function na(e,t){return Je(e)||Bf(e)?!0:M(t,"bpmn:Participant")&&!st(t)?!1:M(e,"bpmn:Participant")?M(t,"bpmn:Process")||M(t,"bpmn:Collaboration"):tt(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:M(e,"bpmn:Lane")?M(t,"bpmn:Participant")||M(t,"bpmn:Lane"):M(e,"bpmn:BoundaryEvent")&&!uT(e)?!1:M(e,"bpmn:FlowElement")&&!M(e,"bpmn:DataStoreReference")?M(t,"bpmn:FlowElementsContainer")?st(t):tt(t,["bpmn:Participant","bpmn:Lane"]):M(e,"bpmn:DataStoreReference")&&M(t,"bpmn:Collaboration")?hr(le(t).get("participants"),function(n){return!!n.get("processRef")}):tt(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?tt(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):M(e,"bpmn:MessageFlow")?M(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function uT(e){return le(e).cancelActivity&&(kv(e)||Ov(e))}function Tv(e){return!Je(e)&&M(e,"bpmn:BoundaryEvent")}function pT(e){return M(e,"bpmn:Lane")}function fT(e){return Tv(e)||M(e,"bpmn:IntermediateThrowEvent")&&kv(e)?!0:M(e,"bpmn:IntermediateCatchEvent")&&Ov(e)}function kv(e){var t=le(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function Ov(e){return Dv(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function Dv(e,t){return t.some(function(n){return zi(e,n)})}function dT(e){return M(e,"bpmn:ReceiveTask")&&kt(e.incoming,function(t){return M(t.source,"bpmn:EventBasedGateway")})}function Ja(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var r=e[0];return Je(r)||!fT(r)||kn(t)||!M(t,"bpmn:Activity")||il(t)||i&&!Ev(i,t)||dT(t)?!1:"attach"}function Iv(e,t,n){if(!t)return!1;var i={replacements:[]};return z(e,function(r){kn(t)||M(r,"bpmn:StartEvent")&&r.type!=="label"&&na(r,t)&&(wM(r)||i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),(EM(r)||SM(r)||RM(r))&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),Dv(r,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&M(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"})),M(t,"bpmn:Transaction")||zi(r,"bpmn:CancelEventDefinition")&&r.type!=="label"&&(M(r,"bpmn:EndEvent")&&na(r,t)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:EndEvent"}),M(r,"bpmn:BoundaryEvent")&&Ja(r,t,null,n)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function Lv(e,t){return hr(e,pT)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return na(n,t)})}function Nf(e,t,n,i){return t?Je(e)||Bf(e)?!0:na(e,t)||ol(e,t):!1}function Bv(e,t,n){return M(e,"bpmn:SubProcess")?st(e)&&(!t||t.width>=100&&t.height>=80):M(e,"bpmn:Lane")||M(e,"bpmn:Participant")?!0:Lf(e)?n?n==="e"||n==="w":!0:Bf(e)?!0:Je(e)?n?n==="e"||n==="w":!0:!1}function hT(e,t){var n=Lf(e),i=Lf(t);return(n||i)&&n!==i}function Nv(e,t){return Pv(t,e)||Pv(e,t)?!1:hT(e,t)?!0:!!$f(e,t)}function $v(e,t){return Mv(e,t)&&Rv(e)&&M(t,"bpmn:Activity")&&!gT(t,e)&&!kn(t)}function Fv(e,t){return Gv(e)&&!Gv(t)?!1:rT(e)&&oT(t)&&!iT(e,t)}function jv(e,t){return aT(e)&&sT(t)&&Mv(e,t)&&!(M(e,"bpmn:EventBasedGateway")&&!cT(t))}function $f(e,t){return tt(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&tt(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:tt(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&tt(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function ol(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:tt(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!Je(t)&&M(e,"bpmn:FlowNode")&&!M(e,"bpmn:BoundaryEvent")&&na(e,t.parent)}function Ff(e,t){return e&&t&&e.indexOf(t)!==-1}function Hv(e,t){return Je(t)?!0:!(M(t,"bpmn:Lane")&&!Ff(e,t.parent)||M(t,"bpmn:MessageFlow")&&!mT(e,t))}function mT(e,t){var n=zv(t.source),i=zv(t.target);return Ff(e,n)&&Ff(e,i)}function zv(e){for(;e;e=e.parent)if(M(e,"bpmn:Participant"))return e;return null}function Gv(e){return Ko(e,"bpmn:Process")||Ko(e,"bpmn:Collaboration")}function gT(e,t){return e.attachers.includes(t)}const yT={__depends__:[Hi],__init__:["bpmnRules"],bpmnRules:["type",Sn]};var vT=2e3;function Vv(e,t){e.on("saveXML.start",vT,n);function n(){var i=t.getRootElements();z(i,function(r){var o=dt(r),a,s;a=Ba([r]),a=nt(a,function(c){return c!==r&&!c.labelTarget}),s=Mn(a,dt),o.set("planeElement",s)})}}Vv.$inject=["eventBus","canvas"];const bT={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",Vv]};function al(e){se.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)})}al.prototype.getOrdering=function(e,t){return null},Ee(al,se);function jf(e,t){al.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=kt(n,function(c){return tt(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&&!tt(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||M(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=Mh(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}}}jf.$inject=["eventBus","canvas"],Ee(jf,al);const xT={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",jf]};function es(){}es.prototype.get=function(){return this._data},es.prototype.set=function(e){this._data=e},es.prototype.clear=function(){var e=this._data;return delete this._data,e},es.prototype.isEmpty=function(){return!this._data};const _T={clipboard:["type",es]};var Wv=1500;function Uv(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",Wv,function(s){o(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",Wv,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=co(a),c=document.elementFromPoint(s.x,s.y),wT(c)}}Uv.$inject=["elementRegistry","eventBus","injector"];function wT(e){return no(e,"svg, .djs-element",!0)}const ET={__init__:["hoverFix"],hoverFix:["type",Uv]};function ST(e){return!0}function sl(e){return Pr(e)||PP(e)}var Yv=500;function qv(e,t,n){var i=this;function r(T,$,k){if(!s(T,$)){var D,H,Q;k?H=t.getGraphics(k):(D=$.delegateTarget||$.target,D&&(H=D,k=t.get(H))),!(!H||!k)&&(Q=e.fire(T,{element:k,gfx:H,originalEvent:$}),Q===!1&&($.stopPropagation(),$.preventDefault()))}}var o={};function a(T){return o[T]}function s(T,$){var k=l[T]||Pr;return!k($)}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":ST,"element.mousedown":sl,"element.mouseup":sl,"element.click":sl,"element.dblclick":sl};function u(T,$,k){var D=c[T];if(!D)throw new Error("unmapped DOM event name <"+T+">");return r(D,$,k)}var p="svg, .djs-element";function f(T,$,k,D){var H=o[k]=function(Q){r(k,Q)};D&&(l[k]=D),H.$delegate=Gn.bind(T,p,$,H)}function d(T,$,k){var D=a(k);D&&Gn.unbind(T,$,D.$delegate)}function h(T){z(c,function($,k){f(T,k,$)})}function m(T){z(c,function($,k){d(T,k,$)})}e.on("canvas.destroy",function(T){m(T.svg)}),e.on("canvas.init",function(T){h(T.svg)}),e.on(["shape.added","connection.added"],function(T){var $=T.element,k=T.gfx;e.fire("interactionEvents.createHit",{element:$,gfx:k})}),e.on(["shape.changed","connection.changed"],Yv,function(T){var $=T.element,k=T.gfx;e.fire("interactionEvents.updateHit",{element:$,gfx:k})}),e.on("interactionEvents.createHit",Yv,function(T){var $=T.element,k=T.gfx;i.createDefaultHit($,k)}),e.on("interactionEvents.updateHit",function(T){var $=T.element,k=T.gfx;i.updateDefaultHit($,k)});var b=S("djs-hit djs-hit-stroke"),E=S("djs-hit djs-hit-click-stroke"),_=S("djs-hit djs-hit-all"),g=S("djs-hit djs-hit-no-move"),y={all:_,"click-stroke":E,stroke:b,"no-move":g};function S(T,$){return $=U({stroke:"white",strokeWidth:15},$||{}),n.cls(T,["no-fill","no-border"],$)}function w(T,$){var k=y[$];if(!k)throw new Error("invalid hit type <"+$+">");return Se(T,k),T}function P(T,$){Ue(T,$)}this.removeHits=function(T){var $=vc(".djs-hit",T);z($,an)},this.createDefaultHit=function(T,$){var k=T.waypoints,D=T.isFrame,H;return k?this.createWaypointsHit($,k):(H=D?"stroke":"all",this.createBoxHit($,H,{width:T.width,height:T.height}))},this.createWaypointsHit=function(T,$){var k=La($);return w(k,"stroke"),P(T,k),k},this.createBoxHit=function(T,$,k){k=U({x:0,y:0},k);var D=De("rect");return w(D,$),Se(D,k),P(T,D),D},this.updateDefaultHit=function(T,$){var k=Rt(".djs-hit",$);if(k)return T.waypoints?Rp(k,T.waypoints):Se(k,{width:T.width,height:T.height}),k},this.fire=r,this.triggerMouseEvent=u,this.mouseHandler=a,this.registerEvent=f,this.unregisterEvent=d}qv.$inject=["eventBus","elementRegistry","styles"];const cl={__init__:["interactionEvents"],interactionEvents:["type",qv]};function ia(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)})}ia.$inject=["eventBus","canvas"],ia.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()})}},ia.prototype.get=function(){return Array.from(this._selectedElements)},ia.prototype.isSelected=function(e){return this._selectedElements.has(e)},ia.prototype.select=function(e,t){var n=this.get();Ne(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?z(e,o=>{this._selectedElements.add(o)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var Kv="hover",Xv="selected";function Zv(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,Kv)}),t.on("element.out",function(r){i(r.element,Kv)}),t.on("selection.changed",function(r){function o(l){i(l,Xv)}function a(l){n(l,Xv)}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)})}Zv.$inject=["canvas","eventBus"];function Qv(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;Ne(l)?t.select(l):t.select(s.filter(RT))}}),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=kt(o,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(r){if(Pr(r)){var o=r.element;o===n.getRootElement()&&(o=null);var a=t.isSelected(o),s=t.get().length>1,c=tl(r);if(a&&s)return c?t.deselect(o):t.select(o);a?t.deselect(o):t.select(o,c)}})}Qv.$inject=["eventBus","selection","canvas","elementRegistry"];function RT(e){return!e.hidden}const di={__init__:["selectionVisuals","selectionBehavior"],__depends__:[cl],selection:["type",ia],selectionVisuals:["type",Zv],selectionBehavior:["type",Qv]};var CT=/^djs-cursor-.*$/;function ll(e){var t=$t(document.body);t.removeMatching(CT),e&&t.add("djs-cursor-"+e)}function Jv(){ll(null)}var MT=5e3;function eb(e,t){t=t||"element.click";function n(){return!1}return e.once(t,MT,n),function(){e.off(t,n)}}var AT=["c","C"],PT=["v","V"],TT=["d","D"],kT=["x","X"],OT=["y","Y"],tb=["z","Z"];function DT(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Un(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function sn(e,t){return e=Ne(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function Hf(e){return e.shiftKey}function IT(e){return Un(e)&&sn(AT,e)}function LT(e){return Un(e)&&sn(PT,e)}function BT(e){return Un(e)&&sn(TT,e)}function NT(e){return Un(e)&&sn(kT,e)}function $T(e){return Un(e)&&!Hf(e)&&sn(tb,e)}function FT(e){return Un(e)&&(sn(OT,e)||sn(tb,e)&&Hf(e))}var ra=Math.round,nb="djs-drag-active";function uo(e){e.preventDefault()}function jT(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function HT(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function ib(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(U({},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,w=o.displacement,P=o.globalStart,T=co(g),$=Ci(T,P),k=o.localStart,D=a(T),H=Ci(D,k);if(!o.active&&(y||HT($)>o.threshold)){if(U(S,{x:ra(k.x+w.x),y:ra(k.y+w.y),dx:0,dy:0},{originalEvent:g}),s("start")===!1)return b();o.active=!0,o.keepSelection||(S.previousSelection=n.get(),n.select(null)),o.cursor&&ll(o.cursor),t.addMarker(t.getRootElement(),nb)}xf(g),o.active&&(U(S,{x:ra(D.x+w.x),y:ra(D.y+w.y),dx:ra(H.x),dy:ra(H.y)},{originalEvent:g}),s("move"))}function u(g){var y,S=!0;o.active&&(g&&(o.payload.originalEvent=g,xf(g)),S=s("end")),S===!1&&s("rejected"),y=E(S!==!0),s("ended",y)}function p(g){sn("Escape",g)&&(uo(g),b())}function f(g){var y;o.active&&(y=eb(e),setTimeout(y,400),uo(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 b(g){var y;if(o){var S=o.active;S&&s("cancel"),y=E(g),S&&s("canceled",y)}}function E(g){var y,S;s("cleanup"),Jv(),o.trapClick?S=f:S=u,Ge.unbind(document,"mousemove",l),Ge.unbind(document,"dragstart",uo),Ge.unbind(document,"selectstart",uo),Ge.unbind(document,"mousedown",S,!0),Ge.unbind(document,"mouseup",S,!0),Ge.unbind(document,"keyup",p),Ge.unbind(document,"touchstart",d,!0),Ge.unbind(document,"touchcancel",b,!0),Ge.unbind(document,"touchmove",l,!0),Ge.unbind(document,"touchend",u,!0),e.off("element.hover",h),e.off("element.out",m),t.removeMarker(t.getRootElement(),nb);var w=o.payload.previousSelection;return g!==!1&&w&&!n.get().length&&c(w),y=o,o=null,y}function _(g,y,S,w){o&&b(!1),typeof y=="string"&&(w=S,S=y,y=null),w=U({},r,w||{});var P=w.data||{},T,$,k,D,H;if(w.trapClick?D=f:D=u,g?(T=ta(g)||g,$=co(g),xf(g),T.type==="dragstart"&&uo(T)):(T=null,$={x:0,y:0}),k=a($),y||(y=k),H=jT(T),o=U({prefix:S,data:P,payload:{},globalStart:$,displacement:Ci(y,k),localStart:k,isTouch:H},w),w.manual||(H?(Ge.bind(document,"touchstart",d,!0),Ge.bind(document,"touchcancel",b,!0),Ge.bind(document,"touchmove",l,!0),Ge.bind(document,"touchend",u,!0)):(Ge.bind(document,"mousemove",l),Ge.bind(document,"dragstart",uo),Ge.bind(document,"selectstart",uo),Ge.bind(document,"mousedown",D,!0),Ge.bind(document,"mouseup",D,!0)),Ge.bind(document,"keyup",p),e.on("element.hover",h),e.on("element.out",m)),s("init")===!1)return b(),!1;w.autoActivate&&l(g,!0)}e.on("diagram.destroy",b),this.init=_,this.move=l,this.hover=h,this.out=m,this.end=u,this.cancel=b,this.context=function(){return o},this.setOptions=function(g){U(r,g)}}ib.$inject=["eventBus","canvas","selection","elementRegistry"];const ir={__depends__:[ET,di],dragging:["type",ib]};function oa(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}oa.prototype.next=function(){return this._prefix+ ++this._counter};const zT=new oa("ps");var GT=["marker-start","marker-mid","marker-end"],VT=["circle","ellipse","line","path","polygon","polyline","path","rect"];function Tr(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}Tr.$inject=["elementRegistry","eventBus","canvas","styles"],Tr.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")},Tr.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},Tr.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var r=gg(n);return this._cloneMarkers(oo(r),i),Se(r,this._styles.cls(i,[])),Ue(t,r),Se(r,"data-preview-support-element-id",e.id),r},Tr.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 Ue(t,n),Se(n,"data-preview-support-element-id",e.id),n},Tr.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(r=>{i._cloneMarkers(r,t,n)}),qT(e)&&GT.forEach(function(r){if(Se(e,r)){var o=WT(e,r,i._canvas.getContainer());o&&i._cloneMarker(n,e,o,r,t)}})},Tr.prototype._cloneMarker=function(e,t,n,i,r="djs-dragger"){var o=[n.id,r,zT.next()].join("-"),a=Rt("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||gg(n);s.id=o,ut(s).add(r);var c=Rt(":scope > defs",e);c||(c=De("defs"),Ue(e,c)),Ue(c,s);var l=YT(s.id);Se(t,i,l)};function WT(e,t,n){var i=UT(Se(e,t));return Rt("marker#"+i,n||document)}function UT(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function YT(e){return"url(#"+e+")"}function qT(e){return VT.indexOf(e.nodeName)!==-1}const aa={__init__:["previewSupport"],previewSupport:["type",Tr]};var KT="drop-ok",rb="drop-not-ok",ob="attach-ok",ab="new-parent",sb="create",XT=2e3;function cb(e,t,n,i,r){function o(c,l,u,p,f){if(!l)return!1;c=nt(c,function(_){var g=_.labelTarget;return!_.parent&&!(Je(_)&&c.indexOf(g)!==-1)});var d=kt(c,function(_){return!Mt(_)}),h=!1,m=!1,b=!1;ub(c)&&(h=r.allowed("shape.attach",{position:u,shape:d,target:l})),h||(ub(c)?b=r.allowed("shape.create",{position:u,shape:d,source:p,target:l}):b=r.allowed("elements.create",{elements:c,position:u,target:l}));var E=f.connectionTarget;return b||h?(d&&p&&(m=r.allowed("connection.create",{source:E===p?d:p,target:E===p?p:d,hints:{targetParent:l,targetAttach:h}})),{attach:h,connect:m}):b===null||h===null?null:!1}function a(c,l){[ob,KT,rb,ab].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}lb(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,ob):a(p,m?ab:rb))}),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,b=h&&h.connect,E=l.hints||{};if(h===!1||!d)return!1;lb(c);var _={x:c.x,y:c.y};b?p=i.appendShape(u,p,_,d,{attach:m,connection:b===!0?{}:b,connectionTarget:E.connectionTarget}):(f=i.createElements(f,_,d,U({},E,{attach:m})),p=kt(f,function(g){return!Mt(g)})),U(l,{elements:f,shape:p}),U(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"],XT,function(){n.off("elements.changed",s)})}),this.start=function(c,l,u){Ne(l)||(l=[l]);var p=kt(l,function(h){return!Mt(h)});if(p){u=U({elements:l,hints:{},shape:p},u||{}),z(l,function(h){ze(h.x)||(h.x=0),ze(h.y)||(h.y=0)});var f=nt(l,function(h){return!h.hidden}),d=Zt(f);z(l,function(h){Mt(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}})),U(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}})}}}cb.$inject=["canvas","dragging","eventBus","modeling","rules"];function lb(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 ub(e){return e&&e.length===1&&!Mt(e[0])}var ZT=750;function pb(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(oo(u),l)):(u=n._createContainer("shape",c),n.drawShape(oo(u),l),En(u,l.x,l.y)),i.addDragger(l,s,u))}),s}t.on("create.move",ZT,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)),En(u,a.x,a.y)):an(u)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&an(c)})}pb.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const ul={__depends__:[ir,aa,Hi,di],__init__:["create","createPreview"],create:["type",cb],createPreview:["type",pb]};function zf(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)})}zf.$inject=["eventBus"],zf.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||QT(0,0)};function QT(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 ts={__init__:["mouse"],mouse:["type",zf]};var fb=2e3;function Yn(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),JT(u)&&(l.priority=2,l.host=u.host.id),Mt(u)&&(l.priority=3,l.source=u.source.id,l.target=u.target.id,l.waypoints=e2(u)),Je(u)&&(l.priority=4,l.labelTarget=u.labelTarget.id),z(["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",fb,function(c){var l;((l=c.hints)==null?void 0:l.clip)!==!1&&n.set(c.tree)}),r.on("copyPaste.pasteElements",fb,function(c){c.tree||(c.tree=n.get())}),r.on("copyPaste.pasteElements",function(c){var l=c.hints;U(l,{createElementsBehavior:!1})})}Yn.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],Yn.prototype.copy=function(e,t={}){var n,i;return Ne(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(Ne(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},Yn.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})}}},Yn.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},Yn.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},Yn.prototype._getElementIdsFromTree=function(e){var t={};return z(e,function(n){z(n,function(i){i.id&&(t[i.id]=!0)})}),t},Yn.prototype._paste=function(e,t,n,i){z(e,function(o){ze(o.x)||(o.x=0),ze(o.y)||(o.y=0)});var r=Zt(e);return z(e,function(o){Mt(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}})),U(o,{x:o.x-r.x-r.width/2,y:o.y-r.y-r.height/2})}),this._modeling.createElements(e,n,t,U({},i))},Yn.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return z(e,function(o,a){o=Pi(o,"priority"),z(o,function(s){var c=U({},Ti(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var l;if(Mt(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},Yn.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(Ti(e,["id"]));return t},Yn.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(Ti(e,["id"]));return t},Yn.prototype.createShape=function(e){var t=this._elementFactory.createShape(Ti(e,["id"]));return t},Yn.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(Mt(e)&&(!n.has(e.source)||!n.has(e.target))||Je(e)&&!n.has(e.labelTarget))},Yn.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[],o=new Map,a=wc(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}ro(a,function(p,f,d){if(Je(p))return;z(p.labels,function(b){c(b,d)});function h(b){b&&b.length&&z(b,function(E){z(E.labels,function(_){c(_,d)}),c(E,d)})}z([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=Pi(r,function(p){return p.descriptor.priority}),e=Mn(r,function(p){return p.element}),z(r,function(p){var f=p.depth;if(!n.hasRelations(p.element,e,u)){hb(p.element,e),u.delete(p.element);return}if(!s(p.element,e)){hb(p.element,e),u.delete(p.element);return}i[f]||(i[f]=[]),i[f].push(p.descriptor)}),i};function JT(e){return!!e.host}function e2(e){return Mn(e.waypoints,function(t){return t=db(t),t.original&&(t.original=db(t.original)),t})}function db(e){return U({},e)}function hb(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const t2={__depends__:[_T,ul,ts,Hi],__init__:["copyPaste"],copyPaste:["type",Yn]};function Gf(e,t,n){Ne(n)||(n=[n]),z(n,function(i){Xr(e[i])||(t[i]=e[i])})}var Vf=750;function mb(e,t,n){function i(c,l){var u=e.create(c.$type);return n.copyElement(c,u,null,l)}t.on("copyPaste.copyElement",Vf,function(c){var l=c.descriptor,u=c.element,p=le(u);if(Je(u))return l;var f=l.businessObject=i(p,!0),d=l.di=i(dt(u),!0);d.bpmnElement=f,Gf(f,l,"name"),Gf(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=le(c);return c.default&&(u[c.default]={element:p,property:"default"}),c.host&&(le(c).attachedToRef=le(l[c.host])),Ti(u,zn(u,function(f,d,h){var m=d.element,b=d.property;return h===c.id&&(m.set(b,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=le(l[u.labelTarget]),u.di=dt(l[u.labelTarget]);return}p=u.businessObject=i(p),f=u.di=i(f),f.bpmnElement=p,Gf(u,p,["isExpanded","name"]),u.type=p.$type}),t.on("copyPaste.copyElement",Vf,function(c){var l=c.descriptor,u=c.element;if(M(u,"bpmn:Participant")){var p=le(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;M(l,"bpmn:SubProcess")&&z(za(u),p=>{u.push(p.annotation)})}),t.on("copyPaste.pasteElement",Vf,function(c){var l=c.cache,u=c.descriptor;a(l,s(u,l,o(l)))})}mb.$inject=["bpmnFactory","eventBus","moddleCopy"];const n2=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],i2=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function ns(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 Pi(r,o=>o==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:r,property:o,propertyName:a}=i,s=pn(r)&&r.$descriptor;if(a&&i2.includes(a))return o;if(a&&n2.includes(a)||a&&s&&!kt(s.properties,Po({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",i=>{const{property:r}=i;if(M(r,"bpmn:ExtensionElements")&&(!r.values||!r.values.length))return!1})}ns.$inject=["eventBus","bpmnFactory","moddle"],ns.prototype.copyElement=function(e,t,n,i=!1){n&&!Ne(n)&&(n=[n]),n=n||Wf(e.$descriptor);const r=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return r===!1||(Ne(r)&&(n=r),z(n,o=>{let a;Hn(e,o)&&(a=e.get(o));const s=this.copyProperty(a,t,o,i);!rn(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:o})===!1||t.set(o,s)})),t},ns.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 pn(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):Ne(e)?zn(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):pn(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},ns.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 Wf(e,t){return zn(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const gb={__depends__:[t2],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",mb],moddleCopy:["type",ns]};var yb=Math.round;function Uf(e,t){this._modeling=e,this._eventBus=t}Uf.$inject=["modeling","eventBus"],Uf.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=yb(s+o/2),u=yb(c+a/2),p=i.replaceShape(e,U({},t,{x:l,y:u,width:o,height:a}),n);return r.fire("replace.end",{element:e,newElement:p,hints:n}),p};function vb(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:r={}}=n;r.select!==!1&&e.select(i)})}vb.$inject=["selection","eventBus"];const r2={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",vb],replace:["type",Uf]};function o2(e,t,n){Ne(n)||(n=[n]),z(n,function(i){Xr(e[i])||(t[i]=e[i])})}var a2=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function s2(e,t){var n=e&&Hn(e,"collapsed")?e.collapsed:!st(e),i;return t&&(Hn(t,"collapsed")||Hn(t,"isExpanded"))?i=Hn(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(pl(p)&&(u==="bpmn:SubProcess"||u==="bpmn:AdHocSubProcess")&&s2(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),o2(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var h=Wf(p.$descriptor),m=Wf(f.$descriptor,!0),b=c2(h,m);U(f,Si(c,a2));var E=nt(b,function(y){return y==="eventDefinitions"?xb(s,c.eventDefinitionType):y==="loopCharacteristics"?!kn(f):Hn(f,y)||y==="processRef"&&c.isExpanded===!1||y==="triggeredByEvent"?!1:y==="isForCompensation"?!kn(f):!0});if(f=n.copyElement(p,f,E),c.eventDefinitionType&&(xb(f,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),M(p,"bpmn:Activity")){if(pl(p))d.isExpanded=st(s);else if(c&&Hn(c,"isExpanded")){d.isExpanded=c.isExpanded;var _=t.getDefaultSize(f,{isExpanded:d.isExpanded});d.width=_.width,d.height=_.height,d.x=s.x-(d.width-s.width)/2,d.y=s.y-(d.height-s.height)/2}st(s)&&!M(p,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(pl(p)&&!pl(f)&&(l.moveChildren=!1),M(p,"bpmn:Participant")){c.isExpanded===!0?f.processRef=e.create("bpmn:Process"):l.moveChildren=!1;var g=hn(s);dt(s).isHorizontal||(dt(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,tt(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&tt(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(f.default=p.default),c.host&&!M(p,"bpmn:BoundaryEvent")&&M(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 pl(e){return M(e,"bpmn:SubProcess")}function xb(e,t){var n=le(e);return t&&n.get("eventDefinitions").some(function(i){return M(i,t)})}function c2(e,t){return e.filter(function(n){return t.includes(n)})}const _b={__depends__:[gb,r2,di],bpmnReplace:["type",bb]};var l2=250;function po(e){this._eventBus=e,this._tools=[],this._active=null}po.$inject=["eventBus"],po.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)},po.prototype.isActive=function(e){return e&&this._active===e},po.prototype.length=function(e){return this._tools.length},po.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},po.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),z(t,function(r){i.push(r+".ended"),i.push(r+".canceled")}),n.on(i,l2,function(r){this._active&&(u2(r)||this.setActive(null))},this)};function u2(e){var t=e.originalEvent&&e.originalEvent.target;return t&&no(t,'.group[data-group="tools"]')}const fl={__depends__:[ir],__init__:["toolManager"],toolManager:["type",po]};function p2(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 f2(e,t){var n=[],i=new Set(e);z(t,function(o){i.add(o)});var r=new Set;return i.forEach(function(o){var a=o.incoming,s=o.outgoing;z(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 d2(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 Yf=Math.abs,h2=Math.round,rr={x:"width",y:"height"},wb="crosshair",kr={n:"top",w:"left",s:"bottom",e:"right"},m2=1500,dl={n:"s",w:"e",s:"n",e:"w"},hl=20;function hi(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",m2,function(c){var l=c.context,u=l.initialized;u||(u=l.initialized=s.init(c,l)),u&&Sb(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){Sb(c);var m={x:0,y:0};m[u]=h2(c["d"+u]),s.makeSpace(f,d,m,p,h),n.once("spaceTool.ended",function(b){s.activateSelection(b.originalEvent,!0,!0)})}})}hi.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],hi.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:wb,data:{context:{reactivate:n}},trapClick:!1})},hi.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:wb,data:{context:{}}})},hi.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},hi.prototype.init=function(e,t){var n=Yf(e.dx)>Yf(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(Yf(i)<5)return!1;i<0&&(i*=-1),Qa(e)&&(i*=-1);var o=p2(n,i),a=this._canvas.getRootElement();!tl(e)&&e.hover&&(a=e.hover);var s=[...Ba(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=g2(c,n,o,r,l);return U(t,c,{axis:n,direction:o,spaceToolConstraints:u,start:r}),ll("resize-"+(n==="x"?"ew":"ns")),!0},hi.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 z(e,function(d){if(!(!d.parent||Je(d))){if(Mt(d)){u.push(d);return}var h=d[t],m=h+d[rr[t]];if(y2(d)&&(n>0&&$e(d)[t]>i||n<0&&$e(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}}}),z(o,function(d){var h=d.attachers;h&&z(h,function(m){p(m)})}),z(l,function(d){var h=d.host;(s.has(h)||c.has(h))&&p(d)}),z(u,function(d){var h=d.source,m=d.target,b=d.label;(s.has(h)||c.has(h))&&(s.has(m)||c.has(m))&&b&&p(b)}),{movingShapes:o,resizingShapes:a}},hi.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},hi.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function Eb(e){return{top:e.top-hl,right:e.right+hl,bottom:e.bottom+hl,left:e.left-hl}}function Sb(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 g2(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 z(a,function(f){var d=f.attachers,h=f.children,m=Le(f),b=nt(h,function(H){return!Mt(H)&&!Je(H)&&!u.has(H)&&!p.has(H)}),E=nt(h,function(H){return!Mt(H)&&!Je(H)&&u.has(H)}),_,g,y,S=[],w=[],P,T,$,k;b.length&&(g=Eb(Le(Zt(b))),_=i-m[kr[n]]+g[kr[n]],n==="n"?s.bottom=l=ze(l)?Math.min(l,_):_:n==="w"?s.right=l=ze(l)?Math.min(l,_):_:n==="s"?s.top=c=ze(c)?Math.max(c,_):_:n==="e"&&(s.left=c=ze(c)?Math.max(c,_):_)),E.length&&(y=Eb(Le(Zt(E))),_=i-y[kr[dl[n]]]+m[kr[dl[n]]],n==="n"?s.bottom=l=ze(l)?Math.min(l,_):_:n==="w"?s.right=l=ze(l)?Math.min(l,_):_:n==="s"?s.top=c=ze(c)?Math.max(c,_):_:n==="e"&&(s.left=c=ze(c)?Math.max(c,_):_)),d&&d.length&&(d.forEach(function(H){u.has(H)?S.push(H):w.push(H)}),S.length&&(P=Le(Zt(S.map($e))),T=m[kr[dl[n]]]-(P[kr[dl[n]]]-i)),w.length&&($=Le(Zt(w.map($e))),k=$[kr[n]]-(m[kr[n]]-i)),n==="n"?(_=Math.min(T||1/0,k||1/0),s.bottom=l=ze(l)?Math.min(l,_):_):n==="w"?(_=Math.min(T||1/0,k||1/0),s.right=l=ze(l)?Math.min(l,_):_):n==="s"?(_=Math.max(T||-1/0,k||-1/0),s.top=c=ze(c)?Math.max(c,_):_):n==="e"&&(_=Math.max(T||-1/0,k||-1/0),s.left=c=ze(c)?Math.max(c,_):_));var D=r&&r[f.id];D&&(n==="n"?(_=i+f[rr[t]]-D[rr[t]],s.bottom=l=ze(l)?Math.min(l,_):_):n==="w"?(_=i+f[rr[t]]-D[rr[t]],s.right=l=ze(l)?Math.min(l,_):_):n==="s"?(_=i-f[rr[t]]+D[rr[t]],s.top=c=ze(c)?Math.max(c,_):_):n==="e"&&(_=i-f[rr[t]]+D[rr[t]],s.left=c=ze(c)?Math.max(c,_):_))}),s}}function y2(e){return!!e.host}var qf="djs-dragging",Rb="djs-resizing",v2=250,ml=Math.max;function Cb(e,t,n,i,r){function o(a,s){z(a,function(c){r.addDragger(c,s),n.addMarker(c,qf)})}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"])),Ue(s,u);var p=De("path");Se(p,"d",l.x),ut(p).add("djs-crosshair"),Ue(u,p);var f=De("path");Se(f,"d",l.y),ut(f).add("djs-crosshair"),Ue(u,f),c.crosshairGroup=u}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;En(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&an(c)}),e.on("spaceTool.move",v2,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"),ut(c).add("djs-crosshair"),Ue(f,c),s.line=c;var d=De("g");Se(d,i.cls("djs-drag-group",["no-events"])),Ue(n.getActiveLayer(),d),o(u,d);var h=new Set(u);z(p,function(w){h.add(w)});var m=new Set,b=s.movingConnections=[];h.forEach(function(w){z(w.outgoing,function(P){m.has(P)||!Mt(P)||!h.has(P.target)||(m.add(P),b.push(P))})}),o(b,d),s.dragGroup=d}if(!s.frameGroup){var E=De("g");Se(E,i.cls("djs-frame-group",["no-events"])),Ue(n.getActiveLayer(),E);var _=[];z(p,function(w){var P=r.addFrame(w,E),T=P.getBBox();_.push({element:P,initialBounds:T}),n.addMarker(w,Rb)}),s.frameGroup=E,s.frames=_}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,En(s.dragGroup,S.x,S.y),z(s.frames,function(w){var P=w.element,T=w.initialBounds,$,k;s.direction==="e"?Se(P,{width:ml(T.width+S.x,5)}):($=ml(T.width-S.x,5),Se(P,{width:$,x:T.x+T.width-$})),s.direction==="s"?Se(P,{height:ml(T.height+S.y,5)}):(k=ml(T.height-S.y,5),Se(P,{height:k,y:T.y+T.height-k}))})}}),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;z(c,function(h){n.removeMarker(h,qf)}),z(l,function(h){n.removeMarker(h,qf)}),f&&(an(p),an(f)),z(u,function(h){n.removeMarker(h,Rb)}),d&&an(d)})}Cb.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const b2={__init__:["spaceToolPreview"],__depends__:[ir,Hi,fl,aa,ts],spaceTool:["type",hi],spaceToolPreview:["type",Cb]};function gl(e,t){e.invoke(hi,this),this._canvas=t}gl.$inject=["injector","canvas"],Ee(gl,hi),gl.prototype.calculateAdjustments=function(e,t,n,i){var r=this._canvas.getRootElement(),o=e[0]===r?null:e[0],a=[];o&&(a=Mo(zo(r.children.filter(l=>M(l,"bpmn:Artifact")),Zt(o))));const s=[...e,...a];var c=hi.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(l){return!(M(l,"bpmn:TextAnnotation")||x2(l)&&(t==="y"&&hn(l)||t==="x"&&!hn(l)))}),c};function x2(e){return M(e,"bpmn:Participant")&&!le(e).processRef}const Mb={__depends__:[b2],spaceTool:["type",gl]};function Ht(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)}Ht.$inject=["eventBus","injector"],Ht.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()},Ht.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},Ht.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},Ht.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()}},Ht.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()}},Ht.prototype.register=function(e,t){this._setHandler(e,t)},Ht.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)},Ht.prototype.canUndo=function(){return!!this._getUndoAction()},Ht.prototype.canRedo=function(){return!!this._getRedoAction()},Ht.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},Ht.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},Ht.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)})},Ht.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},Ht.prototype._createId=function(){return this._uid++},Ht.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},Ht.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()},Ht.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)},Ht.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:Ah("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},Ht.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=Ne(e)?e:[e],t.dirty=t.dirty.concat(e))},Ht.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},Ht.prototype._revertedAction=function(e){this._stackIdx--},Ht.prototype._getHandler=function(e){return this._handlerMap[e]},Ht.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 _2={commandStack:["type",Ht]};function Or(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 w2=250,Ab=1400;function Kf(e,t,n){se.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",Ab,function(r){var o=r.context,a=o.shapes,s=o.validatedShapes;o.shapes=Pb(a),o.validatedShapes=Pb(s)}),i&&t.on("shape.move.start",w2,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",Ab,function(r){var o=r.context,a=o.closure,s=a.enclosedElements,c=[];z(s,function(l){z(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;Or(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=Mp(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(Kf,se),Kf.$inject=["injector","eventBus","modeling"];function Pb(e){var t=new Set(e);return nt(e,function(n){return!t.has(n.labelTarget)})}const E2={__init__:["labelSupport"],labelSupport:["type",Kf]};var S2=251,Tb=1401,kb="attach-ok";function Xf(e,t,n,i,r){se.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",Tb,function(a){var s=a.context,c=s.shapes,l=s.validatedShapes;s.shapes=R2(c),s.validatedShapes=C2(l)}),o&&t.on("shape.move.start",S2,function(a){var s=a.context,c=s.shapes,l=Zf(c);z(l,function(u){o.makeDraggable(s,u,!0),z(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,kb),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(u,kb)}))}}),this.preExecuted("elements.move",Tb,function(a){var s=a.context,c=s.closure,l=s.shapes,u=Zf(l);z(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=nt(c,function(p){var f=p.host;return M2(p)&&!A2(c,f)}),z(u,function(p){r.updateAttachment(p,l)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;z(s,function(c){z(c.attachers,function(l){z(l.outgoing.slice(),function(u){var p=i.allowed("connection.reconnect",{connection:u,source:u.source,target:u.target});p||r.removeConnection(u)}),z(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;Or(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&&z(l.attachers,function(u){var p=Ky(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&&z(p,function(d){var h=Ky(d,l,u);r.moveShape(d,h,d.parent),z(d.labels,function(m){r.moveShape(m,h,m.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;Or(s.attachers,function(c){r.removeShape(c)}),s.host&&r.updateAttachment(s,null)})}Ee(Xf,se),Xf.$inject=["injector","eventBus","canvas","rules","modeling"];function Zf(e){return Du(Mn(e,function(t){return t.attachers||[]}))}function R2(e){var t=Zf(e);return LE("id",e,t)}function C2(e){var t=Ao(e,"id");return nt(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function M2(e){return!!e.host}function A2(e,t){return e.indexOf(t)!==-1}const P2={__depends__:[Hi],__init__:["attachSupport"],attachSupport:["type",Xf]};function Ob(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(Sg(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)})}Ob.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const Qf={__init__:["changeSupport"],changeSupport:["type",Ob]};function mi(e){this._model=e}mi.$inject=["moddle"],mi.prototype._needsId=function(e){return tt(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"])},mi.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;M(e,"bpmn:Activity")?t="Activity":M(e,"bpmn:Event")?t="Event":M(e,"bpmn:Gateway")?t="Gateway":tt(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))},mi.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},mi.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},mi.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",U({bpmnElement:e,bounds:this.createDiBounds()},t))},mi.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},mi.prototype.createDiWaypoints=function(e){var t=this;return Mn(e,function(n){return t.createDiWaypoint(n)})},mi.prototype.createDiWaypoint=function(e){return this.create("dc:Point",Si(e,["x","y"]))},mi.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",U({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},mi.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",U({bpmnElement:e},t))};function qn(e,t,n){se.call(this,e),this._bpmnFactory=t;var i=this;function r(d){var h=d.context,m=h.hints||{},b;!h.cropped&&m.createElementsBehavior!==!1&&(b=h.connection,b.waypoints=n.getCroppedWaypoints(b),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,b=h.parent||h.newParent;i.updateParent(m,b)}this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],Kn(o)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],Kn(a));function s(d){var h=d.context,m=h.oldRoot,b=m.children;z(b,function(E){M(E,"bpmn:BaseElement")&&i.updateParent(E)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(d){var h=d.context.shape;M(h,"bpmn:BaseElement")&&i.updateBounds(h)}this.executed(["shape.move","shape.create","shape.resize"],Kn(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],Kn(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"],Kn(l)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],Kn(l));function u(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],Kn(u)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],Kn(u)),this.executed("connection.reconnect",Kn(function(d){var h=d.context,m=h.connection,b=h.oldSource,E=h.newSource,_=le(m),g=le(b),y=le(E);_.conditionExpression&&!tt(y,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(h.oldConditionExpression=_.conditionExpression,delete _.conditionExpression),b!==E&&g.default===_&&(h.oldDefault=g.default,delete g.default)})),this.reverted("connection.reconnect",Kn(function(d){var h=d.context,m=h.connection,b=h.oldSource,E=h.newSource,_=le(m),g=le(b),y=le(E);h.oldConditionExpression&&(_.conditionExpression=h.oldConditionExpression),h.oldDefault&&(g.default=h.oldDefault,delete y.default)}));function p(d){i.updateAttachment(d.context)}this.executed(["element.updateAttachment"],Kn(p)),this.reverted(["element.updateAttachment"],Kn(p)),this.executed("element.updateLabel",Kn(f)),this.reverted("element.updateLabel",Kn(f));function f(d){const{element:h}=d.context,m=oi(h),b=dt(h),E=b&&b.get("label");Rr(h)||nl(h)||(m&&!E?b.set("label",t.create("bpmndi:BPMNLabel")):!m&&E&&b.set("label",void 0))}}Ee(qn,se),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)&&!(M(e,"bpmn:DataStoreReference")&&e.parent&&M(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=dt(e),o=n&&n.businessObject,a=dt(n);M(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,o,t&&t.businessObject),M(e,"bpmn:DataOutputAssociation")&&(e.source?o=e.source.businessObject:o=null),M(e,"bpmn:DataInputAssociation")&&(e.target?o=e.target.businessObject:o=null),this.updateSemanticParent(i,o),M(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,o),this.updateDiParent(r,a)}},qn.prototype.updateBounds=function(e){var t=dt(e),n=k2(e);if(n){var i=Ci(n,t.get("bounds"));U(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)),U(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;M(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),Ut(i,e)),M(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),qt(r,e))}},qn.prototype.updateDiConnection=function(e,t,n){var i=dt(e),r=dt(t),o=dt(n);i.sourceElement&&i.sourceElement.bpmnElement!==le(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==le(n)&&(i.targetElement=n&&o)},qn.prototype.updateDiParent=function(e,t){if(t&&!M(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(Ut(n,e),e.$parent=null)}};function T2(e){for(;e&&!M(e,"bpmn:Definitions");)e=e.$parent;return e}qn.prototype.getLaneSet=function(e){var t,n;return M(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(M(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&&!((M(e,"bpmn:DataInput")||M(e,"bpmn:DataOutput"))&&(M(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(M(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(M(e,"bpmn:FlowElement")){if(t){if(M(t,"bpmn:Participant"))t=t.processRef;else if(M(t,"bpmn:Lane"))do t=t.$parent.$parent;while(M(t,"bpmn:Lane"))}i="flowElements"}else if(M(e,"bpmn:Artifact")){for(;t&&!M(t,"bpmn:Process")&&!M(t,"bpmn:SubProcess")&&!M(t,"bpmn:Collaboration");)if(M(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;i="artifacts"}else if(M(e,"bpmn:MessageFlow"))i="messageFlows";else if(M(e,"bpmn:Participant")){i="participants";var r=e.processRef,o;r&&(o=T2(e.$parent||t),e.$parent&&(Ut(o.get("rootElements"),r),r.$parent=null),t&&(qt(o.get("rootElements"),r),r.$parent=o))}else M(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":M(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),Ut(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);Ut(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},qn.prototype.updateConnectionWaypoints=function(e){var t=dt(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},qn.prototype.updateConnection=function(e){var t=e.connection,n=le(t),i=t.source,r=le(i),o=t.target,a=le(t.target),s;if(M(n,"bpmn:DataAssociation"))M(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=r,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):M(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||r,this.updateSemanticParent(n,r,s),n.targetRef=a);else{var c=M(n,"bpmn:SequenceFlow");n.sourceRef!==r&&(c&&(Ut(n.sourceRef&&n.sourceRef.get("outgoing"),n),r&&r.get("outgoing")&&r.get("outgoing").push(n)),n.sourceRef=r),n.targetRef!==a&&(c&&(Ut(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 Kn(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;M(i,"bpmn:BaseElement")&&e(t)}}function k2(e){if(M(e,"bpmn:Activity")){var t=dt(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function Dr(e,t){Ji.call(this),this._bpmnFactory=e,this._moddle=t}Ee(Dr,Ji),Dr.$inject=["bpmnFactory","moddle"],Dr.prototype._baseCreate=Ji.prototype.create,Dr.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,U({type:"label",di:n},ao,t))}return this.createElement(e,t)},Dr.prototype.createElement=function(e,t){t=U({},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(!D2(r)){var o=U({},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)}M(i,"bpmn:Group")&&(t=U({isFrame:!0},t)),t=O2(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=Jf(r,t,"isExpanded")),tt(i,["bpmn:Lane","bpmn:Participant"])&&(t=Jf(r,t,"isHorizontal")),M(i,"bpmn:SubProcess")&&(t.collapsed=!st(i,r)),M(i,"bpmn:ExclusiveGateway")&&(Hn(r,"isMarkerVisible")?r.isMarkerVisible===void 0&&(r.isMarkerVisible=!1):r.isMarkerVisible=!0),rn(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),rn(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=U({id:i.id},n,t,{businessObject:i,di:r}),this._baseCreate(e,t)},Dr.prototype.getDefaultSize=function(e,t){var n=le(e);if(t=t||dt(e),M(n,"bpmn:SubProcess"))return st(n,t)?{width:350,height:200}:{width:100,height:80};if(M(n,"bpmn:Task"))return{width:100,height:80};if(M(n,"bpmn:Gateway"))return{width:50,height:50};if(M(n,"bpmn:Event"))return{width:36,height:36};if(M(n,"bpmn:Participant")){var i=t.isHorizontal===void 0||t.isHorizontal===!0;return st(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return M(n,"bpmn:Lane")?{width:400,height:100}:M(n,"bpmn:DataObjectReference")?{width:36,height:50}:M(n,"bpmn:DataStoreReference")?{width:50,height:50}:M(n,"bpmn:TextAnnotation")?{width:100,height:40}:M(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},Dr.prototype.createParticipantShape=function(e){return pn(e)||(e={isExpanded:e}),e=U({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function O2(e,t,n){return z(n,function(i){t=Jf(e,t,i)}),t}function Jf(e,t,n){return t[n]===void 0?t:(e[n]=t[n],Ti(t,[n]))}function D2(e){return tt(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function yl(e,t){this._modeling=e,this._canvas=t}yl.$inject=["modeling","canvas"],yl.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;z(n,function(r){var o={x:0,y:0};rn(i.left)?o.x=i.left-r.x:rn(i.right)?o.x=i.right-r.width-r.x:rn(i.center)?o.x=i.center-Math.round(r.width/2)-r.x:rn(i.top)?o.y=i.top-r.y:rn(i.bottom)?o.y=i.bottom-r.height-r.y:rn(i.middle)&&(o.y=i.middle-Math.round(r.height/2)-r.y),t.moveElements([r],o,r.parent)})},yl.prototype.postExecute=function(e){};function vl(e){this._modeling=e}vl.$inject=["modeling"],vl.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},vl.prototype.postExecute=function(e){var t=e.hints||{};I2(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 I2(e,t){return hr(e.outgoing,function(n){return n.target===t})}function bl(e,t){this._canvas=e,this._layouter=t}bl.$inject=["canvas","layouter"],bl.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},bl.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var xl=Math.round;function ed(e){this._modeling=e}ed.$inject=["modeling"],ed.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,r=e.position,o=e.hints,a=this._modeling;z(t,function(p){ze(p.x)||(p.x=0),ze(p.y)||(p.y=0)});var s=nt(t,function(p){return!p.hidden}),c=Zt(s);z(t,function(p){Mt(p)&&(p.waypoints=Mn(p.waypoints,function(f){return{x:xl(f.x-c.x-c.width/2+r.x),y:xl(f.y-c.y-c.height/2+r.y)}})),U(p,{x:xl(p.x-c.x-c.width/2+r.x),y:xl(p.y-c.y-c.height/2+r.y)})});var l=new Set(wc(t)),u={};z(t,function(p){if(Mt(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=U({},o);l.has(p)||(f.autoResize=!1),Je(p)&&(f=Ti(f,["attach"])),u[p.id]=ze(i)?a.createShape(p,Si(p,["x","y","width","height"]),p.parent||n,i,f):a.createShape(p,Si(p,["x","y","width","height"]),p.parent||n,f)}),e.elements=Mo(u)};var Db=Math.round;function Ir(e){this._canvas=e}Ir.$inject=["canvas"],Ir.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?U(t,n):U(t,{x:n.x-Db(t.width/2),y:n.y-Db(t.height/2)}),this._canvas.addShape(t,i,r),t},Ir.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function is(e){Ir.call(this,e)}Ee(is,Ir),is.$inject=["canvas"];var L2=Ir.prototype.execute;is.prototype.execute=function(e){var t=e.shape;return N2(t),t.labelTarget=e.labelTarget,L2.call(this,e)};var B2=Ir.prototype.revert;is.prototype.revert=function(e){return e.shape.labelTarget=null,B2.call(this,e)};function N2(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function rs(e,t){this._canvas=e,this._modeling=t}rs.$inject=["canvas","modeling"],rs.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;Or(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),Or(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},rs.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=Mp(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},rs.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 td(e,t){this._modeling=e,this._elementRegistry=t}td.$inject=["modeling","elementRegistry"],td.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;z(i,function(r){n.get(r.id)&&(r.waypoints?t.removeConnection(r):t.removeShape(r))})};function os(e,t){this._canvas=e,this._modeling=t}os.$inject=["canvas","modeling"],os.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;Or(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),Or(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),Or(n.children,function(i){Mt(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},os.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=Mp(i.children,n),t.removeShape(n),n},os.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 _l(e){this._modeling=e}_l.$inject=["modeling"];var Ib={x:"y",y:"x"};_l.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(b,E){b.range.min=Math.min(E[i],b.range.min),b.range.max=Math.max(E[i]+E[r],b.range.max)}function a(b){return b[i]+b[r]/2}function s(b){return b.length-1}function c(b){return b.max-b.min}function l(b,E){var _={y:0};_[i]=b-a(E),_[i]&&(_[Ib[i]]=0,t.moveElements([E],_,E.parent))}var u=n[0],p=s(n),f=n[p],d,h,m=0;z(n,function(b,E){var _,g,y;if(b.elements.length<2){E&&E!==n.length-1&&(o(b,b.elements[0]),m+=c(b.range));return}_=Pi(b.elements,i),g=_[0],E===p&&(g=_[s(_)]),y=a(g),b.range=null,z(_,function(S){if(l(y,S),b.range===null){b.range={min:S[i],max:S[i]+S[r]};return}o(b,S)}),E&&E!==n.length-1&&(m+=c(b.range))}),h=Math.abs(f.range.min-u.range.max),d=Math.round((h-m)/(n.length-1)),!(d<n.length-1)&&z(n,function(b,E){var _={},g;b===u||b===f||(g=n[E-1],b.range.max=0,z(b.elements,function(y,S){_[Ib[i]]=0,_[i]=g.range.max-y[i]+d,b.range.min!==y[i]&&(_[i]+=y[i]-b.range.min),_[i]&&t.moveElements([y],_,y.parent),b.range.max=Math.max(y[i]+y[r],S?b.range.max:0)}))})},_l.prototype.postExecute=function(e){};function wl(e,t){this._layouter=e,this._canvas=t}wl.$inject=["layouter","canvas"],wl.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return U(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},wl.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function nd(){}nd.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=Ut(o.children,t),qt(i.children,t,r),t.parent=i,z(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},nd.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return Ut(n.children,t),qt(i.children,t,r),t.parent=i,z(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 id(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}id.prototype.add=function(e,t){return this.addAll([e],t)},id.prototype.addAll=function(e,t){var n=dC(e,!!t,this);return U(this,n),this};function as(e){this._modeling=e}as.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},as.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),z(a,function(p){o.moveShape(p,t,l[p.id]&&!u&&n,{recurse:!1,layout:!1})}),z(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&&uf(p,p.source,t),connectionEnd:d&&pf(p,p.target,t)})})},as.prototype.getClosure=function(e){return new id().addAll(e,!0)};function El(e){this._helper=new as(e)}El.$inject=["modeling"],El.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},El.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 fo(e){this._modeling=e,this._helper=new as(e)}fo.$inject=["modeling"],fo.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=Si(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=Ut(o.children,t),qt(i.children,t,r),U(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},fo.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,r=this._modeling;i.layout!==!1&&(z(t.incoming,function(o){r.layoutConnection(o,{connectionEnd:pf(o,t,n)})}),z(t.outgoing,function(o){r.layoutConnection(o,{connectionStart:uf(o,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},fo.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return qt(n.children,t,i),U(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},fo.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},fo.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function ss(e){this._modeling=e}ss.$inject=["modeling"],ss.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 Ne(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},ss.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||Lb(Ne(r)?r[0]:r)),i&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||Lb(Ne(r)?r[r.length-1]:r)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},ss.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 Lb(e){return e.original||e}function or(e,t){this._modeling=e,this._rules=t}or.$inject=["modeling","rules"],or.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,b){return i.allowed("connection.reconnect",{connection:b,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();z(f,function(h){var m=h.source,b=c(m,s,h);b&&t.reconnectEnd(h,s,Xc(h,s,u),a)}),z(d,function(h){var m=h.target,b=c(s,m,h);b&&t.reconnectStart(h,s,Kc(h,s,u),a)})},or.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},or.prototype.execute=function(e){},or.prototype.revert=function(e){},or.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},or.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},or.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function cs(e){this._modeling=e}cs.$inject=["modeling"],cs.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},U(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},cs.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,r=e.hints||{};r.layout!==!1&&(z(n.incoming,function(o){t.layoutConnection(o,{connectionEnd:Xc(o,n,i)})}),z(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:Kc(o,n,i)})}))},cs.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return U(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function Lr(e){this._modeling=e}Lr.$inject=["modeling"],Lr.prototype.preExecute=function(e){var t=e.delta,n=e.direction,i=e.movingShapes,r=e.resizingShapes,o=e.start,a={};this.moveShapes(i,t),z(r,function(s){a[s.id]=F2(s)}),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(f2(i,r),t,n,o,i,r,a)},Lr.prototype.execute=function(){},Lr.prototype.revert=function(){},Lr.prototype.moveShapes=function(e,t){var n=this;z(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},Lr.prototype.resizeShapes=function(e,t,n){var i=this;z(e,function(r){var o=d2(r,n,t);i._modeling.resizeShape(r,o,null,{attachSupport:!1,autoResize:!1,layout:!1})})},Lr.prototype.updateConnectionWaypoints=function(e,t,n,i,r,o,a){var s=this,c=new Set(r),l=new Set(o);z(e,function(u){var p=u.source,f=u.target,d=$2(u),h=Nb(n),m={},b=c.has(p)||l.has(p),E=c.has(f)||l.has(f);b&&E?(d=Mn(d,function(_){return $b(_,i,n)&&(_[h]=_[h]+t[h]),_.original&&$b(_.original,i,n)&&(_.original[h]=_.original[h]+t[h]),_}),s._modeling.updateWaypoints(u,d,{labelBehavior:!1})):(b||E)&&(c.has(p)?m.connectionStart=uf(u,p,t):c.has(f)?m.connectionEnd=pf(u,f,t):l.has(p)?m.connectionStart=Kc(u,p,a[p.id]):l.has(f)&&(m.connectionEnd=Xc(u,f,a[f.id])),s._modeling.layoutConnection(u,m))})};function Bb(e){return U({},e)}function $2(e){return Mn(e.waypoints,function(t){return t=Bb(t),t.original&&(t.original=Bb(t.original)),t})}function Nb(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function $b(e,t,n){var i=Nb(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function F2(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function Sl(e){this._modeling=e}Sl.$inject=["modeling"],Sl.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=Fb(n),t.collapsed=!t.collapsed;var i=jb(n,t.collapsed);return[t].concat(i)},Sl.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,r=Hb(i,n);return t.collapsed=!t.collapsed,[t].concat(r)};function Fb(e){var t={};return z(e,function(n){t[n.id]=n.hidden,n.children&&(t=U({},t,Fb(n.children)))}),t}function jb(e,t){var n=[];return z(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(jb(i.children,i.collapsed||t)))}),n}function Hb(e,t){var n=[];return z(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(Hb(i.children,t)))}),n}function Rl(e){this._modeling=e}Rl.$inject=["modeling"],Rl.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=zb(i,t),Gb(n,t),t.host=n,t},Rl.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,zb(n,t),Gb(i,t,r),t};function zb(e,t){return Ut(e&&e.attachers,t)}function Gb(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),qt(i,t,n)}}function rd(){}rd.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},rd.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":vl,"shape.create":Ir,"shape.delete":os,"shape.move":fo,"shape.resize":cs,"shape.replace":or,"shape.toggleCollapse":Sl,spaceTool:Lr,"label.create":is,"connection.create":bl,"connection.delete":rs,"connection.move":nd,"connection.layout":wl,"connection.updateWaypoints":rd,"connection.reconnect":ss,"elements.create":ed,"elements.move":El,"elements.delete":td,"elements.distribute":_l,"elements.align":yl,"element.updateAttachment":Rl}},At.prototype.registerHandlers=function(e){z(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){Ne(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,U(i,{docking:"source"}))},At.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,U(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 QC(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 ls(e){this._elementRegistry=e}ls.$inject=["elementRegistry"],ls.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||j2(n,Gs(i));return Vb(n,i),e.oldProperties=o,e.changed=r,r},ls.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return Vb(n,t),i},ls.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return M(e,"bpmn:DataObject")?H2(e,t):[]};function j2(e,t){return zn(t,function(n,i){return n[i]=e.get(i),n},{})}function Vb(e,t){z(t,function(n,i){e.set(i,n)})}function H2(e,t){return t.filter(function(n){return M(n,"bpmn:DataObjectReference")&&le(n).dataObjectRef===e})}var us="default",ar="id",Wb="di",z2={width:0,height:0};function ps(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}ps.$inject=["elementRegistry","moddle","modeling","textRenderer"],ps.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=Y2(e.properties),s=e.oldProperties||G2(t,a);return Ub(a,o)&&(r.unclaim(o[ar]),i.updateId(t,a[ar]),r.claim(a[ar],o)),us in a&&(a[us]&&n.push(i.get(a[us].id)),o[us]&&n.push(i.get(o[us].id))),Yb(t,a),e.oldProperties=s,e.changed=n,n},ps.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&le(n).name;if(i){var r=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,r,z2)}},ps.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 Yb(t,i),Ub(n,r)&&(a.unclaim(n[ar]),o.updateId(t,i[ar]),a.claim(i[ar],r)),e.changed};function Ub(e,t){return ar in e&&e[ar]!==t[ar]}function G2(e,t){var n=Gs(t),i=e.businessObject,r=dt(e);return zn(n,function(o,a){return a!==Wb?o[a]=i.get(a):o[a]=V2(r,Gs(t.di)),o},{})}function V2(e,t){return zn(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function Yb(e,t){var n=e.businessObject,i=dt(e);z(t,function(r,o){o!==Wb?n.set(o,r):i&&W2(i,r)})}function W2(e,t){z(t,function(n,i){e.set(i,n)})}var U2=["default"];function Y2(e){var t=U({},e);return U2.forEach(function(n){n in e&&(t[n]=le(t[n]))}),t}function Cl(e,t){this._canvas=e,this._modeling=t}Cl.$inject=["canvas","modeling"],Cl.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=dt(r);return t.setRootElement(n),t.removeRootElement(r),qt(a.rootElements,i),i.$parent=a,Ut(a.rootElements,o),o.$parent=null,r.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=r,[]},Cl.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,a=i.$parent,s=dt(n);return t.setRootElement(r),t.removeRootElement(n),Ut(a.rootElements,i),i.$parent=null,qt(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,r.di=s,[]};function od(e,t){this._modeling=e,this._spaceTool=t}od.$inject=["modeling","spaceTool"],od.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=pi(i),a=o===i,s=a?i:i.parent,c=Mr(s),l=hn(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+ui,y:i.y,width:i.width-ui,height:i.height}:{x:i.x,y:i.y+ui,width:i.width,height:i.height-ui};n.createShape({type:"bpmn:Lane",isHorizontal:l},u,s)}var p=[];ro(o,function(y){return p.push(y),y.label&&p.push(y.label),y===i?[]:nt(y.children,function(S){return S!==i})});var f,d,h,m,b;r==="top"?(f=-120,d=i.y,h=d+10,m="n",b="y"):r==="left"?(f=-120,d=i.x,h=d+10,m="w",b="x"):r==="bottom"?(f=120,d=i.y+i.height,h=d-10,m="s",b="y"):r==="right"&&(f=120,d=i.x+i.width,h=d-10,m="e",b="x");var E=t.calculateAdjustments(p,b,f,h),_=l?{x:0,y:f}:{x:f,y:0};t.makeSpace(E.movingShapes,E.resizingShapes,_,m,h);var g=l?{x:i.x+(a?ui:0),y:d-(r==="top"?120:0),width:i.width-(a?ui:0),height:120}:{x:d-(r==="left"?120:0),y:i.y+(a?ui:0),width:120,height:i.height-(a?ui:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:l},g,s)};function ad(e){this._modeling=e}ad.$inject=["modeling"],ad.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=Mr(n),o=r.length;if(o>i)throw new Error(`more than <${i}> child lanes`);var a=hn(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+ui,y:n.y+f*c,width:n.width-ui,height:l}:{x:n.x+f*c,y:n.y+ui,width:l,height:n.height-ui},f<o?t.resizeShape(r[f],u):(p={type:"bpmn:Lane",isHorizontal:a},t.createShape(p,u,n))};function fs(e,t){this._modeling=e,this._spaceTool=t}fs.$inject=["modeling","spaceTool"],fs.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},fs.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=HA(e,t);n.resizeShape(e,t),i.forEach(function(r){n.resizeShape(r.shape,r.newBounds)})},fs.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=Le(e),r=Le(t),o=Ry(r,i),a=pi(e),s=[],c=[];ro(a,function(h){return s.push(h),(M(h,"bpmn:Lane")||M(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 ds="flowNodeRef",sd="lanes";function Ml(){}Ml.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},o=[];function a(u,p){var f=Le(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=pi(u);return r[p.id]||(r[p.id]=Vc(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=pi(u);if(!(!p||n.indexOf(p)!==-1)){var f=p.children.filter(function(d){return M(d,"bpmn:FlowNode")});f.forEach(s),n.push(p)}}),e.forEach(s),o.forEach(function(u){var p=u.businessObject,f=p.get(sd),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(ds).forEach(function(f){i.push({flowNode:f,remove:[p],add:[]})})}),i},Ml.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(sd);n.remove.forEach(function(o){Ut(r,o),Ut(o.get(ds),i)}),n.add.forEach(function(o){qt(r,o),qt(o.get(ds),i)})}),[]},Ml.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,r=i.get(sd);n.add.forEach(function(o){Ut(r,o),Ut(o.get(ds),i)}),n.remove.forEach(function(o){qt(r,o),qt(o.get(ds),i)})}),[]};var cd="categoryValueRef";function hs(e,t){this._bpmnFactory=e,this._elementRegistry=t}hs.$inject=["bpmnFactory","elementRegistry"],hs.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,r=new Map,o=[],a=new Map;function s(_,g,y){if(g){var S=a.get(_);S||(S={},a.set(_,S)),!(y&&S.present)&&(!y&&S.past||(y?S.present={categoryValue:g,root:ld(_)}:S.past={categoryValue:g}))}}function c(_){r.set(_,le(_))}function l(){n.filter(function(_){return M(_,"bpmn:FlowElement")&&!Je(_)&&_.parent}).forEach(c)}function u(_){var g=le(_),y=g.get("categoryValueRef");return y||(y=xy(i,g),o.push(q2(_,y))),y}function p(_){return _.reduce(function(g,y){var S=ld(y),w=g.get(S);return w||(w=[],g.set(S,w)),w.push(y),g},new Map)}e=Array.from(e||[]);var f=p(e);t.length&&l(),e.forEach(c),n.filter(function(_){return M(_,"bpmn:Group")&&!Je(_)&&_.parent}).forEach(function(_){var g=le(_).get("categoryValueRef");if(!g){var y=ld(_),S=f.get(y)||[],w=zo(S,_),P=Object.keys(w).length>0;P&&(g=u(_))}s(_,g,!0)}),t.forEach(function(_){s(_.groupShape,_.categoryValue,!1)}),o.length&&l();var d=Array.from(r.keys()),h=Array.from(a.values()).reduce(function(_,g){return g.present&&_.add(g.present.categoryValue),g.past&&_.add(g.past.categoryValue),_},new Set),m=new Map,b=p(d);a.forEach(function(_,g){var y=_.present;if(y){var S=b.get(y.root)||[],w=zo(S,g);S.forEach(function(P){if(w[P.id]){var T=m.get(P);T||(T=new Set,m.set(P,T)),T.add(y.categoryValue)}})}});var E=d.reduce(function(_,g){var y=r.get(g),S=y.get(cd),w=new Set(S),P=m.get(g)||new Set,T=Array.from(P).filter(function(k){return!w.has(k)}),$=S.filter(function(k){return h.has(k)&&!P.has(k)});return(T.length||$.length)&&_.push({businessObject:y,categoryValuesToAdd:T,categoryValuesToRemove:$}),_},[]);return{flowElements:E,groups:o}},hs.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),K2(t.groups),Z2(t.flowElements),[]},hs.prototype.revert=function(e){var t=e.updates;return Q2(t.flowElements),X2(t.groups),[]};function q2(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function K2(e){e.forEach(function(t){le(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function X2(e){e.forEach(function(t){le(t.groupShape).categoryValueRef=null})}function Z2(e){e.forEach(function(t){var n=t.businessObject,i=n.get(cd);t.categoryValuesToRemove.forEach(function(r){Ut(i,r)}),t.categoryValuesToAdd.forEach(function(r){qt(i,r,!0)})})}function Q2(e){e.forEach(function(t){var n=t.businessObject,i=n.get(cd);t.categoryValuesToAdd.forEach(function(r){Ut(i,r)}),t.categoryValuesToRemove.forEach(function(r){qt(i,r,!0)})})}function ld(e){for(;e.parent;)e=e.parent;return e}function Al(e){this._moddle=e}Al.$inject=["moddle"],Al.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),[]},Al.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 J2={fill:void 0,stroke:void 0};function ud(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(jn(t)){var n=ek(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}ud.$inject=["commandStack"],ud.prototype.postExecute=function(e){var t=e.elements,n=e.colors||J2,i=this,r={};"fill"in n&&U(r,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&U(r,{"border-color":this._normalizeColor(n.stroke)}),z(t,function(o){var a=Mt(o)?Si(r,["border-color"]):r,s=dt(o);if(tk(a),Je(o)){if(!s||!M(s.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:o,moddleElement:s.label,properties:{color:r["border-color"]}})}else{if(!tt(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:o,properties:{di:a}})}})};function ek(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 tk(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var nk={width:0,height:0};function qb(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)&&Rr(l)&&!kc(l)&&!Kb(p)){var f=7,d=Dp(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=oi(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)&&!M(u,"bpmn:TextAnnotation"))){if(Je(u)&&Kb(p)){d.removeShape!==!1&&e.removeShape(u,{unsetLabel:!1});return}var h=oi(l);typeof f>"u"&&(f=t.getExternalLabelBounds(u,h)),f&&e.resizeShape(u,f,nk)}}this.preExecute=r,this.execute=o,this.revert=a,this.postExecute=s}qb.$inject=["modeling","textRenderer","bpmnFactory"];function Kb(e){return!e||!e.trim()}function Rn(e,t,n,i){At.call(this,e,t,n),this._bpmnRules=i}Ee(Rn,At),Rn.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],Rn.prototype.getHandlers=function(){var e=At.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=ls,e["element.updateProperties"]=ps,e["canvas.updateRoot"]=Cl,e["lane.add"]=od,e["lane.resize"]=fs,e["lane.split"]=ad,e["lane.updateRefs"]=Ml,e["group.updateRefs"]=hs,e["id.updateClaim"]=Al,e["element.setColor"]=ud,e["element.updateLabel"]=qb,e},Rn.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},Rn.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)},Rn.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},Rn.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},Rn.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},Rn.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},Rn.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},Rn.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Rn.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Rn.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},Rn.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},Rn.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},Rn.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},Rn.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function Xb(){}Xb.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||$e(t.source||e.source),t.connectionEnd||$e(t.target||e.target)]};var Pl=20,ik=5,Tl=Math.round,Zb=20,rk={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function ok(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function ak(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function Qb(e,t,n){var i=wn(t,e,ik),r=n.split(":")[0],o=Tl((t.x-e.x)/2+e.x),a=Tl((t.y-e.y)/2+e.y),s,c,l=ak(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=ok(i,r),c=u?"h:v":"v:h",p?u?(f=a===e.y,s={x:e.x+Pl*(/l/.test(r)?-1:1),y:f?a+Pl:a}):(f=o===e.x,s={x:f?o+Pl:o,y:e.y+Pl*(/t/.test(r)?-1:1)}):s={x:o,y:a}),{waypoints:pd(e,s,c).concat(s),directions:c,turnNextDirections:f}}function sk(e,t,n){return Qb(e,t,n)}function ck(e,t,n){var i=Qb(t,e,Jb(n));return{waypoints:i.waypoints.slice().reverse(),directions:Jb(i.directions),turnNextDirections:i.turnNextDirections}}function lk(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=pd(e.waypoints[e.waypoints.length-1],t.waypoints[0],r);return{waypoints:o,directions:r}}function Jb(e){return e.split(":").reverse().join(":")}function uk(e,t,n){var i=Tl((t.x-e.x)/2+e.x),r=Tl((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 pd(e,t,n){if(n=n||"h:h",!bk(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=sk(e,t,n),r=ck(e,t,n),o=lk(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return uk(e,t,n)}function pk(e,t,n){var i=pd(e,t,n);return i.unshift(e),i.push(t),ix(i)}function fk(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=DE(o,"straight")[0]||"h:h",s=rk[a]||0,c=wn(e,t,s),l=vk(c,a);n=n||$e(e),i=i||$e(t);var u=l.split(":"),p=nx(n,e,u[0],xk(c)),f=nx(i,t,u[1],c);return pk(p,f,l)}function dk(e,t,n,i,r,o){Ne(n)&&(r=n,o=i,n=$e(e),i=$e(t)),o=U({preferredLayouts:[]},o),r=r||[];var a=o.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&mk(e,t,n,i,o),c||(c=o.connectionEnd&&yk(t,e,i,r),c)||(c=o.connectionStart&&gk(e,t,n,r),c)?c:!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:fk(e,t,n,i,o)}function hk(e,t,n){return e>=t&&e<=n}function ex(e,t,n){var i={x:"width",y:"height"};return hk(t[e],n[e],n[e]+n[i[e]])}function mk(e,t,n,i,r){var o={},a,s;return s=wn(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),r.preserveDocking==="target"?ex(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:ex(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 gk(e,t,n,i){return fd(e,t,n,i)}function yk(e,t,n,i){var r=i.slice().reverse();return r=fd(e,t,n,r),r?r.reverse():null}function fd(e,t,n,i){function r(u){return u.length<3?!0:u.length>4?!1:!!kt(u,function(p,f){var d=u[f-1];return d&&$a(p,d)<3})}function o(u,p,f){var d=Zi(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(Cg(u[d],p,Zb)||Cg(u[d],f,Zb))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=fd(e,t,n,l)),c&&Zi(c)?null:c}function vk(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 bk(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 xk(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 nx(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 ix(e){return e.reduce(function(t,n,i){var r=t[t.length-1],o=e[i+1];return Ap(r,o,n,0)||t.push(n),t},[])}var _k=-10,wk=40,Ek={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},Sk={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},dd={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},ms={top:"t",right:"r",bottom:"b",left:"l"};function kl(e){this._elementRegistry=e}Ee(kl,Xb),kl.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=rx(r&&r[0],n)),a||(a=rx(r&&r[r.length-1],i)),(M(e,"bpmn:Association")||M(e,"bpmn:DataAssociation"))&&r&&!ox(n,i))return[].concat([o],r.slice(1,-1),[a]);var u=gy(n,s)?Ek:Sk;return M(e,"bpmn:MessageFlow")?c=Ck(n,i,u):(M(e,"bpmn:SequenceFlow")||ox(n,i))&&(n===i?c={preferredLayouts:Ok(n,e,u)}:M(n,"bpmn:BoundaryEvent")?c={preferredLayouts:Dk(n,i,a,u)}:gs(n)||gs(i)?c={preferredLayouts:u.subProcess,preserveDocking:Ak(n)}:M(n,"bpmn:Gateway")?c={preferredLayouts:u.fromGateway}:M(i,"bpmn:Gateway")?c={preferredLayouts:u.toGateway}:c={preferredLayouts:u.default}),c&&(c=U(c,t),l=ix(dk(n,i,o,a,r,c))),l||[o,a]};function Rk(e){var t=e.host;return wn($e(e),t,_k)}function Ck(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:Mk(e,t)}}function Mk(e,t){return M(t,"bpmn:Participant")?"source":M(e,"bpmn:Participant")?"target":gs(t)?"source":gs(e)||M(t,"bpmn:Event")?"target":M(e,"bpmn:Event")?"source":null}function Ak(e){return gs(e)?"target":"source"}function rx(e,t){return e?e.original||e:$e(t)}function ox(e,t){return M(t,"bpmn:Activity")&&M(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function gs(e){return M(e,"bpmn:SubProcess")&&st(e)}function ho(e,t){return e===t}function Pk(e,t){return t.indexOf(e)!==-1}function sa(e){var t=/right|left/.exec(e);return t&&t[0]}function ca(e){var t=/top|bottom/.exec(e);return t&&t[0]}function ax(e,t){return dd[e]===t}function Tk(e,t){var n=sa(e),i=dd[n];return t.indexOf(i)!==-1}function kk(e,t){var n=ca(e),i=dd[n];return t.indexOf(i)!==-1}function sx(e){return e==="right"||e==="left"}function Ok(e,t,n){var i=t.waypoints,r=i&&i.length&&wn(i[0],e);return r==="top"?n.loop.fromTop:r==="right"?n.loop.fromRight:r==="left"?n.loop.fromLeft:n.loop.fromBottom}function Dk(e,t,n,i){var r=$e(e),o=$e(t),a=Rk(e),s,c,l=ho(e.host,t),u=Pk(a,["top","right","bottom","left"]),p=wn(o,r,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return l?Ik(a,u,e,t,n,i):(s=Lk(a,p,u,i.isHorizontal),c=Bk(a,p,u,i.isHorizontal),[s+":"+c])}function Ik(e,t,n,i,r,o){var a=t?e:o.isHorizontal?ca(e):sa(e),s=ms[a],c;return t?sx(e)?c=cx("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:c=cx("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function cx(e,t,n,i){var r=wk;return!(hd(e,i,n,r)||hd(e,i,{x:n.x+n.width,y:n.y+n.height},r)||hd(e,i,$e(t),r))}function hd(e,t,n,i){return Math.abs(t[e]-n[e])<i}function Lk(e,t,n,i){if(n)return ms[e];var r=ca(e),o=sa(e),a=ca(t),s=sa(t);if(i){if(ho(r,a)||ax(o,s))return ms[r]}else if(ho(o,s)||ax(r,a))return ms[o];return ms[i?o:r]}function Bk(e,t,n,i){if(n)return sx(e)?Tk(e,t)||ho(e,t)?"h":"v":kk(e,t)||ho(e,t)?"v":"h";var r=ca(e),o=sa(e),a=ca(t),s=sa(t);return a&&!s?"v":s&&!a?"h":i?ho(r,a)?"h":"v":ho(o,s)?"v":"h"}kl.$inject=["elementRegistry"];function lx(e){return U({original:e.point.original||e.point},e.actual)}function Br(e,t){this._elementRegistry=e,this._graphicsFactory=t}Br.$inject=["elementRegistry","graphicsFactory"],Br.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(lx(i)),o.push(lx(r)),o},Br.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}},Br.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return Fa(i,r,n)},Br.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},Br.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},Br.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const md={__init__:["modeling","bpmnUpdater"],__depends__:[tT,yT,bT,xT,_b,_2,E2,P2,di,Qf,Mb],bpmnFactory:["type",mi],bpmnUpdater:["type",qn],elementFactory:["type",Dr],modeling:["type",Rn],layouter:["type",kl],connectionDocking:["type",Br]};var Nk=10,ux=50,$k=250;function gd(e,t,n,i){for(var r;r=Fk(e,n,t);)n=i(t,n,r);return n}function yd(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 Fk(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=Hk(e);return kt(r,function(o){if(o===n)return!1;var a=wn(o,i,Nk);return a==="intersect"})}function jk(e,t){t||(t={});function n(h){return h.source===e?1:-1}var i=t.defaultDistance||ux,r=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||$k,c=t.reference||"start";o||(o=Vk);function l(h,m){return r==="n"?c==="start"?Le(h).top-Le(m).bottom:c==="center"?Le(h).top-$e(m).y:Le(h).top-Le(m).top:r==="w"?c==="start"?Le(h).left-Le(m).right:c==="center"?Le(h).left-$e(m).x:Le(h).left-Le(m).left:r==="s"?c==="start"?Le(m).top-Le(h).bottom:c==="center"?$e(m).y-Le(h).bottom:Le(m).bottom-Le(h).bottom:c==="start"?Le(m).left-Le(h).right:c==="center"?$e(m).x-Le(h).right:Le(m).right-Le(h).right}var u=e.incoming.filter(o).map(function(h){var m=a(h),b=m<0?l(h.source,e):l(e,h.source);return{id:h.source.id,distance:b,weight:m}}),p=e.outgoing.filter(o).map(function(h){var m=a(h),b=m>0?l(e,h.target):l(h.target,e);return{id:h.target.id,distance:b,weight:m}}),f=u.concat(p).reduce(function(h,m){return h[m.id+"__weight_"+m.weight]=m,h},{}),d=zn(f,function(h,m){var b=m.distance,E=m.weight;return b<0||b>s||(h[String(b)]||(h[String(b)]=0),h[String(b)]+=1*E,(!h.distance||h[h.distance]<h[String(b)])&&(h.distance=b)),h},{});return d.distance||i}function Hk(e){var t=vd(e);return e.host&&(t=t.concat(vd(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(vd(i))},[]))),t}function vd(e){return Gk(e).concat(zk(e))}function zk(e){return e.incoming.map(function(t){return t.source})}function Gk(e){return e.outgoing.map(function(t){return t.target})}function Vk(){return!0}var Wk=100;function px(e,t,n){e.on("autoPlace",Wk,function(i){var r=i.shape,o=i.source;return Uk(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}}px.$inject=["eventBus","modeling","canvas"];function Uk(e,t,n){n||(n={});var i=n.defaultDistance||ux,r=$e(e),o=Le(e);return{x:o.right+i+t.width/2,y:r.y}}function fx(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}fx.$inject=["eventBus","selection"];const Yk={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",px],autoPlaceSelectionBehavior:["type",fx]};function dx(e,t,n){var i=gy(e,n);if(M(t,"bpmn:TextAnnotation"))return Kk(e,t,i);if(tt(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return Xk(e,t,i);if(M(t,"bpmn:FlowNode"))return qk(e,t,i)}function qk(e,t,n){var i=Le(e),r=$e(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=jk(e,{filter:function(d){return M(d,"bpmn:SequenceFlow")},direction:o.directionHint}),s=30,c=o.minDistance,l=o.baseOrientation;M(e,"bpmn:BoundaryEvent")&&(l=wn(e,e.host,-25),l.indexOf(o.boundaryOrientation)!==-1&&(s*=-1));var u=n?{x:i.right+a+t.width/2,y:r.y+hx(l,c,o)}:{x:r.x+hx(l,c,o),y:i.bottom+a+t.height/2},p={margin:s,minDistance:c},f=n?{y:p}:{x:p};return gd(e,t,u,yd(f))}function hx(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function Kk(e,t,n){var i=Le(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};Mt(e)&&(r=$e(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 gd(e,t,r,yd(a))}function Xk(e,t,n){var i=Le(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 gd(e,t,r,yd(a))}function mx(e,t){e.on("autoPlace",function(n){var i=n.shape,r=n.source;return dx(r,i,t)})}mx.$inject=["eventBus","elementRegistry"];const Ol={__depends__:[Yk],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",mx]},gx=[hy,Wa,md,Ol];function Zk(e={}){Xh(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new Wo({container:t,moddleExtensions:e.moddleExtensions??Xs,additionalModules:[...gx,...e.additionalModules??[]]})}const yx={"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":"풀"},Qk={이:["이","가"],을:["을","를"],와:["과","와"]};function Jk(e,t){const[n,i]=Qk[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 eO={"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":"연관선"},tO="요소";function bd(e){return(e&&eO[e.type])??tO}const vx=20;function nO(e){const t=e.replace(/\s+/g," ").trim();return t.length>vx?`${t.slice(0,vx)}…`:t}function Dl(e,t,n,i=""){const r=e(t),o=(r==null?void 0:r.name)===void 0?void 0:nO(r.name),a=o===void 0?i+bd(r):o,s=o===void 0?a:`「${o}」`;return n?s+Jk(a,n).slice(a.length):s}function iO(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&&bd(o)===bd(a);return[Dl(e,t,i),Dl(e,n,r,s?"다른 ":"")]}function rO(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 oO(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 Il={top:"위",bottom:"아래",left:"왼쪽",right:"오른쪽"};function aO(e,t){const n=(r,o)=>Dl(t,r,o),i=(r,o,a,s)=>iO(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)}의 ${Il[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)}의 ${Il[e.side]}을(를) ${Math.round(e.depth)}px 가릅니다.`;case"edge-along-group-boundary":return e.distance===0?`${n(e.edge,"이")} ${n(e.group)}의 ${Il[e.side]} 테두리 위를 ${e.length}px 겹쳐 흐릅니다.`:`${n(e.edge,"이")} ${n(e.group)}의 ${Il[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 sO(e,t){switch(e.ruleId){case"CHK-FLOW-1":return`${Dl(t,e.targetRefs[0])}에 연결된 선이 하나도 없습니다 — 분기·합류가 없는 게이트웨이는 의미가 정해지지 않습니다.`;case"CHK-POOL-1":return`이 문서에 내용이 없는 풀 ${e.targetRefs.length}개가 펼친 형태로 그려져 있습니다 — 이 문서에서 내용을 그리지 않는 풀은 접힌 형태(블랙박스)가 의미에 맞습니다.`;default:return e.ruleId}}const bx="기타",xd={error:0,warning:1,info:2};function xx(e,t){const n=[];for(const i of e.geometry)n.push({key:`g:${ft(i)}`,source:"geometry",code:i.kind,severity:rO(i),targetRefs:oO(i),category:yx[i.kind]??bx,message:aO(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:yx[i.ruleId]??bx,message:sO(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 la(e,t){return t!==void 0&&e.targetRefs.some(n=>t.has(n))}function _d(e,t){if(t===void 0||e.length===0)return!1;const n=la(e[0],t);return e.some(i=>la(i,t)!==n)}function wx(e,t){const n=_d(e,t);return e.slice().sort((i,r)=>(n?Number(la(r,t))-Number(la(i,t)):0)||xd[i.severity]-xd[r.severity])}var cO=new oa("ov"),lO=500;function gn(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=cO,this._overlayDefaults=U({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=uO(n.getContainer()),this._init()}gn.$inject=["config.overlays","eventBus","canvas","elementRegistry"],gn.prototype.get=function(e){if(jn(e)&&(e={id:e}),jn(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?nt(t.overlays,Po({type:e.type})):t.overlays.slice():[]}else return e.type?nt(this._overlays,Po({type:e.type})):e.id?this._overlays[e.id]:null},gn.prototype.add=function(e,t,n){if(pn(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=U({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},gn.prototype.remove=function(e){var t=this.get(e)||[];Ne(t)||(t=[t]);var n=this;z(t,function(i){var r=n._getOverlayContainer(i.element,!0);if(i&&(Li(i.html),Li(i.htmlContainer),delete i.htmlContainer,delete i.element,delete n._overlays[i.id]),r){var o=r.overlays.indexOf(i);o!==-1&&r.overlays.splice(o,1)}})},gn.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},gn.prototype.show=function(){Ll(this._overlayRoot)},gn.prototype.hide=function(){Ll(this._overlayRoot,!1)},gn.prototype.clear=function(){this._overlays={},this._overlayContainers=[],gc(this._overlayRoot)},gn.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=Zt(t);i=o.x,r=o.y}Ex(n,i,r),Pn(e.html,"data-container-id",t.id)},gn.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=Zt(i).width:a=i.width,r=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=Zt(i).height:s=i.height,o=t.bottom*-1+s}Ex(n,r||0,o||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},gn.prototype._createOverlayContainer=function(e){var t=It('<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},gn.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";Sx(this._overlayRoot,n)},gn.prototype._getOverlayContainer=function(e,t){var n=kt(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},gn.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)),jn(i)&&(i=It(i)),o=this._getOverlayContainer(n),r=It('<div class="djs-overlay" data-overlay-id="'+t+'">'),In(r,{position:"absolute"}),r.appendChild(i),e.type&&$t(r).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();Ll(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())},gn.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&&(rn(r)&&r>t.scale||rn(o)&&o<t.scale))&&(c=!1),Ll(a,c),this._updateOverlayScale(e,t)},gn.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),rn(i)&&t.scale<i&&(a=(1/t.scale||1)*i),rn(r)&&t.scale>r&&(a=(1/t.scale||1)*r)),rn(a)&&(s="scale("+a+","+a+")"),Sx(o,s)},gn.prototype._updateOverlaysVisibilty=function(e){var t=this;z(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},gn.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});z(o,function(c){t.remove(c.id)});var a=t._getOverlayContainer(r);if(a){Li(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",lO,function(i){var r=i.element,o=t._getOverlayContainer(r,!0);o&&(z(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&&$t(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 uO(e){var t=It('<div class="djs-overlay-container" />');return In(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function Ex(e,t,n){In(e,{left:t+"px",top:n+"px"})}function Ll(e,t){e.style.display=t===!1?"none":""}function Sx(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const Bl={__init__:["overlays"],overlays:["type",gn]};function wd(e,t){t.invoke(se,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(wd,se),wd.$inject=["canvas","injector"];const pO={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",wd]};function ys(e){return CSS.escape(e)}var fO={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function Rx(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return fO[t]})}var dO="bjs-breadcrumbs-shown";function Cx(e,t,n){var i=It('<ul class="bjs-breadcrumbs"></ul>'),r=n.getContainer(),o=$t(r);r.appendChild(i);var a=[];e.on("element.changed",function(c){var l=c.element,u=le(l),p=kt(a,function(f){return f===u});p&&s()});function s(c){c&&(a=hO(c));var l=a.flatMap(function(p){var f=n.findRoot(ji(p))||n.findRoot(p.id);if(!f&&M(p,"bpmn:Process")){var d=t.find(function(b){var E=le(b);return E&&E.get("processRef")===p});f=d&&n.findRoot(d.id)}if(!f)return[];var h=Rx(p.name||p.id),m=It('<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(dO,u),l.forEach(function(p){i.appendChild(p)})}e.on("root.set",function(c){s(c.element)})}Cx.$inject=["eventBus","elementRegistry","canvas"];function hO(e){for(var t=le(e),n=[],i=t;i;i=i.$parent)(M(i,"bpmn:SubProcess")||M(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function Mx(e,t){var n=null,i=new mO;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,!(!M(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})}Mx.$inject=["eventBus","canvas"];function mO(){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 Ax={x:180,y:160};function mo(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,r){n._handleImport(r.definitions)})}mo.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)})}},mo.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;M(a,"bpmn:SubProcess")&&!o.isExpanded&&n.push(a),yO(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},mo.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=gO(e),i={x:n.x-Ax.x,y:n.y-Ax.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)})},mo.prototype._moveToDiPlane=function(e,t){var n=Px(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},mo.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},mo.$inject=["eventBus","moddle"];function Px(e){return M(e,"bpmndi:BPMNDiagram")?e:Px(e.$parent)}function gO(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=Le(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),Rc(t)}function yO(e,t){var n=e.$parent;return!(!M(n,"bpmn:SubProcess")||n===t.bpmnElement||tt(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var Nl=250,vO='<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>',bO="bjs-drilldown-empty";function Nr(e,t,n,i,r){se.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",Nl,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",Nl,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],Nl,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"],Nl,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(Nr,se),Nr.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},Nr.prototype._canDrillDown=function(e){var t=this._canvas;return M(e,"bpmn:SubProcess")&&t.findRoot(ji(e))},Nr.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=le(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var r=n&&n.get("flowElements")&&n.get("flowElements").length;$t(i.html).toggle(bO,!r)}},Nr.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=le(e),r=n.get({element:e,type:"drilldown"});r.length&&this._removeOverlay(e);var o=It('<button type="button" class="bjs-drilldown">'+vO+"</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(ji(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:o}),this._updateOverlayVisibility(e)},Nr.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},Nr.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const xO={__depends__:[Bl,Qf,pO],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",Cx],drilldownCentering:["type",Mx],drilldownOverlayBehavior:["type",Nr],subprocessCompatibility:["type",mo]};function $r(e){jt.call(this,e)}Ee($r,jt),$r.prototype._modules=[hy,xO,Bl,di,Wa],$r.prototype._moddleExtensions={};var $l="keyboard.keydown",_O="keyboard.keyup",wO=1e3,Tx="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 Ln(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(Tx));var i=e&&e.bind!==!1;t.on("canvas.init",function(r){n._target=r.svg,i&&n.bind(),n._fire("init")})}Ln.$inject=["config.keyboard","eventBus"],Ln.prototype._keydownHandler=function(e){this._keyHandler(e,$l)},Ln.prototype._keyupHandler=function(e){this._keyHandler(e,_O)},Ln.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||$l,i),n&&e.preventDefault()}},Ln.prototype._isEventIgnored=function(e){return!1},Ln.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(Tx)),this.unbind(),e=this._node=this._target,Ge.bind(e,"keydown",this._keydownHandler),Ge.bind(e,"keyup",this._keyupHandler),this._fire("bind")},Ln.prototype.getBinding=function(){return this._node},Ln.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},Ln.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},Ln.prototype.addListener=function(e,t,n){fn(e)&&(n=t,t=e,e=wO),this._eventBus.on(n||$l,e,t)},Ln.prototype.removeListener=function(e,t){this._eventBus.off(t||$l,e)},Ln.prototype.hasModifier=DT,Ln.prototype.isCmd=Un,Ln.prototype.isShift=Hf,Ln.prototype.isKey=sn;var EO=500;function ua(e,t){var n=this;e.on("editorActions.init",EO,function(i){var r=i.editorActions;n.registerBindings(t,r)})}ua.$inject=["eventBus","keyboard"],ua.prototype.registerBindings=function(e,t){function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("undo",function(i){var r=i.keyEvent;if($T(r))return t.trigger("undo"),!0}),n("redo",function(i){var r=i.keyEvent;if(FT(r))return t.trigger("redo"),!0}),n("copy",function(i){var r=i.keyEvent;if(IT(r))return t.trigger("copy"),!0}),n("paste",function(i){var r=i.keyEvent;if(LT(r))return t.trigger("paste"),!0}),n("duplicate",function(i){var r=i.keyEvent;if(BT(r))return t.trigger("duplicate"),!0}),n("cut",function(i){var r=i.keyEvent;if(NT(r))return t.trigger("cut"),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(sn(["+","Add","="],r)&&Un(r))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(sn(["-","Subtract"],r)&&Un(r))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var r=i.keyEvent;if(sn("0",r)&&Un(r))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var r=i.keyEvent;if(sn(["Backspace","Delete","Del"],r))return t.trigger("removeSelection"),!0})};const Ed={__init__:["keyboard","keyboardBindings"],keyboard:["type",Ln],keyboardBindings:["type",ua]};var SO={moveSpeed:50,moveSpeedAccelerated:200};function kx(e,t,n){var i=this;this._config=U({},SO,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})}}kx.$inject=["config.keyboardMove","keyboard","canvas"];const Ox={__depends__:[Ed],__init__:["keyboardMove"],keyboardMove:["type",kx]};var RO=15;function Dx(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=co(s),p=Ci(u,c);if(!n.dragging&&CO(p)>RO&&(n.dragging=!0,l===0&&eb(e),ll("grab")),n.dragging){var f=n.last||n.start;p=Ci(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,Jv()}function a(s){if(!no(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:co(s)},Ge.bind(document,"mousemove",r),Ge.bind(document,"mouseup",o),!0}}this.isActive=function(){return!!n}}Dx.$inject=["eventBus","canvas"];function CO(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const Ix={__init__:["moveCanvas"],moveCanvas:["type",Dx]};function Lx(e,t){var n=Np(e.min),i=Np(e.max),r=Math.abs(n)+Math.abs(i);return r/t}function MO(e,t){return Math.max(e.min,Math.min(e.max,t))}var AO=Math.sign||function(e){return e>=0?1:-1},Sd={min:.2,max:4},Bx=10,PO=.1,TO=.75;function Gi(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=Nn(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||TO;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}Gi.$inject=["config.zoomScroll","eventBus","canvas"],Gi.prototype.scroll=function(t){this._canvas.scroll(t)},Gi.prototype.reset=function(){this._canvas.zoom("fit-viewport")},Gi.prototype.zoom=function(t,n){var i=Lx(Sd,Bx*2);this._totalDelta+=t,Math.abs(this._totalDelta)>PO&&(this._zoom(t,n,i),this._totalDelta=0)},Gi.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))*AO(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)}},Gi.prototype.stepZoom=function(t,n){var i=Lx(Sd,Bx);this._zoom(t,n,i)},Gi.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=Np(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(MO(Sd,s),t)},Gi.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},Gi.prototype._init=function(e){this.toggle(e)};const Nx={__init__:["zoomScroll"],zoomScroll:["type",Gi]};function vs(e){$r.call(this,e)}Ee(vs,$r),vs.prototype._navigationModules=[Ox,Ix,Nx],vs.prototype._modules=[].concat($r.prototype._modules,vs.prototype._navigationModules);function Rd(e){return e&&e[e.length-1]}function $x(e){return e.y}function Fx(e){return e.x}var kO={left:Fx,center:Fx,right:function(e){return e.x+e.width},top:$x,middle:$x,bottom:function(e){return e.y+e.height}};function pa(e,t){this._modeling=e,this._rules=t}pa.$inject=["modeling","rules"],pa.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}},pa.prototype._isType=function(e,t){return t.indexOf(e)!==-1},pa.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=Rd(t),o[e]=u[i]+u[r];else if(this._isType(e,["center","middle"])){if(z(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=Pi(a,function(f){return f.elements.length>1&&(s=!0),f.elements.length}),s)return o[e]=Rd(c).center,o;l=t[0],t=Pi(t,function(f){return f[i]+f[r]}),u=Rd(t),o[e]=p(l,u)}return o},pa.prototype.trigger=function(e,t){var n=this._modeling,i,r=nt(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:r}),Ne(i)&&(r=i),!(r.length<2||!i)){var o=kO[t],a=Pi(r,o),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const OO={__init__:["alignElements"],alignElements:["type",pa]},DO=new oa;function fa(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}fa.$inject=["eventBus"],fa.prototype.schedule=function(e,t=DO.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},fa.prototype._schedule=function(e,t){const n=IO();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}},fa.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},fa.prototype._cancel=function(e){clearTimeout(e.executionId)};function IO(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const LO={scheduler:["type",fa]};var BO="djs-element-hidden",Fl=".entry",NO=1e3,jx=8,$O=300;function Jt(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}Jt.$inject=["canvas","elementRegistry","eventBus","scheduler"],Jt.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=Ne(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=Ne(i.target)?i.target:[i.target];r.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},Jt.prototype._createContainer=function(){var e=It('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},Jt.prototype.registerProvider=function(e,t){t||(t=e,e=NO),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},Jt.prototype.getEntries=function(e){var t=this._getProviders(),n=Ne(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return z(t,function(r){if(fn(r[n])){var o=r[n](e);fn(o)?i=o(i):z(o,function(a,s){i[s]=a})}}),i},Jt.prototype.trigger=function(e,t,n){var i=this,r,o,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(r=Pn(a,"data-action"),o=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(r,"hover",o,n)},$O);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(r,e,o,n)},Jt.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(fn(s)){if(t==="click")return s(n,r,i)}else if(s[t])return s[t](n,r,i);n.preventDefault()}}}},Jt.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))}},Jt.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Jt.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),i;z(t,function(r,o){var a=r.group||"default",s=It(r.html||'<div class="entry" draggable="true"></div>'),c;Pn(s,"data-action",o),c=Rt("[data-group="+ys(a)+"]",n),c||(c=It('<div class="group"></div>'),Pn(c,"data-group",a),n.appendChild(c)),c.appendChild(s),r.className&&FO(s,r.className),r.title&&Pn(s,"title",r.title),r.imageUrl&&(i=It("<img>"),Pn(i,"src",r.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),$t(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},Jt.prototype._createHtml=function(e){var t=this,n=It('<div class="djs-context-pad"></div>');return Gn.bind(n,Fl,"click",function(i){t.trigger("click",i)}),Gn.bind(n,Fl,"dragstart",function(i){t.trigger("dragstart",i)}),Gn.bind(n,Fl,"mouseover",function(i){t.trigger("mouseover",i)}),Gn.bind(n,Fl,"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},Jt.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()&&HO(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},Jt.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},Jt.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return Ne(e)!==Ne(n)?!1:Ne(e)?e.length===n.length&&Zr(e,function(i){return n.includes(i)}):n===e},Jt.prototype.isShown=function(){return this.isOpen()&&$t(this._current.html).has("open")},Jt.prototype.show=function(){this.isOpen()&&($t(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},Jt.prototype.hide=function(){this.isOpen()&&($t(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},Jt.prototype._getPosition=function(e){if(!Ne(e)&&Mt(e)){var t=this._canvas.viewbox(),n=jO(e),i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale;return{left:i+jx*this._canvas.zoom(),top:r}}var o=this._canvas.getContainer(),a=o.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+jx*this._canvas.zoom(),top:s.top-a.top}},Jt.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")},Jt.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=Ne(n)?n:[n],r=i.some(function(o){return t._canvas.hasMarker(o,BO)});r?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},Jt.prototype._getTargetBounds=function(e){var t=this,n=Ne(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 FO(e,t){var n=$t(e);t=Ne(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function jO(e){return e.waypoints[e.waypoints.length-1]}function HO(e,t){return e=Ne(e)?e:[e],t=Ne(t)?t:[t],e.length===t.length&&Zr(e,function(n){return t.includes(n)})}const Hx={__depends__:[cl,LO,Bl],contextPad:["type",Jt]};var jl,zt,zx,Fr,Gx,Vx,Wx,Cd,Hl,bs,Ux,Md,Ad,Pd,zl={},Gl=[],zO=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Vl=Array.isArray;function sr(e,t){for(var n in t)e[n]=t[n];return e}function Td(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Yx(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 Wl(e,a,i,r,null)}function Wl(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??++zx,__i:-1,__u:0};return r==null&&zt.vnode!=null&&zt.vnode(o),o}function Ul(e){return e.children}function Yl(e,t){this.props=e,this.context=t}function go(e,t){if(t==null)return e.__?go(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"?go(e):null}function GO(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],r=[],o=sr({},t);o.__v=t.__v+1,zt.vnode&&zt.vnode(o),kd(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??go(t),!!(32&t.__u),r),o.__v=t.__v,o.__.__k[o.__i]=o,t_(i,o,r),t.__e=t.__=null,o.__e!=n&&qx(o)}}function qx(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}),qx(e)}function Kx(e){(!e.__d&&(e.__d=!0)&&Fr.push(e)&&!ql.__r++||Gx!=zt.debounceRendering)&&((Gx=zt.debounceRendering)||Vx)(ql)}function ql(){try{for(var e,t=1;Fr.length;)Fr.length>t&&Fr.sort(Wx),e=Fr.shift(),t=Fr.length,GO(e)}finally{Fr.length=ql.__r=0}}function Xx(e,t,n,i,r,o,a,s,c,l,u){var p,f,d,h,m,b,E=i&&i.__k||Gl,_=t.length;for(c=VO(n,t,E,c,_),p=0;p<_;p++)(d=n.__k[p])!=null&&(f=d.__i!=-1&&E[d.__i]||zl,d.__i=p,b=kd(e,d,f,r,o,a,s,c,l,u),h=d.__e,d.ref&&f.ref!=d.ref&&(f.ref&&Od(f.ref,null,d),u.push(d.ref,d.__c||h,d)),m==null&&h!=null&&(m=h),4&d.__u?(c=Zx(d,c,e),f.__e&&(f.__e=null)):typeof d.type=="function"&&b!==void 0?c=b:h&&(c=h.nextSibling),d.__u&=-7);return n.__e=m,c}function VO(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]=Wl(null,a,null,null,null):Vl(a)?a=e.__k[o]=Wl(Ul,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=Wl(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=WO(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=go(s)),i_(s,s));return i}function Zx(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=Zx(i[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=go(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function WO(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 Qx(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||zO.test(t)?n:n+"px"}function Kl(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||Qx(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||Qx(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(Ux,"$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[bs]=i[bs]:(n[bs]=Md,e.addEventListener(t,o?Pd:Ad,o)):e.removeEventListener(t,o?Pd:Ad,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 Jx(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Hl]==null)t[Hl]=Md++;else if(t[Hl]<n[bs])return;return n(zt.event?zt.event(t):t)}}}function kd(e,t,n,i,r,o,a,s,c,l){var u,p,f,d,h,m,b,E,_,g,y,S,w,P,T,$,k=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[s=t.__e=n.__e]),(u=zt.__b)&&u(t);e:if(typeof k=="function"){p=a.length;try{if(_=t.props,g=k.prototype&&k.prototype.render,y=(u=k.contextType)&&i[u.__c],S=u?y?y.props.value:u.__:i,n.__c?E=(f=t.__c=n.__c).__=f.__E:(g?t.__c=f=new k(_,S):(t.__c=f=new Yl(_,S),f.constructor=k,f.render=YO),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&&k.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=sr({},f.__s)),sr(f.__s,k.getDerivedStateFromProps(_,f.__s))),h=f.props,m=f.state,f.__v=t,d)g&&k.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),g&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(g&&k.getDerivedStateFromProps==null&&_!==h&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(_,S),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(_,f.__s,S)===!1){t.__v!=n.__v&&(f.props=_,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(D){D&&(D.__=t)}),Gl.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&a.push(f),s=go(n);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(_,f.__s,S),g&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(h,m,b)})}if(f.context=S,f.props=_,f.__P=e,f.__e=!1,w=zt.__r,P=0,g)f.state=f.__s,f.__d=!1,w&&w(t),u=f.render(f.props,f.state,f.context),Gl.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,w&&w(t),u=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++P<25);f.state=f.__s,f.getChildContext!=null&&(i=sr(sr({},i),f.getChildContext())),g&&!d&&f.getSnapshotBeforeUpdate!=null&&(b=f.getSnapshotBeforeUpdate(h,m)),T=u!=null&&u.type===Ul&&u.key==null?n_(u.props.children):u,s=Xx(e,Vl(T)?T:[T],t,n,i,r,o,a,s,c,l),f.base=t.__e,t.__u&=-161,f.__h.length&&a.push(f),E&&(f.__E=f.__=null)}catch(D){if(a.length=p,t.__v=null,c||o!=null){if(D.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($=o.length;$--;)Td(o[$])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),D.then||e_(t),zt.__e(D,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=UO(n.__e,t,n,i,r,o,a,c,l);return(u=zt.diffed)&&u(t),128&t.__u?void 0:s}function e_(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(e_))}function t_(e,t,n){for(var i=0;i<n.length;i++)Od(n[i],n[++i],n[++i]);zt.__c&&zt.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){zt.__e(o,r.__v)}})}function n_(e){return typeof e!="object"||e==null||e.__b>0?e:Vl(e)?e.map(n_):e.constructor!==void 0?null:sr({},e)}function UO(e,t,n,i,r,o,a,s,c){var l,u,p,f,d,h,m,b=n.props||zl,E=t.props,_=t.type;if(_=="svg"?r="http://www.w3.org/2000/svg":_=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),o!=null){for(l=0;l<o.length;l++)if((d=o[l])&&"setAttribute"in d==!!_&&(_?d.localName==_:d.nodeType==3)){e=d,o[l]=null;break}}if(e==null){if(_==null)return document.createTextNode(E);e=document.createElementNS(r,_,E.is&&E),s&&(zt.__m&&zt.__m(t,o),s=!1),o=null}if(_==null)b===E||s&&e.data==E||(e.data=E);else{if(o=_=="textarea"&&E.defaultValue!=null?null:o&&jl.call(e.childNodes),!s&&o!=null)for(b={},l=0;l<e.attributes.length;l++)b[(d=e.attributes[l]).name]=d.value;for(l in b)d=b[l],l=="dangerouslySetInnerHTML"?p=d:l=="children"||l in E||l=="value"&&"defaultValue"in E||l=="checked"&&"defaultChecked"in E||Kl(e,l,null,d,r);for(l in E)d=E[l],l=="children"?f=d:l=="dangerouslySetInnerHTML"?u=d:l=="value"?h=d:l=="checked"?m=d:s&&typeof d!="function"||b[l]===d||Kl(e,l,d,b[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=""),Xx(t.type=="template"?e.content:e,Vl(f)?f:[f],t,n,i,_=="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,a,o?o[0]:n.__k&&go(n,0),s,c),o!=null)for(l=o.length;l--;)Td(o[l]);s&&_!="textarea"||(l="value",_=="progress"&&h==null?e.removeAttribute("value"):h!=null&&(h!==e[l]||_=="progress"&&!h||_=="option"&&h!=b[l])&&Kl(e,l,h,b[l],r),l="checked",m!=null&&m!=e[l]&&Kl(e,l,m,b[l],r))}return e}function Od(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){zt.__e(r,n)}}function i_(e,t,n){var i,r;if(zt.unmount&&zt.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||Od(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){zt.__e(o,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&i_(i[r],t,n||typeof e.type!="function");n||Td(e.__e),e.__c=e.__=e.__e=void 0}function YO(e,t,n){return this.constructor(e,n)}function r_(e,t,n){var i,r,o,a;t==document&&(t=document.documentElement),zt.__&&zt.__(e,t),r=(i=!1)?null:t.__k,o=[],a=[],kd(t,e=t.__k=Yx(Ul,null,[e]),r||zl,zl,t.namespaceURI,r?null:t.firstChild?jl.call(t.childNodes):null,o,r?r.__e:t.firstChild,i,a),t_(o,e,a),e.props.children=null}jl=Gl.slice,zt={__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}},zx=0,Yl.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=sr({},this.state),typeof e=="function"&&(e=e(sr({},n),this.props)),e&&sr(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Kx(this))},Yl.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Kx(this))},Yl.prototype.render=Ul,Fr=[],Vx=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Wx=function(e,t){return e.__v.__b-t.__v.__b},ql.__r=0,Cd=Math.random().toString(8),Hl="__d"+Cd,bs="__a"+Cd,Ux=/(PointerCapture)$|Capture$/i,Md=0,Ad=Jx(!1),Pd=Jx(!0);var o_=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,o_(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 qO(e){var t=a_.get(this);return t||(t=new Map,a_.set(this,t)),(t=o_(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 Pt=qO.bind(Yx),da,en,Dd,s_,xs=0,c_=[],cn=zt,l_=cn.__b,u_=cn.__r,p_=cn.diffed,f_=cn.__c,d_=cn.unmount,h_=cn.__;function Xl(e,t){cn.__h&&cn.__h(en,e,xs||t),xs=0;var n=en.__H||(en.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function Id(e){return xs=1,KO(g_,e)}function KO(e,t,n){var i=Xl(da++,2);if(i.t=e,!i.__c&&(i.__=[g_(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=en,!en.__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};en.__f=!0;var o=en.shouldComponentUpdate,a=en.componentWillUpdate;en.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)},en.shouldComponentUpdate=r}return i.__N||i.__}function Zl(e,t){var n=Xl(da++,3);!cn.__s&&Nd(n.__H,t)&&(n.__=e,n.u=t,en.__H.__h.push(n))}function Ld(e,t){var n=Xl(da++,4);!cn.__s&&Nd(n.__H,t)&&(n.__=e,n.u=t,en.__h.push(n))}function Ql(e){return xs=5,cr(function(){return{current:e}},[])}function cr(e,t){var n=Xl(da++,7);return Nd(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function _s(e,t){return xs=8,cr(function(){return e},t)}function XO(){for(var e;e=c_.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Jl),t.__h.some(Bd),t.__h=[]}catch(n){t.__h=[],cn.__e(n,e.__v)}}}cn.__b=function(e){en=null,l_&&l_(e)},cn.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),h_&&h_(e,t)},cn.__r=function(e){u_&&u_(e),da=0;var t=(en=e.__c).__H;t&&(Dd===en?(t.__h=[],en.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(Jl),t.__h.some(Bd),t.__h=[],da=0)),Dd=en},cn.diffed=function(e){p_&&p_(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(c_.push(t)!==1&&s_===cn.requestAnimationFrame||((s_=cn.requestAnimationFrame)||ZO)(XO)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),Dd=en=null},cn.__c=function(e,t){t.some(function(n){try{n.__h.some(Jl),n.__h=n.__h.filter(function(i){return!i.__||Bd(i)})}catch(i){t.some(function(r){r.__h&&(r.__h=[])}),t=[],cn.__e(i,n.__v)}}),f_&&f_(e,t)},cn.unmount=function(e){d_&&d_(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{Jl(i)}catch(r){t=r}}),n.__H=void 0,t&&cn.__e(t,n.__v))};var m_=typeof requestAnimationFrame=="function";function ZO(e){var t,n=function(){clearTimeout(i),m_&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);m_&&(t=requestAnimationFrame(n))}function Jl(e){var t=en,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),en=t}function Bd(e){var t=en;e.__c=e.__(),en=t}function Nd(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function g_(e,t){return typeof t=="function"?t(e):t}function QO(e){const{navigationStack:t,setNavigationStack:n}=e,i=cr(()=>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 Pt`
9
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="`+d+'" height="'+f+'" viewBox="'+u+" "+p+" "+d+" "+f+'" 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}},Xt.prototype._setDefinitions=function(e){this._definitions=e},Xt.prototype.getModules=function(){return this._modules},Xt.prototype.clear=function(){this.getDefinitions()&&hr.prototype.clear.call(this)},Xt.prototype.destroy=function(){hr.prototype.destroy.call(this),co(this._container)},Xt.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},Xt.prototype.off=function(e,t){this.get("eventBus").off(e,t)},Xt.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=kt(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},Xt.prototype.getDefinitions=function(){return this._definitions},Xt.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},Xt.prototype._init=function(e,t,n){const i=n.modules||this.getModules(n),o=n.additionalModules||[],r=[{bpmnjs:["value",this],moddle:["value",t]}],a=[].concat(r,i,o),s=te(oo(n,["additionalModules"]),{canvas:te({},n.canvas,{container:e}),modules:a});hr.call(this,s),n&&n.container&&this.attachTo(n.container)},Xt.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},Xt.prototype._createContainer=function(e){const t=Wt('<div class="bjs-container"></div>');return Zn(t,{width:sb(e.width),height:sb(e.height),position:e.position}),t},Xt.prototype._createModdle=function(e){const t=te({},this._moddleExtensions,e.moddleExtensions);return new sy(t)},Xt.prototype._modules=[];function Hl(e,t){return e.warnings=t,e}function P2(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 k2={width:"100%",height:"100%",position:"relative"};function sb(e){return e+(tt(e)?"px":"")}function O2(e,t){return t&&Ht(e.diagrams,function(n){return n.id===t})||null}function D2(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+ib+"</a>",i=Wt(n);Zn(kt("svg",i),ob),Zn(i,rb,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),Ke.bind(i,"click",function(o){T2(),o.preventDefault()})}function Kr(e){Xt.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)}je(Kr,Xt),Kr.prototype._createModdle=function(e){var t=Xt.prototype._createModdle.call(this,e);return t.ids=new so([32,36,1]),t},Kr.prototype._collectIds=function(e,t){var n=e.$model,i=n.ids,o;i.clear();for(o in t)i.claim(o,t[o])};function xt(e,t){return T(e,"bpmn:CallActivity")?!1:T(e,"bpmn:SubProcess")?(t=t||wt(e),t&&T(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):T(e,"bpmn:Participant")?!!Ee(e).processRef:!0}function Tn(e){if(!(!T(e,"bpmn:Participant")&&!T(e,"bpmn:Lane"))){var t=wt(e).isHorizontal;return t===void 0?!0:t}}function L2(e){return e&&Ee(e).isInterrupting!==!1}function Kn(e){return e&&!!Ee(e).triggeredByEvent}function Na(e,t){var n=Ee(e).eventDefinitions;return Zo(n,function(i){return T(i,t)})}function I2(e){return Na(e,"bpmn:ErrorEventDefinition")}function B2(e){return Na(e,"bpmn:EscalationEventDefinition")}function N2(e){return Na(e,"bpmn:CompensateEventDefinition")}var Xr={width:90,height:20},cb=15;function fo(e){return T(e,"bpmn:Event")||T(e,"bpmn:Gateway")||T(e,"bpmn:DataStoreReference")||T(e,"bpmn:DataObjectReference")||T(e,"bpmn:DataInput")||T(e,"bpmn:DataOutput")||T(e,"bpmn:SequenceFlow")||T(e,"bpmn:MessageFlow")||T(e,"bpmn:Group")}function Gl(e){return ft(e.label)}function $2(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],o=F2(e),r=Math.atan((i.y-n.y)/(i.x-n.x)),a=o.x,s=o.y;return Math.abs(r)<Math.PI/2?s-=cb:a+=cb,{x:a,y:s}}function F2(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 Ef(e){return e.waypoints?$2(e.waypoints):T(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+Xr.height/2}:{x:e.x+e.width/2,y:e.y+e.height+Xr.height/2}}function Sf(e,t){var n,i,o,r=e.label;return r&&r.bounds?(o=r.bounds,i={width:Math.max(Xr.width,o.width),height:o.height},n={x:o.x+o.width/2,y:o.y+o.height/2}):(n=Ef(t),i=Xr),te({x:n.x-i.width/2,y:n.y-i.height/2},i)}function lb(e){if(T(e,"bpmn:FlowElement")||T(e,"bpmn:Participant")||T(e,"bpmn:Lane")||T(e,"bpmn:SequenceFlow")||T(e,"bpmn:MessageFlow")||T(e,"bpmn:DataInput")||T(e,"bpmn:DataOutput"))return"name";if(T(e,"bpmn:TextAnnotation"))return"text";if(T(e,"bpmn:Group"))return"categoryValueRef"}function j2(e){var t=e.categoryValueRef;return t&&t.value||""}function ii(e){var t=e.businessObject,n=lb(t);if(n)return n==="categoryValueRef"?j2(t):t[n]||""}function H2(e,t){var n=e.businessObject,i=lb(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function G2(e){return ft(e)&&fo(e.labelTarget)}var $a=7;function ub(e){let t=[];return K(e.incoming,n=>{T(n,"bpmn:Association")&&T(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),K(e.outgoing,n=>{T(n,"bpmn:Association")&&T(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function Ws(e){const t=new Map;return K(mf(e),n=>{K(ub(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 Rf="hsl(225, 10%, 15%)",z2="white";function ho(e,t){return Zo(e.eventDefinitions,function(n){return n.$type===t})}function V2(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function W2(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function yt(e,t,n){var i=wt(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||z2}function Ne(e,t,n){var i=wt(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||Rf}function Us(e,t,n,i){var o=wt(e),r=o.get("label");return i||r&&r.get("color:color")||t||Ne(e,n)}function pb(e){var t=e.x+e.width/2,n=e.y+e.height/2,i=e.width/2,o=[["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 qr(o)}function Mf(e,t){var n=e.x,i=e.y,o=e.width,r=e.height,a=[["M",n+t,i],["l",o-t*2,0],["a",t,t,0,0,1,t,t],["l",0,r-t*2],["a",t,t,0,0,1,-t,t],["l",t*2-o,0],["a",t,t,0,0,1,-t,-t],["l",0,t*2-r],["a",t,t,0,0,1,t,-t],["z"]];return qr(a)}function U2(e){var t=e.width,n=e.height,i=e.x,o=e.y,r=t/2,a=n/2,s=[["M",i+r,o],["l",r,a],["l",-r,a],["l",-r,-a],["z"]];return qr(s)}function q2(e){var t=e.x,n=e.y,i=e.width,o=e.height,r=[["M",t,n],["l",i,0],["l",0,o],["l",-i,0],["z"]];return qr(r)}function qs(e,t={}){return{width:Ai(e,t),height:pi(e,t)}}function Ai(e,t={}){return si(t,"width")?t.width:e.width}function pi(e,t={}){return si(t,"height")?t.height:e.height}var Y2=new so,K2=10,zl=3,X2=1.5,Vl=10,Z2=4,Fa=.95,J2=1,Q2=.25;function Zr(e,t,n,i,o,r,a){ko.call(this,t,a);var s=e&&e.defaultFillColor,c=e&&e.defaultStrokeColor,l=e&&e.defaultLabelColor;function u(F){return n.computeStyle(F,{strokeLinecap:"round",strokeLinejoin:"round",stroke:Rf,strokeWidth:2,fill:"white"})}function p(F){return n.computeStyle(F,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:Rf,strokeWidth:2})}function d(F,C){var{ref:R={x:0,y:0},scale:J=1,element:ne,parentGfx:ge=o._svg}=C,$e=We("marker",{id:F,viewBox:"0 0 20 20",refX:R.x,refY:R.y,markerWidth:20*J,markerHeight:20*J,orient:"auto"});ot($e,ne);var rt=kt(":scope > defs",ge);rt||(rt=We("defs"),ot(ge,rt)),ot(rt,$e)}function f(F,C,R,J){var ne=Y2.nextPrefixed("marker-");return m(F,ne,C,R,J),"url(#"+ne+")"}function m(F,C,R,J,ne){if(R==="sequenceflow-end"){var ge=We("path",{d:"M 1 5 L 11 10 L 1 15 Z",...u({fill:ne,stroke:ne,strokeWidth:1})});d(C,{element:ge,ref:{x:11,y:10},scale:.5,parentGfx:F})}if(R==="messageflow-start"){var $e=We("circle",{cx:6,cy:6,r:3.5,...u({fill:J,stroke:ne,strokeWidth:1,strokeDasharray:[1e4,1]})});d(C,{element:$e,ref:{x:6,y:6},parentGfx:F})}if(R==="messageflow-end"){var rt=We("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...u({fill:J,stroke:ne,strokeWidth:1,strokeDasharray:[1e4,1]})});d(C,{element:rt,ref:{x:8.5,y:5},parentGfx:F})}if(R==="association-start"){var pt=We("path",{d:"M 11 5 L 1 10 L 11 15",...p({fill:"none",stroke:ne,strokeWidth:1.5,strokeDasharray:[1e4,1]})});d(C,{element:pt,ref:{x:1,y:10},scale:.5,parentGfx:F})}if(R==="association-end"){var pn=We("path",{d:"M 1 5 L 11 10 L 1 15",...p({fill:"none",stroke:ne,strokeWidth:1.5,strokeDasharray:[1e4,1]})});d(C,{element:pn,ref:{x:11,y:10},scale:.5,parentGfx:F})}if(R==="conditional-flow-marker"){var bt=We("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...u({fill:J,stroke:ne})});d(C,{element:bt,ref:{x:-1,y:10},scale:.5,parentGfx:F})}if(R==="conditional-default-flow-marker"){var qt=We("path",{d:"M 6 4 L 10 16",...u({stroke:ne,fill:"none"})});d(C,{element:qt,ref:{x:0,y:10},scale:.5,parentGfx:F})}}function h(F,C,R,J,ne={}){Sn(J)&&(ne=J,J=0),J=J||0,ne=u(ne);var ge=C/2,$e=R/2,rt=We("circle",{cx:ge,cy:$e,r:Math.round((C+R)/4-J),...ne});return ot(F,rt),rt}function y(F,C,R,J,ne,ge){Sn(ne)&&(ge=ne,ne=0),ne=ne||0,ge=u(ge);var $e=We("rect",{x:ne,y:ne,width:C-ne*2,height:R-ne*2,rx:J,ry:J,...ge});return ot(F,$e),$e}function w(F,C,R,J){var ne=C/2,ge=R/2,$e=[{x:ne,y:0},{x:C,y:ge},{x:ne,y:R},{x:0,y:ge}],rt=$e.map(function(pn){return pn.x+","+pn.y}).join(" ");J=u(J);var pt=We("polygon",{...J,points:rt});return ot(F,pt),pt}function g(F,C,R,J){R=p(R);var ne=$s(C,R,J);return ot(F,ne),ne}function v(F,C,R){return g(F,C,R,5)}function b(F,C,R){R=p(R);var J=We("path",{...R,d:C});return ot(F,J),J}function S(F,C,R,J){return b(C,R,te({"data-marker":F},J))}function M(F){return Ae[F]}function B(F){return function(C,R,J){return M(F)(C,R,J)}}var A={"bpmn:MessageEventDefinition":function(F,C,R={},J){var ne=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.235,my:.315}}),ge=J?Ne(C,c,R.stroke):yt(C,s,R.fill),$e=J?yt(C,s,R.fill):Ne(C,c,R.stroke),rt=b(F,ne,{fill:ge,stroke:$e,strokeWidth:1});return rt},"bpmn:TimerEventDefinition":function(F,C,R={}){var J=R.width||C.width,ne=R.height||C.height,ge=R.width?1:2,$e=h(F,J,ne,.2*ne,{fill:yt(C,s,R.fill),stroke:Ne(C,c,R.stroke),strokeWidth:ge}),rt=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:J,containerHeight:ne,position:{mx:.5,my:.5}});b(F,rt,{stroke:Ne(C,c,R.stroke),strokeWidth:ge});for(var pt=0;pt<12;pt++){var pn=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:J,containerHeight:ne,position:{mx:.5,my:.5}}),bt=J/2,qt=ne/2;b(F,pn,{strokeWidth:1,stroke:Ne(C,c,R.stroke),transform:"rotate("+pt*30+","+qt+","+bt+")"})}return $e},"bpmn:EscalationEventDefinition":function(F,C,R={},J){var ne=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.5,my:.2}}),ge=J?Ne(C,c,R.stroke):yt(C,s,R.fill);return b(F,ne,{fill:ge,stroke:Ne(C,c,R.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(F,C,R={}){var J=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.5,my:.222}});return b(F,J,{fill:yt(C,s,R.fill),stroke:Ne(C,c,R.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(F,C,R={},J){var ne=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.57,my:.263}}),ge=J?Ne(C,c,R.stroke):yt(C,s,R.fill);return b(F,ne,{fill:ge,stroke:Ne(C,c,R.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(F,C,R={},J){var ne=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.2,my:.722}}),ge=J?Ne(C,c,R.stroke):yt(C,s,R.fill);return b(F,ne,{fill:ge,stroke:Ne(C,c,R.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(F,C,R={},J){var ne=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.638,my:-.055}}),ge=J?Ne(C,c,R.stroke):"none",$e=b(F,ne,{fill:ge,stroke:Ne(C,c,R.stroke),strokeWidth:1});return eb($e,45),$e},"bpmn:CompensateEventDefinition":function(F,C,R={},J){var ne=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.22,my:.5}}),ge=J?Ne(C,c,R.stroke):yt(C,s,R.fill);return b(F,ne,{fill:ge,stroke:Ne(C,c,R.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(F,C,R={},J){var ne=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.5,my:.2}}),ge=J?Ne(C,c,R.stroke):yt(C,s,R.fill);return b(F,ne,{strokeWidth:1,fill:ge,stroke:Ne(C,c,R.stroke)})},"bpmn:MultipleEventDefinition":function(F,C,R={},J){var ne=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.211,my:.36}}),ge=J?Ne(C,c,R.stroke):yt(C,s,R.fill);return b(F,ne,{fill:ge,stroke:Ne(C,c,R.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(F,C,R={}){var J=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.458,my:.194}});return b(F,J,{fill:yt(C,s,R.fill),stroke:Ne(C,c,R.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(F,C,R={}){var J=h(F,C.width,C.height,8,{fill:Ne(C,c,R.stroke),stroke:Ne(C,c,R.stroke),strokeWidth:4});return J}};function I(F,C,R={},J){var ne=Ee(F),ge=V2(ne),$e=J||F;return ne.get("eventDefinitions")&&ne.get("eventDefinitions").length>1?ne.get("parallelMultiple")?A["bpmn:ParallelMultipleEventDefinition"](C,$e,R,ge):A["bpmn:MultipleEventDefinition"](C,$e,R,ge):ho(ne,"bpmn:MessageEventDefinition")?A["bpmn:MessageEventDefinition"](C,$e,R,ge):ho(ne,"bpmn:TimerEventDefinition")?A["bpmn:TimerEventDefinition"](C,$e,R,ge):ho(ne,"bpmn:ConditionalEventDefinition")?A["bpmn:ConditionalEventDefinition"](C,$e,R,ge):ho(ne,"bpmn:SignalEventDefinition")?A["bpmn:SignalEventDefinition"](C,$e,R,ge):ho(ne,"bpmn:EscalationEventDefinition")?A["bpmn:EscalationEventDefinition"](C,$e,R,ge):ho(ne,"bpmn:LinkEventDefinition")?A["bpmn:LinkEventDefinition"](C,$e,R,ge):ho(ne,"bpmn:ErrorEventDefinition")?A["bpmn:ErrorEventDefinition"](C,$e,R,ge):ho(ne,"bpmn:CancelEventDefinition")?A["bpmn:CancelEventDefinition"](C,$e,R,ge):ho(ne,"bpmn:CompensateEventDefinition")?A["bpmn:CompensateEventDefinition"](C,$e,R,ge):ho(ne,"bpmn:TerminateEventDefinition")?A["bpmn:TerminateEventDefinition"](C,$e,R,ge):null}var H={ParticipantMultiplicityMarker:function(F,C,R={}){var J=Ai(C,R),ne=pi(C,R),ge=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:J,containerHeight:ne,position:{mx:(J/2-6)/J,my:(ne-15)/ne}});S("participant-multiplicity",F,ge,{strokeWidth:2,fill:yt(C,s,R.fill),stroke:Ne(C,c,R.stroke)})},SubProcessMarker:function(F,C,R={}){var J=y(F,14,14,0,{strokeWidth:1,fill:yt(C,s,R.fill),stroke:Ne(C,c,R.stroke)});Fn(J,C.width/2-7.5,C.height-20);var ne=i.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:C.width,containerHeight:C.height,position:{mx:(C.width/2-7.5)/C.width,my:(C.height-20)/C.height}});S("sub-process",F,ne,{fill:yt(C,s,R.fill),stroke:Ne(C,c,R.stroke)})},ParallelMarker:function(F,C,R){var J=Ai(C,R),ne=pi(C,R),ge=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:J,containerHeight:ne,position:{mx:(J/2+R.parallel)/J,my:(ne-20)/ne}});S("parallel",F,ge,{fill:yt(C,s,R.fill),stroke:Ne(C,c,R.stroke)})},SequentialMarker:function(F,C,R){var J=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:(C.width/2+R.seq)/C.width,my:(C.height-19)/C.height}});S("sequential",F,J,{fill:yt(C,s,R.fill),stroke:Ne(C,c,R.stroke)})},CompensationMarker:function(F,C,R){var J=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:(C.width/2+R.compensation)/C.width,my:(C.height-13)/C.height}});S("compensation",F,J,{strokeWidth:1,fill:yt(C,s,R.fill),stroke:Ne(C,c,R.stroke)})},LoopMarker:function(F,C,R){var J=Ai(C,R),ne=pi(C,R),ge=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:J,containerHeight:ne,position:{mx:(J/2+R.loop)/J,my:(ne-7)/ne}});S("loop",F,ge,{strokeWidth:1.5,fill:"none",stroke:Ne(C,c,R.stroke),strokeMiterlimit:.5})},AdhocMarker:function(F,C,R){var J=Ai(C,R),ne=pi(C,R),ge=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:J,containerHeight:ne,position:{mx:(J/2+R.adhoc)/J,my:(ne-15)/ne}});S("adhoc",F,ge,{strokeWidth:1,fill:Ne(C,c,R.stroke),stroke:Ne(C,c,R.stroke)})}};function V(F,C,R,J){H[F](C,R,J)}function G(F,C,R=[],J={}){J={fill:J.fill,stroke:J.stroke,width:Ai(C,J),height:pi(C,J)};var ne=Ee(C),ge=R.includes("SubProcessMarker");ge?J={...J,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:J={...J,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},ne.get("isForCompensation")&&R.push("CompensationMarker"),T(ne,"bpmn:AdHocSubProcess")&&(R.push("AdhocMarker"),ge||te(J,{compensation:J.compensation-18}));var $e=ne.get("loopCharacteristics"),rt=$e&&$e.get("isSequential");$e&&(te(J,{compensation:J.compensation-18}),R.includes("AdhocMarker")&&te(J,{seq:-23,loop:-18,parallel:-24}),rt===void 0&&R.push("LoopMarker"),rt===!1&&R.push("ParallelMarker"),rt===!0&&R.push("SequentialMarker")),R.includes("CompensationMarker")&&R.length===1&&te(J,{compensation:-8}),K(R,function(pt){V(pt,F,C,J)})}function ie(F,C,R={}){R=te({size:{width:100}},R);var J=r.createText(C||"",R);return vt(J).add("djs-label"),ot(F,J),J}function pe(F,C,R,J={}){var ne=Ee(C),ge=qs({x:C.x,y:C.y,width:C.width,height:C.height},J);return ie(F,ne.name,{align:R,box:ge,padding:7,style:{fill:Us(C,l,c,J.stroke)}})}function Y(F,C,R={}){var J={width:C.width,height:C.height,x:C.width/2+C.x,y:C.height/2+C.y};return ie(F,ii(C),{box:J,style:te({},r.getExternalStyle(),{fill:Us(C,l,c,R.stroke)})})}function Te(F,C,R,J={}){var ne=Tn(R),ge=ie(F,C,{box:{height:30,width:ne?pi(R,J):Ai(R,J)},align:"center-middle",style:{fill:Us(R,l,c,J.stroke)}});if(ne){var $e=-1*pi(R,J);Fl(ge,0,-$e,270)}}function Pe(F,C,R={}){var{width:J,height:ne}=qs(C,R);return y(F,J,ne,Vl,{...R,fill:yt(C,s,R.fill),fillOpacity:Fa,stroke:Ne(C,c,R.stroke)})}function ke(F,C,R={}){var J=Ee(C),ne=yt(C,s,R.fill),ge=Ne(C,c,R.stroke);return(J.get("associationDirection")==="One"||J.get("associationDirection")==="Both")&&(R.markerEnd=f(F,"association-end",ne,ge)),J.get("associationDirection")==="Both"&&(R.markerStart=f(F,"association-start",ne,ge)),R=Et(R,["markerStart","markerEnd"]),v(F,C.waypoints,{...R,stroke:ge,strokeDasharray:"0, 5"})}function ve(F,C,R={}){var J=yt(C,s,R.fill),ne=Ne(C,c,R.stroke),ge=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.474,my:.296}}),$e=b(F,ge,{fill:J,fillOpacity:Fa,stroke:ne}),rt=Ee(C);if(W2(rt)){var pt=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.33,my:(C.height-18)/C.height}});b(F,pt,{strokeWidth:2,fill:J,stroke:ne})}return $e}function W(F,C,R={}){return h(F,C.width,C.height,{fillOpacity:Fa,...R,fill:yt(C,s,R.fill),stroke:Ne(C,c,R.stroke)})}function de(F,C,R={}){return w(F,C.width,C.height,{fill:yt(C,s,R.fill),fillOpacity:Fa,stroke:Ne(C,c,R.stroke)})}function z(F,C,R={}){var J=y(F,Ai(C,R),pi(C,R),0,{fill:yt(C,s,R.fill),fillOpacity:R.fillOpacity||Fa,stroke:Ne(C,c,R.stroke),strokeWidth:1.5}),ne=Ee(C);if(T(ne,"bpmn:Lane")){var ge=ne.get("name");Te(F,ge,C,R)}return J}function ee(F,C,R={}){var J=Pe(F,C,R),ne=xt(C);if(Kn(C)&&(Le(J,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!ne)){var ge=Ee(C).flowElements||[],$e=ge.filter(rt=>T(rt,"bpmn:StartEvent"));$e.length===1&&he($e[0],F,R,C)}return pe(F,C,ne?"center-top":"center-middle",R),ne?G(F,C,void 0,R):G(F,C,["SubProcessMarker"],R),J}function he(F,C,R,J){var ne=22,ge={fill:yt(J,s,R.fill),stroke:Ne(J,c,R.stroke),width:ne,height:ne},$e=Ee(F).isInterrupting,rt=$e?0:3,pt=$e?1:1.2,pn=20,bt=(ne-pn)/2,qt="translate("+bt+","+bt+")";h(C,pn,pn,{fill:ge.fill,stroke:ge.stroke,strokeWidth:pt,strokeDasharray:rt,transform:qt}),I(F,C,ge,J)}function se(F,C,R={}){var J=Pe(F,C,R);return pe(F,C,"center-middle",R),G(F,C,void 0,R),J}var Ae=this.handlers={"bpmn:AdHocSubProcess":function(F,C,R={}){return xt(C)?R=Et(R,["fill","stroke","width","height"]):R=Et(R,["fill","stroke"]),ee(F,C,R)},"bpmn:Association":function(F,C,R={}){return R=Et(R,["fill","stroke"]),ke(F,C,R)},"bpmn:BoundaryEvent":function(F,C,R={}){var{renderIcon:J=!0}=R;R=Et(R,["fill","stroke"]);var ne=Ee(C),ge=ne.get("cancelActivity");R={strokeWidth:1.5,fill:yt(C,s,R.fill),fillOpacity:J2,stroke:Ne(C,c,R.stroke)},ge||(R.strokeDasharray="6");var $e=W(F,C,R);return h(F,C.width,C.height,zl,{...R,fill:"none"}),J&&I(C,F,R),$e},"bpmn:BusinessRuleTask":function(F,C,R={}){R=Et(R,["fill","stroke"]);var J=se(F,C,R),ne=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),ge=b(F,ne);Le(ge,{fill:yt(C,s,R.fill),stroke:Ne(C,c,R.stroke),strokeWidth:1});var $e=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),rt=b(F,$e);return Le(rt,{fill:Ne(C,c,R.stroke),stroke:Ne(C,c,R.stroke),strokeWidth:1}),J},"bpmn:CallActivity":function(F,C,R={}){return R=Et(R,["fill","stroke"]),ee(F,C,{strokeWidth:5,...R})},"bpmn:ComplexGateway":function(F,C,R={}){R=Et(R,["fill","stroke"]);var J=de(F,C,R),ne=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:C.width,containerHeight:C.height,position:{mx:.46,my:.26}});return b(F,ne,{fill:Ne(C,c,R.stroke),stroke:Ne(C,c,R.stroke),strokeWidth:1}),J},"bpmn:DataInput":function(F,C,R={}){R=Et(R,["fill","stroke"]);var J=i.getRawPath("DATA_ARROW"),ne=ve(F,C,R);return b(F,J,{fill:"none",stroke:Ne(C,c,R.stroke),strokeWidth:1}),ne},"bpmn:DataInputAssociation":function(F,C,R={}){return R=Et(R,["fill","stroke"]),ke(F,C,{...R,markerEnd:f(F,"association-end",yt(C,s,R.fill),Ne(C,c,R.stroke))})},"bpmn:DataObject":function(F,C,R={}){return R=Et(R,["fill","stroke"]),ve(F,C,R)},"bpmn:DataObjectReference":B("bpmn:DataObject"),"bpmn:DataOutput":function(F,C,R={}){R=Et(R,["fill","stroke"]);var J=i.getRawPath("DATA_ARROW"),ne=ve(F,C,R);return b(F,J,{strokeWidth:1,fill:Ne(C,c,R.stroke),stroke:Ne(C,c,R.stroke)}),ne},"bpmn:DataOutputAssociation":function(F,C,R={}){return R=Et(R,["fill","stroke"]),ke(F,C,{...R,markerEnd:f(F,"association-end",yt(C,s,R.fill),Ne(C,c,R.stroke))})},"bpmn:DataStoreReference":function(F,C,R={}){R=Et(R,["fill","stroke"]);var J=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:0,my:.133}});return b(F,J,{fill:yt(C,s,R.fill),fillOpacity:Fa,stroke:Ne(C,c,R.stroke),strokeWidth:2})},"bpmn:EndEvent":function(F,C,R={}){var{renderIcon:J=!0}=R;R=Et(R,["fill","stroke"]);var ne=W(F,C,{...R,strokeWidth:4});return J&&I(C,F,R),ne},"bpmn:EventBasedGateway":function(F,C,R={}){R=Et(R,["fill","stroke"]);var J=Ee(C),ne=de(F,C,R);h(F,C.width,C.height,C.height*.2,{fill:yt(C,"none",R.fill),stroke:Ne(C,c,R.stroke),strokeWidth:1});var ge=J.get("eventGatewayType"),$e=!!J.get("instantiate");function rt(){var pn=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:C.width,containerHeight:C.height,position:{mx:.36,my:.44}});b(F,pn,{fill:"none",stroke:Ne(C,c,R.stroke),strokeWidth:2})}if(ge==="Parallel"){var pt=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:C.width,containerHeight:C.height,position:{mx:.474,my:.296}});b(F,pt,{fill:"none",stroke:Ne(C,c,R.stroke),strokeWidth:1})}else ge==="Exclusive"&&($e||h(F,C.width,C.height,C.height*.26,{fill:"none",stroke:Ne(C,c,R.stroke),strokeWidth:1}),rt());return ne},"bpmn:ExclusiveGateway":function(F,C,R={}){R=Et(R,["fill","stroke"]);var J=de(F,C,R),ne=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:C.width,containerHeight:C.height,position:{mx:.32,my:.3}}),ge=wt(C);return ge.get("isMarkerVisible")&&b(F,ne,{fill:Ne(C,c,R.stroke),stroke:Ne(C,c,R.stroke),strokeWidth:1}),J},"bpmn:Gateway":function(F,C,R={}){return R=Et(R,["fill","stroke"]),de(F,C,R)},"bpmn:Group":function(F,C,R={}){return R=Et(R,["fill","stroke","width","height"]),y(F,C.width,C.height,Vl,{stroke:Ne(C,c,R.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:Ai(C,R),height:pi(C,R)})},"bpmn:InclusiveGateway":function(F,C,R={}){R=Et(R,["fill","stroke"]);var J=de(F,C,R);return h(F,C.width,C.height,C.height*.24,{fill:yt(C,s,R.fill),stroke:Ne(C,c,R.stroke),strokeWidth:2.5}),J},"bpmn:IntermediateEvent":function(F,C,R={}){var{renderIcon:J=!0}=R;R=Et(R,["fill","stroke"]);var ne=W(F,C,{...R,strokeWidth:1.5});return h(F,C.width,C.height,zl,{fill:"none",stroke:Ne(C,c,R.stroke),strokeWidth:1.5}),J&&I(C,F,R),ne},"bpmn:IntermediateCatchEvent":B("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":B("bpmn:IntermediateEvent"),"bpmn:Lane":function(F,C,R={}){return R=Et(R,["fill","stroke","width","height"]),z(F,C,{...R,fillOpacity:Q2})},"bpmn:ManualTask":function(F,C,R={}){R=Et(R,["fill","stroke"]);var J=se(F,C,R),ne=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return b(F,ne,{fill:yt(C,s,R.fill),stroke:Ne(C,c,R.stroke),strokeWidth:.5}),J},"bpmn:MessageFlow":function(F,C,R={}){R=Et(R,["fill","stroke"]);var J=Ee(C),ne=wt(C),ge=yt(C,s,R.fill),$e=Ne(C,c,R.stroke),rt=v(F,C.waypoints,{markerEnd:f(F,"messageflow-end",ge,$e),markerStart:f(F,"messageflow-start",ge,$e),stroke:$e,strokeDasharray:"10, 11",strokeWidth:1.5});if(J.get("messageRef")){var pt=rt.getPointAtLength(rt.getTotalLength()/2),pn=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:pt.x,y:pt.y}}),bt={strokeWidth:1};ne.get("messageVisibleKind")==="initiating"?(bt.fill=ge,bt.stroke=$e):(bt.fill=$e,bt.stroke=ge);var qt=b(F,pn,bt),Kt=J.get("messageRef"),Ln=Kt.get("name"),Bt=ie(F,Ln,{align:"center-top",fitBox:!0,style:{fill:$e}}),sn=qt.getBBox(),zn=Bt.getBBox(),pa=pt.x-zn.width/2,ri=pt.y+sn.height/2+K2;Fl(Bt,pa,ri,0)}return rt},"bpmn:ParallelGateway":function(F,C,R={}){R=Et(R,["fill","stroke"]);var J=de(F,C,R),ne=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:C.width,containerHeight:C.height,position:{mx:.46,my:.2}});return b(F,ne,{fill:Ne(C,c,R.stroke),stroke:Ne(C,c,R.stroke),strokeWidth:1}),J},"bpmn:Participant":function(F,C,R={}){R=Et(R,["fill","stroke","width","height"]);var J=z(F,C,R),ne=xt(C),ge=Tn(C),$e=Ee(C),rt=$e.get("name");if(ne){var pt=ge?[{x:30,y:0},{x:30,y:pi(C,R)}]:[{x:0,y:30},{x:Ai(C,R),y:30}];g(F,pt,{stroke:Ne(C,c,R.stroke),strokeWidth:X2}),Te(F,rt,C,R)}else{var pn=qs(C,R);ge||(pn.height=Ai(C,R),pn.width=pi(C,R));var bt=ie(F,rt,{box:pn,align:"center-middle",style:{fill:Us(C,l,c,R.stroke)}});if(!ge){var qt=-1*pi(C,R);Fl(bt,0,-qt,270)}}return $e.get("participantMultiplicity")&&V("ParticipantMultiplicityMarker",F,C,R),J},"bpmn:ReceiveTask":function(F,C,R={}){R=Et(R,["fill","stroke"]);var J=Ee(C),ne=se(F,C,R),ge;return J.get("instantiate")?(h(F,28,28,20*.22,{fill:yt(C,s,R.fill),stroke:Ne(C,c,R.stroke),strokeWidth:1}),ge=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):ge=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),b(F,ge,{fill:yt(C,s,R.fill),stroke:Ne(C,c,R.stroke),strokeWidth:1}),ne},"bpmn:ScriptTask":function(F,C,R={}){R=Et(R,["fill","stroke"]);var J=se(F,C,R),ne=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return b(F,ne,{fill:yt(C,s,R.fill),stroke:Ne(C,c,R.stroke),strokeWidth:1}),J},"bpmn:SendTask":function(F,C,R={}){R=Et(R,["fill","stroke"]);var J=se(F,C,R),ne=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return b(F,ne,{fill:Ne(C,c,R.stroke),stroke:yt(C,s,R.fill),strokeWidth:1}),J},"bpmn:SequenceFlow":function(F,C,R={}){R=Et(R,["fill","stroke"]);var J=yt(C,s,R.fill),ne=Ne(C,c,R.stroke),ge=v(F,C.waypoints,{markerEnd:f(F,"sequenceflow-end",J,ne),stroke:ne}),$e=Ee(C),{source:rt}=C;if(rt){var pt=Ee(rt);$e.get("conditionExpression")&&T(pt,"bpmn:Activity")&&Le(ge,{markerStart:f(F,"conditional-flow-marker",J,ne)}),pt.get("default")&&(T(pt,"bpmn:Gateway")||T(pt,"bpmn:Activity"))&&pt.get("default")===$e&&Le(ge,{markerStart:f(F,"conditional-default-flow-marker",J,ne)})}return ge},"bpmn:ServiceTask":function(F,C,R={}){R=Et(R,["fill","stroke"]);var J=se(F,C,R);h(F,10,10,{fill:yt(C,s,R.fill),stroke:"none",transform:"translate(6, 6)"});var ne=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});b(F,ne,{fill:yt(C,s,R.fill),stroke:Ne(C,c,R.stroke),strokeWidth:1}),h(F,10,10,{fill:yt(C,s,R.fill),stroke:"none",transform:"translate(11, 10)"});var ge=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return b(F,ge,{fill:yt(C,s,R.fill),stroke:Ne(C,c,R.stroke),strokeWidth:1}),J},"bpmn:StartEvent":function(F,C,R={}){var{renderIcon:J=!0}=R;R=Et(R,["fill","stroke"]);var ne=Ee(C);ne.get("isInterrupting")||(R={...R,strokeDasharray:"6"});var ge=W(F,C,R);return J&&I(C,F,R),ge},"bpmn:SubProcess":function(F,C,R={}){return xt(C)?R=Et(R,["fill","stroke","width","height"]):R=Et(R,["fill","stroke"]),ee(F,C,R)},"bpmn:Task":function(F,C,R={}){return R=Et(R,["fill","stroke"]),se(F,C,R)},"bpmn:TextAnnotation":function(F,C,R={}){R=Et(R,["fill","stroke"]);var{width:J,height:ne}=qs(C,R),ge=y(F,J,ne,0,0,{fill:"none",stroke:"none"}),$e=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:J,containerHeight:ne,position:{mx:0,my:0}});b(F,$e,{stroke:Ne(C,c,R.stroke)});var rt=Ee(C),pt=rt.get("text")||"";return ie(F,pt,{align:"left-top",box:qs(C,R),padding:$a,style:{fill:Us(C,l,c,R.stroke)}}),ge},"bpmn:Transaction":function(F,C,R={}){xt(C)?R=Et(R,["fill","stroke","width","height"]):R=Et(R,["fill","stroke"]);var J=ee(F,C,{strokeWidth:1.5,...R}),ne=n.style(["no-fill","no-events"],{stroke:Ne(C,c,R.stroke),strokeWidth:1.5}),ge=xt(C);return ge||(R={}),y(F,Ai(C,R),pi(C,R),Vl-zl,zl,ne),J},"bpmn:UserTask":function(F,C,R={}){R=Et(R,["fill","stroke"]);var J=se(F,C,R),ne=15,ge=12,$e=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:ne,y:ge}});b(F,$e,{fill:yt(C,s,R.fill),stroke:Ne(C,c,R.stroke),strokeWidth:.5});var rt=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:ne,y:ge}});b(F,rt,{fill:yt(C,s,R.fill),stroke:Ne(C,c,R.stroke),strokeWidth:.5});var pt=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:ne,y:ge}});return b(F,pt,{fill:Ne(C,c,R.stroke),stroke:Ne(C,c,R.stroke),strokeWidth:.5}),J},label:function(F,C,R={}){return Y(F,C,R)}};this._drawPath=b,this._renderer=M}je(Zr,ko),Zr.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],Zr.prototype.canRender=function(e){return T(e,"bpmn:BaseElement")},Zr.prototype.drawShape=function(e,t,n={}){var{type:i}=t,o=this._renderer(i);return o(e,t,n)},Zr.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,o=this._renderer(i);return o(e,t,n)},Zr.prototype.getShapePath=function(e){return ft(e)?Mf(e,Z2):T(e,"bpmn:Event")?pb(e):T(e,"bpmn:Activity")?Mf(e,Vl):T(e,"bpmn:Gateway")?U2(e):q2(e)};function Et(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var eO=0,tO={width:150,height:50};function nO(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function iO(e){return Sn(e)?te({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var Cf=null;function oO(){return Cf||(Cf=document.createElement("canvas").getContext("2d")),Cf}function rO(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(db(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function db(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function aO(e,t){var n=oO();if(!n)return{width:0,height:0};n.font=rO(t),"letterSpacing"in n&&(n.letterSpacing=db(t.letterSpacing)||"0px");var i=e==="",o=i?"dummy":e.replace(/\s+$/,""),r=n.measureText(o);return{width:i?0:r.width,height:"fontBoundingBoxAscent"in r?r.fontBoundingBoxAscent+r.fontBoundingBoxDescent:r.actualBoundingBoxAscent+r.actualBoundingBoxDescent}}function sO(e,t,n){for(var i=e.shift(),o=i,r;;){if(r=aO(o,n),r.width=o?r.width:0,o===" "||o===""||r.width<Math.round(t)||o.length<2)return cO(e,o,i,r);o=uO(o,r.width,t)}}function cO(e,t,n,i){if(t.length<n.length){var o=n.slice(t.length).trim();e.unshift(o)}return{width:i.width,height:i.height,text:t}}var fb="­";function lO(e,t){var n=e.split(/(\s|-|\u00AD)/g),i,o=[],r=0;if(n.length>1)for(;i=n.shift();)if(i.length+r<t)o.push(i),r+=i.length;else{(i==="-"||i===fb)&&o.pop();break}var a=o[o.length-1];return a&&a===fb&&(o[o.length-1]="-"),o.join("")}function uO(e,t,n){var i=Math.max(e.length*(n/t),1),o=lO(e,i);return o||(o=e.slice(0,Math.max(Math.round(i-1),1))),o}function Wl(e){this._config=te({},{size:tO,padding:eO,style:{},align:"center-top"},e||{})}Wl.prototype.createText=function(e,t){return this.layoutText(e,t).element},Wl.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Wl.prototype.layoutText=function(e,t){for(var n=te({},this._config.size,t.box),i=te({},this._config.style,t.style),o=nO(t.align||this._config.align),r=iO(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=pO(i),c=e.split(/\u00AD?\r?\n/),l=[],u=n.width-r.left-r.right;c.length;)l.push(sO(c,u,i));o.vertical==="middle"&&(r.top=r.bottom=0);var p=ci(l,function(y,w,g){return y+(s||w.height)},0)+r.top+r.bottom,d=ci(l,function(y,w,g){return w.width>y?w.width:y},0),f=r.top;o.vertical==="middle"&&(f+=(n.height-p)/2),f-=(s||l[0].height)/4;var m=We("text");Le(m,i),K(l,function(y){var w;switch(f+=s||y.height,o.horizontal){case"left":w=r.left;break;case"right":w=(a?d:u)-r.right-y.width;break;default:w=Math.max(((a?d:u)-y.width)/2+r.left,0)}var g=We("tspan");Le(g,{x:w,y:f}),g.textContent=y.text,ot(m,g)});var h={width:d,height:p};return{dimensions:h,element:m}};function pO(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var dO=12,fO=1.2,hO=40;function hb(e){var t=te({fontFamily:"Arial, sans-serif",fontSize:dO,fontWeight:"normal",lineHeight:fO},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=te({},t,{fontSize:n},e&&e.externalStyle||{}),o=new Wl({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,Xr.width),height:30},l=r(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=r(s,a,{style:t,align:"left-top",padding:$a});return{x:a.x,y:a.y,width:a.width,height:Math.max(hO,Math.round(c.height))}},this.getDimensions=function(a,s){return o.getDimensions(a,s||{})};function r(a,s,c){return o.getDimensions(a,te({box:s},c))}this.createText=function(a,s){return o.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}hb.$inject=["config.textRenderer"];function gO(){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],o,r;n.abspos?(o=n.abspos.x,r=n.abspos.y):(o=n.containerWidth*n.position.mx,r=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=xO(i.d,{mx:o,my:r,e:a});return p}}var mO=/\{([^{}]+)\}/g,yO=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function vO(e,t,n){var i=n;return t.replace(yO,function(o,r,a,s,c){r=r||s,i&&(r in i&&(i=i[r]),typeof i=="function"&&c&&(i=i()))}),i=(i==null||i==n?e:i)+"",i}function xO(e,t){return String(e).replace(mO,function(n,i){return vO(n,i,t)})}const bO={__init__:["bpmnRenderer"],bpmnRenderer:["type",Zr],textRenderer:["type",hb],pathMap:["type",gO]};function wO(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const Ys={translate:["value",wO]};function Ul(e,t,n){return te({id:e.id,type:e.$type,businessObject:e,di:t},n)}function _O(e,t,n){var i=e.waypoint;return!i||i.length<2?[nt(t),nt(n)]:i.map(function(o){return{x:o.x,y:o.y}})}function gb(e,t,n){return new Error(`element ${Yn(t)} referenced by ${Yn(e)}#${n} not yet drawn`)}function Io(e,t,n,i,o){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=o}Io.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],Io.prototype.add=function(e,t,n){var i,o,r;if(T(t,"bpmndi:BPMNPlane")){var a=T(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(Ul(e,t,a)),this._canvas.addRootElement(i)}else if(T(t,"bpmndi:BPMNShape")){var s=!xt(e,t),c=SO(e);o=n&&(n.hidden||n.collapsed);var l=t.bounds;i=this._elementFactory.createShape(Ul(e,t,{collapsed:s,hidden:o,x:Math.round(l.x),y:Math.round(l.y),width:Math.round(l.width),height:Math.round(l.height),isFrame:c})),T(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),T(e,"bpmn:Lane")&&(r=0),T(e,"bpmn:DataStoreReference")&&(EO(n,nt(l))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,r)}else if(T(t,"bpmndi:BPMNEdge")){var u=this._getSource(e),p=this._getTarget(e);o=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(Ul(e,t,{hidden:o,source:u,target:p,waypoints:_O(t,u,p)})),T(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,r)}else throw new Error(`unknown di ${Yn(t)} for element ${Yn(e)}`);return fo(e)&&ii(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},Io.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${Yn(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),o=i&&i.attachers;if(!i)throw gb(e,n,"attachedToRef");t.host=i,o||(i.attachers=o=[]),o.indexOf(t)===-1&&o.push(t)},Io.prototype.addLabel=function(e,t,n){var i,o,r;return i=Sf(t,n),o=ii(n),o&&(i=this._textRenderer.getExternalLabelBounds(i,o)),r=this._elementFactory.createLabel(Ul(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!ii(n),x:Math.round(i.x),y:Math.round(i.y),width:Math.round(i.width),height:Math.round(i.height)})),this._canvas.addShape(r,n.parent)},Io.prototype._getConnectedElement=function(e,t){var n,i,o=e.$type;if(i=e[t+"Ref"],t==="source"&&o==="bpmn:DataInputAssociation"&&(i=i&&i[0]),(t==="source"&&o==="bpmn:DataOutputAssociation"||t==="target"&&o==="bpmn:DataInputAssociation")&&(i=e.$parent),n=i&&this._getElement(i),n)return n;throw i?gb(e,i,t+"Ref"):new Error(`${Yn(e)}#${t} Ref not specified`)},Io.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},Io.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},Io.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function EO(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 SO(e){return T(e,"bpmn:Group")}const mb={__depends__:[bO,{__depends__:[Ys],bpmnImporter:["type",Io]}]};function Ks(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Qi(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Af(e){return Math.log(e)/Math.log(10)}var RO=1e3;function we(e){this._eventBus=e}we.$inject=["eventBus"];function MO(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}we.prototype.on=function(e,t,n,i,o,r){if((An(t)||tt(t))&&(r=o,o=i,i=n,n=t,t=null),An(n)&&(r=o,o=i,i=n,n=RO),Sn(o)&&(r=o,o=!1),!An(i))throw new Error("handlerFn must be a function");et(e)||(e=[e]);var a=this._eventBus;K(e,function(s){var c=["commandStack",s,t].filter(function(l){return l}).join(".");a.on(c,n,o?MO(i,r):i,r)})},we.prototype.canExecute=Bo("canExecute"),we.prototype.preExecute=Bo("preExecute"),we.prototype.preExecuted=Bo("preExecuted"),we.prototype.execute=Bo("execute"),we.prototype.executed=Bo("executed"),we.prototype.postExecute=Bo("postExecute"),we.prototype.postExecuted=Bo("postExecuted"),we.prototype.revert=Bo("revert"),we.prototype.reverted=Bo("reverted");function Bo(e){return function(n,i,o,r,a){(An(n)||tt(n))&&(a=r,r=o,o=i,i=n,n=null),this.on(n,e,i,o,r,a)}}var Tf=["top","bottom","left","right"],ql=10;function Pf(e,t){we.call(this,e),this.postExecuted(["connection.create","connection.layout","connection.updateWaypoints"],function(o){var r=o.context,a=r.connection,s=a.source,c=a.target,l=r.hints||{};l.createElementsBehavior!==!1&&(n(s),n(c))}),this.postExecuted(["label.create"],function(o){var r=o.context,a=r.shape,s=r.hints||{};s.createElementsBehavior!==!1&&n(a.labelTarget)}),this.postExecuted(["elements.create"],function(o){var r=o.context,a=r.elements,s=r.hints||{};s.createElementsBehavior!==!1&&a.forEach(function(c){n(c)})});function n(o){if(Gl(o)&&!$t(o)){var r=TO(o);r&&i(o,r)}}function i(o,r){var a=nt(o),s=o.label,c=nt(s);if(s.parent){var l=Ze(o),u;switch(r){case"top":u={x:a.x,y:l.top-ql-s.height/2};break;case"left":u={x:l.left-ql-s.width/2,y:a.y};break;case"bottom":u={x:a.x,y:l.bottom+ql+s.height/2};break;case"right":u={x:l.right+ql+s.width/2,y:a.y};break}var p=Qi(u,c);t.moveShape(s,p)}}}je(Pf,we),Pf.$inject=["eventBus","modeling"];function CO(e){var t=e.host,n=nt(e),i=$n(n,t),o;i.indexOf("-")>=0?o=i.split("-"):o=[i];var r=Tf.filter(function(a){return o.indexOf(a)===-1});return r}function AO(e){var t=nt(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 yb(t,i)});return n}function TO(e){var t=nt(e.label),n=nt(e),i=yb(n,t);if(PO(i)){var o=AO(e);if(e.host){var r=CO(e);o=o.concat(r)}var a=Tf.filter(function(s){return o.indexOf(s)===-1});return a.indexOf(i)!==-1?$n(e.label,e)!=="intersect"?void 0:i:a[0]}}function yb(e,t){return $n(t,e,5)}function PO(e){return Tf.indexOf(e)!==-1}function kf(e){we.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,i=t.shape;t.position||(T(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)}je(kf,we),kf.$inject=["eventBus"];var kO=1500;function Of(e,t,n){e.invoke(we,this),this.preExecute("elements.delete",kO,function(o){var r=o.context,a=r.elements,s=i(a);s.length&&(r.elements=a.concat(s))}),t.on("shape.move.start",function(o){var r=o.context.shapes,a=i(r);a.length&&(o.context.shapes=r.concat(a))});function i(o){var r=gt(o,l=>T(l,"bpmn:Participant")||T(l,"bpmn:SubProcess"));if(!r.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(l=>T(l,"bpmn:Artifact"))),c=new Set;return K(r,l=>{const u=new Set(ba(La(Array.from(s),yn(l))));c=c.union(u),s=s.difference(u)}),Array.from(c)}}je(Of,we),Of.$inject=["injector","eventBus","canvas"];function Df(e,t){e.invoke(we,this),this.postExecute("shape.move",function(n){var i=n.newParent,o=n.shape,r=gt(o.incoming.concat(o.outgoing),function(a){return T(a,"bpmn:Association")});K(r,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}je(Df,we),Df.$inject=["injector","modeling"];function ja(e,t){for(ai(t)&&(t=[t]);e=e.parent;)if(ht(e,t))return e;return null}function vb(e,t){var n=ja(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=ja(e,i),n)return Tn(n);if(ht(e,i))return Tn(e);var o;for(o=Ee(e);o&&!T(o,"bpmn:Process");o=o.$parent);if(!t)return!0;var r=t.find(function(a){var s=Ee(a);return s&&s.get("processRef")===o});return r?Tn(r):!0}var xb=500;function Yl(e,t){t.invoke(we,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",xb,function(i){var o=i.elements;o=o.filter(function(r){var a=r.host;return bb(r,a)}),o.length===1&&o.map(function(r){return o.indexOf(r)}).forEach(function(r){var a=o[r];i.elements[r]=n._replaceShape(o[r],a)})},!0),this.preExecute("elements.move",xb,function(i){var o=i.shapes,r=i.newHost;if(o.length===1){var a=o[0];bb(a,r)&&(i.shapes=[n._replaceShape(a,r)])}},!0)}Yl.$inject=["bpmnReplace","injector"],je(Yl,we),Yl.prototype._replaceShape=function(e,t){var n=OO(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function OO(e){var t=Ee(e),n=t.eventDefinitions;return n&&n[0]}function bb(e,t){return!ft(e)&&ht(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function Lf(e,t){we.call(this,e);function n(i){return gt(i.attachers,function(o){return T(o,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var o=i.context.source,r=i.context.target,a=n(r);T(o,"bpmn:EventBasedGateway")&&T(r,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var o=i.context.oldSource,r=i.context.newSource;T(o,"bpmn:Gateway")&&T(r,"bpmn:EventBasedGateway")&&K(r.outgoing,function(a){var s=a.target,c=n(s);T(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}Lf.$inject=["eventBus","modeling"],je(Lf,we);function wb(e){return e.create("bpmn:Category")}function DO(e){return e.create("bpmn:CategoryValue")}function _b(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=DO(e)),n.$parent||(n.$parent=wb(e)),n}function LO(e,t,n){return un(t.get("categoryValue"),e),e.$parent=t,un(n.get("rootElements"),t),t.$parent=n,e}function IO(e){var t=e.$parent;return t&&(an(t.get("categoryValue"),e),e.$parent=null),e}function BO(e){var t=e.$parent;return t&&(an(t.get("rootElements"),e),e.$parent=null),e}var NO=500;function If(e,t,n){n.invoke(we,this);function i(c){return t.filter(function(l){return T(l,"bpmn:Group")&&!l.labelTarget}).map(Ee).filter(function(l){return l!==c})}function o(c,l){return i(l).some(function(u){return u.get("categoryValueRef")===c})}function r(c,l){return i(l).some(function(u){var p=u.get("categoryValueRef");return p&&p.$parent===c})}function a(c,l){c&&l&&LO(c,l,e.getDefinitions())}function s(c,l,u){l&&!r(l,u)&&BO(l),c&&!o(c,u)&&IO(c)}this.executed(["shape.create","label.create"],function(c){var l=c.labelTarget||c.shape;!T(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;!T(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,Ee(l))},!0),this.executed(["shape.move","shape.resize"],NO,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,Ee(l))},!0),this.executed("group.updateRefs",function(c){Eb(c).forEach(function(l){a(l.categoryValue,l.category)})},!0),this.reverted("group.updateRefs",function(c){Eb(c).forEach(function(l){s(l.categoryValue,l.category,Ee(l.groupShape))})},!0),this.executed("shape.delete",function(c){var l=c.shape;!T(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,Ee(l))},!0),this.reverted("shape.delete",function(c){var l=c.shape;!T(l,"bpmn:Group")||l.labelTarget||a(c.categoryValue,c.category)},!0)}If.$inject=["bpmnjs","elementRegistry","injector"],je(If,we);function Eb(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function Bf(e,t,n){we.call(this,e),this.preExecute("shape.replace",s,!0),this.postExecuted("shape.replace",c,!0),this.preExecute("connection.create",o,!0),this.postExecuted("connection.delete",i,!0),this.postExecuted("connection.reconnect",r,!0),this.postExecuted("element.updateProperties",a,!0);function i(y){const w=y.source,g=y.target;Ha(w)&&Xs(g)&&u(g)}function o(y){const w=y.connection,g=y.source,v=y.target;Ha(g)&&Kl(v)&&(l(v),d(g,[w]))}function r(y){const w=y.newTarget,g=y.oldSource,v=y.oldTarget;if(v!==w){const b=g;Xs(v)&&u(v),Ha(b)&&Kl(w)&&l(w)}}function a(y){const{element:w}=y;Xs(w)?(p(w),f(w)):Kl(w)&&m(w)}function s(y){const{newData:w,oldShape:g}=y;if(Ha(y.oldShape)&&w.eventDefinitionType!=="bpmn:CompensateEventDefinition"||w.type!=="bpmn:BoundaryEvent"){const v=g.outgoing.find(({target:b})=>Xs(b));v&&v.target&&(y._connectionTarget=v.target)}else if(!Ha(y.oldShape)&&w.eventDefinitionType==="bpmn:CompensateEventDefinition"&&w.type==="bpmn:BoundaryEvent"){const v=g.outgoing.find(({target:b})=>Kl(b));v&&v.target&&(y._connectionTarget=v.target),h(g)}}function c(y){const{_connectionTarget:w,newShape:g}=y;w&&t.connect(g,w)}function l(y){t.updateProperties(y,{isForCompensation:!0})}function u(y){t.updateProperties(y,{isForCompensation:void 0})}function p(y){for(const w of y.incoming)n.canConnect(w.source,y)||t.removeConnection(w);for(const w of y.outgoing)n.canConnect(y,w.target)||t.removeConnection(w)}function d(y,w){y.outgoing.filter(b=>T(b,"bpmn:Association")).filter(b=>Xs(b.target)&&!w.includes(b)).forEach(b=>t.removeConnection(b))}function f(y){const w=y.attachers.slice();w.length&&t.removeElements(w)}function m(y){const w=y.incoming.filter(g=>Ha(g.source));t.removeElements(w)}function h(y){const w=y.outgoing.filter(g=>T(g,"bpmn:SequenceFlow"));t.removeElements(w)}}je(Bf,we),Bf.$inject=["eventBus","modeling","bpmnRules"];function Xs(e){const t=Ee(e);return t&&t.get("isForCompensation")}function Ha(e){return e&&T(e,"bpmn:BoundaryEvent")&&Na(e,"bpmn:CompensateEventDefinition")}function Kl(e){return e&&T(e,"bpmn:Activity")&&!Kn(e)}function Nf(e){e.invoke(we,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,o=n.shape;T(i,"bpmn:Lane")&&!T(o,"bpmn:Lane")&&(n.parent=ja(i,"bpmn:Participant"))})}Nf.$inject=["injector"],je(Nf,we);function $f(e,t){we.call(this,e),this.preExecute("shape.create",function(n){var a;var i=n.context,o=i.shape;if(T(o,"bpmn:DataObjectReference")&&o.type!=="label"){var r=t.create("bpmn:DataObject");r.isCollection=((a=o.businessObject.dataObjectRef)==null?void 0:a.isCollection)||!1,o.businessObject.dataObjectRef=r}})}$f.$inject=["eventBus","bpmnFactory"],je($f,we);var Ff=20,jf=20,Sb=30,Xl=2e3;function Hf(e,t,n){we.call(this,t),t.on(["create.start","shape.move.start"],Xl,function(o){var r=o.context,a=r.shape,s=e.getRootElement();if(!(!T(a,"bpmn:Participant")||!T(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(p){return!T(p,"bpmn:Group")&&!ft(p)&&!$t(p)});if(c.length){var l=yn(c),u=$O(a,l);te(a,u),r.createConstraints=FO(a,l)}}}),t.on("create.start",Xl,function(o){var r=o.context,a=r.shape,s=e.getRootElement(),c=e.getGraphics(s);function l(u){u.element=s,u.gfx=c}T(a,"bpmn:Participant")&&T(s,"bpmn:Process")&&(t.on("element.hover",Xl,l),t.once("create.cleanup",function(){t.off("element.hover",l)}))});function i(){var o=e.getRootElement();return T(o,"bpmn:Collaboration")?o:n.makeCollaboration()}this.preExecute("elements.create",Xl,function(o){var r=o.elements,a=o.parent,s=jO(r),c;s&&T(a,"bpmn:Process")&&(o.parent=i(),c=o.hints=o.hints||{},c.participant=s,c.process=a,c.processRef=Ee(s).get("processRef"))},!0),this.preExecute("shape.create",function(o){var r=o.parent,a=o.shape;T(a,"bpmn:Participant")&&T(r,"bpmn:Process")&&(o.parent=i(),o.process=r,o.processRef=Ee(a).get("processRef"))},!0),this.execute("shape.create",function(o){var r=o.hints||{},a=o.process||r.process,s=o.shape,c=r.participant;a&&(!c||s===c)&&Ee(s).set("processRef",Ee(a))},!0),this.revert("shape.create",function(o){var r=o.hints||{},a=o.process||r.process,s=o.processRef||r.processRef,c=o.shape,l=r.participant;a&&(!l||c===l)&&Ee(c).set("processRef",s)},!0),this.postExecute("shape.create",function(o){var r=o.hints||{},a=o.process||o.hints.process,s=o.shape,c=r.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)}Hf.$inject=["canvas","eventBus","modeling"],je(Hf,we);function $O(e,t){t={width:t.width+Ff*2+Sb,height:t.height+jf*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 FO(e,t){return t=Ze(t),{bottom:t.top+e.height/2-jf,left:t.right-e.width/2+Ff,top:t.bottom-e.height/2+jf,right:t.left+e.width/2-Ff-Sb}}function jO(e){return Ht(e,function(t){return T(t,"bpmn:Participant")})}var Rb="__targetRef_placeholder";function Gf(e,t){we.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],Mb(r)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],Mb(r));function n(a,s,c){var l=a.get("dataInputAssociations");return Ht(l,function(u){return u!==c&&u.targetRef===s})}function i(a,s){var c=a.get("properties"),l=Ht(c,function(u){return u.name===Rb});return!l&&s&&(l=t.create("bpmn:Property",{name:Rb}),un(c,l)),l}function o(a,s){var c=i(a);c&&(n(a,c,s)||an(a.get("properties"),c))}function r(a){var s=a.context,c=s.connection,l=c.businessObject,u=c.target,p=u&&u.businessObject,d=s.newTarget,f=d&&d.businessObject,m=s.oldTarget||s.target,h=m&&m.businessObject,y=c.businessObject,w;h&&h!==p&&o(h,l),f&&f!==p&&o(f,l),p?(w=i(p,!0),y.targetRef=w):y.targetRef=null}}Gf.$inject=["eventBus","bpmnFactory"],je(Gf,we);function Mb(e){return function(t){var n=t.context,i=n.connection;if(T(i,"bpmn:DataInputAssociation"))return e(t)}}function Zl(e){this._bpmnUpdater=e}Zl.$inject=["bpmnUpdater"],Zl.prototype.execute=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.newSemanticParent,o=e.newDiParent;return e.oldSemanticParent=t.$parent,e.oldDiParent=n.$parent,this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,o),[]},Zl.prototype.revert=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.oldSemanticParent,o=e.oldDiParent;return this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,o),[]};function zf(e,t,n,i){we.call(this,i),t.registerHandler("dataStore.updateContainment",Zl);function o(){return n.filter(function(s){return T(s,"bpmn:Participant")&&Ee(s).processRef})[0]}function r(s){return s.children.filter(function(c){return T(c,"bpmn:DataStoreReference")&&!c.labelTarget})}function a(s,c){var l=s.businessObject||s;if(c=c||o(),c){var u=c.businessObject||c;t.execute("dataStore.updateContainment",{dataStoreBo:l,dataStoreDi:wt(s),newSemanticParent:u.processRef||u,newDiParent:wt(c)})}}this.preExecute("shape.create",function(s){var c=s.context,l=c.shape;T(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 T(p,"bpmn:DataStoreReference")});u.length&&(c.hints||(c.hints={}),c.hints.autoResize=l.filter(function(p){return!T(p,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,l=c.shape,u=l.parent;T(l,"bpmn:DataStoreReference")&&l.type!=="label"&&T(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(!T(u,"bpmn:Collaboration")&&T(l,"bpmn:DataStoreReference")&&l.type!=="label"&&T(p,"bpmn:Collaboration")){var d=T(u,"bpmn:Participant")?u:GO(u,"bpmn:Participant");a(l,d)}}),this.postExecute("shape.delete",function(s){var c=s.context,l=c.shape,u=e.getRootElement();ht(l,["bpmn:Participant","bpmn:SubProcess"])&&T(u,"bpmn:Collaboration")&&r(u).filter(function(p){return HO(p,l)}).forEach(function(p){a(p)})}),this.postExecute("canvas.updateRoot",function(s){var c=s.context,l=c.oldRoot,u=c.newRoot,p=r(l);p.forEach(function(d){T(u,"bpmn:Process")&&a(d,u)})})}zf.$inject=["canvas","commandStack","elementRegistry","eventBus"],je(zf,we);function HO(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 GO(e,t){for(;e.parent;){if(T(e.parent,t))return e.parent;e=e.parent}}var Jl=Math.max,Ql=Math.min,zO=20;function Cb(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function VO(e,t,n){var i=n.x,o=n.y,r={x:e.x,y:e.y,width:e.width,height:e.height};return t.indexOf("n")!==-1?(r.y=e.y+o,r.height=e.height-o):t.indexOf("s")!==-1&&(r.height=e.height+o),t.indexOf("e")!==-1?r.width=e.width+i:t.indexOf("w")!==-1&&(r.x=e.x+i,r.width=e.width-i),r}function WO(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 eu(e,t,n){var i=t[e],o=n.min&&n.min[e],r=n.max&&n.max[e];return tt(o)&&(i=(/top|left/.test(e)?Ql:Jl)(i,o)),tt(r)&&(i=(/top|left/.test(e)?Jl:Ql)(i,r)),i}function UO(e,t){if(!t)return e;var n=Ze(e);return Bl({top:eu("top",n,t),right:eu("right",n,t),bottom:eu("bottom",n,t),left:eu("left",n,t)})}function qO(e,t,n,i){var o=Ze(t),r={top:/n/.test(e)?o.bottom-n.height:o.top,left:/w/.test(e)?o.right-n.width:o.left,bottom:/s/.test(e)?o.top+n.height:o.bottom,right:/e/.test(e)?o.left+n.width:o.right},a=i?Ze(i):r,s={top:Ql(r.top,a.top),left:Ql(r.left,a.left),bottom:Jl(r.bottom,a.bottom),right:Jl(r.right,a.right)};return Bl(s)}function Zs(e,t){return typeof e<"u"?e:zO}function YO(e,t){var n,i,o,r;return typeof t=="object"?(n=Zs(t.left),i=Zs(t.right),o=Zs(t.top),r=Zs(t.bottom)):n=i=o=r=Zs(t),{x:e.x-n,y:e.y-o,width:e.width+n+i,height:e.height+o+r}}function KO(e){return!(e.waypoints||e.type==="label")}function Ab(e,t){var n;if(e.length===void 0?n=gt(e.children,KO):n=e,n.length)return YO(yn(n),t)}var gr=Math.abs;function XO(e,t){return Cb(Ze(t),Ze(e))}var ZO=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Ti=30;function tu(e,t){return t=t||[],e.children.filter(function(n){T(n,"bpmn:Lane")&&(tu(n,t),t.push(n))}),t}function mr(e){return e.children.filter(function(t){return T(t,"bpmn:Lane")})}function Pi(e){return ja(e,ZO)||e}function JO(e,t){var n=Pi(e),i=T(n,"bpmn:Process")?[]:[n],o=tu(n,i),r=Ze(e),a=Ze(t),s=XO(e,t),c=[],l=Tn(e);return o.forEach(function(u){if(u!==e){var p=l?0:s.top,d=l?s.right:0,f=l?0:s.bottom,m=l?s.left:0,h=Ze(u);s.top&&(gr(h.bottom-r.top)<10&&(f=a.top-h.bottom),gr(h.top-r.top)<5&&(p=a.top-h.top)),s.left&&(gr(h.right-r.left)<10&&(d=a.left-h.right),gr(h.left-r.left)<5&&(m=a.left-h.left)),s.bottom&&(gr(h.top-r.bottom)<10&&(p=a.bottom-h.top),gr(h.bottom-r.bottom)<5&&(f=a.bottom-h.bottom)),s.right&&(gr(h.left-r.right)<10&&(m=a.right-h.left),gr(h.right-r.right)<5&&(d=a.right-h.right)),(p||d||f||m)&&c.push({shape:u,newBounds:WO(u,{top:p,right:d,bottom:f,left:m})})}}),c}var QO=500;function Vf(e,t){we.call(this,e);function n(i,o){var r=Tn(i),a=mr(o),s=[],c=[],l=[],u=[];if(Yr(a,function(y){return r?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;r?c.length&&s.length?p=i.height/2:p=i.height:u.length&&l.length?p=i.width/2:p=i.width;var d,f,m,h;s.length&&(d=t.calculateAdjustments(s,"y",p,i.y-10),t.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:p},"s")),c.length&&(f=t.calculateAdjustments(c,"y",-p,i.y+i.height+10),t.makeSpace(f.movingShapes,f.resizingShapes,{x:0,y:-p},"n")),l.length&&(m=t.calculateAdjustments(l,"x",p,i.x-10),t.makeSpace(m.movingShapes,m.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",QO,function(i){var o=i.context,r=o.hints,a=o.shape,s=o.oldParent;T(a,"bpmn:Lane")&&(r&&r.nested||n(a,s))})}Vf.$inject=["eventBus","spaceTool"],je(Vf,we);var Tb=500;function nu(e,t){t.invoke(we,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Tb,function(i){var o=i.elements;o.filter(function(r){var a=r.host;return Pb(r,a)}).map(function(r){return o.indexOf(r)}).forEach(function(r){i.elements[r]=n._replaceShape(o[r])})},!0),this.preExecute("elements.move",Tb,function(i){var o=i.shapes,r=i.newHost;o.forEach(function(a,s){var c=a.host;Pb(a,tD(o,c)?c:r)&&(o[s]=n._replaceShape(a))})},!0)}nu.$inject=["bpmnReplace","injector"],je(nu,we),nu.prototype._replaceShape=function(e){var t=eD(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function eD(e){var t=Ee(e),n=t.eventDefinitions;return n&&n[0]}function Pb(e,t){return!ft(e)&&T(e,"bpmn:BoundaryEvent")&&!t}function tD(e,t){return e.indexOf(t)!==-1}var iu=Math.round,nD=Math.max;function iD(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 oD(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var kb=10;function rD(e,t){var n,i;for(n=0;i=e[n];n++)if(Hs(i,t)<=kb)return{point:e[n],bendpoint:!0,index:n};return null}function aD(e,t){var n=Ix(iD(t,kb),oD(e)),i=n[0],o=n[n.length-1],r;return i?i!==o?i.segment2!==o.segment2?(r=nD(i.segment2,o.segment2)-1,{point:e[r],bendpoint:!0,index:r}):{point:{x:iu(i.x+o.x)/2,y:iu(i.y+o.y)/2},index:i.segment2}:{point:{x:iu(i.x),y:iu(i.y)},index:i.segment2}:null}function Wf(e,t){return rD(e,t)||aD(e,t)}function Uf(e,t,n){we.call(this,e);function i(o,r,a){var s=r.waypoints,c,l,u,p,d,f,m,h=o.outgoing.slice(),y=o.incoming.slice(),w;tt(a.width)?w=nt(a):w=a;var g=Wf(s,w);if(g){if(c=s.slice(0,g.index),l=s.slice(g.index+(g.bendpoint?1:0)),!c.length||!l.length)return;u=g.bendpoint?s[g.index]:w,(c.length===1||!Ob(o,c[c.length-1]))&&c.push(Db(u)),(l.length===1||!Ob(o,l[0]))&&l.unshift(Db(u))}p=r.source,d=r.target,t.canConnect(p,o,r)&&(n.reconnectEnd(r,o,c||w),f=r),t.canConnect(o,d,r)&&(f?m=n.connect(o,d,{type:r.type,waypoints:l}):(n.reconnectStart(r,o,l||w),m=r));var v=[].concat(f&&gt(y,function(b){return b.source===f.source})||[],m&&gt(h,function(b){return b.target===m.target})||[]);v.length&&n.removeElements(v)}this.preExecute("elements.move",function(o){var r=o.newParent,a=o.shapes,s=o.delta,c=a[0];if(!(!c||!r)){r&&r.waypoints&&(o.newParent=r=r.parent);var l=nt(c),u={x:l.x+s.x,y:l.y+s.y},p=Ht(r.children,function(d){var f=t.canInsert(a,d);return f&&Wf(d.waypoints,u)});p&&(o.targetFlow=p,o.position=u)}},!0),this.postExecuted("elements.move",function(o){var r=o.shapes,a=o.targetFlow,s=o.position;a&&i(r[0],a,s)},!0),this.preExecute("shape.create",function(o){var r=o.parent,a=o.shape;t.canInsert(a,r)&&(o.targetFlow=r,o.parent=r.parent)},!0),this.postExecuted("shape.create",function(o){var r=o.shape,a=o.targetFlow,s=o.position;a&&i(r,a,s)},!0)}je(Uf,we),Uf.$inject=["eventBus","bpmnRules","modeling"];function Ob(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 Db(e){return te({},e)}function qf(e,t){we.call(this,e),this.preExecuted("connection.create",function(n){var i=n.context,o=i.connection,r=i.source,a=i.target,s=i.hints;if(!(s&&s.createElementsBehavior===!1)&&Ga(o)){var c=[];T(r,"bpmn:EventBasedGateway")?c=a.incoming.filter(l=>l!==o&&Ga(l)):c=a.incoming.filter(l=>l!==o&&Ga(l)&&T(l.source,"bpmn:EventBasedGateway")),c.forEach(function(l){t.removeConnection(l)})}}),this.preExecuted("shape.replace",function(n){var i=n.context,o=i.newShape;if(T(o,"bpmn:EventBasedGateway")){var r=o.outgoing.filter(Ga).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);r.forEach(function(a){a.incoming.filter(Ga).forEach(function(s){const c=a.incoming.filter(Ga).filter(function(l){return l.source===o});(s.source!==o||c.length>1)&&t.removeConnection(s)})})}})}qf.$inject=["eventBus","modeling"],je(qf,we);function Ga(e){return T(e,"bpmn:SequenceFlow")}var ou=1500,Lb=2e3;function Ib(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"],ou,function(i){var o=i.context,r=o.shape||i.shape,a=i.hover;T(a,"bpmn:Lane")&&!ht(r,["bpmn:Lane","bpmn:Participant"])&&(i.hover=Pi(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(r.labelTarget||ht(r,["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"],ou,function(i){var o=i.hover;T(o,"bpmn:Lane")&&(i.hover=Pi(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],ou,function(i){var o=i.context,r=i.hover,a=o.type;T(r,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=Pi(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],ou,function(i){var o=i.context,r=o.start;T(r,"bpmn:Lane")&&(o.start=Pi(r)||r)}),t.on("shape.move.start",Lb,function(i){var o=i.shape;T(o,"bpmn:Lane")&&(i.shape=Pi(o)||o)}),t.on("spaceTool.move",Lb,function(i){var o=i.hover;o&&T(o,"bpmn:Lane")&&(i.hover=Pi(o))})}Ib.$inject=["elementRegistry","eventBus","canvas"];var Bb=770;function Yf(e,t,n,i){n.invoke(we,this);function o(s,c){var l=Ee(s),u=c.categoryValue||l.categoryValueRef;u||(u=_b(e,l));var p=c.category||u.$parent||wb(e);l.categoryValueRef=u,u.$parent=p,c.categoryValue=u,c.category=p}function r(s,c){var l=Ee(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;T(l,"bpmn:Group")&&o(l,c)}),this.revert("label.create",function(s){var c=s.context,l=c.labelTarget;T(l,"bpmn:Group")&&r(l,c)}),this.execute("shape.delete",function(s){var c=s.context,l=c.shape,u=Ee(l);if(!(!T(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(!(!T(l,"bpmn:Group")||l.labelTarget)){var u=c.category,p=c.categoryValue,d=Ee(l);p&&(d.categoryValueRef=p,p.$parent=u)}}),this.execute("shape.create",function(s){var c=s.context,l=c.shape,u=c.hints||{};!T(l,"bpmn:Group")||l.labelTarget||u.createElementsBehavior===!1&&!Ee(l).categoryValueRef&&!c.categoryValue||o(l,c)}),this.reverted("shape.create",function(s){var c=s.context,l=c.shape,u=c.hints||{};!T(l,"bpmn:Group")||l.labelTarget||u.createElementsBehavior===!1&&!Ee(l).categoryValueRef&&!c.categoryValue||r(l,c)}),this.executed(["shape.move","shape.resize"],function(s){var c=s.context,l=c.shape;!T(l,"bpmn:Group")||l.labelTarget||Ee(l).categoryValueRef||o(l,c)}),this.reverted(["shape.move","shape.resize"],function(s){var c=s.context,l=c.shape;!T(l,"bpmn:Group")||l.labelTarget||!c.categoryValue||r(l,c)});function a(s,c){var l=e.create(s.$type);return i.copyElement(s,l,null,c)}t.on("copyPaste.copyElement",Bb,function(s){var c=s.descriptor,l=s.element;if(!(!T(l,"bpmn:Group")||l.labelTarget)){var u=Ee(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",Bb,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})}Yf.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],je(Yf,we);function Kf(e,t,n,i){var o,r,a,s,c;return o=(i.y-n.y)*(t.x-e.x)-(i.x-n.x)*(t.y-e.y),o==0?null:(r=e.y-n.y,a=e.x-n.x,c=(i.x-n.x)*r-(i.y-n.y)*a,s=c/o,{x:Math.round(e.x+s*(t.x-e.x)),y:Math.round(e.y+s*(t.y-e.y))})}function Nb(e){function t(i,o,r){var a={x:r.x,y:r.y-50},s={x:r.x-50,y:r.y},c=Kf(i,o,r,a),l=Kf(i,o,r,s),u;c&&l?$b(c,r)>$b(l,r)?u=l:u=c:u=c||l,i.original=u}function n(i){var o=i.waypoints;t(o[0],o[1],nt(i.source)),t(o[o.length-1],o[o.length-2],nt(i.target))}e.on("bpmnElement.added",function(i){var o=i.element;o.waypoints&&n(o)})}Nb.$inject=["eventBus"];function $b(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Xf(e){we.call(this,e);var t=["bpmn:Participant","bpmn:Lane"];this.executed(["shape.move","shape.create","shape.resize"],function(n){var i=n.context.shape,o=Ee(i),r=wt(i);if(ht(o,t)){var a=r.get("isHorizontal");a===void 0&&(a=!0),r.set("isHorizontal",a)}})}Xf.$inject=["eventBus"],je(Xf,we);function Fb(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function jb(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function sD(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 cD(e,t,n){var i=[{n:e[0]-n[0],lambda:t[0]},{n:e[1]-n[1],lambda:t[1]}],o=i[0].n*t[0]+i[1].n*t[1],r=i[0].lambda*t[0]+i[1].lambda*t[1];return-o/r}function Zf(e,t){var n=t[0],i=t[1],o={x:i.x-n.x,y:i.y-n.y},r=cD([n.x,n.y],[o.x,o.y],[e.x,e.y]);return{x:n.x+r*o.x,y:n.y+r*o.y}}function Hb(e,t){var n=Zf(e,t),i={x:n.x-e.x,y:n.y-e.y};return Fb(i)}function Js(e,t){return Fb({x:e.x-t.x,y:e.y-t.y})}var Gb=Math.sqrt,zb=Math.min,lD=Math.max,Vb=Math.abs;function Wb(e){return Math.pow(e,2)}function Qs(e,t){return Gb(Wb(e.x-t.x)+Wb(e.y-t.y))}function uD(e,t){var n=0,i,o,r,a,s,c,l,u,p,d,f;for(n=0;n<t.length-1;n++){if(i=t[n],o=t[n+1],qb(i,o)?l=[i]:(r=Qs(e,i),a=Qs(e,o),c=zb(r,a),l=pD(i,o,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:qb(i,l[0])?n:n+1}),l.length===2&&(s=fD(l[0],l[1]),u={type:"segment",position:s,segmentIndex:n,relativeLocation:Qs(i,s)/Qs(i,o)}),p=Qs(u.position,e),(!f||d>p)&&(f=u,d=p)}return f}function pD(e,t,n,i){var o=t.x-e.x,r=t.y-e.y,a=n.x-e.x,s=n.y-e.y,c=o*o+r*r,l=o*a+r*s,u=a*a+s*s-i*i,p=l/c,d=u/c,f=p*p-d;if(f<0&&f>-1e-6&&(f=0),f<0)return[];var m=Gb(f),h=-p+m,y=-p-m,w={x:e.x-o*h,y:e.y-r*h};if(f===0)return[w];var g={x:e.x-o*y,y:e.y-r*y};return[w,g].filter(function(v){return dD(v,e,t)})}function dD(e,t,n){return Ub(e.x,t.x,n.x)&&Ub(e.y,t.y,n.y)}function Ub(e,t,n){return e>=zb(t,n)-ru&&e<=lD(t,n)+ru}function fD(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var ru=.1;function qb(e,t){return Vb(e.x-t.x)<=ru&&Vb(e.y-t.y)<=ru}function hD(e,t,n,i){var o=n.segmentIndex,r=t.length-e.length;if(i.segmentMove){var a=i.segmentMove.segmentStartIndex,s=i.segmentMove.newSegmentStartIndex;return o===a?s:o>=s?o+r<s?s:o+r:o}if(i.bendpointMove){var c=i.bendpointMove.insert,l=i.bendpointMove.bendpointIndex,u;if(r===0)return o;if(o>=l&&(u=c?o+1:o-1),o<l&&(u=o,c&&n.type!=="bendpoint"&&l-1===o)){var p=Kb(t,l);p<n.relativeLocation&&u++}return u}return r===0?o:i.connectionStart&&o===0?0:i.connectionEnd&&o===e.length-2?t.length-2:Math.floor((t.length-2)/2)}function Yb(e,t,n,i){var o=0,r=0,a={point:e,delta:{x:0,y:0}},s=uD(e,n),c=s.segmentIndex,l=hD(n,t,s,i);if(l<0||l>t.length-2||l===null)return a;var u=Xb(n,c),p=Xb(t,l),d=s.position,f=mD(u,d),m=gD(u,p);if(s.type==="bendpoint"){var h=t.length-n.length,y=s.bendpointIndex,w=n[y];if(t.indexOf(w)!==-1)return a;if(h===0){var g=t[y];return o=g.x-s.position.x,r=g.y-s.position.y,{delta:{x:o,y:r},point:{x:e.x+o,y:e.y+r}}}h<0&&y!==0&&y<n.length-1&&(f=Kb(n,y))}var v={x:(p[1].x-p[0].x)*f+p[0].x,y:(p[1].y-p[0].y)*f+p[0].y},b=sD({x:e.x-d.x,y:e.y-d.y},m);return o=v.x+b.x-e.x,r=v.y+b.y-e.y,{point:Do(v),delta:Do({x:o,y:r})}}function Kb(e,t){var n=Js(e[t-1],e[t]),i=Js(e[t],e[t+1]),o=n/(n+i);return o}function gD(e,t){var n=jb(e),i=jb(t);return i-n}function Xb(e,t){return[e[t],e[t+1]]}function mD(e,t){var n=Js(e[0],e[1]),i=Js(e[0],t);return n===0?0:i/n}function yD(e,t,n,i){var o=nt(e);return Yb(o,t,n,i).delta}function ec(e,t,n){var i=Ks(t),o=Ks(n),r=Qi(e,i),a={x:r.x*(n.width/t.width),y:r.y*(n.height/t.height)};return Do({x:o.x+a.x,y:o.y+a.y})}function Zb(e,t,n){var i=Ks(e),o=Ks(t),r=Ks(n),a=Qi(e,i),s=Qi(i,o),c=vD(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:r.x+l.x,y:r.y+l.y};return Do({x:u.x+a.x-e.x,y:u.y+a.y-e.y})}function vD(e,t,n){var i=Ze(t),o=Ze(n);if(xD(i,o))return null;var r=$n(t,e),a,s,c;if(r==="top")a={x:0,y:o.bottom-i.bottom};else if(r==="bottom")a={x:0,y:o.top-i.top};else if(r==="right")a={x:o.left-i.left,y:0};else if(r==="left")a={x:o.right-i.right,y:0};else return null;return s={x:e.x+a.x,y:e.y+a.y},c=$n(n,s),c!==r?null:a}function xD(e,t){return bD(e,t)||wD(e,t)}function bD(e,t){return e.right!==t.right&&e.left!==t.left}function wD(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var Jb="name",Qb="text";function Jf(e,t,n,i){we.call(this,e),this.postExecute("element.updateProperties",o),this.postExecute("element.updateModdleProperties",a=>{Ee(a.context.element)===a.context.moddleElement&&o(a)});function o(a){var s=a.context,c=s.element,l=s.properties;if(Jb in l&&t.updateLabel(c,l[Jb]),Qb in l&&T(c,"bpmn:TextAnnotation")){var u=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},l[Qb]||"");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;ft(l)||!fo(l)||ii(l)&&t.updateLabel(l,ii(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 r(a){var s=a.context,c=s.connection,l=c.label,u=te({},s.hints),p=s.newWaypoints||c.waypoints,d=s.oldWaypoints;return typeof u.startChanged>"u"&&(u.startChanged=!!u.connectionStart),typeof u.endChanged>"u"&&(u.endChanged=!!u.connectionEnd),yD(l,p,d,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=r(a),t.moveShape(u,p))}}),this.postExecute(["shape.replace"],function(a){var s=a.context,c=s.newShape,l=s.oldShape,u=Ee(c);u&&fo(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(!(!ft(c)||l.autoResize)){var u=s.newBounds,p=i.getDimensions(ii(c)||"",{box:u,style:i.getExternalStyle()}),d=Math.ceil(p.height),f=u.y!==c.y,m=c.y+c.height;s.newBounds={width:u.width,height:d,x:u.x,y:f?m-d:u.y}}}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.newBounds,u=s.oldBounds;if(Gl(c)){var p=c.label,d=nt(p),f=SD(u),m=ED(d,f),h=_D(m,u,l);t.moveShape(p,h)}})}je(Jf,we),Jf.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function _D(e,t,n){var i=ec(e,t,n);return Do(Qi(i,e))}function ED(e,t){if(t.length){var n=RD(e,t);return Zf(e,n)}}function SD(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 RD(e,t){var n=t.map(function(o){return{line:o,distance:Hb(e,o)}}),i=io(n,"distance");return i[0].line}function MD(e,t,n,i){return Yb(e,t,n,i).point}function Qf(e,t){we.call(this,e);function n(i,o){var r=i.context,a=r.connection,s=te({},r.hints),c=r.newWaypoints||a.waypoints,l=r.oldWaypoints;return typeof s.startChanged>"u"&&(s.startChanged=!!s.connectionStart),typeof s.endChanged>"u"&&(s.endChanged=!!s.connectionEnd),MD(o,c,l,s)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(i){var o=i.context,r=o.connection,a=r.outgoing,s=r.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 o=i.context,r=o.connection,a=r.outgoing,s=r.incoming,c=o.delta;s.forEach(function(l){var u=l.waypoints[l.waypoints.length-1],p={x:u.x+c.x,y:u.y+c.y},d=[].concat(l.waypoints.slice(0,-1),[p]);t.updateWaypoints(l,d)}),a.forEach(function(l){var u=l.waypoints[0],p={x:u.x+c.x,y:u.y+c.y},d=[].concat([p],l.waypoints.slice(1));t.updateWaypoints(l,d)})})}je(Qf,we),Qf.$inject=["eventBus","modeling"];function au(e,t,n){var i=cu(e),o=tw(i,t),r=i[0];return o.length?o[o.length-1]:ec(r.original||r,n,t)}function su(e,t,n){var i=cu(e),o=tw(i,t),r=i[i.length-1];return o.length?o[0]:ec(r.original||r,n,t)}function eh(e,t,n){var i=cu(e),o=ew(t,n),r=i[0];return ec(r.original||r,o,t)}function th(e,t,n){var i=cu(e),o=ew(t,n),r=i[i.length-1];return ec(r.original||r,o,t)}function ew(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function cu(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function tw(e,t){var n=Wn(e,AD);return gt(n,function(i){return CD(i,t)})}function CD(e,t){return $n(t,e,1)==="intersect"}function AD(e){return e.original||e}function nh(e,t){we.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,o=n.newShape;if(TD(i,o)){var r=PD(i);r.incoming.forEach(function(a){var s=su(a,o,i);t.reconnectEnd(a,o,s)}),r.outgoing.forEach(function(a){var s=au(a,o,i);t.reconnectStart(a,o,s)})}},!0)}nh.$inject=["eventBus","modeling"],je(nh,we);function TD(e,t){return T(e,"bpmn:Participant")&&xt(e)&&T(t,"bpmn:Participant")&&!xt(t)}function PD(e){var t=Fs([e]),n=[],i=[];return t.forEach(function(o){o!==e&&(o.incoming.forEach(function(r){T(r,"bpmn:MessageFlow")&&n.push(r)}),o.outgoing.forEach(function(r){T(r,"bpmn:MessageFlow")&&i.push(r)}))},[]),{incoming:n,outgoing:i}}const kD=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function nw(e){const t=Ee(e);if(!T(t,"bpmn:BoundaryEvent")&&!(T(t,"bpmn:StartEvent")&&Kn(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:kD.some(i=>T(n[0],i))}function iw(e){return T(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function ih(e,t){e.invoke(we,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,o=n.context.newShape,r=n.context.hints;if(!nw(o))return;const a=iw(o);if(r.targetElement&&r.targetElement[a]!==void 0)return;const c=Ee(i).get(a),l=Ee(o).get(a);c!==l&&t.updateProperties(o,{[a]:c})})}ih.$inject=["injector","modeling"],je(ih,we);function oh(e,t){we.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,o=wt(i),r=o&&o.get("label"),a=r&&r.get("bounds");a&&t.updateModdleProperties(i,r,{bounds:void 0})},!0)}je(oh,we),oh.$inject=["eventBus","modeling"];function rh(e,t,n){we.call(this,e),this.preExecute("shape.delete",function(i){var o=i.context.shape;if(!(o.incoming.length!==1||o.outgoing.length!==1)){var r=o.incoming[0],a=o.outgoing[0];if(!(!T(r,"bpmn:SequenceFlow")||!T(a,"bpmn:SequenceFlow"))&&t.canConnect(r.source,a.target,r)){var s=OD(r.waypoints,a.waypoints);n.reconnectEnd(r,a.target,s)}}})}je(rh,we),rh.$inject=["eventBus","bpmnRules","modeling"];function za(e){return e.original||e}function OD(e,t){var n=Kf(za(e[e.length-2]),za(e[e.length-1]),za(t[1]),za(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[za(e[0]),za(t[t.length-1])]}function ah(e,t){we.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,o=i.parent;T(i,"bpmn:Participant")&&(n.collaborationRoot=o)},!0),this.postExecute("shape.delete",function(n){var i=n.collaborationRoot;if(i&&!i.businessObject.participants.length){var o=t.makeProcess(),r=i.children.slice();t.moveElements(r,{x:0,y:0},o)}},!0)}ah.$inject=["eventBus","modeling"],je(ah,we);function sh(e,t,n,i){we.call(this,e);var o=i.get("dragging",!1);function r(c){var l=c.source,u=c.target,p=c.parent;if(p){var d,f;T(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(l,u)||(f=!0),n.canConnectMessageFlow(l,u)&&(d="bpmn:MessageFlow")),T(c,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(l,u)||(f=!0),n.canConnectSequenceFlow(l,u)&&(d="bpmn:SequenceFlow")),f&&t.removeConnection(c),d&&t.connect(l,u,{type:d,waypoints:c.waypoints.slice()})}}function a(c){var l=c.context,u=l.connection,p=l.newSource||u.source,d=l.newTarget||u.target,f,m;f=n.canConnect(p,d),!(!f||f.type===u.type)&&(m=t.connect(p,d,{type:f.type,associationDirection:f.associationDirection,waypoints:u.waypoints.slice()}),u.parent&&t.removeConnection(u),l.connection=m,o&&s(u,m))}function s(c,l){var u=o.context(),p=u&&u.payload.previousSelection,d;!p||!p.length||(d=p.indexOf(c),d!==-1&&p.splice(d,1,l))}this.postExecuted("elements.move",function(c){var l=c.closure,u=l.allConnections;K(u,r)},!0),this.preExecute("connection.reconnect",a),this.postExecuted("element.updateProperties",function(c){var l=c.context,u=l.properties,p=l.element,d=p.businessObject,f;u.default&&(f=Ht(p.outgoing,_a({id:p.businessObject.default.id})),f&&t.updateProperties(f,{conditionExpression:void 0})),u.conditionExpression&&d.sourceRef.default===d&&t.updateProperties(p.source,{default:void 0})})}je(sh,we),sh.$inject=["eventBus","modeling","bpmnRules","injector"];function lu(e,t,n,i,o,r){i.invoke(we,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=r,this.postExecuted(["elements.create"],500,function(a){var s=a.context,c=s.parent,l=s.elements,u=ci(l,function(p,d){var f=t.canReplace([d],d.host||d.parent||c);return f?p.concat(f.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=[];K(s.closure.topLevel,function(d){Kn(d)?u=u.concat(d.children):u=u.concat(d)}),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;o.unclaimId(c.businessObject.id,c.businessObject),o.updateProperties(l,{id:c.id})})}je(lu,we),lu.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,o=this._selection;K(t,function(r){var a={type:r.newElementType},s=n.get(r.oldElementId),c=e.indexOf(s);e[c]=i.replaceElement(s,a,{select:!1})}),t&&o.select(e)},lu.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var DD=1500,LD={width:140,height:120},ch={width:300,height:60},lh={width:60,height:300},uu={width:300,height:150},pu={width:150,height:300},ow={width:140,height:120},rw={width:100,height:40};function aw(e){e.on("resize.start",DD,function(t){var n=t.context,i=n.shape,o=n.direction,r=n.balanced;(T(i,"bpmn:Lane")||T(i,"bpmn:Participant"))&&(n.resizeConstraints=FD(i,o,r)),T(i,"bpmn:SubProcess")&&xt(i)&&(n.minDimensions=ow),T(i,"bpmn:TextAnnotation")&&(n.minDimensions=rw)})}aw.$inject=["eventBus"];var yr=Math.abs,ID=Math.min,BD=Math.max;function sw(e,t,n,i){var o=e[t];e[t]=o===void 0?n:i(n,o)}function Va(e,t,n){return sw(e,t,n,ID)}function Wa(e,t,n){return sw(e,t,n,BD)}var ND={top:20,left:50,right:20,bottom:20},$D={top:50,left:20,right:20,bottom:20};function FD(e,t,n){var i=Pi(e),o=!0,r=!0,a=tu(i,[i]),s=Ze(e),c={},l={},u=Tn(e),p=u?ch:lh;/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(m){var h=Ze(m);u?(h.top<s.top-10&&(o=!1),h.bottom>s.bottom+10&&(r=!1)):(h.left<s.left-10&&(o=!1),h.right>s.right+10&&(r=!1)),/n/.test(t)&&(n&&yr(s.top-h.bottom)<10&&Wa(c,"top",h.top+p.height),yr(s.top-h.top)<5&&Va(l,"top",h.bottom-p.height)),/e/.test(t)&&(n&&yr(s.right-h.left)<10&&Va(c,"right",h.right-p.width),yr(s.right-h.right)<5&&Wa(l,"right",h.left+p.width)),/s/.test(t)&&(n&&yr(s.bottom-h.top)<10&&Va(c,"bottom",h.bottom-p.height),yr(s.bottom-h.bottom)<5&&Wa(l,"bottom",h.top+p.height)),/w/.test(t)&&(n&&yr(s.left-h.right)<10&&Wa(c,"left",h.left+p.width),yr(s.left-h.left)<5&&Va(l,"left",h.right-p.width))});var d=i.children.filter(function(m){return!m.hidden&&!m.waypoints&&(T(m,"bpmn:FlowElement")||T(m,"bpmn:Artifact"))}),f=u?ND:$D;return d.forEach(function(m){var h=Ze(m);/n/.test(t)&&(!u||o)&&Va(l,"top",h.top-f.top),/e/.test(t)&&(u||r)&&Wa(l,"right",h.right+f.right),/s/.test(t)&&(!u||r)&&Wa(l,"bottom",h.bottom+f.bottom),/w/.test(t)&&(u||o)&&Va(l,"left",h.left-f.left)}),{min:l,max:c}}function cw(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function Ua(e){return e.originalEvent||e.srcEvent}function uh(e){cw(e),cw(Ua(e))}function Jr(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 lw(){return/mac/i.test(navigator.platform)}function uw(e,t){return(Ua(e)||e).button===t}function vr(e){return uw(e,0)}function jD(e){return uw(e,1)}function tc(e){var t=Ua(e)||e;return vr(e)?lw()?t.metaKey:t.ctrlKey:!1}function du(e){var t=Ua(e)||e;return vr(e)&&t.shiftKey}var pw=1001;function dw(e,t){e.on("resize.start",pw+500,function(n){var i=n.context,o=i.shape;(T(o,"bpmn:Lane")||T(o,"bpmn:Participant"))&&(i.balanced=!tc(n))}),e.on("resize.end",pw,function(n){var i=n.context,o=i.shape,r=i.canExecute,a=i.newBounds;if(T(o,"bpmn:Lane")||T(o,"bpmn:Participant"))return r&&(a=jx(a),t.resizeLane(o,a,i.balanced)),!1})}dw.$inject=["eventBus","modeling"];var HD=500;function ph(e,t,n,i,o){n.invoke(we,this);function r(u){return ht(u,["bpmn:ReceiveTask","bpmn:SendTask"])||GD(u,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(u){var p=e.getDefinitions(),d=p.get("rootElements");return!!Ht(d,_a({id:u.id}))}function s(u){if(T(u,"bpmn:ErrorEventDefinition"))return"errorRef";if(T(u,"bpmn:EscalationEventDefinition"))return"escalationRef";if(T(u,"bpmn:MessageEventDefinition"))return"messageRef";if(T(u,"bpmn:SignalEventDefinition"))return"signalRef"}function c(u){if(ht(u,["bpmn:ReceiveTask","bpmn:SendTask"]))return u.get("messageRef");var p=u.get("eventDefinitions"),d=p[0];return d.get(s(d))}function l(u,p){if(ht(u,["bpmn:ReceiveTask","bpmn:SendTask"]))return u.set("messageRef",p);var d=u.get("eventDefinitions"),f=d[0];return f.set(s(f),p)}this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],function(u){var p=u.shape||u.element;if(r(p)){var d=Ee(p),f=c(d),m;f&&!a(f)&&(m=e.getDefinitions().get("rootElements"),un(m,f),u.addedRootElement=f)}},!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],function(u){var p=u.addedRootElement;if(p){var d=e.getDefinitions().get("rootElements");an(d,p)}},!0),t.on("copyPaste.copyElement",function(u){var p=u.descriptor,d=u.element;if(!(d.labelTarget||!r(d))){var f=Ee(d),m=c(f);m&&(p.referencedRootElement=m)}}),t.on("copyPaste.pasteElement",HD,function(u){var p=u.descriptor,d=p.businessObject,f=p.referencedRootElement;f&&(a(f)||(f=i.copyElement(f,o.create(f.$type))),l(d,f),delete p.referencedRootElement)})}ph.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],je(ph,we);function GD(e,t){return et(t)||(t=[t]),Zo(t,function(n){return Na(e,n)})}var fw=Math.max;function hw(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,o=t.start,r={};return K(n,function(a){var s=a.id;T(a,"bpmn:Participant")&&(r[s]=VD(a,i,o)),T(a,"bpmn:Lane")&&(r[s]=Tn(a)?ch:lh),T(a,"bpmn:SubProcess")&&xt(a)&&(r[s]=ow),T(a,"bpmn:TextAnnotation")&&(r[s]=rw),T(a,"bpmn:Group")&&(r[s]=LD)}),r})}hw.$inject=["eventBus"];function zD(e){return e==="x"}function VD(e,t,n){var i=Tn(e);if(!qD(e))return i?uu:pu;var o=zD(t),r={};return o?i?r=uu:r={width:UD(e,n,o),height:pu.height}:i?r={width:uu.width,height:WD(e,n,o)}:r=pu,r}function WD(e,t,n){var i;return i=YD(e,t,n),fw(uu.height,i)}function UD(e,t,n){var i;return i=KD(e,t,n),fw(pu.width,i)}function qD(e){return!!mr(e).length}function YD(e,t,n){var i=mr(e),o;return o=dh(i,t,n),e.height-o.height+ch.height}function KD(e,t,n){var i=mr(e),o;return o=dh(i,t,n),e.width-o.width+lh.width}function dh(e,t,n){var i,o,r;for(i=0;i<e.length;i++)if(o=e[i],!n&&t>=o.y&&t<=o.y+o.height||n&&t>=o.x&&t<=o.x+o.width)return r=mr(o),r.length?dh(r,t,n):o}var gw="_plane";function mw(e){var t=e.id;return XD(t)}function go(e){var t=e.id;return T(e,"bpmn:SubProcess")?yw(t):t}function Qr(e){return yw(e)}function fu(e){var t=wt(e);return T(t,"bpmndi:BPMNPlane")}function yw(e){return e+gw}function XD(e){return e.replace(new RegExp(gw+"$"),"")}var vw=400,ZD=600,xw={x:180,y:160};function No(e,t,n,i,o,r,a){we.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=i,this._bpmnFactory=o,this._bpmnjs=r,this._elementRegistry=a;var s=this;function c(p){return T(p,"bpmn:SubProcess")&&!xt(p)}function l(p){var d=p.shape,f=p.newRootElement,m=Ee(d);f=s._addDiagram(f||m),p.newRootElement=e.addRootElement(f)}function u(p){var d=p.shape,f=Ee(d);s._removeDiagram(f);var m=p.newRootElement=a.get(go(f));e.removeRootElement(m)}this.executed("shape.create",function(p){var d=p.shape;c(d)&&l(p)},!0),this.postExecuted("elements.create",function(p){var d=p.elements;K(d,function(f){if(c(f)){var m=a.get(go(f));if(!(!m||!f.children||!f.children.length)){var h=bw(f);s._showRecursively(h),s._moveChildrenToShape(h,m)}}})},!0),this.reverted("shape.create",function(p){var d=p.shape;c(d)&&u(p)},!0),this.preExecute("shape.delete",function(p){var d=p.shape;!T(d,"bpmn:SubProcess")||!xt(d)||K(Ws([d]),f=>{n.removeShape(f.annotation)})},!0),this.preExecuted("shape.delete",function(p){var d=p.shape;if(c(d)){var f=a.get(go(d));f&&n.removeElements(f.children.slice())}},!0),this.executed("shape.delete",function(p){var d=p.shape;c(d)&&u(p)},!0),this.reverted("shape.delete",function(p){var d=p.shape;c(d)&&l(p)},!0),this.preExecuted("shape.replace",function(p){var d=p.oldShape,f=p.newShape;!c(d)||!c(f)||(p.oldRoot=e.removeRootElement(go(d)))},!0),this.postExecuted("shape.replace",function(p){var d=p.newShape,f=p.oldRoot,m=e.findRoot(go(d));if(!(!f||!m)){var h=f.children;n.moveElements(h,{x:0,y:0},m)}},!0),this.executed("element.updateProperties",function(p){var d=p.element;if(T(d,"bpmn:SubProcess")){var f=p.properties,m=p.oldProperties,h=m.id,y=f.id;if(h!==y){if(fu(d)){a.updateId(d,Qr(y)),a.updateId(h,y);return}var w=a.get(Qr(h));w&&a.updateId(Qr(h),Qr(y))}}},!0),this.reverted("element.updateProperties",function(p){var d=p.element;if(T(d,"bpmn:SubProcess")){var f=p.properties,m=p.oldProperties,h=m.id,y=f.id;if(h!==y){if(fu(d)){a.updateId(d,Qr(h)),a.updateId(y,h);return}var w=a.get(Qr(y));w&&a.updateId(w,Qr(h))}}},!0),t.on("element.changed",function(p){var d=p.element;if(fu(d)){var f=d,m=a.get(mw(f));!m||m===f||t.fire("element.changed",{element:m})}}),this.executed("shape.toggleCollapse",vw,function(p){var d=p.shape;T(d,"bpmn:SubProcess")&&(xt(d)?u(p):(l(p),s._showRecursively(d.children)))},!0),this.reverted("shape.toggleCollapse",vw,function(p){var d=p.shape;T(d,"bpmn:SubProcess")&&(xt(d)?u(p):(l(p),s._showRecursively(d.children)))},!0),this.postExecuted("shape.toggleCollapse",ZD,function(p){var d=p.shape;if(T(d,"bpmn:SubProcess")){var f=p.newRootElement;if(f)if(xt(d))s._moveChildrenToShape(f.children.slice(),d),K(Ws(d.children),h=>{n.moveShape(h.annotation,{x:0,y:0},d.parent),K(h.associations,y=>{n.moveConnection(y,{x:0,y:0},d.parent)})});else{s._disconnectSharedAnnotations(d);var m=bw(d);s._moveChildrenToShape(m,f)}}},!0),t.on("copyPaste.createTree",function(p){var d=p.element,f=p.children;if(c(d)){var m=go(d),h=a.get(m);h&&f.push.apply(f,h.children)}}),t.on("copyPaste.copyElement",function(p){var d=p.descriptor,f=p.element,m=p.elements,h=f.parent,y=T(wt(h),"bpmndi:BPMNPlane");if(y){var w=mw(h),g=Ht(m,function(v){return v.id===w});g&&(d.parent=g.id)}}),t.on("copyPaste.pasteElement",function(p){var d=p.descriptor;d.parent&&(c(d.parent)||d.parent.hidden)&&(d.hidden=!0)})}je(No,we),No.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 o=yn(i),r;if(!t.x)r={x:xw.x-o.x,y:xw.y-o.y};else{var a=nt(t),s=nt(o);r={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,r,t,{autoResize:!1})}},No.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(ub(e).map(i=>i.annotation));n.size&&K(Ws(e.children),i=>{n.has(i.annotation)&&K(i.associations,o=>{t.removeConnection(o)})})},No.prototype._showRecursively=function(e,t){var n=this,i=[];return e.forEach(function(o){o.hidden=!!t,i=i.concat(o),o.children&&(i=i.concat(n._showRecursively(o.children,o.collapsed||t)))}),i},No.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},No.prototype._createNewDiagram=function(e){var t=this._bpmnFactory,n=this._elementFactory,i=t.create("bpmndi:BPMNPlane",{bpmnElement:e}),o=t.create("bpmndi:BPMNDiagram",{plane:i});i.$parent=o;var r=n.createRoot({id:go(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return r},No.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=Ht(n,function(o){return o.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},No.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function JD(e){var t=[];return K(Ws(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function bw(e){return e.children.slice().concat(JD(e.children)).concat(QD(e))}function QD(e){return mf(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function fh(e,t){e.invoke(we,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,o=n.context.newShape;if(!(!T(o,"bpmn:SubProcess")||T(o,"bpmn:AdHocSubProcess")||!(T(i,"bpmn:Task")||T(i,"bpmn:CallActivity"))||!xt(o))){var r=eL(o);t.createShape({type:"bpmn:StartEvent"},r,o)}})}fh.$inject=["injector","modeling"],je(fh,we);function eL(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function hh(e,t){we.call(this,e),this.preExecute("connection.create",function(n){const{target:i}=n;T(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&&T(i[0],"bpmn:TextAnnotation")&&(n.hints=n.hints||{},n.hints.autoResize=!1)},!0),this.preExecute("shape.resize",function(n){var i=n.context,o=i.shape,r=i.hints||{};if(!(!T(o,"bpmn:TextAnnotation")||r.autoResize)){var a=i.newBounds,s=t.getTextAnnotationBounds(a,ii(o)||""),c=a.y!==o.y&&Math.abs(a.y+a.height-(o.y+o.height))<=1,l=o.y+o.height;i.newBounds={width:a.width,height:s.height,x:a.x,y:c?l-s.height:a.y}}})}je(hh,we),hh.$inject=["eventBus","textRenderer"];function gh(e,t){we.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(xt(i))return;var o=Fs(i);o.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();K(s,function(l){r(l,!0)}),K(c,function(l){r(l,!1)})});function r(a,s){o.indexOf(a.source)!==-1&&o.indexOf(a.target)!==-1||T(a,"bpmn:Association")&&(T(a.source,"bpmn:TextAnnotation")||T(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,i,nt(i)):t.reconnectStart(a,i,nt(i)))}},!0)}je(gh,we),gh.$inject=["eventBus","modeling"];var mh=500;function yh(e,t,n){we.call(this,e);function i(a){a.length&&a.forEach(function(s){s.type==="label"&&!s.businessObject.name&&(s.hidden=!0)})}function o(a,s){var c=a.children,l=s,u,p;return u=tL(c).concat([a]),p=Ab(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 r(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"],mh,function(a){var s=a.context,c=s.shape;T(c,"bpmn:SubProcess")&&(c.collapsed?wt(c).isExpanded=!1:(i(c.children),wt(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],mh,function(a){var s=a.context,c=s.shape;c.collapsed?wt(c).isExpanded=!1:wt(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],mh,function(a){var s=a.context.shape,c=t.getDefaultSize(s),l;s.collapsed?l=r(s,c):l=o(s,c),n.resizeShape(s,l,null,{autoResize:s.collapsed?!1:"nwse"})})}je(yh,we),yh.$inject=["eventBus","elementFactory","modeling"];function tL(e){return e.filter(function(t){return!t.hidden})}function vh(e,t,n,i){t.invoke(we,this),this.preExecute("shape.delete",function(o){var r=o.context,a=r.shape,s=a.businessObject;ft(a)||(T(a,"bpmn:Participant")&&xt(a)&&n.ids.unclaim(s.processRef.id),i.unclaimId(s.id,s))}),this.preExecute("connection.delete",function(o){var r=o.context,a=r.connection,s=a.businessObject;i.unclaimId(s.id,s)}),this.preExecute("canvas.updateRoot",function(){var o=e.getRootElement(),r=o.businessObject;T(o,"bpmn:Collaboration")&&n.ids.unclaim(r.id)})}je(vh,we),vh.$inject=["canvas","injector","moddle","modeling"];function xh(e,t){we.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,o=i.connection,r=o.source;nL(o,r)&&t.updateProperties(r,{default:null})})}je(xh,we),xh.$inject=["eventBus","modeling"];function nL(e,t){if(!T(e,"bpmn:SequenceFlow"))return!1;var n=Ee(t),i=Ee(e);return n.get("default")===i}var iL=500,oL=5e3,ww=["shape.create","shape.delete","shape.move","shape.resize"],_w=[...ww,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function bh(e,t){we.call(this,e);var n;function i(){return n=n||new rL,n.enter(),n}function o(){if(!n)throw new Error("out of bounds release");return n}function r(){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(_w,oL,function(){i()}),this.postExecuted(_w,iL,function(){r()}),this.preExecute(ww,function(a){var s=a.context,c=s.shape,l=o();!c||c.labelTarget||(T(c,"bpmn:Lane")&&l.addLane(c),T(c,"bpmn:FlowNode")&&l.addFlowNode(c))})}bh.$inject=["eventBus","modeling"],je(bh,we);function rL(){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 aL=500,sL=5e3,Ew=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],Sw=[...Ew,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function wh(e,t){we.call(this,e);var n;function i(){return n=n||new cL,n.enter(),n}function o(){if(!n)throw new Error("out of bounds release");return n}function r(){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(Sw,sL,function(){i()}),this.postExecuted(Sw,aL,function(){r()}),this.preExecute(Ew,function(a){var s=a.context.connection||a.context.shape,c=o();!s||s.labelTarget||(T(s,"bpmn:FlowElement")&&c.addFlowElement(s),T(s,"bpmn:Group")&&c.addGroup(s))}),this.preExecute("label.create",function(a){var s=a.context.labelTarget;T(s,"bpmn:Group")&&o().addGroup(s)})}wh.$inject=["eventBus","modeling"],je(wh,we);function cL(){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 _h(e,t){we.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,o=i.elements;for(const r of o)lL(r)&&!pL(r)&&t.updateProperties(r,{isForCompensation:void 0})})}je(_h,we),_h.$inject=["eventBus","modeling"];function lL(e){const t=Ee(e);return t&&t.isForCompensation}function uL(e){return e&&T(e,"bpmn:BoundaryEvent")&&Na(e,"bpmn:CompensateEventDefinition")}function pL(e){return e.incoming.filter(n=>uL(n.source)).length>0}const dL={__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",kf],associationBehavior:["type",Df],attachEventBehavior:["type",Yl],artifactBehavior:["type",Of],boundaryEventBehavior:["type",Lf],categoryRootElementReferenceBehavior:["type",If],compensateBoundaryEventBehaviour:["type",Bf],createBehavior:["type",Nf],createDataObjectBehavior:["type",$f],createParticipantBehavior:["type",Hf],dataInputAssociationBehavior:["type",Gf],dataStoreBehavior:["type",zf],deleteLaneBehavior:["type",Vf],detachEventBehavior:["type",nu],dropOnFlowBehavior:["type",Uf],eventBasedGatewayBehavior:["type",qf],fixHoverBehavior:["type",Ib],groupBehavior:["type",Yf],importDockingFix:["type",Nb],isHorizontalFix:["type",Xf],labelBehavior:["type",Jf],layoutConnectionBehavior:["type",Qf],messageFlowBehavior:["type",nh],nonInterruptingBehavior:["type",ih],removeElementBehavior:["type",rh],removeEmbeddedLabelBoundsBehavior:["type",oh],removeParticipantBehavior:["type",ah],replaceConnectionBehavior:["type",sh],replaceElementBehaviour:["type",lu],resizeBehavior:["type",aw],resizeLaneBehavior:["type",dw],rootElementReferenceBehavior:["type",ph],spaceToolBehavior:["type",hw],subProcessPlaneBehavior:["type",No],subProcessStartEventBehavior:["type",fh],textAnnotationBehavior:["type",hh],toggleCollapseConnectionBehaviour:["type",gh],toggleElementCollapseBehaviour:["type",yh],unclaimIdBehavior:["type",vh],unsetDefaultFlowBehavior:["type",xh],updateFlowNodeRefsBehavior:["type",bh],updateCategoryValueRefsBehavior:["type",wh],setCompensationActivityAfterPasteBehavior:["type",_h]};function Eh(e){this._commandStack=e.get("commandStack",!1)}Eh.$inject=["injector"],Eh.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const mo={__init__:["rules"],rules:["type",Eh]};function ki(e){we.call(this,e),this.init()}ki.$inject=["eventBus"],je(ki,we),ki.prototype.addRule=function(e,t,n){var i=this;typeof e=="string"&&(e=[e]),e.forEach(function(o){i.canExecute(o,t,function(r,a,s){return n(r)},!0)})},ki.prototype.init=function(){};function Rw(e,t){var n=$n(e,t,-15);return n!=="intersect"?n:null}function jn(e){ki.call(this,e)}je(jn,ki),jn.$inject=["eventBus"],jn.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return fL(t)}),this.addRule("connection.create",function(e){var t=e.source,n=e.target,i=e.hints||{},o=i.targetParent,r=i.targetAttach;if(r)return!1;o&&(n.parent=o);try{return gu(t,n)}finally{o&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return gu(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 $w(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return $t(i)&&!mu(t,i)?!1:Xo(t,function(o){return $t(o)?gu(o.source,o.target,o):o.host?nc(o,o.host,null,n):Ch(o,i)})}),this.addRule("elements.move",function(e){var t=e.target,n=e.shapes,i=e.position,o=e.hints;return o!=null&&o.keyboardMove&&n.some(function(a){return Ow(a)&&!n.includes(a.host)})?!1:nc(n,t,null,i)||Bw(n,t,i)||Nw(n,t)||mu(n,t)}),this.addRule("shape.create",function(e){return Ch(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return nc(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return zw(n,t)})},jn.prototype.canConnectMessageFlow=Hw,jn.prototype.canConnectSequenceFlow=Gw,jn.prototype.canConnectDataAssociation=Ah,jn.prototype.canConnectAssociation=Fw,jn.prototype.canConnectCompensationAssociation=jw,jn.prototype.canMove=Nw,jn.prototype.canAttach=nc,jn.prototype.canReplace=Bw,jn.prototype.canDrop=qa,jn.prototype.canInsert=mu,jn.prototype.canCreate=Ch,jn.prototype.canConnect=gu,jn.prototype.canResize=$w,jn.prototype.canCopy=zw;function fL(e){return Sh(e)?null:ht(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function Sh(e){return!e||ft(e)}function Mw(e){do{if(T(e,"bpmn:Process"))return Ee(e);if(T(e,"bpmn:Participant"))return Ee(e).processRef||Ee(e)}while(e=e.parent)}function Rh(e){return T(e,"bpmn:TextAnnotation")}function Mh(e){return T(e,"bpmn:Group")&&!e.labelTarget}function Cw(e){return T(e,"bpmn:BoundaryEvent")&&yo(e,"bpmn:CompensateEventDefinition")}function hu(e){return Ee(e).isForCompensation}function hL(e,t){var n=Mw(e),i=Mw(t);return n===i}function gL(e){return T(e,"bpmn:InteractionNode")&&!T(e,"bpmn:BoundaryEvent")&&(!T(e,"bpmn:Event")||T(e,"bpmn:ThrowEvent")&&Pw(e,"bpmn:MessageEventDefinition"))}function mL(e){return T(e,"bpmn:InteractionNode")&&!hu(e)&&(!T(e,"bpmn:Event")||T(e,"bpmn:CatchEvent")&&Pw(e,"bpmn:MessageEventDefinition"))&&!(T(e,"bpmn:BoundaryEvent")&&!yo(e,"bpmn:MessageEventDefinition"))}function Aw(e){for(var t=e;t=t.parent;){if(T(t,"bpmn:FlowElementsContainer"))return Ee(t);if(T(t,"bpmn:Participant"))return Ee(t).processRef}return null}function Tw(e,t){var n=Aw(e),i=Aw(t);return n===i}function yo(e,t){var n=Ee(e);return!!Ht(n.eventDefinitions||[],function(i){return T(i,t)})}function Pw(e,t){var n=Ee(e);return(n.eventDefinitions||[]).every(function(i){return T(i,t)})}function yL(e){return T(e,"bpmn:FlowNode")&&!T(e,"bpmn:EndEvent")&&!Kn(e)&&!(T(e,"bpmn:IntermediateThrowEvent")&&yo(e,"bpmn:LinkEventDefinition"))&&!Cw(e)&&!hu(e)}function vL(e){return T(e,"bpmn:FlowNode")&&!T(e,"bpmn:StartEvent")&&!T(e,"bpmn:BoundaryEvent")&&!Kn(e)&&!(T(e,"bpmn:IntermediateCatchEvent")&&yo(e,"bpmn:LinkEventDefinition"))&&!hu(e)}function xL(e){return T(e,"bpmn:ReceiveTask")||T(e,"bpmn:IntermediateCatchEvent")&&(yo(e,"bpmn:MessageEventDefinition")||yo(e,"bpmn:TimerEventDefinition")||yo(e,"bpmn:ConditionalEventDefinition")||yo(e,"bpmn:SignalEventDefinition"))}function bL(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function kw(e,t){var n=bL(t);return n.indexOf(e)!==-1}function gu(e,t,n){if(Sh(e)||Sh(t))return null;if(!T(n,"bpmn:DataAssociation")){if(Hw(e,t))return{type:"bpmn:MessageFlow"};if(Gw(e,t))return{type:"bpmn:SequenceFlow"}}var i=Ah(e,t);return i||(jw(e,t)?{type:"bpmn:Association",associationDirection:"One"}:Fw(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function qa(e,t){return ft(e)||Mh(e)?!0:T(t,"bpmn:Participant")&&!xt(t)?!1:T(e,"bpmn:Participant")?T(t,"bpmn:Process")||T(t,"bpmn:Collaboration"):ht(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:T(e,"bpmn:Lane")?T(t,"bpmn:Participant")||T(t,"bpmn:Lane"):T(e,"bpmn:BoundaryEvent")&&!wL(e)?!1:T(e,"bpmn:FlowElement")&&!T(e,"bpmn:DataStoreReference")?T(t,"bpmn:FlowElementsContainer")?xt(t):ht(t,["bpmn:Participant","bpmn:Lane"]):T(e,"bpmn:DataStoreReference")&&T(t,"bpmn:Collaboration")?Zo(Ee(t).get("participants"),function(n){return!!n.get("processRef")}):ht(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?ht(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):T(e,"bpmn:MessageFlow")?T(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function wL(e){return Ee(e).cancelActivity&&(Dw(e)||Lw(e))}function Ow(e){return!ft(e)&&T(e,"bpmn:BoundaryEvent")}function _L(e){return T(e,"bpmn:Lane")}function EL(e){return Ow(e)||T(e,"bpmn:IntermediateThrowEvent")&&Dw(e)?!0:T(e,"bpmn:IntermediateCatchEvent")&&Lw(e)}function Dw(e){var t=Ee(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function Lw(e){return Iw(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function Iw(e,t){return t.some(function(n){return yo(e,n)})}function SL(e){return T(e,"bpmn:ReceiveTask")&&Ht(e.incoming,function(t){return T(t.source,"bpmn:EventBasedGateway")})}function nc(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var o=e[0];return ft(o)||!EL(o)||Kn(t)||!T(t,"bpmn:Activity")||hu(t)||i&&!Rw(i,t)||SL(t)?!1:"attach"}function Bw(e,t,n){if(!t)return!1;var i={replacements:[]};return K(e,function(o){Kn(t)||T(o,"bpmn:StartEvent")&&o.type!=="label"&&qa(o,t)&&(L2(o)||i.replacements.push({oldElementId:o.id,newElementType:"bpmn:StartEvent"}),(I2(o)||B2(o)||N2(o))&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:StartEvent"}),Iw(o,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&T(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:StartEvent"})),T(t,"bpmn:Transaction")||yo(o,"bpmn:CancelEventDefinition")&&o.type!=="label"&&(T(o,"bpmn:EndEvent")&&qa(o,t)&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:EndEvent"}),T(o,"bpmn:BoundaryEvent")&&nc(o,t,null,n)&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function Nw(e,t){return Zo(e,_L)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return qa(n,t)})}function Ch(e,t,n,i){return t?ft(e)||Mh(e)?!0:qa(e,t)||mu(e,t):!1}function $w(e,t,n){return T(e,"bpmn:SubProcess")?xt(e)&&(!t||t.width>=100&&t.height>=80):T(e,"bpmn:Lane")||T(e,"bpmn:Participant")?!0:Rh(e)?n?n==="e"||n==="w":!0:Mh(e)?!0:ft(e)?n?n==="e"||n==="w":!0:!1}function RL(e,t){var n=Rh(e),i=Rh(t);return(n||i)&&n!==i}function Fw(e,t){return kw(t,e)||kw(e,t)?!1:RL(e,t)?!0:!!Ah(e,t)}function jw(e,t){return Tw(e,t)&&Cw(e)&&T(t,"bpmn:Activity")&&!CL(t,e)&&!Kn(t)}function Hw(e,t){return Ww(e)&&!Ww(t)?!1:gL(e)&&mL(t)&&!hL(e,t)}function Gw(e,t){return yL(e)&&vL(t)&&Tw(e,t)&&!(T(e,"bpmn:EventBasedGateway")&&!xL(t))}function Ah(e,t){return ht(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&ht(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:ht(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&ht(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function mu(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:ht(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!ft(t)&&T(e,"bpmn:FlowNode")&&!T(e,"bpmn:BoundaryEvent")&&qa(e,t.parent)}function Th(e,t){return e&&t&&e.indexOf(t)!==-1}function zw(e,t){return ft(t)?!0:!(T(t,"bpmn:Lane")&&!Th(e,t.parent)||T(t,"bpmn:MessageFlow")&&!ML(e,t))}function ML(e,t){var n=Vw(t.source),i=Vw(t.target);return Th(e,n)&&Th(e,i)}function Vw(e){for(;e;e=e.parent)if(T(e,"bpmn:Participant"))return e;return null}function Ww(e){return ja(e,"bpmn:Process")||ja(e,"bpmn:Collaboration")}function CL(e,t){return e.attachers.includes(t)}const AL={__depends__:[mo],__init__:["bpmnRules"],bpmnRules:["type",jn]};var TL=2e3;function Uw(e,t){e.on("saveXML.start",TL,n);function n(){var i=t.getRootElements();K(i,function(o){var r=wt(o),a,s;a=Fs([o]),a=gt(a,function(c){return c!==o&&!c.labelTarget}),s=Wn(a,wt),r.set("planeElement",s)})}}Uw.$inject=["eventBus","canvas"];const PL={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",Uw]};function yu(e){we.call(this,e);var t=this;this.preExecute(["shape.create","connection.create"],function(n){var i=n.context,o=i.shape||i.connection,r=i.parent,a=t.getOrdering(o,r);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,o=i.shape||i.connection,r=i.newParent||o.parent,a=t.getOrdering(o,r);a&&(a.parent!==void 0&&(i.newParent=a.parent),i.newParentIndex=a.index)})}yu.prototype.getOrdering=function(e,t){return null},je(yu,we);function Ph(e,t){yu.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=Ht(n,function(c){return ht(a,[c.type])});return s&&s.order||{level:1}}function o(a){var s=a.order;if(s||(a.order=s=i(a)),!s)throw new Error(`no order for <${a.id}>`);return s}function r(a,s,c){for(var l=s;l&&!ht(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||T(a,"bpmn:TextAnnotation"))return{parent:t.findRoot(s)||t.getRootElement(),index:-1};var c=o(a);c.containers&&(s=r(a,s,c.containers));var l=s.children.indexOf(a),u=Fm(s.children,function(p){return!a.labelTarget&&p.labelTarget?!1:c.level<o(p).level});return u!==-1&&l!==-1&&l<u&&(u-=1),{index:u,parent:s}}}Ph.$inject=["eventBus","canvas"],je(Ph,yu);const kL={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",Ph]};function ic(){}ic.prototype.get=function(){return this._data},ic.prototype.set=function(e){this._data=e},ic.prototype.clear=function(){var e=this._data;return delete this._data,e},ic.prototype.isEmpty=function(){return!this._data};const OL={clipboard:["type",ic]};var qw=1500;function Yw(e,t,n){var i=this,o=n.get("dragging",!1);function r(a){if(!a.hover){var s=a.originalEvent,c=i._findTargetGfx(s),l=c&&e.get(c);c&&l&&(a.stopPropagation(),o.hover({element:l,gfx:c}),o.move(s))}}o&&t.on("drag.start",function(a){t.once("drag.move",qw,function(s){r(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",qw,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=Jr(a),c=document.elementFromPoint(s.x,s.y),DL(c)}}Yw.$inject=["elementRegistry","eventBus","injector"];function DL(e){return Ur(e,"svg, .djs-element",!0)}const LL={__init__:["hoverFix"],hoverFix:["type",Yw]};function IL(e){return!0}function vu(e){return vr(e)||jD(e)}var Kw=500;function Xw(e,t,n){var i=this;function o(A,I,H){if(!s(A,I)){var V,G,ie;H?G=t.getGraphics(H):(V=I.delegateTarget||I.target,V&&(G=V,H=t.get(G))),!(!G||!H)&&(ie=e.fire(A,{element:H,gfx:G,originalEvent:I}),ie===!1&&(I.stopPropagation(),I.preventDefault()))}}var r={};function a(A){return r[A]}function s(A,I){var H=l[A]||vr;return!H(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":IL,"element.mousedown":vu,"element.mouseup":vu,"element.click":vu,"element.dblclick":vu};function u(A,I,H){var V=c[A];if(!V)throw new Error("unmapped DOM event name <"+A+">");return o(V,I,H)}var p="svg, .djs-element";function d(A,I,H,V){var G=r[H]=function(ie){o(H,ie)};V&&(l[H]=V),G.$delegate=li.bind(A,p,I,G)}function f(A,I,H){var V=a(H);V&&li.unbind(A,I,V.$delegate)}function m(A){K(c,function(I,H){d(A,H,I)})}function h(A){K(c,function(I,H){f(A,H,I)})}e.on("canvas.destroy",function(A){h(A.svg)}),e.on("canvas.init",function(A){m(A.svg)}),e.on(["shape.added","connection.added"],function(A){var I=A.element,H=A.gfx;e.fire("interactionEvents.createHit",{element:I,gfx:H})}),e.on(["shape.changed","connection.changed"],Kw,function(A){var I=A.element,H=A.gfx;e.fire("interactionEvents.updateHit",{element:I,gfx:H})}),e.on("interactionEvents.createHit",Kw,function(A){var I=A.element,H=A.gfx;i.createDefaultHit(I,H)}),e.on("interactionEvents.updateHit",function(A){var I=A.element,H=A.gfx;i.updateDefaultHit(I,H)});var y=S("djs-hit djs-hit-stroke"),w=S("djs-hit djs-hit-click-stroke"),g=S("djs-hit djs-hit-all"),v=S("djs-hit djs-hit-no-move"),b={all:g,"click-stroke":w,stroke:y,"no-move":v};function S(A,I){return I=te({stroke:"white",strokeWidth:15},I||{}),n.cls(A,["no-fill","no-border"],I)}function M(A,I){var H=b[I];if(!H)throw new Error("invalid hit type <"+I+">");return Le(A,H),A}function B(A,I){ot(A,I)}this.removeHits=function(A){var I=Ls(".djs-hit",A);K(I,mn)},this.createDefaultHit=function(A,I){var H=A.waypoints,V=A.isFrame,G;return H?this.createWaypointsHit(I,H):(G=V?"stroke":"all",this.createBoxHit(I,G,{width:A.width,height:A.height}))},this.createWaypointsHit=function(A,I){var H=$s(I);return M(H,"stroke"),B(A,H),H},this.createBoxHit=function(A,I,H){H=te({x:0,y:0},H);var V=We("rect");return M(V,I),Le(V,H),B(A,V),V},this.updateDefaultHit=function(A,I){var H=kt(".djs-hit",I);if(H)return A.waypoints?gf(H,A.waypoints):Le(H,{width:A.width,height:A.height}),H},this.fire=o,this.triggerMouseEvent=u,this.mouseHandler=a,this.registerEvent=d,this.unregisterEvent=f}Xw.$inject=["eventBus","elementRegistry","styles"];const xu={__init__:["interactionEvents"],interactionEvents:["type",Xw]};function Ya(e,t){this._eventBus=e,this._canvas=t,this._selectedElements=new Set;var n=this;e.on(["shape.remove","connection.remove"],function(i){var o=i.element;n.deselect(o)}),e.on(["diagram.clear","root.set"],function(i){n.select(null)})}Ya.$inject=["eventBus","canvas"],Ya.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()})}},Ya.prototype.get=function(){return Array.from(this._selectedElements)},Ya.prototype.isSelected=function(e){return this._selectedElements.has(e)},Ya.prototype.select=function(e,t){var n=this.get();et(e)||(e=e?[e]:[]);var i=this._canvas,o=i.getRootElement();e=e.filter(function(r){var a=i.findRoot(r);return o===a}),t?K(e,r=>{this._selectedElements.add(r)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var Zw="hover",Jw="selected";function Qw(e,t){this._canvas=e;function n(o,r){e.addMarker(o,r)}function i(o,r){e.removeMarker(o,r)}t.on("element.hover",function(o){n(o.element,Zw)}),t.on("element.out",function(o){i(o.element,Zw)}),t.on("selection.changed",function(o){function r(l){i(l,Jw)}function a(l){n(l,Jw)}var s=new Set(o.oldSelection),c=new Set(o.newSelection);for(let l of s)c.has(l)||r(l);for(let l of c)s.has(l)||a(l)})}Qw.$inject=["canvas","eventBus"];function e_(e,t,n,i){e.on("create.end",500,function(o){var r=o.context,a=r.canExecute,s=r.elements,c=r.hints||{},l=c.autoSelect;if(a){if(l===!1)return;et(l)?t.select(l):t.select(s.filter(BL))}}),e.on("connect.end",500,function(o){var r=o.context,a=r.connection;a&&t.select(a)}),e.on("shape.move.end",500,function(o){var r=o.previousSelection||[],a=i.get(o.context.shape.id),s=Ht(r,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(o){if(vr(o)){var r=o.element;r===n.getRootElement()&&(r=null);var a=t.isSelected(r),s=t.get().length>1,c=du(o);if(a&&s)return c?t.deselect(r):t.select(r);a?t.deselect(r):t.select(r,c)}})}e_.$inject=["eventBus","selection","canvas","elementRegistry"];function BL(e){return!e.hidden}const Oi={__init__:["selectionVisuals","selectionBehavior"],__depends__:[xu],selection:["type",Ya],selectionVisuals:["type",Qw],selectionBehavior:["type",e_]};var NL=/^djs-cursor-.*$/;function bu(e){var t=Dt(document.body);t.removeMatching(NL),e&&t.add("djs-cursor-"+e)}function t_(){bu(null)}var $L=5e3;function n_(e,t){t=t||"element.click";function n(){return!1}return e.once(t,$L,n),function(){e.off(t,n)}}var FL=["c","C"],jL=["v","V"],HL=["d","D"],GL=["x","X"],zL=["y","Y"],i_=["z","Z"];function VL(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function di(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function Mn(e,t){return e=et(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function kh(e){return e.shiftKey}function WL(e){return di(e)&&Mn(FL,e)}function UL(e){return di(e)&&Mn(jL,e)}function qL(e){return di(e)&&Mn(HL,e)}function YL(e){return di(e)&&Mn(GL,e)}function KL(e){return di(e)&&!kh(e)&&Mn(i_,e)}function XL(e){return di(e)&&(Mn(zL,e)||Mn(i_,e)&&kh(e))}var Ka=Math.round,o_="djs-drag-active";function ea(e){e.preventDefault()}function ZL(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function JL(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function r_(e,t,n,i){var o={threshold:5,trapClick:!0},r;function a(v){var b=t.viewbox(),S=t._container.getBoundingClientRect();return{x:b.x+(v.x-S.left)/b.scale,y:b.y+(v.y-S.top)/b.scale}}function s(v,b){b=b||r;var S=e.createEvent(te({},b.payload,b.data,{isTouch:b.isTouch}));return e.fire("drag."+v,S)===!1?!1:e.fire(b.prefix+"."+v,S)}function c(v){var b=v.filter(function(S){return i.get(S.id)});b.length&&n.select(b)}function l(v,b){var S=r.payload,M=r.displacement,B=r.globalStart,A=Jr(v),I=Qi(A,B),H=r.localStart,V=a(A),G=Qi(V,H);if(!r.active&&(b||JL(I)>r.threshold)){if(te(S,{x:Ka(H.x+M.x),y:Ka(H.y+M.y),dx:0,dy:0},{originalEvent:v}),s("start")===!1)return y();r.active=!0,r.keepSelection||(S.previousSelection=n.get(),n.select(null)),r.cursor&&bu(r.cursor),t.addMarker(t.getRootElement(),o_)}uh(v),r.active&&(te(S,{x:Ka(V.x+M.x),y:Ka(V.y+M.y),dx:Ka(G.x),dy:Ka(G.y)},{originalEvent:v}),s("move"))}function u(v){var b,S=!0;r.active&&(v&&(r.payload.originalEvent=v,uh(v)),S=s("end")),S===!1&&s("rejected"),b=w(S!==!0),s("ended",b)}function p(v){Mn("Escape",v)&&(ea(v),y())}function d(v){var b;r.active&&(b=n_(e),setTimeout(b,400),ea(v)),u(v)}function f(v){l(v)}function m(v){var b=r.payload;b.hoverGfx=v.gfx,b.hover=v.element,s("hover")}function h(v){s("out");var b=r.payload;b.hoverGfx=null,b.hover=null}function y(v){var b;if(r){var S=r.active;S&&s("cancel"),b=w(v),S&&s("canceled",b)}}function w(v){var b,S;s("cleanup"),t_(),r.trapClick?S=d:S=u,Ke.unbind(document,"mousemove",l),Ke.unbind(document,"dragstart",ea),Ke.unbind(document,"selectstart",ea),Ke.unbind(document,"mousedown",S,!0),Ke.unbind(document,"mouseup",S,!0),Ke.unbind(document,"keyup",p),Ke.unbind(document,"touchstart",f,!0),Ke.unbind(document,"touchcancel",y,!0),Ke.unbind(document,"touchmove",l,!0),Ke.unbind(document,"touchend",u,!0),e.off("element.hover",m),e.off("element.out",h),t.removeMarker(t.getRootElement(),o_);var M=r.payload.previousSelection;return v!==!1&&M&&!n.get().length&&c(M),b=r,r=null,b}function g(v,b,S,M){r&&y(!1),typeof b=="string"&&(M=S,S=b,b=null),M=te({},o,M||{});var B=M.data||{},A,I,H,V,G;if(M.trapClick?V=d:V=u,v?(A=Ua(v)||v,I=Jr(v),uh(v),A.type==="dragstart"&&ea(A)):(A=null,I={x:0,y:0}),H=a(I),b||(b=H),G=ZL(A),r=te({prefix:S,data:B,payload:{},globalStart:I,displacement:Qi(b,H),localStart:H,isTouch:G},M),M.manual||(G?(Ke.bind(document,"touchstart",f,!0),Ke.bind(document,"touchcancel",y,!0),Ke.bind(document,"touchmove",l,!0),Ke.bind(document,"touchend",u,!0)):(Ke.bind(document,"mousemove",l),Ke.bind(document,"dragstart",ea),Ke.bind(document,"selectstart",ea),Ke.bind(document,"mousedown",V,!0),Ke.bind(document,"mouseup",V,!0)),Ke.bind(document,"keyup",p),e.on("element.hover",m),e.on("element.out",h)),s("init")===!1)return y(),!1;M.autoActivate&&l(v,!0)}e.on("diagram.destroy",y),this.init=g,this.move=l,this.hover=m,this.out=h,this.end=u,this.cancel=y,this.context=function(){return r},this.setOptions=function(v){te(o,v)}}r_.$inject=["eventBus","canvas","selection","elementRegistry"];const $o={__depends__:[LL,Oi],dragging:["type",r_]};function ta(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}ta.prototype.next=function(){return this._prefix+ ++this._counter};const QL=new ta("ps");var eI=["marker-start","marker-mid","marker-end"],tI=["circle","ellipse","line","path","polygon","polyline","path","rect"];function xr(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}xr.$inject=["elementRegistry","eventBus","canvas","styles"],xr.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")},xr.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},xr.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var o=sf(n);return this._cloneMarkers(fr(o),i),Le(o,this._styles.cls(i,[])),ot(t,o),Le(o,"data-preview-support-element-id",e.id),o},xr.prototype.addFrame=function(e,t){var n=We("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return ot(t,n),Le(n,"data-preview-support-element-id",e.id),n},xr.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(o=>{i._cloneMarkers(o,t,n)}),rI(e)&&eI.forEach(function(o){if(Le(e,o)){var r=nI(e,o,i._canvas.getContainer());r&&i._cloneMarker(n,e,r,o,t)}})},xr.prototype._cloneMarker=function(e,t,n,i,o="djs-dragger"){var r=[n.id,o,QL.next()].join("-"),a=kt("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||sf(n);s.id=r,vt(s).add(o);var c=kt(":scope > defs",e);c||(c=We("defs"),ot(e,c)),ot(c,s);var l=oI(s.id);Le(t,i,l)};function nI(e,t,n){var i=iI(Le(e,t));return kt("marker#"+i,n||document)}function iI(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function oI(e){return"url(#"+e+")"}function rI(e){return tI.indexOf(e.nodeName)!==-1}const Xa={__init__:["previewSupport"],previewSupport:["type",xr]};var aI="drop-ok",a_="drop-not-ok",s_="attach-ok",c_="new-parent",l_="create",sI=2e3;function u_(e,t,n,i,o){function r(c,l,u,p,d){if(!l)return!1;c=gt(c,function(g){var v=g.labelTarget;return!g.parent&&!(ft(g)&&c.indexOf(v)!==-1)});var f=Ht(c,function(g){return!$t(g)}),m=!1,h=!1,y=!1;d_(c)&&(m=o.allowed("shape.attach",{position:u,shape:f,target:l})),m||(d_(c)?y=o.allowed("shape.create",{position:u,shape:f,source:p,target:l}):y=o.allowed("elements.create",{elements:c,position:u,target:l}));var w=d.connectionTarget;return y||m?(f&&p&&(h=o.allowed("connection.create",{source:w===p?f:p,target:w===p?p:f,hints:{targetParent:l,targetAttach:m}})),{attach:m,connect:h}):y===null||m===null?null:!1}function a(c,l){[s_,aI,a_,c_].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,d=l.source,f=l.hints||{};if(!p){l.canExecute=!1,l.target=null;return}p_(c);var m={x:c.x,y:c.y},h=l.canExecute=p&&r(u,p,m,d,f);p&&h!==null&&(l.target=p,h&&h.attach?a(p,s_):a(p,h?c_:a_))}),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,d=l.elements,f=l.target,m=l.canExecute,h=m&&m.attach,y=m&&m.connect,w=l.hints||{};if(m===!1||!f)return!1;p_(c);var g={x:c.x,y:c.y};y?p=i.appendShape(u,p,g,f,{attach:h,connection:y===!0?{}:y,connectionTarget:w.connectionTarget}):(d=i.createElements(d,g,f,te({},w,{attach:h})),p=Ht(d,function(v){return!$t(v)})),te(l,{elements:d,shape:p}),te(c,{elements:d,shape:p})});function s(){var c=t.context();c&&c.prefix===l_&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],sI,function(){n.off("elements.changed",s)})}),this.start=function(c,l,u){et(l)||(l=[l]);var p=Ht(l,function(m){return!$t(m)});if(p){u=te({elements:l,hints:{},shape:p},u||{}),K(l,function(m){tt(m.x)||(m.x=0),tt(m.y)||(m.y=0)});var d=gt(l,function(m){return!m.hidden}),f=yn(d);K(l,function(m){$t(m)&&(m.waypoints=Wn(m.waypoints,function(h){return{x:h.x-f.x-f.width/2,y:h.y-f.y-f.height/2}})),te(m,{x:m.x-f.x-f.width/2,y:m.y-f.y-f.height/2})}),t.init(c,l_,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:l,context:u}})}}}u_.$inject=["canvas","dragging","eventBus","modeling","rules"];function p_(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 d_(e){return e&&e.length===1&&!$t(e[0])}var cI=750;function f_(e,t,n,i,o){function r(a){var s=We("g");Le(s,o.cls("djs-drag-group",["no-events"]));var c=We("g");return a.forEach(function(l){var u;l.hidden||(l.waypoints?(u=n._createContainer("connection",c),n.drawConnection(fr(u),l)):(u=n._createContainer("shape",c),n.drawShape(fr(u),l),Fn(u,l.x,l.y)),i.addDragger(l,s,u))}),s}t.on("create.move",cI,function(a){var s=a.hover,c=a.context,l=c.elements,u=c.dragGroup;u||(u=c.dragGroup=r(l));var p;s?(u.parentNode||(p=e.getActiveLayer(),ot(p,u)),Fn(u,a.x,a.y)):mn(u)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&mn(c)})}f_.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const wu={__depends__:[$o,Xa,mo,Oi],__init__:["create","createPreview"],create:["type",u_],createPreview:["type",f_]};function Oh(e){var t=this;this._lastMoveEvent=null;function n(i){t._lastMoveEvent=i}e.on("canvas.init",function(i){var o=t._svg=i.svg;o.addEventListener("mousemove",n)}),e.on("canvas.destroy",function(){t._lastMouseEvent=null,t._svg.removeEventListener("mousemove",n)})}Oh.$inject=["eventBus"],Oh.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||lI(0,0)};function lI(e,t){var n=document.createEvent("MouseEvent"),i=e,o=t,r=e,a=t;return n.initMouseEvent&&n.initMouseEvent("mousemove",!0,!0,window,0,i,o,r,a,!1,!1,!1,!1,0,null),n}const oc={__init__:["mouse"],mouse:["type",Oh]};var h_=2e3;function fi(e,t,n,i,o,r,a,s){this._canvas=e,this._create=t,this._elementFactory=i,this._eventBus=o,this._modeling=r,this._mouse=a,this._rules=s,o.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),uI(u)&&(l.priority=2,l.host=u.host.id),$t(u)&&(l.priority=3,l.source=u.source.id,l.target=u.target.id,l.waypoints=pI(u)),ft(u)&&(l.priority=4,l.labelTarget=u.labelTarget.id),K(["x","y","width","height"],function(d){tt(u[d])&&(l[d]=u[d])}),l.hidden=u.hidden,l.collapsed=u.collapsed}),o.on("copyPaste.elementsCopied",h_,function(c){var l;((l=c.hints)==null?void 0:l.clip)!==!1&&n.set(c.tree)}),o.on("copyPaste.pasteElements",h_,function(c){c.tree||(c.tree=n.get())}),o.on("copyPaste.pasteElements",function(c){var l=c.hints;te(l,{createElementsBehavior:!1})})}fi.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],fi.prototype.copy=function(e,t={}){var n,i;return et(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(et(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},fi.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 o=t.hints,r=this._createElements(i);if(t.element&&t.point)return this._paste(r,t.element,t.point,o);this._create.start(this._mouse.getLastMoveEvent(),r,{hints:o})}}},fi.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},fi.prototype.cut=function(e){var t=this.copy(e),n=this._getElementIdsFromTree(t),i=e.filter(function(o){return n[o.id]});return i.length>0&&this._modeling.removeElements(i),t},fi.prototype._getElementIdsFromTree=function(e){var t={};return K(e,function(n){K(n,function(i){i.id&&(t[i.id]=!0)})}),t},fi.prototype._paste=function(e,t,n,i){K(e,function(r){tt(r.x)||(r.x=0),tt(r.y)||(r.y=0)});var o=yn(e);return K(e,function(r){$t(r)&&(r.waypoints=Wn(r.waypoints,function(a){return{x:a.x-o.x-o.width/2,y:a.y-o.y-o.height/2}})),te(r,{x:r.x-o.x-o.width/2,y:r.y-o.y-o.height/2})}),this._modeling.createElements(e,n,t,te({},i))},fi.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},o=[];return K(e,function(r,a){r=io(r,"priority"),K(r,function(s){var c=te({},oo(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var l;if($t(c)){c.source=i[s.source],c.target=i[s.target],l=i[s.id]=t.createConnection(c),o.push(l);return}if(ft(c)){c.labelTarget=i[c.labelTarget],l=i[s.id]=t.createLabel(c),o.push(l);return}c.host&&(c.host=i[c.host]),l=i[s.id]=t.createShape(c),o.push(l)})}),o},fi.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(oo(e,["id"]));return t},fi.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(oo(e,["id"]));return t},fi.prototype.createShape=function(e){var t=this._elementFactory.createShape(oo(e,["id"]));return t},fi.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!($t(e)&&(!n.has(e.source)||!n.has(e.target))||ft(e)&&!n.has(e.labelTarget))},fi.prototype.createTree=function(e){var t=this._rules,n=this,i={},o=[],r=new Map,a=Dl(e);function s(p,d){return t.allowed("element.copy",{element:p,elements:d})}function c(p,d){var f=r.get(p);if(!f){var m={element:p,depth:d};o.push(m),r.set(p,m);return}if(f.depth<d){o=l(f,o);var h={element:f.element,depth:d};o.push(h),r.set(p,h)}}function l(p,d){var f=d.indexOf(p);return f!==-1&&d.splice(f,1),d}Yr(a,function(p,d,f){if(ft(p))return;K(p.labels,function(y){c(y,f)});function m(y){y&&y.length&&K(y,function(w){K(w.labels,function(g){c(g,f)}),c(w,f)})}K([p.attachers,p.incoming,p.outgoing],m),c(p,f);var h=[];return p.children&&(h=p.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:p,children:h}),h}),e=Wn(o,function(p){return p.element});var u=new Set(e);return o=Wn(o,function(p){return p.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:p.descriptor,element:p.element,elements:e,elementsSet:u}),p}),o=io(o,function(p){return p.descriptor.priority}),e=Wn(o,function(p){return p.element}),K(o,function(p){var d=p.depth;if(!n.hasRelations(p.element,e,u)){m_(p.element,e),u.delete(p.element);return}if(!s(p.element,e)){m_(p.element,e),u.delete(p.element);return}i[d]||(i[d]=[]),i[d].push(p.descriptor)}),i};function uI(e){return!!e.host}function pI(e){return Wn(e.waypoints,function(t){return t=g_(t),t.original&&(t.original=g_(t.original)),t})}function g_(e){return te({},e)}function m_(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const dI={__depends__:[OL,wu,oc,mo],__init__:["copyPaste"],copyPaste:["type",fi]};function Dh(e,t,n){et(n)||(n=[n]),K(n,function(i){Fr(e[i])||(t[i]=e[i])})}var Lh=750;function y_(e,t,n){function i(c,l){var u=e.create(c.$type);return n.copyElement(c,u,null,l)}t.on("copyPaste.copyElement",Lh,function(c){var l=c.descriptor,u=c.element,p=Ee(u);if(ft(u))return l;var d=l.businessObject=i(p,!0),f=l.di=i(wt(u),!0);f.bpmnElement=d,Dh(d,l,"name"),Dh(f,l,"isExpanded"),p.default&&(l.default=p.default.id)});var o="-bpmn-js-refs";function r(c){return c[o]=c[o]||{}}function a(c,l){c[o]=l}function s(c,l,u){var p=Ee(c);return c.default&&(u[c.default]={element:p,property:"default"}),c.host&&(Ee(c).attachedToRef=Ee(l[c.host])),oo(u,ci(u,function(d,f,m){var h=f.element,y=f.property;return m===c.id&&(h.set(y,p),d.push(c.id)),d},[]))}t.on("copyPaste.pasteElement",function(c){var l=c.cache,u=c.descriptor,p=u.businessObject,d=u.di;if(ft(u)){u.businessObject=Ee(l[u.labelTarget]),u.di=wt(l[u.labelTarget]);return}p=u.businessObject=i(p),d=u.di=i(d),d.bpmnElement=p,Dh(u,p,["isExpanded","name"]),u.type=p.$type}),t.on("copyPaste.copyElement",Lh,function(c){var l=c.descriptor,u=c.element;if(T(u,"bpmn:Participant")){var p=Ee(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;T(l,"bpmn:SubProcess")&&K(Ws(u),p=>{u.push(p.annotation)})}),t.on("copyPaste.pasteElement",Lh,function(c){var l=c.cache,u=c.descriptor;a(l,s(u,l,r(l)))})}y_.$inject=["bpmnFactory","eventBus","moddleCopy"];const fI=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],hI=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function rc(e,t,n){this._bpmnFactory=t,this._eventBus=e,this._moddle=n,e.on("moddleCopy.canCopyProperties",i=>{const{propertyNames:o}=i;if(!(!o||!o.length))return io(o,r=>r==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:o,property:r,propertyName:a}=i,s=Sn(o)&&o.$descriptor;if(a&&hI.includes(a))return r;if(a&&fI.includes(a)||a&&s&&!Ht(s.properties,_a({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",i=>{const{property:o}=i;if(T(o,"bpmn:ExtensionElements")&&(!o.values||!o.values.length))return!1})}rc.$inject=["eventBus","bpmnFactory","moddle"],rc.prototype.copyElement=function(e,t,n,i=!1){n&&!et(n)&&(n=[n]),n=n||Ih(e.$descriptor);const o=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return o===!1||(et(o)&&(n=o),K(n,r=>{let a;si(e,r)&&(a=e.get(r));const s=this.copyProperty(a,t,r,i);!En(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:r})===!1||t.set(r,s)})),t},rc.prototype.copyProperty=function(e,t,n,i=!1){let o=this._eventBus.fire("moddleCopy.canCopyProperty",{parent:t,property:e,propertyName:n,clone:i});if(o===!1)return;if(o)return Sn(o)&&o.$type&&!o.$parent&&(o.$parent=t),o;const r=this._moddle.getPropertyDescriptor(t,n);if(!r.isReference)return r.isId?e&&this._copyId(e,t,i):et(e)?ci(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):Sn(e)&&e.$type?this._moddle.getElementDescriptor(e).isGeneric?void 0:(o=this._bpmnFactory.create(e.$type),o.$parent=t,o=this.copyElement(e,o,null,i),o):e},rc.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 Ih(e,t){return ci(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const v_={__depends__:[dI],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",y_],moddleCopy:["type",rc]};var x_=Math.round;function Bh(e,t){this._modeling=e,this._eventBus=t}Bh.$inject=["modeling","eventBus"],Bh.prototype.replaceElement=function(e,t,n){if(e.waypoints)return null;var i=this._modeling,o=this._eventBus;o.fire("replace.start",{element:e,attrs:t,hints:n});var r=t.width||e.width,a=t.height||e.height,s=t.x||e.x,c=t.y||e.y,l=x_(s+r/2),u=x_(c+a/2),p=i.replaceShape(e,te({},t,{x:l,y:u,width:r,height:a}),n);return o.fire("replace.end",{element:e,newElement:p,hints:n}),p};function b_(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:o={}}=n;o.select!==!1&&e.select(i)})}b_.$inject=["selection","eventBus"];const gI={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",b_],replace:["type",Bh]};function mI(e,t,n){et(n)||(n=[n]),K(n,function(i){Fr(e[i])||(t[i]=e[i])})}var yI=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function vI(e,t){var n=e&&si(e,"collapsed")?e.collapsed:!xt(e),i;return t&&(si(t,"collapsed")||si(t,"isExpanded"))?i=si(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function w_(e,t,n,i,o,r){function a(s,c,l){l=l||{};var u=c.type,p=s.businessObject;if(_u(p)&&(u==="bpmn:SubProcess"||u==="bpmn:AdHocSubProcess")&&vI(s,c))return i.toggleCollapse(s),s;var d=e.create(u),f={type:u,businessObject:d};f.di={},u==="bpmn:ExclusiveGateway"&&(f.di.isMarkerVisible=!0),mI(s.di,f.di,["fill","stroke","background-color","border-color","color"]);var m=Ih(p.$descriptor),h=Ih(d.$descriptor,!0),y=xI(m,h);te(d,Wi(c,yI));var w=gt(y,function(b){return b==="eventDefinitions"?__(s,c.eventDefinitionType):b==="loopCharacteristics"?!Kn(d):si(d,b)||b==="processRef"&&c.isExpanded===!1||b==="triggeredByEvent"?!1:b==="isForCompensation"?!Kn(d):!0});if(d=n.copyElement(p,d,w),c.eventDefinitionType&&(__(d,c.eventDefinitionType)||(f.eventDefinitionType=c.eventDefinitionType,f.eventDefinitionAttrs=c.eventDefinitionAttrs)),T(p,"bpmn:Activity")){if(_u(p))f.isExpanded=xt(s);else if(c&&si(c,"isExpanded")){f.isExpanded=c.isExpanded;var g=t.getDefaultSize(d,{isExpanded:f.isExpanded});f.width=g.width,f.height=g.height,f.x=s.x-(f.width-s.width)/2,f.y=s.y-(f.height-s.height)/2}xt(s)&&!T(p,"bpmn:Task")&&f.isExpanded&&(f.width=s.width,f.height=s.height)}if(_u(p)&&!_u(d)&&(l.moveChildren=!1),T(p,"bpmn:Participant")){c.isExpanded===!0?d.processRef=e.create("bpmn:Process"):l.moveChildren=!1;var v=Tn(s);wt(s).isHorizontal||(wt(f).isHorizontal=v),f.width=v?s.width:t.getDefaultSize(f).width,f.height=v?t.getDefaultSize(f).height:s.height}return r.allowed("shape.resize",{shape:d})||(f.height=t.getDefaultSize(f).height,f.width=t.getDefaultSize(f).width),d.name=p.name,ht(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&ht(d,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(d.default=p.default),c.host&&!T(p,"bpmn:BoundaryEvent")&&T(d,"bpmn:BoundaryEvent")&&(f.host=c.host),(f.type==="bpmn:DataStoreReference"||f.type==="bpmn:DataObjectReference")&&(f.x=s.x+(s.width-f.width)/2),o.replaceElement(s,f,{...l,targetElement:c})}this.replaceElement=a}w_.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function _u(e){return T(e,"bpmn:SubProcess")}function __(e,t){var n=Ee(e);return t&&n.get("eventDefinitions").some(function(i){return T(i,t)})}function xI(e,t){return e.filter(function(n){return t.includes(n)})}const E_={__depends__:[v_,gI,Oi],bpmnReplace:["type",w_]};var bI=250;function na(e){this._eventBus=e,this._tools=[],this._active=null}na.$inject=["eventBus"],na.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)},na.prototype.isActive=function(e){return e&&this._active===e},na.prototype.length=function(e){return this._tools.length},na.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},na.prototype.bindEvents=function(e,t){var n=this._eventBus,i=[];n.on(t.tool+".init",function(o){var r=o.context;if(!r.reactivate&&this.isActive(e)){this.setActive(null);return}this.setActive(e)},this),K(t,function(o){i.push(o+".ended"),i.push(o+".canceled")}),n.on(i,bI,function(o){this._active&&(wI(o)||this.setActive(null))},this)};function wI(e){var t=e.originalEvent&&e.originalEvent.target;return t&&Ur(t,'.group[data-group="tools"]')}const Eu={__depends__:[$o],__init__:["toolManager"],toolManager:["type",na]};function _I(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 EI(e,t){var n=[],i=new Set(e);K(t,function(r){i.add(r)});var o=new Set;return i.forEach(function(r){var a=r.incoming,s=r.outgoing;K(a.concat(s),function(c){var l=c.source,u=c.target;(i.has(l)||i.has(u))&&(o.has(c)||(o.add(c),n.push(c)))})}),n}function SI(e,t,n){var i=e.x,o=e.y,r=e.width,a=e.height,s=n.x,c=n.y;switch(t){case"n":return{x:i,y:o+c,width:r,height:a-c};case"s":return{x:i,y:o,width:r,height:a+c};case"w":return{x:i+s,y:o,width:r-s,height:a};case"e":return{x:i,y:o,width:r+s,height:a};default:throw new Error("unknown direction: "+t)}}var Nh=Math.abs,RI=Math.round,Fo={x:"width",y:"height"},S_="crosshair",br={n:"top",w:"left",s:"bottom",e:"right"},MI=1500,Su={n:"s",w:"e",s:"n",e:"w"},Ru=20;function Di(e,t,n,i,o,r,a){this._canvas=e,this._dragging=t,this._eventBus=n,this._modeling=i,this._rules=o,this._toolManager=r,this._mouse=a;var s=this;r.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",MI,function(c){var l=c.context,u=l.initialized;u||(u=l.initialized=s.init(c,l)),u&&M_(c)}),n.on("spaceTool.end",function(c){var l=c.context,u=l.axis,p=l.direction,d=l.movingShapes,f=l.resizingShapes,m=l.start;if(l.initialized){M_(c);var h={x:0,y:0};h[u]=RI(c["d"+u]),s.makeSpace(d,f,h,p,m),n.once("spaceTool.ended",function(y){s.activateSelection(y.originalEvent,!0,!0)})}})}Di.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Di.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:S_,data:{context:{reactivate:n}},trapClick:!1})},Di.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:S_,data:{context:{}}})},Di.prototype.makeSpace=function(e,t,n,i,o){return this._modeling.createSpace(e,t,n,i,o)},Di.prototype.init=function(e,t){var n=Nh(e.dx)>Nh(e.dy)?"x":"y",i=e["d"+n],o=e[n]-i;if(Nh(i)<5)return!1;i<0&&(i*=-1),tc(e)&&(i*=-1);var r=_I(n,i),a=this._canvas.getRootElement();!du(e)&&e.hover&&(a=e.hover);var s=[...Fs(a),...a.attachers||[]],c=this.calculateAdjustments(s,n,i,o),l=this._eventBus.fire("spaceTool.getMinDimensions",{axis:n,direction:r,shapes:c.resizingShapes,start:o}),u=CI(c,n,r,o,l);return te(t,c,{axis:n,direction:r,spaceToolConstraints:u,start:o}),bu("resize-"+(n==="x"?"ew":"ns")),!0},Di.prototype.calculateAdjustments=function(e,t,n,i){var o=this._rules,r=[],a=[],s=new Set,c=new Set,l=[],u=[];function p(f){s.has(f)||(s.add(f),r.push(f));var m=f.label;m&&!s.has(m)&&(s.add(m),r.push(m))}function d(f){c.has(f)||(c.add(f),a.push(f))}return K(e,function(f){if(!(!f.parent||ft(f))){if($t(f)){u.push(f);return}var m=f[t],h=m+f[Fo[t]];if(AI(f)&&(n>0&&nt(f)[t]>i||n<0&&nt(f)[t]<i)){l.push(f);return}if(n>0&&m>i||n<0&&h<i){p(f);return}if(m<i&&h>i&&o.allowed("shape.resize",{shape:f})){d(f);return}}}),K(r,function(f){var m=f.attachers;m&&K(m,function(h){p(h)})}),K(l,function(f){var m=f.host;(s.has(m)||c.has(m))&&p(f)}),K(u,function(f){var m=f.source,h=f.target,y=f.label;(s.has(m)||c.has(m))&&(s.has(h)||c.has(h))&&y&&p(y)}),{movingShapes:r,resizingShapes:a}},Di.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Di.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function R_(e){return{top:e.top-Ru,right:e.right+Ru,bottom:e.bottom+Ru,left:e.left-Ru}}function M_(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,o;tt(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),tt(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),tt(n.top)&&(o=Math.max(e.y,n.top),e.dy=e.dy+o-e.y,e.y=o),tt(n.bottom)&&(o=Math.min(e.y,n.bottom),e.dy=e.dy+o-e.y,e.y=o)}}function CI(e,t,n,i,o){var r=e.movingShapes,a=e.resizingShapes;if(a.length){var s={},c,l,u=new Set(r),p=new Set(a);return K(a,function(d){var f=d.attachers,m=d.children,h=Ze(d),y=gt(m,function(G){return!$t(G)&&!ft(G)&&!u.has(G)&&!p.has(G)}),w=gt(m,function(G){return!$t(G)&&!ft(G)&&u.has(G)}),g,v,b,S=[],M=[],B,A,I,H;y.length&&(v=R_(Ze(yn(y))),g=i-h[br[n]]+v[br[n]],n==="n"?s.bottom=l=tt(l)?Math.min(l,g):g:n==="w"?s.right=l=tt(l)?Math.min(l,g):g:n==="s"?s.top=c=tt(c)?Math.max(c,g):g:n==="e"&&(s.left=c=tt(c)?Math.max(c,g):g)),w.length&&(b=R_(Ze(yn(w))),g=i-b[br[Su[n]]]+h[br[Su[n]]],n==="n"?s.bottom=l=tt(l)?Math.min(l,g):g:n==="w"?s.right=l=tt(l)?Math.min(l,g):g:n==="s"?s.top=c=tt(c)?Math.max(c,g):g:n==="e"&&(s.left=c=tt(c)?Math.max(c,g):g)),f&&f.length&&(f.forEach(function(G){u.has(G)?S.push(G):M.push(G)}),S.length&&(B=Ze(yn(S.map(nt))),A=h[br[Su[n]]]-(B[br[Su[n]]]-i)),M.length&&(I=Ze(yn(M.map(nt))),H=I[br[n]]-(h[br[n]]-i)),n==="n"?(g=Math.min(A||1/0,H||1/0),s.bottom=l=tt(l)?Math.min(l,g):g):n==="w"?(g=Math.min(A||1/0,H||1/0),s.right=l=tt(l)?Math.min(l,g):g):n==="s"?(g=Math.max(A||-1/0,H||-1/0),s.top=c=tt(c)?Math.max(c,g):g):n==="e"&&(g=Math.max(A||-1/0,H||-1/0),s.left=c=tt(c)?Math.max(c,g):g));var V=o&&o[d.id];V&&(n==="n"?(g=i+d[Fo[t]]-V[Fo[t]],s.bottom=l=tt(l)?Math.min(l,g):g):n==="w"?(g=i+d[Fo[t]]-V[Fo[t]],s.right=l=tt(l)?Math.min(l,g):g):n==="s"?(g=i-d[Fo[t]]+V[Fo[t]],s.top=c=tt(c)?Math.max(c,g):g):n==="e"&&(g=i-d[Fo[t]]+V[Fo[t]],s.left=c=tt(c)?Math.max(c,g):g))}),s}}function AI(e){return!!e.host}var $h="djs-dragging",C_="djs-resizing",TI=250,Mu=Math.max;function A_(e,t,n,i,o){function r(a,s){K(a,function(c){o.addDragger(c,s),n.addMarker(c,$h)})}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=We("g");Le(u,i.cls("djs-crosshair-group",["no-events"])),ot(s,u);var p=We("path");Le(p,"d",l.x),vt(p).add("djs-crosshair"),ot(u,p);var d=We("path");Le(d,"d",l.y),vt(d).add("djs-crosshair"),ot(u,d),c.crosshairGroup=u}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;Fn(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&mn(c)}),e.on("spaceTool.move",TI,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 d=n.getLayer("space");c=We("path"),Le(c,"d","M0,0 L0,0"),vt(c).add("djs-crosshair"),ot(d,c),s.line=c;var f=We("g");Le(f,i.cls("djs-drag-group",["no-events"])),ot(n.getActiveLayer(),f),r(u,f);var m=new Set(u);K(p,function(M){m.add(M)});var h=new Set,y=s.movingConnections=[];m.forEach(function(M){K(M.outgoing,function(B){h.has(B)||!$t(B)||!m.has(B.target)||(h.add(B),y.push(B))})}),r(y,f),s.dragGroup=f}if(!s.frameGroup){var w=We("g");Le(w,i.cls("djs-frame-group",["no-events"])),ot(n.getActiveLayer(),w);var g=[];K(p,function(M){var B=o.addFrame(M,w),A=B.getBBox();g.push({element:B,initialBounds:A}),n.addMarker(M,C_)}),s.frameGroup=w,s.frames=g}var v={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};Le(c,{d:v[l]});var b={x:"y",y:"x"},S={x:a.dx,y:a.dy};S[b[s.axis]]=0,Fn(s.dragGroup,S.x,S.y),K(s.frames,function(M){var B=M.element,A=M.initialBounds,I,H;s.direction==="e"?Le(B,{width:Mu(A.width+S.x,5)}):(I=Mu(A.width-S.x,5),Le(B,{width:I,x:A.x+A.width-I})),s.direction==="s"?Le(B,{height:Mu(A.height+S.y,5)}):(H=Mu(A.height-S.y,5),Le(B,{height:H,y:A.y+A.height-H}))})}}),e.on("spaceTool.cleanup",function(a){var s=a.context,c=s.movingShapes,l=s.movingConnections,u=s.resizingShapes,p=s.line,d=s.dragGroup,f=s.frameGroup;K(c,function(m){n.removeMarker(m,$h)}),K(l,function(m){n.removeMarker(m,$h)}),d&&(mn(p),mn(d)),K(u,function(m){n.removeMarker(m,C_)}),f&&mn(f)})}A_.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const PI={__init__:["spaceToolPreview"],__depends__:[$o,mo,Eu,Xa,oc],spaceTool:["type",Di],spaceToolPreview:["type",A_]};function Cu(e,t){e.invoke(Di,this),this._canvas=t}Cu.$inject=["injector","canvas"],je(Cu,Di),Cu.prototype.calculateAdjustments=function(e,t,n,i){var o=this._canvas.getRootElement(),r=e[0]===o?null:e[0],a=[];r&&(a=ba(La(o.children.filter(l=>T(l,"bpmn:Artifact")),yn(r))));const s=[...e,...a];var c=Di.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(l){return!(T(l,"bpmn:TextAnnotation")||kI(l)&&(t==="y"&&Tn(l)||t==="x"&&!Tn(l)))}),c};function kI(e){return T(e,"bpmn:Participant")&&!Ee(e).processRef}const T_={__depends__:[PI],spaceTool:["type",Cu]};function Zt(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)}Zt.$inject=["eventBus","injector"],Zt.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()},Zt.prototype.canExecute=function(e,t){const n={command:e,context:t},i=this._getHandler(e);let o=this._fire(e,"canExecute",n);if(o===void 0){if(!i)return!1;i.canExecute&&(o=i.canExecute(t))}return o},Zt.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},Zt.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()}},Zt.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()}},Zt.prototype.register=function(e,t){this._setHandler(e,t)},Zt.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)},Zt.prototype.canUndo=function(){return!!this._getUndoAction()},Zt.prototype.canRedo=function(){return!!this._getRedoAction()},Zt.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},Zt.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},Zt.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)})},Zt.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);const i=t?[e+"."+t,t]:[e];let o;n=this._eventBus.createEvent(n);for(const r of i)if(o=this._eventBus.fire("commandStack."+r,n),n.cancelBubble)break;return o},Zt.prototype._createId=function(){return this._uid++},Zt.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},Zt.prototype._internalExecute=function(e,t){const n=e.command,i=e.context,o=this._getHandler(n);if(!o)throw new Error("no command handler registered for <"+n+">");this._pushAction(e),t||(this._fire(n,"preExecute",e),o.preExecute&&o.preExecute(i),this._fire(n,"preExecuted",e)),this._atomicDo(()=>{this._fire(n,"execute",e),o.execute&&this._markDirty(o.execute(i)),this._executedAction(e,t),this._fire(n,"executed",e)}),t||(this._fire(n,"postExecute",e),o.postExecute&&o.postExecute(i),this._fire(n,"postExecuted",e)),this._popAction()},Zt.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)},Zt.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:jm("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},Zt.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=et(e)?e:[e],t.dirty=t.dirty.concat(e))},Zt.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},Zt.prototype._revertedAction=function(e){this._stackIdx--},Zt.prototype._getHandler=function(e){return this._handlerMap[e]},Zt.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 OI={commandStack:["type",Zt]};function wr(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 DI=250,P_=1400;function Fh(e,t,n){we.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",P_,function(o){var r=o.context,a=r.shapes,s=r.validatedShapes;r.shapes=k_(a),r.validatedShapes=k_(s)}),i&&t.on("shape.move.start",DI,function(o){var r=o.context,a=new Set(r.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(r,c,!0)}),this.preExecuted("elements.move",P_,function(o){var r=o.context,a=r.closure,s=a.enclosedElements,c=[];K(s,function(l){K(l.labels,function(u){s[u.id]||c.push(u)})}),a.addAll(c)}),this.preExecute(["connection.delete","shape.delete"],function(o){var r=o.context,a=r.connection||r.shape;wr(a.labels,function(s){n.removeShape(s,{nested:!0})})}),this.execute("shape.delete",function(o){var r=o.context,a=r.shape,s=a.labelTarget;s&&(r.labelTargetIndex=yf(s.labels,a),r.labelTarget=s,a.labelTarget=null)}),this.revert("shape.delete",function(o){var r=o.context,a=r.shape,s=r.labelTarget,c=r.labelTargetIndex;s&&(un(s.labels,a,c),a.labelTarget=s)})}je(Fh,we),Fh.$inject=["injector","eventBus","modeling"];function k_(e){var t=new Set(e);return gt(e,function(n){return!t.has(n.labelTarget)})}const LI={__init__:["labelSupport"],labelSupport:["type",Fh]};var II=251,O_=1401,D_="attach-ok";function jh(e,t,n,i,o){we.call(this,t);var r=e.get("movePreview",!1);t.on("shape.move.start",O_,function(a){var s=a.context,c=s.shapes,l=s.validatedShapes;s.shapes=BI(c),s.validatedShapes=NI(l)}),r&&t.on("shape.move.start",II,function(a){var s=a.context,c=s.shapes,l=Hh(c);K(l,function(u){r.makeDraggable(s,u,!0),K(u.labels,function(p){r.makeDraggable(s,p,!0)})})}),r&&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,D_),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(u,D_)}))}}),this.preExecuted("elements.move",O_,function(a){var s=a.context,c=s.closure,l=s.shapes,u=Hh(l);K(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=gt(c,function(p){var d=p.host;return $I(p)&&!FI(c,d)}),K(u,function(p){o.updateAttachment(p,l)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;K(s,function(c){K(c.attachers,function(l){K(l.outgoing.slice(),function(u){var p=i.allowed("connection.reconnect",{connection:u,source:u.source,target:u.target});p||o.removeConnection(u)}),K(l.incoming.slice(),function(u){var p=i.allowed("connection.reconnect",{connection:u,source:u.source,target:u.target});p||o.removeConnection(u)})})})}),this.postExecute("shape.create",function(a){var s=a.context,c=s.shape,l=s.host;l&&o.updateAttachment(c,l)}),this.postExecute("shape.replace",function(a){var s=a.context,c=s.oldShape,l=s.newShape;wr(c.attachers,function(u){var p=i.allowed("elements.move",{target:l,shapes:[u]});p==="attach"?o.updateAttachment(u,l):o.removeShape(u)}),l.attachers.length&&K(l.attachers,function(u){var p=Zb(u,c,l);o.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,d=s.hints||{};d.attachSupport!==!1&&K(p,function(f){var m=Zb(f,l,u);o.moveShape(f,m,f.parent),K(f.labels,function(h){o.moveShape(h,m,h.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;wr(s.attachers,function(c){o.removeShape(c)}),s.host&&o.updateAttachment(s,null)})}je(jh,we),jh.$inject=["injector","eventBus","canvas","rules","modeling"];function Hh(e){return Xp(Wn(e,function(t){return t.attachers||[]}))}function BI(e){var t=Hh(e);return iM("id",e,t)}function NI(e){var t=wa(e,"id");return gt(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function $I(e){return!!e.host}function FI(e,t){return e.indexOf(t)!==-1}const jI={__depends__:[mo],__init__:["attachSupport"],attachSupport:["type",jh]};function L_(e,t,n,i){e.on("element.changed",function(o){var r=o.element;(r.parent||r===t.getRootElement())&&(o.gfx=n.getGraphics(r)),o.gfx&&e.fire(Rx(r)+".changed",o)}),e.on("elements.changed",function(o){var r=o.elements;r.forEach(function(a){e.fire("element.changed",{element:a})}),i.updateContainments(r)}),e.on("shape.changed",function(o){i.update("shape",o.element,o.gfx)}),e.on("connection.changed",function(o){i.update("connection",o.element,o.gfx)})}L_.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const Gh={__init__:["changeSupport"],changeSupport:["type",L_]};function Li(e){this._model=e}Li.$inject=["moddle"],Li.prototype._needsId=function(e){return ht(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"])},Li.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;T(e,"bpmn:Activity")?t="Activity":T(e,"bpmn:Event")?t="Event":T(e,"bpmn:Gateway")?t="Gateway":ht(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))},Li.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},Li.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},Li.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",te({bpmnElement:e,bounds:this.createDiBounds()},t))},Li.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},Li.prototype.createDiWaypoints=function(e){var t=this;return Wn(e,function(n){return t.createDiWaypoint(n)})},Li.prototype.createDiWaypoint=function(e){return this.create("dc:Point",Wi(e,["x","y"]))},Li.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",te({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},Li.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",te({bpmnElement:e},t))};function hi(e,t,n){we.call(this,e),this._bpmnFactory=t;var i=this;function o(f){var m=f.context,h=m.hints||{},y;!m.cropped&&h.createElementsBehavior!==!1&&(y=m.connection,y.waypoints=n.getCroppedWaypoints(y),m.cropped=!0)}this.executed(["connection.layout","connection.create"],o),this.reverted(["connection.layout"],function(f){delete f.context.cropped});function r(f){var m=f.context;i.updateParent(m.shape||m.connection,m.oldParent)}function a(f){var m=f.context,h=m.shape||m.connection,y=m.parent||m.newParent;i.updateParent(h,y)}this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],gi(r)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],gi(a));function s(f){var m=f.context,h=m.oldRoot,y=h.children;K(y,function(w){T(w,"bpmn:BaseElement")&&i.updateParent(w)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(f){var m=f.context.shape;T(m,"bpmn:BaseElement")&&i.updateBounds(m)}this.executed(["shape.move","shape.create","shape.resize"],gi(function(f){f.context.shape.type!=="label"&&c(f)})),this.reverted(["shape.move","shape.create","shape.resize"],gi(function(f){f.context.shape.type!=="label"&&c(f)})),e.on("shape.changed",function(f){f.element.type==="label"&&c({context:{shape:f.element}})});function l(f){i.updateConnection(f.context)}this.executed(["connection.create","connection.move","connection.delete","connection.reconnect"],gi(l)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],gi(l));function u(f){i.updateConnectionWaypoints(f.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],gi(u)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],gi(u)),this.executed("connection.reconnect",gi(function(f){var m=f.context,h=m.connection,y=m.oldSource,w=m.newSource,g=Ee(h),v=Ee(y),b=Ee(w);g.conditionExpression&&!ht(b,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(m.oldConditionExpression=g.conditionExpression,delete g.conditionExpression),y!==w&&v.default===g&&(m.oldDefault=v.default,delete v.default)})),this.reverted("connection.reconnect",gi(function(f){var m=f.context,h=m.connection,y=m.oldSource,w=m.newSource,g=Ee(h),v=Ee(y),b=Ee(w);m.oldConditionExpression&&(g.conditionExpression=m.oldConditionExpression),m.oldDefault&&(v.default=m.oldDefault,delete b.default)}));function p(f){i.updateAttachment(f.context)}this.executed(["element.updateAttachment"],gi(p)),this.reverted(["element.updateAttachment"],gi(p)),this.executed("element.updateLabel",gi(d)),this.reverted("element.updateLabel",gi(d));function d(f){const{element:m}=f.context,h=ii(m),y=wt(m),w=y&&y.get("label");fo(m)||fu(m)||(h&&!w?y.set("label",t.create("bpmndi:BPMNLabel")):!h&&w&&y.set("label",void 0))}}je(hi,we),hi.$inject=["eventBus","bpmnFactory","connectionDocking"],hi.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},hi.prototype.updateParent=function(e,t){if(!ft(e)&&!(T(e,"bpmn:DataStoreReference")&&e.parent&&T(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,o=wt(e),r=n&&n.businessObject,a=wt(n);T(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,r,t&&t.businessObject),T(e,"bpmn:DataOutputAssociation")&&(e.source?r=e.source.businessObject:r=null),T(e,"bpmn:DataInputAssociation")&&(e.target?r=e.target.businessObject:r=null),this.updateSemanticParent(i,r),T(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,r),this.updateDiParent(o,a)}},hi.prototype.updateBounds=function(e){var t=wt(e),n=GI(e);if(n){var i=Qi(n,t.get("bounds"));te(n,{x:e.x+i.x,y:e.y+i.y})}var o=ft(e)?this._getLabel(t):t,r=o.bounds;r||(r=this._bpmnFactory.createDiBounds(),o.set("bounds",r)),te(r,{x:e.x,y:e.y,width:e.width,height:e.height})},hi.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,o;T(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),an(i,e)),T(t,"bpmn:Lane")&&(o=t.get("flowNodeRef"),un(o,e))}},hi.prototype.updateDiConnection=function(e,t,n){var i=wt(e),o=wt(t),r=wt(n);i.sourceElement&&i.sourceElement.bpmnElement!==Ee(t)&&(i.sourceElement=t&&o),i.targetElement&&i.targetElement.bpmnElement!==Ee(n)&&(i.targetElement=n&&r)},hi.prototype.updateDiParent=function(e,t){if(t&&!T(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(an(n,e),e.$parent=null)}};function HI(e){for(;e&&!T(e,"bpmn:Definitions");)e=e.$parent;return e}hi.prototype.getLaneSet=function(e){var t,n;return T(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(T(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)},hi.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&!((T(e,"bpmn:DataInput")||T(e,"bpmn:DataOutput"))&&(T(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(T(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(T(e,"bpmn:FlowElement")){if(t){if(T(t,"bpmn:Participant"))t=t.processRef;else if(T(t,"bpmn:Lane"))do t=t.$parent.$parent;while(T(t,"bpmn:Lane"))}i="flowElements"}else if(T(e,"bpmn:Artifact")){for(;t&&!T(t,"bpmn:Process")&&!T(t,"bpmn:SubProcess")&&!T(t,"bpmn:Collaboration");)if(T(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;i="artifacts"}else if(T(e,"bpmn:MessageFlow"))i="messageFlows";else if(T(e,"bpmn:Participant")){i="participants";var o=e.processRef,r;o&&(r=HI(e.$parent||t),e.$parent&&(an(r.get("rootElements"),o),o.$parent=null),t&&(un(r.get("rootElements"),o),o.$parent=r))}else T(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":T(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),an(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);an(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},hi.prototype.updateConnectionWaypoints=function(e){var t=wt(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},hi.prototype.updateConnection=function(e){var t=e.connection,n=Ee(t),i=t.source,o=Ee(i),r=t.target,a=Ee(t.target),s;if(T(n,"bpmn:DataAssociation"))T(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=o,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):T(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||o,this.updateSemanticParent(n,o,s),n.targetRef=a);else{var c=T(n,"bpmn:SequenceFlow");n.sourceRef!==o&&(c&&(an(n.sourceRef&&n.sourceRef.get("outgoing"),n),o&&o.get("outgoing")&&o.get("outgoing").push(n)),n.sourceRef=o),n.targetRef!==a&&(c&&(an(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,r)},hi.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function gi(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;T(i,"bpmn:BaseElement")&&e(t)}}function GI(e){if(T(e,"bpmn:Activity")){var t=wt(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function _r(e,t){Lo.call(this),this._bpmnFactory=e,this._moddle=t}je(_r,Lo),_r.$inject=["bpmnFactory","moddle"],_r.prototype._baseCreate=Lo.prototype.create,_r.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,te({type:"label",di:n},Xr,t))}return this.createElement(e,t)},_r.prototype.createElement=function(e,t){t=te({},t||{});var n,i=t.businessObject,o=t.di;if(!i){if(!t.type)throw new Error("no shape type specified");i=this._bpmnFactory.create(t.type)}if(!VI(o)){var r=te({},o||{},{id:i.id+"_di"});e==="root"?o=this._bpmnFactory.createDiPlane(i,r):e==="connection"?o=this._bpmnFactory.createDiEdge(i,r):o=this._bpmnFactory.createDiShape(i,r)}T(i,"bpmn:Group")&&(t=te({isFrame:!0},t)),t=zI(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=zh(o,t,"isExpanded")),ht(i,["bpmn:Lane","bpmn:Participant"])&&(t=zh(o,t,"isHorizontal")),T(i,"bpmn:SubProcess")&&(t.collapsed=!xt(i,o)),T(i,"bpmn:ExclusiveGateway")&&(si(o,"isMarkerVisible")?o.isMarkerVisible===void 0&&(o.isMarkerVisible=!1):o.isMarkerVisible=!0),En(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),En(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,o),t=te({id:i.id},n,t,{businessObject:i,di:o}),this._baseCreate(e,t)},_r.prototype.getDefaultSize=function(e,t){var n=Ee(e);if(t=t||wt(e),T(n,"bpmn:SubProcess"))return xt(n,t)?{width:350,height:200}:{width:100,height:80};if(T(n,"bpmn:Task"))return{width:100,height:80};if(T(n,"bpmn:Gateway"))return{width:50,height:50};if(T(n,"bpmn:Event"))return{width:36,height:36};if(T(n,"bpmn:Participant")){var i=t.isHorizontal===void 0||t.isHorizontal===!0;return xt(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return T(n,"bpmn:Lane")?{width:400,height:100}:T(n,"bpmn:DataObjectReference")?{width:36,height:50}:T(n,"bpmn:DataStoreReference")?{width:50,height:50}:T(n,"bpmn:TextAnnotation")?{width:100,height:40}:T(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},_r.prototype.createParticipantShape=function(e){return Sn(e)||(e={isExpanded:e}),e=te({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function zI(e,t,n){return K(n,function(i){t=zh(e,t,i)}),t}function zh(e,t,n){return t[n]===void 0?t:(e[n]=t[n],oo(t,[n]))}function VI(e){return ht(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function Au(e,t){this._modeling=e,this._canvas=t}Au.$inject=["modeling","canvas"],Au.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;K(n,function(o){var r={x:0,y:0};En(i.left)?r.x=i.left-o.x:En(i.right)?r.x=i.right-o.width-o.x:En(i.center)?r.x=i.center-Math.round(o.width/2)-o.x:En(i.top)?r.y=i.top-o.y:En(i.bottom)?r.y=i.bottom-o.height-o.y:En(i.middle)&&(r.y=i.middle-Math.round(o.height/2)-o.y),t.moveElements([o],r,o.parent)})},Au.prototype.postExecute=function(e){};function Tu(e){this._modeling=e}Tu.$inject=["modeling"],Tu.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var n=e.target||t.parent,i=e.shape,o=e.hints||{};i=e.shape=this._modeling.createShape(i,e.position,n,{attach:o.attach}),e.shape=i},Tu.prototype.postExecute=function(e){var t=e.hints||{};WI(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 WI(e,t){return Zo(e.outgoing,function(n){return n.target===t})}function Pu(e,t){this._canvas=e,this._layouter=t}Pu.$inject=["canvas","layouter"],Pu.prototype.execute=function(e){var t=e.connection,n=e.source,i=e.target,o=e.parent,r=e.parentIndex,a=e.hints;if(!n||!i)throw new Error("source and target required");if(!o)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,o,r),t},Pu.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var ku=Math.round;function Vh(e){this._modeling=e}Vh.$inject=["modeling"],Vh.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,o=e.position,r=e.hints,a=this._modeling;K(t,function(p){tt(p.x)||(p.x=0),tt(p.y)||(p.y=0)});var s=gt(t,function(p){return!p.hidden}),c=yn(s);K(t,function(p){$t(p)&&(p.waypoints=Wn(p.waypoints,function(d){return{x:ku(d.x-c.x-c.width/2+o.x),y:ku(d.y-c.y-c.height/2+o.y)}})),te(p,{x:ku(p.x-c.x-c.width/2+o.x),y:ku(p.y-c.y-c.height/2+o.y)})});var l=new Set(Dl(t)),u={};K(t,function(p){if($t(p)){u[p.id]=tt(i)?a.createConnection(u[p.source.id],u[p.target.id],i,p,p.parent||n,r):a.createConnection(u[p.source.id],u[p.target.id],p,p.parent||n,r);return}var d=te({},r);l.has(p)||(d.autoResize=!1),ft(p)&&(d=oo(d,["attach"])),u[p.id]=tt(i)?a.createShape(p,Wi(p,["x","y","width","height"]),p.parent||n,i,d):a.createShape(p,Wi(p,["x","y","width","height"]),p.parent||n,d)}),e.elements=ba(u)};var I_=Math.round;function Er(e){this._canvas=e}Er.$inject=["canvas"],Er.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,o=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return n.width!==void 0?te(t,n):te(t,{x:n.x-I_(t.width/2),y:n.y-I_(t.height/2)}),this._canvas.addShape(t,i,o),t},Er.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function ac(e){Er.call(this,e)}je(ac,Er),ac.$inject=["canvas"];var UI=Er.prototype.execute;ac.prototype.execute=function(e){var t=e.shape;return YI(t),t.labelTarget=e.labelTarget,UI.call(this,e)};var qI=Er.prototype.revert;ac.prototype.revert=function(e){return e.shape.labelTarget=null,qI.call(this,e)};function YI(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function sc(e,t){this._canvas=e,this._modeling=t}sc.$inject=["canvas","modeling"],sc.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;wr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),wr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},sc.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=yf(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},sc.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,un(n.children,t,i),this._canvas.addConnection(t,n),t};function Wh(e,t){this._modeling=e,this._elementRegistry=t}Wh.$inject=["modeling","elementRegistry"],Wh.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;K(i,function(o){n.get(o.id)&&(o.waypoints?t.removeConnection(o):t.removeShape(o))})};function cc(e,t){this._canvas=e,this._modeling=t}cc.$inject=["canvas","modeling"],cc.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;wr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),wr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),wr(n.children,function(i){$t(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},cc.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=yf(i.children,n),t.removeShape(n),n},cc.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,o=e.oldParentIndex;return un(i.children,n,o),t.addShape(n,i),n};function Ou(e){this._modeling=e}Ou.$inject=["modeling"];var B_={x:"y",y:"x"};Ou.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,o=e.dimension;function r(y,w){y.range.min=Math.min(w[i],y.range.min),y.range.max=Math.max(w[i]+w[o],y.range.max)}function a(y){return y[i]+y[o]/2}function s(y){return y.length-1}function c(y){return y.max-y.min}function l(y,w){var g={y:0};g[i]=y-a(w),g[i]&&(g[B_[i]]=0,t.moveElements([w],g,w.parent))}var u=n[0],p=s(n),d=n[p],f,m,h=0;K(n,function(y,w){var g,v,b;if(y.elements.length<2){w&&w!==n.length-1&&(r(y,y.elements[0]),h+=c(y.range));return}g=io(y.elements,i),v=g[0],w===p&&(v=g[s(g)]),b=a(v),y.range=null,K(g,function(S){if(l(b,S),y.range===null){y.range={min:S[i],max:S[i]+S[o]};return}r(y,S)}),w&&w!==n.length-1&&(h+=c(y.range))}),m=Math.abs(d.range.min-u.range.max),f=Math.round((m-h)/(n.length-1)),!(f<n.length-1)&&K(n,function(y,w){var g={},v;y===u||y===d||(v=n[w-1],y.range.max=0,K(y.elements,function(b,S){g[B_[i]]=0,g[i]=v.range.max-b[i]+f,y.range.min!==b[i]&&(g[i]+=b[i]-y.range.min),g[i]&&t.moveElements([b],g,b.parent),y.range.max=Math.max(b[i]+b[o],S?y.range.max:0)}))})},Ou.prototype.postExecute=function(e){};function Du(e,t){this._layouter=e,this._canvas=t}Du.$inject=["layouter","canvas"],Du.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return te(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},Du.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function Uh(){}Uh.prototype.execute=function(e){var t=e.connection,n=e.delta,i=e.newParent||t.parent,o=e.newParentIndex,r=t.parent;return e.oldParent=r,e.oldParentIndex=an(r.children,t),un(i.children,t,o),t.parent=i,K(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},Uh.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,o=e.oldParentIndex,r=e.delta;return an(n.children,t),un(i.children,t,o),t.parent=i,K(t.waypoints,function(a){a.x-=r.x,a.y-=r.y,a.original&&(a.original.x-=r.x,a.original.y-=r.y)}),t};function qh(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}qh.prototype.add=function(e,t){return this.addAll([e],t)},qh.prototype.addAll=function(e,t){var n=Mk(e,!!t,this);return te(this,n),this};function lc(e){this._modeling=e}lc.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},lc.prototype.moveClosure=function(e,t,n,i,o){var r=this._modeling,a=e.allShapes,s=e.allConnections,c=e.enclosedConnections,l=e.topLevel,u=!1;o&&o.parent===n&&(u=!0),K(a,function(p){r.moveShape(p,t,l[p.id]&&!u&&n,{recurse:!1,layout:!1})}),K(s,function(p){var d=!!a[p.source.id],f=!!a[p.target.id];c[p.id]&&d&&f?r.moveConnection(p,t,l[p.id]&&!u&&n):r.layoutConnection(p,{connectionStart:d&&eh(p,p.source,t),connectionEnd:f&&th(p,p.target,t)})})},lc.prototype.getClosure=function(e){return new qh().addAll(e,!0)};function Lu(e){this._helper=new lc(e)}Lu.$inject=["modeling"],Lu.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},Lu.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 ia(e){this._modeling=e,this._helper=new lc(e)}ia.$inject=["modeling"],ia.prototype.execute=function(e){var t=e.shape,n=e.delta,i=e.newParent||t.parent,o=e.newParentIndex,r=t.parent;return e.oldBounds=Wi(t,["x","y","width","height"]),e.oldParent=r,e.oldParentIndex=an(r.children,t),un(i.children,t,o),te(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},ia.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,o=this._modeling;i.layout!==!1&&(K(t.incoming,function(r){o.layoutConnection(r,{connectionEnd:th(r,t,n)})}),K(t.outgoing,function(r){o.layoutConnection(r,{connectionStart:eh(r,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},ia.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,o=e.delta;return un(n.children,t,i),te(t,{parent:n,x:t.x-o.x,y:t.y-o.y}),t},ia.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},ia.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function uc(e){this._modeling=e}uc.$inject=["modeling"],uc.prototype.execute=function(e){var t=e.newSource,n=e.newTarget,i=e.connection,o=e.dockingOrPoints;if(!t&&!n)throw new Error("newSource or newTarget required");return et(o)&&(e.oldWaypoints=i.waypoints,i.waypoints=o),t&&(e.oldSource=i.source,i.source=t),n&&(e.oldTarget=i.target,i.target=n),i},uc.prototype.postExecute=function(e){var t=e.connection,n=e.newSource,i=e.newTarget,o=e.dockingOrPoints,r=e.hints||{},a={};r.connectionStart&&(a.connectionStart=r.connectionStart),r.connectionEnd&&(a.connectionEnd=r.connectionEnd),r.layoutConnection!==!1&&(n&&(!i||r.docking==="source")&&(a.connectionStart=a.connectionStart||N_(et(o)?o[0]:o)),i&&(!n||r.docking==="target")&&(a.connectionEnd=a.connectionEnd||N_(et(o)?o[o.length-1]:o)),r.newWaypoints&&(a.waypoints=r.newWaypoints),this._modeling.layoutConnection(t,a))},uc.prototype.revert=function(e){var t=e.oldSource,n=e.oldTarget,i=e.oldWaypoints,o=e.connection;return t&&(o.source=t),n&&(o.target=n),i&&(o.waypoints=i),o};function N_(e){return e.original||e}function jo(e,t){this._modeling=e,this._rules=t}jo.$inject=["modeling","rules"],jo.prototype.preExecute=function(e){var t=this,n=this._modeling,i=this._rules,o=e.oldShape,r=e.newData,a=e.hints||{},s;function c(m,h,y){return i.allowed("connection.reconnect",{connection:y,source:m,target:h})}var l={x:r.x,y:r.y},u={x:o.x,y:o.y,width:o.width,height:o.height};s=e.newShape=e.newShape||t.createShape(r,l,o.parent,a),o.host&&n.updateAttachment(s,o.host);var p;a.moveChildren!==!1&&(p=o.children.slice(),n.moveElements(p,{x:0,y:0},s,a));var d=o.incoming.slice(),f=o.outgoing.slice();K(d,function(m){var h=m.source,y=c(h,s,m);y&&t.reconnectEnd(m,s,su(m,s,u),a)}),K(f,function(m){var h=m.target,y=c(s,h,m);y&&t.reconnectStart(m,s,au(m,s,u),a)})},jo.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},jo.prototype.execute=function(e){},jo.prototype.revert=function(e){},jo.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},jo.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},jo.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function pc(e){this._modeling=e}pc.$inject=["modeling"],pc.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},te(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},pc.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,o=e.hints||{};o.layout!==!1&&(K(n.incoming,function(r){t.layoutConnection(r,{connectionEnd:su(r,n,i)})}),K(n.outgoing,function(r){t.layoutConnection(r,{connectionStart:au(r,n,i)})}))},pc.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return te(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function Sr(e){this._modeling=e}Sr.$inject=["modeling"],Sr.prototype.preExecute=function(e){var t=e.delta,n=e.direction,i=e.movingShapes,o=e.resizingShapes,r=e.start,a={};this.moveShapes(i,t),K(o,function(s){a[s.id]=XI(s)}),this.resizeShapes(o,t,n),this.updateConnectionWaypoints(EI(i,o),t,n,r,i,o,a)},Sr.prototype.execute=function(){},Sr.prototype.revert=function(){},Sr.prototype.moveShapes=function(e,t){var n=this;K(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},Sr.prototype.resizeShapes=function(e,t,n){var i=this;K(e,function(o){var r=SI(o,n,t);i._modeling.resizeShape(o,r,null,{attachSupport:!1,autoResize:!1,layout:!1})})},Sr.prototype.updateConnectionWaypoints=function(e,t,n,i,o,r,a){var s=this,c=new Set(o),l=new Set(r);K(e,function(u){var p=u.source,d=u.target,f=KI(u),m=F_(n),h={},y=c.has(p)||l.has(p),w=c.has(d)||l.has(d);y&&w?(f=Wn(f,function(g){return j_(g,i,n)&&(g[m]=g[m]+t[m]),g.original&&j_(g.original,i,n)&&(g.original[m]=g.original[m]+t[m]),g}),s._modeling.updateWaypoints(u,f,{labelBehavior:!1})):(y||w)&&(c.has(p)?h.connectionStart=eh(u,p,t):c.has(d)?h.connectionEnd=th(u,d,t):l.has(p)?h.connectionStart=au(u,p,a[p.id]):l.has(d)&&(h.connectionEnd=su(u,d,a[d.id])),s._modeling.layoutConnection(u,h))})};function $_(e){return te({},e)}function KI(e){return Wn(e.waypoints,function(t){return t=$_(t),t.original&&(t.original=$_(t.original)),t})}function F_(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function j_(e,t,n){var i=F_(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function XI(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function Iu(e){this._modeling=e}Iu.$inject=["modeling"],Iu.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=H_(n),t.collapsed=!t.collapsed;var i=G_(n,t.collapsed);return[t].concat(i)},Iu.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,o=z_(i,n);return t.collapsed=!t.collapsed,[t].concat(o)};function H_(e){var t={};return K(e,function(n){t[n.id]=n.hidden,n.children&&(t=te({},t,H_(n.children)))}),t}function G_(e,t){var n=[];return K(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(G_(i.children,i.collapsed||t)))}),n}function z_(e,t){var n=[];return K(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(z_(i.children,t)))}),n}function Bu(e){this._modeling=e}Bu.$inject=["modeling"],Bu.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=V_(i,t),W_(n,t),t.host=n,t},Bu.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,o=e.attacherIdx;return t.host=i,V_(n,t),W_(i,t,o),t};function V_(e,t){return an(e&&e.attachers,t)}function W_(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),un(i,t,n)}}function Yh(){}Yh.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},Yh.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function Ft(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}Ft.$inject=["eventBus","elementFactory","commandStack"],Ft.prototype.getHandlers=function(){return{"shape.append":Tu,"shape.create":Er,"shape.delete":cc,"shape.move":ia,"shape.resize":pc,"shape.replace":jo,"shape.toggleCollapse":Iu,spaceTool:Sr,"label.create":ac,"connection.create":Pu,"connection.delete":sc,"connection.move":Uh,"connection.layout":Du,"connection.updateWaypoints":Yh,"connection.reconnect":uc,"elements.create":Vh,"elements.move":Lu,"elements.delete":Wh,"elements.distribute":Ou,"elements.align":Au,"element.updateAttachment":Bu}},Ft.prototype.registerHandlers=function(e){K(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},Ft.prototype.moveShape=function(e,t,n,i,o){typeof i=="object"&&(o=i,i=null);var r={shape:e,delta:t,newParent:n,newParentIndex:i,hints:o||{}};this._commandStack.execute("shape.move",r)},Ft.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},Ft.prototype.moveElements=function(e,t,n,i){i=i||{};var o=i.attach,r=n,a;o===!0?(a=n,r=n.parent):o===!1&&(a=null);var s={shapes:e,delta:t,newParent:r,newHost:a,hints:i};this._commandStack.execute("elements.move",s)},Ft.prototype.moveConnection=function(e,t,n,i,o){typeof i=="object"&&(o=i,i=void 0);var r={connection:e,delta:t,newParent:n,newParentIndex:i,hints:o||{}};this._commandStack.execute("connection.move",r)},Ft.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},Ft.prototype.createConnection=function(e,t,n,i,o,r){typeof n=="object"&&(r=o,o=i,i=n,n=void 0),i=this._create("connection",i);var a={source:e,target:t,parent:o,parentIndex:n,connection:i,hints:r};return this._commandStack.execute("connection.create",a),a.connection},Ft.prototype.createShape=function(e,t,n,i,o){typeof i!="number"&&(o=i,i=void 0),o=o||{};var r=o.attach,a,s;e=this._create("shape",e),r?(a=n.parent,s=n):a=n;var c={position:t,shape:e,parent:a,parentIndex:i,host:s,hints:o};return this._commandStack.execute("shape.create",c),c.shape},Ft.prototype.createElements=function(e,t,n,i,o){et(e)||(e=[e]),typeof i!="number"&&(o=i,i=void 0),o=o||{};var r={position:t,elements:e,parent:n,parentIndex:i,hints:o};return this._commandStack.execute("elements.create",r),r.elements},Ft.prototype.createLabel=function(e,t,n,i){n=this._create("label",n);var o={labelTarget:e,position:t,parent:i||e.parent,shape:n};return this._commandStack.execute("label.create",o),o.shape},Ft.prototype.appendShape=function(e,t,n,i,o){o=o||{},t=this._create("shape",t);var r={source:e,position:n,target:i,shape:t,connection:o.connection,connectionParent:o.connectionParent,hints:o};return this._commandStack.execute("shape.append",r),r.shape},Ft.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},Ft.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},Ft.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},Ft.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},Ft.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},Ft.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},Ft.prototype.resizeShape=function(e,t,n,i){var o={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",o)},Ft.prototype.createSpace=function(e,t,n,i,o){var r={delta:n,direction:i,movingShapes:e,resizingShapes:t,start:o};this._commandStack.execute("spaceTool",r)},Ft.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},Ft.prototype.reconnect=function(e,t,n,i,o){var r={connection:e,newSource:t,newTarget:n,dockingOrPoints:i,hints:o||{}};this._commandStack.execute("connection.reconnect",r)},Ft.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,te(i,{docking:"source"}))},Ft.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,te(i,{docking:"target"}))},Ft.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},Ft.prototype._create=function(e,t){return p2(t)?t:this._elementFactory.create(e,t)},Ft.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function dc(e){this._elementRegistry=e}dc.$inject=["elementRegistry"],dc.prototype.execute=function(e){var t=e.element,n=e.moddleElement,i=e.properties;if(!n)throw new Error("<moddleElement> required");var o=e.changed||this._getVisualReferences(n).concat(t),r=e.oldProperties||ZI(n,Jc(i));return U_(n,i),e.oldProperties=r,e.changed=o,o},dc.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return U_(n,t),i},dc.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return T(e,"bpmn:DataObject")?JI(e,t):[]};function ZI(e,t){return ci(t,function(n,i){return n[i]=e.get(i),n},{})}function U_(e,t){K(t,function(n,i){e.set(i,n)})}function JI(e,t){return t.filter(function(n){return T(n,"bpmn:DataObjectReference")&&Ee(n).dataObjectRef===e})}var fc="default",Ho="id",q_="di",QI={width:0,height:0};function hc(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}hc.$inject=["elementRegistry","moddle","modeling","textRenderer"],hc.prototype.execute=function(e){var t=e.element,n=[t];if(!t)throw new Error("element required");var i=this._elementRegistry,o=this._moddle.ids,r=t.businessObject,a=oB(e.properties),s=e.oldProperties||eB(t,a);return Y_(a,r)&&(o.unclaim(r[Ho]),i.updateId(t,a[Ho]),o.claim(a[Ho],r)),fc in a&&(a[fc]&&n.push(i.get(a[fc].id)),r[fc]&&n.push(i.get(r[fc].id))),K_(t,a),e.oldProperties=s,e.changed=n,n},hc.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&Ee(n).name;if(i){var o=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,o,QI)}},hc.prototype.revert=function(e){var t=e.element,n=e.properties,i=e.oldProperties,o=t.businessObject,r=this._elementRegistry,a=this._moddle.ids;return K_(t,i),Y_(n,o)&&(a.unclaim(n[Ho]),r.updateId(t,i[Ho]),a.claim(i[Ho],o)),e.changed};function Y_(e,t){return Ho in e&&e[Ho]!==t[Ho]}function eB(e,t){var n=Jc(t),i=e.businessObject,o=wt(e);return ci(n,function(r,a){return a!==q_?r[a]=i.get(a):r[a]=tB(o,Jc(t.di)),r},{})}function tB(e,t){return ci(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function K_(e,t){var n=e.businessObject,i=wt(e);K(t,function(o,r){r!==q_?n.set(r,o):i&&nB(i,o)})}function nB(e,t){K(t,function(n,i){e.set(i,n)})}var iB=["default"];function oB(e){var t=te({},e);return iB.forEach(function(n){n in e&&(t[n]=Ee(t[n]))}),t}function Nu(e,t){this._canvas=e,this._modeling=t}Nu.$inject=["canvas","modeling"],Nu.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,o=t.getRootElement(),r=o.businessObject,a=r.$parent,s=wt(o);return t.setRootElement(n),t.removeRootElement(o),un(a.rootElements,i),i.$parent=a,an(a.rootElements,r),r.$parent=null,o.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=o,[]},Nu.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,o=e.oldRoot,r=o.businessObject,a=i.$parent,s=wt(n);return t.setRootElement(o),t.removeRootElement(n),an(a.rootElements,i),i.$parent=null,un(a.rootElements,r),r.$parent=a,n.di=null,s.bpmnElement=r,o.di=s,[]};function Kh(e,t){this._modeling=e,this._spaceTool=t}Kh.$inject=["modeling","spaceTool"],Kh.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,o=e.location,r=Pi(i),a=r===i,s=a?i:i.parent,c=mr(s),l=Tn(i);if(l?o==="left"?o="top":o==="right"&&(o="bottom"):o==="top"?o="left":o==="bottom"&&(o="right"),!c.length){var u=l?{x:i.x+Ti,y:i.y,width:i.width-Ti,height:i.height}:{x:i.x,y:i.y+Ti,width:i.width,height:i.height-Ti};n.createShape({type:"bpmn:Lane",isHorizontal:l},u,s)}var p=[];Yr(r,function(b){return p.push(b),b.label&&p.push(b.label),b===i?[]:gt(b.children,function(S){return S!==i})});var d,f,m,h,y;o==="top"?(d=-120,f=i.y,m=f+10,h="n",y="y"):o==="left"?(d=-120,f=i.x,m=f+10,h="w",y="x"):o==="bottom"?(d=120,f=i.y+i.height,m=f-10,h="s",y="y"):o==="right"&&(d=120,f=i.x+i.width,m=f-10,h="e",y="x");var w=t.calculateAdjustments(p,y,d,m),g=l?{x:0,y:d}:{x:d,y:0};t.makeSpace(w.movingShapes,w.resizingShapes,g,h,m);var v=l?{x:i.x+(a?Ti:0),y:f-(o==="top"?120:0),width:i.width-(a?Ti:0),height:120}:{x:f-(o==="left"?120:0),y:i.y+(a?Ti:0),width:120,height:i.height-(a?Ti:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:l},v,s)};function Xh(e){this._modeling=e}Xh.$inject=["modeling"],Xh.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,o=mr(n),r=o.length;if(r>i)throw new Error(`more than <${i}> child lanes`);var a=Tn(n),s=a?n.height:n.width,c=Math.round(s/i),l,u,p,d;for(d=0;d<i;d++)d===i-1?l=s-c*d:l=c,u=a?{x:n.x+Ti,y:n.y+d*c,width:n.width-Ti,height:l}:{x:n.x+d*c,y:n.y+Ti,width:l,height:n.height-Ti},d<r?t.resizeShape(o[d],u):(p={type:"bpmn:Lane",isHorizontal:a},t.createShape(p,u,n))};function gc(e,t){this._modeling=e,this._spaceTool=t}gc.$inject=["modeling","spaceTool"],gc.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},gc.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=JO(e,t);n.resizeShape(e,t),i.forEach(function(o){n.resizeShape(o.shape,o.newBounds)})},gc.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=Ze(e),o=Ze(t),r=Cb(o,i),a=Pi(e),s=[],c=[];Yr(a,function(m){return s.push(m),(T(m,"bpmn:Lane")||T(m,"bpmn:Participant"))&&c.push(m),m.children});var l,u,p,d,f;(r.bottom||r.top)&&(l=r.bottom||r.top,u=e.y+(r.bottom?e.height:0)+(r.bottom?-10:10),p=r.bottom?"s":"n",d=r.top>0||r.bottom<0?-l:l,f=n.calculateAdjustments(s,"y",d,u),n.makeSpace(f.movingShapes,f.resizingShapes,{x:0,y:l},p)),(r.left||r.right)&&(l=r.right||r.left,u=e.x+(r.right?e.width:0)+(r.right?-10:100),p=r.right?"e":"w",d=r.left>0||r.right<0?-l:l,f=n.calculateAdjustments(c,"x",d,u),n.makeSpace(f.movingShapes,f.resizingShapes,{x:l,y:0},p))};var mc="flowNodeRef",Zh="lanes";function $u(){}$u.prototype._computeUpdates=function(e,t){var n=[],i=[],o={},r=[];function a(u,p){var d=Ze(p),f={x:u.x+u.width/2,y:u.y+u.height/2};return f.x>d.left&&f.x<d.right&&f.y>d.top&&f.y<d.bottom}function s(u){n.indexOf(u)===-1&&(r.push(u),n.push(u))}function c(u){var p=Pi(u);return o[p.id]||(o[p.id]=tu(p)),o[p.id]}function l(u){if(!u.parent)return[];var p=c(u);return p.filter(function(d){return a(u,d)}).map(function(d){return d.businessObject})}return t.forEach(function(u){var p=Pi(u);if(!(!p||n.indexOf(p)!==-1)){var d=p.children.filter(function(f){return T(f,"bpmn:FlowNode")});d.forEach(s),n.push(p)}}),e.forEach(s),r.forEach(function(u){var p=u.businessObject,d=p.get(Zh),f=d.slice(),m=l(u);i.push({flowNode:p,remove:f,add:m})}),t.forEach(function(u){var p=u.businessObject;u.parent||p.get(mc).forEach(function(d){i.push({flowNode:d,remove:[p],add:[]})})}),i},$u.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,o=i.get(Zh);n.remove.forEach(function(r){an(o,r),an(r.get(mc),i)}),n.add.forEach(function(r){un(o,r),un(r.get(mc),i)})}),[]},$u.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,o=i.get(Zh);n.add.forEach(function(r){an(o,r),an(r.get(mc),i)}),n.remove.forEach(function(r){un(o,r),un(r.get(mc),i)})}),[]};var Jh="categoryValueRef";function yc(e,t){this._bpmnFactory=e,this._elementRegistry=t}yc.$inject=["bpmnFactory","elementRegistry"],yc.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,o=new Map,r=[],a=new Map;function s(g,v,b){if(v){var S=a.get(g);S||(S={},a.set(g,S)),!(b&&S.present)&&(!b&&S.past||(b?S.present={categoryValue:v,root:Qh(g)}:S.past={categoryValue:v}))}}function c(g){o.set(g,Ee(g))}function l(){n.filter(function(g){return T(g,"bpmn:FlowElement")&&!ft(g)&&g.parent}).forEach(c)}function u(g){var v=Ee(g),b=v.get("categoryValueRef");return b||(b=_b(i,v),r.push(rB(g,b))),b}function p(g){return g.reduce(function(v,b){var S=Qh(b),M=v.get(S);return M||(M=[],v.set(S,M)),M.push(b),v},new Map)}e=Array.from(e||[]);var d=p(e);t.length&&l(),e.forEach(c),n.filter(function(g){return T(g,"bpmn:Group")&&!ft(g)&&g.parent}).forEach(function(g){var v=Ee(g).get("categoryValueRef");if(!v){var b=Qh(g),S=d.get(b)||[],M=La(S,g),B=Object.keys(M).length>0;B&&(v=u(g))}s(g,v,!0)}),t.forEach(function(g){s(g.groupShape,g.categoryValue,!1)}),r.length&&l();var f=Array.from(o.keys()),m=Array.from(a.values()).reduce(function(g,v){return v.present&&g.add(v.present.categoryValue),v.past&&g.add(v.past.categoryValue),g},new Set),h=new Map,y=p(f);a.forEach(function(g,v){var b=g.present;if(b){var S=y.get(b.root)||[],M=La(S,v);S.forEach(function(B){if(M[B.id]){var A=h.get(B);A||(A=new Set,h.set(B,A)),A.add(b.categoryValue)}})}});var w=f.reduce(function(g,v){var b=o.get(v),S=b.get(Jh),M=new Set(S),B=h.get(v)||new Set,A=Array.from(B).filter(function(H){return!M.has(H)}),I=S.filter(function(H){return m.has(H)&&!B.has(H)});return(A.length||I.length)&&g.push({businessObject:b,categoryValuesToAdd:A,categoryValuesToRemove:I}),g},[]);return{flowElements:w,groups:r}},yc.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),aB(t.groups),cB(t.flowElements),[]},yc.prototype.revert=function(e){var t=e.updates;return lB(t.flowElements),sB(t.groups),[]};function rB(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function aB(e){e.forEach(function(t){Ee(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function sB(e){e.forEach(function(t){Ee(t.groupShape).categoryValueRef=null})}function cB(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Jh);t.categoryValuesToRemove.forEach(function(o){an(i,o)}),t.categoryValuesToAdd.forEach(function(o){un(i,o,!0)})})}function lB(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Jh);t.categoryValuesToAdd.forEach(function(o){an(i,o)}),t.categoryValuesToRemove.forEach(function(o){un(i,o,!0)})})}function Qh(e){for(;e.parent;)e=e.parent;return e}function Fu(e){this._moddle=e}Fu.$inject=["moddle"],Fu.prototype.execute=function(e){var t=this._moddle.ids,n=e.id,i=e.element,o=e.claiming;return o?t.claim(n,i):t.unclaim(n),[]},Fu.prototype.revert=function(e){var t=this._moddle.ids,n=e.id,i=e.element,o=e.claiming;return o?t.unclaim(n):t.claim(n,i),[]};var uB={fill:void 0,stroke:void 0};function eg(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(ai(t)){var n=pB(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}eg.$inject=["commandStack"],eg.prototype.postExecute=function(e){var t=e.elements,n=e.colors||uB,i=this,o={};"fill"in n&&te(o,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&te(o,{"border-color":this._normalizeColor(n.stroke)}),K(t,function(r){var a=$t(r)?Wi(o,["border-color"]):o,s=wt(r);if(dB(a),ft(r)){if(!s||!T(s.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:r,moddleElement:s.label,properties:{color:o["border-color"]}})}else{if(!ht(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:r,properties:{di:a}})}})};function pB(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 dB(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var fB={width:0,height:0};function X_(e,t,n){function i(c,l){var u=c.label||c,p=c.labelTarget||c;return H2(u,l),[u,p]}function o(c){var l=c.element,u=l.businessObject,p=c.newLabel;if(!ft(l)&&fo(l)&&!Gl(l)&&!Z_(p)){var d=7,f=Ef(l);f={x:f.x,y:f.y+d},e.createLabel(l,f,{id:u.id+"_label",businessObject:u,di:l.di})}}function r(c){return c.oldLabel=ii(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,d=c.newBounds,f=c.hints||{};if(!(!ft(u)&&!T(u,"bpmn:TextAnnotation"))){if(ft(u)&&Z_(p)){f.removeShape!==!1&&e.removeShape(u,{unsetLabel:!1});return}var m=ii(l);typeof d>"u"&&(d=t.getExternalLabelBounds(u,m)),d&&e.resizeShape(u,d,fB)}}this.preExecute=o,this.execute=r,this.revert=a,this.postExecute=s}X_.$inject=["modeling","textRenderer","bpmnFactory"];function Z_(e){return!e||!e.trim()}function Hn(e,t,n,i){Ft.call(this,e,t,n),this._bpmnRules=i}je(Hn,Ft),Hn.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],Hn.prototype.getHandlers=function(){var e=Ft.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=dc,e["element.updateProperties"]=hc,e["canvas.updateRoot"]=Nu,e["lane.add"]=Kh,e["lane.resize"]=gc,e["lane.split"]=Xh,e["lane.updateRefs"]=$u,e["group.updateRefs"]=yc,e["id.updateClaim"]=Fu,e["element.setColor"]=eg,e["element.updateLabel"]=X_,e},Hn.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},Hn.prototype.connect=function(e,t,n,i){var o=this._bpmnRules;if(n||(n=o.canConnect(e,t)),!!n)return this.createConnection(e,t,n,e.parent,i)},Hn.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},Hn.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},Hn.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},Hn.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},Hn.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},Hn.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Hn.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Hn.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},Hn.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},Hn.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},Hn.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},Hn.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function J_(){}J_.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||nt(t.source||e.source),t.connectionEnd||nt(t.target||e.target)]};var ju=20,hB=5,Hu=Math.round,Q_=20,gB={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function mB(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function yB(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function e0(e,t,n){var i=$n(t,e,hB),o=n.split(":")[0],r=Hu((t.x-e.x)/2+e.x),a=Hu((t.y-e.y)/2+e.y),s,c,l=yB(o,i),u=/h|r|l/.test(o),p=!1,d=!1;return l?(s=u?{x:r,y:e.y}:{x:e.x,y:a},c=u?"h:h":"v:v"):(p=mB(i,o),c=u?"h:v":"v:h",p?u?(d=a===e.y,s={x:e.x+ju*(/l/.test(o)?-1:1),y:d?a+ju:a}):(d=r===e.x,s={x:d?r+ju:r,y:e.y+ju*(/t/.test(o)?-1:1)}):s={x:r,y:a}),{waypoints:tg(e,s,c).concat(s),directions:c,turnNextDirections:d}}function vB(e,t,n){return e0(e,t,n)}function xB(e,t,n){var i=e0(t,e,t0(n));return{waypoints:i.waypoints.slice().reverse(),directions:t0(i.directions),turnNextDirections:i.turnNextDirections}}function bB(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 o=n+":"+i,r=tg(e.waypoints[e.waypoints.length-1],t.waypoints[0],o);return{waypoints:r,directions:o}}function t0(e){return e.split(":").reverse().join(":")}function wB(e,t,n){var i=Hu((t.x-e.x)/2+e.x),o=Hu((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:o},{x:t.x,y:o}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}function tg(e,t,n){if(n=n||"h:h",!PB(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(i0(n)){var i=vB(e,t,n),o=xB(e,t,n),r=bB(i,o);return[].concat(i.waypoints,r.waypoints,o.waypoints)}return wB(e,t,n)}function _B(e,t,n){var i=tg(e,t,n);return i.unshift(e),i.push(t),r0(i)}function EB(e,t,n,i,o){var r=o&&o.preferredLayouts||[],a=tM(r,"straight")[0]||"h:h",s=gB[a]||0,c=$n(e,t,s),l=TB(c,a);n=n||nt(e),i=i||nt(t);var u=l.split(":"),p=o0(n,e,u[0],kB(c)),d=o0(i,t,u[1],c);return _B(p,d,l)}function SB(e,t,n,i,o,r){et(n)&&(o=n,r=i,n=nt(e),i=nt(t)),r=te({preferredLayouts:[]},r),o=o||[];var a=r.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&MB(e,t,n,i,r),c||(c=r.connectionEnd&&AB(t,e,i,o),c)||(c=r.connectionStart&&CB(e,t,n,o),c)?c:!r.connectionStart&&!r.connectionEnd&&o&&o.length?o:EB(e,t,n,i,r)}function RB(e,t,n){return e>=t&&e<=n}function n0(e,t,n){var i={x:"width",y:"height"};return RB(t[e],n[e],n[e]+n[i[e]])}function MB(e,t,n,i,o){var r={},a,s;return s=$n(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),o.preserveDocking==="target"?n0(a,i,e)?(r[a]=i[a],[{x:r.x!==void 0?r.x:n.x,y:r.y!==void 0?r.y:n.y,original:{x:r.x!==void 0?r.x:n.x,y:r.y!==void 0?r.y:n.y}},{x:i.x,y:i.y}]):null:n0(a,n,t)?(r[a]=n[a],[{x:n.x,y:n.y},{x:r.x!==void 0?r.x:i.x,y:r.y!==void 0?r.y:i.y,original:{x:r.x!==void 0?r.x:i.x,y:r.y!==void 0?r.y:i.y}}]):null):null}function CB(e,t,n,i){return ng(e,t,n,i)}function AB(e,t,n,i){var o=i.slice().reverse();return o=ng(e,t,n,o),o?o.reverse():null}function ng(e,t,n,i){function o(u){return u.length<3?!0:u.length>4?!1:!!Ht(u,function(p,d){var f=u[d-1];return f&&Hs(p,f)<3})}function r(u,p,d){var f=Oo(p,u);switch(f){case"v":return{x:d.x,y:u.y};case"h":return{x:u.x,y:d.y}}return{x:u.x,y:u.y}}function a(u,p,d){var f;for(f=u.length-2;f!==0;f--)if(Cx(u[f],p,Q_)||Cx(u[f],d,Q_))return u.slice(f);return u}if(o(i))return null;var s=i[0],c=i.slice(),l;return c[0]=n,c[1]=r(c[1],s,n),l=a(c,e,t),l!==c&&(c=ng(e,t,n,l)),c&&Oo(c)?null:c}function TB(e,t){if(i0(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 PB(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function i0(e){return e&&/t|r|b|l/.test(e)}function kB(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 o0(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 r0(e){return e.reduce(function(t,n,i){var o=t[t.length-1],r=e[i+1];return vf(o,r,n,0)||t.push(n),t},[])}var OB=-10,DB=40,LB={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},IB={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},ig={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},vc={top:"t",right:"r",bottom:"b",left:"l"};function Gu(e){this._elementRegistry=e}je(Gu,J_),Gu.prototype.layoutConnection=function(e,t){t||(t={});var n=t.source||e.source,i=t.target||e.target,o=t.waypoints||e.waypoints,r=t.connectionStart,a=t.connectionEnd,s=this._elementRegistry,c,l;if(r||(r=a0(o&&o[0],n)),a||(a=a0(o&&o[o.length-1],i)),(T(e,"bpmn:Association")||T(e,"bpmn:DataAssociation"))&&o&&!s0(n,i))return[].concat([r],o.slice(1,-1),[a]);var u=vb(n,s)?LB:IB;return T(e,"bpmn:MessageFlow")?c=NB(n,i,u):(T(e,"bpmn:SequenceFlow")||s0(n,i))&&(n===i?c={preferredLayouts:zB(n,e,u)}:T(n,"bpmn:BoundaryEvent")?c={preferredLayouts:VB(n,i,a,u)}:xc(n)||xc(i)?c={preferredLayouts:u.subProcess,preserveDocking:FB(n)}:T(n,"bpmn:Gateway")?c={preferredLayouts:u.fromGateway}:T(i,"bpmn:Gateway")?c={preferredLayouts:u.toGateway}:c={preferredLayouts:u.default}),c&&(c=te(c,t),l=r0(SB(n,i,r,a,o,c))),l||[r,a]};function BB(e){var t=e.host;return $n(nt(e),t,OB)}function NB(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:$B(e,t)}}function $B(e,t){return T(t,"bpmn:Participant")?"source":T(e,"bpmn:Participant")?"target":xc(t)?"source":xc(e)||T(t,"bpmn:Event")?"target":T(e,"bpmn:Event")?"source":null}function FB(e){return xc(e)?"target":"source"}function a0(e,t){return e?e.original||e:nt(t)}function s0(e,t){return T(t,"bpmn:Activity")&&T(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function xc(e){return T(e,"bpmn:SubProcess")&&xt(e)}function oa(e,t){return e===t}function jB(e,t){return t.indexOf(e)!==-1}function Za(e){var t=/right|left/.exec(e);return t&&t[0]}function Ja(e){var t=/top|bottom/.exec(e);return t&&t[0]}function c0(e,t){return ig[e]===t}function HB(e,t){var n=Za(e),i=ig[n];return t.indexOf(i)!==-1}function GB(e,t){var n=Ja(e),i=ig[n];return t.indexOf(i)!==-1}function l0(e){return e==="right"||e==="left"}function zB(e,t,n){var i=t.waypoints,o=i&&i.length&&$n(i[0],e);return o==="top"?n.loop.fromTop:o==="right"?n.loop.fromRight:o==="left"?n.loop.fromLeft:n.loop.fromBottom}function VB(e,t,n,i){var o=nt(e),r=nt(t),a=BB(e),s,c,l=oa(e.host,t),u=jB(a,["top","right","bottom","left"]),p=$n(r,o,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return l?WB(a,u,e,t,n,i):(s=UB(a,p,u,i.isHorizontal),c=qB(a,p,u,i.isHorizontal),[s+":"+c])}function WB(e,t,n,i,o,r){var a=t?e:r.isHorizontal?Ja(e):Za(e),s=vc[a],c;return t?l0(e)?c=u0("y",n,i,o)?"h":r.boundaryLoop.alternateHorizontalSide:c=u0("x",n,i,o)?"v":r.boundaryLoop.alternateVerticalSide:c=r.boundaryLoop.default,[s+":"+c]}function u0(e,t,n,i){var o=DB;return!(og(e,i,n,o)||og(e,i,{x:n.x+n.width,y:n.y+n.height},o)||og(e,i,nt(t),o))}function og(e,t,n,i){return Math.abs(t[e]-n[e])<i}function UB(e,t,n,i){if(n)return vc[e];var o=Ja(e),r=Za(e),a=Ja(t),s=Za(t);if(i){if(oa(o,a)||c0(r,s))return vc[o]}else if(oa(r,s)||c0(o,a))return vc[r];return vc[i?r:o]}function qB(e,t,n,i){if(n)return l0(e)?HB(e,t)||oa(e,t)?"h":"v":GB(e,t)||oa(e,t)?"v":"h";var o=Ja(e),r=Za(e),a=Ja(t),s=Za(t);return a&&!s?"v":s&&!a?"h":i?oa(o,a)?"h":"v":oa(r,s)?"v":"h"}Gu.$inject=["elementRegistry"];function p0(e){return te({original:e.point.original||e.point},e.actual)}function Rr(e,t){this._elementRegistry=e,this._graphicsFactory=t}Rr.$inject=["elementRegistry","graphicsFactory"],Rr.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var i=this.getDockingPoint(e,t,!0),o=this.getDockingPoint(e,n),r=e.waypoints.slice(i.idx+1,o.idx);return r.unshift(p0(i)),r.push(p0(o)),r},Rr.prototype.getDockingPoint=function(e,t,n){var i=e.waypoints,o,r,a;return o=n?0:i.length-1,r=i[o],a=this._getIntersection(t,e,n),{point:r,actual:a||r,idx:o}},Rr.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),o=this._getConnectionPath(t);return Gs(i,o,n)},Rr.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},Rr.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},Rr.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const rg={__init__:["modeling","bpmnUpdater"],__depends__:[dL,AL,PL,kL,E_,OI,LI,jI,Oi,Gh,T_],bpmnFactory:["type",Li],bpmnUpdater:["type",hi],elementFactory:["type",_r],modeling:["type",Hn],layouter:["type",Gu],connectionDocking:["type",Rr]};var YB=10,d0=50,KB=250;function ag(e,t,n,i){for(var o;o=XB(e,n,t);)n=i(t,n,o);return n}function sg(e){return function(t,n,i){var o={x:n.x,y:n.y};return["x","y"].forEach(function(r){var a=e[r];if(a){var s=r==="x"?"width":"height",c=a.margin,l=a.minDistance;c<0?o[r]=Math.min(i[r]+c-t[s]/2,n[r]-l+c):o[r]=Math.max(i[r]+i[s]+c+t[s]/2,n[r]+l+c)}}),o}}function XB(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},o=JB(e);return Ht(o,function(r){if(r===n)return!1;var a=$n(r,i,YB);return a==="intersect"})}function ZB(e,t){t||(t={});function n(m){return m.source===e?1:-1}var i=t.defaultDistance||d0,o=t.direction||"e",r=t.filter,a=t.getWeight||n,s=t.maxDistance||KB,c=t.reference||"start";r||(r=tN);function l(m,h){return o==="n"?c==="start"?Ze(m).top-Ze(h).bottom:c==="center"?Ze(m).top-nt(h).y:Ze(m).top-Ze(h).top:o==="w"?c==="start"?Ze(m).left-Ze(h).right:c==="center"?Ze(m).left-nt(h).x:Ze(m).left-Ze(h).left:o==="s"?c==="start"?Ze(h).top-Ze(m).bottom:c==="center"?nt(h).y-Ze(m).bottom:Ze(h).bottom-Ze(m).bottom:c==="start"?Ze(h).left-Ze(m).right:c==="center"?nt(h).x-Ze(m).right:Ze(h).right-Ze(m).right}var u=e.incoming.filter(r).map(function(m){var h=a(m),y=h<0?l(m.source,e):l(e,m.source);return{id:m.source.id,distance:y,weight:h}}),p=e.outgoing.filter(r).map(function(m){var h=a(m),y=h>0?l(e,m.target):l(m.target,e);return{id:m.target.id,distance:y,weight:h}}),d=u.concat(p).reduce(function(m,h){return m[h.id+"__weight_"+h.weight]=h,m},{}),f=ci(d,function(m,h){var y=h.distance,w=h.weight;return y<0||y>s||(m[String(y)]||(m[String(y)]=0),m[String(y)]+=1*w,(!m.distance||m[m.distance]<m[String(y)])&&(m.distance=y)),m},{});return f.distance||i}function JB(e){var t=cg(e);return e.host&&(t=t.concat(cg(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(cg(i))},[]))),t}function cg(e){return eN(e).concat(QB(e))}function QB(e){return e.incoming.map(function(t){return t.source})}function eN(e){return e.outgoing.map(function(t){return t.target})}function tN(){return!0}var nN=100;function f0(e,t,n){e.on("autoPlace",nN,function(i){var o=i.shape,r=i.source;return iN(r,o)}),e.on("autoPlace.end",function(i){n.scrollToElement(i.shape)}),this.append=function(i,o,r){e.fire("autoPlace.start",{source:i,shape:o});var a=e.fire("autoPlace",{source:i,shape:o}),s=t.appendShape(i,o,a,i.parent,r);return e.fire("autoPlace.end",{source:i,shape:s}),s}}f0.$inject=["eventBus","modeling","canvas"];function iN(e,t,n){n||(n={});var i=n.defaultDistance||d0,o=nt(e),r=Ze(e);return{x:r.right+i+t.width/2,y:o.y}}function h0(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}h0.$inject=["eventBus","selection"];const oN={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",f0],autoPlaceSelectionBehavior:["type",h0]};function g0(e,t,n){var i=vb(e,n);if(T(t,"bpmn:TextAnnotation"))return aN(e,t,i);if(ht(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return sN(e,t,i);if(T(t,"bpmn:FlowNode"))return rN(e,t,i)}function rN(e,t,n){var i=Ze(e),o=nt(e),r=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=ZB(e,{filter:function(f){return T(f,"bpmn:SequenceFlow")},direction:r.directionHint}),s=30,c=r.minDistance,l=r.baseOrientation;T(e,"bpmn:BoundaryEvent")&&(l=$n(e,e.host,-25),l.indexOf(r.boundaryOrientation)!==-1&&(s*=-1));var u=n?{x:i.right+a+t.width/2,y:o.y+m0(l,c,r)}:{x:o.x+m0(l,c,r),y:i.bottom+a+t.height/2},p={margin:s,minDistance:c},d=n?{y:p}:{x:p};return ag(e,t,u,sg(d))}function m0(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function aN(e,t,n){var i=Ze(e),o=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};$t(e)&&(o=nt(e),n?(o.x+=100,o.y-=50):(o.x+=100,o.y+=50));var r={margin:n?-30:30,minDistance:20},a=n?{y:r}:{x:r};return ag(e,t,o,sg(a))}function sN(e,t,n){var i=Ze(e),o=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},r={margin:30,minDistance:30},a=n?{x:r}:{y:r};return ag(e,t,o,sg(a))}function y0(e,t){e.on("autoPlace",function(n){var i=n.shape,o=n.source;return g0(o,i,t)})}y0.$inject=["eventBus","elementRegistry"];const zu={__depends__:[oN],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",y0]};function Go(e,t,n,i){we.call(this,e),this._elementRegistry=t,this._modeling=n,this._rules=i;var o=this;this.postExecuted(["shape.create"],function(r){var a=r.context,s=a.hints||{},c=a.shape,l=a.parent||a.newParent;s.autoResize!==!1&&o._expand([c],l)}),this.postExecuted(["elements.move"],function(r){var a=r.context,s=Xp(ba(a.closure.topLevel)),c=a.hints,l=c?c.autoResize:!0;if(l!==!1){var u=wa(s,function(p){return p.parent.id});K(u,function(p,d){et(l)&&(p=p.filter(function(f){return Ht(l,_a({id:f.id}))})),o._expand(p,d)})}}),this.postExecuted(["shape.toggleCollapse"],function(r){var a=r.context,s=a.hints,c=a.shape;s&&s.autoResize===!1||c.collapsed||o._expand(c.children||[],c)}),this.postExecuted(["shape.resize"],function(r){var a=r.context,s=a.hints,c=a.shape,l=c.parent;s&&s.autoResize===!1||l&&o._expand([c],l)})}Go.$inject=["eventBus","elementRegistry","modeling","rules"],je(Go,we),Go.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),o=Ze(yn(e)),r=Ze(t),a={};return o.top-r.top<i.top&&(a.top=o.top-n.top),o.left-r.left<i.left&&(a.left=o.left-n.left),r.right-o.right<i.right&&(a.right=o.right+n.right),r.bottom-o.bottom<i.bottom&&(a.bottom=o.bottom+n.bottom),Bl(te({},r,a))},Go.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(cN(i,t)){var o=lN(Wi(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:o});var r=t.parent;r&&this._expand([t],r)}}},Go.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},Go.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},Go.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function cN(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function lN(e,t){var n="";return e=Ze(e),t=Ze(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 Vu(e){e.invoke(Go,this)}Vu.$inject=["injector"],je(Vu,Go),Vu.prototype.resize=function(e,t,n){T(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};function bc(e){ki.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}bc.$inject=["eventBus"],je(bc,ki),bc.prototype.canResize=function(e,t){return!1};function Wu(e,t){bc.call(this,e),this._modeling=t}je(Wu,bc),Wu.$inject=["eventBus","modeling"],Wu.prototype.canResize=function(e,t){if(T(t.di,"bpmndi:BPMNPlane")||!T(t,"bpmn:Participant")&&!T(t,"bpmn:Lane")&&!T(t,"bpmn:SubProcess"))return!1;var n=!0;return K(e,function(i){if(T(i,"bpmn:Lane")||ft(i)){n=!1;return}}),n};const v0={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",Vu],bpmnAutoResizeProvider:["type",Wu]},uN=1500;class x0{constructor(t){t.on("moddleCopy.canCopyProperties",uN,({sourceElement:n,targetElement:i})=>{var r;if(!((r=n==null?void 0:n.$instanceOf)!=null&&r.call(n,jr)))return;const o=ln(n);o!==void 0&&i.set("xml:lang",o)})}}on(x0,"$inject",["eventBus"]);const b0={__init__:["translationLocaleCopy"],translationLocaleCopy:["type",x0]},pN=500,Uu=1,w0=(e,t)=>{if((e==null?void 0:e.type)!=="bpmn:TextAnnotation"||!(t!=null&&t.original))return;const{x:n,y:i}=t.original;(n<e.x-Uu||n>e.x+e.width+Uu||i<e.y-Uu||i>e.y+e.height+Uu)&&(t.original={x:Math.round(e.x+e.width/2),y:Math.round(e.y+e.height/2)})};class _0{constructor(t){t.on("bpmnElement.added",pN,({element:n})=>{if((n==null?void 0:n.type)!=="bpmn:Association")return;const i=n.waypoints;!i||i.length<2||(w0(n.source,i[0]),w0(n.target,i[i.length-1]))})}}on(_0,"$inject",["eventBus"]);const E0={__init__:["annotationImportDocking"],annotationImportDocking:["type",_0]},lg=[mb,Ys,rg,zu,v0,rd,b0,E0,Pv];function dN(e={}){py(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new Kr({container:t,moddleExtensions:e.moddleExtensions??Ss,additionalModules:[...lg,...e.additionalModules??[]]})}const S0={"edge-crosses-shape":"연결","edge-crosses-subprocess":"연결","edge-endpoint-detached":"연결","merge-before-predecessor":"연결","edge-crosses-own-endpoint":"연결","message-detours-own-pool-shape":"연결","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":"풀"},fN={이:["이","가"],을:["을","를"],와:["과","와"]};function hN(e,t){const[n,i]=fN[t],o=e.at(-1)??"",r=o.charCodeAt(0);return r>=44032&&r<=55203?e+((r-44032)%28===0?i:n):o>="0"&&o<="9"?e+("013678".includes(o)?n:i):e+`${n}(${i})`}const gN={"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":"연관선"},mN="요소";function ug(e){return(e&&gN[e.type])??mN}const R0=20;function yN(e){const t=e.replace(/\s+/g," ").trim();return t.length>R0?`${t.slice(0,R0)}…`:t}function qu(e,t,n,i=""){const o=e(t),r=(o==null?void 0:o.name)===void 0?void 0:yN(o.name),a=r===void 0?i+ug(o):r,s=r===void 0?a:`「${r}」`;return n?s+hN(a,n).slice(a.length):s}function vN(e,t,n,i,o){const[r,a]=[e(t),e(n)],s=(r==null?void 0:r.name)===void 0&&(a==null?void 0:a.name)===void 0&&ug(r)===ug(a);return[qu(e,t,i),qu(e,n,o,s?"다른 ":"")]}function xN(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 bN(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];case"merge-before-predecessor":return[e.merge,e.edge];case"edge-crosses-own-endpoint":return[e.edge,e.shape];case"message-detours-own-pool-shape":return[e.edge,e.shape]}}const Yu={top:"위",bottom:"아래",left:"왼쪽",right:"오른쪽"};function wN(e,t){const n=(o,r)=>qu(t,o,r),i=(o,r,a,s)=>vN(t,o,r,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[o,r]=i(e.shapes[0],e.shapes[1],"와","이");return e.identical?`${o} ${r} 완전히 같은 자리에 겹쳐 하나가 가려집니다.`:`${o} ${r} 겹칩니다.`}case"shape-outside-container":return`${n(e.shape,"이")} ${n(e.container)} 경계 밖에 놓여 다른 소속으로 읽힙니다.`;case"edge-overlap-opposite":{const[o,r]=i(e.edges[0],e.edges[1],"와","이");return`${o} ${r} 같은 선 위를 ${Math.round(e.length)}px 서로 반대 방향으로 흐릅니다.`}case"edge-overlap-mixed":{const[o,r]=i(e.edges[0],e.edges[1],"와","이");return`${o} ${r} 종류가 다른 선인데 ${Math.round(e.length)}px 겹쳐 흐릅니다.`}case"edge-overlap-unrelated":{const[o,r]=i(e.edges[0],e.edges[1],"와","이");return`${o} ${r} ${Math.round(e.length)}px 한 선처럼 겹쳐 흐르는데 만나는 지점이 없습니다.`}case"label-on-shared-segment":{const[o,r]=i(e.edge,e.other,void 0,"와");return`${o}의 라벨이 ${r} 공유하는 구간 위에 있어 어느 선의 것인지 모호합니다.`}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[o,r]=i(e.groups[0],e.groups[1],"와","이");return`${o} ${r} 공유 멤버 없이 겹쳐 의도인지 알 수 없습니다.`}case"group-overlap-unreadable":switch(e.reason){case"orphan":{const[o,r]=i(e.groups[0],e.groups[1],"와");return`${o} ${r}의 겹친 영역에 어느 그룹에도 속하지 않은 요소가 ${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)}의 ${Yu[e.side]} 경계선과 겹쳐 흐릅니다.`;case"group-on-group-boundary":{const[o,r]=i(e.groups[0],e.groups[1],"와");return`${o} ${r}의 테두리가 같은 선 위에 겹칩니다.`}case"group-cuts-shape":return`${n(e.group)} 테두리가 ${n(e.shape)}의 ${Yu[e.side]}을(를) ${Math.round(e.depth)}px 가릅니다.`;case"edge-along-group-boundary":return e.distance===0?`${n(e.edge,"이")} ${n(e.group)}의 ${Yu[e.side]} 테두리 위를 ${e.length}px 겹쳐 흐릅니다.`:`${n(e.edge,"이")} ${n(e.group)}의 ${Yu[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[o,r]=i(e.pools[0],e.pools[1],"와","이");return e.contained?`${o} ${r} 중 하나가 다른 하나 안에 들어가 있습니다.`:`${o} ${r} 겹칩니다.`}case"merge-before-predecessor":return`합류 ${n(e.merge,"이")} 앞 단계보다 앞에 놓여 ${n(e.edge,"이")} 거꾸로 들어갑니다.`;case"edge-crosses-own-endpoint":return`${n(e.edge,"이")} 자기가 이어진 ${n(e.shape)} 안을 지나 도형을 꿰뚫어 보입니다.`;case"message-detours-own-pool-shape":return`${n(e.edge,"이")} 같은 열에 놓인 ${n(e.shape,"을")} 피해 돌아갑니다.`}}function _N(e,t){switch(e.ruleId){case"CHK-FLOW-1":return`${qu(t,e.targetRefs[0])}에 연결된 선이 하나도 없습니다 — 분기·합류가 없는 게이트웨이는 의미가 정해지지 않습니다.`;case"CHK-POOL-1":return`이 문서에 내용이 없는 풀 ${e.targetRefs.length}개가 펼친 형태로 그려져 있습니다 — 이 문서에서 내용을 그리지 않는 풀은 접힌 형태(블랙박스)가 의미에 맞습니다.`;default:return e.ruleId}}const M0="기타",pg={error:0,warning:1,info:2};function C0(e,t){const n=[];for(const i of e.geometry)n.push({key:`g:${ct(i)}`,source:"geometry",code:i.kind,severity:xN(i),targetRefs:bN(i),category:S0[i.kind]??M0,message:wN(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:S0[i.ruleId]??M0,message:_N(i,t)});return n}function A0(e){const t={error:0,warning:0,info:0};for(const n of e)t[n.severity]++;return t}function Qa(e,t){return t!==void 0&&e.targetRefs.some(n=>t.has(n))}function dg(e,t){if(t===void 0||e.length===0)return!1;const n=Qa(e[0],t);return e.some(i=>Qa(i,t)!==n)}function T0(e,t){const n=dg(e,t);return e.slice().sort((i,o)=>(n?Number(Qa(o,t))-Number(Qa(i,t)):0)||pg[i.severity]-pg[o.severity])}const P0="i18n-untranslated",k0="i18n-review-requested",wc="i18nDisplay.redrawn",O0=[["untranslated",P0],["reviewRequested",k0]];class fg{constructor(t,n,i,o,r,a,s,c,l){on(this,"config");on(this,"displayLocale");on(this,"fallbackLabels",new Set);on(this,"labelDeleteTarget");this.eventBus=t,this.elementRegistry=n,this.canvas=a,this.textRenderer=s,this.graphicsFactory=c,this.elementFactory=l;const u=o.drawShape.bind(o);o.drawShape=(f,m,h)=>this.withDisplayText(m,()=>u(f,m,h),f,!0);const p=r.activate.bind(r);r.activate=f=>this.withDisplayText(f,()=>p(f));const d=r.update.bind(r);r.update=(f,m,h,y)=>{const w=this.resolve(f);if(!w||w.native)return d(f,m,h,y);if((m??"").trim()===(h??"").trim())return;const g=f.labelTarget??f;!(m??"").trim()&&!this.ownText(g)||i.execute(el,{element:g,locale:this.displayLocale,text:m,designLocale:this.config.designLocale,locales:this.locales(),rootLang:this.rootLang()})},t.on("commandStack.shape.delete.preExecute",f=>{const{shape:m,hints:h}=f.context;m!=null&&m.labelTarget&&!(h!=null&&h.nested)&&(this.labelDeleteTarget=m.labelTarget)}),t.on("commandStack.shape.delete.postExecuted",f=>{f.context.labelTarget&&f.context.labelTarget===this.labelDeleteTarget&&(this.labelDeleteTarget=void 0)}),t.on("commandStack.element.updateLabel.preExecute",f=>{if(!this.config)return;const m=f.context,h=m.element.labelTarget??m.element;h!==this.labelDeleteTarget&&((m.newLabel??"").trim()||fo(h.businessObject)&&this.remainingTextsAfterClear(h).length&&(m.hints={...m.hints??{},removeShape:!1}))}),t.on("commandStack.element.updateLabel.postExecute",f=>{if(!this.config)return;const{element:m,newLabel:h,oldLabel:y}=f.context,w=m.labelTarget??m;if(w===this.labelDeleteTarget){i.execute(tl,{element:w,texts:null,designLocale:this.config.designLocale,locales:this.locales(),rootLang:this.rootLang(),before:{texts:{},requests:[]}});return}(h??"")!==(y??"")&&i.execute(el,{element:w,locale:this.displayLocale,text:h??"",designLocale:this.config.designLocale,locales:this.locales(),rootLang:this.rootLang(),nameChangedFrom:y??""})}),t.on("import.done",()=>{this.fallbackLabels.clear(),this.config&&this.syncFallbackLabels()})}configure(t){!t&&!this.config||(this.config=t,this.displayLocale=t==null?void 0:t.designLocale,this.syncFallbackLabels(),this.rerenderAll())}syncFallbackLabels(){if(!this.config){for(const t of this.fallbackLabels)this.elementRegistry.get(t.id)&&this.canvas.removeShape(t);this.fallbackLabels.clear();return}for(const t of this.elementRegistry.getAll()){if(t.type==="label"||t.labelTarget||t.label||!t.di)continue;const n=t.businessObject;if(!n||!fo(n)||ii(t)||!this.docTexts(n).length)continue;const i=Sf(t.di,t),o=this.elementFactory.createLabel({id:`${n.id}_label`,type:"label",businessObject:n,di:t.di,labelTarget:t,x:Math.round(i.x),y:Math.round(i.y),width:Math.round(i.width),height:Math.round(i.height)});this.canvas.addShape(o,t.parent),this.fallbackLabels.add(o)}}docTexts(t){const n=Ui(t);return this.locales().map(i=>n.find(o=>ln(o)===i&&o.body)).filter(Boolean)}ownText(t){var i;const n=this.displayLocale;return(i=Ui(t.businessObject).find(o=>ln(o)===n&&o.body))==null?void 0:i.body}remainingTextsAfterClear(t){const n=t.businessObject,i=Jo(n),o=i?i.target[i.key]??"":"",r=Ui(n).filter(c=>ln(c)),a=o?bs(o,r,this.config.designLocale,this.rootLang()):[],s=this.displayLocale;return this.docTexts(n).filter(c=>{const l=ln(c)??"";return!a.includes(l)&&l!==s})}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,o,r;const t=(i=this.canvas.getRootElement())==null?void 0:i.businessObject,n=(t==null?void 0:t.$parent)??t;return((o=n==null?void 0:n.get)==null?void 0:o.call(n,"xml:lang"))??((r=n==null?void 0:n.$attrs)==null?void 0:r["xml:lang"])}resolve(t){if(!this.config||!this.displayLocale)return;const n=(t.labelTarget??t).businessObject,i=Jo(n);if(!i)return;const o=this.displayLocale,r=i.target[i.key]??"",a=Ui(n).filter(p=>ln(p)),s=p=>p.body??"",c=a.find(p=>ln(p)===o&&s(p)),l=Qo(n).some(p=>p.locale===o)?"reviewRequested":"ok";if(!r){if(c)return{text:s(c),status:l,native:!1};const p=this.docTexts(n)[0];return p?{text:s(p),status:l==="reviewRequested"?l:"untranslated",native:!1,fallbackLocale:ln(p)}:void 0}const u=bs(r,a,this.config.designLocale,this.rootLang());return u.includes(o)?{text:r,status:l,native:!0}:c?{text:s(c),status:l,native:!1}:{text:r,status:"untranslated",native:!1,fallbackLocale:u[0]}}untranslatedCount(t){return this.countStatus(t,"untranslated")}reviewRequestedCount(t){return this.countStatus(t,"reviewRequested")}countStatus(t,n){var r;if(!this.config)return 0;const i=this.displayLocale;this.displayLocale=t;let o=0;try{for(const a of this.elementRegistry.getAll())a.type!=="label"&&((r=this.resolve(a))==null?void 0:r.status)===n&&o++}finally{this.displayLocale=i}return o}withDisplayText(t,n,i,o=!1){var h;if(!this.config)return n();const r=this.resolve(t),a=(h=i==null?void 0:i.parentNode)==null?void 0:h.classList;if(a)for(const[y,w]of O0)a.toggle(w,(r==null?void 0:r.status)===y);if(!r||r.native)return n();const c=o&&r.fallbackLocale&&(this.config.fallbackLocaleTag??!0)?`${r.text} [${r.fallbackLocale}]`:r.text,{target:l,key:u}=Jo((t.labelTarget??t).businessObject),p=Object.prototype.hasOwnProperty.call(l,u),d=l[u];if(d===c)return n();l[u]=c;const f=this.config.adaptiveExternalLabel??!0,m=t.type==="label"&&f?this.widen(t,c):void 0;try{const y=n();return m&&(y!=null&&y.setAttribute)&&y.setAttribute("transform",`translate(${m.dx}, 0)`),y}finally{p?l[u]=d:delete l[u],m==null||m.restore()}}widen(t,n){const{width:i,height:o}=t,r=this.textRenderer.getExternalLabelBounds(t,n);return t.width=r.width,t.height=r.height,{dx:(i-r.width)/2,restore:()=>(t.width=i,t.height=o)}}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[,o]of O0)i.classList.remove(o);this.graphicsFactory.update(n.waypoints?"connection":"shape",n,i)}}this.eventBus.fire(wc)}}on(fg,"$inject",["eventBus","elementRegistry","commandStack","bpmnRenderer","labelEditingProvider","canvas","textRenderer","graphicsFactory","elementFactory"]);const D0={__depends__:[rd],__init__:["i18nDisplay"],i18nDisplay:["type",fg]};var EN=2e3;function hg(e,t,n){e.on("autoPlace",EN,function(i){var o=i.source,r=nt(o),a=i.shape,s=g0(o,a,n);return["x","y"].forEach(function(c){var l={};s[c]!==r[c]&&(s[c]>r[c]?l.min=s[c]:l.max=s[c],T(a,"bpmn:TextAnnotation")&&(SN(c)?l.offset=-a.width/2:l.offset=-a.height/2),s[c]=t.snapValue(s[c],l))}),s})}hg.$inject=["eventBus","gridSnapping","elementRegistry"];function SN(e){return e==="x"}var RN=3e3;function es(e,t,n){we.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],RN,function(o){var r=o.context,a=r.connection,s=r.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||MN(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}es.$inject=["eventBus","gridSnapping","modeling"],je(es,we),es.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=TN(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function MN(e){return e.length>3}function CN(e){return e==="h"}function AN(e){return e==="v"}function TN(e,t,n){var i=Oo(t,n),o={};return CN(i)&&(o.y=e.snapValue(t.y)),AN(i)&&(o.x=e.snapValue(t.x)),("x"in o||"y"in o)&&(t=te({},t,o),n=te({},n,o)),[t,n]}function PN(e){var n;const t=Number.parseFloat(((n=String(this.font).match(/(\d+(?:\.\d+)?)px/))==null?void 0:n[1])??"12");return{width:Vr(e,t),fontBoundingBoxAscent:t*ao.ascentEm,fontBoundingBoxDescent:t*ao.descentEm,actualBoundingBoxAscent:t*ao.ascentEm,actualBoundingBoxDescent:t*ao.descentEm}}class gg{constructor(t,n,i,o,r,a){on(this,"active",!1);on(this,"shadow");on(this,"shadowContainer");this.eventBus=t,this.elementRegistry=n,this.textRenderer=i,this.graphicsFactory=o,this.canvas=r,this.bpmnjs=a,t.on("diagram.destroy",()=>this.disposeShadow());let s=[];t.on("elements.changed",c=>{this.active||(s=c.elements??[])}),t.on("commandStack.changed",c=>{const l=s;s=[],!(this.active||(c==null?void 0:c.trigger)!=="undo"&&(c==null?void 0:c.trigger)!=="redo")&&this.remeasureLabelsOf(l)})}isActive(){return this.active}run(t){if(this.active)throw new Error("headlessReplay.run: 이미 창 안이다(중첩 금지)");const n=typeof CanvasRenderingContext2D>"u"?void 0:CanvasRenderingContext2D.prototype,i=n==null?void 0:n.measureText;n&&(n.measureText=PN),this.active=!0;try{return this.reproject(),t()}finally{this.active=!1,n&&i&&(n.measureText=i),this.relabel(),this.syncGraphicsOrder(),this.redrawAll()}}atBatchBoundary(){if(!this.active)throw new Error("headlessReplay.atBatchBoundary: 창 밖이다");this.eventBus.fire("saveXML.start",{definitions:this.bpmnjs.getDefinitions()}),this.reproject()}reproject(){const t=this.ensureShadow();t.get("eventBus").fire("diagram.clear");let n=!1;t.get("eventBus").once("import.render.complete",()=>n=!0);let i;if(tb(t,this.bpmnjs.getDefinitions()).catch(u=>i=u),!n)throw new Error(`headlessReplay: 그림자 import 가 동기로 끝나지 않았다${i?` — ${String(i)}`:""}`);const o=t.get("elementRegistry"),r=this.elementRegistry,a=u=>u?r.get(u.id):void 0,s=o.getAll();for(const u of s){const p=r.get(u.id);if(!p)continue;u.waypoints?p.waypoints=u.waypoints.map(f=>({x:f.x,y:f.y,...f.original?{original:{x:f.original.x,y:f.original.y}}:{}})):u.parent&&(p.x=u.x,p.y=u.y,p.width=u.width,p.height=u.height),p.collapsed=u.collapsed,p.hidden=u.hidden,p.isFrame=u.isFrame;const d=a(u.parent);d&&p.parent!==d&&(p.parent=d);for(const f of["incoming","outgoing"]){const m=(u[f]??[]).map(a).filter(Boolean),h=p[f];h&&m.length===h.length&&m.every(y=>h.includes(y))&&m.forEach((y,w)=>h[w]=y)}}for(const u of s){const p=r.get(u.id);if(!(p!=null&&p.children)||!u.children)continue;const d=u.children.map(a).filter(Boolean),f=p.children.filter(m=>!d.includes(m)&&m.parent===p);p.children.length=0,p.children.push(...d,...f)}const c=r._elements,l={};for(const u of s)u.id in c&&(l[u.id]=c[u.id]);for(const u of Object.keys(c))u in l||(l[u]=c[u]);r._elements=l}relabel(){for(const t of this.elementRegistry.filter(n=>n.type==="label"))this.remeasure(t)}remeasure(t){const n=t.labelTarget,i=n&&ii(n);if(!i)return!1;const o=this.textRenderer.getExternalLabelBounds(Sf(wt(n),n),i),r={x:Math.round(o.x),y:Math.round(o.y),width:Math.round(o.width),height:Math.round(o.height)};return r.x===t.x&&r.y===t.y&&r.width===t.width&&r.height===t.height?!1:(Object.assign(t,r),!0)}remeasureLabelsOf(t){const n=new Set;for(const o of t){(o==null?void 0:o.type)==="label"&&n.add(o);for(const r of(o==null?void 0:o.labels)??[])n.add(r)}let i=0;for(const o of n){if(!this.elementRegistry.get(o.id)||!this.remeasure(o))continue;const r=this.elementRegistry.getGraphics(o);r&&this.graphicsFactory.update("shape",o,r),i++}i&&this.eventBus.fire(wc)}syncGraphicsOrder(){var t,n;for(const i of this.elementRegistry.getAll()){if(!((t=i.children)!=null&&t.length))continue;const o=this.graphicsFactory._getChildrenContainer(i);for(const r of i.children){const a=(n=this.elementRegistry.getGraphics(r))==null?void 0:n.parentNode;a&&o.appendChild(a)}}}redrawAll(){const t=this.canvas.getRootElement();for(const n of this.elementRegistry.getAll()){if(n===t)continue;const i=this.elementRegistry.getGraphics(n);i&&this.graphicsFactory.update(n.waypoints?"connection":"shape",n,i)}this.eventBus.fire(wc)}ensureShadow(){if(this.shadow)return this.shadow;const t=document.createElement("div");return t.style.cssText="position:absolute;left:-10000px;top:0;width:800px;height:600px;visibility:hidden",document.body.appendChild(t),this.shadowContainer=t,this.shadow=new Kr({container:t,moddleExtensions:Ss,additionalModules:[...lg]}),this.shadow}disposeShadow(){var t,n;(t=this.shadow)==null||t.destroy(),this.shadow=void 0,(n=this.shadowContainer)==null||n.remove(),this.shadowContainer=void 0}}on(gg,"$inject",["eventBus","elementRegistry","textRenderer","graphicsFactory","canvas","bpmnjs"]);function L0(e,t){const n=Object.create(e);return n.on=(i,o,r,a)=>{typeof o=="function"&&(a=r,r=o,o=1e3);const s=function(...c){return t.isActive()?void 0:r.apply(this,c)};return e.on(i,o,s,a)},n}function mg(e,t,n,i){hg.call(this,L0(e,i),t,n)}mg.$inject=["eventBus","gridSnapping","elementRegistry","headlessReplay"];function Ku(e,t,n,i){es.call(this,L0(e,i),t,n)}Ku.prototype=Object.create(es.prototype),Ku.$inject=["eventBus","gridSnapping","modeling","headlessReplay"];function kN(e){return e instanceof mg||e instanceof Ku}const I0={__init__:["headlessReplay"],headlessReplay:["type",gg],gridSnappingAutoPlaceBehavior:["type",mg],gridSnappingLayoutConnectionBehavior:["type",Ku]};function ra(e){return CSS.escape(e)}var ON={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function B0(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return ON[t]})}var Xu=50,DN=new ta,N0={min:.2,max:4},LN=10,IN=.1,BN=250,NN=100,$N=2e3;function Gn(e,t,n,i,o){var r=this;this._canvas=i,this._elementRegistry=o,this._eventBus=n,this._injector=t,this._config=e||{},this._updateTimeout=null,this._firstDebounceTime=null,this._dirty=!1,this._state={isOpen:void 0,isDragging:!1,initialDragPosition:null,offsetViewport:null,cachedViewbox:null,dragger:null,svgClientRect:null,parentClientRect:null,zoomDelta:0},this._minimapId=DN.next(),this._init(),this.toggle(this._config.open||!1);function a(u){(!r._state._svgClientRect||Ju(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect());var p=Zu({x:u.x-r._state._svgClientRect.left,y:u.y-r._state._svgClientRect.top},r._svg,r._lastViewbox);yg(p,r._canvas),r._update()}function s(u){return function(d){var f=vg(d);(!r._state._svgClientRect||Ju(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect()),u&&a(f);var m=Zu({x:f.x-r._state._svgClientRect.left,y:f.y-r._state._svgClientRect.top},r._svg,r._lastViewbox),h=i.viewbox(),y=jN(m,h),w=r._viewportDom.getBoundingClientRect(),g={x:f.x-w.left+1,y:f.y-w.top+1};te(r._state,{cachedViewbox:h,initialDragPosition:{x:f.x,y:f.y},isDragging:!0,offsetViewport:y,offsetViewportDom:g,viewportClientRect:r._viewport.getBoundingClientRect(),parentClientRect:r._parent.getBoundingClientRect()}),Ke.bind(document,"mousemove",c),Ke.bind(document,"mouseup",l)}}function c(u){var p=vg(u);if(r._state.isDragging){(!r._state._svgClientRect||Ju(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect());var d=r._state.offsetViewportDom,f=r._state.viewportClientRect,m=r._state.parentClientRect;te(r._viewportDom.style,{top:p.y-d.y-m.top+"px",left:p.x-d.x-m.left+"px"});var h=F0(m,{top:p.y-d.y-m.top,left:p.x-d.x-m.left,width:f.width,height:f.height});te(r._overlay.style,{clipPath:h});var y=Zu({x:p.x-r._state._svgClientRect.left,y:p.y-r._state._svgClientRect.top},r._svg,r._lastViewbox);yg({x:y.x-r._state.offsetViewport.x,y:y.y-r._state.offsetViewport.y},r._canvas)}}function l(u){var p=vg(u);r._state.isDragging&&(r._state.initialDragPosition.x===p.x&&r._state.initialDragPosition.y===p.y&&a(u),r._update(),te(r._state,{cachedViewbox:null,initialDragPosition:null,isDragging:!1,offsetViewport:null,offsetViewportDom:null}),Ke.unbind(document,"mousemove",c),Ke.unbind(document,"mouseup",l))}Ke.bind(this._viewportDom,"mousedown",s(!1)),Ke.bind(this._svg,"mousedown",s(!0)),Ke.bind(this._parent,"wheel",function(u){if(u.preventDefault(),u.stopPropagation(),!!u.ctrlKey&&((!r._state._svgClientRect||Ju(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect()),!!WN(u,r._state._svgClientRect))){var p=u.deltaMode===0?.02:.32,d=Math.sqrt(Math.pow(u.deltaY,2)+Math.pow(u.deltaX,2))*UN(u.deltaY)*-p;if(r._state.zoomDelta+=d,Math.abs(r._state.zoomDelta)>IN){var f=d>0?1:-1,m=Math.log(i.zoom())/Math.log(10),h=qN(N0,LN*2),y=Math.round(m/h)*h;y+=h*f;var w=Math.pow(10,y);i.zoom(YN(N0,w),g),r._state.zoomDelta=0;var g=Zu({x:u.clientX-r._state._svgClientRect.left,y:u.clientY-r._state._svgClientRect.top},r._svg,r._lastViewbox);yg(g,r._canvas),r._update()}}}),Ke.bind(this._toggle,"click",function(u){u.preventDefault(),u.stopPropagation(),r.toggle()}),n.on(["shape.added","connection.added"],function(u){if(!r.isOpen()){r._dirty=!0;return}r._addElement(u.element),r._scheduleUpdate()}),n.on(["shape.removed","connection.removed"],function(u){if(!r.isOpen()){r._dirty=!0;return}r._removeElement(u.element),r._scheduleUpdate()}),n.on("elements.changed",BN,function(u){if(!r.isOpen()){r._dirty=!0;return}u.elements.forEach(function(p){r._updateElement(p)}),r._scheduleUpdate()}),n.on("element.updateId",function(u){var p=u.element,d=u.newId;r._updateElementId(p,d)}),n.on("canvas.viewbox.changed",function(){r._state.isDragging||r._update()}),n.on("canvas.resized",function(){document.body.contains(r._parent)&&(r._state.isDragging||r._update(),r._state._svgClientRect=r._svg.getBoundingClientRect())}),n.on(["root.set","plane.set"],function(u){if(!r.isOpen()){r._dirty=!0;return}r._clear();var p=u.element||u.plane.rootElement;p.children.forEach(function(d){r._addElement(d)}),r._update()}),n.on("diagram.destroy",function(){r._updateTimeout&&(clearTimeout(r._updateTimeout),r._updateTimeout=null)})}Gn.$inject=["config.minimap","injector","eventBus","canvas","elementRegistry"],Gn.prototype._init=function(){var e=this._canvas,t=e.getContainer(),n=this._parent=document.createElement("div");Dt(n).add("djs-minimap").add("bio-theme-parent"),t.appendChild(n);var i=this._toggle=document.createElement("div");Dt(i).add("toggle"),n.appendChild(i);var o=this._map=document.createElement("div");Dt(o).add("map"),n.appendChild(o);var r=this._svg=We("svg");Le(r,{width:"100%",height:"100%"}),ot(o,r);var a=this._elementsGroup=We("g");ot(r,a);var s=this._viewportGroup=We("g");ot(r,s);var c=this._viewport=We("rect");vt(c).add("viewport"),ot(s,c),Ke.bind(n,"mousedown",function(p){p.stopPropagation()});var l=this._viewportDom=document.createElement("div");Dt(l).add("viewport-dom"),this._parent.appendChild(l);var u=this._overlay=document.createElement("div");Dt(u).add("overlay"),this._parent.appendChild(u)},Gn.prototype._scheduleUpdate=function(){var e=this;if(this.isOpen()){var t=tt(this._config.debounceDelay)?this._config.debounceDelay:NN,n=tt(this._config.debounceSkipDelay)?this._config.debounceSkipDelay:$N,i=Date.now();if(this._firstDebounceTime&&i-this._firstDebounceTime>=n){this._update();return}this._updateTimeout&&clearTimeout(this._updateTimeout),this._firstDebounceTime=this._firstDebounceTime||i,this._updateTimeout=setTimeout(function(){e._update()},t)}},Gn.prototype._rebuild=function(){this._clear();var e=this._canvas,t=e.getRootElement&&e.getRootElement();if(t&&t.children){var n=this;t.children.forEach(function(i){n._addElement(i)})}},Gn.prototype._update=function(){if(this.isOpen()){this._updateTimeout&&(clearTimeout(this._updateTimeout),this._updateTimeout=null),this._firstDebounceTime=null;var e=this._canvas.viewbox(),t=e.inner,n=e.outer;if(j0(e)){var i,o,r,a,s=n.width-t.width,c=n.height-t.height;t.width<n.width?(i=t.x-s/2,r=n.width,t.x+t.width<n.width&&(i=Math.min(0,t.x))):(i=t.x,r=t.width),t.height<n.height?(o=t.y-c/2,a=n.height,t.y+t.height<n.height&&(o=Math.min(0,t.y))):(o=t.y,a=t.height),i=i-Xu,o=o-Xu,r=r+Xu*2,a=a+Xu*2,this._lastViewbox={x:i,y:o,width:r,height:a},Le(this._svg,{viewBox:i+", "+o+", "+r+", "+a}),Le(this._viewport,{x:e.x,y:e.y,width:e.width,height:e.height});var l=this._state._parentClientRect=this._parent.getBoundingClientRect(),u=this._viewport.getBoundingClientRect(),p={top:u.top-l.top,left:u.left-l.left,width:u.width,height:u.height};te(this._viewportDom.style,{top:p.top+"px",left:p.left+"px",width:p.width+"px",height:p.height+"px"});var d=F0(l,p);te(this._overlay.style,{clipPath:d})}}},Gn.prototype.open=function(){te(this._state,{isOpen:!0}),Dt(this._parent).add("open");var e=this._injector.get("translate",!1)||function(t){return t};On(this._toggle,"title",e("Close minimap")),this._dirty&&(this._rebuild(),this._dirty=!1),this._update(),this._eventBus.fire("minimap.toggle",{open:!0})},Gn.prototype.close=function(){te(this._state,{isOpen:!1}),Dt(this._parent).remove("open");var e=this._injector.get("translate",!1)||function(t){return t};On(this._toggle,"title",e("Open minimap")),this._eventBus.fire("minimap.toggle",{open:!1})},Gn.prototype.toggle=function(e){var t=this.isOpen();typeof e>"u"&&(e=!t),e!=t&&(e?this.open():this.close())},Gn.prototype.isOpen=function(){return this._state.isOpen},Gn.prototype._updateElement=function(e){try{e.parent!==void 0&&e.parent!==null&&(this._removeElement(e),this._addElement(e))}catch(t){console.warn("Minimap#_updateElement errored",t)}},Gn.prototype._updateElementId=function(e,t){try{var n=kt("#"+ra(this._prefixId(e.id)),this._elementsGroup);n&&(n.id=this._prefixId(t))}catch(i){console.warn("Minimap#_updateElementId errored",i)}},Gn.prototype.isOnActivePlane=function(e){var t=this._canvas;return t.findRoot?t.findRoot(e)===t.getRootElement():t.findPlane?t.findPlane(e)===t.getActivePlane():!0},Gn.prototype._addElement=function(e){var t=this;if(this._removeElement(e),!!this.isOnActivePlane(e)&&!e.hidden){var n,i,o,r=this._createElement(e),a=kt("#"+ra(this._prefixId(e.parent.id)),this._elementsGroup);if(r){var s=GN(e);return s!==-1?a?zN(r,a,s):this._elementsGroup.appendChild(r):this._elementsGroup.appendChild(r),FN(e)?(n=e.parent,i=0,o=0,typeof n.x<"u"&&typeof n.y<"u"&&(i=-n.x,o=-n.y),Le(r,{transform:"translate("+i+" "+o+")"})):(i=e.x,o=e.y,a&&(n=e.parent,i-=n.x,o-=n.y),Le(r,{transform:"translate("+i+" "+o+")"})),e.children&&e.children.length&&e.children.forEach(function(c){t._addElement(c)}),r}}},Gn.prototype._removeElement=function(e){var t=this._svg.getElementById(this._prefixId(e.id));t&&mn(t)},Gn.prototype._createElement=function(e){var t=this._elementRegistry.getGraphics(e),n;if(t&&(n=fr(t),n)){var i=KN(sf(n));return Le(i,{id:this._prefixId(e.id)}),i}},Gn.prototype._clear=function(){Is(this._elementsGroup)},Gn.prototype._prefixId=function(e){return"djs-minimap-"+e+"-"+this._minimapId};function FN(e){return e.waypoints}function jN(e,t){var n={x:t.x+t.width/2,y:t.y+t.height/2};return{x:e.x-n.x,y:e.y-n.y}}function Zu(e,t,n){var i=t.getBoundingClientRect(),o=HN(n,i.width/i.height),r=$0(e.x,0,i.width,o.x,o.x+o.width),a=$0(e.y,0,i.height,o.y,o.y+o.height);return{x:r,y:a}}function yg(e,t){var n=t.viewbox(),i=n.width,o=n.height;t.viewbox({x:e.x-i/2,y:e.y-o/2,width:i,height:o})}function HN(e,t){var n=e.width/e.height,i=te({},{x:e.x,y:e.y,width:e.width,height:e.height});if(n>t){var o=i.width*(1/t),r=i.y-(o-i.height)/2;te(i,{y:r,height:o})}else if(n<t){var a=i.height*t,s=i.x-(a-i.width)/2;te(i,{x:s,width:a})}return i}function $0(e,t,n,i,o){var r=n-t,a=o-i;return(e-t)*a/r+i}function GN(e){var t=e.parent;return!t||!t.children?-1:t.children.indexOf(e)}function zN(e,t,n){var i=VN(t),o=i[n];o?t.insertBefore(e,o):t.appendChild(e)}function VN(e){return Array.from(e.childNodes).filter(function(t){return t.id})}function Ju(e){return e.width===0&&e.height===0}function WN(e,t){return e.x>t.left&&e.x<t.left+t.width&&e.y>t.top&&e.y<t.top+t.height}var UN=Math.sign||function(e){return e>=0?1:-1};function qN(e,t){var n=Math.log(e.min)/Math.log(10),i=Math.log(e.max)/Math.log(10),o=Math.abs(n)+Math.abs(i);return o/t}function YN(e,t){return Math.max(e.min,Math.min(e.max,t))}function F0(e,t){var n=[vo(t.left,t.top),vo(t.left+t.width,t.top),vo(t.left+t.width,t.top+t.height),vo(t.left,t.top+t.height),vo(t.left,e.height),vo(e.width,e.height),vo(e.width,0),vo(0,0),vo(0,e.height),vo(t.left,e.height)].join(", ");return"polygon("+n+")"}function vo(e,t){return e+"px "+t+"px"}function j0(e){return Xo(e,function(t){return Sn(t)?j0(t):tt(t)&&isFinite(t)})}function vg(e){return e.center?e.center:{x:e.clientX,y:e.clientY}}function KN(e){return Ls("[id]",e).forEach(function(t){t.remove()}),e}var XN={__init__:["minimap"],minimap:["type",Gn]};const H0={closed:"미니맵",open:"접기"};class G0{constructor(t,n,i){this.minimap=n,this.canvas=i,t.on(wc,()=>this.rebuild()),t.on("minimap.toggle",o=>this.retitle(o.open)),this.retitle(n.isOpen())}rebuild(){const t=this.minimap;if(!t.isOpen()){t._dirty=!0;return}t._rebuild(),t._update()}retitle(t){const n=this.canvas.getContainer().querySelector(".djs-minimap .toggle");n==null||n.setAttribute("title",t?H0.open:H0.closed)}}on(G0,"$inject",["eventBus","minimap","canvas"]);const z0=[D0,{__depends__:[XN],__init__:["minimapI18n"],minimapI18n:["type",G0]},b0,E0,Pv,I0];var ZN=new ta("ov"),JN=500;function Dn(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=ZN,this._overlayDefaults=te({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=QN(n.getContainer()),this._init()}Dn.$inject=["config.overlays","eventBus","canvas","elementRegistry"],Dn.prototype.get=function(e){if(ai(e)&&(e={id:e}),ai(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?gt(t.overlays,_a({type:e.type})):t.overlays.slice():[]}else return e.type?gt(this._overlays,_a({type:e.type})):e.id?this._overlays[e.id]:null},Dn.prototype.add=function(e,t,n){if(Sn(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=te({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},Dn.prototype.remove=function(e){var t=this.get(e)||[];et(t)||(t=[t]);var n=this;K(t,function(i){var o=n._getOverlayContainer(i.element,!0);if(i&&(co(i.html),co(i.htmlContainer),delete i.htmlContainer,delete i.element,delete n._overlays[i.id]),o){var r=o.overlays.indexOf(i);r!==-1&&o.overlays.splice(r,1)}})},Dn.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},Dn.prototype.show=function(){Qu(this._overlayRoot)},Dn.prototype.hide=function(){Qu(this._overlayRoot,!1)},Dn.prototype.clear=function(){this._overlays={},this._overlayContainers=[],Tl(this._overlayRoot)},Dn.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,o=t.y;if(t.waypoints){var r=yn(t);i=r.x,o=r.y}V0(n,i,o),On(e.html,"data-container-id",t.id)},Dn.prototype._updateOverlay=function(e){var t=e.position,n=e.htmlContainer,i=e.element,o=t.left,r=t.top;if(t.right!==void 0){var a;i.waypoints?a=yn(i).width:a=i.width,o=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=yn(i).height:s=i.height,r=t.bottom*-1+s}V0(n,o||0,r||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Dn.prototype._createOverlayContainer=function(e){var t=Wt('<div class="djs-overlays" />');Zn(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},Dn.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";W0(this._overlayRoot,n)},Dn.prototype._getOverlayContainer=function(e,t){var n=Ht(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},Dn.prototype._addOverlay=function(e){var t=e.id,n=e.element,i=e.html,o,r;i.get&&i.constructor.prototype.jquery&&(i=i.get(0)),ai(i)&&(i=Wt(i)),r=this._getOverlayContainer(n),o=Wt('<div class="djs-overlay" data-overlay-id="'+t+'">'),Zn(o,{position:"absolute"}),o.appendChild(i),e.type&&Dt(o).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();Qu(o,a===s),e.htmlContainer=o,r.overlays.push(e),r.html.appendChild(o),this._overlays[t]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Dn.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,i=this._canvas.findRoot(e.element),o=n&&n.minZoom,r=n&&n.maxZoom,a=e.htmlContainer,s=this._canvas.getRootElement(),c=!0;(i!==s||n&&(En(o)&&o>t.scale||En(r)&&r<t.scale))&&(c=!1),Qu(a,c),this._updateOverlayScale(e,t)},Dn.prototype._updateOverlayScale=function(e,t){var n=e.scale,i,o,r=e.htmlContainer,a,s="";n!==!0&&(n===!1?(i=1,o=1):(i=n.min,o=n.max),En(i)&&t.scale<i&&(a=(1/t.scale||1)*i),En(o)&&t.scale>o&&(a=(1/t.scale||1)*o)),En(a)&&(s="scale("+a+","+a+")"),W0(r,s)},Dn.prototype._updateOverlaysVisibilty=function(e){var t=this;K(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},Dn.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 o=i.element,r=t.get({element:o});K(r,function(c){t.remove(c.id)});var a=t._getOverlayContainer(o);if(a){co(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",JN,function(i){var o=i.element,r=t._getOverlayContainer(o,!0);r&&(K(r.overlays,function(a){t._updateOverlay(a)}),t._updateOverlayContainer(r))}),e.on("element.marker.update",function(i){var o=t._getOverlayContainer(i.element,!0);o&&Dt(o.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 QN(e){var t=Wt('<div class="djs-overlay-container" />');return Zn(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function V0(e,t,n){Zn(e,{left:t+"px",top:n+"px"})}function Qu(e,t){e.style.display=t===!1?"none":""}function W0(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const ep={__init__:["overlays"],overlays:["type",Dn]};function xg(e,t){t.invoke(we,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)})}je(xg,we),xg.$inject=["canvas","injector"];const e$={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",xg]};var t$="bjs-breadcrumbs-shown";function U0(e,t,n){var i=Wt('<ul class="bjs-breadcrumbs"></ul>'),o=n.getContainer(),r=Dt(o);o.appendChild(i);var a=[];e.on("element.changed",function(c){var l=c.element,u=Ee(l),p=Ht(a,function(d){return d===u});p&&s()});function s(c){c&&(a=n$(c));var l=a.flatMap(function(p){var d=n.findRoot(go(p))||n.findRoot(p.id);if(!d&&T(p,"bpmn:Process")){var f=t.find(function(y){var w=Ee(y);return w&&w.get("processRef")===p});d=f&&n.findRoot(f.id)}if(!d)return[];var m=B0(p.name||p.id),h=Wt('<li><span class="bjs-crumb"><a title="'+m+'">'+m+"</a></span></li>");return h.addEventListener("click",function(){n.setRootElement(d)}),h});i.innerHTML="";var u=l.length>1;r.toggle(t$,u),l.forEach(function(p){i.appendChild(p)})}e.on("root.set",function(c){s(c.element)})}U0.$inject=["eventBus","elementRegistry","canvas"];function n$(e){for(var t=Ee(e),n=[],i=t;i;i=i.$parent)(T(i,"bpmn:SubProcess")||T(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function q0(e,t){var n=null,i=new i$;e.on("root.set",function(o){var r=o.element,a=t.viewbox(),s=i.get(r);if(i.set(n,{x:a.x,y:a.y,zoom:a.scale}),n=r,!(!T(r,"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})}q0.$inject=["eventBus","canvas"];function i$(){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 Y0={x:180,y:160};function aa(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,o){n._handleImport(o.definitions)})}aa.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)})}},aa.prototype._createNewDiagrams=function(e){var t=this,n=[],i=[];e.get("planeElement").forEach(function(r){var a=r.bpmnElement;if(a){var s=a.$parent;T(a,"bpmn:SubProcess")&&!r.isExpanded&&n.push(a),r$(a,e)&&i.push({diElement:r,parent:s})}});var o=[];return n.forEach(function(r){if(!t._processToDiagramMap[r.id]){var a=t._createDiagram(r);t._processToDiagramMap[r.id]=a,o.push(a)}}),i.forEach(function(r){for(var a=r.diElement,s=r.parent;s&&n.indexOf(s)===-1;)s=s.$parent;if(s){var c=t._processToDiagramMap[s.id];t._moveToDiPlane(a,c.plane)}}),o},aa.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=o$(e),i={x:n.x-Y0.x,y:n.y-Y0.y};t.forEach(function(o){o.waypoint?o.waypoint.forEach(function(r){r.x=r.x-i.x,r.y=r.y-i.y}):o.bounds&&(o.bounds.x=o.bounds.x-i.x,o.bounds.y=o.bounds.y-i.y)})},aa.prototype._moveToDiPlane=function(e,t){var n=K0(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},aa.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},aa.$inject=["eventBus","moddle"];function K0(e){return T(e,"bpmndi:BPMNDiagram")?e:K0(e.$parent)}function o$(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=Ze(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),Bl(t)}function r$(e,t){var n=e.$parent;return!(!T(n,"bpmn:SubProcess")||n===t.bpmnElement||ht(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var tp=250,a$='<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>',s$="bjs-drilldown-empty";function Mr(e,t,n,i,o){we.call(this,t),this._canvas=e,this._eventBus=t,this._elementRegistry=n,this._overlays=i,this._translate=o;var r=this;this.executed("shape.toggleCollapse",tp,function(a){var s=a.shape;r._canDrillDown(s)?r._addOverlay(s):r._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",tp,function(a){var s=a.shape;r._canDrillDown(s)?r._addOverlay(s):r._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],tp,function(a){var s=a.oldParent,c=a.newParent||a.parent,l=a.shape;r._canDrillDown(l)&&r._addOverlay(l),r._updateDrilldownOverlay(s),r._updateDrilldownOverlay(c),r._updateDrilldownOverlay(l)},!0),this.reverted(["shape.create","shape.move","shape.delete"],tp,function(a){var s=a.oldParent,c=a.newParent||a.parent,l=a.shape;r._canDrillDown(l)&&r._addOverlay(l),r._updateDrilldownOverlay(s),r._updateDrilldownOverlay(c),r._updateDrilldownOverlay(l)},!0),t.on("import.render.complete",function(){n.filter(function(a){return r._canDrillDown(a)}).map(function(a){r._addOverlay(a)})})}je(Mr,we),Mr.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},Mr.prototype._canDrillDown=function(e){var t=this._canvas;return T(e,"bpmn:SubProcess")&&t.findRoot(go(e))},Mr.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=Ee(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var o=n&&n.get("flowElements")&&n.get("flowElements").length;Dt(i.html).toggle(s$,!o)}},Mr.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=Ee(e),o=n.get({element:e,type:"drilldown"});o.length&&this._removeOverlay(e);var r=Wt('<button type="button" class="bjs-drilldown">'+a$+"</button>"),a=i.get("name")||i.get("id"),s=this._translate("Open {element}",{element:a});r.setAttribute("title",s),r.addEventListener("click",function(){t.setRootElement(t.findRoot(go(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:r}),this._updateOverlayVisibility(e)},Mr.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},Mr.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const c$={__depends__:[ep,Gh,e$],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",U0],drilldownCentering:["type",q0],drilldownOverlayBehavior:["type",Mr],subprocessCompatibility:["type",aa]};function Cr(e){Xt.call(this,e)}je(Cr,Xt),Cr.prototype._modules=[mb,c$,ep,Oi,Ys],Cr.prototype._moddleExtensions={};var np="keyboard.keydown",l$="keyboard.keyup",u$=1e3,X0="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 Jn(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(X0));var i=e&&e.bind!==!1;t.on("canvas.init",function(o){n._target=o.svg,i&&n.bind(),n._fire("init")})}Jn.$inject=["config.keyboard","eventBus"],Jn.prototype._keydownHandler=function(e){this._keyHandler(e,np)},Jn.prototype._keyupHandler=function(e){this._keyHandler(e,l$)},Jn.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||np,i),n&&e.preventDefault()}},Jn.prototype._isEventIgnored=function(e){return!1},Jn.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(X0)),this.unbind(),e=this._node=this._target,Ke.bind(e,"keydown",this._keydownHandler),Ke.bind(e,"keyup",this._keyupHandler),this._fire("bind")},Jn.prototype.getBinding=function(){return this._node},Jn.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),Ke.unbind(e,"keydown",this._keydownHandler),Ke.unbind(e,"keyup",this._keyupHandler)),this._node=null},Jn.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},Jn.prototype.addListener=function(e,t,n){An(e)&&(n=t,t=e,e=u$),this._eventBus.on(n||np,e,t)},Jn.prototype.removeListener=function(e,t){this._eventBus.off(t||np,e)},Jn.prototype.hasModifier=VL,Jn.prototype.isCmd=di,Jn.prototype.isShift=kh,Jn.prototype.isKey=Mn;var p$=500;function ts(e,t){var n=this;e.on("editorActions.init",p$,function(i){var o=i.editorActions;n.registerBindings(t,o)})}ts.$inject=["eventBus","keyboard"],ts.prototype.registerBindings=function(e,t){function n(i,o){t.isRegistered(i)&&e.addListener(o)}n("undo",function(i){var o=i.keyEvent;if(KL(o))return t.trigger("undo"),!0}),n("redo",function(i){var o=i.keyEvent;if(XL(o))return t.trigger("redo"),!0}),n("copy",function(i){var o=i.keyEvent;if(WL(o))return t.trigger("copy"),!0}),n("paste",function(i){var o=i.keyEvent;if(UL(o))return t.trigger("paste"),!0}),n("duplicate",function(i){var o=i.keyEvent;if(qL(o))return t.trigger("duplicate"),!0}),n("cut",function(i){var o=i.keyEvent;if(YL(o))return t.trigger("cut"),!0}),n("stepZoom",function(i){var o=i.keyEvent;if(Mn(["+","Add","="],o)&&di(o))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var o=i.keyEvent;if(Mn(["-","Subtract"],o)&&di(o))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var o=i.keyEvent;if(Mn("0",o)&&di(o))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var o=i.keyEvent;if(Mn(["Backspace","Delete","Del"],o))return t.trigger("removeSelection"),!0})};const bg={__init__:["keyboard","keyboardBindings"],keyboard:["type",Jn],keyboardBindings:["type",ts]};var d$={moveSpeed:50,moveSpeedAccelerated:200};function Z0(e,t,n){var i=this;this._config=te({},d$,e||{}),t.addListener(o);function o(r){var a=r.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(r){var a=0,s=0,c=r.speed,l=c/Math.min(Math.sqrt(n.viewbox().scale),1);switch(r.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})}}Z0.$inject=["config.keyboardMove","keyboard","canvas"];const J0={__depends__:[bg],__init__:["keyboardMove"],keyboardMove:["type",Z0]};var f$=15;function Q0(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 o(s){var c=n.start,l=n.button,u=Jr(s),p=Qi(u,c);if(!n.dragging&&h$(p)>f$&&(n.dragging=!0,l===0&&n_(e),bu("grab")),n.dragging){var d=n.last||n.start;p=Qi(u,d),t.scroll({dx:p.x,dy:p.y}),n.last=u}s.preventDefault()}function r(s){Ke.unbind(document,"mousemove",o),Ke.unbind(document,"mouseup",r),n=null,t_()}function a(s){if(!Ur(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:Jr(s)},Ke.bind(document,"mousemove",o),Ke.bind(document,"mouseup",r),!0}}this.isActive=function(){return!!n}}Q0.$inject=["eventBus","canvas"];function h$(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const eE={__init__:["moveCanvas"],moveCanvas:["type",Q0]};function tE(e,t){var n=Af(e.min),i=Af(e.max),o=Math.abs(n)+Math.abs(i);return o/t}function g$(e,t){return Math.max(e.min,Math.min(e.max,t))}var m$=Math.sign||function(e){return e>=0?1:-1},wg={min:.2,max:4},nE=10,y$=.1,v$=.75;function xo(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=ti(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||v$;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}xo.$inject=["config.zoomScroll","eventBus","canvas"],xo.prototype.scroll=function(t){this._canvas.scroll(t)},xo.prototype.reset=function(){this._canvas.zoom("fit-viewport")},xo.prototype.zoom=function(t,n){var i=tE(wg,nE*2);this._totalDelta+=t,Math.abs(this._totalDelta)>y$&&(this._zoom(t,n,i),this._totalDelta=0)},xo.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||lw()&&t.metaKey,o=t.shiftKey,r=-1*this._scale,a;if(i?r*=t.deltaMode===0?.02:.32:r*=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))*m$(t.deltaY)*r,this.zoom(a,c)}else o?a={dx:r*t.deltaY,dy:0}:a={dx:r*t.deltaX,dy:r*t.deltaY},this.scroll(a)}},xo.prototype.stepZoom=function(t,n){var i=tE(wg,nE);this._zoom(t,n,i)},xo.prototype._zoom=function(e,t,n){var i=this._canvas,o=e>0?1:-1,r=Af(i.zoom()),a=Math.round(r/n)*n;a+=n*o;var s=Math.pow(10,a);i.zoom(g$(wg,s),t)},xo.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,o=this._enabled;return typeof t>"u"&&(t=!o),o!==t&&Ke[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},xo.prototype._init=function(e){this.toggle(e)};const iE={__init__:["zoomScroll"],zoomScroll:["type",xo]};function _c(e){Cr.call(this,e)}je(_c,Cr),_c.prototype._navigationModules=[J0,eE,iE],_c.prototype._modules=[].concat(Cr.prototype._modules,_c.prototype._navigationModules);function _g(e){return e&&e[e.length-1]}function oE(e){return e.y}function rE(e){return e.x}var x$={left:rE,center:rE,right:function(e){return e.x+e.width},top:oE,middle:oE,bottom:function(e){return e.y+e.height}};function ns(e,t){this._modeling=e,this._rules=t}ns.$inject=["modeling","rules"],ns.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}},ns.prototype._isType=function(e,t){return t.indexOf(e)!==-1},ns.prototype._alignmentPosition=function(e,t){var n=this._getOrientationDetails(e),i=n.axis,o=n.dimension,r={},a={},s=!1,c,l,u;function p(d,f){return Math.round((d[i]+f[i]+f[o])/2)}if(this._isType(e,["left","top"]))r[e]=t[0][i];else if(this._isType(e,["right","bottom"]))u=_g(t),r[e]=u[i]+u[o];else if(this._isType(e,["center","middle"])){if(K(t,function(d){var f=d[i]+Math.round(d[o]/2);a[f]?a[f].elements.push(d):a[f]={elements:[d],center:f}}),c=io(a,function(d){return d.elements.length>1&&(s=!0),d.elements.length}),s)return r[e]=_g(c).center,r;l=t[0],t=io(t,function(d){return d[i]+d[o]}),u=_g(t),r[e]=p(l,u)}return r},ns.prototype.trigger=function(e,t){var n=this._modeling,i,o=gt(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:o}),et(i)&&(o=i),!(o.length<2||!i)){var r=x$[t],a=io(o,r),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const b$={__init__:["alignElements"],alignElements:["type",ns]},w$=new ta;function is(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}is.$inject=["eventBus"],is.prototype.schedule=function(e,t=w$.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},is.prototype._schedule=function(e,t){const n=_$();return{executionId:setTimeout(()=>{try{this._scheduled[t]=null;try{n.resolve(e())}catch(o){n.reject(o)}}catch(o){console.error("Scheduler#_schedule execution failed",o)}}),promise:n.promise}},is.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},is.prototype._cancel=function(e){clearTimeout(e.executionId)};function _$(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const E$={scheduler:["type",is]};var S$="djs-element-hidden",ip=".entry",R$=1e3,aE=8,M$=300;function xn(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}xn.$inject=["canvas","elementRegistry","eventBus","scheduler"],xn.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 o=i.target,r=et(o)?o:[o],a=r.filter(function(c){return n.includes(c)});if(a.length){e.close();var s=r.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,o=et(i.target)?i.target:[i.target];o.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},xn.prototype._createContainer=function(){var e=Wt('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},xn.prototype.registerProvider=function(e,t){t||(t=e,e=R$),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},xn.prototype.getEntries=function(e){var t=this._getProviders(),n=et(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return K(t,function(o){if(An(o[n])){var r=o[n](e);An(r)?i=r(i):K(r,function(a,s){i[s]=a})}}),i},xn.prototype.trigger=function(e,t,n){var i=this,o,r,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(o=On(a,"data-action"),r=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(o,"hover",r,n)},M$);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(o,e,r,n)},xn.prototype.triggerEntry=function(e,t,n,i){if(this.isShown()){var o=this._current.target,r=this._current.entries,a=r[e];if(a){var s=a.action;if(this._eventBus.fire("contextPad.trigger",{entry:a,event:n})!==!1){if(An(s)){if(t==="click")return s(n,o,i)}else if(s[t])return s[t](n,o,i);n.preventDefault()}}}},xn.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))}},xn.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},xn.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),i;K(t,function(o,r){var a=o.group||"default",s=Wt(o.html||'<div class="entry" draggable="true"></div>'),c;On(s,"data-action",r),c=kt("[data-group="+ra(a)+"]",n),c||(c=Wt('<div class="group"></div>'),On(c,"data-group",a),n.appendChild(c)),c.appendChild(s),o.className&&C$(s,o.className),o.title&&On(s,"title",o.title),o.imageUrl&&(i=Wt("<img>"),On(i,"src",o.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),Dt(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},xn.prototype._createHtml=function(e){var t=this,n=Wt('<div class="djs-context-pad"></div>');return li.bind(n,ip,"click",function(i){t.trigger("click",i)}),li.bind(n,ip,"dragstart",function(i){t.trigger("dragstart",i)}),li.bind(n,ip,"mouseover",function(i){t.trigger("mouseover",i)}),li.bind(n,ip,"mouseout",function(i){t.trigger("mouseout",i)}),Ke.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},xn.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()&&T$(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},xn.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},xn.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return et(e)!==et(n)?!1:et(e)?e.length===n.length&&Xo(e,function(i){return n.includes(i)}):n===e},xn.prototype.isShown=function(){return this.isOpen()&&Dt(this._current.html).has("open")},xn.prototype.show=function(){this.isOpen()&&(Dt(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},xn.prototype.hide=function(){this.isOpen()&&(Dt(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},xn.prototype._getPosition=function(e){if(!et(e)&&$t(e)){var t=this._canvas.viewbox(),n=A$(e),i=n.x*t.scale-t.x*t.scale,o=n.y*t.scale-t.y*t.scale;return{left:i+aE*this._canvas.zoom(),top:o}}var r=this._canvas.getContainer(),a=r.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+aE*this._canvas.zoom(),top:s.top-a.top}},xn.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")},xn.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=et(n)?n:[n],o=i.some(function(r){return t._canvas.hasMarker(r,S$)});o?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},xn.prototype._getTargetBounds=function(e){var t=this,n=et(e)?e:[e],i=n.map(function(o){return t._canvas.getGraphics(o)});return i.reduce(function(o,r){const a=r.getBoundingClientRect();return o.top=Math.min(o.top,a.top),o.right=Math.max(o.right,a.right),o.bottom=Math.max(o.bottom,a.bottom),o.left=Math.min(o.left,a.left),o.x=o.left,o.y=o.top,o.width=o.right-o.left,o.height=o.bottom-o.top,o},{top:1/0,right:-1/0,bottom:-1/0,left:1/0})};function C$(e,t){var n=Dt(e);t=et(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function A$(e){return e.waypoints[e.waypoints.length-1]}function T$(e,t){return e=et(e)?e:[e],t=et(t)?t:[t],e.length===t.length&&Xo(e,function(n){return t.includes(n)})}const sE={__depends__:[xu,E$,ep],contextPad:["type",xn]};var op,Jt,cE,Ar,lE,uE,pE,Eg,rp,Ec,dE,Sg,Rg,Mg,ap={},sp=[],P$=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,cp=Array.isArray;function zo(e,t){for(var n in t)e[n]=t[n];return e}function Cg(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function fE(e,t,n){var i,o,r,a={};for(r in t)r=="key"?i=t[r]:r=="ref"?o=t[r]:a[r]=t[r];if(arguments.length>2&&(a.children=arguments.length>3?op.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(r in e.defaultProps)a[r]===void 0&&(a[r]=e.defaultProps[r]);return lp(e,a,i,o,null)}function lp(e,t,n,i,o){var r={type:e,props:t,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o??++cE,__i:-1,__u:0};return o==null&&Jt.vnode!=null&&Jt.vnode(r),r}function up(e){return e.children}function pp(e,t){this.props=e,this.context=t}function sa(e,t){if(t==null)return e.__?sa(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"?sa(e):null}function k$(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],o=[],r=zo({},t);r.__v=t.__v+1,Jt.vnode&&Jt.vnode(r),Ag(e.__P,r,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??sa(t),!!(32&t.__u),o),r.__v=t.__v,r.__.__k[r.__i]=r,wE(i,r,o),t.__e=t.__=null,r.__e!=n&&hE(r)}}function hE(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}),hE(e)}function gE(e){(!e.__d&&(e.__d=!0)&&Ar.push(e)&&!dp.__r++||lE!=Jt.debounceRendering)&&((lE=Jt.debounceRendering)||uE)(dp)}function dp(){try{for(var e,t=1;Ar.length;)Ar.length>t&&Ar.sort(pE),e=Ar.shift(),t=Ar.length,k$(e)}finally{Ar.length=dp.__r=0}}function mE(e,t,n,i,o,r,a,s,c,l,u){var p,d,f,m,h,y,w=i&&i.__k||sp,g=t.length;for(c=O$(n,t,w,c,g),p=0;p<g;p++)(f=n.__k[p])!=null&&(d=f.__i!=-1&&w[f.__i]||ap,f.__i=p,y=Ag(e,f,d,o,r,a,s,c,l,u),m=f.__e,f.ref&&d.ref!=f.ref&&(d.ref&&Tg(d.ref,null,f),u.push(f.ref,f.__c||m,f)),h==null&&m!=null&&(h=m),4&f.__u?(c=yE(f,c,e),d.__e&&(d.__e=null)):typeof f.type=="function"&&y!==void 0?c=y:m&&(c=m.nextSibling),f.__u&=-7);return n.__e=h,c}function O$(e,t,n,i,o){var r,a,s,c,l,u=n.length,p=u,d=0;for(e.__k=new Array(o),r=0;r<o;r++)(a=t[r])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?a=e.__k[r]=lp(null,a,null,null,null):cp(a)?a=e.__k[r]=lp(up,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[r]=lp(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[r]=a,c=r+d,a.__=e,a.__b=e.__b+1,s=null,(l=a.__i=D$(a,n,c,p))!=-1&&(p--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(o>u?d--:o<u&&d++),typeof a.type!="function"&&(a.__u|=4)):l!=c&&(l==c-1?d--:l==c+1?d++:(l>c?d--:d++,a.__u|=4))):e.__k[r]=null;if(p)for(r=0;r<u;r++)(s=n[r])!=null&&(2&s.__u)==0&&(s.__e==i&&(i=sa(s)),EE(s,s));return i}function yE(e,t,n){var i,o;if(typeof e.type=="function"){for(i=e.__k,o=0;i&&o<i.length;o++)i[o]&&(i[o].__=e,t=yE(i[o],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=sa(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function D$(e,t,n,i){var o,r,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(o=n-1,r=n+1;o>=0||r<t.length;)if((l=t[a=o>=0?o--:r++])!=null&&(2&l.__u)==0&&s==l.key&&c==l.type)return a}return-1}function vE(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||P$.test(t)?n:n+"px"}function fp(e,t,n,i,o){var r,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||vE(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||vE(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")r=t!=(t=t.replace(dE,"$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+r]=n,n?i?n[Ec]=i[Ec]:(n[Ec]=Sg,e.addEventListener(t,r?Mg:Rg,r)):e.removeEventListener(t,r?Mg:Rg,r);else{if(o=="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 xE(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[rp]==null)t[rp]=Sg++;else if(t[rp]<n[Ec])return;return n(Jt.event?Jt.event(t):t)}}}function Ag(e,t,n,i,o,r,a,s,c,l){var u,p,d,f,m,h,y,w,g,v,b,S,M,B,A,I,H=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),r=[s=t.__e=n.__e]),(u=Jt.__b)&&u(t);e:if(typeof H=="function"){p=a.length;try{if(g=t.props,v=H.prototype&&H.prototype.render,b=(u=H.contextType)&&i[u.__c],S=u?b?b.props.value:u.__:i,n.__c?w=(d=t.__c=n.__c).__=d.__E:(v?t.__c=d=new H(g,S):(t.__c=d=new pp(g,S),d.constructor=H,d.render=I$),b&&b.sub(d),d.state||(d.state={}),d.__n=i,f=d.__d=!0,d.__h=[],d._sb=[]),v&&d.__s==null&&(d.__s=d.state),v&&H.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=zo({},d.__s)),zo(d.__s,H.getDerivedStateFromProps(g,d.__s))),m=d.props,h=d.state,d.__v=t,f)v&&H.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),v&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(v&&H.getDerivedStateFromProps==null&&g!==m&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(g,S),t.__v==n.__v||!d.__e&&d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(g,d.__s,S)===!1){t.__v!=n.__v&&(d.props=g,d.state=d.__s,d.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(V){V&&(V.__=t)}),sp.push.apply(d.__h,d._sb),d._sb=[],d.__h.length&&a.push(d),s=sa(n);break e}d.componentWillUpdate!=null&&d.componentWillUpdate(g,d.__s,S),v&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(m,h,y)})}if(d.context=S,d.props=g,d.__P=e,d.__e=!1,M=Jt.__r,B=0,v)d.state=d.__s,d.__d=!1,M&&M(t),u=d.render(d.props,d.state,d.context),sp.push.apply(d.__h,d._sb),d._sb=[];else do d.__d=!1,M&&M(t),u=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++B<25);d.state=d.__s,d.getChildContext!=null&&(i=zo(zo({},i),d.getChildContext())),v&&!f&&d.getSnapshotBeforeUpdate!=null&&(y=d.getSnapshotBeforeUpdate(m,h)),A=u!=null&&u.type===up&&u.key==null?_E(u.props.children):u,s=mE(e,cp(A)?A:[A],t,n,i,o,r,a,s,c,l),d.base=t.__e,t.__u&=-161,d.__h.length&&a.push(d),w&&(d.__E=d.__=null)}catch(V){if(a.length=p,t.__v=null,c||r!=null){if(V.then){for(t.__u|=c?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;r!=null&&(r[r.indexOf(s)]=null),t.__e=s}else if(r!=null)for(I=r.length;I--;)Cg(r[I])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),V.then||bE(t),Jt.__e(V,t,n)}}else r==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=L$(n.__e,t,n,i,o,r,a,c,l);return(u=Jt.diffed)&&u(t),128&t.__u?void 0:s}function bE(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(bE))}function wE(e,t,n){for(var i=0;i<n.length;i++)Tg(n[i],n[++i],n[++i]);Jt.__c&&Jt.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(r){r.call(o)})}catch(r){Jt.__e(r,o.__v)}})}function _E(e){return typeof e!="object"||e==null||e.__b>0?e:cp(e)?e.map(_E):e.constructor!==void 0?null:zo({},e)}function L$(e,t,n,i,o,r,a,s,c){var l,u,p,d,f,m,h,y=n.props||ap,w=t.props,g=t.type;if(g=="svg"?o="http://www.w3.org/2000/svg":g=="math"?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),r!=null){for(l=0;l<r.length;l++)if((f=r[l])&&"setAttribute"in f==!!g&&(g?f.localName==g:f.nodeType==3)){e=f,r[l]=null;break}}if(e==null){if(g==null)return document.createTextNode(w);e=document.createElementNS(o,g,w.is&&w),s&&(Jt.__m&&Jt.__m(t,r),s=!1),r=null}if(g==null)y===w||s&&e.data==w||(e.data=w);else{if(r=g=="textarea"&&w.defaultValue!=null?null:r&&op.call(e.childNodes),!s&&r!=null)for(y={},l=0;l<e.attributes.length;l++)y[(f=e.attributes[l]).name]=f.value;for(l in y)f=y[l],l=="dangerouslySetInnerHTML"?p=f:l=="children"||l in w||l=="value"&&"defaultValue"in w||l=="checked"&&"defaultChecked"in w||fp(e,l,null,f,o);for(l in w)f=w[l],l=="children"?d=f:l=="dangerouslySetInnerHTML"?u=f:l=="value"?m=f:l=="checked"?h=f:s&&typeof f!="function"||y[l]===f||fp(e,l,f,y[l],o);if(u)s||p&&(u.__html==p.__html||u.__html==e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(p&&(e.innerHTML=""),mE(t.type=="template"?e.content:e,cp(d)?d:[d],t,n,i,g=="foreignObject"?"http://www.w3.org/1999/xhtml":o,r,a,r?r[0]:n.__k&&sa(n,0),s,c),r!=null)for(l=r.length;l--;)Cg(r[l]);s&&g!="textarea"||(l="value",g=="progress"&&m==null?e.removeAttribute("value"):m!=null&&(m!==e[l]||g=="progress"&&!m||g=="option"&&m!=y[l])&&fp(e,l,m,y[l],o),l="checked",h!=null&&h!=e[l]&&fp(e,l,h,y[l],o))}return e}function Tg(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(o){Jt.__e(o,n)}}function EE(e,t,n){var i,o;if(Jt.unmount&&Jt.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||Tg(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(r){Jt.__e(r,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(o=0;o<i.length;o++)i[o]&&EE(i[o],t,n||typeof e.type!="function");n||Cg(e.__e),e.__c=e.__=e.__e=void 0}function I$(e,t,n){return this.constructor(e,n)}function SE(e,t,n){var i,o,r,a;t==document&&(t=document.documentElement),Jt.__&&Jt.__(e,t),o=(i=!1)?null:t.__k,r=[],a=[],Ag(t,e=t.__k=fE(up,null,[e]),o||ap,ap,t.namespaceURI,o?null:t.firstChild?op.call(t.childNodes):null,r,o?o.__e:t.firstChild,i,a),wE(r,e,a),e.props.children=null}op=sp.slice,Jt={__e:function(e,t,n,i){for(var o,r,a;t=t.__;)if((o=t.__c)&&!o.__)try{if((r=o.constructor)&&r.getDerivedStateFromError!=null&&(o.setState(r.getDerivedStateFromError(e)),a=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,i||{}),a=o.__d),a)return o.__E=o}catch(s){e=s}throw e}},cE=0,pp.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=zo({},this.state),typeof e=="function"&&(e=e(zo({},n),this.props)),e&&zo(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),gE(this))},pp.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),gE(this))},pp.prototype.render=up,Ar=[],uE=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,pE=function(e,t){return e.__v.__b-t.__v.__b},dp.__r=0,Eg=Math.random().toString(8),rp="__d"+Eg,Ec="__a"+Eg,dE=/(PointerCapture)$|Capture$/i,Sg=0,Rg=xE(!1),Mg=xE(!0);var RE=function(e,t,n,i){var o;t[0]=0;for(var r=1;r<t.length;r++){var a=t[r++],s=t[r]?(t[0]|=a?1:2,n[t[r++]]):t[++r];a===3?i[0]=s:a===4?i[1]=Object.assign(i[1]||{},s):a===5?(i[1]=i[1]||{})[t[++r]]=s:a===6?i[1][t[++r]]+=s+"":a?(o=e.apply(s,RE(e,s,n,["",null])),i.push(o),s[0]?t[0]|=2:(t[r-2]=0,t[r]=o)):i.push(s)}return i},ME=new Map;function B$(e){var t=ME.get(this);return t||(t=new Map,ME.set(this,t)),(t=RE(this,t.get(e)||(t.set(e,t=(function(n){for(var i,o,r=1,a="",s="",c=[0],l=function(d){r===1&&(d||(a=a.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?c.push(0,d,a):r===3&&(d||a)?(c.push(3,d,a),r=2):r===2&&a==="..."&&d?c.push(4,d,0):r===2&&a&&!d?c.push(5,0,!0,a):r>=5&&((a||!d&&r===5)&&(c.push(r,0,a,o),r=6),d&&(c.push(r,d,0,o),r=6)),a=""},u=0;u<n.length;u++){u&&(r===1&&l(),l(u));for(var p=0;p<n[u].length;p++)i=n[u][p],r===1?i==="<"?(l(),c=[c],r=3):a+=i:r===4?a==="--"&&i===">"?(r=1,a=""):a=i+a[0]:s?i===s?s="":a+=i:i==='"'||i==="'"?s=i:i===">"?(l(),r=1):r&&(i==="="?(r=5,o=a,a=""):i==="/"&&(r<5||n[u][p+1]===">")?(l(),r===3&&(c=c[0]),r=c,(c=c[0]).push(2,0,r),r=0):i===" "||i===" "||i===`
10
+ `||i==="\r"?(l(),r=2):a+=i),r===3&&a==="!--"&&(r=4,c=c[0])}return l(),c})(e)),t),arguments,[])).length>1?t:t[0]}var jt=B$.bind(fE),os,bn,Pg,CE,Sc=0,AE=[],Cn=Jt,TE=Cn.__b,PE=Cn.__r,kE=Cn.diffed,OE=Cn.__c,DE=Cn.unmount,LE=Cn.__;function hp(e,t){Cn.__h&&Cn.__h(bn,e,Sc||t),Sc=0;var n=bn.__H||(bn.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function kg(e){return Sc=1,N$(BE,e)}function N$(e,t,n){var i=hp(os++,2);if(i.t=e,!i.__c&&(i.__=[BE(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=bn,!bn.__f)){var o=function(s,c,l){if(!i.__c.__H)return!0;var u=!1,p=i.__c.props!==s;if(i.__c.__H.__.some(function(f){if(f.__N){u=!0;var m=f.__[0];f.__=f.__N,f.__N=void 0,m!==f.__[0]&&(p=!0)}}),r){var d=r.call(this,s,c,l);return u?d||p:d}return!u||p};bn.__f=!0;var r=bn.shouldComponentUpdate,a=bn.componentWillUpdate;bn.componentWillUpdate=function(s,c,l){if(this.__e){var u=r;r=void 0,o(s,c,l),r=u}a&&a.call(this,s,c,l)},bn.shouldComponentUpdate=o}return i.__N||i.__}function gp(e,t){var n=hp(os++,3);!Cn.__s&&Lg(n.__H,t)&&(n.__=e,n.u=t,bn.__H.__h.push(n))}function Og(e,t){var n=hp(os++,4);!Cn.__s&&Lg(n.__H,t)&&(n.__=e,n.u=t,bn.__h.push(n))}function mp(e){return Sc=5,Vo(function(){return{current:e}},[])}function Vo(e,t){var n=hp(os++,7);return Lg(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Rc(e,t){return Sc=8,Vo(function(){return e},t)}function $$(){for(var e;e=AE.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(yp),t.__h.some(Dg),t.__h=[]}catch(n){t.__h=[],Cn.__e(n,e.__v)}}}Cn.__b=function(e){bn=null,TE&&TE(e)},Cn.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),LE&&LE(e,t)},Cn.__r=function(e){PE&&PE(e),os=0;var t=(bn=e.__c).__H;t&&(Pg===bn?(t.__h=[],bn.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(yp),t.__h.some(Dg),t.__h=[],os=0)),Pg=bn},Cn.diffed=function(e){kE&&kE(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(AE.push(t)!==1&&CE===Cn.requestAnimationFrame||((CE=Cn.requestAnimationFrame)||F$)($$)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),Pg=bn=null},Cn.__c=function(e,t){t.some(function(n){try{n.__h.some(yp),n.__h=n.__h.filter(function(i){return!i.__||Dg(i)})}catch(i){t.some(function(o){o.__h&&(o.__h=[])}),t=[],Cn.__e(i,n.__v)}}),OE&&OE(e,t)},Cn.unmount=function(e){DE&&DE(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{yp(i)}catch(o){t=o}}),n.__H=void 0,t&&Cn.__e(t,n.__v))};var IE=typeof requestAnimationFrame=="function";function F$(e){var t,n=function(){clearTimeout(i),IE&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);IE&&(t=requestAnimationFrame(n))}function yp(e){var t=bn,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),bn=t}function Dg(e){var t=bn;e.__c=e.__(),bn=t}function Lg(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function BE(e,t){return typeof t=="function"?t(e):t}function j$(e){const{navigationStack:t,setNavigationStack:n}=e,i=Vo(()=>t.length<=1?[]:t.slice(0,-1).map((a,s)=>({label:a.label,onClick:()=>n(c=>c.slice(0,s+1))})),[t,n]),o=t.length>0?()=>n([]):null,r=t.length>0?t[t.length-1].label:null;return jt`
12
11
  <div class="djs-popup-breadcrumbs">
13
- ${r&&Pt`
12
+ ${o&&jt`
14
13
  <button
15
14
  type="button"
16
15
  class="djs-popup-breadcrumbs-item djs-popup-breadcrumbs-item--back"
17
16
  title="Back"
18
17
  aria-label="Back"
19
- onClick=${r}
18
+ onClick=${o}
20
19
  >
21
20
  <svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
22
21
  <path fill-rule="evenodd" clip-rule="evenodd" d="M8.03033 1.46967C8.32322 1.76256 8.32322 2.23744 8.03033 2.53033L4.56066 6L8.03033 9.46967C8.32322 9.76256 8.32322 10.2374 8.03033 10.5303C7.73744 10.8232 7.26256 10.8232 6.96967 10.5303L2.96967 6.53033C2.67678 6.23744 2.67678 5.76256 2.96967 5.46967L6.96967 1.46967C7.26256 1.17678 7.73744 1.17678 8.03033 1.46967Z" fill="currentColor"/>
23
22
  </svg>
24
23
  </button>
25
24
  `}
26
- ${i.map((a,s)=>Pt`
25
+ ${i.map((a,s)=>jt`
27
26
  <button
28
27
  key=${s}
29
28
  type="button"
@@ -35,33 +34,33 @@
35
34
  </button>
36
35
  <span class="djs-popup-breadcrumbs-item--separator" aria-hidden="true"></span>
37
36
  `)}
38
- ${o&&Pt`
39
- <span class="djs-popup-breadcrumbs-item djs-popup-breadcrumbs-item--current" title=${o}>
40
- ${o}
37
+ ${r&&jt`
38
+ <span class="djs-popup-breadcrumbs-item djs-popup-breadcrumbs-item--current" title=${r}>
39
+ ${r}
41
40
  </span>
42
41
  `}
43
42
  </div>
44
- `}function y_(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=y_(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function eu(){for(var e,t,n=0,i="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=y_(e))&&(i&&(i+=" "),i+=t);return i}function JO(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:r,title:o}=e,a=cr(()=>eD(t),[t]),s=l=>l.action&&!l.disabled,c=(l,u)=>{if(s(u))return n(l,u)};return Pt`
43
+ `}function NE(e){var t,n,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=NE(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function vp(){for(var e,t,n=0,i="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=NE(e))&&(i&&(i+=" "),i+=t);return i}function H$(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:o,title:r}=e,a=Vo(()=>G$(t),[t]),s=l=>l.action&&!l.disabled,c=(l,u)=>{if(s(u))return n(l,u)};return jt`
45
44
  <div class="djs-popup-header">
46
- <h3 class="djs-popup-title" title=${o}>${o}</h3>
47
- ${a.map(l=>Pt`
45
+ <h3 class="djs-popup-title" title=${r}>${r}</h3>
46
+ ${a.map(l=>jt`
48
47
  <ul key=${l.id} class="djs-popup-header-group" data-header-group=${l.id}>
49
48
 
50
- ${l.entries.map(u=>Pt`
49
+ ${l.entries.map(u=>jt`
51
50
  <li key=${u.id}>
52
51
  <${s(u)?"button":"span"}
53
- class=${tD(u,u===i)}
52
+ class=${z$(u,u===i)}
54
53
  onClick=${p=>c(p,u)}
55
54
  title=${u.title||u.label}
56
55
  data-id=${u.id}
57
56
  aria-disabled=${u.disabled||void 0}
58
- onMouseEnter=${()=>s(u)&&r(u)}
59
- onMouseLeave=${()=>s(u)&&r(null)}
60
- onFocus=${()=>s(u)&&r(u)}
61
- onBlur=${()=>s(u)&&r(null)}
57
+ onMouseEnter=${()=>s(u)&&o(u)}
58
+ onMouseLeave=${()=>s(u)&&o(null)}
59
+ onFocus=${()=>s(u)&&o(u)}
60
+ onBlur=${()=>s(u)&&o(null)}
62
61
  >
63
- ${u.imageUrl&&Pt`<img class="djs-popup-entry-icon" src=${u.imageUrl} alt="" />`||u.imageHtml&&Pt`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:u.imageHtml}} />`}
64
- ${u.label?Pt`
62
+ ${u.imageUrl&&jt`<img class="djs-popup-entry-icon" src=${u.imageUrl} alt="" />`||u.imageHtml&&jt`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:u.imageHtml}} />`}
63
+ ${u.label?jt`
65
64
  <span class="djs-popup-label">${u.label}</span>
66
65
  `:null}
67
66
  </${u.action?"button":"span"}>
@@ -70,35 +69,35 @@
70
69
  </ul>
71
70
  `)}
72
71
  </div>
73
- `}function eD(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 tD(e,t){return eu("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function v_(e,t){return`${e}-entry-${t.id}`}function nD(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 Pt`
72
+ `}function G$(e){return e.reduce((t,n)=>{const i=n.group||"default",o=t.find(r=>r.id===i);return o?o.entries.push(n):t.push({id:i,entries:[n]}),t},[])}function z$(e,t){return vp("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function $E(e,t){return`${e}-entry-${t.id}`}function V$(e){const{idPrefix:t,entry:n,selected:i,onMouseEnter:o,onMouseLeave:r,onAction:a}=e,s=(l,u)=>{if(!n.disabled)return a(l,n,u)},c=!n.entries;return jt`
74
73
  <li
75
- class=${eu("entry",{selected:i,disabled:n.disabled})}
74
+ class=${vp("entry",{selected:i,disabled:n.disabled})}
76
75
  data-id=${n.id}
77
- id=${v_(t,n)}
76
+ id=${$E(t,n)}
78
77
  role="option"
79
78
  aria-selected=${i||void 0}
80
79
  aria-haspopup=${n.entries?"true":void 0}
81
80
  title=${n.title}
82
81
  aria-disabled=${n.disabled||void 0}
83
82
  onClick=${s}
84
- onMouseEnter=${r}
85
- onMouseLeave=${o}
83
+ onMouseEnter=${o}
84
+ onMouseLeave=${r}
86
85
  onDragStart=${l=>c&&s(l,"dragstart")}
87
86
  draggable=${c}
88
87
  >
89
88
  <div class="djs-popup-entry-content">
90
89
  <span
91
- class=${eu("djs-popup-entry-name",n.className)}
90
+ class=${vp("djs-popup-entry-name",n.className)}
92
91
  >
93
- ${n.imageUrl&&Pt`<img class="djs-popup-entry-icon" src=${n.imageUrl} alt="" />`||n.imageHtml&&Pt`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:n.imageHtml}} />`}
92
+ ${n.imageUrl&&jt`<img class="djs-popup-entry-icon" src=${n.imageUrl} alt="" />`||n.imageHtml&&jt`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:n.imageHtml}} />`}
94
93
 
95
- ${n.label?Pt`
94
+ ${n.label?jt`
96
95
  <span class="djs-popup-label">
97
96
  ${n.label}
98
97
  </span>
99
98
  `:null}
100
99
 
101
- ${n.documentationRef&&Pt`
100
+ ${n.documentationRef&&jt`
102
101
  <a
103
102
  class="djs-popup-entry-docs"
104
103
  href=${n.documentationRef}
@@ -115,7 +114,7 @@
115
114
  </a>
116
115
  `}
117
116
  </span>
118
- ${n.description&&Pt`
117
+ ${n.description&&jt`
119
118
  <span
120
119
  class="djs-popup-entry-description"
121
120
  >
@@ -123,7 +122,7 @@
123
122
  </span>
124
123
  `}
125
124
  </div>
126
- ${n.entries&&Pt`
125
+ ${n.entries&&jt`
127
126
  <div class="djs-popup-entry-chevron" aria-hidden="true">
128
127
  <svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
129
128
  <path fill-rule="evenodd" clip-rule="evenodd" d="M3.96967 1.46967C4.26256 1.17678 4.73744 1.17678 5.03033 1.46967L9.03033 5.46967C9.32322 5.76256 9.32322 6.23744 9.03033 6.53033L5.03033 10.5303C4.73744 10.8232 4.26256 10.8232 3.96967 10.5303C3.67678 10.2374 3.67678 9.76256 3.96967 9.46967L7.43934 6L3.96967 2.53033C3.67678 2.23744 3.67678 1.76256 3.96967 1.46967Z" fill="currentColor"/>
@@ -131,7 +130,7 @@
131
130
  </div>
132
131
  `}
133
132
  </li>
134
- `}function iD(e){const{selectedEntry:t,setSelectedEntry:n,groupedEntries:i,keyboardSelection:r,idPrefix:o,id:a,ariaLabel:s,tabIndex:c,ariaActivedescendant:l,...u}=e,p=Ql();Ld(()=>{if(!r||!r.current)return;const m=p.current;if(!m)return;const b=m.querySelector(".selected");b&&rD(b)},[t]);const f=()=>{r.current=!1},d=m=>{r.current||n(m)},h=()=>{r.current||n(null)};return Pt`
133
+ `}function W$(e){const{selectedEntry:t,setSelectedEntry:n,groupedEntries:i,keyboardSelection:o,idPrefix:r,id:a,ariaLabel:s,tabIndex:c,ariaActivedescendant:l,...u}=e,p=mp();Og(()=>{if(!o||!o.current)return;const h=p.current;if(!h)return;const y=h.querySelector(".selected");y&&U$(y)},[t]);const d=()=>{o.current=!1},f=h=>{o.current||n(h)},m=()=>{o.current||n(null)};return jt`
135
134
  <div
136
135
  class="djs-popup-results"
137
136
  ref=${p}
@@ -140,64 +139,64 @@
140
139
  aria-label=${s}
141
140
  tabIndex=${c}
142
141
  aria-activedescendant=${l}
143
- onMouseMove=${f}
142
+ onMouseMove=${d}
144
143
  >
145
- ${i.map(m=>Pt`
146
- ${m.name&&Pt`
147
- <div key=${m.id} id=${b_(o,m)} class="entry-header" title=${m.name}>
148
- ${m.name}
144
+ ${i.map(h=>jt`
145
+ ${h.name&&jt`
146
+ <div key=${h.id} id=${FE(r,h)} class="entry-header" title=${h.name}>
147
+ ${h.name}
149
148
  </div>
150
149
  `}
151
150
  <ul
152
151
  class="djs-popup-group"
153
- data-group=${m.id}
152
+ data-group=${h.id}
154
153
  role="group"
155
- aria-labelledby=${m.name?b_(o,m):void 0}
154
+ aria-labelledby=${h.name?FE(r,h):void 0}
156
155
  >
157
- ${m.entries.map(b=>Pt`
158
- <${nD}
159
- key=${b.id}
160
- idPrefix=${o}
161
- entry=${b}
162
- selected=${b===t}
163
- onMouseEnter=${()=>d(b)}
164
- onMouseLeave=${h}
156
+ ${h.entries.map(y=>jt`
157
+ <${V$}
158
+ key=${y.id}
159
+ idPrefix=${r}
160
+ entry=${y}
161
+ selected=${y===t}
162
+ onMouseEnter=${()=>f(y)}
163
+ onMouseLeave=${m}
165
164
  ...${u}
166
165
  />
167
166
  `)}
168
167
  </ul>
169
168
  `)}
170
169
  </div>
171
- `}function b_(e,t){return`${e}-group-${t.id}`}function rD(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const oD=new oa("djs-popup");function aD(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,b]=Id([]);Zl(()=>{b([])},[f]);const[E,_]=Id(""),g=E.trim().length>0,y=cr(()=>lD(f),[f]),S=cr(()=>rn(l)?y.length>5:!1,[l,y]),w=cr(()=>{const q=m.length?m[m.length-1].entries:f;return S?g?p(y.filter(({searchable:V})=>V!==!1),E,{keys:["label","search","description"]}).map(({item:V})=>V):q.filter(({rank:V=0})=>V>=0):q},[S,g,y,E,p,m,f]),P=cr(()=>g?w.length?[{id:"default",entries:w}]:[]:uD(w),[w,g]),[T,$]=Id(w[0]),k=Ql(null),D=Ql(!1),H=cr(()=>oD.next(),[]),Q=`${H}-results`,fe=T&&v_(H,T);Zl(()=>{const q=k.current;q&&w.includes(q)?$(q):$(w[0]),k.current=null},[w]);const Me=_s(q=>{const V=cD(P);let Pe=V.indexOf(T)+q;Pe<0&&(Pe=V.length-1),Pe>=V.length&&(Pe=0),D.current=!0,$(V[Pe])},[P,T]),Be=_s(q=>{q>0&&T&&T.entries&&(D.current=!0,b(V=>[...V,T])),q<0&&m.length>0&&(D.current=!0,k.current=m[m.length+q],b(V=>V.slice(0,q)))},[T,m]),it=_s((q,V,ie)=>{if(!(!V||V.disabled))return V.entries?(q.preventDefault(),Be(1)):n(q,V,ie)},[n,Be]),X=_s(q=>{if(q.key==="Enter"&&T){const V=q.target;return!!no(V,"a, button",!0)||T.disabled?void 0:it(q,T)}if(q.key==="Backspace"){const V=q.target;if(!(gp(V,"input")&&V.value!==""))return Be(-1),q.preventDefault()}if(q.key==="ArrowUp")return Me(-1),q.preventDefault();if(q.key==="ArrowDown")return Me(1),q.preventDefault();if(q.key==="ArrowRight")return Be(1),q.preventDefault();if(q.key==="ArrowLeft")return Be(-1),q.preventDefault()},[T,Me,Be,it]),ee=_s(q=>{gp(q.target,"input")&&_(()=>q.target.value)},[_]);Zl(()=>(d(),()=>{h()}),[]);const ue=!g&&m.length>0,be=(a||r.length>0)&&!ue;return Pt`
172
- <${x_}
170
+ `}function FE(e,t){return`${e}-group-${t.id}`}function U$(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const q$=new ta("djs-popup");function Y$(e){const{onClose:t,onSelect:n,className:i,headerEntries:o,position:r,title:a,width:s,scale:c,search:l,emptyPlaceholder:u,searchFn:p,entries:d,onOpened:f,onClosed:m}=e,[h,y]=kg([]);gp(()=>{y([])},[d]);const[w,g]=kg(""),v=w.trim().length>0,b=Vo(()=>Z$(d),[d]),S=Vo(()=>En(l)?b.length>5:!1,[l,b]),M=Vo(()=>{const z=h.length?h[h.length-1].entries:d;return S?v?p(b.filter(({searchable:ee})=>ee!==!1),w,{keys:["label","search","description"]}).map(({item:ee})=>ee):z.filter(({rank:ee=0})=>ee>=0):z},[S,v,b,w,p,h,d]),B=Vo(()=>v?M.length?[{id:"default",entries:M}]:[]:J$(M),[M,v]),[A,I]=kg(M[0]),H=mp(null),V=mp(!1),G=Vo(()=>q$.next(),[]),ie=`${G}-results`,pe=A&&$E(G,A);gp(()=>{const z=H.current;z&&M.includes(z)?I(z):I(M[0]),H.current=null},[M]);const Y=Rc(z=>{const ee=X$(B);let se=ee.indexOf(A)+z;se<0&&(se=ee.length-1),se>=ee.length&&(se=0),V.current=!0,I(ee[se])},[B,A]),Te=Rc(z=>{z>0&&A&&A.entries&&(V.current=!0,y(ee=>[...ee,A])),z<0&&h.length>0&&(V.current=!0,H.current=h[h.length+z],y(ee=>ee.slice(0,z)))},[A,h]),Pe=Rc((z,ee,he)=>{if(!(!ee||ee.disabled))return ee.entries?(z.preventDefault(),Te(1)):n(z,ee,he)},[n,Te]),ke=Rc(z=>{if(z.key==="Enter"&&A){const ee=z.target;return!!Ur(ee,"a, button",!0)||A.disabled?void 0:Pe(z,A)}if(z.key==="Backspace"){const ee=z.target;if(!(rf(ee,"input")&&ee.value!==""))return Te(-1),z.preventDefault()}if(z.key==="ArrowUp")return Y(-1),z.preventDefault();if(z.key==="ArrowDown")return Y(1),z.preventDefault();if(z.key==="ArrowRight")return Te(1),z.preventDefault();if(z.key==="ArrowLeft")return Te(-1),z.preventDefault()},[A,Y,Te,Pe]),ve=Rc(z=>{rf(z.target,"input")&&g(()=>z.target.value)},[g]);gp(()=>(f(),()=>{m()}),[]);const W=!v&&h.length>0,de=(a||o.length>0)&&!W;return jt`
171
+ <${jE}
173
172
  onClose=${t}
174
- onKeyup=${ee}
175
- onKeydown=${X}
173
+ onKeyup=${ve}
174
+ onKeydown=${ke}
176
175
  className=${i}
177
- position=${o}
176
+ position=${r}
178
177
  width=${s}
179
178
  scale=${c}
180
- navigationStack=${m}
179
+ navigationStack=${h}
181
180
  >
182
- ${be&&Pt`
183
- <${JO}
184
- headerEntries=${r}
181
+ ${de&&jt`
182
+ <${H$}
183
+ headerEntries=${o}
185
184
  onSelect=${n}
186
- selectedEntry=${T}
187
- setSelectedEntry=${$}
185
+ selectedEntry=${A}
186
+ setSelectedEntry=${I}
188
187
  title=${a}
189
188
  />
190
189
  `}
191
- ${ue&&Pt`
192
- <${QO}
193
- navigationStack=${m}
194
- setNavigationStack=${b}
190
+ ${W&&jt`
191
+ <${j$}
192
+ navigationStack=${h}
193
+ setNavigationStack=${y}
195
194
  />
196
195
  `}
197
- ${f.length>0&&Pt`
196
+ ${d.length>0&&jt`
198
197
  <div class="djs-popup-body">
199
198
 
200
- ${S&&Pt`
199
+ ${S&&jt`
201
200
  <div class="djs-popup-search">
202
201
  <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
202
  <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,39 +207,39 @@
208
207
  role="combobox"
209
208
  aria-label="${a||"Search"}"
210
209
  aria-expanded="true"
211
- aria-controls=${Q}
212
- aria-activedescendant=${fe||void 0}
210
+ aria-controls=${ie}
211
+ aria-activedescendant=${pe||void 0}
213
212
  aria-autocomplete="list"
214
213
  />
215
214
  </div>
216
215
  `}
217
216
 
218
- ${g&&Pt`
217
+ ${v&&jt`
219
218
  <div class="djs-popup-search-count" aria-live="polite">
220
- ${w.length} ${w.length===1?"result":"results"} found
219
+ ${M.length} ${M.length===1?"result":"results"} found
221
220
  </div>
222
221
  `}
223
222
 
224
- <${iD}
225
- groupedEntries=${P}
226
- selectedEntry=${T}
227
- setSelectedEntry=${$}
228
- keyboardSelection=${D}
229
- onAction=${it}
230
- idPrefix=${H}
231
- id=${Q}
223
+ <${W$}
224
+ groupedEntries=${B}
225
+ selectedEntry=${A}
226
+ setSelectedEntry=${I}
227
+ keyboardSelection=${V}
228
+ onAction=${Pe}
229
+ idPrefix=${G}
230
+ id=${ie}
232
231
  ariaLabel=${a||"Results"}
233
232
  tabIndex=${S?-1:0}
234
- ariaActivedescendant=${S?void 0:fe||void 0}
233
+ ariaActivedescendant=${S?void 0:pe||void 0}
235
234
  />
236
235
 
237
- ${T&&T.documentationRef&&Pt`
236
+ ${A&&A.documentationRef&&jt`
238
237
  <div class="djs-popup-footer">
239
238
  <a
240
239
  class="djs-popup-footer-docs"
241
- href=${T.documentationRef}
242
- onClick=${q=>q.stopPropagation()}
243
- aria-label=${T.label?`Open entry documentation for ${T.label}`:"Open entry documentation"}
240
+ href=${A.documentationRef}
241
+ onClick=${z=>z.stopPropagation()}
242
+ aria-label=${A.label?`Open entry documentation for ${A.label}`:"Open entry documentation"}
244
243
  target="_blank"
245
244
  rel="noopener"
246
245
  >
@@ -254,37 +253,37 @@
254
253
  `}
255
254
  </div>
256
255
  `}
257
- ${u&&w.length===0&&Pt`
258
- <div class="djs-popup-no-results">${fn(u)?u(E):u}</div>
256
+ ${u&&M.length===0&&jt`
257
+ <div class="djs-popup-no-results">${An(u)?u(w):u}</div>
259
258
  `}
260
- </${x_}>
261
- `}function x_(e){const{onClose:t,onKeydown:n,onKeyup:i,className:r,children:o,navigationStack:a,position:s}=e,c=Ql();return Ld(()=>{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]),Ld(()=>{const l=c.current;if(!l)return;(l.querySelector("input")||l.querySelector('[role="listbox"]')||l).focus()},[a]),Zl(()=>{const l=p=>{if(p.key==="Escape")return p.preventDefault(),t()},u=p=>{if(!no(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)}},[]),Pt`
259
+ </${jE}>
260
+ `}function jE(e){const{onClose:t,onKeydown:n,onKeyup:i,className:o,children:r,navigationStack:a,position:s}=e,c=mp();return Og(()=>{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]),Og(()=>{const l=c.current;if(!l)return;(l.querySelector("input")||l.querySelector('[role="listbox"]')||l).focus()},[a]),gp(()=>{const l=p=>{if(p.key==="Escape")return p.preventDefault(),t()},u=p=>{if(!Ur(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)}},[]),jt`
262
261
  <div
263
- class=${eu("djs-popup",r)}
264
- style=${sD(e)}
262
+ class=${vp("djs-popup",o)}
263
+ style=${K$(e)}
265
264
  onKeydown=${n}
266
265
  onKeyup=${i}
267
266
  ref=${c}
268
267
  tabIndex="-1"
269
268
  >
270
- ${o}
269
+ ${r}
271
270
  </div>
272
- `}function sD(e){const{width:t}=e,n=typeof t=="number"?`${t}px`:t;return{transform:`scale(${e.scale})`,width:rn(t)?n:void 0,maxWidth:rn(t)?"unset":void 0,"transform-origin":"top left"}}function cD(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 uD(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 pD="data-id",__=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],fD=1e3;function Gt(e,t,n,i){this._eventBus=t,this._canvas=n,this._search=i,this._current=null;var r=rn(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()})}Gt.$inject=["config.popupMenu","eventBus","canvas","search"],Gt.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:i,emptyPlaceholder:r,options:o}=this._current,a=w_(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_(Pt`
273
- <${aD}
274
- onClose=${f=>this.close(f)}
275
- onSelect=${(f,d,h)=>this.trigger(f,d,h)}
271
+ `}function K$(e){const{width:t}=e,n=typeof t=="number"?`${t}px`:t;return{transform:`scale(${e.scale})`,width:En(t)?n:void 0,maxWidth:En(t)?"unset":void 0,"transform-origin":"top left"}}function X$(e){const t=[];return e.forEach(n=>{n.entries.forEach(i=>{t.push(i)})}),t}function Z$(e){const t=[];function n(i){i.forEach(o=>{if(o.entries){n(o.entries);return}t.push(o)})}return n(e),t}function J$(e){const t=[],n=r=>t.find(a=>r.id===a.id),i=r=>!!n(r),o=r=>typeof r=="string"?{id:r}:r;return e.forEach(r=>{const a=r.group?o(r.group):{id:"default"};i(a)?n(a).entries.push(r):t.push({...a,entries:[r]})}),t}var Q$="data-id",HE=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],e5=1e3;function Qt(e,t,n,i){this._eventBus=t,this._canvas=n,this._search=i,this._current=null;var o=En(e&&e.scale)?e.scale:{min:1,max:1};this._config={scale:o},t.on("diagram.destroy",()=>{this.close()}),t.on("element.changed",r=>{const a=this.isOpen()&&this._current.target;r.element===a&&this.refresh()})}Qt.$inject=["config.popupMenu","eventBus","canvas","search"],Qt.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:i,emptyPlaceholder:o,options:r}=this._current,a=GE(n),s=Object.entries(i).map(([d,f])=>({id:d,...f})),c=e&&(d=>this._ensureVisible(d,e)),l=this._updateScale(this._current.container);SE(jt`
272
+ <${Y$}
273
+ onClose=${d=>this.close(d)}
274
+ onSelect=${(d,f,m)=>this.trigger(d,f,m)}
276
275
  position=${c}
277
276
  className=${t}
278
277
  entries=${a}
279
278
  headerEntries=${s}
280
- emptyPlaceholder=${r}
279
+ emptyPlaceholder=${o}
281
280
  scale=${l}
282
281
  onOpened=${this._onOpened.bind(this)}
283
282
  onClosed=${this._onClosed.bind(this)}
284
283
  searchFn=${this._search}
285
- ...${{...o}}
284
+ ...${{...r}}
286
285
  />
287
- `,this._current.container)},Gt.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()},Gt.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()},Gt.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)}},Gt.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},Gt.prototype.reset=function(){const e=this._current.container;r_(null,e),Li(e)},Gt.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},Gt.prototype._onOpened=function(){this._emit("opened")},Gt.prototype._onClosed=function(){this._emit("closed")},Gt.prototype._createContainer=function(e){var t=this._canvas,n=t.getContainer();const i=It(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return n.appendChild(i),i},Gt.prototype._bindAutoClose=function(){this._eventBus.once(__,this.close,this)},Gt.prototype._unbindAutoClose=function(){this._eventBus.off(__,this.close,this)},Gt.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),rn(n)&&e<n&&(r=n),rn(i)&&e>i&&(r=i)),r},Gt.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}},Gt.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},Gt.prototype.registerProvider=function(e,t,n){n||(n=t,t=fD),this._eventBus.on("popupMenu.getProviders."+e,t,function(i){i.providers.push(n)})},Gt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},Gt.prototype._getEntries=function(e,t){var n={};return z(t,function(i){if(!i.getPopupMenuEntries){z(i.getEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=Ti(o,["id"])});return}var r=i.getPopupMenuEntries(e);fn(r)?n=r(n):z(r,function(o,a){n[a]=o})}),n},Gt.prototype._getHeaderEntries=function(e,t){var n={};return z(t,function(i){if(!i.getPopupMenuHeaderEntries){if(!i.getHeaderEntries)return;z(i.getHeaderEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=Ti(o,["id"])});return}var r=i.getPopupMenuHeaderEntries(e);fn(r)?n=r(n):z(r,function(o,a){n[a]=o})}),n},Gt.prototype._getEmptyPlaceholder=function(e){const t=e.find(n=>fn(n.getEmptyPlaceholder));return t&&t.getEmptyPlaceholder()},Gt.prototype.isOpen=function(){return!!this._current},Gt.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let r=no(e.delegateTarget||e.target,".entry",!0),o=Pn(r,pD);t={id:o,...this._getEntry(o)}}const i=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(fn(i)){if(n==="click")return i(e,t)}else if(i[n])return i[n](e,t)}},Gt.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 w_(e,t=[]){return Object.entries(e).map(([n,i])=>{const r={id:n,...i};return r.entries?r.entries=w_(r.entries,[...t,...E_(r.search)]):t.length&&(r.search=[...t,...E_(r.search)]),r})}function E_(e){return e?Ne(e)?e:[e]:[]}function dD(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=hD(o,r,i);return a?{item:o,tokens:a}:[]}).sort(mD(i))}function hD(e,t,n){const{matchedWords:i,tokens:r}=n.reduce((o,a)=>{const s=e[a],{tokens:c,matchedWords:l}=Ne(s)?s.reduce((u,p)=>{const{tokens:f,matchedWords:d}=A_(p,t);return{tokens:[...u.tokens,f],matchedWords:{...u.matchedWords,...d}}},{matchedWords:{},tokens:[]}):A_(s,t);return{tokens:{...o.tokens,[a]:c},matchedWords:{...o.matchedWords,...l}}},{matchedWords:{},tokens:{}});return Object.keys(i).length!==t.length?null:r}function mD(e){return(t,n)=>{let i=0,r=1;for(const o of e){const a=gD(t.tokens[o],n.tokens[o]);if(a!==0){i+=a*r,r*=S_;continue}const s=yD(t.item[o],n.item[o]);if(s!==0){i+=s*r,r*=S_;continue}}return i}}function gD(e,t){return R_(t)-R_(e)}const S_=.5,ha={FULL:131.9,START_FULL_WORD:8,START_WORD_PART:7.87,WORD_START:2.19,WORD_PART:1,NO_MATCH:-.07};function R_(e){const t=e.reduce((s,c)=>s+C_(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 C_(e){if(Ne(e))return Math.max(...e.map(C_));const t=Math.log(e.value.length);return e.match?(e.start?e.end?ha.FULL:e.wordEnd?ha.START_FULL_WORD:ha.START_WORD_PART:e.wordStart?ha.WORD_START:ha.WORD_PART)*t:ha.NO_MATCH*t}function M_(e=""){return Ne(e)?e.join(", "):e}function yD(e,t){return M_(e).localeCompare(M_(t))}function A_(e,t){var l;if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},r=t.map(vD),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),b=d||/\s/.test(e.charAt(p-1)),E=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:b,wordEnd:E,start:d,end:h,all:m});const _=m?t:[u];for(const g of _)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 vD(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}const P_={search:["value",dD]},$d={__depends__:[P_],__init__:["popupMenu"],popupMenu:["type",Gt]};var T_={align:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2000 2000">
286
+ `,this._current.container)},Qt.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 o=this._eventBus.fire("popupMenu.open.allowed",{target:e,providerId:t});if(o===!1)return;this.isOpen()&&this.close();const{entries:r,headerEntries:a,emptyPlaceholder:s}=this._getContext(e,t);this._current={position:n,providerId:t,target:e,entries:r,headerEntries:a,emptyPlaceholder:s,container:this._createContainer({provider:t}),options:i},this._emit("open"),this._bindAutoClose(),this._render()},Qt.prototype.refresh=function(){if(!this.isOpen())return;const{target:e,providerId:t}=this._current,{entries:n,headerEntries:i,emptyPlaceholder:o}=this._getContext(e,t);this._current={...this._current,entries:n,headerEntries:i,emptyPlaceholder:o},this._emit("refresh"),this._render()},Qt.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),o=this._getHeaderEntries(e,n),r=this._getEmptyPlaceholder(n);return{entries:i,headerEntries:o,emptyPlaceholder:r,empty:!(Object.keys(i).length||Object.keys(o).length)}},Qt.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},Qt.prototype.reset=function(){const e=this._current.container;SE(null,e),co(e)},Qt.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},Qt.prototype._onOpened=function(){this._emit("opened")},Qt.prototype._onClosed=function(){this._emit("closed")},Qt.prototype._createContainer=function(e){var t=this._canvas,n=t.getContainer();const i=Wt(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return n.appendChild(i),i},Qt.prototype._bindAutoClose=function(){this._eventBus.once(HE,this.close,this)},Qt.prototype._unbindAutoClose=function(){this._eventBus.off(HE,this.close,this)},Qt.prototype._updateScale=function(){var e=this._canvas.zoom(),t=this._config.scale,n,i,o=e;return t!==!0&&(t===!1?(n=1,i=1):(n=t.min,i=t.max),En(n)&&e<n&&(o=n),En(i)&&e>i&&(o=i)),o},Qt.prototype._ensureVisible=function(e,t){var n=document.documentElement.getBoundingClientRect(),i=e.getBoundingClientRect(),o={},r=t.x,a=t.y;return t.x+i.width>n.width&&(o.x=!0),t.y+i.height>n.height&&(o.y=!0),o.x&&o.y?(r=t.x-i.width,a=t.y-i.height):o.x?(r=t.x-i.width,a=t.y):o.y&&t.y<i.height?(r=t.x,a=10):o.y&&(r=t.x,a=t.y-i.height),t.y<n.top&&(a=t.y+i.height),{x:r,y:a}},Qt.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},Qt.prototype.registerProvider=function(e,t,n){n||(n=t,t=e5),this._eventBus.on("popupMenu.getProviders."+e,t,function(i){i.providers.push(n)})},Qt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},Qt.prototype._getEntries=function(e,t){var n={};return K(t,function(i){if(!i.getPopupMenuEntries){K(i.getEntries(e),function(r){var a=r.id;if(!a)throw new Error("entry ID is missing");n[a]=oo(r,["id"])});return}var o=i.getPopupMenuEntries(e);An(o)?n=o(n):K(o,function(r,a){n[a]=r})}),n},Qt.prototype._getHeaderEntries=function(e,t){var n={};return K(t,function(i){if(!i.getPopupMenuHeaderEntries){if(!i.getHeaderEntries)return;K(i.getHeaderEntries(e),function(r){var a=r.id;if(!a)throw new Error("entry ID is missing");n[a]=oo(r,["id"])});return}var o=i.getPopupMenuHeaderEntries(e);An(o)?n=o(n):K(o,function(r,a){n[a]=r})}),n},Qt.prototype._getEmptyPlaceholder=function(e){const t=e.find(n=>An(n.getEmptyPlaceholder));return t&&t.getEmptyPlaceholder()},Qt.prototype.isOpen=function(){return!!this._current},Qt.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let o=Ur(e.delegateTarget||e.target,".entry",!0),r=On(o,Q$);t={id:r,...this._getEntry(r)}}const i=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(An(i)){if(n==="click")return i(e,t)}else if(i[n])return i[n](e,t)}},Qt.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 GE(e,t=[]){return Object.entries(e).map(([n,i])=>{const o={id:n,...i};return o.entries?o.entries=GE(o.entries,[...t,...zE(o.search)]):t.length&&(o.search=[...t,...zE(o.search)]),o})}function zE(e){return e?et(e)?e:[e]:[]}function t5(e,t,n){const{keys:i}=n;if(t=t.trim().toLowerCase(),!t)throw new Error("<pattern> must not be empty");const o=t.trim().toLowerCase().split(/\s+/);return e.flatMap(r=>{const a=n5(r,o,i);return a?{item:r,tokens:a}:[]}).sort(i5(i))}function n5(e,t,n){const{matchedWords:i,tokens:o}=n.reduce((r,a)=>{const s=e[a],{tokens:c,matchedWords:l}=et(s)?s.reduce((u,p)=>{const{tokens:d,matchedWords:f}=YE(p,t);return{tokens:[...u.tokens,d],matchedWords:{...u.matchedWords,...f}}},{matchedWords:{},tokens:[]}):YE(s,t);return{tokens:{...r.tokens,[a]:c},matchedWords:{...r.matchedWords,...l}}},{matchedWords:{},tokens:{}});return Object.keys(i).length!==t.length?null:o}function i5(e){return(t,n)=>{let i=0,o=1;for(const r of e){const a=o5(t.tokens[r],n.tokens[r]);if(a!==0){i+=a*o,o*=VE;continue}const s=r5(t.item[r],n.item[r]);if(s!==0){i+=s*o,o*=VE;continue}}return i}}function o5(e,t){return WE(t)-WE(e)}const VE=.5,rs={FULL:131.9,START_FULL_WORD:8,START_WORD_PART:7.87,WORD_START:2.19,WORD_PART:1,NO_MATCH:-.07};function WE(e){const t=e.reduce((s,c)=>s+UE(c),0),n=e.flat(),i=n.reduce((s,c)=>s+c.value.length,0),o=n.reduce((s,c)=>s+(c.match?c.value.length:0),0),r=i?o/i:0;return t*(1+r)}function UE(e){if(et(e))return Math.max(...e.map(UE));const t=Math.log(e.value.length);return e.match?(e.start?e.end?rs.FULL:e.wordEnd?rs.START_FULL_WORD:rs.START_WORD_PART:e.wordStart?rs.WORD_START:rs.WORD_PART)*t:rs.NO_MATCH*t}function qE(e=""){return et(e)?e.join(", "):e}function r5(e,t){return qE(e).localeCompare(qE(t))}function YE(e,t){var l;if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},o=t.map(a5),r=[`(?<all>${o.join("\\s+")})`,...o].join("|"),a=new RegExp(r,"ig");let s,c=0;for(;s=a.exec(e);){const[u]=s,p=s.index,d=s.index+u.length,f=p===0,m=d===e.length,h=!!((l=s.groups)!=null&&l.all),y=f||/\s/.test(e.charAt(p-1)),w=m||/\s/.test(e.charAt(d));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:w,start:f,end:m,all:h});const g=h?t:[u];for(const v of g)i[v.toLowerCase()]=!0;c=s.index+u.length}return c<e.length&&n.push({value:e.slice(c),index:c}),{tokens:n,matchedWords:i}}function a5(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}const KE={search:["value",t5]},Ig={__depends__:[KE],__init__:["popupMenu"],popupMenu:["type",Qt]};var XE={align:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2000 2000">
288
287
  <line x1="200" y1="150" x2="200" y2="1850" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>
289
288
  <rect x="500" y="150" width="1300" height="700" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
290
289
  <rect x="500" y="1150" width="700" height="700" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
@@ -312,8 +311,8 @@
312
311
  <line x1="150" y1="900" x2="1650" y2="900" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>
313
312
  <rect x="150" y="250" width="600" height="1300" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
314
313
  <rect x="1050" y="500" width="600" height="800" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
315
- </svg>`},bD=900;function ma(e,t,n,i){e.registerProvider(bD,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}ma.$inject=["contextPad","popupMenu","translate","canvas"],ma.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&U(t,this._getEntries(e)),t},ma.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},ma.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${T_.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);U(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},ma.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 xD=["left","center","right","top","middle","bottom"];function ws(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}ws.$inject=["popupMenu","alignElements","translate","rules"],ws.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&U(t,this._getEntries(e)),t},ws.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},ws.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return z(xD,function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:T_[o],action:function(){t.trigger(e,o),i.close()}}}),r};function tu(e){fi.call(this,e)}tu.$inject=["eventBus"],Ee(tu,fi),tu.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=nt(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=wc(n),n.length<2?!1:n})};const _D={__depends__:[OO,Hx,$d],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",ma],alignElementsMenuProvider:["type",ws],bpmnAlignElements:["type",tu]};function lr(e,t,n,i){se.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=Du(Mo(a.closure.topLevel)),c=a.hints,l=c?c.autoResize:!0;if(l!==!1){var u=Ao(s,function(p){return p.parent.id});z(u,function(p,f){Ne(l)&&(p=p.filter(function(d){return kt(l,Po({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)})}lr.$inject=["eventBus","elementRegistry","modeling","rules"],Ee(lr,se),lr.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=Le(Zt(e)),o=Le(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),Rc(U({},o,a))},lr.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(wD(i,t)){var r=ED(Si(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:r});var o=t.parent;o&&this._expand([t],o)}}},lr.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},lr.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},lr.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function wD(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function ED(e,t){var n="";return e=Le(e),t=Le(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 nu(e){e.invoke(lr,this)}nu.$inject=["injector"],Ee(nu,lr),nu.prototype.resize=function(e,t,n){M(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};function Es(e){fi.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}Es.$inject=["eventBus"],Ee(Es,fi),Es.prototype.canResize=function(e,t){return!1};function iu(e,t){Es.call(this,e),this._modeling=t}Ee(iu,Es),iu.$inject=["eventBus","modeling"],iu.prototype.canResize=function(e,t){if(M(t.di,"bpmndi:BPMNPlane")||!M(t,"bpmn:Participant")&&!M(t,"bpmn:Lane")&&!M(t,"bpmn:SubProcess"))return!1;var n=!0;return z(e,function(i){if(M(i,"bpmn:Lane")||Je(i)){n=!1;return}}),n};const SD={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",nu],bpmnAutoResizeProvider:["type",iu]};function ga(e,t,n){this._canvas=n,this._opts=U({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()})}ga.$inject=["config.autoScroll","eventBus","canvas"],ga.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++)RD(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 RD(e,t,n){return t<e&&e<n}ga.prototype.stopScroll=function(){clearTimeout(this._scrolling)},ga.prototype.setOptions=function(e){this._opts=U({},this._opts,e)},ga.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=co(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const CD={__depends__:[ir],__init__:["autoScroll"],autoScroll:["type",ga]};var k_="djs-bendpoint",O_="djs-segment-dragger";function MD(e,t){var n=co(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 Fd(e,t,n){var i=MD(e,n),r=ef(t,i);return r}function jd(e,t){var n=De("g");ut(n).add(k_),Ue(e,n);var i=De("circle");Se(i,{cx:0,cy:0,r:4}),ut(i).add("djs-visual"),Ue(n,i);var r=De("circle");return Se(r,{cx:0,cy:0,r:10}),ut(r).add("djs-hit"),Ue(n,r),t&&ut(n).add(t),n}function AD(e,t,n,i){var r=De("g");Ue(e,r);var o=18,a=6,s=11,c=TD(t,n,i),l=a+s,u=De("rect");Se(u,{x:-o/2,y:-a/2,width:o,height:a}),ut(u).add("djs-visual"),Ue(r,u);var p=De("rect");return Se(p,{x:-c/2,y:-l/2,width:c,height:l}),ut(p).add("djs-hit"),Ue(r,p),Jg(r,i==="v"?90:0),r}function D_(e,t,n){var i=De("g"),r=Pp(t,n),o=Zi(t,n);return Ue(e,i),AD(i,t,n,o),ut(i).add(O_),ut(i).add(o==="h"?"horizontal":"vertical"),En(i,r.x,r.y),i}function Hd(e){return Math.abs(Math.round(e*2/3))}function PD(e,t){var n=kD(e,t);return sf(e,n)}function TD(e,t,n){var i=t.x-e.x,r=t.y-e.y;return Hd(n==="h"?i:r)}function kD(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=Fy(e,[a,s]);c<i&&(i=c,r=o)}return[n[r],n[r+1]]}function I_(e,t,n,i,r){function o(g,y,S){var w=g.index,P=g.point,T,$,k,D,H,Q;return w<=0||g.bendpoint?!1:(T=y[w-1],$=y[w],k=Pp(T,$),D=Zi(T,$),H=Math.abs(P.x-k.x),Q=Math.abs(P.y-k.y),D&&H<=S&&Q<=S)}function a(g,y){var S=g.waypoints,w,P,T,$;return y.index<=0||y.bendpoint||(w={start:S[y.index-1],end:S[y.index]},P=Zi(w.start,w.end),!P)?null:(P==="h"?T=w.end.x-w.start.x:T=w.end.y-w.start.y,$=Hd(T)/2,$)}function s(g,y){var S=y.waypoints,w=Fd(t,S,g),P;if(w){P=a(y,w);var T;if(o(w,S,P)?T=r.start(g,y,w.index):T=i.start(g,y,w.index,!w.bendpoint),T!==!1)return!0}}function c(g,y,S){Ge.bind(g,y,function(w){n.triggerMouseEvent(y,w,S),w.stopPropagation()})}function l(g,y){var S=t.getLayer("overlays"),w=Rt('.djs-bendpoints[data-element-id="'+ys(g.id)+'"]',S);return!w&&y&&(w=De("g"),Se(w,{"data-element-id":g.id}),ut(w).add("djs-bendpoints"),Ue(S,w),c(w,"mousedown",g),c(w,"click",g),c(w,"dblclick",g)),w}function u(g,y){return Rt('.djs-segment-dragger[data-segment-idx="'+g+'"]',y)}function p(g,y){y.waypoints.forEach(function(S,w){var P=jd(g);Ue(g,P),En(P,S.x,S.y)}),jd(g,"floating")}function f(g,y){for(var S=y.waypoints,w,P,T,$=1;$<S.length;$++)w=S[$-1],P=S[$],Zi(w,P)&&(T=D_(g,w,P),Se(T,{"data-segment-idx":$}),c(T,"mousemove",y))}function d(g){z(vc("."+k_,g),function(y){an(y)})}function h(g){z(vc("."+O_,g),function(y){an(y)})}function m(g){var y=l(g);return y||(y=l(g,!0),p(y,g),f(y,g)),y}function b(g){var y=l(g);y&&(h(y),d(y),f(y,g),p(y,g))}function E(g,y){var S=Rt(".floating",g),w=y.point;S&&(En(S,w.x,w.y),ut(S).add("positioned"))}function _(g,y,S){var w=u(y.index,g),P=S[y.index-1],T=S[y.index],$=y.point,k=Pp(P,T),D=Zi(P,T),H,Q;w&&(H=OD(w),Q={x:$.x-k.x,y:$.y-k.y},D==="v"&&(Q={x:Q.y,y:Q.x}),En(H,Q.x,Q.y))}e.on("connection.changed",function(g){b(g.element)}),e.on("connection.remove",function(g){var y=l(g.element);y&&an(y)}),e.on("element.marker.update",function(g){var y=g.element,S;y.waypoints&&(S=m(y),g.add?ut(S).add(g.marker):ut(S).remove(g.marker))}),e.on("element.mousemove",function(g){var y=g.element,S=y.waypoints,w,P;if(S){if(w=l(y,!0),P=Fd(t,S,g.originalEvent),!P)return;E(w,P),P.bendpoint||_(w,P,S)}}),e.on("element.mousedown",function(g){if(Pr(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 w=Rt(".floating",S);w&&ut(w).remove("positioned")}}}),e.on("element.updateId",function(g){var y=g.element,S=g.newId;if(y.waypoints){var w=l(y);w&&Se(w,{"data-element-id":S})}}),this.addHandles=m,this.updateHandles=b,this.getBendpointsContainer=l,this.getSegmentDragger=u}I_.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function OD(e){return Rt(".djs-visual",e)}var L_=Math.round,yo="reconnectStart",vo="reconnectEnd",Ss="updateWaypoints";function zd(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=yo:!l&&c===d.length-1?h=vo:h=Ss;var m=h===Ss?"connection.updateWaypoints":"connection.reconnect",b=r.allowed(m,{connection:s,source:p,target:f});if(b===!1&&(b=r.allowed(m,{connection:s,source:f,target:p})),b!==!1)return i.init(a,"bendpoint.move",{data:{connection:s,connectionGfx:u,context:{allowed:b,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===Ss?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=r.allowed(h,{connection:c,source:f===yo?p:l,target:f===vo?p:u}),d){s.source=f===yo?p:l,s.target=f===vo?p:u;return}d===!1&&(d=s.allowed=r.allowed(h,{connection:c,source:f===vo?p:u,target:f===yo?p:l})),d&&(s.source=f===vo?p:u,s.target=f===yo?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!==Ss&&(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,b=s.hints||{},E={x:L_(a.x),y:L_(a.y)};if(!c)return!1;m===Ss?(p?f.splice(l,0,E):f[l]=E,b.bendpointMove={insert:p,bendpointIndex:l},f=this.cropWaypoints(u,f),o.updateWaypoints(u,FC(f),b)):(m===yo?(b.docking="source",ru(s)&&(b.docking="target",b.newWaypoints=f.reverse())):m===vo&&(b.docking="target",ru(s)&&(b.docking="source",b.newWaypoints=f.reverse())),o.reconnect(u,d,h,E,b))},this)}zd.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],zd.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 ru(e){var t=e.hover,n=e.source,i=e.target,r=e.type;if(r===yo)return t&&i&&t===i&&n!==i;if(r===vo)return t&&n&&t===n&&n!==i}var DD="reconnectStart",ID="reconnectEnd",B_="updateWaypoints",Rs="connect-ok",ou="connect-not-ok",N_="connect-hover",$_="djs-updating",F_="djs-dragging",j_=1100;function H_(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=jd(i.getLayer("overlays"));ut(f).add("djs-dragging"),i.addMarker(c,F_),i.addMarker(c,$_)}),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,N_),l===B_)return;s?(i.removeMarker(c,ou),i.addMarker(c,Rs)):s===!1&&(i.removeMarker(c,Rs),i.addMarker(c,ou))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],j_,function(o){var a=o.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,N_),i.removeMarker(s,c?Rs:ou))}),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(),b={x:o.x,y:o.y},E=a.hints||{},_={};r&&(E.connectionStart&&(_.connectionStart=E.connectionStart),E.connectionEnd&&(_.connectionEnd=E.connectionEnd),p===DD?ru(a)?(_.connectionEnd=_.connectionEnd||b,_.source=h,_.target=u||d,m=m.reverse()):(_.connectionStart=_.connectionStart||b,_.source=u||d,_.target=h):p===ID?ru(a)?(_.connectionStart=_.connectionStart||b,_.source=u||h,_.target=d,m=m.reverse()):(_.connectionEnd=_.connectionEnd||b,_.source=d,_.target=u||h):(_.noCropping=!0,_.noLayout=!0,m[c]=b),p===B_&&(m=e.cropWaypoints(f,m)),_.waypoints=m,r.drawPreview(a,s,_)),En(l,o.x,o.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],j_,function(o){var a=o.context,s=a.connection,c=a.draggerGfx,l=a.hover,u=a.target,p=a.waypoints;s.waypoints=p,an(c),i.removeMarker(s,$_),i.removeMarker(s,F_),l&&(i.removeMarker(l,Rs),i.removeMarker(l,u?Rs:ou)),r&&r.cleanUp(a)})}H_.$inject=["bendpointMove","injector","eventBus","canvas"];var z_="connect-hover",G_="djs-updating";function V_(e,t,n){return Gd(e,t,e[t]+n)}function Gd(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function LD(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 Gd(t,i,s)}function W_(e){return e==="x"?"y":"x"}function U_(e,t,n){var i,r;return e.original?e.original:(i=$e(t),r=W_(n),Gd(e,r,i[r]))}function Y_(e,t,n,i,r,o){var a=e.get("connectionDocking",!1);this.start=function(p,f,d){var h,m=n.getGraphics(f),b=d-1,E=d,_=f.waypoints,g=_[b],y=_[E],S=Fd(n,_,p),w,P,T;if(w=Zi(g,y),!!w)return P=w==="v"?"x":"y",b===0&&(g=U_(g,f.source,P)),E===_.length-1&&(y=U_(y,f.target,P)),S?T=S.point:T={x:(g.x+y.x)/2,y:(g.y+y.y)/2},h={connection:f,segmentStartIndex:b,segmentEndIndex:E,segmentStart:g,segmentEnd:y,axis:P,dragPosition:T},i.init(p,T,"connectionSegment.move",{cursor:P==="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,b=h[m],E=p.segmentEndIndex+f,_=h[E],g=W_(p.axis),y=LD(d,b,_,g);En(p.draggerGfx,y.x,y.y)}function u(p,f){var d=0,h=p.filter(function(m,b){return Ap(p[b-1],p[b+1],m)?(d=b<=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=D_(h,f.segmentStart,f.segmentEnd),ut(f.draggerGfx).add("djs-dragging"),n.addMarker(d,G_)}),t.on("connectionSegment.move.move",function(p){var f=p.context,d=f.connection,h=f.segmentStartIndex,m=f.segmentEndIndex,b=f.segmentStart,E=f.segmentEnd,_=f.axis,g=f.originalWaypoints.slice(),y=V_(b,_,p["d"+_]),S=V_(E,_,p["d"+_]),w=g.length,P=0;g[h]=y,g[m]=S;var T,$;h<2&&(T=wn(d.source,y),h===1?T==="intersect"&&(g.shift(),g[0]=y,P--):T!=="intersect"&&(g.unshift(b),P++)),m>w-3&&($=wn(d.target,S),m===w-2?$==="intersect"&&(g.pop(),g[g.length-1]=S):$!=="intersect"&&g.push(E)),f.newWaypoints=d.waypoints=s(d,g),l(f,P,p),f.newSegmentStartIndex=h+P,c(p)}),t.on("connectionSegment.move.hover",function(p){p.context.hover=p.hover,n.addMarker(p.hover,z_)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var f=p.context.hover;f&&n.removeMarker(f,z_)}),t.on("connectionSegment.move.cleanup",function(p){var f=p.context,d=f.connection;f.draggerGfx&&an(f.draggerGfx),n.removeMarker(d,G_)}),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 b=u(h,m),E=b.waypoints,_=s(d,E),g=b.segmentOffset,y={segmentMove:{segmentStartIndex:f.segmentStartIndex,newSegmentStartIndex:m+g}};o.updateWaypoints(d,_,y)})}Y_.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var BD=Math.abs,q_=Math.round;function ND(e,t,n){n=n===void 0?10:n;var i,r;for(i=0;i<t.length;i++)if(r=t[i],BD(r-e)<=n)return r}function K_(e){return{x:e.x,y:e.y}}function X_(e){return{x:e.x+e.width,y:e.y+e.height}}function gi(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:q_(e.x+e.width/2),y:q_(e.y+e.height/2)}}function ya(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function tn(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 Z_(e){return e.children||[]}var $D=Math.abs,Q_=Math.round,Vd=10;function J_(e){function t(o,a){if(Ne(o)){for(var s=o.length;s--;)if($D(o[s]-a)<=Vd)return o[s]}else{o=+o;var c=a%o;if(c<Vd)return a-c;if(c>o-Vd)return a-c+o}return a}function n(o,a){if(o.waypoints)return PD(a,o);if(o.width)return{x:Q_(o.width/2+o.x),y:Q_(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:[]},z(m,function(b){b&&(b=b.original||b,h==="y"&&s.horizontal.push(b.y),h==="x"&&s.vertical.push(b.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;U(o,{dx:o.dx-p,dy:o.dy-f,x:l,y:u}),(p||a.vertical.indexOf(s)!==-1)&&tn(o,"x",l),(f||a.horizontal.indexOf(c)!==-1)&&tn(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:[]},z(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);!Mt(s)||!c||!c.x||!c.y||(tn(o,"x",c.x),tn(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;U(o,{dx:o.dx-h,dy:o.dy-m,x:o.x-h,y:o.y-m}),(h||s.vertical.indexOf(u)!==-1)&&tn(o,"x",f),(m||s.horizontal.indexOf(p)!==-1)&&tn(o,"y",d)}})}J_.$inject=["eventBus"];const FD={__depends__:[ir,Hi],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",I_],bendpointMove:["type",zd],bendpointMovePreview:["type",H_],connectionSegmentMove:["type",Y_],bendpointSnapping:["type",J_]};function ew(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),!Co(u)){if(u!==!1){s.source=c,s.target=l;return}u=s.canExecute=o(c,l),!Co(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:Wd(s)?u:l,connectionEnd:Wd(s)?l:u};pn(c)&&(d=c),s.connection=n.connect(p,f,d,h)}),this.start=function(a,s,c,l){pn(c)||(l=c,c=$e(s)),t.init(a,"connect",{autoActivate:l,data:{shape:s,context:{start:s,connectionStart:c}}})}}ew.$inject=["eventBus","dragging","modeling","rules"];function Wd(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var jD=1100,HD=900,tw="connect-ok",nw="connect-not-ok";function iw(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;Wd(o)&&(h=d,m=f),i.drawPreview(o,a,{source:c||l,target:p||s,connectionStart:h,connectionEnd:m})}),t.on("connect.hover",HD,function(r){var o=r.context,a=r.hover,s=o.canExecute;s!==null&&n.addMarker(a,s?tw:nw)}),t.on(["connect.out","connect.cleanup"],jD,function(r){var o=r.hover;o&&(n.removeMarker(o,tw),n.removeMarker(o,nw))}),i&&t.on("connect.cleanup",function(r){i.cleanUp(r.context)})}iw.$inject=["injector","eventBus","canvas"];const Ud={__depends__:[di,Hi,ir],__init__:["connectPreview"],connect:["type",ew],connectPreview:["type",iw]};var zD="djs-dragger";function ur(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)}ur.$inject=["injector","canvas","graphicsFactory","elementFactory"],ur.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()),bc(i),r||(r=e.getConnection=GD(function(m,b,E){return h.getConnection(m,b,E)})),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?$e(o):c,a?$e(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)"})},ur.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||$e(n),o=t.connectionEnd||$e(i),a=this.cropWaypoints(r,o,n,i),s=this.createNoopConnection(a[0],a[1]);Ue(e,s)},ur.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&&Fa(o,s,!0)||e,t=i&&Fa(a,s,!1)||t,[e,t]},ur.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&an(e.connectionPreviewGfx)},ur.prototype.getConnection=function(e){var t=VD(e);return this._elementFactory.createConnection(t)},ur.prototype.createConnectionPreviewGfx=function(){var e=De("g");return Se(e,{pointerEvents:"none"}),ut(e).add(zD),Ue(this._canvas.getActiveLayer(),e),e},ur.prototype.createNoopConnection=function(e,t){return La([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function GD(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 VD(e){return pn(e)?e:{}}const WD={__init__:["connectionPreview"],connectionPreview:["type",ur]},au="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(au);n.filter(s=>!UD(s)).forEach(s=>{let c;Mt(s)?(c=this._graphicsFactory._createContainer("connection",De("g")),this._graphicsFactory.drawConnection(oo(c),s)):(c=this._graphicsFactory._createContainer("shape",De("g")),this._graphicsFactory.drawShape(oo(c),s),En(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);Mt(s)?En(l,c.x,c.y):En(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(oo(l),s,{width:c.width,height:c.height}),En(l,c.x,c.y),this._previewSupport.addDragger(s,a,l)})}cleanUp(){bc(this._canvas.getLayer(au)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(au)}hide(){this._canvas.hideLayer(au)}}rw.$inject=["canvas","graphicsFactory","previewSupport"];function UD(e){return e.hidden}const YD={__depends__:[aa],__init__:["complexPreview"],complexPreview:["type",rw]},ow=Math.round;function su(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}su.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(U({type:t},n)),u=a.fire("autoPlace",{source:e,shape:l});if(!u)return;U(l,{x:u.x-ow(l.width/2),y:u.y-ow(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=>!Co(d))})},su.prototype.cleanUp=function(){this._complexPreview.cleanUp()},su.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const qD={__depends__:[Ol,YD,md],__init__:["appendPreview"],appendPreview:["type",su]};var aw=Math.min,sw=Math.max;function Yd(e){e.preventDefault()}function Cs(e){e.stopPropagation()}function KD(e){return e.nodeType===Node.TEXT_NODE}function XD(e){return[].slice.call(e)}function Mi(e){this.container=e.container,this.parent=It('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=Rt("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=Nn(this.autoResize,this),this.handlePaste=Nn(this.handlePaste,this)}Mi.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=Si(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);U(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=Si(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return U(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},l),i.centerVertically&&U(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},l),a.innerText=n,Ge.bind(a,"keydown",this.keyHandler),Ge.bind(a,"mousedown",Cs),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},Mi.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)}},Mi.prototype.insertText=function(e){e=ZD(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},Mi.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,r=t.startOffset,o=t.endOffset,a=t.commonAncestorContainer,s=XD(a.childNodes),c,l;if(KD(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&&Li(h)}),c=n,l=r+e.length}c&&l!==void 0&&setTimeout(function(){self.setSelection(c,l)})},Mi.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})}},Mi.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=It('<div class="djs-direct-editing-resize-handle"></div>');var s,c,l,u,p=function(h){Yd(h),Cs(h),s=h.clientX,c=h.clientY;var m=t.getBoundingClientRect();l=m.width,u=m.height,Ge.bind(document,"mousemove",f),Ge.bind(document,"mouseup",d)},f=function(h){Yd(h),Cs(h);var m=aw(sw(l+h.clientX-s,i),o),b=aw(sw(u+h.clientY-c,r),a);t.style.width=m+"px",t.style.height=b+"px",e.resizeHandler({width:l,height:u,dx:h.clientX-s,dy:h.clientY-c})},d=function(h){Yd(h),Cs(h),Ge.unbind(document,"mousemove",f,!1),Ge.unbind(document,"mouseup",d,!1)};Ge.bind(n,"mousedown",p)}U(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)},Mi.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",Cs),Ge.unbind(t,"input",this.autoResize),Ge.unbind(t,"paste",this.handlePaste),Ge.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),Li(n)),Li(e)},Mi.prototype.getValue=function(){return this.content.innerText.trim()},Mi.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},Mi.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 ZD(e){return e.replace(/\r\n|\r|\n/g,`
316
- `)}function Xn(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new Mi({container:t.getContainer(),keyHandler:Nn(this._handleKey,this),resizeHandler:Nn(this._handleResize,this),focusoutHandler:Nn(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}Xn.$inject=["eventBus","canvas"],Xn.prototype.registerProvider=function(e){this._providers.push(e)},Xn.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},Xn.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},Xn.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},Xn.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},Xn.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},Xn.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()}},Xn.prototype.getValue=function(){return this._textbox.getValue()},Xn.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()},Xn.prototype._handleResize=function(e){this._fire("resize",e)},Xn.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},Xn.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=kt(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 cw={__depends__:[cl],__init__:["directEditing"],directEditing:["type",Xn]};function QD(e){return function(t){var n=t.target,i=le(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===st(e);return!o||!a||!s||!c}}const JD={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=JD[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var eI=[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")],tI=[ae("none-start-event",{actionName:"replace-with-none-start"}),ae("none-intermediate-throwing"),ae("none-end-event",{actionName:"replace-with-none-end"})],nI=[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")],iI=[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")],rI=[ae("exclusive-gateway"),ae("parallel-gateway"),ae("inclusive-gateway"),ae("complex-gateway"),ae("event-based-gateway")],oI=[ae("transaction"),ae("event-subprocess"),ae("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),ae("collapsed-subprocess")],aI=[ae("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),ae("transaction"),ae("event-subprocess"),ae("collapsed-ad-hoc-subprocess")],lw=[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")],sI=lw,uw=[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"})],cI=[ae("data-store-reference")],lI=[ae("data-object-reference")],uI=[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")],pI=[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")],fI=[{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"}],dI=[ae("expanded-pool"),ae("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],hI={"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 pw={"start-event-non-interrupting":`
314
+ </svg>`},s5=900;function as(e,t,n,i){e.registerProvider(s5,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}as.$inject=["contextPad","popupMenu","translate","canvas"],as.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&te(t,this._getEntries(e)),t},as.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},as.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${XE.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);te(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},as.prototype._getMenuPosition=function(e){var t=5,n=this._contextPad.getPad(e).html,i=n.getBoundingClientRect(),o={x:i.left,y:i.bottom+t};return o};var c5=["left","center","right","top","middle","bottom"];function Mc(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}Mc.$inject=["popupMenu","alignElements","translate","rules"],Mc.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&te(t,this._getEntries(e)),t},Mc.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},Mc.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,o={};return K(c5,function(r){o["align-elements-"+r]={group:"align",title:n("Align elements "+r),className:"bjs-align-elements-menu-entry",imageHtml:XE[r],action:function(){t.trigger(e,r),i.close()}}}),o};function xp(e){ki.call(this,e)}xp.$inject=["eventBus"],je(xp,ki),xp.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=gt(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=Dl(n),n.length<2?!1:n})};const l5={__depends__:[b$,sE,Ig],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",as],alignElementsMenuProvider:["type",Mc],bpmnAlignElements:["type",xp]};function ss(e,t,n){this._canvas=n,this._opts=te({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var i=this;t.on("drag.move",function(o){var r=i._toBorderPoint(o);i.startScroll(r)}),t.on(["drag.cleanup"],function(){i.stopScroll()})}ss.$inject=["config.autoScroll","eventBus","canvas"],ss.prototype.startScroll=function(e){var t=this._canvas,n=this._opts,i=this,o=t.getContainer().getBoundingClientRect(),r=[e.x,e.y,o.width-e.x,o.height-e.y];this.stopScroll();for(var a=0,s=0,c=0;c<4;c++)u5(r[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 u5(e,t,n){return t<e&&e<n}ss.prototype.stopScroll=function(){clearTimeout(this._scrolling)},ss.prototype.setOptions=function(e){this._opts=te({},this._opts,e)},ss.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=Jr(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const p5={__depends__:[$o],__init__:["autoScroll"],autoScroll:["type",ss]};var ZE="djs-bendpoint",JE="djs-segment-dragger";function d5(e,t){var n=Jr(t),i=e._container.getBoundingClientRect(),o;o={x:i.left,y:i.top};var r=e.viewbox();return{x:r.x+(n.x-o.x)/r.scale,y:r.y+(n.y-o.y)/r.scale}}function Bg(e,t,n){var i=d5(e,n),o=Wf(t,i);return o}function Ng(e,t){var n=We("g");vt(n).add(ZE),ot(e,n);var i=We("circle");Le(i,{cx:0,cy:0,r:4}),vt(i).add("djs-visual"),ot(n,i);var o=We("circle");return Le(o,{cx:0,cy:0,r:10}),vt(o).add("djs-hit"),ot(n,o),t&&vt(n).add(t),n}function f5(e,t,n,i){var o=We("g");ot(e,o);var r=18,a=6,s=11,c=g5(t,n,i),l=a+s,u=We("rect");Le(u,{x:-r/2,y:-a/2,width:r,height:a}),vt(u).add("djs-visual"),ot(o,u);var p=We("rect");return Le(p,{x:-c/2,y:-l/2,width:c,height:l}),vt(p).add("djs-hit"),ot(o,p),eb(o,i==="v"?90:0),o}function QE(e,t,n){var i=We("g"),o=xf(t,n),r=Oo(t,n);return ot(e,i),f5(i,t,n,r),vt(i).add(JE),vt(i).add(r==="h"?"horizontal":"vertical"),Fn(i,o.x,o.y),i}function $g(e){return Math.abs(Math.round(e*2/3))}function h5(e,t){var n=m5(e,t);return Zf(e,n)}function g5(e,t,n){var i=t.x-e.x,o=t.y-e.y;return $g(n==="h"?i:o)}function m5(e,t){for(var n=t.waypoints,i=1/0,o,r=0;r<n.length-1;r++){var a=n[r],s=n[r+1],c=Hb(e,[a,s]);c<i&&(i=c,o=r)}return[n[o],n[o+1]]}function eS(e,t,n,i,o){function r(v,b,S){var M=v.index,B=v.point,A,I,H,V,G,ie;return M<=0||v.bendpoint?!1:(A=b[M-1],I=b[M],H=xf(A,I),V=Oo(A,I),G=Math.abs(B.x-H.x),ie=Math.abs(B.y-H.y),V&&G<=S&&ie<=S)}function a(v,b){var S=v.waypoints,M,B,A,I;return b.index<=0||b.bendpoint||(M={start:S[b.index-1],end:S[b.index]},B=Oo(M.start,M.end),!B)?null:(B==="h"?A=M.end.x-M.start.x:A=M.end.y-M.start.y,I=$g(A)/2,I)}function s(v,b){var S=b.waypoints,M=Bg(t,S,v),B;if(M){B=a(b,M);var A;if(r(M,S,B)?A=o.start(v,b,M.index):A=i.start(v,b,M.index,!M.bendpoint),A!==!1)return!0}}function c(v,b,S){Ke.bind(v,b,function(M){n.triggerMouseEvent(b,M,S),M.stopPropagation()})}function l(v,b){var S=t.getLayer("overlays"),M=kt('.djs-bendpoints[data-element-id="'+ra(v.id)+'"]',S);return!M&&b&&(M=We("g"),Le(M,{"data-element-id":v.id}),vt(M).add("djs-bendpoints"),ot(S,M),c(M,"mousedown",v),c(M,"click",v),c(M,"dblclick",v)),M}function u(v,b){return kt('.djs-segment-dragger[data-segment-idx="'+v+'"]',b)}function p(v,b){b.waypoints.forEach(function(S,M){var B=Ng(v);ot(v,B),Fn(B,S.x,S.y)}),Ng(v,"floating")}function d(v,b){for(var S=b.waypoints,M,B,A,I=1;I<S.length;I++)M=S[I-1],B=S[I],Oo(M,B)&&(A=QE(v,M,B),Le(A,{"data-segment-idx":I}),c(A,"mousemove",b))}function f(v){K(Ls("."+ZE,v),function(b){mn(b)})}function m(v){K(Ls("."+JE,v),function(b){mn(b)})}function h(v){var b=l(v);return b||(b=l(v,!0),p(b,v),d(b,v)),b}function y(v){var b=l(v);b&&(m(b),f(b),d(b,v),p(b,v))}function w(v,b){var S=kt(".floating",v),M=b.point;S&&(Fn(S,M.x,M.y),vt(S).add("positioned"))}function g(v,b,S){var M=u(b.index,v),B=S[b.index-1],A=S[b.index],I=b.point,H=xf(B,A),V=Oo(B,A),G,ie;M&&(G=y5(M),ie={x:I.x-H.x,y:I.y-H.y},V==="v"&&(ie={x:ie.y,y:ie.x}),Fn(G,ie.x,ie.y))}e.on("connection.changed",function(v){y(v.element)}),e.on("connection.remove",function(v){var b=l(v.element);b&&mn(b)}),e.on("element.marker.update",function(v){var b=v.element,S;b.waypoints&&(S=h(b),v.add?vt(S).add(v.marker):vt(S).remove(v.marker))}),e.on("element.mousemove",function(v){var b=v.element,S=b.waypoints,M,B;if(S){if(M=l(b,!0),B=Bg(t,S,v.originalEvent),!B)return;w(M,B),B.bendpoint||g(M,B,S)}}),e.on("element.mousedown",function(v){if(vr(v)){var b=v.originalEvent,S=v.element;if(S.waypoints)return s(b,S)}}),e.on("selection.changed",function(v){var b=v.newSelection,S=b[0];S&&S.waypoints&&h(S)}),e.on("element.hover",function(v){var b=v.element;b.waypoints&&h(b)}),e.on("element.out",function(v){var b=v.element;if(b.waypoints){var S=l(b);if(S){var M=kt(".floating",S);M&&vt(M).remove("positioned")}}}),e.on("element.updateId",function(v){var b=v.element,S=v.newId;if(b.waypoints){var M=l(b);M&&Le(M,{"data-element-id":S})}}),this.addHandles=h,this.updateHandles=y,this.getBendpointsContainer=l,this.getSegmentDragger=u}eS.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function y5(e){return kt(".djs-visual",e)}var tS=Math.round,ca="reconnectStart",la="reconnectEnd",Cc="updateWaypoints";function Fg(e,t,n,i,o,r){this._injector=e,this.start=function(a,s,c,l){var u=n.getGraphics(s),p=s.source,d=s.target,f=s.waypoints,m;!l&&c===0?m=ca:!l&&c===f.length-1?m=la:m=Cc;var h=m===Cc?"connection.updateWaypoints":"connection.reconnect",y=o.allowed(h,{connection:s,source:p,target:d});if(y===!1&&(y=o.allowed(h,{connection:s,source:d,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:d,insert:l,type:m}}})},t.on("bendpoint.move.hover",function(a){var s=a.context,c=s.connection,l=c.source,u=c.target,p=a.hover,d=s.type;s.hover=p;var f;if(p){var m=d===Cc?"connection.updateWaypoints":"connection.reconnect";if(f=s.allowed=o.allowed(m,{connection:c,source:d===ca?p:l,target:d===la?p:u}),f){s.source=d===ca?p:l,s.target=d===la?p:u;return}f===!1&&(f=s.allowed=o.allowed(m,{connection:c,source:d===la?p:u,target:d===ca?p:l})),f&&(s.source=d===la?p:u,s.target=d===ca?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!==Cc&&(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,d=u.waypoints.slice(),f=s.source,m=s.target,h=s.type,y=s.hints||{},w={x:tS(a.x),y:tS(a.y)};if(!c)return!1;h===Cc?(p?d.splice(l,0,w):d[l]=w,y.bendpointMove={insert:p,bendpointIndex:l},d=this.cropWaypoints(u,d),r.updateWaypoints(u,Jk(d),y)):(h===ca?(y.docking="source",bp(s)&&(y.docking="target",y.newWaypoints=d.reverse())):h===la&&(y.docking="target",bp(s)&&(y.docking="source",y.newWaypoints=d.reverse())),r.reconnect(u,f,m,w,y))},this)}Fg.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],Fg.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 bp(e){var t=e.hover,n=e.source,i=e.target,o=e.type;if(o===ca)return t&&i&&t===i&&n!==i;if(o===la)return t&&n&&t===n&&n!==i}var v5="reconnectStart",x5="reconnectEnd",nS="updateWaypoints",Ac="connect-ok",wp="connect-not-ok",iS="connect-hover",oS="djs-updating",rS="djs-dragging",aS=1100;function sS(e,t,n,i){this._injector=t;var o=t.get("connectionPreview",!1);n.on("bendpoint.move.start",function(r){var a=r.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:r.x,y:r.y}),c.waypoints=p;var d=a.draggerGfx=Ng(i.getLayer("overlays"));vt(d).add("djs-dragging"),i.addMarker(c,rS),i.addMarker(c,oS)}),n.on("bendpoint.move.hover",function(r){var a=r.context,s=a.allowed,c=a.hover,l=a.type;if(c){if(i.addMarker(c,iS),l===nS)return;s?(i.removeMarker(c,wp),i.addMarker(c,Ac)):s===!1&&(i.removeMarker(c,Ac),i.addMarker(c,wp))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],aS,function(r){var a=r.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,iS),i.removeMarker(s,c?Ac:wp))}),n.on("bendpoint.move.move",function(r){var a=r.context,s=a.allowed,c=a.bendpointIndex,l=a.draggerGfx,u=a.hover,p=a.type,d=a.connection,f=d.source,m=d.target,h=d.waypoints.slice(),y={x:r.x,y:r.y},w=a.hints||{},g={};o&&(w.connectionStart&&(g.connectionStart=w.connectionStart),w.connectionEnd&&(g.connectionEnd=w.connectionEnd),p===v5?bp(a)?(g.connectionEnd=g.connectionEnd||y,g.source=m,g.target=u||f,h=h.reverse()):(g.connectionStart=g.connectionStart||y,g.source=u||f,g.target=m):p===x5?bp(a)?(g.connectionStart=g.connectionStart||y,g.source=u||m,g.target=f,h=h.reverse()):(g.connectionEnd=g.connectionEnd||y,g.source=f,g.target=u||m):(g.noCropping=!0,g.noLayout=!0,h[c]=y),p===nS&&(h=e.cropWaypoints(d,h)),g.waypoints=h,o.drawPreview(a,s,g)),Fn(l,r.x,r.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],aS,function(r){var a=r.context,s=a.connection,c=a.draggerGfx,l=a.hover,u=a.target,p=a.waypoints;s.waypoints=p,mn(c),i.removeMarker(s,oS),i.removeMarker(s,rS),l&&(i.removeMarker(l,Ac),i.removeMarker(l,u?Ac:wp)),o&&o.cleanUp(a)})}sS.$inject=["bendpointMove","injector","eventBus","canvas"];var cS="connect-hover",lS="djs-updating";function uS(e,t,n){return jg(e,t,e[t]+n)}function jg(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function b5(e,t,n,i){var o=Math.max(t[i],n[i]),r=Math.min(t[i],n[i]),a=20,s=Math.min(Math.max(r+a,e[i]),o-a);return jg(t,i,s)}function pS(e){return e==="x"?"y":"x"}function dS(e,t,n){var i,o;return e.original?e.original:(i=nt(t),o=pS(n),jg(e,o,i[o]))}function fS(e,t,n,i,o,r){var a=e.get("connectionDocking",!1);this.start=function(p,d,f){var m,h=n.getGraphics(d),y=f-1,w=f,g=d.waypoints,v=g[y],b=g[w],S=Bg(n,g,p),M,B,A;if(M=Oo(v,b),!!M)return B=M==="v"?"x":"y",y===0&&(v=dS(v,d.source,B)),w===g.length-1&&(b=dS(b,d.target,B)),S?A=S.point:A={x:(v.x+b.x)/2,y:(v.y+b.y)/2},m={connection:d,segmentStartIndex:y,segmentEndIndex:w,segmentStart:v,segmentEnd:b,axis:B,dragPosition:A},i.init(p,A,"connectionSegment.move",{cursor:B==="x"?"resize-ew":"resize-ns",data:{connection:d,connectionGfx:h,context:m}})};function s(p,d){if(!a)return d;var f=p.waypoints,m;return p.waypoints=d,m=a.getCroppedWaypoints(p),p.waypoints=f,m}function c(p){o.update("connection",p.connection,p.connectionGfx)}function l(p,d,f){var m=p.newWaypoints,h=p.segmentStartIndex+d,y=m[h],w=p.segmentEndIndex+d,g=m[w],v=pS(p.axis),b=b5(f,y,g,v);Fn(p.draggerGfx,b.x,b.y)}function u(p,d){var f=0,m=p.filter(function(h,y){return vf(p[y-1],p[y+1],h)?(f=y<=d?f-1:f,!1):!0});return{waypoints:m,segmentOffset:f}}t.on("connectionSegment.move.start",function(p){var d=p.context,f=p.connection,m=n.getLayer("overlays");d.originalWaypoints=f.waypoints.slice(),d.draggerGfx=QE(m,d.segmentStart,d.segmentEnd),vt(d.draggerGfx).add("djs-dragging"),n.addMarker(f,lS)}),t.on("connectionSegment.move.move",function(p){var d=p.context,f=d.connection,m=d.segmentStartIndex,h=d.segmentEndIndex,y=d.segmentStart,w=d.segmentEnd,g=d.axis,v=d.originalWaypoints.slice(),b=uS(y,g,p["d"+g]),S=uS(w,g,p["d"+g]),M=v.length,B=0;v[m]=b,v[h]=S;var A,I;m<2&&(A=$n(f.source,b),m===1?A==="intersect"&&(v.shift(),v[0]=b,B--):A!=="intersect"&&(v.unshift(y),B++)),h>M-3&&(I=$n(f.target,S),h===M-2?I==="intersect"&&(v.pop(),v[v.length-1]=S):I!=="intersect"&&v.push(w)),d.newWaypoints=f.waypoints=s(f,v),l(d,B,p),d.newSegmentStartIndex=m+B,c(p)}),t.on("connectionSegment.move.hover",function(p){p.context.hover=p.hover,n.addMarker(p.hover,cS)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var d=p.context.hover;d&&n.removeMarker(d,cS)}),t.on("connectionSegment.move.cleanup",function(p){var d=p.context,f=d.connection;d.draggerGfx&&mn(d.draggerGfx),n.removeMarker(f,lS)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(p){var d=p.context,f=d.connection;f.waypoints=d.originalWaypoints,c(p)}),t.on("connectionSegment.move.end",function(p){var d=p.context,f=d.connection,m=d.newWaypoints,h=d.newSegmentStartIndex;m=m.map(function(S){return{original:S.original,x:Math.round(S.x),y:Math.round(S.y)}});var y=u(m,h),w=y.waypoints,g=s(f,w),v=y.segmentOffset,b={segmentMove:{segmentStartIndex:d.segmentStartIndex,newSegmentStartIndex:h+v}};r.updateWaypoints(f,g,b)})}fS.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var w5=Math.abs,hS=Math.round;function _5(e,t,n){n=n===void 0?10:n;var i,o;for(i=0;i<t.length;i++)if(o=t[i],w5(o-e)<=n)return o}function gS(e){return{x:e.x,y:e.y}}function mS(e){return{x:e.x+e.width,y:e.y+e.height}}function Ii(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:hS(e.x+e.width/2),y:hS(e.y+e.height/2)}}function cs(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function wn(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,o=e[t],r=e.snapped=e.snapped||{};return n===!1?r[t]=!1:(r[t]=!0,i=n-o,e[t]+=i,e["d"+t]+=i),o}function yS(e){return e.children||[]}var E5=Math.abs,vS=Math.round,Hg=10;function xS(e){function t(r,a){if(et(r)){for(var s=r.length;s--;)if(E5(r[s]-a)<=Hg)return r[s]}else{r=+r;var c=a%r;if(c<Hg)return a-c;if(c>r-Hg)return a-c+r}return a}function n(r,a){if(r.waypoints)return h5(a,r);if(r.width)return{x:vS(r.width/2+r.x),y:vS(r.height/2+r.y)}}function i(r){var a=r.context,s=a.snapPoints,c=a.connection,l=c.waypoints,u=a.segmentStart,p=a.segmentStartIndex,d=a.segmentEnd,f=a.segmentEndIndex,m=a.axis;if(s)return s;var h=[l[p-1],u,d,l[f+1]];return p<2&&h.unshift(n(c.source,r)),f>l.length-3&&h.unshift(n(c.target,r)),a.snapPoints=s={horizontal:[],vertical:[]},K(h,function(y){y&&(y=y.original||y,m==="y"&&s.horizontal.push(y.y),m==="x"&&s.vertical.push(y.x))}),s}e.on("connectionSegment.move.move",1500,function(r){var a=i(r),s=r.x,c=r.y,l,u;if(a){l=t(a.vertical,s),u=t(a.horizontal,c);var p=s-l,d=c-u;te(r,{dx:r.dx-p,dy:r.dy-d,x:l,y:u}),(p||a.vertical.indexOf(s)!==-1)&&wn(r,"x",l),(d||a.horizontal.indexOf(c)!==-1)&&wn(r,"y",u)}});function o(r){var a=r.snapPoints,s=r.connection.waypoints,c=r.bendpointIndex;if(a)return a;var l=[s[c-1],s[c+1]];return r.snapPoints=a={horizontal:[],vertical:[]},K(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(r){var a=r.context,s=a.hover,c=s&&n(s,r);!$t(s)||!c||!c.x||!c.y||(wn(r,"x",c.x),wn(r,"y",c.y))}),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(r){var a=r.context,s=o(a),c=a.hover,l=c&&n(c,r),u=r.x,p=r.y,d,f;if(s){d=t(l?s.vertical.concat([l.x]):s.vertical,u),f=t(l?s.horizontal.concat([l.y]):s.horizontal,p);var m=u-d,h=p-f;te(r,{dx:r.dx-m,dy:r.dy-h,x:r.x-m,y:r.y-h}),(m||s.vertical.indexOf(u)!==-1)&&wn(r,"x",d),(h||s.horizontal.indexOf(p)!==-1)&&wn(r,"y",f)}})}xS.$inject=["eventBus"];const S5={__depends__:[$o,mo],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",eS],bendpointMove:["type",Fg],bendpointMovePreview:["type",sS],connectionSegmentMove:["type",fS],bendpointSnapping:["type",xS]};function bS(e,t,n,i){function o(a,s){return i.allowed("connection.create",{source:a,target:s})}function r(a,s){return o(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=o(c,l),!xa(u)){if(u!==!1){s.source=c,s.target=l;return}u=s.canExecute=r(c,l),!xa(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,d=s.target;if(!c)return!1;var f=null,m={connectionStart:Gg(s)?u:l,connectionEnd:Gg(s)?l:u};Sn(c)&&(f=c),s.connection=n.connect(p,d,f,m)}),this.start=function(a,s,c,l){Sn(c)||(l=c,c=nt(s)),t.init(a,"connect",{autoActivate:l,data:{shape:s,context:{start:s,connectionStart:c}}})}}bS.$inject=["eventBus","dragging","modeling","rules"];function Gg(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var R5=1100,M5=900,wS="connect-ok",_S="connect-not-ok";function ES(e,t,n){var i=e.get("connectionPreview",!1);i&&t.on("connect.move",function(o){var r=o.context,a=r.canExecute,s=r.hover,c=r.source,l=r.start,u=r.startPosition,p=r.target,d=r.connectionStart||u,f=r.connectionEnd||{x:o.x,y:o.y},m=d,h=f;Gg(r)&&(m=f,h=d),i.drawPreview(r,a,{source:c||l,target:p||s,connectionStart:m,connectionEnd:h})}),t.on("connect.hover",M5,function(o){var r=o.context,a=o.hover,s=r.canExecute;s!==null&&n.addMarker(a,s?wS:_S)}),t.on(["connect.out","connect.cleanup"],R5,function(o){var r=o.hover;r&&(n.removeMarker(r,wS),n.removeMarker(r,_S))}),i&&t.on("connect.cleanup",function(o){i.cleanUp(o.context)})}ES.$inject=["injector","eventBus","canvas"];const zg={__depends__:[Oi,mo,$o],__init__:["connectPreview"],connect:["type",bS],connectPreview:["type",ES]};var C5="djs-dragger";function Wo(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)}Wo.$inject=["injector","canvas","graphicsFactory","elementFactory"],Wo.prototype.drawPreview=function(e,t,n){n=n||{};var i=e.connectionPreviewGfx,o=e.getConnection,r=n.source,a=n.target,s=n.waypoints,c=n.connectionStart,l=n.connectionEnd,u=n.noLayout,p=n.noCropping,d=n.noNoop,f,m=this;if(i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),Is(i),o||(o=e.getConnection=A5(function(h,y,w){return m.getConnection(h,y,w)})),t&&(f=o(t,r,a)),!f){!d&&this.drawNoopPreview(i,n);return}f.waypoints=s||[],this._layouter&&!u&&(f.waypoints=this._layouter.layoutConnection(f,{source:r,target:a,connectionStart:c,connectionEnd:l,waypoints:n.waypoints||f.waypoints})),(!f.waypoints||!f.waypoints.length)&&(f.waypoints=[r?nt(r):c,a?nt(a):l]),this._connectionDocking&&(r||a)&&!p&&(f.waypoints=this._connectionDocking.getCroppedWaypoints(f,r,a)),this._graphicsFactory.drawConnection(i,f,{stroke:"var(--element-dragger-color)"})},Wo.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,o=t.connectionStart||nt(n),r=t.connectionEnd||nt(i),a=this.cropWaypoints(o,r,n,i),s=this.createNoopConnection(a[0],a[1]);ot(e,s)},Wo.prototype.cropWaypoints=function(e,t,n,i){var o=this._graphicsFactory,r=n&&o.getShapePath(n),a=i&&o.getShapePath(i),s=o.getConnectionPath({waypoints:[e,t]});return e=n&&Gs(r,s,!0)||e,t=i&&Gs(a,s,!1)||t,[e,t]},Wo.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&mn(e.connectionPreviewGfx)},Wo.prototype.getConnection=function(e){var t=T5(e);return this._elementFactory.createConnection(t)},Wo.prototype.createConnectionPreviewGfx=function(){var e=We("g");return Le(e,{pointerEvents:"none"}),vt(e).add(C5),ot(this._canvas.getActiveLayer(),e),e},Wo.prototype.createNoopConnection=function(e,t){return $s([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function A5(e){var t={};return function(n){var i=JSON.stringify(n),o=t[i];return o||(o=t[i]=e.apply(null,arguments)),o}}function T5(e){return Sn(e)?e:{}}const P5={__init__:["connectionPreview"],connectionPreview:["type",Wo]},_p="complex-preview";class SS{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:o=[],resized:r=[]}=t,a=this._canvas.getLayer(_p);n.filter(s=>!k5(s)).forEach(s=>{let c;$t(s)?(c=this._graphicsFactory._createContainer("connection",We("g")),this._graphicsFactory.drawConnection(fr(c),s)):(c=this._graphicsFactory._createContainer("shape",We("g")),this._graphicsFactory.drawShape(fr(c),s),Fn(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);$t(s)?Fn(l,c.x,c.y):Fn(l,s.x+c.x,s.y+c.y)}),o.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"])}),r.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",We("g"));this._graphicsFactory.drawShape(fr(l),s,{width:c.width,height:c.height}),Fn(l,c.x,c.y),this._previewSupport.addDragger(s,a,l)})}cleanUp(){Is(this._canvas.getLayer(_p)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(_p)}hide(){this._canvas.hideLayer(_p)}}SS.$inject=["canvas","graphicsFactory","previewSupport"];function k5(e){return e.hidden}const O5={__depends__:[Xa],__init__:["complexPreview"],complexPreview:["type",SS]},RS=Math.round;function Ep(e,t,n,i,o,r){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=o,this._rules=r}Ep.prototype.create=function(e,t,n){const i=this._complexPreview,o=this._connectionDocking,r=this._elementFactory,a=this._eventBus,s=this._layouter,c=this._rules,l=r.createShape(te({type:t},n)),u=a.fire("autoPlace",{source:e,shape:l});if(!u)return;te(l,{x:u.x-RS(l.width/2),y:u.y-RS(l.height/2)});const p=c.allowed("connection.create",{source:e,target:l,hints:{targetParent:e.parent}});let d=null;p&&(d=r.createConnection(p),d.waypoints=s.layoutConnection(d,{source:e,target:l}),d.waypoints=o.getCroppedWaypoints(d,e,l)),i.create({created:[l,d].filter(f=>!xa(f))})},Ep.prototype.cleanUp=function(){this._complexPreview.cleanUp()},Ep.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const D5={__depends__:[zu,O5,rg],__init__:["appendPreview"],appendPreview:["type",Ep]};var MS=Math.min,CS=Math.max;function Vg(e){e.preventDefault()}function Tc(e){e.stopPropagation()}function L5(e){return e.nodeType===Node.TEXT_NODE}function I5(e){return[].slice.call(e)}function eo(e){this.container=e.container,this.parent=Wt('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=kt("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=ti(this.autoResize,this),this.handlePaste=ti(this.handlePaste,this)}eo.prototype.create=function(e,t,n,i){var o=this,r=this.parent,a=this.content,s=this.container;i=this.options=i||{},t=this.style=t||{};var c=Wi(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);te(r.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=Wi(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return te(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},l),i.centerVertically&&te(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},l),a.innerText=n,Ke.bind(a,"keydown",this.keyHandler),Ke.bind(a,"mousedown",Tc),Ke.bind(a,"paste",o.handlePaste),Ke.bind(a,"focusout",this.focusoutHandler),i.autoResize&&Ke.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(r),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),r},eo.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 o=this.autoResize(n);o&&this.resizeHandler(o)}},eo.prototype.insertText=function(e){e=B5(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},eo.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,o=t.startOffset,r=t.endOffset,a=t.commonAncestorContainer,s=I5(a.childNodes),c,l;if(L5(a)){var u=n.textContent;n.textContent=u.substring(0,o)+e+u.substring(r),c=n,l=o+e.length}else if(n===this.content&&i===this.content){var p=document.createTextNode(e);this.content.insertBefore(p,s[o]),c=p,l=p.textContent.length}else{var d=s.indexOf(n),f=s.indexOf(i);s.forEach(function(m,h){h===d?m.textContent=n.textContent.substring(0,o)+e+i.textContent.substring(r):h>d&&h<=f&&co(m)}),c=n,l=o+e.length}c&&l!==void 0&&setTimeout(function(){self.setSelection(c,l)})},eo.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(),o=t.scrollHeight;e.style.height=o+"px",this.resizeHandler({width:i.width,height:i.height,dx:0,dy:o-i.height})}},eo.prototype.resizable=function(){var e=this,t=this.parent,n=this.resizeHandle,i=parseInt(this.style.minWidth)||0,o=parseInt(this.style.minHeight)||0,r=parseInt(this.style.maxWidth)||1/0,a=parseInt(this.style.maxHeight)||1/0;if(!n){n=this.resizeHandle=Wt('<div class="djs-direct-editing-resize-handle"></div>');var s,c,l,u,p=function(m){Vg(m),Tc(m),s=m.clientX,c=m.clientY;var h=t.getBoundingClientRect();l=h.width,u=h.height,Ke.bind(document,"mousemove",d),Ke.bind(document,"mouseup",f)},d=function(m){Vg(m),Tc(m);var h=MS(CS(l+m.clientX-s,i),r),y=MS(CS(u+m.clientY-c,o),a);t.style.width=h+"px",t.style.height=y+"px",e.resizeHandler({width:l,height:u,dx:m.clientX-s,dy:m.clientY-c})},f=function(m){Vg(m),Tc(m),Ke.unbind(document,"mousemove",d,!1),Ke.unbind(document,"mouseup",f,!1)};Ke.bind(n,"mousedown",p)}te(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)},eo.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),Ke.unbind(t,"keydown",this.keyHandler),Ke.unbind(t,"mousedown",Tc),Ke.unbind(t,"input",this.autoResize),Ke.unbind(t,"paste",this.handlePaste),Ke.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),co(n)),co(e)},eo.prototype.getValue=function(){return this.content.innerText.trim()},eo.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},eo.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 B5(e){return e.replace(/\r\n|\r|\n/g,`
315
+ `)}function mi(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new eo({container:t.getContainer(),keyHandler:ti(this._handleKey,this),resizeHandler:ti(this._handleResize,this),focusoutHandler:ti(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}mi.$inject=["eventBus","canvas"],mi.prototype.registerProvider=function(e){this._providers.push(e)},mi.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},mi.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},mi.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},mi.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},mi.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},mi.prototype.complete=function(){var e=this._active;if(e){var t,n=e.context.bounds,i=this.$textbox.getBoundingClientRect(),o=this.getValue(),r=e.context.text;(o!==r||i.height!==n.height||i.width!==n.width)&&(t=this._textbox.container.getBoundingClientRect(),e.provider.update(e.element,o,e.context.text,{x:i.left-t.left,y:i.top-t.top,width:i.width,height:i.height})),this._fire("complete"),this.close()}},mi.prototype.getValue=function(){return this._textbox.getValue()},mi.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()},mi.prototype._handleResize=function(e){this._fire("resize",e)},mi.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},mi.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=Ht(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 AS={__depends__:[xu],__init__:["directEditing"],directEditing:["type",mi]};function N5(e){return function(t){var n=t.target,i=Ee(e),o=i.eventDefinitions&&i.eventDefinitions[0],r=i.$type===n.type,a=(o&&o.$type)===n.eventDefinitionType,s=!!n.triggeredByEvent==!!i.triggeredByEvent,c=n.isExpanded===void 0||n.isExpanded===xt(e);return!r||!a||!s||!c}}const $5={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 be(e,t={}){var n=$5[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var F5=[be("none-start-event",{actionName:"replace-with-none-start"}),be("none-intermediate-throwing"),be("none-end-event",{actionName:"replace-with-none-end"}),be("message-start"),be("timer-start"),be("conditional-start"),be("signal-start")],j5=[be("none-start-event",{actionName:"replace-with-none-start"}),be("none-intermediate-throwing"),be("none-end-event",{actionName:"replace-with-none-end"})],H5=[be("none-start-event",{actionName:"replace-with-none-start"}),be("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),be("none-end-event",{actionName:"replace-with-none-end"}),be("message-intermediate-catch"),be("message-intermediate-throw"),be("timer-intermediate-catch"),be("escalation-intermediate-throw"),be("conditional-intermediate-catch"),be("link-intermediate-catch"),be("link-intermediate-throw"),be("compensation-intermediate-throw"),be("signal-intermediate-catch"),be("signal-intermediate-throw")],G5=[be("none-start-event",{actionName:"replace-with-none-start"}),be("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),be("none-end-event",{actionName:"replace-with-none-end"}),be("message-end"),be("escalation-end"),be("error-end"),be("cancel-end"),be("compensation-end"),be("signal-end"),be("terminate-end")],z5=[be("exclusive-gateway"),be("parallel-gateway"),be("inclusive-gateway"),be("complex-gateway"),be("event-based-gateway")],V5=[be("transaction"),be("event-subprocess"),be("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),be("collapsed-subprocess")],W5=[be("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),be("transaction"),be("event-subprocess"),be("collapsed-ad-hoc-subprocess")],TS=[be("transaction"),be("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),be("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),be("event-subprocess")],U5=TS,PS=[be("task"),be("user-task"),be("service-task"),be("send-task"),be("receive-task"),be("manual-task"),be("rule-task"),be("script-task"),be("call-activity"),be("collapsed-subprocess"),be("expanded-subprocess"),be("collapsed-ad-hoc-subprocess"),be("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],q5=[be("data-store-reference")],Y5=[be("data-object-reference")],K5=[be("message-boundary"),be("timer-boundary"),be("escalation-boundary"),be("conditional-boundary"),be("error-boundary"),be("cancel-boundary"),be("signal-boundary"),be("compensation-boundary"),be("non-interrupting-message-boundary"),be("non-interrupting-timer-boundary"),be("non-interrupting-escalation-boundary"),be("non-interrupting-conditional-boundary"),be("non-interrupting-signal-boundary")],X5=[be("message-start"),be("timer-start"),be("conditional-start"),be("signal-start"),be("error-start"),be("escalation-start"),be("compensation-start"),be("non-interrupting-message-start"),be("non-interrupting-timer-start"),be("non-interrupting-conditional-start"),be("non-interrupting-signal-start"),be("non-interrupting-escalation-start")],Z5=[{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"}],J5=[be("expanded-pool"),be("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],Q5={"bpmn:MessageEventDefinition":[be("message-start"),be("message-intermediate-catch"),be("message-intermediate-throw"),be("message-end")],"bpmn:TimerEventDefinition":[be("timer-start"),be("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[be("conditional-start"),be("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[be("signal-start"),be("signal-intermediate-catch"),be("signal-intermediate-throw"),be("signal-end")],"bpmn:ErrorEventDefinition":[be("error-start"),be("error-end")],"bpmn:EscalationEventDefinition":[be("escalation-start"),be("escalation-intermediate-throw"),be("escalation-end")],"bpmn:CompensateEventDefinition":[be("compensation-start"),be("compensation-intermediate-throw"),be("compensation-end")]};const kS={"start-event-non-interrupting":`
317
316
  <svg viewBox="0 0 2048 2048" xmlns="http://www.w3.org/2000/svg">
318
317
  <g transform="translate(0 995.64)">
319
318
  <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 +323,7 @@
324
323
  <circle cx="1024" cy="28.357" r="875" stroke-dasharray="418.310422, 361.2328165" stroke-width="100"/>
325
324
  <circle cx="1024" cy="28.357" r="685" stroke-dasharray="348.31044857,261.23283643" stroke-dashoffset="500" stroke-width="100"/>
326
325
  </g>
327
- </svg>`};function yi(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()}yi.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],yi.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},yi.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],r,o=[];if(Ne(e)||!n.allowed("shape.replace",{element:e}))return{};var a=QD(e);return M(t,"bpmn:DataObjectReference")?this._createEntries(e,cI):M(t,"bpmn:DataStoreReference")&&!M(e.parent,"bpmn:Collaboration")?this._createEntries(e,lI):(M(t,"bpmn:Event")&&!M(t,"bpmn:BoundaryEvent")&&(r=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=hI[r]||[],!kn(t.$parent)&&M(t.$parent,"bpmn:SubProcess")&&(i=nt(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),M(t,"bpmn:StartEvent")&&!M(t.$parent,"bpmn:SubProcess")?(o=nt(eI.concat(i),a),this._createEntries(e,o)):M(t,"bpmn:Participant")?(o=nt(dI,function(c){return st(e)!==c.target.isExpanded}),this._createEntries(e,o)):M(t,"bpmn:StartEvent")&&kn(t.$parent)?(o=nt(pI.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)):M(t,"bpmn:StartEvent")&&!kn(t.$parent)&&M(t.$parent,"bpmn:SubProcess")?(o=nt(tI.concat(i),a),this._createEntries(e,o)):M(t,"bpmn:EndEvent")?(o=nt(iI.concat(i),function(c){var l=c.target;return l.eventDefinitionType=="bpmn:CancelEventDefinition"&&!M(t.$parent,"bpmn:Transaction")?!1:a(c)}),this._createEntries(e,o)):M(t,"bpmn:BoundaryEvent")?(o=nt(uI,function(c){var l=c.target;if(l.eventDefinitionType=="bpmn:CancelEventDefinition"&&!M(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)):M(t,"bpmn:IntermediateCatchEvent")||M(t,"bpmn:IntermediateThrowEvent")?(o=nt(nI.concat(i),a),this._createEntries(e,o)):M(t,"bpmn:Gateway")?(o=nt(rI,a),this._createEntries(e,o)):M(t,"bpmn:Transaction")?(o=nt(lw,a),this._createEntries(e,o)):kn(t)&&st(e)?(o=nt(sI,a),this._createEntries(e,o)):M(t,"bpmn:AdHocSubProcess")&&st(e)?(o=nt(aI,a),this._createEntries(e,o)):M(t,"bpmn:SubProcess")&&st(e)?(o=nt(oI,a),this._createEntries(e,o)):M(t,"bpmn:SubProcess")&&!st(e)?(o=nt(uw,function(c){var l=c.target.type===e.type,u=c.target.isExpanded===!0;return l===u}),this._createEntries(e,o)):M(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,fI):M(t,"bpmn:FlowNode")?(o=nt(uw,a),this._createEntries(e,o)):{})},yi.prototype.getPopupMenuHeaderEntries=function(e){var t={};return M(e,"bpmn:Activity")&&!kn(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),M(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),M(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),ev(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},yi.prototype._createEntries=function(e,t){var n={},i=this;return z(t,function(r){n[r.actionName]=i._createEntry(r,e)}),n},yi.prototype._createSequenceFlowEntries=function(e,t){var n=le(e),i={},r=this._modeling,o=this._moddle,a=this;return z(t,function(s){switch(s.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(M(n.sourceRef,"bpmn:ExclusiveGateway")||M(n.sourceRef,"bpmn:InclusiveGateway")||M(n.sourceRef,"bpmn:ComplexGateway")||M(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&&M(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:M(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e,{conditionExpression:void 0})})}),(M(n.sourceRef,"bpmn:ExclusiveGateway")||M(n.sourceRef,"bpmn:InclusiveGateway")||M(n.sourceRef,"bpmn:ComplexGateway")||M(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},yi.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}},yi.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&&M(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=le(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"}}}},yi.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}}},yi.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}}},yi.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=le(e),i=this,r=tv(e),o=M(e,"bpmn:BoundaryEvent")?pw["intermediate-event-non-interrupting"]:pw["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 mI={__depends__:[$d,_b,Ol],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",yi]};function Ms(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(!(!Qa(d)||!i.isOpen(m))){var b=i.getEntries(m);b.replace&&b.replace.action.click(d,m)}}),n.on("contextPad.close",function(){f.cleanUp()})}Ms.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],Ms.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&U(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,r){t.removeElements(r.slice())}}}}),n},Ms.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return Ne(t)?Zr(e,n=>t.includes(n)):t},Ms.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])&&U(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,w=S.getBoundingClientRect(),P={x:w.left,y:w.bottom+y};return P}function b(g,y,S,w){function P(k,D){var H=i.createShape(U({type:g},w));o.start(k,H,{source:D})}var T=s?function(k,D){var H=i.createShape(U({type:g},w));s.append(D,H)}:P,$=s?function(k,D){return l.create(D,g,w),()=>{l.cleanUp()}}:null;return{group:"model",className:y,title:S,action:{dragstart:P,click:T,hover:$}}}function E(g){return function(y,S){n.splitLane(S,g),t.open(S,!0)}}if(tt(p,["bpmn:Lane","bpmn:Participant"])&&st(e)){var _=Mr(e);U(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")}}}}),_.length<2&&((hn(e)?e.height>=120:e.width>=120)&&U(u,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:E(2)}}}),(hn(e)?e.height>=180:e.width>=180)&&U(u,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:E(3)}}})),U(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 M(p,"bpmn:FlowNode")&&(M(p,"bpmn:EventBasedGateway")?U(u,{"append.receive-task":b("bpmn:ReceiveTask","bpmn-icon-receive-task",c("Append receive task")),"append.message-intermediate-event":b("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",c("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":b("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",c("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":b("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",c("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":b("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",c("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):fw(p,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?U(u,{"append.compensation-activity":b("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!M(p,"bpmn:EndEvent")&&!p.isForCompensation&&!fw(p,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!kn(p)&&U(u,{"append.end-event":b("bpmn:EndEvent","bpmn-icon-end-event-none",c("Append end event")),"append.gateway":b("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",c("Append gateway")),"append.append-task":b("bpmn:Task","bpmn-icon-task",c("Append task")),"append.intermediate-event":b("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",c("Append intermediate/boundary event"))})),a.isEmpty(e,"bpmn-replace")||U(u,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(g,y){var S=U(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})}}}}),M(p,"bpmn:SequenceFlow")&&U(u,{"append.text-annotation":b("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),M(p,"bpmn:MessageFlow")&&U(u,{"append.text-annotation":b("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),tt(p,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&U(u,{"append.text-annotation":b("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}}}),M(p,"bpmn:TextAnnotation")&&U(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:f,dragstart:f}}}),tt(p,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&U(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using data input association"),action:{click:f,dragstart:f}}}),M(p,"bpmn:Group")&&U(u,{"append.text-annotation":b("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&U(u,h()),u};function fw(e,t,n){var i=e.$instanceOf(t),r=!1,o=e.eventDefinitions||[];return z(o,function(a){a.$type===n&&(r=!0)}),i&&r}const gI={__depends__:[qD,cw,Hx,di,Ud,ul,mI],__init__:["contextPadProvider"],contextPadProvider:["type",Ms]};var yI={horizontal:["x","width"],vertical:["y","height"]},dw=5;function pr(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return Ne(i)?i:i?n:[]})}pr.$inject=["modeling","rules"],pr.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},pr.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},pr.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(z(t,function(o){r=o(r,n,i)}),r):e},pr.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=Pi(e,i);return z(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},pr.prototype._setOrientation=function(e){var t=yI[e];this._axis=t[0],this._dimension=t[1]},pr.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)},pr.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+dw,max:t+n-dw}};const vI={__init__:["distributeElements"],distributeElements:["type",pr]};function cu(e){fi.call(this,e)}cu.$inject=["eventBus"],Ee(cu,fi),cu.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=nt(t,function(n){var i=tt(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=wc(t),t.length<3?!1:t})};var hw={horizontal:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
326
+ </svg>`};function Bi(e,t,n,i,o,r,a,s){this._bpmnFactory=e,this._popupMenu=t,this._modeling=n,this._moddle=i,this._bpmnReplace=o,this._rules=r,this._translate=a,this._moddleCopy=s,this._register()}Bi.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],Bi.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Bi.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],o,r=[];if(et(e)||!n.allowed("shape.replace",{element:e}))return{};var a=N5(e);return T(t,"bpmn:DataObjectReference")?this._createEntries(e,q5):T(t,"bpmn:DataStoreReference")&&!T(e.parent,"bpmn:Collaboration")?this._createEntries(e,Y5):(T(t,"bpmn:Event")&&!T(t,"bpmn:BoundaryEvent")&&(o=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=Q5[o]||[],!Kn(t.$parent)&&T(t.$parent,"bpmn:SubProcess")&&(i=gt(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),T(t,"bpmn:StartEvent")&&!T(t.$parent,"bpmn:SubProcess")?(r=gt(F5.concat(i),a),this._createEntries(e,r)):T(t,"bpmn:Participant")?(r=gt(J5,function(c){return xt(e)!==c.target.isExpanded}),this._createEntries(e,r)):T(t,"bpmn:StartEvent")&&Kn(t.$parent)?(r=gt(X5.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,r)):T(t,"bpmn:StartEvent")&&!Kn(t.$parent)&&T(t.$parent,"bpmn:SubProcess")?(r=gt(j5.concat(i),a),this._createEntries(e,r)):T(t,"bpmn:EndEvent")?(r=gt(G5.concat(i),function(c){var l=c.target;return l.eventDefinitionType=="bpmn:CancelEventDefinition"&&!T(t.$parent,"bpmn:Transaction")?!1:a(c)}),this._createEntries(e,r)):T(t,"bpmn:BoundaryEvent")?(r=gt(K5,function(c){var l=c.target;if(l.eventDefinitionType=="bpmn:CancelEventDefinition"&&!T(t.attachedToRef,"bpmn:Transaction"))return!1;var u=l.cancelActivity!==!1,p=t.cancelActivity==u;return a(c)||!a(c)&&!p}),this._createEntries(e,r)):T(t,"bpmn:IntermediateCatchEvent")||T(t,"bpmn:IntermediateThrowEvent")?(r=gt(H5.concat(i),a),this._createEntries(e,r)):T(t,"bpmn:Gateway")?(r=gt(z5,a),this._createEntries(e,r)):T(t,"bpmn:Transaction")?(r=gt(TS,a),this._createEntries(e,r)):Kn(t)&&xt(e)?(r=gt(U5,a),this._createEntries(e,r)):T(t,"bpmn:AdHocSubProcess")&&xt(e)?(r=gt(W5,a),this._createEntries(e,r)):T(t,"bpmn:SubProcess")&&xt(e)?(r=gt(V5,a),this._createEntries(e,r)):T(t,"bpmn:SubProcess")&&!xt(e)?(r=gt(PS,function(c){var l=c.target.type===e.type,u=c.target.isExpanded===!0;return l===u}),this._createEntries(e,r)):T(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,Z5):T(t,"bpmn:FlowNode")?(r=gt(PS,a),this._createEntries(e,r)):{})},Bi.prototype.getPopupMenuHeaderEntries=function(e){var t={};return T(e,"bpmn:Activity")&&!Kn(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),T(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),T(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),nw(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},Bi.prototype._createEntries=function(e,t){var n={},i=this;return K(t,function(o){n[o.actionName]=i._createEntry(o,e)}),n},Bi.prototype._createSequenceFlowEntries=function(e,t){var n=Ee(e),i={},o=this._modeling,r=this._moddle,a=this;return K(t,function(s){switch(s.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(T(n.sourceRef,"bpmn:ExclusiveGateway")||T(n.sourceRef,"bpmn:InclusiveGateway")||T(n.sourceRef,"bpmn:ComplexGateway")||T(n.sourceRef,"bpmn:Activity"))&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){o.updateProperties(e.source,{default:n})})});break;case"replace-with-conditional-flow":!n.conditionExpression&&T(n.sourceRef,"bpmn:Activity")&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){var c=r.create("bpmn:FormalExpression",{body:""});o.updateProperties(e,{conditionExpression:c})})});break;default:T(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){o.updateProperties(e,{conditionExpression:void 0})})}),(T(n.sourceRef,"bpmn:ExclusiveGateway")||T(n.sourceRef,"bpmn:InclusiveGateway")||T(n.sourceRef,"bpmn:ComplexGateway")||T(n.sourceRef,"bpmn:Activity"))&&n.sourceRef.default===n&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){o.updateProperties(e.source,{default:void 0})})})}}),i},Bi.prototype._createEntry=function(e,t,n){var i=this._translate,o=this._bpmnReplace.replaceElement,r=function(){return o(t,e.target)},a=e.label;return a&&typeof a=="function"&&(a=a(t)),n=n||r,{label:i(a),className:e.className,action:n}},Bi.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&&T(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 o=Ee(e),r=o.loopCharacteristics,a,s,c;return r&&(a=r.isSequential,s=r.isSequential===void 0,c=r.isSequential!==void 0&&!r.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"}}}},Bi.prototype._getCollectionHeaderEntries=function(e){var t=this,n=this._translate,i=e.businessObject.dataObjectRef;if(!i)return{};function o(a,s){t._modeling.updateModdleProperties(e,i,{isCollection:!s.active})}var r=i.isCollection;return{"toggle-is-collection":{className:"bpmn-icon-parallel-mi-marker",title:n("Collection"),active:r,action:o}}},Bi.prototype._getParticipantMultiplicityHeaderEntries=function(e){var t=this,n=this._bpmnFactory,i=this._translate;function o(a,s){var c=s.active,l;c||(l=n.create("bpmn:ParticipantMultiplicity")),t._modeling.updateProperties(e,{participantMultiplicity:l})}var r=e.businessObject.participantMultiplicity;return{"toggle-participant-multiplicity":{className:"bpmn-icon-parallel-mi-marker",title:i("Participant multiplicity"),active:!!r,action:o}}},Bi.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=Ee(e),i=this,o=iw(e),r=T(e,"bpmn:BoundaryEvent")?kS["intermediate-event-non-interrupting"]:kS["start-event-non-interrupting"],a=!n[o];return{"toggle-non-interrupting":{imageHtml:r,title:t("Toggle non-interrupting"),active:a,action:function(){i._modeling.updateProperties(e,{[o]:!!a})}}}};const e3={__depends__:[Ig,E_,zu],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Bi]};function Pc(e,t,n,i,o,r,a,s,c,l,u,p,d){e=e||{},i.registerProvider(this),this._contextPad=i,this._modeling=o,this._elementFactory=r,this._connect=a,this._create=s,this._popupMenu=c,this._canvas=l,this._rules=u,this._translate=p,this._eventBus=n,this._appendPreview=d,e.autoPlace!==!1&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,function(f){var m=f.context,h=m.shape;if(!(!tc(f)||!i.isOpen(h))){var y=i.getEntries(h);y.replace&&y.replace.action.click(f,h)}}),n.on("contextPad.close",function(){d.cleanUp()})}Pc.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],Pc.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&te(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,o){t.removeElements(o.slice())}}}}),n},Pc.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return et(t)?Xo(e,n=>t.includes(n)):t},Pc.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,i=this._elementFactory,o=this._connect,r=this._create,a=this._popupMenu,s=this._autoPlace,c=this._translate,l=this._appendPreview,u={};if(e.type==="label")return this._isDeleteAllowed([e])&&te(u,m()),u;var p=e.businessObject;function d(v,b){o.start(v,b)}function f(v,b){n.removeElements([b])}function m(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:f}}}}function h(v){var b=5,S=t.getPad(v).html,M=S.getBoundingClientRect(),B={x:M.left,y:M.bottom+b};return B}function y(v,b,S,M){function B(H,V){var G=i.createShape(te({type:v},M));r.start(H,G,{source:V})}var A=s?function(H,V){var G=i.createShape(te({type:v},M));s.append(V,G)}:B,I=s?function(H,V){return l.create(V,v,M),()=>{l.cleanUp()}}:null;return{group:"model",className:b,title:S,action:{dragstart:B,click:A,hover:I}}}function w(v){return function(b,S){n.splitLane(S,v),t.open(S,!0)}}if(ht(p,["bpmn:Lane","bpmn:Participant"])&&xt(e)){var g=mr(e);te(u,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add lane above"),action:{click:function(v,b){n.addLane(b,"top")}}}}),g.length<2&&((Tn(e)?e.height>=120:e.width>=120)&&te(u,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:w(2)}}}),(Tn(e)?e.height>=180:e.width>=180)&&te(u,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:w(3)}}})),te(u,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add lane below"),action:{click:function(v,b){n.addLane(b,"bottom")}}}})}return T(p,"bpmn:FlowNode")&&(T(p,"bpmn:EventBasedGateway")?te(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"})}):OS(p,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?te(u,{"append.compensation-activity":y("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!T(p,"bpmn:EndEvent")&&!p.isForCompensation&&!OS(p,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!Kn(p)&&te(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")||te(u,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(v,b){var S=te(h(b),{cursor:{x:v.x,y:v.y}});a.open(b,"bpmn-replace",S,{title:c("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),T(p,"bpmn:SequenceFlow")&&te(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),T(p,"bpmn:MessageFlow")&&te(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),ht(p,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&te(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:d,dragstart:d}}}),T(p,"bpmn:TextAnnotation")&&te(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:d,dragstart:d}}}),ht(p,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&te(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using data input association"),action:{click:d,dragstart:d}}}),T(p,"bpmn:Group")&&te(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&te(u,m()),u};function OS(e,t,n){var i=e.$instanceOf(t),o=!1,r=e.eventDefinitions||[];return K(r,function(a){a.$type===n&&(o=!0)}),i&&o}const t3={__depends__:[D5,AS,sE,Oi,zg,wu,e3],__init__:["contextPadProvider"],contextPadProvider:["type",Pc]};var n3={horizontal:["x","width"],vertical:["y","height"]},DS=5;function Uo(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return et(i)?i:i?n:[]})}Uo.$inject=["modeling","rules"],Uo.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},Uo.prototype.trigger=function(e,t){var n=this._modeling,i,o;if(!(e.length<3)&&(this._setOrientation(t),o=this._filterElements(e),i=this._createGroups(o),!(i.length<=2)))return n.distributeElements(i,this._axis,this._dimension),i},Uo.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,o=[].concat(e);return t.length?(K(t,function(r){o=r(o,n,i)}),o):e},Uo.prototype._createGroups=function(e){var t=[],n=this,i=this._axis,o=this._dimension;if(!i)throw new Error('must have a defined "axis" and "dimension"');var r=io(e,i);return K(r,function(a,s){var c=n._findRange(a,i,o),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},Uo.prototype._setOrientation=function(e){var t=n3[e];this._axis=t[0],this._dimension=t[1]},Uo.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)},Uo.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+DS,max:t+n-DS}};const i3={__init__:["distributeElements"],distributeElements:["type",Uo]};function Sp(e){ki.call(this,e)}Sp.$inject=["eventBus"],je(Sp,ki),Sp.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=gt(t,function(n){var i=ht(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=Dl(t),t.length<3?!1:t})};var LS={horizontal:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
328
327
  <polyline points="450 400 450 150 1350 150 1350 400" style="fill:none;stroke:currentColor;stroke-width:100;stroke-linejoin:round;"/>
329
328
  <rect x="150" y="450" width="600" height="1200" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
330
329
  <rect x="1050" y="450" width="600" height="800" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
@@ -332,7 +331,7 @@
332
331
  <polyline points="400 1350 150 1350 150 450 400 450" style="fill:none;stroke:currentColor;stroke-width:100;stroke-linejoin:round;"/>
333
332
  <rect x="450" y="150" width="1200" height="600" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
334
333
  <rect x="450" y="1050" width="800" height="600" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
335
- </svg>`},bI=900;function As(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",bI,this)}As.$inject=["popupMenu","distributeElements","translate","rules"],As.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&U(t,this._getEntries(e)),t},As.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},As.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:hw.horizontal,action:function(o,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:hw.vertical,action:function(o,a){t.trigger(e,"vertical"),i.close()}}};return r};const xI={__depends__:[$d,vI],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",cu],distributeElementsMenuProvider:["type",As]};var mw="is not a registered action",_I="is already registered";function vi(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}vi.$inject=["eventBus","injector"],vi.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=Ne(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&&(Ne(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)})},vi.prototype.trigger=function(e,t){if(!this._actions[e])throw qd(e,mw);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},vi.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);z(e,function(i,r){n._registerAction(r,i)})},vi.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw qd(e,_I);this._actions[e]=t},vi.prototype.unregister=function(e){if(!this.isRegistered(e))throw qd(e,mw);this._actions[e]=void 0},vi.prototype.getActions=function(){return Object.keys(this._actions)},vi.prototype.isRegistered=function(e){return!!this._actions[e]};function qd(e,t){return new Error(e+" "+t)}const wI={__init__:["editorActions"],editorActions:["type",vi]};function lu(e){e.invoke(vi,this)}Ee(lu,vi),lu.$inject=["injector"],lu.prototype._registerDefaultActions=function(e){vi.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(b){return b!==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(),b=h.type;m.length&&c.trigger(m,b)}),i&&l&&this._registerAction("alignElements",function(h){var m=i.get(),b=[],E=h.type;m.length&&(b=nt(m,function(_){return!M(_,"bpmn:Lane")}),l.trigger(b,E))}),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,b;M(h,"bpmn:Collaboration")?b=n.filter(function(E){return M(E.parent,"bpmn:Collaboration")}):b=n.filter(function(E){return E!==h&&!M(E.parent,"bpmn:SubProcess")}),m=Zt(b),f.moveElements(b,{x:-m.x,y:-m.y},h)}),i&&d&&this._registerAction("replaceElement",function(h){d.triggerEntry("replace","click",h)})};const EI={__depends__:[wI],editorActions:["type",lu]};function gw(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;tt(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}gw.$inject=["eventBus"];function bo(e,t){se.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;jn(a)?r.newBounds=n.snapComplex(c,a):r.newBounds=n.snapSimple(s,c)}})}bo.$inject=["eventBus","gridSnapping","modeling"],Ee(bo,se),bo.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},bo.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},bo.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),U(e,o),e},bo.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),U(e,o),e};var SI=2e3;function yw(e,t){e.on(["spaceTool.move","spaceTool.end"],SI,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)}})}yw.$inject=["eventBus","gridSnapping"];const RI={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",bo],gridSnappingSpaceToolBehavior:["type",yw]};var uu=10;function Kd(e,t,n){return n||(n="round"),Math[n](e/t)*t}var CI=1200,MI=800;function jr(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var r=this;t.on("diagram.init",MI,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"],CI,function(o){var a=o.originalEvent;if(!(!r.active||a&&Un(a))){var s=o.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(l){var u={},p=PI(o,l,e);p&&(u.offset=p);var f=AI(o,l);f&&U(u,f),ya(o,l)||r.snapEvent(o,l,u)})}})}jr.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);tn(e,t,i)},jr.prototype.getGridSpacing=function(){return uu},jr.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=Kd(e,uu);var i,r;return t&&t.min&&(i=t.min,ze(i)&&(i=Kd(i+n,uu,"ceil"),e=Math.max(e,i))),t&&t.max&&(r=t.max,ze(r)&&(r=Kd(r+n,uu,"floor"),e=Math.min(e,r))),e-=n,e},jr.prototype.isActive=function(){return this.active},jr.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},jr.prototype.toggleActive=function(){this.setActive(!this.active)},jr.$inject=["elementRegistry","eventBus","config.gridSnapping"];function AI(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&&(pu(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&&(pu(t)?bw(s)?a.x.max=c.left:a.x.min=c.right:vw(s)?a.y.max=c.top:a.y.min=c.bottom),l&&(pu(t)?bw(s)?a.x.min=l.left:a.x.max=l.right:vw(s)?a.y.min=l.top:a.y.max=l.bottom),a[t]}function PI(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)||(pu(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 pu(e){return e==="x"}function vw(e){return e.indexOf("n")!==-1}function bw(e){return e.indexOf("w")!==-1}const TI={__depends__:[RI],__init__:["gridSnapping"],gridSnapping:["type",jr]};var kI=2e3;function xw(e,t,n){e.on("autoPlace",kI,function(i){var r=i.source,o=$e(r),a=i.shape,s=dx(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],M(a,"bpmn:TextAnnotation")&&(OI(c)?l.offset=-a.width/2:l.offset=-a.height/2),s[c]=t.snapValue(s[c],l))}),s})}xw.$inject=["eventBus","gridSnapping","elementRegistry"];function OI(e){return e==="x"}var DI=1750;function _w(e,t,n){t.on(["create.start","shape.move.start"],DI,function(i){var r=i.context,o=r.shape,a=e.getRootElement();if(!(!M(o,"bpmn:Participant")||!M(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}))}})}_w.$inject=["canvas","eventBus","gridSnapping"];var II=3e3;function fu(e,t,n){se.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],II,function(r){var o=r.context,a=o.connection,s=o.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||LI(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}fu.$inject=["eventBus","gridSnapping","modeling"],Ee(fu,se),fu.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=$I(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function LI(e){return e.length>3}function BI(e){return e==="h"}function NI(e){return e==="v"}function $I(e,t,n){var i=Zi(t,n),r={};return BI(i)&&(r.y=e.snapValue(t.y)),NI(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=U({},t,r),n=U({},n,r)),[t,n]}const FI={__depends__:[TI,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",xw],gridSnappingParticipantBehavior:["type",_w],gridSnappingLayoutConnectionBehavior:["type",fu]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",gw]};var jI=30,ww=30;function Ps(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var r=i.element,o=i.gfx;if(M(r,"bpmn:Lane"))return n._createParticipantHit(r,o);if(M(r,"bpmn:Participant"))return st(r)?n._createParticipantHit(r,o):n._createDefaultHit(r,o);if(M(r,"bpmn:SubProcess"))return st(r)?n._createSubProcessHit(r,o):n._createDefaultHit(r,o)})}Ps.$inject=["eventBus","interactionEvents"],Ps.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},Ps.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=hn(e)?{width:jI,height:e.height}:{width:e.width,height:ww};return this._interactionEvents.createBoxHit(t,"all",n),!0},Ps.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:ww}),!0};const HI={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",Ps]};function du(e){e.invoke(ua,this)}Ee(du,ua),du.$inject=["injector"],du.prototype.registerBindings=function(e,t){ua.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 zI={__depends__:[Ed],__init__:["keyboardBindings"],keyboardBindings:["type",du]};var GI={moveSpeed:1,moveSpeedAccelerated:10},VI=1500,Ew="left",Sw="up",Rw="right",Cw="down",WI={ArrowLeft:Ew,Left:Ew,ArrowUp:Sw,Up:Sw,ArrowRight:Rw,Right:Rw,ArrowDown:Cw,Down:Cw},UI={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 Mw(e,t,n,i,r){var o=this;this._config=U({},GI,e||{}),t.addListener(VI,function(a){var s=a.keyEvent,c=WI[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=UI[a](l),p=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});p&&n.moveElements(c,u)}}}Mw.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const YI={__depends__:[Ed,di],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",Mw]};var Aw=10;function Ts(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=DA(u,p,l),c.newBounds=LA(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:Le(u)})}function s(c){var l=c.shape,u=c.canExecute,p=c.newBounds;if(u){if(p=Fg(p),!qI(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)})}Ts.prototype.canResize=function(e){var t=this._rules,n=Si(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},Ts.prototype.activate=function(e,t,n){var i=this._dragging,r,o;if(typeof n=="string"&&(n={direction:n}),r=U({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,Pw(t,o),"resize",{autoActivate:!0,cursor:KI(o),data:{shape:t,context:r}})},Ts.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,r;return i=e.minDimensions||{width:Aw,height:Aw},r=Cy(t,e.childrenBoxPadding),BA(n,t,i,r)},Ts.$inject=["eventBus","rules","modeling","dragging"];function qI(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function Pw(e,t){var n=$e(e),i=Le(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 KI(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 Tw="djs-resizing",kw="resize-not-ok",XI=500;function Ow(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,Tw)),s.width>5&&Se(c,{x:s.x,width:s.width}),s.height>5&&Se(c,{y:s.y,height:s.height}),o.canExecute?ut(c).remove(kw):ut(c).add(kw)}function r(o){var a=o.shape,s=o.frame;s&&an(o.frame),t.removeMarker(a,Tw)}e.on("resize.move",XI,function(o){i(o.context)}),e.on("resize.cleanup",function(o){r(o.context)})}Ow.$inject=["eventBus","canvas","previewSupport"];var hu=-6,mu=8,gu=20,ks="djs-resizer",ZI=["n","w","s","e","nw","ne","se","sw"];function Hr(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&&z(a,Nn(r.addResizer,r))}),e.on("shape.changed",function(o){var a=o.element;n.isSelected(a)&&(r.removeResizers(),r.addResizer(a))})}Hr.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(o){Pr(o)&&i.activate(o,e,n)}Ge.bind(t,"mousedown",r),Ge.bind(t,"touchstart",r)},Hr.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=QI(i),a=De("g");ut(a).add(ks),ut(a).add(ks+"-"+e.id),ut(a).add(ks+"-"+i),Ue(r,a);var s=De("rect");Se(s,{x:-mu/2+o.x,y:-mu/2+o.y,width:mu,height:mu}),ut(s).add(ks+"-visual"),Ue(a,s);var c=De("rect");return Se(c,{x:-gu/2+o.x,y:-gu/2+o.y,width:gu,height:gu}),ut(c).add(ks+"-hit"),Ue(a,c),Ac(a,t,n),a},Hr.prototype.createResizer=function(e,t){var n=Pw(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},Hr.prototype.addResizer=function(e){var t=this;Mt(e)||z(ZI,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},Hr.prototype.removeResizers=function(){var e=this._getResizersParent();bc(e)},Hr.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},Hr.$inject=["eventBus","canvas","selection","resize"];function QI(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-hu:e.indexOf("w")!==-1&&(t.x=hu),e.indexOf("s")!==-1?t.y=-hu:e.indexOf("n")!==-1&&(t.y=hu),t}const Dw={__depends__:[Hi,ir,aa],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Ts],resizePreview:["type",Ow],resizeHandles:["type",Hr]};var JI=2e3;function Os(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"],JI,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||tt(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}Os.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],Os.prototype.activate=function(e){var t=oi(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);U(n,i);var r={},o=n.style||{};return U(o,{backgroundColor:null,border:null}),(tt(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||Iw(e))&&U(r,{centerVertically:!0}),Rr(e)&&(U(r,{resizable:!0,autoResize:!0}),U(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),M(e,"bpmn:TextAnnotation")&&(U(r,{resizable:!0,autoResize:!0}),U(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),U(n,{options:r,style:o}),n}},Os.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(M(e,"bpmn:Lane")||nL(e)){var h=hn(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};U(o,m),U(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(tL(e)){var b=hn(e),E=b?{width:i.width,height:i.height}:{width:i.height,height:i.width,x:r.x-i.height/2,y:r.y-i.width/2};U(o,E),U(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:b?null:"rotate(-90deg)"})}(tt(e,["bpmn:Task","bpmn:CallActivity"])||Iw(e))&&(U(o,{width:i.width,height:i.height}),U(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),eL(e)&&(U(o,{width:i.width,x:i.x}),U(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var _=1,g=i.width+2*_;if(n.labelTarget&&(U(o,{width:g,height:i.height+2*_,x:i.x-_,y:i.y-_}),U(d,{fontSize:l+"px",lineHeight:u})),Rr(n)&&!kc(n)&&!Je(n)){var y=Dp(e),S=t.getAbsoluteBBox({x:y.x,y:y.y,width:0,height:0}),w=l,P=ao.width*a+2*_;U(o,{width:P,height:w+2*_,x:S.x-P/2,y:S.y-w/2-_}),U(d,{fontSize:l+"px",lineHeight:u})}return M(e,"bpmn:TextAnnotation")&&(U(o,{width:i.width+2*_,height:i.height+2*_,x:i.x-_,y:i.y-_,minWidth:30*a,minHeight:10*a}),U(d,{textAlign:"left",paddingTop:Yo*a+"px",paddingBottom:Yo*a+"px",paddingLeft:Yo*a+"px",paddingRight:Yo*a+"px",fontSize:p+"px",lineHeight:f})),{bounds:o,style:d}},Os.prototype.update=function(e,t,n,i){var r,o;M(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}),iL(t)&&(t=null),this._modeling.updateLabel(e,t,r)};function Iw(e){return M(e,"bpmn:SubProcess")&&!st(e)}function eL(e){return M(e,"bpmn:SubProcess")&&st(e)}function tL(e){return M(e,"bpmn:Participant")&&!st(e)}function nL(e){return M(e,"bpmn:Participant")&&st(e)}function iL(e){return!e||!e.trim()}var Lw="djs-element-hidden",Bw="djs-label-hidden";function Nw(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,M(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:rL(o)}),Ue(s,p),Ue(r,s),En(s,o.x,o.y)}M(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,Lw):(M(o,"bpmn:Task")||M(o,"bpmn:CallActivity")||M(o,"bpmn:SubProcess")||M(o,"bpmn:Participant")||M(o,"bpmn:Lane"))&&t.addMarker(o,Bw)}),e.on("directEditing.resize",function(c){if(M(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,Lw),t.removeMarker(o,Bw)),o=void 0,a=void 0,s&&(an(s),s=void 0)})}Nw.$inject=["eventBus","canvas","pathMap"];function rL(e,t){var n=dt(e);return n.get("stroke")||t||"black"}const oL={__depends__:[Qf,Dw,cw],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Os],labelEditingPreview:["type",Nw]};var aL=500,sL=1e3;function Vi(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){LC(o)||i.createOutline(o)}e.on("element.hover",function(o){r(o.element)}),e.on("selection.changed",function(o){z(o.newSelection,r)}),e.on(["shape.changed","connection.changed"],aL,function(o){var a=o.element,s=o.gfx,c=Rt(".djs-outline",s);c&&i.updateOutline(a,c)})}Vi.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=Rt(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),Ue(t,n),this.updateOutline(e,n)),n},Vi.prototype._createOutlineGfx=function(){var e=De("rect");return Se(e,U({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},Vi.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},Vi.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&z(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})},Vi.prototype.updateConnectionOutline=function(e,t){var n=Zt(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})},Vi.prototype.registerProvider=function(e,t){t||(t=e,e=sL),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},Vi.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Vi.prototype.getOutline=function(e){var t,n=this._getProviders();return z(n,function(i){fn(i.getOutline)&&(t=t||i.getOutline(e))}),t},Vi.$inject=["eventBus","styles","elementRegistry"];var yu=6;function Xd(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)})}Xd.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");bc(t);var n=e.length>1,i=this._canvas.getContainer();if(ut(i)[n?"add":"remove"]("djs-multi-select"),!!n){var r=cL(Zt(e)),o=De("rect");Se(o,U({rx:3},r)),ut(o).add("djs-selection-outline"),Ue(t,o)}},Xd.$inject=["eventBus","canvas","selection"];function cL(e){return{x:e.x-yu,y:e.y-yu,width:e.width+yu*2,height:e.height+yu*2}}const Zd={__depends__:[di],__init__:["outline","multiSelectionOutline"],outline:["type",Vi],multiSelectionOutline:["type",Xd]},$w=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],Fw={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},lL=15,vu=2;function jw(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=>tt(h,$w));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(b=>{var E;return(E=b.labels)==null?void 0:E.includes(h)});h&&m&&a(h,m)}}),e.on("shape.changed",function({element:p}){var f;!tt(p,$w)||!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=La([$e(f),$e(p)],Fw),h=d.getAttribute("d"),b=r.isSelected(p)?c(p):l(p),E=Fa(b,h);if(!E)return;const g=r.isSelected(f)?c(f):l(f),y=Fa(g,h)||$e(f);Ka(y,E)<lL||(Rp(d,[y,E]),Ue(o,d))}function s(){vc(`.${Fw.class}`,o).forEach(an)}function c(p){const f=i.getOutline(p);if(!f)return l(p);if(f.x){const d={x:p.x+zr(f,"x")-vu,y:p.y+zr(f,"y")-vu,width:zr(f,"width")+vu*2,height:zr(f,"height")+vu*2};return Lp(d,zr(f,"rx"))}if(f.cx){const d=zr(f,"r"),h={x:p.x+zr(f,"cx")-d,y:p.y+zr(f,"cy")-d,width:d*2,height:d*2};return ly(h)}}function l(p){return n.getShapePath(p)}function u(p){return r.isSelected(p)}}jw.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function zr(e,t){return parseFloat(Se(e,t)||0)}const uL={__depends__:[di,Zd],__init__:["labelLink"],labelLink:["type",jw]};var pL=new oa("tt");function fL(e){var t=It('<div class="djs-tooltip-container" />');return In(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function dL(e,t,n){In(e,{left:t+"px",top:n+"px"})}function Qd(e,t){e.style.display=t===!1?"none":""}var Hw="djs-tooltip",Jd="."+Hw;function Fn(e,t){this._eventBus=e,this._canvas=t,this._ids=pL,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=fL(t.getContainer());var n=this;Gn.bind(this._tooltipRoot,Jd,"mousedown",function(i){i.stopPropagation()}),Gn.bind(this._tooltipRoot,Jd,"mouseover",function(i){n.trigger("mouseover",i)}),Gn.bind(this._tooltipRoot,Jd,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}Fn.$inject=["eventBus","canvas"],Fn.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=U({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},Fn.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(Pn(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},Fn.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},Fn.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},Fn.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)}},Fn.prototype.remove=function(e){var t=this.get(e);t&&(Li(t.html),Li(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},Fn.prototype.show=function(){Qd(this._tooltipRoot)},Fn.prototype.hide=function(){Qd(this._tooltipRoot,!1)},Fn.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},Fn.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)),jn(n)&&(n=It(n)),i=It('<div data-tooltip-id="'+t+'" class="'+Hw+'">'),In(i,{position:"absolute"}),i.appendChild(n),e.type&&$t(i).add("djs-tooltip-"+e.type),e.className&&$t(i).add(e.className),e.htmlContainer=i,r.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},Fn.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;dL(n,t.x,t.y)},Fn.prototype._updateTooltipVisibilty=function(e){z(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,r=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(r=!1),Qd(i,r))})},Fn.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 hL={__init__:["tooltips"],tooltips:["type",Fn]};var mL="flow elements must be children of pools/participants",gL="Data object must be placed within a pool/participant.";function zw(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;M(s,"bpmn:Collaboration")&&(M(a,"bpmn:FlowNode")?i(r,n(mL)):M(a,"bpmn:DataObjectReference")&&i(r,n(gL)))})}zw.$inject=["eventBus","tooltips","translate"];const yL={__depends__:[hL],__init__:["modelingFeedback"],modelingFeedback:["type",zw]};var vL=500,bL=1250,xL=1500,bu=Math.round;function _L(e){return{x:e.x+bu(e.width/2),y:e.y+bu(e.height/2)}}function Gw(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",xL,function(s){var c=s.context,l=s.shape,u=i.get().slice();u.indexOf(l)===-1&&(u=[l]),u=wL(u),U(c,{shapes:u,validatedShapes:u,shape:l})}),e.on("shape.move.start",bL,function(s){var c=s.context,l=c.validatedShapes,u;if(u=c.canExecute=o(l),!u)return!1}),e.on("shape.move.move",vL,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=bu(l.x),l.y=bu(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(Pr(s)){var c=ta(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,l,u){if(pn(l)&&(u=l,l=!1),!(c.waypoints||!c.parent)&&!ut(s.target).has("djs-hit-no-move")){var p=_L(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}Gw.$inject=["eventBus","dragging","modeling","selection","rules"];function wL(e){var t=Ao(e,"id");return nt(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var Vw=499,eh="djs-dragging",Ww="drop-ok",Uw="drop-not-ok",Yw="new-parent",qw="attach-ok";function Kw(e,t,n,i){function r(c){var l=o(c),u=EL(l);return u}function o(c){var l=Ba(c),u=l.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),p=l.concat(u),f=[...new Set(p)];return f}function a(c,l){[qw,Ww,Uw,Yw].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,eh),c.allDraggedElements?c.allDraggedElements.push(l):c.allDraggedElements=[l]}e.on("shape.move.start",Vw,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();Ue(h,d),l.dragGroup=d}f.forEach(function(m){i.addDragger(m,l.dragGroup)}),p?p=Du([p,o(u)]):p=o(u),z(p,function(m){t.addMarker(m,eh)}),l.allDraggedElements=p,l.differentParents=SL(u)}),e.on("shape.move.move",Vw,function(c){var l=c.context,u=l.dragGroup,p=l.target,f=l.shape.parent,d=l.canExecute;p&&(d==="attach"?a(p,qw):l.canExecute&&f&&p.id!==f.id?a(p,Yw):a(p,l.canExecute?Ww:Uw)),En(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;z(u,function(f){t.removeMarker(f,eh)}),p&&an(p)}),this.makeDraggable=s}Kw.$inject=["eventBus","canvas","styles","previewSupport"];function EL(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=nt(e,function(i){return Mt(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function SL(e){return IE(Ao(e,function(t){return t.parent&&t.parent.id}))!==1}const RL={__depends__:[cl,di,Zd,Hi,ir,aa],__init__:["move","movePreview"],move:["type",Gw],movePreview:["type",Kw]};var Xw=".djs-palette-toggle",Zw=".entry",CL=Xw+", "+Zw,th="djs-palette-",ML="shown",nh="open",Qw="two-column",AL=1e3;function nn(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()})}nn.$inject=["eventBus","canvas"],nn.prototype.registerProvider=function(e,t){t||(t=e,e=AL),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},nn.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(TL,{})},nn.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},nn.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=It(nn.HTML_MARKUP);n.appendChild(i),$t(n).add(th+ML),Gn.bind(i,CL,"click",function(r){var o=r.delegateTarget;if(gp(o,Xw))return e.toggle();e.trigger("click",r)}),Ge.bind(i,"mousedown",function(r){r.stopPropagation()}),Gn.bind(i,Zw,"dragstart",function(r){e.trigger("dragstart",r)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},nn.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},nn.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,r,o=$t(n),a=$t(t);"twoColumn"in e?r=e.twoColumn:r=this._needsCollapse(t.clientHeight,this._entries||{}),o.toggle(Qw,r),a.toggle(th+Qw,r),"open"in e&&(o.toggle(nh,e.open),a.toggle(th+nh,e.open)),i.fire("palette.changed",{twoColumn:r,open:this.isOpen()})},nn.prototype._update=function(){var e=Rt(".djs-palette-entries",this._container),t=this._entries=this.getEntries();gc(e),z(t,function(n,i){var r=n.group||"default",o=Rt("[data-group="+ys(r)+"]",e);o||(o=It('<div class="group"></div>'),Pn(o,"data-group",r),e.appendChild(o));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=It(a);if(o.appendChild(s),!n.separator&&(Pn(s,"data-action",i),n.title&&Pn(s,"title",n.title),n.className&&PL(s,n.className),n.imageUrl)){var c=It("<img>");Pn(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},nn.prototype.trigger=function(e,t,n){var i,r,o=t.delegateTarget||t.target;return o?(i=Pn(o,"data-action"),r=t.originalEvent||t,this.triggerEntry(i,e,r,n)):t.preventDefault()},nn.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(fn(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},nn.prototype._layoutChanged=function(){this._toggleState({})},nn.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},nn.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},nn.prototype.open=function(){this._toggleState({open:!0})},nn.prototype.toggle=function(){this.isOpen()?this.close():this.open()},nn.prototype.isActiveTool=function(e){return e&&this._activeTool===e},nn.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=Rt(".djs-palette-entries",this._container),this._toolsContainer=Rt("[data-group=tools]",t)),n=this._toolsContainer,z(n.children,function(i){var r=i.getAttribute("data-action");if(r){var o=$t(i);r=r.replace("-tool",""),o.contains("entry")&&r===e?o.add("highlighted-entry"):o.remove("highlighted-entry")}})},nn.prototype.isOpen=function(){return $t(this._container).has(nh)},nn.prototype._getParentContainer=function(){return this._canvas.getContainer()},nn.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function PL(e,t){var n=$t(e),i=Ne(t)?t:t.split(/\s+/g);i.forEach(function(r){n.add(r)})}function TL(e,t){var n=t.getPaletteEntries();return fn(n)?n(e):(z(n,function(i,r){e[r]=i}),e)}const kL={__init__:["palette"],palette:["type",nn]};var Jw="crosshair",e0="selected",OL="djs-dragging-active-lasso";function Gr(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}),Ue(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 b of m)h.has(b)||t.removeMarker(b,e0);for(const b of h)m.has(b)||t.addMarker(b,e0)}},remove:function(p){this.update(p),p.frame&&an(p.frame),l(!1)}};function l(p){ut(t.getContainer()).toggle(OL,p)}function u(p){var f=i.getAll();return new Set(Mo(zo(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=t0(p),f.add=tl(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=t0(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(tl(p))return s.activateLasso(p.originalEvent),!0})}Gr.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],Gr.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:Jw,data:{context:{}},keepSelection:!0})},Gr.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:Jw,data:{context:{}},keepSelection:!0})},Gr.prototype._select=function(e){this._selection.select(e)},Gr.prototype.select=function(e,t,n=[]){var i=Mo(zo(e,t));this._select([...n,...i])},Gr.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Gr.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function t0(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 DL={__depends__:[fl,ts],__init__:["lassoTool"],lassoTool:["type",Gr]};var ih=1500,n0="grab";function va(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",ih,function(c){if(Qa(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(ih,function(c){if(!(!i0(c.keyEvent)||a.isActive())){var l=a._mouse.getLastMoveEvent();a.activateMove(l,!!l)}},"keyboard.keydown"),s&&s.addListener(ih,function(c){!i0(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!Qa(c)&&u&&e.once("hand.move.ended",function(p){a.activateHand(p.originalEvent,!0,!0)}),!1})}va.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],va.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:n0,data:{context:n||{}}})},va.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:n0,data:{context:{reactivate:n}}})},va.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},va.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function i0(e){return sn("Space",e)}const IL={__depends__:[fl,ts],__init__:["handTool"],handTool:["type",va]};var r0="connect-ok",o0="connect-not-ok";function ba(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:o0))}),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:o0)}),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})}ba.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],ba.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},ba.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},ba.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},ba.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const LL={__depends__:[Ud,Hi,ir,fl,ts],globalConnect:["type",ba]};function rh(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)}rh.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],rh.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 b(E){var _=n.createShape(U({type:p},m));t.start(E,_)}return{group:f,className:d,title:h,action:{dragstart:b,click:b}}}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 U(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 BL={__depends__:[kL,ul,Mb,DL,IL,LL,Wa],__init__:["paletteProvider"],paletteProvider:["type",rh]};var NL=250;function oh(e,t,n,i,r){se.call(this,e);function o(s){var c=s.canExecute.replacements;z(c,function(l){var u=l.oldElementId,p={type:l.newElementType};if(!s.visualReplacements[u]){var f=t.get(u);U(p,{x:f.x,y:f.y});var d=n.createShape(p);i.addShape(d,f.parent);var h=Rt('[data-element-id="'+ys(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;z(c,function(l,u){var p=Rt('[data-element-id="'+ys(u)+'"]',s.dragGroup);p&&Se(p,{display:"inline"}),l.remove(),c[u]&&delete c[u]})}e.on("shape.move.move",NL,function(s){var c=s.context,l=c.canExecute;c.visualReplacements||(c.visualReplacements={}),l&&l.replacements?o(c):a(c)})}oh.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],Ee(oh,se);const $L={__depends__:[aa],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",oh]};var FL=1250,ah=40,jL=20,HL=10,a0=20,s0=["x","y"],zL=Math.abs;function c0(e){e.on(["connect.hover","connect.move","connect.end"],FL,function(t){var n=t.context,i=n.canExecute,r=n.start,o=n.hover,a=n.source,s=n.target;t.originalEvent&&Un(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&o&&GL(t,o,YL(o)),o&&UL(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=gi(r),tt(o,["bpmn:Event","bpmn:Gateway"])&&l0(t,gi(o)),tt(o,["bpmn:Task","bpmn:SubProcess"])&&VL(t,o),M(a,"bpmn:BoundaryEvent")&&s===a.host&&WL(t)):u0(i,"bpmn:MessageFlow")?(M(r,"bpmn:Event")&&(n.connectionStart=gi(r)),M(o,"bpmn:Event")&&l0(t,gi(o))):n.connectionStart=n.initialConnectionStart)})}c0.$inject=["eventBus"];function GL(e,t,n){s0.forEach(function(i){var r=p0(i,t);e[i]<t[i]+n?tn(e,i,t[i]+n):e[i]>t[i]+r-n&&tn(e,i,t[i]+r-n)})}function VL(e,t){var n=gi(t);s0.forEach(function(i){qL(e,t,i)&&tn(e,i,n[i])})}function WL(e){var t=e.context,n=t.source,i=t.target;if(!KL(t)){var r=gi(n),o=wn(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;zL(c-r[s])<ah&&(c>r[s]?l=r[s]+ah:l=r[s]-ah,tn(e,s,l))})}}function l0(e,t){tn(e,"x",t.x),tn(e,"y",t.y)}function u0(e,t){return e&&e.type===t}function UL(e,t){return hr(t,function(n){return u0(e,n)})}function p0(e,t){return e==="x"?t.width:t.height}function YL(e){return M(e,"bpmn:Task")?HL:jL}function qL(e,t,n){return e[n]>t[n]+a0&&e[n]<t[n]+p0(n,t)-a0}function KL(e){var t=e.hover,n=e.source;return t&&n&&t===n}function Vr(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}Vr.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},Vr.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},Vr.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},Vr.prototype.getSnapLocations=function(){return this._snapLocations},Vr.prototype.setSnapLocations=function(e){this._snapLocations=e},Vr.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new xu,n.initDefaults(this._defaultSnaps)),n};function xu(){this._snapValues={}}xu.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)},xu.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&ND(e[n],r[n],i)},xu.prototype.initDefaults=function(e){var t=this;z(e||{},function(n,i){z(n,function(r){t.add(i,r)})})};var XL=1250;function Wi(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"],XL,function(r){var o=r.context,a=o.shape,s=o.snapContext,c=o.target;if(!(r.originalEvent&&Un(r.originalEvent))&&!(ya(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()})}Wi.$inject=["elementRegistry","eventBus","snapping"],Wi.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,r=n.snapContext;r||(r=n.snapContext=new Vr);var o;t.get(i.id)?o=gi(i,e):o={x:e.x+gi(i).x,y:e.y+gi(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},Wi.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return z(i,function(r){if(Je(r)){Je(t)&&e.add("mid",gi(r));return}if(Mt(r)){if(r.waypoints.length<3)return;var o=r.waypoints.slice(1,-1);z(o,function(a){e.add("mid",a)});return}e.add("mid",gi(r))}),!ze(t.x)||!ze(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",gi(t)),e},Wi.prototype.getSnapTargets=function(e,t){return Z_(t).filter(function(n){return!ZL(n)})};function ZL(e){return!!e.hidden}var f0=1500;function xa(e,t){t.invoke(Wi,this),e.on(["create.move","create.end"],f0,tB),e.on(["create.move","create.end","shape.move.move","shape.move.end"],f0,function(n){var i=n.context,r=i.canExecute,o=i.target,a=r&&(r==="attach"||r.attach);a&&!ya(n)&&QL(n,o)})}Ee(xa,Wi),xa.$inject=["eventBus","injector"],xa.prototype.initSnap=function(e){var t=Wi.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return z(n.outgoing,function(r){var o=r.waypoints[0];o=o.original||o,t.setSnapOrigin(r.id+"-docking",h0(o,i,e))}),z(n.incoming,function(r){var o=r.waypoints[r.waypoints.length-1];o=o.original||o,t.setSnapOrigin(r.id+"-docking",h0(o,i,e))}),M(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},xa.prototype.addSnapTargetPoints=function(e,t,n){Wi.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);z(i,function(o){(eB(o)||JL([t,o],"bpmn:TextAnnotation"))&&(e.add("top-left",K_(o)),e.add("bottom-right",X_(o)))});var r=this._elementRegistry;return z(t.incoming,function(o){if(r.get(t.id)){d0(i,o.source)||e.add("mid",$e(o.source));var a=o.waypoints[0];e.add(o.id+"-docking",a.original||a)}}),z(t.outgoing,function(o){if(r.get(t.id)){d0(i,o.target)||e.add("mid",$e(o.target));var a=o.waypoints[o.waypoints.length-1];e.add(o.id+"-docking",a.original||a)}}),M(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},xa.prototype.getSnapTargets=function(e,t){return Wi.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!M(n,"bpmn:Lane")})};function QL(e,t){var n=Le(t),i=Ev(e,t),r=e.context,o=r.shape,a;o.parent?a={x:0,y:0}:a=$e(o),/top/.test(i)?tn(e,"y",n.top-a.y):/bottom/.test(i)&&tn(e,"y",n.bottom-a.y),/left/.test(i)?tn(e,"x",n.left-a.x):/right/.test(i)&&tn(e,"x",n.right-a.x)}function JL(e,t){return e.every(function(n){return M(n,t)})}function eB(e){return M(e,"bpmn:SubProcess")&&st(e)?!0:M(e,"bpmn:Participant")}function tB(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)&&tn(e,"x",e.x),(i&&i>=e.y||o&&o<=e.y)&&tn(e,"y",e.y)}}function d0(e,t){return e.indexOf(t)!==-1}function h0(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var nB=1250;function Ds(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],nB,function(i){var r=i.context,o=r.shape,a=o.parent,s=r.direction,c=r.snapContext;if(!(i.originalEvent&&Un(i.originalEvent))&&!ya(i)){var l=c.pointsForTarget(a);l.initialized||(l=n.addSnapTargetPoints(l,o,a,s),l.initialized=!0),oB(s)&&tn(i,"x",i.x),aB(s)&&tn(i,"y",i.y),t.snap(i,l)}}),e.on(["resize.cleanup"],function(){t.hide()})}Ds.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new Vr);var o=m0(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},Ds.prototype.addSnapTargetPoints=function(e,t,n,i){var r=this.getSnapTargets(t,n);return z(r,function(o){e.add("corner",X_(o)),e.add("corner",K_(o))}),e.add("corner",m0(t,i)),e},Ds.$inject=["eventBus","snapping"],Ds.prototype.getSnapTargets=function(e,t){return Z_(t).filter(function(n){return!iB(n,e)&&!Mt(n)&&!rB(n)&&!Je(n)})};function m0(e,t){var n=$e(e),i=Le(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 iB(e,t){return e.host===t}function rB(e){return!!e.hidden}function oB(e){return e==="n"||e==="s"}function aB(e){return e==="e"||e==="w"}var sB=7,cB=1e3;function Wr(e){this._canvas=e,this._asyncHide=Lu(Nn(this.hide,this),cB)}Wr.$inject=["canvas"],Wr.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,r=i.getSnapLocations(),o={x:ya(e,"x"),y:ya(e,"y")};z(r,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(z(["x","y"],function(l){var u;o[l]||(u=t.snap(c,a,l,sB),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),z(["x","y"],function(a){var s=o[a];pn(s)&&tn(e,a,s.originValue)})},Wr.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=De("path");return Se(n,{d:"M0,0 L0,0"}),ut(n).add("djs-snap-line"),Ue(t,n),{update:function(i){ze(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"})}}},Wr.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},Wr.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},Wr.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},Wr.prototype.hide=function(){z(this._snapLines,function(e){e.update()})};const lB={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",Wi],resizeSnapping:["type",Ds],snapping:["type",Wr]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",c0],createMoveSnapping:["type",xa]};var g0=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=Rt(Ye.INPUT_SELECTOR,this._container),this._resultsContainer=Rt(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:Gn.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){sn("ArrowUp",n)&&n.preventDefault(),sn("ArrowDown",n)&&n.preventDefault()}),t(this._container,Ye.INPUT_SELECTOR,"keyup",function(n){if(sn("Escape",n))return e.close();if(sn("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(sn("ArrowUp",n))return e._scrollToDirection(!0);if(sn("ArrowDown",n))return e._scrollToDirection();sn(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},Ye.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){Gn.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=Rt(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(){gc(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},Ye.prototype._getCurrentResult=function(){return Rt(Ye.RESULT_SELECTED_SELECTOR,this._resultsContainer)},Ye.prototype._createResultNode=function(e,t){var n=It(Ye.RESULT_HTML);return e.primaryTokens.length>0&&y0(n,e.primaryTokens,Ye.RESULT_PRIMARY_HTML),y0(n,e.secondaryTokens,Ye.RESULT_SECONDARY_HTML),Pn(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,$t(this._canvas.getContainer()).add("djs-search-open"),$t(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,$t(this._canvas.getContainer()).remove("djs-search-open"),$t(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&&$t(t).remove(Ye.RESULT_SELECTED_CLASS);var n=Pn(e,Ye.RESULT_ID_ATTRIBUTE),i=this._results[n].element;$t(e).add(Ye.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:g0}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},Ye.prototype._select=function(e){var t=Pn(e,Ye.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:g0}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},Ye.prototype._getBoxHtml=function(){const e=It(Ye.BOX_HTML),t=Rt(Ye.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function y0(e,t,n){var i=uB(t),r=It(n);r.innerHTML=i,e.appendChild(r)}function uB(e){var t="";return e.forEach(function(n){var i=Rx(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">
334
+ </svg>`},o3=900;function kc(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",o3,this)}kc.$inject=["popupMenu","distributeElements","translate","rules"],kc.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&te(t,this._getEntries(e)),t},kc.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},kc.prototype._getEntries=function(e){var t=this._distributeElements,n=this._translate,i=this._popupMenu,o={"distribute-elements-horizontal":{group:"distribute",title:n("Distribute elements horizontally"),className:"bjs-align-elements-menu-entry",imageHtml:LS.horizontal,action:function(r,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:LS.vertical,action:function(r,a){t.trigger(e,"vertical"),i.close()}}};return o};const r3={__depends__:[Ig,i3],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",Sp],distributeElementsMenuProvider:["type",kc]};var IS="is not a registered action",a3="is already registered";function Ni(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}Ni.$inject=["eventBus","injector"],Ni.prototype._registerDefaultActions=function(e){var t=e.get("commandStack",!1),n=e.get("modeling",!1),i=e.get("selection",!1),o=e.get("zoomScroll",!1),r=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()})),r&&i&&this.register("copy",function(){var u=i.get();if(u.length)return r.copy(u)}),r&&i&&this.register("duplicate",function(){var u=i.get();if(u.length)return r.duplicate(u)}),r&&this.register("paste",function(){r.paste()}),r&&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 d=et(p)?p:u;return r.cut(d.slice())}}}),o&&this.register("stepZoom",function(u){o.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}),d;p!==!1&&(et(p)?d=p:d=u,d.length&&n.removeElements(d.slice()))}}),c&&this.register("moveCanvas",function(u){c.moveCanvas(u)}),l&&this.register("moveSelection",function(u){l.moveSelection(u.direction,u.accelerated)})},Ni.prototype.trigger=function(e,t){if(!this._actions[e])throw Wg(e,IS);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},Ni.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);K(e,function(i,o){n._registerAction(o,i)})},Ni.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw Wg(e,a3);this._actions[e]=t},Ni.prototype.unregister=function(e){if(!this.isRegistered(e))throw Wg(e,IS);this._actions[e]=void 0},Ni.prototype.getActions=function(){return Object.keys(this._actions)},Ni.prototype.isRegistered=function(e){return!!this._actions[e]};function Wg(e,t){return new Error(e+" "+t)}const s3={__init__:["editorActions"],editorActions:["type",Ni]};function Rp(e){e.invoke(Ni,this)}je(Rp,Ni),Rp.$inject=["injector"],Rp.prototype._registerDefaultActions=function(e){Ni.prototype._registerDefaultActions.call(this,e);var t=e.get("canvas",!1),n=e.get("elementRegistry",!1),i=e.get("selection",!1),o=e.get("spaceTool",!1),r=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),d=e.get("modeling",!1),f=e.get("contextPad",!1);t&&n&&i&&this._registerAction("selectElements",function(){var m=t.getRootElement(),h=n.filter(function(y){return y!==m});return i.select(h),h}),o&&this._registerAction("spaceTool",function(){o.toggle()}),r&&this._registerAction("lassoTool",function(){r.toggle()}),a&&this._registerAction("handTool",function(){a.toggle()}),s&&this._registerAction("globalConnectTool",function(){s.toggle()}),i&&c&&this._registerAction("distributeElements",function(m){var h=i.get(),y=m.type;h.length&&c.trigger(h,y)}),i&&l&&this._registerAction("alignElements",function(m){var h=i.get(),y=[],w=m.type;h.length&&(y=gt(h,function(g){return!T(g,"bpmn:Lane")}),l.trigger(y,w))}),i&&d&&this._registerAction("setColor",function(m){var h=i.get();h.length&&d.setColor(h,m)}),i&&u&&this._registerAction("directEditing",function(){var m=i.get();m.length&&u.activate(m[0])}),p&&this._registerAction("find",function(){p.toggle()}),t&&d&&this._registerAction("moveToOrigin",function(){var m=t.getRootElement(),h,y;T(m,"bpmn:Collaboration")?y=n.filter(function(w){return T(w.parent,"bpmn:Collaboration")}):y=n.filter(function(w){return w!==m&&!T(w.parent,"bpmn:SubProcess")}),h=yn(y),d.moveElements(y,{x:-h.x,y:-h.y},m)}),i&&f&&this._registerAction("replaceElement",function(m){f.triggerEntry("replace","click",m)})};const c3={__depends__:[s3],editorActions:["type",Rp]};function BS(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;ht(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}BS.$inject=["eventBus"];function ua(e,t){we.call(this,e),this._gridSnapping=t;var n=this;this.preExecute("shape.resize",function(i){var o=i.context,r=o.hints||{},a=r.autoResize;if(a){var s=o.shape,c=o.newBounds;ai(a)?o.newBounds=n.snapComplex(c,a):o.newBounds=n.snapSimple(s,c)}})}ua.$inject=["eventBus","gridSnapping","modeling"],je(ua,we),ua.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},ua.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},ua.prototype.snapHorizontally=function(e,t){var n=this._gridSnapping,i=/w/.test(t),o=/e/.test(t),r={};return r.width=n.snapValue(e.width,{min:e.width}),o&&(i?(r.x=n.snapValue(e.x,{max:e.x}),r.width+=n.snapValue(e.x-r.x,{min:e.x-r.x})):e.x=e.x+e.width-r.width),te(e,r),e},ua.prototype.snapVertically=function(e,t){var n=this._gridSnapping,i=/n/.test(t),o=/s/.test(t),r={};return r.height=n.snapValue(e.height,{min:e.height}),i&&(o?(r.y=n.snapValue(e.y,{max:e.y}),r.height+=n.snapValue(e.y-r.y,{min:e.y-r.y})):e.y=e.y+e.height-r.height),te(e,r),e};var l3=2e3;function NS(e,t){e.on(["spaceTool.move","spaceTool.end"],l3,function(n){var i=n.context;if(i.initialized){var o=i.axis,r;o==="x"?(r=t.snapValue(n.dx),n.x=n.x+r-n.dx,n.dx=r):(r=t.snapValue(n.dy),n.y=n.y+r-n.dy,n.dy=r)}})}NS.$inject=["eventBus","gridSnapping"];const u3={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",ua],gridSnappingSpaceToolBehavior:["type",NS]};var Mp=10;function Ug(e,t,n){return n||(n="round"),Math[n](e/t)*t}var p3=1200,d3=800;function Tr(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var o=this;t.on("diagram.init",d3,function(){o.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"],p3,function(r){var a=r.originalEvent;if(!(!o.active||a&&di(a))){var s=r.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(l){var u={},p=h3(r,l,e);p&&(u.offset=p);var d=f3(r,l);d&&te(u,d),cs(r,l)||o.snapEvent(r,l,u)})}})}Tr.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);wn(e,t,i)},Tr.prototype.getGridSpacing=function(){return Mp},Tr.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=Ug(e,Mp);var i,o;return t&&t.min&&(i=t.min,tt(i)&&(i=Ug(i+n,Mp,"ceil"),e=Math.max(e,i))),t&&t.max&&(o=t.max,tt(o)&&(o=Ug(o+n,Mp,"floor"),e=Math.min(e,o))),e-=n,e},Tr.prototype.isActive=function(){return this.active},Tr.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},Tr.prototype.toggleActive=function(){this.setActive(!this.active)},Tr.$inject=["elementRegistry","eventBus","config.gridSnapping"];function f3(e,t){var n=e.context,i=n.createConstraints,o=n.resizeConstraints||{},r=n.gridSnappingContext,a=r.snapConstraints;if(a&&a[t])return a[t];a||(a=r.snapConstraints={}),a[t]||(a[t]={});var s=n.direction;i&&(Cp(t)?(a.x.min=i.left,a.x.max=i.right):(a.y.min=i.top,a.y.max=i.bottom));var c=o.min,l=o.max;return c&&(Cp(t)?FS(s)?a.x.max=c.left:a.x.min=c.right:$S(s)?a.y.max=c.top:a.y.min=c.bottom),l&&(Cp(t)?FS(s)?a.x.min=l.left:a.x.max=l.right:$S(s)?a.y.min=l.top:a.y.max=l.bottom),a[t]}function h3(e,t,n){var i=e.context,o=e.shape,r=i.gridSnappingContext,a=r.snapLocation,s=r.snapOffset;return s&&tt(s[t])||(s||(s=r.snapOffset={}),tt(s[t])||(s[t]=0),!o)||(n.get(o.id)||(Cp(t)?s[t]+=o[t]+o.width/2:s[t]+=o[t]+o.height/2),!a)||(t==="x"?/left/.test(a)?s[t]-=o.width/2:/right/.test(a)&&(s[t]+=o.width/2):/top/.test(a)?s[t]-=o.height/2:/bottom/.test(a)&&(s[t]+=o.height/2)),s[t]}function Cp(e){return e==="x"}function $S(e){return e.indexOf("n")!==-1}function FS(e){return e.indexOf("w")!==-1}const g3={__depends__:[u3],__init__:["gridSnapping"],gridSnapping:["type",Tr]};var m3=1750;function jS(e,t,n){t.on(["create.start","shape.move.start"],m3,function(i){var o=i.context,r=o.shape,a=e.getRootElement();if(!(!T(r,"bpmn:Participant")||!T(a,"bpmn:Process")||!a.children.length)){var s=o.createConstraints;s&&(r.width=n.snapValue(r.width,{min:r.width}),r.height=n.snapValue(r.height,{min:r.height}))}})}jS.$inject=["canvas","eventBus","gridSnapping"];const y3={__depends__:[g3,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",hg],gridSnappingParticipantBehavior:["type",jS],gridSnappingLayoutConnectionBehavior:["type",es]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",BS]};var v3=30,HS=30;function Oc(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var o=i.element,r=i.gfx;if(T(o,"bpmn:Lane"))return n._createParticipantHit(o,r);if(T(o,"bpmn:Participant"))return xt(o)?n._createParticipantHit(o,r):n._createDefaultHit(o,r);if(T(o,"bpmn:SubProcess"))return xt(o)?n._createSubProcessHit(o,r):n._createDefaultHit(o,r)})}Oc.$inject=["eventBus","interactionEvents"],Oc.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},Oc.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=Tn(e)?{width:v3,height:e.height}:{width:e.width,height:HS};return this._interactionEvents.createBoxHit(t,"all",n),!0},Oc.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:HS}),!0};const x3={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",Oc]};function Ap(e){e.invoke(ts,this)}je(Ap,ts),Ap.$inject=["injector"],Ap.prototype.registerBindings=function(e,t){ts.prototype.registerBindings.call(this,e,t);function n(i,o){t.isRegistered(i)&&e.addListener(o)}n("selectElements",function(i){var o=i.keyEvent;if(e.isKey(["a","A"],o)&&e.isCmd(o))return t.trigger("selectElements"),!0}),n("find",function(i){var o=i.keyEvent;if(e.isKey(["f","F"],o)&&e.isCmd(o))return t.trigger("find"),!0}),n("spaceTool",function(i){var o=i.keyEvent;if(!e.hasModifier(o)&&e.isKey(["s","S"],o))return t.trigger("spaceTool"),!0}),n("lassoTool",function(i){var o=i.keyEvent;if(!e.hasModifier(o)&&e.isKey(["l","L"],o))return t.trigger("lassoTool"),!0}),n("handTool",function(i){var o=i.keyEvent;if(!e.hasModifier(o)&&e.isKey(["h","H"],o))return t.trigger("handTool"),!0}),n("globalConnectTool",function(i){var o=i.keyEvent;if(!e.hasModifier(o)&&e.isKey(["c","C"],o))return t.trigger("globalConnectTool"),!0}),n("directEditing",function(i){var o=i.keyEvent;if(!e.hasModifier(o)&&e.isKey(["e","E"],o))return t.trigger("directEditing"),!0}),n("replaceElement",function(i){var o=i.keyEvent;if(!e.hasModifier(o)&&e.isKey(["r","R"],o))return t.trigger("replaceElement",o),!0})};const b3={__depends__:[bg],__init__:["keyboardBindings"],keyboardBindings:["type",Ap]};var w3={moveSpeed:1,moveSpeedAccelerated:10},_3=1500,GS="left",zS="up",VS="right",WS="down",E3={ArrowLeft:GS,Left:GS,ArrowUp:zS,Up:zS,ArrowRight:VS,Right:VS,ArrowDown:WS,Down:WS},S3={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 US(e,t,n,i,o){var r=this;this._config=te({},w3,e||{}),t.addListener(_3,function(a){var s=a.keyEvent,c=E3[s.key];if(c&&!t.isCmd(s)){var l=t.isShift(s);return r.moveSelection(c,l),!0}}),this.moveSelection=function(a,s){var c=o.get();if(c.length){var l=this._config[s?"moveSpeedAccelerated":"moveSpeed"],u=S3[a](l),p=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});p&&n.moveElements(c,u)}}}US.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const R3={__depends__:[bg,Oi],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",US]};var qS=10;function Dc(e,t,n,i){this._dragging=i,this._rules=t;var o=this;function r(c,l){var u=c.shape,p=c.direction,d=c.resizeConstraints,f;c.delta=l,f=VO(u,p,l),c.newBounds=UO(f,d),c.canExecute=o.canResize(c)}function a(c){var l=c.resizeConstraints,u=c.minBounds;l===void 0&&(u===void 0&&(u=o.computeMinResizeBox(c)),c.resizeConstraints={min:Ze(u)})}function s(c){var l=c.shape,u=c.canExecute,p=c.newBounds;if(u){if(p=jx(p),!M3(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};r(c.context,l)}),e.on("resize.end",function(c){s(c.context)})}Dc.prototype.canResize=function(e){var t=this._rules,n=Wi(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},Dc.prototype.activate=function(e,t,n){var i=this._dragging,o,r;if(typeof n=="string"&&(n={direction:n}),o=te({shape:t},n),r=o.direction,!r)throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");i.init(e,YS(t,r),"resize",{autoActivate:!0,cursor:C3(r),data:{shape:t,context:o}})},Dc.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,o;return i=e.minDimensions||{width:qS,height:qS},o=Ab(t,e.childrenBoxPadding),qO(n,t,i,o)},Dc.$inject=["eventBus","rules","modeling","dragging"];function M3(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function YS(e,t){var n=nt(e),i=Ze(e),o={x:n.x,y:n.y};return t.indexOf("n")!==-1?o.y=i.top:t.indexOf("s")!==-1&&(o.y=i.bottom),t.indexOf("e")!==-1?o.x=i.right:t.indexOf("w")!==-1&&(o.x=i.left),o}function C3(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 KS="djs-resizing",XS="resize-not-ok",A3=500;function ZS(e,t,n){function i(r){var a=r.shape,s=r.newBounds,c=r.frame;c||(c=r.frame=n.addFrame(a,t.getActiveLayer()),t.addMarker(a,KS)),s.width>5&&Le(c,{x:s.x,width:s.width}),s.height>5&&Le(c,{y:s.y,height:s.height}),r.canExecute?vt(c).remove(XS):vt(c).add(XS)}function o(r){var a=r.shape,s=r.frame;s&&mn(r.frame),t.removeMarker(a,KS)}e.on("resize.move",A3,function(r){i(r.context)}),e.on("resize.cleanup",function(r){o(r.context)})}ZS.$inject=["eventBus","canvas","previewSupport"];var Tp=-6,Pp=8,kp=20,Lc="djs-resizer",T3=["n","w","s","e","nw","ne","se","sw"];function Pr(e,t,n,i){this._resize=i,this._canvas=t;var o=this;e.on("selection.changed",function(r){var a=r.newSelection;o.removeResizers(),a.length===1&&K(a,ti(o.addResizer,o))}),e.on("shape.changed",function(r){var a=r.element;n.isSelected(a)&&(o.removeResizers(),o.addResizer(a))})}Pr.prototype.makeDraggable=function(e,t,n){var i=this._resize;function o(r){vr(r)&&i.activate(r,e,n)}Ke.bind(t,"mousedown",o),Ke.bind(t,"touchstart",o)},Pr.prototype._createResizer=function(e,t,n,i){var o=this._getResizersParent(),r=P3(i),a=We("g");vt(a).add(Lc),vt(a).add(Lc+"-"+e.id),vt(a).add(Lc+"-"+i),ot(o,a);var s=We("rect");Le(s,{x:-Pp/2+r.x,y:-Pp/2+r.y,width:Pp,height:Pp}),vt(s).add(Lc+"-visual"),ot(a,s);var c=We("rect");return Le(c,{x:-kp/2+r.x,y:-kp/2+r.y,width:kp,height:kp}),vt(c).add(Lc+"-hit"),ot(a,c),Fl(a,t,n),a},Pr.prototype.createResizer=function(e,t){var n=YS(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},Pr.prototype.addResizer=function(e){var t=this;$t(e)||K(T3,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},Pr.prototype.removeResizers=function(){var e=this._getResizersParent();Is(e)},Pr.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},Pr.$inject=["eventBus","canvas","selection","resize"];function P3(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-Tp:e.indexOf("w")!==-1&&(t.x=Tp),e.indexOf("s")!==-1?t.y=-Tp:e.indexOf("n")!==-1&&(t.y=Tp),t}const JS={__depends__:[mo,$o,Xa],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Dc],resizePreview:["type",ZS],resizeHandles:["type",Pr]};var k3=2e3;function Ic(e,t,n,i,o,r,a){this._bpmnFactory=t,this._canvas=n,this._modeling=o,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"],k3,function(c){i.isActive(c.element)&&i.cancel()}),e.on(["commandStack.changed"],function(c){i.isActive()&&i.cancel()}),e.on("directEditing.activate",function(c){r.removeResizers()}),e.on("create.end",500,function(c){var l=c.context,u=l.shape,p=c.context.canExecute,d=c.isTouch;d||p&&(l.hints&&l.hints.createElementsBehavior===!1||s(u))}),e.on("autoPlace.end",500,function(c){s(c.shape)});function s(c,l){(l||ht(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}Ic.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],Ic.prototype.activate=function(e){var t=ii(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);te(n,i);var o={},r=n.style||{};return te(r,{backgroundColor:null,border:null}),(ht(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||QS(e))&&te(o,{centerVertically:!0}),fo(e)&&(te(o,{resizable:!0,autoResize:!0}),te(r,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),T(e,"bpmn:TextAnnotation")&&(te(o,{resizable:!0,autoResize:!0}),te(r,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),te(n,{options:o,style:r}),n}},Ic.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,i=t.getAbsoluteBBox(n),o={x:i.x+i.width/2,y:i.y+i.height/2},r={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,d=s.lineHeight,f={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(T(e,"bpmn:Lane")||L3(e)){var m=Tn(e),h=m?{width:i.height,height:30*a,x:i.x-i.height/2+15*a,y:o.y-30*a/2}:{width:i.width,height:30*a};te(r,h),te(f,{fontSize:p+"px",lineHeight:d,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:m?"rotate(-90deg)":null})}if(D3(e)){var y=Tn(e),w=y?{width:i.width,height:i.height}:{width:i.height,height:i.width,x:o.x-i.height/2,y:o.y-i.width/2};te(r,w),te(f,{fontSize:p+"px",lineHeight:d,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:y?null:"rotate(-90deg)"})}(ht(e,["bpmn:Task","bpmn:CallActivity"])||QS(e))&&(te(r,{width:i.width,height:i.height}),te(f,{fontSize:p+"px",lineHeight:d,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),O3(e)&&(te(r,{width:i.width,x:i.x}),te(f,{fontSize:p+"px",lineHeight:d,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var g=1,v=i.width+2*g;if(n.labelTarget&&(te(r,{width:v,height:i.height+2*g,x:i.x-g,y:i.y-g}),te(f,{fontSize:l+"px",lineHeight:u})),fo(n)&&!Gl(n)&&!ft(n)){var b=Ef(e),S=t.getAbsoluteBBox({x:b.x,y:b.y,width:0,height:0}),M=l,B=Xr.width*a+2*g;te(r,{width:B,height:M+2*g,x:S.x-B/2,y:S.y-M/2-g}),te(f,{fontSize:l+"px",lineHeight:u})}return T(e,"bpmn:TextAnnotation")&&(te(r,{width:i.width+2*g,height:i.height+2*g,x:i.x-g,y:i.y-g,minWidth:30*a,minHeight:10*a}),te(f,{textAlign:"left",paddingTop:$a*a+"px",paddingBottom:$a*a+"px",paddingLeft:$a*a+"px",paddingRight:$a*a+"px",fontSize:p+"px",lineHeight:d})),{bounds:r,style:f}},Ic.prototype.update=function(e,t,n,i){var o,r;T(e,"bpmn:TextAnnotation")&&(r=this._canvas.getAbsoluteBBox(e),o={x:e.x,y:e.y,width:e.width/r.width*i.width,height:e.height/r.height*i.height}),I3(t)&&(t=null),this._modeling.updateLabel(e,t,o)};function QS(e){return T(e,"bpmn:SubProcess")&&!xt(e)}function O3(e){return T(e,"bpmn:SubProcess")&&xt(e)}function D3(e){return T(e,"bpmn:Participant")&&!xt(e)}function L3(e){return T(e,"bpmn:Participant")&&xt(e)}function I3(e){return!e||!e.trim()}var e1="djs-element-hidden",t1="djs-label-hidden";function n1(e,t,n){var i=this,o=t.getDefaultLayer(),r,a,s;e.on("directEditing.activate",function(c){var l=c.active;if(r=l.element.label||l.element,T(r,"bpmn:TextAnnotation")){a=t.getAbsoluteBBox(r),s=We("g");var u=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:r.width,containerHeight:r.height,position:{mx:0,my:0}}),p=i.path=We("path");Le(p,{d:u,strokeWidth:2,stroke:B3(r)}),ot(s,p),ot(o,s),Fn(s,r.x,r.y)}T(r,"bpmn:TextAnnotation")||r.labelTarget?t.addMarker(r,e1):(T(r,"bpmn:Task")||T(r,"bpmn:CallActivity")||T(r,"bpmn:SubProcess")||T(r,"bpmn:Participant")||T(r,"bpmn:Lane"))&&t.addMarker(r,t1)}),e.on("directEditing.resize",function(c){if(T(r,"bpmn:TextAnnotation")){var l=c.height,u=c.dy,p=Math.max(r.height/a.height*(l+u),0),d=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:r.width,containerHeight:p,position:{mx:0,my:0}});Le(i.path,{d})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var l=c.active;l&&(t.removeMarker(l.element.label||l.element,e1),t.removeMarker(r,t1)),r=void 0,a=void 0,s&&(mn(s),s=void 0)})}n1.$inject=["eventBus","canvas","pathMap"];function B3(e,t){var n=wt(e);return n.get("stroke")||t||"black"}const N3={__depends__:[Gh,JS,AS],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Ic],labelEditingPreview:["type",n1]};var $3=500,F3=1e3;function bo(e,t,n){this._eventBus=e,this._elementRegistry=n,this._outlineOffset=5,this._outlineStyle=t.cls("djs-outline",["no-fill"]);var i=this;function o(r){Yk(r)||i.createOutline(r)}e.on("element.hover",function(r){o(r.element)}),e.on("selection.changed",function(r){K(r.newSelection,o)}),e.on(["shape.changed","connection.changed"],$3,function(r){var a=r.element,s=r.gfx,c=kt(".djs-outline",s);c&&i.updateOutline(a,c)})}bo.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=kt(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),ot(t,n),this.updateOutline(e,n)),n},bo.prototype._createOutlineGfx=function(){var e=We("rect");return Le(e,te({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},bo.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},bo.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&K(i,function(o){n=n||o.updateOutline(t,e)}),n||Le(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},bo.prototype.updateConnectionOutline=function(e,t){var n=yn(t);Le(e,{x:n.x-this._outlineOffset,y:n.y-this._outlineOffset,width:n.width+this._outlineOffset*2,height:n.height+this._outlineOffset*2})},bo.prototype.registerProvider=function(e,t){t||(t=e,e=F3),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},bo.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},bo.prototype.getOutline=function(e){var t,n=this._getProviders();return K(n,function(i){An(i.getOutline)&&(t=t||i.getOutline(e))}),t},bo.$inject=["eventBus","styles","elementRegistry"];var Op=6;function qg(e,t,n){this._canvas=t;var i=this;e.on("element.changed",function(o){n.isSelected(o.element)&&i._updateMultiSelectionOutline(n.get())}),e.on("selection.changed",function(o){var r=o.newSelection;i._updateMultiSelectionOutline(r)})}qg.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");Is(t);var n=e.length>1,i=this._canvas.getContainer();if(vt(i)[n?"add":"remove"]("djs-multi-select"),!!n){var o=j3(yn(e)),r=We("rect");Le(r,te({rx:3},o)),vt(r).add("djs-selection-outline"),ot(t,r)}},qg.$inject=["eventBus","canvas","selection"];function j3(e){return{x:e.x-Op,y:e.y-Op,width:e.width+Op*2,height:e.height+Op*2}}const Yg={__depends__:[Oi],__init__:["outline","multiSelectionOutline"],outline:["type",bo],multiSelectionOutline:["type",qg]},i1=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],o1={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},H3=15,Dp=2;function r1(e,t,n,i,o){const r=t.getLayer("overlays");e.on(["selection.changed","shape.changed"],function(){s()}),e.on("selection.changed",function({newSelection:p}){var f;const d=p.filter(m=>ht(m,i1));if(d.length===1){const m=d[0];ft(m)?a(m,m.labelTarget):(f=m.labels)!=null&&f.length&&a(m.labels[0],m)}if(d.length===2){const m=d.find(ft),h=d.find(y=>{var w;return(w=y.labels)==null?void 0:w.includes(m)});m&&h&&a(m,h)}}),e.on("shape.changed",function({element:p}){var d;!ht(p,i1)||!u(p)||(ft(p)?a(p,p.labelTarget):(d=p.labels)!=null&&d.length&&a(p.labels[0],p))});function a(p,d){const f=$s([nt(d),nt(p)],o1),m=f.getAttribute("d"),y=o.isSelected(p)?c(p):l(p),w=Gs(y,m);if(!w)return;const v=o.isSelected(d)?c(d):l(d),b=Gs(v,m)||nt(d);Js(b,w)<H3||(gf(f,[b,w]),ot(r,f))}function s(){Ls(`.${o1.class}`,r).forEach(mn)}function c(p){const d=i.getOutline(p);if(!d)return l(p);if(d.x){const f={x:p.x+kr(d,"x")-Dp,y:p.y+kr(d,"y")-Dp,width:kr(d,"width")+Dp*2,height:kr(d,"height")+Dp*2};return Mf(f,kr(d,"rx"))}if(d.cx){const f=kr(d,"r"),m={x:p.x+kr(d,"cx")-f,y:p.y+kr(d,"cy")-f,width:f*2,height:f*2};return pb(m)}}function l(p){return n.getShapePath(p)}function u(p){return o.isSelected(p)}}r1.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function kr(e,t){return parseFloat(Le(e,t)||0)}const G3={__depends__:[Oi,Yg],__init__:["labelLink"],labelLink:["type",r1]};var z3=new ta("tt");function V3(e){var t=Wt('<div class="djs-tooltip-container" />');return Zn(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function W3(e,t,n){Zn(e,{left:t+"px",top:n+"px"})}function Kg(e,t){e.style.display=t===!1?"none":""}var a1="djs-tooltip",Xg="."+a1;function oi(e,t){this._eventBus=e,this._canvas=t,this._ids=z3,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=V3(t.getContainer());var n=this;li.bind(this._tooltipRoot,Xg,"mousedown",function(i){i.stopPropagation()}),li.bind(this._tooltipRoot,Xg,"mouseover",function(i){n.trigger("mouseover",i)}),li.bind(this._tooltipRoot,Xg,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}oi.$inject=["eventBus","canvas"],oi.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=te({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},oi.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)))},oi.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},oi.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},oi.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)}},oi.prototype.remove=function(e){var t=this.get(e);t&&(co(t.html),co(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},oi.prototype.show=function(){Kg(this._tooltipRoot)},oi.prototype.hide=function(){Kg(this._tooltipRoot,!1)},oi.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},oi.prototype._addTooltip=function(e){var t=e.id,n=e.html,i,o=this._tooltipRoot;n.get&&n.constructor.prototype.jquery&&(n=n.get(0)),ai(n)&&(n=Wt(n)),i=Wt('<div data-tooltip-id="'+t+'" class="'+a1+'">'),Zn(i,{position:"absolute"}),i.appendChild(n),e.type&&Dt(i).add("djs-tooltip-"+e.type),e.className&&Dt(i).add(e.className),e.htmlContainer=i,o.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},oi.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;W3(n,t.x,t.y)},oi.prototype._updateTooltipVisibilty=function(e){K(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,o=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(o=!1),Kg(i,o))})},oi.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 U3={__init__:["tooltips"],tooltips:["type",oi]};var q3="flow elements must be children of pools/participants",Y3="Data object must be placed within a pool/participant.";function s1(e,t,n){function i(o,r,a){t.add({position:{x:o.x+5,y:o.y+5},type:"error",timeout:2e3,html:"<div>"+r+"</div>"})}e.on(["shape.move.rejected","create.rejected"],function(o){var r=o.context,a=r.shape,s=r.target;T(s,"bpmn:Collaboration")&&(T(a,"bpmn:FlowNode")?i(o,n(q3)):T(a,"bpmn:DataObjectReference")&&i(o,n(Y3)))})}s1.$inject=["eventBus","tooltips","translate"];const K3={__depends__:[U3],__init__:["modelingFeedback"],modelingFeedback:["type",s1]};var X3=500,Z3=1250,J3=1500,Lp=Math.round;function Q3(e){return{x:e.x+Lp(e.width/2),y:e.y+Lp(e.height/2)}}function c1(e,t,n,i,o){function r(s,c,l,u){return o.allowed("elements.move",{shapes:s,delta:c,position:l,target:u})}e.on("shape.move.start",J3,function(s){var c=s.context,l=s.shape,u=i.get().slice();u.indexOf(l)===-1&&(u=[l]),u=eF(u),te(c,{shapes:u,validatedShapes:u,shape:l})}),e.on("shape.move.start",Z3,function(s){var c=s.context,l=c.validatedShapes,u;if(u=c.canExecute=r(l),!u)return!1}),e.on("shape.move.move",X3,function(s){var c=s.context,l=c.validatedShapes,u=s.hover,p={x:s.dx,y:s.dy},d={x:s.x,y:s.y},f;if(f=r(l,p,d,u),c.delta=p,c.canExecute=f,f===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",d=c.shapes;if(u===!1)return!1;l.x=Lp(l.x),l.y=Lp(l.y),!(l.x===0&&l.y===0)&&n.moveElements(d,l,c.target,{primaryShape:c.shape,attach:p})}),e.on("element.mousedown",function(s){if(vr(s)){var c=Ua(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,l,u){if(Sn(l)&&(u=l,l=!1),!(c.waypoints||!c.parent)&&!vt(s.target).has("djs-hit-no-move")){var p=Q3(c),d=t.init(s,p,"shape.move",{cursor:"grabbing",autoActivate:l,data:{shape:c,context:u||{}}});if(d!==!1)return!0}}this.start=a}c1.$inject=["eventBus","dragging","modeling","selection","rules"];function eF(e){var t=wa(e,"id");return gt(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var l1=499,Zg="djs-dragging",u1="drop-ok",p1="drop-not-ok",d1="new-parent",f1="attach-ok";function h1(e,t,n,i){function o(c){var l=r(c),u=tF(l);return u}function r(c){var l=Fs(c),u=l.flatMap(f=>(f.incoming||[]).concat(f.outgoing||[])),p=l.concat(u),d=[...new Set(p)];return d}function a(c,l){[f1,u1,p1,d1].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,Zg),c.allDraggedElements?c.allDraggedElements.push(l):c.allDraggedElements=[l]}e.on("shape.move.start",l1,function(c){var l=c.context,u=l.shapes,p=l.allDraggedElements,d=o(u);if(!l.dragGroup){var f=We("g");Le(f,n.cls("djs-drag-group",["no-events"]));var m=t.getActiveLayer();ot(m,f),l.dragGroup=f}d.forEach(function(h){i.addDragger(h,l.dragGroup)}),p?p=Xp([p,r(u)]):p=r(u),K(p,function(h){t.addMarker(h,Zg)}),l.allDraggedElements=p,l.differentParents=nF(u)}),e.on("shape.move.move",l1,function(c){var l=c.context,u=l.dragGroup,p=l.target,d=l.shape.parent,f=l.canExecute;p&&(f==="attach"?a(p,f1):l.canExecute&&d&&p.id!==d.id?a(p,d1):a(p,l.canExecute?u1:p1)),Fn(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;K(u,function(d){t.removeMarker(d,Zg)}),p&&mn(p)}),this.makeDraggable=s}h1.$inject=["eventBus","canvas","styles","previewSupport"];function tF(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=gt(e,function(i){return $t(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function nF(e){return nM(wa(e,function(t){return t.parent&&t.parent.id}))!==1}const iF={__depends__:[xu,Oi,Yg,mo,$o,Xa],__init__:["move","movePreview"],move:["type",c1],movePreview:["type",h1]};var g1=".djs-palette-toggle",m1=".entry",oF=g1+", "+m1,Jg="djs-palette-",rF="shown",Qg="open",y1="two-column",aF=1e3;function _n(e,t){this._eventBus=e,this._canvas=t;var n=this;e.on("tool-manager.update",function(i){var o=i.tool;n.updateToolHighlight(o)}),e.on("i18n.changed",function(){n._update()}),e.on("diagram.init",function(){n._diagramInitialized=!0,n._rebuild()})}_n.$inject=["eventBus","canvas"],_n.prototype.registerProvider=function(e,t){t||(t=e,e=aF),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},_n.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(cF,{})},_n.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},_n.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=Wt(_n.HTML_MARKUP);n.appendChild(i),Dt(n).add(Jg+rF),li.bind(i,oF,"click",function(o){var r=o.delegateTarget;if(rf(r,g1))return e.toggle();e.trigger("click",o)}),Ke.bind(i,"mousedown",function(o){o.stopPropagation()}),li.bind(i,m1,"dragstart",function(o){e.trigger("dragstart",o)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},_n.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},_n.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,o,r=Dt(n),a=Dt(t);"twoColumn"in e?o=e.twoColumn:o=this._needsCollapse(t.clientHeight,this._entries||{}),r.toggle(y1,o),a.toggle(Jg+y1,o),"open"in e&&(r.toggle(Qg,e.open),a.toggle(Jg+Qg,e.open)),i.fire("palette.changed",{twoColumn:o,open:this.isOpen()})},_n.prototype._update=function(){var e=kt(".djs-palette-entries",this._container),t=this._entries=this.getEntries();Tl(e),K(t,function(n,i){var o=n.group||"default",r=kt("[data-group="+ra(o)+"]",e);r||(r=Wt('<div class="group"></div>'),On(r,"data-group",o),e.appendChild(r));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=Wt(a);if(r.appendChild(s),!n.separator&&(On(s,"data-action",i),n.title&&On(s,"title",n.title),n.className&&sF(s,n.className),n.imageUrl)){var c=Wt("<img>");On(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},_n.prototype.trigger=function(e,t,n){var i,o,r=t.delegateTarget||t.target;return r?(i=On(r,"data-action"),o=t.originalEvent||t,this.triggerEntry(i,e,o,n)):t.preventDefault()},_n.prototype.triggerEntry=function(e,t,n,i){var o=this._entries,r,a;if(r=o[e],!!r&&(a=r.action,this._eventBus.fire("palette.trigger",{entry:r,event:n})!==!1)){if(An(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},_n.prototype._layoutChanged=function(){this._toggleState({})},_n.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},_n.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},_n.prototype.open=function(){this._toggleState({open:!0})},_n.prototype.toggle=function(){this.isOpen()?this.close():this.open()},_n.prototype.isActiveTool=function(e){return e&&this._activeTool===e},_n.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=kt(".djs-palette-entries",this._container),this._toolsContainer=kt("[data-group=tools]",t)),n=this._toolsContainer,K(n.children,function(i){var o=i.getAttribute("data-action");if(o){var r=Dt(i);o=o.replace("-tool",""),r.contains("entry")&&o===e?r.add("highlighted-entry"):r.remove("highlighted-entry")}})},_n.prototype.isOpen=function(){return Dt(this._container).has(Qg)},_n.prototype._getParentContainer=function(){return this._canvas.getContainer()},_n.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function sF(e,t){var n=Dt(e),i=et(t)?t:t.split(/\s+/g);i.forEach(function(o){n.add(o)})}function cF(e,t){var n=t.getPaletteEntries();return An(n)?n(e):(K(n,function(i,o){e[o]=i}),e)}const lF={__init__:["palette"],palette:["type",_n]};var v1="crosshair",x1="selected",uF="djs-dragging-active-lasso";function Or(e,t,n,i,o,r,a){this._selection=o,this._dragging=n,this._mouse=a;var s=this,c={create:function(p){var d=t.getActiveLayer(),f=p.frame=We("rect");Le(f,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),ot(d,f),l(!0),this.update(p)},update:function(p){var d=p.frame,f=p.bbox;d&&f&&Le(d,{x:f.x,y:f.y,width:f.width,height:f.height});var m=p.marked,h=p.lastMarked;if(m&&h){for(const y of h)m.has(y)||t.removeMarker(y,x1);for(const y of m)h.has(y)||t.addMarker(y,x1)}},remove:function(p){this.update(p),p.frame&&mn(p.frame),l(!1)}};function l(p){vt(t.getContainer()).toggle(uF,p)}function u(p){var d=i.getAll();return new Set(ba(La(d,p)))}r.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",function(p){var d=p.originalEvent.target;!p.hover&&!(d instanceof SVGElement)||e.once("lasso.selection.ended",function(){s.activateLasso(p.originalEvent,!0)})}),e.on("lasso.end",0,function(p){var d=p.context;s._select(Array.from(d.marked))}),e.on("lasso.start",function(p){var d=p.context;d.bbox=b1(p),d.add=du(p),d.lastMarked=new Set(o.get()),d.add?d.marked=d.lastMarked:d.marked=new Set,d.initialMarked=d.marked,c.create(d)}),e.on("lasso.move",function(p){var d=p.context,f=d.bbox=b1(p),m=u(f),h=d.initialMarked.union(m);d.lastMarked=d.marked,d.marked=h,c.update(d)}),e.on("lasso.cleanup",function(p){var d=p.context;d.lastMarked=d.marked,d.marked=new Set(o.get()),c.remove(p.context)}),e.on("element.mousedown",1500,function(p){if(du(p))return s.activateLasso(p.originalEvent),!0})}Or.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],Or.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:v1,data:{context:{}},keepSelection:!0})},Or.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:v1,data:{context:{}},keepSelection:!0})},Or.prototype._select=function(e){this._selection.select(e)},Or.prototype.select=function(e,t,n=[]){var i=ba(La(e,t));this._select([...n,...i])},Or.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Or.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function b1(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 pF={__depends__:[Eu,oc],__init__:["lassoTool"],lassoTool:["type",Or]};var em=1500,w1="grab";function ls(e,t,n,i,o,r){this._dragging=n,this._mouse=r;var a=this,s=i.get("keyboard",!1);o.registerTool("hand",{tool:"hand",dragging:"hand.move"}),e.on("element.mousedown",em,function(c){if(tc(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(em,function(c){if(!(!_1(c.keyEvent)||a.isActive())){var l=a._mouse.getLastMoveEvent();a.activateMove(l,!!l)}},"keyboard.keydown"),s&&s.addListener(em,function(c){!_1(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!tc(c)&&u&&e.once("hand.move.ended",function(p){a.activateHand(p.originalEvent,!0,!0)}),!1})}ls.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],ls.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:w1,data:{context:n||{}}})},ls.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:w1,data:{context:{reactivate:n}}})},ls.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},ls.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function _1(e){return Mn("Space",e)}const dF={__depends__:[Eu,oc],__init__:["handTool"],handTool:["type",ls]};var E1="connect-ok",S1="connect-not-ok";function us(e,t,n,i,o,r,a){var s=this;this._dragging=t,this._rules=r,this._mouse=a,o.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?E1:S1))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var l=c.context.startTarget,u=c.context.canStartConnect;l&&i.removeMarker(l,u?E1:S1)}),e.on(["global-connect.ended"],function(c){var l=c.context,u=l.startTarget,p={x:c.x,y:c.y},d=s.canStartConnect(u);if(d)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})}us.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],us.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},us.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},us.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},us.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const fF={__depends__:[zg,mo,$o,Eu,oc],globalConnect:["type",us]};function tm(e,t,n,i,o,r,a,s){this._palette=e,this._create=t,this._elementFactory=n,this._spaceTool=i,this._lassoTool=o,this._handTool=r,this._globalConnect=a,this._translate=s,e.registerProvider(this)}tm.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],tm.prototype.getPaletteEntries=function(){var e={},t=this._create,n=this._elementFactory,i=this._spaceTool,o=this._lassoTool,r=this._handTool,a=this._globalConnect,s=this._translate;function c(p,d,f,m,h){function y(w){var g=n.createShape(te({type:p},h));t.start(w,g)}return{group:d,className:f,title:m,action:{dragstart:y,click:y}}}function l(p){var d=n.createShape({type:"bpmn:SubProcess",x:0,y:0,isExpanded:!0}),f=n.createShape({type:"bpmn:StartEvent",x:40,y:82,parent:d});t.start(p,[d,f],{hints:{autoSelect:[d]}})}function u(p){t.start(p,n.createParticipantShape())}return te(e,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:s("Activate hand tool"),action:{click:function(p){r.activateHand(p)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:s("Activate lasso tool"),action:{click:function(p){o.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 hF={__depends__:[lF,wu,T_,pF,dF,fF,Ys],__init__:["paletteProvider"],paletteProvider:["type",tm]};var gF=250;function nm(e,t,n,i,o){we.call(this,e);function r(s){var c=s.canExecute.replacements;K(c,function(l){var u=l.oldElementId,p={type:l.newElementType};if(!s.visualReplacements[u]){var d=t.get(u);te(p,{x:d.x,y:d.y});var f=n.createShape(p);i.addShape(f,d.parent);var m=kt('[data-element-id="'+ra(d.id)+'"]',s.dragGroup);m&&Le(m,{display:"none"});var h=o.addDragger(f,s.dragGroup);s.visualReplacements[u]=h,i.removeShape(f)}})}function a(s){var c=s.visualReplacements;K(c,function(l,u){var p=kt('[data-element-id="'+ra(u)+'"]',s.dragGroup);p&&Le(p,{display:"inline"}),l.remove(),c[u]&&delete c[u]})}e.on("shape.move.move",gF,function(s){var c=s.context,l=c.canExecute;c.visualReplacements||(c.visualReplacements={}),l&&l.replacements?r(c):a(c)})}nm.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],je(nm,we);const mF={__depends__:[Xa],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",nm]};var yF=1250,im=40,vF=20,xF=10,R1=20,M1=["x","y"],bF=Math.abs;function C1(e){e.on(["connect.hover","connect.move","connect.end"],yF,function(t){var n=t.context,i=n.canExecute,o=n.start,r=n.hover,a=n.source,s=n.target;t.originalEvent&&di(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&r&&wF(t,r,RF(r)),r&&SF(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=Ii(o),ht(r,["bpmn:Event","bpmn:Gateway"])&&A1(t,Ii(r)),ht(r,["bpmn:Task","bpmn:SubProcess"])&&_F(t,r),T(a,"bpmn:BoundaryEvent")&&s===a.host&&EF(t)):T1(i,"bpmn:MessageFlow")?(T(o,"bpmn:Event")&&(n.connectionStart=Ii(o)),T(r,"bpmn:Event")&&A1(t,Ii(r))):n.connectionStart=n.initialConnectionStart)})}C1.$inject=["eventBus"];function wF(e,t,n){M1.forEach(function(i){var o=P1(i,t);e[i]<t[i]+n?wn(e,i,t[i]+n):e[i]>t[i]+o-n&&wn(e,i,t[i]+o-n)})}function _F(e,t){var n=Ii(t);M1.forEach(function(i){MF(e,t,i)&&wn(e,i,n[i])})}function EF(e){var t=e.context,n=t.source,i=t.target;if(!CF(t)){var o=Ii(n),r=$n(o,i,-10),a=[];/top|bottom/.test(r)&&a.push("x"),/left|right/.test(r)&&a.push("y"),a.forEach(function(s){var c=e[s],l;bF(c-o[s])<im&&(c>o[s]?l=o[s]+im:l=o[s]-im,wn(e,s,l))})}}function A1(e,t){wn(e,"x",t.x),wn(e,"y",t.y)}function T1(e,t){return e&&e.type===t}function SF(e,t){return Zo(t,function(n){return T1(e,n)})}function P1(e,t){return e==="x"?t.width:t.height}function RF(e){return T(e,"bpmn:Task")?xF:vF}function MF(e,t,n){return e[n]>t[n]+R1&&e[n]<t[n]+P1(n,t)-R1}function CF(e){var t=e.hover,n=e.source;return t&&n&&t===n}function Dr(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}Dr.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},Dr.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},Dr.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},Dr.prototype.getSnapLocations=function(){return this._snapLocations},Dr.prototype.setSnapLocations=function(e){this._snapLocations=e},Dr.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new Ip,n.initDefaults(this._defaultSnaps)),n};function Ip(){this._snapValues={}}Ip.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)},Ip.prototype.snap=function(e,t,n,i){var o=this._snapValues[t];return o&&_5(e[n],o[n],i)},Ip.prototype.initDefaults=function(e){var t=this;K(e||{},function(n,i){K(n,function(o){t.add(i,o)})})};var AF=1250;function wo(e,t,n){var i=this;this._elementRegistry=e,t.on(["create.start","shape.move.start"],function(o){i.initSnap(o)}),t.on(["create.move","create.end","shape.move.move","shape.move.end"],AF,function(o){var r=o.context,a=r.shape,s=r.snapContext,c=r.target;if(!(o.originalEvent&&di(o.originalEvent))&&!(cs(o)||!c)){var l=s.pointsForTarget(c);l.initialized||(l=i.addSnapTargetPoints(l,a,c),l.initialized=!0),n.snap(o,l)}}),t.on(["create.cleanup","shape.move.cleanup"],function(){n.hide()})}wo.$inject=["elementRegistry","eventBus","snapping"],wo.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,o=n.snapContext;o||(o=n.snapContext=new Dr);var r;t.get(i.id)?r=Ii(i,e):r={x:e.x+Ii(i).x,y:e.y+Ii(i).y};var a={x:r.x-i.width/2,y:r.y-i.height/2},s={x:r.x+i.width/2,y:r.y+i.height/2};return o.setSnapOrigin("mid",{x:r.x-e.x,y:r.y-e.y}),ft(i)||(o.setSnapOrigin("top-left",{x:a.x-e.x,y:a.y-e.y}),o.setSnapOrigin("bottom-right",{x:s.x-e.x,y:s.y-e.y})),o},wo.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return K(i,function(o){if(ft(o)){ft(t)&&e.add("mid",Ii(o));return}if($t(o)){if(o.waypoints.length<3)return;var r=o.waypoints.slice(1,-1);K(r,function(a){e.add("mid",a)});return}e.add("mid",Ii(o))}),!tt(t.x)||!tt(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",Ii(t)),e},wo.prototype.getSnapTargets=function(e,t){return yS(t).filter(function(n){return!TF(n)})};function TF(e){return!!e.hidden}var k1=1500;function ps(e,t){t.invoke(wo,this),e.on(["create.move","create.end"],k1,DF),e.on(["create.move","create.end","shape.move.move","shape.move.end"],k1,function(n){var i=n.context,o=i.canExecute,r=i.target,a=o&&(o==="attach"||o.attach);a&&!cs(n)&&PF(n,r)})}je(ps,wo),ps.$inject=["eventBus","injector"],ps.prototype.initSnap=function(e){var t=wo.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return K(n.outgoing,function(o){var r=o.waypoints[0];r=r.original||r,t.setSnapOrigin(o.id+"-docking",D1(r,i,e))}),K(n.incoming,function(o){var r=o.waypoints[o.waypoints.length-1];r=r.original||r,t.setSnapOrigin(o.id+"-docking",D1(r,i,e))}),T(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},ps.prototype.addSnapTargetPoints=function(e,t,n){wo.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);K(i,function(r){(OF(r)||kF([t,r],"bpmn:TextAnnotation"))&&(e.add("top-left",gS(r)),e.add("bottom-right",mS(r)))});var o=this._elementRegistry;return K(t.incoming,function(r){if(o.get(t.id)){O1(i,r.source)||e.add("mid",nt(r.source));var a=r.waypoints[0];e.add(r.id+"-docking",a.original||a)}}),K(t.outgoing,function(r){if(o.get(t.id)){O1(i,r.target)||e.add("mid",nt(r.target));var a=r.waypoints[r.waypoints.length-1];e.add(r.id+"-docking",a.original||a)}}),T(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},ps.prototype.getSnapTargets=function(e,t){return wo.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!T(n,"bpmn:Lane")})};function PF(e,t){var n=Ze(t),i=Rw(e,t),o=e.context,r=o.shape,a;r.parent?a={x:0,y:0}:a=nt(r),/top/.test(i)?wn(e,"y",n.top-a.y):/bottom/.test(i)&&wn(e,"y",n.bottom-a.y),/left/.test(i)?wn(e,"x",n.left-a.x):/right/.test(i)&&wn(e,"x",n.right-a.x)}function kF(e,t){return e.every(function(n){return T(n,t)})}function OF(e){return T(e,"bpmn:SubProcess")&&xt(e)?!0:T(e,"bpmn:Participant")}function DF(e){var t=e.context,n=t.createConstraints;if(n){var i=n.top,o=n.right,r=n.bottom,a=n.left;(a&&a>=e.x||o&&o<=e.x)&&wn(e,"x",e.x),(i&&i>=e.y||r&&r<=e.y)&&wn(e,"y",e.y)}}function O1(e,t){return e.indexOf(t)!==-1}function D1(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var LF=1250;function Bc(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],LF,function(i){var o=i.context,r=o.shape,a=r.parent,s=o.direction,c=o.snapContext;if(!(i.originalEvent&&di(i.originalEvent))&&!cs(i)){var l=c.pointsForTarget(a);l.initialized||(l=n.addSnapTargetPoints(l,r,a,s),l.initialized=!0),NF(s)&&wn(i,"x",i.x),$F(s)&&wn(i,"y",i.y),t.snap(i,l)}}),e.on(["resize.cleanup"],function(){t.hide()})}Bc.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,o=t.snapContext;o||(o=t.snapContext=new Dr);var r=L1(n,i);return o.setSnapOrigin("corner",{x:r.x-e.x,y:r.y-e.y}),o},Bc.prototype.addSnapTargetPoints=function(e,t,n,i){var o=this.getSnapTargets(t,n);return K(o,function(r){e.add("corner",mS(r)),e.add("corner",gS(r))}),e.add("corner",L1(t,i)),e},Bc.$inject=["eventBus","snapping"],Bc.prototype.getSnapTargets=function(e,t){return yS(t).filter(function(n){return!IF(n,e)&&!$t(n)&&!BF(n)&&!ft(n)})};function L1(e,t){var n=nt(e),i=Ze(e),o={x:n.x,y:n.y};return t.indexOf("n")!==-1?o.y=i.top:t.indexOf("s")!==-1&&(o.y=i.bottom),t.indexOf("e")!==-1?o.x=i.right:t.indexOf("w")!==-1&&(o.x=i.left),o}function IF(e,t){return e.host===t}function BF(e){return!!e.hidden}function NF(e){return e==="n"||e==="s"}function $F(e){return e==="e"||e==="w"}var FF=7,jF=1e3;function Lr(e){this._canvas=e,this._asyncHide=Jp(ti(this.hide,this),jF)}Lr.$inject=["canvas"],Lr.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,o=i.getSnapLocations(),r={x:cs(e,"x"),y:cs(e,"y")};K(o,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(K(["x","y"],function(l){var u;r[l]||(u=t.snap(c,a,l,FF),u!==void 0&&(r[l]={value:u,originValue:u-s[l]}))}),r.x&&r.y)return!1}),this.showSnapLine("vertical",r.x&&r.x.value),this.showSnapLine("horizontal",r.y&&r.y.value),K(["x","y"],function(a){var s=r[a];Sn(s)&&wn(e,a,s.originValue)})},Lr.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=We("path");return Le(n,{d:"M0,0 L0,0"}),vt(n).add("djs-snap-line"),ot(t,n),{update:function(i){tt(i)?e==="horizontal"?Le(n,{d:"M-100000,"+i+" L+100000,"+i,display:""}):Le(n,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):Le(n,{display:"none"})}}},Lr.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},Lr.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},Lr.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},Lr.prototype.hide=function(){K(this._snapLines,function(e){e.update()})};const HF={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",wo],resizeSnapping:["type",Bc],snapping:["type",Lr]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",C1],createMoveSnapping:["type",ps]};var I1=300;function lt(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=kt(lt.INPUT_SELECTOR,this._container),this._resultsContainer=kt(lt.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}lt.$inject=["canvas","eventBus","selection","translate"],lt.prototype._bindEvents=function(){var e=this;function t(n,i,o,r){e._eventMaps.push({el:n,type:o,listener:li.bind(n,i,o,r)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,lt.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,lt.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,lt.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,lt.INPUT_SELECTOR,"keydown",function(n){Mn("ArrowUp",n)&&n.preventDefault(),Mn("ArrowDown",n)&&n.preventDefault()}),t(this._container,lt.INPUT_SELECTOR,"keyup",function(n){if(Mn("Escape",n))return e.close();if(Mn("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(Mn("ArrowUp",n))return e._scrollToDirection(!0);if(Mn("ArrowDown",n))return e._scrollToDirection();Mn(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},lt.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){li.unbind(e.el,e.type,e.listener)})},lt.prototype._search=function(e){var t=this;if(this._clearResults(),!!e.trim()){var n=this._searchProvider.find(e);if(n=n.filter(function(o){return!t._canvas.getRootElements().includes(o.element)}),!n.length){this._selection.select(null);return}n.forEach(function(o){var r=o.element.id,a=t._createResultNode(o,r);t._results[r]={element:o.element,node:a}});var i=kt(lt.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},lt.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},lt.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)}},lt.prototype._clearResults=function(){Tl(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},lt.prototype._getCurrentResult=function(){return kt(lt.RESULT_SELECTED_SELECTOR,this._resultsContainer)},lt.prototype._createResultNode=function(e,t){var n=Wt(lt.RESULT_HTML);return e.primaryTokens.length>0&&B1(n,e.primaryTokens,lt.RESULT_PRIMARY_HTML),B1(n,e.secondaryTokens,lt.RESULT_SECONDARY_HTML),On(n,lt.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},lt.prototype.registerProvider=function(e){this._searchProvider=e},lt.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,Dt(this._canvas.getContainer()).add("djs-search-open"),Dt(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},lt.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,Dt(this._canvas.getContainer()).remove("djs-search-open"),Dt(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},lt.prototype.toggle=function(){this.isOpen()?this.close():this.open()},lt.prototype.isOpen=function(){return this._open},lt.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&Dt(t).remove(lt.RESULT_SELECTED_CLASS);var n=On(e,lt.RESULT_ID_ATTRIBUTE),i=this._results[n].element;Dt(e).add(lt.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:I1}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},lt.prototype._select=function(e){var t=On(e,lt.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:I1}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},lt.prototype._getBoxHtml=function(){const e=Wt(lt.BOX_HTML),t=kt(lt.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function B1(e,t,n){var i=GF(t),o=Wt(n);o.innerHTML=i,e.appendChild(o)}function GF(e){var t="";return e.forEach(function(n){var i=B0(n.value||n.matched||n.normal),o=n.match||n.matched;o?t+='<b class="'+lt.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}lt.CONTAINER_SELECTOR=".djs-search-container",lt.INPUT_SELECTOR=".djs-search-input input",lt.RESULTS_CONTAINER_SELECTOR=".djs-search-results",lt.RESULT_SELECTOR=".djs-search-result",lt.RESULT_SELECTED_CLASS="djs-search-result-selected",lt.RESULT_SELECTED_SELECTOR="."+lt.RESULT_SELECTED_CLASS,lt.RESULT_ID_ATTRIBUTE="data-result-id",lt.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",lt.BOX_HTML=`<div class="djs-search-container djs-scrollable">
336
335
  <div class="djs-search-input">
337
336
  <svg class="djs-search-icon" width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
338
337
  <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 +339,4 @@
340
339
  <input type="text" spellcheck="false" />
341
340
  </div>
342
341
  <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 pB={__depends__:[Wa,Bl,di],searchPad:["type",Ye]};function sh(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}sh.$inject=["elementRegistry","searchPad","canvas","search"],sh.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:oi(i),id:i.id})),e,{keys:["label","id"]}).map(fB)};function fB(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const dB={__depends__:[pB,P_],__init__:["bpmnSearch"],bpmnSearch:["type",sh]},hB="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",mB="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",gB={width:36,height:50},yB={width:50,height:50};function v0(e,t,n){return De("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const bi=5;function _u(e,t){this._styles=t,e.registerProvider(this)}_u.$inject=["outline","styles"],_u.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(kM(e))return n=De("rect"),Se(n,U({x:-bi,y:-bi,rx:4,width:e.width+bi*2,height:e.height+bi*2},t)),n;if(!Je(e))return M(e,"bpmn:Gateway")?(n=De("rect"),U(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),Se(n,U({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):tt(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=De("rect"),Se(n,U({x:-bi,y:-bi,rx:14,width:e.width+bi*2,height:e.height+bi*2},t))):M(e,"bpmn:EndEvent")?(n=De("circle"),Se(n,U({cx:e.width/2,cy:e.height/2,r:e.width/2+bi+1},t))):M(e,"bpmn:Event")?(n=De("circle"),Se(n,U({cx:e.width/2,cy:e.height/2,r:e.width/2+bi},t))):M(e,"bpmn:DataObjectReference")&&b0(e,"bpmn:DataObjectReference")?n=v0(hB,{x:-6,y:-6},t):M(e,"bpmn:DataStoreReference")&&b0(e,"bpmn:DataStoreReference")&&(n=v0(mB,{x:-6,y:-6},t)),n},_u.prototype.updateOutline=function(e,t){if(!Je(e))return tt(e,["bpmn:SubProcess","bpmn:Group"])?(Se(t,{width:e.width+bi*2,height:e.height+bi*2}),!0):!!tt(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function b0(e,t){var n;return t==="bpmn:DataObjectReference"?n=gB:t==="bpmn:DataStoreReference"&&(n=yB),e.width===n.width&&e.height===n.height}const vB={__depends__:[Zd],__init__:["outlineProvider"],outlineProvider:["type",_u]};var bB='<?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 Ui(e){Wo.call(this,e)}Ee(Ui,Wo),Ui.Viewer=$r,Ui.NavigatedViewer=vs,Ui.prototype.createDiagram=function(){return this.importXML(bB)},Ui.prototype._interactionModules=[Ox,Ix,Nx],Ui.prototype._modelingModules=[_D,Ol,CD,SD,FD,Ud,WD,gI,gb,ul,xI,EI,FI,HI,zI,YI,oL,uL,md,yL,RL,BL,$L,Dw,lB,dB,vB],Ui.prototype._modules=[].concat($r.prototype._modules,Ui.prototype._interactionModules,Ui.prototype._modelingModules);const xB=xe.defineComponent({__name:"BpmnModelerView",props:{xml:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,r=n,o=xe.ref();let a;async function s(l){if(!a)throw new Error("modeler not mounted");try{const{warnings:u}=await a.importXML(l),p=qu(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 xe.onMounted(async()=>{a=new Ui({container:o.value,moddleExtensions:Xs}),i.xml&&await s(i.xml),r("ready")}),xe.watch(()=>i.xml,l=>{l&&a&&s(l)}),xe.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(l,u)=>(xe.openBlock(),xe.createElementBlock("div",{ref_key:"container",ref:o,class:"bpmn-modeler-view"},null,512))}}),x0=(e,t)=>{const n=e.__vccOpts||e;for(const[i,r]of t)n[i]=r;return n},_B=x0(xB,[["__scopeId","data-v-a9b41c97"]]),wB=["title","aria-expanded"],EB=["title","onClick"],SB={viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},RB={key:0,d:"M5.6 5.6l4.8 4.8M10.4 5.6l-4.8 4.8",stroke:"currentColor","stroke-width":"1.5"},CB={key:1,d:"M8 4.6v0.2M8 7v4.4",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round"},MB={key:0,class:"bwl-validation__body"},AB={key:0,class:"bwl-validation__empty"},PB={key:1,class:"bwl-validation__empty"},TB={key:2,class:"bwl-validation__list"},kB=["onClick"],OB={key:0,class:"bwl-validation__scope",title:"이번 변경이 만들거나 건드린 요소"},DB={class:"bwl-validation__msg"},IB=["title"],LB=x0(xe.defineComponent({__name:"BpmnValidationPanel",props:{controller:{}},setup(e){const n=e.controller,i=xe.computed(()=>xx(n.issues.value,n.describeElement)),r=xe.computed(()=>_x(i.value)),o=h=>la(h,n.changeScope.value),a=xe.computed(()=>_d(i.value,n.changeScope.value)),s=xe.ref({error:!0,warning:!0,info:!0}),c=xe.computed(()=>wx(i.value.filter(h=>s.value[h.severity]),n.changeScope.value)),l=xe.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)=>(xe.openBlock(),xe.createElementBlock("section",{class:xe.normalizeClass(["bwl-validation",{"is-open":l.value}])},[xe.createElementVNode("header",{class:"bwl-validation__head",onClick:m[1]||(m[1]=b=>l.value=!l.value)},[xe.createElementVNode("button",{type:"button",class:"bwl-validation__toggle",title:l.value?"접기":"펼치기","aria-expanded":l.value},[(xe.openBlock(),xe.createElementBlock("svg",{class:xe.normalizeClass(["bwl-validation__chevron",{"is-open":l.value}]),viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},[...m[2]||(m[2]=[xe.createElementVNode("path",{d:"M6 3l5 5-5 5",fill:"none",stroke:"currentColor","stroke-width":"1.6"},null,-1)])],2)),m[3]||(m[3]=xe.createElementVNode("span",null,"검증",-1))],8,wB),xe.createElementVNode("div",{class:"bwl-validation__counts",onClick:m[0]||(m[0]=xe.withModifiers(()=>{},["stop"]))},[(xe.openBlock(),xe.createElementBlock(xe.Fragment,null,xe.renderList(u,b=>xe.createElementVNode("button",{key:b,type:"button",class:xe.normalizeClass(["bwl-validation__count",[`is-${b}`,{"is-off":!s.value[b]}]]),title:l.value?`${p[b]} ${s.value[b]?"숨기기":"보이기"}`:"검증 패널 펼치기",onClick:E=>f(b)},[(xe.openBlock(),xe.createElementBlock("svg",SB,[m[4]||(m[4]=xe.createElementVNode("circle",{cx:"8",cy:"8",r:"6.4",fill:"none",stroke:"currentColor","stroke-width":"1.5"},null,-1)),b==="error"?(xe.openBlock(),xe.createElementBlock("path",RB)):(xe.openBlock(),xe.createElementBlock("path",CB))])),xe.createElementVNode("span",null,xe.toDisplayString(r.value[b]),1)],10,EB)),64))])]),l.value?(xe.openBlock(),xe.createElementBlock("div",MB,[i.value.length===0?(xe.openBlock(),xe.createElementBlock("p",AB,"발견된 문제가 없습니다.")):c.value.length===0?(xe.openBlock(),xe.createElementBlock("p",PB," 선택한 심각도에 해당하는 항목이 없습니다. ")):(xe.openBlock(),xe.createElementBlock("ul",TB,[(xe.openBlock(!0),xe.createElementBlock(xe.Fragment,null,xe.renderList(c.value,b=>(xe.openBlock(),xe.createElementBlock("li",{key:b.key,class:xe.normalizeClass(["bwl-validation__item",[`is-${b.severity}`,{"is-clickable":b.targetRefs.length>0}]]),onClick:E=>d(b)},[m[5]||(m[5]=xe.createElementVNode("span",{class:"bwl-validation__dot","aria-hidden":"true"},null,-1)),a.value&&o(b)?(xe.openBlock(),xe.createElementBlock("span",OB,"이번 변경")):xe.createCommentVNode("",!0),xe.createElementVNode("span",DB,xe.toDisplayString(b.message),1),xe.createElementVNode("span",{class:"bwl-validation__cat",title:b.code},xe.toDisplayString(b.category),9,IB)],10,kB))),128))]))])):xe.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-60e8b1a9"]]);te.ADDABLE_FLOW_NODE_TYPES=js,te.APPLY_BPMN_OPS_SCHEMA=TE,te.BPMN_EVENT_DEFINITION_TYPES=zs,te.BPMN_MODDLE_EXTENSIONS=Xs,te.BWL_MODDLE_SCHEMA=wh,te.BWL_NS=_h,te.BWL_PREFIX=Tu,te.BWL_SIDES=ku,te.BpmnModelerView=_B,te.BpmnValidationPanel=LB,te.EDITOR=TR,te.FLOW_LABEL_INDENT=nm,te.GROUP_BORDER_MIN_RUN=Ku,te.GROUP_BORDER_NEAR=Lo,te.HEADLESS_BPMN_MODULES=gx,te.HEADLESS_TEXT_METRICS=Do,te.I18N_NS=cS,te.I18N_PREFIX=Yh,te.IR_EVENT_DEFINITIONS=Hs,te.IR_FLOW_NODE_TYPES=Kr,te.LABEL_FORK_MARGIN=Qu,te.LABEL_SHAPE_MIN_DEPTH=hm,te.SEVERITY_ORDER=xd,te.SYMBOLIC_OP_KINDS=Rh,te.SYMBOLIC_OP_SCHEMA=Ch,te.UNDO_EPISODE_COMMAND=Ou,te.applyBpmnOpBatch=lg,te.applyBpmnOps=tg,te.approximateTextWidth=Io,te.auditBpmnGeometry=ym,te.auditBpmnGeometryXml=LS,te.auditBpmnSemantics=dp,te.auditBpmnSemanticsXml=_R,te.auditGeometry=gt,te.auditTargetsOf=ni,te.axisSegmentsOf=dn,te.blackBoxNameRect=Xu,te.buildBpmnOpBatch=PR,te.buildRegistryIndex=bm,te.containerBoundarySegments=$o,te.countBySeverity=_x,te.createBpmnEditorController=kR,te.createBpmnModdle=qh,te.createHeadlessBpmnModeler=Zk,te.crossedShapesOf=bn,te.crossingCost=ti,te.describeProcess=og,te.describeProcessXml=mR,te.diffBpmnElements=cg,te.diffBpmnElementsXml=MR,te.edgeCrossCount=ka,te.edgeCrossingPairsOf=ic,te.edgeCrossingStatsOf=lm,te.executeAsUndoEpisode=Sh,te.followMovedEdgeLabels=jm,te.forwardThreePointCandidates=oc,te.geometryFindingKey=ft,te.installHeadlessBpmnDom=Xh,te.irEventDefinitionOf=Pu,te.isAddableFlowNodeType=bh,te.isChangeScopeMixed=_d,te.isEdgeOverlapFinding=Zu,te.isInChangeScope=la,te.isIrEventDefinition=xh,te.isIrFlowNodeType=vh,te.labelRectsOf=to,te.labelShapeDepth=mm,te.lineCrossesLabel=Oi,te.lineThroughLabel=rm,te.lineThroughShapeLabel=dm,te.loadBpmnXml=Oo,te.lowerOps=Jm,te.oppositeOverlapCount=_S,te.oppositeOverlapOf=tm,te.planBackEdgeBoundaryClearance=Am,te.planCrossPoolRoute=Rm,te.planEdgeRepair=np,te.planLabelLineClearance=sp,te.planLabelPlacement=Nm,te.planMiddleSegmentShifts=_m,te.planOppositeOverlapRepair=Tm,te.planSegmentDetours=rc,te.planShapeLabelClearance=Gm,te.redockIntroducedDetachedEndpoints=Wm,te.repairIntroducedBoundaryHugging=Pm,te.repairIntroducedCrossings=ip,te.repairIntroducedEdgeCrossings=Em,te.repairIntroducedFakeMerges=Om,te.repairIntroducedLabelLines=Hm,te.repairIntroducedOppositeOverlaps=Bm,te.repairIntroducedShapeLabelLines=Vm,te.repairIntroducedSharedSegmentLabels=zm,te.rerouteIntroducedCrossPoolEdges=Cm,te.resolverServicesOf=Km,te.saveBpmnXml=lS,te.sceneCrossingCost=cm,te.sceneFromDefinitions=gm,te.sceneFromRegistry=Xe,te.segmentShapeClearance=nc,te.shapesUnderLabel=Oa,te.sharedSegmentUnderLabel=tc,te.sharedSpansOf=ec,te.sortPanelIssues=wx,te.toPanelIssues=xx,te.touchedElements=AR,te.unreadableOverlapCount=ei,te.unreadableOverlapOf=Bo,te.validateOps=qm,te.warningMessages=qu,Object.defineProperty(te,Symbol.toStringTag,{value:"Module"})}));
342
+ </div>`,lt.RESULT_HTML='<div class="djs-search-result"></div>',lt.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',lt.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const zF={__depends__:[Ys,ep,Oi],searchPad:["type",lt]};function om(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}om.$inject=["elementRegistry","searchPad","canvas","search"],om.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!ft(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:ii(i),id:i.id})),e,{keys:["label","id"]}).map(VF)};function VF(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const WF={__depends__:[zF,KE],__init__:["bpmnSearch"],bpmnSearch:["type",om]},UF="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",qF="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",YF={width:36,height:50},KF={width:50,height:50};function N1(e,t,n){return We("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const $i=5;function Bp(e,t){this._styles=t,e.registerProvider(this)}Bp.$inject=["outline","styles"],Bp.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(G2(e))return n=We("rect"),Le(n,te({x:-$i,y:-$i,rx:4,width:e.width+$i*2,height:e.height+$i*2},t)),n;if(!ft(e))return T(e,"bpmn:Gateway")?(n=We("rect"),te(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),Le(n,te({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):ht(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=We("rect"),Le(n,te({x:-$i,y:-$i,rx:14,width:e.width+$i*2,height:e.height+$i*2},t))):T(e,"bpmn:EndEvent")?(n=We("circle"),Le(n,te({cx:e.width/2,cy:e.height/2,r:e.width/2+$i+1},t))):T(e,"bpmn:Event")?(n=We("circle"),Le(n,te({cx:e.width/2,cy:e.height/2,r:e.width/2+$i},t))):T(e,"bpmn:DataObjectReference")&&$1(e,"bpmn:DataObjectReference")?n=N1(UF,{x:-6,y:-6},t):T(e,"bpmn:DataStoreReference")&&$1(e,"bpmn:DataStoreReference")&&(n=N1(qF,{x:-6,y:-6},t)),n},Bp.prototype.updateOutline=function(e,t){if(!ft(e))return ht(e,["bpmn:SubProcess","bpmn:Group"])?(Le(t,{width:e.width+$i*2,height:e.height+$i*2}),!0):!!ht(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function $1(e,t){var n;return t==="bpmn:DataObjectReference"?n=YF:t==="bpmn:DataStoreReference"&&(n=KF),e.width===n.width&&e.height===n.height}const XF={__depends__:[Yg],__init__:["outlineProvider"],outlineProvider:["type",Bp]};var ZF='<?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 _o(e){Kr.call(this,e)}je(_o,Kr),_o.Viewer=Cr,_o.NavigatedViewer=_c,_o.prototype.createDiagram=function(){return this.importXML(ZF)},_o.prototype._interactionModules=[J0,eE,iE],_o.prototype._modelingModules=[l5,zu,p5,v0,S5,zg,P5,t3,v_,wu,r3,c3,y3,x3,b3,R3,N3,G3,rg,K3,iF,hF,mF,JS,HF,WF,XF],_o.prototype._modules=[].concat(Cr.prototype._modules,_o.prototype._interactionModules,_o.prototype._modelingModules);const JF=Ce.defineComponent({__name:"BpmnModelerView",props:{xml:{},labelFontFamily:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,o=n,r=Ce.ref();let a;async function s(l){if(!a)throw new Error("modeler not mounted");try{const{warnings:u}=await a.importXML(l),p=vd(u);return o("imported",p),{warnings:p}}catch(u){throw o("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 Ce.onMounted(async()=>{a=new _o({container:r.value,moddleExtensions:Ss,additionalModules:[...z0],...i.labelFontFamily?{textRenderer:{defaultStyle:{fontFamily:i.labelFontFamily}}}:{}}),i.xml&&await s(i.xml),o("ready")}),Ce.watch(()=>i.xml,l=>{l&&a&&s(l)}),Ce.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(l,u)=>(Ce.openBlock(),Ce.createElementBlock("div",{ref_key:"container",ref:r,class:"bpmn-modeler-view"},null,512))}}),rm=(e,t)=>{const n=e.__vccOpts||e;for(const[i,o]of t)n[i]=o;return n},QF=rm(JF,[["__scopeId","data-v-7cfbebdb"]]),ej=["title","aria-expanded"],tj=["title","onClick"],nj={viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},ij={key:0,d:"M5.6 5.6l4.8 4.8M10.4 5.6l-4.8 4.8",stroke:"currentColor","stroke-width":"1.5"},oj={key:1,d:"M8 4.6v0.2M8 7v4.4",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round"},rj={key:0,class:"bwl-validation__body"},aj={key:0,class:"bwl-validation__empty"},sj={key:1,class:"bwl-validation__empty"},cj={key:2,class:"bwl-validation__list"},lj=["onClick"],uj={key:0,class:"bwl-validation__scope",title:"이번 변경이 만들거나 건드린 요소"},pj={class:"bwl-validation__msg"},dj=["title"],fj=rm(Ce.defineComponent({__name:"BpmnValidationPanel",props:{controller:{}},setup(e){const n=e.controller,i=Ce.computed(()=>C0(n.issues.value,n.describeElement)),o=Ce.computed(()=>A0(i.value)),r=m=>Qa(m,n.changeScope.value),a=Ce.computed(()=>dg(i.value,n.changeScope.value)),s=Ce.ref({error:!0,warning:!0,info:!0}),c=Ce.computed(()=>T0(i.value.filter(m=>s.value[m.severity]),n.changeScope.value)),l=Ce.ref(!1),u=["error","warning","info"],p={error:"오류",warning:"경고",info:"정보"};function d(m){if(!l.value){l.value=!0;return}s.value[m]=!s.value[m]}function f(m){const h=m.targetRefs[0];h&&n.requestFocus(h)}return(m,h)=>(Ce.openBlock(),Ce.createElementBlock("section",{class:Ce.normalizeClass(["bwl-validation",{"is-open":l.value}])},[Ce.createElementVNode("header",{class:"bwl-validation__head",onClick:h[1]||(h[1]=y=>l.value=!l.value)},[Ce.createElementVNode("button",{type:"button",class:"bwl-validation__toggle",title:l.value?"접기":"펼치기","aria-expanded":l.value},[(Ce.openBlock(),Ce.createElementBlock("svg",{class:Ce.normalizeClass(["bwl-validation__chevron",{"is-open":l.value}]),viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},[...h[2]||(h[2]=[Ce.createElementVNode("path",{d:"M6 3l5 5-5 5",fill:"none",stroke:"currentColor","stroke-width":"1.6"},null,-1)])],2)),h[3]||(h[3]=Ce.createElementVNode("span",null,"검증",-1))],8,ej),Ce.createElementVNode("div",{class:"bwl-validation__counts",onClick:h[0]||(h[0]=Ce.withModifiers(()=>{},["stop"]))},[(Ce.openBlock(),Ce.createElementBlock(Ce.Fragment,null,Ce.renderList(u,y=>Ce.createElementVNode("button",{key:y,type:"button",class:Ce.normalizeClass(["bwl-validation__count",[`is-${y}`,{"is-off":!s.value[y]}]]),title:l.value?`${p[y]} ${s.value[y]?"숨기기":"보이기"}`:"검증 패널 펼치기",onClick:w=>d(y)},[(Ce.openBlock(),Ce.createElementBlock("svg",nj,[h[4]||(h[4]=Ce.createElementVNode("circle",{cx:"8",cy:"8",r:"6.4",fill:"none",stroke:"currentColor","stroke-width":"1.5"},null,-1)),y==="error"?(Ce.openBlock(),Ce.createElementBlock("path",ij)):(Ce.openBlock(),Ce.createElementBlock("path",oj))])),Ce.createElementVNode("span",null,Ce.toDisplayString(o.value[y]),1)],10,tj)),64))])]),l.value?(Ce.openBlock(),Ce.createElementBlock("div",rj,[i.value.length===0?(Ce.openBlock(),Ce.createElementBlock("p",aj,"발견된 문제가 없습니다.")):c.value.length===0?(Ce.openBlock(),Ce.createElementBlock("p",sj," 선택한 심각도에 해당하는 항목이 없습니다. ")):(Ce.openBlock(),Ce.createElementBlock("ul",cj,[(Ce.openBlock(!0),Ce.createElementBlock(Ce.Fragment,null,Ce.renderList(c.value,y=>(Ce.openBlock(),Ce.createElementBlock("li",{key:y.key,class:Ce.normalizeClass(["bwl-validation__item",[`is-${y.severity}`,{"is-clickable":y.targetRefs.length>0}]]),onClick:w=>f(y)},[h[5]||(h[5]=Ce.createElementVNode("span",{class:"bwl-validation__dot","aria-hidden":"true"},null,-1)),a.value&&r(y)?(Ce.openBlock(),Ce.createElementBlock("span",uj,"이번 변경")):Ce.createCommentVNode("",!0),Ce.createElementVNode("span",pj,Ce.toDisplayString(y.message),1),Ce.createElementVNode("span",{class:"bwl-validation__cat",title:y.code},Ce.toDisplayString(y.category),9,dj)],10,lj))),128))]))])):Ce.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-60e8b1a9"]]),hj={key:0,class:"bwl-locale",role:"radiogroup","aria-label":"표시 언어"},gj=["aria-checked","title","data-locale","onClick"],mj={class:"bwl-locale__label"},yj={key:0,class:"bwl-locale__badge"},vj=rm(Ce.defineComponent({__name:"BpmnDisplayLocaleSwitcher",props:{controller:{}},setup(e){const n=e.controller;function i(r){try{return new Intl.DisplayNames([r],{type:"language"}).of(r)??r}catch{return r}}const o=Ce.computed(()=>{const r=n.i18n.value;return r?r.locales.map(a=>{const s=r.counts[a]??{untranslated:0,reviewRequested:0},c=a===r.designLocale?"설계 언어":"병기 언어";return{locale:a,label:i(a),active:a===r.displayLocale,design:a===r.designLocale,pending:s.untranslated+s.reviewRequested,title:`${c} — 미번역 ${s.untranslated} · 확인 요청 ${s.reviewRequested}`}}):[]});return(r,a)=>o.value.length?(Ce.openBlock(),Ce.createElementBlock("div",hj,[(Ce.openBlock(!0),Ce.createElementBlock(Ce.Fragment,null,Ce.renderList(o.value,s=>(Ce.openBlock(),Ce.createElementBlock("button",{key:s.locale,type:"button",role:"radio",class:Ce.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=>Ce.unref(n).setDisplayLocale(s.locale)},[Ce.createElementVNode("span",mj,Ce.toDisplayString(s.label),1),s.pending>0?(Ce.openBlock(),Ce.createElementBlock("span",yj,Ce.toDisplayString(s.pending),1)):Ce.createCommentVNode("",!0)],10,gj))),128))])):Ce.createCommentVNode("",!0)}}),[["__scopeId","data-v-04311925"]]);ue.ADDABLE_FLOW_NODE_TYPES=qc,ue.APPLY_BPMN_OPS_SCHEMA=MM,ue.BPMN_EVENT_DEFINITION_TYPES=Kc,ue.BPMN_MODDLE_EXTENSIONS=Ss,ue.BPMN_MODELER_VIEW_MODULES=z0,ue.BWL_MODDLE_SCHEMA=Lm,ue.BWL_NS=Dm,ue.BWL_PREFIX=qp,ue.BWL_REVIEW_REQUEST_TYPE=Zc,ue.BWL_SIDES=Yp,ue.BpmnDisplayLocaleSwitcher=vj,ue.BpmnModelerView=QF,ue.BpmnValidationPanel=fj,ue.EDITOR=OP,ue.FLOW_LABEL_INDENT=yy,ue.GROUP_BORDER_MIN_RUN=xd,ue.GROUP_BORDER_NEAR=Ma,ue.HEADLESS_BPMN_MODULES=lg,ue.HEADLESS_TEXT_METRICS=ao,ue.HeadlessReplay=gg,ue.HeadlessReplayModule=I0,ue.I18N_DISPLAY_REDRAWN_EVENT=wc,ue.I18N_NS=sM,ue.I18N_PREFIX=Hm,ue.I18N_REVIEW_REQUESTED_CLASS=k0,ue.I18N_TRANSLATION_TYPE=jr,ue.I18N_UNTRANSLATED_CLASS=P0,ue.I18nDisplay=fg,ue.I18nDisplayModule=D0,ue.IR_EVENT_DEFINITIONS=Yc,ue.IR_FLOW_NODE_TYPES=$r,ue.IR_TEXT_LOCALES=Xc,ue.LABEL_FORK_MARGIN=_d,ue.LABEL_SHAPE_MIN_DEPTH=Ty,ue.SET_TRANSLATIONS_COMMAND=tl,ue.SEVERITY_ORDER=pg,ue.SYMBOLIC_OP_KINDS=Gm,ue.SYMBOLIC_OP_SCHEMA=zm,ue.SetTranslationsHandler=nd,ue.TranslationCommands=od,ue.TranslationCommandsModule=rd,ue.TranslationStateIndex=FP,ue.UNDO_EPISODE_COMMAND=Kp,ue.UPDATE_TRANSLATION_COMMAND=el,ue.UpdateTranslationHandler=td,ue.applyBpmnOpBatch=tx,ue.applyBpmnOps=Xd,ue.applyLocaleBackfill=$P,ue.applyTranslationLocaleRestore=VP,ue.approximateTextWidth=Vr,ue.auditBpmnGeometry=Oy,ue.auditBpmnGeometryXml=MA,ue.auditBpmnSemantics=Jd,ue.auditBpmnSemanticsXml=xP,ue.auditGeometry=ut,ue.auditTargetsOf=hn,ue.axisSegmentsOf=fn,ue.blackBoxNameRect=bd,ue.buildBpmnOpBatch=CP,ue.buildRegistryIndex=Ly,ue.collectTranslationStates=lx,ue.containerBoundarySegments=Ta,ue.countBySeverity=A0,ue.createBpmnEditorController=DP,ue.createBpmnModdle=cy,ue.createHeadlessBpmnModeler=dN,ue.crossedShapesOf=Tt,ue.crossingCost=kn,ue.describeProcess=qv,ue.describeProcessXml=fP,ue.diffBpmnElements=Xv,ue.diffBpmnElementsXml=RP,ue.documentLocalesOf=xs,ue.edgeCrossCount=Pa,ue.edgeCrossingPairsOf=Si,ue.edgeCrossingStatsOf=Sy,ue.executeAsUndoEpisode=Bm,ue.feedGeneratedIds=ex,ue.followMovedEdgeLabels=hv,ue.forwardThreePointCandidates=dl,ue.geometryFindingKey=ct,ue.inferScriptLocale=Al,ue.installHeadlessBpmnDom=py,ue.irEventDefinitionOf=Up,ue.isAddableFlowNodeType=km,ue.isChangeScopeMixed=dg,ue.isEdgeOverlapFinding=wd,ue.isGuardedGridSnapping=kN,ue.isInChangeScope=Qa,ue.isIrEventDefinition=Om,ue.isIrFlowNodeType=Pm,ue.isIrTextLocale=ZR,ue.labelRectsOf=rr,ue.labelShapeDepth=Py,ue.labelSlot=Jo,ue.lineCrossesLabel=qi,ue.lineThroughLabel=xy,ue.lineThroughShapeLabel=Ay,ue.loadBpmnXml=Ra,ue.localeTextsOf=ed,ue.lowerOps=Gv,ue.mergeUndoSteps=$m,ue.nameLocalesOf=bs,ue.oppositeOverlapCount=sA,ue.oppositeOverlapOf=my,ue.piercesOwnEndpoint=Sd,ue.planBackEdgeBoundaryClearance=Zy,ue.planCrossPoolRoute=qy,ue.planEdgeRepair=hl,ue.planLabelLineClearance=zd,ue.planLabelPlacement=uv,ue.planLocaleBackfill=NP,ue.planMiddleSegmentShifts=jy,ue.planOppositeOverlapRepair=iv,ue.planSegmentDetours=pl,ue.planShapeLabelClearance=Wd,ue.planTranslationLocaleRestore=zP,ue.poolOverlapsOf=Md,ue.recordGeneratedIds=Qv,ue.redockIntroducedDetachedEndpoints=vv,ue.repairIntroducedBoundaryHugging=Qy,ue.repairIntroducedCrossings=Pd,ue.repairIntroducedEdgeCrossings=Gy,ue.repairIntroducedFakeMerges=rv,ue.repairIntroducedLabelLines=gv,ue.repairIntroducedOppositeOverlaps=lv,ue.repairIntroducedShapeLabelLines=yv,ue.repairIntroducedSharedSegmentLabels=mv,ue.replayAgentTurn=nx,ue.rerouteIntroducedCrossPoolEdges=Yy,ue.resolverServicesOf=kv,ue.reviewRequestValuesOf=id,ue.reviewRequestsOf=Qo,ue.rootLangOf=Qp,ue.saveBpmnXml=XC,ue.sceneCrossingCost=Ey,ue.sceneFromDefinitions=ky,ue.sceneFromRegistry=Ge,ue.segmentShapeClearance=Po,ue.shapesUnderLabel=ka,ue.sharedEndpointCrossingPairsOf=Ri,ue.sharedSegmentUnderLabel=Ca,ue.sharedSpansOf=ul,ue.sortPanelIssues=T0,ue.toPanelIssues=C0,ue.touchedElements=MP,ue.translationLocale=ln,ue.translationsOf=Ui,ue.undoStepMark=Nm,ue.unreadableOverlapCount=qn,ue.unreadableOverlapOf=or,ue.validateOps=_v,ue.warningMessages=vd,Object.defineProperty(ue,Symbol.toStringTag,{value:"Module"})}));