@g1cloud/bpmn-modeler-next 5.0.0-alpha.82 → 5.0.0-alpha.84
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bpmn-modeler.js +1340 -1333
- package/dist/bpmn-modeler.umd.cjs +23 -23
- package/package.json +1 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
(function(ee,ge){typeof exports=="object"&&typeof module<"u"?ge(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],ge):(ee=typeof globalThis<"u"?globalThis:ee||self,ge(ee.BpmnModeler={},ee.Vue))})(this,(function(ee,ge){"use strict";var YL=Object.defineProperty;var qL=(ee,ge,Mr)=>ge in ee?YL(ee,ge,{enumerable:!0,configurable:!0,writable:!0,value:Mr}):ee[ge]=Mr;var no=(ee,ge,Mr)=>qL(ee,typeof ge!="symbol"?ge+"":ge,Mr);const Mr=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","subProcess","boundaryEvent"],fs=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway"];function Ad(e){return Mr.includes(e)}function Pd(e){return fs.includes(e)}const Md="http://g1project.net/spec/bpmn/bwl/1.0",Ul="bwl",Yl=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],Td={name:"bwl-hints",uri:Md,prefix:Ul,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"}]}]},ql="bwl.undoEpisode",kd=new WeakSet;function h0(e){kd.has(e)||(e.register(ql,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),kd.add(e))}function Od(e,t){h0(e);const n={run:t};if(e.execute(ql,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}const Dd=["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"],m0={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},g0={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},y0={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},v0={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다. ⚠ type 집합은 **읽을 수 있는 것보다 좁다** — describe 는 subProcess·boundaryEvent 도 노드로 내지만 그 둘을 새로 만드는 배치는 미실증이라 여기서 받지 않는다(B-87 ⓐ).",properties:{id:{type:"string"},type:{type:"string",enum:[...fs]},name:{type:"string"},participant:{type:"string",description:"소속 풀 id(협업 문서)."},lane:{type:"string",description:"소속 레인 id(풀 정의에 선언된 것)."}},required:["id","type"],additionalProperties:!1},b0={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},x0={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},_0={type:"object",description:"메시지 플로우(풀 경계를 넘는 연결 — 노드 또는 블랙박스 풀 자체가 끝점).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"}},required:["id","source","target"],additionalProperties:!1},w0={type:"object",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},E0={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},S0={type:"object",properties:{id:{type:"string"},text:{type:"string"}},required:["id","text"],additionalProperties:!1},R0={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},C0={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},A0={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...Yl]},offset:{type:"number",description:"앵커 가장자리 → 주석 가장자리 간격(px). 생략 시 50."}},required:["anchor","side"],additionalProperties:!1};function dn(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const P0={"participant.add":dn("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트 — **작을수록 위**(생략 시 op 순서가 곧 배치 순서). 값은 상대 순서만 쓰므로 1,2,3… 연속이든 10,20,30 간격이든 같다.",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":dn("participant.update",{description:"풀 이름/레인 갱신. lanes 는 전체 재선언(생략 = 보존) — 기존 레인을 유지하려면 함께 다시 나열한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"]}),"node.add":dn("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":dn("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:[...fs]},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["id"]}),"sequenceFlow.add":dn("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":dn("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":dn("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":dn("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataStore.add":dn("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":dn("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataAssociation.add":dn("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":dn("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":dn("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":dn("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":dn("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":dn("group.update",{description:"그룹 이름/멤버 갱신. members 는 전체 재선언(생략 = 보존).",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},members:{type:"array",items:{type:"string"}}},required:["id"]}),"element.remove":dn("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},Id={anyOf:Dd.map(e=>P0[e])},M0={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:g0,irParticipant:y0,irNode:v0,irFlowCondition:b0,irSequenceFlow:x0,irMessageFlow:_0,irDataStore:w0,irDataAssociation:E0,irTextAnnotation:S0,irAssociation:R0,irGroup:C0,bwlPlacement:A0,nullableString:m0,symbolicOp:Id}};function Kl(e){return Array.prototype.concat.apply([],e)}const ta=Object.prototype.toString,T0=Object.prototype.hasOwnProperty;function Tr(e){return e===void 0}function Yt(e){return e!==void 0}function io(e){return e==null}function Be(e){return ta.call(e)==="[object Array]"}function Qt(e){return ta.call(e)==="[object Object]"}function Fe(e){return ta.call(e)==="[object Number]"}function Jt(e){const t=ta.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function Pn(e){return ta.call(e)==="[object String]"}function k0(e){if(!Be(e))throw new Error("must supply array")}function Mn(e,t){return!io(e)&&T0.call(e,t)}function vt(e,t){const n=hs(t);let i;return F(e,function(r,o){if(n(r,o))return i=r,!1}),i}function Ld(e,t){const n=hs(t);let i=Be(e)?-1:void 0;return F(e,function(r,o){if(n(r,o))return i=o,!1}),i}function Ke(e,t){const n=hs(t);let i=[];return F(e,function(r,o){n(r,o)&&i.push(r)}),i}function F(e,t){let n,i;if(Tr(e))return;const r=Be(e)?B0:L0;for(let o in e)if(Mn(e,o)&&(n=e[o],i=t(n,r(o)),i===!1))return n}function O0(e,t){if(Tr(e))return[];k0(e);const n=hs(t);return e.filter(function(i,r){return!n(i,r)})}function Tn(e,t,n){return F(e,function(i,r){n=t(n,i,r)}),n}function kr(e,t){return!!Tn(e,function(n,i,r){return n&&t(i,r)},!0)}function Xi(e,t){return!!vt(e,t)}function hn(e,t){let n=[];return F(e,function(i,r){n.push(t(i,r))}),n}function ds(e){return e&&Object.keys(e)||[]}function D0(e){return ds(e).length}function ro(e){return hn(e,t=>t)}function oo(e,t,n={}){return t=Xl(t),F(e,function(i){let r=t(i)||"_",o=n[r];o||(o=n[r]=[]),o.push(i)}),n}function Bd(e,...t){e=Xl(e);let n={};return F(t,r=>oo(r,e,n)),hn(n,function(r,o){return r[0]})}const I0=Bd;function di(e,t){t=Xl(t);let n=[];return F(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)}),hn(n,i=>i.v)}function ao(e){return function(t){return kr(e,function(n,i){return t[i]===n})}}function Xl(e){return Jt(e)?e:t=>t[e]}function hs(e){return Jt(e)?e:t=>t===e}function L0(e){return e}function B0(e){return Number(e)}function Zl(e,t){let n,i,r,o;function a(f){let p=Date.now(),d=f?0:o+t-p;if(d>0)return s(d);e.apply(r,i),c()}function s(f){n=setTimeout(a,f)}function c(){n&&clearTimeout(n),n=o=i=r=void 0}function l(){n&&a(!0),c()}function u(...f){o=Date.now(),i=f,r=this,n||s(t)}return u.flush=l,u.cancel=c,u}function Rn(e,t){return e.bind(t)}function W(e,...t){return Object.assign(e,...t)}function N0(e,t,n){let i=e;return F(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];Yt(a)&&io(s)&&(s=i[r]=isNaN(+a)?{}:[]),Tr(a)?Tr(n)?delete i[r]:i[r]=n:i=s}),e}function li(e,t){let n={},i=Object(e);return F(t,function(r){r in i&&(n[r]=e[r])}),n}function hi(e,t){let n={},i=Object(e);return F(i,function(r,o){t.indexOf(o)===-1&&(n[o]=r)}),n}function Ql(){}Ql.prototype.get=function(e){return this.$model.properties.get(this,e)},Ql.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function Nd(e,t){this.model=e,this.properties=t}Nd.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(Ql.prototype);F(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}),F(a,Rn(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 $0=W(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),$d=W(Object.create(null),{String:function(e){return e},Boolean:function(e){return e==="true"},Integer:function(e){return parseInt(e,10)},Real:function(e){return parseFloat(e)}});function Jl(e,t){var n=$d[e];return n?n(t):t}function eu(e){return!!$0[e]}function Fd(e){return!!$d[e]}function mn(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 zn(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}zn.prototype.build=function(){return li(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},zn.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)},zn.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},zn.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=mn(r[0],i),a=mn(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},zn.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},zn.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},zn.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},zn.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},zn.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},zn.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")},zn.prototype.hasProperty=function(e){return this.propertiesByName[e]},zn.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,r=e.name;r in n||(F(e.properties,Rn(function(o){o=W({},o,{name:o.ns.localName,inherited:t}),Object.defineProperty(o,"definedBy",{value:e});var a=o.replaces,s=o.redefines;a||s?this.redefineProperty(o,a||s,a):(o.isBody&&this.setBodyProperty(o),o.isId&&this.setIdProperty(o),this.addProperty(o))},this)),i.push(e),n[r]=e)};function Zi(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,F(e,Rn(this.registerPackage,this))}Zi.prototype.getPackage=function(e){return this.packageMap[e]},Zi.prototype.getPackages=function(){return this.packages},Zi.prototype.registerPackage=function(e){e=W({},e);var t=this.packageMap;jd(t,e,"prefix"),jd(t,e,"uri"),F(e.types,Rn(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},Zi.prototype.registerType=function(e,t){e=W({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:W({},e.meta||{})});var n=mn(e.name,t.prefix),i=n.name,r=Object.create(null);F(e.properties,Rn(function(o){var a=mn(o.name,n.prefix),s=a.name;eu(o.type)||(o.type=mn(o.type,a.prefix).name),W(o,{ns:a,name:s}),r[s]=o},this)),W(e,{ns:n,name:i,propertiesByName:r}),F(e.extends,Rn(function(o){var a=mn(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},Zi.prototype.mapTypes=function(e,t,n){var i=eu(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(c,l){var u=mn(c,eu(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+">");F(i.superClass,n?a:s),t(i,!n),F(i.traits,a)},Zi.prototype.getEffectiveDescriptor=function(e){var t=mn(e),n=new zn(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},Zi.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function jd(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function Or(e){this.model=e}Or.prototype.set=function(e,t,n){if(!Pn(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),r=i&&i.name;F0(n)?i?delete e[r]:delete e.$attrs[tu(t)]:i?r in e?e[r]=n:Hd(e,i,n):e.$attrs[tu(t)]=n},Or.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[tu(t)];var i=n.name;return!e[i]&&n.isMany&&Hd(e,n,[]),e[i]},Or.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=W({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},Or.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},Or.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},Or.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 F0(e){return typeof e>"u"}function Hd(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function tu(e){return e.replace(/^:/,"")}function Xn(e,t={}){this.properties=new Or(this),this.factory=new Nd(this,this.properties),this.registry=new Zi(e,this.properties),this.typeCache=Object.create(null),this.config=t}Xn.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},Xn.prototype.getType=function(e){var t=this.typeCache,n=Pn(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},Xn.prototype.createAny=function(e,t,n){var i=mn(e),r={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){N0(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}),F(n,function(a,s){Qt(a)&&a.value!==void 0?r[a.name]=a.value:r[s]=a}),r},Xn.prototype.getPackage=function(e){return this.registry.getPackage(e)},Xn.prototype.getPackages=function(){return this.registry.getPackages()},Xn.prototype.getElementDescriptor=function(e){return e.$descriptor},Xn.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},Xn.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},Xn.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var zd=String.fromCharCode,j0=Object.prototype.hasOwnProperty,H0=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,na={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(na).forEach(function(e){na[e.toUpperCase()]=na[e]});function z0(e,t,n,i){return i?j0.call(na,i)?na[i]:"&"+i+";":zd(t||parseInt(n,16))}function Dr(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(H0,z0):e}var Gd="non-whitespace outside of root node";function Qi(e){return new Error(e)}function G0(e){return"missing namespace for prefix <"+e+">"}function ms(e){return{get:e,enumerable:!0}}function V0(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var Vd=Symbol("nameCache");function nu(e){return e+"$uri"}function W0(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[nu(i)]=n;return t}function gs(){return{line:0,column:0}}function U0(e){throw e}function Wd(e){if(!this)return new Wd(e);var t=e&&e.proxy,n,i,r,o,a=U0,s,c,l,u,f=gs,p=!1,d=!1,m="",h=!1,y=!1,v=null,g=!1,b,x,C,M;function k(I){I instanceof Error||(I=Qi(I)),v=I,a(I,f)}function P(I){s&&(I instanceof Error||(I=Qi(I)),s(I,f))}this.on=function(I,z){if(typeof z!="function")throw Qi("required args <name, cb>");switch(I){case"openTag":i=z;break;case"text":n=z;break;case"closeTag":r=z;break;case"error":a=z;break;case"warn":s=z;break;case"cdata":o=z;break;case"attention":u=z;break;case"question":l=z;break;case"comment":c=z;break;default:throw Qi("unsupported event: "+I)}return this},this.ns=function(I){if(typeof I>"u"&&(I={}),typeof I!="object")throw Qi("required args <nsMap={}>");var z=Object.create(null),oe;for(oe in I)z[oe]=I[oe];return y=!0,M=z,this};function B(){b=y?[]:null,x=y?W0(M):null,C=[],f=gs,g=!1,v=null,d=!1,m=""}this.parse=function(I){if(typeof I!="string")throw Qi("required args <xml=string>");if(p)throw Qi("parse during stream; call end() first");return B(),D(I),f=gs,g=!1,v},this.write=function(I){if(typeof I!="string")throw Qi("required args <xml=string>");return p||(B(),p=!0),v||(m=D(m+I,!0)||""),this},this.end=function(){return p||B(),p=!1,v||D(m),m="",f=gs,g=!1,v},this.stop=function(){g=!0};function D(I,z=!1){var oe=null,ye=null,Ve,He=0,it=!1,K=!1,Z=0,se=0,xe,q,V,ne,Te,yt,T,w,E,G="",U=0,X;function Ce(pt,Wt){var nn=pt.indexOf(":");if(nn===-1)return pt;var rn=x[pt.substring(0,nn)];return rn?Wt===rn?pt.substr(nn+1):rn+pt.substr(nn):(P(G0(pt.substring(0,nn))),null)}function Ue(){if(X!==null)return X;var pt,Wt,nn=y&&x.xmlns,rn=y&&h?[]:null,xt=U,Dt=G,bn=Dt.length,Pr,jn,Ti,Hn,Nt,Kn={},jl=new Set,Ut,Je,ct;e:for(;xt<bn;xt++)if(Ut=!1,Je=Dt.charCodeAt(xt),!(Je===32||Je<14&&Je>8)){for((Je<65||Je>122||Je>90&&Je<97)&&Je!==95&&Je!==58&&(P("illegal first char attribute name"),Ut=!0),ct=xt+1;ct<bn;ct++)if(Je=Dt.charCodeAt(ct),!(Je>96&&Je<123||Je>64&&Je<91||Je>47&&Je<59||Je===46||Je===45||Je===95)){if(Je===32||Je<14&&Je>8){P("missing attribute value"),xt=ct;continue e}if(Je===61)break;P("illegal attribute name char"),Ut=!0}if(Nt=Dt.substring(xt,ct),Nt==="xmlns:xmlns"&&(P("illegal declaration of xmlns"),Ut=!0),Je=Dt.charCodeAt(ct+1),Je===34)ct=Dt.indexOf('"',xt=ct+2),ct===-1&&(ct=Dt.indexOf("'",xt),ct!==-1&&(P("attribute value quote missmatch"),Ut=!0));else if(Je===39)ct=Dt.indexOf("'",xt=ct+2),ct===-1&&(ct=Dt.indexOf('"',xt),ct!==-1&&(P("attribute value quote missmatch"),Ut=!0));else for(P("missing attribute value quotes"),Ut=!0,ct=ct+1;ct<bn&&(Je=Dt.charCodeAt(ct+1),!(Je===32||Je<14&&Je>8));ct++);for(ct===-1&&(P("missing closing quotes"),ct=bn,Ut=!0),Ut||(Ti=Dt.substring(xt,ct)),xt=ct;ct+1<bn&&(Je=Dt.charCodeAt(ct+1),!(Je===32||Je<14&&Je>8));ct++)xt===ct&&(P("illegal character after attribute end"),Ut=!0);if(xt=ct+1,Ut)continue e;if(jl.has(Nt)){P("attribute <"+Nt+"> already defined");continue}if(jl.add(Nt),!y){Kn[Nt]=Ti;continue}if(h){if(jn=Nt==="xmlns"?"xmlns":Nt.charCodeAt(0)===120&&Nt.substr(0,6)==="xmlns:"?Nt.substr(6):null,jn!==null){if(pt=Dr(Ti),Wt=nu(jn),Hn=M[pt],!Hn){if(jn==="xmlns"||Wt in x&&x[Wt]!==pt)do Hn="ns"+He++;while(typeof x[Hn]<"u");else Hn=jn;M[pt]=Hn}x[jn]!==Hn&&(Pr||(x=V0(x),Pr=!0),x[jn]=Hn,jn==="xmlns"&&(x[nu(Hn)]=pt,nn=Hn),x[Wt]=pt),Kn[Nt]=Ti;continue}rn.push(Nt,Ti);continue}Nt=Ce(Nt,nn),Nt!==null&&(Kn[Nt]=Ti)}if(h)for(xt=0,bn=rn.length;xt<bn;xt++)Nt=Ce(rn[xt++],nn),Ti=rn[xt],Nt!==null&&(Kn[Nt]=Ti);return X=Kn}function st(){for(var pt=/(\r\n|\r|\n)/g,Wt=0,nn=0,rn=0,xt=se,Dt,bn;Z>=rn&&(Dt=pt.exec(I),!(!Dt||(xt=Dt[0].length+Dt.index,xt>Z)));)Wt+=1,rn=xt;return Z==-1?(nn=xt,bn=I.substring(se)):se===0?bn=I.substring(se,Z):(nn=Z-rn,bn=se==-1?I.substring(Z):I.substring(Z,se+1)),{data:bn,line:Wt,column:nn}}for(f=st,t&&(E=Object.create({},{name:ms(function(){return T}),originalName:ms(function(){return w}),attrs:ms(Ue),ns:ms(function(){return x})}));se!==-1;){if(I.charCodeAt(se)===60?Z=se:Z=I.indexOf("<",se),Z===-1){if(z)return I.substring(se);if(C.length)return k("unexpected end of file");if(!d)return k("missing start tag");se<I.length&&I.substring(se).trim()&&P(Gd);return}if(d||(d=!0),se!==Z){if(C.length){if(n&&(n(I.substring(se,Z),Dr,f),g))return}else if(I.substring(se,Z).trim()&&(P(Gd),g))return}if(ne=I.charCodeAt(Z+1),ne===33){if(V=I.charCodeAt(Z+2),V===91&&I.substr(Z+3,6)==="CDATA["){if(se=I.indexOf("]]>",Z),se===-1)return z?I.substring(Z):k("unclosed cdata");if(o&&(o(I.substring(Z+9,se),f),g))return;se+=3;continue}if(V===45&&I.charCodeAt(Z+3)===45){if(se=I.indexOf("-->",Z),se===-1)return z?I.substring(Z):k("unclosed comment");if(c&&(c(I.substring(Z+4,se),Dr,f),g))return;se+=3;continue}}if(ne===63){if(se=I.indexOf("?>",Z),se===-1)return z?I.substring(Z):k("unclosed question");if(l&&(l(I.substring(Z,se+2),f),g))return;se+=2;continue}for(xe=Z+1;;xe++){if(Te=I.charCodeAt(xe),isNaN(Te))return z?I.substring(Z):(se=-1,k("unclosed tag"));if(Te===34)V=I.indexOf('"',xe+1),xe=V!==-1?V:xe;else if(Te===39)V=I.indexOf("'",xe+1),xe=V!==-1?V:xe;else if(Te===62){se=xe;break}}if(ne===33){if(u&&(u(I.substring(Z,se+1),Dr,f),g))return;se+=1;continue}if(X={},ne===47){if(it=!1,K=!0,!C.length)return k("missing open tag");if(xe=T=C.pop(),V=Z+2+xe.length,I.substring(Z+2,V)!==xe)return k("closing tag mismatch");for(;V<se;V++)if(ne=I.charCodeAt(V),!(ne===32||ne>8&&ne<14))return k("close tag")}else{if(I.charCodeAt(se-1)===47?(xe=T=I.substring(Z+1,se-1),it=!0,K=!0):(xe=T=I.substring(Z+1,se),it=!0,K=!1),!(ne>96&&ne<123||ne>64&&ne<91||ne===95||ne===58))return k("illegal first char nodeName");for(V=1,q=xe.length;V<q;V++)if(ne=xe.charCodeAt(V),!(ne>96&&ne<123||ne>64&&ne<91||ne>47&&ne<59||ne===45||ne===95||ne==46)){if(ne===32||ne<14&&ne>8){T=xe.substring(0,V),X=null;break}return k("invalid nodeName")}K||C.push(T)}if(y){Ve=x,it&&(K||b.push(Ve),X===null&&(h=xe.indexOf("xmlns",V)!==-1)&&(U=V,G=xe,Ue(),h=!1)),w=T,ye!==x&&(oe=x[Vd],oe===void 0&&(oe=x[Vd]=Object.create(null)),ye=x);var Ot=oe[T];if(Ot!==void 0)T=Ot;else{if(ne=T.indexOf(":"),ne!==-1){if(yt=x[T.substring(0,ne)],!yt)return k("missing namespace on <"+w+">");T=T.substr(ne+1)}else yt=x.xmlns;yt&&(T=yt+":"+T),oe[w]=T}}if(it&&(U=V,G=xe,i&&(t?i(E,Dr,K,f):i(T,Ue,Dr,K,f),g)))return;if(K){if(r&&(r(t?E:T,Dr,it,f),g))return;y&&(it?x=Ve:x=b.pop())}se+=1}}}function Ud(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var iu={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},Yd="property";function qd(e){return e.xml&&e.xml.serialize}function Y0(e){const t=qd(e);return t!==Yd&&(t||null)}function q0(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Kd(e,t){return Ud(t)?e.prefix+":"+q0(e.localName):e.name}function K0(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 X0(e,t,n){const i=mn(e,t.xmlns),r=`${t[i.prefix]||i.prefix}:${i.localName}`,o=mn(r);var a=n.getPackage(o.prefix);return K0(o,a)}function Ji(e){return new Error(e)}function ki(e){return e.$descriptor}function Z0(e){W(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw Ji("expected element");var n=this.elementsById,i=ki(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 Ji("duplicate ID <"+o+">");n[o]=t}},this.addWarning=function(t){this.warnings.push(t)}}function ia(){}ia.prototype.handleEnd=function(){},ia.prototype.handleText=function(){},ia.prototype.handleNode=function(){};function ru(){}ru.prototype=Object.create(ia.prototype),ru.prototype.handleNode=function(){return this};function so(){}so.prototype=Object.create(ia.prototype),so.prototype.handleText=function(e){this.body=(this.body||"")+e};function ra(e,t){this.property=e,this.context=t}ra.prototype=Object.create(so.prototype),ra.prototype.handleNode=function(e){if(this.element)throw Ji("expected no sub nodes");return this.element=this.createReference(e),this},ra.prototype.handleEnd=function(){this.element.id=this.body},ra.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function ou(e,t){this.element=t,this.propertyDesc=e}ou.prototype=Object.create(so.prototype),ou.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=Jl(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function ys(){}ys.prototype=Object.create(so.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 xn(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}xn.prototype=Object.create(ys.prototype),xn.prototype.addReference=function(e){this.context.addReference(e)},xn.prototype.handleText=function(e){var t=this.element,n=ki(t),i=n.bodyProperty;if(!i)throw Ji("unexpected body text <"+e+">");so.prototype.handleText.call(this,e)},xn.prototype.handleEnd=function(){var e=this.body,t=this.element,n=ki(t),i=n.bodyProperty;i&&e!==void 0&&(e=Jl(i.type,e),t.set(i.name,e))},xn.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=ki(n),r=this.context,o=new n({}),a=this.model,s;return F(t,function(c,l){var u=i.propertiesByName[l],f;u&&u.isReference?u.isMany?(f=c.split(" "),F(f,function(p){r.addReference({element:o,property:u.ns.name,id:p})})):r.addReference({element:o,property:u.ns.name,id:c}):(u?c=Jl(u.type,c):l==="xmlns"?l=":"+l:(s=mn(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},xn.prototype.getPropertyForNode=function(e){var t=e.name,n=mn(t),i=this.type,r=this.model,o=ki(i),a=n.name,s=o.propertiesByName[a];if(s&&!s.isAttr){const l=Y0(s);if(l){const u=e.attributes[l];if(u){const f=X0(u,e.ns,r),p=r.getType(f);return W({},s,{effectiveType:ki(p).name})}}return s}var c=r.getPackage(n.prefix);if(c){const l=Kd(n,c),u=r.getType(l);if(s=vt(o.properties,function(f){return!f.isVirtual&&!f.isReference&&!f.isAttribute&&u.hasType(f.type)}),s)return W({},s,{effectiveType:ki(u).name})}else if(s=vt(o.properties,function(l){return!l.isReference&&!l.isAttribute&&l.type==="Element"}),s)return s;throw Ji("unrecognized element <"+n.name+">")},xn.prototype.toString=function(){return"ElementDescriptor["+ki(this.type).name+"]"},xn.prototype.valueHandler=function(e,t){return new ou(e,t)},xn.prototype.referenceHandler=function(e){return new ra(e,this.context)},xn.prototype.handler=function(e){return e==="Element"?new co(this.model,e,this.context):new xn(this.model,e,this.context)},xn.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,Fd(n))return this.valueHandler(t,i);t.isReference?r=this.referenceHandler(t).handleNode(e):r=this.handler(n).handleNode(e);var o=r.element;return o!==void 0&&(t.isMany?i.get(t.name).push(o):i.set(t.name,o),t.isReference?(W(o,{element:i}),this.context.addReference(o)):o.$parent=i),r};function au(e,t,n){xn.call(this,e,t,n)}au.prototype=Object.create(xn.prototype),au.prototype.createElement=function(e){var t=e.name,n=mn(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&Kd(n,o)||t;if(!r.hasType(a))throw Ji("unexpected element <"+e.originalName+">");return xn.prototype.createElement.call(this,e)};function co(e,t,n){this.model=e,this.context=n}co.prototype=Object.create(ys.prototype),co.prototype.createElement=function(e){var t=e.name,n=mn(t),i=n.prefix,r=e.ns[i+"$uri"],o=e.attributes;return this.model.createAny(t,r,o)},co.prototype.handleChild=function(e){var t=new co(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},co.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function su(e){e instanceof Xn&&(e={model:e}),W(this,{lax:!1},e)}su.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 r=this.model,o=this.lax,a=new Z0(W({},t,{rootHandler:i})),s=new Wd({proxy:!0}),c=Q0();i.context=a,c.push(i);function l(C,M,k){var P=M(),B=P.line,D=P.column,I=P.data;I.charAt(0)==="<"&&I.indexOf(" ")!==-1&&(I=I.slice(0,I.indexOf(" "))+">");var z="unparsable content "+(I?I+" ":"")+`detected
|
|
1
|
+
(function(ee,ge){typeof exports=="object"&&typeof module<"u"?ge(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],ge):(ee=typeof globalThis<"u"?globalThis:ee||self,ge(ee.BpmnModeler={},ee.Vue))})(this,(function(ee,ge){"use strict";var qL=Object.defineProperty;var KL=(ee,ge,Mr)=>ge in ee?qL(ee,ge,{enumerable:!0,configurable:!0,writable:!0,value:Mr}):ee[ge]=Mr;var no=(ee,ge,Mr)=>KL(ee,typeof ge!="symbol"?ge+"":ge,Mr);const Mr=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","subProcess","boundaryEvent"],fs=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway"];function Ad(e){return Mr.includes(e)}function Pd(e){return fs.includes(e)}const Md="http://g1project.net/spec/bpmn/bwl/1.0",Ul="bwl",Yl=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],Td={name:"bwl-hints",uri:Md,prefix:Ul,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"}]}]},ql="bwl.undoEpisode",kd=new WeakSet;function h0(e){kd.has(e)||(e.register(ql,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),kd.add(e))}function Od(e,t){h0(e);const n={run:t};if(e.execute(ql,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}const Dd=["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"],m0={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},g0={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},y0={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},v0={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다. ⚠ type 집합은 **읽을 수 있는 것보다 좁다** — describe 는 subProcess·boundaryEvent 도 노드로 내지만 그 둘을 새로 만드는 배치는 미실증이라 여기서 받지 않는다(B-87 ⓐ).",properties:{id:{type:"string"},type:{type:"string",enum:[...fs]},name:{type:"string"},participant:{type:"string",description:"소속 풀 id(협업 문서)."},lane:{type:"string",description:"소속 레인 id(풀 정의에 선언된 것)."}},required:["id","type"],additionalProperties:!1},b0={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},x0={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},_0={type:"object",description:"메시지 플로우(풀 경계를 넘는 연결 — 노드 또는 블랙박스 풀 자체가 끝점).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"}},required:["id","source","target"],additionalProperties:!1},w0={type:"object",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},E0={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},S0={type:"object",properties:{id:{type:"string"},text:{type:"string"}},required:["id","text"],additionalProperties:!1},R0={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},C0={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},A0={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...Yl]},offset:{type:"number",description:"앵커 가장자리 → 주석 가장자리 간격(px). 생략 시 50."}},required:["anchor","side"],additionalProperties:!1};function dn(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const P0={"participant.add":dn("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트 — **작을수록 위**(생략 시 op 순서가 곧 배치 순서). 값은 상대 순서만 쓰므로 1,2,3… 연속이든 10,20,30 간격이든 같다.",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":dn("participant.update",{description:"풀 이름/레인 갱신. lanes 는 전체 재선언(생략 = 보존) — 기존 레인을 유지하려면 함께 다시 나열한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"]}),"node.add":dn("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":dn("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:[...fs]},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["id"]}),"sequenceFlow.add":dn("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":dn("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":dn("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":dn("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataStore.add":dn("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":dn("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataAssociation.add":dn("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":dn("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":dn("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":dn("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":dn("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":dn("group.update",{description:"그룹 이름/멤버 갱신. members 는 전체 재선언(생략 = 보존).",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},members:{type:"array",items:{type:"string"}}},required:["id"]}),"element.remove":dn("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},Id={anyOf:Dd.map(e=>P0[e])},M0={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:g0,irParticipant:y0,irNode:v0,irFlowCondition:b0,irSequenceFlow:x0,irMessageFlow:_0,irDataStore:w0,irDataAssociation:E0,irTextAnnotation:S0,irAssociation:R0,irGroup:C0,bwlPlacement:A0,nullableString:m0,symbolicOp:Id}};function Kl(e){return Array.prototype.concat.apply([],e)}const ta=Object.prototype.toString,T0=Object.prototype.hasOwnProperty;function Tr(e){return e===void 0}function Yt(e){return e!==void 0}function io(e){return e==null}function Be(e){return ta.call(e)==="[object Array]"}function Qt(e){return ta.call(e)==="[object Object]"}function Fe(e){return ta.call(e)==="[object Number]"}function Jt(e){const t=ta.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function Pn(e){return ta.call(e)==="[object String]"}function k0(e){if(!Be(e))throw new Error("must supply array")}function Mn(e,t){return!io(e)&&T0.call(e,t)}function vt(e,t){const n=hs(t);let i;return F(e,function(r,o){if(n(r,o))return i=r,!1}),i}function Ld(e,t){const n=hs(t);let i=Be(e)?-1:void 0;return F(e,function(r,o){if(n(r,o))return i=o,!1}),i}function Ke(e,t){const n=hs(t);let i=[];return F(e,function(r,o){n(r,o)&&i.push(r)}),i}function F(e,t){let n,i;if(Tr(e))return;const r=Be(e)?B0:L0;for(let o in e)if(Mn(e,o)&&(n=e[o],i=t(n,r(o)),i===!1))return n}function O0(e,t){if(Tr(e))return[];k0(e);const n=hs(t);return e.filter(function(i,r){return!n(i,r)})}function Tn(e,t,n){return F(e,function(i,r){n=t(n,i,r)}),n}function kr(e,t){return!!Tn(e,function(n,i,r){return n&&t(i,r)},!0)}function Xi(e,t){return!!vt(e,t)}function hn(e,t){let n=[];return F(e,function(i,r){n.push(t(i,r))}),n}function ds(e){return e&&Object.keys(e)||[]}function D0(e){return ds(e).length}function ro(e){return hn(e,t=>t)}function oo(e,t,n={}){return t=Xl(t),F(e,function(i){let r=t(i)||"_",o=n[r];o||(o=n[r]=[]),o.push(i)}),n}function Bd(e,...t){e=Xl(e);let n={};return F(t,r=>oo(r,e,n)),hn(n,function(r,o){return r[0]})}const I0=Bd;function di(e,t){t=Xl(t);let n=[];return F(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)}),hn(n,i=>i.v)}function ao(e){return function(t){return kr(e,function(n,i){return t[i]===n})}}function Xl(e){return Jt(e)?e:t=>t[e]}function hs(e){return Jt(e)?e:t=>t===e}function L0(e){return e}function B0(e){return Number(e)}function Zl(e,t){let n,i,r,o;function a(f){let p=Date.now(),d=f?0:o+t-p;if(d>0)return s(d);e.apply(r,i),c()}function s(f){n=setTimeout(a,f)}function c(){n&&clearTimeout(n),n=o=i=r=void 0}function l(){n&&a(!0),c()}function u(...f){o=Date.now(),i=f,r=this,n||s(t)}return u.flush=l,u.cancel=c,u}function Rn(e,t){return e.bind(t)}function W(e,...t){return Object.assign(e,...t)}function N0(e,t,n){let i=e;return F(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];Yt(a)&&io(s)&&(s=i[r]=isNaN(+a)?{}:[]),Tr(a)?Tr(n)?delete i[r]:i[r]=n:i=s}),e}function li(e,t){let n={},i=Object(e);return F(t,function(r){r in i&&(n[r]=e[r])}),n}function hi(e,t){let n={},i=Object(e);return F(i,function(r,o){t.indexOf(o)===-1&&(n[o]=r)}),n}function Ql(){}Ql.prototype.get=function(e){return this.$model.properties.get(this,e)},Ql.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function Nd(e,t){this.model=e,this.properties=t}Nd.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(Ql.prototype);F(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}),F(a,Rn(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 $0=W(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),$d=W(Object.create(null),{String:function(e){return e},Boolean:function(e){return e==="true"},Integer:function(e){return parseInt(e,10)},Real:function(e){return parseFloat(e)}});function Jl(e,t){var n=$d[e];return n?n(t):t}function eu(e){return!!$0[e]}function Fd(e){return!!$d[e]}function mn(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 zn(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}zn.prototype.build=function(){return li(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},zn.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)},zn.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},zn.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=mn(r[0],i),a=mn(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},zn.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},zn.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},zn.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},zn.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},zn.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},zn.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")},zn.prototype.hasProperty=function(e){return this.propertiesByName[e]},zn.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,r=e.name;r in n||(F(e.properties,Rn(function(o){o=W({},o,{name:o.ns.localName,inherited:t}),Object.defineProperty(o,"definedBy",{value:e});var a=o.replaces,s=o.redefines;a||s?this.redefineProperty(o,a||s,a):(o.isBody&&this.setBodyProperty(o),o.isId&&this.setIdProperty(o),this.addProperty(o))},this)),i.push(e),n[r]=e)};function Zi(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,F(e,Rn(this.registerPackage,this))}Zi.prototype.getPackage=function(e){return this.packageMap[e]},Zi.prototype.getPackages=function(){return this.packages},Zi.prototype.registerPackage=function(e){e=W({},e);var t=this.packageMap;jd(t,e,"prefix"),jd(t,e,"uri"),F(e.types,Rn(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},Zi.prototype.registerType=function(e,t){e=W({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:W({},e.meta||{})});var n=mn(e.name,t.prefix),i=n.name,r=Object.create(null);F(e.properties,Rn(function(o){var a=mn(o.name,n.prefix),s=a.name;eu(o.type)||(o.type=mn(o.type,a.prefix).name),W(o,{ns:a,name:s}),r[s]=o},this)),W(e,{ns:n,name:i,propertiesByName:r}),F(e.extends,Rn(function(o){var a=mn(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},Zi.prototype.mapTypes=function(e,t,n){var i=eu(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(c,l){var u=mn(c,eu(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+">");F(i.superClass,n?a:s),t(i,!n),F(i.traits,a)},Zi.prototype.getEffectiveDescriptor=function(e){var t=mn(e),n=new zn(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},Zi.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function jd(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function Or(e){this.model=e}Or.prototype.set=function(e,t,n){if(!Pn(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),r=i&&i.name;F0(n)?i?delete e[r]:delete e.$attrs[tu(t)]:i?r in e?e[r]=n:Hd(e,i,n):e.$attrs[tu(t)]=n},Or.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[tu(t)];var i=n.name;return!e[i]&&n.isMany&&Hd(e,n,[]),e[i]},Or.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=W({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},Or.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},Or.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},Or.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 F0(e){return typeof e>"u"}function Hd(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function tu(e){return e.replace(/^:/,"")}function Xn(e,t={}){this.properties=new Or(this),this.factory=new Nd(this,this.properties),this.registry=new Zi(e,this.properties),this.typeCache=Object.create(null),this.config=t}Xn.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},Xn.prototype.getType=function(e){var t=this.typeCache,n=Pn(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},Xn.prototype.createAny=function(e,t,n){var i=mn(e),r={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){N0(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}),F(n,function(a,s){Qt(a)&&a.value!==void 0?r[a.name]=a.value:r[s]=a}),r},Xn.prototype.getPackage=function(e){return this.registry.getPackage(e)},Xn.prototype.getPackages=function(){return this.registry.getPackages()},Xn.prototype.getElementDescriptor=function(e){return e.$descriptor},Xn.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},Xn.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},Xn.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var zd=String.fromCharCode,j0=Object.prototype.hasOwnProperty,H0=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,na={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(na).forEach(function(e){na[e.toUpperCase()]=na[e]});function z0(e,t,n,i){return i?j0.call(na,i)?na[i]:"&"+i+";":zd(t||parseInt(n,16))}function Dr(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(H0,z0):e}var Gd="non-whitespace outside of root node";function Qi(e){return new Error(e)}function G0(e){return"missing namespace for prefix <"+e+">"}function ms(e){return{get:e,enumerable:!0}}function V0(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var Vd=Symbol("nameCache");function nu(e){return e+"$uri"}function W0(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[nu(i)]=n;return t}function gs(){return{line:0,column:0}}function U0(e){throw e}function Wd(e){if(!this)return new Wd(e);var t=e&&e.proxy,n,i,r,o,a=U0,s,c,l,u,f=gs,p=!1,d=!1,m="",h=!1,y=!1,v=null,g=!1,b,x,C,M;function k(I){I instanceof Error||(I=Qi(I)),v=I,a(I,f)}function P(I){s&&(I instanceof Error||(I=Qi(I)),s(I,f))}this.on=function(I,z){if(typeof z!="function")throw Qi("required args <name, cb>");switch(I){case"openTag":i=z;break;case"text":n=z;break;case"closeTag":r=z;break;case"error":a=z;break;case"warn":s=z;break;case"cdata":o=z;break;case"attention":u=z;break;case"question":l=z;break;case"comment":c=z;break;default:throw Qi("unsupported event: "+I)}return this},this.ns=function(I){if(typeof I>"u"&&(I={}),typeof I!="object")throw Qi("required args <nsMap={}>");var z=Object.create(null),oe;for(oe in I)z[oe]=I[oe];return y=!0,M=z,this};function B(){b=y?[]:null,x=y?W0(M):null,C=[],f=gs,g=!1,v=null,d=!1,m=""}this.parse=function(I){if(typeof I!="string")throw Qi("required args <xml=string>");if(p)throw Qi("parse during stream; call end() first");return B(),D(I),f=gs,g=!1,v},this.write=function(I){if(typeof I!="string")throw Qi("required args <xml=string>");return p||(B(),p=!0),v||(m=D(m+I,!0)||""),this},this.end=function(){return p||B(),p=!1,v||D(m),m="",f=gs,g=!1,v},this.stop=function(){g=!0};function D(I,z=!1){var oe=null,ye=null,Ve,He=0,it=!1,K=!1,Z=0,se=0,xe,q,V,ne,Te,yt,T,w,E,G="",U=0,X;function Ce(pt,Wt){var nn=pt.indexOf(":");if(nn===-1)return pt;var rn=x[pt.substring(0,nn)];return rn?Wt===rn?pt.substr(nn+1):rn+pt.substr(nn):(P(G0(pt.substring(0,nn))),null)}function Ue(){if(X!==null)return X;var pt,Wt,nn=y&&x.xmlns,rn=y&&h?[]:null,xt=U,Dt=G,bn=Dt.length,Pr,jn,Ti,Hn,Nt,Kn={},jl=new Set,Ut,Je,ct;e:for(;xt<bn;xt++)if(Ut=!1,Je=Dt.charCodeAt(xt),!(Je===32||Je<14&&Je>8)){for((Je<65||Je>122||Je>90&&Je<97)&&Je!==95&&Je!==58&&(P("illegal first char attribute name"),Ut=!0),ct=xt+1;ct<bn;ct++)if(Je=Dt.charCodeAt(ct),!(Je>96&&Je<123||Je>64&&Je<91||Je>47&&Je<59||Je===46||Je===45||Je===95)){if(Je===32||Je<14&&Je>8){P("missing attribute value"),xt=ct;continue e}if(Je===61)break;P("illegal attribute name char"),Ut=!0}if(Nt=Dt.substring(xt,ct),Nt==="xmlns:xmlns"&&(P("illegal declaration of xmlns"),Ut=!0),Je=Dt.charCodeAt(ct+1),Je===34)ct=Dt.indexOf('"',xt=ct+2),ct===-1&&(ct=Dt.indexOf("'",xt),ct!==-1&&(P("attribute value quote missmatch"),Ut=!0));else if(Je===39)ct=Dt.indexOf("'",xt=ct+2),ct===-1&&(ct=Dt.indexOf('"',xt),ct!==-1&&(P("attribute value quote missmatch"),Ut=!0));else for(P("missing attribute value quotes"),Ut=!0,ct=ct+1;ct<bn&&(Je=Dt.charCodeAt(ct+1),!(Je===32||Je<14&&Je>8));ct++);for(ct===-1&&(P("missing closing quotes"),ct=bn,Ut=!0),Ut||(Ti=Dt.substring(xt,ct)),xt=ct;ct+1<bn&&(Je=Dt.charCodeAt(ct+1),!(Je===32||Je<14&&Je>8));ct++)xt===ct&&(P("illegal character after attribute end"),Ut=!0);if(xt=ct+1,Ut)continue e;if(jl.has(Nt)){P("attribute <"+Nt+"> already defined");continue}if(jl.add(Nt),!y){Kn[Nt]=Ti;continue}if(h){if(jn=Nt==="xmlns"?"xmlns":Nt.charCodeAt(0)===120&&Nt.substr(0,6)==="xmlns:"?Nt.substr(6):null,jn!==null){if(pt=Dr(Ti),Wt=nu(jn),Hn=M[pt],!Hn){if(jn==="xmlns"||Wt in x&&x[Wt]!==pt)do Hn="ns"+He++;while(typeof x[Hn]<"u");else Hn=jn;M[pt]=Hn}x[jn]!==Hn&&(Pr||(x=V0(x),Pr=!0),x[jn]=Hn,jn==="xmlns"&&(x[nu(Hn)]=pt,nn=Hn),x[Wt]=pt),Kn[Nt]=Ti;continue}rn.push(Nt,Ti);continue}Nt=Ce(Nt,nn),Nt!==null&&(Kn[Nt]=Ti)}if(h)for(xt=0,bn=rn.length;xt<bn;xt++)Nt=Ce(rn[xt++],nn),Ti=rn[xt],Nt!==null&&(Kn[Nt]=Ti);return X=Kn}function st(){for(var pt=/(\r\n|\r|\n)/g,Wt=0,nn=0,rn=0,xt=se,Dt,bn;Z>=rn&&(Dt=pt.exec(I),!(!Dt||(xt=Dt[0].length+Dt.index,xt>Z)));)Wt+=1,rn=xt;return Z==-1?(nn=xt,bn=I.substring(se)):se===0?bn=I.substring(se,Z):(nn=Z-rn,bn=se==-1?I.substring(Z):I.substring(Z,se+1)),{data:bn,line:Wt,column:nn}}for(f=st,t&&(E=Object.create({},{name:ms(function(){return T}),originalName:ms(function(){return w}),attrs:ms(Ue),ns:ms(function(){return x})}));se!==-1;){if(I.charCodeAt(se)===60?Z=se:Z=I.indexOf("<",se),Z===-1){if(z)return I.substring(se);if(C.length)return k("unexpected end of file");if(!d)return k("missing start tag");se<I.length&&I.substring(se).trim()&&P(Gd);return}if(d||(d=!0),se!==Z){if(C.length){if(n&&(n(I.substring(se,Z),Dr,f),g))return}else if(I.substring(se,Z).trim()&&(P(Gd),g))return}if(ne=I.charCodeAt(Z+1),ne===33){if(V=I.charCodeAt(Z+2),V===91&&I.substr(Z+3,6)==="CDATA["){if(se=I.indexOf("]]>",Z),se===-1)return z?I.substring(Z):k("unclosed cdata");if(o&&(o(I.substring(Z+9,se),f),g))return;se+=3;continue}if(V===45&&I.charCodeAt(Z+3)===45){if(se=I.indexOf("-->",Z),se===-1)return z?I.substring(Z):k("unclosed comment");if(c&&(c(I.substring(Z+4,se),Dr,f),g))return;se+=3;continue}}if(ne===63){if(se=I.indexOf("?>",Z),se===-1)return z?I.substring(Z):k("unclosed question");if(l&&(l(I.substring(Z,se+2),f),g))return;se+=2;continue}for(xe=Z+1;;xe++){if(Te=I.charCodeAt(xe),isNaN(Te))return z?I.substring(Z):(se=-1,k("unclosed tag"));if(Te===34)V=I.indexOf('"',xe+1),xe=V!==-1?V:xe;else if(Te===39)V=I.indexOf("'",xe+1),xe=V!==-1?V:xe;else if(Te===62){se=xe;break}}if(ne===33){if(u&&(u(I.substring(Z,se+1),Dr,f),g))return;se+=1;continue}if(X={},ne===47){if(it=!1,K=!0,!C.length)return k("missing open tag");if(xe=T=C.pop(),V=Z+2+xe.length,I.substring(Z+2,V)!==xe)return k("closing tag mismatch");for(;V<se;V++)if(ne=I.charCodeAt(V),!(ne===32||ne>8&&ne<14))return k("close tag")}else{if(I.charCodeAt(se-1)===47?(xe=T=I.substring(Z+1,se-1),it=!0,K=!0):(xe=T=I.substring(Z+1,se),it=!0,K=!1),!(ne>96&&ne<123||ne>64&&ne<91||ne===95||ne===58))return k("illegal first char nodeName");for(V=1,q=xe.length;V<q;V++)if(ne=xe.charCodeAt(V),!(ne>96&&ne<123||ne>64&&ne<91||ne>47&&ne<59||ne===45||ne===95||ne==46)){if(ne===32||ne<14&&ne>8){T=xe.substring(0,V),X=null;break}return k("invalid nodeName")}K||C.push(T)}if(y){Ve=x,it&&(K||b.push(Ve),X===null&&(h=xe.indexOf("xmlns",V)!==-1)&&(U=V,G=xe,Ue(),h=!1)),w=T,ye!==x&&(oe=x[Vd],oe===void 0&&(oe=x[Vd]=Object.create(null)),ye=x);var Ot=oe[T];if(Ot!==void 0)T=Ot;else{if(ne=T.indexOf(":"),ne!==-1){if(yt=x[T.substring(0,ne)],!yt)return k("missing namespace on <"+w+">");T=T.substr(ne+1)}else yt=x.xmlns;yt&&(T=yt+":"+T),oe[w]=T}}if(it&&(U=V,G=xe,i&&(t?i(E,Dr,K,f):i(T,Ue,Dr,K,f),g)))return;if(K){if(r&&(r(t?E:T,Dr,it,f),g))return;y&&(it?x=Ve:x=b.pop())}se+=1}}}function Ud(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var iu={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},Yd="property";function qd(e){return e.xml&&e.xml.serialize}function Y0(e){const t=qd(e);return t!==Yd&&(t||null)}function q0(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Kd(e,t){return Ud(t)?e.prefix+":"+q0(e.localName):e.name}function K0(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 X0(e,t,n){const i=mn(e,t.xmlns),r=`${t[i.prefix]||i.prefix}:${i.localName}`,o=mn(r);var a=n.getPackage(o.prefix);return K0(o,a)}function Ji(e){return new Error(e)}function ki(e){return e.$descriptor}function Z0(e){W(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw Ji("expected element");var n=this.elementsById,i=ki(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 Ji("duplicate ID <"+o+">");n[o]=t}},this.addWarning=function(t){this.warnings.push(t)}}function ia(){}ia.prototype.handleEnd=function(){},ia.prototype.handleText=function(){},ia.prototype.handleNode=function(){};function ru(){}ru.prototype=Object.create(ia.prototype),ru.prototype.handleNode=function(){return this};function so(){}so.prototype=Object.create(ia.prototype),so.prototype.handleText=function(e){this.body=(this.body||"")+e};function ra(e,t){this.property=e,this.context=t}ra.prototype=Object.create(so.prototype),ra.prototype.handleNode=function(e){if(this.element)throw Ji("expected no sub nodes");return this.element=this.createReference(e),this},ra.prototype.handleEnd=function(){this.element.id=this.body},ra.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function ou(e,t){this.element=t,this.propertyDesc=e}ou.prototype=Object.create(so.prototype),ou.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=Jl(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function ys(){}ys.prototype=Object.create(so.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 xn(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}xn.prototype=Object.create(ys.prototype),xn.prototype.addReference=function(e){this.context.addReference(e)},xn.prototype.handleText=function(e){var t=this.element,n=ki(t),i=n.bodyProperty;if(!i)throw Ji("unexpected body text <"+e+">");so.prototype.handleText.call(this,e)},xn.prototype.handleEnd=function(){var e=this.body,t=this.element,n=ki(t),i=n.bodyProperty;i&&e!==void 0&&(e=Jl(i.type,e),t.set(i.name,e))},xn.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=ki(n),r=this.context,o=new n({}),a=this.model,s;return F(t,function(c,l){var u=i.propertiesByName[l],f;u&&u.isReference?u.isMany?(f=c.split(" "),F(f,function(p){r.addReference({element:o,property:u.ns.name,id:p})})):r.addReference({element:o,property:u.ns.name,id:c}):(u?c=Jl(u.type,c):l==="xmlns"?l=":"+l:(s=mn(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},xn.prototype.getPropertyForNode=function(e){var t=e.name,n=mn(t),i=this.type,r=this.model,o=ki(i),a=n.name,s=o.propertiesByName[a];if(s&&!s.isAttr){const l=Y0(s);if(l){const u=e.attributes[l];if(u){const f=X0(u,e.ns,r),p=r.getType(f);return W({},s,{effectiveType:ki(p).name})}}return s}var c=r.getPackage(n.prefix);if(c){const l=Kd(n,c),u=r.getType(l);if(s=vt(o.properties,function(f){return!f.isVirtual&&!f.isReference&&!f.isAttribute&&u.hasType(f.type)}),s)return W({},s,{effectiveType:ki(u).name})}else if(s=vt(o.properties,function(l){return!l.isReference&&!l.isAttribute&&l.type==="Element"}),s)return s;throw Ji("unrecognized element <"+n.name+">")},xn.prototype.toString=function(){return"ElementDescriptor["+ki(this.type).name+"]"},xn.prototype.valueHandler=function(e,t){return new ou(e,t)},xn.prototype.referenceHandler=function(e){return new ra(e,this.context)},xn.prototype.handler=function(e){return e==="Element"?new co(this.model,e,this.context):new xn(this.model,e,this.context)},xn.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,Fd(n))return this.valueHandler(t,i);t.isReference?r=this.referenceHandler(t).handleNode(e):r=this.handler(n).handleNode(e);var o=r.element;return o!==void 0&&(t.isMany?i.get(t.name).push(o):i.set(t.name,o),t.isReference?(W(o,{element:i}),this.context.addReference(o)):o.$parent=i),r};function au(e,t,n){xn.call(this,e,t,n)}au.prototype=Object.create(xn.prototype),au.prototype.createElement=function(e){var t=e.name,n=mn(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&Kd(n,o)||t;if(!r.hasType(a))throw Ji("unexpected element <"+e.originalName+">");return xn.prototype.createElement.call(this,e)};function co(e,t,n){this.model=e,this.context=n}co.prototype=Object.create(ys.prototype),co.prototype.createElement=function(e){var t=e.name,n=mn(t),i=n.prefix,r=e.ns[i+"$uri"],o=e.attributes;return this.model.createAny(t,r,o)},co.prototype.handleChild=function(e){var t=new co(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},co.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function su(e){e instanceof Xn&&(e={model:e}),W(this,{lax:!1},e)}su.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 r=this.model,o=this.lax,a=new Z0(W({},t,{rootHandler:i})),s=new Wd({proxy:!0}),c=Q0();i.context=a,c.push(i);function l(C,M,k){var P=M(),B=P.line,D=P.column,I=P.data;I.charAt(0)==="<"&&I.indexOf(" ")!==-1&&(I=I.slice(0,I.indexOf(" "))+">");var z="unparsable content "+(I?I+" ":"")+`detected
|
|
2
2
|
line: `+B+`
|
|
3
3
|
column: `+D+`
|
|
4
4
|
nested error: `+C.message;if(k)return a.addWarning({message:z,error:C}),!0;throw Ji(z)}function u(C,M){return l(C,M,!0)}function f(){var C=a.elementsById,M=a.references,k,P;for(k=0;P=M[k];k++){var B=P.element,D=C[P.id],I=ki(B).propertiesByName[P.property];if(D||a.addWarning({message:"unresolved reference <"+P.id+">",element:P.element,property:P.property,value:P.id}),I.isMany){var z=B.get(I.name),oe=z.indexOf(P);oe===-1&&(oe=z.length),D?z[oe]=D:z.splice(oe,1)}else B.set(I.name,D)}}function p(){c.pop().handleEnd()}var d=/^<\?xml /i,m=/ encoding="([^"]+)"/i,h=/^utf-8$/i;function y(C){if(d.test(C)){var M=m.exec(C),k=M&&M[1];!k||h.test(k)||a.addWarning({message:"unsupported document encoding <"+k+">, falling back to UTF-8"})}}function v(C,M){var k=c.peek();try{c.push(k.handleNode(C))}catch(P){l(P,M,o)&&c.push(new ru)}}function g(C,M){try{c.peek().handleText(C)}catch(k){u(k,M)}}function b(C,M){C.trim()&&g(C,M)}var x=r.getPackages().reduce(function(C,M){return C[M.uri]=M.prefix,C},Object.entries(iu).reduce(function(C,[M,k]){return C[k]=M,C},r.config&&r.config.nsMap||{}));return s.ns(x).on("openTag",function(C,M,k,P){var B=C.attrs||{},D=Object.keys(B).reduce(function(z,oe){var ye=M(B[oe]);return z[oe]=ye,z},{}),I={name:C.name,originalName:C.originalName,attributes:D,ns:C.ns};v(I,P)}).on("question",y).on("closeTag",p).on("cdata",g).on("text",function(C,M,k){b(M(C),k)}).on("error",l).on("warn",u),new Promise(function(C,M){var k;try{s.parse(e),f()}catch(z){k=z}var P=i.element;!k&&!P&&(k=Ji("failed to parse document as <"+i.type.$descriptor.name+">"));var B=a.warnings,D=a.references,I=a.elementsById;return k?(k.warnings=B,M(k)):C({rootElement:P,elementsById:I,references:D,warnings:B})})},su.prototype.handler=function(e){return new au(this.model,e)};function Q0(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var J0=`<?xml version="1.0" encoding="UTF-8"?>
|
|
5
5
|
`,eE=/<|>|'|"|&|\n\r|\n/g,Xd=/<|>|&/g;function mi(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}mi.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},mi.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},mi.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},mi.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)},mi.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},mi.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},mi.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri},mi.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},mi.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 tE(e){return e.charAt(0).toLowerCase()+e.slice(1)}function nE(e,t){return Ud(t)?tE(e):e}function Zd(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function Qd(e){return Pn(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function iE(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 rE(e,t){return t.isGeneric?W({localName:t.ns.localName},e):W({localName:nE(t.ns.localName,t.$pkg)},e)}function oE(e,t){return W({localName:t.ns.localName},e)}function aE(e){var t=e.$descriptor;return Ke(t.properties,function(n){var i=n.name;if(n.isVirtual||!Mn(e,i))return!1;var r=e[i];return r===n.default||r===null?!1:n.isMany?r.length:!0})}var sE={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},cE={"<":"lt",">":"gt","&":"amp"};function Jd(e,t,n){return e=Pn(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function lE(e){return Jd(e,eE,sE)}function uE(e){return Jd(e,Xd,cE)}function pE(e){return Ke(e,function(t){return t.isAttr})}function fE(e){return Ke(e,function(t){return!t.isAttr})}function cu(e){this.tagName=e}cu.prototype.build=function(e){return this.element=e,this},cu.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()};function Ir(){}Ir.prototype.serializeValue=Ir.prototype.serializeTo=function(e){e.append(this.escape?uE(this.value):this.value)},Ir.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(Xd)!==-1&&(this.escape=!0),this};function lu(e){this.tagName=e}Zd(lu,Ir),lu.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()};function St(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}St.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=aE(e),this.parseAttributes(pE(r)),this.parseContainments(fE(r))),this.parseGenericAttributes(e,i),this},St.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return rE(t,e)},St.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return oE(t,e)},St.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},St.prototype.nsAttributeName=function(e){var t;if(Pn(e)?t=mn(e):t=e.ns,e.inherited)return{localName:t.localName};var n=this.logNamespaceUsed(t);return this.getNamespaces().logUsed(n),this.isLocalNs(n)?{localName:t.localName}:W({localName:t.localName},n)},St.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}))},St.prototype.parseGenericContainments=function(e){var t=e.$body;t&&this.body.push(new Ir().build({type:"String"},t));var n=e.$children;n&&F(n,i=>{this.body.push(new St(this).build(i))})},St.prototype.parseNsAttribute=function(e,t,n){var i=e.$model,r=mn(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)}},St.prototype.parseNsAttributes=function(e){var t=this,n=e.$attrs,i=[];return F(n,function(r,o){var a=t.parseNsAttribute(e,o,r);a&&i.push(a)}),i},St.prototype.parseGenericAttributes=function(e,t){var n=this;F(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)}})},St.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;F(e,function(r){var o=i.get(r.name),a=r.isReference,s=r.isMany;if(s||(o=[o]),r.isBody)n.push(new Ir().build(r,o[0]));else if(Fd(r.type))F(o,function(l){n.push(new lu(t.addTagName(t.nsPropertyTagName(r))).build(r,l))});else if(a)F(o,function(l){n.push(new cu(t.addTagName(t.nsPropertyTagName(r))).build(l))});else{var c=qd(r);F(o,function(l){var u;c?c===Yd?u=new St(t,r):u=new vs(t,r,c):u=new St(t),n.push(u.build(l))})}})},St.prototype.getNamespaces=function(e){var t=this.namespaces,n=this.parent,i;return t||(i=n&&n.getNamespaces(),e||!i?this.namespaces=t=new mi(i):t=i),t},St.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},St.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},St.prototype.parseAttributes=function(e){var t=this,n=this.element;F(e,function(i){var r=n.get(i.name);if(i.isReference)if(!i.isMany)r=r.id;else{var o=[];F(r,function(a){o.push(a.id)}),r=o.join(" ")}t.addAttribute(t.nsAttributeName(i),r)})},St.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),Qd(e)},St.prototype.addAttribute=function(e,t){var n=this.attrs;Pn(t)&&(t=lE(t));var i=Ld(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)},St.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=iE(n).concat(t)),F(t,function(i){e.append(" ").append(Qd(i.name)).append('="').append(i.value).append('"')})},St.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==Ir;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),F(this.body,function(i){i.serializeTo(e)}),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()};function vs(e,t,n){St.call(this,e,t),this.serialization=n}Zd(vs,St),vs.prototype.parseNsAttributes=function(e){var t=St.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},vs.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function dE(){this.value="",this.write=function(e){this.value+=e}}function hE(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 mE(e){e=W({format:!1,preamble:!0},e||{});function t(n,i){var r=i||new dE,o=new hE(r,e.format);e.preamble&&o.append(J0);var a=new St,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(gE(s)),a.build(n).serializeTo(o),!i)return r.value}return{toXML:t}}function gE(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in iu)n[i]=iu[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 bs(e,t){Xn.call(this,e,t)}bs.prototype=Object.create(Xn.prototype),bs.prototype.fromXML=function(e,t,n){Pn(t)||(n=t,t="bpmn:Definitions");var i=new su(W({model:this,lax:!0},n)),r=i.handler(t);return i.fromXML(e,r)},bs.prototype.toXML=function(e,t){var n=new mE(t);return new Promise(function(i,r){try{var o=n.toXML(e);return i({xml:o})}catch(a){return r(a)}})};var yE="BPMN20",vE="http://www.omg.org/spec/BPMN/20100524/MODEL",bE="bpmn",xE=[],_E=[{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"}]}],wE=[{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"}]}],EE={tagAlias:"lowerCase",typePrefix:"t"},SE={name:yE,uri:vE,prefix:bE,associations:xE,types:_E,enumerations:wE,xml:EE},RE="BPMNDI",CE="http://www.omg.org/spec/BPMN/20100524/DI",AE="bpmndi",PE=[{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"]}],ME=[{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"}]}],TE=[],kE={name:RE,uri:CE,prefix:AE,types:PE,enumerations:ME,associations:TE},OE="DC",DE="http://www.omg.org/spec/DD/20100524/DC",IE="dc",LE=[{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}]}],BE=[],NE={name:OE,uri:DE,prefix:IE,types:LE,associations:BE},$E="DI",FE="http://www.omg.org/spec/DD/20100524/DI",jE="di",HE=[{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"}]}],zE=[],GE={tagAlias:"lowerCase"},VE={name:$E,uri:FE,prefix:jE,types:HE,associations:zE,xml:GE},WE="bpmn.io colors for BPMN",UE="http://bpmn.io/schema/bpmn/biocolor/1.0",YE="bioc",qE=[{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"}]}],KE=[],XE=[],ZE={name:WE,uri:UE,prefix:YE,types:qE,enumerations:KE,associations:XE},QE="BPMN in Color",JE="http://www.omg.org/spec/BPMN/non-normative/color/1.0",e1="color",t1=[{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"}]}],n1=[],i1=[],r1={name:QE,uri:JE,prefix:e1,types:t1,enumerations:n1,associations:i1};const o1={bpmn:SE,bpmndi:kE,dc:NE,di:VE,bioc:ZE,color:r1};function eh(e,t){const n=W({},o1,e);return new bs(n,t)}const a1={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"}},s1="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",th="i18n",xs={[th]:a1,[Ul]:Td};function nh(){return eh(xs)}const ih=nh();async function lo(e){const{rootElement:t,warnings:n}=await ih.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function c1(e){const{xml:t}=await ih.toXML(e,{format:!0});return t}function uu(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const uo={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},l1=/[ᄀ-ᇿ -〿-ヿ㐀-鿿가--⦆]/;function u1(e){const t=uo;return l1.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 po(e,t){let n=0;for(const i of e)n+=t*u1(i);return n}function rh(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&p1(e),f1(e),d1(e),h1(e)}function p1(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:po(r,o),fontBoundingBoxAscent:o*uo.ascentEm,fontBoundingBoxDescent:o*uo.descentEm,actualBoundingBoxAscent:o*uo.ascentEm,actualBoundingBoxDescent:o*uo.descentEm}}};t.getContext=()=>n}function f1(e){if(e.SVGMatrix)return;class t{constructor(){no(this,"a",1);no(this,"b",0);no(this,"c",0);no(this,"d",1);no(this,"e",0);no(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 d1(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,f=Math.cos(u),p=Math.sin(u);a.a=f,a.b=p,a.c=-p,a.d=f,a.e=c-f*c+p*l,a.f=l-p*c-f*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 h1(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:po(n,12),height:14}})}const _s=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),m1=new Set(["bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),g1=1,pu=new Set(["bpmn:TextAnnotation","bpmn:DataStoreReference","bpmn:DataObjectReference","bpmn:DataInput","bpmn:DataOutput"]),y1=2;function Rt(e){switch(e.kind){case"label-over-line":return`L|${e.edge}|${e.line}`;case"edge-crosses-shape":return`x|${e.edge}|${e.shape}`;case"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"pool-name-over-label":return`pn|${e.pool}|${e.label}`}}const oh=20,ws=5,ah=3,v1=8,sh=12,b1=sh*1.2;function fu(e,t){const n=t.split(/\r?\n/),i=Math.max(...n.map(o=>po(o,sh))),r=n.length*b1;return{x:e.x+e.width/2-i/2,y:e.y+e.height/2-r/2,width:i,height:r}}const ch=1;function _n(e){const t=[];for(let n=0;n+1<e.waypoints.length;n++){const i=e.waypoints[n],r=e.waypoints[n+1];Math.abs(i.y-r.y)<.5&&Math.abs(i.x-r.x)>=.5?t.push({axis:"h",at:i.y,lo:Math.min(i.x,r.x),hi:Math.max(i.x,r.x),dir:r.x>i.x?1:-1}):Math.abs(i.x-r.x)<.5&&Math.abs(i.y-r.y)>=.5&&t.push({axis:"v",at:i.x,lo:Math.min(i.y,r.y),hi:Math.max(i.y,r.y),dir:r.y>i.y?1:-1})}return t}function fo(e,t){let n=null;const i=e.type!==t.type,o=!!(e.source&&e.target&&t.source&&t.target)&&e.source!==t.source&&e.source!==t.target&&e.target!==t.source&&e.target!==t.target;for(const a of _n(e))for(const s of _n(t)){if(a.axis!==s.axis||Math.abs(a.at-s.at)>ch)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>=oh&&(!n||l>n.length)&&(n={axis:a.axis,length:l,kind:c})}return n}function du(e){return e.kind==="edge-overlap-opposite"||e.kind==="edge-overlap-mixed"||e.kind==="edge-overlap-unrelated"}function lh(e,t){const n=fo(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function x1(e,t){let n=0;for(const i of t)i.id!==e.id&&lh(e,i)&&n++;return n}function Gn(e,t){let n=0;for(const i of t)i.id!==e.id&&fo(e,i)&&n++;return n}const uh=15,ph=20;function _1(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-ph||t.at>n[1]+ph)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 hu=20;function Es(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>ch)continue;const r=Math.max(e.lo,i.lo),o=Math.min(e.hi,i.hi);o-r<oh||n.push([r-hu,o+hu])}return n}function Ss(e,t){const n=e.label;if(!n)return null;let i=null;for(const r of _n(e)){const o=_1(n,r);if(o){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of Es(r,_n(a)))if(Math.min(c,o[1])>Math.max(s,o[0])){i={other:a.id,axis:r.axis};break}}}}return i}const w1=10,E1=1,S1=(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 R1(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,f=1;const p=(d,m)=>{if(m===0)return d<=0;const h=d/m;if(m>0){if(h>f)return!1;h>u&&(u=h)}else{if(h<u)return!1;h<f&&(f=h)}return!0};return p(r-e.x,c)&&p(e.x-a,-c)&&p(o-e.y,l)&&p(e.y-s,-l)&&f>u}function mu(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 C1=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,ho=1;function Oi(e,t){const n=e.x+ho,i=e.x+e.width-ho,r=e.y+ho,o=e.y+e.height-ho;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 oa(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 fh(e,t){const n=e.label;if(!n)return null;if(_n(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(_n(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(oa(i).some(r=>Oi(n,r)))return i.id;return null}function an(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(R1(e.waypoints[o],e.waypoints[o+1],r,y1)){i.push(r);break}}return i}function A1(e,t,n,i){const r=(l,u,f)=>(u.x-l.x)*(f.y-l.y)-(u.y-l.y)*(f.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 dh=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function aa(e,t){let n=0;for(const i of t){if(i.id===e.id||dh(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++)A1(e.waypoints[o],e.waypoints[o+1],i.waypoints[a],i.waypoints[a+1])&&(r=!0);r&&n++}return n}function Vn(e,t){let n=0;for(const i of t)i.id===e.id||dh(e,i)||aa(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function hh(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++)aa(n[i],[n[r]])>0&&(t+=n[i].type===n[r].type?2:1);return t}function Rs(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)if(aa(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 mh(e){const t=Rs(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),f=n(l.type);u==="solid"&&f==="solid"?r++:u==="dashed"&&f==="dashed"&&o++}return{pairs:t,solidPairs:r,dashedPairs:o,mixedPairs:t.length-r-o,crossPoolMessages:P1(e)}}function P1(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 gh(e,t,n){const i=new Set(t.flatMap(r=>[...r.members]));return e.shapes.filter(r=>!r.container&&!pu.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 yh(e){var n;const t=(n=Et(e==null?void 0:e.extensionElements))==null?void 0:n.values;if(Array.isArray(t))for(const i of t){const r=Et(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 vh=e=>e?{members:e}:{},Wn=e=>e.shapes.filter(t=>!t.container);function M1(e,t,n){if(e.type==="bpmn:TextAnnotation")for(const i of t.edges){if(!/Association$/.test(i.type)||!i.endpoints.includes(e.id))continue;const r=i.endpoints.find(a=>a!==e.id),o=r?n.get(r):void 0;if(o){if(o.container)return o.id;if(o.parent)return o.parent}}}function bh(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(_n(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(oa(i).some(r=>Oi(n,r)))return i.id;return null}function mo(e){const t=[];for(const n of e.shapes)n.label&&t.push({owner:n.id,rect:n.label});for(const n of e.edges)n.label&&t.push({owner:n.id,rect:n.label});return t}function At(e){const t=[],n=e.shapes.filter(v=>!v.container);for(const v of e.edges)for(const g of an(v,n))t.push({kind:"edge-crosses-shape",edge:v.id,shape:g.id});const i=e.shapes.filter(v=>v.container&&m1.has(v.type));if(i.length){const v=(g,b)=>{const x=e.shapes.find(C=>C.id===b);return!!x&&x.x>=g.x&&x.y>=g.y&&x.x+x.width<=g.x+g.width&&x.y+x.height<=g.y+g.height};for(const g of e.edges)for(const b of an(g,i))g.endpoints.includes(b.id)||g.endpoints.some(x=>v(b,x))||t.push({kind:"edge-crosses-subprocess",edge:g.id,subProcess:b.id})}for(const v of e.edges){if(v.waypoints.length<2)continue;const g=[[v.source,v.waypoints[0]],[v.target,v.waypoints[v.waypoints.length-1]]];for(const[b,x]of g){if(!b)continue;const C=e.shapes.find(B=>B.id===b);if(!C||C.container)continue;const M=Math.max(C.x-x.x,x.x-(C.x+C.width),0),k=Math.max(C.y-x.y,x.y-(C.y+C.height),0),P=Math.hypot(M,k);P>w1&&t.push({kind:"edge-endpoint-detached",edge:v.id,shape:b,distance:Math.round(P)})}}const r=e.shapes.filter(v=>v.type==="bpmn:Participant");for(let v=0;v<r.length;v++)for(let g=v+1;g<r.length;g++){const b=r[v],x=r[g];if(b.x+b.width<=x.x||x.x+x.width<=b.x||b.y+b.height<=x.y||x.y+x.height<=b.y)continue;const C=(M,k)=>M.x<=k.x&&M.y<=k.y&&M.x+M.width>=k.x+k.width&&M.y+M.height>=k.y+k.height;t.push({kind:"pool-overlap",pools:[b.id,x.id],contained:C(b,x)||C(x,b)})}const o=n.filter(v=>!v.attached);for(let v=0;v<o.length;v++)for(let g=v+1;g<o.length;g++){const b=o[v],x=o[g];if(!mu(b,x,g1))continue;const C=b.id<x.id?[b.id,x.id]:[x.id,b.id];t.push({kind:"shape-overlap",shapes:C,identical:C1(b,x)})}const a=e.shapes.filter(v=>v.type==="bpmn:Group"&&Array.isArray(v.members)&&v.members.length>0);for(let v=0;v<a.length;v++)for(let g=v+1;g<a.length;g++){const b=a[v],x=a[g],C=Math.min(b.x+b.width,x.x+x.width)-Math.max(b.x,x.x),M=Math.min(b.y+b.height,x.y+x.height)-Math.max(b.y,x.y);if(C<=ws||M<=ws)continue;const k=b.id<x.id?[b.id,x.id]:[x.id,b.id],P=new Set(x.members);if(b.members.some(D=>P.has(D))){const D=gh(e,a,{x:Math.max(b.x,x.x),y:Math.max(b.y,x.y),right:Math.min(b.x+b.width,x.x+x.width),bottom:Math.min(b.y+b.height,x.y+x.height)});D.length&&t.push({kind:"group-overlap-unreadable",reason:"orphan",groups:k,shapes:D});continue}const B=b.x<=x.x&&b.y<=x.y&&b.x+b.width>=x.x+x.width&&b.y+b.height>=x.y+x.height?b.id:x.x<=b.x&&x.y<=b.y&&x.x+x.width>=b.x+b.width&&x.y+x.height>=b.y+b.height?x.id:void 0;t.push({kind:"group-overlap-unintended",groups:k,...B?{container:B}:{}})}const s=new Set(a.flatMap(v=>[...v.members])),c=v=>e.shapes.filter(g=>!g.container&&!pu.has(g.type)&&g.x>=v.x&&g.y>=v.y&&g.x+g.width<=v.x+v.width&&g.y+g.height<=v.y+v.height);for(const v of a){const g=c(v);if(!g.length)continue;const b=new Set(v.members),x=g.filter(C=>!b.has(C.id));x.some(C=>s.has(C.id))&&(x.length*2<g.length||t.push({kind:"group-overlap-unreadable",reason:"minority",group:v.id,shapes:x.map(C=>C.id).sort()}))}for(const v of a){const g=new Set(c(v).map(P=>P.id)),b=new Set(v.members),x=new Set([...g].filter(P=>!b.has(P)&&s.has(P)));if(!x.size)continue;let C=!1,M=!1,k=!1;for(const P of e.edges){if(P.type!=="bpmn:SequenceFlow"||!P.source||!P.target)continue;const B=x.has(P.source),D=x.has(P.target);!B&&D&&!g.has(P.source)?C=!0:B&&!D&&!g.has(P.target)?M=!0:B&&D&&(k=!0)}C&&M&&k&&t.push({kind:"group-overlap-unreadable",reason:"throughpass",group:v.id,shapes:[...x].sort()})}const l=e.shapes.filter(v=>v.type==="bpmn:Group");for(let v=0;v<l.length;v++)for(let g=v+1;g<l.length;g++)for(let b=g+1;b<l.length;b++){const x=[l[v],l[g],l[b]],C={x:Math.max(...x.map(P=>P.x)),y:Math.max(...x.map(P=>P.y)),right:Math.min(...x.map(P=>P.x+P.width)),bottom:Math.min(...x.map(P=>P.y+P.height))};if(C.right-C.x<=ws||C.bottom-C.y<=ws)continue;const M=gh(e,[],C);if(!M.length)continue;const k=x.map(P=>P.id).sort();t.push({kind:"group-stack-unreadable",groups:k,shapes:M})}for(const v of e.shapes.filter(g=>g.type==="bpmn:Group"))for(const g of e.shapes){if(g.container||g.attached||pu.has(g.type)||g.width<=0||g.height<=0)continue;const b=[["top",v.y,"h",v.x,v.x+v.width],["bottom",v.y+v.height,"h",v.x,v.x+v.width],["left",v.x,"v",v.y,v.y+v.height],["right",v.x+v.width,"v",v.y,v.y+v.height]];for(const[x,C,M,k,P]of b){const B=M==="h"?g.x:g.y,D=M==="h"?g.x+g.width:g.y+g.height;if(!(B<P&&k<D))continue;const I=M==="h"?g.y:g.x,z=M==="h"?g.y+g.height:g.x+g.width;if(!(I<C&&C<z))continue;const oe=Math.min(C-I,z-C);oe<v1||t.push({kind:"group-cuts-shape",group:v.id,shape:g.id,side:x,depth:oe})}}const u=e.shapes.filter(v=>v.container&&v.type!=="bpmn:Group"&&v.type!=="bpmn:Lane");for(const v of e.shapes.filter(g=>g.type==="bpmn:Group"))for(const g of u){const b=v.x<g.x+g.width&&g.x<v.x+v.width,x=v.y<g.y+g.height&&g.y<v.y+v.height,C=[["top",v.y,g.y,b],["bottom",v.y+v.height,g.y+g.height,b],["left",v.x,g.x,x],["right",v.x+v.width,g.x+g.width,x]];for(const[M,k,P,B]of C)B&&Math.abs(k-P)<=ah&&t.push({kind:"group-on-container-boundary",group:v.id,container:g.id,side:M})}const f=e.shapes.filter(v=>v.type==="bpmn:Group");for(let v=0;v<f.length;v++)for(let g=v+1;g<f.length;g++){const b=f[v],x=f[g],C=b.x<x.x+x.width&&x.x<b.x+b.width,M=b.y<x.y+x.height&&x.y<b.y+b.height,k=[["x",b.x+b.width,x.x,M],["x",x.x+x.width,b.x,M],["y",b.y+b.height,x.y,C],["y",x.y+x.height,b.y,C]];for(const[P,B,D,I]of k)if(I&&Math.abs(B-D)<=ah){t.push({kind:"group-on-group-boundary",groups:b.id<x.id?[b.id,x.id]:[x.id,b.id],axis:P});break}}for(let v=0;v<e.edges.length;v++)for(let g=v+1;g<e.edges.length;g++){const b=e.edges[v],x=e.edges[g],C=fo(b,x);if(!C)continue;const M=b.id<x.id?[b.id,x.id]:[x.id,b.id];t.push({kind:C.kind==="opposite"?"edge-overlap-opposite":C.kind==="mixed"?"edge-overlap-mixed":"edge-overlap-unrelated",edges:M,axis:C.axis,length:Math.round(C.length)})}for(const v of e.edges){if(!v.label)continue;const g=Ss(v,e.edges);g&&t.push({kind:"label-on-shared-segment",edge:v.id,other:g.other,axis:g.axis})}for(const v of e.edges){if(!v.label)continue;const g=fh(v,e);g&&t.push({kind:"label-over-line",edge:v.id,line:g})}const p=new Set(n.map(v=>v.id)),d=e.shapes.filter(v=>v.type==="bpmn:Participant"&&v.label);for(const v of[...n,...d.filter(g=>!p.has(g.id))]){if(!v.label)continue;const g=bh(v,e);g&&t.push({kind:"label-over-line",edge:v.id,line:g})}const m=new Set(e.shapes.filter(v=>v.type==="bpmn:TextAnnotation").map(v=>v.id));for(const v of d)for(const{owner:g,rect:b}of mo(e))g===v.id||m.has(g)||mu(v.label,b,ho)&&t.push({kind:"pool-name-over-label",pool:v.id,label:g});const h=mo(e);for(const v of n)if(v.type==="bpmn:TextAnnotation")for(const{owner:g,rect:b}of h)g!==v.id&&mu(v,b,ho)&&t.push({kind:"annotation-over-label",annotation:v.id,label:g});const y=new Map(e.shapes.map(v=>[v.id,v]));for(const v of n){const g=v.parent??M1(v,e,y);if(!g)continue;const b=y.get(g);!b||!b.container||S1(b,v,E1)||t.push({kind:"shape-outside-container",shape:v.id,container:b.id})}return t.sort((v,g)=>Rt(v).localeCompare(Rt(g)))}const Et=e=>typeof e=="object"&&e!==null?e:void 0,It=e=>typeof e=="number"?e:0,Di=e=>{const t=Et(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function T1(e){const t=Et(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=Di(o);a&&n.push(a)}}return n}function k1(e){const t=Et(e);if(!t)return{};const n=Array.isArray(t.sourceRef)?void 0:Di(t.sourceRef),i=Array.isArray(t.targetRef)?void 0:Di(t.targetRef);return n&&i?{source:n,target:i}:{}}function O1(e,t){const n=Et(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const r=Di(n);return r?t.get(r):void 0}if(_s.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return Di(n)}function xh(e){var a,s,c,l,u;const t=[],n=[],i=((a=Et(e))==null?void 0:a.diagrams)??[],r=new Map,o=new Set;for(const f of((s=Et(e))==null?void 0:s.rootElements)??[]){const p=Et(f);if((p==null?void 0:p.$type)==="bpmn:Collaboration")for(const d of p.participants??[]){const m=Et(d),h=Di(m),y=Di(m==null?void 0:m.processRef);h&&y?r.set(y,h):h&&o.add(h)}}for(const f of i){const p=Et((c=Et(f))==null?void 0:c.plane),d=(p==null?void 0:p.planeElement)??[];for(const m of d){const h=Et(m);if(!h)continue;const y=Et(h.bpmnElement),v=typeof(y==null?void 0:y.id)=="string"?y.id:void 0;if(!v)continue;const g=typeof(y==null?void 0:y.$type)=="string"?y.$type:"",b=Et(h.bounds);if(b){const C=h.isExpanded===!1&&g!=="bpmn:Participant",M=Et((l=Et(h.label))==null?void 0:l.bounds),k={id:v,type:g,x:It(b.x),y:It(b.y),width:It(b.width),height:It(b.height),container:_s.has(g)&&!C,attached:(y==null?void 0:y.attachedToRef)!==void 0,...y?{parent:O1(y,r)}:{},...M?{label:{x:It(M.x),y:It(M.y),width:It(M.width),height:It(M.height)}}:{},...g==="bpmn:Group"?vh(yh(y)):{}},P=h.isHorizontal!==!1,B=typeof(y==null?void 0:y.name)=="string"?y.name:"";o.has(v)&&P&&B&&(k.label=fu(k,B)),t.push(k);continue}const x=h.waypoint;if(Array.isArray(x)){const C=Et((u=Et(h.label))==null?void 0:u.bounds);n.push({id:v,type:g,waypoints:x.map(M=>{var k,P;return{x:It((k=Et(M))==null?void 0:k.x),y:It((P=Et(M))==null?void 0:P.y)}}),endpoints:T1(y),...k1(y),...C?{label:{x:It(C.x),y:It(C.y),width:It(C.width),height:It(C.height)}}:{}})}}}return{shapes:t,edges:n}}function _h(e){return At(xh(e))}async function D1(e){const{definitions:t,warnings:n}=await lo(e);return{findings:_h(t),warnings:n}}function nt(e){var i;const t=[],n=[];for(const r of e.getAll()){const o=r;if(o.type==="label"||o.labelTarget)continue;const a=typeof o.type=="string"?o.type:"";if(a==="bpmn:Definitions"||a.startsWith("bpmndi:"))continue;const s=o.waypoints;if(s){const h=Et(o.label),y=Di(o.source),v=Di(o.target);n.push({id:o.id,type:a,waypoints:s.map(g=>({x:It(g.x),y:It(g.y)})),endpoints:[y,v].filter(g=>!!g),...y&&v?{source:y,target:v}:{},...h&&typeof h.x=="number"?{label:{x:h.x,y:It(h.y),width:It(h.width),height:It(h.height)}}:{}});continue}if(typeof o.x!="number"||typeof o.y!="number")continue;const c=Et(o.businessObject),l=Et(o.label);let u=Et(o.parent);for(;u&&u.type==="bpmn:Lane";)u=Et(u.parent);const f=typeof(u==null?void 0:u.type)=="string"?u.type:"",p=u&&_s.has(f)&&f!=="bpmn:Group"&&typeof u.id=="string"?u.id:void 0,d={id:o.id,type:a,x:o.x,y:o.y,width:It(o.width),height:It(o.height),container:_s.has(a)&&(a==="bpmn:Participant"||o.collapsed!==!0),attached:(c==null?void 0:c.attachedToRef)!==void 0,...p!==void 0?{parent:p}:{},...l&&typeof l.x=="number"?{label:{x:l.x,y:It(l.y),width:It(l.width),height:It(l.height)}}:{},...a==="bpmn:Group"?vh(yh(c)):{}},m=typeof(c==null?void 0:c.name)=="string"?c.name:"";a==="bpmn:Participant"&&!(c!=null&&c.processRef)&&m&&((i=Et(o.di))==null?void 0:i.isHorizontal)!==!1&&(d.label=fu(d,m)),t.push(d)}return{shapes:t,edges:n}}const I1={"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 L1(e,t){const n=I1[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function wh(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function Eh(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 L1(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&wh(i)===n).sort((i,r)=>i.y-r.y).map(i=>i.id),participantOf:n=>{const i=e.get(n);return i?wh(i):void 0},endpointsOf:n=>{var r,o;const i=e.get(n);if(!(!i||i.type==="label")&&"waypoints"in i)return{source:(r=i.source)==null?void 0:r.id,target:(o=i.target)==null?void 0:o.id}}}}const gu=20,B1=4,bt=(e,t)=>Math.abs(e-t)<.5;function Cs(e,t,n,i=gu){if(bt(e.y,t.y)&&!bt(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(bt(e.x,t.x)&&!bt(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 Sh(e,t,n,i=gu){if(n.length<2)return null;if(bt(e.y,t.y)&&!bt(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,f=Math.max(...n.map(d=>d.y+d.height))+i,p=d=>[{x:c,y:e.y},{x:c,y:d},{x:l,y:d},{x:l,y:e.y}];return[p(u),p(f)]}if(bt(e.x,t.x)&&!bt(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,f=Math.max(...n.map(d=>d.x+d.width))+i,p=d=>[{x:e.x,y:c},{x:d,y:c},{x:d,y:l},{x:e.x,y:l}];return[p(u),p(f)]}return null}function Rh(e,t,n=gu){if(e.length!==4)return null;const[i,r,o,a]=e;if(bt(i.y,r.y)&&bt(r.x,o.x)&&bt(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(bt(i.x,r.x)&&bt(r.y,o.y)&&bt(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 As(e,t){if(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[];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 Ch=30,N1=[0,-25,25,-40,40];function $1(e,t){if(e.type!=="bpmn:MessageFlow"||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[];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+Ch:s-Ch,l=a?i.y+i.height:i.y,u=n.x+n.width/2,f=i.x+i.width/2;return N1.map(p=>[{x:u,y:s},{x:u,y:c},{x:f+p,y:c},{x:f+p,y:l}])}const yu=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],go=(e,t,n)=>an({...e,waypoints:t},n).length;function vu(e,t,n,i){let r=[...e.waypoints],o=go(e,r,t);if(o===0)return null;let a=!1;for(const f of As(e,t))if(go(e,f,t)===0)return f;const s=(i??[]).filter(f=>f.id!==e.id).flatMap(_n),c=f=>_n({...e,waypoints:f}).some(p=>Es(p,s).length>0),l=$1(e,t).filter(f=>go(e,f,t)===0);if(l.length)return l.find(f=>!c(f))??l[0];const u=f=>!n||f.every(p=>p.x>=n.x&&p.x<=n.x+n.width&&p.y>=n.y&&p.y<=n.y+n.height);if(e.endpoints.length===2&&r.length>2){const f=t.find(d=>d.id===e.endpoints[0]),p=t.find(d=>d.id===e.endpoints[1]);if(f&&p&&bt(f.y+f.height/2,p.y+p.height/2)){const d=[r[0],r[r.length-1]];if(bt(d[0].y,d[1].y)&&!bt(d[0].x,d[1].x)){const m=t.filter(g=>!e.endpoints.includes(g.id)&&an({...e,waypoints:d},[g]).length>0),h=m.length>=2?Sh(d[0],d[1],m):null,v=(h?h.map(g=>[d[0],...g,d[1]]):m.length===1?(Cs(d[0],d[1],m[0])??[]).map(g=>[d[0],...g,d[1]]):m.length===0?[d]:[]).filter(g=>go(e,g,t)===0&&g.length<=r.length).sort((g,b)=>Number(u(b))-Number(u(g)));if(v.length)return v.find(g=>!c(g))??v[0]}}}for(let f=0;f+1<r.length;f++){const p=r[f],d=r[f+1],m=t.filter(v=>!e.endpoints.includes(v.id)&&an({...e,waypoints:[p,d]},[v]).length>0);if(m.length<2)continue;const h=Sh(p,d,m);if(!h)continue;const y=h.map(v=>yu(r,f,v)).filter(v=>go(e,v,t)===0).sort((v,g)=>Number(u(g))-Number(u(v)));if(y.length)return y.find(v=>!c(v))??y[0]}for(let f=0;f<B1&&o>0;f++){let p=!1;for(let d=0;d+1<r.length&&!p;d++){const m=r[d],h=r[d+1];for(const y of t){if(e.endpoints.includes(y.id)||an({...e,waypoints:[m,h]},[y]).length===0)continue;const v=Cs(m,h,y),g=v?v.map(x=>yu(r,d,x)):Rh(r,y)??[];if(!g.length)continue;const b=[...g].sort((x,C)=>Number(u(C))-Number(u(x)));for(const x of b){const C=go(e,x,t);if(C<o){r=x,o=C,p=!0,a=!0;break}}if(p)break}}if(!p)break}return a&&o===0?r:null}function bu(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=nt(i),a=Wn(o),s=new Set,c=At(o).filter(u=>u.kind==="edge-crosses-shape"&&!t.has(Rt(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 f=o.edges.find(p=>p.id===u.edge);f&&l.set(u.edge,f)}for(const[u,f]of l){if(n&&!n.has(u))continue;const p=i.get(u);if(!p)continue;const d=p.parent,m=d&&typeof d.x=="number"&&typeof d.width=="number"?{x:d.x,y:d.y,width:d.width,height:d.height}:void 0,h=vu(f,a,m,o.edges);if(!h){an(f,a).some(b=>b.type==="bpmn:TextAnnotation")&&s.add(u);continue}const y=o.edges.filter(b=>b.id!==u),v=Gn(f,y);Gn({...f,waypoints:h},y)>v||r.updateWaypoints(p,h)}return s}const F1=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},xu=(e,t)=>aa(e,[t])>0;function Ah(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=nt(i),a=Wn(o);let s=o;const c=new Set(At(o).map(Rt));for(const[l,u]of Rs(o))if(!t.has(`${l}|${u}`))for(const[f,p]of[[l,u],[u,l]]){if(n.has(f))continue;const d=s.edges.find(B=>B.id===f),m=s.edges.find(B=>B.id===p);if(!d||!m)continue;const h=i.get(f);if(!h)continue;const y=h.parent,v=y&&typeof y.x=="number"&&typeof y.width=="number"?{x:y.x,y:y.y,width:y.width,height:y.height}:void 0,g=F1(m),b=[...As(d,a)??[]],x=vu(d,[...a,...g],v,o.edges);x&&b.push(x);for(let B=0;B+1<d.waypoints.length;B++)for(const D of g)for(const I of Cs(d.waypoints[B],d.waypoints[B+1],D)??[])b.push(yu(d.waypoints,B,I));const C=s.edges.filter(B=>B.id!==f),M=B=>({...s,edges:s.edges.map(D=>D.id===f?{...D,waypoints:B}:D)}),k=B=>!v||B.every(D=>D.x>=v.x&&D.x<=v.x+v.width&&D.y>=v.y&&D.y<=v.y+v.height),P=b.find(B=>{const D={...d,waypoints:B};return xu(D,m)||!k(B)||C.some(I=>I.id!==p&&!xu(d,I)&&xu(D,I))?!1:At(M(B)).every(I=>c.has(Rt(I)))});if(P){r.updateWaypoints(h,P),s=M(P);break}}}const j1=10;function Ph(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 Mh(e,t){if(e.waypoints.length<2||e.endpoints.length!==2)return null;const n=t.shapes.filter(z=>z.type==="bpmn:Participant"&&z.container),i=t.shapes.find(z=>z.id===e.endpoints[0]),r=t.shapes.find(z=>z.id===e.endpoints[1]);if(!i||!r)return null;const o=Ph(i,n),a=Ph(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(z=>z.id!==o.id&&z.id!==a.id&&z.y>=c.y+c.height&&z.y+z.height<=l.y).sort((z,oe)=>z.y-oe.y);if(!u.length)return null;const f=u[0],p=u[u.length-1],d=(c.y+c.height+f.y)/2,m=(p.y+p.height+l.y)/2,h=s?d:m,y=s?m:d,v=e.waypoints[0],g=e.waypoints[e.waypoints.length-1],b=Wn(t),x=t.edges.filter(z=>z.id!==e.id),C=Vn(e,x),M=an(e,b).length;if(C===0&&M===0||M===0&&e.waypoints.length===2)return null;const k=Math.min(...u.map(z=>z.x)),P=Math.max(...u.map(z=>z.x+z.width)),B=(v.x+g.x)/2,D=z=>z.filter((oe,ye)=>ye===0||!(bt(oe.x,z[ye-1].x)&&bt(oe.y,z[ye-1].y)));let I;for(let z=k;z<=P;z+=j1){const oe=D([v,{x:v.x,y:h},{x:z,y:h},{x:z,y},{x:g.x,y},g]),ye={...e,waypoints:oe};if(an(ye,b).length>0)continue;const Ve=Vn(ye,x),He=Math.abs(z-B);(!I||Ve<I.cross||Ve===I.cross&&He<I.detour)&&(I={pts:oe,cross:Ve,detour:He})}return I&&(M>0?I.cross<=C:I.cross<C)?I.pts:null}function Th(e,t){const{elementRegistry:n}=e,i=e.modeling,r=nt(n);for(const o of r.edges){if(o.type!=="bpmn:MessageFlow"||t.has(o.id))continue;const a=nt(n),s=a.edges.find(u=>u.id===o.id);if(!s)continue;const c=Mh(s,a);if(!c)continue;const l=n.get(o.id);l&&i.updateWaypoints(l,c)}}const gi=[25,-25,40,-40],yo=35;function H1(e,t){const n=e.x+e.width/2,i=t.x+t.width/2,r=[];for(const o of[!0,!1]){const a=o?e.y:e.y+e.height,s=o?t.y:t.y+t.height,c=o?Math.min(e.y,t.y)-yo:Math.max(e.y+e.height,t.y+t.height)+yo;for(const l of[0,...gi])if(!(Math.abs(l)>=e.width/2-5))for(const u of[0,...gi]){if(Math.abs(u)>=t.width/2-5)continue;const f=n+l,p=i+u;r.push({pts:[{x:f,y:a},{x:f,y:c},{x:p,y:c},{x:p,y:s}],cost:Math.abs(u)+Math.abs(l)})}}return r}function Ps(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 H1(n,i);const o=i.x+i.width/2,a=n.x+n.width/2,s=r<i.y,c=s?i.y:i.y+i.height,l=s?n.y:n.y+n.height,u=s?n.y-yo:n.y+n.height+yo,f=[];for(const g of[0,...gi]){if(Math.abs(g)>=i.width/2-5)continue;const b=o+g;f.push({pts:[{x:n.x,y:r},{x:b,y:r},{x:b,y:c}],cost:Math.abs(g)});for(const x of[0,...gi]){if(Math.abs(x)>=n.width/2-5)continue;const C=a+x;f.push({pts:[{x:C,y:l},{x:C,y:u},{x:b,y:u},{x:b,y:c}],cost:Math.abs(g)+Math.abs(x)})}}const p=50,d=i.y+i.height/2,m=s?n.y+n.height:n.y;for(const g of[0,...gi]){if(Math.abs(g)>=n.width/2-5)continue;const b=a+g;f.push({pts:[{x:b,y:m},{x:b,y:d},{x:i.x+i.width,y:d}],cost:p+Math.abs(g)})}const h=60,y=s?i.y+i.height:i.y,v=s?i.y+i.height+yo:i.y-yo;for(const g of[0,...gi]){if(Math.abs(g)>=i.width/2-5)continue;const b=o+g;for(const x of[0,...gi]){if(Math.abs(x)>=n.width/2-5)continue;const C=a+x;f.push({pts:[{x:C,y:m},{x:C,y:v},{x:b,y:v},{x:b,y}],cost:h+Math.abs(g)+Math.abs(x)})}}return f}const Ms=30;function kh(e,t){for(let n=1;n<e.length-2;n++){const i=e[n],r=e[n+1],o=bt(i.y,r.y)&&!bt(i.x,r.x),a=bt(i.x,r.x)&&!bt(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)<Ms||Math.abs(i.y-(s.y+s.height))<Ms)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)<Ms||Math.abs(i.x-(s.x+s.width))<Ms)return!0}}return!1}const Ts=40;function z1(e,t,n){let i=0;for(const r of t){if(r.container||n.includes(r.id))continue;const o=r.x-Ts,a=r.x+r.width+Ts,s=r.y-Ts,c=r.y+r.height+Ts;for(let l=1;l<e.length-2;l++){const u=e[l],f=e[l+1],p={x:Math.min(u.x,f.x),y:Math.min(u.y,f.y)},d={x:Math.max(u.x,f.x),y:Math.max(u.y,f.y)};if(p.x<a&&d.x>o&&p.y<c&&d.y>s){i++;break}}}return i}function Oh(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])),r=Wn(t),o=t.edges.filter(M=>M.id!==e.id),a=Gn(e,o),s=Vn(e,o),c=M=>z1(M,t.shapes,e.endpoints)+(kh(M,n)?1:0),l=c(e.waypoints),u=M=>{if(!M)return;const k=M.x+M.width/2,P=M.y+M.height/2;return n.find(B=>B.type==="bpmn:Lane"&&k>=B.x&&k<=B.x+B.width&&P>=B.y&&P<=B.y+B.height)},f=u(i.get(e.endpoints[0]??"")),p=u(i.get(e.endpoints[1]??"")),d=!!f&&!!p&&f.id!==p.id,m=M=>{if(!d||!p)return!1;for(let k=1;k<M.length-2;k++){const P=M[k],B=M[k+1];if(bt(P.y,B.y)&&!bt(P.x,B.x)&&P.y>p.y&&P.y<p.y+p.height)return!0}return!1},h=m(e.waypoints),v=(M=>{if(!M)return;const k=M.x+M.width/2,P=M.y+M.height/2;return n.filter(B=>B.type==="bpmn:Participant"&&k>=B.x&&k<=B.x+B.width&&P>=B.y&&P<=B.y+B.height).sort((B,D)=>B.width*B.height-D.width*D.height)[0]})(i.get(e.endpoints[0]??"")),g=M=>{if(!v)return 0;let k=0;for(let P=1;P<M.length-1;P++){const B=M[P];(B.x<v.x||B.x>v.x+v.width||B.y<v.y||B.y>v.y+v.height)&&k++}return k},b=g(e.waypoints);if(!kh(e.waypoints,n)&&!(d&&!h)&&b===0)return null;const x=M=>M.reduce((k,P,B)=>B?k+Math.abs(P.x-M[B-1].x)+Math.abs(P.y-M[B-1].y):0,0);let C;for(const{pts:M,cost:k}of Ps(e,i)){const P={...e,waypoints:M};if(an(P,r).length>0)continue;const B=Gn(P,o);if(B>a)continue;const D=g(M);if(D>b)continue;const I=D<b&&B===0;if(!I&&Vn(P,o)>s)continue;const z=c(M),oe=m(M);if(!I&&!(oe&&!h)&&z>=l)continue;const Ve=oe?0:1,He=x(M);(!C||D<C.out||D===C.out&&(Ve<C.lane||Ve===C.lane&&(B<C.opp||B===C.opp&&(z<C.sc||z===C.sc&&(k<C.cost||k===C.cost&&He<C.len)))))&&(C={pts:M,out:D,sc:z,lane:Ve,opp:B,cost:k,len:He})}return(C==null?void 0:C.pts)??null}function G1(e,t){const{elementRegistry:n}=e,i=e.modeling,r=nt(n).edges.filter(o=>!t.has(o.id)&&o.waypoints.length>=4).map(o=>o.id).sort();for(const o of r){const a=nt(n),s=a.edges.find(d=>d.id===o);if(!s||s.waypoints.length<4)continue;const c=Wn(a),l=a.edges.filter(d=>d.id!==o),u=an(s,c).length,f=Gn(s,l),p=Vn(s,l);for(const d of As(s,a.shapes)){if(d.length>=s.waypoints.length)continue;const m={...s,waypoints:d};if(an(m,c).length>u||Gn(m,l)>f||Vn(m,l)>p)continue;const h=n.get(o);h&&i.updateWaypoints(h,d);break}}}function Dh(e,t){const{elementRegistry:n}=e,i=e.modeling,r=nt(n).edges.filter(o=>o.type==="bpmn:SequenceFlow"&&!t.has(o.id)).map(o=>o.id).sort();for(const o of r){const a=nt(n),s=a.edges.find(u=>u.id===o);if(!s)continue;const c=Oh(s,a);if(!c)continue;const l=n.get(o);l&&i.updateWaypoints(l,c)}}function _u(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=bt(n[0].x,n[1].x)&&!bt(n[0].y,n[1].y),s=bt(n[n.length-1].x,n[n.length-2].x)&&!bt(n[n.length-1].y,n[n.length-2].y);for(const c of gi){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 V1(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,f=i.y+i.height/2,p=a?n.x+n.width:n.x,d=o?n.y+n.height:n.y,m=a?i.x:i.x+i.width,h=o?i.y:i.y+i.height,y=[];for(const v of[0,...gi])Math.abs(v)<i.width/2-5&&y.push({pts:[{x:p,y:l},{x:u+v,y:l},{x:u+v,y:h}],cost:Math.abs(v)}),Math.abs(v)<i.height/2-5&&y.push({pts:[{x:c,y:d},{x:c,y:f+v},{x:m,y:f+v}],cost:Math.abs(v)});return y}function wu(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,f=[];for(const p of[0,...gi]){const d=u+p;d<=r||d>=o||f.push({pts:[{x:d,y:c},{x:d,y:l}],cost:Math.abs(p)})}return f}function Ih(e,t){const n=new Map(t.shapes.map(d=>[d.id,d])),i=Wn(t),r=t.edges.filter(d=>d.id!==e.id),o=Gn(e,r);if(o===0)return null;const a=Vn(e,r);let s;const c=d=>d.reduce((m,h,y)=>y?m+Math.abs(h.x-d[y-1].x)+Math.abs(h.y-d[y-1].y):0,0),l=3,u=d=>{const m=d[0],h=d[d.length-1],y=Math.hypot(h.x-m.x,h.y-m.y);return y>=1&&c(d)/y>=l?1:0},f=u(e.waypoints),p=[...Ps(e,n),...wu(e,n),..._u(e,n)];for(const{pts:d,cost:m}of p){const h={...e,waypoints:d};if(an(h,i).length>0)continue;const y=Gn(h,r),v=Vn(h,r),g=o-y+(f-u(d));if(y>=o||v-a>g)continue;const b=c(d);(!s||y<s.opposite||y===s.opposite&&(v<s.cross||v===s.cross&&(m<s.cost||m===s.cost&&b<s.len)))&&(s={pts:d,opposite:y,cross:v,cost:m,len:b})}return(s==null?void 0:s.pts)??null}function Lh(e,t){var i;let n=0;for(const r of t)r.id!==e.id&&((i=fo(e,r))==null?void 0:i.kind)==="unrelated"&&n++;return n}function W1(e,t){const n=new Map(t.shapes.map(p=>[p.id,p])),i=Wn(t),r=t.edges.filter(p=>p.id!==e.id),o=Lh(e,r);if(o===0)return null;const a=Gn(e,r),s=Vn(e,r),c=p=>p.reduce((d,m,h)=>h?d+Math.abs(m.x-p[h-1].x)+Math.abs(m.y-p[h-1].y):0,0),l=2;let u;const f=[...Ps(e,n),...wu(e,n),...V1(e,n),..._u(e,n)];for(const{pts:p,cost:d}of f){const m={...e,waypoints:p};if(an(m,i).length>0)continue;const h=Lh(m,r);if(h>=o)continue;const y=Gn(m,r);if(y-h>a-o)continue;const v=Vn(m,r);if(v-s>(o-h)*l)continue;const g=c(p);(!u||h<u.fake||h===u.fake&&(y<u.unreadable||y===u.unreadable&&(v<u.cross||v===u.cross&&(d<u.cost||d===u.cost&&g<u.length))))&&(u={pts:p,fake:h,unreadable:y,cross:v,cost:d,length:g})}return(u==null?void 0:u.pts)??null}function Bh(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=At(nt(i)).filter(s=>s.kind==="edge-overlap-unrelated"&&!t.has(Rt(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=nt(i),l=c.edges.find(p=>p.id===s);if(!l)continue;const u=W1(l,c);if(!u)continue;const f=i.get(s);f&&r.updateWaypoints(f,u)}}function Nh(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 $h(e,t,n){var l;if(e.type!=="bpmn:SequenceFlow"||t.type!=="bpmn:SequenceFlow"||((l=fo(e,t))==null?void 0:l.kind)!=="opposite")return!1;const[i,r]=e.endpoints,[o,a]=t.endpoints,s=[i,r].filter(u=>u&&(u===o||u===a)).length;return!(!!r&&r===o||!!a&&a===i)||s!==1?!1:Nh(e,n)&&Nh(t,n)}function Fh(e,t,n){let i=0;for(const r of t)r.id!==e.id&&$h(e,r,n)&&i++;return i}function U1(e,t){const n=new Map(t.shapes.map(p=>[p.id,p])),i=Wn(t),r=t.edges.filter(p=>p.id!==e.id),o=Fh(e,r,n);if(o===0)return null;const a=Gn(e,r),s=Vn(e,r),c=p=>p.reduce((d,m,h)=>h?d+Math.abs(m.x-p[h-1].x)+Math.abs(m.y-p[h-1].y):0,0),l=2;let u;const f=[...Ps(e,n),...wu(e,n),..._u(e,n)];for(const{pts:p,cost:d}of f){const m={...e,waypoints:p};if(an(m,i).length>0)continue;const h=Fh(m,r,n);if(h>=o)continue;const y=Gn(m,r);if(y-h>a-o)continue;const v=Vn(m,r);if(v-s>(o-h)*l)continue;const g=c(p);(!u||h<u.chain||h===u.chain&&(y<u.unreadable||y===u.unreadable&&(v<u.cross||v===u.cross&&(d<u.cost||d===u.cost&&g<u.length))))&&(u={pts:p,chain:h,unreadable:y,cross:v,cost:d,length:g})}return(u==null?void 0:u.pts)??null}function Y1(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=nt(i),a=new Map(o.shapes.map(l=>[l.id,l])),s=At(o).filter(l=>l.kind==="edge-overlap-opposite"&&!t.has(Rt(l)));if(!s.length)return;const c=new Set;for(const l of s){if(l.kind!=="edge-overlap-opposite")continue;const[u,f]=l.edges.map(p=>o.edges.find(d=>d.id===p));if(!(!u||!f||!$h(u,f,a)))for(const p of l.edges)n.has(p)||c.add(p)}for(const l of[...c].sort()){const u=nt(i),f=u.edges.find(m=>m.id===l);if(!f)continue;const p=U1(f,u);if(!p)continue;const d=i.get(l);d&&r.updateWaypoints(d,p)}}function jh(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=nt(i),a=At(o).filter(u=>du(u)&&!t.has(Rt(u)));if(!a.length)return;const s=new Set;for(const u of a)if(du(u))for(const f of u.edges)n.has(f)||s.add(f);const c=u=>{var f;return((f=o.edges.find(p=>p.id===u))==null?void 0:f.type)??""},l=[...s].sort((u,f)=>{const p=c(u)==="bpmn:SequenceFlow"?0:1,d=c(f)==="bpmn:SequenceFlow"?0:1;return p!==d?p-d:u.localeCompare(f)});for(const u of l){const f=nt(i),p=f.edges.find(h=>h.id===u);if(!p)continue;const d=Ih(p,f);if(!d)continue;const m=i.get(u);m&&r.updateWaypoints(m,d)}}const q1=10,K1=(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 Hh(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!Ss(e,i))return null;const r=Wn(t),o=i.flatMap(_n);for(const a of _n(e)){let s=[[a.lo,a.hi]];for(const[d,m]of Es(a,o))s=s.flatMap(([h,y])=>{const v=[];return d>h&&v.push([h,Math.min(y,d)]),m<y&&v.push([Math.max(h,m),y]),v.filter(([g,b])=>b>g)});const c=a.axis==="h"?n.width:n.height,l=s.find(([d,m])=>m-d>=c+q1*2);if(!l)continue;const u=(l[0]+l[1])/2,f=a.axis==="h"?{x:u,y:a.at-uh}:{x:a.at+kn+n.width/2,y:u},p={x:f.x-n.width/2,y:f.y-n.height/2,width:n.width,height:n.height};if(!Ss({...e,label:p},i)&&!r.some(d=>!e.endpoints.includes(d.id)&&K1(p,d)))return p}return null}const kn=8;function zh(e,t){const n=e.label;if(!n)return null;const i=_n(e);if(!i.length)return null;const r=n.x+n.width/2,o=n.y+n.height/2,a=p=>{const d=p.axis==="h"?r:o,m=p.axis==="h"?o-p.at:r-p.at,h=d<p.lo?p.lo-d:d>p.hi?d-p.hi:0;return Math.hypot(m,h)},s=i.reduce((p,d)=>a(d)<a(p)?d:p,i[0]),c=[...i,...t.edges.filter(p=>p.id!==e.id).flatMap(_n),...t.shapes.filter(p=>p.container).flatMap(oa)],l=p=>!c.some(d=>Oi(p,d));if(l(n))return null;const u=(s.axis==="v"?n.height:n.width)+kn,f=[0,-u,u,-2*u,2*u];if(s.axis==="v")for(const p of[s.at+kn,s.at-kn-n.width])for(const d of f){const m=n.y+d;if(m<s.lo||m+n.height>s.hi)continue;const h={...n,x:p,y:m};if(l(h))return h}else for(const p of[s.at-kn-n.height,s.at+kn])for(const d of f){const m=n.x+d;if(m<s.lo||m+n.width>s.hi)continue;const h={...n,x:m,y:p};if(l(h))return h}return null}function Gh(e,t){const{elementRegistry:n}=e,i=e.modeling;let r=nt(n),o=new Set(At(r).map(Rt));for(const[a,s]of t){const c=s.wps,l=n.get(a),u=l==null?void 0:l.label;if(!u||!(l!=null&&l.waypoints)||l.waypoints.length!==c.length)continue;const f=l.waypoints[0].x-c[0].x,p=l.waypoints[0].y-c[0].y;if(!l.waypoints.every((b,x)=>b.x-c[x].x===f&&b.y-c[x].y===p))continue;const d=s.label.x+f-u.x,m=s.label.y+p-u.y;if(d===0&&m===0)continue;const h=r.edges.find(b=>b.id===a);if(!(h!=null&&h.label))continue;const y={...h.label,x:h.label.x+d,y:h.label.y+m},v={...r,edges:r.edges.map(b=>b.id===a?{...b,label:y}:b)},g=At(v);g.some(b=>!o.has(Rt(b)))||(i.moveElements([u],{x:d,y:m}),r=v,o=new Set(g.map(Rt)))}}function Vh(e,t){const{elementRegistry:n}=e,i=e.modeling,r=nt(n);for(const o of r.edges){if(!o.label||t.has(o.id))continue;const a=zh(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 Wh(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=nt(i),a=At(o).filter(s=>s.kind==="label-on-shared-segment"&&!t.has(Rt(s)));for(const s of a){if(s.kind!=="label-on-shared-segment"||n.has(s.edge))continue;const c=o.edges.find(p=>p.id===s.edge);if(!c)continue;const l=Hh(c,o);if(!l)continue;const u=i.get(s.edge),f=u==null?void 0:u.label;f&&r.moveElements([f],{x:l.x-f.x,y:l.y-f.y})}}function Uh(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(_n),...t.shapes.filter(p=>p.container).flatMap(oa)],r=i.filter(p=>Oi(n,p));if(!r.length)return null;const o=t.shapes.filter(p=>!p.container&&p.id!==e.id),a=mo(t).filter(p=>p.owner!==e.id).map(p=>p.rect),s=(p,d)=>p.x<d.x+d.width&&d.x<p.x+p.width&&p.y<d.y+d.height&&d.y<p.y+p.height,c=p=>!i.some(d=>Oi(p,d))&&!o.some(d=>s(p,d))&&!a.some(d=>s(p,d)),l=[];for(const p of r)p.axis==="h"?l.push({...n,y:p.at-kn-n.height},{...n,y:p.at+kn}):l.push({...n,x:p.at-kn-n.width},{...n,x:p.at+kn});const u=e.x+e.width/2,f=e.y+e.height/2;return l.push({...n,x:u-n.width/2,y:e.y+e.height+kn},{...n,x:u-n.width/2,y:e.y-kn-n.height},{...n,x:e.x+e.width+kn,y:f-n.height/2},{...n,x:e.x-kn-n.width,y:f-n.height/2}),l.find(c)??null}function Yh(e,t){const{elementRegistry:n}=e,i=e.modeling,r=nt(n);for(const o of r.shapes){if(o.container||!o.label||t.has(o.id))continue;const a=Uh(o,nt(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 X1(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 qh(e,t){const{elementRegistry:n}=e,i=e.modeling;let r=nt(n),o=new Set(At(r).map(Rt));const a=[...new Set(At(r).filter(s=>s.kind==="edge-endpoint-detached"&&!t.has(Rt(s))).map(s=>s.edge))].sort();for(const s of a){const c=r.edges.find(h=>h.id===s);if(!c||c.waypoints.length<2)continue;const l=c.waypoints.map(h=>({...h})),u=[[c.endpoints[0],0],[c.endpoints[1],l.length-1]];let f=!1;for(const[h,y]of u){const v=h?r.shapes.find(b=>b.id===h):void 0;if(!v)continue;const g=X1(v,l[y]);g.x===l[y].x&&g.y===l[y].y||(l[y]=g,f=!0)}if(!f)continue;const p={...r,edges:r.edges.map(h=>h.id===s?{...h,waypoints:l}:h)},d=At(p);if(d.some(h=>!o.has(Rt(h))))continue;const m=n.get(s);m&&(i.updateWaypoints(m,l),r=p,o=new Set(d.map(Rt)))}}const Z1=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,Kh=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),Xh={"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}]},ks=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Eu=e=>typeof e=="string"&&e!=="";function Q1(e){const t=[];function n(i,r,o,a){if(a===null){Eu(o)||t.push({kind:"payload-invalid",opIndex:i,field:r});return}if(!ks(o)){t.push({kind:"payload-invalid",opIndex:i,field:r});return}for(const s of a)Eu(o[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${r}.${s}`})}return e.forEach((i,r)=>{var o,a;if(!ks(i)||!Eu(i.kind)||!(i.kind in Xh)){t.push({kind:"payload-invalid",opIndex:r,field:"kind"});return}for(const s of Xh[i.kind]){const c=s.path.endsWith("[]"),l=c?s.path.slice(0,-2):s.path,u=l.split(".");let f=i;for(const d of u.slice(0,-1)){if(!ks(f))break;f=f[d]}if(!ks(f))continue;const p=f[u[u.length-1]];if(!(p===void 0&&s.optional)&&!(p===null&&s.optional)){if(!c){n(r,s.path,p,s.shape);continue}if(!Array.isArray(p)){t.push({kind:"payload-invalid",opIndex:r,field:s.path});continue}p.forEach((d,m)=>n(r,`${l}[${m}]`,d,s.shape))}}if(i.kind==="node.add"||i.kind==="node.update"){const s=i.band;s!==void 0&&(!Number.isInteger(s)||s<0)&&t.push({kind:"payload-invalid",opIndex:r,field:"band"});const c=i.kind==="node.add"?(o=i.node)==null?void 0:o.type:i.type;typeof c=="string"&&!Pd(c)&&t.push({kind:"node-type-unsupported",opIndex:r,id:(i.kind==="node.add"?(a=i.node)==null?void 0:a.id:i.id)??"",type:c})}}),t}function Zh(e,t){const n=Q1(e);if(n.length>0)return n;const i=[],r=new Map,o=new Map;function a(p,d,m){if(!Z1.test(d)){i.push({kind:"id-invalid",opIndex:p,id:d});return}if(t.categoryOf(d)!==void 0||r.has(d)){i.push({kind:"id-duplicate",opIndex:p,id:d});return}r.set(d,{...m,opIndex:p})}e.forEach((p,d)=>{var m;switch(p.kind){case"participant.add":a(d,p.participant.id,{category:"participant",lanes:(p.participant.lanes??[]).map(h=>h.id)});for(const h of p.participant.lanes??[])a(d,h.id,{category:"lane"});break;case"node.add":a(d,p.node.id,{category:"flowNode",participant:p.node.participant});break;case"sequenceFlow.add":a(d,p.flow.id,{category:"sequenceFlow"});break;case"messageFlow.add":a(d,p.flow.id,{category:"messageFlow"});break;case"dataStore.add":a(d,p.dataStore.id,{category:"dataStore"});for(const h of p.associations??[])h.id&&a(d,h.id,{category:"dataAssociation"});break;case"dataAssociation.add":p.association.id&&a(d,p.association.id,{category:"dataAssociation"});break;case"association.add":p.association.id&&a(d,p.association.id,{category:"association"});break;case"annotation.add":a(d,p.annotation.id,{category:"annotation"}),(m=p.association)!=null&&m.id&&a(d,p.association.id,{category:"association"});break;case"group.add":a(d,p.group.id,{category:"group"});break;case"participant.update":if(p.lanes){o.set(p.id,p.lanes.map(h=>h.id));for(const h of p.lanes)t.categoryOf(h.id)===void 0&&a(d,h.id,{category:"lane"})}break}});const s=p=>{var d;return((d=r.get(p))==null?void 0:d.category)??t.categoryOf(p)},c=p=>{const d=r.get(p);return d?d.category==="participant"?p:d.participant:t.categoryOf(p)==="participant"?p:t.participantOf(p)};function l(p,d,m,h){const y=s(d);if(y===void 0){i.push({kind:"ref-missing",opIndex:p,ref:d,role:m});return}if(h&&!h.includes(y)){i.push({kind:"ref-category",opIndex:p,ref:d,role:m,expected:h.join("|"),actual:y});return}return y}const u=t.isCollaboration()||e.some(p=>p.kind==="participant.add");return e.forEach((p,d)=>{var m;switch(p.kind){case"participant.add":break;case"node.add":{const{participant:h,lane:y}=p.node;if(h===void 0){(u||y!==void 0)&&i.push({kind:"participant-required",opIndex:d,id:p.node.id});break}if(l(d,h,"participant",["participant"])===void 0)break;y!==void 0&&((((m=r.get(h))==null?void 0:m.lanes)??o.get(h)??t.lanesOf(h)).includes(y)||i.push({kind:"lane-unknown",opIndex:d,lane:y,participant:h}));break}case"sequenceFlow.add":{const{id:h,source:y,target:v,name:g,condition:b}=p.flow,x=l(d,y,"source",["flowNode"]),C=l(d,v,"target",["flowNode"]);x&&C&&c(y)!==c(v)&&i.push({kind:"flow-cross-pool",opIndex:d,id:h}),g!==void 0&&b!==void 0&&i.push({kind:"condition-name-conflict",opIndex:d,id:h});break}case"messageFlow.add":{const{id:h,source:y,target:v}=p.flow,g=l(d,y,"source",["flowNode","participant"]),b=l(d,v,"target",["flowNode","participant"]);if(g&&b){const x=c(y),C=c(v);x!==void 0&&x===C&&i.push({kind:"message-flow-same-pool",opIndex:d,id:h})}break}case"dataStore.add":{for(const h of p.associations??[]){if([h.source,h.target].filter(g=>g===p.dataStore.id).length!==1){i.push({kind:"data-association-ends",opIndex:d,source:h.source,target:h.target});continue}const v=h.source===p.dataStore.id?h.target:h.source;l(d,v,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:h,target:y}=p.association,v=l(d,h,"source"),g=l(d,y,"target");if(v&&g){const b=new Set([v,g]);b.has("dataStore")&&b.has("flowNode")||i.push({kind:"data-association-ends",opIndex:d,source:h,target:y})}break}case"association.add":{const{id:h,source:y,target:v}=p.association,g=l(d,y,"source"),b=l(d,v,"target");g&&b&&g!=="annotation"&&b!=="annotation"&&i.push({kind:"association-detached",opIndex:d,annotation:h??`${y}->${v}`});break}case"annotation.add":{if(p.association){const{source:h,target:y}=p.association;if(h!==p.annotation.id&&y!==p.annotation.id)i.push({kind:"association-detached",opIndex:d,annotation:p.annotation.id});else{const v=h===p.annotation.id?y:h;l(d,v,"association")}}p.placement&&l(d,p.placement.anchor,"anchor");break}case"group.add":{for(const h of p.group.members??[]){const y=l(d,h,"member");y&&Kh.has(y)&&i.push({kind:"ref-category",opIndex:d,ref:h,role:"member",expected:"shape",actual:y})}break}case"participant.update":{if(f(d,p.id,"participant")===void 0)break;if(p.lanes){const h=t.lanesOf(p.id),y=p.lanes.map(g=>g.id);for(const g of h)y.includes(g)||i.push({kind:"lane-shrink-unsupported",opIndex:d,participant:p.id,lane:g});for(const g of y)t.categoryOf(g)!==void 0&&!h.includes(g)&&i.push({kind:"id-duplicate",opIndex:d,id:g});const v=y.filter(g=>h.includes(g));v.length===h.length&&v.some((g,b)=>g!==h[b])&&i.push({kind:"lane-reorder-unsupported",opIndex:d,participant:p.id})}break}case"node.update":{if(f(d,p.id,"flowNode")===void 0)break;if(p.lane!==void 0){const h=t.participantOf(p.id);(h?o.get(h)??t.lanesOf(h):[]).includes(p.lane)||i.push({kind:"lane-unknown",opIndex:d,lane:p.lane,participant:h??""})}break}case"sequenceFlow.update":{if(f(d,p.id,"sequenceFlow")===void 0)break;if(p.name!==void 0&&p.condition!==void 0&&i.push({kind:"condition-name-conflict",opIndex:d,id:p.id}),p.source!==void 0||p.target!==void 0){const h=p.source===void 0||l(d,p.source,"source",["flowNode"])!==void 0,y=p.target===void 0||l(d,p.target,"target",["flowNode"])!==void 0,v=t.endpointsOf(p.id),g=p.source??(v==null?void 0:v.source),b=p.target??(v==null?void 0:v.target);h&&y&&g!==void 0&&b!==void 0&&new Set([c(g),c(b),c(p.id)]).size>1&&i.push({kind:"flow-cross-pool",opIndex:d,id:p.id})}break}case"messageFlow.update":f(d,p.id,"messageFlow");break;case"dataStore.update":f(d,p.id,"dataStore");break;case"annotation.update":{if(f(d,p.id,"annotation")===void 0)break;p.placement&&l(d,p.placement.anchor,"anchor");break}case"group.update":{if(f(d,p.id,"group")===void 0)break;for(const h of p.members??[]){const y=l(d,h,"member");y&&Kh.has(y)&&i.push({kind:"ref-category",opIndex:d,ref:h,role:"member",expected:"shape",actual:y})}break}case"element.remove":{f(d,p.id)==="lane"&&i.push({kind:"ref-category",opIndex:d,ref:p.id,role:"target",expected:"removable",actual:"lane"});break}}}),i;function f(p,d,m){if(r.has(d)){i.push({kind:"target-added-in-batch",opIndex:p,id:d});return}const h=t.categoryOf(d);if(h===void 0){i.push({kind:"ref-missing",opIndex:p,ref:d,role:"target"});return}if(m&&h!==m){i.push({kind:"ref-category",opIndex:p,ref:d,role:"target",expected:m,actual:h});return}return h}}function Qh(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 Os(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const Ds={"top-left":[-1,-1],top:[0,-1],"top-right":[1,-1],right:[1,0],"bottom-right":[1,1],bottom:[0,1],"bottom-left":[-1,1],left:[-1,0]},sn=10,J1=300,eS=160,Jh=20,em=40,tS=10;function Su(e,t,n,i,r){const o=n,a=(D,I)=>{const[z,oe]=Ds[D];let ye={x:t.x+t.width/2+z*(t.width/2+o.width/2+I),y:t.y+t.height/2+oe*(t.height/2+o.height/2+I)};const Ve=i.x+sn+o.width/2,He=i.x+i.width-sn-o.width/2,it=i.y+sn+o.height/2,K=i.y+i.height-sn-o.height/2,Z={x:Math.min(He,Math.max(Ve,ye.x)),y:Math.min(K,Math.max(it,ye.y))};return(Z.x!==ye.x||Z.y!==ye.y)&&(ye=Math.abs(Z.x-(t.x+t.width/2))<(t.width+o.width)/2+sn&&Math.abs(Z.y-(t.y+t.height/2))<(t.height+o.height)/2+sn?{x:t.x+t.width+sn+o.width/2,y:Z.y}:Z),ye},s=(i.children??[]).filter(D=>!("waypoints"in D&&D.waypoints)&&D.type!=="bpmn:Lane"&&D.type!=="label"&&typeof D.x=="number"&&D.id!==r.selfId),c=nt(e),l=D=>{var z,oe;if(!r.selfId)return!1;const I=e.get(D);return!!I&&(((z=I.source)==null?void 0:z.id)===r.selfId||((oe=I.target)==null?void 0:oe.id)===r.selfId)},u=c.edges.filter(D=>!l(D.id)).flatMap(_n),f=mo(c).filter(D=>D.owner!==r.selfId).map(D=>D.rect),p=D=>({x0:D.x-o.width/2-sn,x1:D.x+o.width/2+sn,y0:D.y-o.height/2-sn,y1:D.y+o.height/2+sn}),d=D=>{const I=p(D);return s.some(z=>I.x0<z.x+z.width&&I.x1>z.x&&I.y0<z.y+z.height&&I.y1>z.y)},m=D=>{const I=p(D);return u.some(z=>z.axis==="h"?z.at>I.y0&&z.at<I.y1&&z.lo<I.x1&&z.hi>I.x0:z.at>I.x0&&z.at<I.x1&&z.lo<I.y1&&z.hi>I.y0)},h=D=>{const I=p(D);return f.some(z=>I.x0<z.x+z.width&&I.x1>z.x&&I.y0<z.y+z.height&&I.y1>z.y)},y=c.shapes.filter(D=>D.type==="bpmn:Group").flatMap(D=>[{axis:"h",at:D.y,lo:D.x,hi:D.x+D.width},{axis:"h",at:D.y+D.height,lo:D.x,hi:D.x+D.width},{axis:"v",at:D.x,lo:D.y,hi:D.y+D.height},{axis:"v",at:D.x+D.width,lo:D.y,hi:D.y+D.height}]),v=D=>{const I=p(D);return y.some(z=>z.axis==="h"?z.at>I.y0&&z.at<I.y1&&z.lo<I.x1&&z.hi>I.x0:z.at>I.x0&&z.at<I.x1&&z.lo<I.y1&&z.hi>I.y0)},g=D=>d(D)||m(D)||h(D)||v(D),b=D=>D.x-o.width/2>=i.x&&D.x+o.width/2<=i.x+i.width&&D.y-o.height/2>=i.y&&D.y+o.height/2<=i.y+i.height;if(r.placement){const D=He=>He.startsWith("top")?He.replace(/^top/,"bottom"):He.replace(/^bottom/,"top"),I=He=>He.endsWith("left")?He.replace(/left$/,"right"):He.replace(/right$/,"left"),z=r.placement.side,oe=[z,D(z),I(z),D(I(z)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],ye=r.placement.offset??50;let Ve=a(z,ye);if(g(Ve)){const He=new Set;for(const it of oe){if(He.has(it))continue;He.add(it);const K=a(it,ye);if(b(K)&&!g(K)){Ve=K;break}}}return Ve}const x=r.from,C=i.x+sn+o.width/2,M=i.x+i.width-sn-o.width/2,k=i.y+sn+o.height/2,P=i.y+i.height-sn-o.height/2;let B={x:Math.min(M,Math.max(C,x.x)),y:Math.min(P,Math.max(k,x.y))};if(g(B)){const D=(t.width+o.width)/2+sn,z=[{x:B.x+D,y:B.y},{x:B.x-D,y:B.y},{x:B.x,y:B.y-o.height-sn},{x:B.x,y:B.y+o.height+sn}].filter(b).find(oe=>!g(oe));z&&(B=z)}return B}function en(e,t){return e.filter(n=>n.kind===t)}function tm(e,t){var Ww,Uw,Yw,qw,Kw,Xw,Zw,Qw,Jw,e0,t0,n0,i0,r0,o0,a0,s0,c0,l0,u0,p0,f0,d0;const{modeling:n,bpmnFactory:i,elementFactory:r,elementRegistry:o,canvas:a,autoPlace:s,bpmnReplace:c,spaceTool:l}=t,u=()=>a.getRootElement(),f=_=>o.get(_),p=_=>{const R=f(_);if(!R)throw new Error(`하강 참조 해소 실패: ${_}`);return R},d=_=>{let R=_.parent;for(;R;){if(R.type==="bpmn:Participant")return R;R=R.parent}},m=new Map;for(const _ of o.filter(R=>!("waypoints"in R&&R.waypoints)&&R.type!=="bpmn:Lane"&&R.type!=="label"&&typeof R.x=="number"))m.set(_.id,{x:_.x,y:_.y});const h=en(e,"participant.add"),y=en(e,"node.add"),v=en(e,"sequenceFlow.add"),g=en(e,"messageFlow.add"),b=en(e,"dataStore.add"),x=en(e,"dataAssociation.add"),C=en(e,"annotation.add"),M=en(e,"group.add"),k=new Map(y.map(_=>[_.node.id,_])),P=(_,R,A)=>{var j;const O=_.businessObject,$=(((j=O.extensionElements)==null?void 0:j.values)??[]).filter(H=>H.$type!==R),L=A?[...$,i.create(R,A)]:$;if(!L.length){O.extensionElements&&n.updateProperties(_,{extensionElements:void 0});return}const N=i.create("bpmn:ExtensionElements",{values:L});L.forEach(H=>{H.$parent=N}),n.updateProperties(_,{extensionElements:N})},B=_=>({anchor:_.anchor,side:_.side,..._.offset!==void 0?{offset:_.offset}:{}});for(const _ of en(e,"element.remove")){const R=f(_.id);R&&n.removeElements([R])}const D=_=>o.filter(R=>{var A;return R.type==="bpmn:Lane"&&((A=d(R))==null?void 0:A.id)===_}).sort((R,A)=>R.y-A.y);for(const _ of en(e,"participant.update")){const R=p(_.id);if(_.name!==void 0&&n.updateProperties(R,{name:_.name??void 0}),!_.lanes)continue;const A=D(_.id);if(!A.length){n.splitLane(R,_.lanes.length),D(_.id).forEach(($,L)=>{const N=_.lanes[L];N&&n.updateProperties($,{id:N.id,name:N.name})});continue}const O=new Set(A.map($=>$.id));_.lanes.forEach(($,L)=>{if(O.has($.id)){n.updateProperties(p($.id),{name:$.name});return}const N=L===0?n.addLane(D(_.id)[0],"top"):n.addLane(p(_.lanes[L-1].id),"bottom");n.updateProperties(N,{id:$.id,name:$.name})})}const I=150,z=130,oe=80,ye=90,Ve=180,He=30,it=30,K=(_,R,A,O,$)=>{const L=A-R.width/2,N=O-R.height/2;return(_.children??[]).find(j=>!("waypoints"in j&&j.waypoints)&&j.type!=="bpmn:Lane"&&j.type!=="label"&&!($!=null&&$.has(j.id))&&typeof j.x=="number"&&L<j.x+j.width+it&&L+R.width+it>j.x&&N<j.y+j.height&&N+R.height>j.y)},Z=new Set;for(const _ of h){Z.add(`pool:${_.participant.id}`);for(const R of _.participant.lanes??[])Z.add(R.id)}const se=new Map;for(const _ of y){const R=_.node.lane??`pool:${_.node.participant??""}`;let A=se.get(R);A||se.set(R,A=new Set([0])),_.band!==void 0&&A.add(_.band)}const xe=new Map;for(const[_,R]of se){if(!Z.has(_))continue;const A=[...R].sort((L,N)=>L-N),O=A.map((L,N)=>N===0?0:N%2===1?Math.ceil(N/2):-(N/2)),$=Math.min(...O);xe.set(_,new Map(A.map((L,N)=>[L,O[N]-$])))}{const _=new Map;for(const R of h)(R.participant.lanes??[]).forEach((A,O)=>_.set(A.id,O));for(const[R,A]of xe){if(!_.has(R)||A.size<2)continue;const O=_.get(R),$=A.get(0)??0,L=new Set;for(const re of y){if(re.node.lane!==R||(re.band??0)!==0||!re.node.type.endsWith("Gateway"))continue;const Me={in:new Set,out:new Set,cross:new Set};for(const we of v){const Pe=we.flow.source===re.node.id;if(!Pe&&we.flow.target!==re.node.id)continue;const lt=k.get(Pe?we.flow.target:we.flow.source);if(!lt||lt.node.participant!==re.node.participant||!lt.node.lane)continue;let De,le=!1;if(lt.node.lane!==R){const Re=_.get(lt.node.lane);if(Re===void 0)continue;De=Re>O?"down":"up",le=!0}else{const Re=A.get(lt.band??0)??$;De=Re>$?"down":Re<$?"up":void 0}De&&(Me[Pe?"out":"in"].add(De),le&&Me.cross.add(De))}for(const we of["up","down"])Me.in.has(we)&&Me.out.has(we)&&Me.cross.has(we)&&L.add(we)}if(L.size!==1)continue;const[N]=L,j=Math.max(...A.values()),H=N==="down"?j:0;if($===H)continue;const Y=[...A.entries()].filter(([re])=>re!==0).sort((re,Me)=>re[1]-Me[1]),ae=[...Array(j+1).keys()].filter(re=>re!==H),_e=new Map([[0,H]]);Y.forEach(([re],Me)=>_e.set(re,ae[Me])),xe.set(R,_e)}}const q=_=>{var R;return(((R=se.get(_))==null?void 0:R.size)??0)>1},V=_=>_.band??(_.node.lane||!q(`pool:${_.node.participant??""}`)?void 0:0),ne=new Map,Te=_=>ne.get(_.node.id)??V(_),yt=new Set,T=new Set;{const _=new Map;for(const O of v)_.set(O.flow.target,(_.get(O.flow.target)??0)+1);const R=O=>{const $=[],L=new Set([O]),N=[O];for(;N.length;){const j=N.shift();$.push(j);for(const H of v)H.flow.source!==j||L.has(H.flow.target)||(_.get(H.flow.target)??0)!==1||(L.add(H.flow.target),N.push(H.flow.target))}return $},A=(O,$)=>{var L;return((L=xe.get(O))==null?void 0:L.get($))??$};for(const O of y){if(!O.node.type.endsWith("Gateway"))continue;const $=O.node.lane??`pool:${O.node.participant??""}`,L=xe.get($);if(!L||L.size<2)continue;const N=Te(O);if(N===void 0||A($,N)!==A($,0))continue;const j=A($,N),H=v.filter(we=>we.flow.source===O.node.id).map(we=>k.get(we.flow.target)).filter(we=>!!we&&(we.node.lane??`pool:${we.node.participant??""}`)===$),Y=H.filter(we=>{const Pe=Te(we);return Pe!==void 0&&A($,Pe)===j&&(_.get(we.node.id)??0)===1}),ae=H.some(we=>{const Pe=Te(we);return Pe!==void 0&&A($,Pe)>j});if(Y.length!==1||!ae)continue;const _e=new Set(H.flatMap(we=>R(we.node.id)));if(!v.some(we=>we.flow.target===O.node.id&&_e.has(we.flow.source)))continue;const Me=new Map;for(const[we,Pe]of L)Me.set(we,Pe+1);Me.set(-1,0),xe.set($,Me);for(const we of R(Y[0].node.id))k.has(we)&&(ne.set(we,-1),T.add(we));yt.add(O.node.id)}}const w=(_,R)=>{var A;return((A=xe.get(_))==null?void 0:A.get(R))??R},E=(_,R,A,O)=>{const $=_?f(_):R?f(R):void 0;if(!$)return!1;const L=_?$.y+Math.min($.height/2,ye):$.y+oe;return Math.abs(L+w(_??`pool:${R??""}`,A)*I-O)<=I/2},G=new Map;for(const[_,R]of se){let A=0;for(const O of R)A=Math.max(A,w(_,O));G.set(_,A)}const U=_=>Ve+I*_,X=(_,R,A)=>{const O=u().children.filter($=>!("waypoints"in $&&$.waypoints)&&$.id!==R&&typeof $.y=="number"&&$.y>=_);O.length&&n.moveElements(O,{x:0,y:A})},Ce=(_,R,A)=>{const O=_.type==="bpmn:Participant"?_:void 0;if(!O||O.children.some(j=>j.type==="bpmn:Lane"))return;const $=A+R.height/2+He-O.y;if(O.height>=$)return;const L=$-O.height,N=O.y+O.height;n.resizeShape(O,{x:O.x,y:O.y,width:O.width,height:$}),X(N,O.id,L)},Ue=(_,R)=>{const A=R-_.height;if(A<=0)return;const O=d(_)??_,$=[],L=H=>{$.push(H);for(const Y of H.children??[])L(Y)};L(O);const N=_.y+_.height-10,j=l.calculateAdjustments($,"y",A,N);l.makeSpace(j.movingShapes,j.resizingShapes,{x:0,y:A},"s",N)},st=(_,R,A)=>{if(_){const N=p(_),j=U(R);if(N.height>=j)return;const H=j-N.height,Y=d(N),ae=Y?Y.y+Y.height:N.y+N.height;Ue(N,j),X(ae,Y==null?void 0:Y.id,H);return}if(!A)return;const O=I*(R+1);if(A.height>=O)return;const $=O-A.height,L=A.y+A.height;n.resizeShape(A,{x:A.x,y:A.y,width:A.width,height:O}),X(L,A.id,$)},Ot=new Map;for(const _ of v)Ot.set(_.flow.target,(Ot.get(_.flow.target)??0)+1);const pt=_=>(Ot.get(_)??0)<=1,Wt=(_,R,A)=>{if(!_)return!0;const O=f(_);return O?A-R.height/2>=O.y&&A+R.height/2<=O.y+O.height:!0},nn=h.map((_,R)=>({op:_,declared:R}));nn.sort((_,R)=>{const A=_.op.order??Number.POSITIVE_INFINITY,O=R.op.order??Number.POSITIVE_INFINITY;return A!==O?A-O:_.declared-R.declared});let rn=80;for(const _ of o.getAll())_.parent===u()&&"height"in _&&typeof _.y=="number"&&(rn=Math.max(rn,_.y+_.height+60));for(const{op:_}of nn){const R=_.participant,A=y.filter(re=>re.node.participant===R.id).length,O=((Ww=R.lanes)==null?void 0:Ww.length)??0,$=Math.max(1200,A*160+300),L=(R.lanes??[]).map(re=>U(G.get(re.id)??0)),N=L.reduce((re,Me)=>re+Me,0);O&&N<300&&(L[O-1]+=300-N);const j=Math.max(300,I*((G.get(`pool:${R.id}`)??0)+1)),H=R.blackBox||A+O===0?120:O?Math.max(300,N):j,Y=r.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:R.id,name:R.name,..._.order!==void 0?{"bwl:poolOrder":_.order}:{},...R.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:$,height:H,isExpanded:!0}),ae=n.createShape(Y,{x:100+$/2,y:rn+H/2},u()),_e=R.lanes??[];if(_e.length&&n.splitLane(ae,_e.length),_e.length){const re=o.filter(Me=>{var we;return Me.type==="bpmn:Lane"&&((we=d(Me))==null?void 0:we.id)===R.id}).sort((Me,we)=>Me.y-we.y);if(re.forEach((Me,we)=>{const Pe=_e[we];Pe&&n.updateProperties(Me,{id:Pe.id,name:Pe.name})}),L.some(Me=>Me!==ae.height/O)){let Me=ae.y;re.forEach((we,Pe)=>{const lt=L[Pe];n.resizeShape(we,{x:we.x,y:Me,width:we.width,height:lt}),Me+=lt})}}rn=ae.y+ae.height+60}const xt=_=>{var O;const R=k.get(_);if(R)return R.node.participant??"";const A=f(_);return A?A.type==="bpmn:Participant"?A.id:((O=d(A))==null?void 0:O.id)??"":""},Dt=new Map,bn=_=>{let R=Dt.get(_);return R||Dt.set(_,R={nodes:[],flows:[]}),R};for(const _ of y)bn(_.node.participant??"").nodes.push(_);for(const _ of v)bn(xt(_.flow.source)).flows.push(_);const Pr=_=>{var R;return i.create("bpmn:SequenceFlow",{id:_.id,name:_.name??((R=_.condition)==null?void 0:R.label)})},jn=(_,R,A)=>r.createShape({type:Os(_.type),businessObject:i.create(Os(_.type),{id:_.id,name:_.name,...R!==void 0?{"bwl:band":R}:{},...A!==void 0?{"bwl:afterColumn":A}:{}})}),Ti=[...nn.map(({op:_})=>_.participant.id).filter(_=>Dt.has(_)),...[...Dt.keys()].filter(_=>!h.some(R=>R.participant.id===_))],Hn=_=>_.endsWith("Gateway");for(const _ of Ti){const R=Dt.get(_),A=_?p(_):void 0,O=A?A.x+150:250;let $=A?A.y+80:120;const L=(le,Re,ue)=>{if(le){const Ae=p(le);return Ae.y+Math.min(Ae.height/2,ye)+w(le,Re??0)*I}return Re!==void 0&&A?A.y+oe+w(`pool:${_}`,Re)*I:ue},N=(le,Re,ue)=>{if(le){const Ae=p(le);return Ae.y+Math.min(Ae.height/2,ye)+Re*I}return A?A.y+oe+Re*I:ue},j=le=>le.participant?p(le.participant):u(),H=(le,Re,ue,Ae,rt,We,Le)=>{const tt=ue!==void 0||Ae!==void 0,de=w(ue??`pool:${_}`,Ae??0);if((Ae===void 0||E(ue,_,Ae,Le??Number.NaN))&&Le!==void 0&&Wt(ue,Re,Le)&&!K(le,Re,rt,Le))return{x:rt,y:Le};if(tt)for(let ce=0;ce<4;ce++){const he=N(ue,de+ce,We);if(!K(le,Re,rt,he))return st(ue,de+ce,A),{x:rt,y:he}}const fe=L(ue,Ae,We);tt?st(ue,de,A):Ce(le,Re,fe);let Q=rt;for(let ce=0;ce<64;ce++){const he=K(le,Re,Q,fe);if(!he)break;Q=he.x+he.width+z+Re.width/2}return{x:Q,y:fe}},Y=new Set(R.flows.map(le=>le.flow.target)),ae=new Map,_e=le=>{if(le===void 0)return;const Re=o.get(le);if(!(!Re||typeof Re.x!="number"||typeof Re.width!="number"))return Re.x+Re.width+z};for(const le of R.nodes){if(Y.has(le.node.id))continue;const Re=jn(le.node,le.band,le.afterColumn),ue=V(le),Ae=le.node.lane?`${le.node.lane}|${ue??""}`:ue!==void 0?`band:${ue}`:"",rt=j(le.node),We=ae.get(Ae)??O,Le=_e(le.afterColumn),tt=Le===void 0?We:Math.max(We,Le),de=H(rt,Re,le.node.lane,ue,tt,$);n.createShape(Re,de,rt),ae.set(Ae,de.x+Re.width+z),!le.node.lane&&ue===void 0&&($+=160)}const re=new Set,Me=new Map,we=new Map,Pe=new Map;if(_&&Z.has(`pool:${_}`)){const le=new Map;for(const de of R.flows)le.set(de.flow.target,(le.get(de.flow.target)??0)+1);const Re=de=>L(de.node.lane,Te(de),Number.NaN),ue=new Set,Ae=de=>{var ce;const fe=(ce=k.get(de))==null?void 0:ce.node.participant;if(fe)return f(fe);const Q=f(de);if(Q)return Q.type==="bpmn:Participant"?Q:d(Q)},rt=de=>{const fe=[],Q=new Set([de]),ce=[de];for(;ce.length;){const he=ce.shift(),ve=k.get(he);ve&&fe.push(ve);for(const me of R.flows)me.flow.source!==he||Q.has(me.flow.target)||(le.get(me.flow.target)??0)!==1||(Q.add(me.flow.target),ce.push(me.flow.target))}return fe},We=de=>{if(!A)return;const fe=new Set(de.map(he=>he.node.id));let Q=!1,ce=!1;for(const he of g){if(!fe.has(he.flow.source))continue;const ve=Ae(he.flow.target);!ve||ve.id===A.id||(ve.y<A.y?Q=!0:ce=!0)}return Q&&!ce?"up":ce&&!Q?"down":void 0};for(const de of R.nodes){if(!Hn(de.node.type))continue;const fe=L(de.node.lane,V(de),Number.NaN);if(Number.isNaN(fe))continue;const Q=[];for(const me of R.flows){if(me.flow.source!==de.node.id)continue;const pe=k.get(me.flow.target);if(!pe||pe.node.lane!==de.node.lane||(le.get(pe.node.id)??0)!==1)continue;const ke=V(pe);if(ke===void 0)continue;const ut=L(pe.node.lane,ke,Number.NaN);if(Number.isNaN(ut))continue;const _t=rt(pe.node.id),Xe=We(_t);Xe&&Q.push({subtree:_t,band:ke,row:ut,dir:Xe})}if(!Q.some(me=>me.dir==="up")||!Q.some(me=>me.dir==="down")||!Q.some(me=>me.dir==="up"&&Q.some(pe=>pe.dir==="down"&&pe.row<me.row)))continue;const he=[...Q].sort((me,pe)=>me.row-pe.row);[...Q.filter(me=>me.dir==="up"),...Q.filter(me=>me.dir==="down")].sort((me,pe)=>me.dir===pe.dir?me.row-pe.row:me.dir==="up"?-1:1).forEach((me,pe)=>{const ke=he[pe].band;if(ke!==me.band){ue.add(de.node.id);for(const ut of me.subtree)V(ut)===me.band&&ne.set(ut.node.id,ke)}})}const Le=de=>{if(!A)return;const fe=new Set(de.map(he=>he.node.id));let Q=!1,ce=!1;for(const he of g){if(!fe.has(he.flow.target))continue;const ve=Ae(he.flow.source);!ve||ve.id===A.id||(ve.y<A.y?Q=!0:ce=!0)}return Q&&!ce?"up":ce&&!Q?"down":void 0};for(const de of R.nodes){if(!Hn(de.node.type))continue;const fe=de.node.lane??`pool:${_}`,Q=xe.get(fe);if(!Q||Q.size<2)continue;const ce=Q.get(0);if(ce===void 0)continue;const he=Math.max(...Q.values()),ve=ce===he&&ce!==0?"down":void 0;if(!ve)continue;const me=[];for(const Xe of R.flows){if(Xe.flow.source!==de.node.id)continue;const dt=k.get(Xe.flow.target);if(!dt||dt.node.lane!==de.node.lane||(le.get(dt.node.id)??0)!==1)continue;const fn=Te(dt);fn!==void 0&&me.push({t:dt,subtree:rt(dt.node.id),band:fn})}const pe=me.find(Xe=>(Q.get(Xe.band)??Xe.band)===ce);if(!pe||Le(pe.subtree)===ve||We(pe.subtree)===ve)continue;const ke=me.find(Xe=>Xe!==pe&&Le(Xe.subtree)===ve);if(!ke)continue;const ut=pe.band,_t=ke.band;for(const Xe of pe.subtree)Te(Xe)===ut&&ne.set(Xe.node.id,_t);for(const Xe of ke.subtree)Te(Xe)===_t&&ne.set(Xe.node.id,ut);ue.add(de.node.id)}for(const de of R.nodes){if(!Hn(de.node.type))continue;const fe=Re(de);if(Number.isNaN(fe)||C.some(me=>{var pe,ke;return(((pe=me.placement)==null?void 0:pe.anchor)??(me.association?me.association.source===me.annotation.id?me.association.target:me.association.source:void 0))===de.node.id&&((ke=me.placement)==null?void 0:ke.side.startsWith("bottom"))}))continue;let ce,he=!1,ve;for(const me of R.flows){if(me.flow.source!==de.node.id)continue;const pe=k.get(me.flow.target);if(!pe||!pe.node.lane&&V(pe)===void 0)continue;const ke=Re(pe);Number.isNaN(ke)||(Math.abs(ke-fe)<.5&&(he=!0),ke>fe?!ce||ke>ce.row?ce={id:pe.node.id,row:ke,count:1}:ke===ce.row&&ce.count++:ke<fe&&pe.node.lane===de.node.lane&&(!ve||ke>ve.row?ve={op:pe,row:ke,count:1}:ke===ve.row&&ve.count++))}ce&&ce.count===1&&(le.get(ce.id)??0)===1&&!ue.has(de.node.id)&&re.add(ce.id),!he&&ve&&ve.count===1&&(le.get(ve.op.node.id)??0)===1&&!yt.has(de.node.id)&&Me.set(ve.op.node.id,{lane:de.node.lane,band:Te(de)})}const tt=new Map;for(const de of g)tt.set(de.flow.target,[...tt.get(de.flow.target)??[],de]);for(const de of R.nodes){const fe=tt.get(de.node.id);if(!fe||fe.length!==1||!le.get(de.node.id)||!de.node.lane&&V(de)===void 0||T.has(de.node.id))continue;const Q=(Uw=k.get(fe[0].flow.source))==null?void 0:Uw.node.participant,ce=Q?f(Q):void 0;if(!ce||!A||ce.id===A.id)continue;const he=de.node.lane??`pool:${_}`,ve=xe.get(he);if(!ve)continue;const me=ve.get(0)??0,pe=(ve.get(Te(de)??0)??me)-me;if(pe===0)continue;const ke=ce.y<A.y;if(ke&&pe<0||!ke&&pe>0)continue;let ut;for(const[_t,Xe]of ve){const dt=Xe-me;(ke&&dt<0&&(!ut||dt<ut.row)||!ke&&dt>0&&(!ut||dt>ut.row))&&(ut={band:_t,row:dt})}ut&&we.set(de.node.id,{lane:de.node.lane,band:ut.band})}}const lt=new Set;let De=0;for(;De++<R.nodes.length+2;){for(let ue=0;ue<R.nodes.length+R.flows.length+2;ue++){let Ae=!1;for(const rt of R.flows){const We=rt.flow;if(lt.has(We.id))continue;const Le=f(We.source);if(!Le)continue;const tt=f(We.target),de=k.get(We.target);if(!tt&&de){const fe=jn(de.node,de.band),Q=Te(de);if(de.node.lane||Q!==void 0){const ce=j(de.node),he=Le,ve=he.x+(Pe.get(We.source)??0)+he.width+z,me=Me.get(We.target)??we.get(We.target),pe=H(ce,fe,me?me.lane:de.node.lane,me?me.band:Q,re.has(We.target)?he.x+he.width/2:ve,Number.NaN,me||!pt(We.target)?void 0:he.y+he.height/2),ke=n.createShape(fe,pe,ce);re.has(We.target)&&Pe.set(We.target,ve-(ke.x+ke.width/2)),n.connect(Le,ke,{type:"bpmn:SequenceFlow",businessObject:Pr(We)})}else s.append(Le,fe,{connection:{type:"bpmn:SequenceFlow",businessObject:Pr(We)}})}else if(tt)n.connect(Le,tt,{type:"bpmn:SequenceFlow",businessObject:Pr(We)});else continue;lt.add(We.id),Ae=!0}if(!Ae)break}const le=R.nodes.filter(ue=>!f(ue.node.id));if(!le.length)break;const Re=le[0];{const ue=jn(Re.node,Re.band),Ae=j(Re.node),rt=V(Re);n.createShape(ue,H(Ae,ue,Re.node.lane,rt,O,$),Ae),!Re.node.lane&&rt===void 0&&($+=160)}}}const Nt=40,Kn=(_,R=()=>!0)=>{const A=f(_);if(!A)return[];const O=[A],$=new Set([_]);for(let L=0;L<O.length;L++){const N=O[L].id;for(const j of v){const H=j.flow.target;if(j.flow.source!==N||$.has(H)||!k.has(H))continue;$.add(H);const Y=f(H);Y&&R(Y)&&O.push(Y)}}return O},jl=(_,R=()=>!0)=>{const A=f(_);if(!A)return[];const O=[A],$=new Set([_]);for(let L=0;L<O.length;L++){const N=O[L].id;for(const j of v){const H=j.flow.source;if(j.flow.target!==N||$.has(H)||!k.has(H))continue;$.add(H);const Y=f(H);Y&&R(Y)&&O.push(Y)}}return O},Ut=30,Je=_=>!("waypoints"in _&&_.waypoints)&&_.type!=="bpmn:Lane"&&_.type!=="label"&&typeof _.x=="number",ct=(_,R)=>{const A=new Set(_.flatMap(N=>N.subtree.map(j=>j.id)));for(const N of _){const j=(N.pool.children??[]).filter(Je).filter(Y=>!A.has(Y.id));if(N.subtree.some(Y=>j.some(ae=>Y.x+R<ae.x+ae.width+Ut&&Y.x+R+Y.width+Ut>ae.x&&Y.y<ae.y+ae.height&&Y.y+Y.height>ae.y)))return null}const O=_.map(N=>N.pool.width),$=o.filter(N=>N.type==="label").map(N=>({label:N,x:N.x,y:N.y}));n.moveElements(_.flatMap(N=>N.subtree),{x:R,y:0});const L=_.map(N=>{const H=Math.max(...N.subtree.map(Y=>Y.x+Y.width))+150-(N.pool.x+N.pool.width);return H>0&&n.resizeShape(N.pool,{x:N.pool.x,y:N.pool.y,width:N.pool.width+H,height:N.pool.height}),H});return()=>{n.moveElements(_.flatMap(N=>N.subtree),{x:-R,y:0}),_.forEach((N,j)=>{L[j]>0&&n.resizeShape(N.pool,{x:N.pool.x,y:N.pool.y,width:O[j],height:N.pool.height})});for(let N=0;N<3;N++){let j=0;for(const H of $){const Y=H.x-H.label.x,ae=H.y-H.label.y;Math.abs(Y)<=.5&&Math.abs(ae)<=.5||(n.moveElements([H.label],{x:Y,y:ae}),j++)}if(!j)break}}},Ew=_=>{var $,L;const R=new Map,A=new Map;for(const N of o.getAll()){if(N.type!=="bpmn:Participant")continue;const j=N;(j.children??[]).length||(R.set(j.id,j),A.set(j.id,[]))}for(const N of o.getAll()){if(N.type!=="bpmn:MessageFlow")continue;const j=N,H=($=j.source)==null?void 0:$.id,Y=(L=j.target)==null?void 0:L.id;H&&Y&&A.has(H)&&A.get(H).push(Y),H&&Y&&A.has(Y)&&A.get(Y).push(H)}const O=[];for(const[N,j]of A)j.length&&j.every(H=>_.has(H))&&O.push(R.get(N));return O},Sw=(_,R)=>{if(!_.length)return null;const A=new Set(_.map(N=>N.id)),O=o.getAll().filter(N=>N.type==="bpmn:Participant"&&!A.has(N.id));if(_.some(N=>O.some(j=>N.x+R<j.x+j.width+Ut&&N.x+R+N.width+Ut>j.x&&N.y<j.y+j.height&&N.y+N.height>j.y)))return null;const L=o.filter(N=>N.type==="label").map(N=>({label:N,x:N.x,y:N.y}));return n.moveElements(_,{x:R,y:0}),()=>{n.moveElements(_,{x:-R,y:0});for(let N=0;N<3;N++){let j=0;for(const H of L){const Y=H.x-H.label.x,ae=H.y-H.label.y;Math.abs(Y)<=.5&&Math.abs(ae)<=.5||(n.moveElements([H.label],{x:Y,y:ae}),j++)}if(!j)break}}},Rw=()=>{let _=0;for(const R of o.getAll()){if(R.type!=="bpmn:DataInputAssociation"&&R.type!=="bpmn:DataOutputAssociation")continue;const A=R.waypoints??[];for(let O=1;O<A.length;O++)_+=Math.hypot(A[O].x-A[O-1].x,A[O].y-A[O-1].y)}return _},Cw=()=>{let _=0;for(const R of o.getAll()){if(R.type!=="bpmn:Association")continue;const A=R.waypoints??[];for(let O=1;O<A.length;O++)_+=Math.hypot(A[O].x-A[O-1].x,A[O].y-A[O-1].y)}return _},ML=_=>{const R=[];for(const A of o.getAll()){if(A.type!=="bpmn:TextAnnotation")continue;const O=A;if(_.has(O.id))continue;const L=[...O.incoming??[],...O.outgoing??[]].filter(H=>H.type==="bpmn:Association").map(H=>H.source===O?H.target:H.source);if(!L.length||L.some(H=>H===void 0))continue;const N=H=>{if(!("waypoints"in H&&H.waypoints))return[H.id];const Y=H,ae=[Y.source,Y.target];return ae.some(_e=>!_e)?[]:ae.map(_e=>_e.id)},j=L.flatMap(H=>N(H));j.length&&j.every(H=>_.has(H))&&R.push(O)}return R},Aw=()=>At(nt(o)).filter(_=>_.kind==="edge-crosses-shape").length,Pw=_=>{const R=(_.children??[]).filter(Je);let A=0;for(let O=0;O<R.length;O++)for(let $=O+1;$<R.length;$++){const L=R[O],N=R[$];L.x<N.x+N.width&&L.x+L.width>N.x&&L.y<N.y+N.height&&L.y+L.height>N.y&&A++}return A},Qo=()=>{const _=nt(o),R=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:_.edges.filter(A=>A.type==="bpmn:MessageFlow"&&A.waypoints.length===2).length,lines:_.edges.filter(A=>R(A.waypoints)).length}},TL=_=>{const R=new Map;for(const O of o.getAll()){if(O.type!=="bpmn:MessageFlow")continue;const $=O;if(!$.waypoints||$.waypoints.length!==2)continue;const L=$.source,N=$.target;if(!L||!N)continue;const j=_.has(L.id);if(j===_.has(N.id))continue;const H=j?N:L,Y=d(H);if(!Y||_.has(H.id))continue;const ae=R.get(Y.id);ae?H.x<ae.minX&&(ae.minX=H.x):R.set(Y.id,{pool:Y,minX:H.x})}const A=[];for(const{pool:O,minX:$}of R.values()){const L=(O.children??[]).filter(N=>Je(N)&&!_.has(N.id)&&N.x>=$);L.length&&A.push({subtree:L,pool:O})}return A};for(const _ of en(e,"sequenceFlow.update")){if(_.target===void 0)continue;const R=k.get(_.target);if(!R)continue;const A=f(_.target),O=f(_.id);if(!A||!O)continue;const $=_.source!==void 0?f(_.source):O.source,L=O.target;if(!$||!L||L.id===A.id)continue;const N=Kn(_.target),j=new Set(N.map(Le=>Le.id)),H=Math.min(...N.map(Le=>Le.x)),Y=Math.max(...N.map(Le=>Le.x+Le.width)),ae=$.x+$.width,_e=Y-H+Nt*2-(L.x-ae);let re=[];if(_e>0){const Le=d(A),tt=(Le==null?void 0:Le.children)??[],de=he=>he.type==="bpmn:Lane";re=(()=>{const he=new Set;for(const me of tt)Je(me)&&!j.has(me.id)&&me.id!==$.id&&me.x>=L.x&&he.add(me.id);const ve=[];for(const me of tt){if(me.type!=="bpmn:DataStoreReference"&&me.type!=="bpmn:DataObjectReference")continue;const pe=me,ut=[...pe.incoming??[],...pe.outgoing??[]].filter(_t=>_t.type==="bpmn:DataInputAssociation"||_t.type==="bpmn:DataOutputAssociation").map(_t=>_t.source===pe?_t.target:_t.source);ut.length&&ut.every(_t=>_t!==void 0&&he.has(_t.id))&&ve.push(pe)}return ve})();const Q=tt.filter(he=>!("waypoints"in he&&he.waypoints)&&!de(he)&&!j.has(he.id)&&he.id!==$.id&&he.x>=L.x),ce=Le?[Le,...tt.filter(he=>de(he))]:[];if(Q.length){const he=new Set(Q.map(dt=>dt.id)),ve=TL(he),me=new Set(he);for(const dt of ve)for(const fn of dt.subtree)me.add(fn.id);const pe=ML(me),ke=Ew(he),ut=new Set(he);for(const dt of ve)for(const fn of dt.subtree)ut.add(fn.id);const _t=ve.length?Ew(ut):ke;n.createSpace(Q,ce,{x:_e,y:0},"e",L.x-1);let Xe=!1;if(ve.length){const dt=Qo(),fn=ct(ve,_e);if(fn){const Sn=_t.length?Sw(_t,_e):null,to=Qo();to.messages>dt.messages&&to.lines>=dt.lines?Xe=!0:(Sn==null||Sn(),fn())}}if(!Xe){for(const dt of ve){const fn=Qo(),Sn=ct([dt],_e);if(!Sn)continue;const to=Qo();(to.messages<=fn.messages||to.lines<fn.lines)&&Sn()}if(ke.length){const dt=Qo(),fn=Sw(ke,_e);if(fn){const Sn=Qo();(Sn.messages<=dt.messages||Sn.lines<dt.lines)&&fn()}}}if(pe.length){const dt=()=>new Set(At(nt(o)).map(Sn=>Rt(Sn))),fn=Sn=>{const to=Cw(),GL=dt(),VL=Sn.map($t=>({a:$t,x:$t.x,y:$t.y})),WL=o.filter($t=>$t.type==="label").map($t=>({label:$t,x:$t.x,y:$t.y}));n.moveElements(Sn,{x:_e,y:0});const UL=[...dt()].filter($t=>!GL.has($t));if(Cw()<to&&UL.length===0)return!0;for(const{a:$t,x:us,y:ps}of VL)($t.x!==us||$t.y!==ps)&&n.moveElements([$t],{x:us-$t.x,y:ps-$t.y});for(const $t of WL){const us=$t.x-$t.label.x,ps=$t.y-$t.label.y;(us!==0||ps!==0)&&n.moveElements([$t.label],{x:us,y:ps})}return!1};if(!fn(pe)&&pe.length>1)for(const Sn of pe)fn([Sn])}}}const Me=R.node.lane!==void 0?f(R.node.lane):R.node.participant!==void 0?f(R.node.participant):void 0,we=Le=>{if(!Me)return!0;const tt=Le.y+Le.height/2;return tt>=Me.y&&tt<=Me.y+Me.height},Pe=!we($)&&we(L)?L:$,lt=Pe.y+Pe.height/2,De=lt-(A.y+A.height/2),le=R.band!==void 0,Re=le?[A]:N,ue=(R.band===void 0||E(R.node.lane,R.node.participant,R.band,lt))&&pt(_.target)&&Re.every(Le=>{var tt;return Wt((tt=k.get(Le.id))==null?void 0:tt.node.lane,Le,Le.y+Le.height/2+De)}),Ae=Le=>Math.abs(Le.y+Le.height/2-(A.y+A.height/2))<=I/2;if(ue&&le){const Le=Math.abs(De)<=I/2?N.filter(tt=>tt.id!==A.id&&Ae(tt)):[];if(n.moveElements(N,{x:ae+Nt-H,y:0}),n.moveElements([A],{x:0,y:De}),Le.length){const tt=()=>new Set(At(nt(o)).map(ve=>Rt(ve))),de=tt(),fe=o.filter(ve=>ve.type==="label").map(ve=>({label:ve,x:ve.x,y:ve.y}));n.moveElements(Le,{x:0,y:De});const Q=tt(),ce=[...Q].filter(ve=>!de.has(ve)).length,he=[...de].filter(ve=>!Q.has(ve)).length;if(ce>he){n.moveElements(Le,{x:0,y:-De});for(const ve of fe){const me=ve.x-ve.label.x,pe=ve.y-ve.label.y;(me!==0||pe!==0)&&n.moveElements([ve.label],{x:me,y:pe})}}}}else n.moveElements(N,{x:ae+Nt-H,y:ue?De:0});const rt=d(A);if(!ue&&R.node.lane===void 0&&R.band!==void 0&&rt){const Le=rt.y+oe+w(`pool:${R.node.participant??""}`,R.band)*I,tt=Le-(A.y+A.height/2);tt!==0&&!K(rt,A,A.x+A.width/2,Le,j)&&n.moveElements([A],{x:0,y:tt})}const We=re.length?d(re[0]):void 0;if(We){const Le={assoc:Rw(),overlaps:Pw(We),crosses:Aw()},tt=re.map(pe=>({st:pe,x:pe.x})),de=o.filter(pe=>pe.type==="label").map(pe=>({label:pe,x:pe.x,y:pe.y})),fe=Math.min(...re.flatMap(pe=>[...pe.incoming??[],...pe.outgoing??[]].filter(ke=>ke.type==="bpmn:DataInputAssociation"||ke.type==="bpmn:DataOutputAssociation").map(ke=>(ke.source===pe?ke.target:ke.source).x))),Q=new Set(re.map(pe=>pe.id)),ce=(We.children??[]).filter(Je).filter(pe=>!Q.has(pe.id));let he=fe;for(const pe of[...re].sort((ke,ut)=>ke.x-ut.x)){let ke=he;for(let ut=0;ut<100;ut++){const _t=ce.find(Xe=>ke<Xe.x+Xe.width+Ut&&ke+pe.width+Ut>Xe.x&&pe.y<Xe.y+Xe.height&&pe.y+pe.height>Xe.y);if(!_t)break;ke=_t.x+_t.width+Ut}ke!==pe.x&&n.moveElements([pe],{x:ke-pe.x,y:0}),he=ke+pe.width+Ut}const ve=he+150-(We.x+We.width);ve>0&&n.resizeShape(We,{x:We.x,y:We.y,width:We.width+ve,height:We.height});const me={assoc:Rw(),overlaps:Pw(We),crosses:Aw()};if(me.assoc>=Le.assoc||me.overlaps>Le.overlaps||me.crosses>Le.crosses){for(const{st:pe,x:ke}of tt)pe.x!==ke&&n.moveElements([pe],{x:ke-pe.x,y:0});ve>0&&n.resizeShape(We,{x:We.x,y:We.y,width:We.width-ve,height:We.height});for(const pe of de){const ke=pe.x-pe.label.x,ut=pe.y-pe.label.y;(ke!==0||ut!==0)&&n.moveElements([pe.label],{x:ke,y:ut})}}}}const Mw=(_,R)=>{const A=R.target===_,O=p(R.source),$=p(R.target),L=A?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(O,$,R.id?{type:L,businessObject:i.create(L,{id:R.id})}:{type:L})},Tw=100,kw=_=>{for(const R of h){if(!R.participant.blackBox)continue;const A=f(R.participant.id);if(!A)continue;const O=[];for(const L of g){const N=L.flow.source===R.participant.id?L.flow.target:L.flow.target===R.participant.id?L.flow.source:void 0,j=N?f(N):void 0;j&&typeof j.x=="number"&&j.type!=="bpmn:Participant"&&O.push(j)}if(!O.length)continue;if(!_&&R.order===void 0){const L=(()=>{var j;const N=new Map;for(const H of O){const Y=d(H);if(!Y)continue;const ae=N.get(Y.id);ae?ae.n+=1:N.set(Y.id,{shape:Y,n:1})}return(j=[...N.values()].sort((H,Y)=>Y.n-H.n)[0])==null?void 0:j.shape})();if(L){const N=Y=>Y.reduce((ae,_e)=>ae+_e,0)/Y.length,j=N(O.map(Y=>Y.y+Y.height/2))<L.y+L.height/2,H=o.filter(Y=>Y.type==="bpmn:Participant"&&Y.id!==R.participant.id&&Y.id!==L.id).filter(Y=>j?Y.y+Y.height<=L.y+5:Y.y>=L.y+L.height-5);if(H.length){const Y=[...H.reduce((ue,Ae)=>ue.set(Ae.y,(ue.get(Ae.y)??0)+1),new Map)].sort((ue,Ae)=>Ae[1]-ue[1]||(j?Ae[0]-ue[0]:ue[0]-Ae[0]))[0][0],ae=Math.min(A.width,J1),_e=eS,re=O.map(ue=>ue.x+ue.width/2),Me=Math.round(N(re)-ae/2),we=Math.max(...re)+Tw,Pe=ue=>({x:ue,width:Math.max(ae,we-ue)}),lt=H.filter(ue=>Math.min(ue.y+ue.height,Y+_e)-Math.max(ue.y,Y)>0),De=ue=>{const Ae=Pe(ue);return lt.some(rt=>rt.x<Ae.x+Ae.width&&Ae.x<rt.x+rt.width)},le=ue=>{const Ae=Pe(ue);return re.filter(rt=>rt>=Ae.x+10&&rt<=Ae.x+Ae.width-10).length},Re=(()=>{if(!De(Me))return Me;const ue=le(Me);return lt.flatMap(Ae=>[Ae.x+Ae.width+Jh,Ae.x-Jh-ae]).map(Ae=>Math.round(Ae)).filter(Ae=>!De(Ae)&&le(Ae)>=ue).sort((Ae,rt)=>Math.abs(Ae-Me)-Math.abs(rt-Me))[0]??Me})();if(Re!==A.x||Y!==A.y||ae!==A.width||_e!==A.height){const ue=()=>new Set(At(nt(o)).map(de=>Rt(de))),Ae=ue(),rt={x:A.x,y:A.y,width:A.width,height:A.height};n.resizeShape(A,{x:Re,y:Y,width:ae,height:_e});const We=ue(),Le=[...We].filter(de=>!Ae.has(de)).length,tt=[...Ae].filter(de=>!We.has(de)).length;Le>tt&&n.resizeShape(A,rt)}}}}const $=Math.max(...O.map(L=>L.x+L.width/2))+Tw;if($>A.x+A.width&&n.resizeShape(A,{x:A.x,y:A.y,width:$-A.x,height:A.height}),!!_)for(const L of g){const N=f(L.flow.id),j=L.flow.source===R.participant.id?L.flow.target:L.flow.target===R.participant.id?L.flow.source:void 0,H=j?f(j):void 0;if(!N||!H||H.type==="bpmn:Participant")continue;const Y=H.x+H.width/2;if(Y<A.x+10||Y>A.x+A.width-10)continue;const ae=A.y>H.y,_e=ae?H.y+H.height:H.y,re=ae?A.y:A.y+A.height,Me=L.flow.source===R.participant.id?[{x:Y,y:re},{x:Y,y:_e}]:[{x:Y,y:_e},{x:Y,y:re}],we=nt(o),Pe={...we.edges.find(lt=>lt.id===L.flow.id),waypoints:Me};an(Pe,Wn(we)).length||n.updateWaypoints(N,Me)}}};kw(!1);for(const _ of g){const R=_.flow;n.connect(p(R.source),p(R.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:R.id,name:R.name})})}{const A=new Set([...v.map(H=>H.flow.id),...g.map(H=>H.flow.id)].filter(H=>!!H)),O=o.filter(H=>!!H.waypoints),$=(H,Y)=>Math.abs(Y.x-H.x)<2?"L":Math.abs(Y.x-(H.x+H.width))<2?"R":Math.abs(Y.y-H.y)<2?"T":Math.abs(Y.y-(H.y+H.height))<2?"B":void 0,L=new Map,N=(H,Y,ae)=>{if(!H||!Y||typeof H.x!="number")return;const _e=$(H,Y);if(!_e)return;let re=L.get(H.id);re||L.set(H.id,re=new Map),re.set(_e,[...re.get(_e)??[],ae])};for(const H of O){const Y=H.waypoints;!Y||Y.length<2||(N(H.source,Y[0],{id:H.id,dir:"out"}),N(H.target,Y[Y.length-1],{id:H.id,dir:"in"}))}const j=new Set;for(const[H,Y]of L){const ae=f(H);if(!ae||typeof ae.x!="number"||![...Y.values()].some(le=>{const Re=le.filter(ue=>ue.dir==="in");return le.length>=3&&Re.length>=1&&le.some(ue=>ue.dir==="out")&&Re.some(ue=>A.has(ue.id))}))continue;const re=d(ae);if(!re||j.has(re.id)||(re.children??[]).some(le=>le.type==="bpmn:Lane"))continue;const Me=(Yw=Y.get("T"))!=null&&Yw.length?(qw=Y.get("B"))!=null&&qw.length?void 0:"B":"T";if(!Me||(Me==="T"?ae.y-re.y:re.y+re.height-(ae.y+ae.height))>=I)continue;const Pe=(re.children??[]).filter(le=>!("waypoints"in le&&le.waypoints)&&le.type!=="label"&&typeof le.x=="number"),lt=re.y+re.height;n.resizeShape(re,{x:re.x,y:re.y,width:re.width,height:re.height+I});const De=u().children.filter(le=>!("waypoints"in le&&le.waypoints)&&le.id!==re.id&&typeof le.y=="number"&&le.y>=lt);De.length&&n.moveElements(De,{x:0,y:I}),Me==="T"&&Pe.length&&n.moveElements(Pe,{x:0,y:I}),j.add(re.id)}}const wd=20,Ow=4,kL=2,OL=[10,30,80],Jo=()=>{const _=nt(o);return{bad:At(_).filter(R=>R.kind==="edge-crosses-shape"||R.kind==="edge-overlap-opposite"||R.kind==="edge-overlap-mixed").length,crossings:hh(_),straight:_.edges.filter(R=>R.type==="bpmn:MessageFlow"&&R.waypoints.length===2).length}},ea=_=>{const R=nt(o),A=R.edges.find(O=>O.id===_);return A?an(A,Wn(R)).length:0},Hl=_=>ea(_)>0,zl=_=>nt(o).edges.filter(R=>R.type==="bpmn:MessageFlow"&&R.id!==_&&R.waypoints.length===2).length,DL=(_,R,A)=>ct([{subtree:_,pool:R}],A),Dw=(_,R)=>R.bad>_.bad||R.crossings>_.crossings&&R.straight<=_.straight&&R.bad>=_.bad,Gl=(_,R)=>Dw(_,R)||R.straight<_.straight,Vl=(_,R,A=()=>!0,O=Dw)=>{const $=Jo(),L=ct(_,R);if(!L)return!1;const N=Jo();return O($,N)||!A()?(L(),!1):!0},Iw=(_,R,A,O=()=>!0)=>Vl([{subtree:_,pool:R}],A,O),Qr=_=>{var R;return!!((R=k.get(_))!=null&&R.node.participant)},cs=new Map;for(const _ of g){if(!Qr(_.flow.target))continue;const R=cs.get(_.flow.target)??[];R.push(_),cs.set(_.flow.target,R)}const Wl=[...cs.keys()],Ed=new Set(v.map(_=>_.flow.target)),Lw=_=>nn.findIndex(({op:R})=>R.participant.id===_);Wl.sort((_,R)=>{var $,L;const A=Ed.has(_)?1:0,O=Ed.has(R)?1:0;return A!==O?A-O:Lw(($=k.get(_))==null?void 0:$.node.participant)-Lw((L=k.get(R))==null?void 0:L.node.participant)});const Jr=_=>_.x+_.width/2,IL=_=>{const R=new Map;for(const $ of o.getAll()){const L=$;if(!L.waypoints||!L.source||!L.target)continue;(R.get(L.source.id)??R.set(L.source.id,[]).get(L.source.id)).push(L.target.id)}const A=new Set([_]),O=[_];for(let $=0;$<O.length;$++)for(const L of R.get(O[$])??[])A.has(L)||(A.add(L),O.push(L));return A},LL=(_,R)=>{const A=IL(R);let O;for(const $ of o.getAll()){const L=$;if(L.type!=="bpmn:MessageFlow"||!L.source||!L.target||L.target.id!==_||A.has(L.source.id))continue;const N=L.source;if(typeof N.x!="number"||N.type==="bpmn:Participant")continue;const j=Jr(N);(O===void 0||j>O)&&(O=j)}return O},Sd=(_,R)=>{const A=f(_.flow.source);if(A)return A.type==="bpmn:Participant"?LL(A.id,R):Jr(A)},Bw=_=>{let R;for(const A of cs.get(_)??[]){const O=Sd(A,_);O!==void 0&&(!R||O>R.cx)&&(R={op:A,cx:O})}return R==null?void 0:R.op},BL=_=>{const R=Bw(_),A=f(_),O=R?Sd(R,_):void 0;return A&&O!==void 0?O-Jr(A):void 0},NL=_=>{const R=BL(_);return R!==void 0&&Math.abs(R)<wd},Nw=(_,R,A,O,$)=>{var L;for(let N=!0;N;){N=!1;for(const j of g){if(j.flow.id===A)continue;const H=R.has(j.flow.source),Y=R.has(j.flow.target);if(H===Y||O(H?j.flow.source:j.flow.target))continue;const ae=H?j.flow.target:j.flow.source;if($(ae)||!Qr(ae))continue;const _e=f(j.flow.id);if(!(_e!=null&&_e.waypoints)||_e.waypoints.length!==2)continue;const re=f(ae),Me=(L=k.get(ae))==null?void 0:L.node.participant;if(!re||!Me)continue;const we=Kn(ae,Pe=>Pe.x>=re.x).filter(Pe=>!R.has(Pe.id));if(!(!we.length||we.some(Pe=>$(Pe.id)))){for(const Pe of we)R.add(Pe.id);_.set(Me,[..._.get(Me)??[],...we]),N=!0}}}return[..._].map(([N,j])=>({subtree:j,pool:p(N)}))},$w=(_,R,A,O,$)=>Nw(new Map([[R,[..._]]]),new Set(_.map(L=>L.id)),O,L=>L===A,L=>L===$),Rd=_=>{const R=Bw(_);if(!R)return null;const A=f(_),O=f(R.flow.source),$=Sd(R,_);if(!A||!O||$===void 0)return null;const L=$-Jr(A);if(L>=wd){const N=k.get(_).node.participant,j=Kn(_,H=>H.x>=A.x);return{groups:$w(j,N,_,R.flow.id,R.flow.source),dx:L}}if(-L>=wd&&Qr(R.flow.source)){const N=k.get(R.flow.source).node.participant,j=Kn(R.flow.source,H=>H.x>=O.x&&!NL(H.id));return{groups:$w(j,N,R.flow.source,R.flow.id,_),dx:-L}}return null},Fw=()=>Wl.map(_=>({id:_,plan:Rd(_)})).filter(_=>!!_.plan).sort((_,R)=>Math.min(..._.plan.groups.flatMap(A=>A.subtree.map(O=>O.x)))-Math.min(...R.plan.groups.flatMap(A=>A.subtree.map(O=>O.x)))).map(_=>_.id);for(let _=0;_<3;_++){const R=Jo(),A=[];for(const $ of Fw()){const L=Rd($);if(!L)continue;const N=ct(L.groups,L.dx);N&&A.push(N)}if(!A.length)break;if(!Gl(R,Jo()))continue;for(const $ of A.reverse())$();let O=!1;for(const $ of Fw()){const L=Rd($);L&&Vl(L.groups,L.dx,()=>!0,Gl)&&(O=!0)}if(!O)break}for(const _ of Wl){if(Ed.has(_))continue;const R=k.get(_);if(!R||R.node.lane!==void 0)continue;const A=V(R);if(A===void 0)continue;const O=f(_),$=O?d(O):void 0;if(!O||!$)continue;const L=$.y+oe+w(`pool:${R.node.participant??""}`,A)*I,N=L-(O.y+O.height/2);N!==0&&!K($,O,O.x+O.width/2,L)&&n.moveElements([O],{x:0,y:N})}for(const _ of Wl.flatMap(R=>cs.get(R)??[])){if(!Hl(_.flow.id))continue;const R=f(_.flow.target);if(!R)continue;const A=p(k.get(_.flow.target).node.participant),O=Kn(_.flow.target,j=>j.x>=R.x),$=R.width+z,L=ea(_.flow.id),N=zl(_.flow.id);for(let j=1;j<=Ow;j++){const H=()=>ea(_.flow.id)<L&&zl(_.flow.id)>=N;if(Iw(O,A,$*j,H))break}}for(const _ of g){if(!Hl(_.flow.id))continue;const R=f(_.flow.source),A=f(_.flow.target);if(!R||!A||R.type==="bpmn:Participant"||A.type==="bpmn:Participant")continue;const O=R.x+R.width/2;if(Math.abs(O-(A.x+A.width/2))>15)continue;const[$,L]=R.y<A.y?[R.y+R.height,A.y]:[A.y+A.height,R.y],N=[...k.values()].map(j=>f(j.node.id)).filter(j=>!!j&&j.id!==R.id&&j.id!==A.id).filter(j=>j.x<=O&&O<=j.x+j.width&&j.y+j.height>$&&j.y<L).sort((j,H)=>j.x-H.x);for(const j of N){const H=(Kw=k.get(j.id))==null?void 0:Kw.node.participant,Y=H?f(H):void 0;if(!Y)continue;const ae=[...k.values()].filter(Re=>Re.node.participant===H).map(Re=>Re.node.id),_e=Re=>Re.map(ue=>f(ue)).filter(ue=>!!ue),Me=[jl(j.id,Re=>{var ue;return((ue=k.get(Re.id))==null?void 0:ue.node.participant)===H}),_e(ae)].filter(Re=>Re.length),we=j.width+z,Pe=ea(_.flow.id),lt=zl(_.flow.id),De=()=>ea(_.flow.id)<Pe&&zl(_.flow.id)>=lt;let le=!1;for(const Re of Me){for(let ue=1;ue<=Ow;ue++)if(Iw(Re,Y,we*ue,De)){le=!0;break}if(le)break}if(!Hl(_.flow.id))break}}for(const _ of g){if(!Hl(_.flow.id))continue;const R=f(_.flow.id);if(((Xw=R==null?void 0:R.waypoints)==null?void 0:Xw.length)!==2)continue;const A=f(_.flow.source),O=f(_.flow.target);if(!A||!O||A.type==="bpmn:Participant"||O.type==="bpmn:Participant"||!Qr(_.flow.source)||!Qr(_.flow.target)||Math.abs(Jr(A)-Jr(O))>kL)continue;const $=Jr(A),L=R.waypoints.map(Pe=>Pe.y),[N,j]=[Math.min(...L),Math.max(...L)],H=Wn(nt(o)).filter(Pe=>Pe.id!==A.id&&Pe.id!==O.id&&Pe.x<$&&$<Pe.x+Pe.width&&N<Pe.y+Pe.height&&Pe.y<j);if(!H.length)continue;const Y=(Zw=k.get(_.flow.source))==null?void 0:Zw.node.participant,ae=(Qw=k.get(_.flow.target))==null?void 0:Qw.node.participant;if(!Y||!ae)continue;const _e=new Map;for(const[Pe,lt,De]of[[_.flow.source,A,Y],[_.flow.target,O,ae]]){const le=_e.get(De)??[],Re=Kn(Pe,ue=>ue.x>=lt.x).filter(ue=>!le.some(Ae=>Ae.id===ue.id));_e.set(De,[...le,...Re])}const re=new Set([..._e.values()].flat().map(Pe=>Pe.id)),Me=Nw(_e,re,_.flow.id,Pe=>Pe===_.flow.source||Pe===_.flow.target,()=>!1),we=Math.max(...H.map(Pe=>Pe.x+Pe.width));for(const Pe of OL){const lt=we+Pe-$;if(lt<=0)continue;if(Vl(Me,lt,()=>{var le,Re;return ea(_.flow.id)===0&&((Re=(le=f(_.flow.id))==null?void 0:le.waypoints)==null?void 0:Re.length)===2},Gl))break}}{const _=A=>A.y+A.height/2,R=[];for(const A of k.keys()){if(!Qr(A))continue;const O=v.filter(N=>N.flow.target===A);if(O.length!==1)continue;const $=f(O[0].flow.source),L=f(A);!$||!L||!k.has($.id)||Math.abs(_($)-_(L))>1||L.x-($.x+$.width)<=z+1||R.push({id:A,pred:$,node:L})}R.sort((A,O)=>A.node.x-O.node.x);for(const{id:A}of R){const O=k.get(A),$=f(A),L=f(v.find(re=>re.flow.target===A).flow.source);if(!$||!L)continue;const N=$.x-(L.x+L.width);if(N<=z+1)continue;const j=p(O.node.participant),H=Kn(A,re=>re.x>=$.x),Y=Jo(),ae=DL(H,j,-(N-z));if(!ae)continue;const _e=Jo();(_e.bad>Y.bad||_e.crossings>=Y.crossings||_e.straight<Y.straight)&&ae()}}kw(!0);for(const _ of b){const R=_.associations??[],A=R.map(L=>L.source===_.dataStore.id?L.target:L.source).map(f).find(Boolean),O=A?d(A)??u():u(),$=A?{x:A.x+A.width/2,y:A.y+A.height+110}:{x:200,y:rn+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:_.dataStore.id,name:_.dataStore.name})},$,O);for(const L of R)Mw(_.dataStore.id,L)}for(const _ of x){const A=p(_.association.target).type==="bpmn:DataStoreReference"?_.association.target:_.association.source;Mw(A,_.association)}let jw=0;const eo=10,Hw=40,$L=(_,R)=>{const A=R.map(H=>d(H)).filter(H=>!!H);for(const H of A){const Y=eo,ae=H.y,_e=H.y+H.height,re=H.x,Me=H.x+H.width;if(Math.abs(_.y-ae)<Y){const we=ae+Y-_.y;_.y+=we,_.height-=we}if(Math.abs(_.y+_.height-_e)<Y&&(_.height=_e-Y-_.y),Math.abs(_.x-re)<Y){const we=re+Y-_.x;_.x+=we,_.width-=we}Math.abs(_.x+_.width-Me)<Y&&(_.width=Me-Y-_.x)}if(!A.length)return;const O=Math.min(...A.map(H=>H.y)),$=Math.max(...A.map(H=>H.y+H.height)),L=O-_.y,N=_.y+_.height-$,j=Hw-eo;if(L>0!=N>0)if(L>0&&L<j){const H=L+eo;_.y+=H,_.height-=H}else N>0&&N<j&&(_.height-=N+eo)},FL=(_,R)=>{const A=eo,O=30,$=o.filter(L=>L.type==="bpmn:Group"&&L.id!==R);for(const L of $){const N=L.x,j=L.x+L.width,H=L.y,Y=L.y+L.height,ae=_.y<Y&&H<_.y+_.height,_e=_.x<j&&N<_.x+_.width;if(ae){if(Math.abs(_.x-j)<A){const re=Math.min(j+A-_.x,O);re>0&&_.width-re>0&&(_.x+=re,_.width-=re)}if(Math.abs(_.x+_.width-N)<A){const re=Math.min(_.x+_.width-(N-A),O);re>0&&_.width-re>0&&(_.width-=re)}}if(_e){if(Math.abs(_.y-Y)<A){const re=Math.min(Y+A-_.y,O);re>0&&_.height-re>0&&(_.y+=re,_.height-=re)}if(Math.abs(_.y+_.height-H)<A){const re=Math.min(_.y+_.height-(H-A),O);re>0&&_.height-re>0&&(_.height-=re)}}}},Cd=(_,R)=>{const A=Hw,O=Math.min(..._.map(H=>H.x))-A,$=Math.min(..._.map(H=>H.y))-A,L=Math.max(..._.map(H=>H.x+H.width))+A,N=Math.max(..._.map(H=>H.y+H.height))+A,j={x:O,y:$,width:L-O,height:N-$};return $L(j,_),FL(j,R),j};for(const _ of M){const R=(_.group.members??[]).map(f).filter($=>!!$);let A;R.length?A=Cd(R,_.group.id):(A={x:300+jw*350,y:40,width:300,height:200},jw++);const O=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:_.group.id}),width:A.width,height:A.height},{x:A.x+A.width/2,y:A.y+A.height/2},u());_.group.name&&n.updateLabel(O,_.group.name),(Jw=_.group.members)!=null&&Jw.length&&P(O,"bwl:Members",{refs:_.group.members.join(" ")})}{const _=o.filter($=>!!$.waypoints),R=new Map,A=($,L)=>{!$||!L||(R.has($)||R.set($,new Set),R.get($).add(L))};for(const $ of _){const L=(e0=$.source)==null?void 0:e0.id,N=(t0=$.target)==null?void 0:t0.id;A(L,N),((n0=$.type)!=null&&n0.includes("DataOutputAssociation")||(i0=$.type)!=null&&i0.includes("DataInputAssociation")||$.type==="bpmn:Association")&&A(N,L)}const O=o.filter($=>$.type==="bpmn:Group");for(const $ of O){const N=(((r0=$.businessObject.extensionElements)==null?void 0:r0.values)??[]).find(De=>De.$type==="bwl:Members"),j=((N==null?void 0:N.refs)??"").split(" ").filter(Boolean);if(!j.length)continue;const H=new Set(j),Y=[...j];for(;Y.length;){const De=Y.shift();for(const le of R.get(De)??[])H.has(le)||(H.add(le),Y.push(le))}const ae=$.x,_e=$.x+$.width,re=$.y,Me=$.y+$.height,we=De=>v.filter(le=>le.flow.target===De).length,Pe=De=>{var Re;const le=((Re=f(De))==null?void 0:Re.type)??"";if(le==="bpmn:StartEvent"&&we(De)===0)return!1;if(le.endsWith("Gateway")){const ue=v.filter(Ae=>Ae.flow.target===De).map(Ae=>Ae.flow.source);if(ue.length&&ue.every(Ae=>{var rt;return((rt=f(Ae))==null?void 0:rt.type)==="bpmn:StartEvent"&&we(Ae)===0}))return!1}return!0},lt=o.filter(De=>Je(De)).filter(De=>De.type!=="bpmn:Group"&&De.type!=="bpmn:Participant"&&De.type!=="bpmn:TextAnnotation"&&!H.has(De.id)&&Qr(De.id)&&Pe(De.id)&&De.x<_e&&De.x+De.width>ae&&De.y<Me&&De.y+De.height>re);if(lt.length)for(const De of[-1,1]){const le=lt.filter(fe=>(fe.x+fe.width-ae<=_e-fe.x?-1:1)===De);if(!le.length)continue;const Re=[];for(const fe of le){const Q=Re.find(ce=>ce.some(he=>fe.y<he.y+he.height&&fe.y+fe.height>he.y));Q?Q.push(fe):Re.push([fe])}const ue=new Map;for(const fe of Re){let Q=De<0?ae-eo:_e+eo;for(const ce of[...fe].sort((he,ve)=>De<0?ve.x-he.x:he.x-ve.x)){const he=De<0?Math.min(ce.x,Q-ce.width):Math.max(ce.x,Q);Q=De<0?he-Ut:he+ce.width+Ut,he!==ce.x&&Math.sign(he-ce.x)===De&&ue.set(ce.id,he-ce.x)}}const Ae=new Map,rt=fe=>Ae.get(fe)===fe||!Ae.get(fe)?fe:rt(Ae.get(fe));for(const fe of le)Ae.set(fe.id,fe.id);for(const fe of g){const Q=ue.has(fe.flow.source)?fe.flow.source:void 0,ce=ue.has(fe.flow.target)?fe.flow.target:void 0;if(!Q||!ce)continue;const he=f(fe.flow.id);((o0=he==null?void 0:he.waypoints)==null?void 0:o0.length)===2&&Ae.set(rt(Q),rt(ce))}const We=new Map;for(const fe of le){if(!ue.has(fe.id))continue;const Q=rt(fe.id);We.set(Q,[...We.get(Q)??[],fe])}const Le=[...We.values()].sort((fe,Q)=>De<0?Math.min(...fe.map(ce=>ce.x))-Math.min(...Q.map(ce=>ce.x)):Math.max(...Q.map(ce=>ce.x))-Math.max(...fe.map(ce=>ce.x))),tt=[];let de=!0;for(const fe of Le){const Q=fe.map(ve=>ue.get(ve.id)??0).reduce((ve,me)=>Math.abs(me)>Math.abs(ve)?me:ve,0),ce=new Map;let he=!0;for(const ve of fe){const me=d(ve);if(!me){he=!1;break}ce.has(me.id)||ce.set(me.id,{subtree:[],pool:me}),ce.get(me.id).subtree.push(ve)}he&&Vl([...ce.values()],Q,()=>!0,Gl)?tt.push({shapes:fe,dx:Q}):de=!1}if(!de)for(const fe of tt.reverse())n.moveElements(fe.shapes,{x:-fe.dx,y:0})}}}{const _=new Set([...M.map(R=>R.group.id),...en(e,"group.update").map(R=>R.id)]);for(const R of o.filter(A=>A.type==="bpmn:Group")){if(_.has(R.id))continue;const O=(((a0=R.businessObject.extensionElements)==null?void 0:a0.values)??[]).find(j=>j.$type==="bwl:Members"),$=((O==null?void 0:O.refs)??"").split(" ").filter(Boolean).map(f).filter(j=>!!j);!$.length||!$.some(j=>{const H=m.get(j.id);return!H||H.x!==j.x||H.y!==j.y})||!$.some(j=>j.x<R.x||j.y<R.y||j.x+j.width>R.x+R.width||j.y+j.height>R.y+R.height)||n.resizeShape(R,Cd($,R.id))}}{const R=new Map(mo(nt(o)).map(j=>[j.owner,j.rect])),A=o.filter(j=>!!j.waypoints),O=new Map,$=(j,H)=>{!j||!H||(O.has(j)||O.set(j,new Set),O.get(j).add(H))};for(const j of A){const H=(s0=j.source)==null?void 0:s0.id,Y=(c0=j.target)==null?void 0:c0.id;$(H,Y),((l0=j.type)!=null&&l0.includes("DataOutputAssociation")||(u0=j.type)!=null&&u0.includes("DataInputAssociation")||j.type==="bpmn:Association")&&$(Y,H)}const L=j=>v.filter(H=>H.flow.target===j).length,N=j=>{var Y;const H=((Y=f(j))==null?void 0:Y.type)??"";if(H==="bpmn:StartEvent"&&L(j)===0)return!1;if(H.endsWith("Gateway")){const ae=v.filter(_e=>_e.flow.target===j).map(_e=>_e.flow.source);if(ae.length&&ae.every(_e=>{var re;return((re=f(_e))==null?void 0:re.type)==="bpmn:StartEvent"&&L(_e)===0}))return!1}return!0};for(const j of o.filter(H=>H.type==="bpmn:Group")){const Y=(((p0=j.businessObject.extensionElements)==null?void 0:p0.values)??[]).find(Q=>Q.$type==="bwl:Members"),ae=((Y==null?void 0:Y.refs)??"").split(" ").filter(Boolean);if(!ae.length)continue;const _e=ae.map(f).filter(Q=>!!Q);if(!_e.length||!(M.some(Q=>Q.group.id===j.id)||en(e,"group.update").some(Q=>Q.id===j.id)||_e.some(Q=>{const ce=m.get(Q.id);return!ce||ce.x!==Q.x||ce.y!==Q.y})))continue;const Me=new Set(ae),we=[...ae];for(;we.length;){const Q=we.shift();for(const ce of O.get(Q)??[])Me.has(ce)||(Me.add(ce),we.push(ce))}const Pe=j.x,lt=j.x+j.width,De=j.y,le=j.y+j.height,Re=Q=>{const ce=R.get(Q.id),he={x:Q.x,y:Q.y,width:Q.width,height:Q.height};return ce?[he,{x:ce.x,y:ce.y,width:ce.width,height:ce.height}]:[he]},ue=_e.flatMap(Re),Ae=Math.min(...ue.map(Q=>Q.x)),rt=Math.max(...ue.map(Q=>Q.x+Q.width)),We=Math.min(...ue.map(Q=>Q.y)),Le=Math.max(...ue.map(Q=>Q.y+Q.height)),tt={L:Ae-Pe,R:lt-rt,T:We-De,B:le-Le},de=o.filter(Q=>Je(Q)).filter(Q=>Q.type!=="bpmn:Group"&&Q.type!=="bpmn:Participant"&&Q.type!=="bpmn:TextAnnotation"&&!Me.has(Q.id)&&N(Q.id)&&Q.x<lt&&Q.x+Q.width>Pe&&Q.y<le&&Q.y+Q.height>De);if(!de.length)continue;const fe={L:0,R:0,T:0,B:0};for(const Q of de){const ce=Re(Q),he=Math.min(...ce.map(Xe=>Xe.x)),ve=Math.max(...ce.map(Xe=>Xe.x+Xe.width)),me=Math.min(...ce.map(Xe=>Xe.y)),pe=Math.max(...ce.map(Xe=>Xe.y+Xe.height)),ke={L:ve-Pe,R:lt-he,T:pe-De,B:le-me},ut=["L","R","T","B"].filter(Xe=>ke[Xe]<=tt[Xe]+.001);if(!ut.length)continue;const _t=ut.reduce((Xe,dt)=>ke[dt]<ke[Xe]?dt:Xe,ut[0]);fe[_t]=Math.max(fe[_t],Math.min(ke[_t]+10,tt[_t]))}!fe.L&&!fe.R&&!fe.T&&!fe.B||n.resizeShape(j,{x:j.x+fe.L,y:j.y+fe.T,width:j.width-fe.L-fe.R,height:j.height-fe.T-fe.B})}}const zw=_=>{const R=_.waypoints;if(R!=null&&R.length){const O=R[Math.floor((R.length-1)/2)];return{x:O.x,y:O.y,width:0,height:0}}const A=_;return{x:A.x,y:A.y,width:A.width,height:A.height}};let ls=0;const Gw=12,Vw=14,jL=15,HL=300,zL=_=>{const R=_.split(`
|
|
7
|
-
`),A=Math.max(...R.map(L=>po(L,Gw))),O=Math.max(100,Math.min(HL,Math.ceil(A)+Vw)),$=R.reduce((L,N)=>L+Math.max(1,Math.ceil((po(N,Gw)+Vw)/O)),0);return{width:O,height:Math.max(30,$*jL+10)}};for(const _ of C){const R=_.association,A=((f0=_.placement)==null?void 0:f0.anchor)??(R?R.source===_.annotation.id?R.target:R.source:void 0),O=A?f(A):void 0,$=O?zw(O):void 0,L=zL(_.annotation.text??"");let N;if($&&_.placement){const[ae,_e]=Ds[_.placement.side],re=_.placement.offset??50;N={x:$.x+$.width/2+ae*($.width/2+L.width/2+re),y:$.y+$.height/2+_e*($.height/2+L.height/2+re)}}else $?(N={x:$.x+$.width/2+180+ls%3*260,y:$.y-110-ls%2*95},ls++):(N={x:300+ls*260,y:60},ls++);const j=O?d(O)??u():u(),H=j;$&&typeof H.x=="number"&&typeof H.width=="number"&&H.type==="bpmn:Participant"&&(N=Su(o,$,L,H,_.placement?{placement:_.placement}:{from:N}));const Y=n.createShape({type:"bpmn:TextAnnotation",width:L.width,height:L.height,businessObject:i.create("bpmn:TextAnnotation",{id:_.annotation.id,text:_.annotation.text})},N,j);if(R){const ae=_e=>_e===_.annotation.id?Y:p(_e);n.connect(ae(R.source),ae(R.target),R.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:R.id})}:{type:"bpmn:Association"})}_.placement&&P(Y,"bwl:Placement",B(_.placement))}for(const _ of en(e,"association.add")){const R=_.association;n.connect(p(R.source),p(R.target),R.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:R.id})}:{type:"bpmn:Association"})}for(const _ of en(e,"node.update")){let R=p(_.id);if(_.type&&Os(_.type)!==R.type&&(R=c.replaceElement(R,{type:Os(_.type)})),_.name!==void 0&&n.updateProperties(R,{name:_.name??void 0}),_.lane||_.band!==void 0){_.band!==void 0&&n.updateProperties(R,{"bwl:band":_.band});const A=R.y+R.height/2,O=d(R),$=_.lane?p(_.lane):((O==null?void 0:O.children)??[]).find(N=>N.type==="bpmn:Lane"&&A>=N.y&&A<=N.y+N.height);_.band!==void 0&&st($==null?void 0:$.id,_.band,O);const L=$?$.y+(_.band===void 0?$.height/2:Math.min($.height/2,ye)+w($.id,_.band)*I):_.band!==void 0&&O?O.y+oe+w(`pool:${O.id}`,_.band)*I:void 0;if(L!==void 0){const N=L-A;N!==0&&n.moveElements([R],{x:0,y:N})}}}for(const _ of en(e,"sequenceFlow.update")){const R=p(_.id);if(_.source!==void 0||_.target!==void 0){const A=R,O=_.source!==void 0?p(_.source):A.source,$=_.target!==void 0?p(_.target):A.target,L=N=>({x:N.x+N.width/2,y:N.y+N.height/2});n.reconnect(A,O,$,[L(O),L($)])}_.name!==void 0&&n.updateProperties(R,{name:_.name??void 0}),_.condition!==void 0&&n.updateProperties(R,{name:((d0=_.condition)==null?void 0:d0.label)??void 0})}for(const _ of en(e,"messageFlow.update"))_.name!==void 0&&n.updateProperties(p(_.id),{name:_.name??void 0});for(const _ of en(e,"dataStore.update"))_.name!==void 0&&n.updateProperties(p(_.id),{name:_.name??void 0});for(const _ of en(e,"annotation.update")){const R=p(_.id);if(_.text!==void 0&&n.updateProperties(R,{text:_.text}),_.placement===null)P(R,"bwl:Placement",null);else if(_.placement){const A=p(_.placement.anchor),O=zw(A),$=d(A)??u(),L=typeof $.x=="number"&&typeof $.width=="number"&&$.type==="bpmn:Participant",[N,j]=Ds[_.placement.side],H=_.placement.offset??50,Y={x:O.x+O.width/2+N*(O.width/2+R.width/2+H),y:O.y+O.height/2+j*(O.height/2+R.height/2+H)},ae=L?Su(o,O,{width:R.width,height:R.height},$,{placement:_.placement,selfId:_.id}):Y;n.moveElements([R],{x:ae.x-(R.x+R.width/2),y:ae.y-(R.y+R.height/2)}),P(R,"bwl:Placement",B(_.placement))}}for(const _ of en(e,"group.update")){const R=p(_.id);if(_.name!==void 0&&n.updateLabel(R,_.name??""),_.members){const A=_.members.map(f).filter(O=>!!O);A.length&&n.resizeShape(R,Cd(A,_.id)),P(R,"bwl:Members",{refs:_.members.join(" ")})}}}function Ru(e){switch(e.kind){case"annotation-over-label":return[e.annotation];case"edge-crosses-shape":return[e.shape];case"shape-outside-container":return[e.shape];case"shape-overlap":return e.shapes;default:return[]}}function nS(e,t,n){var u,f;const{elementRegistry:i}=e,r=e.modeling,o=p=>At(p).filter(d=>!t.has(Rt(d))),a=p=>{var d;return((d=i.get(p))==null?void 0:d.type)==="bpmn:TextAnnotation"},s=nt(i),c=o(s),l=[...new Set(c.flatMap(Ru))].filter(p=>n.has(p)&&a(p));if(l.length)for(const p of l){const d=i.get(p);if(!d||typeof d.x!="number"||typeof d.width!="number")continue;let m=d.parent,h;for(;m;){if(m.type==="bpmn:Participant"){h=m;break}m=m.parent}if(!h){const ye=d.x+d.width/2,Ve=d.y+d.height/2;h=i.getAll().find(He=>{if(He.type!=="bpmn:Participant")return!1;const it=He;return typeof it.x=="number"&&typeof it.width=="number"&&ye>=it.x&&ye<=it.x+it.width&&Ve>=it.y&&Ve<=it.y+it.height})}if(!h||typeof h.x!="number"||typeof h.width!="number")continue;const v=(((u=d.businessObject.extensionElements)==null?void 0:u.values)??[]).find(ye=>ye.$type==="bwl:Placement"),g=[...d.incoming??[],...d.outgoing??[]].find(ye=>ye.type==="bpmn:Association"),b=(v!=null&&v.anchor?i.get(v.anchor):void 0)??(g?((f=g.source)==null?void 0:f.id)===p?g.target:g.source:void 0);if(!b)continue;const x=b.waypoints,C=x!=null&&x.length?{x:x[Math.floor((x.length-1)/2)].x,y:x[Math.floor((x.length-1)/2)].y,width:0,height:0}:{x:b.x,y:b.y,width:b.width,height:b.height},M={width:d.width,height:d.height},k={x:d.x+d.width/2,y:d.y+d.height/2},P=v==null?void 0:v.side,B=[];P&&P in Ds&&B.push(Su(i,C,M,h,{placement:{side:P,offset:(v==null?void 0:v.offset)??null},selfId:p}));for(const[ye,Ve]of[[-1,0],[1,0],[0,-1],[0,1]])for(let He=1;He<=tS;He++)B.push({x:k.x+ye*em*He,y:k.y+Ve*em*He});const D={...s,edges:s.edges.filter(ye=>ye.id!==(g==null?void 0:g.id))},I=o(D),z=I.filter(ye=>Ru(ye).includes(p)).length;if(!z)continue;let oe;for(const ye of B){const Ve=ye.x-k.x,He=ye.y-k.y;if(!Ve&&!He||ye.x-M.width/2<h.x||ye.x+M.width/2>h.x+h.width||ye.y-M.height/2<h.y||ye.y+M.height/2>h.y+h.height)continue;const it={...D,shapes:D.shapes.map(xe=>xe.id===p?{...xe,x:xe.x+Ve,y:xe.y+He}:xe)},K=o(it),Z=K.filter(xe=>Ru(xe).includes(p)).length;if(Z>=z||K.length>I.length)continue;const se=Math.abs(Ve)+Math.abs(He);if((!oe||Z<oe.mine||Z===oe.mine&&(K.length<oe.all||K.length===oe.all&&se<oe.dist))&&(oe={x:ye.x,y:ye.y,mine:Z,all:K.length,dist:se}),oe.mine===0&&oe.all<I.length)break}oe&&r.moveElements([d],{x:oe.x-k.x,y:oe.y-k.y})}}const iS=60;function rS(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=u=>At(u).filter(f=>!t.has(Rt(f))),a=u=>u.filter(f=>f.kind==="pool-overlap"),s=new Map(n.shapes.map(u=>[u.id,u])),c=(u,f)=>f.x>=u.x&&f.y>=u.y&&f.x+f.width<=u.x+u.width&&f.y+f.height<=u.y+u.height,l=u=>{if(!s.get(u))return[u];const p=new Set,d=new Set([u]);for(let h=0;h<4;h++){let y=!1;for(const v of n.shapes)v.type!=="bpmn:Group"||p.has(v.id)||[...d].some(g=>{const b=s.get(g);return b&&c(v,b)})&&(p.add(v.id),y=!0);for(const v of n.shapes)v.type!=="bpmn:Participant"||d.has(v.id)||[...p].some(g=>{const b=s.get(g);return b&&c(b,v)})&&(d.add(v.id),y=!0);if(!y)break}const m=n.shapes.filter(h=>!h.parent&&!d.has(h.id)&&!p.has(h.id)&&h.type!=="bpmn:Group"&&h.type!=="bpmn:Participant").filter(h=>[...p].some(y=>{const v=s.get(y);return v&&c(v,h)})).map(h=>h.id);return[...d,...p,...m]};for(let u=0;u<6;u++){const f=nt(i),p=o(f),d=a(p);if(!d.length)return;const m=new Map(f.shapes.map(x=>[x.id,x]));let h=null;for(const x of d){if(x.kind!=="pool-overlap")continue;const[C,M]=x.pools,k=m.get(C),P=m.get(M);if(!k||!P)continue;const[B,D]=k.x<=P.x?[k,P]:[P,k];if(x.contained)continue;const I=s.get(B.id),z=s.get(D.id),oe=I&&z?Math.max(z.x-(I.x+I.width),0):iS,ye=B.x+B.width+oe-D.x;if(ye<=0)continue;const Ve=l(D.id).filter(He=>i.get(He));Ve.length&&(!h||ye>h.dx)&&(h={movers:Ve,dx:ye})}if(!h)return;const y=h.movers.map(x=>i.get(x)).filter(x=>!!x&&typeof x.x=="number");if(!y.length)return;const v=p.length,g=d.length;r.moveElements(y,{x:h.dx,y:0});const b=o(nt(i));if(!(a(b).length<g&&b.length<=v)){r.moveElements(y,{x:-h.dx,y:0});return}}}function oS(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=l=>At(l).filter(u=>!t.has(Rt(u))),a=(l,u)=>u.x>=l.x&&u.y>=l.y&&u.x+u.width<=l.x+l.width&&u.y+u.height<=l.y+l.height,s=l=>({l:Math.min(...l.map(u=>u.x)),t:Math.min(...l.map(u=>u.y)),r:Math.max(...l.map(u=>u.x+u.width)),b:Math.max(...l.map(u=>u.y+u.height))}),c=n.shapes.filter(l=>{var u;return l.type==="bpmn:Group"&&!((u=l.members)!=null&&u.length)});if(c.length)for(const l of c){const u=i.get(l.id);if(!u||typeof u.x!="number")continue;const f=n.shapes.filter(M=>M.id!==l.id&&M.type!=="bpmn:Group"&&a(l,M));if(!f.length)continue;const p=f.map(M=>i.get(M.id)).filter(M=>!!M&&typeof M.x=="number");if(p.length!==f.length)continue;const d=s(f),m=s(p),h=m.l+(l.x-d.l),y=m.t+(l.y-d.t),v=m.r+(l.x+l.width-d.r),g=m.b+(l.y+l.height-d.b),b={x:h,y,width:v-h,height:g-y};if(b.width<=0||b.height<=0||Math.abs(b.x-u.x)<1&&Math.abs(b.y-u.y)<1&&Math.abs(b.width-u.width)<1&&Math.abs(b.height-u.height)<1)continue;const x=o(nt(i)).length,C={x:u.x,y:u.y,width:u.width,height:u.height};r.resizeShape(u,b),o(nt(i)).length>x&&r.resizeShape(u,C)}}function nm(e,t,n=tm){const i=Qh(e),r=Zh(t,Eh(i.elementRegistry)),o={edgeCrossings:{before:0,after:0,pairs:[],solidPairs:0,dashedPairs:0,mixedPairs:0,crossPoolMessages:0}};if(r.length)return{ok:!1,issues:r,findings:[],stats:o};const a=nt(i.elementRegistry),s=new Set(At(a).map(Rt)),c=new Set(a.edges.map(g=>g.id)),l=new Set(a.shapes.map(g=>g.id)),u=Rs(a),f=u.length,p=new Set(u.map(([g,b])=>`${g}|${b}`)),d=new Map;for(const g of i.elementRegistry.filter(b=>"waypoints"in b&&!!b.waypoints))g.label&&d.set(g.id,{wps:g.waypoints.map(b=>({x:b.x,y:b.y})),label:{x:g.label.x,y:g.label.y}});const m=e.get("commandStack");try{Od(m,()=>{n(t,i),rS(i,s,a),oS(i,s,a),Th(i,c);const g=bu(i,s);Ah(i,p,c),jh(i,s,c),Dh(i,c),G1(i,c),Bh(i,s,c),Y1(i,s,c),Wh(i,s,c),Vh(i,c),Yh(i,l),nS(i,s,l),bu(i,s,g),qh(i,s),Gh(i,d)})}catch(g){return{ok:!1,issues:[{kind:"lower-failed",message:g instanceof Error?g.message:String(g)}],findings:[],stats:o}}const h=nt(i.elementRegistry),y=At(h).filter(g=>!s.has(Rt(g))),v=mh(h);return{ok:!0,issues:[],findings:y,stats:{edgeCrossings:{before:f,after:v.pairs.length,pairs:v.pairs,solidPairs:v.solidPairs,dashedPairs:v.dashedPairs,mixedPairs:v.mixedPairs,crossPoolMessages:v.crossPoolMessages}}}}function aS(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function im(e,t){return typeof e.get=="function"?e.get(t):e[t]}function rm(e,t){const n=im(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function om(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(r=>(r==null?void 0:r.$type)===t)}function sS(e){return typeof e=="string"&&Yl.includes(e)}function ui(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function am(e){const t=e.rootElements??[],n=t.find(K=>K.$type==="bpmn:Collaboration"),i=new Map(t.filter(K=>K.$type==="bpmn:Process").map(K=>[K.id,K])),r=[],o=[],a=[],s=[],c=[],l=[],u={poolOrders:{},bands:{},placements:{},afterColumns:{}},f=[],p=[],d=[],m=[],h=[],y=[],v=[],g=new Set,b=new Set,x=K=>{K&&g.add(K)},C=K=>{g.add(K),b.add(K)},M=K=>{const Z=om(K,"bwl:Placement");if(!Z)return;const se=typeof Z.anchor=="string"?Z.anchor:void 0;if(!se||!sS(Z.side))return;const xe=typeof Z.offset=="number"?Z.offset:void 0;h.push({owner:K.id,anchor:se,side:Z.side,...xe!==void 0?{offset:xe}:{}})},k=K=>{const Z=om(K,"bwl:Members"),se=typeof(Z==null?void 0:Z.refs)=="string"?Z.refs.split(/\s+/).filter(Boolean):[];se.length&&v.push({owner:K.id,refs:se})},P=K=>{var Z;for(const se of K)switch(x(se.id),se.$type){case"bpmn:TextAnnotation":C(se.id),s.push({id:se.id,text:typeof se.text=="string"?se.text:""}),M(se);break;case"bpmn:Association":d.push({id:se.id,type:se.$type,source:ui(se.sourceRef),target:ui(se.targetRef)});break;case"bpmn:Group":{C(se.id);const xe=(Z=se.categoryValueRef)==null?void 0:Z.value;c.push({id:se.id,...typeof xe=="string"&&xe?{name:xe}:{}}),k(se);break}default:l.push({id:se.id,type:se.$type,reason:"type-outside-mvp"})}},B=K=>{for(const Z of K.flowElements??[])x(Z.id),l.push({id:Z.id,type:Z.$type,reason:"inside-container"}),(Z.flowElements??[]).length&&B(Z);for(const Z of K.artifacts??[])x(Z.id),l.push({id:Z.id,type:Z.$type,reason:"inside-container"})},D=(K,Z)=>{const se=K.flowElements??[],xe=(K.laneSets??[]).flatMap(V=>V.lanes??[]),q=new Map;for(const V of xe){x(V.id);for(const ne of V.flowNodeRef??[]){const Te=ui(ne);Te&&q.set(Te,V.id)}}for(const V of se){if(x(V.id),V.$type==="bpmn:SequenceFlow"){f.push({id:V.id,source:ui(V.sourceRef),target:ui(V.targetRef),...typeof V.name=="string"&&V.name?{name:V.name}:{}});continue}if(V.$type==="bpmn:DataStoreReference"){C(V.id),a.push({id:V.id,...V.name?{name:V.name}:{}});continue}const ne=aS(V.$type);if(!Ad(ne)){l.push({id:V.id,type:V.$type,reason:"type-outside-mvp"});continue}C(V.id);const Te=ne==="boundaryEvent"?ui(V.attachedToRef):void 0;o.push({id:V.id,type:ne,...V.name?{name:V.name}:{},...Z?{participant:Z}:{},...q.has(V.id)?{lane:q.get(V.id)}:{},...Te?{attachedTo:Te}:{}}),ne==="subProcess"&&B(V);const yt=rm(V,"bwl:band");yt!==void 0&&(u.bands[V.id]=yt);const T=im(V,"bwl:afterColumn");typeof T=="string"&&T!==""&&y.push([V.id,T]);for(const w of V.dataOutputAssociations??[])x(w.id),m.push({id:w.id,type:w.$type,source:V.id,target:ui(w.targetRef)});for(const w of V.dataInputAssociations??[])x(w.id),m.push({id:w.id,type:w.$type,source:ui((w.sourceRef??[])[0]),target:V.id})}P(K.artifacts??[])};if(n){const K=new Set;for(const Z of n.participants??[]){C(Z.id);const se=ui(Z.processRef);se&&K.add(se);const xe=se?i.get(se):void 0,q=((xe==null?void 0:xe.laneSets)??[]).flatMap(yt=>yt.lanes??[]),V=q.map(yt=>({id:yt.id,...yt.name?{name:yt.name}:{}}));for(const yt of V)C(yt.id);const ne=!xe||(xe.flowElements??[]).length===0&&q.length===0&&(xe.artifacts??[]).length===0;r.push({id:Z.id,...Z.name?{name:Z.name}:{},...ne?{blackBox:!0}:{},...V.length?{lanes:V}:{}});const Te=rm(Z,"bwl:poolOrder");Te!==void 0&&(u.poolOrders[Z.id]=Te),xe&&D(xe,Z.id)}for(const Z of n.messageFlows??[])x(Z.id),p.push({id:Z.id,source:ui(Z.sourceRef),target:ui(Z.targetRef),...typeof Z.name=="string"&&Z.name?{name:Z.name}:{}});P(n.artifacts??[]);for(const[Z,se]of i)!K.has(Z)&&(se.flowElements??[]).length>0&&l.push({id:Z,type:se.$type,reason:"unreachable-process"})}else for(const K of i.values())D(K);const I=[],z=[],oe=[],ye=[],Ve=(K,Z)=>!!K&&!!Z&&b.has(K)&&b.has(Z);for(const K of f){if(!Ve(K.source,K.target)){l.push({id:K.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}I.push({id:K.id,source:K.source,target:K.target,...K.name?{name:K.name}:{}}),b.add(K.id)}for(const K of p){if(!Ve(K.source,K.target)){l.push({id:K.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}z.push({id:K.id,source:K.source,target:K.target,...K.name?{name:K.name}:{}}),b.add(K.id)}for(const K of m){if(!Ve(K.source,K.target)){l.push({id:K.id??"",type:K.type,reason:"endpoint-outside-mvp"});continue}ye.push({...K.id?{id:K.id}:{},source:K.source,target:K.target}),K.id&&b.add(K.id)}for(const K of d){if(!Ve(K.source,K.target)){l.push({id:K.id??"",type:K.type,reason:"endpoint-outside-mvp"});continue}oe.push({...K.id?{id:K.id}:{},source:K.source,target:K.target})}const He=new Map(c.map(K=>[K.id,K]));for(const{owner:K,refs:Z}of v){const se=Z.filter(q=>g.has(q)),xe=He.get(K);xe&&se.length&&(xe.members=se)}for(const K of h)g.has(K.anchor)&&(u.placements[K.owner]={anchor:K.anchor,side:K.side,...K.offset!==void 0?{offset:K.offset}:{}});for(const[K,Z]of y)g.has(Z)&&(u.afterColumns[K]=Z);return{definition:{...r.length?{participants:r}:{},nodes:o,sequenceFlows:I,...z.length?{messageFlows:z}:{},...a.length?{dataStores:a}:{},...ye.length?{dataAssociations:ye}:{},...s.length?{annotations:s}:{},...oe.length?{associations:oe}:{},...c.length?{groups:c}:{}},hints:u,omitted:l}}async function cS(e){const{definitions:t,warnings:n}=await lo(e);return{...am(t),warnings:n}}const lS=new Set(["bpmn:ExclusiveGateway","bpmn:ParallelGateway","bpmn:InclusiveGateway","bpmn:EventBasedGateway","bpmn:ComplexGateway"]);function Cu(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function uS(e){return Cu(e.processRef)!==void 0}function pS(e){const t=new Set,n=r=>{const o=Cu(r);o&&t.add(o)},i=r=>{for(const o of r.flowElements??[]){n(o.sourceRef),n(o.targetRef),o.attachedToRef&&(n(o.attachedToRef),t.add(o.id));for(const a of o.dataOutputAssociations??[])t.add(o.id),n(a.targetRef);for(const a of o.dataInputAssociations??[]){t.add(o.id);for(const s of a.sourceRef??[])n(s)}(o.flowElements??[]).length&&i(o)}for(const o of r.artifacts??[])n(o.sourceRef),n(o.targetRef)};for(const r of e.rootElements??[])if(r.$type==="bpmn:Process")i(r);else if(r.$type==="bpmn:Collaboration"){for(const o of r.messageFlows??[])n(o.sourceRef),n(o.targetRef);for(const o of r.artifacts??[])n(o.sourceRef),n(o.targetRef)}return t}function fS(e){const t=[],n=i=>{for(const r of i.flowElements??[])lS.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 dS(e){if(!e)return!0;const t=(e.laneSets??[]).flatMap(n=>n.lanes??[]);return(e.flowElements??[]).length===0&&t.length===0&&(e.artifacts??[]).length===0}function Au(e){const t=[],n=e.rootElements??[],i=pS(e);for(const o of fS(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??[])uS(s)&&dS(o.get(Cu(s.processRef)))&&a.push(s.id);a.length&&t.push({ruleId:"CHK-POOL-1",severity:"info",targetKind:"participant",targetRefs:a,params:{count:a.length}})}return t}async function hS(e){const{definitions:t,warnings:n}=await lo(e);return{issues:Au(t),warnings:n}}const mS=.5,gS=8,yS=new Set(["bpmn:Definitions","bpmn:Collaboration","bpmn:Process","bpmn:LaneSet","bpmn:ExtensionElements","bpmn:Documentation","bpmn:Relationship","bpmn:Property","bpmn:Category","bpmn:CategoryValue"]),vo=e=>typeof e=="number"?e:Number(e??NaN),Is=e=>{if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:""};function vS(e){const t=e,n=[],i=typeof t.name=="string"?t.name:typeof t.text=="string"?t.text:"";n.push(`n=${i.replace(/\s+/g," ").trim()}`);for(const o of["sourceRef","targetRef","attachedToRef","processRef","default"])t[o]!==void 0&&n.push(`${o}=${Is(t[o])}`);if(String(e.$type)==="bpmn:Group"){const o=t.categoryValueRef,a=Array.isArray(o)?o:o==null?[]:[o];n.push(`cat=[${a.map(s=>`${Is(s)}:${typeof(s==null?void 0:s.value)=="string"?s.value:""}`).sort().join(",")}]`)}Array.isArray(t.flowNodeRef)&&n.push(`lane=[${t.flowNodeRef.map(Is).sort().join(",")}]`);const r=t.conditionExpression;return r&&typeof r.body=="string"&&n.push(`cond=${r.body}`),n.join("|")}function bS(e){const t=new Map,n=new Map,i=(a,s)=>{a&&t.set(a,[...t.get(a)??[],...s])},r=a=>{const s=a;return s?[vo(s.x),vo(s.y),vo(s.width),vo(s.height)]:[]},o=a=>{if(Array.isArray(a))return a.forEach(o);if(!a||typeof a!="object")return;const s=a,c=String(s.$type??"");if(c==="bpmndi:BPMNShape"||c==="bpmndi:BPMNEdge"){const l=Is(s.bpmnElement);if(c==="bpmndi:BPMNShape")i(l,r(s.bounds));else{const f=Array.isArray(s.waypoint)?s.waypoint:[];i(l,f.flatMap(p=>[vo(p.x),vo(p.y)]))}const u=s.label;u!=null&&u.bounds&&l&&n.set(l,r(u.bounds).slice(0,2));return}for(const l of Object.values(s))(Array.isArray(l)||l&&typeof l=="object"&&"$type"in l)&&o(l)};return o(e.diagrams),{body:t,labels:n}}function sm(e){const t=bS(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:")&&!yS.has(s)&&n.set(c,{type:s,props:vS(a),geometry:(t.body.get(c)??[]).join(","),label:(t.labels.get(c)??[]).join(",")});for(const l of Object.values(a))(Array.isArray(l)||l&&typeof l=="object")&&r(l)};return r(e),n}function cm(e,t,n){if(e===t)return!1;const i=e===""?[]:e.split(",").map(Number),r=t===""?[]:t.split(",").map(Number);return i.length!==r.length?!0:i.some((o,a)=>Math.abs(o-r[a])>n)}function lm(e,t,n={}){const i=n.moveTolerance??mS,r=sm(e),o=sm(t),a=[],s=[],c=[];for(const[l,u]of o){const f=r.get(l);if(!f){a.push(l);continue}(f.type!==u.type||f.props!==u.props||cm(f.geometry,u.geometry,i)||cm(f.label,u.label,n.labelTolerance??gS))&&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 xS(e,t,n={}){const[i,r]=await Promise.all([lo(e),lo(t)]);return{...lm(i.definitions,r.definitions,n),warnings:[...i.warnings,...r.warnings]}}function _S(e){return new Set([...e.added,...e.modified])}function wS(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function um(e,t,{currentVersion:n}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const i=nm(e,t.ops);if(!i.ok)return{status:"rejected",issues:i.issues};const{xml:r}=await e.saveXML({format:!0});return{status:"applied",version:n+1,xml:r??"",findings:i.findings,stats:i.stats}}const ES=Symbol("bpmn-editor"),Pu={geometry:[],semantic:[]};function SS(){const e=ge.ref(!1),t=ge.ref(!0),n=ge.ref(!1),i=ge.shallowRef(Pu),r=ge.shallowRef(void 0);let o,a;const s=()=>{if(!o){i.value=Pu;return}const p=At(nt(o.get("elementRegistry"))),d=o.getDefinitions();i.value={geometry:p,semantic:d?Au(d):[]}},c=()=>{e.value=!0,s()};function l(p,d){p.get("canvas").getContainer().style.pointerEvents=d?"":"none";const m=p.get("keyboard");d?(a&&m.bind(a),a=void 0):a||(a=m.getBinding(),m.unbind())}function u(){if(!o)throw new Error("modeler not attached — 뷰 @ready 후 attach() 필요");return o}function f(){return o==null?void 0:o.get("commandStack")}return{dirty:e,editable:t,agentBusy:n,issues:i,revalidate:s,changeScope:r,setChangeScope(p){r.value=p===void 0?void 0:new Set(p)},requestFocus(p){if(!o)return;const d=o.get("elementRegistry").get(p);d&&(o.get("canvas").scrollToElement(d,180),o.get("selection").select(d))},describeElement(p){const d=o==null?void 0:o.get("elementRegistry").get(p),m=d==null?void 0:d.businessObject;if(!m)return;const h=typeof m.name=="string"&&m.name.trim()!==""?m.name:m.text;return{name:typeof h=="string"&&h.trim()!==""?h.trim():void 0,type:typeof m.$type=="string"?m.$type:""}},attach(p){o&&this.detach(),o=p,o.get("eventBus").on("commandStack.changed",c),t.value||l(o,!1),s()},detach(){o==null||o.get("eventBus").off("commandStack.changed",c),o&&!t.value&&l(o,!0),a=void 0,o=void 0,i.value=Pu,r.value=void 0},setEditable(p){t.value=p,o&&l(o,p)},async applyAgentBatch(p,d){const m=u();n.value=!0;try{const h=await um(m,p,{currentVersion:d});return h.status==="applied"&&(e.value=!1),h}finally{n.value=!1}},async importXml(p){const{warnings:d}=await u().importXML(p);return e.value=!1,r.value=void 0,s(),{warnings:uu(d)}},async saveXml(){const{xml:p}=await u().saveXML({format:!0});return e.value=!1,p??""},undo:()=>{var p;return(p=f())==null?void 0:p.undo()},redo:()=>{var p;return(p=f())==null?void 0:p.redo()},canUndo:()=>{var p;return((p=f())==null?void 0:p.canUndo())??!1},canRedo:()=>{var p;return((p=f())==null?void 0:p.canRedo())??!1}}}function Ee(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function RS(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Mu={exports:{}},pm;function CS(){if(pm)return Mu.exports;pm=1;var e=Mu.exports=function(t,n){if(n||(n=16),t===void 0&&(t=128),t<=0)return"0";for(var i=Math.log(Math.pow(2,t))/Math.log(n),r=2;i===1/0;r*=2)i=Math.log(Math.pow(2,t/r))/Math.log(n)*r;for(var o=i-Math.floor(i),a="",r=0;r<Math.floor(i);r++){var s=Math.floor(Math.random()*n).toString(n);a=s+a}if(o){var c=Math.pow(n,o),s=Math.floor(Math.random()*c).toString(n);a=s+a}var l=parseInt(a,n);return l!==1/0&&l>=Math.pow(2,t)?e(t,n):a};return e.rack=function(t,n,i){var r=function(a){var s=0;do{if(s++>10)if(i)t+=i;else throw new Error("too many ID collisions, use more bits");var c=e(t,n)}while(Object.hasOwnProperty.call(o,c));return o[c]=a,c},o=r.hats={};return r.get=function(a){return r.hats[a]},r.set=function(a,s){return r.hats[a]=s,r},r.bits=t||128,r.base=n||16,r},Mu.exports}var AS=CS(),PS=RS(AS);function yi(e){if(!(this instanceof yi))return new yi(e);e=e||[128,36,1],this._seed=e.length?PS.rack(e[0],e[1],e[2]):e}yi.prototype.next=function(e){return this._seed(e||!0)},yi.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},yi.prototype.claim=function(e,t){this._seed.set(e,t||!0)},yi.prototype.assigned=function(e){return this._seed.get(e)||!1},yi.prototype.unclaim=function(e){delete this._seed.hats[e]},yi.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const qt={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};qt.td=qt.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],qt.option=qt.optgroup=[1,'<select multiple="multiple">',"</select>"],qt.thead=qt.tbody=qt.colgroup=qt.caption=qt.tfoot=[1,"<table>","</table>"],qt.polyline=qt.ellipse=qt.polygon=qt.circle=qt.text=qt.line=qt.path=qt.rect=qt.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function wt(e,t=globalThis.document){var l;if(typeof e!="string")throw new TypeError("String expected");const n=/^<!--(.*?)-->$/s.exec(e);if(n)return t.createComment(n[1]);const i=(l=/<([\w:]+)/.exec(e))==null?void 0:l[1];if(!i)return t.createTextNode(e);if(e=e.trim(),i==="body"){const u=t.createElement("html");u.innerHTML=e;const{lastChild:f}=u;return f.remove(),f}let[r,o,a]=Object.hasOwn(qt,i)?qt[i]:qt._default,s=t.createElement("div");for(s.innerHTML=o+e+a;r--;)s=s.lastChild;if(s.firstChild===s.lastChild){const{firstChild:u}=s;return u.remove(),u}const c=t.createDocumentFragment();return c.append(...s.childNodes),c}function MS(e,t){return t.forEach(function(n){n&&typeof n!="string"&&!Array.isArray(n)&&Object.keys(n).forEach(function(i){if(i!=="default"&&!(i in e)){var r=Object.getOwnPropertyDescriptor(n,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:function(){return n[i]}})}})}),Object.freeze(e)}function wn(e,...t){const n=e.style;return F(t,function(i){i&&F(i,function(r,o){n[o]=r})}),e}function gn(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const TS=Object.prototype.toString;function Ct(e){return new er(e)}function er(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}er.prototype.add=function(e){return this.list.add(e),this},er.prototype.remove=function(e){return TS.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},er.prototype.removeMatching=function(e){const t=this.array();for(let n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},er.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},er.prototype.array=function(){return Array.from(this.list)},er.prototype.has=er.prototype.contains=function(e){return this.list.contains(e)};function Ls(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Lr(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function kS(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Bs={},fm;function OS(){if(fm)return Bs;fm=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return Bs.bind=function(r,o,a,s){return e||i(),r[e](n+o,a,s||!1),a},Bs.unbind=function(r,o,a,s){return t||i(),r[t](n+o,a,s||!1),a},Bs}var dm=OS(),DS=kS(dm),je=MS({__proto__:null,default:DS},[dm]),hm=["focus","blur"];function IS(e,t,n,i,r){return hm.indexOf(n)!==-1&&(r=!0),je.bind(e,n,function(o){var a=o.target||o.srcElement;o.delegateTarget=Lr(a,t,!0),o.delegateTarget&&i.call(e,o)},r)}function LS(e,t,n,i){return hm.indexOf(t)!==-1&&(i=!0),je.unbind(e,t,n,i)}var On={bind:IS,unbind:LS};function Tu(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function ft(e,t){return t=t||document,t.querySelector(e)}function Ns(e,t){return t=t||document,t.querySelectorAll(e)}function vi(e){e.parentNode&&e.parentNode.removeChild(e)}function BS(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function NS(e,t){return t.appendChild(BS(e,t))}function ze(e,t){return NS(t,e),e}var ku=2,mm={"alignment-baseline":1,"baseline-shift":1,clip:1,"clip-path":1,"clip-rule":1,color:1,"color-interpolation":1,"color-interpolation-filters":1,"color-profile":1,"color-rendering":1,cursor:1,direction:1,display:1,"dominant-baseline":1,"enable-background":1,fill:1,"fill-opacity":1,"fill-rule":1,filter:1,"flood-color":1,"flood-opacity":1,font:1,"font-family":1,"font-size":ku,"font-size-adjust":1,"font-stretch":1,"font-style":1,"font-variant":1,"font-weight":1,"glyph-orientation-horizontal":1,"glyph-orientation-vertical":1,"image-rendering":1,kerning:1,"letter-spacing":1,"lighting-color":1,marker:1,"marker-end":1,"marker-mid":1,"marker-start":1,mask:1,opacity:1,overflow:1,"pointer-events":1,"shape-rendering":1,"stop-color":1,"stop-opacity":1,stroke:1,"stroke-dasharray":1,"stroke-dashoffset":1,"stroke-linecap":1,"stroke-linejoin":1,"stroke-miterlimit":1,"stroke-opacity":1,"stroke-width":ku,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function $S(e,t){return mm[t]?e.style[t]:e.getAttributeNS(null,t)}function gm(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=mm[i];r?(r===ku&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function FS(e,t){var n=Object.keys(t),i,r;for(i=0,r;r=n[i];i++)gm(e,r,t[r])}function Se(e,t,n){if(typeof t=="string")if(n!==void 0)gm(e,t,n);else return $S(e,t);else FS(e,t);return e}const jS=Object.prototype.toString;function et(e){return new tr(e)}function tr(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}tr.prototype.add=function(e){return this.list.add(e),this},tr.prototype.remove=function(e){return jS.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},tr.prototype.removeMatching=function(e){const t=this.array();for(let n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},tr.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},tr.prototype.array=function(){return Array.from(this.list)},tr.prototype.has=tr.prototype.contains=function(e){return this.list.contains(e)};function $s(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function ym(e){return e.cloneNode(!0)}var Ou={svg:"http://www.w3.org/2000/svg"},vm='<svg xmlns="'+Ou.svg+'"';function HS(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(Ou.svg)===-1&&(e=vm+e.substring(4)):(e=vm+">"+e+"</svg>",t=!0);var n=zS(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function zS(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function Oe(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=HS(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(Ou.svg,e),t&&Se(n,t),n}var Du=null;function bm(){return Du===null&&(Du=Oe("svg")),Du}function xm(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function GS(e,t,n,i,r,o){var a=bm().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return xm(a,e);case 6:return xm(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}function sa(e){return bm().createSVGTransform()}var _m=/([&<>]{1})/g,VS=/([&<>\n\r"]{1})/g,WS={"&":"&","<":"<",">":">",'"':"'"};function Iu(e,t){function n(i,r){return WS[r]||r}return e.replace(t,n)}function wm(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(Iu(e.textContent,_m));break;case 1:if(t.push("<",e.tagName),e.hasAttributes())for(r=e.attributes,n=0,i=r.length;n<i;++n)o=r.item(n),t.push(" ",o.name,'="',Iu(o.value,VS),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)wm(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",Iu(e.nodeValue,_m),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function US(e){for(var t=e.firstChild,n=[];t;)wm(t,n),t=t.nextSibling;return n.join("")}function Em(e,t){return US(e)}function Kt(e){var t=e.parentNode;return t&&t.removeChild(e),e}function YS(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function qS(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(YS(e,i))}function ca(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),qS(n,t)),n.consolidate()}const KS=/^class[ {]/;function XS(e){return KS.test(e.toString())}function Lu(e){return Array.isArray(e)}function Bu(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Fs(...e){e.length===1&&Lu(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const ZS=/constructor\s*[^(]*\(\s*([^)]*)\)/m,QS=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,JS=/\/\*([^*]*)\*\//m;function eR(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(XS(e)?ZS:QS);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const r=i.match(JS);return(r&&r[1]||i).trim()})||[]}function Sm(e,t){const n=t||{get:function(b,x){if(i.push(b),x===!1)return null;throw s(`No provider for "${b}"!`)}},i=[],r=this._providers=Object.create(n._providers||null),o=this._instances=Object.create(null),a=o.injector=this,s=function(b){const x=i.join(" -> ");return i.length=0,new Error(x?`${b} (Resolving: ${x})`:b)};function c(b,x){if(!r[b]&&b.includes(".")){const C=b.split(".");let M=c(C.shift());for(;C.length;)M=M[C.shift()];return M}if(Bu(o,b))return o[b];if(Bu(r,b)){if(i.indexOf(b)!==-1)throw i.push(b),s("Cannot resolve circular dependency!");return i.push(b),o[b]=r[b][0](r[b][1]),i.pop(),o[b]}return n.get(b,x)}function l(b,x){if(typeof x>"u"&&(x={}),typeof b!="function")if(Lu(b))b=Fs(b.slice());else throw s(`Cannot invoke "${b}". Expected a function!`);const M=(b.$inject||eR(b)).map(k=>Bu(x,k)?x[k]:c(k));return{fn:b,dependencies:M}}function u(b){const{fn:x,dependencies:C}=l(b),M=Function.prototype.bind.call(x,null,...C);return new M}function f(b,x,C){const{fn:M,dependencies:k}=l(b,C);return M.apply(x,k)}function p(b){return Fs(x=>b.get(x))}function d(b,x){if(x&&x.length){const C=Object.create(null),M=Object.create(null),k=[],P=[],B=[];let D,I,z,oe;for(let ye in r)D=r[ye],x.indexOf(ye)!==-1&&(D[2]==="private"?(I=k.indexOf(D[3]),I===-1?(z=D[3].createChild([],x),oe=p(z),k.push(D[3]),P.push(z),B.push(oe),C[ye]=[oe,ye,"private",z]):C[ye]=[B[I],ye,"private",P[I]]):C[ye]=[D[2],D[1]],M[ye]=!0),(D[2]==="factory"||D[2]==="type")&&D[1].$scope&&x.forEach(Ve=>{D[1].$scope.indexOf(Ve)!==-1&&(C[ye]=[D[2],D[1]],M[Ve]=!0)});x.forEach(ye=>{if(!M[ye])throw new Error('No provider for "'+ye+'". Cannot use provider from the parent!')}),b.unshift(C)}return new Sm(b,a)}const m={factory:f,type:u,value:function(b){return b}};function h(b,x){const C=b.__init__||[];return function(){C.forEach(M=>{typeof M=="string"?x.get(M):x.invoke(M)})}}function y(b){const x=b.__exports__;if(x){const C=b.__modules__,M=Object.keys(b).reduce((I,z)=>(z!=="__exports__"&&z!=="__modules__"&&z!=="__init__"&&z!=="__depends__"&&(I[z]=b[z]),I),Object.create(null)),k=(C||[]).concat(M),P=d(k),B=Fs(function(I){return P.get(I)});x.forEach(function(I){r[I]=[B,I,"private",P]});const D=(b.__init__||[]).slice();return D.unshift(function(){P.init()}),b=Object.assign({},b,{__init__:D}),h(b,P)}return Object.keys(b).forEach(function(C){if(C==="__init__"||C==="__depends__")return;const M=b[C];if(M[2]==="private"){r[C]=M;return}const k=M[0],P=M[1];r[C]=[m[k],tR(k,P),k]}),h(b,a)}function v(b,x){return b.indexOf(x)!==-1||(b=(x.__depends__||[]).reduce(v,b),b.indexOf(x)!==-1)?b:b.concat(x)}function g(b){const x=b.reduce(v,[]).map(y);let C=!1;return function(){C||(C=!0,x.forEach(M=>M()))}}this.get=c,this.invoke=f,this.instantiate=u,this.createChild=d,this.init=g(e)}function tR(e,t){return e!=="value"&&Lu(t)&&(t=Fs(t.slice())),t}var nR=1e3;function Ii(e,t){var n=this;t=t||nR,e.on(["render.shape","render.connection"],t,function(i,r){var o=i.type,a=r.element,s=r.gfx,c=r.attrs;if(n.canRender(a))return o==="render.shape"?n.drawShape(s,a,c):n.drawConnection(s,a,c)}),e.on(["render.getShapePath","render.getConnectionPath"],t,function(i,r){if(n.canRender(r))return i.type==="render.getShapePath"?n.getShapePath(r):n.getConnectionPath(r)})}Ii.prototype.canRender=function(e){},Ii.prototype.drawShape=function(e,t){},Ii.prototype.drawConnection=function(e,t){},Ii.prototype.getShapePath=function(e){},Ii.prototype.getConnectionPath=function(e){};function Br(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function iR(e){return["M",e.x,e.y]}function Nu(e){return["L",e.x,e.y]}function rR(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function oR(e,t){const n=e.length,i=[iR(e[0])];for(let r=1;r<n;r++){const o=e[r-1],a=e[r],s=e[r+1];if(!s||!t){i.push(Nu(a));continue}const c=Math.min(t,$u(a.x-o.x,a.y-o.y),$u(s.x-a.x,s.y-a.y));if(!c){i.push(Nu(a));continue}const l=js(a,o,c),u=js(a,o,c*.5),f=js(a,s,c),p=js(a,s,c*.5);i.push(Nu(l)),i.push(rR(u,p,f))}return i}function js(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=$u(i,r),a=n/o;return{x:e.x+i*a,y:e.y+r*a}}function $u(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function la(e,t,n){Fe(t)&&(n=t,t=null),t||(t={});const i=Oe("path",t);return Fe(n)&&(i.dataset.cornerRadius=String(n)),Fu(i,e)}function Fu(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return Se(e,{d:Br(oR(t,n))}),e}function Hs(e){var t=new Set(e);return Ke(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function Nr(e,t,n){n=n||0,Be(e)||(e=[e]),F(e,function(i,r){var o=t(i,r,n);Be(o)&&o.length&&Nr(o,t,n+1)})}function ju(e,t,n){var i=new Set,r=new Set;return Nr(e,function(o,a,s){i.add(o);var c=o.children;if(c&&!r.has(c))return r.add(c),c}),Array.from(i)}function ua(e,t){return ju(e)}function aR(e,t,n){Tr(t)&&(t=!0),Qt(t)&&(n=t,t=!0),n=n||{};var i=pa(n.allShapes),r=pa(n.allConnections),o=pa(n.enclosedElements),a=pa(n.enclosedConnections),s=pa(n.topLevel,t&&oo(e,function(u){return u.id}));function c(u){s[u.source.id]&&s[u.target.id]&&(s[u.id]=[u]),i[u.source.id]&&i[u.target.id]&&(a[u.id]=o[u.id]=u),r[u.id]=u}function l(u){if(o[u.id]=u,u.waypoints)a[u.id]=r[u.id]=u;else return i[u.id]=u,F(u.incoming,c),F(u.outgoing,c),u.children}return Nr(e,l),{allShapes:i,allConnections:r,topLevel:s,enclosedConnections:a,enclosedElements:o}}function Ft(e,t){t=!!t,Be(e)||(e=[e]);var n,i,r,o;return F(e,function(a){var s=a;a.waypoints&&!t&&(s=Ft(a.waypoints,!0));var c=s.x,l=s.y,u=s.height||0,f=s.width||0;(c<n||n===void 0)&&(n=c),(l<i||i===void 0)&&(i=l),(c+f>r||r===void 0)&&(r=c+f),(l+u>o||o===void 0)&&(o=l+u)}),{x:n,y:i,height:o-i,width:r-n}}function bo(e,t){var n={};return F(e,function(i){var r=i;r.waypoints&&(r=Ft(r)),!Fe(t.y)&&r.x>t.x&&(n[i.id]=i),!Fe(t.x)&&r.y>t.y&&(n[i.id]=i),r.x>t.x&&r.y>t.y&&(Fe(t.width)&&Fe(t.height)&&r.width+r.x<t.width+t.x&&r.height+r.y<t.height+t.y||!Fe(t.width)||!Fe(t.height))&&(n[i.id]=i)}),n}function Rm(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function Cm(e){return!!(e&&e.isFrame)}function pa(e,t){return W({},e||{},t||{})}var sR=1;function nr(e,t){Ii.call(this,e,sR),this.CONNECTION_STYLE=t.style(["no-fill"],{strokeWidth:5,stroke:"fuchsia"}),this.SHAPE_STYLE=t.style({fill:"white",stroke:"fuchsia",strokeWidth:2}),this.FRAME_STYLE=t.style(["no-fill"],{stroke:"fuchsia",strokeDasharray:4,strokeWidth:2})}Ee(nr,Ii),nr.prototype.canRender=function(){return!0},nr.prototype.drawShape=function(t,n,i){var r=Oe("rect");return Se(r,{x:0,y:0,width:n.width||0,height:n.height||0}),Cm(n)?Se(r,W({},this.FRAME_STYLE,i||{})):Se(r,W({},this.SHAPE_STYLE,i||{})),ze(t,r),r},nr.prototype.drawConnection=function(t,n,i){var r=la(n.waypoints,W({},this.CONNECTION_STYLE,i||{}));return ze(t,r),r},nr.prototype.getShapePath=function(t){var n=t.x,i=t.y,r=t.width,o=t.height,a=[["M",n,i],["l",r,0],["l",0,o],["l",-r,0],["z"]];return Br(a)},nr.prototype.getConnectionPath=function(t){var n=t.waypoints,i,r,o=[];for(i=0;r=n[i];i++)r=r.original||r,o.push([i===0?"M":"L",r.x,r.y]);return Br(o)},nr.$inject=["eventBus","styles"];function cR(){var e={"no-fill":{fill:"none"},"no-border":{strokeOpacity:0},"no-events":{pointerEvents:"none"}},t=this;this.cls=function(n,i,r){var o=this.style(i,r);return W(o,{class:n})},this.style=function(n,i){!Be(n)&&!i&&(i=n,n=[]);var r=Tn(n,function(o,a){return W(o,e[a]||{})},{});return i?W(r,i):r},this.computeStyle=function(n,i,r){return Be(i)||(r=i,i=[]),t.style(i||[],W({},r,n||{}))}}const lR={__init__:["defaultRenderer"],defaultRenderer:["type",nr],styles:["type",cR]};function Lt(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function Bt(e,t,n){if(!(!e||!t)){typeof n!="number"&&(n=-1);var i=e.indexOf(t);if(i!==-1){if(i===n)return;if(n!==-1)e.splice(i,1);else return}n!==-1?e.splice(n,0,t):e.push(t)}}function Hu(e,t){return!e||!t?-1:e.indexOf(t)}function fa(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function zu(e,t,n,i){if(typeof i>"u"&&(i=5),!e||!t||!n)return!1;var r=(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),o=fa(e,t);return Math.abs(r/o)<=i}var uR=2;function Li(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[r,o]of Object.entries(i))if(pR(r,n))return o;return!1}function pR(e,t){const n=t[0];return kr(t,function(i){return Math.abs(n[e]-i[e])<=uR})}function Am(e,t,n){return n=n||0,e.x>t.x-n&&e.y>t.y-n&&e.x<t.x+t.width+n&&e.y<t.y+t.height+n}function Gu(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var fR=/,?([a-z]),?/gi,Pm=parseFloat,jt=Math,ir=jt.PI,bi=jt.min,xi=jt.max,Mm=jt.pow,rr=jt.abs,dR=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,hR=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,Tm=Array.isArray||function(e){return e instanceof Array};function mR(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function gR(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 yR(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 mR(r,i)?(gR(o,i),r[i]):(o.length>=1e3&&delete r[o.shift()],o.push(i),r[i]=e(...arguments),r[i])}return t}function vR(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(dR,function(i,r,o){var a=[],s=r.toLowerCase();for(o.replace(hR,function(c,l){l&&a.push(+l)}),s=="m"&&a.length>2&&(n.push([r,...a.splice(0,2)]),s="l",r=r=="m"?"l":"L");a.length>=t[s]&&(n.push([r,...a.splice(0,t[s])]),!!t[s]););}),n.toString=Wu,n}function bR(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 xR(e){for(var t=0,n=e.length;t<n;t++){var i=e[t][0];if(i!=="M"&&i!=="C")return!1}return!0}function Vu(e,t,n,i){return arguments.length===1&&(t=e.y,n=e.width,i=e.height,e=e.x),{x:e,y:t,width:n,height:i,x2:e+n,y2:t+i}}function Wu(){return this.join(",").replace(fR,"$1")}function _R(e){for(var t=new Array(e.length),n=0,i=e.length;n<i;n++)for(var r=e[n],o=t[n]=new Array(r.length),a=0,s=r.length;a<s;a++)o[a]=r[a];return t.toString=Wu,t}function km(e,t,n,i,r,o,a,s,c){var l=1-c,u=Mm(l,3),f=Mm(l,2),p=c*c,d=p*c,m=u*e+f*3*c*n+l*3*c*c*r+d*a,h=u*t+f*3*c*i+l*3*c*c*o+d*s;return{x:zs(m),y:zs(h)}}function Om(e){var t=AR(...e);return Vu(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function or(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function wR(e,t){return e=Vu(e),t=Vu(t),or(t,e.x,e.y)||or(t,e.x2,e.y)||or(t,e.x,e.y2)||or(t,e.x2,e.y2)||or(e,t.x,t.y)||or(e,t.x2,t.y)||or(e,t.x,t.y2)||or(e,t.x2,t.y2)||(e.x<t.x2&&e.x>t.x||t.x<e.x2&&t.x>e.x)&&(e.y<t.y2&&e.y>t.y||t.y<e.y2&&t.y>e.y)}function Dm(e,t,n,i,r){var o=-3*t+9*n-9*i+3*r,a=e*o+6*t-12*n+6*i;return e*a-3*t+3*n}function Im(e,t,n,i,r,o,a,s,c){c==null&&(c=1),c=c>1?1:c<0?0:c;for(var l=c/2,u=12,f=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],p=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],d=0,m=0;m<u;m++){var h=l*f[m]+l,y=Dm(h,e,n,r,a),v=Dm(h,t,i,o,s),g=y*y+v*v;d+=p[m]*jt.sqrt(g)}return l*d}function ER(e,t,n,i,r,o,a,s){if(!(xi(e,n)<bi(r,a)||bi(e,n)>xi(r,a)||xi(t,i)<bi(o,s)||bi(t,i)>xi(o,s))){var c=(e*i-t*n)*(r-a)-(e-n)*(r*s-o*a),l=(e*i-t*n)*(o-s)-(t-i)*(r*s-o*a),u=(e-n)*(o-s)-(t-i)*(r-a);if(u){var f=zs(c/u),p=zs(l/u),d=+f.toFixed(2),m=+p.toFixed(2);if(!(d<+bi(e,n).toFixed(2)||d>+xi(e,n).toFixed(2)||d<+bi(r,a).toFixed(2)||d>+xi(r,a).toFixed(2)||m<+bi(t,i).toFixed(2)||m>+xi(t,i).toFixed(2)||m<+bi(o,s).toFixed(2)||m>+xi(o,s).toFixed(2)))return{x:f,y:p}}}}function zs(e){return Math.round(e*1e11)/1e11}function SR(e,t,n){var i=Om(e),r=Om(t);if(!wR(i,r))return[];var o=Im(...e),a=Im(...t),s=Bm(e)?1:~~(o/5)||1,c=Bm(t)?1:~~(a/5)||1,l=new Array(s+1),u=new Array(c+1),f={},p=[],d,m;for(d=0;d<s+1;d++){var h=km(...e,d/s);l[d]={x:h.x,y:h.y,t:d/s}}for(d=0;d<c+1;d++)h=km(...t,d/c),u[d]={x:h.x,y:h.y,t:d/c};for(d=0;d<s;d++)for(m=0;m<c;m++){var y=l[d],v=l[d+1],g=u[m],b=u[m+1],x=rr(v.x-y.x)<.01?"y":"x",C=rr(b.x-g.x)<.01?"y":"x",M=ER(y.x,y.y,v.x,v.y,g.x,g.y,b.x,b.y),k;if(M){if(k=M.x.toFixed(9)+"#"+M.y.toFixed(9),f[k])continue;f[k]=!0;var P=y.t+rr((M[x]-y[x])/(v[x]-y[x]))*(v.t-y.t),B=g.t+rr((M[C]-g[C])/(b[C]-g[C]))*(b.t-g.t);P>=0&&P<=1&&B>=0&&B<=1&&p.push({x:M.x,y:M.y,t1:P,t2:B})}}return p}function Lm(e,t,n){e=Fm(e),t=Fm(t);for(var i,r,o,a,s,c,l,u,f,p,d=n?0:[],m=0,h=e.length;m<h;m++){var y=e[m];if(y[0]=="M")i=s=y[1],r=c=y[2];else{y[0]=="C"?(f=[i,r,...y.slice(1)],i=f[6],r=f[7]):(f=[i,r,i,r,s,c,s,c],i=s,r=c);for(var v=0,g=t.length;v<g;v++){var b=t[v];if(b[0]=="M")o=l=b[1],a=u=b[2];else{b[0]=="C"?(p=[o,a,...b.slice(1)],o=p[6],a=p[7]):(p=[o,a,o,a,l,u,l,u],o=l,a=u);var x=SR(f,p);{for(var C=0,M=x.length;C<M;C++)x[C].segment1=m,x[C].segment2=v,x[C].bez1=f,x[C].bez2=p;d=d.concat(x)}}}}}return d}function RR(e){return Tm(e)&&Tm(e[0])}function CR(e){if(bR(e))return e;var t=new Array(e.length),n=0,i=0,r=0,o=0,a=0,s;e[0][0]=="M"&&(n=+e[0][1],i=+e[0][2],r=n,o=i,a++,t[0]=["M",n,i]);for(var c,l,u=a,f=e.length;u<f;u++){if(l=e[u],s=l[0],t[u]=c=new Array(l.length),s!=s.toUpperCase())switch(c[0]=s.toUpperCase(),c[0]){case"A":c[1]=l[1],c[2]=l[2],c[3]=l[3],c[4]=l[4],c[5]=l[5],c[6]=+l[6]+n,c[7]=+l[7]+i;break;case"V":c[1]=+l[1]+i;break;case"H":c[1]=+l[1]+n;break;case"M":r=+l[1]+n,o=+l[2]+i;default:for(var p=1,d=l.length;p<d;p++)c[p]=+l[p]+(p%2?n:i)}else for(var m=0,h=l.length;m<h;m++)c[m]=l[m];switch(s=s.toUpperCase(),c[0]){case"Z":n=+r,i=+o;break;case"H":n=c[1];break;case"V":i=c[1];break;case"M":r=c[c.length-2],o=c[c.length-1];default:n=c[c.length-2],i=c[c.length-1]}}return t.toString=Wu,t}function Bm(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function Gs(e,t,n,i){return[e,t,n,i,n,i]}function Nm(e,t,n,i,r,o){var a=.3333333333333333,s=2/3;return[a*e+s*n,a*t+s*i,a*r+s*n,a*o+s*i,r,o]}function $m(e,t,n,i,r,o,a,s,c,l){var u=ir*120/180,f=ir/180*(+r||0),p=[],d,m=yR(function(T,w,E){var G=T*jt.cos(E)-w*jt.sin(E),U=T*jt.sin(E)+w*jt.cos(E);return{x:G,y:U}});if(l)k=l[0],P=l[1],C=l[2],M=l[3];else{d=m(e,t,-f),e=d.x,t=d.y,d=m(s,c,-f),s=d.x,c=d.y;var h=(e-s)/2,y=(t-c)/2,v=h*h/(n*n)+y*y/(i*i);v>1&&(v=jt.sqrt(v),n=v*n,i=v*i);var g=n*n,b=i*i,x=(o==a?-1:1)*jt.sqrt(rr((g*b-g*y*y-b*h*h)/(g*y*y+b*h*h))),C=x*n*y/i+(e+s)/2,M=x*-i*h/n+(t+c)/2,k=jt.asin(((t-M)/i).toFixed(9)),P=jt.asin(((c-M)/i).toFixed(9));k=e<C?ir-k:k,P=s<C?ir-P:P,k<0&&(k=ir*2+k),P<0&&(P=ir*2+P),a&&k>P&&(k=k-ir*2),!a&&P>k&&(P=P-ir*2)}var B=P-k;if(rr(B)>u){var D=P,I=s,z=c;P=k+u*(a&&P>k?1:-1),s=C+n*jt.cos(P),c=M+i*jt.sin(P),p=$m(s,c,n,i,r,0,a,I,z,[P,D,C,M])}B=P-k;var oe=jt.cos(k),ye=jt.sin(k),Ve=jt.cos(P),He=jt.sin(P),it=jt.tan(B/4),K=4/3*n*it,Z=4/3*i*it,se=[e,t],xe=[e+K*ye,t-Z*oe],q=[s+K*He,c-Z*Ve],V=[s,c];if(xe[0]=2*se[0]-xe[0],xe[1]=2*se[1]-xe[1],l)return[xe,q,V].concat(p);p=[xe,q,V].concat(p).join().split(",");for(var ne=[],Te=0,yt=p.length;Te<yt;Te++)ne[Te]=Te%2?m(p[Te-1],p[Te],f).y:m(p[Te],p[Te+1],f).x;return ne}function AR(e,t,n,i,r,o,a,s){for(var c=[],l=[[],[]],u,f,p,d,m,h,y,v,g=0;g<2;++g){if(g==0?(f=6*e-12*n+6*r,u=-3*e+9*n-9*r+3*a,p=3*n-3*e):(f=6*t-12*i+6*o,u=-3*t+9*i-9*o+3*s,p=3*i-3*t),rr(u)<1e-12){if(rr(f)<1e-12)continue;d=-p/f,0<d&&d<1&&c.push(d);continue}y=f*f-4*p*u,v=jt.sqrt(y),!(y<0)&&(m=(-f+v)/(2*u),0<m&&m<1&&c.push(m),h=(-f-v)/(2*u),0<h&&h<1&&c.push(h))}for(var b=c.length,x=b,C;b--;)d=c[b],C=1-d,l[0][b]=C*C*C*e+3*C*C*d*n+3*C*d*d*r+d*d*d*a,l[1][b]=C*C*C*t+3*C*C*d*i+3*C*d*d*o+d*d*d*s;return l[0][x]=e,l[1][x]=t,l[0][x+1]=a,l[1][x+1]=s,l[0].length=l[1].length=x+2,{x0:bi(...l[0]),y0:bi(...l[1]),x1:xi(...l[0]),y1:xi(...l[1])}}function Fm(e){if(RR(e)||(e=vR(e)),xR(e))return e;for(var t=_R(CR(e)),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i=function(p,d,m){var h,y;if(!p)return["C",d.x,d.y,d.x,d.y,d.x,d.y];switch(!(p[0]in{T:1,Q:1})&&(d.qx=d.qy=null),p[0]){case"M":d.X=p[1],d.Y=p[2];break;case"A":p=["C",...$m(d.x,d.y,...p.slice(1))];break;case"S":m=="C"||m=="S"?(h=d.x*2-d.bx,y=d.y*2-d.by):(h=d.x,y=d.y),p=["C",h,y,...p.slice(1)];break;case"T":m=="Q"||m=="T"?(d.qx=d.x*2-d.qx,d.qy=d.y*2-d.qy):(d.qx=d.x,d.qy=d.y),p=["C",...Nm(d.x,d.y,d.qx,d.qy,p[1],p[2])];break;case"Q":d.qx=p[1],d.qy=p[2],p=["C",...Nm(d.x,d.y,p[1],p[2],p[3],p[4])];break;case"L":p=["C",...Gs(d.x,d.y,p[1],p[2])];break;case"H":p=["C",...Gs(d.x,d.y,p[1],d.y)];break;case"V":p=["C",...Gs(d.x,d.y,d.x,p[1])];break;case"Z":p=["C",...Gs(d.x,d.y,d.X,d.Y)];break}return p},r=function(p,d){if(p[d].length>7){p[d].shift();for(var m=p[d];m.length;)o[d]="A",p.splice(d++,0,["C",...m.splice(0,6)]);p.splice(d,1),l=t.length}},o=[],a="",s="",c=0,l=t.length;c<l;c++){t[c]&&(a=t[c][0]),a!="C"&&(o[c]=a,c&&(s=o[c-1])),t[c]=i(t[c],n,s),o[c]!="A"&&a=="C"&&(o[c]="C"),r(t,c);var u=t[c],f=u.length;n.x=u[f-2],n.y=u[f-1],n.bx=Pm(u[f-4])||n.x,n.by=Pm(u[f-3])||n.y}return t}function ht(e){return Qt(e)&&Mn(e,"waypoints")}function Ye(e){return Qt(e)&&Mn(e,"labelTarget")}function PR(e){return Qt(e)&&io(e.parent)}function jm(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function Bi(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function Ie(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function Vs(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function MR(e){return Bi({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function TR(e){for(var t=e.waypoints,n=t.reduce(function(l,u,f){var p=t[f-1];if(p){var d=l[l.length-1],m=d&&d.endLength||0,h=DR(p,u);l.push({start:p,end:u,startLength:m,endLength:m+h,length:h})}return l},[]),i=n.reduce(function(l,u){return l+u.length},0),r=i/2,o=0,a=n[o];a.endLength<r;)a=n[++o];var s=(r-a.startLength)/a.length,c={x:a.start.x+(a.end.x-a.start.x)*s,y:a.start.y+(a.end.y-a.start.y)*s};return c}function Ne(e){return ht(e)?TR(e):MR(e)}function cn(e,t,n){n=n||0,Qt(n)||(n={x:n,y:n});var i=Ie(e),r=Ie(t),o=i.bottom+n.y<=r.top,a=i.left-n.x>=r.right,s=i.top-n.y>=r.bottom,c=i.right+n.x<=r.left,l=o?"top":s?"bottom":null,u=c?"left":a?"right":null;return u&&l?l+"-"+u:u||l||"intersect"}function da(e,t,n){var i=kR(e,t);return i.length===1||i.length===2&&fa(i[0],i[1])<1?Bi(i[0]):i.length>1?(i=di(i,function(r){var o=Math.floor(r.t2*100)||1;return o=100-o,o=(o<10?"0":"")+o,r.segment2+"#"+o}),Bi(i[n?0:i.length-1])):null}function kR(e,t){return Lm(e,t)}function OR(e){e=e.slice();for(var t=0,n,i,r;e[t];)n=e[t],i=e[t-1],r=e[t+1],fa(n,r)===0||zu(i,r,n)?e.splice(t,1):t++;return e}function DR(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Ws(e,t){return Math.round(e*t)/t}function Hm(e){return Fe(e)?e+"px":e}function IR(e){for(;e.parent;)e=e.parent;return e}function LR(e){e=W({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),wn(n,{position:"relative",overflow:"hidden",width:Hm(e.width),height:Hm(e.height)}),t.appendChild(n),n}function zm(e,t,n){const i=Oe("g");et(i).add(t);const r=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}const BR="base",Gm=0,NR=1,$R={shape:["x","y","width","height"],connection:["waypoints"]};function $e(e,t,n,i){this._eventBus=t,this._elementRegistry=i,this._graphicsFactory=n,this._rootsIdx=0,this._layers={},this._planes=[],this._rootElement=null,this._focused=!1,this._init(e||{})}$e.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],$e.prototype._init=function(e){const t=this._eventBus,n=this._container=LR(e),i=this._svg=Oe("svg");Se(i,{width:"100%",height:"100%"}),gn(i,"tabindex",0),e.autoFocus&&t.on("element.hover",()=>{this.restoreFocus()}),t.on("element.mousedown",500,o=>{this.focus()}),i.addEventListener("focusin",()=>{this._setFocused(!0)}),i.addEventListener("focusout",()=>{this._setFocused(!1)}),i.addEventListener("mouseover",()=>{this._eventBus.fire("canvas.mouseover")}),i.addEventListener("mouseout",()=>{this._eventBus.fire("canvas.mouseout")}),ze(n,i);const r=this._viewport=zm(i,"viewport");e.deferUpdate&&(this._viewboxChanged=Zl(this._viewboxChanged,300)),this._restoreFocus=Zl(this._restoreFocus,0),t.on("diagram.init",()=>{t.fire("canvas.init",{svg:i,viewport:r})}),t.on(["shape.added","connection.added","shape.removed","connection.removed","elements.changed","root.set"],()=>{delete this._cachedViewbox}),t.on("diagram.destroy",500,this._destroy,this),t.on("diagram.clear",500,this._clear,this)},$e.prototype._destroy=function(){this._restoreFocus.cancel(),this._eventBus.fire("canvas.destroy",{svg:this._svg,viewport:this._viewport});const e=this._container.parentNode;e&&e.removeChild(this._container),delete this._svg,delete this._container,delete this._layers,delete this._planes,delete this._rootElement,delete this._viewport},$e.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},$e.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=Rm(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},$e.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},$e.prototype.restoreFocus=function(){this._restoreFocus()},$e.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},$e.prototype.isFocused=function(){return this._focused},$e.prototype.getDefaultLayer=function(){return this.getLayer(BR,Gm)},$e.prototype.getLayer=function(e,t){if(!e)throw new Error("must specify a name");let n=this._layers[e];if(n||(n=this._layers[e]=this._createLayer(e,t)),typeof t<"u"&&n.index!==t)throw new Error("layer <"+e+"> already created at index <"+t+">");return n.group},$e.prototype._getChildIndex=function(e){return Tn(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},$e.prototype._createLayer=function(e,t){typeof t>"u"&&(t=NR);const n=this._getChildIndex(t);return{group:zm(this._viewport,"layer-"+e,n),index:t,visible:!0}},$e.prototype.showLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const n=this._viewport,i=t.group,r=t.index;if(t.visible)return i;const o=this._getChildIndex(r);return n.insertBefore(i,n.childNodes[o]||null),t.visible=!0,i},$e.prototype.hideLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const n=t.group;return t.visible&&(Kt(n),t.visible=!1),n},$e.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],Kt(t.group))},$e.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},$e.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const r=this._findPlaneForRoot(IR(i));if(!r||n&&r.rootElement!==n)return;n=r.rootElement}return n},$e.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},$e.prototype._findPlaneForRoot=function(e){return vt(this._planes,function(t){return t.rootElement===e})},$e.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},$e.prototype._resolveElements=function(e){return Be(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},$e.prototype.getContainer=function(){return this._container},$e.prototype._updateMarker=function(e,t,n){let i;e=this._resolveElement(e),e.markers=e.markers||new Set,i=this._elementRegistry._elements[e.id],i&&(F([i.gfx,i.secondaryGfx],function(r){r&&(n?(e.markers.add(t),et(r).add(t)):(e.markers.delete(t),et(r).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},$e.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},$e.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},$e.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},$e.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},$e.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},$e.prototype.addRootElement=function(e){const t=this._rootsIdx++;e||(e={id:"__implicitroot_"+t,children:[],isImplicit:!0});const n=e.layer="root-"+t;this._ensureValid("root",e);const i=this.getLayer(n,Gm);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},$e.prototype.removeRootElement=function(e){if(e=this._resolveElement(e),!!this._findPlaneForRoot(e))return this._removeRoot(e),this._removeLayer(e.layer),this._planes=this._planes.filter(function(n){return n.rootElement!==e}),this._rootElement===e&&(this._rootElement=null),e},$e.prototype.setRootElement=function(e){if(e===this._rootElement)return e;let t;if(!e)throw new Error("rootElement required");return t=this._findPlaneForRoot(e),t||(e=this.addRootElement(e)),this._setRoot(e),e},$e.prototype._removeRoot=function(e){const t=this._elementRegistry,n=this._eventBus;n.fire("root.remove",{element:e}),n.fire("root.removed",{element:e}),t.remove(e)},$e.prototype._addRoot=function(e,t){const n=this._elementRegistry,i=this._eventBus;i.fire("root.add",{element:e}),n.add(e,t),i.fire("root.added",{element:e,gfx:t})},$e.prototype._setRoot=function(e,t){const n=this._rootElement;n&&(this._elementRegistry.updateGraphics(n,null,!0),this.hideLayer(n.layer)),e&&(t||(t=this._findPlaneForRoot(e).layer),this._elementRegistry.updateGraphics(e,this._svg,!0),this.showLayer(e.layer)),this._rootElement=e,this._eventBus.fire("root.set",{element:e})},$e.prototype._ensureValid=function(e,t){if(!t.id)throw new Error("element must have an id");if(this._elementRegistry.get(t.id))throw new Error("element <"+t.id+"> already exists");const n=$R[e];if(!kr(n,function(r){return typeof t[r]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},$e.prototype._setParent=function(e,t,n){Bt(t.children,e,n),e.parent=t},$e.prototype._addElement=function(e,t,n,i){n=n||this.getRootElement();const r=this._eventBus,o=this._graphicsFactory;this._ensureValid(e,t),r.fire(e+".add",{element:t,parent:n}),this._setParent(t,n,i);const a=o.create(e,t,i);return this._elementRegistry.add(t,a),o.update(e,t,a),r.fire(e+".added",{element:t,gfx:a}),t},$e.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},$e.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},$e.prototype._removeElement=function(e,t){const n=this._elementRegistry,i=this._graphicsFactory,r=this._eventBus;if(e=n.get(e.id||e),!!e)return r.fire(t+".remove",{element:e}),i.remove(e),Lt(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},$e.prototype.removeShape=function(e){return this._removeElement(e,"shape")},$e.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},$e.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},$e.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},$e.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},$e.prototype.viewbox=function(e){if(e===void 0&&this._cachedViewbox)return structuredClone(this._cachedViewbox);const t=this._viewport,n=this.getSize();let i,r,o,a,s,c,l;if(e)this._changeViewbox(function(){s=Math.min(n.width/e.width,n.height/e.height);const u=this._svg.createSVGMatrix().scale(s).translate(-e.x,-e.y);ca(t,u)});else return o=this._rootElement?this.getActiveLayer():null,i=o&&o.getBBox()||{},a=ca(t),r=a?a.matrix:GS(),s=Ws(r.a,1e3),c=Ws(-r.e||0,1e3),l=Ws(-r.f||0,1e3),e=this._cachedViewbox={x:c?c/s:0,y:l?l/s:0,width:n.width/s,height:n.height/s,scale:s,inner:{width:i.width||0,height:i.height||0,x:i.x||0,y:i.y||0},outer:n},e;return e},$e.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=W({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),Vm(t,n)}),{x:n.e,y:n.f}},$e.prototype.scrollToElement=function(e,t){let n=100;const i=this._resolveElements(e);if(!i.length)return;const r=this.findRoot(i);if(!r)return;r!==this.getRootElement()&&this.setRootElement(r);const o=i.filter(m=>m!=r);if(!o.length)return;t||(t={}),typeof t=="number"&&(n=t),t={top:t.top||n,right:t.right||n,bottom:t.bottom||n,left:t.left||n};const a=Ft(o),s=Ie(a),c=this.viewbox(),l=this.zoom();let u,f;c.y+=t.top/l,c.x+=t.left/l,c.width-=(t.right+t.left)/l,c.height-=(t.bottom+t.top)/l;const p=Ie(c);if(!(a.width<c.width&&a.height<c.height))u=a.x-c.x,f=a.y-c.y;else{const m=Math.max(0,s.right-p.right),h=Math.min(0,s.left-p.left),y=Math.max(0,s.bottom-p.bottom),v=Math.min(0,s.top-p.top);u=m||h,f=y||v}this.scroll({dx:-u*l,dy:-f*l})},$e.prototype.zoom=function(e,t){if(!e)return this.viewbox(e).scale;if(e==="fit-viewport")return this._fitViewport(t);let n,i;return this._changeViewbox(function(){typeof t!="object"&&(n=this.viewbox().outer,t={x:n.width/2,y:n.height/2}),i=this._setZoom(e,t)}),Ws(i.a,1e3)};function Vm(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}$e.prototype._fitViewport=function(e){const t=this.viewbox(),n=t.outer,i=t.inner;let r,o;return i.x>=0&&i.y>=0&&i.x+i.width<=n.width&&i.y+i.height<=n.height&&!e?o={x:0,y:0,width:Math.max(i.width+i.x,n.width),height:Math.max(i.height+i.y,n.height)}:(r=Math.min(1,n.width/i.width,n.height/i.height),o={x:i.x+(e?i.width/2-n.width/r/2:0),y:i.y+(e?i.height/2-n.height/r/2:0),width:n.width/r,height:n.height/r}),this.viewbox(o),this.viewbox(!1).scale},$e.prototype._setZoom=function(e,t){const n=this._svg,i=this._viewport,r=n.createSVGMatrix(),o=n.createSVGPoint();let a,s,c,l,u;c=i.getCTM();const f=c.a;return t?(a=W(o,t),s=a.matrixTransform(c.inverse()),l=r.translate(s.x,s.y).scale(1/f*e).translate(-s.x,-s.y),u=c.multiply(l)):u=r.scale(e),Vm(this._viewport,u),u},$e.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},$e.prototype.getAbsoluteBBox=function(e){const t=this.viewbox();let n;e.waypoints?n=this.getGraphics(e).getBBox():n=e;const i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale,o=n.width*t.scale,a=n.height*t.scale;return{x:i,y:r,width:o,height:a}},$e.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var xo="data-element-id";function Un(e){this._elements={},this._eventBus=e}Un.$inject=["eventBus"],Un.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),Se(t,xo,i),n&&Se(n,xo,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},Un.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(Se(i.gfx,xo,""),i.secondaryGfx&&Se(i.secondaryGfx,xo,""),delete t[n])},Un.prototype.updateId=function(e,t){this._validateId(t),typeof e=="string"&&(e=this.get(e)),this._eventBus.fire("element.updateId",{element:e,newId:t});var n=this.getGraphics(e),i=this.getGraphics(e,!0);this.remove(e),e.id=t,this.add(e,n,i)},Un.prototype.updateGraphics=function(e,t,n){var i=e.id||e,r=this._elements[i];return n?r.secondaryGfx=t:r.gfx=t,t&&Se(t,xo,i),t},Un.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&Se(e,xo);var n=this._elements[t];return n&&n.element},Un.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},Un.prototype.find=function(e){for(var t=this._elements,n=Object.keys(t),i=0;i<n.length;i++){var r=n[i],o=t[r],a=o.element,s=o.gfx;if(e(a,s))return a}},Un.prototype.getAll=function(){return this.filter(function(e){return e})},Un.prototype.forEach=function(e){var t=this._elements;Object.keys(t).forEach(function(n){var i=t[n],r=i.element,o=i.gfx;return e(r,o)})},Un.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},Un.prototype._validateId=function(e){if(!e)throw new Error("element must have an id");if(this._elements[e])throw new Error("element with id "+e+" already added")};function FR(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 jR(e){return e.__refs_collection===!0}function HR(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function Wm(e,t,n){var i=FR(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 zR(e,t,n){var i=t.inverse,r=n[t.name];Object.defineProperty(n,t.name,{configurable:t.configurable,enumerable:t.enumerable,get:function(){return r},set:function(o){if(o!==r){var a=r;r=null,a&&e.unset(a,i,n),r=o,e.set(r,i,n)}}})}function Zn(e,t){if(!(this instanceof Zn))return new Zn(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}Zn.prototype.bind=function(e,t){if(typeof t=="string"){if(!this.props[t])throw new Error("no property <"+t+"> in ref");t=this.props[t]}t.collection?Wm(this,t,e):zR(this,t,e)},Zn.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return jR(n)||Wm(this,t,e),n},Zn.prototype.ensureBound=function(e,t){HR(e,t)||this.bind(e,t)},Zn.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},Zn.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var Uu=new Zn({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Um=new Zn({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Ym=new Zn({name:"attachers",collection:!0},{name:"host"}),qm=new Zn({name:"outgoing",collection:!0},{name:"source"}),Km=new Zn({name:"incoming",collection:!0},{name:"target"});function _o(){Object.defineProperty(this,"businessObject",{writable:!0}),Object.defineProperty(this,"label",{get:function(){return this.labels[0]},set:function(e){var t=this.label,n=this.labels;!e&&t?n.remove(t):n.add(e,0)}}),Uu.bind(this,"parent"),Um.bind(this,"labels"),qm.bind(this,"outgoing"),Km.bind(this,"incoming")}function ha(){_o.call(this),Uu.bind(this,"children"),Ym.bind(this,"host"),Ym.bind(this,"attachers")}Ee(ha,_o);function Xm(){_o.call(this),Uu.bind(this,"children")}Ee(Xm,ha);function Zm(){ha.call(this),Um.bind(this,"labelTarget")}Ee(Zm,ha);function Qm(){_o.call(this),qm.bind(this,"source"),Km.bind(this,"target")}Ee(Qm,_o);var GR={connection:Qm,shape:ha,label:Zm,root:Xm};function VR(e,t){var n=GR[e];if(!n)throw new Error("unknown type: <"+e+">");return W(new n,t)}function WR(e){return e instanceof _o}function Ni(){this._uid=12}Ni.prototype.createRoot=function(e){return this.create("root",e)},Ni.prototype.createLabel=function(e){return this.create("label",e)},Ni.prototype.createShape=function(e){return this.create("shape",e)},Ni.prototype.createConnection=function(e){return this.create("connection",e)},Ni.prototype.create=function(e,t){return t=W({},t||{}),t.id||(t.id=e+"_"+this._uid++),VR(e,t)};var Us="__fn",Jm=1e3,UR=Array.prototype.slice;function Dn(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}Dn.prototype.on=function(e,t,n,i){if(e=Be(e)?e:[e],Jt(t)&&(i=n,n=t,t=Jm),!Fe(t))throw new Error("priority must be a number");var r=n;i&&(r=Rn(n,i),r[Us]=n[Us]||n);var o=this;e.forEach(function(a){o._addListener(a,{priority:t,callback:r,next:null})})},Dn.prototype.once=function(e,t,n,i){var r=this;if(Jt(t)&&(i=n,n=t,t=Jm),!Fe(t))throw new Error("priority must be a number");function o(){o.__isTomb=!0;var a=n.apply(i,arguments);return r.off(e,o),a}o[Us]=n,this.on(e,t,o)},Dn.prototype.off=function(e,t){e=Be(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},Dn.prototype.createEvent=function(e){var t=new ma;return t.init(e),t},Dn.prototype.fire=function(e,t){var n,i,r,o;if(o=UR.call(arguments),typeof e=="object"&&(t=e,e=t.type),!e)throw new Error("no event type specified");if(i=this._listeners[e],!!i){t instanceof ma?n=t:n=this.createEvent(t),o[0]=n;var a=n.type;e!==a&&(n.type=e);try{r=this._invokeListeners(n,o,i)}finally{e!==a&&(n.type=a)}return r===void 0&&n.defaultPrevented&&(r=!1),r}},Dn.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},Dn.prototype._destroy=function(){this._listeners={}},Dn.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},Dn.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=YR(n.callback,t),i!==void 0&&(e.returnValue=i,e.stopPropagation()),i===!1&&e.preventDefault()}catch(r){if(!this.handleError(r))throw console.error("unhandled error in event listener",r),r}return i},Dn.prototype._addListener=function(e,t){var n=this._getListeners(e),i;if(!n){this._setListeners(e,t);return}for(;n;){if(n.priority<t.priority){t.next=n,i?i.next=t:this._setListeners(e,t);return}i=n,n=n.next}i.next=t},Dn.prototype._getListeners=function(e){return this._listeners[e]},Dn.prototype._setListeners=function(e,t){this._listeners[e]=t},Dn.prototype._removeListener=function(e,t){var n=this._getListeners(e),i,r,o;if(!t){this._setListeners(e,null);return}for(;n;)i=n.next,o=n.callback,(o===t||o[Us]===t)&&(r?r.next=i:this._setListeners(e,i)),r=n,n=i};function ma(){}ma.prototype.stopPropagation=function(){this.cancelBubble=!0},ma.prototype.preventDefault=function(){this.defaultPrevented=!0},ma.prototype.init=function(e){W(this,e||{})};function YR(e,t){return e.apply(null,t)}function $r(e){return e.childNodes[0]}function qR(e){return e.parentNode.childNodes[1]}function Ys(e,t,n,i,r){var o=sa();o.setTranslate(t,n);var a=sa();a.setRotate(i||0,0,0);var s=sa();s.setScale(1,1),ca(e,[o,a,s])}function ln(e,t,n){var i=sa();i.setTranslate(t,n),ca(e,i)}function eg(e,t){var n=sa();n.setRotate(t,0,0),ca(e,n)}function Yn(e,t){this._eventBus=e,this._elementRegistry=t}Yn.$inject=["eventBus","elementRegistry"],Yn.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=qR(t),n||(n=Oe("g"),et(n).add("djs-children"),ze(t.parentNode,n))):n=t,n},Yn.prototype._clear=function(e){var t=$r(e);return Ls(t),t},Yn.prototype._createContainer=function(e,t,n,i){var r=Oe("g");et(r).add("djs-group"),typeof n<"u"?KR(r,t,t.childNodes[n]):ze(t,r);var o=Oe("g");et(o).add("djs-element"),et(o).add("djs-"+e),i&&et(o).add("djs-frame"),ze(r,o);var a=Oe("g");return et(a).add("djs-visual"),ze(o,a),o},Yn.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,Cm(t))},Yn.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=Tn(e,function(r,o){return o.parent&&(r[o.parent.id]=o.parent),r},{}),F(i,function(r){var o=r.children;if(o){var a=t._getChildrenContainer(r),s=a.firstChild;F(o,function(c){var l=n.getGraphics(c).parentNode;l===s?s=s.nextSibling:a.insertBefore(l,s)})}})},Yn.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},Yn.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},Yn.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},Yn.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},Yn.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),ln(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?Se(n,"display","none"):Se(n,"display","block")}},Yn.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);Kt(t.parentNode)};function KR(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const XR={__depends__:[lR],__init__:["canvas"],canvas:["type",$e],elementRegistry:["type",Un],elementFactory:["type",Ni],eventBus:["type",Dn],graphicsFactory:["type",Yn]};function ZR(e){var t=new Sm(e);return t.init(),t}function QR(e){e=e||{};var t={config:["value",e]},n=[t,XR].concat(e.modules||[]);return ZR(n)}function ar(e,t){this._injector=t||QR(e),this.get("eventBus").fire("diagram.init")}ar.prototype.get=function(e,t){return this._injector.get(e,t)},ar.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},ar.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},ar.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function yn(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function Cn(e,t){return e.$instanceOf(t)}function JR(e){return vt(e.rootElements,function(t){return Cn(t,"bpmn:Process")||Cn(t,"bpmn:Collaboration")})}function eC(e){var t={},n=[],i={};function r(q,V){return function(ne){q(ne,V)}}function o(q){t[q.id]=q}function a(q){return t[q.id]}function s(q,V){var ne=q.gfx;if(ne)throw new Error(`already rendered ${yn(q)}`);return e.element(q,i[q.id],V)}function c(q,V){return e.root(q,i[q.id],V)}function l(q,V){try{var ne=i[q.id]&&s(q,V);return o(q),ne}catch(Te){u(Te.message,{element:q,error:Te}),console.error(`failed to import ${yn(q)}`,Te)}}function u(q,V){e.error(q,V)}var f=this.registerDi=function(V){var ne=V.bpmnElement;ne?i[ne.id]?u(`multiple DI elements defined for ${yn(ne)}`,{element:ne}):i[ne.id]=V:u(`no bpmnElement referenced in ${yn(V)}`,{element:V})};function p(q){d(q.plane)}function d(q){f(q),F(q.planeElement,m)}function m(q){f(q)}this.handleDefinitions=function(V,ne){var Te=V.diagrams;if(ne&&Te.indexOf(ne)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!ne&&Te&&Te.length&&(ne=Te[0]),!ne)throw new Error("no diagram to display");i={},p(ne);var yt=ne.plane;if(!yt)throw new Error(`no plane for ${yn(ne)}`);var T=yt.bpmnElement;if(!T)if(T=JR(V),T)u(`correcting missing bpmnElement on ${yn(yt)} to ${yn(T)}`),yt.bpmnElement=T,f(yt);else throw new Error("no process or collaboration to display");var w=c(T,yt);if(Cn(T,"bpmn:Process")||Cn(T,"bpmn:SubProcess"))y(T,w);else if(Cn(T,"bpmn:Collaboration"))se(T,w),v(V.rootElements,w);else throw new Error(`unsupported bpmnElement for ${yn(yt)}: ${yn(T)}`);h(n)};var h=this.handleDeferred=function(){for(var V;n.length;)V=n.shift(),V()};function y(q,V){it(q,V),B(q.ioSpecification,V),P(q.artifacts,V),o(q)}function v(q,V){var ne=Ke(q,function(Te){return!a(Te)&&Cn(Te,"bpmn:Process")&&Te.laneSets});ne.forEach(r(y,V))}function g(q,V){l(q,V)}function b(q,V){F(q,r(g,V))}function x(q,V){l(q,V)}function C(q,V){l(q,V)}function M(q,V){l(q,V)}function k(q,V){l(q,V)}function P(q,V){F(q,function(ne){Cn(ne,"bpmn:Association")?n.push(function(){k(ne,V)}):k(ne,V)})}function B(q,V){q&&(F(q.dataInputs,r(C,V)),F(q.dataOutputs,r(M,V)))}var D=this.handleSubProcess=function(V,ne){it(V,ne),P(V.artifacts,ne)};function I(q,V){var ne=l(q,V);Cn(q,"bpmn:SubProcess")&&D(q,ne||V),Cn(q,"bpmn:Activity")&&B(q.ioSpecification,V),n.push(function(){F(q.dataInputAssociations,r(x,V)),F(q.dataOutputAssociations,r(x,V))})}function z(q,V){l(q,V)}function oe(q,V){l(q,V)}function ye(q,V){n.push(function(){var ne=l(q,V);q.childLaneSet&&Ve(q.childLaneSet,ne||V),xe(q)})}function Ve(q,V){F(q.lanes,r(ye,V))}function He(q,V){F(q,r(Ve,V))}function it(q,V){K(q.flowElements,V),q.laneSets&&He(q.laneSets,V)}function K(q,V){F(q,function(ne){Cn(ne,"bpmn:SequenceFlow")?n.push(function(){z(ne,V)}):Cn(ne,"bpmn:BoundaryEvent")?n.unshift(function(){I(ne,V)}):Cn(ne,"bpmn:FlowNode")?I(ne,V):Cn(ne,"bpmn:DataObject")||(Cn(ne,"bpmn:DataStoreReference")||Cn(ne,"bpmn:DataObjectReference")?oe(ne,V):u(`unrecognized flowElement ${yn(ne)} in context ${yn(V&&V.businessObject)}`,{element:ne,context:V}))})}function Z(q,V){var ne=l(q,V),Te=q.processRef;Te&&y(Te,ne||V)}function se(q,V){F(q.participants,r(Z,V)),n.push(function(){b(q.messageFlows,V)}),P(q.artifacts,V)}function xe(q){F(q.flowNodeRef,function(V){var ne=V.get("lanes");ne&&ne.push(q)})}}function S(e,t){var n=ie(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function qe(e,t){return Xi(t,function(n){return S(e,n)})}function ie(e){return e&&e.businessObject||e}function ot(e){return e&&e.di}function tC(e,t,n){var i,r,o,a,s=[];function c(l,u){var f={root:function(h,y){return i.add(h,y)},element:function(h,y,v){return i.add(h,y,v)},error:function(h,y){s.push({message:h,context:y})}},p=new eC(f);u=u||l.diagrams&&l.diagrams[0];var d=nC(l,u);if(!d)throw new Error("no diagram to display");F(d,function(h){p.handleDefinitions(l,h)});var m=u.plane.bpmnElement.id;o.setRootElement(o.findRoot(m+"_plane")||o.findRoot(m))}return new Promise(function(l,u){try{return i=e.get("bpmnImporter"),r=e.get("eventBus"),o=e.get("canvas"),r.fire("import.render.start",{definitions:t}),c(t,n),r.fire("import.render.complete",{error:a,warnings:s}),l({warnings:s})}catch(f){return f.warnings=s,u(f)}})}function nC(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!S(n,"bpmn:Process")&&!S(n,"bpmn:Collaboration")&&(i=iC(n));var r;S(i,"bpmn:Collaboration")?r=i:r=vt(e.rootElements,function(l){if(S(l,"bpmn:Collaboration"))return vt(l.participants,function(u){return u.processRef===i})});var o=[i];r&&(o=hn(r.participants,function(l){return l.processRef}),o.push(r));var a=tg(o),s=[t],c=[n];return F(e.diagrams,function(l){if(l.plane){var u=l.plane.bpmnElement;a.indexOf(u)!==-1&&c.indexOf(u)===-1&&(s.push(l),c.push(u))}}),s}}function tg(e){var t=[];return F(e,function(n){n&&(t.push(n),t=t.concat(tg(n.flowElements)))}),t}function iC(e){for(var t=e;t;){if(S(t,"bpmn:Process"))return t;t=t.$parent}}var rC='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.02 5.57" width="53" height="21"><path fill="currentColor" d="M1.88.92v.14c0 .41-.13.68-.4.8.33.14.46.44.46.86v.33c0 .61-.33.95-.95.95H0V0h.95c.65 0 .93.3.93.92zM.63.57v1.06h.24c.24 0 .38-.1.38-.43V.98c0-.28-.1-.4-.32-.4zm0 1.63v1.22h.36c.2 0 .32-.1.32-.39v-.35c0-.37-.12-.48-.4-.48H.63zM4.18.99v.52c0 .64-.31.98-.94.98h-.3V4h-.62V0h.92c.63 0 .94.35.94.99zM2.94.57v1.35h.3c.2 0 .3-.09.3-.37v-.6c0-.29-.1-.38-.3-.38h-.3zm2.89 2.27L6.25 0h.88v4h-.6V1.12L6.1 3.99h-.6l-.46-2.82v2.82h-.55V0h.87zM8.14 1.1V4h-.56V0h.79L9 2.4V0h.56v4h-.64zm2.49 2.29v.6h-.6v-.6zM12.12 1c0-.63.33-1 .95-1 .61 0 .95.37.95 1v2.04c0 .64-.34 1-.95 1-.62 0-.95-.37-.95-1zm.62 2.08c0 .28.13.39.33.39s.32-.1.32-.4V.98c0-.29-.12-.4-.32-.4s-.33.11-.33.4z"/><path fill="currentColor" d="M0 4.53h14.02v1.04H0zM11.08 0h.63v.62h-.63zm.63 4V1h-.63v2.98z"/></svg>',ng=rC,ig={verticalAlign:"middle"},rg={color:"#404040"},oC={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},aC={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},sC={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"},cC='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+ng+'</a><span>Web-based tooling for BPMN, DMN and forms powered by <a href="https://bpmn.io" target="_blank" rel="noopener">bpmn.io</a>.</span></div></div>',_i;function lC(){_i=wt(cC),wn(_i,oC),wn(ft("svg",_i),ig),wn(ft(".backdrop",_i),aC),wn(ft(".notice",_i),sC),wn(ft(".link",_i),rg,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function uC(){_i||(lC(),On.bind(_i,".backdrop","click",function(e){document.body.removeChild(_i)})),document.body.appendChild(_i)}const qs=5,og="djs-outline-hidden";function Pt(e){e=W({},fC,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),hC(this._container)}Ee(Pt,ar),Pt.prototype.importXML=async function(t,n){const i=this;function r(a){return i.get("eventBus").createEvent(a)}let o=[];try{t=this._emit("import.parse.start",{xml:t})||t;let a;try{a=await this._moddle.fromXML(t,"bpmn:Definitions")}catch(p){throw this._emit("import.parse.complete",{error:p}),p}let s=a.rootElement;const c=a.references,l=a.warnings,u=a.elementsById;o=o.concat(l),s=this._emit("import.parse.complete",r({error:null,definitions:s,elementsById:u,references:c,warnings:o}))||s;const f=await this.importDefinitions(s,n);return o=o.concat(f.warnings),this._emit("import.done",{error:null,warnings:o}),{warnings:o}}catch(a){let s=a;throw o=o.concat(s.warnings||[]),Ks(s,o),s=pC(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},Pt.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},Pt.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const o=new Error("no XML imported");throw Ks(o,[]),o}if(typeof t=="string"&&(i=dC(n,t),!i)){const o=new Error("BPMNDiagram <"+t+"> not found");throw Ks(o,[]),o}try{this.clear()}catch(o){throw Ks(o,[]),o}const{warnings:r}=await tC(this,n,i);return{warnings:r}},Pt.prototype.saveXML=async function(t){t=t||{};let n=this._definitions,i,r;try{if(!n)throw new Error("no definitions loaded");n=this._emit("saveXML.start",{definitions:n})||n,r=(await this._moddle.toXML(n,t)).xml,r=this._emit("saveXML.serialized",{xml:r})||r}catch(a){i=a}const o=i?{error:i}:{xml:r};if(this._emit("saveXML.done",o),i)throw i;return o},Pt.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),r=i.getActiveLayer(),o=ft(":scope > defs",i._svg),a=Em(r),s=o?"<defs>"+Em(o)+"</defs>":"",c=i.getContainer();Ct(c).add(og);let l;try{l=r.getBBox()}finally{Ct(c).remove(og)}const u=l.x-qs,f=l.y-qs,p=l.width+qs*2,d=l.height+qs*2;t=`<?xml version="1.0" encoding="utf-8"?>
|
|
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 mE(e){e=W({format:!1,preamble:!0},e||{});function t(n,i){var r=i||new dE,o=new hE(r,e.format);e.preamble&&o.append(J0);var a=new St,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(gE(s)),a.build(n).serializeTo(o),!i)return r.value}return{toXML:t}}function gE(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in iu)n[i]=iu[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 bs(e,t){Xn.call(this,e,t)}bs.prototype=Object.create(Xn.prototype),bs.prototype.fromXML=function(e,t,n){Pn(t)||(n=t,t="bpmn:Definitions");var i=new su(W({model:this,lax:!0},n)),r=i.handler(t);return i.fromXML(e,r)},bs.prototype.toXML=function(e,t){var n=new mE(t);return new Promise(function(i,r){try{var o=n.toXML(e);return i({xml:o})}catch(a){return r(a)}})};var yE="BPMN20",vE="http://www.omg.org/spec/BPMN/20100524/MODEL",bE="bpmn",xE=[],_E=[{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"}]}],wE=[{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"}]}],EE={tagAlias:"lowerCase",typePrefix:"t"},SE={name:yE,uri:vE,prefix:bE,associations:xE,types:_E,enumerations:wE,xml:EE},RE="BPMNDI",CE="http://www.omg.org/spec/BPMN/20100524/DI",AE="bpmndi",PE=[{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"]}],ME=[{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"}]}],TE=[],kE={name:RE,uri:CE,prefix:AE,types:PE,enumerations:ME,associations:TE},OE="DC",DE="http://www.omg.org/spec/DD/20100524/DC",IE="dc",LE=[{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}]}],BE=[],NE={name:OE,uri:DE,prefix:IE,types:LE,associations:BE},$E="DI",FE="http://www.omg.org/spec/DD/20100524/DI",jE="di",HE=[{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"}]}],zE=[],GE={tagAlias:"lowerCase"},VE={name:$E,uri:FE,prefix:jE,types:HE,associations:zE,xml:GE},WE="bpmn.io colors for BPMN",UE="http://bpmn.io/schema/bpmn/biocolor/1.0",YE="bioc",qE=[{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"}]}],KE=[],XE=[],ZE={name:WE,uri:UE,prefix:YE,types:qE,enumerations:KE,associations:XE},QE="BPMN in Color",JE="http://www.omg.org/spec/BPMN/non-normative/color/1.0",e1="color",t1=[{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"}]}],n1=[],i1=[],r1={name:QE,uri:JE,prefix:e1,types:t1,enumerations:n1,associations:i1};const o1={bpmn:SE,bpmndi:kE,dc:NE,di:VE,bioc:ZE,color:r1};function eh(e,t){const n=W({},o1,e);return new bs(n,t)}const a1={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"}},s1="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",th="i18n",xs={[th]:a1,[Ul]:Td};function nh(){return eh(xs)}const ih=nh();async function lo(e){const{rootElement:t,warnings:n}=await ih.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function c1(e){const{xml:t}=await ih.toXML(e,{format:!0});return t}function uu(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const uo={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},l1=/[ᄀ-ᇿ -〿-ヿ㐀-鿿가--⦆]/;function u1(e){const t=uo;return l1.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 po(e,t){let n=0;for(const i of e)n+=t*u1(i);return n}function rh(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&p1(e),f1(e),d1(e),h1(e)}function p1(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:po(r,o),fontBoundingBoxAscent:o*uo.ascentEm,fontBoundingBoxDescent:o*uo.descentEm,actualBoundingBoxAscent:o*uo.ascentEm,actualBoundingBoxDescent:o*uo.descentEm}}};t.getContext=()=>n}function f1(e){if(e.SVGMatrix)return;class t{constructor(){no(this,"a",1);no(this,"b",0);no(this,"c",0);no(this,"d",1);no(this,"e",0);no(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 d1(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,f=Math.cos(u),p=Math.sin(u);a.a=f,a.b=p,a.c=-p,a.d=f,a.e=c-f*c+p*l,a.f=l-p*c-f*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 h1(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:po(n,12),height:14}})}const _s=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),m1=new Set(["bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),g1=1,pu=new Set(["bpmn:TextAnnotation","bpmn:DataStoreReference","bpmn:DataObjectReference","bpmn:DataInput","bpmn:DataOutput"]),y1=2;function Rt(e){switch(e.kind){case"label-over-line":return`L|${e.edge}|${e.line}`;case"edge-crosses-shape":return`x|${e.edge}|${e.shape}`;case"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"pool-name-over-label":return`pn|${e.pool}|${e.label}`}}const oh=20,ws=5,ah=3,v1=8,sh=12,b1=sh*1.2;function fu(e,t){const n=t.split(/\r?\n/),i=Math.max(...n.map(o=>po(o,sh))),r=n.length*b1;return{x:e.x+e.width/2-i/2,y:e.y+e.height/2-r/2,width:i,height:r}}const ch=1;function _n(e){const t=[];for(let n=0;n+1<e.waypoints.length;n++){const i=e.waypoints[n],r=e.waypoints[n+1];Math.abs(i.y-r.y)<.5&&Math.abs(i.x-r.x)>=.5?t.push({axis:"h",at:i.y,lo:Math.min(i.x,r.x),hi:Math.max(i.x,r.x),dir:r.x>i.x?1:-1}):Math.abs(i.x-r.x)<.5&&Math.abs(i.y-r.y)>=.5&&t.push({axis:"v",at:i.x,lo:Math.min(i.y,r.y),hi:Math.max(i.y,r.y),dir:r.y>i.y?1:-1})}return t}function fo(e,t){let n=null;const i=e.type!==t.type,o=!!(e.source&&e.target&&t.source&&t.target)&&e.source!==t.source&&e.source!==t.target&&e.target!==t.source&&e.target!==t.target;for(const a of _n(e))for(const s of _n(t)){if(a.axis!==s.axis||Math.abs(a.at-s.at)>ch)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>=oh&&(!n||l>n.length)&&(n={axis:a.axis,length:l,kind:c})}return n}function du(e){return e.kind==="edge-overlap-opposite"||e.kind==="edge-overlap-mixed"||e.kind==="edge-overlap-unrelated"}function lh(e,t){const n=fo(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function x1(e,t){let n=0;for(const i of t)i.id!==e.id&&lh(e,i)&&n++;return n}function Gn(e,t){let n=0;for(const i of t)i.id!==e.id&&fo(e,i)&&n++;return n}const uh=15,ph=20;function _1(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-ph||t.at>n[1]+ph)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 hu=20;function Es(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>ch)continue;const r=Math.max(e.lo,i.lo),o=Math.min(e.hi,i.hi);o-r<oh||n.push([r-hu,o+hu])}return n}function Ss(e,t){const n=e.label;if(!n)return null;let i=null;for(const r of _n(e)){const o=_1(n,r);if(o){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of Es(r,_n(a)))if(Math.min(c,o[1])>Math.max(s,o[0])){i={other:a.id,axis:r.axis};break}}}}return i}const w1=10,E1=1,S1=(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 R1(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,f=1;const p=(d,m)=>{if(m===0)return d<=0;const h=d/m;if(m>0){if(h>f)return!1;h>u&&(u=h)}else{if(h<u)return!1;h<f&&(f=h)}return!0};return p(r-e.x,c)&&p(e.x-a,-c)&&p(o-e.y,l)&&p(e.y-s,-l)&&f>u}function mu(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 C1=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,ho=1;function Oi(e,t){const n=e.x+ho,i=e.x+e.width-ho,r=e.y+ho,o=e.y+e.height-ho;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 oa(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 fh(e,t){const n=e.label;if(!n)return null;if(_n(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(_n(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(oa(i).some(r=>Oi(n,r)))return i.id;return null}function an(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(R1(e.waypoints[o],e.waypoints[o+1],r,y1)){i.push(r);break}}return i}function A1(e,t,n,i){const r=(l,u,f)=>(u.x-l.x)*(f.y-l.y)-(u.y-l.y)*(f.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 dh=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function aa(e,t){let n=0;for(const i of t){if(i.id===e.id||dh(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++)A1(e.waypoints[o],e.waypoints[o+1],i.waypoints[a],i.waypoints[a+1])&&(r=!0);r&&n++}return n}function Vn(e,t){let n=0;for(const i of t)i.id===e.id||dh(e,i)||aa(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function hh(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++)aa(n[i],[n[r]])>0&&(t+=n[i].type===n[r].type?2:1);return t}function Rs(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)if(aa(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 mh(e){const t=Rs(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),f=n(l.type);u==="solid"&&f==="solid"?r++:u==="dashed"&&f==="dashed"&&o++}return{pairs:t,solidPairs:r,dashedPairs:o,mixedPairs:t.length-r-o,crossPoolMessages:P1(e)}}function P1(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 gh(e,t,n){const i=new Set(t.flatMap(r=>[...r.members]));return e.shapes.filter(r=>!r.container&&!pu.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 yh(e){var n;const t=(n=Et(e==null?void 0:e.extensionElements))==null?void 0:n.values;if(Array.isArray(t))for(const i of t){const r=Et(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 vh=e=>e?{members:e}:{},Wn=e=>e.shapes.filter(t=>!t.container);function M1(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 T1(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 bh(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(_n(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(oa(i).some(r=>Oi(n,r)))return i.id;return null}function mo(e){const t=[];for(const n of e.shapes)n.label&&t.push({owner:n.id,rect:n.label});for(const n of e.edges)n.label&&t.push({owner:n.id,rect:n.label});return t}function At(e){const t=[],n=e.shapes.filter(v=>!v.container);for(const v of e.edges)for(const g of an(v,n))t.push({kind:"edge-crosses-shape",edge:v.id,shape:g.id});const i=e.shapes.filter(v=>v.container&&m1.has(v.type));if(i.length){const v=(g,b)=>{const x=e.shapes.find(C=>C.id===b);return!!x&&x.x>=g.x&&x.y>=g.y&&x.x+x.width<=g.x+g.width&&x.y+x.height<=g.y+g.height};for(const g of e.edges)for(const b of an(g,i))g.endpoints.includes(b.id)||g.endpoints.some(x=>v(b,x))||t.push({kind:"edge-crosses-subprocess",edge:g.id,subProcess:b.id})}for(const v of e.edges){if(v.waypoints.length<2)continue;const g=[[v.source,v.waypoints[0]],[v.target,v.waypoints[v.waypoints.length-1]]];for(const[b,x]of g){if(!b)continue;const C=e.shapes.find(B=>B.id===b);if(!C||C.container)continue;const M=Math.max(C.x-x.x,x.x-(C.x+C.width),0),k=Math.max(C.y-x.y,x.y-(C.y+C.height),0),P=Math.hypot(M,k);P>w1&&t.push({kind:"edge-endpoint-detached",edge:v.id,shape:b,distance:Math.round(P)})}}const r=e.shapes.filter(v=>v.type==="bpmn:Participant");for(let v=0;v<r.length;v++)for(let g=v+1;g<r.length;g++){const b=r[v],x=r[g];if(b.x+b.width<=x.x||x.x+x.width<=b.x||b.y+b.height<=x.y||x.y+x.height<=b.y)continue;const C=(M,k)=>M.x<=k.x&&M.y<=k.y&&M.x+M.width>=k.x+k.width&&M.y+M.height>=k.y+k.height;t.push({kind:"pool-overlap",pools:[b.id,x.id],contained:C(b,x)||C(x,b)})}const o=n.filter(v=>!v.attached);for(let v=0;v<o.length;v++)for(let g=v+1;g<o.length;g++){const b=o[v],x=o[g];if(!mu(b,x,g1))continue;const C=b.id<x.id?[b.id,x.id]:[x.id,b.id];t.push({kind:"shape-overlap",shapes:C,identical:C1(b,x)})}const a=e.shapes.filter(v=>v.type==="bpmn:Group"&&Array.isArray(v.members)&&v.members.length>0);for(let v=0;v<a.length;v++)for(let g=v+1;g<a.length;g++){const b=a[v],x=a[g],C=Math.min(b.x+b.width,x.x+x.width)-Math.max(b.x,x.x),M=Math.min(b.y+b.height,x.y+x.height)-Math.max(b.y,x.y);if(C<=ws||M<=ws)continue;const k=b.id<x.id?[b.id,x.id]:[x.id,b.id],P=new Set(x.members);if(b.members.some(D=>P.has(D))){const D=gh(e,a,{x:Math.max(b.x,x.x),y:Math.max(b.y,x.y),right:Math.min(b.x+b.width,x.x+x.width),bottom:Math.min(b.y+b.height,x.y+x.height)});D.length&&t.push({kind:"group-overlap-unreadable",reason:"orphan",groups:k,shapes:D});continue}const B=b.x<=x.x&&b.y<=x.y&&b.x+b.width>=x.x+x.width&&b.y+b.height>=x.y+x.height?b.id:x.x<=b.x&&x.y<=b.y&&x.x+x.width>=b.x+b.width&&x.y+x.height>=b.y+b.height?x.id:void 0;t.push({kind:"group-overlap-unintended",groups:k,...B?{container:B}:{}})}const s=new Set(a.flatMap(v=>[...v.members])),c=v=>e.shapes.filter(g=>!g.container&&!pu.has(g.type)&&g.x>=v.x&&g.y>=v.y&&g.x+g.width<=v.x+v.width&&g.y+g.height<=v.y+v.height);for(const v of a){const g=c(v);if(!g.length)continue;const b=new Set(v.members),x=g.filter(C=>!b.has(C.id));x.some(C=>s.has(C.id))&&(x.length*2<g.length||t.push({kind:"group-overlap-unreadable",reason:"minority",group:v.id,shapes:x.map(C=>C.id).sort()}))}for(const v of a){const g=new Set(c(v).map(P=>P.id)),b=new Set(v.members),x=new Set([...g].filter(P=>!b.has(P)&&s.has(P)));if(!x.size)continue;let C=!1,M=!1,k=!1;for(const P of e.edges){if(P.type!=="bpmn:SequenceFlow"||!P.source||!P.target)continue;const B=x.has(P.source),D=x.has(P.target);!B&&D&&!g.has(P.source)?C=!0:B&&!D&&!g.has(P.target)?M=!0:B&&D&&(k=!0)}C&&M&&k&&t.push({kind:"group-overlap-unreadable",reason:"throughpass",group:v.id,shapes:[...x].sort()})}const l=e.shapes.filter(v=>v.type==="bpmn:Group");for(let v=0;v<l.length;v++)for(let g=v+1;g<l.length;g++)for(let b=g+1;b<l.length;b++){const x=[l[v],l[g],l[b]],C={x:Math.max(...x.map(P=>P.x)),y:Math.max(...x.map(P=>P.y)),right:Math.min(...x.map(P=>P.x+P.width)),bottom:Math.min(...x.map(P=>P.y+P.height))};if(C.right-C.x<=ws||C.bottom-C.y<=ws)continue;const M=gh(e,[],C);if(!M.length)continue;const k=x.map(P=>P.id).sort();t.push({kind:"group-stack-unreadable",groups:k,shapes:M})}for(const v of e.shapes.filter(g=>g.type==="bpmn:Group"))for(const g of e.shapes){if(g.container||g.attached||pu.has(g.type)||g.width<=0||g.height<=0)continue;const b=[["top",v.y,"h",v.x,v.x+v.width],["bottom",v.y+v.height,"h",v.x,v.x+v.width],["left",v.x,"v",v.y,v.y+v.height],["right",v.x+v.width,"v",v.y,v.y+v.height]];for(const[x,C,M,k,P]of b){const B=M==="h"?g.x:g.y,D=M==="h"?g.x+g.width:g.y+g.height;if(!(B<P&&k<D))continue;const I=M==="h"?g.y:g.x,z=M==="h"?g.y+g.height:g.x+g.width;if(!(I<C&&C<z))continue;const oe=Math.min(C-I,z-C);oe<v1||t.push({kind:"group-cuts-shape",group:v.id,shape:g.id,side:x,depth:oe})}}const u=e.shapes.filter(v=>v.container&&v.type!=="bpmn:Group"&&v.type!=="bpmn:Lane");for(const v of e.shapes.filter(g=>g.type==="bpmn:Group"))for(const g of u){const b=v.x<g.x+g.width&&g.x<v.x+v.width,x=v.y<g.y+g.height&&g.y<v.y+v.height,C=[["top",v.y,g.y,b],["bottom",v.y+v.height,g.y+g.height,b],["left",v.x,g.x,x],["right",v.x+v.width,g.x+g.width,x]];for(const[M,k,P,B]of C)B&&Math.abs(k-P)<=ah&&t.push({kind:"group-on-container-boundary",group:v.id,container:g.id,side:M})}const f=e.shapes.filter(v=>v.type==="bpmn:Group");for(let v=0;v<f.length;v++)for(let g=v+1;g<f.length;g++){const b=f[v],x=f[g],C=b.x<x.x+x.width&&x.x<b.x+b.width,M=b.y<x.y+x.height&&x.y<b.y+b.height,k=[["x",b.x+b.width,x.x,M],["x",x.x+x.width,b.x,M],["y",b.y+b.height,x.y,C],["y",x.y+x.height,b.y,C]];for(const[P,B,D,I]of k)if(I&&Math.abs(B-D)<=ah){t.push({kind:"group-on-group-boundary",groups:b.id<x.id?[b.id,x.id]:[x.id,b.id],axis:P});break}}for(let v=0;v<e.edges.length;v++)for(let g=v+1;g<e.edges.length;g++){const b=e.edges[v],x=e.edges[g],C=fo(b,x);if(!C)continue;const M=b.id<x.id?[b.id,x.id]:[x.id,b.id];t.push({kind:C.kind==="opposite"?"edge-overlap-opposite":C.kind==="mixed"?"edge-overlap-mixed":"edge-overlap-unrelated",edges:M,axis:C.axis,length:Math.round(C.length)})}for(const v of e.edges){if(!v.label)continue;const g=Ss(v,e.edges);g&&t.push({kind:"label-on-shared-segment",edge:v.id,other:g.other,axis:g.axis})}for(const v of e.edges){if(!v.label)continue;const g=fh(v,e);g&&t.push({kind:"label-over-line",edge:v.id,line:g})}const p=new Set(n.map(v=>v.id)),d=e.shapes.filter(v=>v.type==="bpmn:Participant"&&v.label);for(const v of[...n,...d.filter(g=>!p.has(g.id))]){if(!v.label)continue;const g=bh(v,e);g&&t.push({kind:"label-over-line",edge:v.id,line:g})}const m=new Set(e.shapes.filter(v=>v.type==="bpmn:TextAnnotation").map(v=>v.id));for(const v of d)for(const{owner:g,rect:b}of mo(e))g===v.id||m.has(g)||mu(v.label,b,ho)&&t.push({kind:"pool-name-over-label",pool:v.id,label:g});const h=mo(e);for(const v of n)if(v.type==="bpmn:TextAnnotation")for(const{owner:g,rect:b}of h)g!==v.id&&mu(v,b,ho)&&t.push({kind:"annotation-over-label",annotation:v.id,label:g});const y=new Map(e.shapes.map(v=>[v.id,v]));for(const v of n){const g=v.parent??M1(v,e,y);if(!g)continue;const b=y.get(g);!b||!b.container||S1(b,v,E1)||v.type==="bpmn:TextAnnotation"&&!T1(v,b,e)||t.push({kind:"shape-outside-container",shape:v.id,container:b.id})}return t.sort((v,g)=>Rt(v).localeCompare(Rt(g)))}const Et=e=>typeof e=="object"&&e!==null?e:void 0,It=e=>typeof e=="number"?e:0,Di=e=>{const t=Et(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function k1(e){const t=Et(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=Di(o);a&&n.push(a)}}return n}function O1(e){const t=Et(e);if(!t)return{};const n=Array.isArray(t.sourceRef)?void 0:Di(t.sourceRef),i=Array.isArray(t.targetRef)?void 0:Di(t.targetRef);return n&&i?{source:n,target:i}:{}}function D1(e,t){const n=Et(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const r=Di(n);return r?t.get(r):void 0}if(_s.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return Di(n)}function xh(e){var a,s,c,l,u;const t=[],n=[],i=((a=Et(e))==null?void 0:a.diagrams)??[],r=new Map,o=new Set;for(const f of((s=Et(e))==null?void 0:s.rootElements)??[]){const p=Et(f);if((p==null?void 0:p.$type)==="bpmn:Collaboration")for(const d of p.participants??[]){const m=Et(d),h=Di(m),y=Di(m==null?void 0:m.processRef);h&&y?r.set(y,h):h&&o.add(h)}}for(const f of i){const p=Et((c=Et(f))==null?void 0:c.plane),d=(p==null?void 0:p.planeElement)??[];for(const m of d){const h=Et(m);if(!h)continue;const y=Et(h.bpmnElement),v=typeof(y==null?void 0:y.id)=="string"?y.id:void 0;if(!v)continue;const g=typeof(y==null?void 0:y.$type)=="string"?y.$type:"",b=Et(h.bounds);if(b){const C=h.isExpanded===!1&&g!=="bpmn:Participant",M=Et((l=Et(h.label))==null?void 0:l.bounds),k={id:v,type:g,x:It(b.x),y:It(b.y),width:It(b.width),height:It(b.height),container:_s.has(g)&&!C,attached:(y==null?void 0:y.attachedToRef)!==void 0,...y?{parent:D1(y,r)}:{},...M?{label:{x:It(M.x),y:It(M.y),width:It(M.width),height:It(M.height)}}:{},...g==="bpmn:Group"?vh(yh(y)):{}},P=h.isHorizontal!==!1,B=typeof(y==null?void 0:y.name)=="string"?y.name:"";o.has(v)&&P&&B&&(k.label=fu(k,B)),t.push(k);continue}const x=h.waypoint;if(Array.isArray(x)){const C=Et((u=Et(h.label))==null?void 0:u.bounds);n.push({id:v,type:g,waypoints:x.map(M=>{var k,P;return{x:It((k=Et(M))==null?void 0:k.x),y:It((P=Et(M))==null?void 0:P.y)}}),endpoints:k1(y),...O1(y),...C?{label:{x:It(C.x),y:It(C.y),width:It(C.width),height:It(C.height)}}:{}})}}}return{shapes:t,edges:n}}function _h(e){return At(xh(e))}async function I1(e){const{definitions:t,warnings:n}=await lo(e);return{findings:_h(t),warnings:n}}function nt(e){var i;const t=[],n=[];for(const r of e.getAll()){const o=r;if(o.type==="label"||o.labelTarget)continue;const a=typeof o.type=="string"?o.type:"";if(a==="bpmn:Definitions"||a.startsWith("bpmndi:"))continue;const s=o.waypoints;if(s){const h=Et(o.label),y=Di(o.source),v=Di(o.target);n.push({id:o.id,type:a,waypoints:s.map(g=>({x:It(g.x),y:It(g.y)})),endpoints:[y,v].filter(g=>!!g),...y&&v?{source:y,target:v}:{},...h&&typeof h.x=="number"?{label:{x:h.x,y:It(h.y),width:It(h.width),height:It(h.height)}}:{}});continue}if(typeof o.x!="number"||typeof o.y!="number")continue;const c=Et(o.businessObject),l=Et(o.label);let u=Et(o.parent);for(;u&&u.type==="bpmn:Lane";)u=Et(u.parent);const f=typeof(u==null?void 0:u.type)=="string"?u.type:"",p=u&&_s.has(f)&&f!=="bpmn:Group"&&typeof u.id=="string"?u.id:void 0,d={id:o.id,type:a,x:o.x,y:o.y,width:It(o.width),height:It(o.height),container:_s.has(a)&&(a==="bpmn:Participant"||o.collapsed!==!0),attached:(c==null?void 0:c.attachedToRef)!==void 0,...p!==void 0?{parent:p}:{},...l&&typeof l.x=="number"?{label:{x:l.x,y:It(l.y),width:It(l.width),height:It(l.height)}}:{},...a==="bpmn:Group"?vh(yh(c)):{}},m=typeof(c==null?void 0:c.name)=="string"?c.name:"";a==="bpmn:Participant"&&!(c!=null&&c.processRef)&&m&&((i=Et(o.di))==null?void 0:i.isHorizontal)!==!1&&(d.label=fu(d,m)),t.push(d)}return{shapes:t,edges:n}}const L1={"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 B1(e,t){const n=L1[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function wh(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function Eh(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 B1(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&wh(i)===n).sort((i,r)=>i.y-r.y).map(i=>i.id),participantOf:n=>{const i=e.get(n);return i?wh(i):void 0},endpointsOf:n=>{var r,o;const i=e.get(n);if(!(!i||i.type==="label")&&"waypoints"in i)return{source:(r=i.source)==null?void 0:r.id,target:(o=i.target)==null?void 0:o.id}}}}const gu=20,N1=4,bt=(e,t)=>Math.abs(e-t)<.5;function Cs(e,t,n,i=gu){if(bt(e.y,t.y)&&!bt(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(bt(e.x,t.x)&&!bt(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 Sh(e,t,n,i=gu){if(n.length<2)return null;if(bt(e.y,t.y)&&!bt(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,f=Math.max(...n.map(d=>d.y+d.height))+i,p=d=>[{x:c,y:e.y},{x:c,y:d},{x:l,y:d},{x:l,y:e.y}];return[p(u),p(f)]}if(bt(e.x,t.x)&&!bt(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,f=Math.max(...n.map(d=>d.x+d.width))+i,p=d=>[{x:e.x,y:c},{x:d,y:c},{x:d,y:l},{x:e.x,y:l}];return[p(u),p(f)]}return null}function Rh(e,t,n=gu){if(e.length!==4)return null;const[i,r,o,a]=e;if(bt(i.y,r.y)&&bt(r.x,o.x)&&bt(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(bt(i.x,r.x)&&bt(r.y,o.y)&&bt(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 As(e,t){if(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[];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 Ch=30,$1=[0,-25,25,-40,40];function F1(e,t){if(e.type!=="bpmn:MessageFlow"||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[];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+Ch:s-Ch,l=a?i.y+i.height:i.y,u=n.x+n.width/2,f=i.x+i.width/2;return $1.map(p=>[{x:u,y:s},{x:u,y:c},{x:f+p,y:c},{x:f+p,y:l}])}const yu=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],go=(e,t,n)=>an({...e,waypoints:t},n).length;function vu(e,t,n,i){let r=[...e.waypoints],o=go(e,r,t);if(o===0)return null;let a=!1;for(const f of As(e,t))if(go(e,f,t)===0)return f;const s=(i??[]).filter(f=>f.id!==e.id).flatMap(_n),c=f=>_n({...e,waypoints:f}).some(p=>Es(p,s).length>0),l=F1(e,t).filter(f=>go(e,f,t)===0);if(l.length)return l.find(f=>!c(f))??l[0];const u=f=>!n||f.every(p=>p.x>=n.x&&p.x<=n.x+n.width&&p.y>=n.y&&p.y<=n.y+n.height);if(e.endpoints.length===2&&r.length>2){const f=t.find(d=>d.id===e.endpoints[0]),p=t.find(d=>d.id===e.endpoints[1]);if(f&&p&&bt(f.y+f.height/2,p.y+p.height/2)){const d=[r[0],r[r.length-1]];if(bt(d[0].y,d[1].y)&&!bt(d[0].x,d[1].x)){const m=t.filter(g=>!e.endpoints.includes(g.id)&&an({...e,waypoints:d},[g]).length>0),h=m.length>=2?Sh(d[0],d[1],m):null,v=(h?h.map(g=>[d[0],...g,d[1]]):m.length===1?(Cs(d[0],d[1],m[0])??[]).map(g=>[d[0],...g,d[1]]):m.length===0?[d]:[]).filter(g=>go(e,g,t)===0&&g.length<=r.length).sort((g,b)=>Number(u(b))-Number(u(g)));if(v.length)return v.find(g=>!c(g))??v[0]}}}for(let f=0;f+1<r.length;f++){const p=r[f],d=r[f+1],m=t.filter(v=>!e.endpoints.includes(v.id)&&an({...e,waypoints:[p,d]},[v]).length>0);if(m.length<2)continue;const h=Sh(p,d,m);if(!h)continue;const y=h.map(v=>yu(r,f,v)).filter(v=>go(e,v,t)===0).sort((v,g)=>Number(u(g))-Number(u(v)));if(y.length)return y.find(v=>!c(v))??y[0]}for(let f=0;f<N1&&o>0;f++){let p=!1;for(let d=0;d+1<r.length&&!p;d++){const m=r[d],h=r[d+1];for(const y of t){if(e.endpoints.includes(y.id)||an({...e,waypoints:[m,h]},[y]).length===0)continue;const v=Cs(m,h,y),g=v?v.map(x=>yu(r,d,x)):Rh(r,y)??[];if(!g.length)continue;const b=[...g].sort((x,C)=>Number(u(C))-Number(u(x)));for(const x of b){const C=go(e,x,t);if(C<o){r=x,o=C,p=!0,a=!0;break}}if(p)break}}if(!p)break}return a&&o===0?r:null}function bu(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=nt(i),a=Wn(o),s=new Set,c=At(o).filter(u=>u.kind==="edge-crosses-shape"&&!t.has(Rt(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 f=o.edges.find(p=>p.id===u.edge);f&&l.set(u.edge,f)}for(const[u,f]of l){if(n&&!n.has(u))continue;const p=i.get(u);if(!p)continue;const d=p.parent,m=d&&typeof d.x=="number"&&typeof d.width=="number"?{x:d.x,y:d.y,width:d.width,height:d.height}:void 0,h=vu(f,a,m,o.edges);if(!h){an(f,a).some(b=>b.type==="bpmn:TextAnnotation")&&s.add(u);continue}const y=o.edges.filter(b=>b.id!==u),v=Gn(f,y);Gn({...f,waypoints:h},y)>v||r.updateWaypoints(p,h)}return s}const j1=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},xu=(e,t)=>aa(e,[t])>0;function Ah(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=nt(i),a=Wn(o);let s=o;const c=new Set(At(o).map(Rt));for(const[l,u]of Rs(o))if(!t.has(`${l}|${u}`))for(const[f,p]of[[l,u],[u,l]]){if(n.has(f))continue;const d=s.edges.find(B=>B.id===f),m=s.edges.find(B=>B.id===p);if(!d||!m)continue;const h=i.get(f);if(!h)continue;const y=h.parent,v=y&&typeof y.x=="number"&&typeof y.width=="number"?{x:y.x,y:y.y,width:y.width,height:y.height}:void 0,g=j1(m),b=[...As(d,a)??[]],x=vu(d,[...a,...g],v,o.edges);x&&b.push(x);for(let B=0;B+1<d.waypoints.length;B++)for(const D of g)for(const I of Cs(d.waypoints[B],d.waypoints[B+1],D)??[])b.push(yu(d.waypoints,B,I));const C=s.edges.filter(B=>B.id!==f),M=B=>({...s,edges:s.edges.map(D=>D.id===f?{...D,waypoints:B}:D)}),k=B=>!v||B.every(D=>D.x>=v.x&&D.x<=v.x+v.width&&D.y>=v.y&&D.y<=v.y+v.height),P=b.find(B=>{const D={...d,waypoints:B};return xu(D,m)||!k(B)||C.some(I=>I.id!==p&&!xu(d,I)&&xu(D,I))?!1:At(M(B)).every(I=>c.has(Rt(I)))});if(P){r.updateWaypoints(h,P),s=M(P);break}}}const H1=10;function Ph(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 Mh(e,t){if(e.waypoints.length<2||e.endpoints.length!==2)return null;const n=t.shapes.filter(z=>z.type==="bpmn:Participant"&&z.container),i=t.shapes.find(z=>z.id===e.endpoints[0]),r=t.shapes.find(z=>z.id===e.endpoints[1]);if(!i||!r)return null;const o=Ph(i,n),a=Ph(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(z=>z.id!==o.id&&z.id!==a.id&&z.y>=c.y+c.height&&z.y+z.height<=l.y).sort((z,oe)=>z.y-oe.y);if(!u.length)return null;const f=u[0],p=u[u.length-1],d=(c.y+c.height+f.y)/2,m=(p.y+p.height+l.y)/2,h=s?d:m,y=s?m:d,v=e.waypoints[0],g=e.waypoints[e.waypoints.length-1],b=Wn(t),x=t.edges.filter(z=>z.id!==e.id),C=Vn(e,x),M=an(e,b).length;if(C===0&&M===0||M===0&&e.waypoints.length===2)return null;const k=Math.min(...u.map(z=>z.x)),P=Math.max(...u.map(z=>z.x+z.width)),B=(v.x+g.x)/2,D=z=>z.filter((oe,ye)=>ye===0||!(bt(oe.x,z[ye-1].x)&&bt(oe.y,z[ye-1].y)));let I;for(let z=k;z<=P;z+=H1){const oe=D([v,{x:v.x,y:h},{x:z,y:h},{x:z,y},{x:g.x,y},g]),ye={...e,waypoints:oe};if(an(ye,b).length>0)continue;const Ve=Vn(ye,x),He=Math.abs(z-B);(!I||Ve<I.cross||Ve===I.cross&&He<I.detour)&&(I={pts:oe,cross:Ve,detour:He})}return I&&(M>0?I.cross<=C:I.cross<C)?I.pts:null}function Th(e,t){const{elementRegistry:n}=e,i=e.modeling,r=nt(n);for(const o of r.edges){if(o.type!=="bpmn:MessageFlow"||t.has(o.id))continue;const a=nt(n),s=a.edges.find(u=>u.id===o.id);if(!s)continue;const c=Mh(s,a);if(!c)continue;const l=n.get(o.id);l&&i.updateWaypoints(l,c)}}const gi=[25,-25,40,-40],yo=35;function z1(e,t){const n=e.x+e.width/2,i=t.x+t.width/2,r=[];for(const o of[!0,!1]){const a=o?e.y:e.y+e.height,s=o?t.y:t.y+t.height,c=o?Math.min(e.y,t.y)-yo:Math.max(e.y+e.height,t.y+t.height)+yo;for(const l of[0,...gi])if(!(Math.abs(l)>=e.width/2-5))for(const u of[0,...gi]){if(Math.abs(u)>=t.width/2-5)continue;const f=n+l,p=i+u;r.push({pts:[{x:f,y:a},{x:f,y:c},{x:p,y:c},{x:p,y:s}],cost:Math.abs(u)+Math.abs(l)})}}return r}function Ps(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 z1(n,i);const o=i.x+i.width/2,a=n.x+n.width/2,s=r<i.y,c=s?i.y:i.y+i.height,l=s?n.y:n.y+n.height,u=s?n.y-yo:n.y+n.height+yo,f=[];for(const g of[0,...gi]){if(Math.abs(g)>=i.width/2-5)continue;const b=o+g;f.push({pts:[{x:n.x,y:r},{x:b,y:r},{x:b,y:c}],cost:Math.abs(g)});for(const x of[0,...gi]){if(Math.abs(x)>=n.width/2-5)continue;const C=a+x;f.push({pts:[{x:C,y:l},{x:C,y:u},{x:b,y:u},{x:b,y:c}],cost:Math.abs(g)+Math.abs(x)})}}const p=50,d=i.y+i.height/2,m=s?n.y+n.height:n.y;for(const g of[0,...gi]){if(Math.abs(g)>=n.width/2-5)continue;const b=a+g;f.push({pts:[{x:b,y:m},{x:b,y:d},{x:i.x+i.width,y:d}],cost:p+Math.abs(g)})}const h=60,y=s?i.y+i.height:i.y,v=s?i.y+i.height+yo:i.y-yo;for(const g of[0,...gi]){if(Math.abs(g)>=i.width/2-5)continue;const b=o+g;for(const x of[0,...gi]){if(Math.abs(x)>=n.width/2-5)continue;const C=a+x;f.push({pts:[{x:C,y:m},{x:C,y:v},{x:b,y:v},{x:b,y}],cost:h+Math.abs(g)+Math.abs(x)})}}return f}const Ms=30;function kh(e,t){for(let n=1;n<e.length-2;n++){const i=e[n],r=e[n+1],o=bt(i.y,r.y)&&!bt(i.x,r.x),a=bt(i.x,r.x)&&!bt(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)<Ms||Math.abs(i.y-(s.y+s.height))<Ms)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)<Ms||Math.abs(i.x-(s.x+s.width))<Ms)return!0}}return!1}const Ts=40;function G1(e,t,n){let i=0;for(const r of t){if(r.container||n.includes(r.id))continue;const o=r.x-Ts,a=r.x+r.width+Ts,s=r.y-Ts,c=r.y+r.height+Ts;for(let l=1;l<e.length-2;l++){const u=e[l],f=e[l+1],p={x:Math.min(u.x,f.x),y:Math.min(u.y,f.y)},d={x:Math.max(u.x,f.x),y:Math.max(u.y,f.y)};if(p.x<a&&d.x>o&&p.y<c&&d.y>s){i++;break}}}return i}function Oh(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])),r=Wn(t),o=t.edges.filter(M=>M.id!==e.id),a=Gn(e,o),s=Vn(e,o),c=M=>G1(M,t.shapes,e.endpoints)+(kh(M,n)?1:0),l=c(e.waypoints),u=M=>{if(!M)return;const k=M.x+M.width/2,P=M.y+M.height/2;return n.find(B=>B.type==="bpmn:Lane"&&k>=B.x&&k<=B.x+B.width&&P>=B.y&&P<=B.y+B.height)},f=u(i.get(e.endpoints[0]??"")),p=u(i.get(e.endpoints[1]??"")),d=!!f&&!!p&&f.id!==p.id,m=M=>{if(!d||!p)return!1;for(let k=1;k<M.length-2;k++){const P=M[k],B=M[k+1];if(bt(P.y,B.y)&&!bt(P.x,B.x)&&P.y>p.y&&P.y<p.y+p.height)return!0}return!1},h=m(e.waypoints),v=(M=>{if(!M)return;const k=M.x+M.width/2,P=M.y+M.height/2;return n.filter(B=>B.type==="bpmn:Participant"&&k>=B.x&&k<=B.x+B.width&&P>=B.y&&P<=B.y+B.height).sort((B,D)=>B.width*B.height-D.width*D.height)[0]})(i.get(e.endpoints[0]??"")),g=M=>{if(!v)return 0;let k=0;for(let P=1;P<M.length-1;P++){const B=M[P];(B.x<v.x||B.x>v.x+v.width||B.y<v.y||B.y>v.y+v.height)&&k++}return k},b=g(e.waypoints);if(!kh(e.waypoints,n)&&!(d&&!h)&&b===0)return null;const x=M=>M.reduce((k,P,B)=>B?k+Math.abs(P.x-M[B-1].x)+Math.abs(P.y-M[B-1].y):0,0);let C;for(const{pts:M,cost:k}of Ps(e,i)){const P={...e,waypoints:M};if(an(P,r).length>0)continue;const B=Gn(P,o);if(B>a)continue;const D=g(M);if(D>b)continue;const I=D<b&&B===0;if(!I&&Vn(P,o)>s)continue;const z=c(M),oe=m(M);if(!I&&!(oe&&!h)&&z>=l)continue;const Ve=oe?0:1,He=x(M);(!C||D<C.out||D===C.out&&(Ve<C.lane||Ve===C.lane&&(B<C.opp||B===C.opp&&(z<C.sc||z===C.sc&&(k<C.cost||k===C.cost&&He<C.len)))))&&(C={pts:M,out:D,sc:z,lane:Ve,opp:B,cost:k,len:He})}return(C==null?void 0:C.pts)??null}function V1(e,t){const{elementRegistry:n}=e,i=e.modeling,r=nt(n).edges.filter(o=>!t.has(o.id)&&o.waypoints.length>=4).map(o=>o.id).sort();for(const o of r){const a=nt(n),s=a.edges.find(d=>d.id===o);if(!s||s.waypoints.length<4)continue;const c=Wn(a),l=a.edges.filter(d=>d.id!==o),u=an(s,c).length,f=Gn(s,l),p=Vn(s,l);for(const d of As(s,a.shapes)){if(d.length>=s.waypoints.length)continue;const m={...s,waypoints:d};if(an(m,c).length>u||Gn(m,l)>f||Vn(m,l)>p)continue;const h=n.get(o);h&&i.updateWaypoints(h,d);break}}}function Dh(e,t){const{elementRegistry:n}=e,i=e.modeling,r=nt(n).edges.filter(o=>o.type==="bpmn:SequenceFlow"&&!t.has(o.id)).map(o=>o.id).sort();for(const o of r){const a=nt(n),s=a.edges.find(u=>u.id===o);if(!s)continue;const c=Oh(s,a);if(!c)continue;const l=n.get(o);l&&i.updateWaypoints(l,c)}}function _u(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=bt(n[0].x,n[1].x)&&!bt(n[0].y,n[1].y),s=bt(n[n.length-1].x,n[n.length-2].x)&&!bt(n[n.length-1].y,n[n.length-2].y);for(const c of gi){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 W1(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,f=i.y+i.height/2,p=a?n.x+n.width:n.x,d=o?n.y+n.height:n.y,m=a?i.x:i.x+i.width,h=o?i.y:i.y+i.height,y=[];for(const v of[0,...gi])Math.abs(v)<i.width/2-5&&y.push({pts:[{x:p,y:l},{x:u+v,y:l},{x:u+v,y:h}],cost:Math.abs(v)}),Math.abs(v)<i.height/2-5&&y.push({pts:[{x:c,y:d},{x:c,y:f+v},{x:m,y:f+v}],cost:Math.abs(v)});return y}function wu(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,f=[];for(const p of[0,...gi]){const d=u+p;d<=r||d>=o||f.push({pts:[{x:d,y:c},{x:d,y:l}],cost:Math.abs(p)})}return f}function Ih(e,t){const n=new Map(t.shapes.map(d=>[d.id,d])),i=Wn(t),r=t.edges.filter(d=>d.id!==e.id),o=Gn(e,r);if(o===0)return null;const a=Vn(e,r);let s;const c=d=>d.reduce((m,h,y)=>y?m+Math.abs(h.x-d[y-1].x)+Math.abs(h.y-d[y-1].y):0,0),l=3,u=d=>{const m=d[0],h=d[d.length-1],y=Math.hypot(h.x-m.x,h.y-m.y);return y>=1&&c(d)/y>=l?1:0},f=u(e.waypoints),p=[...Ps(e,n),...wu(e,n),..._u(e,n)];for(const{pts:d,cost:m}of p){const h={...e,waypoints:d};if(an(h,i).length>0)continue;const y=Gn(h,r),v=Vn(h,r),g=o-y+(f-u(d));if(y>=o||v-a>g)continue;const b=c(d);(!s||y<s.opposite||y===s.opposite&&(v<s.cross||v===s.cross&&(m<s.cost||m===s.cost&&b<s.len)))&&(s={pts:d,opposite:y,cross:v,cost:m,len:b})}return(s==null?void 0:s.pts)??null}function Lh(e,t){var i;let n=0;for(const r of t)r.id!==e.id&&((i=fo(e,r))==null?void 0:i.kind)==="unrelated"&&n++;return n}function U1(e,t){const n=new Map(t.shapes.map(p=>[p.id,p])),i=Wn(t),r=t.edges.filter(p=>p.id!==e.id),o=Lh(e,r);if(o===0)return null;const a=Gn(e,r),s=Vn(e,r),c=p=>p.reduce((d,m,h)=>h?d+Math.abs(m.x-p[h-1].x)+Math.abs(m.y-p[h-1].y):0,0),l=2;let u;const f=[...Ps(e,n),...wu(e,n),...W1(e,n),..._u(e,n)];for(const{pts:p,cost:d}of f){const m={...e,waypoints:p};if(an(m,i).length>0)continue;const h=Lh(m,r);if(h>=o)continue;const y=Gn(m,r);if(y-h>a-o)continue;const v=Vn(m,r);if(v-s>(o-h)*l)continue;const g=c(p);(!u||h<u.fake||h===u.fake&&(y<u.unreadable||y===u.unreadable&&(v<u.cross||v===u.cross&&(d<u.cost||d===u.cost&&g<u.length))))&&(u={pts:p,fake:h,unreadable:y,cross:v,cost:d,length:g})}return(u==null?void 0:u.pts)??null}function Bh(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=At(nt(i)).filter(s=>s.kind==="edge-overlap-unrelated"&&!t.has(Rt(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=nt(i),l=c.edges.find(p=>p.id===s);if(!l)continue;const u=U1(l,c);if(!u)continue;const f=i.get(s);f&&r.updateWaypoints(f,u)}}function Nh(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 $h(e,t,n){var l;if(e.type!=="bpmn:SequenceFlow"||t.type!=="bpmn:SequenceFlow"||((l=fo(e,t))==null?void 0:l.kind)!=="opposite")return!1;const[i,r]=e.endpoints,[o,a]=t.endpoints,s=[i,r].filter(u=>u&&(u===o||u===a)).length;return!(!!r&&r===o||!!a&&a===i)||s!==1?!1:Nh(e,n)&&Nh(t,n)}function Fh(e,t,n){let i=0;for(const r of t)r.id!==e.id&&$h(e,r,n)&&i++;return i}function Y1(e,t){const n=new Map(t.shapes.map(p=>[p.id,p])),i=Wn(t),r=t.edges.filter(p=>p.id!==e.id),o=Fh(e,r,n);if(o===0)return null;const a=Gn(e,r),s=Vn(e,r),c=p=>p.reduce((d,m,h)=>h?d+Math.abs(m.x-p[h-1].x)+Math.abs(m.y-p[h-1].y):0,0),l=2;let u;const f=[...Ps(e,n),...wu(e,n),..._u(e,n)];for(const{pts:p,cost:d}of f){const m={...e,waypoints:p};if(an(m,i).length>0)continue;const h=Fh(m,r,n);if(h>=o)continue;const y=Gn(m,r);if(y-h>a-o)continue;const v=Vn(m,r);if(v-s>(o-h)*l)continue;const g=c(p);(!u||h<u.chain||h===u.chain&&(y<u.unreadable||y===u.unreadable&&(v<u.cross||v===u.cross&&(d<u.cost||d===u.cost&&g<u.length))))&&(u={pts:p,chain:h,unreadable:y,cross:v,cost:d,length:g})}return(u==null?void 0:u.pts)??null}function q1(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=nt(i),a=new Map(o.shapes.map(l=>[l.id,l])),s=At(o).filter(l=>l.kind==="edge-overlap-opposite"&&!t.has(Rt(l)));if(!s.length)return;const c=new Set;for(const l of s){if(l.kind!=="edge-overlap-opposite")continue;const[u,f]=l.edges.map(p=>o.edges.find(d=>d.id===p));if(!(!u||!f||!$h(u,f,a)))for(const p of l.edges)n.has(p)||c.add(p)}for(const l of[...c].sort()){const u=nt(i),f=u.edges.find(m=>m.id===l);if(!f)continue;const p=Y1(f,u);if(!p)continue;const d=i.get(l);d&&r.updateWaypoints(d,p)}}function jh(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=nt(i),a=At(o).filter(u=>du(u)&&!t.has(Rt(u)));if(!a.length)return;const s=new Set;for(const u of a)if(du(u))for(const f of u.edges)n.has(f)||s.add(f);const c=u=>{var f;return((f=o.edges.find(p=>p.id===u))==null?void 0:f.type)??""},l=[...s].sort((u,f)=>{const p=c(u)==="bpmn:SequenceFlow"?0:1,d=c(f)==="bpmn:SequenceFlow"?0:1;return p!==d?p-d:u.localeCompare(f)});for(const u of l){const f=nt(i),p=f.edges.find(h=>h.id===u);if(!p)continue;const d=Ih(p,f);if(!d)continue;const m=i.get(u);m&&r.updateWaypoints(m,d)}}const K1=10,X1=(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 Hh(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!Ss(e,i))return null;const r=Wn(t),o=i.flatMap(_n);for(const a of _n(e)){let s=[[a.lo,a.hi]];for(const[d,m]of Es(a,o))s=s.flatMap(([h,y])=>{const v=[];return d>h&&v.push([h,Math.min(y,d)]),m<y&&v.push([Math.max(h,m),y]),v.filter(([g,b])=>b>g)});const c=a.axis==="h"?n.width:n.height,l=s.find(([d,m])=>m-d>=c+K1*2);if(!l)continue;const u=(l[0]+l[1])/2,f=a.axis==="h"?{x:u,y:a.at-uh}:{x:a.at+kn+n.width/2,y:u},p={x:f.x-n.width/2,y:f.y-n.height/2,width:n.width,height:n.height};if(!Ss({...e,label:p},i)&&!r.some(d=>!e.endpoints.includes(d.id)&&X1(p,d)))return p}return null}const kn=8;function zh(e,t){const n=e.label;if(!n)return null;const i=_n(e);if(!i.length)return null;const r=n.x+n.width/2,o=n.y+n.height/2,a=p=>{const d=p.axis==="h"?r:o,m=p.axis==="h"?o-p.at:r-p.at,h=d<p.lo?p.lo-d:d>p.hi?d-p.hi:0;return Math.hypot(m,h)},s=i.reduce((p,d)=>a(d)<a(p)?d:p,i[0]),c=[...i,...t.edges.filter(p=>p.id!==e.id).flatMap(_n),...t.shapes.filter(p=>p.container).flatMap(oa)],l=p=>!c.some(d=>Oi(p,d));if(l(n))return null;const u=(s.axis==="v"?n.height:n.width)+kn,f=[0,-u,u,-2*u,2*u];if(s.axis==="v")for(const p of[s.at+kn,s.at-kn-n.width])for(const d of f){const m=n.y+d;if(m<s.lo||m+n.height>s.hi)continue;const h={...n,x:p,y:m};if(l(h))return h}else for(const p of[s.at-kn-n.height,s.at+kn])for(const d of f){const m=n.x+d;if(m<s.lo||m+n.width>s.hi)continue;const h={...n,x:m,y:p};if(l(h))return h}return null}function Gh(e,t){const{elementRegistry:n}=e,i=e.modeling;let r=nt(n),o=new Set(At(r).map(Rt));for(const[a,s]of t){const c=s.wps,l=n.get(a),u=l==null?void 0:l.label;if(!u||!(l!=null&&l.waypoints)||l.waypoints.length!==c.length)continue;const f=l.waypoints[0].x-c[0].x,p=l.waypoints[0].y-c[0].y;if(!l.waypoints.every((b,x)=>b.x-c[x].x===f&&b.y-c[x].y===p))continue;const d=s.label.x+f-u.x,m=s.label.y+p-u.y;if(d===0&&m===0)continue;const h=r.edges.find(b=>b.id===a);if(!(h!=null&&h.label))continue;const y={...h.label,x:h.label.x+d,y:h.label.y+m},v={...r,edges:r.edges.map(b=>b.id===a?{...b,label:y}:b)},g=At(v);g.some(b=>!o.has(Rt(b)))||(i.moveElements([u],{x:d,y:m}),r=v,o=new Set(g.map(Rt)))}}function Vh(e,t){const{elementRegistry:n}=e,i=e.modeling,r=nt(n);for(const o of r.edges){if(!o.label||t.has(o.id))continue;const a=zh(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 Wh(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=nt(i),a=At(o).filter(s=>s.kind==="label-on-shared-segment"&&!t.has(Rt(s)));for(const s of a){if(s.kind!=="label-on-shared-segment"||n.has(s.edge))continue;const c=o.edges.find(p=>p.id===s.edge);if(!c)continue;const l=Hh(c,o);if(!l)continue;const u=i.get(s.edge),f=u==null?void 0:u.label;f&&r.moveElements([f],{x:l.x-f.x,y:l.y-f.y})}}function Uh(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(_n),...t.shapes.filter(p=>p.container).flatMap(oa)],r=i.filter(p=>Oi(n,p));if(!r.length)return null;const o=t.shapes.filter(p=>!p.container&&p.id!==e.id),a=mo(t).filter(p=>p.owner!==e.id).map(p=>p.rect),s=(p,d)=>p.x<d.x+d.width&&d.x<p.x+p.width&&p.y<d.y+d.height&&d.y<p.y+p.height,c=p=>!i.some(d=>Oi(p,d))&&!o.some(d=>s(p,d))&&!a.some(d=>s(p,d)),l=[];for(const p of r)p.axis==="h"?l.push({...n,y:p.at-kn-n.height},{...n,y:p.at+kn}):l.push({...n,x:p.at-kn-n.width},{...n,x:p.at+kn});const u=e.x+e.width/2,f=e.y+e.height/2;return l.push({...n,x:u-n.width/2,y:e.y+e.height+kn},{...n,x:u-n.width/2,y:e.y-kn-n.height},{...n,x:e.x+e.width+kn,y:f-n.height/2},{...n,x:e.x-kn-n.width,y:f-n.height/2}),l.find(c)??null}function Yh(e,t){const{elementRegistry:n}=e,i=e.modeling,r=nt(n);for(const o of r.shapes){if(o.container||!o.label||t.has(o.id))continue;const a=Uh(o,nt(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 Z1(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 qh(e,t){const{elementRegistry:n}=e,i=e.modeling;let r=nt(n),o=new Set(At(r).map(Rt));const a=[...new Set(At(r).filter(s=>s.kind==="edge-endpoint-detached"&&!t.has(Rt(s))).map(s=>s.edge))].sort();for(const s of a){const c=r.edges.find(h=>h.id===s);if(!c||c.waypoints.length<2)continue;const l=c.waypoints.map(h=>({...h})),u=[[c.endpoints[0],0],[c.endpoints[1],l.length-1]];let f=!1;for(const[h,y]of u){const v=h?r.shapes.find(b=>b.id===h):void 0;if(!v)continue;const g=Z1(v,l[y]);g.x===l[y].x&&g.y===l[y].y||(l[y]=g,f=!0)}if(!f)continue;const p={...r,edges:r.edges.map(h=>h.id===s?{...h,waypoints:l}:h)},d=At(p);if(d.some(h=>!o.has(Rt(h))))continue;const m=n.get(s);m&&(i.updateWaypoints(m,l),r=p,o=new Set(d.map(Rt)))}}const Q1=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,Kh=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),Xh={"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}]},ks=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Eu=e=>typeof e=="string"&&e!=="";function J1(e){const t=[];function n(i,r,o,a){if(a===null){Eu(o)||t.push({kind:"payload-invalid",opIndex:i,field:r});return}if(!ks(o)){t.push({kind:"payload-invalid",opIndex:i,field:r});return}for(const s of a)Eu(o[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${r}.${s}`})}return e.forEach((i,r)=>{var o,a;if(!ks(i)||!Eu(i.kind)||!(i.kind in Xh)){t.push({kind:"payload-invalid",opIndex:r,field:"kind"});return}for(const s of Xh[i.kind]){const c=s.path.endsWith("[]"),l=c?s.path.slice(0,-2):s.path,u=l.split(".");let f=i;for(const d of u.slice(0,-1)){if(!ks(f))break;f=f[d]}if(!ks(f))continue;const p=f[u[u.length-1]];if(!(p===void 0&&s.optional)&&!(p===null&&s.optional)){if(!c){n(r,s.path,p,s.shape);continue}if(!Array.isArray(p)){t.push({kind:"payload-invalid",opIndex:r,field:s.path});continue}p.forEach((d,m)=>n(r,`${l}[${m}]`,d,s.shape))}}if(i.kind==="node.add"||i.kind==="node.update"){const s=i.band;s!==void 0&&(!Number.isInteger(s)||s<0)&&t.push({kind:"payload-invalid",opIndex:r,field:"band"});const c=i.kind==="node.add"?(o=i.node)==null?void 0:o.type:i.type;typeof c=="string"&&!Pd(c)&&t.push({kind:"node-type-unsupported",opIndex:r,id:(i.kind==="node.add"?(a=i.node)==null?void 0:a.id:i.id)??"",type:c})}}),t}function Zh(e,t){const n=J1(e);if(n.length>0)return n;const i=[],r=new Map,o=new Map;function a(p,d,m){if(!Q1.test(d)){i.push({kind:"id-invalid",opIndex:p,id:d});return}if(t.categoryOf(d)!==void 0||r.has(d)){i.push({kind:"id-duplicate",opIndex:p,id:d});return}r.set(d,{...m,opIndex:p})}e.forEach((p,d)=>{var m;switch(p.kind){case"participant.add":a(d,p.participant.id,{category:"participant",lanes:(p.participant.lanes??[]).map(h=>h.id)});for(const h of p.participant.lanes??[])a(d,h.id,{category:"lane"});break;case"node.add":a(d,p.node.id,{category:"flowNode",participant:p.node.participant});break;case"sequenceFlow.add":a(d,p.flow.id,{category:"sequenceFlow"});break;case"messageFlow.add":a(d,p.flow.id,{category:"messageFlow"});break;case"dataStore.add":a(d,p.dataStore.id,{category:"dataStore"});for(const h of p.associations??[])h.id&&a(d,h.id,{category:"dataAssociation"});break;case"dataAssociation.add":p.association.id&&a(d,p.association.id,{category:"dataAssociation"});break;case"association.add":p.association.id&&a(d,p.association.id,{category:"association"});break;case"annotation.add":a(d,p.annotation.id,{category:"annotation"}),(m=p.association)!=null&&m.id&&a(d,p.association.id,{category:"association"});break;case"group.add":a(d,p.group.id,{category:"group"});break;case"participant.update":if(p.lanes){o.set(p.id,p.lanes.map(h=>h.id));for(const h of p.lanes)t.categoryOf(h.id)===void 0&&a(d,h.id,{category:"lane"})}break}});const s=p=>{var d;return((d=r.get(p))==null?void 0:d.category)??t.categoryOf(p)},c=p=>{const d=r.get(p);return d?d.category==="participant"?p:d.participant:t.categoryOf(p)==="participant"?p:t.participantOf(p)};function l(p,d,m,h){const y=s(d);if(y===void 0){i.push({kind:"ref-missing",opIndex:p,ref:d,role:m});return}if(h&&!h.includes(y)){i.push({kind:"ref-category",opIndex:p,ref:d,role:m,expected:h.join("|"),actual:y});return}return y}const u=t.isCollaboration()||e.some(p=>p.kind==="participant.add");return e.forEach((p,d)=>{var m;switch(p.kind){case"participant.add":break;case"node.add":{const{participant:h,lane:y}=p.node;if(h===void 0){(u||y!==void 0)&&i.push({kind:"participant-required",opIndex:d,id:p.node.id});break}if(l(d,h,"participant",["participant"])===void 0)break;y!==void 0&&((((m=r.get(h))==null?void 0:m.lanes)??o.get(h)??t.lanesOf(h)).includes(y)||i.push({kind:"lane-unknown",opIndex:d,lane:y,participant:h}));break}case"sequenceFlow.add":{const{id:h,source:y,target:v,name:g,condition:b}=p.flow,x=l(d,y,"source",["flowNode"]),C=l(d,v,"target",["flowNode"]);x&&C&&c(y)!==c(v)&&i.push({kind:"flow-cross-pool",opIndex:d,id:h}),g!==void 0&&b!==void 0&&i.push({kind:"condition-name-conflict",opIndex:d,id:h});break}case"messageFlow.add":{const{id:h,source:y,target:v}=p.flow,g=l(d,y,"source",["flowNode","participant"]),b=l(d,v,"target",["flowNode","participant"]);if(g&&b){const x=c(y),C=c(v);x!==void 0&&x===C&&i.push({kind:"message-flow-same-pool",opIndex:d,id:h})}break}case"dataStore.add":{for(const h of p.associations??[]){if([h.source,h.target].filter(g=>g===p.dataStore.id).length!==1){i.push({kind:"data-association-ends",opIndex:d,source:h.source,target:h.target});continue}const v=h.source===p.dataStore.id?h.target:h.source;l(d,v,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:h,target:y}=p.association,v=l(d,h,"source"),g=l(d,y,"target");if(v&&g){const b=new Set([v,g]);b.has("dataStore")&&b.has("flowNode")||i.push({kind:"data-association-ends",opIndex:d,source:h,target:y})}break}case"association.add":{const{id:h,source:y,target:v}=p.association,g=l(d,y,"source"),b=l(d,v,"target");g&&b&&g!=="annotation"&&b!=="annotation"&&i.push({kind:"association-detached",opIndex:d,annotation:h??`${y}->${v}`});break}case"annotation.add":{if(p.association){const{source:h,target:y}=p.association;if(h!==p.annotation.id&&y!==p.annotation.id)i.push({kind:"association-detached",opIndex:d,annotation:p.annotation.id});else{const v=h===p.annotation.id?y:h;l(d,v,"association")}}p.placement&&l(d,p.placement.anchor,"anchor");break}case"group.add":{for(const h of p.group.members??[]){const y=l(d,h,"member");y&&Kh.has(y)&&i.push({kind:"ref-category",opIndex:d,ref:h,role:"member",expected:"shape",actual:y})}break}case"participant.update":{if(f(d,p.id,"participant")===void 0)break;if(p.lanes){const h=t.lanesOf(p.id),y=p.lanes.map(g=>g.id);for(const g of h)y.includes(g)||i.push({kind:"lane-shrink-unsupported",opIndex:d,participant:p.id,lane:g});for(const g of y)t.categoryOf(g)!==void 0&&!h.includes(g)&&i.push({kind:"id-duplicate",opIndex:d,id:g});const v=y.filter(g=>h.includes(g));v.length===h.length&&v.some((g,b)=>g!==h[b])&&i.push({kind:"lane-reorder-unsupported",opIndex:d,participant:p.id})}break}case"node.update":{if(f(d,p.id,"flowNode")===void 0)break;if(p.lane!==void 0){const h=t.participantOf(p.id);(h?o.get(h)??t.lanesOf(h):[]).includes(p.lane)||i.push({kind:"lane-unknown",opIndex:d,lane:p.lane,participant:h??""})}break}case"sequenceFlow.update":{if(f(d,p.id,"sequenceFlow")===void 0)break;if(p.name!==void 0&&p.condition!==void 0&&i.push({kind:"condition-name-conflict",opIndex:d,id:p.id}),p.source!==void 0||p.target!==void 0){const h=p.source===void 0||l(d,p.source,"source",["flowNode"])!==void 0,y=p.target===void 0||l(d,p.target,"target",["flowNode"])!==void 0,v=t.endpointsOf(p.id),g=p.source??(v==null?void 0:v.source),b=p.target??(v==null?void 0:v.target);h&&y&&g!==void 0&&b!==void 0&&new Set([c(g),c(b),c(p.id)]).size>1&&i.push({kind:"flow-cross-pool",opIndex:d,id:p.id})}break}case"messageFlow.update":f(d,p.id,"messageFlow");break;case"dataStore.update":f(d,p.id,"dataStore");break;case"annotation.update":{if(f(d,p.id,"annotation")===void 0)break;p.placement&&l(d,p.placement.anchor,"anchor");break}case"group.update":{if(f(d,p.id,"group")===void 0)break;for(const h of p.members??[]){const y=l(d,h,"member");y&&Kh.has(y)&&i.push({kind:"ref-category",opIndex:d,ref:h,role:"member",expected:"shape",actual:y})}break}case"element.remove":{f(d,p.id)==="lane"&&i.push({kind:"ref-category",opIndex:d,ref:p.id,role:"target",expected:"removable",actual:"lane"});break}}}),i;function f(p,d,m){if(r.has(d)){i.push({kind:"target-added-in-batch",opIndex:p,id:d});return}const h=t.categoryOf(d);if(h===void 0){i.push({kind:"ref-missing",opIndex:p,ref:d,role:"target"});return}if(m&&h!==m){i.push({kind:"ref-category",opIndex:p,ref:d,role:"target",expected:m,actual:h});return}return h}}function Qh(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 Os(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const Ds={"top-left":[-1,-1],top:[0,-1],"top-right":[1,-1],right:[1,0],"bottom-right":[1,1],bottom:[0,1],"bottom-left":[-1,1],left:[-1,0]},sn=10,eS=300,tS=160,Jh=20,em=40,nS=10;function Su(e,t,n,i,r){const o=n,a=(D,I)=>{const[z,oe]=Ds[D];let ye={x:t.x+t.width/2+z*(t.width/2+o.width/2+I),y:t.y+t.height/2+oe*(t.height/2+o.height/2+I)};const Ve=i.x+sn+o.width/2,He=i.x+i.width-sn-o.width/2,it=i.y+sn+o.height/2,K=i.y+i.height-sn-o.height/2,Z={x:Math.min(He,Math.max(Ve,ye.x)),y:Math.min(K,Math.max(it,ye.y))};return(Z.x!==ye.x||Z.y!==ye.y)&&(ye=Math.abs(Z.x-(t.x+t.width/2))<(t.width+o.width)/2+sn&&Math.abs(Z.y-(t.y+t.height/2))<(t.height+o.height)/2+sn?{x:t.x+t.width+sn+o.width/2,y:Z.y}:Z),ye},s=(i.children??[]).filter(D=>!("waypoints"in D&&D.waypoints)&&D.type!=="bpmn:Lane"&&D.type!=="label"&&typeof D.x=="number"&&D.id!==r.selfId),c=nt(e),l=D=>{var z,oe;if(!r.selfId)return!1;const I=e.get(D);return!!I&&(((z=I.source)==null?void 0:z.id)===r.selfId||((oe=I.target)==null?void 0:oe.id)===r.selfId)},u=c.edges.filter(D=>!l(D.id)).flatMap(_n),f=mo(c).filter(D=>D.owner!==r.selfId).map(D=>D.rect),p=D=>({x0:D.x-o.width/2-sn,x1:D.x+o.width/2+sn,y0:D.y-o.height/2-sn,y1:D.y+o.height/2+sn}),d=D=>{const I=p(D);return s.some(z=>I.x0<z.x+z.width&&I.x1>z.x&&I.y0<z.y+z.height&&I.y1>z.y)},m=D=>{const I=p(D);return u.some(z=>z.axis==="h"?z.at>I.y0&&z.at<I.y1&&z.lo<I.x1&&z.hi>I.x0:z.at>I.x0&&z.at<I.x1&&z.lo<I.y1&&z.hi>I.y0)},h=D=>{const I=p(D);return f.some(z=>I.x0<z.x+z.width&&I.x1>z.x&&I.y0<z.y+z.height&&I.y1>z.y)},y=c.shapes.filter(D=>D.type==="bpmn:Group").flatMap(D=>[{axis:"h",at:D.y,lo:D.x,hi:D.x+D.width},{axis:"h",at:D.y+D.height,lo:D.x,hi:D.x+D.width},{axis:"v",at:D.x,lo:D.y,hi:D.y+D.height},{axis:"v",at:D.x+D.width,lo:D.y,hi:D.y+D.height}]),v=D=>{const I=p(D);return y.some(z=>z.axis==="h"?z.at>I.y0&&z.at<I.y1&&z.lo<I.x1&&z.hi>I.x0:z.at>I.x0&&z.at<I.x1&&z.lo<I.y1&&z.hi>I.y0)},g=D=>d(D)||m(D)||h(D)||v(D),b=D=>D.x-o.width/2>=i.x&&D.x+o.width/2<=i.x+i.width&&D.y-o.height/2>=i.y&&D.y+o.height/2<=i.y+i.height;if(r.placement){const D=He=>He.startsWith("top")?He.replace(/^top/,"bottom"):He.replace(/^bottom/,"top"),I=He=>He.endsWith("left")?He.replace(/left$/,"right"):He.replace(/right$/,"left"),z=r.placement.side,oe=[z,D(z),I(z),D(I(z)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],ye=r.placement.offset??50;let Ve=a(z,ye);if(g(Ve)){const He=new Set;for(const it of oe){if(He.has(it))continue;He.add(it);const K=a(it,ye);if(b(K)&&!g(K)){Ve=K;break}}}return Ve}const x=r.from,C=i.x+sn+o.width/2,M=i.x+i.width-sn-o.width/2,k=i.y+sn+o.height/2,P=i.y+i.height-sn-o.height/2;let B={x:Math.min(M,Math.max(C,x.x)),y:Math.min(P,Math.max(k,x.y))};if(g(B)){const D=(t.width+o.width)/2+sn,z=[{x:B.x+D,y:B.y},{x:B.x-D,y:B.y},{x:B.x,y:B.y-o.height-sn},{x:B.x,y:B.y+o.height+sn}].filter(b).find(oe=>!g(oe));z&&(B=z)}return B}function en(e,t){return e.filter(n=>n.kind===t)}function tm(e,t){var Ww,Uw,Yw,qw,Kw,Xw,Zw,Qw,Jw,e0,t0,n0,i0,r0,o0,a0,s0,c0,l0,u0,p0,f0,d0;const{modeling:n,bpmnFactory:i,elementFactory:r,elementRegistry:o,canvas:a,autoPlace:s,bpmnReplace:c,spaceTool:l}=t,u=()=>a.getRootElement(),f=_=>o.get(_),p=_=>{const R=f(_);if(!R)throw new Error(`하강 참조 해소 실패: ${_}`);return R},d=_=>{let R=_.parent;for(;R;){if(R.type==="bpmn:Participant")return R;R=R.parent}},m=new Map;for(const _ of o.filter(R=>!("waypoints"in R&&R.waypoints)&&R.type!=="bpmn:Lane"&&R.type!=="label"&&typeof R.x=="number"))m.set(_.id,{x:_.x,y:_.y});const h=en(e,"participant.add"),y=en(e,"node.add"),v=en(e,"sequenceFlow.add"),g=en(e,"messageFlow.add"),b=en(e,"dataStore.add"),x=en(e,"dataAssociation.add"),C=en(e,"annotation.add"),M=en(e,"group.add"),k=new Map(y.map(_=>[_.node.id,_])),P=(_,R,A)=>{var j;const O=_.businessObject,$=(((j=O.extensionElements)==null?void 0:j.values)??[]).filter(H=>H.$type!==R),L=A?[...$,i.create(R,A)]:$;if(!L.length){O.extensionElements&&n.updateProperties(_,{extensionElements:void 0});return}const N=i.create("bpmn:ExtensionElements",{values:L});L.forEach(H=>{H.$parent=N}),n.updateProperties(_,{extensionElements:N})},B=_=>({anchor:_.anchor,side:_.side,..._.offset!==void 0?{offset:_.offset}:{}});for(const _ of en(e,"element.remove")){const R=f(_.id);R&&n.removeElements([R])}const D=_=>o.filter(R=>{var A;return R.type==="bpmn:Lane"&&((A=d(R))==null?void 0:A.id)===_}).sort((R,A)=>R.y-A.y);for(const _ of en(e,"participant.update")){const R=p(_.id);if(_.name!==void 0&&n.updateProperties(R,{name:_.name??void 0}),!_.lanes)continue;const A=D(_.id);if(!A.length){n.splitLane(R,_.lanes.length),D(_.id).forEach(($,L)=>{const N=_.lanes[L];N&&n.updateProperties($,{id:N.id,name:N.name})});continue}const O=new Set(A.map($=>$.id));_.lanes.forEach(($,L)=>{if(O.has($.id)){n.updateProperties(p($.id),{name:$.name});return}const N=L===0?n.addLane(D(_.id)[0],"top"):n.addLane(p(_.lanes[L-1].id),"bottom");n.updateProperties(N,{id:$.id,name:$.name})})}const I=150,z=130,oe=80,ye=90,Ve=180,He=30,it=30,K=(_,R,A,O,$)=>{const L=A-R.width/2,N=O-R.height/2;return(_.children??[]).find(j=>!("waypoints"in j&&j.waypoints)&&j.type!=="bpmn:Lane"&&j.type!=="label"&&!($!=null&&$.has(j.id))&&typeof j.x=="number"&&L<j.x+j.width+it&&L+R.width+it>j.x&&N<j.y+j.height&&N+R.height>j.y)},Z=new Set;for(const _ of h){Z.add(`pool:${_.participant.id}`);for(const R of _.participant.lanes??[])Z.add(R.id)}const se=new Map;for(const _ of y){const R=_.node.lane??`pool:${_.node.participant??""}`;let A=se.get(R);A||se.set(R,A=new Set([0])),_.band!==void 0&&A.add(_.band)}const xe=new Map;for(const[_,R]of se){if(!Z.has(_))continue;const A=[...R].sort((L,N)=>L-N),O=A.map((L,N)=>N===0?0:N%2===1?Math.ceil(N/2):-(N/2)),$=Math.min(...O);xe.set(_,new Map(A.map((L,N)=>[L,O[N]-$])))}{const _=new Map;for(const R of h)(R.participant.lanes??[]).forEach((A,O)=>_.set(A.id,O));for(const[R,A]of xe){if(!_.has(R)||A.size<2)continue;const O=_.get(R),$=A.get(0)??0,L=new Set;for(const re of y){if(re.node.lane!==R||(re.band??0)!==0||!re.node.type.endsWith("Gateway"))continue;const Me={in:new Set,out:new Set,cross:new Set};for(const we of v){const Pe=we.flow.source===re.node.id;if(!Pe&&we.flow.target!==re.node.id)continue;const lt=k.get(Pe?we.flow.target:we.flow.source);if(!lt||lt.node.participant!==re.node.participant||!lt.node.lane)continue;let De,le=!1;if(lt.node.lane!==R){const Re=_.get(lt.node.lane);if(Re===void 0)continue;De=Re>O?"down":"up",le=!0}else{const Re=A.get(lt.band??0)??$;De=Re>$?"down":Re<$?"up":void 0}De&&(Me[Pe?"out":"in"].add(De),le&&Me.cross.add(De))}for(const we of["up","down"])Me.in.has(we)&&Me.out.has(we)&&Me.cross.has(we)&&L.add(we)}if(L.size!==1)continue;const[N]=L,j=Math.max(...A.values()),H=N==="down"?j:0;if($===H)continue;const Y=[...A.entries()].filter(([re])=>re!==0).sort((re,Me)=>re[1]-Me[1]),ae=[...Array(j+1).keys()].filter(re=>re!==H),_e=new Map([[0,H]]);Y.forEach(([re],Me)=>_e.set(re,ae[Me])),xe.set(R,_e)}}const q=_=>{var R;return(((R=se.get(_))==null?void 0:R.size)??0)>1},V=_=>_.band??(_.node.lane||!q(`pool:${_.node.participant??""}`)?void 0:0),ne=new Map,Te=_=>ne.get(_.node.id)??V(_),yt=new Set,T=new Set;{const _=new Map;for(const O of v)_.set(O.flow.target,(_.get(O.flow.target)??0)+1);const R=O=>{const $=[],L=new Set([O]),N=[O];for(;N.length;){const j=N.shift();$.push(j);for(const H of v)H.flow.source!==j||L.has(H.flow.target)||(_.get(H.flow.target)??0)!==1||(L.add(H.flow.target),N.push(H.flow.target))}return $},A=(O,$)=>{var L;return((L=xe.get(O))==null?void 0:L.get($))??$};for(const O of y){if(!O.node.type.endsWith("Gateway"))continue;const $=O.node.lane??`pool:${O.node.participant??""}`,L=xe.get($);if(!L||L.size<2)continue;const N=Te(O);if(N===void 0||A($,N)!==A($,0))continue;const j=A($,N),H=v.filter(we=>we.flow.source===O.node.id).map(we=>k.get(we.flow.target)).filter(we=>!!we&&(we.node.lane??`pool:${we.node.participant??""}`)===$),Y=H.filter(we=>{const Pe=Te(we);return Pe!==void 0&&A($,Pe)===j&&(_.get(we.node.id)??0)===1}),ae=H.some(we=>{const Pe=Te(we);return Pe!==void 0&&A($,Pe)>j});if(Y.length!==1||!ae)continue;const _e=new Set(H.flatMap(we=>R(we.node.id)));if(!v.some(we=>we.flow.target===O.node.id&&_e.has(we.flow.source)))continue;const Me=new Map;for(const[we,Pe]of L)Me.set(we,Pe+1);Me.set(-1,0),xe.set($,Me);for(const we of R(Y[0].node.id))k.has(we)&&(ne.set(we,-1),T.add(we));yt.add(O.node.id)}}const w=(_,R)=>{var A;return((A=xe.get(_))==null?void 0:A.get(R))??R},E=(_,R,A,O)=>{const $=_?f(_):R?f(R):void 0;if(!$)return!1;const L=_?$.y+Math.min($.height/2,ye):$.y+oe;return Math.abs(L+w(_??`pool:${R??""}`,A)*I-O)<=I/2},G=new Map;for(const[_,R]of se){let A=0;for(const O of R)A=Math.max(A,w(_,O));G.set(_,A)}const U=_=>Ve+I*_,X=(_,R,A)=>{const O=u().children.filter($=>!("waypoints"in $&&$.waypoints)&&$.id!==R&&typeof $.y=="number"&&$.y>=_);O.length&&n.moveElements(O,{x:0,y:A})},Ce=(_,R,A)=>{const O=_.type==="bpmn:Participant"?_:void 0;if(!O||O.children.some(j=>j.type==="bpmn:Lane"))return;const $=A+R.height/2+He-O.y;if(O.height>=$)return;const L=$-O.height,N=O.y+O.height;n.resizeShape(O,{x:O.x,y:O.y,width:O.width,height:$}),X(N,O.id,L)},Ue=(_,R)=>{const A=R-_.height;if(A<=0)return;const O=d(_)??_,$=[],L=H=>{$.push(H);for(const Y of H.children??[])L(Y)};L(O);const N=_.y+_.height-10,j=l.calculateAdjustments($,"y",A,N);l.makeSpace(j.movingShapes,j.resizingShapes,{x:0,y:A},"s",N)},st=(_,R,A)=>{if(_){const N=p(_),j=U(R);if(N.height>=j)return;const H=j-N.height,Y=d(N),ae=Y?Y.y+Y.height:N.y+N.height;Ue(N,j),X(ae,Y==null?void 0:Y.id,H);return}if(!A)return;const O=I*(R+1);if(A.height>=O)return;const $=O-A.height,L=A.y+A.height;n.resizeShape(A,{x:A.x,y:A.y,width:A.width,height:O}),X(L,A.id,$)},Ot=new Map;for(const _ of v)Ot.set(_.flow.target,(Ot.get(_.flow.target)??0)+1);const pt=_=>(Ot.get(_)??0)<=1,Wt=(_,R,A)=>{if(!_)return!0;const O=f(_);return O?A-R.height/2>=O.y&&A+R.height/2<=O.y+O.height:!0},nn=h.map((_,R)=>({op:_,declared:R}));nn.sort((_,R)=>{const A=_.op.order??Number.POSITIVE_INFINITY,O=R.op.order??Number.POSITIVE_INFINITY;return A!==O?A-O:_.declared-R.declared});let rn=80;for(const _ of o.getAll())_.parent===u()&&"height"in _&&typeof _.y=="number"&&(rn=Math.max(rn,_.y+_.height+60));for(const{op:_}of nn){const R=_.participant,A=y.filter(re=>re.node.participant===R.id).length,O=((Ww=R.lanes)==null?void 0:Ww.length)??0,$=Math.max(1200,A*160+300),L=(R.lanes??[]).map(re=>U(G.get(re.id)??0)),N=L.reduce((re,Me)=>re+Me,0);O&&N<300&&(L[O-1]+=300-N);const j=Math.max(300,I*((G.get(`pool:${R.id}`)??0)+1)),H=R.blackBox||A+O===0?120:O?Math.max(300,N):j,Y=r.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:R.id,name:R.name,..._.order!==void 0?{"bwl:poolOrder":_.order}:{},...R.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:$,height:H,isExpanded:!0}),ae=n.createShape(Y,{x:100+$/2,y:rn+H/2},u()),_e=R.lanes??[];if(_e.length&&n.splitLane(ae,_e.length),_e.length){const re=o.filter(Me=>{var we;return Me.type==="bpmn:Lane"&&((we=d(Me))==null?void 0:we.id)===R.id}).sort((Me,we)=>Me.y-we.y);if(re.forEach((Me,we)=>{const Pe=_e[we];Pe&&n.updateProperties(Me,{id:Pe.id,name:Pe.name})}),L.some(Me=>Me!==ae.height/O)){let Me=ae.y;re.forEach((we,Pe)=>{const lt=L[Pe];n.resizeShape(we,{x:we.x,y:Me,width:we.width,height:lt}),Me+=lt})}}rn=ae.y+ae.height+60}const xt=_=>{var O;const R=k.get(_);if(R)return R.node.participant??"";const A=f(_);return A?A.type==="bpmn:Participant"?A.id:((O=d(A))==null?void 0:O.id)??"":""},Dt=new Map,bn=_=>{let R=Dt.get(_);return R||Dt.set(_,R={nodes:[],flows:[]}),R};for(const _ of y)bn(_.node.participant??"").nodes.push(_);for(const _ of v)bn(xt(_.flow.source)).flows.push(_);const Pr=_=>{var R;return i.create("bpmn:SequenceFlow",{id:_.id,name:_.name??((R=_.condition)==null?void 0:R.label)})},jn=(_,R,A)=>r.createShape({type:Os(_.type),businessObject:i.create(Os(_.type),{id:_.id,name:_.name,...R!==void 0?{"bwl:band":R}:{},...A!==void 0?{"bwl:afterColumn":A}:{}})}),Ti=[...nn.map(({op:_})=>_.participant.id).filter(_=>Dt.has(_)),...[...Dt.keys()].filter(_=>!h.some(R=>R.participant.id===_))],Hn=_=>_.endsWith("Gateway");for(const _ of Ti){const R=Dt.get(_),A=_?p(_):void 0,O=A?A.x+150:250;let $=A?A.y+80:120;const L=(le,Re,ue)=>{if(le){const Ae=p(le);return Ae.y+Math.min(Ae.height/2,ye)+w(le,Re??0)*I}return Re!==void 0&&A?A.y+oe+w(`pool:${_}`,Re)*I:ue},N=(le,Re,ue)=>{if(le){const Ae=p(le);return Ae.y+Math.min(Ae.height/2,ye)+Re*I}return A?A.y+oe+Re*I:ue},j=le=>le.participant?p(le.participant):u(),H=(le,Re,ue,Ae,rt,We,Le)=>{const tt=ue!==void 0||Ae!==void 0,de=w(ue??`pool:${_}`,Ae??0);if((Ae===void 0||E(ue,_,Ae,Le??Number.NaN))&&Le!==void 0&&Wt(ue,Re,Le)&&!K(le,Re,rt,Le))return{x:rt,y:Le};if(tt)for(let ce=0;ce<4;ce++){const he=N(ue,de+ce,We);if(!K(le,Re,rt,he))return st(ue,de+ce,A),{x:rt,y:he}}const fe=L(ue,Ae,We);tt?st(ue,de,A):Ce(le,Re,fe);let Q=rt;for(let ce=0;ce<64;ce++){const he=K(le,Re,Q,fe);if(!he)break;Q=he.x+he.width+z+Re.width/2}return{x:Q,y:fe}},Y=new Set(R.flows.map(le=>le.flow.target)),ae=new Map,_e=le=>{if(le===void 0)return;const Re=o.get(le);if(!(!Re||typeof Re.x!="number"||typeof Re.width!="number"))return Re.x+Re.width+z};for(const le of R.nodes){if(Y.has(le.node.id))continue;const Re=jn(le.node,le.band,le.afterColumn),ue=V(le),Ae=le.node.lane?`${le.node.lane}|${ue??""}`:ue!==void 0?`band:${ue}`:"",rt=j(le.node),We=ae.get(Ae)??O,Le=_e(le.afterColumn),tt=Le===void 0?We:Math.max(We,Le),de=H(rt,Re,le.node.lane,ue,tt,$);n.createShape(Re,de,rt),ae.set(Ae,de.x+Re.width+z),!le.node.lane&&ue===void 0&&($+=160)}const re=new Set,Me=new Map,we=new Map,Pe=new Map;if(_&&Z.has(`pool:${_}`)){const le=new Map;for(const de of R.flows)le.set(de.flow.target,(le.get(de.flow.target)??0)+1);const Re=de=>L(de.node.lane,Te(de),Number.NaN),ue=new Set,Ae=de=>{var ce;const fe=(ce=k.get(de))==null?void 0:ce.node.participant;if(fe)return f(fe);const Q=f(de);if(Q)return Q.type==="bpmn:Participant"?Q:d(Q)},rt=de=>{const fe=[],Q=new Set([de]),ce=[de];for(;ce.length;){const he=ce.shift(),ve=k.get(he);ve&&fe.push(ve);for(const me of R.flows)me.flow.source!==he||Q.has(me.flow.target)||(le.get(me.flow.target)??0)!==1||(Q.add(me.flow.target),ce.push(me.flow.target))}return fe},We=de=>{if(!A)return;const fe=new Set(de.map(he=>he.node.id));let Q=!1,ce=!1;for(const he of g){if(!fe.has(he.flow.source))continue;const ve=Ae(he.flow.target);!ve||ve.id===A.id||(ve.y<A.y?Q=!0:ce=!0)}return Q&&!ce?"up":ce&&!Q?"down":void 0};for(const de of R.nodes){if(!Hn(de.node.type))continue;const fe=L(de.node.lane,V(de),Number.NaN);if(Number.isNaN(fe))continue;const Q=[];for(const me of R.flows){if(me.flow.source!==de.node.id)continue;const pe=k.get(me.flow.target);if(!pe||pe.node.lane!==de.node.lane||(le.get(pe.node.id)??0)!==1)continue;const ke=V(pe);if(ke===void 0)continue;const ut=L(pe.node.lane,ke,Number.NaN);if(Number.isNaN(ut))continue;const _t=rt(pe.node.id),Xe=We(_t);Xe&&Q.push({subtree:_t,band:ke,row:ut,dir:Xe})}if(!Q.some(me=>me.dir==="up")||!Q.some(me=>me.dir==="down")||!Q.some(me=>me.dir==="up"&&Q.some(pe=>pe.dir==="down"&&pe.row<me.row)))continue;const he=[...Q].sort((me,pe)=>me.row-pe.row);[...Q.filter(me=>me.dir==="up"),...Q.filter(me=>me.dir==="down")].sort((me,pe)=>me.dir===pe.dir?me.row-pe.row:me.dir==="up"?-1:1).forEach((me,pe)=>{const ke=he[pe].band;if(ke!==me.band){ue.add(de.node.id);for(const ut of me.subtree)V(ut)===me.band&&ne.set(ut.node.id,ke)}})}const Le=de=>{if(!A)return;const fe=new Set(de.map(he=>he.node.id));let Q=!1,ce=!1;for(const he of g){if(!fe.has(he.flow.target))continue;const ve=Ae(he.flow.source);!ve||ve.id===A.id||(ve.y<A.y?Q=!0:ce=!0)}return Q&&!ce?"up":ce&&!Q?"down":void 0};for(const de of R.nodes){if(!Hn(de.node.type))continue;const fe=de.node.lane??`pool:${_}`,Q=xe.get(fe);if(!Q||Q.size<2)continue;const ce=Q.get(0);if(ce===void 0)continue;const he=Math.max(...Q.values()),ve=ce===he&&ce!==0?"down":void 0;if(!ve)continue;const me=[];for(const Xe of R.flows){if(Xe.flow.source!==de.node.id)continue;const dt=k.get(Xe.flow.target);if(!dt||dt.node.lane!==de.node.lane||(le.get(dt.node.id)??0)!==1)continue;const fn=Te(dt);fn!==void 0&&me.push({t:dt,subtree:rt(dt.node.id),band:fn})}const pe=me.find(Xe=>(Q.get(Xe.band)??Xe.band)===ce);if(!pe||Le(pe.subtree)===ve||We(pe.subtree)===ve)continue;const ke=me.find(Xe=>Xe!==pe&&Le(Xe.subtree)===ve);if(!ke)continue;const ut=pe.band,_t=ke.band;for(const Xe of pe.subtree)Te(Xe)===ut&&ne.set(Xe.node.id,_t);for(const Xe of ke.subtree)Te(Xe)===_t&&ne.set(Xe.node.id,ut);ue.add(de.node.id)}for(const de of R.nodes){if(!Hn(de.node.type))continue;const fe=Re(de);if(Number.isNaN(fe)||C.some(me=>{var pe,ke;return(((pe=me.placement)==null?void 0:pe.anchor)??(me.association?me.association.source===me.annotation.id?me.association.target:me.association.source:void 0))===de.node.id&&((ke=me.placement)==null?void 0:ke.side.startsWith("bottom"))}))continue;let ce,he=!1,ve;for(const me of R.flows){if(me.flow.source!==de.node.id)continue;const pe=k.get(me.flow.target);if(!pe||!pe.node.lane&&V(pe)===void 0)continue;const ke=Re(pe);Number.isNaN(ke)||(Math.abs(ke-fe)<.5&&(he=!0),ke>fe?!ce||ke>ce.row?ce={id:pe.node.id,row:ke,count:1}:ke===ce.row&&ce.count++:ke<fe&&pe.node.lane===de.node.lane&&(!ve||ke>ve.row?ve={op:pe,row:ke,count:1}:ke===ve.row&&ve.count++))}ce&&ce.count===1&&(le.get(ce.id)??0)===1&&!ue.has(de.node.id)&&re.add(ce.id),!he&&ve&&ve.count===1&&(le.get(ve.op.node.id)??0)===1&&!yt.has(de.node.id)&&Me.set(ve.op.node.id,{lane:de.node.lane,band:Te(de)})}const tt=new Map;for(const de of g)tt.set(de.flow.target,[...tt.get(de.flow.target)??[],de]);for(const de of R.nodes){const fe=tt.get(de.node.id);if(!fe||fe.length!==1||!le.get(de.node.id)||!de.node.lane&&V(de)===void 0||T.has(de.node.id))continue;const Q=(Uw=k.get(fe[0].flow.source))==null?void 0:Uw.node.participant,ce=Q?f(Q):void 0;if(!ce||!A||ce.id===A.id)continue;const he=de.node.lane??`pool:${_}`,ve=xe.get(he);if(!ve)continue;const me=ve.get(0)??0,pe=(ve.get(Te(de)??0)??me)-me;if(pe===0)continue;const ke=ce.y<A.y;if(ke&&pe<0||!ke&&pe>0)continue;let ut;for(const[_t,Xe]of ve){const dt=Xe-me;(ke&&dt<0&&(!ut||dt<ut.row)||!ke&&dt>0&&(!ut||dt>ut.row))&&(ut={band:_t,row:dt})}ut&&we.set(de.node.id,{lane:de.node.lane,band:ut.band})}}const lt=new Set;let De=0;for(;De++<R.nodes.length+2;){for(let ue=0;ue<R.nodes.length+R.flows.length+2;ue++){let Ae=!1;for(const rt of R.flows){const We=rt.flow;if(lt.has(We.id))continue;const Le=f(We.source);if(!Le)continue;const tt=f(We.target),de=k.get(We.target);if(!tt&&de){const fe=jn(de.node,de.band),Q=Te(de);if(de.node.lane||Q!==void 0){const ce=j(de.node),he=Le,ve=he.x+(Pe.get(We.source)??0)+he.width+z,me=Me.get(We.target)??we.get(We.target),pe=H(ce,fe,me?me.lane:de.node.lane,me?me.band:Q,re.has(We.target)?he.x+he.width/2:ve,Number.NaN,me||!pt(We.target)?void 0:he.y+he.height/2),ke=n.createShape(fe,pe,ce);re.has(We.target)&&Pe.set(We.target,ve-(ke.x+ke.width/2)),n.connect(Le,ke,{type:"bpmn:SequenceFlow",businessObject:Pr(We)})}else s.append(Le,fe,{connection:{type:"bpmn:SequenceFlow",businessObject:Pr(We)}})}else if(tt)n.connect(Le,tt,{type:"bpmn:SequenceFlow",businessObject:Pr(We)});else continue;lt.add(We.id),Ae=!0}if(!Ae)break}const le=R.nodes.filter(ue=>!f(ue.node.id));if(!le.length)break;const Re=le[0];{const ue=jn(Re.node,Re.band),Ae=j(Re.node),rt=V(Re);n.createShape(ue,H(Ae,ue,Re.node.lane,rt,O,$),Ae),!Re.node.lane&&rt===void 0&&($+=160)}}}const Nt=40,Kn=(_,R=()=>!0)=>{const A=f(_);if(!A)return[];const O=[A],$=new Set([_]);for(let L=0;L<O.length;L++){const N=O[L].id;for(const j of v){const H=j.flow.target;if(j.flow.source!==N||$.has(H)||!k.has(H))continue;$.add(H);const Y=f(H);Y&&R(Y)&&O.push(Y)}}return O},jl=(_,R=()=>!0)=>{const A=f(_);if(!A)return[];const O=[A],$=new Set([_]);for(let L=0;L<O.length;L++){const N=O[L].id;for(const j of v){const H=j.flow.source;if(j.flow.target!==N||$.has(H)||!k.has(H))continue;$.add(H);const Y=f(H);Y&&R(Y)&&O.push(Y)}}return O},Ut=30,Je=_=>!("waypoints"in _&&_.waypoints)&&_.type!=="bpmn:Lane"&&_.type!=="label"&&typeof _.x=="number",ct=(_,R)=>{const A=new Set(_.flatMap(N=>N.subtree.map(j=>j.id)));for(const N of _){const j=(N.pool.children??[]).filter(Je).filter(Y=>!A.has(Y.id));if(N.subtree.some(Y=>j.some(ae=>Y.x+R<ae.x+ae.width+Ut&&Y.x+R+Y.width+Ut>ae.x&&Y.y<ae.y+ae.height&&Y.y+Y.height>ae.y)))return null}const O=_.map(N=>N.pool.width),$=o.filter(N=>N.type==="label").map(N=>({label:N,x:N.x,y:N.y}));n.moveElements(_.flatMap(N=>N.subtree),{x:R,y:0});const L=_.map(N=>{const H=Math.max(...N.subtree.map(Y=>Y.x+Y.width))+150-(N.pool.x+N.pool.width);return H>0&&n.resizeShape(N.pool,{x:N.pool.x,y:N.pool.y,width:N.pool.width+H,height:N.pool.height}),H});return()=>{n.moveElements(_.flatMap(N=>N.subtree),{x:-R,y:0}),_.forEach((N,j)=>{L[j]>0&&n.resizeShape(N.pool,{x:N.pool.x,y:N.pool.y,width:O[j],height:N.pool.height})});for(let N=0;N<3;N++){let j=0;for(const H of $){const Y=H.x-H.label.x,ae=H.y-H.label.y;Math.abs(Y)<=.5&&Math.abs(ae)<=.5||(n.moveElements([H.label],{x:Y,y:ae}),j++)}if(!j)break}}},Ew=_=>{var $,L;const R=new Map,A=new Map;for(const N of o.getAll()){if(N.type!=="bpmn:Participant")continue;const j=N;(j.children??[]).length||(R.set(j.id,j),A.set(j.id,[]))}for(const N of o.getAll()){if(N.type!=="bpmn:MessageFlow")continue;const j=N,H=($=j.source)==null?void 0:$.id,Y=(L=j.target)==null?void 0:L.id;H&&Y&&A.has(H)&&A.get(H).push(Y),H&&Y&&A.has(Y)&&A.get(Y).push(H)}const O=[];for(const[N,j]of A)j.length&&j.every(H=>_.has(H))&&O.push(R.get(N));return O},Sw=(_,R)=>{if(!_.length)return null;const A=new Set(_.map(N=>N.id)),O=o.getAll().filter(N=>N.type==="bpmn:Participant"&&!A.has(N.id));if(_.some(N=>O.some(j=>N.x+R<j.x+j.width+Ut&&N.x+R+N.width+Ut>j.x&&N.y<j.y+j.height&&N.y+N.height>j.y)))return null;const L=o.filter(N=>N.type==="label").map(N=>({label:N,x:N.x,y:N.y}));return n.moveElements(_,{x:R,y:0}),()=>{n.moveElements(_,{x:-R,y:0});for(let N=0;N<3;N++){let j=0;for(const H of L){const Y=H.x-H.label.x,ae=H.y-H.label.y;Math.abs(Y)<=.5&&Math.abs(ae)<=.5||(n.moveElements([H.label],{x:Y,y:ae}),j++)}if(!j)break}}},Rw=()=>{let _=0;for(const R of o.getAll()){if(R.type!=="bpmn:DataInputAssociation"&&R.type!=="bpmn:DataOutputAssociation")continue;const A=R.waypoints??[];for(let O=1;O<A.length;O++)_+=Math.hypot(A[O].x-A[O-1].x,A[O].y-A[O-1].y)}return _},Cw=()=>{let _=0;for(const R of o.getAll()){if(R.type!=="bpmn:Association")continue;const A=R.waypoints??[];for(let O=1;O<A.length;O++)_+=Math.hypot(A[O].x-A[O-1].x,A[O].y-A[O-1].y)}return _},TL=_=>{const R=[];for(const A of o.getAll()){if(A.type!=="bpmn:TextAnnotation")continue;const O=A;if(_.has(O.id))continue;const L=[...O.incoming??[],...O.outgoing??[]].filter(H=>H.type==="bpmn:Association").map(H=>H.source===O?H.target:H.source);if(!L.length||L.some(H=>H===void 0))continue;const N=H=>{if(!("waypoints"in H&&H.waypoints))return[H.id];const Y=H,ae=[Y.source,Y.target];return ae.some(_e=>!_e)?[]:ae.map(_e=>_e.id)},j=L.flatMap(H=>N(H));j.length&&j.every(H=>_.has(H))&&R.push(O)}return R},Aw=()=>At(nt(o)).filter(_=>_.kind==="edge-crosses-shape").length,Pw=_=>{const R=(_.children??[]).filter(Je);let A=0;for(let O=0;O<R.length;O++)for(let $=O+1;$<R.length;$++){const L=R[O],N=R[$];L.x<N.x+N.width&&L.x+L.width>N.x&&L.y<N.y+N.height&&L.y+L.height>N.y&&A++}return A},Qo=()=>{const _=nt(o),R=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:_.edges.filter(A=>A.type==="bpmn:MessageFlow"&&A.waypoints.length===2).length,lines:_.edges.filter(A=>R(A.waypoints)).length}},kL=_=>{const R=new Map;for(const O of o.getAll()){if(O.type!=="bpmn:MessageFlow")continue;const $=O;if(!$.waypoints||$.waypoints.length!==2)continue;const L=$.source,N=$.target;if(!L||!N)continue;const j=_.has(L.id);if(j===_.has(N.id))continue;const H=j?N:L,Y=d(H);if(!Y||_.has(H.id))continue;const ae=R.get(Y.id);ae?H.x<ae.minX&&(ae.minX=H.x):R.set(Y.id,{pool:Y,minX:H.x})}const A=[];for(const{pool:O,minX:$}of R.values()){const L=(O.children??[]).filter(N=>Je(N)&&!_.has(N.id)&&N.x>=$);L.length&&A.push({subtree:L,pool:O})}return A};for(const _ of en(e,"sequenceFlow.update")){if(_.target===void 0)continue;const R=k.get(_.target);if(!R)continue;const A=f(_.target),O=f(_.id);if(!A||!O)continue;const $=_.source!==void 0?f(_.source):O.source,L=O.target;if(!$||!L||L.id===A.id)continue;const N=Kn(_.target),j=new Set(N.map(Le=>Le.id)),H=Math.min(...N.map(Le=>Le.x)),Y=Math.max(...N.map(Le=>Le.x+Le.width)),ae=$.x+$.width,_e=Y-H+Nt*2-(L.x-ae);let re=[];if(_e>0){const Le=d(A),tt=(Le==null?void 0:Le.children)??[],de=he=>he.type==="bpmn:Lane";re=(()=>{const he=new Set;for(const me of tt)Je(me)&&!j.has(me.id)&&me.id!==$.id&&me.x>=L.x&&he.add(me.id);const ve=[];for(const me of tt){if(me.type!=="bpmn:DataStoreReference"&&me.type!=="bpmn:DataObjectReference")continue;const pe=me,ut=[...pe.incoming??[],...pe.outgoing??[]].filter(_t=>_t.type==="bpmn:DataInputAssociation"||_t.type==="bpmn:DataOutputAssociation").map(_t=>_t.source===pe?_t.target:_t.source);ut.length&&ut.every(_t=>_t!==void 0&&he.has(_t.id))&&ve.push(pe)}return ve})();const Q=tt.filter(he=>!("waypoints"in he&&he.waypoints)&&!de(he)&&!j.has(he.id)&&he.id!==$.id&&he.x>=L.x),ce=Le?[Le,...tt.filter(he=>de(he))]:[];if(Q.length){const he=new Set(Q.map(dt=>dt.id)),ve=kL(he),me=new Set(he);for(const dt of ve)for(const fn of dt.subtree)me.add(fn.id);const pe=TL(me),ke=Ew(he),ut=new Set(he);for(const dt of ve)for(const fn of dt.subtree)ut.add(fn.id);const _t=ve.length?Ew(ut):ke;n.createSpace(Q,ce,{x:_e,y:0},"e",L.x-1);let Xe=!1;if(ve.length){const dt=Qo(),fn=ct(ve,_e);if(fn){const Sn=_t.length?Sw(_t,_e):null,to=Qo();to.messages>dt.messages&&to.lines>=dt.lines?Xe=!0:(Sn==null||Sn(),fn())}}if(!Xe){for(const dt of ve){const fn=Qo(),Sn=ct([dt],_e);if(!Sn)continue;const to=Qo();(to.messages<=fn.messages||to.lines<fn.lines)&&Sn()}if(ke.length){const dt=Qo(),fn=Sw(ke,_e);if(fn){const Sn=Qo();(Sn.messages<=dt.messages||Sn.lines<dt.lines)&&fn()}}}if(pe.length){const dt=()=>new Set(At(nt(o)).map(Sn=>Rt(Sn))),fn=Sn=>{const to=Cw(),VL=dt(),WL=Sn.map($t=>({a:$t,x:$t.x,y:$t.y})),UL=o.filter($t=>$t.type==="label").map($t=>({label:$t,x:$t.x,y:$t.y}));n.moveElements(Sn,{x:_e,y:0});const YL=[...dt()].filter($t=>!VL.has($t));if(Cw()<to&&YL.length===0)return!0;for(const{a:$t,x:us,y:ps}of WL)($t.x!==us||$t.y!==ps)&&n.moveElements([$t],{x:us-$t.x,y:ps-$t.y});for(const $t of UL){const us=$t.x-$t.label.x,ps=$t.y-$t.label.y;(us!==0||ps!==0)&&n.moveElements([$t.label],{x:us,y:ps})}return!1};if(!fn(pe)&&pe.length>1)for(const Sn of pe)fn([Sn])}}}const Me=R.node.lane!==void 0?f(R.node.lane):R.node.participant!==void 0?f(R.node.participant):void 0,we=Le=>{if(!Me)return!0;const tt=Le.y+Le.height/2;return tt>=Me.y&&tt<=Me.y+Me.height},Pe=!we($)&&we(L)?L:$,lt=Pe.y+Pe.height/2,De=lt-(A.y+A.height/2),le=R.band!==void 0,Re=le?[A]:N,ue=(R.band===void 0||E(R.node.lane,R.node.participant,R.band,lt))&&pt(_.target)&&Re.every(Le=>{var tt;return Wt((tt=k.get(Le.id))==null?void 0:tt.node.lane,Le,Le.y+Le.height/2+De)}),Ae=Le=>Math.abs(Le.y+Le.height/2-(A.y+A.height/2))<=I/2;if(ue&&le){const Le=Math.abs(De)<=I/2?N.filter(tt=>tt.id!==A.id&&Ae(tt)):[];if(n.moveElements(N,{x:ae+Nt-H,y:0}),n.moveElements([A],{x:0,y:De}),Le.length){const tt=()=>new Set(At(nt(o)).map(ve=>Rt(ve))),de=tt(),fe=o.filter(ve=>ve.type==="label").map(ve=>({label:ve,x:ve.x,y:ve.y}));n.moveElements(Le,{x:0,y:De});const Q=tt(),ce=[...Q].filter(ve=>!de.has(ve)).length,he=[...de].filter(ve=>!Q.has(ve)).length;if(ce>he){n.moveElements(Le,{x:0,y:-De});for(const ve of fe){const me=ve.x-ve.label.x,pe=ve.y-ve.label.y;(me!==0||pe!==0)&&n.moveElements([ve.label],{x:me,y:pe})}}}}else n.moveElements(N,{x:ae+Nt-H,y:ue?De:0});const rt=d(A);if(!ue&&R.node.lane===void 0&&R.band!==void 0&&rt){const Le=rt.y+oe+w(`pool:${R.node.participant??""}`,R.band)*I,tt=Le-(A.y+A.height/2);tt!==0&&!K(rt,A,A.x+A.width/2,Le,j)&&n.moveElements([A],{x:0,y:tt})}const We=re.length?d(re[0]):void 0;if(We){const Le={assoc:Rw(),overlaps:Pw(We),crosses:Aw()},tt=re.map(pe=>({st:pe,x:pe.x})),de=o.filter(pe=>pe.type==="label").map(pe=>({label:pe,x:pe.x,y:pe.y})),fe=Math.min(...re.flatMap(pe=>[...pe.incoming??[],...pe.outgoing??[]].filter(ke=>ke.type==="bpmn:DataInputAssociation"||ke.type==="bpmn:DataOutputAssociation").map(ke=>(ke.source===pe?ke.target:ke.source).x))),Q=new Set(re.map(pe=>pe.id)),ce=(We.children??[]).filter(Je).filter(pe=>!Q.has(pe.id));let he=fe;for(const pe of[...re].sort((ke,ut)=>ke.x-ut.x)){let ke=he;for(let ut=0;ut<100;ut++){const _t=ce.find(Xe=>ke<Xe.x+Xe.width+Ut&&ke+pe.width+Ut>Xe.x&&pe.y<Xe.y+Xe.height&&pe.y+pe.height>Xe.y);if(!_t)break;ke=_t.x+_t.width+Ut}ke!==pe.x&&n.moveElements([pe],{x:ke-pe.x,y:0}),he=ke+pe.width+Ut}const ve=he+150-(We.x+We.width);ve>0&&n.resizeShape(We,{x:We.x,y:We.y,width:We.width+ve,height:We.height});const me={assoc:Rw(),overlaps:Pw(We),crosses:Aw()};if(me.assoc>=Le.assoc||me.overlaps>Le.overlaps||me.crosses>Le.crosses){for(const{st:pe,x:ke}of tt)pe.x!==ke&&n.moveElements([pe],{x:ke-pe.x,y:0});ve>0&&n.resizeShape(We,{x:We.x,y:We.y,width:We.width-ve,height:We.height});for(const pe of de){const ke=pe.x-pe.label.x,ut=pe.y-pe.label.y;(ke!==0||ut!==0)&&n.moveElements([pe.label],{x:ke,y:ut})}}}}const Mw=(_,R)=>{const A=R.target===_,O=p(R.source),$=p(R.target),L=A?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(O,$,R.id?{type:L,businessObject:i.create(L,{id:R.id})}:{type:L})},Tw=100,kw=_=>{for(const R of h){if(!R.participant.blackBox)continue;const A=f(R.participant.id);if(!A)continue;const O=[];for(const L of g){const N=L.flow.source===R.participant.id?L.flow.target:L.flow.target===R.participant.id?L.flow.source:void 0,j=N?f(N):void 0;j&&typeof j.x=="number"&&j.type!=="bpmn:Participant"&&O.push(j)}if(!O.length)continue;if(!_&&R.order===void 0){const L=(()=>{var j;const N=new Map;for(const H of O){const Y=d(H);if(!Y)continue;const ae=N.get(Y.id);ae?ae.n+=1:N.set(Y.id,{shape:Y,n:1})}return(j=[...N.values()].sort((H,Y)=>Y.n-H.n)[0])==null?void 0:j.shape})();if(L){const N=Y=>Y.reduce((ae,_e)=>ae+_e,0)/Y.length,j=N(O.map(Y=>Y.y+Y.height/2))<L.y+L.height/2,H=o.filter(Y=>Y.type==="bpmn:Participant"&&Y.id!==R.participant.id&&Y.id!==L.id).filter(Y=>j?Y.y+Y.height<=L.y+5:Y.y>=L.y+L.height-5);if(H.length){const Y=[...H.reduce((ue,Ae)=>ue.set(Ae.y,(ue.get(Ae.y)??0)+1),new Map)].sort((ue,Ae)=>Ae[1]-ue[1]||(j?Ae[0]-ue[0]:ue[0]-Ae[0]))[0][0],ae=Math.min(A.width,eS),_e=tS,re=O.map(ue=>ue.x+ue.width/2),Me=Math.round(N(re)-ae/2),we=Math.max(...re)+Tw,Pe=ue=>({x:ue,width:Math.max(ae,we-ue)}),lt=H.filter(ue=>Math.min(ue.y+ue.height,Y+_e)-Math.max(ue.y,Y)>0),De=ue=>{const Ae=Pe(ue);return lt.some(rt=>rt.x<Ae.x+Ae.width&&Ae.x<rt.x+rt.width)},le=ue=>{const Ae=Pe(ue);return re.filter(rt=>rt>=Ae.x+10&&rt<=Ae.x+Ae.width-10).length},Re=(()=>{if(!De(Me))return Me;const ue=le(Me);return lt.flatMap(Ae=>[Ae.x+Ae.width+Jh,Ae.x-Jh-ae]).map(Ae=>Math.round(Ae)).filter(Ae=>!De(Ae)&&le(Ae)>=ue).sort((Ae,rt)=>Math.abs(Ae-Me)-Math.abs(rt-Me))[0]??Me})();if(Re!==A.x||Y!==A.y||ae!==A.width||_e!==A.height){const ue=()=>new Set(At(nt(o)).map(de=>Rt(de))),Ae=ue(),rt={x:A.x,y:A.y,width:A.width,height:A.height};n.resizeShape(A,{x:Re,y:Y,width:ae,height:_e});const We=ue(),Le=[...We].filter(de=>!Ae.has(de)).length,tt=[...Ae].filter(de=>!We.has(de)).length;Le>tt&&n.resizeShape(A,rt)}}}}const $=Math.max(...O.map(L=>L.x+L.width/2))+Tw;if($>A.x+A.width&&n.resizeShape(A,{x:A.x,y:A.y,width:$-A.x,height:A.height}),!!_)for(const L of g){const N=f(L.flow.id),j=L.flow.source===R.participant.id?L.flow.target:L.flow.target===R.participant.id?L.flow.source:void 0,H=j?f(j):void 0;if(!N||!H||H.type==="bpmn:Participant")continue;const Y=H.x+H.width/2;if(Y<A.x+10||Y>A.x+A.width-10)continue;const ae=A.y>H.y,_e=ae?H.y+H.height:H.y,re=ae?A.y:A.y+A.height,Me=L.flow.source===R.participant.id?[{x:Y,y:re},{x:Y,y:_e}]:[{x:Y,y:_e},{x:Y,y:re}],we=nt(o),Pe={...we.edges.find(lt=>lt.id===L.flow.id),waypoints:Me};an(Pe,Wn(we)).length||n.updateWaypoints(N,Me)}}};kw(!1);for(const _ of g){const R=_.flow;n.connect(p(R.source),p(R.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:R.id,name:R.name})})}{const A=new Set([...v.map(H=>H.flow.id),...g.map(H=>H.flow.id)].filter(H=>!!H)),O=o.filter(H=>!!H.waypoints),$=(H,Y)=>Math.abs(Y.x-H.x)<2?"L":Math.abs(Y.x-(H.x+H.width))<2?"R":Math.abs(Y.y-H.y)<2?"T":Math.abs(Y.y-(H.y+H.height))<2?"B":void 0,L=new Map,N=(H,Y,ae)=>{if(!H||!Y||typeof H.x!="number")return;const _e=$(H,Y);if(!_e)return;let re=L.get(H.id);re||L.set(H.id,re=new Map),re.set(_e,[...re.get(_e)??[],ae])};for(const H of O){const Y=H.waypoints;!Y||Y.length<2||(N(H.source,Y[0],{id:H.id,dir:"out"}),N(H.target,Y[Y.length-1],{id:H.id,dir:"in"}))}const j=new Set;for(const[H,Y]of L){const ae=f(H);if(!ae||typeof ae.x!="number"||![...Y.values()].some(le=>{const Re=le.filter(ue=>ue.dir==="in");return le.length>=3&&Re.length>=1&&le.some(ue=>ue.dir==="out")&&Re.some(ue=>A.has(ue.id))}))continue;const re=d(ae);if(!re||j.has(re.id)||(re.children??[]).some(le=>le.type==="bpmn:Lane"))continue;const Me=(Yw=Y.get("T"))!=null&&Yw.length?(qw=Y.get("B"))!=null&&qw.length?void 0:"B":"T";if(!Me||(Me==="T"?ae.y-re.y:re.y+re.height-(ae.y+ae.height))>=I)continue;const Pe=(re.children??[]).filter(le=>!("waypoints"in le&&le.waypoints)&&le.type!=="label"&&typeof le.x=="number"),lt=re.y+re.height;n.resizeShape(re,{x:re.x,y:re.y,width:re.width,height:re.height+I});const De=u().children.filter(le=>!("waypoints"in le&&le.waypoints)&&le.id!==re.id&&typeof le.y=="number"&&le.y>=lt);De.length&&n.moveElements(De,{x:0,y:I}),Me==="T"&&Pe.length&&n.moveElements(Pe,{x:0,y:I}),j.add(re.id)}}const wd=20,Ow=4,OL=2,DL=[10,30,80],Jo=()=>{const _=nt(o);return{bad:At(_).filter(R=>R.kind==="edge-crosses-shape"||R.kind==="edge-overlap-opposite"||R.kind==="edge-overlap-mixed").length,crossings:hh(_),straight:_.edges.filter(R=>R.type==="bpmn:MessageFlow"&&R.waypoints.length===2).length}},ea=_=>{const R=nt(o),A=R.edges.find(O=>O.id===_);return A?an(A,Wn(R)).length:0},Hl=_=>ea(_)>0,zl=_=>nt(o).edges.filter(R=>R.type==="bpmn:MessageFlow"&&R.id!==_&&R.waypoints.length===2).length,IL=(_,R,A)=>ct([{subtree:_,pool:R}],A),Dw=(_,R)=>R.bad>_.bad||R.crossings>_.crossings&&R.straight<=_.straight&&R.bad>=_.bad,Gl=(_,R)=>Dw(_,R)||R.straight<_.straight,Vl=(_,R,A=()=>!0,O=Dw)=>{const $=Jo(),L=ct(_,R);if(!L)return!1;const N=Jo();return O($,N)||!A()?(L(),!1):!0},Iw=(_,R,A,O=()=>!0)=>Vl([{subtree:_,pool:R}],A,O),Qr=_=>{var R;return!!((R=k.get(_))!=null&&R.node.participant)},cs=new Map;for(const _ of g){if(!Qr(_.flow.target))continue;const R=cs.get(_.flow.target)??[];R.push(_),cs.set(_.flow.target,R)}const Wl=[...cs.keys()],Ed=new Set(v.map(_=>_.flow.target)),Lw=_=>nn.findIndex(({op:R})=>R.participant.id===_);Wl.sort((_,R)=>{var $,L;const A=Ed.has(_)?1:0,O=Ed.has(R)?1:0;return A!==O?A-O:Lw(($=k.get(_))==null?void 0:$.node.participant)-Lw((L=k.get(R))==null?void 0:L.node.participant)});const Jr=_=>_.x+_.width/2,LL=_=>{const R=new Map;for(const $ of o.getAll()){const L=$;if(!L.waypoints||!L.source||!L.target)continue;(R.get(L.source.id)??R.set(L.source.id,[]).get(L.source.id)).push(L.target.id)}const A=new Set([_]),O=[_];for(let $=0;$<O.length;$++)for(const L of R.get(O[$])??[])A.has(L)||(A.add(L),O.push(L));return A},BL=(_,R)=>{const A=LL(R);let O;for(const $ of o.getAll()){const L=$;if(L.type!=="bpmn:MessageFlow"||!L.source||!L.target||L.target.id!==_||A.has(L.source.id))continue;const N=L.source;if(typeof N.x!="number"||N.type==="bpmn:Participant")continue;const j=Jr(N);(O===void 0||j>O)&&(O=j)}return O},Sd=(_,R)=>{const A=f(_.flow.source);if(A)return A.type==="bpmn:Participant"?BL(A.id,R):Jr(A)},Bw=_=>{let R;for(const A of cs.get(_)??[]){const O=Sd(A,_);O!==void 0&&(!R||O>R.cx)&&(R={op:A,cx:O})}return R==null?void 0:R.op},NL=_=>{const R=Bw(_),A=f(_),O=R?Sd(R,_):void 0;return A&&O!==void 0?O-Jr(A):void 0},$L=_=>{const R=NL(_);return R!==void 0&&Math.abs(R)<wd},Nw=(_,R,A,O,$)=>{var L;for(let N=!0;N;){N=!1;for(const j of g){if(j.flow.id===A)continue;const H=R.has(j.flow.source),Y=R.has(j.flow.target);if(H===Y||O(H?j.flow.source:j.flow.target))continue;const ae=H?j.flow.target:j.flow.source;if($(ae)||!Qr(ae))continue;const _e=f(j.flow.id);if(!(_e!=null&&_e.waypoints)||_e.waypoints.length!==2)continue;const re=f(ae),Me=(L=k.get(ae))==null?void 0:L.node.participant;if(!re||!Me)continue;const we=Kn(ae,Pe=>Pe.x>=re.x).filter(Pe=>!R.has(Pe.id));if(!(!we.length||we.some(Pe=>$(Pe.id)))){for(const Pe of we)R.add(Pe.id);_.set(Me,[..._.get(Me)??[],...we]),N=!0}}}return[..._].map(([N,j])=>({subtree:j,pool:p(N)}))},$w=(_,R,A,O,$)=>Nw(new Map([[R,[..._]]]),new Set(_.map(L=>L.id)),O,L=>L===A,L=>L===$),Rd=_=>{const R=Bw(_);if(!R)return null;const A=f(_),O=f(R.flow.source),$=Sd(R,_);if(!A||!O||$===void 0)return null;const L=$-Jr(A);if(L>=wd){const N=k.get(_).node.participant,j=Kn(_,H=>H.x>=A.x);return{groups:$w(j,N,_,R.flow.id,R.flow.source),dx:L}}if(-L>=wd&&Qr(R.flow.source)){const N=k.get(R.flow.source).node.participant,j=Kn(R.flow.source,H=>H.x>=O.x&&!$L(H.id));return{groups:$w(j,N,R.flow.source,R.flow.id,_),dx:-L}}return null},Fw=()=>Wl.map(_=>({id:_,plan:Rd(_)})).filter(_=>!!_.plan).sort((_,R)=>Math.min(..._.plan.groups.flatMap(A=>A.subtree.map(O=>O.x)))-Math.min(...R.plan.groups.flatMap(A=>A.subtree.map(O=>O.x)))).map(_=>_.id);for(let _=0;_<3;_++){const R=Jo(),A=[];for(const $ of Fw()){const L=Rd($);if(!L)continue;const N=ct(L.groups,L.dx);N&&A.push(N)}if(!A.length)break;if(!Gl(R,Jo()))continue;for(const $ of A.reverse())$();let O=!1;for(const $ of Fw()){const L=Rd($);L&&Vl(L.groups,L.dx,()=>!0,Gl)&&(O=!0)}if(!O)break}for(const _ of Wl){if(Ed.has(_))continue;const R=k.get(_);if(!R||R.node.lane!==void 0)continue;const A=V(R);if(A===void 0)continue;const O=f(_),$=O?d(O):void 0;if(!O||!$)continue;const L=$.y+oe+w(`pool:${R.node.participant??""}`,A)*I,N=L-(O.y+O.height/2);N!==0&&!K($,O,O.x+O.width/2,L)&&n.moveElements([O],{x:0,y:N})}for(const _ of Wl.flatMap(R=>cs.get(R)??[])){if(!Hl(_.flow.id))continue;const R=f(_.flow.target);if(!R)continue;const A=p(k.get(_.flow.target).node.participant),O=Kn(_.flow.target,j=>j.x>=R.x),$=R.width+z,L=ea(_.flow.id),N=zl(_.flow.id);for(let j=1;j<=Ow;j++){const H=()=>ea(_.flow.id)<L&&zl(_.flow.id)>=N;if(Iw(O,A,$*j,H))break}}for(const _ of g){if(!Hl(_.flow.id))continue;const R=f(_.flow.source),A=f(_.flow.target);if(!R||!A||R.type==="bpmn:Participant"||A.type==="bpmn:Participant")continue;const O=R.x+R.width/2;if(Math.abs(O-(A.x+A.width/2))>15)continue;const[$,L]=R.y<A.y?[R.y+R.height,A.y]:[A.y+A.height,R.y],N=[...k.values()].map(j=>f(j.node.id)).filter(j=>!!j&&j.id!==R.id&&j.id!==A.id).filter(j=>j.x<=O&&O<=j.x+j.width&&j.y+j.height>$&&j.y<L).sort((j,H)=>j.x-H.x);for(const j of N){const H=(Kw=k.get(j.id))==null?void 0:Kw.node.participant,Y=H?f(H):void 0;if(!Y)continue;const ae=[...k.values()].filter(Re=>Re.node.participant===H).map(Re=>Re.node.id),_e=Re=>Re.map(ue=>f(ue)).filter(ue=>!!ue),Me=[jl(j.id,Re=>{var ue;return((ue=k.get(Re.id))==null?void 0:ue.node.participant)===H}),_e(ae)].filter(Re=>Re.length),we=j.width+z,Pe=ea(_.flow.id),lt=zl(_.flow.id),De=()=>ea(_.flow.id)<Pe&&zl(_.flow.id)>=lt;let le=!1;for(const Re of Me){for(let ue=1;ue<=Ow;ue++)if(Iw(Re,Y,we*ue,De)){le=!0;break}if(le)break}if(!Hl(_.flow.id))break}}for(const _ of g){if(!Hl(_.flow.id))continue;const R=f(_.flow.id);if(((Xw=R==null?void 0:R.waypoints)==null?void 0:Xw.length)!==2)continue;const A=f(_.flow.source),O=f(_.flow.target);if(!A||!O||A.type==="bpmn:Participant"||O.type==="bpmn:Participant"||!Qr(_.flow.source)||!Qr(_.flow.target)||Math.abs(Jr(A)-Jr(O))>OL)continue;const $=Jr(A),L=R.waypoints.map(Pe=>Pe.y),[N,j]=[Math.min(...L),Math.max(...L)],H=Wn(nt(o)).filter(Pe=>Pe.id!==A.id&&Pe.id!==O.id&&Pe.x<$&&$<Pe.x+Pe.width&&N<Pe.y+Pe.height&&Pe.y<j);if(!H.length)continue;const Y=(Zw=k.get(_.flow.source))==null?void 0:Zw.node.participant,ae=(Qw=k.get(_.flow.target))==null?void 0:Qw.node.participant;if(!Y||!ae)continue;const _e=new Map;for(const[Pe,lt,De]of[[_.flow.source,A,Y],[_.flow.target,O,ae]]){const le=_e.get(De)??[],Re=Kn(Pe,ue=>ue.x>=lt.x).filter(ue=>!le.some(Ae=>Ae.id===ue.id));_e.set(De,[...le,...Re])}const re=new Set([..._e.values()].flat().map(Pe=>Pe.id)),Me=Nw(_e,re,_.flow.id,Pe=>Pe===_.flow.source||Pe===_.flow.target,()=>!1),we=Math.max(...H.map(Pe=>Pe.x+Pe.width));for(const Pe of DL){const lt=we+Pe-$;if(lt<=0)continue;if(Vl(Me,lt,()=>{var le,Re;return ea(_.flow.id)===0&&((Re=(le=f(_.flow.id))==null?void 0:le.waypoints)==null?void 0:Re.length)===2},Gl))break}}{const _=A=>A.y+A.height/2,R=[];for(const A of k.keys()){if(!Qr(A))continue;const O=v.filter(N=>N.flow.target===A);if(O.length!==1)continue;const $=f(O[0].flow.source),L=f(A);!$||!L||!k.has($.id)||Math.abs(_($)-_(L))>1||L.x-($.x+$.width)<=z+1||R.push({id:A,pred:$,node:L})}R.sort((A,O)=>A.node.x-O.node.x);for(const{id:A}of R){const O=k.get(A),$=f(A),L=f(v.find(re=>re.flow.target===A).flow.source);if(!$||!L)continue;const N=$.x-(L.x+L.width);if(N<=z+1)continue;const j=p(O.node.participant),H=Kn(A,re=>re.x>=$.x),Y=Jo(),ae=IL(H,j,-(N-z));if(!ae)continue;const _e=Jo();(_e.bad>Y.bad||_e.crossings>=Y.crossings||_e.straight<Y.straight)&&ae()}}kw(!0);for(const _ of b){const R=_.associations??[],A=R.map(L=>L.source===_.dataStore.id?L.target:L.source).map(f).find(Boolean),O=A?d(A)??u():u(),$=A?{x:A.x+A.width/2,y:A.y+A.height+110}:{x:200,y:rn+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:_.dataStore.id,name:_.dataStore.name})},$,O);for(const L of R)Mw(_.dataStore.id,L)}for(const _ of x){const A=p(_.association.target).type==="bpmn:DataStoreReference"?_.association.target:_.association.source;Mw(A,_.association)}let jw=0;const eo=10,Hw=40,FL=(_,R)=>{const A=R.map(H=>d(H)).filter(H=>!!H);for(const H of A){const Y=eo,ae=H.y,_e=H.y+H.height,re=H.x,Me=H.x+H.width;if(Math.abs(_.y-ae)<Y){const we=ae+Y-_.y;_.y+=we,_.height-=we}if(Math.abs(_.y+_.height-_e)<Y&&(_.height=_e-Y-_.y),Math.abs(_.x-re)<Y){const we=re+Y-_.x;_.x+=we,_.width-=we}Math.abs(_.x+_.width-Me)<Y&&(_.width=Me-Y-_.x)}if(!A.length)return;const O=Math.min(...A.map(H=>H.y)),$=Math.max(...A.map(H=>H.y+H.height)),L=O-_.y,N=_.y+_.height-$,j=Hw-eo;if(L>0!=N>0)if(L>0&&L<j){const H=L+eo;_.y+=H,_.height-=H}else N>0&&N<j&&(_.height-=N+eo)},jL=(_,R)=>{const A=eo,O=30,$=o.filter(L=>L.type==="bpmn:Group"&&L.id!==R);for(const L of $){const N=L.x,j=L.x+L.width,H=L.y,Y=L.y+L.height,ae=_.y<Y&&H<_.y+_.height,_e=_.x<j&&N<_.x+_.width;if(ae){if(Math.abs(_.x-j)<A){const re=Math.min(j+A-_.x,O);re>0&&_.width-re>0&&(_.x+=re,_.width-=re)}if(Math.abs(_.x+_.width-N)<A){const re=Math.min(_.x+_.width-(N-A),O);re>0&&_.width-re>0&&(_.width-=re)}}if(_e){if(Math.abs(_.y-Y)<A){const re=Math.min(Y+A-_.y,O);re>0&&_.height-re>0&&(_.y+=re,_.height-=re)}if(Math.abs(_.y+_.height-H)<A){const re=Math.min(_.y+_.height-(H-A),O);re>0&&_.height-re>0&&(_.height-=re)}}}},Cd=(_,R)=>{const A=Hw,O=Math.min(..._.map(H=>H.x))-A,$=Math.min(..._.map(H=>H.y))-A,L=Math.max(..._.map(H=>H.x+H.width))+A,N=Math.max(..._.map(H=>H.y+H.height))+A,j={x:O,y:$,width:L-O,height:N-$};return FL(j,_),jL(j,R),j};for(const _ of M){const R=(_.group.members??[]).map(f).filter($=>!!$);let A;R.length?A=Cd(R,_.group.id):(A={x:300+jw*350,y:40,width:300,height:200},jw++);const O=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:_.group.id}),width:A.width,height:A.height},{x:A.x+A.width/2,y:A.y+A.height/2},u());_.group.name&&n.updateLabel(O,_.group.name),(Jw=_.group.members)!=null&&Jw.length&&P(O,"bwl:Members",{refs:_.group.members.join(" ")})}{const _=o.filter($=>!!$.waypoints),R=new Map,A=($,L)=>{!$||!L||(R.has($)||R.set($,new Set),R.get($).add(L))};for(const $ of _){const L=(e0=$.source)==null?void 0:e0.id,N=(t0=$.target)==null?void 0:t0.id;A(L,N),((n0=$.type)!=null&&n0.includes("DataOutputAssociation")||(i0=$.type)!=null&&i0.includes("DataInputAssociation")||$.type==="bpmn:Association")&&A(N,L)}const O=o.filter($=>$.type==="bpmn:Group");for(const $ of O){const N=(((r0=$.businessObject.extensionElements)==null?void 0:r0.values)??[]).find(De=>De.$type==="bwl:Members"),j=((N==null?void 0:N.refs)??"").split(" ").filter(Boolean);if(!j.length)continue;const H=new Set(j),Y=[...j];for(;Y.length;){const De=Y.shift();for(const le of R.get(De)??[])H.has(le)||(H.add(le),Y.push(le))}const ae=$.x,_e=$.x+$.width,re=$.y,Me=$.y+$.height,we=De=>v.filter(le=>le.flow.target===De).length,Pe=De=>{var Re;const le=((Re=f(De))==null?void 0:Re.type)??"";if(le==="bpmn:StartEvent"&&we(De)===0)return!1;if(le.endsWith("Gateway")){const ue=v.filter(Ae=>Ae.flow.target===De).map(Ae=>Ae.flow.source);if(ue.length&&ue.every(Ae=>{var rt;return((rt=f(Ae))==null?void 0:rt.type)==="bpmn:StartEvent"&&we(Ae)===0}))return!1}return!0},lt=o.filter(De=>Je(De)).filter(De=>De.type!=="bpmn:Group"&&De.type!=="bpmn:Participant"&&De.type!=="bpmn:TextAnnotation"&&!H.has(De.id)&&Qr(De.id)&&Pe(De.id)&&De.x<_e&&De.x+De.width>ae&&De.y<Me&&De.y+De.height>re);if(lt.length)for(const De of[-1,1]){const le=lt.filter(fe=>(fe.x+fe.width-ae<=_e-fe.x?-1:1)===De);if(!le.length)continue;const Re=[];for(const fe of le){const Q=Re.find(ce=>ce.some(he=>fe.y<he.y+he.height&&fe.y+fe.height>he.y));Q?Q.push(fe):Re.push([fe])}const ue=new Map;for(const fe of Re){let Q=De<0?ae-eo:_e+eo;for(const ce of[...fe].sort((he,ve)=>De<0?ve.x-he.x:he.x-ve.x)){const he=De<0?Math.min(ce.x,Q-ce.width):Math.max(ce.x,Q);Q=De<0?he-Ut:he+ce.width+Ut,he!==ce.x&&Math.sign(he-ce.x)===De&&ue.set(ce.id,he-ce.x)}}const Ae=new Map,rt=fe=>Ae.get(fe)===fe||!Ae.get(fe)?fe:rt(Ae.get(fe));for(const fe of le)Ae.set(fe.id,fe.id);for(const fe of g){const Q=ue.has(fe.flow.source)?fe.flow.source:void 0,ce=ue.has(fe.flow.target)?fe.flow.target:void 0;if(!Q||!ce)continue;const he=f(fe.flow.id);((o0=he==null?void 0:he.waypoints)==null?void 0:o0.length)===2&&Ae.set(rt(Q),rt(ce))}const We=new Map;for(const fe of le){if(!ue.has(fe.id))continue;const Q=rt(fe.id);We.set(Q,[...We.get(Q)??[],fe])}const Le=[...We.values()].sort((fe,Q)=>De<0?Math.min(...fe.map(ce=>ce.x))-Math.min(...Q.map(ce=>ce.x)):Math.max(...Q.map(ce=>ce.x))-Math.max(...fe.map(ce=>ce.x))),tt=[];let de=!0;for(const fe of Le){const Q=fe.map(ve=>ue.get(ve.id)??0).reduce((ve,me)=>Math.abs(me)>Math.abs(ve)?me:ve,0),ce=new Map;let he=!0;for(const ve of fe){const me=d(ve);if(!me){he=!1;break}ce.has(me.id)||ce.set(me.id,{subtree:[],pool:me}),ce.get(me.id).subtree.push(ve)}he&&Vl([...ce.values()],Q,()=>!0,Gl)?tt.push({shapes:fe,dx:Q}):de=!1}if(!de)for(const fe of tt.reverse())n.moveElements(fe.shapes,{x:-fe.dx,y:0})}}}{const _=new Set([...M.map(R=>R.group.id),...en(e,"group.update").map(R=>R.id)]);for(const R of o.filter(A=>A.type==="bpmn:Group")){if(_.has(R.id))continue;const O=(((a0=R.businessObject.extensionElements)==null?void 0:a0.values)??[]).find(j=>j.$type==="bwl:Members"),$=((O==null?void 0:O.refs)??"").split(" ").filter(Boolean).map(f).filter(j=>!!j);!$.length||!$.some(j=>{const H=m.get(j.id);return!H||H.x!==j.x||H.y!==j.y})||!$.some(j=>j.x<R.x||j.y<R.y||j.x+j.width>R.x+R.width||j.y+j.height>R.y+R.height)||n.resizeShape(R,Cd($,R.id))}}{const R=new Map(mo(nt(o)).map(j=>[j.owner,j.rect])),A=o.filter(j=>!!j.waypoints),O=new Map,$=(j,H)=>{!j||!H||(O.has(j)||O.set(j,new Set),O.get(j).add(H))};for(const j of A){const H=(s0=j.source)==null?void 0:s0.id,Y=(c0=j.target)==null?void 0:c0.id;$(H,Y),((l0=j.type)!=null&&l0.includes("DataOutputAssociation")||(u0=j.type)!=null&&u0.includes("DataInputAssociation")||j.type==="bpmn:Association")&&$(Y,H)}const L=j=>v.filter(H=>H.flow.target===j).length,N=j=>{var Y;const H=((Y=f(j))==null?void 0:Y.type)??"";if(H==="bpmn:StartEvent"&&L(j)===0)return!1;if(H.endsWith("Gateway")){const ae=v.filter(_e=>_e.flow.target===j).map(_e=>_e.flow.source);if(ae.length&&ae.every(_e=>{var re;return((re=f(_e))==null?void 0:re.type)==="bpmn:StartEvent"&&L(_e)===0}))return!1}return!0};for(const j of o.filter(H=>H.type==="bpmn:Group")){const Y=(((p0=j.businessObject.extensionElements)==null?void 0:p0.values)??[]).find(Q=>Q.$type==="bwl:Members"),ae=((Y==null?void 0:Y.refs)??"").split(" ").filter(Boolean);if(!ae.length)continue;const _e=ae.map(f).filter(Q=>!!Q);if(!_e.length||!(M.some(Q=>Q.group.id===j.id)||en(e,"group.update").some(Q=>Q.id===j.id)||_e.some(Q=>{const ce=m.get(Q.id);return!ce||ce.x!==Q.x||ce.y!==Q.y})))continue;const Me=new Set(ae),we=[...ae];for(;we.length;){const Q=we.shift();for(const ce of O.get(Q)??[])Me.has(ce)||(Me.add(ce),we.push(ce))}const Pe=j.x,lt=j.x+j.width,De=j.y,le=j.y+j.height,Re=Q=>{const ce=R.get(Q.id),he={x:Q.x,y:Q.y,width:Q.width,height:Q.height};return ce?[he,{x:ce.x,y:ce.y,width:ce.width,height:ce.height}]:[he]},ue=_e.flatMap(Re),Ae=Math.min(...ue.map(Q=>Q.x)),rt=Math.max(...ue.map(Q=>Q.x+Q.width)),We=Math.min(...ue.map(Q=>Q.y)),Le=Math.max(...ue.map(Q=>Q.y+Q.height)),tt={L:Ae-Pe,R:lt-rt,T:We-De,B:le-Le},de=o.filter(Q=>Je(Q)).filter(Q=>Q.type!=="bpmn:Group"&&Q.type!=="bpmn:Participant"&&Q.type!=="bpmn:TextAnnotation"&&!Me.has(Q.id)&&N(Q.id)&&Q.x<lt&&Q.x+Q.width>Pe&&Q.y<le&&Q.y+Q.height>De);if(!de.length)continue;const fe={L:0,R:0,T:0,B:0};for(const Q of de){const ce=Re(Q),he=Math.min(...ce.map(Xe=>Xe.x)),ve=Math.max(...ce.map(Xe=>Xe.x+Xe.width)),me=Math.min(...ce.map(Xe=>Xe.y)),pe=Math.max(...ce.map(Xe=>Xe.y+Xe.height)),ke={L:ve-Pe,R:lt-he,T:pe-De,B:le-me},ut=["L","R","T","B"].filter(Xe=>ke[Xe]<=tt[Xe]+.001);if(!ut.length)continue;const _t=ut.reduce((Xe,dt)=>ke[dt]<ke[Xe]?dt:Xe,ut[0]);fe[_t]=Math.max(fe[_t],Math.min(ke[_t]+10,tt[_t]))}!fe.L&&!fe.R&&!fe.T&&!fe.B||n.resizeShape(j,{x:j.x+fe.L,y:j.y+fe.T,width:j.width-fe.L-fe.R,height:j.height-fe.T-fe.B})}}const zw=_=>{const R=_.waypoints;if(R!=null&&R.length){const O=R[Math.floor((R.length-1)/2)];return{x:O.x,y:O.y,width:0,height:0}}const A=_;return{x:A.x,y:A.y,width:A.width,height:A.height}};let ls=0;const Gw=12,Vw=14,HL=15,zL=300,GL=_=>{const R=_.split(`
|
|
7
|
+
`),A=Math.max(...R.map(L=>po(L,Gw))),O=Math.max(100,Math.min(zL,Math.ceil(A)+Vw)),$=R.reduce((L,N)=>L+Math.max(1,Math.ceil((po(N,Gw)+Vw)/O)),0);return{width:O,height:Math.max(30,$*HL+10)}};for(const _ of C){const R=_.association,A=((f0=_.placement)==null?void 0:f0.anchor)??(R?R.source===_.annotation.id?R.target:R.source:void 0),O=A?f(A):void 0,$=O?zw(O):void 0,L=GL(_.annotation.text??"");let N;if($&&_.placement){const[ae,_e]=Ds[_.placement.side],re=_.placement.offset??50;N={x:$.x+$.width/2+ae*($.width/2+L.width/2+re),y:$.y+$.height/2+_e*($.height/2+L.height/2+re)}}else $?(N={x:$.x+$.width/2+180+ls%3*260,y:$.y-110-ls%2*95},ls++):(N={x:300+ls*260,y:60},ls++);const j=O?d(O)??u():u(),H=j;$&&typeof H.x=="number"&&typeof H.width=="number"&&H.type==="bpmn:Participant"&&(N=Su(o,$,L,H,_.placement?{placement:_.placement}:{from:N}));const Y=n.createShape({type:"bpmn:TextAnnotation",width:L.width,height:L.height,businessObject:i.create("bpmn:TextAnnotation",{id:_.annotation.id,text:_.annotation.text})},N,j);if(R){const ae=_e=>_e===_.annotation.id?Y:p(_e);n.connect(ae(R.source),ae(R.target),R.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:R.id})}:{type:"bpmn:Association"})}_.placement&&P(Y,"bwl:Placement",B(_.placement))}for(const _ of en(e,"association.add")){const R=_.association;n.connect(p(R.source),p(R.target),R.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:R.id})}:{type:"bpmn:Association"})}for(const _ of en(e,"node.update")){let R=p(_.id);if(_.type&&Os(_.type)!==R.type&&(R=c.replaceElement(R,{type:Os(_.type)})),_.name!==void 0&&n.updateProperties(R,{name:_.name??void 0}),_.lane||_.band!==void 0){_.band!==void 0&&n.updateProperties(R,{"bwl:band":_.band});const A=R.y+R.height/2,O=d(R),$=_.lane?p(_.lane):((O==null?void 0:O.children)??[]).find(N=>N.type==="bpmn:Lane"&&A>=N.y&&A<=N.y+N.height);_.band!==void 0&&st($==null?void 0:$.id,_.band,O);const L=$?$.y+(_.band===void 0?$.height/2:Math.min($.height/2,ye)+w($.id,_.band)*I):_.band!==void 0&&O?O.y+oe+w(`pool:${O.id}`,_.band)*I:void 0;if(L!==void 0){const N=L-A;N!==0&&n.moveElements([R],{x:0,y:N})}}}for(const _ of en(e,"sequenceFlow.update")){const R=p(_.id);if(_.source!==void 0||_.target!==void 0){const A=R,O=_.source!==void 0?p(_.source):A.source,$=_.target!==void 0?p(_.target):A.target,L=N=>({x:N.x+N.width/2,y:N.y+N.height/2});n.reconnect(A,O,$,[L(O),L($)])}_.name!==void 0&&n.updateProperties(R,{name:_.name??void 0}),_.condition!==void 0&&n.updateProperties(R,{name:((d0=_.condition)==null?void 0:d0.label)??void 0})}for(const _ of en(e,"messageFlow.update"))_.name!==void 0&&n.updateProperties(p(_.id),{name:_.name??void 0});for(const _ of en(e,"dataStore.update"))_.name!==void 0&&n.updateProperties(p(_.id),{name:_.name??void 0});for(const _ of en(e,"annotation.update")){const R=p(_.id);if(_.text!==void 0&&n.updateProperties(R,{text:_.text}),_.placement===null)P(R,"bwl:Placement",null);else if(_.placement){const A=p(_.placement.anchor),O=zw(A),$=d(A)??u(),L=typeof $.x=="number"&&typeof $.width=="number"&&$.type==="bpmn:Participant",[N,j]=Ds[_.placement.side],H=_.placement.offset??50,Y={x:O.x+O.width/2+N*(O.width/2+R.width/2+H),y:O.y+O.height/2+j*(O.height/2+R.height/2+H)},ae=L?Su(o,O,{width:R.width,height:R.height},$,{placement:_.placement,selfId:_.id}):Y;n.moveElements([R],{x:ae.x-(R.x+R.width/2),y:ae.y-(R.y+R.height/2)}),P(R,"bwl:Placement",B(_.placement))}}for(const _ of en(e,"group.update")){const R=p(_.id);if(_.name!==void 0&&n.updateLabel(R,_.name??""),_.members){const A=_.members.map(f).filter(O=>!!O);A.length&&n.resizeShape(R,Cd(A,_.id)),P(R,"bwl:Members",{refs:_.members.join(" ")})}}}function Ru(e){switch(e.kind){case"annotation-over-label":return[e.annotation];case"edge-crosses-shape":return[e.shape];case"shape-outside-container":return[e.shape];case"shape-overlap":return e.shapes;default:return[]}}function iS(e,t,n){var u,f;const{elementRegistry:i}=e,r=e.modeling,o=p=>At(p).filter(d=>!t.has(Rt(d))),a=p=>{var d;return((d=i.get(p))==null?void 0:d.type)==="bpmn:TextAnnotation"},s=nt(i),c=o(s),l=[...new Set(c.flatMap(Ru))].filter(p=>n.has(p)&&a(p));if(l.length)for(const p of l){const d=i.get(p);if(!d||typeof d.x!="number"||typeof d.width!="number")continue;let m=d.parent,h;for(;m;){if(m.type==="bpmn:Participant"){h=m;break}m=m.parent}if(!h){const ye=d.x+d.width/2,Ve=d.y+d.height/2;h=i.getAll().find(He=>{if(He.type!=="bpmn:Participant")return!1;const it=He;return typeof it.x=="number"&&typeof it.width=="number"&&ye>=it.x&&ye<=it.x+it.width&&Ve>=it.y&&Ve<=it.y+it.height})}if(!h||typeof h.x!="number"||typeof h.width!="number")continue;const v=(((u=d.businessObject.extensionElements)==null?void 0:u.values)??[]).find(ye=>ye.$type==="bwl:Placement"),g=[...d.incoming??[],...d.outgoing??[]].find(ye=>ye.type==="bpmn:Association"),b=(v!=null&&v.anchor?i.get(v.anchor):void 0)??(g?((f=g.source)==null?void 0:f.id)===p?g.target:g.source:void 0);if(!b)continue;const x=b.waypoints,C=x!=null&&x.length?{x:x[Math.floor((x.length-1)/2)].x,y:x[Math.floor((x.length-1)/2)].y,width:0,height:0}:{x:b.x,y:b.y,width:b.width,height:b.height},M={width:d.width,height:d.height},k={x:d.x+d.width/2,y:d.y+d.height/2},P=v==null?void 0:v.side,B=[];P&&P in Ds&&B.push(Su(i,C,M,h,{placement:{side:P,offset:(v==null?void 0:v.offset)??null},selfId:p}));for(const[ye,Ve]of[[-1,0],[1,0],[0,-1],[0,1]])for(let He=1;He<=nS;He++)B.push({x:k.x+ye*em*He,y:k.y+Ve*em*He});const D={...s,edges:s.edges.filter(ye=>ye.id!==(g==null?void 0:g.id))},I=o(D),z=I.filter(ye=>Ru(ye).includes(p)).length;if(!z)continue;let oe;for(const ye of B){const Ve=ye.x-k.x,He=ye.y-k.y;if(!Ve&&!He||ye.x-M.width/2<h.x||ye.x+M.width/2>h.x+h.width||ye.y-M.height/2<h.y||ye.y+M.height/2>h.y+h.height)continue;const it={...D,shapes:D.shapes.map(xe=>xe.id===p?{...xe,x:xe.x+Ve,y:xe.y+He}:xe)},K=o(it),Z=K.filter(xe=>Ru(xe).includes(p)).length;if(Z>=z||K.length>I.length)continue;const se=Math.abs(Ve)+Math.abs(He);if((!oe||Z<oe.mine||Z===oe.mine&&(K.length<oe.all||K.length===oe.all&&se<oe.dist))&&(oe={x:ye.x,y:ye.y,mine:Z,all:K.length,dist:se}),oe.mine===0&&oe.all<I.length)break}oe&&r.moveElements([d],{x:oe.x-k.x,y:oe.y-k.y})}}const rS=60;function oS(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=u=>At(u).filter(f=>!t.has(Rt(f))),a=u=>u.filter(f=>f.kind==="pool-overlap"),s=new Map(n.shapes.map(u=>[u.id,u])),c=(u,f)=>f.x>=u.x&&f.y>=u.y&&f.x+f.width<=u.x+u.width&&f.y+f.height<=u.y+u.height,l=u=>{if(!s.get(u))return[u];const p=new Set,d=new Set([u]);for(let h=0;h<4;h++){let y=!1;for(const v of n.shapes)v.type!=="bpmn:Group"||p.has(v.id)||[...d].some(g=>{const b=s.get(g);return b&&c(v,b)})&&(p.add(v.id),y=!0);for(const v of n.shapes)v.type!=="bpmn:Participant"||d.has(v.id)||[...p].some(g=>{const b=s.get(g);return b&&c(b,v)})&&(d.add(v.id),y=!0);if(!y)break}const m=n.shapes.filter(h=>!h.parent&&!d.has(h.id)&&!p.has(h.id)&&h.type!=="bpmn:Group"&&h.type!=="bpmn:Participant").filter(h=>[...p].some(y=>{const v=s.get(y);return v&&c(v,h)})).map(h=>h.id);return[...d,...p,...m]};for(let u=0;u<6;u++){const f=nt(i),p=o(f),d=a(p);if(!d.length)return;const m=new Map(f.shapes.map(x=>[x.id,x]));let h=null;for(const x of d){if(x.kind!=="pool-overlap")continue;const[C,M]=x.pools,k=m.get(C),P=m.get(M);if(!k||!P)continue;const[B,D]=k.x<=P.x?[k,P]:[P,k];if(x.contained)continue;const I=s.get(B.id),z=s.get(D.id),oe=I&&z?Math.max(z.x-(I.x+I.width),0):rS,ye=B.x+B.width+oe-D.x;if(ye<=0)continue;const Ve=l(D.id).filter(He=>i.get(He));Ve.length&&(!h||ye>h.dx)&&(h={movers:Ve,dx:ye})}if(!h)return;const y=h.movers.map(x=>i.get(x)).filter(x=>!!x&&typeof x.x=="number");if(!y.length)return;const v=p.length,g=d.length;r.moveElements(y,{x:h.dx,y:0});const b=o(nt(i));if(!(a(b).length<g&&b.length<=v)){r.moveElements(y,{x:-h.dx,y:0});return}}}function aS(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=l=>At(l).filter(u=>!t.has(Rt(u))),a=(l,u)=>u.x>=l.x&&u.y>=l.y&&u.x+u.width<=l.x+l.width&&u.y+u.height<=l.y+l.height,s=l=>({l:Math.min(...l.map(u=>u.x)),t:Math.min(...l.map(u=>u.y)),r:Math.max(...l.map(u=>u.x+u.width)),b:Math.max(...l.map(u=>u.y+u.height))}),c=n.shapes.filter(l=>{var u;return l.type==="bpmn:Group"&&!((u=l.members)!=null&&u.length)});if(c.length)for(const l of c){const u=i.get(l.id);if(!u||typeof u.x!="number")continue;const f=n.shapes.filter(M=>M.id!==l.id&&M.type!=="bpmn:Group"&&a(l,M));if(!f.length)continue;const p=f.map(M=>i.get(M.id)).filter(M=>!!M&&typeof M.x=="number");if(p.length!==f.length)continue;const d=s(f),m=s(p),h=m.l+(l.x-d.l),y=m.t+(l.y-d.t),v=m.r+(l.x+l.width-d.r),g=m.b+(l.y+l.height-d.b),b={x:h,y,width:v-h,height:g-y};if(b.width<=0||b.height<=0||Math.abs(b.x-u.x)<1&&Math.abs(b.y-u.y)<1&&Math.abs(b.width-u.width)<1&&Math.abs(b.height-u.height)<1)continue;const x=o(nt(i)).length,C={x:u.x,y:u.y,width:u.width,height:u.height};r.resizeShape(u,b),o(nt(i)).length>x&&r.resizeShape(u,C)}}function nm(e,t,n=tm){const i=Qh(e),r=Zh(t,Eh(i.elementRegistry)),o={edgeCrossings:{before:0,after:0,pairs:[],solidPairs:0,dashedPairs:0,mixedPairs:0,crossPoolMessages:0}};if(r.length)return{ok:!1,issues:r,findings:[],stats:o};const a=nt(i.elementRegistry),s=new Set(At(a).map(Rt)),c=new Set(a.edges.map(g=>g.id)),l=new Set(a.shapes.map(g=>g.id)),u=Rs(a),f=u.length,p=new Set(u.map(([g,b])=>`${g}|${b}`)),d=new Map;for(const g of i.elementRegistry.filter(b=>"waypoints"in b&&!!b.waypoints))g.label&&d.set(g.id,{wps:g.waypoints.map(b=>({x:b.x,y:b.y})),label:{x:g.label.x,y:g.label.y}});const m=e.get("commandStack");try{Od(m,()=>{n(t,i),oS(i,s,a),aS(i,s,a),Th(i,c);const g=bu(i,s);Ah(i,p,c),jh(i,s,c),Dh(i,c),V1(i,c),Bh(i,s,c),q1(i,s,c),Wh(i,s,c),Vh(i,c),Yh(i,l),iS(i,s,l),bu(i,s,g),qh(i,s),Gh(i,d)})}catch(g){return{ok:!1,issues:[{kind:"lower-failed",message:g instanceof Error?g.message:String(g)}],findings:[],stats:o}}const h=nt(i.elementRegistry),y=At(h).filter(g=>!s.has(Rt(g))),v=mh(h);return{ok:!0,issues:[],findings:y,stats:{edgeCrossings:{before:f,after:v.pairs.length,pairs:v.pairs,solidPairs:v.solidPairs,dashedPairs:v.dashedPairs,mixedPairs:v.mixedPairs,crossPoolMessages:v.crossPoolMessages}}}}function sS(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function im(e,t){return typeof e.get=="function"?e.get(t):e[t]}function rm(e,t){const n=im(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function om(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(r=>(r==null?void 0:r.$type)===t)}function cS(e){return typeof e=="string"&&Yl.includes(e)}function ui(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function am(e){const t=e.rootElements??[],n=t.find(K=>K.$type==="bpmn:Collaboration"),i=new Map(t.filter(K=>K.$type==="bpmn:Process").map(K=>[K.id,K])),r=[],o=[],a=[],s=[],c=[],l=[],u={poolOrders:{},bands:{},placements:{},afterColumns:{}},f=[],p=[],d=[],m=[],h=[],y=[],v=[],g=new Set,b=new Set,x=K=>{K&&g.add(K)},C=K=>{g.add(K),b.add(K)},M=K=>{const Z=om(K,"bwl:Placement");if(!Z)return;const se=typeof Z.anchor=="string"?Z.anchor:void 0;if(!se||!cS(Z.side))return;const xe=typeof Z.offset=="number"?Z.offset:void 0;h.push({owner:K.id,anchor:se,side:Z.side,...xe!==void 0?{offset:xe}:{}})},k=K=>{const Z=om(K,"bwl:Members"),se=typeof(Z==null?void 0:Z.refs)=="string"?Z.refs.split(/\s+/).filter(Boolean):[];se.length&&v.push({owner:K.id,refs:se})},P=K=>{var Z;for(const se of K)switch(x(se.id),se.$type){case"bpmn:TextAnnotation":C(se.id),s.push({id:se.id,text:typeof se.text=="string"?se.text:""}),M(se);break;case"bpmn:Association":d.push({id:se.id,type:se.$type,source:ui(se.sourceRef),target:ui(se.targetRef)});break;case"bpmn:Group":{C(se.id);const xe=(Z=se.categoryValueRef)==null?void 0:Z.value;c.push({id:se.id,...typeof xe=="string"&&xe?{name:xe}:{}}),k(se);break}default:l.push({id:se.id,type:se.$type,reason:"type-outside-mvp"})}},B=K=>{for(const Z of K.flowElements??[])x(Z.id),l.push({id:Z.id,type:Z.$type,reason:"inside-container"}),(Z.flowElements??[]).length&&B(Z);for(const Z of K.artifacts??[])x(Z.id),l.push({id:Z.id,type:Z.$type,reason:"inside-container"})},D=(K,Z)=>{const se=K.flowElements??[],xe=(K.laneSets??[]).flatMap(V=>V.lanes??[]),q=new Map;for(const V of xe){x(V.id);for(const ne of V.flowNodeRef??[]){const Te=ui(ne);Te&&q.set(Te,V.id)}}for(const V of se){if(x(V.id),V.$type==="bpmn:SequenceFlow"){f.push({id:V.id,source:ui(V.sourceRef),target:ui(V.targetRef),...typeof V.name=="string"&&V.name?{name:V.name}:{}});continue}if(V.$type==="bpmn:DataStoreReference"){C(V.id),a.push({id:V.id,...V.name?{name:V.name}:{}});continue}const ne=sS(V.$type);if(!Ad(ne)){l.push({id:V.id,type:V.$type,reason:"type-outside-mvp"});continue}C(V.id);const Te=ne==="boundaryEvent"?ui(V.attachedToRef):void 0;o.push({id:V.id,type:ne,...V.name?{name:V.name}:{},...Z?{participant:Z}:{},...q.has(V.id)?{lane:q.get(V.id)}:{},...Te?{attachedTo:Te}:{}}),ne==="subProcess"&&B(V);const yt=rm(V,"bwl:band");yt!==void 0&&(u.bands[V.id]=yt);const T=im(V,"bwl:afterColumn");typeof T=="string"&&T!==""&&y.push([V.id,T]);for(const w of V.dataOutputAssociations??[])x(w.id),m.push({id:w.id,type:w.$type,source:V.id,target:ui(w.targetRef)});for(const w of V.dataInputAssociations??[])x(w.id),m.push({id:w.id,type:w.$type,source:ui((w.sourceRef??[])[0]),target:V.id})}P(K.artifacts??[])};if(n){const K=new Set;for(const Z of n.participants??[]){C(Z.id);const se=ui(Z.processRef);se&&K.add(se);const xe=se?i.get(se):void 0,q=((xe==null?void 0:xe.laneSets)??[]).flatMap(yt=>yt.lanes??[]),V=q.map(yt=>({id:yt.id,...yt.name?{name:yt.name}:{}}));for(const yt of V)C(yt.id);const ne=!xe||(xe.flowElements??[]).length===0&&q.length===0&&(xe.artifacts??[]).length===0;r.push({id:Z.id,...Z.name?{name:Z.name}:{},...ne?{blackBox:!0}:{},...V.length?{lanes:V}:{}});const Te=rm(Z,"bwl:poolOrder");Te!==void 0&&(u.poolOrders[Z.id]=Te),xe&&D(xe,Z.id)}for(const Z of n.messageFlows??[])x(Z.id),p.push({id:Z.id,source:ui(Z.sourceRef),target:ui(Z.targetRef),...typeof Z.name=="string"&&Z.name?{name:Z.name}:{}});P(n.artifacts??[]);for(const[Z,se]of i)!K.has(Z)&&(se.flowElements??[]).length>0&&l.push({id:Z,type:se.$type,reason:"unreachable-process"})}else for(const K of i.values())D(K);const I=[],z=[],oe=[],ye=[],Ve=(K,Z)=>!!K&&!!Z&&b.has(K)&&b.has(Z);for(const K of f){if(!Ve(K.source,K.target)){l.push({id:K.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}I.push({id:K.id,source:K.source,target:K.target,...K.name?{name:K.name}:{}}),b.add(K.id)}for(const K of p){if(!Ve(K.source,K.target)){l.push({id:K.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}z.push({id:K.id,source:K.source,target:K.target,...K.name?{name:K.name}:{}}),b.add(K.id)}for(const K of m){if(!Ve(K.source,K.target)){l.push({id:K.id??"",type:K.type,reason:"endpoint-outside-mvp"});continue}ye.push({...K.id?{id:K.id}:{},source:K.source,target:K.target}),K.id&&b.add(K.id)}for(const K of d){if(!Ve(K.source,K.target)){l.push({id:K.id??"",type:K.type,reason:"endpoint-outside-mvp"});continue}oe.push({...K.id?{id:K.id}:{},source:K.source,target:K.target})}const He=new Map(c.map(K=>[K.id,K]));for(const{owner:K,refs:Z}of v){const se=Z.filter(q=>g.has(q)),xe=He.get(K);xe&&se.length&&(xe.members=se)}for(const K of h)g.has(K.anchor)&&(u.placements[K.owner]={anchor:K.anchor,side:K.side,...K.offset!==void 0?{offset:K.offset}:{}});for(const[K,Z]of y)g.has(Z)&&(u.afterColumns[K]=Z);return{definition:{...r.length?{participants:r}:{},nodes:o,sequenceFlows:I,...z.length?{messageFlows:z}:{},...a.length?{dataStores:a}:{},...ye.length?{dataAssociations:ye}:{},...s.length?{annotations:s}:{},...oe.length?{associations:oe}:{},...c.length?{groups:c}:{}},hints:u,omitted:l}}async function lS(e){const{definitions:t,warnings:n}=await lo(e);return{...am(t),warnings:n}}const uS=new Set(["bpmn:ExclusiveGateway","bpmn:ParallelGateway","bpmn:InclusiveGateway","bpmn:EventBasedGateway","bpmn:ComplexGateway"]);function Cu(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function pS(e){return Cu(e.processRef)!==void 0}function fS(e){const t=new Set,n=r=>{const o=Cu(r);o&&t.add(o)},i=r=>{for(const o of r.flowElements??[]){n(o.sourceRef),n(o.targetRef),o.attachedToRef&&(n(o.attachedToRef),t.add(o.id));for(const a of o.dataOutputAssociations??[])t.add(o.id),n(a.targetRef);for(const a of o.dataInputAssociations??[]){t.add(o.id);for(const s of a.sourceRef??[])n(s)}(o.flowElements??[]).length&&i(o)}for(const o of r.artifacts??[])n(o.sourceRef),n(o.targetRef)};for(const r of e.rootElements??[])if(r.$type==="bpmn:Process")i(r);else if(r.$type==="bpmn:Collaboration"){for(const o of r.messageFlows??[])n(o.sourceRef),n(o.targetRef);for(const o of r.artifacts??[])n(o.sourceRef),n(o.targetRef)}return t}function dS(e){const t=[],n=i=>{for(const r of i.flowElements??[])uS.has(r.$type)&&t.push(r),(r.flowElements??[]).length&&n(r)};for(const i of e.rootElements??[])i.$type==="bpmn:Process"&&n(i);return t}function hS(e){if(!e)return!0;const t=(e.laneSets??[]).flatMap(n=>n.lanes??[]);return(e.flowElements??[]).length===0&&t.length===0&&(e.artifacts??[]).length===0}function Au(e){const t=[],n=e.rootElements??[],i=fS(e);for(const o of dS(e))i.has(o.id)||t.push({ruleId:"CHK-FLOW-1",severity:"warning",targetKind:"flowNode",targetRefs:[o.id],params:{type:o.$type}});const r=n.find(o=>o.$type==="bpmn:Collaboration");if(r){const o=new Map(n.filter(s=>s.$type==="bpmn:Process").map(s=>[s.id,s])),a=[];for(const s of r.participants??[])pS(s)&&hS(o.get(Cu(s.processRef)))&&a.push(s.id);a.length&&t.push({ruleId:"CHK-POOL-1",severity:"info",targetKind:"participant",targetRefs:a,params:{count:a.length}})}return t}async function mS(e){const{definitions:t,warnings:n}=await lo(e);return{issues:Au(t),warnings:n}}const gS=.5,yS=8,vS=new Set(["bpmn:Definitions","bpmn:Collaboration","bpmn:Process","bpmn:LaneSet","bpmn:ExtensionElements","bpmn:Documentation","bpmn:Relationship","bpmn:Property","bpmn:Category","bpmn:CategoryValue"]),vo=e=>typeof e=="number"?e:Number(e??NaN),Is=e=>{if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:""};function bS(e){const t=e,n=[],i=typeof t.name=="string"?t.name:typeof t.text=="string"?t.text:"";n.push(`n=${i.replace(/\s+/g," ").trim()}`);for(const o of["sourceRef","targetRef","attachedToRef","processRef","default"])t[o]!==void 0&&n.push(`${o}=${Is(t[o])}`);if(String(e.$type)==="bpmn:Group"){const o=t.categoryValueRef,a=Array.isArray(o)?o:o==null?[]:[o];n.push(`cat=[${a.map(s=>`${Is(s)}:${typeof(s==null?void 0:s.value)=="string"?s.value:""}`).sort().join(",")}]`)}Array.isArray(t.flowNodeRef)&&n.push(`lane=[${t.flowNodeRef.map(Is).sort().join(",")}]`);const r=t.conditionExpression;return r&&typeof r.body=="string"&&n.push(`cond=${r.body}`),n.join("|")}function xS(e){const t=new Map,n=new Map,i=(a,s)=>{a&&t.set(a,[...t.get(a)??[],...s])},r=a=>{const s=a;return s?[vo(s.x),vo(s.y),vo(s.width),vo(s.height)]:[]},o=a=>{if(Array.isArray(a))return a.forEach(o);if(!a||typeof a!="object")return;const s=a,c=String(s.$type??"");if(c==="bpmndi:BPMNShape"||c==="bpmndi:BPMNEdge"){const l=Is(s.bpmnElement);if(c==="bpmndi:BPMNShape")i(l,r(s.bounds));else{const f=Array.isArray(s.waypoint)?s.waypoint:[];i(l,f.flatMap(p=>[vo(p.x),vo(p.y)]))}const u=s.label;u!=null&&u.bounds&&l&&n.set(l,r(u.bounds).slice(0,2));return}for(const l of Object.values(s))(Array.isArray(l)||l&&typeof l=="object"&&"$type"in l)&&o(l)};return o(e.diagrams),{body:t,labels:n}}function sm(e){const t=xS(e),n=new Map,i=new Set,r=o=>{if(Array.isArray(o))return o.forEach(r);if(!o||typeof o!="object"||i.has(o))return;i.add(o);const a=o,s=String(a.$type??"");if(s.startsWith("bpmndi:")||s.startsWith("dc:")||s.startsWith("di:"))return;const c=typeof a.id=="string"?a.id:"";c&&s.startsWith("bpmn:")&&!vS.has(s)&&n.set(c,{type:s,props:bS(a),geometry:(t.body.get(c)??[]).join(","),label:(t.labels.get(c)??[]).join(",")});for(const l of Object.values(a))(Array.isArray(l)||l&&typeof l=="object")&&r(l)};return r(e),n}function cm(e,t,n){if(e===t)return!1;const i=e===""?[]:e.split(",").map(Number),r=t===""?[]:t.split(",").map(Number);return i.length!==r.length?!0:i.some((o,a)=>Math.abs(o-r[a])>n)}function lm(e,t,n={}){const i=n.moveTolerance??gS,r=sm(e),o=sm(t),a=[],s=[],c=[];for(const[l,u]of o){const f=r.get(l);if(!f){a.push(l);continue}(f.type!==u.type||f.props!==u.props||cm(f.geometry,u.geometry,i)||cm(f.label,u.label,n.labelTolerance??yS))&&c.push(l)}for(const l of r.keys())o.has(l)||s.push(l);return{added:a.sort(),removed:s.sort(),modified:c.sort()}}async function _S(e,t,n={}){const[i,r]=await Promise.all([lo(e),lo(t)]);return{...lm(i.definitions,r.definitions,n),warnings:[...i.warnings,...r.warnings]}}function wS(e){return new Set([...e.added,...e.modified])}function ES(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function um(e,t,{currentVersion:n}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const i=nm(e,t.ops);if(!i.ok)return{status:"rejected",issues:i.issues};const{xml:r}=await e.saveXML({format:!0});return{status:"applied",version:n+1,xml:r??"",findings:i.findings,stats:i.stats}}const SS=Symbol("bpmn-editor"),Pu={geometry:[],semantic:[]};function RS(){const e=ge.ref(!1),t=ge.ref(!0),n=ge.ref(!1),i=ge.shallowRef(Pu),r=ge.shallowRef(void 0);let o,a;const s=()=>{if(!o){i.value=Pu;return}const p=At(nt(o.get("elementRegistry"))),d=o.getDefinitions();i.value={geometry:p,semantic:d?Au(d):[]}},c=()=>{e.value=!0,s()};function l(p,d){p.get("canvas").getContainer().style.pointerEvents=d?"":"none";const m=p.get("keyboard");d?(a&&m.bind(a),a=void 0):a||(a=m.getBinding(),m.unbind())}function u(){if(!o)throw new Error("modeler not attached — 뷰 @ready 후 attach() 필요");return o}function f(){return o==null?void 0:o.get("commandStack")}return{dirty:e,editable:t,agentBusy:n,issues:i,revalidate:s,changeScope:r,setChangeScope(p){r.value=p===void 0?void 0:new Set(p)},requestFocus(p){if(!o)return;const d=o.get("elementRegistry").get(p);d&&(o.get("canvas").scrollToElement(d,180),o.get("selection").select(d))},describeElement(p){const d=o==null?void 0:o.get("elementRegistry").get(p),m=d==null?void 0:d.businessObject;if(!m)return;const h=typeof m.name=="string"&&m.name.trim()!==""?m.name:m.text;return{name:typeof h=="string"&&h.trim()!==""?h.trim():void 0,type:typeof m.$type=="string"?m.$type:""}},attach(p){o&&this.detach(),o=p,o.get("eventBus").on("commandStack.changed",c),t.value||l(o,!1),s()},detach(){o==null||o.get("eventBus").off("commandStack.changed",c),o&&!t.value&&l(o,!0),a=void 0,o=void 0,i.value=Pu,r.value=void 0},setEditable(p){t.value=p,o&&l(o,p)},async applyAgentBatch(p,d){const m=u();n.value=!0;try{const h=await um(m,p,{currentVersion:d});return h.status==="applied"&&(e.value=!1),h}finally{n.value=!1}},async importXml(p){const{warnings:d}=await u().importXML(p);return e.value=!1,r.value=void 0,s(),{warnings:uu(d)}},async saveXml(){const{xml:p}=await u().saveXML({format:!0});return e.value=!1,p??""},undo:()=>{var p;return(p=f())==null?void 0:p.undo()},redo:()=>{var p;return(p=f())==null?void 0:p.redo()},canUndo:()=>{var p;return((p=f())==null?void 0:p.canUndo())??!1},canRedo:()=>{var p;return((p=f())==null?void 0:p.canRedo())??!1}}}function Ee(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function CS(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Mu={exports:{}},pm;function AS(){if(pm)return Mu.exports;pm=1;var e=Mu.exports=function(t,n){if(n||(n=16),t===void 0&&(t=128),t<=0)return"0";for(var i=Math.log(Math.pow(2,t))/Math.log(n),r=2;i===1/0;r*=2)i=Math.log(Math.pow(2,t/r))/Math.log(n)*r;for(var o=i-Math.floor(i),a="",r=0;r<Math.floor(i);r++){var s=Math.floor(Math.random()*n).toString(n);a=s+a}if(o){var c=Math.pow(n,o),s=Math.floor(Math.random()*c).toString(n);a=s+a}var l=parseInt(a,n);return l!==1/0&&l>=Math.pow(2,t)?e(t,n):a};return e.rack=function(t,n,i){var r=function(a){var s=0;do{if(s++>10)if(i)t+=i;else throw new Error("too many ID collisions, use more bits");var c=e(t,n)}while(Object.hasOwnProperty.call(o,c));return o[c]=a,c},o=r.hats={};return r.get=function(a){return r.hats[a]},r.set=function(a,s){return r.hats[a]=s,r},r.bits=t||128,r.base=n||16,r},Mu.exports}var PS=AS(),MS=CS(PS);function yi(e){if(!(this instanceof yi))return new yi(e);e=e||[128,36,1],this._seed=e.length?MS.rack(e[0],e[1],e[2]):e}yi.prototype.next=function(e){return this._seed(e||!0)},yi.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},yi.prototype.claim=function(e,t){this._seed.set(e,t||!0)},yi.prototype.assigned=function(e){return this._seed.get(e)||!1},yi.prototype.unclaim=function(e){delete this._seed.hats[e]},yi.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const qt={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};qt.td=qt.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],qt.option=qt.optgroup=[1,'<select multiple="multiple">',"</select>"],qt.thead=qt.tbody=qt.colgroup=qt.caption=qt.tfoot=[1,"<table>","</table>"],qt.polyline=qt.ellipse=qt.polygon=qt.circle=qt.text=qt.line=qt.path=qt.rect=qt.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function wt(e,t=globalThis.document){var l;if(typeof e!="string")throw new TypeError("String expected");const n=/^<!--(.*?)-->$/s.exec(e);if(n)return t.createComment(n[1]);const i=(l=/<([\w:]+)/.exec(e))==null?void 0:l[1];if(!i)return t.createTextNode(e);if(e=e.trim(),i==="body"){const u=t.createElement("html");u.innerHTML=e;const{lastChild:f}=u;return f.remove(),f}let[r,o,a]=Object.hasOwn(qt,i)?qt[i]:qt._default,s=t.createElement("div");for(s.innerHTML=o+e+a;r--;)s=s.lastChild;if(s.firstChild===s.lastChild){const{firstChild:u}=s;return u.remove(),u}const c=t.createDocumentFragment();return c.append(...s.childNodes),c}function TS(e,t){return t.forEach(function(n){n&&typeof n!="string"&&!Array.isArray(n)&&Object.keys(n).forEach(function(i){if(i!=="default"&&!(i in e)){var r=Object.getOwnPropertyDescriptor(n,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:function(){return n[i]}})}})}),Object.freeze(e)}function wn(e,...t){const n=e.style;return F(t,function(i){i&&F(i,function(r,o){n[o]=r})}),e}function gn(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const kS=Object.prototype.toString;function Ct(e){return new er(e)}function er(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}er.prototype.add=function(e){return this.list.add(e),this},er.prototype.remove=function(e){return kS.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},er.prototype.removeMatching=function(e){const t=this.array();for(let n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},er.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},er.prototype.array=function(){return Array.from(this.list)},er.prototype.has=er.prototype.contains=function(e){return this.list.contains(e)};function Ls(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Lr(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function OS(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Bs={},fm;function DS(){if(fm)return Bs;fm=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return Bs.bind=function(r,o,a,s){return e||i(),r[e](n+o,a,s||!1),a},Bs.unbind=function(r,o,a,s){return t||i(),r[t](n+o,a,s||!1),a},Bs}var dm=DS(),IS=OS(dm),je=TS({__proto__:null,default:IS},[dm]),hm=["focus","blur"];function LS(e,t,n,i,r){return hm.indexOf(n)!==-1&&(r=!0),je.bind(e,n,function(o){var a=o.target||o.srcElement;o.delegateTarget=Lr(a,t,!0),o.delegateTarget&&i.call(e,o)},r)}function BS(e,t,n,i){return hm.indexOf(t)!==-1&&(i=!0),je.unbind(e,t,n,i)}var On={bind:LS,unbind:BS};function Tu(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function ft(e,t){return t=t||document,t.querySelector(e)}function Ns(e,t){return t=t||document,t.querySelectorAll(e)}function vi(e){e.parentNode&&e.parentNode.removeChild(e)}function NS(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function $S(e,t){return t.appendChild(NS(e,t))}function ze(e,t){return $S(t,e),e}var ku=2,mm={"alignment-baseline":1,"baseline-shift":1,clip:1,"clip-path":1,"clip-rule":1,color:1,"color-interpolation":1,"color-interpolation-filters":1,"color-profile":1,"color-rendering":1,cursor:1,direction:1,display:1,"dominant-baseline":1,"enable-background":1,fill:1,"fill-opacity":1,"fill-rule":1,filter:1,"flood-color":1,"flood-opacity":1,font:1,"font-family":1,"font-size":ku,"font-size-adjust":1,"font-stretch":1,"font-style":1,"font-variant":1,"font-weight":1,"glyph-orientation-horizontal":1,"glyph-orientation-vertical":1,"image-rendering":1,kerning:1,"letter-spacing":1,"lighting-color":1,marker:1,"marker-end":1,"marker-mid":1,"marker-start":1,mask:1,opacity:1,overflow:1,"pointer-events":1,"shape-rendering":1,"stop-color":1,"stop-opacity":1,stroke:1,"stroke-dasharray":1,"stroke-dashoffset":1,"stroke-linecap":1,"stroke-linejoin":1,"stroke-miterlimit":1,"stroke-opacity":1,"stroke-width":ku,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function FS(e,t){return mm[t]?e.style[t]:e.getAttributeNS(null,t)}function gm(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=mm[i];r?(r===ku&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function jS(e,t){var n=Object.keys(t),i,r;for(i=0,r;r=n[i];i++)gm(e,r,t[r])}function Se(e,t,n){if(typeof t=="string")if(n!==void 0)gm(e,t,n);else return FS(e,t);else jS(e,t);return e}const HS=Object.prototype.toString;function et(e){return new tr(e)}function tr(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}tr.prototype.add=function(e){return this.list.add(e),this},tr.prototype.remove=function(e){return HS.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},tr.prototype.removeMatching=function(e){const t=this.array();for(let n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},tr.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},tr.prototype.array=function(){return Array.from(this.list)},tr.prototype.has=tr.prototype.contains=function(e){return this.list.contains(e)};function $s(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function ym(e){return e.cloneNode(!0)}var Ou={svg:"http://www.w3.org/2000/svg"},vm='<svg xmlns="'+Ou.svg+'"';function zS(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(Ou.svg)===-1&&(e=vm+e.substring(4)):(e=vm+">"+e+"</svg>",t=!0);var n=GS(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function GS(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function Oe(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=zS(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(Ou.svg,e),t&&Se(n,t),n}var Du=null;function bm(){return Du===null&&(Du=Oe("svg")),Du}function xm(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function VS(e,t,n,i,r,o){var a=bm().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return xm(a,e);case 6:return xm(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}function sa(e){return bm().createSVGTransform()}var _m=/([&<>]{1})/g,WS=/([&<>\n\r"]{1})/g,US={"&":"&","<":"<",">":">",'"':"'"};function Iu(e,t){function n(i,r){return US[r]||r}return e.replace(t,n)}function wm(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(Iu(e.textContent,_m));break;case 1:if(t.push("<",e.tagName),e.hasAttributes())for(r=e.attributes,n=0,i=r.length;n<i;++n)o=r.item(n),t.push(" ",o.name,'="',Iu(o.value,WS),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)wm(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",Iu(e.nodeValue,_m),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function YS(e){for(var t=e.firstChild,n=[];t;)wm(t,n),t=t.nextSibling;return n.join("")}function Em(e,t){return YS(e)}function Kt(e){var t=e.parentNode;return t&&t.removeChild(e),e}function qS(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function KS(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(qS(e,i))}function ca(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),KS(n,t)),n.consolidate()}const XS=/^class[ {]/;function ZS(e){return XS.test(e.toString())}function Lu(e){return Array.isArray(e)}function Bu(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Fs(...e){e.length===1&&Lu(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const QS=/constructor\s*[^(]*\(\s*([^)]*)\)/m,JS=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,eR=/\/\*([^*]*)\*\//m;function tR(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(ZS(e)?QS:JS);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const r=i.match(eR);return(r&&r[1]||i).trim()})||[]}function Sm(e,t){const n=t||{get:function(b,x){if(i.push(b),x===!1)return null;throw s(`No provider for "${b}"!`)}},i=[],r=this._providers=Object.create(n._providers||null),o=this._instances=Object.create(null),a=o.injector=this,s=function(b){const x=i.join(" -> ");return i.length=0,new Error(x?`${b} (Resolving: ${x})`:b)};function c(b,x){if(!r[b]&&b.includes(".")){const C=b.split(".");let M=c(C.shift());for(;C.length;)M=M[C.shift()];return M}if(Bu(o,b))return o[b];if(Bu(r,b)){if(i.indexOf(b)!==-1)throw i.push(b),s("Cannot resolve circular dependency!");return i.push(b),o[b]=r[b][0](r[b][1]),i.pop(),o[b]}return n.get(b,x)}function l(b,x){if(typeof x>"u"&&(x={}),typeof b!="function")if(Lu(b))b=Fs(b.slice());else throw s(`Cannot invoke "${b}". Expected a function!`);const M=(b.$inject||tR(b)).map(k=>Bu(x,k)?x[k]:c(k));return{fn:b,dependencies:M}}function u(b){const{fn:x,dependencies:C}=l(b),M=Function.prototype.bind.call(x,null,...C);return new M}function f(b,x,C){const{fn:M,dependencies:k}=l(b,C);return M.apply(x,k)}function p(b){return Fs(x=>b.get(x))}function d(b,x){if(x&&x.length){const C=Object.create(null),M=Object.create(null),k=[],P=[],B=[];let D,I,z,oe;for(let ye in r)D=r[ye],x.indexOf(ye)!==-1&&(D[2]==="private"?(I=k.indexOf(D[3]),I===-1?(z=D[3].createChild([],x),oe=p(z),k.push(D[3]),P.push(z),B.push(oe),C[ye]=[oe,ye,"private",z]):C[ye]=[B[I],ye,"private",P[I]]):C[ye]=[D[2],D[1]],M[ye]=!0),(D[2]==="factory"||D[2]==="type")&&D[1].$scope&&x.forEach(Ve=>{D[1].$scope.indexOf(Ve)!==-1&&(C[ye]=[D[2],D[1]],M[Ve]=!0)});x.forEach(ye=>{if(!M[ye])throw new Error('No provider for "'+ye+'". Cannot use provider from the parent!')}),b.unshift(C)}return new Sm(b,a)}const m={factory:f,type:u,value:function(b){return b}};function h(b,x){const C=b.__init__||[];return function(){C.forEach(M=>{typeof M=="string"?x.get(M):x.invoke(M)})}}function y(b){const x=b.__exports__;if(x){const C=b.__modules__,M=Object.keys(b).reduce((I,z)=>(z!=="__exports__"&&z!=="__modules__"&&z!=="__init__"&&z!=="__depends__"&&(I[z]=b[z]),I),Object.create(null)),k=(C||[]).concat(M),P=d(k),B=Fs(function(I){return P.get(I)});x.forEach(function(I){r[I]=[B,I,"private",P]});const D=(b.__init__||[]).slice();return D.unshift(function(){P.init()}),b=Object.assign({},b,{__init__:D}),h(b,P)}return Object.keys(b).forEach(function(C){if(C==="__init__"||C==="__depends__")return;const M=b[C];if(M[2]==="private"){r[C]=M;return}const k=M[0],P=M[1];r[C]=[m[k],nR(k,P),k]}),h(b,a)}function v(b,x){return b.indexOf(x)!==-1||(b=(x.__depends__||[]).reduce(v,b),b.indexOf(x)!==-1)?b:b.concat(x)}function g(b){const x=b.reduce(v,[]).map(y);let C=!1;return function(){C||(C=!0,x.forEach(M=>M()))}}this.get=c,this.invoke=f,this.instantiate=u,this.createChild=d,this.init=g(e)}function nR(e,t){return e!=="value"&&Lu(t)&&(t=Fs(t.slice())),t}var iR=1e3;function Ii(e,t){var n=this;t=t||iR,e.on(["render.shape","render.connection"],t,function(i,r){var o=i.type,a=r.element,s=r.gfx,c=r.attrs;if(n.canRender(a))return o==="render.shape"?n.drawShape(s,a,c):n.drawConnection(s,a,c)}),e.on(["render.getShapePath","render.getConnectionPath"],t,function(i,r){if(n.canRender(r))return i.type==="render.getShapePath"?n.getShapePath(r):n.getConnectionPath(r)})}Ii.prototype.canRender=function(e){},Ii.prototype.drawShape=function(e,t){},Ii.prototype.drawConnection=function(e,t){},Ii.prototype.getShapePath=function(e){},Ii.prototype.getConnectionPath=function(e){};function Br(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function rR(e){return["M",e.x,e.y]}function Nu(e){return["L",e.x,e.y]}function oR(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function aR(e,t){const n=e.length,i=[rR(e[0])];for(let r=1;r<n;r++){const o=e[r-1],a=e[r],s=e[r+1];if(!s||!t){i.push(Nu(a));continue}const c=Math.min(t,$u(a.x-o.x,a.y-o.y),$u(s.x-a.x,s.y-a.y));if(!c){i.push(Nu(a));continue}const l=js(a,o,c),u=js(a,o,c*.5),f=js(a,s,c),p=js(a,s,c*.5);i.push(Nu(l)),i.push(oR(u,p,f))}return i}function js(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=$u(i,r),a=n/o;return{x:e.x+i*a,y:e.y+r*a}}function $u(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function la(e,t,n){Fe(t)&&(n=t,t=null),t||(t={});const i=Oe("path",t);return Fe(n)&&(i.dataset.cornerRadius=String(n)),Fu(i,e)}function Fu(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return Se(e,{d:Br(aR(t,n))}),e}function Hs(e){var t=new Set(e);return Ke(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function Nr(e,t,n){n=n||0,Be(e)||(e=[e]),F(e,function(i,r){var o=t(i,r,n);Be(o)&&o.length&&Nr(o,t,n+1)})}function ju(e,t,n){var i=new Set,r=new Set;return Nr(e,function(o,a,s){i.add(o);var c=o.children;if(c&&!r.has(c))return r.add(c),c}),Array.from(i)}function ua(e,t){return ju(e)}function sR(e,t,n){Tr(t)&&(t=!0),Qt(t)&&(n=t,t=!0),n=n||{};var i=pa(n.allShapes),r=pa(n.allConnections),o=pa(n.enclosedElements),a=pa(n.enclosedConnections),s=pa(n.topLevel,t&&oo(e,function(u){return u.id}));function c(u){s[u.source.id]&&s[u.target.id]&&(s[u.id]=[u]),i[u.source.id]&&i[u.target.id]&&(a[u.id]=o[u.id]=u),r[u.id]=u}function l(u){if(o[u.id]=u,u.waypoints)a[u.id]=r[u.id]=u;else return i[u.id]=u,F(u.incoming,c),F(u.outgoing,c),u.children}return Nr(e,l),{allShapes:i,allConnections:r,topLevel:s,enclosedConnections:a,enclosedElements:o}}function Ft(e,t){t=!!t,Be(e)||(e=[e]);var n,i,r,o;return F(e,function(a){var s=a;a.waypoints&&!t&&(s=Ft(a.waypoints,!0));var c=s.x,l=s.y,u=s.height||0,f=s.width||0;(c<n||n===void 0)&&(n=c),(l<i||i===void 0)&&(i=l),(c+f>r||r===void 0)&&(r=c+f),(l+u>o||o===void 0)&&(o=l+u)}),{x:n,y:i,height:o-i,width:r-n}}function bo(e,t){var n={};return F(e,function(i){var r=i;r.waypoints&&(r=Ft(r)),!Fe(t.y)&&r.x>t.x&&(n[i.id]=i),!Fe(t.x)&&r.y>t.y&&(n[i.id]=i),r.x>t.x&&r.y>t.y&&(Fe(t.width)&&Fe(t.height)&&r.width+r.x<t.width+t.x&&r.height+r.y<t.height+t.y||!Fe(t.width)||!Fe(t.height))&&(n[i.id]=i)}),n}function Rm(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function Cm(e){return!!(e&&e.isFrame)}function pa(e,t){return W({},e||{},t||{})}var cR=1;function nr(e,t){Ii.call(this,e,cR),this.CONNECTION_STYLE=t.style(["no-fill"],{strokeWidth:5,stroke:"fuchsia"}),this.SHAPE_STYLE=t.style({fill:"white",stroke:"fuchsia",strokeWidth:2}),this.FRAME_STYLE=t.style(["no-fill"],{stroke:"fuchsia",strokeDasharray:4,strokeWidth:2})}Ee(nr,Ii),nr.prototype.canRender=function(){return!0},nr.prototype.drawShape=function(t,n,i){var r=Oe("rect");return Se(r,{x:0,y:0,width:n.width||0,height:n.height||0}),Cm(n)?Se(r,W({},this.FRAME_STYLE,i||{})):Se(r,W({},this.SHAPE_STYLE,i||{})),ze(t,r),r},nr.prototype.drawConnection=function(t,n,i){var r=la(n.waypoints,W({},this.CONNECTION_STYLE,i||{}));return ze(t,r),r},nr.prototype.getShapePath=function(t){var n=t.x,i=t.y,r=t.width,o=t.height,a=[["M",n,i],["l",r,0],["l",0,o],["l",-r,0],["z"]];return Br(a)},nr.prototype.getConnectionPath=function(t){var n=t.waypoints,i,r,o=[];for(i=0;r=n[i];i++)r=r.original||r,o.push([i===0?"M":"L",r.x,r.y]);return Br(o)},nr.$inject=["eventBus","styles"];function lR(){var e={"no-fill":{fill:"none"},"no-border":{strokeOpacity:0},"no-events":{pointerEvents:"none"}},t=this;this.cls=function(n,i,r){var o=this.style(i,r);return W(o,{class:n})},this.style=function(n,i){!Be(n)&&!i&&(i=n,n=[]);var r=Tn(n,function(o,a){return W(o,e[a]||{})},{});return i?W(r,i):r},this.computeStyle=function(n,i,r){return Be(i)||(r=i,i=[]),t.style(i||[],W({},r,n||{}))}}const uR={__init__:["defaultRenderer"],defaultRenderer:["type",nr],styles:["type",lR]};function Lt(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function Bt(e,t,n){if(!(!e||!t)){typeof n!="number"&&(n=-1);var i=e.indexOf(t);if(i!==-1){if(i===n)return;if(n!==-1)e.splice(i,1);else return}n!==-1?e.splice(n,0,t):e.push(t)}}function Hu(e,t){return!e||!t?-1:e.indexOf(t)}function fa(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function zu(e,t,n,i){if(typeof i>"u"&&(i=5),!e||!t||!n)return!1;var r=(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),o=fa(e,t);return Math.abs(r/o)<=i}var pR=2;function Li(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[r,o]of Object.entries(i))if(fR(r,n))return o;return!1}function fR(e,t){const n=t[0];return kr(t,function(i){return Math.abs(n[e]-i[e])<=pR})}function Am(e,t,n){return n=n||0,e.x>t.x-n&&e.y>t.y-n&&e.x<t.x+t.width+n&&e.y<t.y+t.height+n}function Gu(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var dR=/,?([a-z]),?/gi,Pm=parseFloat,jt=Math,ir=jt.PI,bi=jt.min,xi=jt.max,Mm=jt.pow,rr=jt.abs,hR=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,mR=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,Tm=Array.isArray||function(e){return e instanceof Array};function gR(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function yR(e,t){for(var n=0,i=e.length;n<i;n++)if(e[n]===t)return e.push(e.splice(n,1)[0])}function vR(e){function t(){var n=Array.prototype.slice.call(arguments,0),i=n.join("␀"),r=t.cache=t.cache||{},o=t.count=t.count||[];return gR(r,i)?(yR(o,i),r[i]):(o.length>=1e3&&delete r[o.shift()],o.push(i),r[i]=e(...arguments),r[i])}return t}function bR(e){if(!e)return null;var t={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},n=[];return String(e).replace(hR,function(i,r,o){var a=[],s=r.toLowerCase();for(o.replace(mR,function(c,l){l&&a.push(+l)}),s=="m"&&a.length>2&&(n.push([r,...a.splice(0,2)]),s="l",r=r=="m"?"l":"L");a.length>=t[s]&&(n.push([r,...a.splice(0,t[s])]),!!t[s]););}),n.toString=Wu,n}function xR(e){for(var t=0,n=e.length;t<n;t++){var i=e[t][0];if(typeof i=="string"&&i!==i.toUpperCase())return!1}return!0}function _R(e){for(var t=0,n=e.length;t<n;t++){var i=e[t][0];if(i!=="M"&&i!=="C")return!1}return!0}function Vu(e,t,n,i){return arguments.length===1&&(t=e.y,n=e.width,i=e.height,e=e.x),{x:e,y:t,width:n,height:i,x2:e+n,y2:t+i}}function Wu(){return this.join(",").replace(dR,"$1")}function wR(e){for(var t=new Array(e.length),n=0,i=e.length;n<i;n++)for(var r=e[n],o=t[n]=new Array(r.length),a=0,s=r.length;a<s;a++)o[a]=r[a];return t.toString=Wu,t}function km(e,t,n,i,r,o,a,s,c){var l=1-c,u=Mm(l,3),f=Mm(l,2),p=c*c,d=p*c,m=u*e+f*3*c*n+l*3*c*c*r+d*a,h=u*t+f*3*c*i+l*3*c*c*o+d*s;return{x:zs(m),y:zs(h)}}function Om(e){var t=PR(...e);return Vu(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function or(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function ER(e,t){return e=Vu(e),t=Vu(t),or(t,e.x,e.y)||or(t,e.x2,e.y)||or(t,e.x,e.y2)||or(t,e.x2,e.y2)||or(e,t.x,t.y)||or(e,t.x2,t.y)||or(e,t.x,t.y2)||or(e,t.x2,t.y2)||(e.x<t.x2&&e.x>t.x||t.x<e.x2&&t.x>e.x)&&(e.y<t.y2&&e.y>t.y||t.y<e.y2&&t.y>e.y)}function Dm(e,t,n,i,r){var o=-3*t+9*n-9*i+3*r,a=e*o+6*t-12*n+6*i;return e*a-3*t+3*n}function Im(e,t,n,i,r,o,a,s,c){c==null&&(c=1),c=c>1?1:c<0?0:c;for(var l=c/2,u=12,f=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],p=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],d=0,m=0;m<u;m++){var h=l*f[m]+l,y=Dm(h,e,n,r,a),v=Dm(h,t,i,o,s),g=y*y+v*v;d+=p[m]*jt.sqrt(g)}return l*d}function SR(e,t,n,i,r,o,a,s){if(!(xi(e,n)<bi(r,a)||bi(e,n)>xi(r,a)||xi(t,i)<bi(o,s)||bi(t,i)>xi(o,s))){var c=(e*i-t*n)*(r-a)-(e-n)*(r*s-o*a),l=(e*i-t*n)*(o-s)-(t-i)*(r*s-o*a),u=(e-n)*(o-s)-(t-i)*(r-a);if(u){var f=zs(c/u),p=zs(l/u),d=+f.toFixed(2),m=+p.toFixed(2);if(!(d<+bi(e,n).toFixed(2)||d>+xi(e,n).toFixed(2)||d<+bi(r,a).toFixed(2)||d>+xi(r,a).toFixed(2)||m<+bi(t,i).toFixed(2)||m>+xi(t,i).toFixed(2)||m<+bi(o,s).toFixed(2)||m>+xi(o,s).toFixed(2)))return{x:f,y:p}}}}function zs(e){return Math.round(e*1e11)/1e11}function RR(e,t,n){var i=Om(e),r=Om(t);if(!ER(i,r))return[];var o=Im(...e),a=Im(...t),s=Bm(e)?1:~~(o/5)||1,c=Bm(t)?1:~~(a/5)||1,l=new Array(s+1),u=new Array(c+1),f={},p=[],d,m;for(d=0;d<s+1;d++){var h=km(...e,d/s);l[d]={x:h.x,y:h.y,t:d/s}}for(d=0;d<c+1;d++)h=km(...t,d/c),u[d]={x:h.x,y:h.y,t:d/c};for(d=0;d<s;d++)for(m=0;m<c;m++){var y=l[d],v=l[d+1],g=u[m],b=u[m+1],x=rr(v.x-y.x)<.01?"y":"x",C=rr(b.x-g.x)<.01?"y":"x",M=SR(y.x,y.y,v.x,v.y,g.x,g.y,b.x,b.y),k;if(M){if(k=M.x.toFixed(9)+"#"+M.y.toFixed(9),f[k])continue;f[k]=!0;var P=y.t+rr((M[x]-y[x])/(v[x]-y[x]))*(v.t-y.t),B=g.t+rr((M[C]-g[C])/(b[C]-g[C]))*(b.t-g.t);P>=0&&P<=1&&B>=0&&B<=1&&p.push({x:M.x,y:M.y,t1:P,t2:B})}}return p}function Lm(e,t,n){e=Fm(e),t=Fm(t);for(var i,r,o,a,s,c,l,u,f,p,d=n?0:[],m=0,h=e.length;m<h;m++){var y=e[m];if(y[0]=="M")i=s=y[1],r=c=y[2];else{y[0]=="C"?(f=[i,r,...y.slice(1)],i=f[6],r=f[7]):(f=[i,r,i,r,s,c,s,c],i=s,r=c);for(var v=0,g=t.length;v<g;v++){var b=t[v];if(b[0]=="M")o=l=b[1],a=u=b[2];else{b[0]=="C"?(p=[o,a,...b.slice(1)],o=p[6],a=p[7]):(p=[o,a,o,a,l,u,l,u],o=l,a=u);var x=RR(f,p);{for(var C=0,M=x.length;C<M;C++)x[C].segment1=m,x[C].segment2=v,x[C].bez1=f,x[C].bez2=p;d=d.concat(x)}}}}}return d}function CR(e){return Tm(e)&&Tm(e[0])}function AR(e){if(xR(e))return e;var t=new Array(e.length),n=0,i=0,r=0,o=0,a=0,s;e[0][0]=="M"&&(n=+e[0][1],i=+e[0][2],r=n,o=i,a++,t[0]=["M",n,i]);for(var c,l,u=a,f=e.length;u<f;u++){if(l=e[u],s=l[0],t[u]=c=new Array(l.length),s!=s.toUpperCase())switch(c[0]=s.toUpperCase(),c[0]){case"A":c[1]=l[1],c[2]=l[2],c[3]=l[3],c[4]=l[4],c[5]=l[5],c[6]=+l[6]+n,c[7]=+l[7]+i;break;case"V":c[1]=+l[1]+i;break;case"H":c[1]=+l[1]+n;break;case"M":r=+l[1]+n,o=+l[2]+i;default:for(var p=1,d=l.length;p<d;p++)c[p]=+l[p]+(p%2?n:i)}else for(var m=0,h=l.length;m<h;m++)c[m]=l[m];switch(s=s.toUpperCase(),c[0]){case"Z":n=+r,i=+o;break;case"H":n=c[1];break;case"V":i=c[1];break;case"M":r=c[c.length-2],o=c[c.length-1];default:n=c[c.length-2],i=c[c.length-1]}}return t.toString=Wu,t}function Bm(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function Gs(e,t,n,i){return[e,t,n,i,n,i]}function Nm(e,t,n,i,r,o){var a=.3333333333333333,s=2/3;return[a*e+s*n,a*t+s*i,a*r+s*n,a*o+s*i,r,o]}function $m(e,t,n,i,r,o,a,s,c,l){var u=ir*120/180,f=ir/180*(+r||0),p=[],d,m=vR(function(T,w,E){var G=T*jt.cos(E)-w*jt.sin(E),U=T*jt.sin(E)+w*jt.cos(E);return{x:G,y:U}});if(l)k=l[0],P=l[1],C=l[2],M=l[3];else{d=m(e,t,-f),e=d.x,t=d.y,d=m(s,c,-f),s=d.x,c=d.y;var h=(e-s)/2,y=(t-c)/2,v=h*h/(n*n)+y*y/(i*i);v>1&&(v=jt.sqrt(v),n=v*n,i=v*i);var g=n*n,b=i*i,x=(o==a?-1:1)*jt.sqrt(rr((g*b-g*y*y-b*h*h)/(g*y*y+b*h*h))),C=x*n*y/i+(e+s)/2,M=x*-i*h/n+(t+c)/2,k=jt.asin(((t-M)/i).toFixed(9)),P=jt.asin(((c-M)/i).toFixed(9));k=e<C?ir-k:k,P=s<C?ir-P:P,k<0&&(k=ir*2+k),P<0&&(P=ir*2+P),a&&k>P&&(k=k-ir*2),!a&&P>k&&(P=P-ir*2)}var B=P-k;if(rr(B)>u){var D=P,I=s,z=c;P=k+u*(a&&P>k?1:-1),s=C+n*jt.cos(P),c=M+i*jt.sin(P),p=$m(s,c,n,i,r,0,a,I,z,[P,D,C,M])}B=P-k;var oe=jt.cos(k),ye=jt.sin(k),Ve=jt.cos(P),He=jt.sin(P),it=jt.tan(B/4),K=4/3*n*it,Z=4/3*i*it,se=[e,t],xe=[e+K*ye,t-Z*oe],q=[s+K*He,c-Z*Ve],V=[s,c];if(xe[0]=2*se[0]-xe[0],xe[1]=2*se[1]-xe[1],l)return[xe,q,V].concat(p);p=[xe,q,V].concat(p).join().split(",");for(var ne=[],Te=0,yt=p.length;Te<yt;Te++)ne[Te]=Te%2?m(p[Te-1],p[Te],f).y:m(p[Te],p[Te+1],f).x;return ne}function PR(e,t,n,i,r,o,a,s){for(var c=[],l=[[],[]],u,f,p,d,m,h,y,v,g=0;g<2;++g){if(g==0?(f=6*e-12*n+6*r,u=-3*e+9*n-9*r+3*a,p=3*n-3*e):(f=6*t-12*i+6*o,u=-3*t+9*i-9*o+3*s,p=3*i-3*t),rr(u)<1e-12){if(rr(f)<1e-12)continue;d=-p/f,0<d&&d<1&&c.push(d);continue}y=f*f-4*p*u,v=jt.sqrt(y),!(y<0)&&(m=(-f+v)/(2*u),0<m&&m<1&&c.push(m),h=(-f-v)/(2*u),0<h&&h<1&&c.push(h))}for(var b=c.length,x=b,C;b--;)d=c[b],C=1-d,l[0][b]=C*C*C*e+3*C*C*d*n+3*C*d*d*r+d*d*d*a,l[1][b]=C*C*C*t+3*C*C*d*i+3*C*d*d*o+d*d*d*s;return l[0][x]=e,l[1][x]=t,l[0][x+1]=a,l[1][x+1]=s,l[0].length=l[1].length=x+2,{x0:bi(...l[0]),y0:bi(...l[1]),x1:xi(...l[0]),y1:xi(...l[1])}}function Fm(e){if(CR(e)||(e=bR(e)),_R(e))return e;for(var t=wR(AR(e)),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i=function(p,d,m){var h,y;if(!p)return["C",d.x,d.y,d.x,d.y,d.x,d.y];switch(!(p[0]in{T:1,Q:1})&&(d.qx=d.qy=null),p[0]){case"M":d.X=p[1],d.Y=p[2];break;case"A":p=["C",...$m(d.x,d.y,...p.slice(1))];break;case"S":m=="C"||m=="S"?(h=d.x*2-d.bx,y=d.y*2-d.by):(h=d.x,y=d.y),p=["C",h,y,...p.slice(1)];break;case"T":m=="Q"||m=="T"?(d.qx=d.x*2-d.qx,d.qy=d.y*2-d.qy):(d.qx=d.x,d.qy=d.y),p=["C",...Nm(d.x,d.y,d.qx,d.qy,p[1],p[2])];break;case"Q":d.qx=p[1],d.qy=p[2],p=["C",...Nm(d.x,d.y,p[1],p[2],p[3],p[4])];break;case"L":p=["C",...Gs(d.x,d.y,p[1],p[2])];break;case"H":p=["C",...Gs(d.x,d.y,p[1],d.y)];break;case"V":p=["C",...Gs(d.x,d.y,d.x,p[1])];break;case"Z":p=["C",...Gs(d.x,d.y,d.X,d.Y)];break}return p},r=function(p,d){if(p[d].length>7){p[d].shift();for(var m=p[d];m.length;)o[d]="A",p.splice(d++,0,["C",...m.splice(0,6)]);p.splice(d,1),l=t.length}},o=[],a="",s="",c=0,l=t.length;c<l;c++){t[c]&&(a=t[c][0]),a!="C"&&(o[c]=a,c&&(s=o[c-1])),t[c]=i(t[c],n,s),o[c]!="A"&&a=="C"&&(o[c]="C"),r(t,c);var u=t[c],f=u.length;n.x=u[f-2],n.y=u[f-1],n.bx=Pm(u[f-4])||n.x,n.by=Pm(u[f-3])||n.y}return t}function ht(e){return Qt(e)&&Mn(e,"waypoints")}function Ye(e){return Qt(e)&&Mn(e,"labelTarget")}function MR(e){return Qt(e)&&io(e.parent)}function jm(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function Bi(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function Ie(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function Vs(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function TR(e){return Bi({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function kR(e){for(var t=e.waypoints,n=t.reduce(function(l,u,f){var p=t[f-1];if(p){var d=l[l.length-1],m=d&&d.endLength||0,h=IR(p,u);l.push({start:p,end:u,startLength:m,endLength:m+h,length:h})}return l},[]),i=n.reduce(function(l,u){return l+u.length},0),r=i/2,o=0,a=n[o];a.endLength<r;)a=n[++o];var s=(r-a.startLength)/a.length,c={x:a.start.x+(a.end.x-a.start.x)*s,y:a.start.y+(a.end.y-a.start.y)*s};return c}function Ne(e){return ht(e)?kR(e):TR(e)}function cn(e,t,n){n=n||0,Qt(n)||(n={x:n,y:n});var i=Ie(e),r=Ie(t),o=i.bottom+n.y<=r.top,a=i.left-n.x>=r.right,s=i.top-n.y>=r.bottom,c=i.right+n.x<=r.left,l=o?"top":s?"bottom":null,u=c?"left":a?"right":null;return u&&l?l+"-"+u:u||l||"intersect"}function da(e,t,n){var i=OR(e,t);return i.length===1||i.length===2&&fa(i[0],i[1])<1?Bi(i[0]):i.length>1?(i=di(i,function(r){var o=Math.floor(r.t2*100)||1;return o=100-o,o=(o<10?"0":"")+o,r.segment2+"#"+o}),Bi(i[n?0:i.length-1])):null}function OR(e,t){return Lm(e,t)}function DR(e){e=e.slice();for(var t=0,n,i,r;e[t];)n=e[t],i=e[t-1],r=e[t+1],fa(n,r)===0||zu(i,r,n)?e.splice(t,1):t++;return e}function IR(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Ws(e,t){return Math.round(e*t)/t}function Hm(e){return Fe(e)?e+"px":e}function LR(e){for(;e.parent;)e=e.parent;return e}function BR(e){e=W({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),wn(n,{position:"relative",overflow:"hidden",width:Hm(e.width),height:Hm(e.height)}),t.appendChild(n),n}function zm(e,t,n){const i=Oe("g");et(i).add(t);const r=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}const NR="base",Gm=0,$R=1,FR={shape:["x","y","width","height"],connection:["waypoints"]};function $e(e,t,n,i){this._eventBus=t,this._elementRegistry=i,this._graphicsFactory=n,this._rootsIdx=0,this._layers={},this._planes=[],this._rootElement=null,this._focused=!1,this._init(e||{})}$e.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],$e.prototype._init=function(e){const t=this._eventBus,n=this._container=BR(e),i=this._svg=Oe("svg");Se(i,{width:"100%",height:"100%"}),gn(i,"tabindex",0),e.autoFocus&&t.on("element.hover",()=>{this.restoreFocus()}),t.on("element.mousedown",500,o=>{this.focus()}),i.addEventListener("focusin",()=>{this._setFocused(!0)}),i.addEventListener("focusout",()=>{this._setFocused(!1)}),i.addEventListener("mouseover",()=>{this._eventBus.fire("canvas.mouseover")}),i.addEventListener("mouseout",()=>{this._eventBus.fire("canvas.mouseout")}),ze(n,i);const r=this._viewport=zm(i,"viewport");e.deferUpdate&&(this._viewboxChanged=Zl(this._viewboxChanged,300)),this._restoreFocus=Zl(this._restoreFocus,0),t.on("diagram.init",()=>{t.fire("canvas.init",{svg:i,viewport:r})}),t.on(["shape.added","connection.added","shape.removed","connection.removed","elements.changed","root.set"],()=>{delete this._cachedViewbox}),t.on("diagram.destroy",500,this._destroy,this),t.on("diagram.clear",500,this._clear,this)},$e.prototype._destroy=function(){this._restoreFocus.cancel(),this._eventBus.fire("canvas.destroy",{svg:this._svg,viewport:this._viewport});const e=this._container.parentNode;e&&e.removeChild(this._container),delete this._svg,delete this._container,delete this._layers,delete this._planes,delete this._rootElement,delete this._viewport},$e.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},$e.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=Rm(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},$e.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},$e.prototype.restoreFocus=function(){this._restoreFocus()},$e.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},$e.prototype.isFocused=function(){return this._focused},$e.prototype.getDefaultLayer=function(){return this.getLayer(NR,Gm)},$e.prototype.getLayer=function(e,t){if(!e)throw new Error("must specify a name");let n=this._layers[e];if(n||(n=this._layers[e]=this._createLayer(e,t)),typeof t<"u"&&n.index!==t)throw new Error("layer <"+e+"> already created at index <"+t+">");return n.group},$e.prototype._getChildIndex=function(e){return Tn(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},$e.prototype._createLayer=function(e,t){typeof t>"u"&&(t=$R);const n=this._getChildIndex(t);return{group:zm(this._viewport,"layer-"+e,n),index:t,visible:!0}},$e.prototype.showLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const n=this._viewport,i=t.group,r=t.index;if(t.visible)return i;const o=this._getChildIndex(r);return n.insertBefore(i,n.childNodes[o]||null),t.visible=!0,i},$e.prototype.hideLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const n=t.group;return t.visible&&(Kt(n),t.visible=!1),n},$e.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],Kt(t.group))},$e.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},$e.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const r=this._findPlaneForRoot(LR(i));if(!r||n&&r.rootElement!==n)return;n=r.rootElement}return n},$e.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},$e.prototype._findPlaneForRoot=function(e){return vt(this._planes,function(t){return t.rootElement===e})},$e.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},$e.prototype._resolveElements=function(e){return Be(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},$e.prototype.getContainer=function(){return this._container},$e.prototype._updateMarker=function(e,t,n){let i;e=this._resolveElement(e),e.markers=e.markers||new Set,i=this._elementRegistry._elements[e.id],i&&(F([i.gfx,i.secondaryGfx],function(r){r&&(n?(e.markers.add(t),et(r).add(t)):(e.markers.delete(t),et(r).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},$e.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},$e.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},$e.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},$e.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},$e.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},$e.prototype.addRootElement=function(e){const t=this._rootsIdx++;e||(e={id:"__implicitroot_"+t,children:[],isImplicit:!0});const n=e.layer="root-"+t;this._ensureValid("root",e);const i=this.getLayer(n,Gm);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},$e.prototype.removeRootElement=function(e){if(e=this._resolveElement(e),!!this._findPlaneForRoot(e))return this._removeRoot(e),this._removeLayer(e.layer),this._planes=this._planes.filter(function(n){return n.rootElement!==e}),this._rootElement===e&&(this._rootElement=null),e},$e.prototype.setRootElement=function(e){if(e===this._rootElement)return e;let t;if(!e)throw new Error("rootElement required");return t=this._findPlaneForRoot(e),t||(e=this.addRootElement(e)),this._setRoot(e),e},$e.prototype._removeRoot=function(e){const t=this._elementRegistry,n=this._eventBus;n.fire("root.remove",{element:e}),n.fire("root.removed",{element:e}),t.remove(e)},$e.prototype._addRoot=function(e,t){const n=this._elementRegistry,i=this._eventBus;i.fire("root.add",{element:e}),n.add(e,t),i.fire("root.added",{element:e,gfx:t})},$e.prototype._setRoot=function(e,t){const n=this._rootElement;n&&(this._elementRegistry.updateGraphics(n,null,!0),this.hideLayer(n.layer)),e&&(t||(t=this._findPlaneForRoot(e).layer),this._elementRegistry.updateGraphics(e,this._svg,!0),this.showLayer(e.layer)),this._rootElement=e,this._eventBus.fire("root.set",{element:e})},$e.prototype._ensureValid=function(e,t){if(!t.id)throw new Error("element must have an id");if(this._elementRegistry.get(t.id))throw new Error("element <"+t.id+"> already exists");const n=FR[e];if(!kr(n,function(r){return typeof t[r]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},$e.prototype._setParent=function(e,t,n){Bt(t.children,e,n),e.parent=t},$e.prototype._addElement=function(e,t,n,i){n=n||this.getRootElement();const r=this._eventBus,o=this._graphicsFactory;this._ensureValid(e,t),r.fire(e+".add",{element:t,parent:n}),this._setParent(t,n,i);const a=o.create(e,t,i);return this._elementRegistry.add(t,a),o.update(e,t,a),r.fire(e+".added",{element:t,gfx:a}),t},$e.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},$e.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},$e.prototype._removeElement=function(e,t){const n=this._elementRegistry,i=this._graphicsFactory,r=this._eventBus;if(e=n.get(e.id||e),!!e)return r.fire(t+".remove",{element:e}),i.remove(e),Lt(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},$e.prototype.removeShape=function(e){return this._removeElement(e,"shape")},$e.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},$e.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},$e.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},$e.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},$e.prototype.viewbox=function(e){if(e===void 0&&this._cachedViewbox)return structuredClone(this._cachedViewbox);const t=this._viewport,n=this.getSize();let i,r,o,a,s,c,l;if(e)this._changeViewbox(function(){s=Math.min(n.width/e.width,n.height/e.height);const u=this._svg.createSVGMatrix().scale(s).translate(-e.x,-e.y);ca(t,u)});else return o=this._rootElement?this.getActiveLayer():null,i=o&&o.getBBox()||{},a=ca(t),r=a?a.matrix:VS(),s=Ws(r.a,1e3),c=Ws(-r.e||0,1e3),l=Ws(-r.f||0,1e3),e=this._cachedViewbox={x:c?c/s:0,y:l?l/s:0,width:n.width/s,height:n.height/s,scale:s,inner:{width:i.width||0,height:i.height||0,x:i.x||0,y:i.y||0},outer:n},e;return e},$e.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=W({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),Vm(t,n)}),{x:n.e,y:n.f}},$e.prototype.scrollToElement=function(e,t){let n=100;const i=this._resolveElements(e);if(!i.length)return;const r=this.findRoot(i);if(!r)return;r!==this.getRootElement()&&this.setRootElement(r);const o=i.filter(m=>m!=r);if(!o.length)return;t||(t={}),typeof t=="number"&&(n=t),t={top:t.top||n,right:t.right||n,bottom:t.bottom||n,left:t.left||n};const a=Ft(o),s=Ie(a),c=this.viewbox(),l=this.zoom();let u,f;c.y+=t.top/l,c.x+=t.left/l,c.width-=(t.right+t.left)/l,c.height-=(t.bottom+t.top)/l;const p=Ie(c);if(!(a.width<c.width&&a.height<c.height))u=a.x-c.x,f=a.y-c.y;else{const m=Math.max(0,s.right-p.right),h=Math.min(0,s.left-p.left),y=Math.max(0,s.bottom-p.bottom),v=Math.min(0,s.top-p.top);u=m||h,f=y||v}this.scroll({dx:-u*l,dy:-f*l})},$e.prototype.zoom=function(e,t){if(!e)return this.viewbox(e).scale;if(e==="fit-viewport")return this._fitViewport(t);let n,i;return this._changeViewbox(function(){typeof t!="object"&&(n=this.viewbox().outer,t={x:n.width/2,y:n.height/2}),i=this._setZoom(e,t)}),Ws(i.a,1e3)};function Vm(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}$e.prototype._fitViewport=function(e){const t=this.viewbox(),n=t.outer,i=t.inner;let r,o;return i.x>=0&&i.y>=0&&i.x+i.width<=n.width&&i.y+i.height<=n.height&&!e?o={x:0,y:0,width:Math.max(i.width+i.x,n.width),height:Math.max(i.height+i.y,n.height)}:(r=Math.min(1,n.width/i.width,n.height/i.height),o={x:i.x+(e?i.width/2-n.width/r/2:0),y:i.y+(e?i.height/2-n.height/r/2:0),width:n.width/r,height:n.height/r}),this.viewbox(o),this.viewbox(!1).scale},$e.prototype._setZoom=function(e,t){const n=this._svg,i=this._viewport,r=n.createSVGMatrix(),o=n.createSVGPoint();let a,s,c,l,u;c=i.getCTM();const f=c.a;return t?(a=W(o,t),s=a.matrixTransform(c.inverse()),l=r.translate(s.x,s.y).scale(1/f*e).translate(-s.x,-s.y),u=c.multiply(l)):u=r.scale(e),Vm(this._viewport,u),u},$e.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},$e.prototype.getAbsoluteBBox=function(e){const t=this.viewbox();let n;e.waypoints?n=this.getGraphics(e).getBBox():n=e;const i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale,o=n.width*t.scale,a=n.height*t.scale;return{x:i,y:r,width:o,height:a}},$e.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var xo="data-element-id";function Un(e){this._elements={},this._eventBus=e}Un.$inject=["eventBus"],Un.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),Se(t,xo,i),n&&Se(n,xo,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},Un.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(Se(i.gfx,xo,""),i.secondaryGfx&&Se(i.secondaryGfx,xo,""),delete t[n])},Un.prototype.updateId=function(e,t){this._validateId(t),typeof e=="string"&&(e=this.get(e)),this._eventBus.fire("element.updateId",{element:e,newId:t});var n=this.getGraphics(e),i=this.getGraphics(e,!0);this.remove(e),e.id=t,this.add(e,n,i)},Un.prototype.updateGraphics=function(e,t,n){var i=e.id||e,r=this._elements[i];return n?r.secondaryGfx=t:r.gfx=t,t&&Se(t,xo,i),t},Un.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&Se(e,xo);var n=this._elements[t];return n&&n.element},Un.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},Un.prototype.find=function(e){for(var t=this._elements,n=Object.keys(t),i=0;i<n.length;i++){var r=n[i],o=t[r],a=o.element,s=o.gfx;if(e(a,s))return a}},Un.prototype.getAll=function(){return this.filter(function(e){return e})},Un.prototype.forEach=function(e){var t=this._elements;Object.keys(t).forEach(function(n){var i=t[n],r=i.element,o=i.gfx;return e(r,o)})},Un.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},Un.prototype._validateId=function(e){if(!e)throw new Error("element must have an id");if(this._elements[e])throw new Error("element with id "+e+" already added")};function jR(e,t,n,i){var r=n.inverse;return Object.defineProperty(e,"remove",{value:function(o){var a=this.indexOf(o);return a!==-1&&(this.splice(a,1),t.unset(o,r,i)),o}}),Object.defineProperty(e,"contains",{value:function(o){return this.indexOf(o)!==-1}}),Object.defineProperty(e,"add",{value:function(o,a){var s=this.indexOf(o);if(typeof a>"u"){if(s!==-1)return;a=this.length}s!==-1&&this.splice(s,1),this.splice(a,0,o),s===-1&&t.set(o,r,i)}}),Object.defineProperty(e,"__refs_collection",{value:!0}),e}function HR(e){return e.__refs_collection===!0}function zR(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function Wm(e,t,n){var i=jR(n[t.name]||[],e,t,n);Object.defineProperty(n,t.name,{enumerable:t.enumerable,value:i}),i.length&&i.forEach(function(r){e.set(r,t.inverse,n)})}function GR(e,t,n){var i=t.inverse,r=n[t.name];Object.defineProperty(n,t.name,{configurable:t.configurable,enumerable:t.enumerable,get:function(){return r},set:function(o){if(o!==r){var a=r;r=null,a&&e.unset(a,i,n),r=o,e.set(r,i,n)}}})}function Zn(e,t){if(!(this instanceof Zn))return new Zn(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}Zn.prototype.bind=function(e,t){if(typeof t=="string"){if(!this.props[t])throw new Error("no property <"+t+"> in ref");t=this.props[t]}t.collection?Wm(this,t,e):GR(this,t,e)},Zn.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return HR(n)||Wm(this,t,e),n},Zn.prototype.ensureBound=function(e,t){zR(e,t)||this.bind(e,t)},Zn.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},Zn.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var Uu=new Zn({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Um=new Zn({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Ym=new Zn({name:"attachers",collection:!0},{name:"host"}),qm=new Zn({name:"outgoing",collection:!0},{name:"source"}),Km=new Zn({name:"incoming",collection:!0},{name:"target"});function _o(){Object.defineProperty(this,"businessObject",{writable:!0}),Object.defineProperty(this,"label",{get:function(){return this.labels[0]},set:function(e){var t=this.label,n=this.labels;!e&&t?n.remove(t):n.add(e,0)}}),Uu.bind(this,"parent"),Um.bind(this,"labels"),qm.bind(this,"outgoing"),Km.bind(this,"incoming")}function ha(){_o.call(this),Uu.bind(this,"children"),Ym.bind(this,"host"),Ym.bind(this,"attachers")}Ee(ha,_o);function Xm(){_o.call(this),Uu.bind(this,"children")}Ee(Xm,ha);function Zm(){ha.call(this),Um.bind(this,"labelTarget")}Ee(Zm,ha);function Qm(){_o.call(this),qm.bind(this,"source"),Km.bind(this,"target")}Ee(Qm,_o);var VR={connection:Qm,shape:ha,label:Zm,root:Xm};function WR(e,t){var n=VR[e];if(!n)throw new Error("unknown type: <"+e+">");return W(new n,t)}function UR(e){return e instanceof _o}function Ni(){this._uid=12}Ni.prototype.createRoot=function(e){return this.create("root",e)},Ni.prototype.createLabel=function(e){return this.create("label",e)},Ni.prototype.createShape=function(e){return this.create("shape",e)},Ni.prototype.createConnection=function(e){return this.create("connection",e)},Ni.prototype.create=function(e,t){return t=W({},t||{}),t.id||(t.id=e+"_"+this._uid++),WR(e,t)};var Us="__fn",Jm=1e3,YR=Array.prototype.slice;function Dn(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}Dn.prototype.on=function(e,t,n,i){if(e=Be(e)?e:[e],Jt(t)&&(i=n,n=t,t=Jm),!Fe(t))throw new Error("priority must be a number");var r=n;i&&(r=Rn(n,i),r[Us]=n[Us]||n);var o=this;e.forEach(function(a){o._addListener(a,{priority:t,callback:r,next:null})})},Dn.prototype.once=function(e,t,n,i){var r=this;if(Jt(t)&&(i=n,n=t,t=Jm),!Fe(t))throw new Error("priority must be a number");function o(){o.__isTomb=!0;var a=n.apply(i,arguments);return r.off(e,o),a}o[Us]=n,this.on(e,t,o)},Dn.prototype.off=function(e,t){e=Be(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},Dn.prototype.createEvent=function(e){var t=new ma;return t.init(e),t},Dn.prototype.fire=function(e,t){var n,i,r,o;if(o=YR.call(arguments),typeof e=="object"&&(t=e,e=t.type),!e)throw new Error("no event type specified");if(i=this._listeners[e],!!i){t instanceof ma?n=t:n=this.createEvent(t),o[0]=n;var a=n.type;e!==a&&(n.type=e);try{r=this._invokeListeners(n,o,i)}finally{e!==a&&(n.type=a)}return r===void 0&&n.defaultPrevented&&(r=!1),r}},Dn.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},Dn.prototype._destroy=function(){this._listeners={}},Dn.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},Dn.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=qR(n.callback,t),i!==void 0&&(e.returnValue=i,e.stopPropagation()),i===!1&&e.preventDefault()}catch(r){if(!this.handleError(r))throw console.error("unhandled error in event listener",r),r}return i},Dn.prototype._addListener=function(e,t){var n=this._getListeners(e),i;if(!n){this._setListeners(e,t);return}for(;n;){if(n.priority<t.priority){t.next=n,i?i.next=t:this._setListeners(e,t);return}i=n,n=n.next}i.next=t},Dn.prototype._getListeners=function(e){return this._listeners[e]},Dn.prototype._setListeners=function(e,t){this._listeners[e]=t},Dn.prototype._removeListener=function(e,t){var n=this._getListeners(e),i,r,o;if(!t){this._setListeners(e,null);return}for(;n;)i=n.next,o=n.callback,(o===t||o[Us]===t)&&(r?r.next=i:this._setListeners(e,i)),r=n,n=i};function ma(){}ma.prototype.stopPropagation=function(){this.cancelBubble=!0},ma.prototype.preventDefault=function(){this.defaultPrevented=!0},ma.prototype.init=function(e){W(this,e||{})};function qR(e,t){return e.apply(null,t)}function $r(e){return e.childNodes[0]}function KR(e){return e.parentNode.childNodes[1]}function Ys(e,t,n,i,r){var o=sa();o.setTranslate(t,n);var a=sa();a.setRotate(i||0,0,0);var s=sa();s.setScale(1,1),ca(e,[o,a,s])}function ln(e,t,n){var i=sa();i.setTranslate(t,n),ca(e,i)}function eg(e,t){var n=sa();n.setRotate(t,0,0),ca(e,n)}function Yn(e,t){this._eventBus=e,this._elementRegistry=t}Yn.$inject=["eventBus","elementRegistry"],Yn.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=KR(t),n||(n=Oe("g"),et(n).add("djs-children"),ze(t.parentNode,n))):n=t,n},Yn.prototype._clear=function(e){var t=$r(e);return Ls(t),t},Yn.prototype._createContainer=function(e,t,n,i){var r=Oe("g");et(r).add("djs-group"),typeof n<"u"?XR(r,t,t.childNodes[n]):ze(t,r);var o=Oe("g");et(o).add("djs-element"),et(o).add("djs-"+e),i&&et(o).add("djs-frame"),ze(r,o);var a=Oe("g");return et(a).add("djs-visual"),ze(o,a),o},Yn.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,Cm(t))},Yn.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=Tn(e,function(r,o){return o.parent&&(r[o.parent.id]=o.parent),r},{}),F(i,function(r){var o=r.children;if(o){var a=t._getChildrenContainer(r),s=a.firstChild;F(o,function(c){var l=n.getGraphics(c).parentNode;l===s?s=s.nextSibling:a.insertBefore(l,s)})}})},Yn.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},Yn.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},Yn.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},Yn.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},Yn.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),ln(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?Se(n,"display","none"):Se(n,"display","block")}},Yn.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);Kt(t.parentNode)};function XR(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const ZR={__depends__:[uR],__init__:["canvas"],canvas:["type",$e],elementRegistry:["type",Un],elementFactory:["type",Ni],eventBus:["type",Dn],graphicsFactory:["type",Yn]};function QR(e){var t=new Sm(e);return t.init(),t}function JR(e){e=e||{};var t={config:["value",e]},n=[t,ZR].concat(e.modules||[]);return QR(n)}function ar(e,t){this._injector=t||JR(e),this.get("eventBus").fire("diagram.init")}ar.prototype.get=function(e,t){return this._injector.get(e,t)},ar.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},ar.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},ar.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function yn(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function Cn(e,t){return e.$instanceOf(t)}function eC(e){return vt(e.rootElements,function(t){return Cn(t,"bpmn:Process")||Cn(t,"bpmn:Collaboration")})}function tC(e){var t={},n=[],i={};function r(q,V){return function(ne){q(ne,V)}}function o(q){t[q.id]=q}function a(q){return t[q.id]}function s(q,V){var ne=q.gfx;if(ne)throw new Error(`already rendered ${yn(q)}`);return e.element(q,i[q.id],V)}function c(q,V){return e.root(q,i[q.id],V)}function l(q,V){try{var ne=i[q.id]&&s(q,V);return o(q),ne}catch(Te){u(Te.message,{element:q,error:Te}),console.error(`failed to import ${yn(q)}`,Te)}}function u(q,V){e.error(q,V)}var f=this.registerDi=function(V){var ne=V.bpmnElement;ne?i[ne.id]?u(`multiple DI elements defined for ${yn(ne)}`,{element:ne}):i[ne.id]=V:u(`no bpmnElement referenced in ${yn(V)}`,{element:V})};function p(q){d(q.plane)}function d(q){f(q),F(q.planeElement,m)}function m(q){f(q)}this.handleDefinitions=function(V,ne){var Te=V.diagrams;if(ne&&Te.indexOf(ne)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!ne&&Te&&Te.length&&(ne=Te[0]),!ne)throw new Error("no diagram to display");i={},p(ne);var yt=ne.plane;if(!yt)throw new Error(`no plane for ${yn(ne)}`);var T=yt.bpmnElement;if(!T)if(T=eC(V),T)u(`correcting missing bpmnElement on ${yn(yt)} to ${yn(T)}`),yt.bpmnElement=T,f(yt);else throw new Error("no process or collaboration to display");var w=c(T,yt);if(Cn(T,"bpmn:Process")||Cn(T,"bpmn:SubProcess"))y(T,w);else if(Cn(T,"bpmn:Collaboration"))se(T,w),v(V.rootElements,w);else throw new Error(`unsupported bpmnElement for ${yn(yt)}: ${yn(T)}`);h(n)};var h=this.handleDeferred=function(){for(var V;n.length;)V=n.shift(),V()};function y(q,V){it(q,V),B(q.ioSpecification,V),P(q.artifacts,V),o(q)}function v(q,V){var ne=Ke(q,function(Te){return!a(Te)&&Cn(Te,"bpmn:Process")&&Te.laneSets});ne.forEach(r(y,V))}function g(q,V){l(q,V)}function b(q,V){F(q,r(g,V))}function x(q,V){l(q,V)}function C(q,V){l(q,V)}function M(q,V){l(q,V)}function k(q,V){l(q,V)}function P(q,V){F(q,function(ne){Cn(ne,"bpmn:Association")?n.push(function(){k(ne,V)}):k(ne,V)})}function B(q,V){q&&(F(q.dataInputs,r(C,V)),F(q.dataOutputs,r(M,V)))}var D=this.handleSubProcess=function(V,ne){it(V,ne),P(V.artifacts,ne)};function I(q,V){var ne=l(q,V);Cn(q,"bpmn:SubProcess")&&D(q,ne||V),Cn(q,"bpmn:Activity")&&B(q.ioSpecification,V),n.push(function(){F(q.dataInputAssociations,r(x,V)),F(q.dataOutputAssociations,r(x,V))})}function z(q,V){l(q,V)}function oe(q,V){l(q,V)}function ye(q,V){n.push(function(){var ne=l(q,V);q.childLaneSet&&Ve(q.childLaneSet,ne||V),xe(q)})}function Ve(q,V){F(q.lanes,r(ye,V))}function He(q,V){F(q,r(Ve,V))}function it(q,V){K(q.flowElements,V),q.laneSets&&He(q.laneSets,V)}function K(q,V){F(q,function(ne){Cn(ne,"bpmn:SequenceFlow")?n.push(function(){z(ne,V)}):Cn(ne,"bpmn:BoundaryEvent")?n.unshift(function(){I(ne,V)}):Cn(ne,"bpmn:FlowNode")?I(ne,V):Cn(ne,"bpmn:DataObject")||(Cn(ne,"bpmn:DataStoreReference")||Cn(ne,"bpmn:DataObjectReference")?oe(ne,V):u(`unrecognized flowElement ${yn(ne)} in context ${yn(V&&V.businessObject)}`,{element:ne,context:V}))})}function Z(q,V){var ne=l(q,V),Te=q.processRef;Te&&y(Te,ne||V)}function se(q,V){F(q.participants,r(Z,V)),n.push(function(){b(q.messageFlows,V)}),P(q.artifacts,V)}function xe(q){F(q.flowNodeRef,function(V){var ne=V.get("lanes");ne&&ne.push(q)})}}function S(e,t){var n=ie(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function qe(e,t){return Xi(t,function(n){return S(e,n)})}function ie(e){return e&&e.businessObject||e}function ot(e){return e&&e.di}function nC(e,t,n){var i,r,o,a,s=[];function c(l,u){var f={root:function(h,y){return i.add(h,y)},element:function(h,y,v){return i.add(h,y,v)},error:function(h,y){s.push({message:h,context:y})}},p=new tC(f);u=u||l.diagrams&&l.diagrams[0];var d=iC(l,u);if(!d)throw new Error("no diagram to display");F(d,function(h){p.handleDefinitions(l,h)});var m=u.plane.bpmnElement.id;o.setRootElement(o.findRoot(m+"_plane")||o.findRoot(m))}return new Promise(function(l,u){try{return i=e.get("bpmnImporter"),r=e.get("eventBus"),o=e.get("canvas"),r.fire("import.render.start",{definitions:t}),c(t,n),r.fire("import.render.complete",{error:a,warnings:s}),l({warnings:s})}catch(f){return f.warnings=s,u(f)}})}function iC(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!S(n,"bpmn:Process")&&!S(n,"bpmn:Collaboration")&&(i=rC(n));var r;S(i,"bpmn:Collaboration")?r=i:r=vt(e.rootElements,function(l){if(S(l,"bpmn:Collaboration"))return vt(l.participants,function(u){return u.processRef===i})});var o=[i];r&&(o=hn(r.participants,function(l){return l.processRef}),o.push(r));var a=tg(o),s=[t],c=[n];return F(e.diagrams,function(l){if(l.plane){var u=l.plane.bpmnElement;a.indexOf(u)!==-1&&c.indexOf(u)===-1&&(s.push(l),c.push(u))}}),s}}function tg(e){var t=[];return F(e,function(n){n&&(t.push(n),t=t.concat(tg(n.flowElements)))}),t}function rC(e){for(var t=e;t;){if(S(t,"bpmn:Process"))return t;t=t.$parent}}var oC='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.02 5.57" width="53" height="21"><path fill="currentColor" d="M1.88.92v.14c0 .41-.13.68-.4.8.33.14.46.44.46.86v.33c0 .61-.33.95-.95.95H0V0h.95c.65 0 .93.3.93.92zM.63.57v1.06h.24c.24 0 .38-.1.38-.43V.98c0-.28-.1-.4-.32-.4zm0 1.63v1.22h.36c.2 0 .32-.1.32-.39v-.35c0-.37-.12-.48-.4-.48H.63zM4.18.99v.52c0 .64-.31.98-.94.98h-.3V4h-.62V0h.92c.63 0 .94.35.94.99zM2.94.57v1.35h.3c.2 0 .3-.09.3-.37v-.6c0-.29-.1-.38-.3-.38h-.3zm2.89 2.27L6.25 0h.88v4h-.6V1.12L6.1 3.99h-.6l-.46-2.82v2.82h-.55V0h.87zM8.14 1.1V4h-.56V0h.79L9 2.4V0h.56v4h-.64zm2.49 2.29v.6h-.6v-.6zM12.12 1c0-.63.33-1 .95-1 .61 0 .95.37.95 1v2.04c0 .64-.34 1-.95 1-.62 0-.95-.37-.95-1zm.62 2.08c0 .28.13.39.33.39s.32-.1.32-.4V.98c0-.29-.12-.4-.32-.4s-.33.11-.33.4z"/><path fill="currentColor" d="M0 4.53h14.02v1.04H0zM11.08 0h.63v.62h-.63zm.63 4V1h-.63v2.98z"/></svg>',ng=oC,ig={verticalAlign:"middle"},rg={color:"#404040"},aC={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},sC={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},cC={position:"absolute",left:"50%",top:"40%",transform:"translate(-50%)",width:"260px",padding:"10px",background:"white",boxShadow:"0 1px 4px rgba(0,0,0,0.3)",fontFamily:"Helvetica, Arial, sans-serif",fontSize:"14px",display:"flex",lineHeight:"1.3"},lC='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+ng+'</a><span>Web-based tooling for BPMN, DMN and forms powered by <a href="https://bpmn.io" target="_blank" rel="noopener">bpmn.io</a>.</span></div></div>',_i;function uC(){_i=wt(lC),wn(_i,aC),wn(ft("svg",_i),ig),wn(ft(".backdrop",_i),sC),wn(ft(".notice",_i),cC),wn(ft(".link",_i),rg,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function pC(){_i||(uC(),On.bind(_i,".backdrop","click",function(e){document.body.removeChild(_i)})),document.body.appendChild(_i)}const qs=5,og="djs-outline-hidden";function Pt(e){e=W({},dC,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),mC(this._container)}Ee(Pt,ar),Pt.prototype.importXML=async function(t,n){const i=this;function r(a){return i.get("eventBus").createEvent(a)}let o=[];try{t=this._emit("import.parse.start",{xml:t})||t;let a;try{a=await this._moddle.fromXML(t,"bpmn:Definitions")}catch(p){throw this._emit("import.parse.complete",{error:p}),p}let s=a.rootElement;const c=a.references,l=a.warnings,u=a.elementsById;o=o.concat(l),s=this._emit("import.parse.complete",r({error:null,definitions:s,elementsById:u,references:c,warnings:o}))||s;const f=await this.importDefinitions(s,n);return o=o.concat(f.warnings),this._emit("import.done",{error:null,warnings:o}),{warnings:o}}catch(a){let s=a;throw o=o.concat(s.warnings||[]),Ks(s,o),s=fC(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},Pt.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},Pt.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const o=new Error("no XML imported");throw Ks(o,[]),o}if(typeof t=="string"&&(i=hC(n,t),!i)){const o=new Error("BPMNDiagram <"+t+"> not found");throw Ks(o,[]),o}try{this.clear()}catch(o){throw Ks(o,[]),o}const{warnings:r}=await nC(this,n,i);return{warnings:r}},Pt.prototype.saveXML=async function(t){t=t||{};let n=this._definitions,i,r;try{if(!n)throw new Error("no definitions loaded");n=this._emit("saveXML.start",{definitions:n})||n,r=(await this._moddle.toXML(n,t)).xml,r=this._emit("saveXML.serialized",{xml:r})||r}catch(a){i=a}const o=i?{error:i}:{xml:r};if(this._emit("saveXML.done",o),i)throw i;return o},Pt.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),r=i.getActiveLayer(),o=ft(":scope > defs",i._svg),a=Em(r),s=o?"<defs>"+Em(o)+"</defs>":"",c=i.getContainer();Ct(c).add(og);let l;try{l=r.getBBox()}finally{Ct(c).remove(og)}const u=l.x-qs,f=l.y-qs,p=l.width+qs*2,d=l.height+qs*2;t=`<?xml version="1.0" encoding="utf-8"?>
|
|
8
8
|
<!-- created with bpmn-js / http://bpmn.io -->
|
|
9
9
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
|
10
|
-
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="`+p+'" height="'+d+'" viewBox="'+u+" "+f+" "+p+" "+d+'" version="1.1">'+s+a+"</svg>"}catch(i){n=i}if(this._emit("saveSVG.done",{error:n,svg:t}),n)throw n;return{svg:t}},Pt.prototype._setDefinitions=function(e){this._definitions=e},Pt.prototype.getModules=function(){return this._modules},Pt.prototype.clear=function(){this.getDefinitions()&&ar.prototype.clear.call(this)},Pt.prototype.destroy=function(){ar.prototype.destroy.call(this),vi(this._container)},Pt.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},Pt.prototype.off=function(e,t){this.get("eventBus").off(e,t)},Pt.prototype.attachTo=function(e){if(!e)throw new Error("parentNode required");this.detach(),e.get&&e.constructor.prototype.jquery&&(e=e.get(0)),typeof e=="string"&&(e=ft(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},Pt.prototype.getDefinitions=function(){return this._definitions},Pt.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},Pt.prototype._init=function(e,t,n){const i=n.modules||this.getModules(n),r=n.additionalModules||[],o=[{bpmnjs:["value",this],moddle:["value",t]}],a=[].concat(o,i,r),s=W(hi(n,["additionalModules"]),{canvas:W({},n.canvas,{container:e}),modules:a});ar.call(this,s),n&&n.container&&this.attachTo(n.container)},Pt.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},Pt.prototype._createContainer=function(e){const t=wt('<div class="bjs-container"></div>');return wn(t,{width:ag(e.width),height:ag(e.height),position:e.position}),t},Pt.prototype._createModdle=function(e){const t=W({},this._moddleExtensions,e.moddleExtensions);return new eh(t)},Pt.prototype._modules=[];function Ks(e,t){return e.warnings=t,e}function pC(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 fC={width:"100%",height:"100%",position:"relative"};function ag(e){return e+(Fe(e)?"px":"")}function dC(e,t){return t&&vt(e.diagrams,function(n){return n.id===t})||null}function hC(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+ng+"</a>",i=wt(n);wn(ft("svg",i),ig),wn(i,rg,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),je.bind(i,"click",function(r){uC(),r.preventDefault()})}function wo(e){Pt.call(this,e),this.on("import.parse.complete",function(t){t.error||this._collectIds(t.definitions,t.elementsById)},this),this.on("diagram.destroy",function(){this.get("moddle").ids.clear()},this)}Ee(wo,Pt),wo.prototype._createModdle=function(e){var t=Pt.prototype._createModdle.call(this,e);return t.ids=new yi([32,36,1]),t},wo.prototype._collectIds=function(e,t){var n=e.$model,i=n.ids,r;i.clear();for(r in t)i.claim(r,t[r])};function Qe(e,t){return S(e,"bpmn:CallActivity")?!1:S(e,"bpmn:SubProcess")?(t=t||ot(e),t&&S(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):S(e,"bpmn:Participant")?!!ie(e).processRef:!0}function tn(e){if(!(!S(e,"bpmn:Participant")&&!S(e,"bpmn:Lane"))){var t=ot(e).isHorizontal;return t===void 0?!0:t}}function mC(e){return e&&ie(e).isInterrupting!==!1}function vn(e){return e&&!!ie(e).triggeredByEvent}function Eo(e,t){var n=ie(e).eventDefinitions;return Xi(n,function(i){return S(i,t)})}function gC(e){return Eo(e,"bpmn:ErrorEventDefinition")}function yC(e){return Eo(e,"bpmn:EscalationEventDefinition")}function vC(e){return Eo(e,"bpmn:CompensateEventDefinition")}var Fr={width:90,height:20},sg=15;function sr(e){return S(e,"bpmn:Event")||S(e,"bpmn:Gateway")||S(e,"bpmn:DataStoreReference")||S(e,"bpmn:DataObjectReference")||S(e,"bpmn:DataInput")||S(e,"bpmn:DataOutput")||S(e,"bpmn:SequenceFlow")||S(e,"bpmn:MessageFlow")||S(e,"bpmn:Group")}function Xs(e){return Ye(e.label)}function bC(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=xC(e),o=Math.atan((i.y-n.y)/(i.x-n.x)),a=r.x,s=r.y;return Math.abs(o)<Math.PI/2?s-=sg:a+=sg,{x:a,y:s}}function xC(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)];return{x:n.x+(i.x-n.x)/2,y:n.y+(i.y-n.y)/2}}function Yu(e){return e.waypoints?bC(e.waypoints):S(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+Fr.height/2}:{x:e.x+e.width/2,y:e.y+e.height+Fr.height/2}}function _C(e,t){var n,i,r,o=e.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(Fr.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=Yu(t),i=Fr),W({x:n.x-i.width/2,y:n.y-i.height/2},i)}function cg(e){if(S(e,"bpmn:FlowElement")||S(e,"bpmn:Participant")||S(e,"bpmn:Lane")||S(e,"bpmn:SequenceFlow")||S(e,"bpmn:MessageFlow")||S(e,"bpmn:DataInput")||S(e,"bpmn:DataOutput"))return"name";if(S(e,"bpmn:TextAnnotation"))return"text";if(S(e,"bpmn:Group"))return"categoryValueRef"}function wC(e){var t=e.categoryValueRef;return t&&t.value||""}function qn(e){var t=e.businessObject,n=cg(t);if(n)return n==="categoryValueRef"?wC(t):t[n]||""}function EC(e,t){var n=e.businessObject,i=cg(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function SC(e){return Ye(e)&&sr(e.labelTarget)}var So=7;function lg(e){let t=[];return F(e.incoming,n=>{S(n,"bpmn:Association")&&S(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),F(e.outgoing,n=>{S(n,"bpmn:Association")&&S(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function ga(e){const t=new Map;return F(ju(e),n=>{F(lg(n),i=>{t.has(i.annotation)||t.set(i.annotation,{annotation:i.annotation,associations:[]}),t.get(i.annotation).associations.push(i.association)})}),[...t.values()]}var qu="hsl(225, 10%, 15%)",RC="white";function wi(e,t){return Xi(e.eventDefinitions,function(n){return n.$type===t})}function CC(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function AC(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function Ze(e,t,n){var i=ot(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||RC}function be(e,t,n){var i=ot(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||qu}function ya(e,t,n,i){var r=ot(e),o=r.get("label");return i||o&&o.get("color:color")||t||be(e,n)}function ug(e){var t=e.x+e.width/2,n=e.y+e.height/2,i=e.width/2,r=[["M",t,n],["m",0,-i],["a",i,i,0,1,1,0,2*i],["a",i,i,0,1,1,0,-2*i],["z"]];return Br(r)}function Ku(e,t){var n=e.x,i=e.y,r=e.width,o=e.height,a=[["M",n+t,i],["l",r-t*2,0],["a",t,t,0,0,1,t,t],["l",0,o-t*2],["a",t,t,0,0,1,-t,t],["l",t*2-r,0],["a",t,t,0,0,1,-t,-t],["l",0,t*2-o],["a",t,t,0,0,1,t,-t],["z"]];return Br(a)}function PC(e){var t=e.width,n=e.height,i=e.x,r=e.y,o=t/2,a=n/2,s=[["M",i+o,r],["l",o,a],["l",-o,a],["l",-o,-a],["z"]];return Br(s)}function MC(e){var t=e.x,n=e.y,i=e.width,r=e.height,o=[["M",t,n],["l",i,0],["l",0,r],["l",-i,0],["z"]];return Br(o)}function va(e,t={}){return{width:Qn(e,t),height:In(e,t)}}function Qn(e,t={}){return Mn(t,"width")?t.width:e.width}function In(e,t={}){return Mn(t,"height")?t.height:e.height}var TC=new yi,kC=10,Zs=3,OC=1.5,Qs=10,DC=4,Ro=.95,IC=1,LC=.25;function jr(e,t,n,i,r,o,a){Ii.call(this,t,a);var s=e&&e.defaultFillColor,c=e&&e.defaultStrokeColor,l=e&&e.defaultLabelColor;function u(T){return n.computeStyle(T,{strokeLinecap:"round",strokeLinejoin:"round",stroke:qu,strokeWidth:2,fill:"white"})}function f(T){return n.computeStyle(T,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:qu,strokeWidth:2})}function p(T,w){var{ref:E={x:0,y:0},scale:G=1,element:U,parentGfx:X=r._svg}=w,Ce=Oe("marker",{id:T,viewBox:"0 0 20 20",refX:E.x,refY:E.y,markerWidth:20*G,markerHeight:20*G,orient:"auto"});ze(Ce,U);var Ue=ft(":scope > defs",X);Ue||(Ue=Oe("defs"),ze(X,Ue)),ze(Ue,Ce)}function d(T,w,E,G){var U=TC.nextPrefixed("marker-");return m(T,U,w,E,G),"url(#"+U+")"}function m(T,w,E,G,U){if(E==="sequenceflow-end"){var X=Oe("path",{d:"M 1 5 L 11 10 L 1 15 Z",...u({fill:U,stroke:U,strokeWidth:1})});p(w,{element:X,ref:{x:11,y:10},scale:.5,parentGfx:T})}if(E==="messageflow-start"){var Ce=Oe("circle",{cx:6,cy:6,r:3.5,...u({fill:G,stroke:U,strokeWidth:1,strokeDasharray:[1e4,1]})});p(w,{element:Ce,ref:{x:6,y:6},parentGfx:T})}if(E==="messageflow-end"){var Ue=Oe("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...u({fill:G,stroke:U,strokeWidth:1,strokeDasharray:[1e4,1]})});p(w,{element:Ue,ref:{x:8.5,y:5},parentGfx:T})}if(E==="association-start"){var st=Oe("path",{d:"M 11 5 L 1 10 L 11 15",...f({fill:"none",stroke:U,strokeWidth:1.5,strokeDasharray:[1e4,1]})});p(w,{element:st,ref:{x:1,y:10},scale:.5,parentGfx:T})}if(E==="association-end"){var Ot=Oe("path",{d:"M 1 5 L 11 10 L 1 15",...f({fill:"none",stroke:U,strokeWidth:1.5,strokeDasharray:[1e4,1]})});p(w,{element:Ot,ref:{x:11,y:10},scale:.5,parentGfx:T})}if(E==="conditional-flow-marker"){var pt=Oe("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...u({fill:G,stroke:U})});p(w,{element:pt,ref:{x:-1,y:10},scale:.5,parentGfx:T})}if(E==="conditional-default-flow-marker"){var Wt=Oe("path",{d:"M 6 4 L 10 16",...u({stroke:U,fill:"none"})});p(w,{element:Wt,ref:{x:0,y:10},scale:.5,parentGfx:T})}}function h(T,w,E,G,U={}){Qt(G)&&(U=G,G=0),G=G||0,U=u(U);var X=w/2,Ce=E/2,Ue=Oe("circle",{cx:X,cy:Ce,r:Math.round((w+E)/4-G),...U});return ze(T,Ue),Ue}function y(T,w,E,G,U,X){Qt(U)&&(X=U,U=0),U=U||0,X=u(X);var Ce=Oe("rect",{x:U,y:U,width:w-U*2,height:E-U*2,rx:G,ry:G,...X});return ze(T,Ce),Ce}function v(T,w,E,G){var U=w/2,X=E/2,Ce=[{x:U,y:0},{x:w,y:X},{x:U,y:E},{x:0,y:X}],Ue=Ce.map(function(Ot){return Ot.x+","+Ot.y}).join(" ");G=u(G);var st=Oe("polygon",{...G,points:Ue});return ze(T,st),st}function g(T,w,E,G){E=f(E);var U=la(w,E,G);return ze(T,U),U}function b(T,w,E){return g(T,w,E,5)}function x(T,w,E){E=f(E);var G=Oe("path",{...E,d:w});return ze(T,G),G}function C(T,w,E,G){return x(w,E,W({"data-marker":T},G))}function M(T){return yt[T]}function k(T){return function(w,E,G){return M(T)(w,E,G)}}var P={"bpmn:MessageEventDefinition":function(T,w,E={},G){var U=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:E.width||w.width,containerHeight:E.height||w.height,position:{mx:.235,my:.315}}),X=G?be(w,c,E.stroke):Ze(w,s,E.fill),Ce=G?Ze(w,s,E.fill):be(w,c,E.stroke),Ue=x(T,U,{fill:X,stroke:Ce,strokeWidth:1});return Ue},"bpmn:TimerEventDefinition":function(T,w,E={}){var G=E.width||w.width,U=E.height||w.height,X=E.width?1:2,Ce=h(T,G,U,.2*U,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:X}),Ue=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:G,containerHeight:U,position:{mx:.5,my:.5}});x(T,Ue,{stroke:be(w,c,E.stroke),strokeWidth:X});for(var st=0;st<12;st++){var Ot=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:G,containerHeight:U,position:{mx:.5,my:.5}}),pt=G/2,Wt=U/2;x(T,Ot,{strokeWidth:1,stroke:be(w,c,E.stroke),transform:"rotate("+st*30+","+Wt+","+pt+")"})}return Ce},"bpmn:EscalationEventDefinition":function(T,w,E={},G){var U=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width||w.width,containerHeight:E.height||w.height,position:{mx:.5,my:.2}}),X=G?be(w,c,E.stroke):Ze(w,s,E.fill);return x(T,U,{fill:X,stroke:be(w,c,E.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(T,w,E={}){var G=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width||w.width,containerHeight:E.height||w.height,position:{mx:.5,my:.222}});return x(T,G,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(T,w,E={},G){var U=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width,containerHeight:w.height,position:{mx:.57,my:.263}}),X=G?be(w,c,E.stroke):Ze(w,s,E.fill);return x(T,U,{fill:X,stroke:be(w,c,E.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(T,w,E={},G){var U=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:E.width||w.width,containerHeight:E.height||w.height,position:{mx:.2,my:.722}}),X=G?be(w,c,E.stroke):Ze(w,s,E.fill);return x(T,U,{fill:X,stroke:be(w,c,E.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(T,w,E={},G){var U=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width,containerHeight:w.height,position:{mx:.638,my:-.055}}),X=G?be(w,c,E.stroke):"none",Ce=x(T,U,{fill:X,stroke:be(w,c,E.stroke),strokeWidth:1});return eg(Ce,45),Ce},"bpmn:CompensateEventDefinition":function(T,w,E={},G){var U=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width||w.width,containerHeight:E.height||w.height,position:{mx:.22,my:.5}}),X=G?be(w,c,E.stroke):Ze(w,s,E.fill);return x(T,U,{fill:X,stroke:be(w,c,E.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(T,w,E={},G){var U=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:E.width||w.width,containerHeight:E.height||w.height,position:{mx:.5,my:.2}}),X=G?be(w,c,E.stroke):Ze(w,s,E.fill);return x(T,U,{strokeWidth:1,fill:X,stroke:be(w,c,E.stroke)})},"bpmn:MultipleEventDefinition":function(T,w,E={},G){var U=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:E.width||w.width,containerHeight:E.height||w.height,position:{mx:.211,my:.36}}),X=G?be(w,c,E.stroke):Ze(w,s,E.fill);return x(T,U,{fill:X,stroke:be(w,c,E.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(T,w,E={}){var G=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:E.width||w.width,containerHeight:E.height||w.height,position:{mx:.458,my:.194}});return x(T,G,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(T,w,E={}){var G=h(T,w.width,w.height,8,{fill:be(w,c,E.stroke),stroke:be(w,c,E.stroke),strokeWidth:4});return G}};function B(T,w,E={},G){var U=ie(T),X=CC(U),Ce=G||T;return U.get("eventDefinitions")&&U.get("eventDefinitions").length>1?U.get("parallelMultiple")?P["bpmn:ParallelMultipleEventDefinition"](w,Ce,E,X):P["bpmn:MultipleEventDefinition"](w,Ce,E,X):wi(U,"bpmn:MessageEventDefinition")?P["bpmn:MessageEventDefinition"](w,Ce,E,X):wi(U,"bpmn:TimerEventDefinition")?P["bpmn:TimerEventDefinition"](w,Ce,E,X):wi(U,"bpmn:ConditionalEventDefinition")?P["bpmn:ConditionalEventDefinition"](w,Ce,E,X):wi(U,"bpmn:SignalEventDefinition")?P["bpmn:SignalEventDefinition"](w,Ce,E,X):wi(U,"bpmn:EscalationEventDefinition")?P["bpmn:EscalationEventDefinition"](w,Ce,E,X):wi(U,"bpmn:LinkEventDefinition")?P["bpmn:LinkEventDefinition"](w,Ce,E,X):wi(U,"bpmn:ErrorEventDefinition")?P["bpmn:ErrorEventDefinition"](w,Ce,E,X):wi(U,"bpmn:CancelEventDefinition")?P["bpmn:CancelEventDefinition"](w,Ce,E,X):wi(U,"bpmn:CompensateEventDefinition")?P["bpmn:CompensateEventDefinition"](w,Ce,E,X):wi(U,"bpmn:TerminateEventDefinition")?P["bpmn:TerminateEventDefinition"](w,Ce,E,X):null}var D={ParticipantMultiplicityMarker:function(T,w,E={}){var G=Qn(w,E),U=In(w,E),X=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:U,position:{mx:(G/2-6)/G,my:(U-15)/U}});C("participant-multiplicity",T,X,{strokeWidth:2,fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke)})},SubProcessMarker:function(T,w,E={}){var G=y(T,14,14,0,{strokeWidth:1,fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke)});ln(G,w.width/2-7.5,w.height-20);var U=i.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:w.width,containerHeight:w.height,position:{mx:(w.width/2-7.5)/w.width,my:(w.height-20)/w.height}});C("sub-process",T,U,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke)})},ParallelMarker:function(T,w,E){var G=Qn(w,E),U=In(w,E),X=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:U,position:{mx:(G/2+E.parallel)/G,my:(U-20)/U}});C("parallel",T,X,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke)})},SequentialMarker:function(T,w,E){var G=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width,containerHeight:w.height,position:{mx:(w.width/2+E.seq)/w.width,my:(w.height-19)/w.height}});C("sequential",T,G,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke)})},CompensationMarker:function(T,w,E){var G=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width,containerHeight:w.height,position:{mx:(w.width/2+E.compensation)/w.width,my:(w.height-13)/w.height}});C("compensation",T,G,{strokeWidth:1,fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke)})},LoopMarker:function(T,w,E){var G=Qn(w,E),U=In(w,E),X=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:U,position:{mx:(G/2+E.loop)/G,my:(U-7)/U}});C("loop",T,X,{strokeWidth:1.5,fill:"none",stroke:be(w,c,E.stroke),strokeMiterlimit:.5})},AdhocMarker:function(T,w,E){var G=Qn(w,E),U=In(w,E),X=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:U,position:{mx:(G/2+E.adhoc)/G,my:(U-15)/U}});C("adhoc",T,X,{strokeWidth:1,fill:be(w,c,E.stroke),stroke:be(w,c,E.stroke)})}};function I(T,w,E,G){D[T](w,E,G)}function z(T,w,E=[],G={}){G={fill:G.fill,stroke:G.stroke,width:Qn(w,G),height:In(w,G)};var U=ie(w),X=E.includes("SubProcessMarker");X?G={...G,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:G={...G,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},U.get("isForCompensation")&&E.push("CompensationMarker"),S(U,"bpmn:AdHocSubProcess")&&(E.push("AdhocMarker"),X||W(G,{compensation:G.compensation-18}));var Ce=U.get("loopCharacteristics"),Ue=Ce&&Ce.get("isSequential");Ce&&(W(G,{compensation:G.compensation-18}),E.includes("AdhocMarker")&&W(G,{seq:-23,loop:-18,parallel:-24}),Ue===void 0&&E.push("LoopMarker"),Ue===!1&&E.push("ParallelMarker"),Ue===!0&&E.push("SequentialMarker")),E.includes("CompensationMarker")&&E.length===1&&W(G,{compensation:-8}),F(E,function(st){I(st,T,w,G)})}function oe(T,w,E={}){E=W({size:{width:100}},E);var G=o.createText(w||"",E);return et(G).add("djs-label"),ze(T,G),G}function ye(T,w,E,G={}){var U=ie(w),X=va({x:w.x,y:w.y,width:w.width,height:w.height},G);return oe(T,U.name,{align:E,box:X,padding:7,style:{fill:ya(w,l,c,G.stroke)}})}function Ve(T,w,E={}){var G={width:w.width,height:w.height,x:w.width/2+w.x,y:w.height/2+w.y};return oe(T,qn(w),{box:G,style:W({},o.getExternalStyle(),{fill:ya(w,l,c,E.stroke)})})}function He(T,w,E,G={}){var U=tn(E),X=oe(T,w,{box:{height:30,width:U?In(E,G):Qn(E,G)},align:"center-middle",style:{fill:ya(E,l,c,G.stroke)}});if(U){var Ce=-1*In(E,G);Ys(X,0,-Ce,270)}}function it(T,w,E={}){var{width:G,height:U}=va(w,E);return y(T,G,U,Qs,{...E,fill:Ze(w,s,E.fill),fillOpacity:Ro,stroke:be(w,c,E.stroke)})}function K(T,w,E={}){var G=ie(w),U=Ze(w,s,E.fill),X=be(w,c,E.stroke);return(G.get("associationDirection")==="One"||G.get("associationDirection")==="Both")&&(E.markerEnd=d(T,"association-end",U,X)),G.get("associationDirection")==="Both"&&(E.markerStart=d(T,"association-start",U,X)),E=at(E,["markerStart","markerEnd"]),b(T,w.waypoints,{...E,stroke:X,strokeDasharray:"0, 5"})}function Z(T,w,E={}){var G=Ze(w,s,E.fill),U=be(w,c,E.stroke),X=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width,containerHeight:w.height,position:{mx:.474,my:.296}}),Ce=x(T,X,{fill:G,fillOpacity:Ro,stroke:U}),Ue=ie(w);if(AC(Ue)){var st=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width,containerHeight:w.height,position:{mx:.33,my:(w.height-18)/w.height}});x(T,st,{strokeWidth:2,fill:G,stroke:U})}return Ce}function se(T,w,E={}){return h(T,w.width,w.height,{fillOpacity:Ro,...E,fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke)})}function xe(T,w,E={}){return v(T,w.width,w.height,{fill:Ze(w,s,E.fill),fillOpacity:Ro,stroke:be(w,c,E.stroke)})}function q(T,w,E={}){var G=y(T,Qn(w,E),In(w,E),0,{fill:Ze(w,s,E.fill),fillOpacity:E.fillOpacity||Ro,stroke:be(w,c,E.stroke),strokeWidth:1.5}),U=ie(w);if(S(U,"bpmn:Lane")){var X=U.get("name");He(T,X,w,E)}return G}function V(T,w,E={}){var G=it(T,w,E),U=Qe(w);if(vn(w)&&(Se(G,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!U)){var X=ie(w).flowElements||[],Ce=X.filter(Ue=>S(Ue,"bpmn:StartEvent"));Ce.length===1&&ne(Ce[0],T,E,w)}return ye(T,w,U?"center-top":"center-middle",E),U?z(T,w,void 0,E):z(T,w,["SubProcessMarker"],E),G}function ne(T,w,E,G){var U=22,X={fill:Ze(G,s,E.fill),stroke:be(G,c,E.stroke),width:U,height:U},Ce=ie(T).isInterrupting,Ue=Ce?0:3,st=Ce?1:1.2,Ot=20,pt=(U-Ot)/2,Wt="translate("+pt+","+pt+")";h(w,Ot,Ot,{fill:X.fill,stroke:X.stroke,strokeWidth:st,strokeDasharray:Ue,transform:Wt}),B(T,w,X,G)}function Te(T,w,E={}){var G=it(T,w,E);return ye(T,w,"center-middle",E),z(T,w,void 0,E),G}var yt=this.handlers={"bpmn:AdHocSubProcess":function(T,w,E={}){return Qe(w)?E=at(E,["fill","stroke","width","height"]):E=at(E,["fill","stroke"]),V(T,w,E)},"bpmn:Association":function(T,w,E={}){return E=at(E,["fill","stroke"]),K(T,w,E)},"bpmn:BoundaryEvent":function(T,w,E={}){var{renderIcon:G=!0}=E;E=at(E,["fill","stroke"]);var U=ie(w),X=U.get("cancelActivity");E={strokeWidth:1.5,fill:Ze(w,s,E.fill),fillOpacity:IC,stroke:be(w,c,E.stroke)},X||(E.strokeDasharray="6");var Ce=se(T,w,E);return h(T,w.width,w.height,Zs,{...E,fill:"none"}),G&&B(w,T,E),Ce},"bpmn:BusinessRuleTask":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=Te(T,w,E),U=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),X=x(T,U);Se(X,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:1});var Ce=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),Ue=x(T,Ce);return Se(Ue,{fill:be(w,c,E.stroke),stroke:be(w,c,E.stroke),strokeWidth:1}),G},"bpmn:CallActivity":function(T,w,E={}){return E=at(E,["fill","stroke"]),V(T,w,{strokeWidth:5,...E})},"bpmn:ComplexGateway":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=xe(T,w,E),U=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:w.width,containerHeight:w.height,position:{mx:.46,my:.26}});return x(T,U,{fill:be(w,c,E.stroke),stroke:be(w,c,E.stroke),strokeWidth:1}),G},"bpmn:DataInput":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=i.getRawPath("DATA_ARROW"),U=Z(T,w,E);return x(T,G,{fill:"none",stroke:be(w,c,E.stroke),strokeWidth:1}),U},"bpmn:DataInputAssociation":function(T,w,E={}){return E=at(E,["fill","stroke"]),K(T,w,{...E,markerEnd:d(T,"association-end",Ze(w,s,E.fill),be(w,c,E.stroke))})},"bpmn:DataObject":function(T,w,E={}){return E=at(E,["fill","stroke"]),Z(T,w,E)},"bpmn:DataObjectReference":k("bpmn:DataObject"),"bpmn:DataOutput":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=i.getRawPath("DATA_ARROW"),U=Z(T,w,E);return x(T,G,{strokeWidth:1,fill:be(w,c,E.stroke),stroke:be(w,c,E.stroke)}),U},"bpmn:DataOutputAssociation":function(T,w,E={}){return E=at(E,["fill","stroke"]),K(T,w,{...E,markerEnd:d(T,"association-end",Ze(w,s,E.fill),be(w,c,E.stroke))})},"bpmn:DataStoreReference":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width,containerHeight:w.height,position:{mx:0,my:.133}});return x(T,G,{fill:Ze(w,s,E.fill),fillOpacity:Ro,stroke:be(w,c,E.stroke),strokeWidth:2})},"bpmn:EndEvent":function(T,w,E={}){var{renderIcon:G=!0}=E;E=at(E,["fill","stroke"]);var U=se(T,w,{...E,strokeWidth:4});return G&&B(w,T,E),U},"bpmn:EventBasedGateway":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=ie(w),U=xe(T,w,E);h(T,w.width,w.height,w.height*.2,{fill:Ze(w,"none",E.fill),stroke:be(w,c,E.stroke),strokeWidth:1});var X=G.get("eventGatewayType"),Ce=!!G.get("instantiate");function Ue(){var Ot=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:w.width,containerHeight:w.height,position:{mx:.36,my:.44}});x(T,Ot,{fill:"none",stroke:be(w,c,E.stroke),strokeWidth:2})}if(X==="Parallel"){var st=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:w.width,containerHeight:w.height,position:{mx:.474,my:.296}});x(T,st,{fill:"none",stroke:be(w,c,E.stroke),strokeWidth:1})}else X==="Exclusive"&&(Ce||h(T,w.width,w.height,w.height*.26,{fill:"none",stroke:be(w,c,E.stroke),strokeWidth:1}),Ue());return U},"bpmn:ExclusiveGateway":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=xe(T,w,E),U=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:w.width,containerHeight:w.height,position:{mx:.32,my:.3}}),X=ot(w);return X.get("isMarkerVisible")&&x(T,U,{fill:be(w,c,E.stroke),stroke:be(w,c,E.stroke),strokeWidth:1}),G},"bpmn:Gateway":function(T,w,E={}){return E=at(E,["fill","stroke"]),xe(T,w,E)},"bpmn:Group":function(T,w,E={}){return E=at(E,["fill","stroke","width","height"]),y(T,w.width,w.height,Qs,{stroke:be(w,c,E.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:Qn(w,E),height:In(w,E)})},"bpmn:InclusiveGateway":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=xe(T,w,E);return h(T,w.width,w.height,w.height*.24,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:2.5}),G},"bpmn:IntermediateEvent":function(T,w,E={}){var{renderIcon:G=!0}=E;E=at(E,["fill","stroke"]);var U=se(T,w,{...E,strokeWidth:1.5});return h(T,w.width,w.height,Zs,{fill:"none",stroke:be(w,c,E.stroke),strokeWidth:1.5}),G&&B(w,T,E),U},"bpmn:IntermediateCatchEvent":k("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":k("bpmn:IntermediateEvent"),"bpmn:Lane":function(T,w,E={}){return E=at(E,["fill","stroke","width","height"]),q(T,w,{...E,fillOpacity:LC})},"bpmn:ManualTask":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=Te(T,w,E),U=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return x(T,U,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:.5}),G},"bpmn:MessageFlow":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=ie(w),U=ot(w),X=Ze(w,s,E.fill),Ce=be(w,c,E.stroke),Ue=b(T,w.waypoints,{markerEnd:d(T,"messageflow-end",X,Ce),markerStart:d(T,"messageflow-start",X,Ce),stroke:Ce,strokeDasharray:"10, 11",strokeWidth:1.5});if(G.get("messageRef")){var st=Ue.getPointAtLength(Ue.getTotalLength()/2),Ot=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:st.x,y:st.y}}),pt={strokeWidth:1};U.get("messageVisibleKind")==="initiating"?(pt.fill=X,pt.stroke=Ce):(pt.fill=Ce,pt.stroke=X);var Wt=x(T,Ot,pt),nn=G.get("messageRef"),rn=nn.get("name"),xt=oe(T,rn,{align:"center-top",fitBox:!0,style:{fill:Ce}}),Dt=Wt.getBBox(),bn=xt.getBBox(),Pr=st.x-bn.width/2,jn=st.y+Dt.height/2+kC;Ys(xt,Pr,jn,0)}return Ue},"bpmn:ParallelGateway":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=xe(T,w,E),U=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:w.width,containerHeight:w.height,position:{mx:.46,my:.2}});return x(T,U,{fill:be(w,c,E.stroke),stroke:be(w,c,E.stroke),strokeWidth:1}),G},"bpmn:Participant":function(T,w,E={}){E=at(E,["fill","stroke","width","height"]);var G=q(T,w,E),U=Qe(w),X=tn(w),Ce=ie(w),Ue=Ce.get("name");if(U){var st=X?[{x:30,y:0},{x:30,y:In(w,E)}]:[{x:0,y:30},{x:Qn(w,E),y:30}];g(T,st,{stroke:be(w,c,E.stroke),strokeWidth:OC}),He(T,Ue,w,E)}else{var Ot=va(w,E);X||(Ot.height=Qn(w,E),Ot.width=In(w,E));var pt=oe(T,Ue,{box:Ot,align:"center-middle",style:{fill:ya(w,l,c,E.stroke)}});if(!X){var Wt=-1*In(w,E);Ys(pt,0,-Wt,270)}}return Ce.get("participantMultiplicity")&&I("ParticipantMultiplicityMarker",T,w,E),G},"bpmn:ReceiveTask":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=ie(w),U=Te(T,w,E),X;return G.get("instantiate")?(h(T,28,28,20*.22,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:1}),X=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):X=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),x(T,X,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:1}),U},"bpmn:ScriptTask":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=Te(T,w,E),U=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return x(T,U,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:1}),G},"bpmn:SendTask":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=Te(T,w,E),U=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return x(T,U,{fill:be(w,c,E.stroke),stroke:Ze(w,s,E.fill),strokeWidth:1}),G},"bpmn:SequenceFlow":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=Ze(w,s,E.fill),U=be(w,c,E.stroke),X=b(T,w.waypoints,{markerEnd:d(T,"sequenceflow-end",G,U),stroke:U}),Ce=ie(w),{source:Ue}=w;if(Ue){var st=ie(Ue);Ce.get("conditionExpression")&&S(st,"bpmn:Activity")&&Se(X,{markerStart:d(T,"conditional-flow-marker",G,U)}),st.get("default")&&(S(st,"bpmn:Gateway")||S(st,"bpmn:Activity"))&&st.get("default")===Ce&&Se(X,{markerStart:d(T,"conditional-default-flow-marker",G,U)})}return X},"bpmn:ServiceTask":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=Te(T,w,E);h(T,10,10,{fill:Ze(w,s,E.fill),stroke:"none",transform:"translate(6, 6)"});var U=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});x(T,U,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:1}),h(T,10,10,{fill:Ze(w,s,E.fill),stroke:"none",transform:"translate(11, 10)"});var X=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return x(T,X,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:1}),G},"bpmn:StartEvent":function(T,w,E={}){var{renderIcon:G=!0}=E;E=at(E,["fill","stroke"]);var U=ie(w);U.get("isInterrupting")||(E={...E,strokeDasharray:"6"});var X=se(T,w,E);return G&&B(w,T,E),X},"bpmn:SubProcess":function(T,w,E={}){return Qe(w)?E=at(E,["fill","stroke","width","height"]):E=at(E,["fill","stroke"]),V(T,w,E)},"bpmn:Task":function(T,w,E={}){return E=at(E,["fill","stroke"]),Te(T,w,E)},"bpmn:TextAnnotation":function(T,w,E={}){E=at(E,["fill","stroke"]);var{width:G,height:U}=va(w,E),X=y(T,G,U,0,0,{fill:"none",stroke:"none"}),Ce=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:U,position:{mx:0,my:0}});x(T,Ce,{stroke:be(w,c,E.stroke)});var Ue=ie(w),st=Ue.get("text")||"";return oe(T,st,{align:"left-top",box:va(w,E),padding:So,style:{fill:ya(w,l,c,E.stroke)}}),X},"bpmn:Transaction":function(T,w,E={}){Qe(w)?E=at(E,["fill","stroke","width","height"]):E=at(E,["fill","stroke"]);var G=V(T,w,{strokeWidth:1.5,...E}),U=n.style(["no-fill","no-events"],{stroke:be(w,c,E.stroke),strokeWidth:1.5}),X=Qe(w);return X||(E={}),y(T,Qn(w,E),In(w,E),Qs-Zs,Zs,U),G},"bpmn:UserTask":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=Te(T,w,E),U=15,X=12,Ce=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:U,y:X}});x(T,Ce,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:.5});var Ue=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:U,y:X}});x(T,Ue,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:.5});var st=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:U,y:X}});return x(T,st,{fill:be(w,c,E.stroke),stroke:be(w,c,E.stroke),strokeWidth:.5}),G},label:function(T,w,E={}){return Ve(T,w,E)}};this._drawPath=x,this._renderer=M}Ee(jr,Ii),jr.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],jr.prototype.canRender=function(e){return S(e,"bpmn:BaseElement")},jr.prototype.drawShape=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},jr.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},jr.prototype.getShapePath=function(e){return Ye(e)?Ku(e,DC):S(e,"bpmn:Event")?ug(e):S(e,"bpmn:Activity")?Ku(e,Qs):S(e,"bpmn:Gateway")?PC(e):MC(e)};function at(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var BC=0,NC={width:150,height:50};function $C(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function FC(e){return Qt(e)?W({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var Xu=null;function jC(){return Xu||(Xu=document.createElement("canvas").getContext("2d")),Xu}function HC(e){var t=[];return e.fontStyle&&t.push(e.fontStyle),e.fontVariant&&t.push(e.fontVariant),e.fontWeight&&t.push(e.fontWeight),e.fontStretch&&t.push(e.fontStretch),t.push(pg(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function pg(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function zC(e,t){var n=jC();if(!n)return{width:0,height:0};n.font=HC(t),"letterSpacing"in n&&(n.letterSpacing=pg(t.letterSpacing)||"0px");var i=e==="",r=i?"dummy":e.replace(/\s+$/,""),o=n.measureText(r);return{width:i?0:o.width,height:"fontBoundingBoxAscent"in o?o.fontBoundingBoxAscent+o.fontBoundingBoxDescent:o.actualBoundingBoxAscent+o.actualBoundingBoxDescent}}function GC(e,t,n){for(var i=e.shift(),r=i,o;;){if(o=zC(r,n),o.width=r?o.width:0,r===" "||r===""||o.width<Math.round(t)||r.length<2)return VC(e,r,i,o);r=UC(r,o.width,t)}}function VC(e,t,n,i){if(t.length<n.length){var r=n.slice(t.length).trim();e.unshift(r)}return{width:i.width,height:i.height,text:t}}var fg="";function WC(e,t){var n=e.split(/(\s|-|\u00AD)/g),i,r=[],o=0;if(n.length>1)for(;i=n.shift();)if(i.length+o<t)r.push(i),o+=i.length;else{(i==="-"||i===fg)&&r.pop();break}var a=r[r.length-1];return a&&a===fg&&(r[r.length-1]="-"),r.join("")}function UC(e,t,n){var i=Math.max(e.length*(n/t),1),r=WC(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function Js(e){this._config=W({},{size:NC,padding:BC,style:{},align:"center-top"},e||{})}Js.prototype.createText=function(e,t){return this.layoutText(e,t).element},Js.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Js.prototype.layoutText=function(e,t){for(var n=W({},this._config.size,t.box),i=W({},this._config.style,t.style),r=$C(t.align||this._config.align),o=FC(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=YC(i),c=e.split(/\u00AD?\r?\n/),l=[],u=n.width-o.left-o.right;c.length;)l.push(GC(c,u,i));r.vertical==="middle"&&(o.top=o.bottom=0);var f=Tn(l,function(y,v,g){return y+(s||v.height)},0)+o.top+o.bottom,p=Tn(l,function(y,v,g){return v.width>y?v.width:y},0),d=o.top;r.vertical==="middle"&&(d+=(n.height-f)/2),d-=(s||l[0].height)/4;var m=Oe("text");Se(m,i),F(l,function(y){var v;switch(d+=s||y.height,r.horizontal){case"left":v=o.left;break;case"right":v=(a?p:u)-o.right-y.width;break;default:v=Math.max(((a?p:u)-y.width)/2+o.left,0)}var g=Oe("tspan");Se(g,{x:v,y:d}),g.textContent=y.text,ze(m,g)});var h={width:p,height:f};return{dimensions:h,element:m}};function YC(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var qC=12,KC=1.2,XC=40;function dg(e){var t=W({fontFamily:"Arial, sans-serif",fontSize:qC,fontWeight:"normal",lineHeight:KC},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=W({},t,{fontSize:n},e&&e.externalStyle||{}),r=new Js({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,Fr.width),height:30},l=o(s,c,{style:i});return{x:Math.round(a.x+a.width/2-l.width/2),y:a.y,width:Math.ceil(l.width),height:Math.ceil(l.height)}},this.getTextAnnotationBounds=function(a,s){var c=o(s,a,{style:t,align:"left-top",padding:So});return{x:a.x,y:a.y,width:a.width,height:Math.max(XC,Math.round(c.height))}},this.getDimensions=function(a,s){return r.getDimensions(a,s||{})};function o(a,s,c){return r.getDimensions(a,W({box:s},c))}this.createText=function(a,s){return r.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}dg.$inject=["config.textRenderer"];function ZC(){this.pathMap={EVENT_MESSAGE:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:36,width:36,heightElements:[6,14],widthElements:[10.5,21]},EVENT_SIGNAL:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x1},0 Z",height:36,width:36,heightElements:[18],widthElements:[10,20]},EVENT_ESCALATION:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x0},-{e.y1} l -{e.x0},{e.y1} Z",height:36,width:36,heightElements:[20,7],widthElements:[8]},EVENT_CONDITIONAL:{d:"M {e.x0},{e.y0} l {e.x1},0 l 0,{e.y2} l -{e.x1},0 Z M {e.x2},{e.y3} l {e.x0},0 M {e.x2},{e.y4} l {e.x0},0 M {e.x2},{e.y5} l {e.x0},0 M {e.x2},{e.y6} l {e.x0},0 M {e.x2},{e.y7} l {e.x0},0 M {e.x2},{e.y8} l {e.x0},0 ",height:36,width:36,heightElements:[8.5,14.5,18,11.5,14.5,17.5,20.5,23.5,26.5],widthElements:[10.5,14.5,12.5]},EVENT_LINK:{d:"m {mx},{my} 0,{e.y0} -{e.x1},0 0,{e.y1} {e.x1},0 0,{e.y0} {e.x0},-{e.y2} -{e.x0},-{e.y2} z",height:36,width:36,heightElements:[4.4375,6.75,7.8125],widthElements:[9.84375,13.5]},EVENT_ERROR:{d:"m {mx},{my} {e.x0},-{e.y0} {e.x1},-{e.y1} {e.x2},{e.y2} {e.x3},-{e.y3} -{e.x4},{e.y4} -{e.x5},-{e.y5} z",height:36,width:36,heightElements:[.023,8.737,8.151,16.564,10.591,8.714],widthElements:[.085,6.672,6.97,4.273,5.337,6.636]},EVENT_CANCEL_45:{d:"m {mx},{my} -{e.x1},0 0,{e.x0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:36,width:36,heightElements:[4.75,8.5],widthElements:[4.75,8.5]},EVENT_COMPENSATION:{d:"m {mx},{my} {e.x0},-{e.y0} 0,{e.y1} z m {e.x1},-{e.y2} {e.x2},-{e.y3} 0,{e.y1} -{e.x2},-{e.y3} z",height:36,width:36,heightElements:[6.5,13,.4,6.1],widthElements:[9,9.3,8.7]},EVENT_TIMER_WH:{d:"M {mx},{my} l {e.x0},-{e.y0} m -{e.x0},{e.y0} l {e.x1},{e.y1} ",height:36,width:36,heightElements:[10,2],widthElements:[3,7]},EVENT_TIMER_LINE:{d:"M {mx},{my} m {e.x0},{e.y0} l -{e.x1},{e.y1} ",height:36,width:36,heightElements:[10,3],widthElements:[0,0]},EVENT_MULTIPLE:{d:"m {mx},{my} {e.x1},-{e.y0} {e.x1},{e.y0} -{e.x0},{e.y1} -{e.x2},0 z",height:36,width:36,heightElements:[6.28099,12.56199],widthElements:[3.1405,9.42149,12.56198]},EVENT_PARALLEL_MULTIPLE:{d:"m {mx},{my} {e.x0},0 0,{e.y1} {e.x1},0 0,{e.y0} -{e.x1},0 0,{e.y1} -{e.x0},0 0,-{e.y1} -{e.x1},0 0,-{e.y0} {e.x1},0 z",height:36,width:36,heightElements:[2.56228,7.68683],widthElements:[2.56228,7.68683]},GATEWAY_EXCLUSIVE:{d:"m {mx},{my} {e.x0},{e.y0} {e.x1},{e.y0} {e.x2},0 {e.x4},{e.y2} {e.x4},{e.y1} {e.x2},0 {e.x1},{e.y3} {e.x0},{e.y3} {e.x3},0 {e.x5},{e.y1} {e.x5},{e.y2} {e.x3},0 z",height:17.5,width:17.5,heightElements:[8.5,6.5312,-6.5312,-8.5],widthElements:[6.5,-6.5,3,-3,5,-5]},GATEWAY_PARALLEL:{d:"m {mx},{my} 0,{e.y1} -{e.x1},0 0,{e.y0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:30,width:30,heightElements:[5,12.5],widthElements:[5,12.5]},GATEWAY_EVENT_BASED:{d:"m {mx},{my} {e.x0},{e.y0} {e.x0},{e.y1} {e.x1},{e.y2} {e.x2},0 z",height:11,width:11,heightElements:[-6,6,12,-12],widthElements:[9,-3,-12]},GATEWAY_COMPLEX:{d:"m {mx},{my} 0,{e.y0} -{e.x0},-{e.y1} -{e.x1},{e.y2} {e.x0},{e.y1} -{e.x2},0 0,{e.y3} {e.x2},0 -{e.x0},{e.y1} l {e.x1},{e.y2} {e.x0},-{e.y1} 0,{e.y0} {e.x3},0 0,-{e.y0} {e.x0},{e.y1} {e.x1},-{e.y2} -{e.x0},-{e.y1} {e.x2},0 0,-{e.y3} -{e.x2},0 {e.x0},-{e.y1} -{e.x1},-{e.y2} -{e.x0},{e.y1} 0,-{e.y0} -{e.x3},0 z",height:17.125,width:17.125,heightElements:[4.875,3.4375,2.125,3],widthElements:[3.4375,2.125,4.875,3]},DATA_OBJECT_PATH:{d:"m 0,0 {e.x1},0 {e.x0},{e.y0} 0,{e.y1} -{e.x2},0 0,-{e.y2} {e.x1},0 0,{e.y0} {e.x0},0",height:61,width:51,heightElements:[10,50,60],widthElements:[10,40,50,60]},DATA_OBJECT_COLLECTION_PATH:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},DATA_ARROW:{d:"m 5,9 9,0 0,-3 5,5 -5,5 0,-3 -9,0 z",height:61,width:51,heightElements:[],widthElements:[]},DATA_STORE:{d:"m {mx},{my} l 0,{e.y2} c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 l 0,-{e.y2} c -{e.x0},-{e.y1} -{e.x1},-{e.y1} -{e.x2},0c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0",height:61,width:61,heightElements:[7,10,45],widthElements:[2,58,60]},TEXT_ANNOTATION:{d:"m {mx}, {my} m 10,0 l -10,0 l 0,{e.y0} l 10,0",height:30,width:10,heightElements:[30],widthElements:[10]},MARKER_SUB_PROCESS:{d:"m{mx},{my} m 7,2 l 0,10 m -5,-5 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_PARALLEL:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},MARKER_SEQUENTIAL:{d:"m{mx},{my} m 0,3 l 10,0 m -10,3 l 10,0 m -10,3 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_COMPENSATION:{d:"m {mx},{my} 7,-5 0,10 z m 7.1,-0.3 6.9,-4.7 0,10 -6.9,-4.7 z",height:10,width:21,heightElements:[],widthElements:[]},MARKER_LOOP:{d:"m {mx},{my} c 3.526979,0 6.386161,-2.829858 6.386161,-6.320661 0,-3.490806 -2.859182,-6.320661 -6.386161,-6.320661 -3.526978,0 -6.38616,2.829855 -6.38616,6.320661 0,1.745402 0.714797,3.325567 1.870463,4.469381 0.577834,0.571908 1.265885,1.034728 2.029916,1.35457 l -0.718163,-3.909793 m 0.718163,3.909793 -3.885211,0.802902",height:13.9,width:13.7,heightElements:[],widthElements:[]},MARKER_ADHOC:{d:"m {mx},{my} m 0.84461,2.64411 c 1.05533,-1.23780996 2.64337,-2.07882 4.29653,-1.97997996 2.05163,0.0805 3.85579,1.15803 5.76082,1.79107 1.06385,0.34139996 2.24454,0.1438 3.18759,-0.43767 0.61743,-0.33642 1.2775,-0.64078 1.7542,-1.17511 0,0.56023 0,1.12046 0,1.6807 -0.98706,0.96237996 -2.29792,1.62393996 -3.6918,1.66181996 -1.24459,0.0927 -2.46671,-0.2491 -3.59505,-0.74812 -1.35789,-0.55965 -2.75133,-1.33436996 -4.27027,-1.18121996 -1.37741,0.14601 -2.41842,1.13685996 -3.44288,1.96782996 z",height:4,width:15,heightElements:[],widthElements:[]},TASK_TYPE_SEND:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:14,width:21,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_SCRIPT:{d:"m {mx},{my} c 9.966553,-6.27276 -8.000926,-7.91932 2.968968,-14.938 l -8.802728,0 c -10.969894,7.01868 6.997585,8.66524 -2.968967,14.938 z m -7,-12 l 5,0 m -4.5,3 l 4.5,0 m -3,3 l 5,0m -4,3 l 5,0",height:15,width:12.6,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_USER_1:{d:"m {mx},{my} c 0.909,-0.845 1.594,-2.049 1.594,-3.385 0,-2.554 -1.805,-4.62199999 -4.357,-4.62199999 -2.55199998,0 -4.28799998,2.06799999 -4.28799998,4.62199999 0,1.348 0.974,2.562 1.89599998,3.405 -0.52899998,0.187 -5.669,2.097 -5.794,4.7560005 v 6.718 h 17 v -6.718 c 0,-2.2980005 -5.5279996,-4.5950005 -6.0509996,-4.7760005 zm -8,6 l 0,5.5 m 11,0 l 0,-5"},TASK_TYPE_USER_2:{d:"m {mx},{my} m 2.162,1.009 c 0,2.4470005 -2.158,4.4310005 -4.821,4.4310005 -2.66499998,0 -4.822,-1.981 -4.822,-4.4310005 "},TASK_TYPE_USER_3:{d:"m {mx},{my} m -6.9,-3.80 c 0,0 2.25099998,-2.358 4.27399998,-1.177 2.024,1.181 4.221,1.537 4.124,0.965 -0.098,-0.57 -0.117,-3.79099999 -4.191,-4.13599999 -3.57499998,0.001 -4.20799998,3.36699999 -4.20699998,4.34799999 z"},TASK_TYPE_MANUAL:{d:"m {mx},{my} c 0.234,-0.01 5.604,0.008 8.029,0.004 0.808,0 1.271,-0.172 1.417,-0.752 0.227,-0.898 -0.334,-1.314 -1.338,-1.316 -2.467,-0.01 -7.886,-0.004 -8.108,-0.004 -0.014,-0.079 0.016,-0.533 0,-0.61 0.195,-0.042 8.507,0.006 9.616,0.002 0.877,-0.007 1.35,-0.438 1.353,-1.208 0.003,-0.768 -0.479,-1.09 -1.35,-1.091 -2.968,-0.002 -9.619,-0.013 -9.619,-0.013 v -0.591 c 0,0 5.052,-0.016 7.225,-0.016 0.888,-0.002 1.354,-0.416 1.351,-1.193 -0.006,-0.761 -0.492,-1.196 -1.361,-1.196 -3.473,-0.005 -10.86,-0.003 -11.0829995,-0.003 -0.022,-0.047 -0.045,-0.094 -0.069,-0.139 0.3939995,-0.319 2.0409995,-1.626 2.4149995,-2.017 0.469,-0.4870005 0.519,-1.1650005 0.162,-1.6040005 -0.414,-0.511 -0.973,-0.5 -1.48,-0.236 -1.4609995,0.764 -6.5999995,3.6430005 -7.7329995,4.2710005 -0.9,0.499 -1.516,1.253 -1.882,2.19 -0.37000002,0.95 -0.17,2.01 -0.166,2.979 0.004,0.718 -0.27300002,1.345 -0.055,2.063 0.629,2.087 2.425,3.312 4.859,3.318 4.6179995,0.014 9.2379995,-0.139 13.8569995,-0.158 0.755,-0.004 1.171,-0.301 1.182,-1.033 0.012,-0.754 -0.423,-0.969 -1.183,-0.973 -1.778,-0.01 -5.824,-0.004 -6.04,-0.004 10e-4,-0.084 0.003,-0.586 10e-4,-0.67 z"},TASK_TYPE_INSTANTIATING_SEND:{d:"m {mx},{my} l 0,8.4 l 12.6,0 l 0,-8.4 z l 6.3,3.6 l 6.3,-3.6"},TASK_TYPE_SERVICE:{d:"m {mx},{my} v -1.71335 c 0.352326,-0.0705 0.703932,-0.17838 1.047628,-0.32133 0.344416,-0.14465 0.665822,-0.32133 0.966377,-0.52145 l 1.19431,1.18005 1.567487,-1.57688 -1.195028,-1.18014 c 0.403376,-0.61394 0.683079,-1.29908 0.825447,-2.01824 l 1.622133,-0.01 v -2.2196 l -1.636514,0.01 c -0.07333,-0.35153 -0.178319,-0.70024 -0.323564,-1.04372 -0.145244,-0.34406 -0.321407,-0.6644 -0.522735,-0.96217 l 1.131035,-1.13631 -1.583305,-1.56293 -1.129598,1.13589 c -0.614052,-0.40108 -1.302883,-0.68093 -2.022633,-0.82247 l 0.0093,-1.61852 h -2.241173 l 0.0042,1.63124 c -0.353763,0.0736 -0.705369,0.17977 -1.049785,0.32371 -0.344415,0.14437 -0.665102,0.32092 -0.9635006,0.52046 l -1.1698628,-1.15823 -1.5667691,1.5792 1.1684265,1.15669 c -0.4026573,0.61283 -0.68308,1.29797 -0.8247287,2.01713 l -1.6588041,0.003 v 2.22174 l 1.6724648,-0.006 c 0.073327,0.35077 0.1797598,0.70243 0.3242851,1.04472 0.1452428,0.34448 0.3214064,0.6644 0.5227339,0.96066 l -1.1993431,1.19723 1.5840256,1.56011 1.1964668,-1.19348 c 0.6140517,0.40346 1.3028827,0.68232 2.0233517,0.82331 l 7.19e-4,1.69892 h 2.226848 z m 0.221462,-3.9957 c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_SERVICE_FILL:{d:"m {mx},{my} c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_BUSINESS_RULE_HEADER:{d:"m {mx},{my} 0,4 20,0 0,-4 z"},TASK_TYPE_BUSINESS_RULE_MAIN:{d:"m {mx},{my} 0,12 20,0 0,-12 zm 0,8 l 20,0 m -13,-4 l 0,8"},MESSAGE_FLOW_MARKER:{d:"m {mx},{my} m -10.5 ,-7 l 0,14 l 21,0 l 0,-14 z l 10.5,6 l 10.5,-6"}},this.getRawPath=function(t){return this.pathMap[t].d},this.getScaledPath=function(t,n){var i=this.pathMap[t],r,o;n.abspos?(r=n.abspos.x,o=n.abspos.y):(r=n.containerWidth*n.position.mx,o=n.containerHeight*n.position.my);var a={};if(n.position){for(var s=n.containerHeight/i.height*n.yScaleFactor,c=n.containerWidth/i.width*n.xScaleFactor,l=0;l<i.heightElements.length;l++)a["y"+l]=i.heightElements[l]*s;for(var u=0;u<i.widthElements.length;u++)a["x"+u]=i.widthElements[u]*c}var f=tA(i.d,{mx:r,my:o,e:a});return f}}var QC=/\{([^{}]+)\}/g,JC=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function eA(e,t,n){var i=n;return t.replace(JC,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 tA(e,t){return String(e).replace(QC,function(n,i){return eA(n,i,t)})}const nA={__init__:["bpmnRenderer"],bpmnRenderer:["type",jr],textRenderer:["type",dg],pathMap:["type",ZC]};function iA(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const ba={translate:["value",iA]};function ec(e,t,n){return W({id:e.id,type:e.$type,businessObject:e,di:t},n)}function rA(e,t,n){var i=e.waypoint;return!i||i.length<2?[Ne(t),Ne(n)]:i.map(function(r){return{x:r.x,y:r.y}})}function hg(e,t,n){return new Error(`element ${yn(t)} referenced by ${yn(e)}#${n} not yet drawn`)}function $i(e,t,n,i,r){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=r}$i.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],$i.prototype.add=function(e,t,n){var i,r,o;if(S(t,"bpmndi:BPMNPlane")){var a=S(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(ec(e,t,a)),this._canvas.addRootElement(i)}else if(S(t,"bpmndi:BPMNShape")){var s=!Qe(e,t),c=aA(e);r=n&&(n.hidden||n.collapsed);var l=t.bounds;i=this._elementFactory.createShape(ec(e,t,{collapsed:s,hidden:r,x:Math.round(l.x),y:Math.round(l.y),width:Math.round(l.width),height:Math.round(l.height),isFrame:c})),S(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),S(e,"bpmn:Lane")&&(o=0),S(e,"bpmn:DataStoreReference")&&(oA(n,Ne(l))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,o)}else if(S(t,"bpmndi:BPMNEdge")){var u=this._getSource(e),f=this._getTarget(e);r=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(ec(e,t,{hidden:r,source:u,target:f,waypoints:rA(t,u,f)})),S(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,o)}else throw new Error(`unknown di ${yn(t)} for element ${yn(e)}`);return sr(e)&&qn(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},$i.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${yn(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),r=i&&i.attachers;if(!i)throw hg(e,n,"attachedToRef");t.host=i,r||(i.attachers=r=[]),r.indexOf(t)===-1&&r.push(t)},$i.prototype.addLabel=function(e,t,n){var i,r,o;return i=_C(t,n),r=qn(n),r&&(i=this._textRenderer.getExternalLabelBounds(i,r)),o=this._elementFactory.createLabel(ec(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!qn(n),x:Math.round(i.x),y:Math.round(i.y),width:Math.round(i.width),height:Math.round(i.height)})),this._canvas.addShape(o,n.parent)},$i.prototype._getConnectedElement=function(e,t){var n,i,r=e.$type;if(i=e[t+"Ref"],t==="source"&&r==="bpmn:DataInputAssociation"&&(i=i&&i[0]),(t==="source"&&r==="bpmn:DataOutputAssociation"||t==="target"&&r==="bpmn:DataInputAssociation")&&(i=e.$parent),n=i&&this._getElement(i),n)return n;throw i?hg(e,i,t+"Ref"):new Error(`${yn(e)}#${t} Ref not specified`)},$i.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},$i.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},$i.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function oA(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 aA(e){return S(e,"bpmn:Group")}const mg={__depends__:[nA,{__depends__:[ba],bpmnImporter:["type",$i]}]};function xa(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function pi(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Zu(e){return Math.log(e)/Math.log(10)}var sA=1e3;function te(e){this._eventBus=e}te.$inject=["eventBus"];function cA(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}te.prototype.on=function(e,t,n,i,r,o){if((Jt(t)||Fe(t))&&(o=r,r=i,i=n,n=t,t=null),Jt(n)&&(o=r,r=i,i=n,n=sA),Qt(r)&&(o=r,r=!1),!Jt(i))throw new Error("handlerFn must be a function");Be(e)||(e=[e]);var a=this._eventBus;F(e,function(s){var c=["commandStack",s,t].filter(function(l){return l}).join(".");a.on(c,n,r?cA(i,o):i,o)})},te.prototype.canExecute=Fi("canExecute"),te.prototype.preExecute=Fi("preExecute"),te.prototype.preExecuted=Fi("preExecuted"),te.prototype.execute=Fi("execute"),te.prototype.executed=Fi("executed"),te.prototype.postExecute=Fi("postExecute"),te.prototype.postExecuted=Fi("postExecuted"),te.prototype.revert=Fi("revert"),te.prototype.reverted=Fi("reverted");function Fi(e){return function(n,i,r,o,a){(Jt(n)||Fe(n))&&(a=o,o=r,r=i,i=n,n=null),this.on(n,e,i,r,o,a)}}var Qu=["top","bottom","left","right"],tc=10;function Ju(e,t){te.call(this,e),this.postExecuted(["connection.create","connection.layout","connection.updateWaypoints"],function(r){var o=r.context,a=o.connection,s=a.source,c=a.target,l=o.hints||{};l.createElementsBehavior!==!1&&(n(s),n(c))}),this.postExecuted(["label.create"],function(r){var o=r.context,a=o.shape,s=o.hints||{};s.createElementsBehavior!==!1&&n(a.labelTarget)}),this.postExecuted(["elements.create"],function(r){var o=r.context,a=o.elements,s=o.hints||{};s.createElementsBehavior!==!1&&a.forEach(function(c){n(c)})});function n(r){if(Xs(r)&&!ht(r)){var o=pA(r);o&&i(r,o)}}function i(r,o){var a=Ne(r),s=r.label,c=Ne(s);if(s.parent){var l=Ie(r),u;switch(o){case"top":u={x:a.x,y:l.top-tc-s.height/2};break;case"left":u={x:l.left-tc-s.width/2,y:a.y};break;case"bottom":u={x:a.x,y:l.bottom+tc+s.height/2};break;case"right":u={x:l.right+tc+s.width/2,y:a.y};break}var f=pi(u,c);t.moveShape(s,f)}}}Ee(Ju,te),Ju.$inject=["eventBus","modeling"];function lA(e){var t=e.host,n=Ne(e),i=cn(n,t),r;i.indexOf("-")>=0?r=i.split("-"):r=[i];var o=Qu.filter(function(a){return r.indexOf(a)===-1});return o}function uA(e){var t=Ne(e),n=[].concat(e.incoming.map(function(i){return i.waypoints[i.waypoints.length-2]}),e.outgoing.map(function(i){return i.waypoints[1]})).map(function(i){return gg(t,i)});return n}function pA(e){var t=Ne(e.label),n=Ne(e),i=gg(n,t);if(fA(i)){var r=uA(e);if(e.host){var o=lA(e);r=r.concat(o)}var a=Qu.filter(function(s){return r.indexOf(s)===-1});return a.indexOf(i)!==-1?cn(e.label,e)!=="intersect"?void 0:i:a[0]}}function gg(e,t){return cn(t,e,5)}function fA(e){return Qu.indexOf(e)!==-1}function ep(e){te.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,i=t.shape;t.position||(S(i,"bpmn:TextAnnotation")?t.position={x:n.x+n.width/2+75,y:n.y-50-i.height/2}:t.position={x:n.x+n.width+80+i.width/2,y:n.y+n.height/2})},!0)}Ee(ep,te),ep.$inject=["eventBus"];var dA=1500;function tp(e,t,n){e.invoke(te,this),this.preExecute("elements.delete",dA,function(r){var o=r.context,a=o.elements,s=i(a);s.length&&(o.elements=a.concat(s))}),t.on("shape.move.start",function(r){var o=r.context.shapes,a=i(o);a.length&&(r.context.shapes=o.concat(a))});function i(r){var o=Ke(r,l=>S(l,"bpmn:Participant")||S(l,"bpmn:SubProcess"));if(!o.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(l=>S(l,"bpmn:Artifact"))),c=new Set;return F(o,l=>{const u=new Set(ro(bo(Array.from(s),Ft(l))));c=c.union(u),s=s.difference(u)}),Array.from(c)}}Ee(tp,te),tp.$inject=["injector","eventBus","canvas"];function np(e,t){e.invoke(te,this),this.postExecute("shape.move",function(n){var i=n.newParent,r=n.shape,o=Ke(r.incoming.concat(r.outgoing),function(a){return S(a,"bpmn:Association")});F(o,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}Ee(np,te),np.$inject=["injector","modeling"];function Co(e,t){for(Pn(t)&&(t=[t]);e=e.parent;)if(qe(e,t))return e;return null}function yg(e,t){var n=Co(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=Co(e,i),n)return tn(n);if(qe(e,i))return tn(e);var r;for(r=ie(e);r&&!S(r,"bpmn:Process");r=r.$parent);if(!t)return!0;var o=t.find(function(a){var s=ie(a);return s&&s.get("processRef")===r});return o?tn(o):!0}var vg=500;function nc(e,t){t.invoke(te,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",vg,function(i){var r=i.elements;r=r.filter(function(o){var a=o.host;return bg(o,a)}),r.length===1&&r.map(function(o){return r.indexOf(o)}).forEach(function(o){var a=r[o];i.elements[o]=n._replaceShape(r[o],a)})},!0),this.preExecute("elements.move",vg,function(i){var r=i.shapes,o=i.newHost;if(r.length===1){var a=r[0];bg(a,o)&&(i.shapes=[n._replaceShape(a,o)])}},!0)}nc.$inject=["bpmnReplace","injector"],Ee(nc,te),nc.prototype._replaceShape=function(e,t){var n=hA(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function hA(e){var t=ie(e),n=t.eventDefinitions;return n&&n[0]}function bg(e,t){return!Ye(e)&&qe(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function ip(e,t){te.call(this,e);function n(i){return Ke(i.attachers,function(r){return S(r,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var r=i.context.source,o=i.context.target,a=n(o);S(r,"bpmn:EventBasedGateway")&&S(o,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var r=i.context.oldSource,o=i.context.newSource;S(r,"bpmn:Gateway")&&S(o,"bpmn:EventBasedGateway")&&F(o.outgoing,function(a){var s=a.target,c=n(s);S(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}ip.$inject=["eventBus","modeling"],Ee(ip,te);function xg(e){return e.create("bpmn:Category")}function mA(e){return e.create("bpmn:CategoryValue")}function _g(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=mA(e)),n.$parent||(n.$parent=xg(e)),n}function gA(e,t,n){return Bt(t.get("categoryValue"),e),e.$parent=t,Bt(n.get("rootElements"),t),t.$parent=n,e}function yA(e){var t=e.$parent;return t&&(Lt(t.get("categoryValue"),e),e.$parent=null),e}function vA(e){var t=e.$parent;return t&&(Lt(t.get("rootElements"),e),e.$parent=null),e}var bA=500;function rp(e,t,n){n.invoke(te,this);function i(c){return t.filter(function(l){return S(l,"bpmn:Group")&&!l.labelTarget}).map(ie).filter(function(l){return l!==c})}function r(c,l){return i(l).some(function(u){return u.get("categoryValueRef")===c})}function o(c,l){return i(l).some(function(u){var f=u.get("categoryValueRef");return f&&f.$parent===c})}function a(c,l){c&&l&&gA(c,l,e.getDefinitions())}function s(c,l,u){l&&!o(l,u)&&vA(l),c&&!r(c,u)&&yA(c)}this.executed(["shape.create","label.create"],function(c){var l=c.labelTarget||c.shape;!S(l,"bpmn:Group")||l.labelTarget||a(c.categoryValue,c.category)},!0),this.reverted(["shape.create","label.create"],function(c){var l=c.labelTarget||c.shape;!S(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,ie(l))},!0),this.executed(["shape.move","shape.resize"],bA,function(c){a(c.categoryValue,c.category)},!0),this.reverted(["shape.move","shape.resize"],function(c){var l=c.shape;c.categoryValue&&s(c.categoryValue,c.category,ie(l))},!0),this.executed("group.updateRefs",function(c){wg(c).forEach(function(l){a(l.categoryValue,l.category)})},!0),this.reverted("group.updateRefs",function(c){wg(c).forEach(function(l){s(l.categoryValue,l.category,ie(l.groupShape))})},!0),this.executed("shape.delete",function(c){var l=c.shape;!S(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,ie(l))},!0),this.reverted("shape.delete",function(c){var l=c.shape;!S(l,"bpmn:Group")||l.labelTarget||a(c.categoryValue,c.category)},!0)}rp.$inject=["bpmnjs","elementRegistry","injector"],Ee(rp,te);function wg(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function op(e,t,n){te.call(this,e),this.preExecute("shape.replace",s,!0),this.postExecuted("shape.replace",c,!0),this.preExecute("connection.create",r,!0),this.postExecuted("connection.delete",i,!0),this.postExecuted("connection.reconnect",o,!0),this.postExecuted("element.updateProperties",a,!0);function i(y){const v=y.source,g=y.target;Ao(v)&&_a(g)&&u(g)}function r(y){const v=y.connection,g=y.source,b=y.target;Ao(g)&&ic(b)&&(l(b),p(g,[v]))}function o(y){const v=y.newTarget,g=y.oldSource,b=y.oldTarget;if(b!==v){const x=g;_a(b)&&u(b),Ao(x)&&ic(v)&&l(v)}}function a(y){const{element:v}=y;_a(v)?(f(v),d(v)):ic(v)&&m(v)}function s(y){const{newData:v,oldShape:g}=y;if(Ao(y.oldShape)&&v.eventDefinitionType!=="bpmn:CompensateEventDefinition"||v.type!=="bpmn:BoundaryEvent"){const b=g.outgoing.find(({target:x})=>_a(x));b&&b.target&&(y._connectionTarget=b.target)}else if(!Ao(y.oldShape)&&v.eventDefinitionType==="bpmn:CompensateEventDefinition"&&v.type==="bpmn:BoundaryEvent"){const b=g.outgoing.find(({target:x})=>ic(x));b&&b.target&&(y._connectionTarget=b.target),h(g)}}function c(y){const{_connectionTarget:v,newShape:g}=y;v&&t.connect(g,v)}function l(y){t.updateProperties(y,{isForCompensation:!0})}function u(y){t.updateProperties(y,{isForCompensation:void 0})}function f(y){for(const v of y.incoming)n.canConnect(v.source,y)||t.removeConnection(v);for(const v of y.outgoing)n.canConnect(y,v.target)||t.removeConnection(v)}function p(y,v){y.outgoing.filter(x=>S(x,"bpmn:Association")).filter(x=>_a(x.target)&&!v.includes(x)).forEach(x=>t.removeConnection(x))}function d(y){const v=y.attachers.slice();v.length&&t.removeElements(v)}function m(y){const v=y.incoming.filter(g=>Ao(g.source));t.removeElements(v)}function h(y){const v=y.outgoing.filter(g=>S(g,"bpmn:SequenceFlow"));t.removeElements(v)}}Ee(op,te),op.$inject=["eventBus","modeling","bpmnRules"];function _a(e){const t=ie(e);return t&&t.get("isForCompensation")}function Ao(e){return e&&S(e,"bpmn:BoundaryEvent")&&Eo(e,"bpmn:CompensateEventDefinition")}function ic(e){return e&&S(e,"bpmn:Activity")&&!vn(e)}function ap(e){e.invoke(te,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,r=n.shape;S(i,"bpmn:Lane")&&!S(r,"bpmn:Lane")&&(n.parent=Co(i,"bpmn:Participant"))})}ap.$inject=["injector"],Ee(ap,te);function sp(e,t){te.call(this,e),this.preExecute("shape.create",function(n){var a;var i=n.context,r=i.shape;if(S(r,"bpmn:DataObjectReference")&&r.type!=="label"){var o=t.create("bpmn:DataObject");o.isCollection=((a=r.businessObject.dataObjectRef)==null?void 0:a.isCollection)||!1,r.businessObject.dataObjectRef=o}})}sp.$inject=["eventBus","bpmnFactory"],Ee(sp,te);var cp=20,lp=20,Eg=30,rc=2e3;function up(e,t,n){te.call(this,t),t.on(["create.start","shape.move.start"],rc,function(r){var o=r.context,a=o.shape,s=e.getRootElement();if(!(!S(a,"bpmn:Participant")||!S(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(f){return!S(f,"bpmn:Group")&&!Ye(f)&&!ht(f)});if(c.length){var l=Ft(c),u=xA(a,l);W(a,u),o.createConstraints=_A(a,l)}}}),t.on("create.start",rc,function(r){var o=r.context,a=o.shape,s=e.getRootElement(),c=e.getGraphics(s);function l(u){u.element=s,u.gfx=c}S(a,"bpmn:Participant")&&S(s,"bpmn:Process")&&(t.on("element.hover",rc,l),t.once("create.cleanup",function(){t.off("element.hover",l)}))});function i(){var r=e.getRootElement();return S(r,"bpmn:Collaboration")?r:n.makeCollaboration()}this.preExecute("elements.create",rc,function(r){var o=r.elements,a=r.parent,s=wA(o),c;s&&S(a,"bpmn:Process")&&(r.parent=i(),c=r.hints=r.hints||{},c.participant=s,c.process=a,c.processRef=ie(s).get("processRef"))},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;S(a,"bpmn:Participant")&&S(o,"bpmn:Process")&&(r.parent=i(),r.process=o,r.processRef=ie(a).get("processRef"))},!0),this.execute("shape.create",function(r){var o=r.hints||{},a=r.process||o.process,s=r.shape,c=o.participant;a&&(!c||s===c)&&ie(s).set("processRef",ie(a))},!0),this.revert("shape.create",function(r){var o=r.hints||{},a=r.process||o.process,s=r.processRef||o.processRef,c=r.shape,l=o.participant;a&&(!l||c===l)&&ie(c).set("processRef",s)},!0),this.postExecute("shape.create",function(r){var o=r.hints||{},a=r.process||r.hints.process,s=r.shape,c=o.participant;if(a){var l=a.children.slice();c?s===c&&n.moveElements(l,{x:0,y:0},c):n.moveElements(l,{x:0,y:0},s)}},!0)}up.$inject=["canvas","eventBus","modeling"],Ee(up,te);function xA(e,t){t={width:t.width+cp*2+Eg,height:t.height+lp*2};var n=Math.max(e.width,t.width),i=Math.max(e.height,t.height);return{x:-n/2,y:-i/2,width:n,height:i}}function _A(e,t){return t=Ie(t),{bottom:t.top+e.height/2-lp,left:t.right-e.width/2+cp,top:t.bottom-e.height/2+lp,right:t.left+e.width/2-cp-Eg}}function wA(e){return vt(e,function(t){return S(t,"bpmn:Participant")})}var Sg="__targetRef_placeholder";function pp(e,t){te.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],Rg(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],Rg(o));function n(a,s,c){var l=a.get("dataInputAssociations");return vt(l,function(u){return u!==c&&u.targetRef===s})}function i(a,s){var c=a.get("properties"),l=vt(c,function(u){return u.name===Sg});return!l&&s&&(l=t.create("bpmn:Property",{name:Sg}),Bt(c,l)),l}function r(a,s){var c=i(a);c&&(n(a,c,s)||Lt(a.get("properties"),c))}function o(a){var s=a.context,c=s.connection,l=c.businessObject,u=c.target,f=u&&u.businessObject,p=s.newTarget,d=p&&p.businessObject,m=s.oldTarget||s.target,h=m&&m.businessObject,y=c.businessObject,v;h&&h!==f&&r(h,l),d&&d!==f&&r(d,l),f?(v=i(f,!0),y.targetRef=v):y.targetRef=null}}pp.$inject=["eventBus","bpmnFactory"],Ee(pp,te);function Rg(e){return function(t){var n=t.context,i=n.connection;if(S(i,"bpmn:DataInputAssociation"))return e(t)}}function oc(e){this._bpmnUpdater=e}oc.$inject=["bpmnUpdater"],oc.prototype.execute=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.newSemanticParent,r=e.newDiParent;return e.oldSemanticParent=t.$parent,e.oldDiParent=n.$parent,this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,r),[]},oc.prototype.revert=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.oldSemanticParent,r=e.oldDiParent;return this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,r),[]};function fp(e,t,n,i){te.call(this,i),t.registerHandler("dataStore.updateContainment",oc);function r(){return n.filter(function(s){return S(s,"bpmn:Participant")&&ie(s).processRef})[0]}function o(s){return s.children.filter(function(c){return S(c,"bpmn:DataStoreReference")&&!c.labelTarget})}function a(s,c){var l=s.businessObject||s;if(c=c||r(),c){var u=c.businessObject||c;t.execute("dataStore.updateContainment",{dataStoreBo:l,dataStoreDi:ot(s),newSemanticParent:u.processRef||u,newDiParent:ot(c)})}}this.preExecute("shape.create",function(s){var c=s.context,l=c.shape;S(l,"bpmn:DataStoreReference")&&l.type!=="label"&&(c.hints||(c.hints={}),c.hints.autoResize=!1)}),this.preExecute("elements.move",function(s){var c=s.context,l=c.shapes,u=l.filter(function(f){return S(f,"bpmn:DataStoreReference")});u.length&&(c.hints||(c.hints={}),c.hints.autoResize=l.filter(function(f){return!S(f,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,l=c.shape,u=l.parent;S(l,"bpmn:DataStoreReference")&&l.type!=="label"&&S(u,"bpmn:Collaboration")&&a(l)}),this.postExecute("shape.move",function(s){var c=s.context,l=c.shape,u=c.oldParent,f=l.parent;if(!S(u,"bpmn:Collaboration")&&S(l,"bpmn:DataStoreReference")&&l.type!=="label"&&S(f,"bpmn:Collaboration")){var p=S(u,"bpmn:Participant")?u:SA(u,"bpmn:Participant");a(l,p)}}),this.postExecute("shape.delete",function(s){var c=s.context,l=c.shape,u=e.getRootElement();qe(l,["bpmn:Participant","bpmn:SubProcess"])&&S(u,"bpmn:Collaboration")&&o(u).filter(function(f){return EA(f,l)}).forEach(function(f){a(f)})}),this.postExecute("canvas.updateRoot",function(s){var c=s.context,l=c.oldRoot,u=c.newRoot,f=o(l);f.forEach(function(p){S(u,"bpmn:Process")&&a(p,u)})})}fp.$inject=["canvas","commandStack","elementRegistry","eventBus"],Ee(fp,te);function EA(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 SA(e,t){for(;e.parent;){if(S(e.parent,t))return e.parent;e=e.parent}}var ac=Math.max,sc=Math.min,RA=20;function Cg(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function CA(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 AA(e,t){return{x:e.x+(t.left||0),y:e.y+(t.top||0),width:e.width-(t.left||0)+(t.right||0),height:e.height-(t.top||0)+(t.bottom||0)}}function cc(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return Fe(r)&&(i=(/top|left/.test(e)?sc:ac)(i,r)),Fe(o)&&(i=(/top|left/.test(e)?ac:sc)(i,o)),i}function PA(e,t){if(!t)return e;var n=Ie(e);return Vs({top:cc("top",n,t),right:cc("right",n,t),bottom:cc("bottom",n,t),left:cc("left",n,t)})}function MA(e,t,n,i){var r=Ie(t),o={top:/n/.test(e)?r.bottom-n.height:r.top,left:/w/.test(e)?r.right-n.width:r.left,bottom:/s/.test(e)?r.top+n.height:r.bottom,right:/e/.test(e)?r.left+n.width:r.right},a=i?Ie(i):o,s={top:sc(o.top,a.top),left:sc(o.left,a.left),bottom:ac(o.bottom,a.bottom),right:ac(o.right,a.right)};return Vs(s)}function wa(e,t){return typeof e<"u"?e:RA}function TA(e,t){var n,i,r,o;return typeof t=="object"?(n=wa(t.left),i=wa(t.right),r=wa(t.top),o=wa(t.bottom)):n=i=r=o=wa(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function kA(e){return!(e.waypoints||e.type==="label")}function Ag(e,t){var n;if(e.length===void 0?n=Ke(e.children,kA):n=e,n.length)return TA(Ft(n),t)}var cr=Math.abs;function OA(e,t){return Cg(Ie(t),Ie(e))}var DA=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Jn=30;function lc(e,t){return t=t||[],e.children.filter(function(n){S(n,"bpmn:Lane")&&(lc(n,t),t.push(n))}),t}function lr(e){return e.children.filter(function(t){return S(t,"bpmn:Lane")})}function ei(e){return Co(e,DA)||e}function IA(e,t){var n=ei(e),i=S(n,"bpmn:Process")?[]:[n],r=lc(n,i),o=Ie(e),a=Ie(t),s=OA(e,t),c=[],l=tn(e);return r.forEach(function(u){if(u!==e){var f=l?0:s.top,p=l?s.right:0,d=l?0:s.bottom,m=l?s.left:0,h=Ie(u);s.top&&(cr(h.bottom-o.top)<10&&(d=a.top-h.bottom),cr(h.top-o.top)<5&&(f=a.top-h.top)),s.left&&(cr(h.right-o.left)<10&&(p=a.left-h.right),cr(h.left-o.left)<5&&(m=a.left-h.left)),s.bottom&&(cr(h.top-o.bottom)<10&&(f=a.bottom-h.top),cr(h.bottom-o.bottom)<5&&(d=a.bottom-h.bottom)),s.right&&(cr(h.left-o.right)<10&&(m=a.right-h.left),cr(h.right-o.right)<5&&(p=a.right-h.right)),(f||p||d||m)&&c.push({shape:u,newBounds:AA(u,{top:f,right:p,bottom:d,left:m})})}}),c}var LA=500;function dp(e,t){te.call(this,e);function n(i,r){var o=tn(i),a=lr(r),s=[],c=[],l=[],u=[];if(Nr(a,function(y){return o?y.y>i.y?c.push(y):s.push(y):y.x>i.x?u.push(y):l.push(y),y.children}),!!a.length){var f;o?c.length&&s.length?f=i.height/2:f=i.height:u.length&&l.length?f=i.width/2:f=i.width;var p,d,m,h;s.length&&(p=t.calculateAdjustments(s,"y",f,i.y-10),t.makeSpace(p.movingShapes,p.resizingShapes,{x:0,y:f},"s")),c.length&&(d=t.calculateAdjustments(c,"y",-f,i.y+i.height+10),t.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:-f},"n")),l.length&&(m=t.calculateAdjustments(l,"x",f,i.x-10),t.makeSpace(m.movingShapes,m.resizingShapes,{x:f,y:0},"e")),u.length&&(h=t.calculateAdjustments(u,"x",-f,i.x+i.width+10),t.makeSpace(h.movingShapes,h.resizingShapes,{x:-f,y:0},"w"))}}this.postExecuted("shape.delete",LA,function(i){var r=i.context,o=r.hints,a=r.shape,s=r.oldParent;S(a,"bpmn:Lane")&&(o&&o.nested||n(a,s))})}dp.$inject=["eventBus","spaceTool"],Ee(dp,te);var Pg=500;function uc(e,t){t.invoke(te,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Pg,function(i){var r=i.elements;r.filter(function(o){var a=o.host;return Mg(o,a)}).map(function(o){return r.indexOf(o)}).forEach(function(o){i.elements[o]=n._replaceShape(r[o])})},!0),this.preExecute("elements.move",Pg,function(i){var r=i.shapes,o=i.newHost;r.forEach(function(a,s){var c=a.host;Mg(a,NA(r,c)?c:o)&&(r[s]=n._replaceShape(a))})},!0)}uc.$inject=["bpmnReplace","injector"],Ee(uc,te),uc.prototype._replaceShape=function(e){var t=BA(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function BA(e){var t=ie(e),n=t.eventDefinitions;return n&&n[0]}function Mg(e,t){return!Ye(e)&&S(e,"bpmn:BoundaryEvent")&&!t}function NA(e,t){return e.indexOf(t)!==-1}var pc=Math.round,$A=Math.max;function FA(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 jA(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var Tg=10;function HA(e,t){var n,i;for(n=0;i=e[n];n++)if(fa(i,t)<=Tg)return{point:e[n],bendpoint:!0,index:n};return null}function zA(e,t){var n=Lm(FA(t,Tg),jA(e)),i=n[0],r=n[n.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=$A(i.segment2,r.segment2)-1,{point:e[o],bendpoint:!0,index:o}):{point:{x:pc(i.x+r.x)/2,y:pc(i.y+r.y)/2},index:i.segment2}:{point:{x:pc(i.x),y:pc(i.y)},index:i.segment2}:null}function hp(e,t){return HA(e,t)||zA(e,t)}function mp(e,t,n){te.call(this,e);function i(r,o,a){var s=o.waypoints,c,l,u,f,p,d,m,h=r.outgoing.slice(),y=r.incoming.slice(),v;Fe(a.width)?v=Ne(a):v=a;var g=hp(s,v);if(g){if(c=s.slice(0,g.index),l=s.slice(g.index+(g.bendpoint?1:0)),!c.length||!l.length)return;u=g.bendpoint?s[g.index]:v,(c.length===1||!kg(r,c[c.length-1]))&&c.push(Og(u)),(l.length===1||!kg(r,l[0]))&&l.unshift(Og(u))}f=o.source,p=o.target,t.canConnect(f,r,o)&&(n.reconnectEnd(o,r,c||v),d=o),t.canConnect(r,p,o)&&(d?m=n.connect(r,p,{type:o.type,waypoints:l}):(n.reconnectStart(o,r,l||v),m=o));var b=[].concat(d&&Ke(y,function(x){return x.source===d.source})||[],m&&Ke(h,function(x){return x.target===m.target})||[]);b.length&&n.removeElements(b)}this.preExecute("elements.move",function(r){var o=r.newParent,a=r.shapes,s=r.delta,c=a[0];if(!(!c||!o)){o&&o.waypoints&&(r.newParent=o=o.parent);var l=Ne(c),u={x:l.x+s.x,y:l.y+s.y},f=vt(o.children,function(p){var d=t.canInsert(a,p);return d&&hp(p.waypoints,u)});f&&(r.targetFlow=f,r.position=u)}},!0),this.postExecuted("elements.move",function(r){var o=r.shapes,a=r.targetFlow,s=r.position;a&&i(o[0],a,s)},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;t.canInsert(a,o)&&(r.targetFlow=o,r.parent=o.parent)},!0),this.postExecuted("shape.create",function(r){var o=r.shape,a=r.targetFlow,s=r.position;a&&i(o,a,s)},!0)}Ee(mp,te),mp.$inject=["eventBus","bpmnRules","modeling"];function kg(e,t){var n=t.x,i=t.y;return n>=e.x&&n<=e.x+e.width&&i>=e.y&&i<=e.y+e.height}function Og(e){return W({},e)}function gp(e,t){te.call(this,e),this.preExecuted("connection.create",function(n){var i=n.context,r=i.connection,o=i.source,a=i.target,s=i.hints;if(!(s&&s.createElementsBehavior===!1)&&Po(r)){var c=[];S(o,"bpmn:EventBasedGateway")?c=a.incoming.filter(l=>l!==r&&Po(l)):c=a.incoming.filter(l=>l!==r&&Po(l)&&S(l.source,"bpmn:EventBasedGateway")),c.forEach(function(l){t.removeConnection(l)})}}),this.preExecuted("shape.replace",function(n){var i=n.context,r=i.newShape;if(S(r,"bpmn:EventBasedGateway")){var o=r.outgoing.filter(Po).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);o.forEach(function(a){a.incoming.filter(Po).forEach(function(s){const c=a.incoming.filter(Po).filter(function(l){return l.source===r});(s.source!==r||c.length>1)&&t.removeConnection(s)})})}})}gp.$inject=["eventBus","modeling"],Ee(gp,te);function Po(e){return S(e,"bpmn:SequenceFlow")}var fc=1500,Dg=2e3;function Ig(e,t,n){t.on(["create.hover","create.move","create.out","create.end","shape.move.hover","shape.move.move","shape.move.out","shape.move.end"],fc,function(i){var r=i.context,o=r.shape||i.shape,a=i.hover;S(a,"bpmn:Lane")&&!qe(o,["bpmn:Lane","bpmn:Participant"])&&(i.hover=ei(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(o.labelTarget||qe(o,["bpmn:Group","bpmn:TextAnnotation"]))&&(i.hover=s,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.hover","connect.out","connect.end","connect.cleanup","global-connect.hover","global-connect.out","global-connect.end","global-connect.cleanup"],fc,function(i){var r=i.hover;S(r,"bpmn:Lane")&&(i.hover=ei(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],fc,function(i){var r=i.context,o=i.hover,a=r.type;S(o,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=ei(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],fc,function(i){var r=i.context,o=r.start;S(o,"bpmn:Lane")&&(r.start=ei(o)||o)}),t.on("shape.move.start",Dg,function(i){var r=i.shape;S(r,"bpmn:Lane")&&(i.shape=ei(r)||r)}),t.on("spaceTool.move",Dg,function(i){var r=i.hover;r&&S(r,"bpmn:Lane")&&(i.hover=ei(r))})}Ig.$inject=["elementRegistry","eventBus","canvas"];var Lg=770;function yp(e,t,n,i){n.invoke(te,this);function r(s,c){var l=ie(s),u=c.categoryValue||l.categoryValueRef;u||(u=_g(e,l));var f=c.category||u.$parent||xg(e);l.categoryValueRef=u,u.$parent=f,c.categoryValue=u,c.category=f}function o(s,c){var l=ie(s),u=c.categoryValue||l.categoryValueRef,f=c.category||u&&u.$parent;u&&(c.categoryValue=u,c.category=f,l.categoryValueRef=null)}this.execute("label.create",function(s){var c=s.context,l=c.labelTarget;S(l,"bpmn:Group")&&r(l,c)}),this.revert("label.create",function(s){var c=s.context,l=c.labelTarget;S(l,"bpmn:Group")&&o(l,c)}),this.execute("shape.delete",function(s){var c=s.context,l=c.shape,u=ie(l);if(!(!S(l,"bpmn:Group")||l.labelTarget)){var f=c.categoryValue=u.categoryValueRef;f&&(c.category=f.$parent,u.categoryValueRef=null)}}),this.reverted("shape.delete",function(s){var c=s.context,l=c.shape;if(!(!S(l,"bpmn:Group")||l.labelTarget)){var u=c.category,f=c.categoryValue,p=ie(l);f&&(p.categoryValueRef=f,f.$parent=u)}}),this.execute("shape.create",function(s){var c=s.context,l=c.shape,u=c.hints||{};!S(l,"bpmn:Group")||l.labelTarget||u.createElementsBehavior===!1&&!ie(l).categoryValueRef&&!c.categoryValue||r(l,c)}),this.reverted("shape.create",function(s){var c=s.context,l=c.shape,u=c.hints||{};!S(l,"bpmn:Group")||l.labelTarget||u.createElementsBehavior===!1&&!ie(l).categoryValueRef&&!c.categoryValue||o(l,c)}),this.executed(["shape.move","shape.resize"],function(s){var c=s.context,l=c.shape;!S(l,"bpmn:Group")||l.labelTarget||ie(l).categoryValueRef||r(l,c)}),this.reverted(["shape.move","shape.resize"],function(s){var c=s.context,l=c.shape;!S(l,"bpmn:Group")||l.labelTarget||!c.categoryValue||o(l,c)});function a(s,c){var l=e.create(s.$type);return i.copyElement(s,l,null,c)}t.on("copyPaste.copyElement",Lg,function(s){var c=s.descriptor,l=s.element;if(!(!S(l,"bpmn:Group")||l.labelTarget)){var u=ie(l);if(u.categoryValueRef){var f=u.categoryValueRef;c.categoryValue=a(f,!0),f.$parent&&(c.category=a(f.$parent,!0))}}}),t.on("copyPaste.pasteElement",Lg,function(s){var c=s.descriptor,l=c.businessObject,u=c.categoryValue,f=c.category;u&&(u=l.categoryValueRef=a(u)),f&&(u.$parent=a(f)),delete c.category,delete c.categoryValue})}yp.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],Ee(yp,te);function vp(e,t,n,i){var r,o,a,s,c;return r=(i.y-n.y)*(t.x-e.x)-(i.x-n.x)*(t.y-e.y),r==0?null:(o=e.y-n.y,a=e.x-n.x,c=(i.x-n.x)*o-(i.y-n.y)*a,s=c/r,{x:Math.round(e.x+s*(t.x-e.x)),y:Math.round(e.y+s*(t.y-e.y))})}function Bg(e){function t(i,r,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=vp(i,r,o,a),l=vp(i,r,o,s),u;c&&l?Ng(c,o)>Ng(l,o)?u=l:u=c:u=c||l,i.original=u}function n(i){var r=i.waypoints;t(r[0],r[1],Ne(i.source)),t(r[r.length-1],r[r.length-2],Ne(i.target))}e.on("bpmnElement.added",function(i){var r=i.element;r.waypoints&&n(r)})}Bg.$inject=["eventBus"];function Ng(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function bp(e){te.call(this,e);var t=["bpmn:Participant","bpmn:Lane"];this.executed(["shape.move","shape.create","shape.resize"],function(n){var i=n.context.shape,r=ie(i),o=ot(i);if(qe(r,t)){var a=o.get("isHorizontal");a===void 0&&(a=!0),o.set("isHorizontal",a)}})}bp.$inject=["eventBus"],Ee(bp,te);function $g(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Fg(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function GA(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 VA(e,t,n){var i=[{n:e[0]-n[0],lambda:t[0]},{n:e[1]-n[1],lambda:t[1]}],r=i[0].n*t[0]+i[1].n*t[1],o=i[0].lambda*t[0]+i[1].lambda*t[1];return-r/o}function xp(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=VA([n.x,n.y],[r.x,r.y],[e.x,e.y]);return{x:n.x+o*r.x,y:n.y+o*r.y}}function jg(e,t){var n=xp(e,t),i={x:n.x-e.x,y:n.y-e.y};return $g(i)}function Ea(e,t){return $g({x:e.x-t.x,y:e.y-t.y})}var Hg=Math.sqrt,zg=Math.min,WA=Math.max,Gg=Math.abs;function Vg(e){return Math.pow(e,2)}function Sa(e,t){return Hg(Vg(e.x-t.x)+Vg(e.y-t.y))}function UA(e,t){var n=0,i,r,o,a,s,c,l,u,f,p,d;for(n=0;n<t.length-1;n++){if(i=t[n],r=t[n+1],Ug(i,r)?l=[i]:(o=Sa(e,i),a=Sa(e,r),c=zg(o,a),l=YA(i,r,e,c)),l.length<1)throw new Error("expected between [1, 2] circle -> line intersections");l.length===1&&(u={type:"bendpoint",position:l[0],segmentIndex:n,bendpointIndex:Ug(i,l[0])?n:n+1}),l.length===2&&(s=KA(l[0],l[1]),u={type:"segment",position:s,segmentIndex:n,relativeLocation:Sa(i,s)/Sa(i,r)}),f=Sa(u.position,e),(!d||p>f)&&(d=u,p=f)}return d}function YA(e,t,n,i){var r=t.x-e.x,o=t.y-e.y,a=n.x-e.x,s=n.y-e.y,c=r*r+o*o,l=r*a+o*s,u=a*a+s*s-i*i,f=l/c,p=u/c,d=f*f-p;if(d<0&&d>-1e-6&&(d=0),d<0)return[];var m=Hg(d),h=-f+m,y=-f-m,v={x:e.x-r*h,y:e.y-o*h};if(d===0)return[v];var g={x:e.x-r*y,y:e.y-o*y};return[v,g].filter(function(b){return qA(b,e,t)})}function qA(e,t,n){return Wg(e.x,t.x,n.x)&&Wg(e.y,t.y,n.y)}function Wg(e,t,n){return e>=zg(t,n)-dc&&e<=WA(t,n)+dc}function KA(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var dc=.1;function Ug(e,t){return Gg(e.x-t.x)<=dc&&Gg(e.y-t.y)<=dc}function XA(e,t,n,i){var r=n.segmentIndex,o=t.length-e.length;if(i.segmentMove){var a=i.segmentMove.segmentStartIndex,s=i.segmentMove.newSegmentStartIndex;return r===a?s:r>=s?r+o<s?s:r+o:r}if(i.bendpointMove){var c=i.bendpointMove.insert,l=i.bendpointMove.bendpointIndex,u;if(o===0)return r;if(r>=l&&(u=c?r+1:r-1),r<l&&(u=r,c&&n.type!=="bendpoint"&&l-1===r)){var f=qg(t,l);f<n.relativeLocation&&u++}return u}return o===0?r:i.connectionStart&&r===0?0:i.connectionEnd&&r===e.length-2?t.length-2:Math.floor((t.length-2)/2)}function Yg(e,t,n,i){var r=0,o=0,a={point:e,delta:{x:0,y:0}},s=UA(e,n),c=s.segmentIndex,l=XA(n,t,s,i);if(l<0||l>t.length-2||l===null)return a;var u=Kg(n,c),f=Kg(t,l),p=s.position,d=QA(u,p),m=ZA(u,f);if(s.type==="bendpoint"){var h=t.length-n.length,y=s.bendpointIndex,v=n[y];if(t.indexOf(v)!==-1)return a;if(h===0){var g=t[y];return r=g.x-s.position.x,o=g.y-s.position.y,{delta:{x:r,y:o},point:{x:e.x+r,y:e.y+o}}}h<0&&y!==0&&y<n.length-1&&(d=qg(n,y))}var b={x:(f[1].x-f[0].x)*d+f[0].x,y:(f[1].y-f[0].y)*d+f[0].y},x=GA({x:e.x-p.x,y:e.y-p.y},m);return r=b.x+x.x-e.x,o=b.y+x.y-e.y,{point:Bi(b),delta:Bi({x:r,y:o})}}function qg(e,t){var n=Ea(e[t-1],e[t]),i=Ea(e[t],e[t+1]),r=n/(n+i);return r}function ZA(e,t){var n=Fg(e),i=Fg(t);return i-n}function Kg(e,t){return[e[t],e[t+1]]}function QA(e,t){var n=Ea(e[0],e[1]),i=Ea(e[0],t);return n===0?0:i/n}function JA(e,t,n,i){var r=Ne(e);return Yg(r,t,n,i).delta}function Ra(e,t,n){var i=xa(t),r=xa(n),o=pi(e,i),a={x:o.x*(n.width/t.width),y:o.y*(n.height/t.height)};return Bi({x:r.x+a.x,y:r.y+a.y})}function Xg(e,t,n){var i=xa(e),r=xa(t),o=xa(n),a=pi(e,i),s=pi(i,r),c=eP(i,t,n);if(c)return c;var l={x:s.x*(n.width/t.width),y:s.y*(n.height/t.height)},u={x:o.x+l.x,y:o.y+l.y};return Bi({x:u.x+a.x-e.x,y:u.y+a.y-e.y})}function eP(e,t,n){var i=Ie(t),r=Ie(n);if(tP(i,r))return null;var o=cn(t,e),a,s,c;if(o==="top")a={x:0,y:r.bottom-i.bottom};else if(o==="bottom")a={x:0,y:r.top-i.top};else if(o==="right")a={x:r.left-i.left,y:0};else if(o==="left")a={x:r.right-i.right,y:0};else return null;return s={x:e.x+a.x,y:e.y+a.y},c=cn(n,s),c!==o?null:a}function tP(e,t){return nP(e,t)||iP(e,t)}function nP(e,t){return e.right!==t.right&&e.left!==t.left}function iP(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var Zg="name",Qg="text";function _p(e,t,n,i){te.call(this,e),this.postExecute("element.updateProperties",r),this.postExecute("element.updateModdleProperties",a=>{ie(a.context.element)===a.context.moddleElement&&r(a)});function r(a){var s=a.context,c=s.element,l=s.properties;if(Zg in l&&t.updateLabel(c,l[Zg]),Qg in l&&S(c,"bpmn:TextAnnotation")){var u=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},l[Qg]||"");t.updateLabel(c,l.text,u)}}this.postExecute(["shape.create","connection.create"],function(a){var s=a.context,c=s.hints||{};if(c.createElementsBehavior!==!1){var l=s.shape||s.connection;Ye(l)||!sr(l)||qn(l)&&t.updateLabel(l,qn(l))}}),this.postExecute("shape.delete",function(a){var s=a.context,c=s.labelTarget,l=s.hints||{};c&&l.unsetLabel!==!1&&t.updateLabel(c,null,null,{removeShape:!1})});function o(a){var s=a.context,c=s.connection,l=c.label,u=W({},s.hints),f=s.newWaypoints||c.waypoints,p=s.oldWaypoints;return typeof u.startChanged>"u"&&(u.startChanged=!!u.connectionStart),typeof u.endChanged>"u"&&(u.endChanged=!!u.connectionEnd),JA(l,f,p,u)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(a){var s=a.context,c=s.hints||{};if(c.labelBehavior!==!1){var l=s.connection,u=l.label,f;!u||!u.parent||(f=o(a),t.moveShape(u,f))}}),this.postExecute(["shape.replace"],function(a){var s=a.context,c=s.newShape,l=s.oldShape,u=ie(c);u&&sr(u)&&l.label&&c.label&&(c.label.x=l.label.x,c.label.y=l.label.y)}),this.preExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.hints||{};if(!(!Ye(c)||l.autoResize)){var u=s.newBounds,f=i.getDimensions(qn(c)||"",{box:u,style:i.getExternalStyle()}),p=Math.ceil(f.height),d=u.y!==c.y,m=c.y+c.height;s.newBounds={width:u.width,height:p,x:u.x,y:d?m-p:u.y}}}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.newBounds,u=s.oldBounds;if(Xs(c)){var f=c.label,p=Ne(f),d=aP(u),m=oP(p,d),h=rP(m,u,l);t.moveShape(f,h)}})}Ee(_p,te),_p.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function rP(e,t,n){var i=Ra(e,t,n);return Bi(pi(i,e))}function oP(e,t){if(t.length){var n=sP(e,t);return xp(e,n)}}function aP(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 sP(e,t){var n=t.map(function(r){return{line:r,distance:jg(e,r)}}),i=di(n,"distance");return i[0].line}function cP(e,t,n,i){return Yg(e,t,n,i).point}function wp(e,t){te.call(this,e);function n(i,r){var o=i.context,a=o.connection,s=W({},o.hints),c=o.newWaypoints||a.waypoints,l=o.oldWaypoints;return typeof s.startChanged>"u"&&(s.startChanged=!!s.connectionStart),typeof s.endChanged>"u"&&(s.endChanged=!!s.connectionEnd),cP(r,c,l,s)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(i){var r=i.context,o=r.connection,a=o.outgoing,s=o.incoming;s.forEach(function(c){var l=c.waypoints[c.waypoints.length-1],u=n(i,l),f=[].concat(c.waypoints.slice(0,-1),[u]);t.updateWaypoints(c,f)}),a.forEach(function(c){var l=c.waypoints[0],u=n(i,l),f=[].concat([u],c.waypoints.slice(1));t.updateWaypoints(c,f)})}),this.postExecute(["connection.move"],function(i){var r=i.context,o=r.connection,a=o.outgoing,s=o.incoming,c=r.delta;s.forEach(function(l){var u=l.waypoints[l.waypoints.length-1],f={x:u.x+c.x,y:u.y+c.y},p=[].concat(l.waypoints.slice(0,-1),[f]);t.updateWaypoints(l,p)}),a.forEach(function(l){var u=l.waypoints[0],f={x:u.x+c.x,y:u.y+c.y},p=[].concat([f],l.waypoints.slice(1));t.updateWaypoints(l,p)})})}Ee(wp,te),wp.$inject=["eventBus","modeling"];function hc(e,t,n){var i=gc(e),r=ey(i,t),o=i[0];return r.length?r[r.length-1]:Ra(o.original||o,n,t)}function mc(e,t,n){var i=gc(e),r=ey(i,t),o=i[i.length-1];return r.length?r[0]:Ra(o.original||o,n,t)}function Ep(e,t,n){var i=gc(e),r=Jg(t,n),o=i[0];return Ra(o.original||o,r,t)}function Sp(e,t,n){var i=gc(e),r=Jg(t,n),o=i[i.length-1];return Ra(o.original||o,r,t)}function Jg(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function gc(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function ey(e,t){var n=hn(e,uP);return Ke(n,function(i){return lP(i,t)})}function lP(e,t){return cn(t,e,1)==="intersect"}function uP(e){return e.original||e}function Rp(e,t){te.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,r=n.newShape;if(pP(i,r)){var o=fP(i);o.incoming.forEach(function(a){var s=mc(a,r,i);t.reconnectEnd(a,r,s)}),o.outgoing.forEach(function(a){var s=hc(a,r,i);t.reconnectStart(a,r,s)})}},!0)}Rp.$inject=["eventBus","modeling"],Ee(Rp,te);function pP(e,t){return S(e,"bpmn:Participant")&&Qe(e)&&S(t,"bpmn:Participant")&&!Qe(t)}function fP(e){var t=ua([e]),n=[],i=[];return t.forEach(function(r){r!==e&&(r.incoming.forEach(function(o){S(o,"bpmn:MessageFlow")&&n.push(o)}),r.outgoing.forEach(function(o){S(o,"bpmn:MessageFlow")&&i.push(o)}))},[]),{incoming:n,outgoing:i}}const dP=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function ty(e){const t=ie(e);if(!S(t,"bpmn:BoundaryEvent")&&!(S(t,"bpmn:StartEvent")&&vn(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:dP.some(i=>S(n[0],i))}function ny(e){return S(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function Cp(e,t){e.invoke(te,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,r=n.context.newShape,o=n.context.hints;if(!ty(r))return;const a=ny(r);if(o.targetElement&&o.targetElement[a]!==void 0)return;const c=ie(i).get(a),l=ie(r).get(a);c!==l&&t.updateProperties(r,{[a]:c})})}Cp.$inject=["injector","modeling"],Ee(Cp,te);function Ap(e,t){te.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,r=ot(i),o=r&&r.get("label"),a=o&&o.get("bounds");a&&t.updateModdleProperties(i,o,{bounds:void 0})},!0)}Ee(Ap,te),Ap.$inject=["eventBus","modeling"];function Pp(e,t,n){te.call(this,e),this.preExecute("shape.delete",function(i){var r=i.context.shape;if(!(r.incoming.length!==1||r.outgoing.length!==1)){var o=r.incoming[0],a=r.outgoing[0];if(!(!S(o,"bpmn:SequenceFlow")||!S(a,"bpmn:SequenceFlow"))&&t.canConnect(o.source,a.target,o)){var s=hP(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}Ee(Pp,te),Pp.$inject=["eventBus","bpmnRules","modeling"];function Mo(e){return e.original||e}function hP(e,t){var n=vp(Mo(e[e.length-2]),Mo(e[e.length-1]),Mo(t[1]),Mo(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[Mo(e[0]),Mo(t[t.length-1])]}function Mp(e,t){te.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,r=i.parent;S(i,"bpmn:Participant")&&(n.collaborationRoot=r)},!0),this.postExecute("shape.delete",function(n){var i=n.collaborationRoot;if(i&&!i.businessObject.participants.length){var r=t.makeProcess(),o=i.children.slice();t.moveElements(o,{x:0,y:0},r)}},!0)}Mp.$inject=["eventBus","modeling"],Ee(Mp,te);function Tp(e,t,n,i){te.call(this,e);var r=i.get("dragging",!1);function o(c){var l=c.source,u=c.target,f=c.parent;if(f){var p,d;S(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(l,u)||(d=!0),n.canConnectMessageFlow(l,u)&&(p="bpmn:MessageFlow")),S(c,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(l,u)||(d=!0),n.canConnectSequenceFlow(l,u)&&(p="bpmn:SequenceFlow")),d&&t.removeConnection(c),p&&t.connect(l,u,{type:p,waypoints:c.waypoints.slice()})}}function a(c){var l=c.context,u=l.connection,f=l.newSource||u.source,p=l.newTarget||u.target,d,m;d=n.canConnect(f,p),!(!d||d.type===u.type)&&(m=t.connect(f,p,{type:d.type,associationDirection:d.associationDirection,waypoints:u.waypoints.slice()}),u.parent&&t.removeConnection(u),l.connection=m,r&&s(u,m))}function s(c,l){var u=r.context(),f=u&&u.payload.previousSelection,p;!f||!f.length||(p=f.indexOf(c),p!==-1&&f.splice(p,1,l))}this.postExecuted("elements.move",function(c){var l=c.closure,u=l.allConnections;F(u,o)},!0),this.preExecute("connection.reconnect",a),this.postExecuted("element.updateProperties",function(c){var l=c.context,u=l.properties,f=l.element,p=f.businessObject,d;u.default&&(d=vt(f.outgoing,ao({id:f.businessObject.default.id})),d&&t.updateProperties(d,{conditionExpression:void 0})),u.conditionExpression&&p.sourceRef.default===p&&t.updateProperties(f.source,{default:void 0})})}Ee(Tp,te),Tp.$inject=["eventBus","modeling","bpmnRules","injector"];function yc(e,t,n,i,r,o){i.invoke(te,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=o,this.postExecuted(["elements.create"],500,function(a){var s=a.context,c=s.parent,l=s.elements,u=Tn(l,function(f,p){var d=t.canReplace([p],p.host||p.parent||c);return d?f.concat(d.replacements):f},[]);u.length&&this._replaceElements(l,u)},this),this.postExecuted(["elements.move"],500,function(a){var s=a.context,c=s.newParent,l=s.newHost,u=[];F(s.closure.topLevel,function(p){vn(p)?u=u.concat(p.children):u=u.concat(p)}),u.length===1&&l&&(c=l);var f=t.canReplace(u,c);f&&this._replaceElements(u,f.replacements,l)},this),this.postExecute(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,l=s.newShape,u=c.attachers,f;u&&u.length&&(f=t.canReplace(u,l),this._replaceElements(u,f.replacements))},this),this.postExecuted(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,l=s.newShape;r.unclaimId(c.businessObject.id,c.businessObject),r.updateProperties(l,{id:c.id})})}Ee(yc,te),yc.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,r=this._selection;F(t,function(o){var a={type:o.newElementType},s=n.get(o.oldElementId),c=e.indexOf(s);e[c]=i.replaceElement(s,a,{select:!1})}),t&&r.select(e)},yc.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var mP=1500,gP={width:140,height:120},kp={width:300,height:60},Op={width:60,height:300},vc={width:300,height:150},bc={width:150,height:300},iy={width:140,height:120},ry={width:100,height:40};function oy(e){e.on("resize.start",mP,function(t){var n=t.context,i=n.shape,r=n.direction,o=n.balanced;(S(i,"bpmn:Lane")||S(i,"bpmn:Participant"))&&(n.resizeConstraints=_P(i,r,o)),S(i,"bpmn:SubProcess")&&Qe(i)&&(n.minDimensions=iy),S(i,"bpmn:TextAnnotation")&&(n.minDimensions=ry)})}oy.$inject=["eventBus"];var ur=Math.abs,yP=Math.min,vP=Math.max;function ay(e,t,n,i){var r=e[t];e[t]=r===void 0?n:i(n,r)}function To(e,t,n){return ay(e,t,n,yP)}function ko(e,t,n){return ay(e,t,n,vP)}var bP={top:20,left:50,right:20,bottom:20},xP={top:50,left:20,right:20,bottom:20};function _P(e,t,n){var i=ei(e),r=!0,o=!0,a=lc(i,[i]),s=Ie(e),c={},l={},u=tn(e),f=u?kp:Op;/n/.test(t)?l.top=s.bottom-f.height:/e/.test(t)?l.right=s.left+f.width:/s/.test(t)?l.bottom=s.top+f.height:/w/.test(t)&&(l.left=s.right-f.width),a.forEach(function(m){var h=Ie(m);u?(h.top<s.top-10&&(r=!1),h.bottom>s.bottom+10&&(o=!1)):(h.left<s.left-10&&(r=!1),h.right>s.right+10&&(o=!1)),/n/.test(t)&&(n&&ur(s.top-h.bottom)<10&&ko(c,"top",h.top+f.height),ur(s.top-h.top)<5&&To(l,"top",h.bottom-f.height)),/e/.test(t)&&(n&&ur(s.right-h.left)<10&&To(c,"right",h.right-f.width),ur(s.right-h.right)<5&&ko(l,"right",h.left+f.width)),/s/.test(t)&&(n&&ur(s.bottom-h.top)<10&&To(c,"bottom",h.bottom-f.height),ur(s.bottom-h.bottom)<5&&ko(l,"bottom",h.top+f.height)),/w/.test(t)&&(n&&ur(s.left-h.right)<10&&ko(c,"left",h.left+f.width),ur(s.left-h.left)<5&&To(l,"left",h.right-f.width))});var p=i.children.filter(function(m){return!m.hidden&&!m.waypoints&&(S(m,"bpmn:FlowElement")||S(m,"bpmn:Artifact"))}),d=u?bP:xP;return p.forEach(function(m){var h=Ie(m);/n/.test(t)&&(!u||r)&&To(l,"top",h.top-d.top),/e/.test(t)&&(u||o)&&ko(l,"right",h.right+d.right),/s/.test(t)&&(!u||o)&&ko(l,"bottom",h.bottom+d.bottom),/w/.test(t)&&(u||r)&&To(l,"left",h.left-d.left)}),{min:l,max:c}}function sy(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function Oo(e){return e.originalEvent||e.srcEvent}function Dp(e){sy(e),sy(Oo(e))}function Hr(e){return e.pointers&&e.pointers.length&&(e=e.pointers[0]),e.touches&&e.touches.length&&(e=e.touches[0]),e?{x:e.clientX,y:e.clientY}:null}function cy(){return/mac/i.test(navigator.platform)}function ly(e,t){return(Oo(e)||e).button===t}function pr(e){return ly(e,0)}function wP(e){return ly(e,1)}function Ca(e){var t=Oo(e)||e;return pr(e)?cy()?t.metaKey:t.ctrlKey:!1}function xc(e){var t=Oo(e)||e;return pr(e)&&t.shiftKey}var uy=1001;function py(e,t){e.on("resize.start",uy+500,function(n){var i=n.context,r=i.shape;(S(r,"bpmn:Lane")||S(r,"bpmn:Participant"))&&(i.balanced=!Ca(n))}),e.on("resize.end",uy,function(n){var i=n.context,r=i.shape,o=i.canExecute,a=i.newBounds;if(S(r,"bpmn:Lane")||S(r,"bpmn:Participant"))return o&&(a=jm(a),t.resizeLane(r,a,i.balanced)),!1})}py.$inject=["eventBus","modeling"];var EP=500;function Ip(e,t,n,i,r){n.invoke(te,this);function o(u){return qe(u,["bpmn:ReceiveTask","bpmn:SendTask"])||SP(u,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(u){var f=e.getDefinitions(),p=f.get("rootElements");return!!vt(p,ao({id:u.id}))}function s(u){if(S(u,"bpmn:ErrorEventDefinition"))return"errorRef";if(S(u,"bpmn:EscalationEventDefinition"))return"escalationRef";if(S(u,"bpmn:MessageEventDefinition"))return"messageRef";if(S(u,"bpmn:SignalEventDefinition"))return"signalRef"}function c(u){if(qe(u,["bpmn:ReceiveTask","bpmn:SendTask"]))return u.get("messageRef");var f=u.get("eventDefinitions"),p=f[0];return p.get(s(p))}function l(u,f){if(qe(u,["bpmn:ReceiveTask","bpmn:SendTask"]))return u.set("messageRef",f);var p=u.get("eventDefinitions"),d=p[0];return d.set(s(d),f)}this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],function(u){var f=u.shape||u.element;if(o(f)){var p=ie(f),d=c(p),m;d&&!a(d)&&(m=e.getDefinitions().get("rootElements"),Bt(m,d),u.addedRootElement=d)}},!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],function(u){var f=u.addedRootElement;if(f){var p=e.getDefinitions().get("rootElements");Lt(p,f)}},!0),t.on("copyPaste.copyElement",function(u){var f=u.descriptor,p=u.element;if(!(p.labelTarget||!o(p))){var d=ie(p),m=c(d);m&&(f.referencedRootElement=m)}}),t.on("copyPaste.pasteElement",EP,function(u){var f=u.descriptor,p=f.businessObject,d=f.referencedRootElement;d&&(a(d)||(d=i.copyElement(d,r.create(d.$type))),l(p,d),delete f.referencedRootElement)})}Ip.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],Ee(Ip,te);function SP(e,t){return Be(t)||(t=[t]),Xi(t,function(n){return Eo(e,n)})}var fy=Math.max;function dy(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,r=t.start,o={};return F(n,function(a){var s=a.id;S(a,"bpmn:Participant")&&(o[s]=CP(a,i,r)),S(a,"bpmn:Lane")&&(o[s]=tn(a)?kp:Op),S(a,"bpmn:SubProcess")&&Qe(a)&&(o[s]=iy),S(a,"bpmn:TextAnnotation")&&(o[s]=ry),S(a,"bpmn:Group")&&(o[s]=gP)}),o})}dy.$inject=["eventBus"];function RP(e){return e==="x"}function CP(e,t,n){var i=tn(e);if(!MP(e))return i?vc:bc;var r=RP(t),o={};return r?i?o=vc:o={width:PP(e,n,r),height:bc.height}:i?o={width:vc.width,height:AP(e,n,r)}:o=bc,o}function AP(e,t,n){var i;return i=TP(e,t,n),fy(vc.height,i)}function PP(e,t,n){var i;return i=kP(e,t,n),fy(bc.width,i)}function MP(e){return!!lr(e).length}function TP(e,t,n){var i=lr(e),r;return r=Lp(i,t,n),e.height-r.height+kp.height}function kP(e,t,n){var i=lr(e),r;return r=Lp(i,t,n),e.width-r.width+Op.width}function Lp(e,t,n){var i,r,o;for(i=0;i<e.length;i++)if(r=e[i],!n&&t>=r.y&&t<=r.y+r.height||n&&t>=r.x&&t<=r.x+r.width)return o=lr(r),o.length?Lp(o,t,n):r}var hy="_plane";function my(e){var t=e.id;return OP(t)}function Ei(e){var t=e.id;return S(e,"bpmn:SubProcess")?gy(t):t}function zr(e){return gy(e)}function _c(e){var t=ot(e);return S(t,"bpmndi:BPMNPlane")}function gy(e){return e+hy}function OP(e){return e.replace(new RegExp(hy+"$"),"")}var yy=400,DP=600,vy={x:180,y:160};function ji(e,t,n,i,r,o,a){te.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=i,this._bpmnFactory=r,this._bpmnjs=o,this._elementRegistry=a;var s=this;function c(f){return S(f,"bpmn:SubProcess")&&!Qe(f)}function l(f){var p=f.shape,d=f.newRootElement,m=ie(p);d=s._addDiagram(d||m),f.newRootElement=e.addRootElement(d)}function u(f){var p=f.shape,d=ie(p);s._removeDiagram(d);var m=f.newRootElement=a.get(Ei(d));e.removeRootElement(m)}this.executed("shape.create",function(f){var p=f.shape;c(p)&&l(f)},!0),this.postExecuted("elements.create",function(f){var p=f.elements;F(p,function(d){if(c(d)){var m=a.get(Ei(d));if(!(!m||!d.children||!d.children.length)){var h=by(d);s._showRecursively(h),s._moveChildrenToShape(h,m)}}})},!0),this.reverted("shape.create",function(f){var p=f.shape;c(p)&&u(f)},!0),this.preExecute("shape.delete",function(f){var p=f.shape;!S(p,"bpmn:SubProcess")||!Qe(p)||F(ga([p]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(f){var p=f.shape;if(c(p)){var d=a.get(Ei(p));d&&n.removeElements(d.children.slice())}},!0),this.executed("shape.delete",function(f){var p=f.shape;c(p)&&u(f)},!0),this.reverted("shape.delete",function(f){var p=f.shape;c(p)&&l(f)},!0),this.preExecuted("shape.replace",function(f){var p=f.oldShape,d=f.newShape;!c(p)||!c(d)||(f.oldRoot=e.removeRootElement(Ei(p)))},!0),this.postExecuted("shape.replace",function(f){var p=f.newShape,d=f.oldRoot,m=e.findRoot(Ei(p));if(!(!d||!m)){var h=d.children;n.moveElements(h,{x:0,y:0},m)}},!0),this.executed("element.updateProperties",function(f){var p=f.element;if(S(p,"bpmn:SubProcess")){var d=f.properties,m=f.oldProperties,h=m.id,y=d.id;if(h!==y){if(_c(p)){a.updateId(p,zr(y)),a.updateId(h,y);return}var v=a.get(zr(h));v&&a.updateId(zr(h),zr(y))}}},!0),this.reverted("element.updateProperties",function(f){var p=f.element;if(S(p,"bpmn:SubProcess")){var d=f.properties,m=f.oldProperties,h=m.id,y=d.id;if(h!==y){if(_c(p)){a.updateId(p,zr(h)),a.updateId(y,h);return}var v=a.get(zr(y));v&&a.updateId(v,zr(h))}}},!0),t.on("element.changed",function(f){var p=f.element;if(_c(p)){var d=p,m=a.get(my(d));!m||m===d||t.fire("element.changed",{element:m})}}),this.executed("shape.toggleCollapse",yy,function(f){var p=f.shape;S(p,"bpmn:SubProcess")&&(Qe(p)?u(f):(l(f),s._showRecursively(p.children)))},!0),this.reverted("shape.toggleCollapse",yy,function(f){var p=f.shape;S(p,"bpmn:SubProcess")&&(Qe(p)?u(f):(l(f),s._showRecursively(p.children)))},!0),this.postExecuted("shape.toggleCollapse",DP,function(f){var p=f.shape;if(S(p,"bpmn:SubProcess")){var d=f.newRootElement;if(d)if(Qe(p))s._moveChildrenToShape(d.children.slice(),p),F(ga(p.children),h=>{n.moveShape(h.annotation,{x:0,y:0},p.parent),F(h.associations,y=>{n.moveConnection(y,{x:0,y:0},p.parent)})});else{s._disconnectSharedAnnotations(p);var m=by(p);s._moveChildrenToShape(m,d)}}},!0),t.on("copyPaste.createTree",function(f){var p=f.element,d=f.children;if(c(p)){var m=Ei(p),h=a.get(m);h&&d.push.apply(d,h.children)}}),t.on("copyPaste.copyElement",function(f){var p=f.descriptor,d=f.element,m=f.elements,h=d.parent,y=S(ot(h),"bpmndi:BPMNPlane");if(y){var v=my(h),g=vt(m,function(b){return b.id===v});g&&(p.parent=g.id)}}),t.on("copyPaste.pasteElement",function(f){var p=f.descriptor;p.parent&&(c(p.parent)||p.parent.hidden)&&(p.hidden=!0)})}Ee(ji,te),ji.prototype._moveChildrenToShape=function(e,t){var n=this._modeling;if(e.length){var i=e.filter(function(c){return!c.hidden});if(!i.length){n.moveElements(e,{x:0,y:0},t,{autoResize:!1});return}var r=Ft(i),o;if(!t.x)o={x:vy.x-r.x,y:vy.y-r.y};else{var a=Ne(t),s=Ne(r);o={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,o,t,{autoResize:!1})}},ji.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(lg(e).map(i=>i.annotation));n.size&&F(ga(e.children),i=>{n.has(i.annotation)&&F(i.associations,r=>{t.removeConnection(r)})})},ji.prototype._showRecursively=function(e,t){var n=this,i=[];return e.forEach(function(r){r.hidden=!!t,i=i.concat(r),r.children&&(i=i.concat(n._showRecursively(r.children,r.collapsed||t)))}),i},ji.prototype._addDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams;return e.businessObject||(e=this._createNewDiagram(e)),n.push(e.di.$parent),e},ji.prototype._createNewDiagram=function(e){var t=this._bpmnFactory,n=this._elementFactory,i=t.create("bpmndi:BPMNPlane",{bpmnElement:e}),r=t.create("bpmndi:BPMNDiagram",{plane:i});i.$parent=r;var o=n.createRoot({id:Ei(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return o},ji.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=vt(n,function(r){return r.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},ji.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function IP(e){var t=[];return F(ga(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function by(e){return e.children.slice().concat(IP(e.children)).concat(LP(e))}function LP(e){return ju(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function Bp(e,t){e.invoke(te,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,r=n.context.newShape;if(!(!S(r,"bpmn:SubProcess")||S(r,"bpmn:AdHocSubProcess")||!(S(i,"bpmn:Task")||S(i,"bpmn:CallActivity"))||!Qe(r))){var o=BP(r);t.createShape({type:"bpmn:StartEvent"},o,r)}})}Bp.$inject=["injector","modeling"],Ee(Bp,te);function BP(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function Np(e,t){te.call(this,e),this.preExecute("connection.create",function(n){const{target:i}=n;S(i,"bpmn:TextAnnotation")&&(n.parent=i.parent)},!0),this.preExecute(["shape.create","shape.resize","elements.move"],function(n){const i=n.shapes||[n.shape];i.length===1&&S(i[0],"bpmn:TextAnnotation")&&(n.hints=n.hints||{},n.hints.autoResize=!1)},!0),this.preExecute("shape.resize",function(n){var i=n.context,r=i.shape,o=i.hints||{};if(!(!S(r,"bpmn:TextAnnotation")||o.autoResize)){var a=i.newBounds,s=t.getTextAnnotationBounds(a,qn(r)||""),c=a.y!==r.y&&Math.abs(a.y+a.height-(r.y+r.height))<=1,l=r.y+r.height;i.newBounds={width:a.width,height:s.height,x:a.x,y:c?l-s.height:a.y}}})}Ee(Np,te),Np.$inject=["eventBus","textRenderer"];function $p(e,t){te.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(Qe(i))return;var r=ua(i);r.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();F(s,function(l){o(l,!0)}),F(c,function(l){o(l,!1)})});function o(a,s){r.indexOf(a.source)!==-1&&r.indexOf(a.target)!==-1||S(a,"bpmn:Association")&&(S(a.source,"bpmn:TextAnnotation")||S(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,i,Ne(i)):t.reconnectStart(a,i,Ne(i)))}},!0)}Ee($p,te),$p.$inject=["eventBus","modeling"];var Fp=500;function jp(e,t,n){te.call(this,e);function i(a){a.length&&a.forEach(function(s){s.type==="label"&&!s.businessObject.name&&(s.hidden=!0)})}function r(a,s){var c=a.children,l=s,u,f;return u=NP(c).concat([a]),f=Ag(u),f?(l.width=Math.max(f.width,l.width),l.height=Math.max(f.height,l.height),l.x=f.x+(f.width-l.width)/2,l.y=f.y+(f.height-l.height)/2):(l.x=a.x+(a.width-l.width)/2,l.y=a.y+(a.height-l.height)/2),l}function o(a,s){return{x:a.x+(a.width-s.width)/2,y:a.y+(a.height-s.height)/2,width:s.width,height:s.height}}this.executed(["shape.toggleCollapse"],Fp,function(a){var s=a.context,c=s.shape;S(c,"bpmn:SubProcess")&&(c.collapsed?ot(c).isExpanded=!1:(i(c.children),ot(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],Fp,function(a){var s=a.context,c=s.shape;c.collapsed?ot(c).isExpanded=!1:ot(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],Fp,function(a){var s=a.context.shape,c=t.getDefaultSize(s),l;s.collapsed?l=o(s,c):l=r(s,c),n.resizeShape(s,l,null,{autoResize:s.collapsed?!1:"nwse"})})}Ee(jp,te),jp.$inject=["eventBus","elementFactory","modeling"];function NP(e){return e.filter(function(t){return!t.hidden})}function Hp(e,t,n,i){t.invoke(te,this),this.preExecute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.businessObject;Ye(a)||(S(a,"bpmn:Participant")&&Qe(a)&&n.ids.unclaim(s.processRef.id),i.unclaimId(s.id,s))}),this.preExecute("connection.delete",function(r){var o=r.context,a=o.connection,s=a.businessObject;i.unclaimId(s.id,s)}),this.preExecute("canvas.updateRoot",function(){var r=e.getRootElement(),o=r.businessObject;S(r,"bpmn:Collaboration")&&n.ids.unclaim(o.id)})}Ee(Hp,te),Hp.$inject=["canvas","injector","moddle","modeling"];function zp(e,t){te.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,r=i.connection,o=r.source;$P(r,o)&&t.updateProperties(o,{default:null})})}Ee(zp,te),zp.$inject=["eventBus","modeling"];function $P(e,t){if(!S(e,"bpmn:SequenceFlow"))return!1;var n=ie(t),i=ie(e);return n.get("default")===i}var FP=500,jP=5e3,xy=["shape.create","shape.delete","shape.move","shape.resize"],_y=[...xy,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function Gp(e,t){te.call(this,e);var n;function i(){return n=n||new HP,n.enter(),n}function r(){if(!n)throw new Error("out of bounds release");return n}function o(){if(!n)throw new Error("out of bounds release");var a=n.leave();return a&&(t.updateLaneRefs(n.flowNodes,n.lanes),n=null),a}this.preExecute(_y,jP,function(){i()}),this.postExecuted(_y,FP,function(){o()}),this.preExecute(xy,function(a){var s=a.context,c=s.shape,l=r();!c||c.labelTarget||(S(c,"bpmn:Lane")&&l.addLane(c),S(c,"bpmn:FlowNode")&&l.addFlowNode(c))})}Gp.$inject=["eventBus","modeling"],Ee(Gp,te);function HP(){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 zP=500,GP=5e3,wy=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],Ey=[...wy,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function Vp(e,t){te.call(this,e);var n;function i(){return n=n||new VP,n.enter(),n}function r(){if(!n)throw new Error("out of bounds release");return n}function o(){if(!n)throw new Error("out of bounds release");var a=n.leave();return a&&(t.updateCategoryValueRefs(Array.from(n.affectedFlowElements),Array.from(n.affectedGroupEntries.values())),n=null),a}this.preExecute(Ey,GP,function(){i()}),this.postExecuted(Ey,zP,function(){o()}),this.preExecute(wy,function(a){var s=a.context.connection||a.context.shape,c=r();!s||s.labelTarget||(S(s,"bpmn:FlowElement")&&c.addFlowElement(s),S(s,"bpmn:Group")&&c.addGroup(s))}),this.preExecute("label.create",function(a){var s=a.context.labelTarget;S(s,"bpmn:Group")&&r().addGroup(s)})}Vp.$inject=["eventBus","modeling"],Ee(Vp,te);function VP(){this.affectedFlowElements=new Set,this.affectedGroupEntries=new Map,this.counter=0,this.addFlowElement=function(e){this.affectedFlowElements.add(e)},this.addGroup=function(e){this.affectedGroupEntries.has(e)||this.affectedGroupEntries.set(e,{categoryValue:e.businessObject.categoryValueRef,groupShape:e})},this.enter=function(){this.counter++},this.leave=function(){return this.counter--,!this.counter}}function Wp(e,t){te.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,r=i.elements;for(const o of r)WP(o)&&!YP(o)&&t.updateProperties(o,{isForCompensation:void 0})})}Ee(Wp,te),Wp.$inject=["eventBus","modeling"];function WP(e){const t=ie(e);return t&&t.isForCompensation}function UP(e){return e&&S(e,"bpmn:BoundaryEvent")&&Eo(e,"bpmn:CompensateEventDefinition")}function YP(e){return e.incoming.filter(n=>UP(n.source)).length>0}const qP={__init__:["adaptiveLabelPositioningBehavior","appendBehavior","artifactBehavior","associationBehavior","attachEventBehavior","boundaryEventBehavior","categoryRootElementReferenceBehavior","compensateBoundaryEventBehaviour","createBehavior","createDataObjectBehavior","createParticipantBehavior","dataInputAssociationBehavior","dataStoreBehavior","deleteLaneBehavior","detachEventBehavior","dropOnFlowBehavior","eventBasedGatewayBehavior","fixHoverBehavior","groupBehavior","importDockingFix","isHorizontalFix","labelBehavior","layoutConnectionBehavior","messageFlowBehavior","nonInterruptingBehavior","removeElementBehavior","removeEmbeddedLabelBoundsBehavior","removeParticipantBehavior","replaceConnectionBehavior","replaceElementBehaviour","resizeBehavior","resizeLaneBehavior","rootElementReferenceBehavior","spaceToolBehavior","subProcessPlaneBehavior","subProcessStartEventBehavior","textAnnotationBehavior","toggleCollapseConnectionBehaviour","toggleElementCollapseBehaviour","unclaimIdBehavior","updateFlowNodeRefsBehavior","updateCategoryValueRefsBehavior","unsetDefaultFlowBehavior","setCompensationActivityAfterPasteBehavior"],adaptiveLabelPositioningBehavior:["type",Ju],appendBehavior:["type",ep],associationBehavior:["type",np],attachEventBehavior:["type",nc],artifactBehavior:["type",tp],boundaryEventBehavior:["type",ip],categoryRootElementReferenceBehavior:["type",rp],compensateBoundaryEventBehaviour:["type",op],createBehavior:["type",ap],createDataObjectBehavior:["type",sp],createParticipantBehavior:["type",up],dataInputAssociationBehavior:["type",pp],dataStoreBehavior:["type",fp],deleteLaneBehavior:["type",dp],detachEventBehavior:["type",uc],dropOnFlowBehavior:["type",mp],eventBasedGatewayBehavior:["type",gp],fixHoverBehavior:["type",Ig],groupBehavior:["type",yp],importDockingFix:["type",Bg],isHorizontalFix:["type",bp],labelBehavior:["type",_p],layoutConnectionBehavior:["type",wp],messageFlowBehavior:["type",Rp],nonInterruptingBehavior:["type",Cp],removeElementBehavior:["type",Pp],removeEmbeddedLabelBoundsBehavior:["type",Ap],removeParticipantBehavior:["type",Mp],replaceConnectionBehavior:["type",Tp],replaceElementBehaviour:["type",yc],resizeBehavior:["type",oy],resizeLaneBehavior:["type",py],rootElementReferenceBehavior:["type",Ip],spaceToolBehavior:["type",dy],subProcessPlaneBehavior:["type",ji],subProcessStartEventBehavior:["type",Bp],textAnnotationBehavior:["type",Np],toggleCollapseConnectionBehaviour:["type",$p],toggleElementCollapseBehaviour:["type",jp],unclaimIdBehavior:["type",Hp],unsetDefaultFlowBehavior:["type",zp],updateFlowNodeRefsBehavior:["type",Gp],updateCategoryValueRefsBehavior:["type",Vp],setCompensationActivityAfterPasteBehavior:["type",Wp]};function Up(e){this._commandStack=e.get("commandStack",!1)}Up.$inject=["injector"],Up.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const Si={__init__:["rules"],rules:["type",Up]};function ti(e){te.call(this,e),this.init()}ti.$inject=["eventBus"],Ee(ti,te),ti.prototype.addRule=function(e,t,n){var i=this;typeof e=="string"&&(e=[e]),e.forEach(function(r){i.canExecute(r,t,function(o,a,s){return n(o)},!0)})},ti.prototype.init=function(){};function Sy(e,t){var n=cn(e,t,-15);return n!=="intersect"?n:null}function un(e){ti.call(this,e)}Ee(un,ti),un.$inject=["eventBus"],un.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return KP(t)}),this.addRule("connection.create",function(e){var t=e.source,n=e.target,i=e.hints||{},r=i.targetParent,o=i.targetAttach;if(o)return!1;r&&(n.parent=r);try{return Ec(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return Ec(n,i,t)}),this.addRule("connection.updateWaypoints",function(e){return{type:e.connection.type}}),this.addRule("shape.resize",function(e){var t=e.shape,n=e.newBounds,i=e.direction;return Ny(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return ht(i)&&!Sc(t,i)?!1:kr(t,function(r){return ht(r)?Ec(r.source,r.target,r):r.host?Aa(r,r.host,null,n):Xp(r,i)})}),this.addRule("elements.move",function(e){var t=e.target,n=e.shapes,i=e.position,r=e.hints;return r!=null&&r.keyboardMove&&n.some(function(a){return ky(a)&&!n.includes(a.host)})?!1:Aa(n,t,null,i)||Ly(n,t,i)||By(n,t)||Sc(n,t)}),this.addRule("shape.create",function(e){return Xp(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return Aa(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return zy(n,t)})},un.prototype.canConnectMessageFlow=jy,un.prototype.canConnectSequenceFlow=Hy,un.prototype.canConnectDataAssociation=Zp,un.prototype.canConnectAssociation=$y,un.prototype.canConnectCompensationAssociation=Fy,un.prototype.canMove=By,un.prototype.canAttach=Aa,un.prototype.canReplace=Ly,un.prototype.canDrop=Do,un.prototype.canInsert=Sc,un.prototype.canCreate=Xp,un.prototype.canConnect=Ec,un.prototype.canResize=Ny,un.prototype.canCopy=zy;function KP(e){return Yp(e)?null:qe(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function Yp(e){return!e||Ye(e)}function Ry(e){do{if(S(e,"bpmn:Process"))return ie(e);if(S(e,"bpmn:Participant"))return ie(e).processRef||ie(e)}while(e=e.parent)}function qp(e){return S(e,"bpmn:TextAnnotation")}function Kp(e){return S(e,"bpmn:Group")&&!e.labelTarget}function Cy(e){return S(e,"bpmn:BoundaryEvent")&&Ri(e,"bpmn:CompensateEventDefinition")}function wc(e){return ie(e).isForCompensation}function XP(e,t){var n=Ry(e),i=Ry(t);return n===i}function ZP(e){return S(e,"bpmn:InteractionNode")&&!S(e,"bpmn:BoundaryEvent")&&(!S(e,"bpmn:Event")||S(e,"bpmn:ThrowEvent")&&My(e,"bpmn:MessageEventDefinition"))}function QP(e){return S(e,"bpmn:InteractionNode")&&!wc(e)&&(!S(e,"bpmn:Event")||S(e,"bpmn:CatchEvent")&&My(e,"bpmn:MessageEventDefinition"))&&!(S(e,"bpmn:BoundaryEvent")&&!Ri(e,"bpmn:MessageEventDefinition"))}function Ay(e){for(var t=e;t=t.parent;){if(S(t,"bpmn:FlowElementsContainer"))return ie(t);if(S(t,"bpmn:Participant"))return ie(t).processRef}return null}function Py(e,t){var n=Ay(e),i=Ay(t);return n===i}function Ri(e,t){var n=ie(e);return!!vt(n.eventDefinitions||[],function(i){return S(i,t)})}function My(e,t){var n=ie(e);return(n.eventDefinitions||[]).every(function(i){return S(i,t)})}function JP(e){return S(e,"bpmn:FlowNode")&&!S(e,"bpmn:EndEvent")&&!vn(e)&&!(S(e,"bpmn:IntermediateThrowEvent")&&Ri(e,"bpmn:LinkEventDefinition"))&&!Cy(e)&&!wc(e)}function eM(e){return S(e,"bpmn:FlowNode")&&!S(e,"bpmn:StartEvent")&&!S(e,"bpmn:BoundaryEvent")&&!vn(e)&&!(S(e,"bpmn:IntermediateCatchEvent")&&Ri(e,"bpmn:LinkEventDefinition"))&&!wc(e)}function tM(e){return S(e,"bpmn:ReceiveTask")||S(e,"bpmn:IntermediateCatchEvent")&&(Ri(e,"bpmn:MessageEventDefinition")||Ri(e,"bpmn:TimerEventDefinition")||Ri(e,"bpmn:ConditionalEventDefinition")||Ri(e,"bpmn:SignalEventDefinition"))}function nM(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function Ty(e,t){var n=nM(t);return n.indexOf(e)!==-1}function Ec(e,t,n){if(Yp(e)||Yp(t))return null;if(!S(n,"bpmn:DataAssociation")){if(jy(e,t))return{type:"bpmn:MessageFlow"};if(Hy(e,t))return{type:"bpmn:SequenceFlow"}}var i=Zp(e,t);return i||(Fy(e,t)?{type:"bpmn:Association",associationDirection:"One"}:$y(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function Do(e,t){return Ye(e)||Kp(e)?!0:S(t,"bpmn:Participant")&&!Qe(t)?!1:S(e,"bpmn:Participant")?S(t,"bpmn:Process")||S(t,"bpmn:Collaboration"):qe(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:S(e,"bpmn:Lane")?S(t,"bpmn:Participant")||S(t,"bpmn:Lane"):S(e,"bpmn:BoundaryEvent")&&!iM(e)?!1:S(e,"bpmn:FlowElement")&&!S(e,"bpmn:DataStoreReference")?S(t,"bpmn:FlowElementsContainer")?Qe(t):qe(t,["bpmn:Participant","bpmn:Lane"]):S(e,"bpmn:DataStoreReference")&&S(t,"bpmn:Collaboration")?Xi(ie(t).get("participants"),function(n){return!!n.get("processRef")}):qe(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?qe(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):S(e,"bpmn:MessageFlow")?S(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function iM(e){return ie(e).cancelActivity&&(Oy(e)||Dy(e))}function ky(e){return!Ye(e)&&S(e,"bpmn:BoundaryEvent")}function rM(e){return S(e,"bpmn:Lane")}function oM(e){return ky(e)||S(e,"bpmn:IntermediateThrowEvent")&&Oy(e)?!0:S(e,"bpmn:IntermediateCatchEvent")&&Dy(e)}function Oy(e){var t=ie(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function Dy(e){return Iy(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function Iy(e,t){return t.some(function(n){return Ri(e,n)})}function aM(e){return S(e,"bpmn:ReceiveTask")&&vt(e.incoming,function(t){return S(t.source,"bpmn:EventBasedGateway")})}function Aa(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var r=e[0];return Ye(r)||!oM(r)||vn(t)||!S(t,"bpmn:Activity")||wc(t)||i&&!Sy(i,t)||aM(t)?!1:"attach"}function Ly(e,t,n){if(!t)return!1;var i={replacements:[]};return F(e,function(r){vn(t)||S(r,"bpmn:StartEvent")&&r.type!=="label"&&Do(r,t)&&(mC(r)||i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),(gC(r)||yC(r)||vC(r))&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),Iy(r,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&S(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"})),S(t,"bpmn:Transaction")||Ri(r,"bpmn:CancelEventDefinition")&&r.type!=="label"&&(S(r,"bpmn:EndEvent")&&Do(r,t)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:EndEvent"}),S(r,"bpmn:BoundaryEvent")&&Aa(r,t,null,n)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function By(e,t){return Xi(e,rM)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return Do(n,t)})}function Xp(e,t,n,i){return t?Ye(e)||Kp(e)?!0:Do(e,t)||Sc(e,t):!1}function Ny(e,t,n){return S(e,"bpmn:SubProcess")?Qe(e)&&(!t||t.width>=100&&t.height>=80):S(e,"bpmn:Lane")||S(e,"bpmn:Participant")?!0:qp(e)?n?n==="e"||n==="w":!0:Kp(e)?!0:Ye(e)?n?n==="e"||n==="w":!0:!1}function sM(e,t){var n=qp(e),i=qp(t);return(n||i)&&n!==i}function $y(e,t){return Ty(t,e)||Ty(e,t)?!1:sM(e,t)?!0:!!Zp(e,t)}function Fy(e,t){return Py(e,t)&&Cy(e)&&S(t,"bpmn:Activity")&&!lM(t,e)&&!vn(t)}function jy(e,t){return Vy(e)&&!Vy(t)?!1:ZP(e)&&QP(t)&&!XP(e,t)}function Hy(e,t){return JP(e)&&eM(t)&&Py(e,t)&&!(S(e,"bpmn:EventBasedGateway")&&!tM(t))}function Zp(e,t){return qe(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&qe(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:qe(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&qe(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function Sc(e,t,n){if(!t)return!1;if(Array.isArray(e)){if(e.length!==1)return!1;e=e[0]}return t.source===e||t.target===e?!1:qe(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!Ye(t)&&S(e,"bpmn:FlowNode")&&!S(e,"bpmn:BoundaryEvent")&&Do(e,t.parent)}function Qp(e,t){return e&&t&&e.indexOf(t)!==-1}function zy(e,t){return Ye(t)?!0:!(S(t,"bpmn:Lane")&&!Qp(e,t.parent)||S(t,"bpmn:MessageFlow")&&!cM(e,t))}function cM(e,t){var n=Gy(t.source),i=Gy(t.target);return Qp(e,n)&&Qp(e,i)}function Gy(e){for(;e;e=e.parent)if(S(e,"bpmn:Participant"))return e;return null}function Vy(e){return Co(e,"bpmn:Process")||Co(e,"bpmn:Collaboration")}function lM(e,t){return e.attachers.includes(t)}const uM={__depends__:[Si],__init__:["bpmnRules"],bpmnRules:["type",un]};var pM=2e3;function Wy(e,t){e.on("saveXML.start",pM,n);function n(){var i=t.getRootElements();F(i,function(r){var o=ot(r),a,s;a=ua([r]),a=Ke(a,function(c){return c!==r&&!c.labelTarget}),s=hn(a,ot),o.set("planeElement",s)})}}Wy.$inject=["eventBus","canvas"];const fM={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",Wy]};function Rc(e){te.call(this,e);var t=this;this.preExecute(["shape.create","connection.create"],function(n){var i=n.context,r=i.shape||i.connection,o=i.parent,a=t.getOrdering(r,o);a&&(a.parent!==void 0&&(i.parent=a.parent),i.parentIndex=a.index)}),this.preExecute(["shape.move","connection.move"],function(n){var i=n.context,r=i.shape||i.connection,o=i.newParent||r.parent,a=t.getOrdering(r,o);a&&(a.parent!==void 0&&(i.newParent=a.parent),i.newParentIndex=a.index)})}Rc.prototype.getOrdering=function(e,t){return null},Ee(Rc,te);function Jp(e,t){Rc.call(this,e);var n=[{type:"bpmn:SubProcess",order:{level:6}},{type:"bpmn:SequenceFlow",order:{level:9,containers:["bpmn:Participant","bpmn:FlowElementsContainer"]}},{type:"bpmn:DataAssociation",order:{level:9,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:TextAnnotation",order:{level:9}},{type:"bpmn:MessageFlow",order:{level:9,containers:["bpmn:Collaboration"]}},{type:"bpmn:Association",order:{level:6,containers:["bpmn:Participant","bpmn:FlowElementsContainer","bpmn:Collaboration"]}},{type:"bpmn:BoundaryEvent",order:{level:8}},{type:"bpmn:Group",order:{level:10,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:FlowElement",order:{level:5}},{type:"bpmn:Participant",order:{level:-2}},{type:"bpmn:Lane",order:{level:-1}}];function i(a){if(a.labelTarget)return{level:10};var s=vt(n,function(c){return qe(a,[c.type])});return s&&s.order||{level:1}}function r(a){var s=a.order;if(s||(a.order=s=i(a)),!s)throw new Error(`no order for <${a.id}>`);return s}function o(a,s,c){for(var l=s;l&&!qe(l,c);)l=l.parent;if(!l)throw new Error(`no parent for <${a.id}> in <${s&&s.id}>`);return l}this.getOrdering=function(a,s){if(a.labelTarget||S(a,"bpmn:TextAnnotation"))return{parent:t.findRoot(s)||t.getRootElement(),index:-1};var c=r(a);c.containers&&(s=o(a,s,c.containers));var l=s.children.indexOf(a),u=Ld(s.children,function(f){return!a.labelTarget&&f.labelTarget?!1:c.level<r(f).level});return u!==-1&&l!==-1&&l<u&&(u-=1),{index:u,parent:s}}}Jp.$inject=["eventBus","canvas"],Ee(Jp,Rc);const dM={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",Jp]};function Pa(){}Pa.prototype.get=function(){return this._data},Pa.prototype.set=function(e){this._data=e},Pa.prototype.clear=function(){var e=this._data;return delete this._data,e},Pa.prototype.isEmpty=function(){return!this._data};const hM={clipboard:["type",Pa]};var Uy=1500;function Yy(e,t,n){var i=this,r=n.get("dragging",!1);function o(a){if(!a.hover){var s=a.originalEvent,c=i._findTargetGfx(s),l=c&&e.get(c);c&&l&&(a.stopPropagation(),r.hover({element:l,gfx:c}),r.move(s))}}r&&t.on("drag.start",function(a){t.once("drag.move",Uy,function(s){o(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",Uy,function(c){s&&t.fire("element.out",{element:s,gfx:a})}),t.on("element.out",function(){a=null,s=null})})(),this._findTargetGfx=function(a){var s,c;if(a instanceof MouseEvent)return s=Hr(a),c=document.elementFromPoint(s.x,s.y),mM(c)}}Yy.$inject=["elementRegistry","eventBus","injector"];function mM(e){return Lr(e,"svg, .djs-element",!0)}const gM={__init__:["hoverFix"],hoverFix:["type",Yy]};function yM(e){return!0}function Cc(e){return pr(e)||wP(e)}var qy=500;function Ky(e,t,n){var i=this;function r(P,B,D){if(!s(P,B)){var I,z,oe;D?z=t.getGraphics(D):(I=B.delegateTarget||B.target,I&&(z=I,D=t.get(z))),!(!z||!D)&&(oe=e.fire(P,{element:D,gfx:z,originalEvent:B}),oe===!1&&(B.stopPropagation(),B.preventDefault()))}}var o={};function a(P){return o[P]}function s(P,B){var D=l[P]||pr;return!D(B)}var c={click:"element.click",contextmenu:"element.contextmenu",dblclick:"element.dblclick",mousedown:"element.mousedown",mousemove:"element.mousemove",mouseover:"element.hover",mouseout:"element.out",mouseup:"element.mouseup"},l={"element.contextmenu":yM,"element.mousedown":Cc,"element.mouseup":Cc,"element.click":Cc,"element.dblclick":Cc};function u(P,B,D){var I=c[P];if(!I)throw new Error("unmapped DOM event name <"+P+">");return r(I,B,D)}var f="svg, .djs-element";function p(P,B,D,I){var z=o[D]=function(oe){r(D,oe)};I&&(l[D]=I),z.$delegate=On.bind(P,f,B,z)}function d(P,B,D){var I=a(D);I&&On.unbind(P,B,I.$delegate)}function m(P){F(c,function(B,D){p(P,D,B)})}function h(P){F(c,function(B,D){d(P,D,B)})}e.on("canvas.destroy",function(P){h(P.svg)}),e.on("canvas.init",function(P){m(P.svg)}),e.on(["shape.added","connection.added"],function(P){var B=P.element,D=P.gfx;e.fire("interactionEvents.createHit",{element:B,gfx:D})}),e.on(["shape.changed","connection.changed"],qy,function(P){var B=P.element,D=P.gfx;e.fire("interactionEvents.updateHit",{element:B,gfx:D})}),e.on("interactionEvents.createHit",qy,function(P){var B=P.element,D=P.gfx;i.createDefaultHit(B,D)}),e.on("interactionEvents.updateHit",function(P){var B=P.element,D=P.gfx;i.updateDefaultHit(B,D)});var y=C("djs-hit djs-hit-stroke"),v=C("djs-hit djs-hit-click-stroke"),g=C("djs-hit djs-hit-all"),b=C("djs-hit djs-hit-no-move"),x={all:g,"click-stroke":v,stroke:y,"no-move":b};function C(P,B){return B=W({stroke:"white",strokeWidth:15},B||{}),n.cls(P,["no-fill","no-border"],B)}function M(P,B){var D=x[B];if(!D)throw new Error("invalid hit type <"+B+">");return Se(P,D),P}function k(P,B){ze(P,B)}this.removeHits=function(P){var B=Ns(".djs-hit",P);F(B,Kt)},this.createDefaultHit=function(P,B){var D=P.waypoints,I=P.isFrame,z;return D?this.createWaypointsHit(B,D):(z=I?"stroke":"all",this.createBoxHit(B,z,{width:P.width,height:P.height}))},this.createWaypointsHit=function(P,B){var D=la(B);return M(D,"stroke"),k(P,D),D},this.createBoxHit=function(P,B,D){D=W({x:0,y:0},D);var I=Oe("rect");return M(I,B),Se(I,D),k(P,I),I},this.updateDefaultHit=function(P,B){var D=ft(".djs-hit",B);if(D)return P.waypoints?Fu(D,P.waypoints):Se(D,{width:P.width,height:P.height}),D},this.fire=r,this.triggerMouseEvent=u,this.mouseHandler=a,this.registerEvent=p,this.unregisterEvent=d}Ky.$inject=["eventBus","elementRegistry","styles"];const Ac={__init__:["interactionEvents"],interactionEvents:["type",Ky]};function Io(e,t){this._eventBus=e,this._canvas=t,this._selectedElements=new Set;var n=this;e.on(["shape.remove","connection.remove"],function(i){var r=i.element;n.deselect(r)}),e.on(["diagram.clear","root.set"],function(i){n.select(null)})}Io.$inject=["eventBus","canvas"],Io.prototype.deselect=function(e){if(this._selectedElements.has(e)){var t=this.get();this._selectedElements.delete(e),this._eventBus.fire("selection.changed",{oldSelection:t,newSelection:this.get()})}},Io.prototype.get=function(){return Array.from(this._selectedElements)},Io.prototype.isSelected=function(e){return this._selectedElements.has(e)},Io.prototype.select=function(e,t){var n=this.get();Be(e)||(e=e?[e]:[]);var i=this._canvas,r=i.getRootElement();e=e.filter(function(o){var a=i.findRoot(o);return r===a}),t?F(e,o=>{this._selectedElements.add(o)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var Xy="hover",Zy="selected";function Qy(e,t){this._canvas=e;function n(r,o){e.addMarker(r,o)}function i(r,o){e.removeMarker(r,o)}t.on("element.hover",function(r){n(r.element,Xy)}),t.on("element.out",function(r){i(r.element,Xy)}),t.on("selection.changed",function(r){function o(l){i(l,Zy)}function a(l){n(l,Zy)}var s=new Set(r.oldSelection),c=new Set(r.newSelection);for(let l of s)c.has(l)||o(l);for(let l of c)s.has(l)||a(l)})}Qy.$inject=["canvas","eventBus"];function Jy(e,t,n,i){e.on("create.end",500,function(r){var o=r.context,a=o.canExecute,s=o.elements,c=o.hints||{},l=c.autoSelect;if(a){if(l===!1)return;Be(l)?t.select(l):t.select(s.filter(vM))}}),e.on("connect.end",500,function(r){var o=r.context,a=o.connection;a&&t.select(a)}),e.on("shape.move.end",500,function(r){var o=r.previousSelection||[],a=i.get(r.context.shape.id),s=vt(o,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(r){if(pr(r)){var o=r.element;o===n.getRootElement()&&(o=null);var a=t.isSelected(o),s=t.get().length>1,c=xc(r);if(a&&s)return c?t.deselect(o):t.select(o);a?t.deselect(o):t.select(o,c)}})}Jy.$inject=["eventBus","selection","canvas","elementRegistry"];function vM(e){return!e.hidden}const ni={__init__:["selectionVisuals","selectionBehavior"],__depends__:[Ac],selection:["type",Io],selectionVisuals:["type",Qy],selectionBehavior:["type",Jy]};var bM=/^djs-cursor-.*$/;function Pc(e){var t=Ct(document.body);t.removeMatching(bM),e&&t.add("djs-cursor-"+e)}function ev(){Pc(null)}var xM=5e3;function tv(e,t){t=t||"element.click";function n(){return!1}return e.once(t,xM,n),function(){e.off(t,n)}}var _M=["c","C"],wM=["v","V"],EM=["d","D"],SM=["x","X"],RM=["y","Y"],nv=["z","Z"];function CM(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Ln(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function Xt(e,t){return e=Be(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function ef(e){return e.shiftKey}function AM(e){return Ln(e)&&Xt(_M,e)}function PM(e){return Ln(e)&&Xt(wM,e)}function MM(e){return Ln(e)&&Xt(EM,e)}function TM(e){return Ln(e)&&Xt(SM,e)}function kM(e){return Ln(e)&&!ef(e)&&Xt(nv,e)}function OM(e){return Ln(e)&&(Xt(RM,e)||Xt(nv,e)&&ef(e))}var Lo=Math.round,iv="djs-drag-active";function Gr(e){e.preventDefault()}function DM(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function IM(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function rv(e,t,n,i){var r={threshold:5,trapClick:!0},o;function a(b){var x=t.viewbox(),C=t._container.getBoundingClientRect();return{x:x.x+(b.x-C.left)/x.scale,y:x.y+(b.y-C.top)/x.scale}}function s(b,x){x=x||o;var C=e.createEvent(W({},x.payload,x.data,{isTouch:x.isTouch}));return e.fire("drag."+b,C)===!1?!1:e.fire(x.prefix+"."+b,C)}function c(b){var x=b.filter(function(C){return i.get(C.id)});x.length&&n.select(x)}function l(b,x){var C=o.payload,M=o.displacement,k=o.globalStart,P=Hr(b),B=pi(P,k),D=o.localStart,I=a(P),z=pi(I,D);if(!o.active&&(x||IM(B)>o.threshold)){if(W(C,{x:Lo(D.x+M.x),y:Lo(D.y+M.y),dx:0,dy:0},{originalEvent:b}),s("start")===!1)return y();o.active=!0,o.keepSelection||(C.previousSelection=n.get(),n.select(null)),o.cursor&&Pc(o.cursor),t.addMarker(t.getRootElement(),iv)}Dp(b),o.active&&(W(C,{x:Lo(I.x+M.x),y:Lo(I.y+M.y),dx:Lo(z.x),dy:Lo(z.y)},{originalEvent:b}),s("move"))}function u(b){var x,C=!0;o.active&&(b&&(o.payload.originalEvent=b,Dp(b)),C=s("end")),C===!1&&s("rejected"),x=v(C!==!0),s("ended",x)}function f(b){Xt("Escape",b)&&(Gr(b),y())}function p(b){var x;o.active&&(x=tv(e),setTimeout(x,400),Gr(b)),u(b)}function d(b){l(b)}function m(b){var x=o.payload;x.hoverGfx=b.gfx,x.hover=b.element,s("hover")}function h(b){s("out");var x=o.payload;x.hoverGfx=null,x.hover=null}function y(b){var x;if(o){var C=o.active;C&&s("cancel"),x=v(b),C&&s("canceled",x)}}function v(b){var x,C;s("cleanup"),ev(),o.trapClick?C=p:C=u,je.unbind(document,"mousemove",l),je.unbind(document,"dragstart",Gr),je.unbind(document,"selectstart",Gr),je.unbind(document,"mousedown",C,!0),je.unbind(document,"mouseup",C,!0),je.unbind(document,"keyup",f),je.unbind(document,"touchstart",d,!0),je.unbind(document,"touchcancel",y,!0),je.unbind(document,"touchmove",l,!0),je.unbind(document,"touchend",u,!0),e.off("element.hover",m),e.off("element.out",h),t.removeMarker(t.getRootElement(),iv);var M=o.payload.previousSelection;return b!==!1&&M&&!n.get().length&&c(M),x=o,o=null,x}function g(b,x,C,M){o&&y(!1),typeof x=="string"&&(M=C,C=x,x=null),M=W({},r,M||{});var k=M.data||{},P,B,D,I,z;if(M.trapClick?I=p:I=u,b?(P=Oo(b)||b,B=Hr(b),Dp(b),P.type==="dragstart"&&Gr(P)):(P=null,B={x:0,y:0}),D=a(B),x||(x=D),z=DM(P),o=W({prefix:C,data:k,payload:{},globalStart:B,displacement:pi(x,D),localStart:D,isTouch:z},M),M.manual||(z?(je.bind(document,"touchstart",d,!0),je.bind(document,"touchcancel",y,!0),je.bind(document,"touchmove",l,!0),je.bind(document,"touchend",u,!0)):(je.bind(document,"mousemove",l),je.bind(document,"dragstart",Gr),je.bind(document,"selectstart",Gr),je.bind(document,"mousedown",I,!0),je.bind(document,"mouseup",I,!0)),je.bind(document,"keyup",f),e.on("element.hover",m),e.on("element.out",h)),s("init")===!1)return y(),!1;M.autoActivate&&l(b,!0)}e.on("diagram.destroy",y),this.init=g,this.move=l,this.hover=m,this.out=h,this.end=u,this.cancel=y,this.context=function(){return o},this.setOptions=function(b){W(r,b)}}rv.$inject=["eventBus","canvas","selection","elementRegistry"];const Hi={__depends__:[gM,ni],dragging:["type",rv]};function Bo(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}Bo.prototype.next=function(){return this._prefix+ ++this._counter};const LM=new Bo("ps");var BM=["marker-start","marker-mid","marker-end"],NM=["circle","ellipse","line","path","polygon","polyline","path","rect"];function fr(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}fr.$inject=["elementRegistry","eventBus","canvas","styles"],fr.prototype.cleanUp=function(){console.warn("PreviewSupport#cleanUp is deprecated and will be removed in future versions. You do not need to manually clean up previews anymore. cf. https://github.com/bpmn-io/diagram-js/pull/906")},fr.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},fr.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var r=ym(n);return this._cloneMarkers($r(r),i),Se(r,this._styles.cls(i,[])),ze(t,r),Se(r,"data-preview-support-element-id",e.id),r},fr.prototype.addFrame=function(e,t){var n=Oe("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return ze(t,n),Se(n,"data-preview-support-element-id",e.id),n},fr.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(r=>{i._cloneMarkers(r,t,n)}),HM(e)&&BM.forEach(function(r){if(Se(e,r)){var o=$M(e,r,i._canvas.getContainer());o&&i._cloneMarker(n,e,o,r,t)}})},fr.prototype._cloneMarker=function(e,t,n,i,r="djs-dragger"){var o=[n.id,r,LM.next()].join("-"),a=ft("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||ym(n);s.id=o,et(s).add(r);var c=ft(":scope > defs",e);c||(c=Oe("defs"),ze(e,c)),ze(c,s);var l=jM(s.id);Se(t,i,l)};function $M(e,t,n){var i=FM(Se(e,t));return ft("marker#"+i,n||document)}function FM(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function jM(e){return"url(#"+e+")"}function HM(e){return NM.indexOf(e.nodeName)!==-1}const No={__init__:["previewSupport"],previewSupport:["type",fr]};var zM="drop-ok",ov="drop-not-ok",av="attach-ok",sv="new-parent",cv="create",GM=2e3;function lv(e,t,n,i,r){function o(c,l,u,f,p){if(!l)return!1;c=Ke(c,function(g){var b=g.labelTarget;return!g.parent&&!(Ye(g)&&c.indexOf(b)!==-1)});var d=vt(c,function(g){return!ht(g)}),m=!1,h=!1,y=!1;pv(c)&&(m=r.allowed("shape.attach",{position:u,shape:d,target:l})),m||(pv(c)?y=r.allowed("shape.create",{position:u,shape:d,source:f,target:l}):y=r.allowed("elements.create",{elements:c,position:u,target:l}));var v=p.connectionTarget;return y||m?(d&&f&&(h=r.allowed("connection.create",{source:v===f?d:f,target:v===f?f:d,hints:{targetParent:l,targetAttach:m}})),{attach:m,connect:h}):y===null||m===null?null:!1}function a(c,l){[av,zM,ov,sv].forEach(function(u){u===l?e.addMarker(c,u):e.removeMarker(c,u)})}n.on(["create.move","create.hover"],function(c){var l=c.context,u=l.elements,f=c.hover,p=l.source,d=l.hints||{};if(!f){l.canExecute=!1,l.target=null;return}uv(c);var m={x:c.x,y:c.y},h=l.canExecute=f&&o(u,f,m,p,d);f&&h!==null&&(l.target=f,h&&h.attach?a(f,av):a(f,h?sv:ov))}),n.on(["create.end","create.out","create.cleanup"],function(c){var l=c.hover;l&&a(l,null)}),n.on("create.end",function(c){var l=c.context,u=l.source,f=l.shape,p=l.elements,d=l.target,m=l.canExecute,h=m&&m.attach,y=m&&m.connect,v=l.hints||{};if(m===!1||!d)return!1;uv(c);var g={x:c.x,y:c.y};y?f=i.appendShape(u,f,g,d,{attach:h,connection:y===!0?{}:y,connectionTarget:v.connectionTarget}):(p=i.createElements(p,g,d,W({},v,{attach:h})),f=vt(p,function(b){return!ht(b)})),W(l,{elements:p,shape:f}),W(c,{elements:p,shape:f})});function s(){var c=t.context();c&&c.prefix===cv&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],GM,function(){n.off("elements.changed",s)})}),this.start=function(c,l,u){Be(l)||(l=[l]);var f=vt(l,function(m){return!ht(m)});if(f){u=W({elements:l,hints:{},shape:f},u||{}),F(l,function(m){Fe(m.x)||(m.x=0),Fe(m.y)||(m.y=0)});var p=Ke(l,function(m){return!m.hidden}),d=Ft(p);F(l,function(m){ht(m)&&(m.waypoints=hn(m.waypoints,function(h){return{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2}})),W(m,{x:m.x-d.x-d.width/2,y:m.y-d.y-d.height/2})}),t.init(c,cv,{cursor:"grabbing",autoActivate:!0,data:{shape:f,elements:l,context:u}})}}}lv.$inject=["canvas","dragging","eventBus","modeling","rules"];function uv(e){var t=e.context,n=t.createConstraints;n&&(n.left&&(e.x=Math.max(e.x,n.left)),n.right&&(e.x=Math.min(e.x,n.right)),n.top&&(e.y=Math.max(e.y,n.top)),n.bottom&&(e.y=Math.min(e.y,n.bottom)))}function pv(e){return e&&e.length===1&&!ht(e[0])}var VM=750;function fv(e,t,n,i,r){function o(a){var s=Oe("g");Se(s,r.cls("djs-drag-group",["no-events"]));var c=Oe("g");return a.forEach(function(l){var u;l.hidden||(l.waypoints?(u=n._createContainer("connection",c),n.drawConnection($r(u),l)):(u=n._createContainer("shape",c),n.drawShape($r(u),l),ln(u,l.x,l.y)),i.addDragger(l,s,u))}),s}t.on("create.move",VM,function(a){var s=a.hover,c=a.context,l=c.elements,u=c.dragGroup;u||(u=c.dragGroup=o(l));var f;s?(u.parentNode||(f=e.getActiveLayer(),ze(f,u)),ln(u,a.x,a.y)):Kt(u)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&Kt(c)})}fv.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const Mc={__depends__:[Hi,No,Si,ni],__init__:["create","createPreview"],create:["type",lv],createPreview:["type",fv]};function tf(e){var t=this;this._lastMoveEvent=null;function n(i){t._lastMoveEvent=i}e.on("canvas.init",function(i){var r=t._svg=i.svg;r.addEventListener("mousemove",n)}),e.on("canvas.destroy",function(){t._lastMouseEvent=null,t._svg.removeEventListener("mousemove",n)})}tf.$inject=["eventBus"],tf.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||WM(0,0)};function WM(e,t){var n=document.createEvent("MouseEvent"),i=e,r=t,o=e,a=t;return n.initMouseEvent&&n.initMouseEvent("mousemove",!0,!0,window,0,i,r,o,a,!1,!1,!1,!1,0,null),n}const Ma={__init__:["mouse"],mouse:["type",tf]};var dv=2e3;function Bn(e,t,n,i,r,o,a,s){this._canvas=e,this._create=t,this._elementFactory=i,this._eventBus=r,this._modeling=o,this._mouse=a,this._rules=s,r.on("copyPaste.copyElement",function(c){var l=c.descriptor,u=c.element,f=c.elementsSet;l.priority=1,l.id=u.id,f.has(u.parent)&&(l.parent=u.parent.id),UM(u)&&(l.priority=2,l.host=u.host.id),ht(u)&&(l.priority=3,l.source=u.source.id,l.target=u.target.id,l.waypoints=YM(u)),Ye(u)&&(l.priority=4,l.labelTarget=u.labelTarget.id),F(["x","y","width","height"],function(p){Fe(u[p])&&(l[p]=u[p])}),l.hidden=u.hidden,l.collapsed=u.collapsed}),r.on("copyPaste.elementsCopied",dv,function(c){var l;((l=c.hints)==null?void 0:l.clip)!==!1&&n.set(c.tree)}),r.on("copyPaste.pasteElements",dv,function(c){c.tree||(c.tree=n.get())}),r.on("copyPaste.pasteElements",function(c){var l=c.hints;W(l,{createElementsBehavior:!1})})}Bn.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],Bn.prototype.copy=function(e,t={}){var n,i;return Be(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(Be(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},Bn.prototype.paste=function(e={}){var t=this._eventBus.createEvent({type:"copyPaste.pasteElements",hints:{},...e}),n=this._eventBus.fire(t);if(n!==!1){var i=t.tree;if(i){var r=t.hints,o=this._createElements(i);if(t.element&&t.point)return this._paste(o,t.element,t.point,r);this._create.start(this._mouse.getLastMoveEvent(),o,{hints:r})}}},Bn.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},Bn.prototype.cut=function(e){var t=this.copy(e),n=this._getElementIdsFromTree(t),i=e.filter(function(r){return n[r.id]});return i.length>0&&this._modeling.removeElements(i),t},Bn.prototype._getElementIdsFromTree=function(e){var t={};return F(e,function(n){F(n,function(i){i.id&&(t[i.id]=!0)})}),t},Bn.prototype._paste=function(e,t,n,i){F(e,function(o){Fe(o.x)||(o.x=0),Fe(o.y)||(o.y=0)});var r=Ft(e);return F(e,function(o){ht(o)&&(o.waypoints=hn(o.waypoints,function(a){return{x:a.x-r.x-r.width/2,y:a.y-r.y-r.height/2}})),W(o,{x:o.x-r.x-r.width/2,y:o.y-r.y-r.height/2})}),this._modeling.createElements(e,n,t,W({},i))},Bn.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return F(e,function(o,a){o=di(o,"priority"),F(o,function(s){var c=W({},hi(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var l;if(ht(c)){c.source=i[s.source],c.target=i[s.target],l=i[s.id]=t.createConnection(c),r.push(l);return}if(Ye(c)){c.labelTarget=i[c.labelTarget],l=i[s.id]=t.createLabel(c),r.push(l);return}c.host&&(c.host=i[c.host]),l=i[s.id]=t.createShape(c),r.push(l)})}),r},Bn.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(hi(e,["id"]));return t},Bn.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(hi(e,["id"]));return t},Bn.prototype.createShape=function(e){var t=this._elementFactory.createShape(hi(e,["id"]));return t},Bn.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(ht(e)&&(!n.has(e.source)||!n.has(e.target))||Ye(e)&&!n.has(e.labelTarget))},Bn.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[],o=new Map,a=Hs(e);function s(f,p){return t.allowed("element.copy",{element:f,elements:p})}function c(f,p){var d=o.get(f);if(!d){var m={element:f,depth:p};r.push(m),o.set(f,m);return}if(d.depth<p){r=l(d,r);var h={element:d.element,depth:p};r.push(h),o.set(f,h)}}function l(f,p){var d=p.indexOf(f);return d!==-1&&p.splice(d,1),p}Nr(a,function(f,p,d){if(Ye(f))return;F(f.labels,function(y){c(y,d)});function m(y){y&&y.length&&F(y,function(v){F(v.labels,function(g){c(g,d)}),c(v,d)})}F([f.attachers,f.incoming,f.outgoing],m),c(f,d);var h=[];return f.children&&(h=f.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:f,children:h}),h}),e=hn(r,function(f){return f.element});var u=new Set(e);return r=hn(r,function(f){return f.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:f.descriptor,element:f.element,elements:e,elementsSet:u}),f}),r=di(r,function(f){return f.descriptor.priority}),e=hn(r,function(f){return f.element}),F(r,function(f){var p=f.depth;if(!n.hasRelations(f.element,e,u)){mv(f.element,e),u.delete(f.element);return}if(!s(f.element,e)){mv(f.element,e),u.delete(f.element);return}i[p]||(i[p]=[]),i[p].push(f.descriptor)}),i};function UM(e){return!!e.host}function YM(e){return hn(e.waypoints,function(t){return t=hv(t),t.original&&(t.original=hv(t.original)),t})}function hv(e){return W({},e)}function mv(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const qM={__depends__:[hM,Mc,Ma,Si],__init__:["copyPaste"],copyPaste:["type",Bn]};function nf(e,t,n){Be(n)||(n=[n]),F(n,function(i){Tr(e[i])||(t[i]=e[i])})}var rf=750;function gv(e,t,n){function i(c,l){var u=e.create(c.$type);return n.copyElement(c,u,null,l)}t.on("copyPaste.copyElement",rf,function(c){var l=c.descriptor,u=c.element,f=ie(u);if(Ye(u))return l;var p=l.businessObject=i(f,!0),d=l.di=i(ot(u),!0);d.bpmnElement=p,nf(p,l,"name"),nf(d,l,"isExpanded"),f.default&&(l.default=f.default.id)});var r="-bpmn-js-refs";function o(c){return c[r]=c[r]||{}}function a(c,l){c[r]=l}function s(c,l,u){var f=ie(c);return c.default&&(u[c.default]={element:f,property:"default"}),c.host&&(ie(c).attachedToRef=ie(l[c.host])),hi(u,Tn(u,function(p,d,m){var h=d.element,y=d.property;return m===c.id&&(h.set(y,f),p.push(c.id)),p},[]))}t.on("copyPaste.pasteElement",function(c){var l=c.cache,u=c.descriptor,f=u.businessObject,p=u.di;if(Ye(u)){u.businessObject=ie(l[u.labelTarget]),u.di=ot(l[u.labelTarget]);return}f=u.businessObject=i(f),p=u.di=i(p),p.bpmnElement=f,nf(u,f,["isExpanded","name"]),u.type=f.$type}),t.on("copyPaste.copyElement",rf,function(c){var l=c.descriptor,u=c.element;if(S(u,"bpmn:Participant")){var f=ie(u);f.processRef&&(l.processRef=i(f.processRef,!0))}}),t.on("copyPaste.pasteElement",function(c){var l=c.descriptor,u=l.processRef;u&&(l.processRef=i(u))}),t.on("copyPaste.createTree",function(c){var l=c.element,u=c.children;S(l,"bpmn:SubProcess")&&F(ga(u),f=>{u.push(f.annotation)})}),t.on("copyPaste.pasteElement",rf,function(c){var l=c.cache,u=c.descriptor;a(l,s(u,l,o(l)))})}gv.$inject=["bpmnFactory","eventBus","moddleCopy"];const KM=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],XM=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function Ta(e,t,n){this._bpmnFactory=t,this._eventBus=e,this._moddle=n,e.on("moddleCopy.canCopyProperties",i=>{const{propertyNames:r}=i;if(!(!r||!r.length))return di(r,o=>o==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:r,property:o,propertyName:a}=i,s=Qt(r)&&r.$descriptor;if(a&&XM.includes(a))return o;if(a&&KM.includes(a)||a&&s&&!vt(s.properties,ao({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",i=>{const{property:r}=i;if(S(r,"bpmn:ExtensionElements")&&(!r.values||!r.values.length))return!1})}Ta.$inject=["eventBus","bpmnFactory","moddle"],Ta.prototype.copyElement=function(e,t,n,i=!1){n&&!Be(n)&&(n=[n]),n=n||of(e.$descriptor);const r=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return r===!1||(Be(r)&&(n=r),F(n,o=>{let a;Mn(e,o)&&(a=e.get(o));const s=this.copyProperty(a,t,o,i);!Yt(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:o})===!1||t.set(o,s)})),t},Ta.prototype.copyProperty=function(e,t,n,i=!1){let r=this._eventBus.fire("moddleCopy.canCopyProperty",{parent:t,property:e,propertyName:n,clone:i});if(r===!1)return;if(r)return Qt(r)&&r.$type&&!r.$parent&&(r.$parent=t),r;const o=this._moddle.getPropertyDescriptor(t,n);if(!o.isReference)return o.isId?e&&this._copyId(e,t,i):Be(e)?Tn(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):Qt(e)&&e.$type?this._moddle.getElementDescriptor(e).isGeneric?void 0:(r=this._bpmnFactory.create(e.$type),r.$parent=t,r=this.copyElement(e,r,null,i),r):e},Ta.prototype._copyId=function(e,t,n=!1){if(n)return e;if(!this._moddle.ids.assigned(e))return this._moddle.ids.claim(e,t),e};function of(e,t){return Tn(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const yv={__depends__:[qM],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",gv],moddleCopy:["type",Ta]};var vv=Math.round;function af(e,t){this._modeling=e,this._eventBus=t}af.$inject=["modeling","eventBus"],af.prototype.replaceElement=function(e,t,n){if(e.waypoints)return null;var i=this._modeling,r=this._eventBus;r.fire("replace.start",{element:e,attrs:t,hints:n});var o=t.width||e.width,a=t.height||e.height,s=t.x||e.x,c=t.y||e.y,l=vv(s+o/2),u=vv(c+a/2),f=i.replaceShape(e,W({},t,{x:l,y:u,width:o,height:a}),n);return r.fire("replace.end",{element:e,newElement:f,hints:n}),f};function bv(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:r={}}=n;r.select!==!1&&e.select(i)})}bv.$inject=["selection","eventBus"];const ZM={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",bv],replace:["type",af]};function QM(e,t,n){Be(n)||(n=[n]),F(n,function(i){Tr(e[i])||(t[i]=e[i])})}var JM=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function eT(e,t){var n=e&&Mn(e,"collapsed")?e.collapsed:!Qe(e),i;return t&&(Mn(t,"collapsed")||Mn(t,"isExpanded"))?i=Mn(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function xv(e,t,n,i,r,o){function a(s,c,l){l=l||{};var u=c.type,f=s.businessObject;if(Tc(f)&&(u==="bpmn:SubProcess"||u==="bpmn:AdHocSubProcess")&&eT(s,c))return i.toggleCollapse(s),s;var p=e.create(u),d={type:u,businessObject:p};d.di={},u==="bpmn:ExclusiveGateway"&&(d.di.isMarkerVisible=!0),QM(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var m=of(f.$descriptor),h=of(p.$descriptor,!0),y=tT(m,h);W(p,li(c,JM));var v=Ke(y,function(x){return x==="eventDefinitions"?_v(s,c.eventDefinitionType):x==="loopCharacteristics"?!vn(p):Mn(p,x)||x==="processRef"&&c.isExpanded===!1||x==="triggeredByEvent"?!1:x==="isForCompensation"?!vn(p):!0});if(p=n.copyElement(f,p,v),c.eventDefinitionType&&(_v(p,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),S(f,"bpmn:Activity")){if(Tc(f))d.isExpanded=Qe(s);else if(c&&Mn(c,"isExpanded")){d.isExpanded=c.isExpanded;var g=t.getDefaultSize(p,{isExpanded:d.isExpanded});d.width=g.width,d.height=g.height,d.x=s.x-(d.width-s.width)/2,d.y=s.y-(d.height-s.height)/2}Qe(s)&&!S(f,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(Tc(f)&&!Tc(p)&&(l.moveChildren=!1),S(f,"bpmn:Participant")){c.isExpanded===!0?p.processRef=e.create("bpmn:Process"):l.moveChildren=!1;var b=tn(s);ot(s).isHorizontal||(ot(d).isHorizontal=b),d.width=b?s.width:t.getDefaultSize(d).width,d.height=b?t.getDefaultSize(d).height:s.height}return o.allowed("shape.resize",{shape:p})||(d.height=t.getDefaultSize(d).height,d.width=t.getDefaultSize(d).width),p.name=f.name,qe(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&qe(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(p.default=f.default),c.host&&!S(f,"bpmn:BoundaryEvent")&&S(p,"bpmn:BoundaryEvent")&&(d.host=c.host),(d.type==="bpmn:DataStoreReference"||d.type==="bpmn:DataObjectReference")&&(d.x=s.x+(s.width-d.width)/2),r.replaceElement(s,d,{...l,targetElement:c})}this.replaceElement=a}xv.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function Tc(e){return S(e,"bpmn:SubProcess")}function _v(e,t){var n=ie(e);return t&&n.get("eventDefinitions").some(function(i){return S(i,t)})}function tT(e,t){return e.filter(function(n){return t.includes(n)})}const wv={__depends__:[yv,ZM,ni],bpmnReplace:["type",xv]};var nT=250;function Vr(e){this._eventBus=e,this._tools=[],this._active=null}Vr.$inject=["eventBus"],Vr.prototype.registerTool=function(e,t){var n=this._tools;if(!t)throw new Error(`A tool has to be registered with it's "events"`);n.push(e),this.bindEvents(e,t)},Vr.prototype.isActive=function(e){return e&&this._active===e},Vr.prototype.length=function(e){return this._tools.length},Vr.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Vr.prototype.bindEvents=function(e,t){var n=this._eventBus,i=[];n.on(t.tool+".init",function(r){var o=r.context;if(!o.reactivate&&this.isActive(e)){this.setActive(null);return}this.setActive(e)},this),F(t,function(r){i.push(r+".ended"),i.push(r+".canceled")}),n.on(i,nT,function(r){this._active&&(iT(r)||this.setActive(null))},this)};function iT(e){var t=e.originalEvent&&e.originalEvent.target;return t&&Lr(t,'.group[data-group="tools"]')}const kc={__depends__:[Hi],__init__:["toolManager"],toolManager:["type",Vr]};function rT(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 oT(e,t){var n=[],i=new Set(e);F(t,function(o){i.add(o)});var r=new Set;return i.forEach(function(o){var a=o.incoming,s=o.outgoing;F(a.concat(s),function(c){var l=c.source,u=c.target;(i.has(l)||i.has(u))&&(r.has(c)||(r.add(c),n.push(c)))})}),n}function aT(e,t,n){var i=e.x,r=e.y,o=e.width,a=e.height,s=n.x,c=n.y;switch(t){case"n":return{x:i,y:r+c,width:o,height:a-c};case"s":return{x:i,y:r,width:o,height:a+c};case"w":return{x:i+s,y:r,width:o-s,height:a};case"e":return{x:i,y:r,width:o+s,height:a};default:throw new Error("unknown direction: "+t)}}var sf=Math.abs,sT=Math.round,zi={x:"width",y:"height"},Ev="crosshair",dr={n:"top",w:"left",s:"bottom",e:"right"},cT=1500,Oc={n:"s",w:"e",s:"n",e:"w"},Dc=20;function ii(e,t,n,i,r,o,a){this._canvas=e,this._dragging=t,this._eventBus=n,this._modeling=i,this._rules=r,this._toolManager=o,this._mouse=a;var s=this;o.registerTool("space",{tool:"spaceTool.selection",dragging:"spaceTool"}),n.on("spaceTool.selection.end",function(c){n.once("spaceTool.selection.ended",function(){s.activateMakeSpace(c.originalEvent)})}),n.on("spaceTool.move",cT,function(c){var l=c.context,u=l.initialized;u||(u=l.initialized=s.init(c,l)),u&&Rv(c)}),n.on("spaceTool.end",function(c){var l=c.context,u=l.axis,f=l.direction,p=l.movingShapes,d=l.resizingShapes,m=l.start;if(l.initialized){Rv(c);var h={x:0,y:0};h[u]=sT(c["d"+u]),s.makeSpace(p,d,h,f,m),n.once("spaceTool.ended",function(y){s.activateSelection(y.originalEvent,!0,!0)})}})}ii.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],ii.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:Ev,data:{context:{reactivate:n}},trapClick:!1})},ii.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:Ev,data:{context:{}}})},ii.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},ii.prototype.init=function(e,t){var n=sf(e.dx)>sf(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(sf(i)<5)return!1;i<0&&(i*=-1),Ca(e)&&(i*=-1);var o=rT(n,i),a=this._canvas.getRootElement();!xc(e)&&e.hover&&(a=e.hover);var s=[...ua(a),...a.attachers||[]],c=this.calculateAdjustments(s,n,i,r),l=this._eventBus.fire("spaceTool.getMinDimensions",{axis:n,direction:o,shapes:c.resizingShapes,start:r}),u=lT(c,n,o,r,l);return W(t,c,{axis:n,direction:o,spaceToolConstraints:u,start:r}),Pc("resize-"+(n==="x"?"ew":"ns")),!0},ii.prototype.calculateAdjustments=function(e,t,n,i){var r=this._rules,o=[],a=[],s=new Set,c=new Set,l=[],u=[];function f(d){s.has(d)||(s.add(d),o.push(d));var m=d.label;m&&!s.has(m)&&(s.add(m),o.push(m))}function p(d){c.has(d)||(c.add(d),a.push(d))}return F(e,function(d){if(!(!d.parent||Ye(d))){if(ht(d)){u.push(d);return}var m=d[t],h=m+d[zi[t]];if(uT(d)&&(n>0&&Ne(d)[t]>i||n<0&&Ne(d)[t]<i)){l.push(d);return}if(n>0&&m>i||n<0&&h<i){f(d);return}if(m<i&&h>i&&r.allowed("shape.resize",{shape:d})){p(d);return}}}),F(o,function(d){var m=d.attachers;m&&F(m,function(h){f(h)})}),F(l,function(d){var m=d.host;(s.has(m)||c.has(m))&&f(d)}),F(u,function(d){var m=d.source,h=d.target,y=d.label;(s.has(m)||c.has(m))&&(s.has(h)||c.has(h))&&y&&f(y)}),{movingShapes:o,resizingShapes:a}},ii.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},ii.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function Sv(e){return{top:e.top-Dc,right:e.right+Dc,bottom:e.bottom+Dc,left:e.left-Dc}}function Rv(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,r;Fe(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),Fe(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),Fe(n.top)&&(r=Math.max(e.y,n.top),e.dy=e.dy+r-e.y,e.y=r),Fe(n.bottom)&&(r=Math.min(e.y,n.bottom),e.dy=e.dy+r-e.y,e.y=r)}}function lT(e,t,n,i,r){var o=e.movingShapes,a=e.resizingShapes;if(a.length){var s={},c,l,u=new Set(o),f=new Set(a);return F(a,function(p){var d=p.attachers,m=p.children,h=Ie(p),y=Ke(m,function(z){return!ht(z)&&!Ye(z)&&!u.has(z)&&!f.has(z)}),v=Ke(m,function(z){return!ht(z)&&!Ye(z)&&u.has(z)}),g,b,x,C=[],M=[],k,P,B,D;y.length&&(b=Sv(Ie(Ft(y))),g=i-h[dr[n]]+b[dr[n]],n==="n"?s.bottom=l=Fe(l)?Math.min(l,g):g:n==="w"?s.right=l=Fe(l)?Math.min(l,g):g:n==="s"?s.top=c=Fe(c)?Math.max(c,g):g:n==="e"&&(s.left=c=Fe(c)?Math.max(c,g):g)),v.length&&(x=Sv(Ie(Ft(v))),g=i-x[dr[Oc[n]]]+h[dr[Oc[n]]],n==="n"?s.bottom=l=Fe(l)?Math.min(l,g):g:n==="w"?s.right=l=Fe(l)?Math.min(l,g):g:n==="s"?s.top=c=Fe(c)?Math.max(c,g):g:n==="e"&&(s.left=c=Fe(c)?Math.max(c,g):g)),d&&d.length&&(d.forEach(function(z){u.has(z)?C.push(z):M.push(z)}),C.length&&(k=Ie(Ft(C.map(Ne))),P=h[dr[Oc[n]]]-(k[dr[Oc[n]]]-i)),M.length&&(B=Ie(Ft(M.map(Ne))),D=B[dr[n]]-(h[dr[n]]-i)),n==="n"?(g=Math.min(P||1/0,D||1/0),s.bottom=l=Fe(l)?Math.min(l,g):g):n==="w"?(g=Math.min(P||1/0,D||1/0),s.right=l=Fe(l)?Math.min(l,g):g):n==="s"?(g=Math.max(P||-1/0,D||-1/0),s.top=c=Fe(c)?Math.max(c,g):g):n==="e"&&(g=Math.max(P||-1/0,D||-1/0),s.left=c=Fe(c)?Math.max(c,g):g));var I=r&&r[p.id];I&&(n==="n"?(g=i+p[zi[t]]-I[zi[t]],s.bottom=l=Fe(l)?Math.min(l,g):g):n==="w"?(g=i+p[zi[t]]-I[zi[t]],s.right=l=Fe(l)?Math.min(l,g):g):n==="s"?(g=i-p[zi[t]]+I[zi[t]],s.top=c=Fe(c)?Math.max(c,g):g):n==="e"&&(g=i-p[zi[t]]+I[zi[t]],s.left=c=Fe(c)?Math.max(c,g):g))}),s}}function uT(e){return!!e.host}var cf="djs-dragging",Cv="djs-resizing",pT=250,Ic=Math.max;function Av(e,t,n,i,r){function o(a,s){F(a,function(c){r.addDragger(c,s),n.addMarker(c,cf)})}e.on("spaceTool.selection.start",function(a){var s=n.getLayer("space"),c=a.context,l={x:"M 0,-10000 L 0,10000",y:"M -10000,0 L 10000,0"},u=Oe("g");Se(u,i.cls("djs-crosshair-group",["no-events"])),ze(s,u);var f=Oe("path");Se(f,"d",l.x),et(f).add("djs-crosshair"),ze(u,f);var p=Oe("path");Se(p,"d",l.y),et(p).add("djs-crosshair"),ze(u,p),c.crosshairGroup=u}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;ln(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&Kt(c)}),e.on("spaceTool.move",pT,function(a){var s=a.context,c=s.line,l=s.axis,u=s.movingShapes,f=s.resizingShapes;if(s.initialized){if(!s.dragGroup){var p=n.getLayer("space");c=Oe("path"),Se(c,"d","M0,0 L0,0"),et(c).add("djs-crosshair"),ze(p,c),s.line=c;var d=Oe("g");Se(d,i.cls("djs-drag-group",["no-events"])),ze(n.getActiveLayer(),d),o(u,d);var m=new Set(u);F(f,function(M){m.add(M)});var h=new Set,y=s.movingConnections=[];m.forEach(function(M){F(M.outgoing,function(k){h.has(k)||!ht(k)||!m.has(k.target)||(h.add(k),y.push(k))})}),o(y,d),s.dragGroup=d}if(!s.frameGroup){var v=Oe("g");Se(v,i.cls("djs-frame-group",["no-events"])),ze(n.getActiveLayer(),v);var g=[];F(f,function(M){var k=r.addFrame(M,v),P=k.getBBox();g.push({element:k,initialBounds:P}),n.addMarker(M,Cv)}),s.frameGroup=v,s.frames=g}var b={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};Se(c,{d:b[l]});var x={x:"y",y:"x"},C={x:a.dx,y:a.dy};C[x[s.axis]]=0,ln(s.dragGroup,C.x,C.y),F(s.frames,function(M){var k=M.element,P=M.initialBounds,B,D;s.direction==="e"?Se(k,{width:Ic(P.width+C.x,5)}):(B=Ic(P.width-C.x,5),Se(k,{width:B,x:P.x+P.width-B})),s.direction==="s"?Se(k,{height:Ic(P.height+C.y,5)}):(D=Ic(P.height-C.y,5),Se(k,{height:D,y:P.y+P.height-D}))})}}),e.on("spaceTool.cleanup",function(a){var s=a.context,c=s.movingShapes,l=s.movingConnections,u=s.resizingShapes,f=s.line,p=s.dragGroup,d=s.frameGroup;F(c,function(m){n.removeMarker(m,cf)}),F(l,function(m){n.removeMarker(m,cf)}),p&&(Kt(f),Kt(p)),F(u,function(m){n.removeMarker(m,Cv)}),d&&Kt(d)})}Av.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const fT={__init__:["spaceToolPreview"],__depends__:[Hi,Si,kc,No,Ma],spaceTool:["type",ii],spaceToolPreview:["type",Av]};function Lc(e,t){e.invoke(ii,this),this._canvas=t}Lc.$inject=["injector","canvas"],Ee(Lc,ii),Lc.prototype.calculateAdjustments=function(e,t,n,i){var r=this._canvas.getRootElement(),o=e[0]===r?null:e[0],a=[];o&&(a=ro(bo(r.children.filter(l=>S(l,"bpmn:Artifact")),Ft(o))));const s=[...e,...a];var c=ii.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(l){return!(S(l,"bpmn:TextAnnotation")||dT(l)&&(t==="y"&&tn(l)||t==="x"&&!tn(l)))}),c};function dT(e){return S(e,"bpmn:Participant")&&!ie(e).processRef}const Pv={__depends__:[fT],spaceTool:["type",Lc]};function Mt(e,t){this._handlerMap={},this._stack=[],this._stackIdx=-1,this._currentExecution={actions:[],dirty:[],trigger:null},this._injector=t,this._eventBus=e,this._uid=1,e.on(["diagram.destroy","diagram.clear"],function(){this.clear(!1)},this)}Mt.$inject=["eventBus","injector"],Mt.prototype.execute=function(e,t){if(!e)throw new Error("command required");this._currentExecution.trigger="execute";const n={command:e,context:t};this._pushAction(n),this._internalExecute(n),this._popAction()},Mt.prototype.canExecute=function(e,t){const n={command:e,context:t},i=this._getHandler(e);let r=this._fire(e,"canExecute",n);if(r===void 0){if(!i)return!1;i.canExecute&&(r=i.canExecute(t))}return r},Mt.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},Mt.prototype.undo=function(){let e=this._getUndoAction(),t;if(e){for(this._currentExecution.trigger="undo",this._pushAction(e);e&&(this._internalUndo(e),t=this._getUndoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}},Mt.prototype.redo=function(){let e=this._getRedoAction(),t;if(e){for(this._currentExecution.trigger="redo",this._pushAction(e);e&&(this._internalExecute(e,!0),t=this._getRedoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}},Mt.prototype.register=function(e,t){this._setHandler(e,t)},Mt.prototype.registerHandler=function(e,t){if(!e||!t)throw new Error("command and handlerCls must be defined");const n=this._injector.instantiate(t);this.register(e,n)},Mt.prototype.canUndo=function(){return!!this._getUndoAction()},Mt.prototype.canRedo=function(){return!!this._getRedoAction()},Mt.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},Mt.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},Mt.prototype._internalUndo=function(e){const t=e.command,n=e.context,i=this._getHandler(t);this._atomicDo(()=>{this._fire(t,"revert",e),i.revert&&this._markDirty(i.revert(n)),this._revertedAction(e),this._fire(t,"reverted",e)})},Mt.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);const i=t?[e+"."+t,t]:[e];let r;n=this._eventBus.createEvent(n);for(const o of i)if(r=this._eventBus.fire("commandStack."+o,n),n.cancelBubble)break;return r},Mt.prototype._createId=function(){return this._uid++},Mt.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},Mt.prototype._internalExecute=function(e,t){const n=e.command,i=e.context,r=this._getHandler(n);if(!r)throw new Error("no command handler registered for <"+n+">");this._pushAction(e),t||(this._fire(n,"preExecute",e),r.preExecute&&r.preExecute(i),this._fire(n,"preExecuted",e)),this._atomicDo(()=>{this._fire(n,"execute",e),r.execute&&this._markDirty(r.execute(i)),this._executedAction(e,t),this._fire(n,"executed",e)}),t||(this._fire(n,"postExecute",e),r.postExecute&&r.postExecute(i),this._fire(n,"postExecuted",e)),this._popAction()},Mt.prototype._pushAction=function(e){const t=this._currentExecution,n=t.actions,i=n[0];if(t.atomic)throw new Error("illegal invocation in <execute> or <revert> phase (action: "+e.command+")");e.id||(e.id=i&&i.id||this._createId()),n.push(e)},Mt.prototype._popAction=function(){const e=this._currentExecution,t=e.trigger,n=e.actions,i=e.dirty;n.pop(),n.length||(this._eventBus.fire("elements.changed",{elements:Bd("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},Mt.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=Be(e)?e:[e],t.dirty=t.dirty.concat(e))},Mt.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},Mt.prototype._revertedAction=function(e){this._stackIdx--},Mt.prototype._getHandler=function(e){return this._handlerMap[e]},Mt.prototype._setHandler=function(e,t){if(!e||!t)throw new Error("command and handler required");if(this._handlerMap[e])throw new Error("overriding handler for command <"+e+">");this._handlerMap[e]=t};const hT={commandStack:["type",Mt]};function hr(e,t){if(typeof t!="function")throw new Error("removeFn iterator must be a function");if(!e)return[];for(var n;n=e[0];)t(n);return e}var mT=250,Mv=1400;function lf(e,t,n){te.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",Mv,function(r){var o=r.context,a=o.shapes,s=o.validatedShapes;o.shapes=Tv(a),o.validatedShapes=Tv(s)}),i&&t.on("shape.move.start",mT,function(r){var o=r.context,a=new Set(o.shapes),s=new Set;for(const c of a)for(const l of c.labels)!l.hidden&&!a.has(l)&&s.add(l),c.labelTarget&&s.add(c);for(const c of s)i.makeDraggable(o,c,!0)}),this.preExecuted("elements.move",Mv,function(r){var o=r.context,a=o.closure,s=a.enclosedElements,c=[];F(s,function(l){F(l.labels,function(u){s[u.id]||c.push(u)})}),a.addAll(c)}),this.preExecute(["connection.delete","shape.delete"],function(r){var o=r.context,a=o.connection||o.shape;hr(a.labels,function(s){n.removeShape(s,{nested:!0})})}),this.execute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.labelTarget;s&&(o.labelTargetIndex=Hu(s.labels,a),o.labelTarget=s,a.labelTarget=null)}),this.revert("shape.delete",function(r){var o=r.context,a=o.shape,s=o.labelTarget,c=o.labelTargetIndex;s&&(Bt(s.labels,a,c),a.labelTarget=s)})}Ee(lf,te),lf.$inject=["injector","eventBus","modeling"];function Tv(e){var t=new Set(e);return Ke(e,function(n){return!t.has(n.labelTarget)})}const gT={__init__:["labelSupport"],labelSupport:["type",lf]};var yT=251,kv=1401,Ov="attach-ok";function uf(e,t,n,i,r){te.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",kv,function(a){var s=a.context,c=s.shapes,l=s.validatedShapes;s.shapes=vT(c),s.validatedShapes=bT(l)}),o&&t.on("shape.move.start",yT,function(a){var s=a.context,c=s.shapes,l=pf(c);F(l,function(u){o.makeDraggable(s,u,!0),F(u.labels,function(f){o.makeDraggable(s,f,!0)})})}),o&&t.on("shape.move.start",function(a){var s=a.context,c=s.shapes;if(c.length===1){var l=c[0],u=l.host;u&&(n.addMarker(u,Ov),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(u,Ov)}))}}),this.preExecuted("elements.move",kv,function(a){var s=a.context,c=s.closure,l=s.shapes,u=pf(l);F(u,function(f){c.add(f,c.topLevel[f.host.id])})}),this.postExecuted("elements.move",function(a){var s=a.context,c=s.shapes,l=s.newHost,u;l&&c.length!==1||(l?u=c:u=Ke(c,function(f){var p=f.host;return xT(f)&&!_T(c,p)}),F(u,function(f){r.updateAttachment(f,l)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;F(s,function(c){F(c.attachers,function(l){F(l.outgoing.slice(),function(u){var f=i.allowed("connection.reconnect",{connection:u,source:u.source,target:u.target});f||r.removeConnection(u)}),F(l.incoming.slice(),function(u){var f=i.allowed("connection.reconnect",{connection:u,source:u.source,target:u.target});f||r.removeConnection(u)})})})}),this.postExecute("shape.create",function(a){var s=a.context,c=s.shape,l=s.host;l&&r.updateAttachment(c,l)}),this.postExecute("shape.replace",function(a){var s=a.context,c=s.oldShape,l=s.newShape;hr(c.attachers,function(u){var f=i.allowed("elements.move",{target:l,shapes:[u]});f==="attach"?r.updateAttachment(u,l):r.removeShape(u)}),l.attachers.length&&F(l.attachers,function(u){var f=Xg(u,c,l);r.moveShape(u,f,u.parent)})}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.oldBounds,u=s.newBounds,f=c.attachers,p=s.hints||{};p.attachSupport!==!1&&F(f,function(d){var m=Xg(d,l,u);r.moveShape(d,m,d.parent),F(d.labels,function(h){r.moveShape(h,m,h.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;hr(s.attachers,function(c){r.removeShape(c)}),s.host&&r.updateAttachment(s,null)})}Ee(uf,te),uf.$inject=["injector","eventBus","canvas","rules","modeling"];function pf(e){return Kl(hn(e,function(t){return t.attachers||[]}))}function vT(e){var t=pf(e);return I0("id",e,t)}function bT(e){var t=oo(e,"id");return Ke(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function xT(e){return!!e.host}function _T(e,t){return e.indexOf(t)!==-1}const wT={__depends__:[Si],__init__:["attachSupport"],attachSupport:["type",uf]};function Dv(e,t,n,i){e.on("element.changed",function(r){var o=r.element;(o.parent||o===t.getRootElement())&&(r.gfx=n.getGraphics(o)),r.gfx&&e.fire(Rm(o)+".changed",r)}),e.on("elements.changed",function(r){var o=r.elements;o.forEach(function(a){e.fire("element.changed",{element:a})}),i.updateContainments(o)}),e.on("shape.changed",function(r){i.update("shape",r.element,r.gfx)}),e.on("connection.changed",function(r){i.update("connection",r.element,r.gfx)})}Dv.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const ff={__init__:["changeSupport"],changeSupport:["type",Dv]};function ri(e){this._model=e}ri.$inject=["moddle"],ri.prototype._needsId=function(e){return qe(e,["bpmn:RootElement","bpmn:FlowElement","bpmn:MessageFlow","bpmn:DataAssociation","bpmn:Artifact","bpmn:Participant","bpmn:Lane","bpmn:LaneSet","bpmn:Process","bpmn:Collaboration","bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane","bpmn:Property","bpmn:CategoryValue"])},ri.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;S(e,"bpmn:Activity")?t="Activity":S(e,"bpmn:Event")?t="Event":S(e,"bpmn:Gateway")?t="Gateway":qe(e,["bpmn:SequenceFlow","bpmn:MessageFlow"])?t="Flow":t=(e.$type||"").replace(/^[^:]*:/g,""),t+="_",!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e))},ri.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},ri.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},ri.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",W({bpmnElement:e,bounds:this.createDiBounds()},t))},ri.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},ri.prototype.createDiWaypoints=function(e){var t=this;return hn(e,function(n){return t.createDiWaypoint(n)})},ri.prototype.createDiWaypoint=function(e){return this.create("dc:Point",li(e,["x","y"]))},ri.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",W({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},ri.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",W({bpmnElement:e},t))};function Nn(e,t,n){te.call(this,e),this._bpmnFactory=t;var i=this;function r(d){var m=d.context,h=m.hints||{},y;!m.cropped&&h.createElementsBehavior!==!1&&(y=m.connection,y.waypoints=n.getCroppedWaypoints(y),m.cropped=!0)}this.executed(["connection.layout","connection.create"],r),this.reverted(["connection.layout"],function(d){delete d.context.cropped});function o(d){var m=d.context;i.updateParent(m.shape||m.connection,m.oldParent)}function a(d){var m=d.context,h=m.shape||m.connection,y=m.parent||m.newParent;i.updateParent(h,y)}this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],$n(o)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],$n(a));function s(d){var m=d.context,h=m.oldRoot,y=h.children;F(y,function(v){S(v,"bpmn:BaseElement")&&i.updateParent(v)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(d){var m=d.context.shape;S(m,"bpmn:BaseElement")&&i.updateBounds(m)}this.executed(["shape.move","shape.create","shape.resize"],$n(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],$n(function(d){d.context.shape.type!=="label"&&c(d)})),e.on("shape.changed",function(d){d.element.type==="label"&&c({context:{shape:d.element}})});function l(d){i.updateConnection(d.context)}this.executed(["connection.create","connection.move","connection.delete","connection.reconnect"],$n(l)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],$n(l));function u(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],$n(u)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],$n(u)),this.executed("connection.reconnect",$n(function(d){var m=d.context,h=m.connection,y=m.oldSource,v=m.newSource,g=ie(h),b=ie(y),x=ie(v);g.conditionExpression&&!qe(x,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(m.oldConditionExpression=g.conditionExpression,delete g.conditionExpression),y!==v&&b.default===g&&(m.oldDefault=b.default,delete b.default)})),this.reverted("connection.reconnect",$n(function(d){var m=d.context,h=m.connection,y=m.oldSource,v=m.newSource,g=ie(h),b=ie(y),x=ie(v);m.oldConditionExpression&&(g.conditionExpression=m.oldConditionExpression),m.oldDefault&&(b.default=m.oldDefault,delete x.default)}));function f(d){i.updateAttachment(d.context)}this.executed(["element.updateAttachment"],$n(f)),this.reverted(["element.updateAttachment"],$n(f)),this.executed("element.updateLabel",$n(p)),this.reverted("element.updateLabel",$n(p));function p(d){const{element:m}=d.context,h=qn(m),y=ot(m),v=y&&y.get("label");sr(m)||_c(m)||(h&&!v?y.set("label",t.create("bpmndi:BPMNLabel")):!h&&v&&y.set("label",void 0))}}Ee(Nn,te),Nn.$inject=["eventBus","bpmnFactory","connectionDocking"],Nn.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},Nn.prototype.updateParent=function(e,t){if(!Ye(e)&&!(S(e,"bpmn:DataStoreReference")&&e.parent&&S(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=ot(e),o=n&&n.businessObject,a=ot(n);S(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,o,t&&t.businessObject),S(e,"bpmn:DataOutputAssociation")&&(e.source?o=e.source.businessObject:o=null),S(e,"bpmn:DataInputAssociation")&&(e.target?o=e.target.businessObject:o=null),this.updateSemanticParent(i,o),S(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,o),this.updateDiParent(r,a)}},Nn.prototype.updateBounds=function(e){var t=ot(e),n=ST(e);if(n){var i=pi(n,t.get("bounds"));W(n,{x:e.x+i.x,y:e.y+i.y})}var r=Ye(e)?this._getLabel(t):t,o=r.bounds;o||(o=this._bpmnFactory.createDiBounds(),r.set("bounds",o)),W(o,{x:e.x,y:e.y,width:e.width,height:e.height})},Nn.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,r;S(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),Lt(i,e)),S(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),Bt(r,e))}},Nn.prototype.updateDiConnection=function(e,t,n){var i=ot(e),r=ot(t),o=ot(n);i.sourceElement&&i.sourceElement.bpmnElement!==ie(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==ie(n)&&(i.targetElement=n&&o)},Nn.prototype.updateDiParent=function(e,t){if(t&&!S(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(Lt(n,e),e.$parent=null)}};function ET(e){for(;e&&!S(e,"bpmn:Definitions");)e=e.$parent;return e}Nn.prototype.getLaneSet=function(e){var t,n;return S(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(S(e,"bpmn:Participant")&&(e=e.processRef),n=e.get("laneSets"),t=n[0],t||(t=this._bpmnFactory.create("bpmn:LaneSet"),t.$parent=e,n.push(t)),t)},Nn.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&!((S(e,"bpmn:DataInput")||S(e,"bpmn:DataOutput"))&&(S(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(S(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(S(e,"bpmn:FlowElement")){if(t){if(S(t,"bpmn:Participant"))t=t.processRef;else if(S(t,"bpmn:Lane"))do t=t.$parent.$parent;while(S(t,"bpmn:Lane"))}i="flowElements"}else if(S(e,"bpmn:Artifact")){for(;t&&!S(t,"bpmn:Process")&&!S(t,"bpmn:SubProcess")&&!S(t,"bpmn:Collaboration");)if(S(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;i="artifacts"}else if(S(e,"bpmn:MessageFlow"))i="messageFlows";else if(S(e,"bpmn:Participant")){i="participants";var r=e.processRef,o;r&&(o=ET(e.$parent||t),e.$parent&&(Lt(o.get("rootElements"),r),r.$parent=null),t&&(Bt(o.get("rootElements"),r),r.$parent=o))}else S(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":S(e,"bpmn:DataInputAssociation")&&(i="dataInputAssociations");if(!i)throw new Error(`no parent for <${e.id}> in <${t.id}>`);var a;if(e.$parent&&(a=e.$parent.get(i),Lt(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);Lt(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},Nn.prototype.updateConnectionWaypoints=function(e){var t=ot(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},Nn.prototype.updateConnection=function(e){var t=e.connection,n=ie(t),i=t.source,r=ie(i),o=t.target,a=ie(t.target),s;if(S(n,"bpmn:DataAssociation"))S(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=r,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):S(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||r,this.updateSemanticParent(n,r,s),n.targetRef=a);else{var c=S(n,"bpmn:SequenceFlow");n.sourceRef!==r&&(c&&(Lt(n.sourceRef&&n.sourceRef.get("outgoing"),n),r&&r.get("outgoing")&&r.get("outgoing").push(n)),n.sourceRef=r),n.targetRef!==a&&(c&&(Lt(n.targetRef&&n.targetRef.get("incoming"),n),a&&a.get("incoming")&&a.get("incoming").push(n)),n.targetRef=a)}this.updateConnectionWaypoints(t),this.updateDiConnection(t,i,o)},Nn.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function $n(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;S(i,"bpmn:BaseElement")&&e(t)}}function ST(e){if(S(e,"bpmn:Activity")){var t=ot(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function mr(e,t){Ni.call(this),this._bpmnFactory=e,this._moddle=t}Ee(mr,Ni),mr.$inject=["bpmnFactory","moddle"],mr.prototype._baseCreate=Ni.prototype.create,mr.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,W({type:"label",di:n},Fr,t))}return this.createElement(e,t)},mr.prototype.createElement=function(e,t){t=W({},t||{});var n,i=t.businessObject,r=t.di;if(!i){if(!t.type)throw new Error("no shape type specified");i=this._bpmnFactory.create(t.type)}if(!CT(r)){var o=W({},r||{},{id:i.id+"_di"});e==="root"?r=this._bpmnFactory.createDiPlane(i,o):e==="connection"?r=this._bpmnFactory.createDiEdge(i,o):r=this._bpmnFactory.createDiShape(i,o)}S(i,"bpmn:Group")&&(t=W({isFrame:!0},t)),t=RT(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=df(r,t,"isExpanded")),qe(i,["bpmn:Lane","bpmn:Participant"])&&(t=df(r,t,"isHorizontal")),S(i,"bpmn:SubProcess")&&(t.collapsed=!Qe(i,r)),S(i,"bpmn:ExclusiveGateway")&&(Mn(r,"isMarkerVisible")?r.isMarkerVisible===void 0&&(r.isMarkerVisible=!1):r.isMarkerVisible=!0),Yt(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),Yt(t.cancelActivity)&&(i.cancelActivity=t.cancelActivity,delete t.cancelActivity);var a,s;return t.eventDefinitionType&&(a=i.get("eventDefinitions")||[],s=this._bpmnFactory.create(t.eventDefinitionType,t.eventDefinitionAttrs),t.eventDefinitionType==="bpmn:ConditionalEventDefinition"&&(s.condition=this._bpmnFactory.create("bpmn:FormalExpression")),a.push(s),s.$parent=i,i.eventDefinitions=a,delete t.eventDefinitionType),n=this.getDefaultSize(i,r),t=W({id:i.id},n,t,{businessObject:i,di:r}),this._baseCreate(e,t)},mr.prototype.getDefaultSize=function(e,t){var n=ie(e);if(t=t||ot(e),S(n,"bpmn:SubProcess"))return Qe(n,t)?{width:350,height:200}:{width:100,height:80};if(S(n,"bpmn:Task"))return{width:100,height:80};if(S(n,"bpmn:Gateway"))return{width:50,height:50};if(S(n,"bpmn:Event"))return{width:36,height:36};if(S(n,"bpmn:Participant")){var i=t.isHorizontal===void 0||t.isHorizontal===!0;return Qe(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return S(n,"bpmn:Lane")?{width:400,height:100}:S(n,"bpmn:DataObjectReference")?{width:36,height:50}:S(n,"bpmn:DataStoreReference")?{width:50,height:50}:S(n,"bpmn:TextAnnotation")?{width:100,height:40}:S(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},mr.prototype.createParticipantShape=function(e){return Qt(e)||(e={isExpanded:e}),e=W({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function RT(e,t,n){return F(n,function(i){t=df(e,t,i)}),t}function df(e,t,n){return t[n]===void 0?t:(e[n]=t[n],hi(t,[n]))}function CT(e){return qe(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function Bc(e,t){this._modeling=e,this._canvas=t}Bc.$inject=["modeling","canvas"],Bc.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;F(n,function(r){var o={x:0,y:0};Yt(i.left)?o.x=i.left-r.x:Yt(i.right)?o.x=i.right-r.width-r.x:Yt(i.center)?o.x=i.center-Math.round(r.width/2)-r.x:Yt(i.top)?o.y=i.top-r.y:Yt(i.bottom)?o.y=i.bottom-r.height-r.y:Yt(i.middle)&&(o.y=i.middle-Math.round(r.height/2)-r.y),t.moveElements([r],o,r.parent)})},Bc.prototype.postExecute=function(e){};function Nc(e){this._modeling=e}Nc.$inject=["modeling"],Nc.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var n=e.target||t.parent,i=e.shape,r=e.hints||{};i=e.shape=this._modeling.createShape(i,e.position,n,{attach:r.attach}),e.shape=i},Nc.prototype.postExecute=function(e){var t=e.hints||{};AT(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 AT(e,t){return Xi(e.outgoing,function(n){return n.target===t})}function $c(e,t){this._canvas=e,this._layouter=t}$c.$inject=["canvas","layouter"],$c.prototype.execute=function(e){var t=e.connection,n=e.source,i=e.target,r=e.parent,o=e.parentIndex,a=e.hints;if(!n||!i)throw new Error("source and target required");if(!r)throw new Error("parent required");return t.source=n,t.target=i,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,a)),this._canvas.addConnection(t,r,o),t},$c.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var Fc=Math.round;function hf(e){this._modeling=e}hf.$inject=["modeling"],hf.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,r=e.position,o=e.hints,a=this._modeling;F(t,function(f){Fe(f.x)||(f.x=0),Fe(f.y)||(f.y=0)});var s=Ke(t,function(f){return!f.hidden}),c=Ft(s);F(t,function(f){ht(f)&&(f.waypoints=hn(f.waypoints,function(p){return{x:Fc(p.x-c.x-c.width/2+r.x),y:Fc(p.y-c.y-c.height/2+r.y)}})),W(f,{x:Fc(f.x-c.x-c.width/2+r.x),y:Fc(f.y-c.y-c.height/2+r.y)})});var l=new Set(Hs(t)),u={};F(t,function(f){if(ht(f)){u[f.id]=Fe(i)?a.createConnection(u[f.source.id],u[f.target.id],i,f,f.parent||n,o):a.createConnection(u[f.source.id],u[f.target.id],f,f.parent||n,o);return}var p=W({},o);l.has(f)||(p.autoResize=!1),Ye(f)&&(p=hi(p,["attach"])),u[f.id]=Fe(i)?a.createShape(f,li(f,["x","y","width","height"]),f.parent||n,i,p):a.createShape(f,li(f,["x","y","width","height"]),f.parent||n,p)}),e.elements=ro(u)};var Iv=Math.round;function gr(e){this._canvas=e}gr.$inject=["canvas"],gr.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,r=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return n.width!==void 0?W(t,n):W(t,{x:n.x-Iv(t.width/2),y:n.y-Iv(t.height/2)}),this._canvas.addShape(t,i,r),t},gr.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function ka(e){gr.call(this,e)}Ee(ka,gr),ka.$inject=["canvas"];var PT=gr.prototype.execute;ka.prototype.execute=function(e){var t=e.shape;return TT(t),t.labelTarget=e.labelTarget,PT.call(this,e)};var MT=gr.prototype.revert;ka.prototype.revert=function(e){return e.shape.labelTarget=null,MT.call(this,e)};function TT(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function Oa(e,t){this._canvas=e,this._modeling=t}Oa.$inject=["canvas","modeling"],Oa.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;hr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),hr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},Oa.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=Hu(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},Oa.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,Bt(n.children,t,i),this._canvas.addConnection(t,n),t};function mf(e,t){this._modeling=e,this._elementRegistry=t}mf.$inject=["modeling","elementRegistry"],mf.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;F(i,function(r){n.get(r.id)&&(r.waypoints?t.removeConnection(r):t.removeShape(r))})};function Da(e,t){this._canvas=e,this._modeling=t}Da.$inject=["canvas","modeling"],Da.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;hr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),hr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),hr(n.children,function(i){ht(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},Da.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=Hu(i.children,n),t.removeShape(n),n},Da.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return Bt(i.children,n,r),t.addShape(n,i),n};function jc(e){this._modeling=e}jc.$inject=["modeling"];var Lv={x:"y",y:"x"};jc.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(y,v){y.range.min=Math.min(v[i],y.range.min),y.range.max=Math.max(v[i]+v[r],y.range.max)}function a(y){return y[i]+y[r]/2}function s(y){return y.length-1}function c(y){return y.max-y.min}function l(y,v){var g={y:0};g[i]=y-a(v),g[i]&&(g[Lv[i]]=0,t.moveElements([v],g,v.parent))}var u=n[0],f=s(n),p=n[f],d,m,h=0;F(n,function(y,v){var g,b,x;if(y.elements.length<2){v&&v!==n.length-1&&(o(y,y.elements[0]),h+=c(y.range));return}g=di(y.elements,i),b=g[0],v===f&&(b=g[s(g)]),x=a(b),y.range=null,F(g,function(C){if(l(x,C),y.range===null){y.range={min:C[i],max:C[i]+C[r]};return}o(y,C)}),v&&v!==n.length-1&&(h+=c(y.range))}),m=Math.abs(p.range.min-u.range.max),d=Math.round((m-h)/(n.length-1)),!(d<n.length-1)&&F(n,function(y,v){var g={},b;y===u||y===p||(b=n[v-1],y.range.max=0,F(y.elements,function(x,C){g[Lv[i]]=0,g[i]=b.range.max-x[i]+d,y.range.min!==x[i]&&(g[i]+=x[i]-y.range.min),g[i]&&t.moveElements([x],g,x.parent),y.range.max=Math.max(x[i]+x[r],C?y.range.max:0)}))})},jc.prototype.postExecute=function(e){};function Hc(e,t){this._layouter=e,this._canvas=t}Hc.$inject=["layouter","canvas"],Hc.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return W(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},Hc.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function gf(){}gf.prototype.execute=function(e){var t=e.connection,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldParent=o,e.oldParentIndex=Lt(o.children,t),Bt(i.children,t,r),t.parent=i,F(t.waypoints,function(a){a.x+=n.x,a.y+=n.y,a.original&&(a.original.x+=n.x,a.original.y+=n.y)}),t},gf.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return Lt(n.children,t),Bt(i.children,t,r),t.parent=i,F(t.waypoints,function(a){a.x-=o.x,a.y-=o.y,a.original&&(a.original.x-=o.x,a.original.y-=o.y)}),t};function yf(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}yf.prototype.add=function(e,t){return this.addAll([e],t)},yf.prototype.addAll=function(e,t){var n=aR(e,!!t,this);return W(this,n),this};function Ia(e){this._modeling=e}Ia.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},Ia.prototype.moveClosure=function(e,t,n,i,r){var o=this._modeling,a=e.allShapes,s=e.allConnections,c=e.enclosedConnections,l=e.topLevel,u=!1;r&&r.parent===n&&(u=!0),F(a,function(f){o.moveShape(f,t,l[f.id]&&!u&&n,{recurse:!1,layout:!1})}),F(s,function(f){var p=!!a[f.source.id],d=!!a[f.target.id];c[f.id]&&p&&d?o.moveConnection(f,t,l[f.id]&&!u&&n):o.layoutConnection(f,{connectionStart:p&&Ep(f,f.source,t),connectionEnd:d&&Sp(f,f.target,t)})})},Ia.prototype.getClosure=function(e){return new yf().addAll(e,!0)};function zc(e){this._helper=new Ia(e)}zc.$inject=["modeling"],zc.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},zc.prototype.postExecute=function(e){var t=e.hints,n;t&&t.primaryShape&&(n=t.primaryShape,t.oldParent=n.parent),this._helper.moveClosure(e.closure,e.delta,e.newParent,e.newHost,n)};function Wr(e){this._modeling=e,this._helper=new Ia(e)}Wr.$inject=["modeling"],Wr.prototype.execute=function(e){var t=e.shape,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldBounds=li(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=Lt(o.children,t),Bt(i.children,t,r),W(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},Wr.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,r=this._modeling;i.layout!==!1&&(F(t.incoming,function(o){r.layoutConnection(o,{connectionEnd:Sp(o,t,n)})}),F(t.outgoing,function(o){r.layoutConnection(o,{connectionStart:Ep(o,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},Wr.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return Bt(n.children,t,i),W(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},Wr.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},Wr.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function La(e){this._modeling=e}La.$inject=["modeling"],La.prototype.execute=function(e){var t=e.newSource,n=e.newTarget,i=e.connection,r=e.dockingOrPoints;if(!t&&!n)throw new Error("newSource or newTarget required");return Be(r)&&(e.oldWaypoints=i.waypoints,i.waypoints=r),t&&(e.oldSource=i.source,i.source=t),n&&(e.oldTarget=i.target,i.target=n),i},La.prototype.postExecute=function(e){var t=e.connection,n=e.newSource,i=e.newTarget,r=e.dockingOrPoints,o=e.hints||{},a={};o.connectionStart&&(a.connectionStart=o.connectionStart),o.connectionEnd&&(a.connectionEnd=o.connectionEnd),o.layoutConnection!==!1&&(n&&(!i||o.docking==="source")&&(a.connectionStart=a.connectionStart||Bv(Be(r)?r[0]:r)),i&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||Bv(Be(r)?r[r.length-1]:r)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},La.prototype.revert=function(e){var t=e.oldSource,n=e.oldTarget,i=e.oldWaypoints,r=e.connection;return t&&(r.source=t),n&&(r.target=n),i&&(r.waypoints=i),r};function Bv(e){return e.original||e}function Gi(e,t){this._modeling=e,this._rules=t}Gi.$inject=["modeling","rules"],Gi.prototype.preExecute=function(e){var t=this,n=this._modeling,i=this._rules,r=e.oldShape,o=e.newData,a=e.hints||{},s;function c(m,h,y){return i.allowed("connection.reconnect",{connection:y,source:m,target:h})}var l={x:o.x,y:o.y},u={x:r.x,y:r.y,width:r.width,height:r.height};s=e.newShape=e.newShape||t.createShape(o,l,r.parent,a),r.host&&n.updateAttachment(s,r.host);var f;a.moveChildren!==!1&&(f=r.children.slice(),n.moveElements(f,{x:0,y:0},s,a));var p=r.incoming.slice(),d=r.outgoing.slice();F(p,function(m){var h=m.source,y=c(h,s,m);y&&t.reconnectEnd(m,s,mc(m,s,u),a)}),F(d,function(m){var h=m.target,y=c(s,h,m);y&&t.reconnectStart(m,s,hc(m,s,u),a)})},Gi.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},Gi.prototype.execute=function(e){},Gi.prototype.revert=function(e){},Gi.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},Gi.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},Gi.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function Ba(e){this._modeling=e}Ba.$inject=["modeling"],Ba.prototype.execute=function(e){var t=e.shape,n=e.newBounds,i=e.minBounds;if(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)throw new Error("newBounds must have {x, y, width, height} properties");if(i&&(n.width<i.width||n.height<i.height))throw new Error("width and height cannot be less than minimum height and width");if(!i&&n.width<10||n.height<10)throw new Error("width and height cannot be less than 10px");return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},W(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Ba.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,r=e.hints||{};r.layout!==!1&&(F(n.incoming,function(o){t.layoutConnection(o,{connectionEnd:mc(o,n,i)})}),F(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:hc(o,n,i)})}))},Ba.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return W(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function yr(e){this._modeling=e}yr.$inject=["modeling"],yr.prototype.preExecute=function(e){var t=e.delta,n=e.direction,i=e.movingShapes,r=e.resizingShapes,o=e.start,a={};this.moveShapes(i,t),F(r,function(s){a[s.id]=OT(s)}),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(oT(i,r),t,n,o,i,r,a)},yr.prototype.execute=function(){},yr.prototype.revert=function(){},yr.prototype.moveShapes=function(e,t){var n=this;F(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},yr.prototype.resizeShapes=function(e,t,n){var i=this;F(e,function(r){var o=aT(r,n,t);i._modeling.resizeShape(r,o,null,{attachSupport:!1,autoResize:!1,layout:!1})})},yr.prototype.updateConnectionWaypoints=function(e,t,n,i,r,o,a){var s=this,c=new Set(r),l=new Set(o);F(e,function(u){var f=u.source,p=u.target,d=kT(u),m=$v(n),h={},y=c.has(f)||l.has(f),v=c.has(p)||l.has(p);y&&v?(d=hn(d,function(g){return Fv(g,i,n)&&(g[m]=g[m]+t[m]),g.original&&Fv(g.original,i,n)&&(g.original[m]=g.original[m]+t[m]),g}),s._modeling.updateWaypoints(u,d,{labelBehavior:!1})):(y||v)&&(c.has(f)?h.connectionStart=Ep(u,f,t):c.has(p)?h.connectionEnd=Sp(u,p,t):l.has(f)?h.connectionStart=hc(u,f,a[f.id]):l.has(p)&&(h.connectionEnd=mc(u,p,a[p.id])),s._modeling.layoutConnection(u,h))})};function Nv(e){return W({},e)}function kT(e){return hn(e.waypoints,function(t){return t=Nv(t),t.original&&(t.original=Nv(t.original)),t})}function $v(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function Fv(e,t,n){var i=$v(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function OT(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function Gc(e){this._modeling=e}Gc.$inject=["modeling"],Gc.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=jv(n),t.collapsed=!t.collapsed;var i=Hv(n,t.collapsed);return[t].concat(i)},Gc.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,r=zv(i,n);return t.collapsed=!t.collapsed,[t].concat(r)};function jv(e){var t={};return F(e,function(n){t[n.id]=n.hidden,n.children&&(t=W({},t,jv(n.children)))}),t}function Hv(e,t){var n=[];return F(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(Hv(i.children,i.collapsed||t)))}),n}function zv(e,t){var n=[];return F(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(zv(i.children,t)))}),n}function Vc(e){this._modeling=e}Vc.$inject=["modeling"],Vc.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=Gv(i,t),Vv(n,t),t.host=n,t},Vc.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,Gv(n,t),Vv(i,t,r),t};function Gv(e,t){return Lt(e&&e.attachers,t)}function Vv(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),Bt(i,t,n)}}function vf(){}vf.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},vf.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function mt(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}mt.$inject=["eventBus","elementFactory","commandStack"],mt.prototype.getHandlers=function(){return{"shape.append":Nc,"shape.create":gr,"shape.delete":Da,"shape.move":Wr,"shape.resize":Ba,"shape.replace":Gi,"shape.toggleCollapse":Gc,spaceTool:yr,"label.create":ka,"connection.create":$c,"connection.delete":Oa,"connection.move":gf,"connection.layout":Hc,"connection.updateWaypoints":vf,"connection.reconnect":La,"elements.create":hf,"elements.move":zc,"elements.delete":mf,"elements.distribute":jc,"elements.align":Bc,"element.updateAttachment":Vc}},mt.prototype.registerHandlers=function(e){F(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},mt.prototype.moveShape=function(e,t,n,i,r){typeof i=="object"&&(r=i,i=null);var o={shape:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("shape.move",o)},mt.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},mt.prototype.moveElements=function(e,t,n,i){i=i||{};var r=i.attach,o=n,a;r===!0?(a=n,o=n.parent):r===!1&&(a=null);var s={shapes:e,delta:t,newParent:o,newHost:a,hints:i};this._commandStack.execute("elements.move",s)},mt.prototype.moveConnection=function(e,t,n,i,r){typeof i=="object"&&(r=i,i=void 0);var o={connection:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("connection.move",o)},mt.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},mt.prototype.createConnection=function(e,t,n,i,r,o){typeof n=="object"&&(o=r,r=i,i=n,n=void 0),i=this._create("connection",i);var a={source:e,target:t,parent:r,parentIndex:n,connection:i,hints:o};return this._commandStack.execute("connection.create",a),a.connection},mt.prototype.createShape=function(e,t,n,i,r){typeof i!="number"&&(r=i,i=void 0),r=r||{};var o=r.attach,a,s;e=this._create("shape",e),o?(a=n.parent,s=n):a=n;var c={position:t,shape:e,parent:a,parentIndex:i,host:s,hints:r};return this._commandStack.execute("shape.create",c),c.shape},mt.prototype.createElements=function(e,t,n,i,r){Be(e)||(e=[e]),typeof i!="number"&&(r=i,i=void 0),r=r||{};var o={position:t,elements:e,parent:n,parentIndex:i,hints:r};return this._commandStack.execute("elements.create",o),o.elements},mt.prototype.createLabel=function(e,t,n,i){n=this._create("label",n);var r={labelTarget:e,position:t,parent:i||e.parent,shape:n};return this._commandStack.execute("label.create",r),r.shape},mt.prototype.appendShape=function(e,t,n,i,r){r=r||{},t=this._create("shape",t);var o={source:e,position:n,target:i,shape:t,connection:r.connection,connectionParent:r.connectionParent,hints:r};return this._commandStack.execute("shape.append",o),o.shape},mt.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},mt.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},mt.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},mt.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},mt.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},mt.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},mt.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},mt.prototype.createSpace=function(e,t,n,i,r){var o={delta:n,direction:i,movingShapes:e,resizingShapes:t,start:r};this._commandStack.execute("spaceTool",o)},mt.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},mt.prototype.reconnect=function(e,t,n,i,r){var o={connection:e,newSource:t,newTarget:n,dockingOrPoints:i,hints:r||{}};this._commandStack.execute("connection.reconnect",o)},mt.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,W(i,{docking:"source"}))},mt.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,W(i,{docking:"target"}))},mt.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},mt.prototype._create=function(e,t){return WR(t)?t:this._elementFactory.create(e,t)},mt.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function Na(e){this._elementRegistry=e}Na.$inject=["elementRegistry"],Na.prototype.execute=function(e){var t=e.element,n=e.moddleElement,i=e.properties;if(!n)throw new Error("<moddleElement> required");var r=e.changed||this._getVisualReferences(n).concat(t),o=e.oldProperties||DT(n,ds(i));return Wv(n,i),e.oldProperties=o,e.changed=r,r},Na.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return Wv(n,t),i},Na.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return S(e,"bpmn:DataObject")?IT(e,t):[]};function DT(e,t){return Tn(t,function(n,i){return n[i]=e.get(i),n},{})}function Wv(e,t){F(t,function(n,i){e.set(i,n)})}function IT(e,t){return t.filter(function(n){return S(n,"bpmn:DataObjectReference")&&ie(n).dataObjectRef===e})}var $a="default",Vi="id",Uv="di",LT={width:0,height:0};function Fa(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}Fa.$inject=["elementRegistry","moddle","modeling","textRenderer"],Fa.prototype.execute=function(e){var t=e.element,n=[t];if(!t)throw new Error("element required");var i=this._elementRegistry,r=this._moddle.ids,o=t.businessObject,a=jT(e.properties),s=e.oldProperties||BT(t,a);return Yv(a,o)&&(r.unclaim(o[Vi]),i.updateId(t,a[Vi]),r.claim(a[Vi],o)),$a in a&&(a[$a]&&n.push(i.get(a[$a].id)),o[$a]&&n.push(i.get(o[$a].id))),qv(t,a),e.oldProperties=s,e.changed=n,n},Fa.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&ie(n).name;if(i){var r=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,r,LT)}},Fa.prototype.revert=function(e){var t=e.element,n=e.properties,i=e.oldProperties,r=t.businessObject,o=this._elementRegistry,a=this._moddle.ids;return qv(t,i),Yv(n,r)&&(a.unclaim(n[Vi]),o.updateId(t,i[Vi]),a.claim(i[Vi],r)),e.changed};function Yv(e,t){return Vi in e&&e[Vi]!==t[Vi]}function BT(e,t){var n=ds(t),i=e.businessObject,r=ot(e);return Tn(n,function(o,a){return a!==Uv?o[a]=i.get(a):o[a]=NT(r,ds(t.di)),o},{})}function NT(e,t){return Tn(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function qv(e,t){var n=e.businessObject,i=ot(e);F(t,function(r,o){o!==Uv?n.set(o,r):i&&$T(i,r)})}function $T(e,t){F(t,function(n,i){e.set(i,n)})}var FT=["default"];function jT(e){var t=W({},e);return FT.forEach(function(n){n in e&&(t[n]=ie(t[n]))}),t}function Wc(e,t){this._canvas=e,this._modeling=t}Wc.$inject=["canvas","modeling"],Wc.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=ot(r);return t.setRootElement(n),t.removeRootElement(r),Bt(a.rootElements,i),i.$parent=a,Lt(a.rootElements,o),o.$parent=null,r.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=r,[]},Wc.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,a=i.$parent,s=ot(n);return t.setRootElement(r),t.removeRootElement(n),Lt(a.rootElements,i),i.$parent=null,Bt(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,r.di=s,[]};function bf(e,t){this._modeling=e,this._spaceTool=t}bf.$inject=["modeling","spaceTool"],bf.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=ei(i),a=o===i,s=a?i:i.parent,c=lr(s),l=tn(i);if(l?r==="left"?r="top":r==="right"&&(r="bottom"):r==="top"?r="left":r==="bottom"&&(r="right"),!c.length){var u=l?{x:i.x+Jn,y:i.y,width:i.width-Jn,height:i.height}:{x:i.x,y:i.y+Jn,width:i.width,height:i.height-Jn};n.createShape({type:"bpmn:Lane",isHorizontal:l},u,s)}var f=[];Nr(o,function(x){return f.push(x),x.label&&f.push(x.label),x===i?[]:Ke(x.children,function(C){return C!==i})});var p,d,m,h,y;r==="top"?(p=-120,d=i.y,m=d+10,h="n",y="y"):r==="left"?(p=-120,d=i.x,m=d+10,h="w",y="x"):r==="bottom"?(p=120,d=i.y+i.height,m=d-10,h="s",y="y"):r==="right"&&(p=120,d=i.x+i.width,m=d-10,h="e",y="x");var v=t.calculateAdjustments(f,y,p,m),g=l?{x:0,y:p}:{x:p,y:0};t.makeSpace(v.movingShapes,v.resizingShapes,g,h,m);var b=l?{x:i.x+(a?Jn:0),y:d-(r==="top"?120:0),width:i.width-(a?Jn:0),height:120}:{x:d-(r==="left"?120:0),y:i.y+(a?Jn:0),width:120,height:i.height-(a?Jn:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:l},b,s)};function xf(e){this._modeling=e}xf.$inject=["modeling"],xf.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=lr(n),o=r.length;if(o>i)throw new Error(`more than <${i}> child lanes`);var a=tn(n),s=a?n.height:n.width,c=Math.round(s/i),l,u,f,p;for(p=0;p<i;p++)p===i-1?l=s-c*p:l=c,u=a?{x:n.x+Jn,y:n.y+p*c,width:n.width-Jn,height:l}:{x:n.x+p*c,y:n.y+Jn,width:l,height:n.height-Jn},p<o?t.resizeShape(r[p],u):(f={type:"bpmn:Lane",isHorizontal:a},t.createShape(f,u,n))};function ja(e,t){this._modeling=e,this._spaceTool=t}ja.$inject=["modeling","spaceTool"],ja.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},ja.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=IA(e,t);n.resizeShape(e,t),i.forEach(function(r){n.resizeShape(r.shape,r.newBounds)})},ja.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=Ie(e),r=Ie(t),o=Cg(r,i),a=ei(e),s=[],c=[];Nr(a,function(m){return s.push(m),(S(m,"bpmn:Lane")||S(m,"bpmn:Participant"))&&c.push(m),m.children});var l,u,f,p,d;(o.bottom||o.top)&&(l=o.bottom||o.top,u=e.y+(o.bottom?e.height:0)+(o.bottom?-10:10),f=o.bottom?"s":"n",p=o.top>0||o.bottom<0?-l:l,d=n.calculateAdjustments(s,"y",p,u),n.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:l},f)),(o.left||o.right)&&(l=o.right||o.left,u=e.x+(o.right?e.width:0)+(o.right?-10:100),f=o.right?"e":"w",p=o.left>0||o.right<0?-l:l,d=n.calculateAdjustments(c,"x",p,u),n.makeSpace(d.movingShapes,d.resizingShapes,{x:l,y:0},f))};var Ha="flowNodeRef",_f="lanes";function Uc(){}Uc.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},o=[];function a(u,f){var p=Ie(f),d={x:u.x+u.width/2,y:u.y+u.height/2};return d.x>p.left&&d.x<p.right&&d.y>p.top&&d.y<p.bottom}function s(u){n.indexOf(u)===-1&&(o.push(u),n.push(u))}function c(u){var f=ei(u);return r[f.id]||(r[f.id]=lc(f)),r[f.id]}function l(u){if(!u.parent)return[];var f=c(u);return f.filter(function(p){return a(u,p)}).map(function(p){return p.businessObject})}return t.forEach(function(u){var f=ei(u);if(!(!f||n.indexOf(f)!==-1)){var p=f.children.filter(function(d){return S(d,"bpmn:FlowNode")});p.forEach(s),n.push(f)}}),e.forEach(s),o.forEach(function(u){var f=u.businessObject,p=f.get(_f),d=p.slice(),m=l(u);i.push({flowNode:f,remove:d,add:m})}),t.forEach(function(u){var f=u.businessObject;u.parent||f.get(Ha).forEach(function(p){i.push({flowNode:p,remove:[f],add:[]})})}),i},Uc.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.flowNodeShapes,e.laneShapes)),t.forEach(function(n){var i=n.flowNode,r=i.get(_f);n.remove.forEach(function(o){Lt(r,o),Lt(o.get(Ha),i)}),n.add.forEach(function(o){Bt(r,o),Bt(o.get(Ha),i)})}),[]},Uc.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,r=i.get(_f);n.add.forEach(function(o){Lt(r,o),Lt(o.get(Ha),i)}),n.remove.forEach(function(o){Bt(r,o),Bt(o.get(Ha),i)})}),[]};var wf="categoryValueRef";function za(e,t){this._bpmnFactory=e,this._elementRegistry=t}za.$inject=["bpmnFactory","elementRegistry"],za.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,r=new Map,o=[],a=new Map;function s(g,b,x){if(b){var C=a.get(g);C||(C={},a.set(g,C)),!(x&&C.present)&&(!x&&C.past||(x?C.present={categoryValue:b,root:Ef(g)}:C.past={categoryValue:b}))}}function c(g){r.set(g,ie(g))}function l(){n.filter(function(g){return S(g,"bpmn:FlowElement")&&!Ye(g)&&g.parent}).forEach(c)}function u(g){var b=ie(g),x=b.get("categoryValueRef");return x||(x=_g(i,b),o.push(HT(g,x))),x}function f(g){return g.reduce(function(b,x){var C=Ef(x),M=b.get(C);return M||(M=[],b.set(C,M)),M.push(x),b},new Map)}e=Array.from(e||[]);var p=f(e);t.length&&l(),e.forEach(c),n.filter(function(g){return S(g,"bpmn:Group")&&!Ye(g)&&g.parent}).forEach(function(g){var b=ie(g).get("categoryValueRef");if(!b){var x=Ef(g),C=p.get(x)||[],M=bo(C,g),k=Object.keys(M).length>0;k&&(b=u(g))}s(g,b,!0)}),t.forEach(function(g){s(g.groupShape,g.categoryValue,!1)}),o.length&&l();var d=Array.from(r.keys()),m=Array.from(a.values()).reduce(function(g,b){return b.present&&g.add(b.present.categoryValue),b.past&&g.add(b.past.categoryValue),g},new Set),h=new Map,y=f(d);a.forEach(function(g,b){var x=g.present;if(x){var C=y.get(x.root)||[],M=bo(C,b);C.forEach(function(k){if(M[k.id]){var P=h.get(k);P||(P=new Set,h.set(k,P)),P.add(x.categoryValue)}})}});var v=d.reduce(function(g,b){var x=r.get(b),C=x.get(wf),M=new Set(C),k=h.get(b)||new Set,P=Array.from(k).filter(function(D){return!M.has(D)}),B=C.filter(function(D){return m.has(D)&&!k.has(D)});return(P.length||B.length)&&g.push({businessObject:x,categoryValuesToAdd:P,categoryValuesToRemove:B}),g},[]);return{flowElements:v,groups:o}},za.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),zT(t.groups),VT(t.flowElements),[]},za.prototype.revert=function(e){var t=e.updates;return WT(t.flowElements),GT(t.groups),[]};function HT(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function zT(e){e.forEach(function(t){ie(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function GT(e){e.forEach(function(t){ie(t.groupShape).categoryValueRef=null})}function VT(e){e.forEach(function(t){var n=t.businessObject,i=n.get(wf);t.categoryValuesToRemove.forEach(function(r){Lt(i,r)}),t.categoryValuesToAdd.forEach(function(r){Bt(i,r,!0)})})}function WT(e){e.forEach(function(t){var n=t.businessObject,i=n.get(wf);t.categoryValuesToAdd.forEach(function(r){Lt(i,r)}),t.categoryValuesToRemove.forEach(function(r){Bt(i,r,!0)})})}function Ef(e){for(;e.parent;)e=e.parent;return e}function Yc(e){this._moddle=e}Yc.$inject=["moddle"],Yc.prototype.execute=function(e){var t=this._moddle.ids,n=e.id,i=e.element,r=e.claiming;return r?t.claim(n,i):t.unclaim(n),[]},Yc.prototype.revert=function(e){var t=this._moddle.ids,n=e.id,i=e.element,r=e.claiming;return r?t.unclaim(n):t.claim(n,i),[]};var UT={fill:void 0,stroke:void 0};function Sf(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(Pn(t)){var n=YT(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}Sf.$inject=["commandStack"],Sf.prototype.postExecute=function(e){var t=e.elements,n=e.colors||UT,i=this,r={};"fill"in n&&W(r,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&W(r,{"border-color":this._normalizeColor(n.stroke)}),F(t,function(o){var a=ht(o)?li(r,["border-color"]):r,s=ot(o);if(qT(a),Ye(o)){if(!s||!S(s.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:o,moddleElement:s.label,properties:{color:r["border-color"]}})}else{if(!qe(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:o,properties:{di:a}})}})};function YT(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 qT(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var KT={width:0,height:0};function Kv(e,t,n){function i(c,l){var u=c.label||c,f=c.labelTarget||c;return EC(u,l),[u,f]}function r(c){var l=c.element,u=l.businessObject,f=c.newLabel;if(!Ye(l)&&sr(l)&&!Xs(l)&&!Xv(f)){var p=7,d=Yu(l);d={x:d.x,y:d.y+p},e.createLabel(l,d,{id:u.id+"_label",businessObject:u,di:l.di})}}function o(c){return c.oldLabel=qn(c.element),i(c.element,c.newLabel)}function a(c){return i(c.element,c.oldLabel)}function s(c){var l=c.element,u=l.label||l,f=c.newLabel,p=c.newBounds,d=c.hints||{};if(!(!Ye(u)&&!S(u,"bpmn:TextAnnotation"))){if(Ye(u)&&Xv(f)){d.removeShape!==!1&&e.removeShape(u,{unsetLabel:!1});return}var m=qn(l);typeof p>"u"&&(p=t.getExternalLabelBounds(u,m)),p&&e.resizeShape(u,p,KT)}}this.preExecute=r,this.execute=o,this.revert=a,this.postExecute=s}Kv.$inject=["modeling","textRenderer","bpmnFactory"];function Xv(e){return!e||!e.trim()}function pn(e,t,n,i){mt.call(this,e,t,n),this._bpmnRules=i}Ee(pn,mt),pn.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],pn.prototype.getHandlers=function(){var e=mt.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=Na,e["element.updateProperties"]=Fa,e["canvas.updateRoot"]=Wc,e["lane.add"]=bf,e["lane.resize"]=ja,e["lane.split"]=xf,e["lane.updateRefs"]=Uc,e["group.updateRefs"]=za,e["id.updateClaim"]=Yc,e["element.setColor"]=Sf,e["element.updateLabel"]=Kv,e},pn.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},pn.prototype.connect=function(e,t,n,i){var r=this._bpmnRules;if(n||(n=r.canConnect(e,t)),!!n)return this.createConnection(e,t,n,e.parent,i)},pn.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},pn.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},pn.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},pn.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},pn.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},pn.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},pn.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},pn.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},pn.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},pn.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},pn.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},pn.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function Zv(){}Zv.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||Ne(t.source||e.source),t.connectionEnd||Ne(t.target||e.target)]};var qc=20,XT=5,Kc=Math.round,Qv=20,ZT={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function QT(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function JT(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function Jv(e,t,n){var i=cn(t,e,XT),r=n.split(":")[0],o=Kc((t.x-e.x)/2+e.x),a=Kc((t.y-e.y)/2+e.y),s,c,l=JT(r,i),u=/h|r|l/.test(r),f=!1,p=!1;return l?(s=u?{x:o,y:e.y}:{x:e.x,y:a},c=u?"h:h":"v:v"):(f=QT(i,r),c=u?"h:v":"v:h",f?u?(p=a===e.y,s={x:e.x+qc*(/l/.test(r)?-1:1),y:p?a+qc:a}):(p=o===e.x,s={x:p?o+qc:o,y:e.y+qc*(/t/.test(r)?-1:1)}):s={x:o,y:a}),{waypoints:Rf(e,s,c).concat(s),directions:c,turnNextDirections:p}}function e2(e,t,n){return Jv(e,t,n)}function t2(e,t,n){var i=Jv(t,e,eb(n));return{waypoints:i.waypoints.slice().reverse(),directions:eb(i.directions),turnNextDirections:i.turnNextDirections}}function n2(e,t){var n=e.directions.split(":")[1],i=t.directions.split(":")[0];e.turnNextDirections&&(n=n=="h"?"v":"h"),t.turnNextDirections&&(i=i=="h"?"v":"h");var r=n+":"+i,o=Rf(e.waypoints[e.waypoints.length-1],t.waypoints[0],r);return{waypoints:o,directions:r}}function eb(e){return e.split(":").reverse().join(":")}function i2(e,t,n){var i=Kc((t.x-e.x)/2+e.x),r=Kc((t.y-e.y)/2+e.y);if(n==="h:v")return[{x:t.x,y:e.y}];if(n==="v:h")return[{x:e.x,y:t.y}];if(n==="h:h")return[{x:i,y:e.y},{x:i,y:t.y}];if(n==="v:v")return[{x:e.x,y:r},{x:t.x,y:r}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}function Rf(e,t,n){if(n=n||"h:h",!f2(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(nb(n)){var i=e2(e,t,n),r=t2(e,t,n),o=n2(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return i2(e,t,n)}function r2(e,t,n){var i=Rf(e,t,n);return i.unshift(e),i.push(t),rb(i)}function o2(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=O0(o,"straight")[0]||"h:h",s=ZT[a]||0,c=cn(e,t,s),l=p2(c,a);n=n||Ne(e),i=i||Ne(t);var u=l.split(":"),f=ib(n,e,u[0],d2(c)),p=ib(i,t,u[1],c);return r2(f,p,l)}function a2(e,t,n,i,r,o){Be(n)&&(r=n,o=i,n=Ne(e),i=Ne(t)),o=W({preferredLayouts:[]},o),r=r||[];var a=o.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&c2(e,t,n,i,o),c||(c=o.connectionEnd&&u2(t,e,i,r),c)||(c=o.connectionStart&&l2(e,t,n,r),c)?c:!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:o2(e,t,n,i,o)}function s2(e,t,n){return e>=t&&e<=n}function tb(e,t,n){var i={x:"width",y:"height"};return s2(t[e],n[e],n[e]+n[i[e]])}function c2(e,t,n,i,r){var o={},a,s;return s=cn(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),r.preserveDocking==="target"?tb(a,i,e)?(o[a]=i[a],[{x:o.x!==void 0?o.x:n.x,y:o.y!==void 0?o.y:n.y,original:{x:o.x!==void 0?o.x:n.x,y:o.y!==void 0?o.y:n.y}},{x:i.x,y:i.y}]):null:tb(a,n,t)?(o[a]=n[a],[{x:n.x,y:n.y},{x:o.x!==void 0?o.x:i.x,y:o.y!==void 0?o.y:i.y,original:{x:o.x!==void 0?o.x:i.x,y:o.y!==void 0?o.y:i.y}}]):null):null}function l2(e,t,n,i){return Cf(e,t,n,i)}function u2(e,t,n,i){var r=i.slice().reverse();return r=Cf(e,t,n,r),r?r.reverse():null}function Cf(e,t,n,i){function r(u){return u.length<3?!0:u.length>4?!1:!!vt(u,function(f,p){var d=u[p-1];return d&&fa(f,d)<3})}function o(u,f,p){var d=Li(f,u);switch(d){case"v":return{x:p.x,y:u.y};case"h":return{x:u.x,y:p.y}}return{x:u.x,y:u.y}}function a(u,f,p){var d;for(d=u.length-2;d!==0;d--)if(Am(u[d],f,Qv)||Am(u[d],p,Qv))return u.slice(d);return u}if(r(i))return null;var s=i[0],c=i.slice(),l;return c[0]=n,c[1]=o(c[1],s,n),l=a(c,e,t),l!==c&&(c=Cf(e,t,n,l)),c&&Li(c)?null:c}function p2(e,t){if(nb(t))return t;switch(e){case"intersect":return"t:t";case"top":case"bottom":return"v:v";case"left":case"right":return"h:h";default:return t}}function f2(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function nb(e){return e&&/t|r|b|l/.test(e)}function d2(e){return{top:"bottom",bottom:"top",left:"right",right:"left","top-left":"bottom-right","bottom-right":"top-left","top-right":"bottom-left","bottom-left":"top-right"}[e]}function ib(e,t,n,i){if(n==="h"&&(n=/left/.test(i)?"l":"r"),n==="v"&&(n=/top/.test(i)?"t":"b"),n==="t")return{original:e,x:e.x,y:t.y};if(n==="r")return{original:e,x:t.x+t.width,y:e.y};if(n==="b")return{original:e,x:e.x,y:t.y+t.height};if(n==="l")return{original:e,x:t.x,y:e.y};throw new Error("unexpected dockingDirection: <"+n+">")}function rb(e){return e.reduce(function(t,n,i){var r=t[t.length-1],o=e[i+1];return zu(r,o,n,0)||t.push(n),t},[])}var h2=-10,m2=40,g2={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},y2={default:["v:v"],fromGateway:["h:v"],toGateway:["v:h"],loop:{fromTop:["t:l"],fromRight:["r:t"],fromLeft:["l:b"],fromBottom:["b:r"]},boundaryLoop:{alternateHorizontalSide:"t",alternateVerticalSide:"r",default:"h"},messageFlow:["straight","h:h"],subProcess:["straight","v:v"],isHorizontal:!1},Af={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},Ga={top:"t",right:"r",bottom:"b",left:"l"};function Xc(e){this._elementRegistry=e}Ee(Xc,Zv),Xc.prototype.layoutConnection=function(e,t){t||(t={});var n=t.source||e.source,i=t.target||e.target,r=t.waypoints||e.waypoints,o=t.connectionStart,a=t.connectionEnd,s=this._elementRegistry,c,l;if(o||(o=ob(r&&r[0],n)),a||(a=ob(r&&r[r.length-1],i)),(S(e,"bpmn:Association")||S(e,"bpmn:DataAssociation"))&&r&&!ab(n,i))return[].concat([o],r.slice(1,-1),[a]);var u=yg(n,s)?g2:y2;return S(e,"bpmn:MessageFlow")?c=b2(n,i,u):(S(e,"bpmn:SequenceFlow")||ab(n,i))&&(n===i?c={preferredLayouts:R2(n,e,u)}:S(n,"bpmn:BoundaryEvent")?c={preferredLayouts:C2(n,i,a,u)}:Va(n)||Va(i)?c={preferredLayouts:u.subProcess,preserveDocking:_2(n)}:S(n,"bpmn:Gateway")?c={preferredLayouts:u.fromGateway}:S(i,"bpmn:Gateway")?c={preferredLayouts:u.toGateway}:c={preferredLayouts:u.default}),c&&(c=W(c,t),l=rb(a2(n,i,o,a,r,c))),l||[o,a]};function v2(e){var t=e.host;return cn(Ne(e),t,h2)}function b2(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:x2(e,t)}}function x2(e,t){return S(t,"bpmn:Participant")?"source":S(e,"bpmn:Participant")?"target":Va(t)?"source":Va(e)||S(t,"bpmn:Event")?"target":S(e,"bpmn:Event")?"source":null}function _2(e){return Va(e)?"target":"source"}function ob(e,t){return e?e.original||e:Ne(t)}function ab(e,t){return S(t,"bpmn:Activity")&&S(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function Va(e){return S(e,"bpmn:SubProcess")&&Qe(e)}function Ur(e,t){return e===t}function w2(e,t){return t.indexOf(e)!==-1}function $o(e){var t=/right|left/.exec(e);return t&&t[0]}function Fo(e){var t=/top|bottom/.exec(e);return t&&t[0]}function sb(e,t){return Af[e]===t}function E2(e,t){var n=$o(e),i=Af[n];return t.indexOf(i)!==-1}function S2(e,t){var n=Fo(e),i=Af[n];return t.indexOf(i)!==-1}function cb(e){return e==="right"||e==="left"}function R2(e,t,n){var i=t.waypoints,r=i&&i.length&&cn(i[0],e);return r==="top"?n.loop.fromTop:r==="right"?n.loop.fromRight:r==="left"?n.loop.fromLeft:n.loop.fromBottom}function C2(e,t,n,i){var r=Ne(e),o=Ne(t),a=v2(e),s,c,l=Ur(e.host,t),u=w2(a,["top","right","bottom","left"]),f=cn(o,r,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return l?A2(a,u,e,t,n,i):(s=P2(a,f,u,i.isHorizontal),c=M2(a,f,u,i.isHorizontal),[s+":"+c])}function A2(e,t,n,i,r,o){var a=t?e:o.isHorizontal?Fo(e):$o(e),s=Ga[a],c;return t?cb(e)?c=lb("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:c=lb("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function lb(e,t,n,i){var r=m2;return!(Pf(e,i,n,r)||Pf(e,i,{x:n.x+n.width,y:n.y+n.height},r)||Pf(e,i,Ne(t),r))}function Pf(e,t,n,i){return Math.abs(t[e]-n[e])<i}function P2(e,t,n,i){if(n)return Ga[e];var r=Fo(e),o=$o(e),a=Fo(t),s=$o(t);if(i){if(Ur(r,a)||sb(o,s))return Ga[r]}else if(Ur(o,s)||sb(r,a))return Ga[o];return Ga[i?o:r]}function M2(e,t,n,i){if(n)return cb(e)?E2(e,t)||Ur(e,t)?"h":"v":S2(e,t)||Ur(e,t)?"v":"h";var r=Fo(e),o=$o(e),a=Fo(t),s=$o(t);return a&&!s?"v":s&&!a?"h":i?Ur(r,a)?"h":"v":Ur(o,s)?"v":"h"}Xc.$inject=["elementRegistry"];function ub(e){return W({original:e.point.original||e.point},e.actual)}function vr(e,t){this._elementRegistry=e,this._graphicsFactory=t}vr.$inject=["elementRegistry","graphicsFactory"],vr.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var i=this.getDockingPoint(e,t,!0),r=this.getDockingPoint(e,n),o=e.waypoints.slice(i.idx+1,r.idx);return o.unshift(ub(i)),o.push(ub(r)),o},vr.prototype.getDockingPoint=function(e,t,n){var i=e.waypoints,r,o,a;return r=n?0:i.length-1,o=i[r],a=this._getIntersection(t,e,n),{point:o,actual:a||o,idx:r}},vr.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return da(i,r,n)},vr.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},vr.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},vr.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const Mf={__init__:["modeling","bpmnUpdater"],__depends__:[qP,uM,fM,dM,wv,hT,gT,wT,ni,ff,Pv],bpmnFactory:["type",ri],bpmnUpdater:["type",Nn],elementFactory:["type",mr],modeling:["type",pn],layouter:["type",Xc],connectionDocking:["type",vr]};var T2=10,pb=50,k2=250;function Tf(e,t,n,i){for(var r;r=O2(e,n,t);)n=i(t,n,r);return n}function kf(e){return function(t,n,i){var r={x:n.x,y:n.y};return["x","y"].forEach(function(o){var a=e[o];if(a){var s=o==="x"?"width":"height",c=a.margin,l=a.minDistance;c<0?r[o]=Math.min(i[o]+c-t[s]/2,n[o]-l+c):r[o]=Math.max(i[o]+i[s]+c+t[s]/2,n[o]+l+c)}}),r}}function O2(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=I2(e);return vt(r,function(o){if(o===n)return!1;var a=cn(o,i,T2);return a==="intersect"})}function D2(e,t){t||(t={});function n(m){return m.source===e?1:-1}var i=t.defaultDistance||pb,r=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||k2,c=t.reference||"start";o||(o=N2);function l(m,h){return r==="n"?c==="start"?Ie(m).top-Ie(h).bottom:c==="center"?Ie(m).top-Ne(h).y:Ie(m).top-Ie(h).top:r==="w"?c==="start"?Ie(m).left-Ie(h).right:c==="center"?Ie(m).left-Ne(h).x:Ie(m).left-Ie(h).left:r==="s"?c==="start"?Ie(h).top-Ie(m).bottom:c==="center"?Ne(h).y-Ie(m).bottom:Ie(h).bottom-Ie(m).bottom:c==="start"?Ie(h).left-Ie(m).right:c==="center"?Ne(h).x-Ie(m).right:Ie(h).right-Ie(m).right}var u=e.incoming.filter(o).map(function(m){var h=a(m),y=h<0?l(m.source,e):l(e,m.source);return{id:m.source.id,distance:y,weight:h}}),f=e.outgoing.filter(o).map(function(m){var h=a(m),y=h>0?l(e,m.target):l(m.target,e);return{id:m.target.id,distance:y,weight:h}}),p=u.concat(f).reduce(function(m,h){return m[h.id+"__weight_"+h.weight]=h,m},{}),d=Tn(p,function(m,h){var y=h.distance,v=h.weight;return y<0||y>s||(m[String(y)]||(m[String(y)]=0),m[String(y)]+=1*v,(!m.distance||m[m.distance]<m[String(y)])&&(m.distance=y)),m},{});return d.distance||i}function I2(e){var t=Of(e);return e.host&&(t=t.concat(Of(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(Of(i))},[]))),t}function Of(e){return B2(e).concat(L2(e))}function L2(e){return e.incoming.map(function(t){return t.source})}function B2(e){return e.outgoing.map(function(t){return t.target})}function N2(){return!0}var $2=100;function fb(e,t,n){e.on("autoPlace",$2,function(i){var r=i.shape,o=i.source;return F2(o,r)}),e.on("autoPlace.end",function(i){n.scrollToElement(i.shape)}),this.append=function(i,r,o){e.fire("autoPlace.start",{source:i,shape:r});var a=e.fire("autoPlace",{source:i,shape:r}),s=t.appendShape(i,r,a,i.parent,o);return e.fire("autoPlace.end",{source:i,shape:s}),s}}fb.$inject=["eventBus","modeling","canvas"];function F2(e,t,n){n||(n={});var i=n.defaultDistance||pb,r=Ne(e),o=Ie(e);return{x:o.right+i+t.width/2,y:r.y}}function db(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}db.$inject=["eventBus","selection"];const j2={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",fb],autoPlaceSelectionBehavior:["type",db]};function hb(e,t,n){var i=yg(e,n);if(S(t,"bpmn:TextAnnotation"))return z2(e,t,i);if(qe(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return G2(e,t,i);if(S(t,"bpmn:FlowNode"))return H2(e,t,i)}function H2(e,t,n){var i=Ie(e),r=Ne(e),o=n?{directionHint:"e",minDistance:80,baseOrientation:"left",boundaryOrientation:"top",start:"top",end:"bottom"}:{directionHint:"s",minDistance:90,baseOrientation:"top",boundaryOrientation:"left",start:"left",end:"right"},a=D2(e,{filter:function(d){return S(d,"bpmn:SequenceFlow")},direction:o.directionHint}),s=30,c=o.minDistance,l=o.baseOrientation;S(e,"bpmn:BoundaryEvent")&&(l=cn(e,e.host,-25),l.indexOf(o.boundaryOrientation)!==-1&&(s*=-1));var u=n?{x:i.right+a+t.width/2,y:r.y+mb(l,c,o)}:{x:r.x+mb(l,c,o),y:i.bottom+a+t.height/2},f={margin:s,minDistance:c},p=n?{y:f}:{x:f};return Tf(e,t,u,kf(p))}function mb(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function z2(e,t,n){var i=Ie(e),r=n?{x:i.right+t.width/2,y:i.top-50-t.height/2}:{x:i.right+50+t.width/2,y:i.bottom+t.height/2};ht(e)&&(r=Ne(e),n?(r.x+=100,r.y-=50):(r.x+=100,r.y+=50));var o={margin:n?-30:30,minDistance:20},a=n?{y:o}:{x:o};return Tf(e,t,r,kf(a))}function G2(e,t,n){var i=Ie(e),r=n?{x:i.right-10+t.width/2,y:i.bottom+40+t.width/2}:{x:i.left-40-t.width/2,y:i.bottom-10+t.height/2},o={margin:30,minDistance:30},a=n?{x:o}:{y:o};return Tf(e,t,r,kf(a))}function gb(e,t){e.on("autoPlace",function(n){var i=n.shape,r=n.source;return hb(r,i,t)})}gb.$inject=["eventBus","elementRegistry"];const Zc={__depends__:[j2],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",gb]},yb=[mg,ba,Mf,Zc];function V2(e={}){rh(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new wo({container:t,moddleExtensions:e.moddleExtensions??xs,additionalModules:[...yb,...e.additionalModules??[]]})}const vb={"edge-crosses-shape":"연결","edge-crosses-subprocess":"연결","edge-endpoint-detached":"연결","edge-overlap-opposite":"겹침","edge-overlap-mixed":"겹침","edge-overlap-unrelated":"겹침","shape-overlap":"겹침","shape-outside-container":"소속","label-on-shared-segment":"라벨","label-over-line":"라벨","annotation-over-label":"라벨","pool-name-over-label":"라벨","group-overlap-unintended":"그룹","group-overlap-unreadable":"그룹","group-stack-unreadable":"그룹","group-on-container-boundary":"그룹","group-on-group-boundary":"그룹","group-cuts-shape":"그룹","pool-overlap":"풀","CHK-FLOW-1":"구조","CHK-POOL-1":"풀"},W2={이:["이","가"],을:["을","를"],와:["과","와"]};function U2(e,t){const[n,i]=W2[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 Y2={"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":"연관선"},q2="요소";function Df(e){return(e&&Y2[e.type])??q2}const bb=20;function K2(e){const t=e.replace(/\s+/g," ").trim();return t.length>bb?`${t.slice(0,bb)}…`:t}function Qc(e,t,n,i=""){const r=e(t),o=(r==null?void 0:r.name)===void 0?void 0:K2(r.name),a=o===void 0?i+Df(r):o,s=o===void 0?a:`「${o}」`;return n?s+U2(a,n).slice(a.length):s}function X2(e,t,n,i,r){const[o,a]=[e(t),e(n)],s=(o==null?void 0:o.name)===void 0&&(a==null?void 0:a.name)===void 0&&Df(o)===Df(a);return[Qc(e,t,i),Qc(e,n,r,s?"다른 ":"")]}function Z2(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 Q2(e){switch(e.kind){case"edge-crosses-shape":return[e.edge,e.shape];case"edge-crosses-subprocess":return[e.edge,e.subProcess];case"edge-endpoint-detached":return[e.edge,e.shape];case"shape-overlap":return[...e.shapes];case"shape-outside-container":return[e.shape,e.container];case"edge-overlap-opposite":case"edge-overlap-mixed":case"edge-overlap-unrelated":return[...e.edges];case"label-on-shared-segment":return[e.edge,e.other];case"label-over-line":return[e.edge,e.line];case"annotation-over-label":return[e.annotation,e.label];case"group-overlap-unintended":return e.container?[e.container,...e.groups.filter(t=>t!==e.container)]:[...e.groups];case"group-overlap-unreadable":return e.reason==="orphan"?[...e.groups,...e.shapes]:[e.group,...e.shapes];case"group-stack-unreadable":return[...e.groups,...e.shapes];case"group-on-container-boundary":return[e.group,e.container];case"group-on-group-boundary":return[...e.groups];case"group-cuts-shape":return[e.group,e.shape];case"pool-name-over-label":return[e.pool,e.label];case"pool-overlap":return[...e.pools]}}const xb={top:"위",bottom:"아래",left:"왼쪽",right:"오른쪽"};function J2(e,t){const n=(r,o)=>Qc(t,r,o),i=(r,o,a,s)=>X2(t,r,o,a,s);switch(e.kind){case"edge-crosses-shape":return`${n(e.edge,"이")} ${n(e.shape,"을")} 가로지릅니다.`;case"edge-crosses-subprocess":return`${n(e.edge,"이")} 서브프로세스 ${n(e.subProcess)} 안을 지나갑니다.`;case"edge-endpoint-detached":return`${n(e.edge)}의 끝이 ${n(e.shape)}에서 ${Math.round(e.distance)}px 떨어져 연결이 끊겨 보입니다.`;case"shape-overlap":{const[r,o]=i(e.shapes[0],e.shapes[1],"와","이");return e.identical?`${r} ${o} 완전히 같은 자리에 겹쳐 하나가 가려집니다.`:`${r} ${o} 겹칩니다.`}case"shape-outside-container":return`${n(e.shape,"이")} ${n(e.container)} 경계 밖에 놓여 다른 소속으로 읽힙니다.`;case"edge-overlap-opposite":{const[r,o]=i(e.edges[0],e.edges[1],"와","이");return`${r} ${o} 같은 선 위를 ${Math.round(e.length)}px 서로 반대 방향으로 흐릅니다.`}case"edge-overlap-mixed":{const[r,o]=i(e.edges[0],e.edges[1],"와","이");return`${r} ${o} 종류가 다른 선인데 ${Math.round(e.length)}px 겹쳐 흐릅니다.`}case"edge-overlap-unrelated":{const[r,o]=i(e.edges[0],e.edges[1],"와","이");return`${r} ${o} ${Math.round(e.length)}px 한 선처럼 겹쳐 흐르는데 만나는 지점이 없습니다.`}case"label-on-shared-segment":{const[r,o]=i(e.edge,e.other,void 0,"와");return`${r}의 라벨이 ${o} 공유하는 구간 위에 있어 어느 선의 것인지 모호합니다.`}case"label-over-line":return`${n(e.edge)}의 라벨을 선이 가로지릅니다.`;case"annotation-over-label":return`주석 ${n(e.annotation,"이")} ${n(e.label)}의 이름 라벨을 덮습니다.`;case"group-overlap-unintended":{if(e.container)return`${n(e.container,"이")} 다른 그룹을 통째로 덮습니다.`;const[r,o]=i(e.groups[0],e.groups[1],"와","이");return`${r} ${o} 공유 멤버 없이 겹쳐 의도인지 알 수 없습니다.`}case"group-overlap-unreadable":switch(e.reason){case"orphan":{const[r,o]=i(e.groups[0],e.groups[1],"와");return`${r} ${o}의 겹친 영역에 어느 그룹에도 속하지 않은 요소가 ${e.shapes.length}개 있습니다.`}case"minority":return`${n(e.group)} 상자 안에서 자기 멤버가 과반이 아닙니다(다른 요소 ${e.shapes.length}개).`;case"throughpass":return`${n(e.group)} 상자를 자기 멤버가 아닌 요소 ${e.shapes.length}개가 지나갑니다.`}case"group-stack-unreadable":return`그룹 ${e.groups.length}개가 겹쳐 쌓여 요소 ${e.shapes.length}개가 어느 단계인지 읽히지 않습니다.`;case"group-on-container-boundary":return`${n(e.group)} 테두리가 ${n(e.container)}의 ${xb[e.side]} 경계선과 겹쳐 흐릅니다.`;case"group-on-group-boundary":{const[r,o]=i(e.groups[0],e.groups[1],"와");return`${r} ${o}의 테두리가 같은 선 위에 겹칩니다.`}case"group-cuts-shape":return`${n(e.group)} 테두리가 ${n(e.shape)}의 ${xb[e.side]}을(를) ${Math.round(e.depth)}px 가릅니다.`;case"pool-name-over-label":return`${n(e.pool)}의 이름 밴드가 ${n(e.label)}의 라벨을 덮습니다.`;case"pool-overlap":{const[r,o]=i(e.pools[0],e.pools[1],"와","이");return e.contained?`${r} ${o} 중 하나가 다른 하나 안에 들어가 있습니다.`:`${r} ${o} 겹칩니다.`}}}function ek(e,t){switch(e.ruleId){case"CHK-FLOW-1":return`${Qc(t,e.targetRefs[0])}에 연결된 선이 하나도 없습니다 — 분기·합류가 없는 게이트웨이는 의미가 정해지지 않습니다.`;case"CHK-POOL-1":return`내용이 없는 풀 ${e.targetRefs.length}개가 펼친 형태로 그려져 있습니다 — 빈 풀은 접힌 형태(블랙박스)가 의미에 맞습니다.`;default:return e.ruleId}}const _b="기타",If={error:0,warning:1,info:2};function wb(e,t){const n=[];for(const i of e.geometry)n.push({key:`g:${Rt(i)}`,source:"geometry",code:i.kind,severity:Z2(i),targetRefs:Q2(i),category:vb[i.kind]??_b,message:J2(i,t)});for(const i of e.semantic)n.push({key:`s:${i.ruleId}|${i.targetRefs.join(",")}`,source:"semantic",code:i.ruleId,severity:i.severity,targetRefs:[...i.targetRefs],category:vb[i.ruleId]??_b,message:ek(i,t)});return n}function Eb(e){const t={error:0,warning:0,info:0};for(const n of e)t[n.severity]++;return t}function jo(e,t){return t!==void 0&&e.targetRefs.some(n=>t.has(n))}function Lf(e,t){if(t===void 0||e.length===0)return!1;const n=jo(e[0],t);return e.some(i=>jo(i,t)!==n)}function Sb(e,t){const n=Lf(e,t);return e.slice().sort((i,r)=>(n?Number(jo(r,t))-Number(jo(i,t)):0)||If[i.severity]-If[r.severity])}var tk=new Bo("ov"),nk=500;function on(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=tk,this._overlayDefaults=W({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=ik(n.getContainer()),this._init()}on.$inject=["config.overlays","eventBus","canvas","elementRegistry"],on.prototype.get=function(e){if(Pn(e)&&(e={id:e}),Pn(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?Ke(t.overlays,ao({type:e.type})):t.overlays.slice():[]}else return e.type?Ke(this._overlays,ao({type:e.type})):e.id?this._overlays[e.id]:null},on.prototype.add=function(e,t,n){if(Qt(t)&&(n=t,t=null),e.id||(e=this._elementRegistry.get(e)),!n.position)throw new Error("must specifiy overlay position");if(!n.html)throw new Error("must specifiy overlay html");if(!e)throw new Error("invalid element specified");var i=this._ids.next();return n=W({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},on.prototype.remove=function(e){var t=this.get(e)||[];Be(t)||(t=[t]);var n=this;F(t,function(i){var r=n._getOverlayContainer(i.element,!0);if(i&&(vi(i.html),vi(i.htmlContainer),delete i.htmlContainer,delete i.element,delete n._overlays[i.id]),r){var o=r.overlays.indexOf(i);o!==-1&&r.overlays.splice(o,1)}})},on.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},on.prototype.show=function(){Jc(this._overlayRoot)},on.prototype.hide=function(){Jc(this._overlayRoot,!1)},on.prototype.clear=function(){this._overlays={},this._overlayContainers=[],Ls(this._overlayRoot)},on.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=Ft(t);i=o.x,r=o.y}Rb(n,i,r),gn(e.html,"data-container-id",t.id)},on.prototype._updateOverlay=function(e){var t=e.position,n=e.htmlContainer,i=e.element,r=t.left,o=t.top;if(t.right!==void 0){var a;i.waypoints?a=Ft(i).width:a=i.width,r=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=Ft(i).height:s=i.height,o=t.bottom*-1+s}Rb(n,r||0,o||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},on.prototype._createOverlayContainer=function(e){var t=wt('<div class="djs-overlays" />');wn(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},on.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";Cb(this._overlayRoot,n)},on.prototype._getOverlayContainer=function(e,t){var n=vt(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},on.prototype._addOverlay=function(e){var t=e.id,n=e.element,i=e.html,r,o;i.get&&i.constructor.prototype.jquery&&(i=i.get(0)),Pn(i)&&(i=wt(i)),o=this._getOverlayContainer(n),r=wt('<div class="djs-overlay" data-overlay-id="'+t+'">'),wn(r,{position:"absolute"}),r.appendChild(i),e.type&&Ct(r).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();Jc(r,a===s),e.htmlContainer=r,o.overlays.push(e),o.html.appendChild(r),this._overlays[t]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},on.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,i=this._canvas.findRoot(e.element),r=n&&n.minZoom,o=n&&n.maxZoom,a=e.htmlContainer,s=this._canvas.getRootElement(),c=!0;(i!==s||n&&(Yt(r)&&r>t.scale||Yt(o)&&o<t.scale))&&(c=!1),Jc(a,c),this._updateOverlayScale(e,t)},on.prototype._updateOverlayScale=function(e,t){var n=e.scale,i,r,o=e.htmlContainer,a,s="";n!==!0&&(n===!1?(i=1,r=1):(i=n.min,r=n.max),Yt(i)&&t.scale<i&&(a=(1/t.scale||1)*i),Yt(r)&&t.scale>r&&(a=(1/t.scale||1)*r)),Yt(a)&&(s="scale("+a+","+a+")"),Cb(o,s)},on.prototype._updateOverlaysVisibilty=function(e){var t=this;F(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},on.prototype._init=function(){var e=this._eventBus,t=this;function n(i){t._updateRoot(i),t._updateOverlaysVisibilty(i),t.show()}e.on("canvas.viewbox.changing",function(i){t.hide()}),e.on("canvas.viewbox.changed",function(i){n(i.viewbox)}),e.on(["shape.remove","connection.remove"],function(i){var r=i.element,o=t.get({element:r});F(o,function(c){t.remove(c.id)});var a=t._getOverlayContainer(r);if(a){vi(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",nk,function(i){var r=i.element,o=t._getOverlayContainer(r,!0);o&&(F(o.overlays,function(a){t._updateOverlay(a)}),t._updateOverlayContainer(o))}),e.on("element.marker.update",function(i){var r=t._getOverlayContainer(i.element,!0);r&&Ct(r.html)[i.add?"add":"remove"](i.marker)}),e.on("root.set",function(){t._updateOverlaysVisibilty(t._canvas.viewbox())}),e.on("diagram.clear",this.clear,this)};function ik(e){var t=wt('<div class="djs-overlay-container" />');return wn(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function Rb(e,t,n){wn(e,{left:t+"px",top:n+"px"})}function Jc(e,t){e.style.display=t===!1?"none":""}function Cb(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const el={__init__:["overlays"],overlays:["type",on]};function Bf(e,t){t.invoke(te,this),this.executed(function(n){var i=n.context;i.rootElement?e.setRootElement(i.rootElement):i.rootElement=e.getRootElement()}),this.revert(function(n){var i=n.context;i.rootElement&&e.setRootElement(i.rootElement)})}Ee(Bf,te),Bf.$inject=["canvas","injector"];const rk={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",Bf]};function Wa(e){return CSS.escape(e)}var ok={"&":"&","<":"<",">":">",'"':""","'":"'"};function Ab(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return ok[t]})}var ak="bjs-breadcrumbs-shown";function Pb(e,t,n){var i=wt('<ul class="bjs-breadcrumbs"></ul>'),r=n.getContainer(),o=Ct(r);r.appendChild(i);var a=[];e.on("element.changed",function(c){var l=c.element,u=ie(l),f=vt(a,function(p){return p===u});f&&s()});function s(c){c&&(a=sk(c));var l=a.flatMap(function(f){var p=n.findRoot(Ei(f))||n.findRoot(f.id);if(!p&&S(f,"bpmn:Process")){var d=t.find(function(y){var v=ie(y);return v&&v.get("processRef")===f});p=d&&n.findRoot(d.id)}if(!p)return[];var m=Ab(f.name||f.id),h=wt('<li><span class="bjs-crumb"><a title="'+m+'">'+m+"</a></span></li>");return h.addEventListener("click",function(){n.setRootElement(p)}),h});i.innerHTML="";var u=l.length>1;o.toggle(ak,u),l.forEach(function(f){i.appendChild(f)})}e.on("root.set",function(c){s(c.element)})}Pb.$inject=["eventBus","elementRegistry","canvas"];function sk(e){for(var t=ie(e),n=[],i=t;i;i=i.$parent)(S(i,"bpmn:SubProcess")||S(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function Mb(e,t){var n=null,i=new ck;e.on("root.set",function(r){var o=r.element,a=t.viewbox(),s=i.get(o);if(i.set(n,{x:a.x,y:a.y,zoom:a.scale}),n=o,!(!S(o,"bpmn:SubProcess")&&!s)){s=s||{x:0,y:0,zoom:1};var c=(a.x-s.x)*a.scale,l=(a.y-s.y)*a.scale;(c!==0||l!==0)&&t.scroll({dx:c,dy:l}),s.zoom!==a.scale&&t.zoom(s.zoom,{x:0,y:0})}}),e.on("diagram.clear",function(){i.clear(),n=null})}Mb.$inject=["eventBus","canvas"];function ck(){this._entries=[],this.set=function(e,t){var n=!1;for(var i in this._entries)if(this._entries[i][0]===e){this._entries[i][1]=t,n=!0;break}n||this._entries.push([e,t])},this.get=function(e){for(var t in this._entries)if(this._entries[t][0]===e)return this._entries[t][1];return null},this.clear=function(){this._entries.length=0},this.remove=function(e){var t=-1;for(var n in this._entries)if(this._entries[n][0]===e){t=n;break}t!==-1&&this._entries.splice(t,1)}}var Tb={x:180,y:160};function Yr(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,r){n._handleImport(r.definitions)})}Yr.prototype._handleImport=function(e){if(e.diagrams){var t=this;this._definitions=e,this._processToDiagramMap={},e.diagrams.forEach(function(i){!i.plane||!i.plane.bpmnElement||(t._processToDiagramMap[i.plane.bpmnElement.id]=i)});var n=e.diagrams.filter(i=>i.plane).flatMap(i=>t._createNewDiagrams(i.plane));n.forEach(function(i){t._movePlaneElementsToOrigin(i.plane)})}},Yr.prototype._createNewDiagrams=function(e){var t=this,n=[],i=[];e.get("planeElement").forEach(function(o){var a=o.bpmnElement;if(a){var s=a.$parent;S(a,"bpmn:SubProcess")&&!o.isExpanded&&n.push(a),uk(a,e)&&i.push({diElement:o,parent:s})}});var r=[];return n.forEach(function(o){if(!t._processToDiagramMap[o.id]){var a=t._createDiagram(o);t._processToDiagramMap[o.id]=a,r.push(a)}}),i.forEach(function(o){for(var a=o.diElement,s=o.parent;s&&n.indexOf(s)===-1;)s=s.$parent;if(s){var c=t._processToDiagramMap[s.id];t._moveToDiPlane(a,c.plane)}}),r},Yr.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=lk(e),i={x:n.x-Tb.x,y:n.y-Tb.y};t.forEach(function(r){r.waypoint?r.waypoint.forEach(function(o){o.x=o.x-i.x,o.y=o.y-i.y}):r.bounds&&(r.bounds.x=r.bounds.x-i.x,r.bounds.y=r.bounds.y-i.y)})},Yr.prototype._moveToDiPlane=function(e,t){var n=kb(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},Yr.prototype._createDiagram=function(e){var t=this._moddle.create("bpmndi:BPMNPlane",{bpmnElement:e}),n=this._moddle.create("bpmndi:BPMNDiagram",{plane:t});return t.$parent=n,t.bpmnElement=e,n.$parent=this._definitions,this._definitions.diagrams.push(n),n},Yr.$inject=["eventBus","moddle"];function kb(e){return S(e,"bpmndi:BPMNDiagram")?e:kb(e.$parent)}function lk(e){var t={top:1/0,right:-1/0,bottom:-1/0,left:1/0};return e.planeElement.forEach(function(n){if(n.bounds){var i=Ie(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),Vs(t)}function uk(e,t){var n=e.$parent;return!(!S(n,"bpmn:SubProcess")||n===t.bpmnElement||qe(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var tl=250,pk='<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>',fk="bjs-drilldown-empty";function br(e,t,n,i,r){te.call(this,t),this._canvas=e,this._eventBus=t,this._elementRegistry=n,this._overlays=i,this._translate=r;var o=this;this.executed("shape.toggleCollapse",tl,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",tl,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],tl,function(a){var s=a.oldParent,c=a.newParent||a.parent,l=a.shape;o._canDrillDown(l)&&o._addOverlay(l),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(l)},!0),this.reverted(["shape.create","shape.move","shape.delete"],tl,function(a){var s=a.oldParent,c=a.newParent||a.parent,l=a.shape;o._canDrillDown(l)&&o._addOverlay(l),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(l)},!0),t.on("import.render.complete",function(){n.filter(function(a){return o._canDrillDown(a)}).map(function(a){o._addOverlay(a)})})}Ee(br,te),br.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},br.prototype._canDrillDown=function(e){var t=this._canvas;return S(e,"bpmn:SubProcess")&&t.findRoot(Ei(e))},br.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=ie(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var r=n&&n.get("flowElements")&&n.get("flowElements").length;Ct(i.html).toggle(fk,!r)}},br.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=ie(e),r=n.get({element:e,type:"drilldown"});r.length&&this._removeOverlay(e);var o=wt('<button type="button" class="bjs-drilldown">'+pk+"</button>"),a=i.get("name")||i.get("id"),s=this._translate("Open {element}",{element:a});o.setAttribute("title",s),o.addEventListener("click",function(){t.setRootElement(t.findRoot(Ei(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:o}),this._updateOverlayVisibility(e)},br.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},br.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const dk={__depends__:[el,ff,rk],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",Pb],drilldownCentering:["type",Mb],drilldownOverlayBehavior:["type",br],subprocessCompatibility:["type",Yr]};function xr(e){Pt.call(this,e)}Ee(xr,Pt),xr.prototype._modules=[mg,dk,el,ni,ba],xr.prototype._moddleExtensions={};var nl="keyboard.keydown",hk="keyboard.keyup",mk=1e3,Ob="Keyboard binding is now implicit; explicit binding to an element got removed. For more information, see https://github.com/bpmn-io/diagram-js/issues/661";function En(e,t){var n=this;this._config=e=e||{},this._eventBus=t,this._keydownHandler=this._keydownHandler.bind(this),this._keyupHandler=this._keyupHandler.bind(this),t.on("diagram.destroy",function(){n._fire("destroy"),n.unbind()}),e.bindTo&&console.error("unsupported configuration <keyboard.bindTo>",new Error(Ob));var i=e&&e.bind!==!1;t.on("canvas.init",function(r){n._target=r.svg,i&&n.bind(),n._fire("init")})}En.$inject=["config.keyboard","eventBus"],En.prototype._keydownHandler=function(e){this._keyHandler(e,nl)},En.prototype._keyupHandler=function(e){this._keyHandler(e,hk)},En.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||nl,i),n&&e.preventDefault()}},En.prototype._isEventIgnored=function(e){return!1},En.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(Ob)),this.unbind(),e=this._node=this._target,je.bind(e,"keydown",this._keydownHandler),je.bind(e,"keyup",this._keyupHandler),this._fire("bind")},En.prototype.getBinding=function(){return this._node},En.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),je.unbind(e,"keydown",this._keydownHandler),je.unbind(e,"keyup",this._keyupHandler)),this._node=null},En.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},En.prototype.addListener=function(e,t,n){Jt(e)&&(n=t,t=e,e=mk),this._eventBus.on(n||nl,e,t)},En.prototype.removeListener=function(e,t){this._eventBus.off(t||nl,e)},En.prototype.hasModifier=CM,En.prototype.isCmd=Ln,En.prototype.isShift=ef,En.prototype.isKey=Xt;var gk=500;function Ho(e,t){var n=this;e.on("editorActions.init",gk,function(i){var r=i.editorActions;n.registerBindings(t,r)})}Ho.$inject=["eventBus","keyboard"],Ho.prototype.registerBindings=function(e,t){function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("undo",function(i){var r=i.keyEvent;if(kM(r))return t.trigger("undo"),!0}),n("redo",function(i){var r=i.keyEvent;if(OM(r))return t.trigger("redo"),!0}),n("copy",function(i){var r=i.keyEvent;if(AM(r))return t.trigger("copy"),!0}),n("paste",function(i){var r=i.keyEvent;if(PM(r))return t.trigger("paste"),!0}),n("duplicate",function(i){var r=i.keyEvent;if(MM(r))return t.trigger("duplicate"),!0}),n("cut",function(i){var r=i.keyEvent;if(TM(r))return t.trigger("cut"),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(Xt(["+","Add","="],r)&&Ln(r))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(Xt(["-","Subtract"],r)&&Ln(r))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var r=i.keyEvent;if(Xt("0",r)&&Ln(r))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var r=i.keyEvent;if(Xt(["Backspace","Delete","Del"],r))return t.trigger("removeSelection"),!0})};const Nf={__init__:["keyboard","keyboardBindings"],keyboard:["type",En],keyboardBindings:["type",Ho]};var yk={moveSpeed:50,moveSpeedAccelerated:200};function Db(e,t,n){var i=this;this._config=W({},yk,e||{}),t.addListener(r);function r(o){var a=o.keyEvent,s=i._config;if(t.isCmd(a)&&t.isKey(["ArrowLeft","Left","ArrowUp","Up","ArrowDown","Down","ArrowRight","Right"],a)){var c=t.isShift(a)?s.moveSpeedAccelerated:s.moveSpeed,l;switch(a.key){case"ArrowLeft":case"Left":l="left";break;case"ArrowUp":case"Up":l="up";break;case"ArrowRight":case"Right":l="right";break;case"ArrowDown":case"Down":l="down";break}return i.moveCanvas({speed:c,direction:l}),!0}}this.moveCanvas=function(o){var a=0,s=0,c=o.speed,l=c/Math.min(Math.sqrt(n.viewbox().scale),1);switch(o.direction){case"left":a=l;break;case"up":s=l;break;case"right":a=-l;break;case"down":s=-l;break}n.scroll({dx:a,dy:s})}}Db.$inject=["config.keyboardMove","keyboard","canvas"];const Ib={__depends__:[Nf],__init__:["keyboardMove"],keyboardMove:["type",Db]};var vk=15;function Lb(e,t){var n;function i(s){return a(s.originalEvent)}e.on("canvas.focus.changed",function(s){s.focused?e.on("element.mousedown",500,i):e.off("element.mousedown",i)});function r(s){var c=n.start,l=n.button,u=Hr(s),f=pi(u,c);if(!n.dragging&&bk(f)>vk&&(n.dragging=!0,l===0&&tv(e),Pc("grab")),n.dragging){var p=n.last||n.start;f=pi(u,p),t.scroll({dx:f.x,dy:f.y}),n.last=u}s.preventDefault()}function o(s){je.unbind(document,"mousemove",r),je.unbind(document,"mouseup",o),n=null,ev()}function a(s){if(!Lr(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:Hr(s)},je.bind(document,"mousemove",r),je.bind(document,"mouseup",o),!0}}this.isActive=function(){return!!n}}Lb.$inject=["eventBus","canvas"];function bk(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const Bb={__init__:["moveCanvas"],moveCanvas:["type",Lb]};function Nb(e,t){var n=Zu(e.min),i=Zu(e.max),r=Math.abs(n)+Math.abs(i);return r/t}function xk(e,t){return Math.max(e.min,Math.min(e.max,t))}var _k=Math.sign||function(e){return e>=0?1:-1},$f={min:.2,max:4},$b=10,wk=.1,Ek=.75;function Ci(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=Rn(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||Ek;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}Ci.$inject=["config.zoomScroll","eventBus","canvas"],Ci.prototype.scroll=function(t){this._canvas.scroll(t)},Ci.prototype.reset=function(){this._canvas.zoom("fit-viewport")},Ci.prototype.zoom=function(t,n){var i=Nb($f,$b*2);this._totalDelta+=t,Math.abs(this._totalDelta)>wk&&(this._zoom(t,n,i),this._totalDelta=0)},Ci.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||cy()&&t.metaKey,r=t.shiftKey,o=-1*this._scale,a;if(i?o*=t.deltaMode===0?.02:.32:o*=t.deltaMode===0?1:16,i){var s=n.getBoundingClientRect(),c={x:t.clientX-s.left,y:t.clientY-s.top};a=Math.sqrt(Math.pow(t.deltaY,2)+Math.pow(t.deltaX,2))*_k(t.deltaY)*o,this.zoom(a,c)}else r?a={dx:o*t.deltaY,dy:0}:a={dx:o*t.deltaX,dy:o*t.deltaY},this.scroll(a)}},Ci.prototype.stepZoom=function(t,n){var i=Nb($f,$b);this._zoom(t,n,i)},Ci.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=Zu(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(xk($f,s),t)},Ci.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,r=this._enabled;return typeof t>"u"&&(t=!r),r!==t&&je[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},Ci.prototype._init=function(e){this.toggle(e)};const Fb={__init__:["zoomScroll"],zoomScroll:["type",Ci]};function Ua(e){xr.call(this,e)}Ee(Ua,xr),Ua.prototype._navigationModules=[Ib,Bb,Fb],Ua.prototype._modules=[].concat(xr.prototype._modules,Ua.prototype._navigationModules);function Ff(e){return e&&e[e.length-1]}function jb(e){return e.y}function Hb(e){return e.x}var Sk={left:Hb,center:Hb,right:function(e){return e.x+e.width},top:jb,middle:jb,bottom:function(e){return e.y+e.height}};function zo(e,t){this._modeling=e,this._rules=t}zo.$inject=["modeling","rules"],zo.prototype._getOrientationDetails=function(e){var t=["top","bottom","middle"],n="x",i="width";return t.indexOf(e)!==-1&&(n="y",i="height"),{axis:n,dimension:i}},zo.prototype._isType=function(e,t){return t.indexOf(e)!==-1},zo.prototype._alignmentPosition=function(e,t){var n=this._getOrientationDetails(e),i=n.axis,r=n.dimension,o={},a={},s=!1,c,l,u;function f(p,d){return Math.round((p[i]+d[i]+d[r])/2)}if(this._isType(e,["left","top"]))o[e]=t[0][i];else if(this._isType(e,["right","bottom"]))u=Ff(t),o[e]=u[i]+u[r];else if(this._isType(e,["center","middle"])){if(F(t,function(p){var d=p[i]+Math.round(p[r]/2);a[d]?a[d].elements.push(p):a[d]={elements:[p],center:d}}),c=di(a,function(p){return p.elements.length>1&&(s=!0),p.elements.length}),s)return o[e]=Ff(c).center,o;l=t[0],t=di(t,function(p){return p[i]+p[r]}),u=Ff(t),o[e]=f(l,u)}return o},zo.prototype.trigger=function(e,t){var n=this._modeling,i,r=Ke(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:r}),Be(i)&&(r=i),!(r.length<2||!i)){var o=Sk[t],a=di(r,o),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const Rk={__init__:["alignElements"],alignElements:["type",zo]},Ck=new Bo;function Go(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}Go.$inject=["eventBus"],Go.prototype.schedule=function(e,t=Ck.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},Go.prototype._schedule=function(e,t){const n=Ak();return{executionId:setTimeout(()=>{try{this._scheduled[t]=null;try{n.resolve(e())}catch(r){n.reject(r)}}catch(r){console.error("Scheduler#_schedule execution failed",r)}}),promise:n.promise}},Go.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},Go.prototype._cancel=function(e){clearTimeout(e.executionId)};function Ak(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const Pk={scheduler:["type",Go]};var Mk="djs-element-hidden",il=".entry",Tk=1e3,zb=8,kk=300;function Ht(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}Ht.$inject=["canvas","elementRegistry","eventBus","scheduler"],Ht.prototype._init=function(){var e=this;this._eventBus.on("selection.changed",function(t){var n=t.newSelection,i=n.length?n.length===1?n[0]:n:null;i?e.open(i,!0):e.close()}),this._eventBus.on("elements.changed",function(t){var n=t.elements,i=e._current;if(i){var r=i.target,o=Be(r)?r:[r],a=o.filter(function(c){return n.includes(c)});if(a.length){e.close();var s=o.filter(function(c){return e._elementRegistry.get(c.id)});s.length&&e._updateAndOpen(s.length>1?s:s[0])}}}),this._eventBus.on("canvas.viewbox.changed",function(){e._updatePosition()}),this._eventBus.on("element.marker.update",function(t){if(e.isOpen()){var n=t.element,i=e._current,r=Be(i.target)?i.target:[i.target];r.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},Ht.prototype._createContainer=function(){var e=wt('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},Ht.prototype.registerProvider=function(e,t){t||(t=e,e=Tk),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},Ht.prototype.getEntries=function(e){var t=this._getProviders(),n=Be(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return F(t,function(r){if(Jt(r[n])){var o=r[n](e);Jt(o)?i=o(i):F(o,function(a,s){i[s]=a})}}),i},Ht.prototype.trigger=function(e,t,n){var i=this,r,o,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(r=gn(a,"data-action"),o=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(r,"hover",o,n)},kk);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(r,e,o,n)},Ht.prototype.triggerEntry=function(e,t,n,i){if(this.isShown()){var r=this._current.target,o=this._current.entries,a=o[e];if(a){var s=a.action;if(this._eventBus.fire("contextPad.trigger",{entry:a,event:n})!==!1){if(Jt(s)){if(t==="click")return s(n,r,i)}else if(s[t])return s[t](n,r,i);n.preventDefault()}}}},Ht.prototype.open=function(e,t){if(!(!t&&this.isOpen(e))){var n=this._eventBus.fire("contextPad.open.allowed",{target:e});n!==!1&&(this.close(),this._updateAndOpen(e))}},Ht.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Ht.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),i;F(t,function(r,o){var a=r.group||"default",s=wt(r.html||'<div class="entry" draggable="true"></div>'),c;gn(s,"data-action",o),c=ft("[data-group="+Wa(a)+"]",n),c||(c=wt('<div class="group"></div>'),gn(c,"data-group",a),n.appendChild(c)),c.appendChild(s),r.className&&Ok(s,r.className),r.title&&gn(s,"title",r.title),r.imageUrl&&(i=wt("<img>"),gn(i,"src",r.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),Ct(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},Ht.prototype._createHtml=function(e){var t=this,n=wt('<div class="djs-context-pad"></div>');return On.bind(n,il,"click",function(i){t.trigger("click",i)}),On.bind(n,il,"dragstart",function(i){t.trigger("dragstart",i)}),On.bind(n,il,"mouseover",function(i){t.trigger("mouseover",i)}),On.bind(n,il,"mouseout",function(i){t.trigger("mouseout",i)}),je.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},Ht.prototype.getPad=function(e){console.warn(new Error("ContextPad#getPad is deprecated and will be removed in future library versions, cf. https://github.com/bpmn-io/diagram-js/pull/888"));let t;return this.isOpen()&&Ik(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},Ht.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},Ht.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return Be(e)!==Be(n)?!1:Be(e)?e.length===n.length&&kr(e,function(i){return n.includes(i)}):n===e},Ht.prototype.isShown=function(){return this.isOpen()&&Ct(this._current.html).has("open")},Ht.prototype.show=function(){this.isOpen()&&(Ct(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},Ht.prototype.hide=function(){this.isOpen()&&(Ct(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},Ht.prototype._getPosition=function(e){if(!Be(e)&&ht(e)){var t=this._canvas.viewbox(),n=Dk(e),i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale;return{left:i+zb*this._canvas.zoom(),top:r}}var o=this._canvas.getContainer(),a=o.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+zb*this._canvas.zoom(),top:s.top-a.top}},Ht.prototype._updatePosition=function(){const e=()=>{if(this.isOpen()){var t=this._current.html,n=this._getPosition(this._current.target);"x"in n&&"y"in n?(t.style.left=n.x+"px",t.style.top=n.y+"px"):["top","right","bottom","left"].forEach(function(i){i in n&&(t.style[i]=n[i]+"px")})}};this._scheduler.schedule(e,"ContextPad#_updatePosition")},Ht.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=Be(n)?n:[n],r=i.some(function(o){return t._canvas.hasMarker(o,Mk)});r?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},Ht.prototype._getTargetBounds=function(e){var t=this,n=Be(e)?e:[e],i=n.map(function(r){return t._canvas.getGraphics(r)});return i.reduce(function(r,o){const a=o.getBoundingClientRect();return r.top=Math.min(r.top,a.top),r.right=Math.max(r.right,a.right),r.bottom=Math.max(r.bottom,a.bottom),r.left=Math.min(r.left,a.left),r.x=r.left,r.y=r.top,r.width=r.right-r.left,r.height=r.bottom-r.top,r},{top:1/0,right:-1/0,bottom:-1/0,left:1/0})};function Ok(e,t){var n=Ct(e);t=Be(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function Dk(e){return e.waypoints[e.waypoints.length-1]}function Ik(e,t){return e=Be(e)?e:[e],t=Be(t)?t:[t],e.length===t.length&&kr(e,function(n){return t.includes(n)})}const Gb={__depends__:[Ac,Pk,el],contextPad:["type",Ht]};var rl,Tt,Vb,_r,Wb,Ub,Yb,jf,ol,Ya,qb,Hf,zf,Gf,al={},sl=[],Lk=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,cl=Array.isArray;function Wi(e,t){for(var n in t)e[n]=t[n];return e}function Vf(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Kb(e,t,n){var i,r,o,a={};for(o in t)o=="key"?i=t[o]:o=="ref"?r=t[o]:a[o]=t[o];if(arguments.length>2&&(a.children=arguments.length>3?rl.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(o in e.defaultProps)a[o]===void 0&&(a[o]=e.defaultProps[o]);return ll(e,a,i,r,null)}function ll(e,t,n,i,r){var o={type:e,props:t,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r??++Vb,__i:-1,__u:0};return r==null&&Tt.vnode!=null&&Tt.vnode(o),o}function ul(e){return e.children}function pl(e,t){this.props=e,this.context=t}function qr(e,t){if(t==null)return e.__?qr(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?qr(e):null}function Bk(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],r=[],o=Wi({},t);o.__v=t.__v+1,Tt.vnode&&Tt.vnode(o),Wf(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??qr(t),!!(32&t.__u),r),o.__v=t.__v,o.__.__k[o.__i]=o,ix(i,o,r),t.__e=t.__=null,o.__e!=n&&Xb(o)}}function Xb(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),Xb(e)}function Zb(e){(!e.__d&&(e.__d=!0)&&_r.push(e)&&!fl.__r++||Wb!=Tt.debounceRendering)&&((Wb=Tt.debounceRendering)||Ub)(fl)}function fl(){try{for(var e,t=1;_r.length;)_r.length>t&&_r.sort(Yb),e=_r.shift(),t=_r.length,Bk(e)}finally{_r.length=fl.__r=0}}function Qb(e,t,n,i,r,o,a,s,c,l,u){var f,p,d,m,h,y,v=i&&i.__k||sl,g=t.length;for(c=Nk(n,t,v,c,g),f=0;f<g;f++)(d=n.__k[f])!=null&&(p=d.__i!=-1&&v[d.__i]||al,d.__i=f,y=Wf(e,d,p,r,o,a,s,c,l,u),m=d.__e,d.ref&&p.ref!=d.ref&&(p.ref&&Uf(p.ref,null,d),u.push(d.ref,d.__c||m,d)),h==null&&m!=null&&(h=m),4&d.__u?(c=Jb(d,c,e),p.__e&&(p.__e=null)):typeof d.type=="function"&&y!==void 0?c=y:m&&(c=m.nextSibling),d.__u&=-7);return n.__e=h,c}function Nk(e,t,n,i,r){var o,a,s,c,l,u=n.length,f=u,p=0;for(e.__k=new Array(r),o=0;o<r;o++)(a=t[o])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?a=e.__k[o]=ll(null,a,null,null,null):cl(a)?a=e.__k[o]=ll(ul,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=ll(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[o]=a,c=o+p,a.__=e,a.__b=e.__b+1,s=null,(l=a.__i=$k(a,n,c,f))!=-1&&(f--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(r>u?p--:r<u&&p++),typeof a.type!="function"&&(a.__u|=4)):l!=c&&(l==c-1?p--:l==c+1?p++:(l>c?p--:p++,a.__u|=4))):e.__k[o]=null;if(f)for(o=0;o<u;o++)(s=n[o])!=null&&(2&s.__u)==0&&(s.__e==i&&(i=qr(s)),ox(s,s));return i}function Jb(e,t,n){var i,r;if(typeof e.type=="function"){for(i=e.__k,r=0;i&&r<i.length;r++)i[r]&&(i[r].__=e,t=Jb(i[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=qr(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function $k(e,t,n,i){var r,o,a,s=e.key,c=e.type,l=t[n],u=l!=null&&(2&l.__u)==0;if(l===null&&s==null||u&&s==l.key&&c==l.type)return n;if(i>(u?1:0)){for(r=n-1,o=n+1;r>=0||o<t.length;)if((l=t[a=r>=0?r--:o++])!=null&&(2&l.__u)==0&&s==l.key&&c==l.type)return a}return-1}function ex(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||Lk.test(t)?n:n+"px"}function dl(e,t,n,i,r){var o,a;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof i=="string"&&(e.style.cssText=i=""),i)for(t in i)n&&t in n||ex(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||ex(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(qb,"$1")),a=t.toLowerCase(),t=a in e||t=="onFocusOut"||t=="onFocusIn"?a.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?i?n[Ya]=i[Ya]:(n[Ya]=Hf,e.addEventListener(t,o?Gf:zf,o)):e.removeEventListener(t,o?Gf:zf,o);else{if(r=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function tx(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[ol]==null)t[ol]=Hf++;else if(t[ol]<n[Ya])return;return n(Tt.event?Tt.event(t):t)}}}function Wf(e,t,n,i,r,o,a,s,c,l){var u,f,p,d,m,h,y,v,g,b,x,C,M,k,P,B,D=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[s=t.__e=n.__e]),(u=Tt.__b)&&u(t);e:if(typeof D=="function"){f=a.length;try{if(g=t.props,b=D.prototype&&D.prototype.render,x=(u=D.contextType)&&i[u.__c],C=u?x?x.props.value:u.__:i,n.__c?v=(p=t.__c=n.__c).__=p.__E:(b?t.__c=p=new D(g,C):(t.__c=p=new pl(g,C),p.constructor=D,p.render=jk),x&&x.sub(p),p.state||(p.state={}),p.__n=i,d=p.__d=!0,p.__h=[],p._sb=[]),b&&p.__s==null&&(p.__s=p.state),b&&D.getDerivedStateFromProps!=null&&(p.__s==p.state&&(p.__s=Wi({},p.__s)),Wi(p.__s,D.getDerivedStateFromProps(g,p.__s))),m=p.props,h=p.state,p.__v=t,d)b&&D.getDerivedStateFromProps==null&&p.componentWillMount!=null&&p.componentWillMount(),b&&p.componentDidMount!=null&&p.__h.push(p.componentDidMount);else{if(b&&D.getDerivedStateFromProps==null&&g!==m&&p.componentWillReceiveProps!=null&&p.componentWillReceiveProps(g,C),t.__v==n.__v||!p.__e&&p.shouldComponentUpdate!=null&&p.shouldComponentUpdate(g,p.__s,C)===!1){t.__v!=n.__v&&(p.props=g,p.state=p.__s,p.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(I){I&&(I.__=t)}),sl.push.apply(p.__h,p._sb),p._sb=[],p.__h.length&&a.push(p),s=qr(n);break e}p.componentWillUpdate!=null&&p.componentWillUpdate(g,p.__s,C),b&&p.componentDidUpdate!=null&&p.__h.push(function(){p.componentDidUpdate(m,h,y)})}if(p.context=C,p.props=g,p.__P=e,p.__e=!1,M=Tt.__r,k=0,b)p.state=p.__s,p.__d=!1,M&&M(t),u=p.render(p.props,p.state,p.context),sl.push.apply(p.__h,p._sb),p._sb=[];else do p.__d=!1,M&&M(t),u=p.render(p.props,p.state,p.context),p.state=p.__s;while(p.__d&&++k<25);p.state=p.__s,p.getChildContext!=null&&(i=Wi(Wi({},i),p.getChildContext())),b&&!d&&p.getSnapshotBeforeUpdate!=null&&(y=p.getSnapshotBeforeUpdate(m,h)),P=u!=null&&u.type===ul&&u.key==null?rx(u.props.children):u,s=Qb(e,cl(P)?P:[P],t,n,i,r,o,a,s,c,l),p.base=t.__e,t.__u&=-161,p.__h.length&&a.push(p),v&&(p.__E=p.__=null)}catch(I){if(a.length=f,t.__v=null,c||o!=null){if(I.then){for(t.__u|=c?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;o!=null&&(o[o.indexOf(s)]=null),t.__e=s}else if(o!=null)for(B=o.length;B--;)Vf(o[B])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),I.then||nx(t),Tt.__e(I,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=Fk(n.__e,t,n,i,r,o,a,c,l);return(u=Tt.diffed)&&u(t),128&t.__u?void 0:s}function nx(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(nx))}function ix(e,t,n){for(var i=0;i<n.length;i++)Uf(n[i],n[++i],n[++i]);Tt.__c&&Tt.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){Tt.__e(o,r.__v)}})}function rx(e){return typeof e!="object"||e==null||e.__b>0?e:cl(e)?e.map(rx):e.constructor!==void 0?null:Wi({},e)}function Fk(e,t,n,i,r,o,a,s,c){var l,u,f,p,d,m,h,y=n.props||al,v=t.props,g=t.type;if(g=="svg"?r="http://www.w3.org/2000/svg":g=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),o!=null){for(l=0;l<o.length;l++)if((d=o[l])&&"setAttribute"in d==!!g&&(g?d.localName==g:d.nodeType==3)){e=d,o[l]=null;break}}if(e==null){if(g==null)return document.createTextNode(v);e=document.createElementNS(r,g,v.is&&v),s&&(Tt.__m&&Tt.__m(t,o),s=!1),o=null}if(g==null)y===v||s&&e.data==v||(e.data=v);else{if(o=g=="textarea"&&v.defaultValue!=null?null:o&&rl.call(e.childNodes),!s&&o!=null)for(y={},l=0;l<e.attributes.length;l++)y[(d=e.attributes[l]).name]=d.value;for(l in y)d=y[l],l=="dangerouslySetInnerHTML"?f=d:l=="children"||l in v||l=="value"&&"defaultValue"in v||l=="checked"&&"defaultChecked"in v||dl(e,l,null,d,r);for(l in v)d=v[l],l=="children"?p=d:l=="dangerouslySetInnerHTML"?u=d:l=="value"?m=d:l=="checked"?h=d:s&&typeof d!="function"||y[l]===d||dl(e,l,d,y[l],r);if(u)s||f&&(u.__html==f.__html||u.__html==e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(f&&(e.innerHTML=""),Qb(t.type=="template"?e.content:e,cl(p)?p:[p],t,n,i,g=="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,a,o?o[0]:n.__k&&qr(n,0),s,c),o!=null)for(l=o.length;l--;)Vf(o[l]);s&&g!="textarea"||(l="value",g=="progress"&&m==null?e.removeAttribute("value"):m!=null&&(m!==e[l]||g=="progress"&&!m||g=="option"&&m!=y[l])&&dl(e,l,m,y[l],r),l="checked",h!=null&&h!=e[l]&&dl(e,l,h,y[l],r))}return e}function Uf(e,t,n){try{if(typeof e=="function"){var i=typeof e.__u=="function";i&&e.__u(),i&&t==null||(e.__u=e(t))}else e.current=t}catch(r){Tt.__e(r,n)}}function ox(e,t,n){var i,r;if(Tt.unmount&&Tt.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||Uf(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){Tt.__e(o,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&ox(i[r],t,n||typeof e.type!="function");n||Vf(e.__e),e.__c=e.__=e.__e=void 0}function jk(e,t,n){return this.constructor(e,n)}function ax(e,t,n){var i,r,o,a;t==document&&(t=document.documentElement),Tt.__&&Tt.__(e,t),r=(i=!1)?null:t.__k,o=[],a=[],Wf(t,e=t.__k=Kb(ul,null,[e]),r||al,al,t.namespaceURI,r?null:t.firstChild?rl.call(t.childNodes):null,o,r?r.__e:t.firstChild,i,a),ix(o,e,a),e.props.children=null}rl=sl.slice,Tt={__e:function(e,t,n,i){for(var r,o,a;t=t.__;)if((r=t.__c)&&!r.__)try{if((o=r.constructor)&&o.getDerivedStateFromError!=null&&(r.setState(o.getDerivedStateFromError(e)),a=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(e,i||{}),a=r.__d),a)return r.__E=r}catch(s){e=s}throw e}},Vb=0,pl.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Wi({},this.state),typeof e=="function"&&(e=e(Wi({},n),this.props)),e&&Wi(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Zb(this))},pl.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Zb(this))},pl.prototype.render=ul,_r=[],Ub=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Yb=function(e,t){return e.__v.__b-t.__v.__b},fl.__r=0,jf=Math.random().toString(8),ol="__d"+jf,Ya="__a"+jf,qb=/(PointerCapture)$|Capture$/i,Hf=0,zf=tx(!1),Gf=tx(!0);var sx=function(e,t,n,i){var r;t[0]=0;for(var o=1;o<t.length;o++){var a=t[o++],s=t[o]?(t[0]|=a?1:2,n[t[o++]]):t[++o];a===3?i[0]=s:a===4?i[1]=Object.assign(i[1]||{},s):a===5?(i[1]=i[1]||{})[t[++o]]=s:a===6?i[1][t[++o]]+=s+"":a?(r=e.apply(s,sx(e,s,n,["",null])),i.push(r),s[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(s)}return i},cx=new Map;function Hk(e){var t=cx.get(this);return t||(t=new Map,cx.set(this,t)),(t=sx(this,t.get(e)||(t.set(e,t=(function(n){for(var i,r,o=1,a="",s="",c=[0],l=function(p){o===1&&(p||(a=a.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?c.push(0,p,a):o===3&&(p||a)?(c.push(3,p,a),o=2):o===2&&a==="..."&&p?c.push(4,p,0):o===2&&a&&!p?c.push(5,0,!0,a):o>=5&&((a||!p&&o===5)&&(c.push(o,0,a,r),o=6),p&&(c.push(o,p,0,r),o=6)),a=""},u=0;u<n.length;u++){u&&(o===1&&l(),l(u));for(var f=0;f<n[u].length;f++)i=n[u][f],o===1?i==="<"?(l(),c=[c],o=3):a+=i:o===4?a==="--"&&i===">"?(o=1,a=""):a=i+a[0]:s?i===s?s="":a+=i:i==='"'||i==="'"?s=i:i===">"?(l(),o=1):o&&(i==="="?(o=5,r=a,a=""):i==="/"&&(o<5||n[u][f+1]===">")?(l(),o===3&&(c=c[0]),o=c,(c=c[0]).push(2,0,o),o=0):i===" "||i===" "||i===`
|
|
11
|
-
`||i==="\r"?(l(),o=2):a+=i),o===3&&a==="!--"&&(o=4,c=c[0])}return l(),c})(e)),t),arguments,[])).length>1?t:t[0]}var gt=
|
|
10
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="`+p+'" height="'+d+'" viewBox="'+u+" "+f+" "+p+" "+d+'" version="1.1">'+s+a+"</svg>"}catch(i){n=i}if(this._emit("saveSVG.done",{error:n,svg:t}),n)throw n;return{svg:t}},Pt.prototype._setDefinitions=function(e){this._definitions=e},Pt.prototype.getModules=function(){return this._modules},Pt.prototype.clear=function(){this.getDefinitions()&&ar.prototype.clear.call(this)},Pt.prototype.destroy=function(){ar.prototype.destroy.call(this),vi(this._container)},Pt.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},Pt.prototype.off=function(e,t){this.get("eventBus").off(e,t)},Pt.prototype.attachTo=function(e){if(!e)throw new Error("parentNode required");this.detach(),e.get&&e.constructor.prototype.jquery&&(e=e.get(0)),typeof e=="string"&&(e=ft(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},Pt.prototype.getDefinitions=function(){return this._definitions},Pt.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},Pt.prototype._init=function(e,t,n){const i=n.modules||this.getModules(n),r=n.additionalModules||[],o=[{bpmnjs:["value",this],moddle:["value",t]}],a=[].concat(o,i,r),s=W(hi(n,["additionalModules"]),{canvas:W({},n.canvas,{container:e}),modules:a});ar.call(this,s),n&&n.container&&this.attachTo(n.container)},Pt.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},Pt.prototype._createContainer=function(e){const t=wt('<div class="bjs-container"></div>');return wn(t,{width:ag(e.width),height:ag(e.height),position:e.position}),t},Pt.prototype._createModdle=function(e){const t=W({},this._moddleExtensions,e.moddleExtensions);return new eh(t)},Pt.prototype._modules=[];function Ks(e,t){return e.warnings=t,e}function fC(e){const n=/unparsable content <([^>]+)> detected([\s\S]*)$/.exec(e.message);return n&&(e.message="unparsable content <"+n[1]+"> detected; this may indicate an invalid BPMN 2.0 diagram file"+n[2]),e}const dC={width:"100%",height:"100%",position:"relative"};function ag(e){return e+(Fe(e)?"px":"")}function hC(e,t){return t&&vt(e.diagrams,function(n){return n.id===t})||null}function mC(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+ng+"</a>",i=wt(n);wn(ft("svg",i),ig),wn(i,rg,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),je.bind(i,"click",function(r){pC(),r.preventDefault()})}function wo(e){Pt.call(this,e),this.on("import.parse.complete",function(t){t.error||this._collectIds(t.definitions,t.elementsById)},this),this.on("diagram.destroy",function(){this.get("moddle").ids.clear()},this)}Ee(wo,Pt),wo.prototype._createModdle=function(e){var t=Pt.prototype._createModdle.call(this,e);return t.ids=new yi([32,36,1]),t},wo.prototype._collectIds=function(e,t){var n=e.$model,i=n.ids,r;i.clear();for(r in t)i.claim(r,t[r])};function Qe(e,t){return S(e,"bpmn:CallActivity")?!1:S(e,"bpmn:SubProcess")?(t=t||ot(e),t&&S(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):S(e,"bpmn:Participant")?!!ie(e).processRef:!0}function tn(e){if(!(!S(e,"bpmn:Participant")&&!S(e,"bpmn:Lane"))){var t=ot(e).isHorizontal;return t===void 0?!0:t}}function gC(e){return e&&ie(e).isInterrupting!==!1}function vn(e){return e&&!!ie(e).triggeredByEvent}function Eo(e,t){var n=ie(e).eventDefinitions;return Xi(n,function(i){return S(i,t)})}function yC(e){return Eo(e,"bpmn:ErrorEventDefinition")}function vC(e){return Eo(e,"bpmn:EscalationEventDefinition")}function bC(e){return Eo(e,"bpmn:CompensateEventDefinition")}var Fr={width:90,height:20},sg=15;function sr(e){return S(e,"bpmn:Event")||S(e,"bpmn:Gateway")||S(e,"bpmn:DataStoreReference")||S(e,"bpmn:DataObjectReference")||S(e,"bpmn:DataInput")||S(e,"bpmn:DataOutput")||S(e,"bpmn:SequenceFlow")||S(e,"bpmn:MessageFlow")||S(e,"bpmn:Group")}function Xs(e){return Ye(e.label)}function xC(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=_C(e),o=Math.atan((i.y-n.y)/(i.x-n.x)),a=r.x,s=r.y;return Math.abs(o)<Math.PI/2?s-=sg:a+=sg,{x:a,y:s}}function _C(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)];return{x:n.x+(i.x-n.x)/2,y:n.y+(i.y-n.y)/2}}function Yu(e){return e.waypoints?xC(e.waypoints):S(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+Fr.height/2}:{x:e.x+e.width/2,y:e.y+e.height+Fr.height/2}}function wC(e,t){var n,i,r,o=e.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(Fr.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=Yu(t),i=Fr),W({x:n.x-i.width/2,y:n.y-i.height/2},i)}function cg(e){if(S(e,"bpmn:FlowElement")||S(e,"bpmn:Participant")||S(e,"bpmn:Lane")||S(e,"bpmn:SequenceFlow")||S(e,"bpmn:MessageFlow")||S(e,"bpmn:DataInput")||S(e,"bpmn:DataOutput"))return"name";if(S(e,"bpmn:TextAnnotation"))return"text";if(S(e,"bpmn:Group"))return"categoryValueRef"}function EC(e){var t=e.categoryValueRef;return t&&t.value||""}function qn(e){var t=e.businessObject,n=cg(t);if(n)return n==="categoryValueRef"?EC(t):t[n]||""}function SC(e,t){var n=e.businessObject,i=cg(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function RC(e){return Ye(e)&&sr(e.labelTarget)}var So=7;function lg(e){let t=[];return F(e.incoming,n=>{S(n,"bpmn:Association")&&S(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),F(e.outgoing,n=>{S(n,"bpmn:Association")&&S(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function ga(e){const t=new Map;return F(ju(e),n=>{F(lg(n),i=>{t.has(i.annotation)||t.set(i.annotation,{annotation:i.annotation,associations:[]}),t.get(i.annotation).associations.push(i.association)})}),[...t.values()]}var qu="hsl(225, 10%, 15%)",CC="white";function wi(e,t){return Xi(e.eventDefinitions,function(n){return n.$type===t})}function AC(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function PC(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function Ze(e,t,n){var i=ot(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||CC}function be(e,t,n){var i=ot(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||qu}function ya(e,t,n,i){var r=ot(e),o=r.get("label");return i||o&&o.get("color:color")||t||be(e,n)}function ug(e){var t=e.x+e.width/2,n=e.y+e.height/2,i=e.width/2,r=[["M",t,n],["m",0,-i],["a",i,i,0,1,1,0,2*i],["a",i,i,0,1,1,0,-2*i],["z"]];return Br(r)}function Ku(e,t){var n=e.x,i=e.y,r=e.width,o=e.height,a=[["M",n+t,i],["l",r-t*2,0],["a",t,t,0,0,1,t,t],["l",0,o-t*2],["a",t,t,0,0,1,-t,t],["l",t*2-r,0],["a",t,t,0,0,1,-t,-t],["l",0,t*2-o],["a",t,t,0,0,1,t,-t],["z"]];return Br(a)}function MC(e){var t=e.width,n=e.height,i=e.x,r=e.y,o=t/2,a=n/2,s=[["M",i+o,r],["l",o,a],["l",-o,a],["l",-o,-a],["z"]];return Br(s)}function TC(e){var t=e.x,n=e.y,i=e.width,r=e.height,o=[["M",t,n],["l",i,0],["l",0,r],["l",-i,0],["z"]];return Br(o)}function va(e,t={}){return{width:Qn(e,t),height:In(e,t)}}function Qn(e,t={}){return Mn(t,"width")?t.width:e.width}function In(e,t={}){return Mn(t,"height")?t.height:e.height}var kC=new yi,OC=10,Zs=3,DC=1.5,Qs=10,IC=4,Ro=.95,LC=1,BC=.25;function jr(e,t,n,i,r,o,a){Ii.call(this,t,a);var s=e&&e.defaultFillColor,c=e&&e.defaultStrokeColor,l=e&&e.defaultLabelColor;function u(T){return n.computeStyle(T,{strokeLinecap:"round",strokeLinejoin:"round",stroke:qu,strokeWidth:2,fill:"white"})}function f(T){return n.computeStyle(T,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:qu,strokeWidth:2})}function p(T,w){var{ref:E={x:0,y:0},scale:G=1,element:U,parentGfx:X=r._svg}=w,Ce=Oe("marker",{id:T,viewBox:"0 0 20 20",refX:E.x,refY:E.y,markerWidth:20*G,markerHeight:20*G,orient:"auto"});ze(Ce,U);var Ue=ft(":scope > defs",X);Ue||(Ue=Oe("defs"),ze(X,Ue)),ze(Ue,Ce)}function d(T,w,E,G){var U=kC.nextPrefixed("marker-");return m(T,U,w,E,G),"url(#"+U+")"}function m(T,w,E,G,U){if(E==="sequenceflow-end"){var X=Oe("path",{d:"M 1 5 L 11 10 L 1 15 Z",...u({fill:U,stroke:U,strokeWidth:1})});p(w,{element:X,ref:{x:11,y:10},scale:.5,parentGfx:T})}if(E==="messageflow-start"){var Ce=Oe("circle",{cx:6,cy:6,r:3.5,...u({fill:G,stroke:U,strokeWidth:1,strokeDasharray:[1e4,1]})});p(w,{element:Ce,ref:{x:6,y:6},parentGfx:T})}if(E==="messageflow-end"){var Ue=Oe("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...u({fill:G,stroke:U,strokeWidth:1,strokeDasharray:[1e4,1]})});p(w,{element:Ue,ref:{x:8.5,y:5},parentGfx:T})}if(E==="association-start"){var st=Oe("path",{d:"M 11 5 L 1 10 L 11 15",...f({fill:"none",stroke:U,strokeWidth:1.5,strokeDasharray:[1e4,1]})});p(w,{element:st,ref:{x:1,y:10},scale:.5,parentGfx:T})}if(E==="association-end"){var Ot=Oe("path",{d:"M 1 5 L 11 10 L 1 15",...f({fill:"none",stroke:U,strokeWidth:1.5,strokeDasharray:[1e4,1]})});p(w,{element:Ot,ref:{x:11,y:10},scale:.5,parentGfx:T})}if(E==="conditional-flow-marker"){var pt=Oe("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...u({fill:G,stroke:U})});p(w,{element:pt,ref:{x:-1,y:10},scale:.5,parentGfx:T})}if(E==="conditional-default-flow-marker"){var Wt=Oe("path",{d:"M 6 4 L 10 16",...u({stroke:U,fill:"none"})});p(w,{element:Wt,ref:{x:0,y:10},scale:.5,parentGfx:T})}}function h(T,w,E,G,U={}){Qt(G)&&(U=G,G=0),G=G||0,U=u(U);var X=w/2,Ce=E/2,Ue=Oe("circle",{cx:X,cy:Ce,r:Math.round((w+E)/4-G),...U});return ze(T,Ue),Ue}function y(T,w,E,G,U,X){Qt(U)&&(X=U,U=0),U=U||0,X=u(X);var Ce=Oe("rect",{x:U,y:U,width:w-U*2,height:E-U*2,rx:G,ry:G,...X});return ze(T,Ce),Ce}function v(T,w,E,G){var U=w/2,X=E/2,Ce=[{x:U,y:0},{x:w,y:X},{x:U,y:E},{x:0,y:X}],Ue=Ce.map(function(Ot){return Ot.x+","+Ot.y}).join(" ");G=u(G);var st=Oe("polygon",{...G,points:Ue});return ze(T,st),st}function g(T,w,E,G){E=f(E);var U=la(w,E,G);return ze(T,U),U}function b(T,w,E){return g(T,w,E,5)}function x(T,w,E){E=f(E);var G=Oe("path",{...E,d:w});return ze(T,G),G}function C(T,w,E,G){return x(w,E,W({"data-marker":T},G))}function M(T){return yt[T]}function k(T){return function(w,E,G){return M(T)(w,E,G)}}var P={"bpmn:MessageEventDefinition":function(T,w,E={},G){var U=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:E.width||w.width,containerHeight:E.height||w.height,position:{mx:.235,my:.315}}),X=G?be(w,c,E.stroke):Ze(w,s,E.fill),Ce=G?Ze(w,s,E.fill):be(w,c,E.stroke),Ue=x(T,U,{fill:X,stroke:Ce,strokeWidth:1});return Ue},"bpmn:TimerEventDefinition":function(T,w,E={}){var G=E.width||w.width,U=E.height||w.height,X=E.width?1:2,Ce=h(T,G,U,.2*U,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:X}),Ue=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:G,containerHeight:U,position:{mx:.5,my:.5}});x(T,Ue,{stroke:be(w,c,E.stroke),strokeWidth:X});for(var st=0;st<12;st++){var Ot=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:G,containerHeight:U,position:{mx:.5,my:.5}}),pt=G/2,Wt=U/2;x(T,Ot,{strokeWidth:1,stroke:be(w,c,E.stroke),transform:"rotate("+st*30+","+Wt+","+pt+")"})}return Ce},"bpmn:EscalationEventDefinition":function(T,w,E={},G){var U=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width||w.width,containerHeight:E.height||w.height,position:{mx:.5,my:.2}}),X=G?be(w,c,E.stroke):Ze(w,s,E.fill);return x(T,U,{fill:X,stroke:be(w,c,E.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(T,w,E={}){var G=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width||w.width,containerHeight:E.height||w.height,position:{mx:.5,my:.222}});return x(T,G,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(T,w,E={},G){var U=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width,containerHeight:w.height,position:{mx:.57,my:.263}}),X=G?be(w,c,E.stroke):Ze(w,s,E.fill);return x(T,U,{fill:X,stroke:be(w,c,E.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(T,w,E={},G){var U=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:E.width||w.width,containerHeight:E.height||w.height,position:{mx:.2,my:.722}}),X=G?be(w,c,E.stroke):Ze(w,s,E.fill);return x(T,U,{fill:X,stroke:be(w,c,E.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(T,w,E={},G){var U=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width,containerHeight:w.height,position:{mx:.638,my:-.055}}),X=G?be(w,c,E.stroke):"none",Ce=x(T,U,{fill:X,stroke:be(w,c,E.stroke),strokeWidth:1});return eg(Ce,45),Ce},"bpmn:CompensateEventDefinition":function(T,w,E={},G){var U=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width||w.width,containerHeight:E.height||w.height,position:{mx:.22,my:.5}}),X=G?be(w,c,E.stroke):Ze(w,s,E.fill);return x(T,U,{fill:X,stroke:be(w,c,E.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(T,w,E={},G){var U=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:E.width||w.width,containerHeight:E.height||w.height,position:{mx:.5,my:.2}}),X=G?be(w,c,E.stroke):Ze(w,s,E.fill);return x(T,U,{strokeWidth:1,fill:X,stroke:be(w,c,E.stroke)})},"bpmn:MultipleEventDefinition":function(T,w,E={},G){var U=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:E.width||w.width,containerHeight:E.height||w.height,position:{mx:.211,my:.36}}),X=G?be(w,c,E.stroke):Ze(w,s,E.fill);return x(T,U,{fill:X,stroke:be(w,c,E.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(T,w,E={}){var G=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:E.width||w.width,containerHeight:E.height||w.height,position:{mx:.458,my:.194}});return x(T,G,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(T,w,E={}){var G=h(T,w.width,w.height,8,{fill:be(w,c,E.stroke),stroke:be(w,c,E.stroke),strokeWidth:4});return G}};function B(T,w,E={},G){var U=ie(T),X=AC(U),Ce=G||T;return U.get("eventDefinitions")&&U.get("eventDefinitions").length>1?U.get("parallelMultiple")?P["bpmn:ParallelMultipleEventDefinition"](w,Ce,E,X):P["bpmn:MultipleEventDefinition"](w,Ce,E,X):wi(U,"bpmn:MessageEventDefinition")?P["bpmn:MessageEventDefinition"](w,Ce,E,X):wi(U,"bpmn:TimerEventDefinition")?P["bpmn:TimerEventDefinition"](w,Ce,E,X):wi(U,"bpmn:ConditionalEventDefinition")?P["bpmn:ConditionalEventDefinition"](w,Ce,E,X):wi(U,"bpmn:SignalEventDefinition")?P["bpmn:SignalEventDefinition"](w,Ce,E,X):wi(U,"bpmn:EscalationEventDefinition")?P["bpmn:EscalationEventDefinition"](w,Ce,E,X):wi(U,"bpmn:LinkEventDefinition")?P["bpmn:LinkEventDefinition"](w,Ce,E,X):wi(U,"bpmn:ErrorEventDefinition")?P["bpmn:ErrorEventDefinition"](w,Ce,E,X):wi(U,"bpmn:CancelEventDefinition")?P["bpmn:CancelEventDefinition"](w,Ce,E,X):wi(U,"bpmn:CompensateEventDefinition")?P["bpmn:CompensateEventDefinition"](w,Ce,E,X):wi(U,"bpmn:TerminateEventDefinition")?P["bpmn:TerminateEventDefinition"](w,Ce,E,X):null}var D={ParticipantMultiplicityMarker:function(T,w,E={}){var G=Qn(w,E),U=In(w,E),X=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:U,position:{mx:(G/2-6)/G,my:(U-15)/U}});C("participant-multiplicity",T,X,{strokeWidth:2,fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke)})},SubProcessMarker:function(T,w,E={}){var G=y(T,14,14,0,{strokeWidth:1,fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke)});ln(G,w.width/2-7.5,w.height-20);var U=i.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:w.width,containerHeight:w.height,position:{mx:(w.width/2-7.5)/w.width,my:(w.height-20)/w.height}});C("sub-process",T,U,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke)})},ParallelMarker:function(T,w,E){var G=Qn(w,E),U=In(w,E),X=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:U,position:{mx:(G/2+E.parallel)/G,my:(U-20)/U}});C("parallel",T,X,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke)})},SequentialMarker:function(T,w,E){var G=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width,containerHeight:w.height,position:{mx:(w.width/2+E.seq)/w.width,my:(w.height-19)/w.height}});C("sequential",T,G,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke)})},CompensationMarker:function(T,w,E){var G=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width,containerHeight:w.height,position:{mx:(w.width/2+E.compensation)/w.width,my:(w.height-13)/w.height}});C("compensation",T,G,{strokeWidth:1,fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke)})},LoopMarker:function(T,w,E){var G=Qn(w,E),U=In(w,E),X=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:U,position:{mx:(G/2+E.loop)/G,my:(U-7)/U}});C("loop",T,X,{strokeWidth:1.5,fill:"none",stroke:be(w,c,E.stroke),strokeMiterlimit:.5})},AdhocMarker:function(T,w,E){var G=Qn(w,E),U=In(w,E),X=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:U,position:{mx:(G/2+E.adhoc)/G,my:(U-15)/U}});C("adhoc",T,X,{strokeWidth:1,fill:be(w,c,E.stroke),stroke:be(w,c,E.stroke)})}};function I(T,w,E,G){D[T](w,E,G)}function z(T,w,E=[],G={}){G={fill:G.fill,stroke:G.stroke,width:Qn(w,G),height:In(w,G)};var U=ie(w),X=E.includes("SubProcessMarker");X?G={...G,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:G={...G,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},U.get("isForCompensation")&&E.push("CompensationMarker"),S(U,"bpmn:AdHocSubProcess")&&(E.push("AdhocMarker"),X||W(G,{compensation:G.compensation-18}));var Ce=U.get("loopCharacteristics"),Ue=Ce&&Ce.get("isSequential");Ce&&(W(G,{compensation:G.compensation-18}),E.includes("AdhocMarker")&&W(G,{seq:-23,loop:-18,parallel:-24}),Ue===void 0&&E.push("LoopMarker"),Ue===!1&&E.push("ParallelMarker"),Ue===!0&&E.push("SequentialMarker")),E.includes("CompensationMarker")&&E.length===1&&W(G,{compensation:-8}),F(E,function(st){I(st,T,w,G)})}function oe(T,w,E={}){E=W({size:{width:100}},E);var G=o.createText(w||"",E);return et(G).add("djs-label"),ze(T,G),G}function ye(T,w,E,G={}){var U=ie(w),X=va({x:w.x,y:w.y,width:w.width,height:w.height},G);return oe(T,U.name,{align:E,box:X,padding:7,style:{fill:ya(w,l,c,G.stroke)}})}function Ve(T,w,E={}){var G={width:w.width,height:w.height,x:w.width/2+w.x,y:w.height/2+w.y};return oe(T,qn(w),{box:G,style:W({},o.getExternalStyle(),{fill:ya(w,l,c,E.stroke)})})}function He(T,w,E,G={}){var U=tn(E),X=oe(T,w,{box:{height:30,width:U?In(E,G):Qn(E,G)},align:"center-middle",style:{fill:ya(E,l,c,G.stroke)}});if(U){var Ce=-1*In(E,G);Ys(X,0,-Ce,270)}}function it(T,w,E={}){var{width:G,height:U}=va(w,E);return y(T,G,U,Qs,{...E,fill:Ze(w,s,E.fill),fillOpacity:Ro,stroke:be(w,c,E.stroke)})}function K(T,w,E={}){var G=ie(w),U=Ze(w,s,E.fill),X=be(w,c,E.stroke);return(G.get("associationDirection")==="One"||G.get("associationDirection")==="Both")&&(E.markerEnd=d(T,"association-end",U,X)),G.get("associationDirection")==="Both"&&(E.markerStart=d(T,"association-start",U,X)),E=at(E,["markerStart","markerEnd"]),b(T,w.waypoints,{...E,stroke:X,strokeDasharray:"0, 5"})}function Z(T,w,E={}){var G=Ze(w,s,E.fill),U=be(w,c,E.stroke),X=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width,containerHeight:w.height,position:{mx:.474,my:.296}}),Ce=x(T,X,{fill:G,fillOpacity:Ro,stroke:U}),Ue=ie(w);if(PC(Ue)){var st=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width,containerHeight:w.height,position:{mx:.33,my:(w.height-18)/w.height}});x(T,st,{strokeWidth:2,fill:G,stroke:U})}return Ce}function se(T,w,E={}){return h(T,w.width,w.height,{fillOpacity:Ro,...E,fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke)})}function xe(T,w,E={}){return v(T,w.width,w.height,{fill:Ze(w,s,E.fill),fillOpacity:Ro,stroke:be(w,c,E.stroke)})}function q(T,w,E={}){var G=y(T,Qn(w,E),In(w,E),0,{fill:Ze(w,s,E.fill),fillOpacity:E.fillOpacity||Ro,stroke:be(w,c,E.stroke),strokeWidth:1.5}),U=ie(w);if(S(U,"bpmn:Lane")){var X=U.get("name");He(T,X,w,E)}return G}function V(T,w,E={}){var G=it(T,w,E),U=Qe(w);if(vn(w)&&(Se(G,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!U)){var X=ie(w).flowElements||[],Ce=X.filter(Ue=>S(Ue,"bpmn:StartEvent"));Ce.length===1&&ne(Ce[0],T,E,w)}return ye(T,w,U?"center-top":"center-middle",E),U?z(T,w,void 0,E):z(T,w,["SubProcessMarker"],E),G}function ne(T,w,E,G){var U=22,X={fill:Ze(G,s,E.fill),stroke:be(G,c,E.stroke),width:U,height:U},Ce=ie(T).isInterrupting,Ue=Ce?0:3,st=Ce?1:1.2,Ot=20,pt=(U-Ot)/2,Wt="translate("+pt+","+pt+")";h(w,Ot,Ot,{fill:X.fill,stroke:X.stroke,strokeWidth:st,strokeDasharray:Ue,transform:Wt}),B(T,w,X,G)}function Te(T,w,E={}){var G=it(T,w,E);return ye(T,w,"center-middle",E),z(T,w,void 0,E),G}var yt=this.handlers={"bpmn:AdHocSubProcess":function(T,w,E={}){return Qe(w)?E=at(E,["fill","stroke","width","height"]):E=at(E,["fill","stroke"]),V(T,w,E)},"bpmn:Association":function(T,w,E={}){return E=at(E,["fill","stroke"]),K(T,w,E)},"bpmn:BoundaryEvent":function(T,w,E={}){var{renderIcon:G=!0}=E;E=at(E,["fill","stroke"]);var U=ie(w),X=U.get("cancelActivity");E={strokeWidth:1.5,fill:Ze(w,s,E.fill),fillOpacity:LC,stroke:be(w,c,E.stroke)},X||(E.strokeDasharray="6");var Ce=se(T,w,E);return h(T,w.width,w.height,Zs,{...E,fill:"none"}),G&&B(w,T,E),Ce},"bpmn:BusinessRuleTask":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=Te(T,w,E),U=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),X=x(T,U);Se(X,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:1});var Ce=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),Ue=x(T,Ce);return Se(Ue,{fill:be(w,c,E.stroke),stroke:be(w,c,E.stroke),strokeWidth:1}),G},"bpmn:CallActivity":function(T,w,E={}){return E=at(E,["fill","stroke"]),V(T,w,{strokeWidth:5,...E})},"bpmn:ComplexGateway":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=xe(T,w,E),U=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:w.width,containerHeight:w.height,position:{mx:.46,my:.26}});return x(T,U,{fill:be(w,c,E.stroke),stroke:be(w,c,E.stroke),strokeWidth:1}),G},"bpmn:DataInput":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=i.getRawPath("DATA_ARROW"),U=Z(T,w,E);return x(T,G,{fill:"none",stroke:be(w,c,E.stroke),strokeWidth:1}),U},"bpmn:DataInputAssociation":function(T,w,E={}){return E=at(E,["fill","stroke"]),K(T,w,{...E,markerEnd:d(T,"association-end",Ze(w,s,E.fill),be(w,c,E.stroke))})},"bpmn:DataObject":function(T,w,E={}){return E=at(E,["fill","stroke"]),Z(T,w,E)},"bpmn:DataObjectReference":k("bpmn:DataObject"),"bpmn:DataOutput":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=i.getRawPath("DATA_ARROW"),U=Z(T,w,E);return x(T,G,{strokeWidth:1,fill:be(w,c,E.stroke),stroke:be(w,c,E.stroke)}),U},"bpmn:DataOutputAssociation":function(T,w,E={}){return E=at(E,["fill","stroke"]),K(T,w,{...E,markerEnd:d(T,"association-end",Ze(w,s,E.fill),be(w,c,E.stroke))})},"bpmn:DataStoreReference":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width,containerHeight:w.height,position:{mx:0,my:.133}});return x(T,G,{fill:Ze(w,s,E.fill),fillOpacity:Ro,stroke:be(w,c,E.stroke),strokeWidth:2})},"bpmn:EndEvent":function(T,w,E={}){var{renderIcon:G=!0}=E;E=at(E,["fill","stroke"]);var U=se(T,w,{...E,strokeWidth:4});return G&&B(w,T,E),U},"bpmn:EventBasedGateway":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=ie(w),U=xe(T,w,E);h(T,w.width,w.height,w.height*.2,{fill:Ze(w,"none",E.fill),stroke:be(w,c,E.stroke),strokeWidth:1});var X=G.get("eventGatewayType"),Ce=!!G.get("instantiate");function Ue(){var Ot=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:w.width,containerHeight:w.height,position:{mx:.36,my:.44}});x(T,Ot,{fill:"none",stroke:be(w,c,E.stroke),strokeWidth:2})}if(X==="Parallel"){var st=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:w.width,containerHeight:w.height,position:{mx:.474,my:.296}});x(T,st,{fill:"none",stroke:be(w,c,E.stroke),strokeWidth:1})}else X==="Exclusive"&&(Ce||h(T,w.width,w.height,w.height*.26,{fill:"none",stroke:be(w,c,E.stroke),strokeWidth:1}),Ue());return U},"bpmn:ExclusiveGateway":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=xe(T,w,E),U=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:w.width,containerHeight:w.height,position:{mx:.32,my:.3}}),X=ot(w);return X.get("isMarkerVisible")&&x(T,U,{fill:be(w,c,E.stroke),stroke:be(w,c,E.stroke),strokeWidth:1}),G},"bpmn:Gateway":function(T,w,E={}){return E=at(E,["fill","stroke"]),xe(T,w,E)},"bpmn:Group":function(T,w,E={}){return E=at(E,["fill","stroke","width","height"]),y(T,w.width,w.height,Qs,{stroke:be(w,c,E.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:Qn(w,E),height:In(w,E)})},"bpmn:InclusiveGateway":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=xe(T,w,E);return h(T,w.width,w.height,w.height*.24,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:2.5}),G},"bpmn:IntermediateEvent":function(T,w,E={}){var{renderIcon:G=!0}=E;E=at(E,["fill","stroke"]);var U=se(T,w,{...E,strokeWidth:1.5});return h(T,w.width,w.height,Zs,{fill:"none",stroke:be(w,c,E.stroke),strokeWidth:1.5}),G&&B(w,T,E),U},"bpmn:IntermediateCatchEvent":k("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":k("bpmn:IntermediateEvent"),"bpmn:Lane":function(T,w,E={}){return E=at(E,["fill","stroke","width","height"]),q(T,w,{...E,fillOpacity:BC})},"bpmn:ManualTask":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=Te(T,w,E),U=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return x(T,U,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:.5}),G},"bpmn:MessageFlow":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=ie(w),U=ot(w),X=Ze(w,s,E.fill),Ce=be(w,c,E.stroke),Ue=b(T,w.waypoints,{markerEnd:d(T,"messageflow-end",X,Ce),markerStart:d(T,"messageflow-start",X,Ce),stroke:Ce,strokeDasharray:"10, 11",strokeWidth:1.5});if(G.get("messageRef")){var st=Ue.getPointAtLength(Ue.getTotalLength()/2),Ot=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:st.x,y:st.y}}),pt={strokeWidth:1};U.get("messageVisibleKind")==="initiating"?(pt.fill=X,pt.stroke=Ce):(pt.fill=Ce,pt.stroke=X);var Wt=x(T,Ot,pt),nn=G.get("messageRef"),rn=nn.get("name"),xt=oe(T,rn,{align:"center-top",fitBox:!0,style:{fill:Ce}}),Dt=Wt.getBBox(),bn=xt.getBBox(),Pr=st.x-bn.width/2,jn=st.y+Dt.height/2+OC;Ys(xt,Pr,jn,0)}return Ue},"bpmn:ParallelGateway":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=xe(T,w,E),U=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:w.width,containerHeight:w.height,position:{mx:.46,my:.2}});return x(T,U,{fill:be(w,c,E.stroke),stroke:be(w,c,E.stroke),strokeWidth:1}),G},"bpmn:Participant":function(T,w,E={}){E=at(E,["fill","stroke","width","height"]);var G=q(T,w,E),U=Qe(w),X=tn(w),Ce=ie(w),Ue=Ce.get("name");if(U){var st=X?[{x:30,y:0},{x:30,y:In(w,E)}]:[{x:0,y:30},{x:Qn(w,E),y:30}];g(T,st,{stroke:be(w,c,E.stroke),strokeWidth:DC}),He(T,Ue,w,E)}else{var Ot=va(w,E);X||(Ot.height=Qn(w,E),Ot.width=In(w,E));var pt=oe(T,Ue,{box:Ot,align:"center-middle",style:{fill:ya(w,l,c,E.stroke)}});if(!X){var Wt=-1*In(w,E);Ys(pt,0,-Wt,270)}}return Ce.get("participantMultiplicity")&&I("ParticipantMultiplicityMarker",T,w,E),G},"bpmn:ReceiveTask":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=ie(w),U=Te(T,w,E),X;return G.get("instantiate")?(h(T,28,28,20*.22,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:1}),X=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):X=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),x(T,X,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:1}),U},"bpmn:ScriptTask":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=Te(T,w,E),U=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return x(T,U,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:1}),G},"bpmn:SendTask":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=Te(T,w,E),U=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return x(T,U,{fill:be(w,c,E.stroke),stroke:Ze(w,s,E.fill),strokeWidth:1}),G},"bpmn:SequenceFlow":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=Ze(w,s,E.fill),U=be(w,c,E.stroke),X=b(T,w.waypoints,{markerEnd:d(T,"sequenceflow-end",G,U),stroke:U}),Ce=ie(w),{source:Ue}=w;if(Ue){var st=ie(Ue);Ce.get("conditionExpression")&&S(st,"bpmn:Activity")&&Se(X,{markerStart:d(T,"conditional-flow-marker",G,U)}),st.get("default")&&(S(st,"bpmn:Gateway")||S(st,"bpmn:Activity"))&&st.get("default")===Ce&&Se(X,{markerStart:d(T,"conditional-default-flow-marker",G,U)})}return X},"bpmn:ServiceTask":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=Te(T,w,E);h(T,10,10,{fill:Ze(w,s,E.fill),stroke:"none",transform:"translate(6, 6)"});var U=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});x(T,U,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:1}),h(T,10,10,{fill:Ze(w,s,E.fill),stroke:"none",transform:"translate(11, 10)"});var X=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return x(T,X,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:1}),G},"bpmn:StartEvent":function(T,w,E={}){var{renderIcon:G=!0}=E;E=at(E,["fill","stroke"]);var U=ie(w);U.get("isInterrupting")||(E={...E,strokeDasharray:"6"});var X=se(T,w,E);return G&&B(w,T,E),X},"bpmn:SubProcess":function(T,w,E={}){return Qe(w)?E=at(E,["fill","stroke","width","height"]):E=at(E,["fill","stroke"]),V(T,w,E)},"bpmn:Task":function(T,w,E={}){return E=at(E,["fill","stroke"]),Te(T,w,E)},"bpmn:TextAnnotation":function(T,w,E={}){E=at(E,["fill","stroke"]);var{width:G,height:U}=va(w,E),X=y(T,G,U,0,0,{fill:"none",stroke:"none"}),Ce=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:U,position:{mx:0,my:0}});x(T,Ce,{stroke:be(w,c,E.stroke)});var Ue=ie(w),st=Ue.get("text")||"";return oe(T,st,{align:"left-top",box:va(w,E),padding:So,style:{fill:ya(w,l,c,E.stroke)}}),X},"bpmn:Transaction":function(T,w,E={}){Qe(w)?E=at(E,["fill","stroke","width","height"]):E=at(E,["fill","stroke"]);var G=V(T,w,{strokeWidth:1.5,...E}),U=n.style(["no-fill","no-events"],{stroke:be(w,c,E.stroke),strokeWidth:1.5}),X=Qe(w);return X||(E={}),y(T,Qn(w,E),In(w,E),Qs-Zs,Zs,U),G},"bpmn:UserTask":function(T,w,E={}){E=at(E,["fill","stroke"]);var G=Te(T,w,E),U=15,X=12,Ce=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:U,y:X}});x(T,Ce,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:.5});var Ue=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:U,y:X}});x(T,Ue,{fill:Ze(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:.5});var st=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:U,y:X}});return x(T,st,{fill:be(w,c,E.stroke),stroke:be(w,c,E.stroke),strokeWidth:.5}),G},label:function(T,w,E={}){return Ve(T,w,E)}};this._drawPath=x,this._renderer=M}Ee(jr,Ii),jr.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],jr.prototype.canRender=function(e){return S(e,"bpmn:BaseElement")},jr.prototype.drawShape=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},jr.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},jr.prototype.getShapePath=function(e){return Ye(e)?Ku(e,IC):S(e,"bpmn:Event")?ug(e):S(e,"bpmn:Activity")?Ku(e,Qs):S(e,"bpmn:Gateway")?MC(e):TC(e)};function at(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var NC=0,$C={width:150,height:50};function FC(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function jC(e){return Qt(e)?W({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var Xu=null;function HC(){return Xu||(Xu=document.createElement("canvas").getContext("2d")),Xu}function zC(e){var t=[];return e.fontStyle&&t.push(e.fontStyle),e.fontVariant&&t.push(e.fontVariant),e.fontWeight&&t.push(e.fontWeight),e.fontStretch&&t.push(e.fontStretch),t.push(pg(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function pg(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function GC(e,t){var n=HC();if(!n)return{width:0,height:0};n.font=zC(t),"letterSpacing"in n&&(n.letterSpacing=pg(t.letterSpacing)||"0px");var i=e==="",r=i?"dummy":e.replace(/\s+$/,""),o=n.measureText(r);return{width:i?0:o.width,height:"fontBoundingBoxAscent"in o?o.fontBoundingBoxAscent+o.fontBoundingBoxDescent:o.actualBoundingBoxAscent+o.actualBoundingBoxDescent}}function VC(e,t,n){for(var i=e.shift(),r=i,o;;){if(o=GC(r,n),o.width=r?o.width:0,r===" "||r===""||o.width<Math.round(t)||r.length<2)return WC(e,r,i,o);r=YC(r,o.width,t)}}function WC(e,t,n,i){if(t.length<n.length){var r=n.slice(t.length).trim();e.unshift(r)}return{width:i.width,height:i.height,text:t}}var fg="";function UC(e,t){var n=e.split(/(\s|-|\u00AD)/g),i,r=[],o=0;if(n.length>1)for(;i=n.shift();)if(i.length+o<t)r.push(i),o+=i.length;else{(i==="-"||i===fg)&&r.pop();break}var a=r[r.length-1];return a&&a===fg&&(r[r.length-1]="-"),r.join("")}function YC(e,t,n){var i=Math.max(e.length*(n/t),1),r=UC(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function Js(e){this._config=W({},{size:$C,padding:NC,style:{},align:"center-top"},e||{})}Js.prototype.createText=function(e,t){return this.layoutText(e,t).element},Js.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Js.prototype.layoutText=function(e,t){for(var n=W({},this._config.size,t.box),i=W({},this._config.style,t.style),r=FC(t.align||this._config.align),o=jC(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=qC(i),c=e.split(/\u00AD?\r?\n/),l=[],u=n.width-o.left-o.right;c.length;)l.push(VC(c,u,i));r.vertical==="middle"&&(o.top=o.bottom=0);var f=Tn(l,function(y,v,g){return y+(s||v.height)},0)+o.top+o.bottom,p=Tn(l,function(y,v,g){return v.width>y?v.width:y},0),d=o.top;r.vertical==="middle"&&(d+=(n.height-f)/2),d-=(s||l[0].height)/4;var m=Oe("text");Se(m,i),F(l,function(y){var v;switch(d+=s||y.height,r.horizontal){case"left":v=o.left;break;case"right":v=(a?p:u)-o.right-y.width;break;default:v=Math.max(((a?p:u)-y.width)/2+o.left,0)}var g=Oe("tspan");Se(g,{x:v,y:d}),g.textContent=y.text,ze(m,g)});var h={width:p,height:f};return{dimensions:h,element:m}};function qC(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var KC=12,XC=1.2,ZC=40;function dg(e){var t=W({fontFamily:"Arial, sans-serif",fontSize:KC,fontWeight:"normal",lineHeight:XC},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=W({},t,{fontSize:n},e&&e.externalStyle||{}),r=new Js({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,Fr.width),height:30},l=o(s,c,{style:i});return{x:Math.round(a.x+a.width/2-l.width/2),y:a.y,width:Math.ceil(l.width),height:Math.ceil(l.height)}},this.getTextAnnotationBounds=function(a,s){var c=o(s,a,{style:t,align:"left-top",padding:So});return{x:a.x,y:a.y,width:a.width,height:Math.max(ZC,Math.round(c.height))}},this.getDimensions=function(a,s){return r.getDimensions(a,s||{})};function o(a,s,c){return r.getDimensions(a,W({box:s},c))}this.createText=function(a,s){return r.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}dg.$inject=["config.textRenderer"];function QC(){this.pathMap={EVENT_MESSAGE:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:36,width:36,heightElements:[6,14],widthElements:[10.5,21]},EVENT_SIGNAL:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x1},0 Z",height:36,width:36,heightElements:[18],widthElements:[10,20]},EVENT_ESCALATION:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x0},-{e.y1} l -{e.x0},{e.y1} Z",height:36,width:36,heightElements:[20,7],widthElements:[8]},EVENT_CONDITIONAL:{d:"M {e.x0},{e.y0} l {e.x1},0 l 0,{e.y2} l -{e.x1},0 Z M {e.x2},{e.y3} l {e.x0},0 M {e.x2},{e.y4} l {e.x0},0 M {e.x2},{e.y5} l {e.x0},0 M {e.x2},{e.y6} l {e.x0},0 M {e.x2},{e.y7} l {e.x0},0 M {e.x2},{e.y8} l {e.x0},0 ",height:36,width:36,heightElements:[8.5,14.5,18,11.5,14.5,17.5,20.5,23.5,26.5],widthElements:[10.5,14.5,12.5]},EVENT_LINK:{d:"m {mx},{my} 0,{e.y0} -{e.x1},0 0,{e.y1} {e.x1},0 0,{e.y0} {e.x0},-{e.y2} -{e.x0},-{e.y2} z",height:36,width:36,heightElements:[4.4375,6.75,7.8125],widthElements:[9.84375,13.5]},EVENT_ERROR:{d:"m {mx},{my} {e.x0},-{e.y0} {e.x1},-{e.y1} {e.x2},{e.y2} {e.x3},-{e.y3} -{e.x4},{e.y4} -{e.x5},-{e.y5} z",height:36,width:36,heightElements:[.023,8.737,8.151,16.564,10.591,8.714],widthElements:[.085,6.672,6.97,4.273,5.337,6.636]},EVENT_CANCEL_45:{d:"m {mx},{my} -{e.x1},0 0,{e.x0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:36,width:36,heightElements:[4.75,8.5],widthElements:[4.75,8.5]},EVENT_COMPENSATION:{d:"m {mx},{my} {e.x0},-{e.y0} 0,{e.y1} z m {e.x1},-{e.y2} {e.x2},-{e.y3} 0,{e.y1} -{e.x2},-{e.y3} z",height:36,width:36,heightElements:[6.5,13,.4,6.1],widthElements:[9,9.3,8.7]},EVENT_TIMER_WH:{d:"M {mx},{my} l {e.x0},-{e.y0} m -{e.x0},{e.y0} l {e.x1},{e.y1} ",height:36,width:36,heightElements:[10,2],widthElements:[3,7]},EVENT_TIMER_LINE:{d:"M {mx},{my} m {e.x0},{e.y0} l -{e.x1},{e.y1} ",height:36,width:36,heightElements:[10,3],widthElements:[0,0]},EVENT_MULTIPLE:{d:"m {mx},{my} {e.x1},-{e.y0} {e.x1},{e.y0} -{e.x0},{e.y1} -{e.x2},0 z",height:36,width:36,heightElements:[6.28099,12.56199],widthElements:[3.1405,9.42149,12.56198]},EVENT_PARALLEL_MULTIPLE:{d:"m {mx},{my} {e.x0},0 0,{e.y1} {e.x1},0 0,{e.y0} -{e.x1},0 0,{e.y1} -{e.x0},0 0,-{e.y1} -{e.x1},0 0,-{e.y0} {e.x1},0 z",height:36,width:36,heightElements:[2.56228,7.68683],widthElements:[2.56228,7.68683]},GATEWAY_EXCLUSIVE:{d:"m {mx},{my} {e.x0},{e.y0} {e.x1},{e.y0} {e.x2},0 {e.x4},{e.y2} {e.x4},{e.y1} {e.x2},0 {e.x1},{e.y3} {e.x0},{e.y3} {e.x3},0 {e.x5},{e.y1} {e.x5},{e.y2} {e.x3},0 z",height:17.5,width:17.5,heightElements:[8.5,6.5312,-6.5312,-8.5],widthElements:[6.5,-6.5,3,-3,5,-5]},GATEWAY_PARALLEL:{d:"m {mx},{my} 0,{e.y1} -{e.x1},0 0,{e.y0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:30,width:30,heightElements:[5,12.5],widthElements:[5,12.5]},GATEWAY_EVENT_BASED:{d:"m {mx},{my} {e.x0},{e.y0} {e.x0},{e.y1} {e.x1},{e.y2} {e.x2},0 z",height:11,width:11,heightElements:[-6,6,12,-12],widthElements:[9,-3,-12]},GATEWAY_COMPLEX:{d:"m {mx},{my} 0,{e.y0} -{e.x0},-{e.y1} -{e.x1},{e.y2} {e.x0},{e.y1} -{e.x2},0 0,{e.y3} {e.x2},0 -{e.x0},{e.y1} l {e.x1},{e.y2} {e.x0},-{e.y1} 0,{e.y0} {e.x3},0 0,-{e.y0} {e.x0},{e.y1} {e.x1},-{e.y2} -{e.x0},-{e.y1} {e.x2},0 0,-{e.y3} -{e.x2},0 {e.x0},-{e.y1} -{e.x1},-{e.y2} -{e.x0},{e.y1} 0,-{e.y0} -{e.x3},0 z",height:17.125,width:17.125,heightElements:[4.875,3.4375,2.125,3],widthElements:[3.4375,2.125,4.875,3]},DATA_OBJECT_PATH:{d:"m 0,0 {e.x1},0 {e.x0},{e.y0} 0,{e.y1} -{e.x2},0 0,-{e.y2} {e.x1},0 0,{e.y0} {e.x0},0",height:61,width:51,heightElements:[10,50,60],widthElements:[10,40,50,60]},DATA_OBJECT_COLLECTION_PATH:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},DATA_ARROW:{d:"m 5,9 9,0 0,-3 5,5 -5,5 0,-3 -9,0 z",height:61,width:51,heightElements:[],widthElements:[]},DATA_STORE:{d:"m {mx},{my} l 0,{e.y2} c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 l 0,-{e.y2} c -{e.x0},-{e.y1} -{e.x1},-{e.y1} -{e.x2},0c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0",height:61,width:61,heightElements:[7,10,45],widthElements:[2,58,60]},TEXT_ANNOTATION:{d:"m {mx}, {my} m 10,0 l -10,0 l 0,{e.y0} l 10,0",height:30,width:10,heightElements:[30],widthElements:[10]},MARKER_SUB_PROCESS:{d:"m{mx},{my} m 7,2 l 0,10 m -5,-5 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_PARALLEL:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},MARKER_SEQUENTIAL:{d:"m{mx},{my} m 0,3 l 10,0 m -10,3 l 10,0 m -10,3 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_COMPENSATION:{d:"m {mx},{my} 7,-5 0,10 z m 7.1,-0.3 6.9,-4.7 0,10 -6.9,-4.7 z",height:10,width:21,heightElements:[],widthElements:[]},MARKER_LOOP:{d:"m {mx},{my} c 3.526979,0 6.386161,-2.829858 6.386161,-6.320661 0,-3.490806 -2.859182,-6.320661 -6.386161,-6.320661 -3.526978,0 -6.38616,2.829855 -6.38616,6.320661 0,1.745402 0.714797,3.325567 1.870463,4.469381 0.577834,0.571908 1.265885,1.034728 2.029916,1.35457 l -0.718163,-3.909793 m 0.718163,3.909793 -3.885211,0.802902",height:13.9,width:13.7,heightElements:[],widthElements:[]},MARKER_ADHOC:{d:"m {mx},{my} m 0.84461,2.64411 c 1.05533,-1.23780996 2.64337,-2.07882 4.29653,-1.97997996 2.05163,0.0805 3.85579,1.15803 5.76082,1.79107 1.06385,0.34139996 2.24454,0.1438 3.18759,-0.43767 0.61743,-0.33642 1.2775,-0.64078 1.7542,-1.17511 0,0.56023 0,1.12046 0,1.6807 -0.98706,0.96237996 -2.29792,1.62393996 -3.6918,1.66181996 -1.24459,0.0927 -2.46671,-0.2491 -3.59505,-0.74812 -1.35789,-0.55965 -2.75133,-1.33436996 -4.27027,-1.18121996 -1.37741,0.14601 -2.41842,1.13685996 -3.44288,1.96782996 z",height:4,width:15,heightElements:[],widthElements:[]},TASK_TYPE_SEND:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:14,width:21,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_SCRIPT:{d:"m {mx},{my} c 9.966553,-6.27276 -8.000926,-7.91932 2.968968,-14.938 l -8.802728,0 c -10.969894,7.01868 6.997585,8.66524 -2.968967,14.938 z m -7,-12 l 5,0 m -4.5,3 l 4.5,0 m -3,3 l 5,0m -4,3 l 5,0",height:15,width:12.6,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_USER_1:{d:"m {mx},{my} c 0.909,-0.845 1.594,-2.049 1.594,-3.385 0,-2.554 -1.805,-4.62199999 -4.357,-4.62199999 -2.55199998,0 -4.28799998,2.06799999 -4.28799998,4.62199999 0,1.348 0.974,2.562 1.89599998,3.405 -0.52899998,0.187 -5.669,2.097 -5.794,4.7560005 v 6.718 h 17 v -6.718 c 0,-2.2980005 -5.5279996,-4.5950005 -6.0509996,-4.7760005 zm -8,6 l 0,5.5 m 11,0 l 0,-5"},TASK_TYPE_USER_2:{d:"m {mx},{my} m 2.162,1.009 c 0,2.4470005 -2.158,4.4310005 -4.821,4.4310005 -2.66499998,0 -4.822,-1.981 -4.822,-4.4310005 "},TASK_TYPE_USER_3:{d:"m {mx},{my} m -6.9,-3.80 c 0,0 2.25099998,-2.358 4.27399998,-1.177 2.024,1.181 4.221,1.537 4.124,0.965 -0.098,-0.57 -0.117,-3.79099999 -4.191,-4.13599999 -3.57499998,0.001 -4.20799998,3.36699999 -4.20699998,4.34799999 z"},TASK_TYPE_MANUAL:{d:"m {mx},{my} c 0.234,-0.01 5.604,0.008 8.029,0.004 0.808,0 1.271,-0.172 1.417,-0.752 0.227,-0.898 -0.334,-1.314 -1.338,-1.316 -2.467,-0.01 -7.886,-0.004 -8.108,-0.004 -0.014,-0.079 0.016,-0.533 0,-0.61 0.195,-0.042 8.507,0.006 9.616,0.002 0.877,-0.007 1.35,-0.438 1.353,-1.208 0.003,-0.768 -0.479,-1.09 -1.35,-1.091 -2.968,-0.002 -9.619,-0.013 -9.619,-0.013 v -0.591 c 0,0 5.052,-0.016 7.225,-0.016 0.888,-0.002 1.354,-0.416 1.351,-1.193 -0.006,-0.761 -0.492,-1.196 -1.361,-1.196 -3.473,-0.005 -10.86,-0.003 -11.0829995,-0.003 -0.022,-0.047 -0.045,-0.094 -0.069,-0.139 0.3939995,-0.319 2.0409995,-1.626 2.4149995,-2.017 0.469,-0.4870005 0.519,-1.1650005 0.162,-1.6040005 -0.414,-0.511 -0.973,-0.5 -1.48,-0.236 -1.4609995,0.764 -6.5999995,3.6430005 -7.7329995,4.2710005 -0.9,0.499 -1.516,1.253 -1.882,2.19 -0.37000002,0.95 -0.17,2.01 -0.166,2.979 0.004,0.718 -0.27300002,1.345 -0.055,2.063 0.629,2.087 2.425,3.312 4.859,3.318 4.6179995,0.014 9.2379995,-0.139 13.8569995,-0.158 0.755,-0.004 1.171,-0.301 1.182,-1.033 0.012,-0.754 -0.423,-0.969 -1.183,-0.973 -1.778,-0.01 -5.824,-0.004 -6.04,-0.004 10e-4,-0.084 0.003,-0.586 10e-4,-0.67 z"},TASK_TYPE_INSTANTIATING_SEND:{d:"m {mx},{my} l 0,8.4 l 12.6,0 l 0,-8.4 z l 6.3,3.6 l 6.3,-3.6"},TASK_TYPE_SERVICE:{d:"m {mx},{my} v -1.71335 c 0.352326,-0.0705 0.703932,-0.17838 1.047628,-0.32133 0.344416,-0.14465 0.665822,-0.32133 0.966377,-0.52145 l 1.19431,1.18005 1.567487,-1.57688 -1.195028,-1.18014 c 0.403376,-0.61394 0.683079,-1.29908 0.825447,-2.01824 l 1.622133,-0.01 v -2.2196 l -1.636514,0.01 c -0.07333,-0.35153 -0.178319,-0.70024 -0.323564,-1.04372 -0.145244,-0.34406 -0.321407,-0.6644 -0.522735,-0.96217 l 1.131035,-1.13631 -1.583305,-1.56293 -1.129598,1.13589 c -0.614052,-0.40108 -1.302883,-0.68093 -2.022633,-0.82247 l 0.0093,-1.61852 h -2.241173 l 0.0042,1.63124 c -0.353763,0.0736 -0.705369,0.17977 -1.049785,0.32371 -0.344415,0.14437 -0.665102,0.32092 -0.9635006,0.52046 l -1.1698628,-1.15823 -1.5667691,1.5792 1.1684265,1.15669 c -0.4026573,0.61283 -0.68308,1.29797 -0.8247287,2.01713 l -1.6588041,0.003 v 2.22174 l 1.6724648,-0.006 c 0.073327,0.35077 0.1797598,0.70243 0.3242851,1.04472 0.1452428,0.34448 0.3214064,0.6644 0.5227339,0.96066 l -1.1993431,1.19723 1.5840256,1.56011 1.1964668,-1.19348 c 0.6140517,0.40346 1.3028827,0.68232 2.0233517,0.82331 l 7.19e-4,1.69892 h 2.226848 z m 0.221462,-3.9957 c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_SERVICE_FILL:{d:"m {mx},{my} c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_BUSINESS_RULE_HEADER:{d:"m {mx},{my} 0,4 20,0 0,-4 z"},TASK_TYPE_BUSINESS_RULE_MAIN:{d:"m {mx},{my} 0,12 20,0 0,-12 zm 0,8 l 20,0 m -13,-4 l 0,8"},MESSAGE_FLOW_MARKER:{d:"m {mx},{my} m -10.5 ,-7 l 0,14 l 21,0 l 0,-14 z l 10.5,6 l 10.5,-6"}},this.getRawPath=function(t){return this.pathMap[t].d},this.getScaledPath=function(t,n){var i=this.pathMap[t],r,o;n.abspos?(r=n.abspos.x,o=n.abspos.y):(r=n.containerWidth*n.position.mx,o=n.containerHeight*n.position.my);var a={};if(n.position){for(var s=n.containerHeight/i.height*n.yScaleFactor,c=n.containerWidth/i.width*n.xScaleFactor,l=0;l<i.heightElements.length;l++)a["y"+l]=i.heightElements[l]*s;for(var u=0;u<i.widthElements.length;u++)a["x"+u]=i.widthElements[u]*c}var f=nA(i.d,{mx:r,my:o,e:a});return f}}var JC=/\{([^{}]+)\}/g,eA=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function tA(e,t,n){var i=n;return t.replace(eA,function(r,o,a,s,c){o=o||s,i&&(o in i&&(i=i[o]),typeof i=="function"&&c&&(i=i()))}),i=(i==null||i==n?e:i)+"",i}function nA(e,t){return String(e).replace(JC,function(n,i){return tA(n,i,t)})}const iA={__init__:["bpmnRenderer"],bpmnRenderer:["type",jr],textRenderer:["type",dg],pathMap:["type",QC]};function rA(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const ba={translate:["value",rA]};function ec(e,t,n){return W({id:e.id,type:e.$type,businessObject:e,di:t},n)}function oA(e,t,n){var i=e.waypoint;return!i||i.length<2?[Ne(t),Ne(n)]:i.map(function(r){return{x:r.x,y:r.y}})}function hg(e,t,n){return new Error(`element ${yn(t)} referenced by ${yn(e)}#${n} not yet drawn`)}function $i(e,t,n,i,r){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=r}$i.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],$i.prototype.add=function(e,t,n){var i,r,o;if(S(t,"bpmndi:BPMNPlane")){var a=S(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(ec(e,t,a)),this._canvas.addRootElement(i)}else if(S(t,"bpmndi:BPMNShape")){var s=!Qe(e,t),c=sA(e);r=n&&(n.hidden||n.collapsed);var l=t.bounds;i=this._elementFactory.createShape(ec(e,t,{collapsed:s,hidden:r,x:Math.round(l.x),y:Math.round(l.y),width:Math.round(l.width),height:Math.round(l.height),isFrame:c})),S(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),S(e,"bpmn:Lane")&&(o=0),S(e,"bpmn:DataStoreReference")&&(aA(n,Ne(l))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,o)}else if(S(t,"bpmndi:BPMNEdge")){var u=this._getSource(e),f=this._getTarget(e);r=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(ec(e,t,{hidden:r,source:u,target:f,waypoints:oA(t,u,f)})),S(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,o)}else throw new Error(`unknown di ${yn(t)} for element ${yn(e)}`);return sr(e)&&qn(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},$i.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${yn(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),r=i&&i.attachers;if(!i)throw hg(e,n,"attachedToRef");t.host=i,r||(i.attachers=r=[]),r.indexOf(t)===-1&&r.push(t)},$i.prototype.addLabel=function(e,t,n){var i,r,o;return i=wC(t,n),r=qn(n),r&&(i=this._textRenderer.getExternalLabelBounds(i,r)),o=this._elementFactory.createLabel(ec(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!qn(n),x:Math.round(i.x),y:Math.round(i.y),width:Math.round(i.width),height:Math.round(i.height)})),this._canvas.addShape(o,n.parent)},$i.prototype._getConnectedElement=function(e,t){var n,i,r=e.$type;if(i=e[t+"Ref"],t==="source"&&r==="bpmn:DataInputAssociation"&&(i=i&&i[0]),(t==="source"&&r==="bpmn:DataOutputAssociation"||t==="target"&&r==="bpmn:DataInputAssociation")&&(i=e.$parent),n=i&&this._getElement(i),n)return n;throw i?hg(e,i,t+"Ref"):new Error(`${yn(e)}#${t} Ref not specified`)},$i.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},$i.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},$i.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function aA(e,t){var n=t.x,i=t.y;return n>=e.x&&n<=e.x+e.width&&i>=e.y&&i<=e.y+e.height}function sA(e){return S(e,"bpmn:Group")}const mg={__depends__:[iA,{__depends__:[ba],bpmnImporter:["type",$i]}]};function xa(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function pi(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Zu(e){return Math.log(e)/Math.log(10)}var cA=1e3;function te(e){this._eventBus=e}te.$inject=["eventBus"];function lA(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}te.prototype.on=function(e,t,n,i,r,o){if((Jt(t)||Fe(t))&&(o=r,r=i,i=n,n=t,t=null),Jt(n)&&(o=r,r=i,i=n,n=cA),Qt(r)&&(o=r,r=!1),!Jt(i))throw new Error("handlerFn must be a function");Be(e)||(e=[e]);var a=this._eventBus;F(e,function(s){var c=["commandStack",s,t].filter(function(l){return l}).join(".");a.on(c,n,r?lA(i,o):i,o)})},te.prototype.canExecute=Fi("canExecute"),te.prototype.preExecute=Fi("preExecute"),te.prototype.preExecuted=Fi("preExecuted"),te.prototype.execute=Fi("execute"),te.prototype.executed=Fi("executed"),te.prototype.postExecute=Fi("postExecute"),te.prototype.postExecuted=Fi("postExecuted"),te.prototype.revert=Fi("revert"),te.prototype.reverted=Fi("reverted");function Fi(e){return function(n,i,r,o,a){(Jt(n)||Fe(n))&&(a=o,o=r,r=i,i=n,n=null),this.on(n,e,i,r,o,a)}}var Qu=["top","bottom","left","right"],tc=10;function Ju(e,t){te.call(this,e),this.postExecuted(["connection.create","connection.layout","connection.updateWaypoints"],function(r){var o=r.context,a=o.connection,s=a.source,c=a.target,l=o.hints||{};l.createElementsBehavior!==!1&&(n(s),n(c))}),this.postExecuted(["label.create"],function(r){var o=r.context,a=o.shape,s=o.hints||{};s.createElementsBehavior!==!1&&n(a.labelTarget)}),this.postExecuted(["elements.create"],function(r){var o=r.context,a=o.elements,s=o.hints||{};s.createElementsBehavior!==!1&&a.forEach(function(c){n(c)})});function n(r){if(Xs(r)&&!ht(r)){var o=fA(r);o&&i(r,o)}}function i(r,o){var a=Ne(r),s=r.label,c=Ne(s);if(s.parent){var l=Ie(r),u;switch(o){case"top":u={x:a.x,y:l.top-tc-s.height/2};break;case"left":u={x:l.left-tc-s.width/2,y:a.y};break;case"bottom":u={x:a.x,y:l.bottom+tc+s.height/2};break;case"right":u={x:l.right+tc+s.width/2,y:a.y};break}var f=pi(u,c);t.moveShape(s,f)}}}Ee(Ju,te),Ju.$inject=["eventBus","modeling"];function uA(e){var t=e.host,n=Ne(e),i=cn(n,t),r;i.indexOf("-")>=0?r=i.split("-"):r=[i];var o=Qu.filter(function(a){return r.indexOf(a)===-1});return o}function pA(e){var t=Ne(e),n=[].concat(e.incoming.map(function(i){return i.waypoints[i.waypoints.length-2]}),e.outgoing.map(function(i){return i.waypoints[1]})).map(function(i){return gg(t,i)});return n}function fA(e){var t=Ne(e.label),n=Ne(e),i=gg(n,t);if(dA(i)){var r=pA(e);if(e.host){var o=uA(e);r=r.concat(o)}var a=Qu.filter(function(s){return r.indexOf(s)===-1});return a.indexOf(i)!==-1?cn(e.label,e)!=="intersect"?void 0:i:a[0]}}function gg(e,t){return cn(t,e,5)}function dA(e){return Qu.indexOf(e)!==-1}function ep(e){te.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,i=t.shape;t.position||(S(i,"bpmn:TextAnnotation")?t.position={x:n.x+n.width/2+75,y:n.y-50-i.height/2}:t.position={x:n.x+n.width+80+i.width/2,y:n.y+n.height/2})},!0)}Ee(ep,te),ep.$inject=["eventBus"];var hA=1500;function tp(e,t,n){e.invoke(te,this),this.preExecute("elements.delete",hA,function(r){var o=r.context,a=o.elements,s=i(a);s.length&&(o.elements=a.concat(s))}),t.on("shape.move.start",function(r){var o=r.context.shapes,a=i(o);a.length&&(r.context.shapes=o.concat(a))});function i(r){var o=Ke(r,l=>S(l,"bpmn:Participant")||S(l,"bpmn:SubProcess"));if(!o.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(l=>S(l,"bpmn:Artifact"))),c=new Set;return F(o,l=>{const u=new Set(ro(bo(Array.from(s),Ft(l))));c=c.union(u),s=s.difference(u)}),Array.from(c)}}Ee(tp,te),tp.$inject=["injector","eventBus","canvas"];function np(e,t){e.invoke(te,this),this.postExecute("shape.move",function(n){var i=n.newParent,r=n.shape,o=Ke(r.incoming.concat(r.outgoing),function(a){return S(a,"bpmn:Association")});F(o,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}Ee(np,te),np.$inject=["injector","modeling"];function Co(e,t){for(Pn(t)&&(t=[t]);e=e.parent;)if(qe(e,t))return e;return null}function yg(e,t){var n=Co(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=Co(e,i),n)return tn(n);if(qe(e,i))return tn(e);var r;for(r=ie(e);r&&!S(r,"bpmn:Process");r=r.$parent);if(!t)return!0;var o=t.find(function(a){var s=ie(a);return s&&s.get("processRef")===r});return o?tn(o):!0}var vg=500;function nc(e,t){t.invoke(te,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",vg,function(i){var r=i.elements;r=r.filter(function(o){var a=o.host;return bg(o,a)}),r.length===1&&r.map(function(o){return r.indexOf(o)}).forEach(function(o){var a=r[o];i.elements[o]=n._replaceShape(r[o],a)})},!0),this.preExecute("elements.move",vg,function(i){var r=i.shapes,o=i.newHost;if(r.length===1){var a=r[0];bg(a,o)&&(i.shapes=[n._replaceShape(a,o)])}},!0)}nc.$inject=["bpmnReplace","injector"],Ee(nc,te),nc.prototype._replaceShape=function(e,t){var n=mA(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function mA(e){var t=ie(e),n=t.eventDefinitions;return n&&n[0]}function bg(e,t){return!Ye(e)&&qe(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function ip(e,t){te.call(this,e);function n(i){return Ke(i.attachers,function(r){return S(r,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var r=i.context.source,o=i.context.target,a=n(o);S(r,"bpmn:EventBasedGateway")&&S(o,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var r=i.context.oldSource,o=i.context.newSource;S(r,"bpmn:Gateway")&&S(o,"bpmn:EventBasedGateway")&&F(o.outgoing,function(a){var s=a.target,c=n(s);S(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}ip.$inject=["eventBus","modeling"],Ee(ip,te);function xg(e){return e.create("bpmn:Category")}function gA(e){return e.create("bpmn:CategoryValue")}function _g(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=gA(e)),n.$parent||(n.$parent=xg(e)),n}function yA(e,t,n){return Bt(t.get("categoryValue"),e),e.$parent=t,Bt(n.get("rootElements"),t),t.$parent=n,e}function vA(e){var t=e.$parent;return t&&(Lt(t.get("categoryValue"),e),e.$parent=null),e}function bA(e){var t=e.$parent;return t&&(Lt(t.get("rootElements"),e),e.$parent=null),e}var xA=500;function rp(e,t,n){n.invoke(te,this);function i(c){return t.filter(function(l){return S(l,"bpmn:Group")&&!l.labelTarget}).map(ie).filter(function(l){return l!==c})}function r(c,l){return i(l).some(function(u){return u.get("categoryValueRef")===c})}function o(c,l){return i(l).some(function(u){var f=u.get("categoryValueRef");return f&&f.$parent===c})}function a(c,l){c&&l&&yA(c,l,e.getDefinitions())}function s(c,l,u){l&&!o(l,u)&&bA(l),c&&!r(c,u)&&vA(c)}this.executed(["shape.create","label.create"],function(c){var l=c.labelTarget||c.shape;!S(l,"bpmn:Group")||l.labelTarget||a(c.categoryValue,c.category)},!0),this.reverted(["shape.create","label.create"],function(c){var l=c.labelTarget||c.shape;!S(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,ie(l))},!0),this.executed(["shape.move","shape.resize"],xA,function(c){a(c.categoryValue,c.category)},!0),this.reverted(["shape.move","shape.resize"],function(c){var l=c.shape;c.categoryValue&&s(c.categoryValue,c.category,ie(l))},!0),this.executed("group.updateRefs",function(c){wg(c).forEach(function(l){a(l.categoryValue,l.category)})},!0),this.reverted("group.updateRefs",function(c){wg(c).forEach(function(l){s(l.categoryValue,l.category,ie(l.groupShape))})},!0),this.executed("shape.delete",function(c){var l=c.shape;!S(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,ie(l))},!0),this.reverted("shape.delete",function(c){var l=c.shape;!S(l,"bpmn:Group")||l.labelTarget||a(c.categoryValue,c.category)},!0)}rp.$inject=["bpmnjs","elementRegistry","injector"],Ee(rp,te);function wg(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function op(e,t,n){te.call(this,e),this.preExecute("shape.replace",s,!0),this.postExecuted("shape.replace",c,!0),this.preExecute("connection.create",r,!0),this.postExecuted("connection.delete",i,!0),this.postExecuted("connection.reconnect",o,!0),this.postExecuted("element.updateProperties",a,!0);function i(y){const v=y.source,g=y.target;Ao(v)&&_a(g)&&u(g)}function r(y){const v=y.connection,g=y.source,b=y.target;Ao(g)&&ic(b)&&(l(b),p(g,[v]))}function o(y){const v=y.newTarget,g=y.oldSource,b=y.oldTarget;if(b!==v){const x=g;_a(b)&&u(b),Ao(x)&&ic(v)&&l(v)}}function a(y){const{element:v}=y;_a(v)?(f(v),d(v)):ic(v)&&m(v)}function s(y){const{newData:v,oldShape:g}=y;if(Ao(y.oldShape)&&v.eventDefinitionType!=="bpmn:CompensateEventDefinition"||v.type!=="bpmn:BoundaryEvent"){const b=g.outgoing.find(({target:x})=>_a(x));b&&b.target&&(y._connectionTarget=b.target)}else if(!Ao(y.oldShape)&&v.eventDefinitionType==="bpmn:CompensateEventDefinition"&&v.type==="bpmn:BoundaryEvent"){const b=g.outgoing.find(({target:x})=>ic(x));b&&b.target&&(y._connectionTarget=b.target),h(g)}}function c(y){const{_connectionTarget:v,newShape:g}=y;v&&t.connect(g,v)}function l(y){t.updateProperties(y,{isForCompensation:!0})}function u(y){t.updateProperties(y,{isForCompensation:void 0})}function f(y){for(const v of y.incoming)n.canConnect(v.source,y)||t.removeConnection(v);for(const v of y.outgoing)n.canConnect(y,v.target)||t.removeConnection(v)}function p(y,v){y.outgoing.filter(x=>S(x,"bpmn:Association")).filter(x=>_a(x.target)&&!v.includes(x)).forEach(x=>t.removeConnection(x))}function d(y){const v=y.attachers.slice();v.length&&t.removeElements(v)}function m(y){const v=y.incoming.filter(g=>Ao(g.source));t.removeElements(v)}function h(y){const v=y.outgoing.filter(g=>S(g,"bpmn:SequenceFlow"));t.removeElements(v)}}Ee(op,te),op.$inject=["eventBus","modeling","bpmnRules"];function _a(e){const t=ie(e);return t&&t.get("isForCompensation")}function Ao(e){return e&&S(e,"bpmn:BoundaryEvent")&&Eo(e,"bpmn:CompensateEventDefinition")}function ic(e){return e&&S(e,"bpmn:Activity")&&!vn(e)}function ap(e){e.invoke(te,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,r=n.shape;S(i,"bpmn:Lane")&&!S(r,"bpmn:Lane")&&(n.parent=Co(i,"bpmn:Participant"))})}ap.$inject=["injector"],Ee(ap,te);function sp(e,t){te.call(this,e),this.preExecute("shape.create",function(n){var a;var i=n.context,r=i.shape;if(S(r,"bpmn:DataObjectReference")&&r.type!=="label"){var o=t.create("bpmn:DataObject");o.isCollection=((a=r.businessObject.dataObjectRef)==null?void 0:a.isCollection)||!1,r.businessObject.dataObjectRef=o}})}sp.$inject=["eventBus","bpmnFactory"],Ee(sp,te);var cp=20,lp=20,Eg=30,rc=2e3;function up(e,t,n){te.call(this,t),t.on(["create.start","shape.move.start"],rc,function(r){var o=r.context,a=o.shape,s=e.getRootElement();if(!(!S(a,"bpmn:Participant")||!S(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(f){return!S(f,"bpmn:Group")&&!Ye(f)&&!ht(f)});if(c.length){var l=Ft(c),u=_A(a,l);W(a,u),o.createConstraints=wA(a,l)}}}),t.on("create.start",rc,function(r){var o=r.context,a=o.shape,s=e.getRootElement(),c=e.getGraphics(s);function l(u){u.element=s,u.gfx=c}S(a,"bpmn:Participant")&&S(s,"bpmn:Process")&&(t.on("element.hover",rc,l),t.once("create.cleanup",function(){t.off("element.hover",l)}))});function i(){var r=e.getRootElement();return S(r,"bpmn:Collaboration")?r:n.makeCollaboration()}this.preExecute("elements.create",rc,function(r){var o=r.elements,a=r.parent,s=EA(o),c;s&&S(a,"bpmn:Process")&&(r.parent=i(),c=r.hints=r.hints||{},c.participant=s,c.process=a,c.processRef=ie(s).get("processRef"))},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;S(a,"bpmn:Participant")&&S(o,"bpmn:Process")&&(r.parent=i(),r.process=o,r.processRef=ie(a).get("processRef"))},!0),this.execute("shape.create",function(r){var o=r.hints||{},a=r.process||o.process,s=r.shape,c=o.participant;a&&(!c||s===c)&&ie(s).set("processRef",ie(a))},!0),this.revert("shape.create",function(r){var o=r.hints||{},a=r.process||o.process,s=r.processRef||o.processRef,c=r.shape,l=o.participant;a&&(!l||c===l)&&ie(c).set("processRef",s)},!0),this.postExecute("shape.create",function(r){var o=r.hints||{},a=r.process||r.hints.process,s=r.shape,c=o.participant;if(a){var l=a.children.slice();c?s===c&&n.moveElements(l,{x:0,y:0},c):n.moveElements(l,{x:0,y:0},s)}},!0)}up.$inject=["canvas","eventBus","modeling"],Ee(up,te);function _A(e,t){t={width:t.width+cp*2+Eg,height:t.height+lp*2};var n=Math.max(e.width,t.width),i=Math.max(e.height,t.height);return{x:-n/2,y:-i/2,width:n,height:i}}function wA(e,t){return t=Ie(t),{bottom:t.top+e.height/2-lp,left:t.right-e.width/2+cp,top:t.bottom-e.height/2+lp,right:t.left+e.width/2-cp-Eg}}function EA(e){return vt(e,function(t){return S(t,"bpmn:Participant")})}var Sg="__targetRef_placeholder";function pp(e,t){te.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],Rg(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],Rg(o));function n(a,s,c){var l=a.get("dataInputAssociations");return vt(l,function(u){return u!==c&&u.targetRef===s})}function i(a,s){var c=a.get("properties"),l=vt(c,function(u){return u.name===Sg});return!l&&s&&(l=t.create("bpmn:Property",{name:Sg}),Bt(c,l)),l}function r(a,s){var c=i(a);c&&(n(a,c,s)||Lt(a.get("properties"),c))}function o(a){var s=a.context,c=s.connection,l=c.businessObject,u=c.target,f=u&&u.businessObject,p=s.newTarget,d=p&&p.businessObject,m=s.oldTarget||s.target,h=m&&m.businessObject,y=c.businessObject,v;h&&h!==f&&r(h,l),d&&d!==f&&r(d,l),f?(v=i(f,!0),y.targetRef=v):y.targetRef=null}}pp.$inject=["eventBus","bpmnFactory"],Ee(pp,te);function Rg(e){return function(t){var n=t.context,i=n.connection;if(S(i,"bpmn:DataInputAssociation"))return e(t)}}function oc(e){this._bpmnUpdater=e}oc.$inject=["bpmnUpdater"],oc.prototype.execute=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.newSemanticParent,r=e.newDiParent;return e.oldSemanticParent=t.$parent,e.oldDiParent=n.$parent,this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,r),[]},oc.prototype.revert=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.oldSemanticParent,r=e.oldDiParent;return this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,r),[]};function fp(e,t,n,i){te.call(this,i),t.registerHandler("dataStore.updateContainment",oc);function r(){return n.filter(function(s){return S(s,"bpmn:Participant")&&ie(s).processRef})[0]}function o(s){return s.children.filter(function(c){return S(c,"bpmn:DataStoreReference")&&!c.labelTarget})}function a(s,c){var l=s.businessObject||s;if(c=c||r(),c){var u=c.businessObject||c;t.execute("dataStore.updateContainment",{dataStoreBo:l,dataStoreDi:ot(s),newSemanticParent:u.processRef||u,newDiParent:ot(c)})}}this.preExecute("shape.create",function(s){var c=s.context,l=c.shape;S(l,"bpmn:DataStoreReference")&&l.type!=="label"&&(c.hints||(c.hints={}),c.hints.autoResize=!1)}),this.preExecute("elements.move",function(s){var c=s.context,l=c.shapes,u=l.filter(function(f){return S(f,"bpmn:DataStoreReference")});u.length&&(c.hints||(c.hints={}),c.hints.autoResize=l.filter(function(f){return!S(f,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,l=c.shape,u=l.parent;S(l,"bpmn:DataStoreReference")&&l.type!=="label"&&S(u,"bpmn:Collaboration")&&a(l)}),this.postExecute("shape.move",function(s){var c=s.context,l=c.shape,u=c.oldParent,f=l.parent;if(!S(u,"bpmn:Collaboration")&&S(l,"bpmn:DataStoreReference")&&l.type!=="label"&&S(f,"bpmn:Collaboration")){var p=S(u,"bpmn:Participant")?u:RA(u,"bpmn:Participant");a(l,p)}}),this.postExecute("shape.delete",function(s){var c=s.context,l=c.shape,u=e.getRootElement();qe(l,["bpmn:Participant","bpmn:SubProcess"])&&S(u,"bpmn:Collaboration")&&o(u).filter(function(f){return SA(f,l)}).forEach(function(f){a(f)})}),this.postExecute("canvas.updateRoot",function(s){var c=s.context,l=c.oldRoot,u=c.newRoot,f=o(l);f.forEach(function(p){S(u,"bpmn:Process")&&a(p,u)})})}fp.$inject=["canvas","commandStack","elementRegistry","eventBus"],Ee(fp,te);function SA(e,t){for(var n=e.businessObject||e,i=t.businessObject||t;n.$parent;){if(n.$parent===i.processRef||i)return!0;n=n.$parent}return!1}function RA(e,t){for(;e.parent;){if(S(e.parent,t))return e.parent;e=e.parent}}var ac=Math.max,sc=Math.min,CA=20;function Cg(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function AA(e,t,n){var i=n.x,r=n.y,o={x:e.x,y:e.y,width:e.width,height:e.height};return t.indexOf("n")!==-1?(o.y=e.y+r,o.height=e.height-r):t.indexOf("s")!==-1&&(o.height=e.height+r),t.indexOf("e")!==-1?o.width=e.width+i:t.indexOf("w")!==-1&&(o.x=e.x+i,o.width=e.width-i),o}function PA(e,t){return{x:e.x+(t.left||0),y:e.y+(t.top||0),width:e.width-(t.left||0)+(t.right||0),height:e.height-(t.top||0)+(t.bottom||0)}}function cc(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return Fe(r)&&(i=(/top|left/.test(e)?sc:ac)(i,r)),Fe(o)&&(i=(/top|left/.test(e)?ac:sc)(i,o)),i}function MA(e,t){if(!t)return e;var n=Ie(e);return Vs({top:cc("top",n,t),right:cc("right",n,t),bottom:cc("bottom",n,t),left:cc("left",n,t)})}function TA(e,t,n,i){var r=Ie(t),o={top:/n/.test(e)?r.bottom-n.height:r.top,left:/w/.test(e)?r.right-n.width:r.left,bottom:/s/.test(e)?r.top+n.height:r.bottom,right:/e/.test(e)?r.left+n.width:r.right},a=i?Ie(i):o,s={top:sc(o.top,a.top),left:sc(o.left,a.left),bottom:ac(o.bottom,a.bottom),right:ac(o.right,a.right)};return Vs(s)}function wa(e,t){return typeof e<"u"?e:CA}function kA(e,t){var n,i,r,o;return typeof t=="object"?(n=wa(t.left),i=wa(t.right),r=wa(t.top),o=wa(t.bottom)):n=i=r=o=wa(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function OA(e){return!(e.waypoints||e.type==="label")}function Ag(e,t){var n;if(e.length===void 0?n=Ke(e.children,OA):n=e,n.length)return kA(Ft(n),t)}var cr=Math.abs;function DA(e,t){return Cg(Ie(t),Ie(e))}var IA=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Jn=30;function lc(e,t){return t=t||[],e.children.filter(function(n){S(n,"bpmn:Lane")&&(lc(n,t),t.push(n))}),t}function lr(e){return e.children.filter(function(t){return S(t,"bpmn:Lane")})}function ei(e){return Co(e,IA)||e}function LA(e,t){var n=ei(e),i=S(n,"bpmn:Process")?[]:[n],r=lc(n,i),o=Ie(e),a=Ie(t),s=DA(e,t),c=[],l=tn(e);return r.forEach(function(u){if(u!==e){var f=l?0:s.top,p=l?s.right:0,d=l?0:s.bottom,m=l?s.left:0,h=Ie(u);s.top&&(cr(h.bottom-o.top)<10&&(d=a.top-h.bottom),cr(h.top-o.top)<5&&(f=a.top-h.top)),s.left&&(cr(h.right-o.left)<10&&(p=a.left-h.right),cr(h.left-o.left)<5&&(m=a.left-h.left)),s.bottom&&(cr(h.top-o.bottom)<10&&(f=a.bottom-h.top),cr(h.bottom-o.bottom)<5&&(d=a.bottom-h.bottom)),s.right&&(cr(h.left-o.right)<10&&(m=a.right-h.left),cr(h.right-o.right)<5&&(p=a.right-h.right)),(f||p||d||m)&&c.push({shape:u,newBounds:PA(u,{top:f,right:p,bottom:d,left:m})})}}),c}var BA=500;function dp(e,t){te.call(this,e);function n(i,r){var o=tn(i),a=lr(r),s=[],c=[],l=[],u=[];if(Nr(a,function(y){return o?y.y>i.y?c.push(y):s.push(y):y.x>i.x?u.push(y):l.push(y),y.children}),!!a.length){var f;o?c.length&&s.length?f=i.height/2:f=i.height:u.length&&l.length?f=i.width/2:f=i.width;var p,d,m,h;s.length&&(p=t.calculateAdjustments(s,"y",f,i.y-10),t.makeSpace(p.movingShapes,p.resizingShapes,{x:0,y:f},"s")),c.length&&(d=t.calculateAdjustments(c,"y",-f,i.y+i.height+10),t.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:-f},"n")),l.length&&(m=t.calculateAdjustments(l,"x",f,i.x-10),t.makeSpace(m.movingShapes,m.resizingShapes,{x:f,y:0},"e")),u.length&&(h=t.calculateAdjustments(u,"x",-f,i.x+i.width+10),t.makeSpace(h.movingShapes,h.resizingShapes,{x:-f,y:0},"w"))}}this.postExecuted("shape.delete",BA,function(i){var r=i.context,o=r.hints,a=r.shape,s=r.oldParent;S(a,"bpmn:Lane")&&(o&&o.nested||n(a,s))})}dp.$inject=["eventBus","spaceTool"],Ee(dp,te);var Pg=500;function uc(e,t){t.invoke(te,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Pg,function(i){var r=i.elements;r.filter(function(o){var a=o.host;return Mg(o,a)}).map(function(o){return r.indexOf(o)}).forEach(function(o){i.elements[o]=n._replaceShape(r[o])})},!0),this.preExecute("elements.move",Pg,function(i){var r=i.shapes,o=i.newHost;r.forEach(function(a,s){var c=a.host;Mg(a,$A(r,c)?c:o)&&(r[s]=n._replaceShape(a))})},!0)}uc.$inject=["bpmnReplace","injector"],Ee(uc,te),uc.prototype._replaceShape=function(e){var t=NA(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function NA(e){var t=ie(e),n=t.eventDefinitions;return n&&n[0]}function Mg(e,t){return!Ye(e)&&S(e,"bpmn:BoundaryEvent")&&!t}function $A(e,t){return e.indexOf(t)!==-1}var pc=Math.round,FA=Math.max;function jA(e,t){var n=e.x,i=e.y;return[["M",n,i],["m",0,-t],["a",t,t,0,1,1,0,2*t],["a",t,t,0,1,1,0,-2*t],["z"]]}function HA(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var Tg=10;function zA(e,t){var n,i;for(n=0;i=e[n];n++)if(fa(i,t)<=Tg)return{point:e[n],bendpoint:!0,index:n};return null}function GA(e,t){var n=Lm(jA(t,Tg),HA(e)),i=n[0],r=n[n.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=FA(i.segment2,r.segment2)-1,{point:e[o],bendpoint:!0,index:o}):{point:{x:pc(i.x+r.x)/2,y:pc(i.y+r.y)/2},index:i.segment2}:{point:{x:pc(i.x),y:pc(i.y)},index:i.segment2}:null}function hp(e,t){return zA(e,t)||GA(e,t)}function mp(e,t,n){te.call(this,e);function i(r,o,a){var s=o.waypoints,c,l,u,f,p,d,m,h=r.outgoing.slice(),y=r.incoming.slice(),v;Fe(a.width)?v=Ne(a):v=a;var g=hp(s,v);if(g){if(c=s.slice(0,g.index),l=s.slice(g.index+(g.bendpoint?1:0)),!c.length||!l.length)return;u=g.bendpoint?s[g.index]:v,(c.length===1||!kg(r,c[c.length-1]))&&c.push(Og(u)),(l.length===1||!kg(r,l[0]))&&l.unshift(Og(u))}f=o.source,p=o.target,t.canConnect(f,r,o)&&(n.reconnectEnd(o,r,c||v),d=o),t.canConnect(r,p,o)&&(d?m=n.connect(r,p,{type:o.type,waypoints:l}):(n.reconnectStart(o,r,l||v),m=o));var b=[].concat(d&&Ke(y,function(x){return x.source===d.source})||[],m&&Ke(h,function(x){return x.target===m.target})||[]);b.length&&n.removeElements(b)}this.preExecute("elements.move",function(r){var o=r.newParent,a=r.shapes,s=r.delta,c=a[0];if(!(!c||!o)){o&&o.waypoints&&(r.newParent=o=o.parent);var l=Ne(c),u={x:l.x+s.x,y:l.y+s.y},f=vt(o.children,function(p){var d=t.canInsert(a,p);return d&&hp(p.waypoints,u)});f&&(r.targetFlow=f,r.position=u)}},!0),this.postExecuted("elements.move",function(r){var o=r.shapes,a=r.targetFlow,s=r.position;a&&i(o[0],a,s)},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;t.canInsert(a,o)&&(r.targetFlow=o,r.parent=o.parent)},!0),this.postExecuted("shape.create",function(r){var o=r.shape,a=r.targetFlow,s=r.position;a&&i(o,a,s)},!0)}Ee(mp,te),mp.$inject=["eventBus","bpmnRules","modeling"];function kg(e,t){var n=t.x,i=t.y;return n>=e.x&&n<=e.x+e.width&&i>=e.y&&i<=e.y+e.height}function Og(e){return W({},e)}function gp(e,t){te.call(this,e),this.preExecuted("connection.create",function(n){var i=n.context,r=i.connection,o=i.source,a=i.target,s=i.hints;if(!(s&&s.createElementsBehavior===!1)&&Po(r)){var c=[];S(o,"bpmn:EventBasedGateway")?c=a.incoming.filter(l=>l!==r&&Po(l)):c=a.incoming.filter(l=>l!==r&&Po(l)&&S(l.source,"bpmn:EventBasedGateway")),c.forEach(function(l){t.removeConnection(l)})}}),this.preExecuted("shape.replace",function(n){var i=n.context,r=i.newShape;if(S(r,"bpmn:EventBasedGateway")){var o=r.outgoing.filter(Po).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);o.forEach(function(a){a.incoming.filter(Po).forEach(function(s){const c=a.incoming.filter(Po).filter(function(l){return l.source===r});(s.source!==r||c.length>1)&&t.removeConnection(s)})})}})}gp.$inject=["eventBus","modeling"],Ee(gp,te);function Po(e){return S(e,"bpmn:SequenceFlow")}var fc=1500,Dg=2e3;function Ig(e,t,n){t.on(["create.hover","create.move","create.out","create.end","shape.move.hover","shape.move.move","shape.move.out","shape.move.end"],fc,function(i){var r=i.context,o=r.shape||i.shape,a=i.hover;S(a,"bpmn:Lane")&&!qe(o,["bpmn:Lane","bpmn:Participant"])&&(i.hover=ei(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(o.labelTarget||qe(o,["bpmn:Group","bpmn:TextAnnotation"]))&&(i.hover=s,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.hover","connect.out","connect.end","connect.cleanup","global-connect.hover","global-connect.out","global-connect.end","global-connect.cleanup"],fc,function(i){var r=i.hover;S(r,"bpmn:Lane")&&(i.hover=ei(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],fc,function(i){var r=i.context,o=i.hover,a=r.type;S(o,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=ei(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],fc,function(i){var r=i.context,o=r.start;S(o,"bpmn:Lane")&&(r.start=ei(o)||o)}),t.on("shape.move.start",Dg,function(i){var r=i.shape;S(r,"bpmn:Lane")&&(i.shape=ei(r)||r)}),t.on("spaceTool.move",Dg,function(i){var r=i.hover;r&&S(r,"bpmn:Lane")&&(i.hover=ei(r))})}Ig.$inject=["elementRegistry","eventBus","canvas"];var Lg=770;function yp(e,t,n,i){n.invoke(te,this);function r(s,c){var l=ie(s),u=c.categoryValue||l.categoryValueRef;u||(u=_g(e,l));var f=c.category||u.$parent||xg(e);l.categoryValueRef=u,u.$parent=f,c.categoryValue=u,c.category=f}function o(s,c){var l=ie(s),u=c.categoryValue||l.categoryValueRef,f=c.category||u&&u.$parent;u&&(c.categoryValue=u,c.category=f,l.categoryValueRef=null)}this.execute("label.create",function(s){var c=s.context,l=c.labelTarget;S(l,"bpmn:Group")&&r(l,c)}),this.revert("label.create",function(s){var c=s.context,l=c.labelTarget;S(l,"bpmn:Group")&&o(l,c)}),this.execute("shape.delete",function(s){var c=s.context,l=c.shape,u=ie(l);if(!(!S(l,"bpmn:Group")||l.labelTarget)){var f=c.categoryValue=u.categoryValueRef;f&&(c.category=f.$parent,u.categoryValueRef=null)}}),this.reverted("shape.delete",function(s){var c=s.context,l=c.shape;if(!(!S(l,"bpmn:Group")||l.labelTarget)){var u=c.category,f=c.categoryValue,p=ie(l);f&&(p.categoryValueRef=f,f.$parent=u)}}),this.execute("shape.create",function(s){var c=s.context,l=c.shape,u=c.hints||{};!S(l,"bpmn:Group")||l.labelTarget||u.createElementsBehavior===!1&&!ie(l).categoryValueRef&&!c.categoryValue||r(l,c)}),this.reverted("shape.create",function(s){var c=s.context,l=c.shape,u=c.hints||{};!S(l,"bpmn:Group")||l.labelTarget||u.createElementsBehavior===!1&&!ie(l).categoryValueRef&&!c.categoryValue||o(l,c)}),this.executed(["shape.move","shape.resize"],function(s){var c=s.context,l=c.shape;!S(l,"bpmn:Group")||l.labelTarget||ie(l).categoryValueRef||r(l,c)}),this.reverted(["shape.move","shape.resize"],function(s){var c=s.context,l=c.shape;!S(l,"bpmn:Group")||l.labelTarget||!c.categoryValue||o(l,c)});function a(s,c){var l=e.create(s.$type);return i.copyElement(s,l,null,c)}t.on("copyPaste.copyElement",Lg,function(s){var c=s.descriptor,l=s.element;if(!(!S(l,"bpmn:Group")||l.labelTarget)){var u=ie(l);if(u.categoryValueRef){var f=u.categoryValueRef;c.categoryValue=a(f,!0),f.$parent&&(c.category=a(f.$parent,!0))}}}),t.on("copyPaste.pasteElement",Lg,function(s){var c=s.descriptor,l=c.businessObject,u=c.categoryValue,f=c.category;u&&(u=l.categoryValueRef=a(u)),f&&(u.$parent=a(f)),delete c.category,delete c.categoryValue})}yp.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],Ee(yp,te);function vp(e,t,n,i){var r,o,a,s,c;return r=(i.y-n.y)*(t.x-e.x)-(i.x-n.x)*(t.y-e.y),r==0?null:(o=e.y-n.y,a=e.x-n.x,c=(i.x-n.x)*o-(i.y-n.y)*a,s=c/r,{x:Math.round(e.x+s*(t.x-e.x)),y:Math.round(e.y+s*(t.y-e.y))})}function Bg(e){function t(i,r,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=vp(i,r,o,a),l=vp(i,r,o,s),u;c&&l?Ng(c,o)>Ng(l,o)?u=l:u=c:u=c||l,i.original=u}function n(i){var r=i.waypoints;t(r[0],r[1],Ne(i.source)),t(r[r.length-1],r[r.length-2],Ne(i.target))}e.on("bpmnElement.added",function(i){var r=i.element;r.waypoints&&n(r)})}Bg.$inject=["eventBus"];function Ng(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function bp(e){te.call(this,e);var t=["bpmn:Participant","bpmn:Lane"];this.executed(["shape.move","shape.create","shape.resize"],function(n){var i=n.context.shape,r=ie(i),o=ot(i);if(qe(r,t)){var a=o.get("isHorizontal");a===void 0&&(a=!0),o.set("isHorizontal",a)}})}bp.$inject=["eventBus"],Ee(bp,te);function $g(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Fg(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function VA(e,t){return t?{x:Math.cos(t)*e.x-Math.sin(t)*e.y,y:Math.sin(t)*e.x+Math.cos(t)*e.y}:e}function WA(e,t,n){var i=[{n:e[0]-n[0],lambda:t[0]},{n:e[1]-n[1],lambda:t[1]}],r=i[0].n*t[0]+i[1].n*t[1],o=i[0].lambda*t[0]+i[1].lambda*t[1];return-r/o}function xp(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=WA([n.x,n.y],[r.x,r.y],[e.x,e.y]);return{x:n.x+o*r.x,y:n.y+o*r.y}}function jg(e,t){var n=xp(e,t),i={x:n.x-e.x,y:n.y-e.y};return $g(i)}function Ea(e,t){return $g({x:e.x-t.x,y:e.y-t.y})}var Hg=Math.sqrt,zg=Math.min,UA=Math.max,Gg=Math.abs;function Vg(e){return Math.pow(e,2)}function Sa(e,t){return Hg(Vg(e.x-t.x)+Vg(e.y-t.y))}function YA(e,t){var n=0,i,r,o,a,s,c,l,u,f,p,d;for(n=0;n<t.length-1;n++){if(i=t[n],r=t[n+1],Ug(i,r)?l=[i]:(o=Sa(e,i),a=Sa(e,r),c=zg(o,a),l=qA(i,r,e,c)),l.length<1)throw new Error("expected between [1, 2] circle -> line intersections");l.length===1&&(u={type:"bendpoint",position:l[0],segmentIndex:n,bendpointIndex:Ug(i,l[0])?n:n+1}),l.length===2&&(s=XA(l[0],l[1]),u={type:"segment",position:s,segmentIndex:n,relativeLocation:Sa(i,s)/Sa(i,r)}),f=Sa(u.position,e),(!d||p>f)&&(d=u,p=f)}return d}function qA(e,t,n,i){var r=t.x-e.x,o=t.y-e.y,a=n.x-e.x,s=n.y-e.y,c=r*r+o*o,l=r*a+o*s,u=a*a+s*s-i*i,f=l/c,p=u/c,d=f*f-p;if(d<0&&d>-1e-6&&(d=0),d<0)return[];var m=Hg(d),h=-f+m,y=-f-m,v={x:e.x-r*h,y:e.y-o*h};if(d===0)return[v];var g={x:e.x-r*y,y:e.y-o*y};return[v,g].filter(function(b){return KA(b,e,t)})}function KA(e,t,n){return Wg(e.x,t.x,n.x)&&Wg(e.y,t.y,n.y)}function Wg(e,t,n){return e>=zg(t,n)-dc&&e<=UA(t,n)+dc}function XA(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var dc=.1;function Ug(e,t){return Gg(e.x-t.x)<=dc&&Gg(e.y-t.y)<=dc}function ZA(e,t,n,i){var r=n.segmentIndex,o=t.length-e.length;if(i.segmentMove){var a=i.segmentMove.segmentStartIndex,s=i.segmentMove.newSegmentStartIndex;return r===a?s:r>=s?r+o<s?s:r+o:r}if(i.bendpointMove){var c=i.bendpointMove.insert,l=i.bendpointMove.bendpointIndex,u;if(o===0)return r;if(r>=l&&(u=c?r+1:r-1),r<l&&(u=r,c&&n.type!=="bendpoint"&&l-1===r)){var f=qg(t,l);f<n.relativeLocation&&u++}return u}return o===0?r:i.connectionStart&&r===0?0:i.connectionEnd&&r===e.length-2?t.length-2:Math.floor((t.length-2)/2)}function Yg(e,t,n,i){var r=0,o=0,a={point:e,delta:{x:0,y:0}},s=YA(e,n),c=s.segmentIndex,l=ZA(n,t,s,i);if(l<0||l>t.length-2||l===null)return a;var u=Kg(n,c),f=Kg(t,l),p=s.position,d=JA(u,p),m=QA(u,f);if(s.type==="bendpoint"){var h=t.length-n.length,y=s.bendpointIndex,v=n[y];if(t.indexOf(v)!==-1)return a;if(h===0){var g=t[y];return r=g.x-s.position.x,o=g.y-s.position.y,{delta:{x:r,y:o},point:{x:e.x+r,y:e.y+o}}}h<0&&y!==0&&y<n.length-1&&(d=qg(n,y))}var b={x:(f[1].x-f[0].x)*d+f[0].x,y:(f[1].y-f[0].y)*d+f[0].y},x=VA({x:e.x-p.x,y:e.y-p.y},m);return r=b.x+x.x-e.x,o=b.y+x.y-e.y,{point:Bi(b),delta:Bi({x:r,y:o})}}function qg(e,t){var n=Ea(e[t-1],e[t]),i=Ea(e[t],e[t+1]),r=n/(n+i);return r}function QA(e,t){var n=Fg(e),i=Fg(t);return i-n}function Kg(e,t){return[e[t],e[t+1]]}function JA(e,t){var n=Ea(e[0],e[1]),i=Ea(e[0],t);return n===0?0:i/n}function eP(e,t,n,i){var r=Ne(e);return Yg(r,t,n,i).delta}function Ra(e,t,n){var i=xa(t),r=xa(n),o=pi(e,i),a={x:o.x*(n.width/t.width),y:o.y*(n.height/t.height)};return Bi({x:r.x+a.x,y:r.y+a.y})}function Xg(e,t,n){var i=xa(e),r=xa(t),o=xa(n),a=pi(e,i),s=pi(i,r),c=tP(i,t,n);if(c)return c;var l={x:s.x*(n.width/t.width),y:s.y*(n.height/t.height)},u={x:o.x+l.x,y:o.y+l.y};return Bi({x:u.x+a.x-e.x,y:u.y+a.y-e.y})}function tP(e,t,n){var i=Ie(t),r=Ie(n);if(nP(i,r))return null;var o=cn(t,e),a,s,c;if(o==="top")a={x:0,y:r.bottom-i.bottom};else if(o==="bottom")a={x:0,y:r.top-i.top};else if(o==="right")a={x:r.left-i.left,y:0};else if(o==="left")a={x:r.right-i.right,y:0};else return null;return s={x:e.x+a.x,y:e.y+a.y},c=cn(n,s),c!==o?null:a}function nP(e,t){return iP(e,t)||rP(e,t)}function iP(e,t){return e.right!==t.right&&e.left!==t.left}function rP(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var Zg="name",Qg="text";function _p(e,t,n,i){te.call(this,e),this.postExecute("element.updateProperties",r),this.postExecute("element.updateModdleProperties",a=>{ie(a.context.element)===a.context.moddleElement&&r(a)});function r(a){var s=a.context,c=s.element,l=s.properties;if(Zg in l&&t.updateLabel(c,l[Zg]),Qg in l&&S(c,"bpmn:TextAnnotation")){var u=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},l[Qg]||"");t.updateLabel(c,l.text,u)}}this.postExecute(["shape.create","connection.create"],function(a){var s=a.context,c=s.hints||{};if(c.createElementsBehavior!==!1){var l=s.shape||s.connection;Ye(l)||!sr(l)||qn(l)&&t.updateLabel(l,qn(l))}}),this.postExecute("shape.delete",function(a){var s=a.context,c=s.labelTarget,l=s.hints||{};c&&l.unsetLabel!==!1&&t.updateLabel(c,null,null,{removeShape:!1})});function o(a){var s=a.context,c=s.connection,l=c.label,u=W({},s.hints),f=s.newWaypoints||c.waypoints,p=s.oldWaypoints;return typeof u.startChanged>"u"&&(u.startChanged=!!u.connectionStart),typeof u.endChanged>"u"&&(u.endChanged=!!u.connectionEnd),eP(l,f,p,u)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(a){var s=a.context,c=s.hints||{};if(c.labelBehavior!==!1){var l=s.connection,u=l.label,f;!u||!u.parent||(f=o(a),t.moveShape(u,f))}}),this.postExecute(["shape.replace"],function(a){var s=a.context,c=s.newShape,l=s.oldShape,u=ie(c);u&&sr(u)&&l.label&&c.label&&(c.label.x=l.label.x,c.label.y=l.label.y)}),this.preExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.hints||{};if(!(!Ye(c)||l.autoResize)){var u=s.newBounds,f=i.getDimensions(qn(c)||"",{box:u,style:i.getExternalStyle()}),p=Math.ceil(f.height),d=u.y!==c.y,m=c.y+c.height;s.newBounds={width:u.width,height:p,x:u.x,y:d?m-p:u.y}}}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.newBounds,u=s.oldBounds;if(Xs(c)){var f=c.label,p=Ne(f),d=sP(u),m=aP(p,d),h=oP(m,u,l);t.moveShape(f,h)}})}Ee(_p,te),_p.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function oP(e,t,n){var i=Ra(e,t,n);return Bi(pi(i,e))}function aP(e,t){if(t.length){var n=cP(e,t);return xp(e,n)}}function sP(e){return[[{x:e.x,y:e.y},{x:e.x+(e.width||0),y:e.y}],[{x:e.x+(e.width||0),y:e.y},{x:e.x+(e.width||0),y:e.y+(e.height||0)}],[{x:e.x,y:e.y+(e.height||0)},{x:e.x+(e.width||0),y:e.y+(e.height||0)}],[{x:e.x,y:e.y},{x:e.x,y:e.y+(e.height||0)}]]}function cP(e,t){var n=t.map(function(r){return{line:r,distance:jg(e,r)}}),i=di(n,"distance");return i[0].line}function lP(e,t,n,i){return Yg(e,t,n,i).point}function wp(e,t){te.call(this,e);function n(i,r){var o=i.context,a=o.connection,s=W({},o.hints),c=o.newWaypoints||a.waypoints,l=o.oldWaypoints;return typeof s.startChanged>"u"&&(s.startChanged=!!s.connectionStart),typeof s.endChanged>"u"&&(s.endChanged=!!s.connectionEnd),lP(r,c,l,s)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(i){var r=i.context,o=r.connection,a=o.outgoing,s=o.incoming;s.forEach(function(c){var l=c.waypoints[c.waypoints.length-1],u=n(i,l),f=[].concat(c.waypoints.slice(0,-1),[u]);t.updateWaypoints(c,f)}),a.forEach(function(c){var l=c.waypoints[0],u=n(i,l),f=[].concat([u],c.waypoints.slice(1));t.updateWaypoints(c,f)})}),this.postExecute(["connection.move"],function(i){var r=i.context,o=r.connection,a=o.outgoing,s=o.incoming,c=r.delta;s.forEach(function(l){var u=l.waypoints[l.waypoints.length-1],f={x:u.x+c.x,y:u.y+c.y},p=[].concat(l.waypoints.slice(0,-1),[f]);t.updateWaypoints(l,p)}),a.forEach(function(l){var u=l.waypoints[0],f={x:u.x+c.x,y:u.y+c.y},p=[].concat([f],l.waypoints.slice(1));t.updateWaypoints(l,p)})})}Ee(wp,te),wp.$inject=["eventBus","modeling"];function hc(e,t,n){var i=gc(e),r=ey(i,t),o=i[0];return r.length?r[r.length-1]:Ra(o.original||o,n,t)}function mc(e,t,n){var i=gc(e),r=ey(i,t),o=i[i.length-1];return r.length?r[0]:Ra(o.original||o,n,t)}function Ep(e,t,n){var i=gc(e),r=Jg(t,n),o=i[0];return Ra(o.original||o,r,t)}function Sp(e,t,n){var i=gc(e),r=Jg(t,n),o=i[i.length-1];return Ra(o.original||o,r,t)}function Jg(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function gc(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function ey(e,t){var n=hn(e,pP);return Ke(n,function(i){return uP(i,t)})}function uP(e,t){return cn(t,e,1)==="intersect"}function pP(e){return e.original||e}function Rp(e,t){te.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,r=n.newShape;if(fP(i,r)){var o=dP(i);o.incoming.forEach(function(a){var s=mc(a,r,i);t.reconnectEnd(a,r,s)}),o.outgoing.forEach(function(a){var s=hc(a,r,i);t.reconnectStart(a,r,s)})}},!0)}Rp.$inject=["eventBus","modeling"],Ee(Rp,te);function fP(e,t){return S(e,"bpmn:Participant")&&Qe(e)&&S(t,"bpmn:Participant")&&!Qe(t)}function dP(e){var t=ua([e]),n=[],i=[];return t.forEach(function(r){r!==e&&(r.incoming.forEach(function(o){S(o,"bpmn:MessageFlow")&&n.push(o)}),r.outgoing.forEach(function(o){S(o,"bpmn:MessageFlow")&&i.push(o)}))},[]),{incoming:n,outgoing:i}}const hP=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function ty(e){const t=ie(e);if(!S(t,"bpmn:BoundaryEvent")&&!(S(t,"bpmn:StartEvent")&&vn(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:hP.some(i=>S(n[0],i))}function ny(e){return S(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function Cp(e,t){e.invoke(te,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,r=n.context.newShape,o=n.context.hints;if(!ty(r))return;const a=ny(r);if(o.targetElement&&o.targetElement[a]!==void 0)return;const c=ie(i).get(a),l=ie(r).get(a);c!==l&&t.updateProperties(r,{[a]:c})})}Cp.$inject=["injector","modeling"],Ee(Cp,te);function Ap(e,t){te.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,r=ot(i),o=r&&r.get("label"),a=o&&o.get("bounds");a&&t.updateModdleProperties(i,o,{bounds:void 0})},!0)}Ee(Ap,te),Ap.$inject=["eventBus","modeling"];function Pp(e,t,n){te.call(this,e),this.preExecute("shape.delete",function(i){var r=i.context.shape;if(!(r.incoming.length!==1||r.outgoing.length!==1)){var o=r.incoming[0],a=r.outgoing[0];if(!(!S(o,"bpmn:SequenceFlow")||!S(a,"bpmn:SequenceFlow"))&&t.canConnect(o.source,a.target,o)){var s=mP(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}Ee(Pp,te),Pp.$inject=["eventBus","bpmnRules","modeling"];function Mo(e){return e.original||e}function mP(e,t){var n=vp(Mo(e[e.length-2]),Mo(e[e.length-1]),Mo(t[1]),Mo(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[Mo(e[0]),Mo(t[t.length-1])]}function Mp(e,t){te.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,r=i.parent;S(i,"bpmn:Participant")&&(n.collaborationRoot=r)},!0),this.postExecute("shape.delete",function(n){var i=n.collaborationRoot;if(i&&!i.businessObject.participants.length){var r=t.makeProcess(),o=i.children.slice();t.moveElements(o,{x:0,y:0},r)}},!0)}Mp.$inject=["eventBus","modeling"],Ee(Mp,te);function Tp(e,t,n,i){te.call(this,e);var r=i.get("dragging",!1);function o(c){var l=c.source,u=c.target,f=c.parent;if(f){var p,d;S(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(l,u)||(d=!0),n.canConnectMessageFlow(l,u)&&(p="bpmn:MessageFlow")),S(c,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(l,u)||(d=!0),n.canConnectSequenceFlow(l,u)&&(p="bpmn:SequenceFlow")),d&&t.removeConnection(c),p&&t.connect(l,u,{type:p,waypoints:c.waypoints.slice()})}}function a(c){var l=c.context,u=l.connection,f=l.newSource||u.source,p=l.newTarget||u.target,d,m;d=n.canConnect(f,p),!(!d||d.type===u.type)&&(m=t.connect(f,p,{type:d.type,associationDirection:d.associationDirection,waypoints:u.waypoints.slice()}),u.parent&&t.removeConnection(u),l.connection=m,r&&s(u,m))}function s(c,l){var u=r.context(),f=u&&u.payload.previousSelection,p;!f||!f.length||(p=f.indexOf(c),p!==-1&&f.splice(p,1,l))}this.postExecuted("elements.move",function(c){var l=c.closure,u=l.allConnections;F(u,o)},!0),this.preExecute("connection.reconnect",a),this.postExecuted("element.updateProperties",function(c){var l=c.context,u=l.properties,f=l.element,p=f.businessObject,d;u.default&&(d=vt(f.outgoing,ao({id:f.businessObject.default.id})),d&&t.updateProperties(d,{conditionExpression:void 0})),u.conditionExpression&&p.sourceRef.default===p&&t.updateProperties(f.source,{default:void 0})})}Ee(Tp,te),Tp.$inject=["eventBus","modeling","bpmnRules","injector"];function yc(e,t,n,i,r,o){i.invoke(te,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=o,this.postExecuted(["elements.create"],500,function(a){var s=a.context,c=s.parent,l=s.elements,u=Tn(l,function(f,p){var d=t.canReplace([p],p.host||p.parent||c);return d?f.concat(d.replacements):f},[]);u.length&&this._replaceElements(l,u)},this),this.postExecuted(["elements.move"],500,function(a){var s=a.context,c=s.newParent,l=s.newHost,u=[];F(s.closure.topLevel,function(p){vn(p)?u=u.concat(p.children):u=u.concat(p)}),u.length===1&&l&&(c=l);var f=t.canReplace(u,c);f&&this._replaceElements(u,f.replacements,l)},this),this.postExecute(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,l=s.newShape,u=c.attachers,f;u&&u.length&&(f=t.canReplace(u,l),this._replaceElements(u,f.replacements))},this),this.postExecuted(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,l=s.newShape;r.unclaimId(c.businessObject.id,c.businessObject),r.updateProperties(l,{id:c.id})})}Ee(yc,te),yc.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,r=this._selection;F(t,function(o){var a={type:o.newElementType},s=n.get(o.oldElementId),c=e.indexOf(s);e[c]=i.replaceElement(s,a,{select:!1})}),t&&r.select(e)},yc.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var gP=1500,yP={width:140,height:120},kp={width:300,height:60},Op={width:60,height:300},vc={width:300,height:150},bc={width:150,height:300},iy={width:140,height:120},ry={width:100,height:40};function oy(e){e.on("resize.start",gP,function(t){var n=t.context,i=n.shape,r=n.direction,o=n.balanced;(S(i,"bpmn:Lane")||S(i,"bpmn:Participant"))&&(n.resizeConstraints=wP(i,r,o)),S(i,"bpmn:SubProcess")&&Qe(i)&&(n.minDimensions=iy),S(i,"bpmn:TextAnnotation")&&(n.minDimensions=ry)})}oy.$inject=["eventBus"];var ur=Math.abs,vP=Math.min,bP=Math.max;function ay(e,t,n,i){var r=e[t];e[t]=r===void 0?n:i(n,r)}function To(e,t,n){return ay(e,t,n,vP)}function ko(e,t,n){return ay(e,t,n,bP)}var xP={top:20,left:50,right:20,bottom:20},_P={top:50,left:20,right:20,bottom:20};function wP(e,t,n){var i=ei(e),r=!0,o=!0,a=lc(i,[i]),s=Ie(e),c={},l={},u=tn(e),f=u?kp:Op;/n/.test(t)?l.top=s.bottom-f.height:/e/.test(t)?l.right=s.left+f.width:/s/.test(t)?l.bottom=s.top+f.height:/w/.test(t)&&(l.left=s.right-f.width),a.forEach(function(m){var h=Ie(m);u?(h.top<s.top-10&&(r=!1),h.bottom>s.bottom+10&&(o=!1)):(h.left<s.left-10&&(r=!1),h.right>s.right+10&&(o=!1)),/n/.test(t)&&(n&&ur(s.top-h.bottom)<10&&ko(c,"top",h.top+f.height),ur(s.top-h.top)<5&&To(l,"top",h.bottom-f.height)),/e/.test(t)&&(n&&ur(s.right-h.left)<10&&To(c,"right",h.right-f.width),ur(s.right-h.right)<5&&ko(l,"right",h.left+f.width)),/s/.test(t)&&(n&&ur(s.bottom-h.top)<10&&To(c,"bottom",h.bottom-f.height),ur(s.bottom-h.bottom)<5&&ko(l,"bottom",h.top+f.height)),/w/.test(t)&&(n&&ur(s.left-h.right)<10&&ko(c,"left",h.left+f.width),ur(s.left-h.left)<5&&To(l,"left",h.right-f.width))});var p=i.children.filter(function(m){return!m.hidden&&!m.waypoints&&(S(m,"bpmn:FlowElement")||S(m,"bpmn:Artifact"))}),d=u?xP:_P;return p.forEach(function(m){var h=Ie(m);/n/.test(t)&&(!u||r)&&To(l,"top",h.top-d.top),/e/.test(t)&&(u||o)&&ko(l,"right",h.right+d.right),/s/.test(t)&&(!u||o)&&ko(l,"bottom",h.bottom+d.bottom),/w/.test(t)&&(u||r)&&To(l,"left",h.left-d.left)}),{min:l,max:c}}function sy(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function Oo(e){return e.originalEvent||e.srcEvent}function Dp(e){sy(e),sy(Oo(e))}function Hr(e){return e.pointers&&e.pointers.length&&(e=e.pointers[0]),e.touches&&e.touches.length&&(e=e.touches[0]),e?{x:e.clientX,y:e.clientY}:null}function cy(){return/mac/i.test(navigator.platform)}function ly(e,t){return(Oo(e)||e).button===t}function pr(e){return ly(e,0)}function EP(e){return ly(e,1)}function Ca(e){var t=Oo(e)||e;return pr(e)?cy()?t.metaKey:t.ctrlKey:!1}function xc(e){var t=Oo(e)||e;return pr(e)&&t.shiftKey}var uy=1001;function py(e,t){e.on("resize.start",uy+500,function(n){var i=n.context,r=i.shape;(S(r,"bpmn:Lane")||S(r,"bpmn:Participant"))&&(i.balanced=!Ca(n))}),e.on("resize.end",uy,function(n){var i=n.context,r=i.shape,o=i.canExecute,a=i.newBounds;if(S(r,"bpmn:Lane")||S(r,"bpmn:Participant"))return o&&(a=jm(a),t.resizeLane(r,a,i.balanced)),!1})}py.$inject=["eventBus","modeling"];var SP=500;function Ip(e,t,n,i,r){n.invoke(te,this);function o(u){return qe(u,["bpmn:ReceiveTask","bpmn:SendTask"])||RP(u,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(u){var f=e.getDefinitions(),p=f.get("rootElements");return!!vt(p,ao({id:u.id}))}function s(u){if(S(u,"bpmn:ErrorEventDefinition"))return"errorRef";if(S(u,"bpmn:EscalationEventDefinition"))return"escalationRef";if(S(u,"bpmn:MessageEventDefinition"))return"messageRef";if(S(u,"bpmn:SignalEventDefinition"))return"signalRef"}function c(u){if(qe(u,["bpmn:ReceiveTask","bpmn:SendTask"]))return u.get("messageRef");var f=u.get("eventDefinitions"),p=f[0];return p.get(s(p))}function l(u,f){if(qe(u,["bpmn:ReceiveTask","bpmn:SendTask"]))return u.set("messageRef",f);var p=u.get("eventDefinitions"),d=p[0];return d.set(s(d),f)}this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],function(u){var f=u.shape||u.element;if(o(f)){var p=ie(f),d=c(p),m;d&&!a(d)&&(m=e.getDefinitions().get("rootElements"),Bt(m,d),u.addedRootElement=d)}},!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],function(u){var f=u.addedRootElement;if(f){var p=e.getDefinitions().get("rootElements");Lt(p,f)}},!0),t.on("copyPaste.copyElement",function(u){var f=u.descriptor,p=u.element;if(!(p.labelTarget||!o(p))){var d=ie(p),m=c(d);m&&(f.referencedRootElement=m)}}),t.on("copyPaste.pasteElement",SP,function(u){var f=u.descriptor,p=f.businessObject,d=f.referencedRootElement;d&&(a(d)||(d=i.copyElement(d,r.create(d.$type))),l(p,d),delete f.referencedRootElement)})}Ip.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],Ee(Ip,te);function RP(e,t){return Be(t)||(t=[t]),Xi(t,function(n){return Eo(e,n)})}var fy=Math.max;function dy(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,r=t.start,o={};return F(n,function(a){var s=a.id;S(a,"bpmn:Participant")&&(o[s]=AP(a,i,r)),S(a,"bpmn:Lane")&&(o[s]=tn(a)?kp:Op),S(a,"bpmn:SubProcess")&&Qe(a)&&(o[s]=iy),S(a,"bpmn:TextAnnotation")&&(o[s]=ry),S(a,"bpmn:Group")&&(o[s]=yP)}),o})}dy.$inject=["eventBus"];function CP(e){return e==="x"}function AP(e,t,n){var i=tn(e);if(!TP(e))return i?vc:bc;var r=CP(t),o={};return r?i?o=vc:o={width:MP(e,n,r),height:bc.height}:i?o={width:vc.width,height:PP(e,n,r)}:o=bc,o}function PP(e,t,n){var i;return i=kP(e,t,n),fy(vc.height,i)}function MP(e,t,n){var i;return i=OP(e,t,n),fy(bc.width,i)}function TP(e){return!!lr(e).length}function kP(e,t,n){var i=lr(e),r;return r=Lp(i,t,n),e.height-r.height+kp.height}function OP(e,t,n){var i=lr(e),r;return r=Lp(i,t,n),e.width-r.width+Op.width}function Lp(e,t,n){var i,r,o;for(i=0;i<e.length;i++)if(r=e[i],!n&&t>=r.y&&t<=r.y+r.height||n&&t>=r.x&&t<=r.x+r.width)return o=lr(r),o.length?Lp(o,t,n):r}var hy="_plane";function my(e){var t=e.id;return DP(t)}function Ei(e){var t=e.id;return S(e,"bpmn:SubProcess")?gy(t):t}function zr(e){return gy(e)}function _c(e){var t=ot(e);return S(t,"bpmndi:BPMNPlane")}function gy(e){return e+hy}function DP(e){return e.replace(new RegExp(hy+"$"),"")}var yy=400,IP=600,vy={x:180,y:160};function ji(e,t,n,i,r,o,a){te.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=i,this._bpmnFactory=r,this._bpmnjs=o,this._elementRegistry=a;var s=this;function c(f){return S(f,"bpmn:SubProcess")&&!Qe(f)}function l(f){var p=f.shape,d=f.newRootElement,m=ie(p);d=s._addDiagram(d||m),f.newRootElement=e.addRootElement(d)}function u(f){var p=f.shape,d=ie(p);s._removeDiagram(d);var m=f.newRootElement=a.get(Ei(d));e.removeRootElement(m)}this.executed("shape.create",function(f){var p=f.shape;c(p)&&l(f)},!0),this.postExecuted("elements.create",function(f){var p=f.elements;F(p,function(d){if(c(d)){var m=a.get(Ei(d));if(!(!m||!d.children||!d.children.length)){var h=by(d);s._showRecursively(h),s._moveChildrenToShape(h,m)}}})},!0),this.reverted("shape.create",function(f){var p=f.shape;c(p)&&u(f)},!0),this.preExecute("shape.delete",function(f){var p=f.shape;!S(p,"bpmn:SubProcess")||!Qe(p)||F(ga([p]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(f){var p=f.shape;if(c(p)){var d=a.get(Ei(p));d&&n.removeElements(d.children.slice())}},!0),this.executed("shape.delete",function(f){var p=f.shape;c(p)&&u(f)},!0),this.reverted("shape.delete",function(f){var p=f.shape;c(p)&&l(f)},!0),this.preExecuted("shape.replace",function(f){var p=f.oldShape,d=f.newShape;!c(p)||!c(d)||(f.oldRoot=e.removeRootElement(Ei(p)))},!0),this.postExecuted("shape.replace",function(f){var p=f.newShape,d=f.oldRoot,m=e.findRoot(Ei(p));if(!(!d||!m)){var h=d.children;n.moveElements(h,{x:0,y:0},m)}},!0),this.executed("element.updateProperties",function(f){var p=f.element;if(S(p,"bpmn:SubProcess")){var d=f.properties,m=f.oldProperties,h=m.id,y=d.id;if(h!==y){if(_c(p)){a.updateId(p,zr(y)),a.updateId(h,y);return}var v=a.get(zr(h));v&&a.updateId(zr(h),zr(y))}}},!0),this.reverted("element.updateProperties",function(f){var p=f.element;if(S(p,"bpmn:SubProcess")){var d=f.properties,m=f.oldProperties,h=m.id,y=d.id;if(h!==y){if(_c(p)){a.updateId(p,zr(h)),a.updateId(y,h);return}var v=a.get(zr(y));v&&a.updateId(v,zr(h))}}},!0),t.on("element.changed",function(f){var p=f.element;if(_c(p)){var d=p,m=a.get(my(d));!m||m===d||t.fire("element.changed",{element:m})}}),this.executed("shape.toggleCollapse",yy,function(f){var p=f.shape;S(p,"bpmn:SubProcess")&&(Qe(p)?u(f):(l(f),s._showRecursively(p.children)))},!0),this.reverted("shape.toggleCollapse",yy,function(f){var p=f.shape;S(p,"bpmn:SubProcess")&&(Qe(p)?u(f):(l(f),s._showRecursively(p.children)))},!0),this.postExecuted("shape.toggleCollapse",IP,function(f){var p=f.shape;if(S(p,"bpmn:SubProcess")){var d=f.newRootElement;if(d)if(Qe(p))s._moveChildrenToShape(d.children.slice(),p),F(ga(p.children),h=>{n.moveShape(h.annotation,{x:0,y:0},p.parent),F(h.associations,y=>{n.moveConnection(y,{x:0,y:0},p.parent)})});else{s._disconnectSharedAnnotations(p);var m=by(p);s._moveChildrenToShape(m,d)}}},!0),t.on("copyPaste.createTree",function(f){var p=f.element,d=f.children;if(c(p)){var m=Ei(p),h=a.get(m);h&&d.push.apply(d,h.children)}}),t.on("copyPaste.copyElement",function(f){var p=f.descriptor,d=f.element,m=f.elements,h=d.parent,y=S(ot(h),"bpmndi:BPMNPlane");if(y){var v=my(h),g=vt(m,function(b){return b.id===v});g&&(p.parent=g.id)}}),t.on("copyPaste.pasteElement",function(f){var p=f.descriptor;p.parent&&(c(p.parent)||p.parent.hidden)&&(p.hidden=!0)})}Ee(ji,te),ji.prototype._moveChildrenToShape=function(e,t){var n=this._modeling;if(e.length){var i=e.filter(function(c){return!c.hidden});if(!i.length){n.moveElements(e,{x:0,y:0},t,{autoResize:!1});return}var r=Ft(i),o;if(!t.x)o={x:vy.x-r.x,y:vy.y-r.y};else{var a=Ne(t),s=Ne(r);o={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,o,t,{autoResize:!1})}},ji.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(lg(e).map(i=>i.annotation));n.size&&F(ga(e.children),i=>{n.has(i.annotation)&&F(i.associations,r=>{t.removeConnection(r)})})},ji.prototype._showRecursively=function(e,t){var n=this,i=[];return e.forEach(function(r){r.hidden=!!t,i=i.concat(r),r.children&&(i=i.concat(n._showRecursively(r.children,r.collapsed||t)))}),i},ji.prototype._addDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams;return e.businessObject||(e=this._createNewDiagram(e)),n.push(e.di.$parent),e},ji.prototype._createNewDiagram=function(e){var t=this._bpmnFactory,n=this._elementFactory,i=t.create("bpmndi:BPMNPlane",{bpmnElement:e}),r=t.create("bpmndi:BPMNDiagram",{plane:i});i.$parent=r;var o=n.createRoot({id:Ei(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return o},ji.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=vt(n,function(r){return r.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},ji.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function LP(e){var t=[];return F(ga(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function by(e){return e.children.slice().concat(LP(e.children)).concat(BP(e))}function BP(e){return ju(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function Bp(e,t){e.invoke(te,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,r=n.context.newShape;if(!(!S(r,"bpmn:SubProcess")||S(r,"bpmn:AdHocSubProcess")||!(S(i,"bpmn:Task")||S(i,"bpmn:CallActivity"))||!Qe(r))){var o=NP(r);t.createShape({type:"bpmn:StartEvent"},o,r)}})}Bp.$inject=["injector","modeling"],Ee(Bp,te);function NP(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function Np(e,t){te.call(this,e),this.preExecute("connection.create",function(n){const{target:i}=n;S(i,"bpmn:TextAnnotation")&&(n.parent=i.parent)},!0),this.preExecute(["shape.create","shape.resize","elements.move"],function(n){const i=n.shapes||[n.shape];i.length===1&&S(i[0],"bpmn:TextAnnotation")&&(n.hints=n.hints||{},n.hints.autoResize=!1)},!0),this.preExecute("shape.resize",function(n){var i=n.context,r=i.shape,o=i.hints||{};if(!(!S(r,"bpmn:TextAnnotation")||o.autoResize)){var a=i.newBounds,s=t.getTextAnnotationBounds(a,qn(r)||""),c=a.y!==r.y&&Math.abs(a.y+a.height-(r.y+r.height))<=1,l=r.y+r.height;i.newBounds={width:a.width,height:s.height,x:a.x,y:c?l-s.height:a.y}}})}Ee(Np,te),Np.$inject=["eventBus","textRenderer"];function $p(e,t){te.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(Qe(i))return;var r=ua(i);r.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();F(s,function(l){o(l,!0)}),F(c,function(l){o(l,!1)})});function o(a,s){r.indexOf(a.source)!==-1&&r.indexOf(a.target)!==-1||S(a,"bpmn:Association")&&(S(a.source,"bpmn:TextAnnotation")||S(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,i,Ne(i)):t.reconnectStart(a,i,Ne(i)))}},!0)}Ee($p,te),$p.$inject=["eventBus","modeling"];var Fp=500;function jp(e,t,n){te.call(this,e);function i(a){a.length&&a.forEach(function(s){s.type==="label"&&!s.businessObject.name&&(s.hidden=!0)})}function r(a,s){var c=a.children,l=s,u,f;return u=$P(c).concat([a]),f=Ag(u),f?(l.width=Math.max(f.width,l.width),l.height=Math.max(f.height,l.height),l.x=f.x+(f.width-l.width)/2,l.y=f.y+(f.height-l.height)/2):(l.x=a.x+(a.width-l.width)/2,l.y=a.y+(a.height-l.height)/2),l}function o(a,s){return{x:a.x+(a.width-s.width)/2,y:a.y+(a.height-s.height)/2,width:s.width,height:s.height}}this.executed(["shape.toggleCollapse"],Fp,function(a){var s=a.context,c=s.shape;S(c,"bpmn:SubProcess")&&(c.collapsed?ot(c).isExpanded=!1:(i(c.children),ot(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],Fp,function(a){var s=a.context,c=s.shape;c.collapsed?ot(c).isExpanded=!1:ot(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],Fp,function(a){var s=a.context.shape,c=t.getDefaultSize(s),l;s.collapsed?l=o(s,c):l=r(s,c),n.resizeShape(s,l,null,{autoResize:s.collapsed?!1:"nwse"})})}Ee(jp,te),jp.$inject=["eventBus","elementFactory","modeling"];function $P(e){return e.filter(function(t){return!t.hidden})}function Hp(e,t,n,i){t.invoke(te,this),this.preExecute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.businessObject;Ye(a)||(S(a,"bpmn:Participant")&&Qe(a)&&n.ids.unclaim(s.processRef.id),i.unclaimId(s.id,s))}),this.preExecute("connection.delete",function(r){var o=r.context,a=o.connection,s=a.businessObject;i.unclaimId(s.id,s)}),this.preExecute("canvas.updateRoot",function(){var r=e.getRootElement(),o=r.businessObject;S(r,"bpmn:Collaboration")&&n.ids.unclaim(o.id)})}Ee(Hp,te),Hp.$inject=["canvas","injector","moddle","modeling"];function zp(e,t){te.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,r=i.connection,o=r.source;FP(r,o)&&t.updateProperties(o,{default:null})})}Ee(zp,te),zp.$inject=["eventBus","modeling"];function FP(e,t){if(!S(e,"bpmn:SequenceFlow"))return!1;var n=ie(t),i=ie(e);return n.get("default")===i}var jP=500,HP=5e3,xy=["shape.create","shape.delete","shape.move","shape.resize"],_y=[...xy,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function Gp(e,t){te.call(this,e);var n;function i(){return n=n||new zP,n.enter(),n}function r(){if(!n)throw new Error("out of bounds release");return n}function o(){if(!n)throw new Error("out of bounds release");var a=n.leave();return a&&(t.updateLaneRefs(n.flowNodes,n.lanes),n=null),a}this.preExecute(_y,HP,function(){i()}),this.postExecuted(_y,jP,function(){o()}),this.preExecute(xy,function(a){var s=a.context,c=s.shape,l=r();!c||c.labelTarget||(S(c,"bpmn:Lane")&&l.addLane(c),S(c,"bpmn:FlowNode")&&l.addFlowNode(c))})}Gp.$inject=["eventBus","modeling"],Ee(Gp,te);function zP(){this.flowNodes=[],this.lanes=[],this.counter=0,this.addLane=function(e){this.lanes.push(e)},this.addFlowNode=function(e){this.flowNodes.push(e)},this.enter=function(){this.counter++},this.leave=function(){return this.counter--,!this.counter}}var GP=500,VP=5e3,wy=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],Ey=[...wy,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function Vp(e,t){te.call(this,e);var n;function i(){return n=n||new WP,n.enter(),n}function r(){if(!n)throw new Error("out of bounds release");return n}function o(){if(!n)throw new Error("out of bounds release");var a=n.leave();return a&&(t.updateCategoryValueRefs(Array.from(n.affectedFlowElements),Array.from(n.affectedGroupEntries.values())),n=null),a}this.preExecute(Ey,VP,function(){i()}),this.postExecuted(Ey,GP,function(){o()}),this.preExecute(wy,function(a){var s=a.context.connection||a.context.shape,c=r();!s||s.labelTarget||(S(s,"bpmn:FlowElement")&&c.addFlowElement(s),S(s,"bpmn:Group")&&c.addGroup(s))}),this.preExecute("label.create",function(a){var s=a.context.labelTarget;S(s,"bpmn:Group")&&r().addGroup(s)})}Vp.$inject=["eventBus","modeling"],Ee(Vp,te);function WP(){this.affectedFlowElements=new Set,this.affectedGroupEntries=new Map,this.counter=0,this.addFlowElement=function(e){this.affectedFlowElements.add(e)},this.addGroup=function(e){this.affectedGroupEntries.has(e)||this.affectedGroupEntries.set(e,{categoryValue:e.businessObject.categoryValueRef,groupShape:e})},this.enter=function(){this.counter++},this.leave=function(){return this.counter--,!this.counter}}function Wp(e,t){te.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,r=i.elements;for(const o of r)UP(o)&&!qP(o)&&t.updateProperties(o,{isForCompensation:void 0})})}Ee(Wp,te),Wp.$inject=["eventBus","modeling"];function UP(e){const t=ie(e);return t&&t.isForCompensation}function YP(e){return e&&S(e,"bpmn:BoundaryEvent")&&Eo(e,"bpmn:CompensateEventDefinition")}function qP(e){return e.incoming.filter(n=>YP(n.source)).length>0}const KP={__init__:["adaptiveLabelPositioningBehavior","appendBehavior","artifactBehavior","associationBehavior","attachEventBehavior","boundaryEventBehavior","categoryRootElementReferenceBehavior","compensateBoundaryEventBehaviour","createBehavior","createDataObjectBehavior","createParticipantBehavior","dataInputAssociationBehavior","dataStoreBehavior","deleteLaneBehavior","detachEventBehavior","dropOnFlowBehavior","eventBasedGatewayBehavior","fixHoverBehavior","groupBehavior","importDockingFix","isHorizontalFix","labelBehavior","layoutConnectionBehavior","messageFlowBehavior","nonInterruptingBehavior","removeElementBehavior","removeEmbeddedLabelBoundsBehavior","removeParticipantBehavior","replaceConnectionBehavior","replaceElementBehaviour","resizeBehavior","resizeLaneBehavior","rootElementReferenceBehavior","spaceToolBehavior","subProcessPlaneBehavior","subProcessStartEventBehavior","textAnnotationBehavior","toggleCollapseConnectionBehaviour","toggleElementCollapseBehaviour","unclaimIdBehavior","updateFlowNodeRefsBehavior","updateCategoryValueRefsBehavior","unsetDefaultFlowBehavior","setCompensationActivityAfterPasteBehavior"],adaptiveLabelPositioningBehavior:["type",Ju],appendBehavior:["type",ep],associationBehavior:["type",np],attachEventBehavior:["type",nc],artifactBehavior:["type",tp],boundaryEventBehavior:["type",ip],categoryRootElementReferenceBehavior:["type",rp],compensateBoundaryEventBehaviour:["type",op],createBehavior:["type",ap],createDataObjectBehavior:["type",sp],createParticipantBehavior:["type",up],dataInputAssociationBehavior:["type",pp],dataStoreBehavior:["type",fp],deleteLaneBehavior:["type",dp],detachEventBehavior:["type",uc],dropOnFlowBehavior:["type",mp],eventBasedGatewayBehavior:["type",gp],fixHoverBehavior:["type",Ig],groupBehavior:["type",yp],importDockingFix:["type",Bg],isHorizontalFix:["type",bp],labelBehavior:["type",_p],layoutConnectionBehavior:["type",wp],messageFlowBehavior:["type",Rp],nonInterruptingBehavior:["type",Cp],removeElementBehavior:["type",Pp],removeEmbeddedLabelBoundsBehavior:["type",Ap],removeParticipantBehavior:["type",Mp],replaceConnectionBehavior:["type",Tp],replaceElementBehaviour:["type",yc],resizeBehavior:["type",oy],resizeLaneBehavior:["type",py],rootElementReferenceBehavior:["type",Ip],spaceToolBehavior:["type",dy],subProcessPlaneBehavior:["type",ji],subProcessStartEventBehavior:["type",Bp],textAnnotationBehavior:["type",Np],toggleCollapseConnectionBehaviour:["type",$p],toggleElementCollapseBehaviour:["type",jp],unclaimIdBehavior:["type",Hp],unsetDefaultFlowBehavior:["type",zp],updateFlowNodeRefsBehavior:["type",Gp],updateCategoryValueRefsBehavior:["type",Vp],setCompensationActivityAfterPasteBehavior:["type",Wp]};function Up(e){this._commandStack=e.get("commandStack",!1)}Up.$inject=["injector"],Up.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const Si={__init__:["rules"],rules:["type",Up]};function ti(e){te.call(this,e),this.init()}ti.$inject=["eventBus"],Ee(ti,te),ti.prototype.addRule=function(e,t,n){var i=this;typeof e=="string"&&(e=[e]),e.forEach(function(r){i.canExecute(r,t,function(o,a,s){return n(o)},!0)})},ti.prototype.init=function(){};function Sy(e,t){var n=cn(e,t,-15);return n!=="intersect"?n:null}function un(e){ti.call(this,e)}Ee(un,ti),un.$inject=["eventBus"],un.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return XP(t)}),this.addRule("connection.create",function(e){var t=e.source,n=e.target,i=e.hints||{},r=i.targetParent,o=i.targetAttach;if(o)return!1;r&&(n.parent=r);try{return Ec(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return Ec(n,i,t)}),this.addRule("connection.updateWaypoints",function(e){return{type:e.connection.type}}),this.addRule("shape.resize",function(e){var t=e.shape,n=e.newBounds,i=e.direction;return Ny(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return ht(i)&&!Sc(t,i)?!1:kr(t,function(r){return ht(r)?Ec(r.source,r.target,r):r.host?Aa(r,r.host,null,n):Xp(r,i)})}),this.addRule("elements.move",function(e){var t=e.target,n=e.shapes,i=e.position,r=e.hints;return r!=null&&r.keyboardMove&&n.some(function(a){return ky(a)&&!n.includes(a.host)})?!1:Aa(n,t,null,i)||Ly(n,t,i)||By(n,t)||Sc(n,t)}),this.addRule("shape.create",function(e){return Xp(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return Aa(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return zy(n,t)})},un.prototype.canConnectMessageFlow=jy,un.prototype.canConnectSequenceFlow=Hy,un.prototype.canConnectDataAssociation=Zp,un.prototype.canConnectAssociation=$y,un.prototype.canConnectCompensationAssociation=Fy,un.prototype.canMove=By,un.prototype.canAttach=Aa,un.prototype.canReplace=Ly,un.prototype.canDrop=Do,un.prototype.canInsert=Sc,un.prototype.canCreate=Xp,un.prototype.canConnect=Ec,un.prototype.canResize=Ny,un.prototype.canCopy=zy;function XP(e){return Yp(e)?null:qe(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function Yp(e){return!e||Ye(e)}function Ry(e){do{if(S(e,"bpmn:Process"))return ie(e);if(S(e,"bpmn:Participant"))return ie(e).processRef||ie(e)}while(e=e.parent)}function qp(e){return S(e,"bpmn:TextAnnotation")}function Kp(e){return S(e,"bpmn:Group")&&!e.labelTarget}function Cy(e){return S(e,"bpmn:BoundaryEvent")&&Ri(e,"bpmn:CompensateEventDefinition")}function wc(e){return ie(e).isForCompensation}function ZP(e,t){var n=Ry(e),i=Ry(t);return n===i}function QP(e){return S(e,"bpmn:InteractionNode")&&!S(e,"bpmn:BoundaryEvent")&&(!S(e,"bpmn:Event")||S(e,"bpmn:ThrowEvent")&&My(e,"bpmn:MessageEventDefinition"))}function JP(e){return S(e,"bpmn:InteractionNode")&&!wc(e)&&(!S(e,"bpmn:Event")||S(e,"bpmn:CatchEvent")&&My(e,"bpmn:MessageEventDefinition"))&&!(S(e,"bpmn:BoundaryEvent")&&!Ri(e,"bpmn:MessageEventDefinition"))}function Ay(e){for(var t=e;t=t.parent;){if(S(t,"bpmn:FlowElementsContainer"))return ie(t);if(S(t,"bpmn:Participant"))return ie(t).processRef}return null}function Py(e,t){var n=Ay(e),i=Ay(t);return n===i}function Ri(e,t){var n=ie(e);return!!vt(n.eventDefinitions||[],function(i){return S(i,t)})}function My(e,t){var n=ie(e);return(n.eventDefinitions||[]).every(function(i){return S(i,t)})}function eM(e){return S(e,"bpmn:FlowNode")&&!S(e,"bpmn:EndEvent")&&!vn(e)&&!(S(e,"bpmn:IntermediateThrowEvent")&&Ri(e,"bpmn:LinkEventDefinition"))&&!Cy(e)&&!wc(e)}function tM(e){return S(e,"bpmn:FlowNode")&&!S(e,"bpmn:StartEvent")&&!S(e,"bpmn:BoundaryEvent")&&!vn(e)&&!(S(e,"bpmn:IntermediateCatchEvent")&&Ri(e,"bpmn:LinkEventDefinition"))&&!wc(e)}function nM(e){return S(e,"bpmn:ReceiveTask")||S(e,"bpmn:IntermediateCatchEvent")&&(Ri(e,"bpmn:MessageEventDefinition")||Ri(e,"bpmn:TimerEventDefinition")||Ri(e,"bpmn:ConditionalEventDefinition")||Ri(e,"bpmn:SignalEventDefinition"))}function iM(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function Ty(e,t){var n=iM(t);return n.indexOf(e)!==-1}function Ec(e,t,n){if(Yp(e)||Yp(t))return null;if(!S(n,"bpmn:DataAssociation")){if(jy(e,t))return{type:"bpmn:MessageFlow"};if(Hy(e,t))return{type:"bpmn:SequenceFlow"}}var i=Zp(e,t);return i||(Fy(e,t)?{type:"bpmn:Association",associationDirection:"One"}:$y(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function Do(e,t){return Ye(e)||Kp(e)?!0:S(t,"bpmn:Participant")&&!Qe(t)?!1:S(e,"bpmn:Participant")?S(t,"bpmn:Process")||S(t,"bpmn:Collaboration"):qe(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:S(e,"bpmn:Lane")?S(t,"bpmn:Participant")||S(t,"bpmn:Lane"):S(e,"bpmn:BoundaryEvent")&&!rM(e)?!1:S(e,"bpmn:FlowElement")&&!S(e,"bpmn:DataStoreReference")?S(t,"bpmn:FlowElementsContainer")?Qe(t):qe(t,["bpmn:Participant","bpmn:Lane"]):S(e,"bpmn:DataStoreReference")&&S(t,"bpmn:Collaboration")?Xi(ie(t).get("participants"),function(n){return!!n.get("processRef")}):qe(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?qe(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):S(e,"bpmn:MessageFlow")?S(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function rM(e){return ie(e).cancelActivity&&(Oy(e)||Dy(e))}function ky(e){return!Ye(e)&&S(e,"bpmn:BoundaryEvent")}function oM(e){return S(e,"bpmn:Lane")}function aM(e){return ky(e)||S(e,"bpmn:IntermediateThrowEvent")&&Oy(e)?!0:S(e,"bpmn:IntermediateCatchEvent")&&Dy(e)}function Oy(e){var t=ie(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function Dy(e){return Iy(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function Iy(e,t){return t.some(function(n){return Ri(e,n)})}function sM(e){return S(e,"bpmn:ReceiveTask")&&vt(e.incoming,function(t){return S(t.source,"bpmn:EventBasedGateway")})}function Aa(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var r=e[0];return Ye(r)||!aM(r)||vn(t)||!S(t,"bpmn:Activity")||wc(t)||i&&!Sy(i,t)||sM(t)?!1:"attach"}function Ly(e,t,n){if(!t)return!1;var i={replacements:[]};return F(e,function(r){vn(t)||S(r,"bpmn:StartEvent")&&r.type!=="label"&&Do(r,t)&&(gC(r)||i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),(yC(r)||vC(r)||bC(r))&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),Iy(r,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&S(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"})),S(t,"bpmn:Transaction")||Ri(r,"bpmn:CancelEventDefinition")&&r.type!=="label"&&(S(r,"bpmn:EndEvent")&&Do(r,t)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:EndEvent"}),S(r,"bpmn:BoundaryEvent")&&Aa(r,t,null,n)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function By(e,t){return Xi(e,oM)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return Do(n,t)})}function Xp(e,t,n,i){return t?Ye(e)||Kp(e)?!0:Do(e,t)||Sc(e,t):!1}function Ny(e,t,n){return S(e,"bpmn:SubProcess")?Qe(e)&&(!t||t.width>=100&&t.height>=80):S(e,"bpmn:Lane")||S(e,"bpmn:Participant")?!0:qp(e)?n?n==="e"||n==="w":!0:Kp(e)?!0:Ye(e)?n?n==="e"||n==="w":!0:!1}function cM(e,t){var n=qp(e),i=qp(t);return(n||i)&&n!==i}function $y(e,t){return Ty(t,e)||Ty(e,t)?!1:cM(e,t)?!0:!!Zp(e,t)}function Fy(e,t){return Py(e,t)&&Cy(e)&&S(t,"bpmn:Activity")&&!uM(t,e)&&!vn(t)}function jy(e,t){return Vy(e)&&!Vy(t)?!1:QP(e)&&JP(t)&&!ZP(e,t)}function Hy(e,t){return eM(e)&&tM(t)&&Py(e,t)&&!(S(e,"bpmn:EventBasedGateway")&&!nM(t))}function Zp(e,t){return qe(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&qe(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:qe(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&qe(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function Sc(e,t,n){if(!t)return!1;if(Array.isArray(e)){if(e.length!==1)return!1;e=e[0]}return t.source===e||t.target===e?!1:qe(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!Ye(t)&&S(e,"bpmn:FlowNode")&&!S(e,"bpmn:BoundaryEvent")&&Do(e,t.parent)}function Qp(e,t){return e&&t&&e.indexOf(t)!==-1}function zy(e,t){return Ye(t)?!0:!(S(t,"bpmn:Lane")&&!Qp(e,t.parent)||S(t,"bpmn:MessageFlow")&&!lM(e,t))}function lM(e,t){var n=Gy(t.source),i=Gy(t.target);return Qp(e,n)&&Qp(e,i)}function Gy(e){for(;e;e=e.parent)if(S(e,"bpmn:Participant"))return e;return null}function Vy(e){return Co(e,"bpmn:Process")||Co(e,"bpmn:Collaboration")}function uM(e,t){return e.attachers.includes(t)}const pM={__depends__:[Si],__init__:["bpmnRules"],bpmnRules:["type",un]};var fM=2e3;function Wy(e,t){e.on("saveXML.start",fM,n);function n(){var i=t.getRootElements();F(i,function(r){var o=ot(r),a,s;a=ua([r]),a=Ke(a,function(c){return c!==r&&!c.labelTarget}),s=hn(a,ot),o.set("planeElement",s)})}}Wy.$inject=["eventBus","canvas"];const dM={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",Wy]};function Rc(e){te.call(this,e);var t=this;this.preExecute(["shape.create","connection.create"],function(n){var i=n.context,r=i.shape||i.connection,o=i.parent,a=t.getOrdering(r,o);a&&(a.parent!==void 0&&(i.parent=a.parent),i.parentIndex=a.index)}),this.preExecute(["shape.move","connection.move"],function(n){var i=n.context,r=i.shape||i.connection,o=i.newParent||r.parent,a=t.getOrdering(r,o);a&&(a.parent!==void 0&&(i.newParent=a.parent),i.newParentIndex=a.index)})}Rc.prototype.getOrdering=function(e,t){return null},Ee(Rc,te);function Jp(e,t){Rc.call(this,e);var n=[{type:"bpmn:SubProcess",order:{level:6}},{type:"bpmn:SequenceFlow",order:{level:9,containers:["bpmn:Participant","bpmn:FlowElementsContainer"]}},{type:"bpmn:DataAssociation",order:{level:9,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:TextAnnotation",order:{level:9}},{type:"bpmn:MessageFlow",order:{level:9,containers:["bpmn:Collaboration"]}},{type:"bpmn:Association",order:{level:6,containers:["bpmn:Participant","bpmn:FlowElementsContainer","bpmn:Collaboration"]}},{type:"bpmn:BoundaryEvent",order:{level:8}},{type:"bpmn:Group",order:{level:10,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:FlowElement",order:{level:5}},{type:"bpmn:Participant",order:{level:-2}},{type:"bpmn:Lane",order:{level:-1}}];function i(a){if(a.labelTarget)return{level:10};var s=vt(n,function(c){return qe(a,[c.type])});return s&&s.order||{level:1}}function r(a){var s=a.order;if(s||(a.order=s=i(a)),!s)throw new Error(`no order for <${a.id}>`);return s}function o(a,s,c){for(var l=s;l&&!qe(l,c);)l=l.parent;if(!l)throw new Error(`no parent for <${a.id}> in <${s&&s.id}>`);return l}this.getOrdering=function(a,s){if(a.labelTarget||S(a,"bpmn:TextAnnotation"))return{parent:t.findRoot(s)||t.getRootElement(),index:-1};var c=r(a);c.containers&&(s=o(a,s,c.containers));var l=s.children.indexOf(a),u=Ld(s.children,function(f){return!a.labelTarget&&f.labelTarget?!1:c.level<r(f).level});return u!==-1&&l!==-1&&l<u&&(u-=1),{index:u,parent:s}}}Jp.$inject=["eventBus","canvas"],Ee(Jp,Rc);const hM={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",Jp]};function Pa(){}Pa.prototype.get=function(){return this._data},Pa.prototype.set=function(e){this._data=e},Pa.prototype.clear=function(){var e=this._data;return delete this._data,e},Pa.prototype.isEmpty=function(){return!this._data};const mM={clipboard:["type",Pa]};var Uy=1500;function Yy(e,t,n){var i=this,r=n.get("dragging",!1);function o(a){if(!a.hover){var s=a.originalEvent,c=i._findTargetGfx(s),l=c&&e.get(c);c&&l&&(a.stopPropagation(),r.hover({element:l,gfx:c}),r.move(s))}}r&&t.on("drag.start",function(a){t.once("drag.move",Uy,function(s){o(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",Uy,function(c){s&&t.fire("element.out",{element:s,gfx:a})}),t.on("element.out",function(){a=null,s=null})})(),this._findTargetGfx=function(a){var s,c;if(a instanceof MouseEvent)return s=Hr(a),c=document.elementFromPoint(s.x,s.y),gM(c)}}Yy.$inject=["elementRegistry","eventBus","injector"];function gM(e){return Lr(e,"svg, .djs-element",!0)}const yM={__init__:["hoverFix"],hoverFix:["type",Yy]};function vM(e){return!0}function Cc(e){return pr(e)||EP(e)}var qy=500;function Ky(e,t,n){var i=this;function r(P,B,D){if(!s(P,B)){var I,z,oe;D?z=t.getGraphics(D):(I=B.delegateTarget||B.target,I&&(z=I,D=t.get(z))),!(!z||!D)&&(oe=e.fire(P,{element:D,gfx:z,originalEvent:B}),oe===!1&&(B.stopPropagation(),B.preventDefault()))}}var o={};function a(P){return o[P]}function s(P,B){var D=l[P]||pr;return!D(B)}var c={click:"element.click",contextmenu:"element.contextmenu",dblclick:"element.dblclick",mousedown:"element.mousedown",mousemove:"element.mousemove",mouseover:"element.hover",mouseout:"element.out",mouseup:"element.mouseup"},l={"element.contextmenu":vM,"element.mousedown":Cc,"element.mouseup":Cc,"element.click":Cc,"element.dblclick":Cc};function u(P,B,D){var I=c[P];if(!I)throw new Error("unmapped DOM event name <"+P+">");return r(I,B,D)}var f="svg, .djs-element";function p(P,B,D,I){var z=o[D]=function(oe){r(D,oe)};I&&(l[D]=I),z.$delegate=On.bind(P,f,B,z)}function d(P,B,D){var I=a(D);I&&On.unbind(P,B,I.$delegate)}function m(P){F(c,function(B,D){p(P,D,B)})}function h(P){F(c,function(B,D){d(P,D,B)})}e.on("canvas.destroy",function(P){h(P.svg)}),e.on("canvas.init",function(P){m(P.svg)}),e.on(["shape.added","connection.added"],function(P){var B=P.element,D=P.gfx;e.fire("interactionEvents.createHit",{element:B,gfx:D})}),e.on(["shape.changed","connection.changed"],qy,function(P){var B=P.element,D=P.gfx;e.fire("interactionEvents.updateHit",{element:B,gfx:D})}),e.on("interactionEvents.createHit",qy,function(P){var B=P.element,D=P.gfx;i.createDefaultHit(B,D)}),e.on("interactionEvents.updateHit",function(P){var B=P.element,D=P.gfx;i.updateDefaultHit(B,D)});var y=C("djs-hit djs-hit-stroke"),v=C("djs-hit djs-hit-click-stroke"),g=C("djs-hit djs-hit-all"),b=C("djs-hit djs-hit-no-move"),x={all:g,"click-stroke":v,stroke:y,"no-move":b};function C(P,B){return B=W({stroke:"white",strokeWidth:15},B||{}),n.cls(P,["no-fill","no-border"],B)}function M(P,B){var D=x[B];if(!D)throw new Error("invalid hit type <"+B+">");return Se(P,D),P}function k(P,B){ze(P,B)}this.removeHits=function(P){var B=Ns(".djs-hit",P);F(B,Kt)},this.createDefaultHit=function(P,B){var D=P.waypoints,I=P.isFrame,z;return D?this.createWaypointsHit(B,D):(z=I?"stroke":"all",this.createBoxHit(B,z,{width:P.width,height:P.height}))},this.createWaypointsHit=function(P,B){var D=la(B);return M(D,"stroke"),k(P,D),D},this.createBoxHit=function(P,B,D){D=W({x:0,y:0},D);var I=Oe("rect");return M(I,B),Se(I,D),k(P,I),I},this.updateDefaultHit=function(P,B){var D=ft(".djs-hit",B);if(D)return P.waypoints?Fu(D,P.waypoints):Se(D,{width:P.width,height:P.height}),D},this.fire=r,this.triggerMouseEvent=u,this.mouseHandler=a,this.registerEvent=p,this.unregisterEvent=d}Ky.$inject=["eventBus","elementRegistry","styles"];const Ac={__init__:["interactionEvents"],interactionEvents:["type",Ky]};function Io(e,t){this._eventBus=e,this._canvas=t,this._selectedElements=new Set;var n=this;e.on(["shape.remove","connection.remove"],function(i){var r=i.element;n.deselect(r)}),e.on(["diagram.clear","root.set"],function(i){n.select(null)})}Io.$inject=["eventBus","canvas"],Io.prototype.deselect=function(e){if(this._selectedElements.has(e)){var t=this.get();this._selectedElements.delete(e),this._eventBus.fire("selection.changed",{oldSelection:t,newSelection:this.get()})}},Io.prototype.get=function(){return Array.from(this._selectedElements)},Io.prototype.isSelected=function(e){return this._selectedElements.has(e)},Io.prototype.select=function(e,t){var n=this.get();Be(e)||(e=e?[e]:[]);var i=this._canvas,r=i.getRootElement();e=e.filter(function(o){var a=i.findRoot(o);return r===a}),t?F(e,o=>{this._selectedElements.add(o)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var Xy="hover",Zy="selected";function Qy(e,t){this._canvas=e;function n(r,o){e.addMarker(r,o)}function i(r,o){e.removeMarker(r,o)}t.on("element.hover",function(r){n(r.element,Xy)}),t.on("element.out",function(r){i(r.element,Xy)}),t.on("selection.changed",function(r){function o(l){i(l,Zy)}function a(l){n(l,Zy)}var s=new Set(r.oldSelection),c=new Set(r.newSelection);for(let l of s)c.has(l)||o(l);for(let l of c)s.has(l)||a(l)})}Qy.$inject=["canvas","eventBus"];function Jy(e,t,n,i){e.on("create.end",500,function(r){var o=r.context,a=o.canExecute,s=o.elements,c=o.hints||{},l=c.autoSelect;if(a){if(l===!1)return;Be(l)?t.select(l):t.select(s.filter(bM))}}),e.on("connect.end",500,function(r){var o=r.context,a=o.connection;a&&t.select(a)}),e.on("shape.move.end",500,function(r){var o=r.previousSelection||[],a=i.get(r.context.shape.id),s=vt(o,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(r){if(pr(r)){var o=r.element;o===n.getRootElement()&&(o=null);var a=t.isSelected(o),s=t.get().length>1,c=xc(r);if(a&&s)return c?t.deselect(o):t.select(o);a?t.deselect(o):t.select(o,c)}})}Jy.$inject=["eventBus","selection","canvas","elementRegistry"];function bM(e){return!e.hidden}const ni={__init__:["selectionVisuals","selectionBehavior"],__depends__:[Ac],selection:["type",Io],selectionVisuals:["type",Qy],selectionBehavior:["type",Jy]};var xM=/^djs-cursor-.*$/;function Pc(e){var t=Ct(document.body);t.removeMatching(xM),e&&t.add("djs-cursor-"+e)}function ev(){Pc(null)}var _M=5e3;function tv(e,t){t=t||"element.click";function n(){return!1}return e.once(t,_M,n),function(){e.off(t,n)}}var wM=["c","C"],EM=["v","V"],SM=["d","D"],RM=["x","X"],CM=["y","Y"],nv=["z","Z"];function AM(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Ln(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function Xt(e,t){return e=Be(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function ef(e){return e.shiftKey}function PM(e){return Ln(e)&&Xt(wM,e)}function MM(e){return Ln(e)&&Xt(EM,e)}function TM(e){return Ln(e)&&Xt(SM,e)}function kM(e){return Ln(e)&&Xt(RM,e)}function OM(e){return Ln(e)&&!ef(e)&&Xt(nv,e)}function DM(e){return Ln(e)&&(Xt(CM,e)||Xt(nv,e)&&ef(e))}var Lo=Math.round,iv="djs-drag-active";function Gr(e){e.preventDefault()}function IM(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function LM(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function rv(e,t,n,i){var r={threshold:5,trapClick:!0},o;function a(b){var x=t.viewbox(),C=t._container.getBoundingClientRect();return{x:x.x+(b.x-C.left)/x.scale,y:x.y+(b.y-C.top)/x.scale}}function s(b,x){x=x||o;var C=e.createEvent(W({},x.payload,x.data,{isTouch:x.isTouch}));return e.fire("drag."+b,C)===!1?!1:e.fire(x.prefix+"."+b,C)}function c(b){var x=b.filter(function(C){return i.get(C.id)});x.length&&n.select(x)}function l(b,x){var C=o.payload,M=o.displacement,k=o.globalStart,P=Hr(b),B=pi(P,k),D=o.localStart,I=a(P),z=pi(I,D);if(!o.active&&(x||LM(B)>o.threshold)){if(W(C,{x:Lo(D.x+M.x),y:Lo(D.y+M.y),dx:0,dy:0},{originalEvent:b}),s("start")===!1)return y();o.active=!0,o.keepSelection||(C.previousSelection=n.get(),n.select(null)),o.cursor&&Pc(o.cursor),t.addMarker(t.getRootElement(),iv)}Dp(b),o.active&&(W(C,{x:Lo(I.x+M.x),y:Lo(I.y+M.y),dx:Lo(z.x),dy:Lo(z.y)},{originalEvent:b}),s("move"))}function u(b){var x,C=!0;o.active&&(b&&(o.payload.originalEvent=b,Dp(b)),C=s("end")),C===!1&&s("rejected"),x=v(C!==!0),s("ended",x)}function f(b){Xt("Escape",b)&&(Gr(b),y())}function p(b){var x;o.active&&(x=tv(e),setTimeout(x,400),Gr(b)),u(b)}function d(b){l(b)}function m(b){var x=o.payload;x.hoverGfx=b.gfx,x.hover=b.element,s("hover")}function h(b){s("out");var x=o.payload;x.hoverGfx=null,x.hover=null}function y(b){var x;if(o){var C=o.active;C&&s("cancel"),x=v(b),C&&s("canceled",x)}}function v(b){var x,C;s("cleanup"),ev(),o.trapClick?C=p:C=u,je.unbind(document,"mousemove",l),je.unbind(document,"dragstart",Gr),je.unbind(document,"selectstart",Gr),je.unbind(document,"mousedown",C,!0),je.unbind(document,"mouseup",C,!0),je.unbind(document,"keyup",f),je.unbind(document,"touchstart",d,!0),je.unbind(document,"touchcancel",y,!0),je.unbind(document,"touchmove",l,!0),je.unbind(document,"touchend",u,!0),e.off("element.hover",m),e.off("element.out",h),t.removeMarker(t.getRootElement(),iv);var M=o.payload.previousSelection;return b!==!1&&M&&!n.get().length&&c(M),x=o,o=null,x}function g(b,x,C,M){o&&y(!1),typeof x=="string"&&(M=C,C=x,x=null),M=W({},r,M||{});var k=M.data||{},P,B,D,I,z;if(M.trapClick?I=p:I=u,b?(P=Oo(b)||b,B=Hr(b),Dp(b),P.type==="dragstart"&&Gr(P)):(P=null,B={x:0,y:0}),D=a(B),x||(x=D),z=IM(P),o=W({prefix:C,data:k,payload:{},globalStart:B,displacement:pi(x,D),localStart:D,isTouch:z},M),M.manual||(z?(je.bind(document,"touchstart",d,!0),je.bind(document,"touchcancel",y,!0),je.bind(document,"touchmove",l,!0),je.bind(document,"touchend",u,!0)):(je.bind(document,"mousemove",l),je.bind(document,"dragstart",Gr),je.bind(document,"selectstart",Gr),je.bind(document,"mousedown",I,!0),je.bind(document,"mouseup",I,!0)),je.bind(document,"keyup",f),e.on("element.hover",m),e.on("element.out",h)),s("init")===!1)return y(),!1;M.autoActivate&&l(b,!0)}e.on("diagram.destroy",y),this.init=g,this.move=l,this.hover=m,this.out=h,this.end=u,this.cancel=y,this.context=function(){return o},this.setOptions=function(b){W(r,b)}}rv.$inject=["eventBus","canvas","selection","elementRegistry"];const Hi={__depends__:[yM,ni],dragging:["type",rv]};function Bo(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}Bo.prototype.next=function(){return this._prefix+ ++this._counter};const BM=new Bo("ps");var NM=["marker-start","marker-mid","marker-end"],$M=["circle","ellipse","line","path","polygon","polyline","path","rect"];function fr(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}fr.$inject=["elementRegistry","eventBus","canvas","styles"],fr.prototype.cleanUp=function(){console.warn("PreviewSupport#cleanUp is deprecated and will be removed in future versions. You do not need to manually clean up previews anymore. cf. https://github.com/bpmn-io/diagram-js/pull/906")},fr.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},fr.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var r=ym(n);return this._cloneMarkers($r(r),i),Se(r,this._styles.cls(i,[])),ze(t,r),Se(r,"data-preview-support-element-id",e.id),r},fr.prototype.addFrame=function(e,t){var n=Oe("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return ze(t,n),Se(n,"data-preview-support-element-id",e.id),n},fr.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(r=>{i._cloneMarkers(r,t,n)}),zM(e)&&NM.forEach(function(r){if(Se(e,r)){var o=FM(e,r,i._canvas.getContainer());o&&i._cloneMarker(n,e,o,r,t)}})},fr.prototype._cloneMarker=function(e,t,n,i,r="djs-dragger"){var o=[n.id,r,BM.next()].join("-"),a=ft("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||ym(n);s.id=o,et(s).add(r);var c=ft(":scope > defs",e);c||(c=Oe("defs"),ze(e,c)),ze(c,s);var l=HM(s.id);Se(t,i,l)};function FM(e,t,n){var i=jM(Se(e,t));return ft("marker#"+i,n||document)}function jM(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function HM(e){return"url(#"+e+")"}function zM(e){return $M.indexOf(e.nodeName)!==-1}const No={__init__:["previewSupport"],previewSupport:["type",fr]};var GM="drop-ok",ov="drop-not-ok",av="attach-ok",sv="new-parent",cv="create",VM=2e3;function lv(e,t,n,i,r){function o(c,l,u,f,p){if(!l)return!1;c=Ke(c,function(g){var b=g.labelTarget;return!g.parent&&!(Ye(g)&&c.indexOf(b)!==-1)});var d=vt(c,function(g){return!ht(g)}),m=!1,h=!1,y=!1;pv(c)&&(m=r.allowed("shape.attach",{position:u,shape:d,target:l})),m||(pv(c)?y=r.allowed("shape.create",{position:u,shape:d,source:f,target:l}):y=r.allowed("elements.create",{elements:c,position:u,target:l}));var v=p.connectionTarget;return y||m?(d&&f&&(h=r.allowed("connection.create",{source:v===f?d:f,target:v===f?f:d,hints:{targetParent:l,targetAttach:m}})),{attach:m,connect:h}):y===null||m===null?null:!1}function a(c,l){[av,GM,ov,sv].forEach(function(u){u===l?e.addMarker(c,u):e.removeMarker(c,u)})}n.on(["create.move","create.hover"],function(c){var l=c.context,u=l.elements,f=c.hover,p=l.source,d=l.hints||{};if(!f){l.canExecute=!1,l.target=null;return}uv(c);var m={x:c.x,y:c.y},h=l.canExecute=f&&o(u,f,m,p,d);f&&h!==null&&(l.target=f,h&&h.attach?a(f,av):a(f,h?sv:ov))}),n.on(["create.end","create.out","create.cleanup"],function(c){var l=c.hover;l&&a(l,null)}),n.on("create.end",function(c){var l=c.context,u=l.source,f=l.shape,p=l.elements,d=l.target,m=l.canExecute,h=m&&m.attach,y=m&&m.connect,v=l.hints||{};if(m===!1||!d)return!1;uv(c);var g={x:c.x,y:c.y};y?f=i.appendShape(u,f,g,d,{attach:h,connection:y===!0?{}:y,connectionTarget:v.connectionTarget}):(p=i.createElements(p,g,d,W({},v,{attach:h})),f=vt(p,function(b){return!ht(b)})),W(l,{elements:p,shape:f}),W(c,{elements:p,shape:f})});function s(){var c=t.context();c&&c.prefix===cv&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],VM,function(){n.off("elements.changed",s)})}),this.start=function(c,l,u){Be(l)||(l=[l]);var f=vt(l,function(m){return!ht(m)});if(f){u=W({elements:l,hints:{},shape:f},u||{}),F(l,function(m){Fe(m.x)||(m.x=0),Fe(m.y)||(m.y=0)});var p=Ke(l,function(m){return!m.hidden}),d=Ft(p);F(l,function(m){ht(m)&&(m.waypoints=hn(m.waypoints,function(h){return{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2}})),W(m,{x:m.x-d.x-d.width/2,y:m.y-d.y-d.height/2})}),t.init(c,cv,{cursor:"grabbing",autoActivate:!0,data:{shape:f,elements:l,context:u}})}}}lv.$inject=["canvas","dragging","eventBus","modeling","rules"];function uv(e){var t=e.context,n=t.createConstraints;n&&(n.left&&(e.x=Math.max(e.x,n.left)),n.right&&(e.x=Math.min(e.x,n.right)),n.top&&(e.y=Math.max(e.y,n.top)),n.bottom&&(e.y=Math.min(e.y,n.bottom)))}function pv(e){return e&&e.length===1&&!ht(e[0])}var WM=750;function fv(e,t,n,i,r){function o(a){var s=Oe("g");Se(s,r.cls("djs-drag-group",["no-events"]));var c=Oe("g");return a.forEach(function(l){var u;l.hidden||(l.waypoints?(u=n._createContainer("connection",c),n.drawConnection($r(u),l)):(u=n._createContainer("shape",c),n.drawShape($r(u),l),ln(u,l.x,l.y)),i.addDragger(l,s,u))}),s}t.on("create.move",WM,function(a){var s=a.hover,c=a.context,l=c.elements,u=c.dragGroup;u||(u=c.dragGroup=o(l));var f;s?(u.parentNode||(f=e.getActiveLayer(),ze(f,u)),ln(u,a.x,a.y)):Kt(u)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&Kt(c)})}fv.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const Mc={__depends__:[Hi,No,Si,ni],__init__:["create","createPreview"],create:["type",lv],createPreview:["type",fv]};function tf(e){var t=this;this._lastMoveEvent=null;function n(i){t._lastMoveEvent=i}e.on("canvas.init",function(i){var r=t._svg=i.svg;r.addEventListener("mousemove",n)}),e.on("canvas.destroy",function(){t._lastMouseEvent=null,t._svg.removeEventListener("mousemove",n)})}tf.$inject=["eventBus"],tf.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||UM(0,0)};function UM(e,t){var n=document.createEvent("MouseEvent"),i=e,r=t,o=e,a=t;return n.initMouseEvent&&n.initMouseEvent("mousemove",!0,!0,window,0,i,r,o,a,!1,!1,!1,!1,0,null),n}const Ma={__init__:["mouse"],mouse:["type",tf]};var dv=2e3;function Bn(e,t,n,i,r,o,a,s){this._canvas=e,this._create=t,this._elementFactory=i,this._eventBus=r,this._modeling=o,this._mouse=a,this._rules=s,r.on("copyPaste.copyElement",function(c){var l=c.descriptor,u=c.element,f=c.elementsSet;l.priority=1,l.id=u.id,f.has(u.parent)&&(l.parent=u.parent.id),YM(u)&&(l.priority=2,l.host=u.host.id),ht(u)&&(l.priority=3,l.source=u.source.id,l.target=u.target.id,l.waypoints=qM(u)),Ye(u)&&(l.priority=4,l.labelTarget=u.labelTarget.id),F(["x","y","width","height"],function(p){Fe(u[p])&&(l[p]=u[p])}),l.hidden=u.hidden,l.collapsed=u.collapsed}),r.on("copyPaste.elementsCopied",dv,function(c){var l;((l=c.hints)==null?void 0:l.clip)!==!1&&n.set(c.tree)}),r.on("copyPaste.pasteElements",dv,function(c){c.tree||(c.tree=n.get())}),r.on("copyPaste.pasteElements",function(c){var l=c.hints;W(l,{createElementsBehavior:!1})})}Bn.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],Bn.prototype.copy=function(e,t={}){var n,i;return Be(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(Be(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},Bn.prototype.paste=function(e={}){var t=this._eventBus.createEvent({type:"copyPaste.pasteElements",hints:{},...e}),n=this._eventBus.fire(t);if(n!==!1){var i=t.tree;if(i){var r=t.hints,o=this._createElements(i);if(t.element&&t.point)return this._paste(o,t.element,t.point,r);this._create.start(this._mouse.getLastMoveEvent(),o,{hints:r})}}},Bn.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},Bn.prototype.cut=function(e){var t=this.copy(e),n=this._getElementIdsFromTree(t),i=e.filter(function(r){return n[r.id]});return i.length>0&&this._modeling.removeElements(i),t},Bn.prototype._getElementIdsFromTree=function(e){var t={};return F(e,function(n){F(n,function(i){i.id&&(t[i.id]=!0)})}),t},Bn.prototype._paste=function(e,t,n,i){F(e,function(o){Fe(o.x)||(o.x=0),Fe(o.y)||(o.y=0)});var r=Ft(e);return F(e,function(o){ht(o)&&(o.waypoints=hn(o.waypoints,function(a){return{x:a.x-r.x-r.width/2,y:a.y-r.y-r.height/2}})),W(o,{x:o.x-r.x-r.width/2,y:o.y-r.y-r.height/2})}),this._modeling.createElements(e,n,t,W({},i))},Bn.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return F(e,function(o,a){o=di(o,"priority"),F(o,function(s){var c=W({},hi(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var l;if(ht(c)){c.source=i[s.source],c.target=i[s.target],l=i[s.id]=t.createConnection(c),r.push(l);return}if(Ye(c)){c.labelTarget=i[c.labelTarget],l=i[s.id]=t.createLabel(c),r.push(l);return}c.host&&(c.host=i[c.host]),l=i[s.id]=t.createShape(c),r.push(l)})}),r},Bn.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(hi(e,["id"]));return t},Bn.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(hi(e,["id"]));return t},Bn.prototype.createShape=function(e){var t=this._elementFactory.createShape(hi(e,["id"]));return t},Bn.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(ht(e)&&(!n.has(e.source)||!n.has(e.target))||Ye(e)&&!n.has(e.labelTarget))},Bn.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[],o=new Map,a=Hs(e);function s(f,p){return t.allowed("element.copy",{element:f,elements:p})}function c(f,p){var d=o.get(f);if(!d){var m={element:f,depth:p};r.push(m),o.set(f,m);return}if(d.depth<p){r=l(d,r);var h={element:d.element,depth:p};r.push(h),o.set(f,h)}}function l(f,p){var d=p.indexOf(f);return d!==-1&&p.splice(d,1),p}Nr(a,function(f,p,d){if(Ye(f))return;F(f.labels,function(y){c(y,d)});function m(y){y&&y.length&&F(y,function(v){F(v.labels,function(g){c(g,d)}),c(v,d)})}F([f.attachers,f.incoming,f.outgoing],m),c(f,d);var h=[];return f.children&&(h=f.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:f,children:h}),h}),e=hn(r,function(f){return f.element});var u=new Set(e);return r=hn(r,function(f){return f.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:f.descriptor,element:f.element,elements:e,elementsSet:u}),f}),r=di(r,function(f){return f.descriptor.priority}),e=hn(r,function(f){return f.element}),F(r,function(f){var p=f.depth;if(!n.hasRelations(f.element,e,u)){mv(f.element,e),u.delete(f.element);return}if(!s(f.element,e)){mv(f.element,e),u.delete(f.element);return}i[p]||(i[p]=[]),i[p].push(f.descriptor)}),i};function YM(e){return!!e.host}function qM(e){return hn(e.waypoints,function(t){return t=hv(t),t.original&&(t.original=hv(t.original)),t})}function hv(e){return W({},e)}function mv(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const KM={__depends__:[mM,Mc,Ma,Si],__init__:["copyPaste"],copyPaste:["type",Bn]};function nf(e,t,n){Be(n)||(n=[n]),F(n,function(i){Tr(e[i])||(t[i]=e[i])})}var rf=750;function gv(e,t,n){function i(c,l){var u=e.create(c.$type);return n.copyElement(c,u,null,l)}t.on("copyPaste.copyElement",rf,function(c){var l=c.descriptor,u=c.element,f=ie(u);if(Ye(u))return l;var p=l.businessObject=i(f,!0),d=l.di=i(ot(u),!0);d.bpmnElement=p,nf(p,l,"name"),nf(d,l,"isExpanded"),f.default&&(l.default=f.default.id)});var r="-bpmn-js-refs";function o(c){return c[r]=c[r]||{}}function a(c,l){c[r]=l}function s(c,l,u){var f=ie(c);return c.default&&(u[c.default]={element:f,property:"default"}),c.host&&(ie(c).attachedToRef=ie(l[c.host])),hi(u,Tn(u,function(p,d,m){var h=d.element,y=d.property;return m===c.id&&(h.set(y,f),p.push(c.id)),p},[]))}t.on("copyPaste.pasteElement",function(c){var l=c.cache,u=c.descriptor,f=u.businessObject,p=u.di;if(Ye(u)){u.businessObject=ie(l[u.labelTarget]),u.di=ot(l[u.labelTarget]);return}f=u.businessObject=i(f),p=u.di=i(p),p.bpmnElement=f,nf(u,f,["isExpanded","name"]),u.type=f.$type}),t.on("copyPaste.copyElement",rf,function(c){var l=c.descriptor,u=c.element;if(S(u,"bpmn:Participant")){var f=ie(u);f.processRef&&(l.processRef=i(f.processRef,!0))}}),t.on("copyPaste.pasteElement",function(c){var l=c.descriptor,u=l.processRef;u&&(l.processRef=i(u))}),t.on("copyPaste.createTree",function(c){var l=c.element,u=c.children;S(l,"bpmn:SubProcess")&&F(ga(u),f=>{u.push(f.annotation)})}),t.on("copyPaste.pasteElement",rf,function(c){var l=c.cache,u=c.descriptor;a(l,s(u,l,o(l)))})}gv.$inject=["bpmnFactory","eventBus","moddleCopy"];const XM=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],ZM=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function Ta(e,t,n){this._bpmnFactory=t,this._eventBus=e,this._moddle=n,e.on("moddleCopy.canCopyProperties",i=>{const{propertyNames:r}=i;if(!(!r||!r.length))return di(r,o=>o==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:r,property:o,propertyName:a}=i,s=Qt(r)&&r.$descriptor;if(a&&ZM.includes(a))return o;if(a&&XM.includes(a)||a&&s&&!vt(s.properties,ao({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",i=>{const{property:r}=i;if(S(r,"bpmn:ExtensionElements")&&(!r.values||!r.values.length))return!1})}Ta.$inject=["eventBus","bpmnFactory","moddle"],Ta.prototype.copyElement=function(e,t,n,i=!1){n&&!Be(n)&&(n=[n]),n=n||of(e.$descriptor);const r=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return r===!1||(Be(r)&&(n=r),F(n,o=>{let a;Mn(e,o)&&(a=e.get(o));const s=this.copyProperty(a,t,o,i);!Yt(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:o})===!1||t.set(o,s)})),t},Ta.prototype.copyProperty=function(e,t,n,i=!1){let r=this._eventBus.fire("moddleCopy.canCopyProperty",{parent:t,property:e,propertyName:n,clone:i});if(r===!1)return;if(r)return Qt(r)&&r.$type&&!r.$parent&&(r.$parent=t),r;const o=this._moddle.getPropertyDescriptor(t,n);if(!o.isReference)return o.isId?e&&this._copyId(e,t,i):Be(e)?Tn(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):Qt(e)&&e.$type?this._moddle.getElementDescriptor(e).isGeneric?void 0:(r=this._bpmnFactory.create(e.$type),r.$parent=t,r=this.copyElement(e,r,null,i),r):e},Ta.prototype._copyId=function(e,t,n=!1){if(n)return e;if(!this._moddle.ids.assigned(e))return this._moddle.ids.claim(e,t),e};function of(e,t){return Tn(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const yv={__depends__:[KM],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",gv],moddleCopy:["type",Ta]};var vv=Math.round;function af(e,t){this._modeling=e,this._eventBus=t}af.$inject=["modeling","eventBus"],af.prototype.replaceElement=function(e,t,n){if(e.waypoints)return null;var i=this._modeling,r=this._eventBus;r.fire("replace.start",{element:e,attrs:t,hints:n});var o=t.width||e.width,a=t.height||e.height,s=t.x||e.x,c=t.y||e.y,l=vv(s+o/2),u=vv(c+a/2),f=i.replaceShape(e,W({},t,{x:l,y:u,width:o,height:a}),n);return r.fire("replace.end",{element:e,newElement:f,hints:n}),f};function bv(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:r={}}=n;r.select!==!1&&e.select(i)})}bv.$inject=["selection","eventBus"];const QM={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",bv],replace:["type",af]};function JM(e,t,n){Be(n)||(n=[n]),F(n,function(i){Tr(e[i])||(t[i]=e[i])})}var eT=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function tT(e,t){var n=e&&Mn(e,"collapsed")?e.collapsed:!Qe(e),i;return t&&(Mn(t,"collapsed")||Mn(t,"isExpanded"))?i=Mn(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function xv(e,t,n,i,r,o){function a(s,c,l){l=l||{};var u=c.type,f=s.businessObject;if(Tc(f)&&(u==="bpmn:SubProcess"||u==="bpmn:AdHocSubProcess")&&tT(s,c))return i.toggleCollapse(s),s;var p=e.create(u),d={type:u,businessObject:p};d.di={},u==="bpmn:ExclusiveGateway"&&(d.di.isMarkerVisible=!0),JM(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var m=of(f.$descriptor),h=of(p.$descriptor,!0),y=nT(m,h);W(p,li(c,eT));var v=Ke(y,function(x){return x==="eventDefinitions"?_v(s,c.eventDefinitionType):x==="loopCharacteristics"?!vn(p):Mn(p,x)||x==="processRef"&&c.isExpanded===!1||x==="triggeredByEvent"?!1:x==="isForCompensation"?!vn(p):!0});if(p=n.copyElement(f,p,v),c.eventDefinitionType&&(_v(p,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),S(f,"bpmn:Activity")){if(Tc(f))d.isExpanded=Qe(s);else if(c&&Mn(c,"isExpanded")){d.isExpanded=c.isExpanded;var g=t.getDefaultSize(p,{isExpanded:d.isExpanded});d.width=g.width,d.height=g.height,d.x=s.x-(d.width-s.width)/2,d.y=s.y-(d.height-s.height)/2}Qe(s)&&!S(f,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(Tc(f)&&!Tc(p)&&(l.moveChildren=!1),S(f,"bpmn:Participant")){c.isExpanded===!0?p.processRef=e.create("bpmn:Process"):l.moveChildren=!1;var b=tn(s);ot(s).isHorizontal||(ot(d).isHorizontal=b),d.width=b?s.width:t.getDefaultSize(d).width,d.height=b?t.getDefaultSize(d).height:s.height}return o.allowed("shape.resize",{shape:p})||(d.height=t.getDefaultSize(d).height,d.width=t.getDefaultSize(d).width),p.name=f.name,qe(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&qe(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(p.default=f.default),c.host&&!S(f,"bpmn:BoundaryEvent")&&S(p,"bpmn:BoundaryEvent")&&(d.host=c.host),(d.type==="bpmn:DataStoreReference"||d.type==="bpmn:DataObjectReference")&&(d.x=s.x+(s.width-d.width)/2),r.replaceElement(s,d,{...l,targetElement:c})}this.replaceElement=a}xv.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function Tc(e){return S(e,"bpmn:SubProcess")}function _v(e,t){var n=ie(e);return t&&n.get("eventDefinitions").some(function(i){return S(i,t)})}function nT(e,t){return e.filter(function(n){return t.includes(n)})}const wv={__depends__:[yv,QM,ni],bpmnReplace:["type",xv]};var iT=250;function Vr(e){this._eventBus=e,this._tools=[],this._active=null}Vr.$inject=["eventBus"],Vr.prototype.registerTool=function(e,t){var n=this._tools;if(!t)throw new Error(`A tool has to be registered with it's "events"`);n.push(e),this.bindEvents(e,t)},Vr.prototype.isActive=function(e){return e&&this._active===e},Vr.prototype.length=function(e){return this._tools.length},Vr.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Vr.prototype.bindEvents=function(e,t){var n=this._eventBus,i=[];n.on(t.tool+".init",function(r){var o=r.context;if(!o.reactivate&&this.isActive(e)){this.setActive(null);return}this.setActive(e)},this),F(t,function(r){i.push(r+".ended"),i.push(r+".canceled")}),n.on(i,iT,function(r){this._active&&(rT(r)||this.setActive(null))},this)};function rT(e){var t=e.originalEvent&&e.originalEvent.target;return t&&Lr(t,'.group[data-group="tools"]')}const kc={__depends__:[Hi],__init__:["toolManager"],toolManager:["type",Vr]};function oT(e,t){if(e==="x"){if(t>0)return"e";if(t<0)return"w"}if(e==="y"){if(t>0)return"s";if(t<0)return"n"}return null}function aT(e,t){var n=[],i=new Set(e);F(t,function(o){i.add(o)});var r=new Set;return i.forEach(function(o){var a=o.incoming,s=o.outgoing;F(a.concat(s),function(c){var l=c.source,u=c.target;(i.has(l)||i.has(u))&&(r.has(c)||(r.add(c),n.push(c)))})}),n}function sT(e,t,n){var i=e.x,r=e.y,o=e.width,a=e.height,s=n.x,c=n.y;switch(t){case"n":return{x:i,y:r+c,width:o,height:a-c};case"s":return{x:i,y:r,width:o,height:a+c};case"w":return{x:i+s,y:r,width:o-s,height:a};case"e":return{x:i,y:r,width:o+s,height:a};default:throw new Error("unknown direction: "+t)}}var sf=Math.abs,cT=Math.round,zi={x:"width",y:"height"},Ev="crosshair",dr={n:"top",w:"left",s:"bottom",e:"right"},lT=1500,Oc={n:"s",w:"e",s:"n",e:"w"},Dc=20;function ii(e,t,n,i,r,o,a){this._canvas=e,this._dragging=t,this._eventBus=n,this._modeling=i,this._rules=r,this._toolManager=o,this._mouse=a;var s=this;o.registerTool("space",{tool:"spaceTool.selection",dragging:"spaceTool"}),n.on("spaceTool.selection.end",function(c){n.once("spaceTool.selection.ended",function(){s.activateMakeSpace(c.originalEvent)})}),n.on("spaceTool.move",lT,function(c){var l=c.context,u=l.initialized;u||(u=l.initialized=s.init(c,l)),u&&Rv(c)}),n.on("spaceTool.end",function(c){var l=c.context,u=l.axis,f=l.direction,p=l.movingShapes,d=l.resizingShapes,m=l.start;if(l.initialized){Rv(c);var h={x:0,y:0};h[u]=cT(c["d"+u]),s.makeSpace(p,d,h,f,m),n.once("spaceTool.ended",function(y){s.activateSelection(y.originalEvent,!0,!0)})}})}ii.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],ii.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:Ev,data:{context:{reactivate:n}},trapClick:!1})},ii.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:Ev,data:{context:{}}})},ii.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},ii.prototype.init=function(e,t){var n=sf(e.dx)>sf(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(sf(i)<5)return!1;i<0&&(i*=-1),Ca(e)&&(i*=-1);var o=oT(n,i),a=this._canvas.getRootElement();!xc(e)&&e.hover&&(a=e.hover);var s=[...ua(a),...a.attachers||[]],c=this.calculateAdjustments(s,n,i,r),l=this._eventBus.fire("spaceTool.getMinDimensions",{axis:n,direction:o,shapes:c.resizingShapes,start:r}),u=uT(c,n,o,r,l);return W(t,c,{axis:n,direction:o,spaceToolConstraints:u,start:r}),Pc("resize-"+(n==="x"?"ew":"ns")),!0},ii.prototype.calculateAdjustments=function(e,t,n,i){var r=this._rules,o=[],a=[],s=new Set,c=new Set,l=[],u=[];function f(d){s.has(d)||(s.add(d),o.push(d));var m=d.label;m&&!s.has(m)&&(s.add(m),o.push(m))}function p(d){c.has(d)||(c.add(d),a.push(d))}return F(e,function(d){if(!(!d.parent||Ye(d))){if(ht(d)){u.push(d);return}var m=d[t],h=m+d[zi[t]];if(pT(d)&&(n>0&&Ne(d)[t]>i||n<0&&Ne(d)[t]<i)){l.push(d);return}if(n>0&&m>i||n<0&&h<i){f(d);return}if(m<i&&h>i&&r.allowed("shape.resize",{shape:d})){p(d);return}}}),F(o,function(d){var m=d.attachers;m&&F(m,function(h){f(h)})}),F(l,function(d){var m=d.host;(s.has(m)||c.has(m))&&f(d)}),F(u,function(d){var m=d.source,h=d.target,y=d.label;(s.has(m)||c.has(m))&&(s.has(h)||c.has(h))&&y&&f(y)}),{movingShapes:o,resizingShapes:a}},ii.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},ii.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function Sv(e){return{top:e.top-Dc,right:e.right+Dc,bottom:e.bottom+Dc,left:e.left-Dc}}function Rv(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,r;Fe(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),Fe(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),Fe(n.top)&&(r=Math.max(e.y,n.top),e.dy=e.dy+r-e.y,e.y=r),Fe(n.bottom)&&(r=Math.min(e.y,n.bottom),e.dy=e.dy+r-e.y,e.y=r)}}function uT(e,t,n,i,r){var o=e.movingShapes,a=e.resizingShapes;if(a.length){var s={},c,l,u=new Set(o),f=new Set(a);return F(a,function(p){var d=p.attachers,m=p.children,h=Ie(p),y=Ke(m,function(z){return!ht(z)&&!Ye(z)&&!u.has(z)&&!f.has(z)}),v=Ke(m,function(z){return!ht(z)&&!Ye(z)&&u.has(z)}),g,b,x,C=[],M=[],k,P,B,D;y.length&&(b=Sv(Ie(Ft(y))),g=i-h[dr[n]]+b[dr[n]],n==="n"?s.bottom=l=Fe(l)?Math.min(l,g):g:n==="w"?s.right=l=Fe(l)?Math.min(l,g):g:n==="s"?s.top=c=Fe(c)?Math.max(c,g):g:n==="e"&&(s.left=c=Fe(c)?Math.max(c,g):g)),v.length&&(x=Sv(Ie(Ft(v))),g=i-x[dr[Oc[n]]]+h[dr[Oc[n]]],n==="n"?s.bottom=l=Fe(l)?Math.min(l,g):g:n==="w"?s.right=l=Fe(l)?Math.min(l,g):g:n==="s"?s.top=c=Fe(c)?Math.max(c,g):g:n==="e"&&(s.left=c=Fe(c)?Math.max(c,g):g)),d&&d.length&&(d.forEach(function(z){u.has(z)?C.push(z):M.push(z)}),C.length&&(k=Ie(Ft(C.map(Ne))),P=h[dr[Oc[n]]]-(k[dr[Oc[n]]]-i)),M.length&&(B=Ie(Ft(M.map(Ne))),D=B[dr[n]]-(h[dr[n]]-i)),n==="n"?(g=Math.min(P||1/0,D||1/0),s.bottom=l=Fe(l)?Math.min(l,g):g):n==="w"?(g=Math.min(P||1/0,D||1/0),s.right=l=Fe(l)?Math.min(l,g):g):n==="s"?(g=Math.max(P||-1/0,D||-1/0),s.top=c=Fe(c)?Math.max(c,g):g):n==="e"&&(g=Math.max(P||-1/0,D||-1/0),s.left=c=Fe(c)?Math.max(c,g):g));var I=r&&r[p.id];I&&(n==="n"?(g=i+p[zi[t]]-I[zi[t]],s.bottom=l=Fe(l)?Math.min(l,g):g):n==="w"?(g=i+p[zi[t]]-I[zi[t]],s.right=l=Fe(l)?Math.min(l,g):g):n==="s"?(g=i-p[zi[t]]+I[zi[t]],s.top=c=Fe(c)?Math.max(c,g):g):n==="e"&&(g=i-p[zi[t]]+I[zi[t]],s.left=c=Fe(c)?Math.max(c,g):g))}),s}}function pT(e){return!!e.host}var cf="djs-dragging",Cv="djs-resizing",fT=250,Ic=Math.max;function Av(e,t,n,i,r){function o(a,s){F(a,function(c){r.addDragger(c,s),n.addMarker(c,cf)})}e.on("spaceTool.selection.start",function(a){var s=n.getLayer("space"),c=a.context,l={x:"M 0,-10000 L 0,10000",y:"M -10000,0 L 10000,0"},u=Oe("g");Se(u,i.cls("djs-crosshair-group",["no-events"])),ze(s,u);var f=Oe("path");Se(f,"d",l.x),et(f).add("djs-crosshair"),ze(u,f);var p=Oe("path");Se(p,"d",l.y),et(p).add("djs-crosshair"),ze(u,p),c.crosshairGroup=u}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;ln(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&Kt(c)}),e.on("spaceTool.move",fT,function(a){var s=a.context,c=s.line,l=s.axis,u=s.movingShapes,f=s.resizingShapes;if(s.initialized){if(!s.dragGroup){var p=n.getLayer("space");c=Oe("path"),Se(c,"d","M0,0 L0,0"),et(c).add("djs-crosshair"),ze(p,c),s.line=c;var d=Oe("g");Se(d,i.cls("djs-drag-group",["no-events"])),ze(n.getActiveLayer(),d),o(u,d);var m=new Set(u);F(f,function(M){m.add(M)});var h=new Set,y=s.movingConnections=[];m.forEach(function(M){F(M.outgoing,function(k){h.has(k)||!ht(k)||!m.has(k.target)||(h.add(k),y.push(k))})}),o(y,d),s.dragGroup=d}if(!s.frameGroup){var v=Oe("g");Se(v,i.cls("djs-frame-group",["no-events"])),ze(n.getActiveLayer(),v);var g=[];F(f,function(M){var k=r.addFrame(M,v),P=k.getBBox();g.push({element:k,initialBounds:P}),n.addMarker(M,Cv)}),s.frameGroup=v,s.frames=g}var b={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};Se(c,{d:b[l]});var x={x:"y",y:"x"},C={x:a.dx,y:a.dy};C[x[s.axis]]=0,ln(s.dragGroup,C.x,C.y),F(s.frames,function(M){var k=M.element,P=M.initialBounds,B,D;s.direction==="e"?Se(k,{width:Ic(P.width+C.x,5)}):(B=Ic(P.width-C.x,5),Se(k,{width:B,x:P.x+P.width-B})),s.direction==="s"?Se(k,{height:Ic(P.height+C.y,5)}):(D=Ic(P.height-C.y,5),Se(k,{height:D,y:P.y+P.height-D}))})}}),e.on("spaceTool.cleanup",function(a){var s=a.context,c=s.movingShapes,l=s.movingConnections,u=s.resizingShapes,f=s.line,p=s.dragGroup,d=s.frameGroup;F(c,function(m){n.removeMarker(m,cf)}),F(l,function(m){n.removeMarker(m,cf)}),p&&(Kt(f),Kt(p)),F(u,function(m){n.removeMarker(m,Cv)}),d&&Kt(d)})}Av.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const dT={__init__:["spaceToolPreview"],__depends__:[Hi,Si,kc,No,Ma],spaceTool:["type",ii],spaceToolPreview:["type",Av]};function Lc(e,t){e.invoke(ii,this),this._canvas=t}Lc.$inject=["injector","canvas"],Ee(Lc,ii),Lc.prototype.calculateAdjustments=function(e,t,n,i){var r=this._canvas.getRootElement(),o=e[0]===r?null:e[0],a=[];o&&(a=ro(bo(r.children.filter(l=>S(l,"bpmn:Artifact")),Ft(o))));const s=[...e,...a];var c=ii.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(l){return!(S(l,"bpmn:TextAnnotation")||hT(l)&&(t==="y"&&tn(l)||t==="x"&&!tn(l)))}),c};function hT(e){return S(e,"bpmn:Participant")&&!ie(e).processRef}const Pv={__depends__:[dT],spaceTool:["type",Lc]};function Mt(e,t){this._handlerMap={},this._stack=[],this._stackIdx=-1,this._currentExecution={actions:[],dirty:[],trigger:null},this._injector=t,this._eventBus=e,this._uid=1,e.on(["diagram.destroy","diagram.clear"],function(){this.clear(!1)},this)}Mt.$inject=["eventBus","injector"],Mt.prototype.execute=function(e,t){if(!e)throw new Error("command required");this._currentExecution.trigger="execute";const n={command:e,context:t};this._pushAction(n),this._internalExecute(n),this._popAction()},Mt.prototype.canExecute=function(e,t){const n={command:e,context:t},i=this._getHandler(e);let r=this._fire(e,"canExecute",n);if(r===void 0){if(!i)return!1;i.canExecute&&(r=i.canExecute(t))}return r},Mt.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},Mt.prototype.undo=function(){let e=this._getUndoAction(),t;if(e){for(this._currentExecution.trigger="undo",this._pushAction(e);e&&(this._internalUndo(e),t=this._getUndoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}},Mt.prototype.redo=function(){let e=this._getRedoAction(),t;if(e){for(this._currentExecution.trigger="redo",this._pushAction(e);e&&(this._internalExecute(e,!0),t=this._getRedoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}},Mt.prototype.register=function(e,t){this._setHandler(e,t)},Mt.prototype.registerHandler=function(e,t){if(!e||!t)throw new Error("command and handlerCls must be defined");const n=this._injector.instantiate(t);this.register(e,n)},Mt.prototype.canUndo=function(){return!!this._getUndoAction()},Mt.prototype.canRedo=function(){return!!this._getRedoAction()},Mt.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},Mt.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},Mt.prototype._internalUndo=function(e){const t=e.command,n=e.context,i=this._getHandler(t);this._atomicDo(()=>{this._fire(t,"revert",e),i.revert&&this._markDirty(i.revert(n)),this._revertedAction(e),this._fire(t,"reverted",e)})},Mt.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);const i=t?[e+"."+t,t]:[e];let r;n=this._eventBus.createEvent(n);for(const o of i)if(r=this._eventBus.fire("commandStack."+o,n),n.cancelBubble)break;return r},Mt.prototype._createId=function(){return this._uid++},Mt.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},Mt.prototype._internalExecute=function(e,t){const n=e.command,i=e.context,r=this._getHandler(n);if(!r)throw new Error("no command handler registered for <"+n+">");this._pushAction(e),t||(this._fire(n,"preExecute",e),r.preExecute&&r.preExecute(i),this._fire(n,"preExecuted",e)),this._atomicDo(()=>{this._fire(n,"execute",e),r.execute&&this._markDirty(r.execute(i)),this._executedAction(e,t),this._fire(n,"executed",e)}),t||(this._fire(n,"postExecute",e),r.postExecute&&r.postExecute(i),this._fire(n,"postExecuted",e)),this._popAction()},Mt.prototype._pushAction=function(e){const t=this._currentExecution,n=t.actions,i=n[0];if(t.atomic)throw new Error("illegal invocation in <execute> or <revert> phase (action: "+e.command+")");e.id||(e.id=i&&i.id||this._createId()),n.push(e)},Mt.prototype._popAction=function(){const e=this._currentExecution,t=e.trigger,n=e.actions,i=e.dirty;n.pop(),n.length||(this._eventBus.fire("elements.changed",{elements:Bd("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},Mt.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=Be(e)?e:[e],t.dirty=t.dirty.concat(e))},Mt.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},Mt.prototype._revertedAction=function(e){this._stackIdx--},Mt.prototype._getHandler=function(e){return this._handlerMap[e]},Mt.prototype._setHandler=function(e,t){if(!e||!t)throw new Error("command and handler required");if(this._handlerMap[e])throw new Error("overriding handler for command <"+e+">");this._handlerMap[e]=t};const mT={commandStack:["type",Mt]};function hr(e,t){if(typeof t!="function")throw new Error("removeFn iterator must be a function");if(!e)return[];for(var n;n=e[0];)t(n);return e}var gT=250,Mv=1400;function lf(e,t,n){te.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",Mv,function(r){var o=r.context,a=o.shapes,s=o.validatedShapes;o.shapes=Tv(a),o.validatedShapes=Tv(s)}),i&&t.on("shape.move.start",gT,function(r){var o=r.context,a=new Set(o.shapes),s=new Set;for(const c of a)for(const l of c.labels)!l.hidden&&!a.has(l)&&s.add(l),c.labelTarget&&s.add(c);for(const c of s)i.makeDraggable(o,c,!0)}),this.preExecuted("elements.move",Mv,function(r){var o=r.context,a=o.closure,s=a.enclosedElements,c=[];F(s,function(l){F(l.labels,function(u){s[u.id]||c.push(u)})}),a.addAll(c)}),this.preExecute(["connection.delete","shape.delete"],function(r){var o=r.context,a=o.connection||o.shape;hr(a.labels,function(s){n.removeShape(s,{nested:!0})})}),this.execute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.labelTarget;s&&(o.labelTargetIndex=Hu(s.labels,a),o.labelTarget=s,a.labelTarget=null)}),this.revert("shape.delete",function(r){var o=r.context,a=o.shape,s=o.labelTarget,c=o.labelTargetIndex;s&&(Bt(s.labels,a,c),a.labelTarget=s)})}Ee(lf,te),lf.$inject=["injector","eventBus","modeling"];function Tv(e){var t=new Set(e);return Ke(e,function(n){return!t.has(n.labelTarget)})}const yT={__init__:["labelSupport"],labelSupport:["type",lf]};var vT=251,kv=1401,Ov="attach-ok";function uf(e,t,n,i,r){te.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",kv,function(a){var s=a.context,c=s.shapes,l=s.validatedShapes;s.shapes=bT(c),s.validatedShapes=xT(l)}),o&&t.on("shape.move.start",vT,function(a){var s=a.context,c=s.shapes,l=pf(c);F(l,function(u){o.makeDraggable(s,u,!0),F(u.labels,function(f){o.makeDraggable(s,f,!0)})})}),o&&t.on("shape.move.start",function(a){var s=a.context,c=s.shapes;if(c.length===1){var l=c[0],u=l.host;u&&(n.addMarker(u,Ov),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(u,Ov)}))}}),this.preExecuted("elements.move",kv,function(a){var s=a.context,c=s.closure,l=s.shapes,u=pf(l);F(u,function(f){c.add(f,c.topLevel[f.host.id])})}),this.postExecuted("elements.move",function(a){var s=a.context,c=s.shapes,l=s.newHost,u;l&&c.length!==1||(l?u=c:u=Ke(c,function(f){var p=f.host;return _T(f)&&!wT(c,p)}),F(u,function(f){r.updateAttachment(f,l)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;F(s,function(c){F(c.attachers,function(l){F(l.outgoing.slice(),function(u){var f=i.allowed("connection.reconnect",{connection:u,source:u.source,target:u.target});f||r.removeConnection(u)}),F(l.incoming.slice(),function(u){var f=i.allowed("connection.reconnect",{connection:u,source:u.source,target:u.target});f||r.removeConnection(u)})})})}),this.postExecute("shape.create",function(a){var s=a.context,c=s.shape,l=s.host;l&&r.updateAttachment(c,l)}),this.postExecute("shape.replace",function(a){var s=a.context,c=s.oldShape,l=s.newShape;hr(c.attachers,function(u){var f=i.allowed("elements.move",{target:l,shapes:[u]});f==="attach"?r.updateAttachment(u,l):r.removeShape(u)}),l.attachers.length&&F(l.attachers,function(u){var f=Xg(u,c,l);r.moveShape(u,f,u.parent)})}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.oldBounds,u=s.newBounds,f=c.attachers,p=s.hints||{};p.attachSupport!==!1&&F(f,function(d){var m=Xg(d,l,u);r.moveShape(d,m,d.parent),F(d.labels,function(h){r.moveShape(h,m,h.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;hr(s.attachers,function(c){r.removeShape(c)}),s.host&&r.updateAttachment(s,null)})}Ee(uf,te),uf.$inject=["injector","eventBus","canvas","rules","modeling"];function pf(e){return Kl(hn(e,function(t){return t.attachers||[]}))}function bT(e){var t=pf(e);return I0("id",e,t)}function xT(e){var t=oo(e,"id");return Ke(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function _T(e){return!!e.host}function wT(e,t){return e.indexOf(t)!==-1}const ET={__depends__:[Si],__init__:["attachSupport"],attachSupport:["type",uf]};function Dv(e,t,n,i){e.on("element.changed",function(r){var o=r.element;(o.parent||o===t.getRootElement())&&(r.gfx=n.getGraphics(o)),r.gfx&&e.fire(Rm(o)+".changed",r)}),e.on("elements.changed",function(r){var o=r.elements;o.forEach(function(a){e.fire("element.changed",{element:a})}),i.updateContainments(o)}),e.on("shape.changed",function(r){i.update("shape",r.element,r.gfx)}),e.on("connection.changed",function(r){i.update("connection",r.element,r.gfx)})}Dv.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const ff={__init__:["changeSupport"],changeSupport:["type",Dv]};function ri(e){this._model=e}ri.$inject=["moddle"],ri.prototype._needsId=function(e){return qe(e,["bpmn:RootElement","bpmn:FlowElement","bpmn:MessageFlow","bpmn:DataAssociation","bpmn:Artifact","bpmn:Participant","bpmn:Lane","bpmn:LaneSet","bpmn:Process","bpmn:Collaboration","bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane","bpmn:Property","bpmn:CategoryValue"])},ri.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;S(e,"bpmn:Activity")?t="Activity":S(e,"bpmn:Event")?t="Event":S(e,"bpmn:Gateway")?t="Gateway":qe(e,["bpmn:SequenceFlow","bpmn:MessageFlow"])?t="Flow":t=(e.$type||"").replace(/^[^:]*:/g,""),t+="_",!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e))},ri.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},ri.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},ri.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",W({bpmnElement:e,bounds:this.createDiBounds()},t))},ri.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},ri.prototype.createDiWaypoints=function(e){var t=this;return hn(e,function(n){return t.createDiWaypoint(n)})},ri.prototype.createDiWaypoint=function(e){return this.create("dc:Point",li(e,["x","y"]))},ri.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",W({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},ri.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",W({bpmnElement:e},t))};function Nn(e,t,n){te.call(this,e),this._bpmnFactory=t;var i=this;function r(d){var m=d.context,h=m.hints||{},y;!m.cropped&&h.createElementsBehavior!==!1&&(y=m.connection,y.waypoints=n.getCroppedWaypoints(y),m.cropped=!0)}this.executed(["connection.layout","connection.create"],r),this.reverted(["connection.layout"],function(d){delete d.context.cropped});function o(d){var m=d.context;i.updateParent(m.shape||m.connection,m.oldParent)}function a(d){var m=d.context,h=m.shape||m.connection,y=m.parent||m.newParent;i.updateParent(h,y)}this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],$n(o)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],$n(a));function s(d){var m=d.context,h=m.oldRoot,y=h.children;F(y,function(v){S(v,"bpmn:BaseElement")&&i.updateParent(v)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(d){var m=d.context.shape;S(m,"bpmn:BaseElement")&&i.updateBounds(m)}this.executed(["shape.move","shape.create","shape.resize"],$n(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],$n(function(d){d.context.shape.type!=="label"&&c(d)})),e.on("shape.changed",function(d){d.element.type==="label"&&c({context:{shape:d.element}})});function l(d){i.updateConnection(d.context)}this.executed(["connection.create","connection.move","connection.delete","connection.reconnect"],$n(l)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],$n(l));function u(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],$n(u)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],$n(u)),this.executed("connection.reconnect",$n(function(d){var m=d.context,h=m.connection,y=m.oldSource,v=m.newSource,g=ie(h),b=ie(y),x=ie(v);g.conditionExpression&&!qe(x,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(m.oldConditionExpression=g.conditionExpression,delete g.conditionExpression),y!==v&&b.default===g&&(m.oldDefault=b.default,delete b.default)})),this.reverted("connection.reconnect",$n(function(d){var m=d.context,h=m.connection,y=m.oldSource,v=m.newSource,g=ie(h),b=ie(y),x=ie(v);m.oldConditionExpression&&(g.conditionExpression=m.oldConditionExpression),m.oldDefault&&(b.default=m.oldDefault,delete x.default)}));function f(d){i.updateAttachment(d.context)}this.executed(["element.updateAttachment"],$n(f)),this.reverted(["element.updateAttachment"],$n(f)),this.executed("element.updateLabel",$n(p)),this.reverted("element.updateLabel",$n(p));function p(d){const{element:m}=d.context,h=qn(m),y=ot(m),v=y&&y.get("label");sr(m)||_c(m)||(h&&!v?y.set("label",t.create("bpmndi:BPMNLabel")):!h&&v&&y.set("label",void 0))}}Ee(Nn,te),Nn.$inject=["eventBus","bpmnFactory","connectionDocking"],Nn.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},Nn.prototype.updateParent=function(e,t){if(!Ye(e)&&!(S(e,"bpmn:DataStoreReference")&&e.parent&&S(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=ot(e),o=n&&n.businessObject,a=ot(n);S(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,o,t&&t.businessObject),S(e,"bpmn:DataOutputAssociation")&&(e.source?o=e.source.businessObject:o=null),S(e,"bpmn:DataInputAssociation")&&(e.target?o=e.target.businessObject:o=null),this.updateSemanticParent(i,o),S(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,o),this.updateDiParent(r,a)}},Nn.prototype.updateBounds=function(e){var t=ot(e),n=RT(e);if(n){var i=pi(n,t.get("bounds"));W(n,{x:e.x+i.x,y:e.y+i.y})}var r=Ye(e)?this._getLabel(t):t,o=r.bounds;o||(o=this._bpmnFactory.createDiBounds(),r.set("bounds",o)),W(o,{x:e.x,y:e.y,width:e.width,height:e.height})},Nn.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,r;S(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),Lt(i,e)),S(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),Bt(r,e))}},Nn.prototype.updateDiConnection=function(e,t,n){var i=ot(e),r=ot(t),o=ot(n);i.sourceElement&&i.sourceElement.bpmnElement!==ie(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==ie(n)&&(i.targetElement=n&&o)},Nn.prototype.updateDiParent=function(e,t){if(t&&!S(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(Lt(n,e),e.$parent=null)}};function ST(e){for(;e&&!S(e,"bpmn:Definitions");)e=e.$parent;return e}Nn.prototype.getLaneSet=function(e){var t,n;return S(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(S(e,"bpmn:Participant")&&(e=e.processRef),n=e.get("laneSets"),t=n[0],t||(t=this._bpmnFactory.create("bpmn:LaneSet"),t.$parent=e,n.push(t)),t)},Nn.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&!((S(e,"bpmn:DataInput")||S(e,"bpmn:DataOutput"))&&(S(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(S(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(S(e,"bpmn:FlowElement")){if(t){if(S(t,"bpmn:Participant"))t=t.processRef;else if(S(t,"bpmn:Lane"))do t=t.$parent.$parent;while(S(t,"bpmn:Lane"))}i="flowElements"}else if(S(e,"bpmn:Artifact")){for(;t&&!S(t,"bpmn:Process")&&!S(t,"bpmn:SubProcess")&&!S(t,"bpmn:Collaboration");)if(S(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;i="artifacts"}else if(S(e,"bpmn:MessageFlow"))i="messageFlows";else if(S(e,"bpmn:Participant")){i="participants";var r=e.processRef,o;r&&(o=ST(e.$parent||t),e.$parent&&(Lt(o.get("rootElements"),r),r.$parent=null),t&&(Bt(o.get("rootElements"),r),r.$parent=o))}else S(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":S(e,"bpmn:DataInputAssociation")&&(i="dataInputAssociations");if(!i)throw new Error(`no parent for <${e.id}> in <${t.id}>`);var a;if(e.$parent&&(a=e.$parent.get(i),Lt(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);Lt(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},Nn.prototype.updateConnectionWaypoints=function(e){var t=ot(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},Nn.prototype.updateConnection=function(e){var t=e.connection,n=ie(t),i=t.source,r=ie(i),o=t.target,a=ie(t.target),s;if(S(n,"bpmn:DataAssociation"))S(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=r,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):S(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||r,this.updateSemanticParent(n,r,s),n.targetRef=a);else{var c=S(n,"bpmn:SequenceFlow");n.sourceRef!==r&&(c&&(Lt(n.sourceRef&&n.sourceRef.get("outgoing"),n),r&&r.get("outgoing")&&r.get("outgoing").push(n)),n.sourceRef=r),n.targetRef!==a&&(c&&(Lt(n.targetRef&&n.targetRef.get("incoming"),n),a&&a.get("incoming")&&a.get("incoming").push(n)),n.targetRef=a)}this.updateConnectionWaypoints(t),this.updateDiConnection(t,i,o)},Nn.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function $n(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;S(i,"bpmn:BaseElement")&&e(t)}}function RT(e){if(S(e,"bpmn:Activity")){var t=ot(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function mr(e,t){Ni.call(this),this._bpmnFactory=e,this._moddle=t}Ee(mr,Ni),mr.$inject=["bpmnFactory","moddle"],mr.prototype._baseCreate=Ni.prototype.create,mr.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,W({type:"label",di:n},Fr,t))}return this.createElement(e,t)},mr.prototype.createElement=function(e,t){t=W({},t||{});var n,i=t.businessObject,r=t.di;if(!i){if(!t.type)throw new Error("no shape type specified");i=this._bpmnFactory.create(t.type)}if(!AT(r)){var o=W({},r||{},{id:i.id+"_di"});e==="root"?r=this._bpmnFactory.createDiPlane(i,o):e==="connection"?r=this._bpmnFactory.createDiEdge(i,o):r=this._bpmnFactory.createDiShape(i,o)}S(i,"bpmn:Group")&&(t=W({isFrame:!0},t)),t=CT(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=df(r,t,"isExpanded")),qe(i,["bpmn:Lane","bpmn:Participant"])&&(t=df(r,t,"isHorizontal")),S(i,"bpmn:SubProcess")&&(t.collapsed=!Qe(i,r)),S(i,"bpmn:ExclusiveGateway")&&(Mn(r,"isMarkerVisible")?r.isMarkerVisible===void 0&&(r.isMarkerVisible=!1):r.isMarkerVisible=!0),Yt(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),Yt(t.cancelActivity)&&(i.cancelActivity=t.cancelActivity,delete t.cancelActivity);var a,s;return t.eventDefinitionType&&(a=i.get("eventDefinitions")||[],s=this._bpmnFactory.create(t.eventDefinitionType,t.eventDefinitionAttrs),t.eventDefinitionType==="bpmn:ConditionalEventDefinition"&&(s.condition=this._bpmnFactory.create("bpmn:FormalExpression")),a.push(s),s.$parent=i,i.eventDefinitions=a,delete t.eventDefinitionType),n=this.getDefaultSize(i,r),t=W({id:i.id},n,t,{businessObject:i,di:r}),this._baseCreate(e,t)},mr.prototype.getDefaultSize=function(e,t){var n=ie(e);if(t=t||ot(e),S(n,"bpmn:SubProcess"))return Qe(n,t)?{width:350,height:200}:{width:100,height:80};if(S(n,"bpmn:Task"))return{width:100,height:80};if(S(n,"bpmn:Gateway"))return{width:50,height:50};if(S(n,"bpmn:Event"))return{width:36,height:36};if(S(n,"bpmn:Participant")){var i=t.isHorizontal===void 0||t.isHorizontal===!0;return Qe(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return S(n,"bpmn:Lane")?{width:400,height:100}:S(n,"bpmn:DataObjectReference")?{width:36,height:50}:S(n,"bpmn:DataStoreReference")?{width:50,height:50}:S(n,"bpmn:TextAnnotation")?{width:100,height:40}:S(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},mr.prototype.createParticipantShape=function(e){return Qt(e)||(e={isExpanded:e}),e=W({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function CT(e,t,n){return F(n,function(i){t=df(e,t,i)}),t}function df(e,t,n){return t[n]===void 0?t:(e[n]=t[n],hi(t,[n]))}function AT(e){return qe(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function Bc(e,t){this._modeling=e,this._canvas=t}Bc.$inject=["modeling","canvas"],Bc.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;F(n,function(r){var o={x:0,y:0};Yt(i.left)?o.x=i.left-r.x:Yt(i.right)?o.x=i.right-r.width-r.x:Yt(i.center)?o.x=i.center-Math.round(r.width/2)-r.x:Yt(i.top)?o.y=i.top-r.y:Yt(i.bottom)?o.y=i.bottom-r.height-r.y:Yt(i.middle)&&(o.y=i.middle-Math.round(r.height/2)-r.y),t.moveElements([r],o,r.parent)})},Bc.prototype.postExecute=function(e){};function Nc(e){this._modeling=e}Nc.$inject=["modeling"],Nc.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var n=e.target||t.parent,i=e.shape,r=e.hints||{};i=e.shape=this._modeling.createShape(i,e.position,n,{attach:r.attach}),e.shape=i},Nc.prototype.postExecute=function(e){var t=e.hints||{};PT(e.source,e.shape)||(t.connectionTarget===e.source?this._modeling.connect(e.shape,e.source,e.connection):this._modeling.connect(e.source,e.shape,e.connection))};function PT(e,t){return Xi(e.outgoing,function(n){return n.target===t})}function $c(e,t){this._canvas=e,this._layouter=t}$c.$inject=["canvas","layouter"],$c.prototype.execute=function(e){var t=e.connection,n=e.source,i=e.target,r=e.parent,o=e.parentIndex,a=e.hints;if(!n||!i)throw new Error("source and target required");if(!r)throw new Error("parent required");return t.source=n,t.target=i,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,a)),this._canvas.addConnection(t,r,o),t},$c.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var Fc=Math.round;function hf(e){this._modeling=e}hf.$inject=["modeling"],hf.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,r=e.position,o=e.hints,a=this._modeling;F(t,function(f){Fe(f.x)||(f.x=0),Fe(f.y)||(f.y=0)});var s=Ke(t,function(f){return!f.hidden}),c=Ft(s);F(t,function(f){ht(f)&&(f.waypoints=hn(f.waypoints,function(p){return{x:Fc(p.x-c.x-c.width/2+r.x),y:Fc(p.y-c.y-c.height/2+r.y)}})),W(f,{x:Fc(f.x-c.x-c.width/2+r.x),y:Fc(f.y-c.y-c.height/2+r.y)})});var l=new Set(Hs(t)),u={};F(t,function(f){if(ht(f)){u[f.id]=Fe(i)?a.createConnection(u[f.source.id],u[f.target.id],i,f,f.parent||n,o):a.createConnection(u[f.source.id],u[f.target.id],f,f.parent||n,o);return}var p=W({},o);l.has(f)||(p.autoResize=!1),Ye(f)&&(p=hi(p,["attach"])),u[f.id]=Fe(i)?a.createShape(f,li(f,["x","y","width","height"]),f.parent||n,i,p):a.createShape(f,li(f,["x","y","width","height"]),f.parent||n,p)}),e.elements=ro(u)};var Iv=Math.round;function gr(e){this._canvas=e}gr.$inject=["canvas"],gr.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,r=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return n.width!==void 0?W(t,n):W(t,{x:n.x-Iv(t.width/2),y:n.y-Iv(t.height/2)}),this._canvas.addShape(t,i,r),t},gr.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function ka(e){gr.call(this,e)}Ee(ka,gr),ka.$inject=["canvas"];var MT=gr.prototype.execute;ka.prototype.execute=function(e){var t=e.shape;return kT(t),t.labelTarget=e.labelTarget,MT.call(this,e)};var TT=gr.prototype.revert;ka.prototype.revert=function(e){return e.shape.labelTarget=null,TT.call(this,e)};function kT(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function Oa(e,t){this._canvas=e,this._modeling=t}Oa.$inject=["canvas","modeling"],Oa.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;hr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),hr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},Oa.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=Hu(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},Oa.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,Bt(n.children,t,i),this._canvas.addConnection(t,n),t};function mf(e,t){this._modeling=e,this._elementRegistry=t}mf.$inject=["modeling","elementRegistry"],mf.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;F(i,function(r){n.get(r.id)&&(r.waypoints?t.removeConnection(r):t.removeShape(r))})};function Da(e,t){this._canvas=e,this._modeling=t}Da.$inject=["canvas","modeling"],Da.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;hr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),hr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),hr(n.children,function(i){ht(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},Da.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=Hu(i.children,n),t.removeShape(n),n},Da.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return Bt(i.children,n,r),t.addShape(n,i),n};function jc(e){this._modeling=e}jc.$inject=["modeling"];var Lv={x:"y",y:"x"};jc.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(y,v){y.range.min=Math.min(v[i],y.range.min),y.range.max=Math.max(v[i]+v[r],y.range.max)}function a(y){return y[i]+y[r]/2}function s(y){return y.length-1}function c(y){return y.max-y.min}function l(y,v){var g={y:0};g[i]=y-a(v),g[i]&&(g[Lv[i]]=0,t.moveElements([v],g,v.parent))}var u=n[0],f=s(n),p=n[f],d,m,h=0;F(n,function(y,v){var g,b,x;if(y.elements.length<2){v&&v!==n.length-1&&(o(y,y.elements[0]),h+=c(y.range));return}g=di(y.elements,i),b=g[0],v===f&&(b=g[s(g)]),x=a(b),y.range=null,F(g,function(C){if(l(x,C),y.range===null){y.range={min:C[i],max:C[i]+C[r]};return}o(y,C)}),v&&v!==n.length-1&&(h+=c(y.range))}),m=Math.abs(p.range.min-u.range.max),d=Math.round((m-h)/(n.length-1)),!(d<n.length-1)&&F(n,function(y,v){var g={},b;y===u||y===p||(b=n[v-1],y.range.max=0,F(y.elements,function(x,C){g[Lv[i]]=0,g[i]=b.range.max-x[i]+d,y.range.min!==x[i]&&(g[i]+=x[i]-y.range.min),g[i]&&t.moveElements([x],g,x.parent),y.range.max=Math.max(x[i]+x[r],C?y.range.max:0)}))})},jc.prototype.postExecute=function(e){};function Hc(e,t){this._layouter=e,this._canvas=t}Hc.$inject=["layouter","canvas"],Hc.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return W(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},Hc.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function gf(){}gf.prototype.execute=function(e){var t=e.connection,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldParent=o,e.oldParentIndex=Lt(o.children,t),Bt(i.children,t,r),t.parent=i,F(t.waypoints,function(a){a.x+=n.x,a.y+=n.y,a.original&&(a.original.x+=n.x,a.original.y+=n.y)}),t},gf.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return Lt(n.children,t),Bt(i.children,t,r),t.parent=i,F(t.waypoints,function(a){a.x-=o.x,a.y-=o.y,a.original&&(a.original.x-=o.x,a.original.y-=o.y)}),t};function yf(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}yf.prototype.add=function(e,t){return this.addAll([e],t)},yf.prototype.addAll=function(e,t){var n=sR(e,!!t,this);return W(this,n),this};function Ia(e){this._modeling=e}Ia.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},Ia.prototype.moveClosure=function(e,t,n,i,r){var o=this._modeling,a=e.allShapes,s=e.allConnections,c=e.enclosedConnections,l=e.topLevel,u=!1;r&&r.parent===n&&(u=!0),F(a,function(f){o.moveShape(f,t,l[f.id]&&!u&&n,{recurse:!1,layout:!1})}),F(s,function(f){var p=!!a[f.source.id],d=!!a[f.target.id];c[f.id]&&p&&d?o.moveConnection(f,t,l[f.id]&&!u&&n):o.layoutConnection(f,{connectionStart:p&&Ep(f,f.source,t),connectionEnd:d&&Sp(f,f.target,t)})})},Ia.prototype.getClosure=function(e){return new yf().addAll(e,!0)};function zc(e){this._helper=new Ia(e)}zc.$inject=["modeling"],zc.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},zc.prototype.postExecute=function(e){var t=e.hints,n;t&&t.primaryShape&&(n=t.primaryShape,t.oldParent=n.parent),this._helper.moveClosure(e.closure,e.delta,e.newParent,e.newHost,n)};function Wr(e){this._modeling=e,this._helper=new Ia(e)}Wr.$inject=["modeling"],Wr.prototype.execute=function(e){var t=e.shape,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldBounds=li(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=Lt(o.children,t),Bt(i.children,t,r),W(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},Wr.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,r=this._modeling;i.layout!==!1&&(F(t.incoming,function(o){r.layoutConnection(o,{connectionEnd:Sp(o,t,n)})}),F(t.outgoing,function(o){r.layoutConnection(o,{connectionStart:Ep(o,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},Wr.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return Bt(n.children,t,i),W(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},Wr.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},Wr.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function La(e){this._modeling=e}La.$inject=["modeling"],La.prototype.execute=function(e){var t=e.newSource,n=e.newTarget,i=e.connection,r=e.dockingOrPoints;if(!t&&!n)throw new Error("newSource or newTarget required");return Be(r)&&(e.oldWaypoints=i.waypoints,i.waypoints=r),t&&(e.oldSource=i.source,i.source=t),n&&(e.oldTarget=i.target,i.target=n),i},La.prototype.postExecute=function(e){var t=e.connection,n=e.newSource,i=e.newTarget,r=e.dockingOrPoints,o=e.hints||{},a={};o.connectionStart&&(a.connectionStart=o.connectionStart),o.connectionEnd&&(a.connectionEnd=o.connectionEnd),o.layoutConnection!==!1&&(n&&(!i||o.docking==="source")&&(a.connectionStart=a.connectionStart||Bv(Be(r)?r[0]:r)),i&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||Bv(Be(r)?r[r.length-1]:r)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},La.prototype.revert=function(e){var t=e.oldSource,n=e.oldTarget,i=e.oldWaypoints,r=e.connection;return t&&(r.source=t),n&&(r.target=n),i&&(r.waypoints=i),r};function Bv(e){return e.original||e}function Gi(e,t){this._modeling=e,this._rules=t}Gi.$inject=["modeling","rules"],Gi.prototype.preExecute=function(e){var t=this,n=this._modeling,i=this._rules,r=e.oldShape,o=e.newData,a=e.hints||{},s;function c(m,h,y){return i.allowed("connection.reconnect",{connection:y,source:m,target:h})}var l={x:o.x,y:o.y},u={x:r.x,y:r.y,width:r.width,height:r.height};s=e.newShape=e.newShape||t.createShape(o,l,r.parent,a),r.host&&n.updateAttachment(s,r.host);var f;a.moveChildren!==!1&&(f=r.children.slice(),n.moveElements(f,{x:0,y:0},s,a));var p=r.incoming.slice(),d=r.outgoing.slice();F(p,function(m){var h=m.source,y=c(h,s,m);y&&t.reconnectEnd(m,s,mc(m,s,u),a)}),F(d,function(m){var h=m.target,y=c(s,h,m);y&&t.reconnectStart(m,s,hc(m,s,u),a)})},Gi.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},Gi.prototype.execute=function(e){},Gi.prototype.revert=function(e){},Gi.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},Gi.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},Gi.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function Ba(e){this._modeling=e}Ba.$inject=["modeling"],Ba.prototype.execute=function(e){var t=e.shape,n=e.newBounds,i=e.minBounds;if(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)throw new Error("newBounds must have {x, y, width, height} properties");if(i&&(n.width<i.width||n.height<i.height))throw new Error("width and height cannot be less than minimum height and width");if(!i&&n.width<10||n.height<10)throw new Error("width and height cannot be less than 10px");return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},W(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Ba.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,r=e.hints||{};r.layout!==!1&&(F(n.incoming,function(o){t.layoutConnection(o,{connectionEnd:mc(o,n,i)})}),F(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:hc(o,n,i)})}))},Ba.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return W(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function yr(e){this._modeling=e}yr.$inject=["modeling"],yr.prototype.preExecute=function(e){var t=e.delta,n=e.direction,i=e.movingShapes,r=e.resizingShapes,o=e.start,a={};this.moveShapes(i,t),F(r,function(s){a[s.id]=DT(s)}),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(aT(i,r),t,n,o,i,r,a)},yr.prototype.execute=function(){},yr.prototype.revert=function(){},yr.prototype.moveShapes=function(e,t){var n=this;F(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},yr.prototype.resizeShapes=function(e,t,n){var i=this;F(e,function(r){var o=sT(r,n,t);i._modeling.resizeShape(r,o,null,{attachSupport:!1,autoResize:!1,layout:!1})})},yr.prototype.updateConnectionWaypoints=function(e,t,n,i,r,o,a){var s=this,c=new Set(r),l=new Set(o);F(e,function(u){var f=u.source,p=u.target,d=OT(u),m=$v(n),h={},y=c.has(f)||l.has(f),v=c.has(p)||l.has(p);y&&v?(d=hn(d,function(g){return Fv(g,i,n)&&(g[m]=g[m]+t[m]),g.original&&Fv(g.original,i,n)&&(g.original[m]=g.original[m]+t[m]),g}),s._modeling.updateWaypoints(u,d,{labelBehavior:!1})):(y||v)&&(c.has(f)?h.connectionStart=Ep(u,f,t):c.has(p)?h.connectionEnd=Sp(u,p,t):l.has(f)?h.connectionStart=hc(u,f,a[f.id]):l.has(p)&&(h.connectionEnd=mc(u,p,a[p.id])),s._modeling.layoutConnection(u,h))})};function Nv(e){return W({},e)}function OT(e){return hn(e.waypoints,function(t){return t=Nv(t),t.original&&(t.original=Nv(t.original)),t})}function $v(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function Fv(e,t,n){var i=$v(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function DT(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function Gc(e){this._modeling=e}Gc.$inject=["modeling"],Gc.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=jv(n),t.collapsed=!t.collapsed;var i=Hv(n,t.collapsed);return[t].concat(i)},Gc.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,r=zv(i,n);return t.collapsed=!t.collapsed,[t].concat(r)};function jv(e){var t={};return F(e,function(n){t[n.id]=n.hidden,n.children&&(t=W({},t,jv(n.children)))}),t}function Hv(e,t){var n=[];return F(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(Hv(i.children,i.collapsed||t)))}),n}function zv(e,t){var n=[];return F(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(zv(i.children,t)))}),n}function Vc(e){this._modeling=e}Vc.$inject=["modeling"],Vc.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=Gv(i,t),Vv(n,t),t.host=n,t},Vc.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,Gv(n,t),Vv(i,t,r),t};function Gv(e,t){return Lt(e&&e.attachers,t)}function Vv(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),Bt(i,t,n)}}function vf(){}vf.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},vf.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function mt(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}mt.$inject=["eventBus","elementFactory","commandStack"],mt.prototype.getHandlers=function(){return{"shape.append":Nc,"shape.create":gr,"shape.delete":Da,"shape.move":Wr,"shape.resize":Ba,"shape.replace":Gi,"shape.toggleCollapse":Gc,spaceTool:yr,"label.create":ka,"connection.create":$c,"connection.delete":Oa,"connection.move":gf,"connection.layout":Hc,"connection.updateWaypoints":vf,"connection.reconnect":La,"elements.create":hf,"elements.move":zc,"elements.delete":mf,"elements.distribute":jc,"elements.align":Bc,"element.updateAttachment":Vc}},mt.prototype.registerHandlers=function(e){F(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},mt.prototype.moveShape=function(e,t,n,i,r){typeof i=="object"&&(r=i,i=null);var o={shape:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("shape.move",o)},mt.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},mt.prototype.moveElements=function(e,t,n,i){i=i||{};var r=i.attach,o=n,a;r===!0?(a=n,o=n.parent):r===!1&&(a=null);var s={shapes:e,delta:t,newParent:o,newHost:a,hints:i};this._commandStack.execute("elements.move",s)},mt.prototype.moveConnection=function(e,t,n,i,r){typeof i=="object"&&(r=i,i=void 0);var o={connection:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("connection.move",o)},mt.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},mt.prototype.createConnection=function(e,t,n,i,r,o){typeof n=="object"&&(o=r,r=i,i=n,n=void 0),i=this._create("connection",i);var a={source:e,target:t,parent:r,parentIndex:n,connection:i,hints:o};return this._commandStack.execute("connection.create",a),a.connection},mt.prototype.createShape=function(e,t,n,i,r){typeof i!="number"&&(r=i,i=void 0),r=r||{};var o=r.attach,a,s;e=this._create("shape",e),o?(a=n.parent,s=n):a=n;var c={position:t,shape:e,parent:a,parentIndex:i,host:s,hints:r};return this._commandStack.execute("shape.create",c),c.shape},mt.prototype.createElements=function(e,t,n,i,r){Be(e)||(e=[e]),typeof i!="number"&&(r=i,i=void 0),r=r||{};var o={position:t,elements:e,parent:n,parentIndex:i,hints:r};return this._commandStack.execute("elements.create",o),o.elements},mt.prototype.createLabel=function(e,t,n,i){n=this._create("label",n);var r={labelTarget:e,position:t,parent:i||e.parent,shape:n};return this._commandStack.execute("label.create",r),r.shape},mt.prototype.appendShape=function(e,t,n,i,r){r=r||{},t=this._create("shape",t);var o={source:e,position:n,target:i,shape:t,connection:r.connection,connectionParent:r.connectionParent,hints:r};return this._commandStack.execute("shape.append",o),o.shape},mt.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},mt.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},mt.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},mt.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},mt.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},mt.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},mt.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},mt.prototype.createSpace=function(e,t,n,i,r){var o={delta:n,direction:i,movingShapes:e,resizingShapes:t,start:r};this._commandStack.execute("spaceTool",o)},mt.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},mt.prototype.reconnect=function(e,t,n,i,r){var o={connection:e,newSource:t,newTarget:n,dockingOrPoints:i,hints:r||{}};this._commandStack.execute("connection.reconnect",o)},mt.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,W(i,{docking:"source"}))},mt.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,W(i,{docking:"target"}))},mt.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},mt.prototype._create=function(e,t){return UR(t)?t:this._elementFactory.create(e,t)},mt.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function Na(e){this._elementRegistry=e}Na.$inject=["elementRegistry"],Na.prototype.execute=function(e){var t=e.element,n=e.moddleElement,i=e.properties;if(!n)throw new Error("<moddleElement> required");var r=e.changed||this._getVisualReferences(n).concat(t),o=e.oldProperties||IT(n,ds(i));return Wv(n,i),e.oldProperties=o,e.changed=r,r},Na.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return Wv(n,t),i},Na.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return S(e,"bpmn:DataObject")?LT(e,t):[]};function IT(e,t){return Tn(t,function(n,i){return n[i]=e.get(i),n},{})}function Wv(e,t){F(t,function(n,i){e.set(i,n)})}function LT(e,t){return t.filter(function(n){return S(n,"bpmn:DataObjectReference")&&ie(n).dataObjectRef===e})}var $a="default",Vi="id",Uv="di",BT={width:0,height:0};function Fa(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}Fa.$inject=["elementRegistry","moddle","modeling","textRenderer"],Fa.prototype.execute=function(e){var t=e.element,n=[t];if(!t)throw new Error("element required");var i=this._elementRegistry,r=this._moddle.ids,o=t.businessObject,a=HT(e.properties),s=e.oldProperties||NT(t,a);return Yv(a,o)&&(r.unclaim(o[Vi]),i.updateId(t,a[Vi]),r.claim(a[Vi],o)),$a in a&&(a[$a]&&n.push(i.get(a[$a].id)),o[$a]&&n.push(i.get(o[$a].id))),qv(t,a),e.oldProperties=s,e.changed=n,n},Fa.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&ie(n).name;if(i){var r=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,r,BT)}},Fa.prototype.revert=function(e){var t=e.element,n=e.properties,i=e.oldProperties,r=t.businessObject,o=this._elementRegistry,a=this._moddle.ids;return qv(t,i),Yv(n,r)&&(a.unclaim(n[Vi]),o.updateId(t,i[Vi]),a.claim(i[Vi],r)),e.changed};function Yv(e,t){return Vi in e&&e[Vi]!==t[Vi]}function NT(e,t){var n=ds(t),i=e.businessObject,r=ot(e);return Tn(n,function(o,a){return a!==Uv?o[a]=i.get(a):o[a]=$T(r,ds(t.di)),o},{})}function $T(e,t){return Tn(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function qv(e,t){var n=e.businessObject,i=ot(e);F(t,function(r,o){o!==Uv?n.set(o,r):i&&FT(i,r)})}function FT(e,t){F(t,function(n,i){e.set(i,n)})}var jT=["default"];function HT(e){var t=W({},e);return jT.forEach(function(n){n in e&&(t[n]=ie(t[n]))}),t}function Wc(e,t){this._canvas=e,this._modeling=t}Wc.$inject=["canvas","modeling"],Wc.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=ot(r);return t.setRootElement(n),t.removeRootElement(r),Bt(a.rootElements,i),i.$parent=a,Lt(a.rootElements,o),o.$parent=null,r.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=r,[]},Wc.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,a=i.$parent,s=ot(n);return t.setRootElement(r),t.removeRootElement(n),Lt(a.rootElements,i),i.$parent=null,Bt(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,r.di=s,[]};function bf(e,t){this._modeling=e,this._spaceTool=t}bf.$inject=["modeling","spaceTool"],bf.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=ei(i),a=o===i,s=a?i:i.parent,c=lr(s),l=tn(i);if(l?r==="left"?r="top":r==="right"&&(r="bottom"):r==="top"?r="left":r==="bottom"&&(r="right"),!c.length){var u=l?{x:i.x+Jn,y:i.y,width:i.width-Jn,height:i.height}:{x:i.x,y:i.y+Jn,width:i.width,height:i.height-Jn};n.createShape({type:"bpmn:Lane",isHorizontal:l},u,s)}var f=[];Nr(o,function(x){return f.push(x),x.label&&f.push(x.label),x===i?[]:Ke(x.children,function(C){return C!==i})});var p,d,m,h,y;r==="top"?(p=-120,d=i.y,m=d+10,h="n",y="y"):r==="left"?(p=-120,d=i.x,m=d+10,h="w",y="x"):r==="bottom"?(p=120,d=i.y+i.height,m=d-10,h="s",y="y"):r==="right"&&(p=120,d=i.x+i.width,m=d-10,h="e",y="x");var v=t.calculateAdjustments(f,y,p,m),g=l?{x:0,y:p}:{x:p,y:0};t.makeSpace(v.movingShapes,v.resizingShapes,g,h,m);var b=l?{x:i.x+(a?Jn:0),y:d-(r==="top"?120:0),width:i.width-(a?Jn:0),height:120}:{x:d-(r==="left"?120:0),y:i.y+(a?Jn:0),width:120,height:i.height-(a?Jn:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:l},b,s)};function xf(e){this._modeling=e}xf.$inject=["modeling"],xf.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=lr(n),o=r.length;if(o>i)throw new Error(`more than <${i}> child lanes`);var a=tn(n),s=a?n.height:n.width,c=Math.round(s/i),l,u,f,p;for(p=0;p<i;p++)p===i-1?l=s-c*p:l=c,u=a?{x:n.x+Jn,y:n.y+p*c,width:n.width-Jn,height:l}:{x:n.x+p*c,y:n.y+Jn,width:l,height:n.height-Jn},p<o?t.resizeShape(r[p],u):(f={type:"bpmn:Lane",isHorizontal:a},t.createShape(f,u,n))};function ja(e,t){this._modeling=e,this._spaceTool=t}ja.$inject=["modeling","spaceTool"],ja.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},ja.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=LA(e,t);n.resizeShape(e,t),i.forEach(function(r){n.resizeShape(r.shape,r.newBounds)})},ja.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=Ie(e),r=Ie(t),o=Cg(r,i),a=ei(e),s=[],c=[];Nr(a,function(m){return s.push(m),(S(m,"bpmn:Lane")||S(m,"bpmn:Participant"))&&c.push(m),m.children});var l,u,f,p,d;(o.bottom||o.top)&&(l=o.bottom||o.top,u=e.y+(o.bottom?e.height:0)+(o.bottom?-10:10),f=o.bottom?"s":"n",p=o.top>0||o.bottom<0?-l:l,d=n.calculateAdjustments(s,"y",p,u),n.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:l},f)),(o.left||o.right)&&(l=o.right||o.left,u=e.x+(o.right?e.width:0)+(o.right?-10:100),f=o.right?"e":"w",p=o.left>0||o.right<0?-l:l,d=n.calculateAdjustments(c,"x",p,u),n.makeSpace(d.movingShapes,d.resizingShapes,{x:l,y:0},f))};var Ha="flowNodeRef",_f="lanes";function Uc(){}Uc.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},o=[];function a(u,f){var p=Ie(f),d={x:u.x+u.width/2,y:u.y+u.height/2};return d.x>p.left&&d.x<p.right&&d.y>p.top&&d.y<p.bottom}function s(u){n.indexOf(u)===-1&&(o.push(u),n.push(u))}function c(u){var f=ei(u);return r[f.id]||(r[f.id]=lc(f)),r[f.id]}function l(u){if(!u.parent)return[];var f=c(u);return f.filter(function(p){return a(u,p)}).map(function(p){return p.businessObject})}return t.forEach(function(u){var f=ei(u);if(!(!f||n.indexOf(f)!==-1)){var p=f.children.filter(function(d){return S(d,"bpmn:FlowNode")});p.forEach(s),n.push(f)}}),e.forEach(s),o.forEach(function(u){var f=u.businessObject,p=f.get(_f),d=p.slice(),m=l(u);i.push({flowNode:f,remove:d,add:m})}),t.forEach(function(u){var f=u.businessObject;u.parent||f.get(Ha).forEach(function(p){i.push({flowNode:p,remove:[f],add:[]})})}),i},Uc.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.flowNodeShapes,e.laneShapes)),t.forEach(function(n){var i=n.flowNode,r=i.get(_f);n.remove.forEach(function(o){Lt(r,o),Lt(o.get(Ha),i)}),n.add.forEach(function(o){Bt(r,o),Bt(o.get(Ha),i)})}),[]},Uc.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,r=i.get(_f);n.add.forEach(function(o){Lt(r,o),Lt(o.get(Ha),i)}),n.remove.forEach(function(o){Bt(r,o),Bt(o.get(Ha),i)})}),[]};var wf="categoryValueRef";function za(e,t){this._bpmnFactory=e,this._elementRegistry=t}za.$inject=["bpmnFactory","elementRegistry"],za.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,r=new Map,o=[],a=new Map;function s(g,b,x){if(b){var C=a.get(g);C||(C={},a.set(g,C)),!(x&&C.present)&&(!x&&C.past||(x?C.present={categoryValue:b,root:Ef(g)}:C.past={categoryValue:b}))}}function c(g){r.set(g,ie(g))}function l(){n.filter(function(g){return S(g,"bpmn:FlowElement")&&!Ye(g)&&g.parent}).forEach(c)}function u(g){var b=ie(g),x=b.get("categoryValueRef");return x||(x=_g(i,b),o.push(zT(g,x))),x}function f(g){return g.reduce(function(b,x){var C=Ef(x),M=b.get(C);return M||(M=[],b.set(C,M)),M.push(x),b},new Map)}e=Array.from(e||[]);var p=f(e);t.length&&l(),e.forEach(c),n.filter(function(g){return S(g,"bpmn:Group")&&!Ye(g)&&g.parent}).forEach(function(g){var b=ie(g).get("categoryValueRef");if(!b){var x=Ef(g),C=p.get(x)||[],M=bo(C,g),k=Object.keys(M).length>0;k&&(b=u(g))}s(g,b,!0)}),t.forEach(function(g){s(g.groupShape,g.categoryValue,!1)}),o.length&&l();var d=Array.from(r.keys()),m=Array.from(a.values()).reduce(function(g,b){return b.present&&g.add(b.present.categoryValue),b.past&&g.add(b.past.categoryValue),g},new Set),h=new Map,y=f(d);a.forEach(function(g,b){var x=g.present;if(x){var C=y.get(x.root)||[],M=bo(C,b);C.forEach(function(k){if(M[k.id]){var P=h.get(k);P||(P=new Set,h.set(k,P)),P.add(x.categoryValue)}})}});var v=d.reduce(function(g,b){var x=r.get(b),C=x.get(wf),M=new Set(C),k=h.get(b)||new Set,P=Array.from(k).filter(function(D){return!M.has(D)}),B=C.filter(function(D){return m.has(D)&&!k.has(D)});return(P.length||B.length)&&g.push({businessObject:x,categoryValuesToAdd:P,categoryValuesToRemove:B}),g},[]);return{flowElements:v,groups:o}},za.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),GT(t.groups),WT(t.flowElements),[]},za.prototype.revert=function(e){var t=e.updates;return UT(t.flowElements),VT(t.groups),[]};function zT(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function GT(e){e.forEach(function(t){ie(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function VT(e){e.forEach(function(t){ie(t.groupShape).categoryValueRef=null})}function WT(e){e.forEach(function(t){var n=t.businessObject,i=n.get(wf);t.categoryValuesToRemove.forEach(function(r){Lt(i,r)}),t.categoryValuesToAdd.forEach(function(r){Bt(i,r,!0)})})}function UT(e){e.forEach(function(t){var n=t.businessObject,i=n.get(wf);t.categoryValuesToAdd.forEach(function(r){Lt(i,r)}),t.categoryValuesToRemove.forEach(function(r){Bt(i,r,!0)})})}function Ef(e){for(;e.parent;)e=e.parent;return e}function Yc(e){this._moddle=e}Yc.$inject=["moddle"],Yc.prototype.execute=function(e){var t=this._moddle.ids,n=e.id,i=e.element,r=e.claiming;return r?t.claim(n,i):t.unclaim(n),[]},Yc.prototype.revert=function(e){var t=this._moddle.ids,n=e.id,i=e.element,r=e.claiming;return r?t.unclaim(n):t.claim(n,i),[]};var YT={fill:void 0,stroke:void 0};function Sf(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(Pn(t)){var n=qT(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}Sf.$inject=["commandStack"],Sf.prototype.postExecute=function(e){var t=e.elements,n=e.colors||YT,i=this,r={};"fill"in n&&W(r,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&W(r,{"border-color":this._normalizeColor(n.stroke)}),F(t,function(o){var a=ht(o)?li(r,["border-color"]):r,s=ot(o);if(KT(a),Ye(o)){if(!s||!S(s.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:o,moddleElement:s.label,properties:{color:r["border-color"]}})}else{if(!qe(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:o,properties:{di:a}})}})};function qT(e){var t=document.createElement("canvas").getContext("2d");return t.fillStyle="transparent",t.fillStyle=e,/^#[0-9a-fA-F]{6}$/.test(t.fillStyle)?t.fillStyle:null}function KT(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var XT={width:0,height:0};function Kv(e,t,n){function i(c,l){var u=c.label||c,f=c.labelTarget||c;return SC(u,l),[u,f]}function r(c){var l=c.element,u=l.businessObject,f=c.newLabel;if(!Ye(l)&&sr(l)&&!Xs(l)&&!Xv(f)){var p=7,d=Yu(l);d={x:d.x,y:d.y+p},e.createLabel(l,d,{id:u.id+"_label",businessObject:u,di:l.di})}}function o(c){return c.oldLabel=qn(c.element),i(c.element,c.newLabel)}function a(c){return i(c.element,c.oldLabel)}function s(c){var l=c.element,u=l.label||l,f=c.newLabel,p=c.newBounds,d=c.hints||{};if(!(!Ye(u)&&!S(u,"bpmn:TextAnnotation"))){if(Ye(u)&&Xv(f)){d.removeShape!==!1&&e.removeShape(u,{unsetLabel:!1});return}var m=qn(l);typeof p>"u"&&(p=t.getExternalLabelBounds(u,m)),p&&e.resizeShape(u,p,XT)}}this.preExecute=r,this.execute=o,this.revert=a,this.postExecute=s}Kv.$inject=["modeling","textRenderer","bpmnFactory"];function Xv(e){return!e||!e.trim()}function pn(e,t,n,i){mt.call(this,e,t,n),this._bpmnRules=i}Ee(pn,mt),pn.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],pn.prototype.getHandlers=function(){var e=mt.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=Na,e["element.updateProperties"]=Fa,e["canvas.updateRoot"]=Wc,e["lane.add"]=bf,e["lane.resize"]=ja,e["lane.split"]=xf,e["lane.updateRefs"]=Uc,e["group.updateRefs"]=za,e["id.updateClaim"]=Yc,e["element.setColor"]=Sf,e["element.updateLabel"]=Kv,e},pn.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},pn.prototype.connect=function(e,t,n,i){var r=this._bpmnRules;if(n||(n=r.canConnect(e,t)),!!n)return this.createConnection(e,t,n,e.parent,i)},pn.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},pn.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},pn.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},pn.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},pn.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},pn.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},pn.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},pn.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},pn.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},pn.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},pn.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},pn.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function Zv(){}Zv.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||Ne(t.source||e.source),t.connectionEnd||Ne(t.target||e.target)]};var qc=20,ZT=5,Kc=Math.round,Qv=20,QT={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function JT(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function e2(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function Jv(e,t,n){var i=cn(t,e,ZT),r=n.split(":")[0],o=Kc((t.x-e.x)/2+e.x),a=Kc((t.y-e.y)/2+e.y),s,c,l=e2(r,i),u=/h|r|l/.test(r),f=!1,p=!1;return l?(s=u?{x:o,y:e.y}:{x:e.x,y:a},c=u?"h:h":"v:v"):(f=JT(i,r),c=u?"h:v":"v:h",f?u?(p=a===e.y,s={x:e.x+qc*(/l/.test(r)?-1:1),y:p?a+qc:a}):(p=o===e.x,s={x:p?o+qc:o,y:e.y+qc*(/t/.test(r)?-1:1)}):s={x:o,y:a}),{waypoints:Rf(e,s,c).concat(s),directions:c,turnNextDirections:p}}function t2(e,t,n){return Jv(e,t,n)}function n2(e,t,n){var i=Jv(t,e,eb(n));return{waypoints:i.waypoints.slice().reverse(),directions:eb(i.directions),turnNextDirections:i.turnNextDirections}}function i2(e,t){var n=e.directions.split(":")[1],i=t.directions.split(":")[0];e.turnNextDirections&&(n=n=="h"?"v":"h"),t.turnNextDirections&&(i=i=="h"?"v":"h");var r=n+":"+i,o=Rf(e.waypoints[e.waypoints.length-1],t.waypoints[0],r);return{waypoints:o,directions:r}}function eb(e){return e.split(":").reverse().join(":")}function r2(e,t,n){var i=Kc((t.x-e.x)/2+e.x),r=Kc((t.y-e.y)/2+e.y);if(n==="h:v")return[{x:t.x,y:e.y}];if(n==="v:h")return[{x:e.x,y:t.y}];if(n==="h:h")return[{x:i,y:e.y},{x:i,y:t.y}];if(n==="v:v")return[{x:e.x,y:r},{x:t.x,y:r}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}function Rf(e,t,n){if(n=n||"h:h",!d2(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(nb(n)){var i=t2(e,t,n),r=n2(e,t,n),o=i2(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return r2(e,t,n)}function o2(e,t,n){var i=Rf(e,t,n);return i.unshift(e),i.push(t),rb(i)}function a2(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=O0(o,"straight")[0]||"h:h",s=QT[a]||0,c=cn(e,t,s),l=f2(c,a);n=n||Ne(e),i=i||Ne(t);var u=l.split(":"),f=ib(n,e,u[0],h2(c)),p=ib(i,t,u[1],c);return o2(f,p,l)}function s2(e,t,n,i,r,o){Be(n)&&(r=n,o=i,n=Ne(e),i=Ne(t)),o=W({preferredLayouts:[]},o),r=r||[];var a=o.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&l2(e,t,n,i,o),c||(c=o.connectionEnd&&p2(t,e,i,r),c)||(c=o.connectionStart&&u2(e,t,n,r),c)?c:!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:a2(e,t,n,i,o)}function c2(e,t,n){return e>=t&&e<=n}function tb(e,t,n){var i={x:"width",y:"height"};return c2(t[e],n[e],n[e]+n[i[e]])}function l2(e,t,n,i,r){var o={},a,s;return s=cn(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),r.preserveDocking==="target"?tb(a,i,e)?(o[a]=i[a],[{x:o.x!==void 0?o.x:n.x,y:o.y!==void 0?o.y:n.y,original:{x:o.x!==void 0?o.x:n.x,y:o.y!==void 0?o.y:n.y}},{x:i.x,y:i.y}]):null:tb(a,n,t)?(o[a]=n[a],[{x:n.x,y:n.y},{x:o.x!==void 0?o.x:i.x,y:o.y!==void 0?o.y:i.y,original:{x:o.x!==void 0?o.x:i.x,y:o.y!==void 0?o.y:i.y}}]):null):null}function u2(e,t,n,i){return Cf(e,t,n,i)}function p2(e,t,n,i){var r=i.slice().reverse();return r=Cf(e,t,n,r),r?r.reverse():null}function Cf(e,t,n,i){function r(u){return u.length<3?!0:u.length>4?!1:!!vt(u,function(f,p){var d=u[p-1];return d&&fa(f,d)<3})}function o(u,f,p){var d=Li(f,u);switch(d){case"v":return{x:p.x,y:u.y};case"h":return{x:u.x,y:p.y}}return{x:u.x,y:u.y}}function a(u,f,p){var d;for(d=u.length-2;d!==0;d--)if(Am(u[d],f,Qv)||Am(u[d],p,Qv))return u.slice(d);return u}if(r(i))return null;var s=i[0],c=i.slice(),l;return c[0]=n,c[1]=o(c[1],s,n),l=a(c,e,t),l!==c&&(c=Cf(e,t,n,l)),c&&Li(c)?null:c}function f2(e,t){if(nb(t))return t;switch(e){case"intersect":return"t:t";case"top":case"bottom":return"v:v";case"left":case"right":return"h:h";default:return t}}function d2(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function nb(e){return e&&/t|r|b|l/.test(e)}function h2(e){return{top:"bottom",bottom:"top",left:"right",right:"left","top-left":"bottom-right","bottom-right":"top-left","top-right":"bottom-left","bottom-left":"top-right"}[e]}function ib(e,t,n,i){if(n==="h"&&(n=/left/.test(i)?"l":"r"),n==="v"&&(n=/top/.test(i)?"t":"b"),n==="t")return{original:e,x:e.x,y:t.y};if(n==="r")return{original:e,x:t.x+t.width,y:e.y};if(n==="b")return{original:e,x:e.x,y:t.y+t.height};if(n==="l")return{original:e,x:t.x,y:e.y};throw new Error("unexpected dockingDirection: <"+n+">")}function rb(e){return e.reduce(function(t,n,i){var r=t[t.length-1],o=e[i+1];return zu(r,o,n,0)||t.push(n),t},[])}var m2=-10,g2=40,y2={default:["h:h"],fromGateway:["v:h"],toGateway:["h:v"],loop:{fromTop:["t:r"],fromRight:["r:b"],fromLeft:["l:t"],fromBottom:["b:l"]},boundaryLoop:{alternateHorizontalSide:"b",alternateVerticalSide:"l",default:"v"},messageFlow:["straight","v:v"],subProcess:["straight","h:h"],isHorizontal:!0},v2={default:["v:v"],fromGateway:["h:v"],toGateway:["v:h"],loop:{fromTop:["t:l"],fromRight:["r:t"],fromLeft:["l:b"],fromBottom:["b:r"]},boundaryLoop:{alternateHorizontalSide:"t",alternateVerticalSide:"r",default:"h"},messageFlow:["straight","h:h"],subProcess:["straight","v:v"],isHorizontal:!1},Af={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},Ga={top:"t",right:"r",bottom:"b",left:"l"};function Xc(e){this._elementRegistry=e}Ee(Xc,Zv),Xc.prototype.layoutConnection=function(e,t){t||(t={});var n=t.source||e.source,i=t.target||e.target,r=t.waypoints||e.waypoints,o=t.connectionStart,a=t.connectionEnd,s=this._elementRegistry,c,l;if(o||(o=ob(r&&r[0],n)),a||(a=ob(r&&r[r.length-1],i)),(S(e,"bpmn:Association")||S(e,"bpmn:DataAssociation"))&&r&&!ab(n,i))return[].concat([o],r.slice(1,-1),[a]);var u=yg(n,s)?y2:v2;return S(e,"bpmn:MessageFlow")?c=x2(n,i,u):(S(e,"bpmn:SequenceFlow")||ab(n,i))&&(n===i?c={preferredLayouts:C2(n,e,u)}:S(n,"bpmn:BoundaryEvent")?c={preferredLayouts:A2(n,i,a,u)}:Va(n)||Va(i)?c={preferredLayouts:u.subProcess,preserveDocking:w2(n)}:S(n,"bpmn:Gateway")?c={preferredLayouts:u.fromGateway}:S(i,"bpmn:Gateway")?c={preferredLayouts:u.toGateway}:c={preferredLayouts:u.default}),c&&(c=W(c,t),l=rb(s2(n,i,o,a,r,c))),l||[o,a]};function b2(e){var t=e.host;return cn(Ne(e),t,m2)}function x2(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:_2(e,t)}}function _2(e,t){return S(t,"bpmn:Participant")?"source":S(e,"bpmn:Participant")?"target":Va(t)?"source":Va(e)||S(t,"bpmn:Event")?"target":S(e,"bpmn:Event")?"source":null}function w2(e){return Va(e)?"target":"source"}function ob(e,t){return e?e.original||e:Ne(t)}function ab(e,t){return S(t,"bpmn:Activity")&&S(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function Va(e){return S(e,"bpmn:SubProcess")&&Qe(e)}function Ur(e,t){return e===t}function E2(e,t){return t.indexOf(e)!==-1}function $o(e){var t=/right|left/.exec(e);return t&&t[0]}function Fo(e){var t=/top|bottom/.exec(e);return t&&t[0]}function sb(e,t){return Af[e]===t}function S2(e,t){var n=$o(e),i=Af[n];return t.indexOf(i)!==-1}function R2(e,t){var n=Fo(e),i=Af[n];return t.indexOf(i)!==-1}function cb(e){return e==="right"||e==="left"}function C2(e,t,n){var i=t.waypoints,r=i&&i.length&&cn(i[0],e);return r==="top"?n.loop.fromTop:r==="right"?n.loop.fromRight:r==="left"?n.loop.fromLeft:n.loop.fromBottom}function A2(e,t,n,i){var r=Ne(e),o=Ne(t),a=b2(e),s,c,l=Ur(e.host,t),u=E2(a,["top","right","bottom","left"]),f=cn(o,r,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return l?P2(a,u,e,t,n,i):(s=M2(a,f,u,i.isHorizontal),c=T2(a,f,u,i.isHorizontal),[s+":"+c])}function P2(e,t,n,i,r,o){var a=t?e:o.isHorizontal?Fo(e):$o(e),s=Ga[a],c;return t?cb(e)?c=lb("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:c=lb("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function lb(e,t,n,i){var r=g2;return!(Pf(e,i,n,r)||Pf(e,i,{x:n.x+n.width,y:n.y+n.height},r)||Pf(e,i,Ne(t),r))}function Pf(e,t,n,i){return Math.abs(t[e]-n[e])<i}function M2(e,t,n,i){if(n)return Ga[e];var r=Fo(e),o=$o(e),a=Fo(t),s=$o(t);if(i){if(Ur(r,a)||sb(o,s))return Ga[r]}else if(Ur(o,s)||sb(r,a))return Ga[o];return Ga[i?o:r]}function T2(e,t,n,i){if(n)return cb(e)?S2(e,t)||Ur(e,t)?"h":"v":R2(e,t)||Ur(e,t)?"v":"h";var r=Fo(e),o=$o(e),a=Fo(t),s=$o(t);return a&&!s?"v":s&&!a?"h":i?Ur(r,a)?"h":"v":Ur(o,s)?"v":"h"}Xc.$inject=["elementRegistry"];function ub(e){return W({original:e.point.original||e.point},e.actual)}function vr(e,t){this._elementRegistry=e,this._graphicsFactory=t}vr.$inject=["elementRegistry","graphicsFactory"],vr.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var i=this.getDockingPoint(e,t,!0),r=this.getDockingPoint(e,n),o=e.waypoints.slice(i.idx+1,r.idx);return o.unshift(ub(i)),o.push(ub(r)),o},vr.prototype.getDockingPoint=function(e,t,n){var i=e.waypoints,r,o,a;return r=n?0:i.length-1,o=i[r],a=this._getIntersection(t,e,n),{point:o,actual:a||o,idx:r}},vr.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return da(i,r,n)},vr.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},vr.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},vr.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const Mf={__init__:["modeling","bpmnUpdater"],__depends__:[KP,pM,dM,hM,wv,mT,yT,ET,ni,ff,Pv],bpmnFactory:["type",ri],bpmnUpdater:["type",Nn],elementFactory:["type",mr],modeling:["type",pn],layouter:["type",Xc],connectionDocking:["type",vr]};var k2=10,pb=50,O2=250;function Tf(e,t,n,i){for(var r;r=D2(e,n,t);)n=i(t,n,r);return n}function kf(e){return function(t,n,i){var r={x:n.x,y:n.y};return["x","y"].forEach(function(o){var a=e[o];if(a){var s=o==="x"?"width":"height",c=a.margin,l=a.minDistance;c<0?r[o]=Math.min(i[o]+c-t[s]/2,n[o]-l+c):r[o]=Math.max(i[o]+i[s]+c+t[s]/2,n[o]+l+c)}}),r}}function D2(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=L2(e);return vt(r,function(o){if(o===n)return!1;var a=cn(o,i,k2);return a==="intersect"})}function I2(e,t){t||(t={});function n(m){return m.source===e?1:-1}var i=t.defaultDistance||pb,r=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||O2,c=t.reference||"start";o||(o=$2);function l(m,h){return r==="n"?c==="start"?Ie(m).top-Ie(h).bottom:c==="center"?Ie(m).top-Ne(h).y:Ie(m).top-Ie(h).top:r==="w"?c==="start"?Ie(m).left-Ie(h).right:c==="center"?Ie(m).left-Ne(h).x:Ie(m).left-Ie(h).left:r==="s"?c==="start"?Ie(h).top-Ie(m).bottom:c==="center"?Ne(h).y-Ie(m).bottom:Ie(h).bottom-Ie(m).bottom:c==="start"?Ie(h).left-Ie(m).right:c==="center"?Ne(h).x-Ie(m).right:Ie(h).right-Ie(m).right}var u=e.incoming.filter(o).map(function(m){var h=a(m),y=h<0?l(m.source,e):l(e,m.source);return{id:m.source.id,distance:y,weight:h}}),f=e.outgoing.filter(o).map(function(m){var h=a(m),y=h>0?l(e,m.target):l(m.target,e);return{id:m.target.id,distance:y,weight:h}}),p=u.concat(f).reduce(function(m,h){return m[h.id+"__weight_"+h.weight]=h,m},{}),d=Tn(p,function(m,h){var y=h.distance,v=h.weight;return y<0||y>s||(m[String(y)]||(m[String(y)]=0),m[String(y)]+=1*v,(!m.distance||m[m.distance]<m[String(y)])&&(m.distance=y)),m},{});return d.distance||i}function L2(e){var t=Of(e);return e.host&&(t=t.concat(Of(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(Of(i))},[]))),t}function Of(e){return N2(e).concat(B2(e))}function B2(e){return e.incoming.map(function(t){return t.source})}function N2(e){return e.outgoing.map(function(t){return t.target})}function $2(){return!0}var F2=100;function fb(e,t,n){e.on("autoPlace",F2,function(i){var r=i.shape,o=i.source;return j2(o,r)}),e.on("autoPlace.end",function(i){n.scrollToElement(i.shape)}),this.append=function(i,r,o){e.fire("autoPlace.start",{source:i,shape:r});var a=e.fire("autoPlace",{source:i,shape:r}),s=t.appendShape(i,r,a,i.parent,o);return e.fire("autoPlace.end",{source:i,shape:s}),s}}fb.$inject=["eventBus","modeling","canvas"];function j2(e,t,n){n||(n={});var i=n.defaultDistance||pb,r=Ne(e),o=Ie(e);return{x:o.right+i+t.width/2,y:r.y}}function db(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}db.$inject=["eventBus","selection"];const H2={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",fb],autoPlaceSelectionBehavior:["type",db]};function hb(e,t,n){var i=yg(e,n);if(S(t,"bpmn:TextAnnotation"))return G2(e,t,i);if(qe(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return V2(e,t,i);if(S(t,"bpmn:FlowNode"))return z2(e,t,i)}function z2(e,t,n){var i=Ie(e),r=Ne(e),o=n?{directionHint:"e",minDistance:80,baseOrientation:"left",boundaryOrientation:"top",start:"top",end:"bottom"}:{directionHint:"s",minDistance:90,baseOrientation:"top",boundaryOrientation:"left",start:"left",end:"right"},a=I2(e,{filter:function(d){return S(d,"bpmn:SequenceFlow")},direction:o.directionHint}),s=30,c=o.minDistance,l=o.baseOrientation;S(e,"bpmn:BoundaryEvent")&&(l=cn(e,e.host,-25),l.indexOf(o.boundaryOrientation)!==-1&&(s*=-1));var u=n?{x:i.right+a+t.width/2,y:r.y+mb(l,c,o)}:{x:r.x+mb(l,c,o),y:i.bottom+a+t.height/2},f={margin:s,minDistance:c},p=n?{y:f}:{x:f};return Tf(e,t,u,kf(p))}function mb(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function G2(e,t,n){var i=Ie(e),r=n?{x:i.right+t.width/2,y:i.top-50-t.height/2}:{x:i.right+50+t.width/2,y:i.bottom+t.height/2};ht(e)&&(r=Ne(e),n?(r.x+=100,r.y-=50):(r.x+=100,r.y+=50));var o={margin:n?-30:30,minDistance:20},a=n?{y:o}:{x:o};return Tf(e,t,r,kf(a))}function V2(e,t,n){var i=Ie(e),r=n?{x:i.right-10+t.width/2,y:i.bottom+40+t.width/2}:{x:i.left-40-t.width/2,y:i.bottom-10+t.height/2},o={margin:30,minDistance:30},a=n?{x:o}:{y:o};return Tf(e,t,r,kf(a))}function gb(e,t){e.on("autoPlace",function(n){var i=n.shape,r=n.source;return hb(r,i,t)})}gb.$inject=["eventBus","elementRegistry"];const Zc={__depends__:[H2],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",gb]},yb=[mg,ba,Mf,Zc];function W2(e={}){rh(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new wo({container:t,moddleExtensions:e.moddleExtensions??xs,additionalModules:[...yb,...e.additionalModules??[]]})}const vb={"edge-crosses-shape":"연결","edge-crosses-subprocess":"연결","edge-endpoint-detached":"연결","edge-overlap-opposite":"겹침","edge-overlap-mixed":"겹침","edge-overlap-unrelated":"겹침","shape-overlap":"겹침","shape-outside-container":"소속","label-on-shared-segment":"라벨","label-over-line":"라벨","annotation-over-label":"라벨","pool-name-over-label":"라벨","group-overlap-unintended":"그룹","group-overlap-unreadable":"그룹","group-stack-unreadable":"그룹","group-on-container-boundary":"그룹","group-on-group-boundary":"그룹","group-cuts-shape":"그룹","pool-overlap":"풀","CHK-FLOW-1":"구조","CHK-POOL-1":"풀"},U2={이:["이","가"],을:["을","를"],와:["과","와"]};function Y2(e,t){const[n,i]=U2[t],r=e.at(-1)??"",o=r.charCodeAt(0);return o>=44032&&o<=55203?e+((o-44032)%28===0?i:n):r>="0"&&r<="9"?e+("013678".includes(r)?n:i):e+`${n}(${i})`}const q2={"bpmn:StartEvent":"시작 이벤트","bpmn:EndEvent":"종료 이벤트","bpmn:IntermediateCatchEvent":"중간 이벤트","bpmn:IntermediateThrowEvent":"중간 이벤트","bpmn:BoundaryEvent":"경계 이벤트","bpmn:Task":"작업","bpmn:UserTask":"작업","bpmn:ServiceTask":"작업","bpmn:SendTask":"작업","bpmn:ReceiveTask":"작업","bpmn:ManualTask":"작업","bpmn:ScriptTask":"작업","bpmn:BusinessRuleTask":"작업","bpmn:CallActivity":"작업","bpmn:SubProcess":"서브프로세스","bpmn:ExclusiveGateway":"게이트웨이","bpmn:ParallelGateway":"게이트웨이","bpmn:InclusiveGateway":"게이트웨이","bpmn:EventBasedGateway":"게이트웨이","bpmn:ComplexGateway":"게이트웨이","bpmn:Participant":"풀","bpmn:Lane":"레인","bpmn:TextAnnotation":"주석","bpmn:Group":"그룹","bpmn:DataStoreReference":"데이터 저장소","bpmn:DataObjectReference":"데이터 객체","bpmn:SequenceFlow":"연결선","bpmn:MessageFlow":"메시지 연결선","bpmn:Association":"연관선"},K2="요소";function Df(e){return(e&&q2[e.type])??K2}const bb=20;function X2(e){const t=e.replace(/\s+/g," ").trim();return t.length>bb?`${t.slice(0,bb)}…`:t}function Qc(e,t,n,i=""){const r=e(t),o=(r==null?void 0:r.name)===void 0?void 0:X2(r.name),a=o===void 0?i+Df(r):o,s=o===void 0?a:`「${o}」`;return n?s+Y2(a,n).slice(a.length):s}function Z2(e,t,n,i,r){const[o,a]=[e(t),e(n)],s=(o==null?void 0:o.name)===void 0&&(a==null?void 0:a.name)===void 0&&Df(o)===Df(a);return[Qc(e,t,i),Qc(e,n,r,s?"다른 ":"")]}function Q2(e){switch(e.kind){case"shape-overlap":return e.identical?"error":"warning";case"shape-outside-container":return"error";case"edge-endpoint-detached":return"error";case"pool-overlap":return e.contained?"error":"warning";case"group-cuts-shape":return"error";default:return"warning"}}function J2(e){switch(e.kind){case"edge-crosses-shape":return[e.edge,e.shape];case"edge-crosses-subprocess":return[e.edge,e.subProcess];case"edge-endpoint-detached":return[e.edge,e.shape];case"shape-overlap":return[...e.shapes];case"shape-outside-container":return[e.shape,e.container];case"edge-overlap-opposite":case"edge-overlap-mixed":case"edge-overlap-unrelated":return[...e.edges];case"label-on-shared-segment":return[e.edge,e.other];case"label-over-line":return[e.edge,e.line];case"annotation-over-label":return[e.annotation,e.label];case"group-overlap-unintended":return e.container?[e.container,...e.groups.filter(t=>t!==e.container)]:[...e.groups];case"group-overlap-unreadable":return e.reason==="orphan"?[...e.groups,...e.shapes]:[e.group,...e.shapes];case"group-stack-unreadable":return[...e.groups,...e.shapes];case"group-on-container-boundary":return[e.group,e.container];case"group-on-group-boundary":return[...e.groups];case"group-cuts-shape":return[e.group,e.shape];case"pool-name-over-label":return[e.pool,e.label];case"pool-overlap":return[...e.pools]}}const xb={top:"위",bottom:"아래",left:"왼쪽",right:"오른쪽"};function ek(e,t){const n=(r,o)=>Qc(t,r,o),i=(r,o,a,s)=>Z2(t,r,o,a,s);switch(e.kind){case"edge-crosses-shape":return`${n(e.edge,"이")} ${n(e.shape,"을")} 가로지릅니다.`;case"edge-crosses-subprocess":return`${n(e.edge,"이")} 서브프로세스 ${n(e.subProcess)} 안을 지나갑니다.`;case"edge-endpoint-detached":return`${n(e.edge)}의 끝이 ${n(e.shape)}에서 ${Math.round(e.distance)}px 떨어져 연결이 끊겨 보입니다.`;case"shape-overlap":{const[r,o]=i(e.shapes[0],e.shapes[1],"와","이");return e.identical?`${r} ${o} 완전히 같은 자리에 겹쳐 하나가 가려집니다.`:`${r} ${o} 겹칩니다.`}case"shape-outside-container":return`${n(e.shape,"이")} ${n(e.container)} 경계 밖에 놓여 다른 소속으로 읽힙니다.`;case"edge-overlap-opposite":{const[r,o]=i(e.edges[0],e.edges[1],"와","이");return`${r} ${o} 같은 선 위를 ${Math.round(e.length)}px 서로 반대 방향으로 흐릅니다.`}case"edge-overlap-mixed":{const[r,o]=i(e.edges[0],e.edges[1],"와","이");return`${r} ${o} 종류가 다른 선인데 ${Math.round(e.length)}px 겹쳐 흐릅니다.`}case"edge-overlap-unrelated":{const[r,o]=i(e.edges[0],e.edges[1],"와","이");return`${r} ${o} ${Math.round(e.length)}px 한 선처럼 겹쳐 흐르는데 만나는 지점이 없습니다.`}case"label-on-shared-segment":{const[r,o]=i(e.edge,e.other,void 0,"와");return`${r}의 라벨이 ${o} 공유하는 구간 위에 있어 어느 선의 것인지 모호합니다.`}case"label-over-line":return`${n(e.edge)}의 라벨을 선이 가로지릅니다.`;case"annotation-over-label":return`주석 ${n(e.annotation,"이")} ${n(e.label)}의 이름 라벨을 덮습니다.`;case"group-overlap-unintended":{if(e.container)return`${n(e.container,"이")} 다른 그룹을 통째로 덮습니다.`;const[r,o]=i(e.groups[0],e.groups[1],"와","이");return`${r} ${o} 공유 멤버 없이 겹쳐 의도인지 알 수 없습니다.`}case"group-overlap-unreadable":switch(e.reason){case"orphan":{const[r,o]=i(e.groups[0],e.groups[1],"와");return`${r} ${o}의 겹친 영역에 어느 그룹에도 속하지 않은 요소가 ${e.shapes.length}개 있습니다.`}case"minority":return`${n(e.group)} 상자 안에서 자기 멤버가 과반이 아닙니다(다른 요소 ${e.shapes.length}개).`;case"throughpass":return`${n(e.group)} 상자를 자기 멤버가 아닌 요소 ${e.shapes.length}개가 지나갑니다.`}case"group-stack-unreadable":return`그룹 ${e.groups.length}개가 겹쳐 쌓여 요소 ${e.shapes.length}개가 어느 단계인지 읽히지 않습니다.`;case"group-on-container-boundary":return`${n(e.group)} 테두리가 ${n(e.container)}의 ${xb[e.side]} 경계선과 겹쳐 흐릅니다.`;case"group-on-group-boundary":{const[r,o]=i(e.groups[0],e.groups[1],"와");return`${r} ${o}의 테두리가 같은 선 위에 겹칩니다.`}case"group-cuts-shape":return`${n(e.group)} 테두리가 ${n(e.shape)}의 ${xb[e.side]}을(를) ${Math.round(e.depth)}px 가릅니다.`;case"pool-name-over-label":return`${n(e.pool)}의 이름 밴드가 ${n(e.label)}의 라벨을 덮습니다.`;case"pool-overlap":{const[r,o]=i(e.pools[0],e.pools[1],"와","이");return e.contained?`${r} ${o} 중 하나가 다른 하나 안에 들어가 있습니다.`:`${r} ${o} 겹칩니다.`}}}function tk(e,t){switch(e.ruleId){case"CHK-FLOW-1":return`${Qc(t,e.targetRefs[0])}에 연결된 선이 하나도 없습니다 — 분기·합류가 없는 게이트웨이는 의미가 정해지지 않습니다.`;case"CHK-POOL-1":return`이 문서에 내용이 없는 풀 ${e.targetRefs.length}개가 펼친 형태로 그려져 있습니다 — 이 문서에서 내용을 그리지 않는 풀은 접힌 형태(블랙박스)가 의미에 맞습니다.`;default:return e.ruleId}}const _b="기타",If={error:0,warning:1,info:2};function wb(e,t){const n=[];for(const i of e.geometry)n.push({key:`g:${Rt(i)}`,source:"geometry",code:i.kind,severity:Q2(i),targetRefs:J2(i),category:vb[i.kind]??_b,message:ek(i,t)});for(const i of e.semantic)n.push({key:`s:${i.ruleId}|${i.targetRefs.join(",")}`,source:"semantic",code:i.ruleId,severity:i.severity,targetRefs:[...i.targetRefs],category:vb[i.ruleId]??_b,message:tk(i,t)});return n}function Eb(e){const t={error:0,warning:0,info:0};for(const n of e)t[n.severity]++;return t}function jo(e,t){return t!==void 0&&e.targetRefs.some(n=>t.has(n))}function Lf(e,t){if(t===void 0||e.length===0)return!1;const n=jo(e[0],t);return e.some(i=>jo(i,t)!==n)}function Sb(e,t){const n=Lf(e,t);return e.slice().sort((i,r)=>(n?Number(jo(r,t))-Number(jo(i,t)):0)||If[i.severity]-If[r.severity])}var nk=new Bo("ov"),ik=500;function on(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=nk,this._overlayDefaults=W({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=rk(n.getContainer()),this._init()}on.$inject=["config.overlays","eventBus","canvas","elementRegistry"],on.prototype.get=function(e){if(Pn(e)&&(e={id:e}),Pn(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?Ke(t.overlays,ao({type:e.type})):t.overlays.slice():[]}else return e.type?Ke(this._overlays,ao({type:e.type})):e.id?this._overlays[e.id]:null},on.prototype.add=function(e,t,n){if(Qt(t)&&(n=t,t=null),e.id||(e=this._elementRegistry.get(e)),!n.position)throw new Error("must specifiy overlay position");if(!n.html)throw new Error("must specifiy overlay html");if(!e)throw new Error("invalid element specified");var i=this._ids.next();return n=W({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},on.prototype.remove=function(e){var t=this.get(e)||[];Be(t)||(t=[t]);var n=this;F(t,function(i){var r=n._getOverlayContainer(i.element,!0);if(i&&(vi(i.html),vi(i.htmlContainer),delete i.htmlContainer,delete i.element,delete n._overlays[i.id]),r){var o=r.overlays.indexOf(i);o!==-1&&r.overlays.splice(o,1)}})},on.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},on.prototype.show=function(){Jc(this._overlayRoot)},on.prototype.hide=function(){Jc(this._overlayRoot,!1)},on.prototype.clear=function(){this._overlays={},this._overlayContainers=[],Ls(this._overlayRoot)},on.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=Ft(t);i=o.x,r=o.y}Rb(n,i,r),gn(e.html,"data-container-id",t.id)},on.prototype._updateOverlay=function(e){var t=e.position,n=e.htmlContainer,i=e.element,r=t.left,o=t.top;if(t.right!==void 0){var a;i.waypoints?a=Ft(i).width:a=i.width,r=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=Ft(i).height:s=i.height,o=t.bottom*-1+s}Rb(n,r||0,o||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},on.prototype._createOverlayContainer=function(e){var t=wt('<div class="djs-overlays" />');wn(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},on.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";Cb(this._overlayRoot,n)},on.prototype._getOverlayContainer=function(e,t){var n=vt(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},on.prototype._addOverlay=function(e){var t=e.id,n=e.element,i=e.html,r,o;i.get&&i.constructor.prototype.jquery&&(i=i.get(0)),Pn(i)&&(i=wt(i)),o=this._getOverlayContainer(n),r=wt('<div class="djs-overlay" data-overlay-id="'+t+'">'),wn(r,{position:"absolute"}),r.appendChild(i),e.type&&Ct(r).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();Jc(r,a===s),e.htmlContainer=r,o.overlays.push(e),o.html.appendChild(r),this._overlays[t]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},on.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,i=this._canvas.findRoot(e.element),r=n&&n.minZoom,o=n&&n.maxZoom,a=e.htmlContainer,s=this._canvas.getRootElement(),c=!0;(i!==s||n&&(Yt(r)&&r>t.scale||Yt(o)&&o<t.scale))&&(c=!1),Jc(a,c),this._updateOverlayScale(e,t)},on.prototype._updateOverlayScale=function(e,t){var n=e.scale,i,r,o=e.htmlContainer,a,s="";n!==!0&&(n===!1?(i=1,r=1):(i=n.min,r=n.max),Yt(i)&&t.scale<i&&(a=(1/t.scale||1)*i),Yt(r)&&t.scale>r&&(a=(1/t.scale||1)*r)),Yt(a)&&(s="scale("+a+","+a+")"),Cb(o,s)},on.prototype._updateOverlaysVisibilty=function(e){var t=this;F(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},on.prototype._init=function(){var e=this._eventBus,t=this;function n(i){t._updateRoot(i),t._updateOverlaysVisibilty(i),t.show()}e.on("canvas.viewbox.changing",function(i){t.hide()}),e.on("canvas.viewbox.changed",function(i){n(i.viewbox)}),e.on(["shape.remove","connection.remove"],function(i){var r=i.element,o=t.get({element:r});F(o,function(c){t.remove(c.id)});var a=t._getOverlayContainer(r);if(a){vi(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",ik,function(i){var r=i.element,o=t._getOverlayContainer(r,!0);o&&(F(o.overlays,function(a){t._updateOverlay(a)}),t._updateOverlayContainer(o))}),e.on("element.marker.update",function(i){var r=t._getOverlayContainer(i.element,!0);r&&Ct(r.html)[i.add?"add":"remove"](i.marker)}),e.on("root.set",function(){t._updateOverlaysVisibilty(t._canvas.viewbox())}),e.on("diagram.clear",this.clear,this)};function rk(e){var t=wt('<div class="djs-overlay-container" />');return wn(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function Rb(e,t,n){wn(e,{left:t+"px",top:n+"px"})}function Jc(e,t){e.style.display=t===!1?"none":""}function Cb(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const el={__init__:["overlays"],overlays:["type",on]};function Bf(e,t){t.invoke(te,this),this.executed(function(n){var i=n.context;i.rootElement?e.setRootElement(i.rootElement):i.rootElement=e.getRootElement()}),this.revert(function(n){var i=n.context;i.rootElement&&e.setRootElement(i.rootElement)})}Ee(Bf,te),Bf.$inject=["canvas","injector"];const ok={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",Bf]};function Wa(e){return CSS.escape(e)}var ak={"&":"&","<":"<",">":">",'"':""","'":"'"};function Ab(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return ak[t]})}var sk="bjs-breadcrumbs-shown";function Pb(e,t,n){var i=wt('<ul class="bjs-breadcrumbs"></ul>'),r=n.getContainer(),o=Ct(r);r.appendChild(i);var a=[];e.on("element.changed",function(c){var l=c.element,u=ie(l),f=vt(a,function(p){return p===u});f&&s()});function s(c){c&&(a=ck(c));var l=a.flatMap(function(f){var p=n.findRoot(Ei(f))||n.findRoot(f.id);if(!p&&S(f,"bpmn:Process")){var d=t.find(function(y){var v=ie(y);return v&&v.get("processRef")===f});p=d&&n.findRoot(d.id)}if(!p)return[];var m=Ab(f.name||f.id),h=wt('<li><span class="bjs-crumb"><a title="'+m+'">'+m+"</a></span></li>");return h.addEventListener("click",function(){n.setRootElement(p)}),h});i.innerHTML="";var u=l.length>1;o.toggle(sk,u),l.forEach(function(f){i.appendChild(f)})}e.on("root.set",function(c){s(c.element)})}Pb.$inject=["eventBus","elementRegistry","canvas"];function ck(e){for(var t=ie(e),n=[],i=t;i;i=i.$parent)(S(i,"bpmn:SubProcess")||S(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function Mb(e,t){var n=null,i=new lk;e.on("root.set",function(r){var o=r.element,a=t.viewbox(),s=i.get(o);if(i.set(n,{x:a.x,y:a.y,zoom:a.scale}),n=o,!(!S(o,"bpmn:SubProcess")&&!s)){s=s||{x:0,y:0,zoom:1};var c=(a.x-s.x)*a.scale,l=(a.y-s.y)*a.scale;(c!==0||l!==0)&&t.scroll({dx:c,dy:l}),s.zoom!==a.scale&&t.zoom(s.zoom,{x:0,y:0})}}),e.on("diagram.clear",function(){i.clear(),n=null})}Mb.$inject=["eventBus","canvas"];function lk(){this._entries=[],this.set=function(e,t){var n=!1;for(var i in this._entries)if(this._entries[i][0]===e){this._entries[i][1]=t,n=!0;break}n||this._entries.push([e,t])},this.get=function(e){for(var t in this._entries)if(this._entries[t][0]===e)return this._entries[t][1];return null},this.clear=function(){this._entries.length=0},this.remove=function(e){var t=-1;for(var n in this._entries)if(this._entries[n][0]===e){t=n;break}t!==-1&&this._entries.splice(t,1)}}var Tb={x:180,y:160};function Yr(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,r){n._handleImport(r.definitions)})}Yr.prototype._handleImport=function(e){if(e.diagrams){var t=this;this._definitions=e,this._processToDiagramMap={},e.diagrams.forEach(function(i){!i.plane||!i.plane.bpmnElement||(t._processToDiagramMap[i.plane.bpmnElement.id]=i)});var n=e.diagrams.filter(i=>i.plane).flatMap(i=>t._createNewDiagrams(i.plane));n.forEach(function(i){t._movePlaneElementsToOrigin(i.plane)})}},Yr.prototype._createNewDiagrams=function(e){var t=this,n=[],i=[];e.get("planeElement").forEach(function(o){var a=o.bpmnElement;if(a){var s=a.$parent;S(a,"bpmn:SubProcess")&&!o.isExpanded&&n.push(a),pk(a,e)&&i.push({diElement:o,parent:s})}});var r=[];return n.forEach(function(o){if(!t._processToDiagramMap[o.id]){var a=t._createDiagram(o);t._processToDiagramMap[o.id]=a,r.push(a)}}),i.forEach(function(o){for(var a=o.diElement,s=o.parent;s&&n.indexOf(s)===-1;)s=s.$parent;if(s){var c=t._processToDiagramMap[s.id];t._moveToDiPlane(a,c.plane)}}),r},Yr.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=uk(e),i={x:n.x-Tb.x,y:n.y-Tb.y};t.forEach(function(r){r.waypoint?r.waypoint.forEach(function(o){o.x=o.x-i.x,o.y=o.y-i.y}):r.bounds&&(r.bounds.x=r.bounds.x-i.x,r.bounds.y=r.bounds.y-i.y)})},Yr.prototype._moveToDiPlane=function(e,t){var n=kb(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},Yr.prototype._createDiagram=function(e){var t=this._moddle.create("bpmndi:BPMNPlane",{bpmnElement:e}),n=this._moddle.create("bpmndi:BPMNDiagram",{plane:t});return t.$parent=n,t.bpmnElement=e,n.$parent=this._definitions,this._definitions.diagrams.push(n),n},Yr.$inject=["eventBus","moddle"];function kb(e){return S(e,"bpmndi:BPMNDiagram")?e:kb(e.$parent)}function uk(e){var t={top:1/0,right:-1/0,bottom:-1/0,left:1/0};return e.planeElement.forEach(function(n){if(n.bounds){var i=Ie(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),Vs(t)}function pk(e,t){var n=e.$parent;return!(!S(n,"bpmn:SubProcess")||n===t.bpmnElement||qe(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var tl=250,fk='<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M4.81801948,3.50735931 L10.4996894,9.1896894 L10.5,4 L12,4 L12,12 L4,12 L4,10.5 L9.6896894,10.4996894 L3.75735931,4.56801948 C3.46446609,4.27512627 3.46446609,3.80025253 3.75735931,3.50735931 C4.05025253,3.21446609 4.52512627,3.21446609 4.81801948,3.50735931 Z"/></svg>',dk="bjs-drilldown-empty";function br(e,t,n,i,r){te.call(this,t),this._canvas=e,this._eventBus=t,this._elementRegistry=n,this._overlays=i,this._translate=r;var o=this;this.executed("shape.toggleCollapse",tl,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",tl,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],tl,function(a){var s=a.oldParent,c=a.newParent||a.parent,l=a.shape;o._canDrillDown(l)&&o._addOverlay(l),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(l)},!0),this.reverted(["shape.create","shape.move","shape.delete"],tl,function(a){var s=a.oldParent,c=a.newParent||a.parent,l=a.shape;o._canDrillDown(l)&&o._addOverlay(l),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(l)},!0),t.on("import.render.complete",function(){n.filter(function(a){return o._canDrillDown(a)}).map(function(a){o._addOverlay(a)})})}Ee(br,te),br.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},br.prototype._canDrillDown=function(e){var t=this._canvas;return S(e,"bpmn:SubProcess")&&t.findRoot(Ei(e))},br.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=ie(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var r=n&&n.get("flowElements")&&n.get("flowElements").length;Ct(i.html).toggle(dk,!r)}},br.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=ie(e),r=n.get({element:e,type:"drilldown"});r.length&&this._removeOverlay(e);var o=wt('<button type="button" class="bjs-drilldown">'+fk+"</button>"),a=i.get("name")||i.get("id"),s=this._translate("Open {element}",{element:a});o.setAttribute("title",s),o.addEventListener("click",function(){t.setRootElement(t.findRoot(Ei(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:o}),this._updateOverlayVisibility(e)},br.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},br.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const hk={__depends__:[el,ff,ok],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",Pb],drilldownCentering:["type",Mb],drilldownOverlayBehavior:["type",br],subprocessCompatibility:["type",Yr]};function xr(e){Pt.call(this,e)}Ee(xr,Pt),xr.prototype._modules=[mg,hk,el,ni,ba],xr.prototype._moddleExtensions={};var nl="keyboard.keydown",mk="keyboard.keyup",gk=1e3,Ob="Keyboard binding is now implicit; explicit binding to an element got removed. For more information, see https://github.com/bpmn-io/diagram-js/issues/661";function En(e,t){var n=this;this._config=e=e||{},this._eventBus=t,this._keydownHandler=this._keydownHandler.bind(this),this._keyupHandler=this._keyupHandler.bind(this),t.on("diagram.destroy",function(){n._fire("destroy"),n.unbind()}),e.bindTo&&console.error("unsupported configuration <keyboard.bindTo>",new Error(Ob));var i=e&&e.bind!==!1;t.on("canvas.init",function(r){n._target=r.svg,i&&n.bind(),n._fire("init")})}En.$inject=["config.keyboard","eventBus"],En.prototype._keydownHandler=function(e){this._keyHandler(e,nl)},En.prototype._keyupHandler=function(e){this._keyHandler(e,mk)},En.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||nl,i),n&&e.preventDefault()}},En.prototype._isEventIgnored=function(e){return!1},En.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(Ob)),this.unbind(),e=this._node=this._target,je.bind(e,"keydown",this._keydownHandler),je.bind(e,"keyup",this._keyupHandler),this._fire("bind")},En.prototype.getBinding=function(){return this._node},En.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),je.unbind(e,"keydown",this._keydownHandler),je.unbind(e,"keyup",this._keyupHandler)),this._node=null},En.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},En.prototype.addListener=function(e,t,n){Jt(e)&&(n=t,t=e,e=gk),this._eventBus.on(n||nl,e,t)},En.prototype.removeListener=function(e,t){this._eventBus.off(t||nl,e)},En.prototype.hasModifier=AM,En.prototype.isCmd=Ln,En.prototype.isShift=ef,En.prototype.isKey=Xt;var yk=500;function Ho(e,t){var n=this;e.on("editorActions.init",yk,function(i){var r=i.editorActions;n.registerBindings(t,r)})}Ho.$inject=["eventBus","keyboard"],Ho.prototype.registerBindings=function(e,t){function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("undo",function(i){var r=i.keyEvent;if(OM(r))return t.trigger("undo"),!0}),n("redo",function(i){var r=i.keyEvent;if(DM(r))return t.trigger("redo"),!0}),n("copy",function(i){var r=i.keyEvent;if(PM(r))return t.trigger("copy"),!0}),n("paste",function(i){var r=i.keyEvent;if(MM(r))return t.trigger("paste"),!0}),n("duplicate",function(i){var r=i.keyEvent;if(TM(r))return t.trigger("duplicate"),!0}),n("cut",function(i){var r=i.keyEvent;if(kM(r))return t.trigger("cut"),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(Xt(["+","Add","="],r)&&Ln(r))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(Xt(["-","Subtract"],r)&&Ln(r))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var r=i.keyEvent;if(Xt("0",r)&&Ln(r))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var r=i.keyEvent;if(Xt(["Backspace","Delete","Del"],r))return t.trigger("removeSelection"),!0})};const Nf={__init__:["keyboard","keyboardBindings"],keyboard:["type",En],keyboardBindings:["type",Ho]};var vk={moveSpeed:50,moveSpeedAccelerated:200};function Db(e,t,n){var i=this;this._config=W({},vk,e||{}),t.addListener(r);function r(o){var a=o.keyEvent,s=i._config;if(t.isCmd(a)&&t.isKey(["ArrowLeft","Left","ArrowUp","Up","ArrowDown","Down","ArrowRight","Right"],a)){var c=t.isShift(a)?s.moveSpeedAccelerated:s.moveSpeed,l;switch(a.key){case"ArrowLeft":case"Left":l="left";break;case"ArrowUp":case"Up":l="up";break;case"ArrowRight":case"Right":l="right";break;case"ArrowDown":case"Down":l="down";break}return i.moveCanvas({speed:c,direction:l}),!0}}this.moveCanvas=function(o){var a=0,s=0,c=o.speed,l=c/Math.min(Math.sqrt(n.viewbox().scale),1);switch(o.direction){case"left":a=l;break;case"up":s=l;break;case"right":a=-l;break;case"down":s=-l;break}n.scroll({dx:a,dy:s})}}Db.$inject=["config.keyboardMove","keyboard","canvas"];const Ib={__depends__:[Nf],__init__:["keyboardMove"],keyboardMove:["type",Db]};var bk=15;function Lb(e,t){var n;function i(s){return a(s.originalEvent)}e.on("canvas.focus.changed",function(s){s.focused?e.on("element.mousedown",500,i):e.off("element.mousedown",i)});function r(s){var c=n.start,l=n.button,u=Hr(s),f=pi(u,c);if(!n.dragging&&xk(f)>bk&&(n.dragging=!0,l===0&&tv(e),Pc("grab")),n.dragging){var p=n.last||n.start;f=pi(u,p),t.scroll({dx:f.x,dy:f.y}),n.last=u}s.preventDefault()}function o(s){je.unbind(document,"mousemove",r),je.unbind(document,"mouseup",o),n=null,ev()}function a(s){if(!Lr(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:Hr(s)},je.bind(document,"mousemove",r),je.bind(document,"mouseup",o),!0}}this.isActive=function(){return!!n}}Lb.$inject=["eventBus","canvas"];function xk(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const Bb={__init__:["moveCanvas"],moveCanvas:["type",Lb]};function Nb(e,t){var n=Zu(e.min),i=Zu(e.max),r=Math.abs(n)+Math.abs(i);return r/t}function _k(e,t){return Math.max(e.min,Math.min(e.max,t))}var wk=Math.sign||function(e){return e>=0?1:-1},$f={min:.2,max:4},$b=10,Ek=.1,Sk=.75;function Ci(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=Rn(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||Sk;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}Ci.$inject=["config.zoomScroll","eventBus","canvas"],Ci.prototype.scroll=function(t){this._canvas.scroll(t)},Ci.prototype.reset=function(){this._canvas.zoom("fit-viewport")},Ci.prototype.zoom=function(t,n){var i=Nb($f,$b*2);this._totalDelta+=t,Math.abs(this._totalDelta)>Ek&&(this._zoom(t,n,i),this._totalDelta=0)},Ci.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||cy()&&t.metaKey,r=t.shiftKey,o=-1*this._scale,a;if(i?o*=t.deltaMode===0?.02:.32:o*=t.deltaMode===0?1:16,i){var s=n.getBoundingClientRect(),c={x:t.clientX-s.left,y:t.clientY-s.top};a=Math.sqrt(Math.pow(t.deltaY,2)+Math.pow(t.deltaX,2))*wk(t.deltaY)*o,this.zoom(a,c)}else r?a={dx:o*t.deltaY,dy:0}:a={dx:o*t.deltaX,dy:o*t.deltaY},this.scroll(a)}},Ci.prototype.stepZoom=function(t,n){var i=Nb($f,$b);this._zoom(t,n,i)},Ci.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=Zu(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(_k($f,s),t)},Ci.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,r=this._enabled;return typeof t>"u"&&(t=!r),r!==t&&je[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},Ci.prototype._init=function(e){this.toggle(e)};const Fb={__init__:["zoomScroll"],zoomScroll:["type",Ci]};function Ua(e){xr.call(this,e)}Ee(Ua,xr),Ua.prototype._navigationModules=[Ib,Bb,Fb],Ua.prototype._modules=[].concat(xr.prototype._modules,Ua.prototype._navigationModules);function Ff(e){return e&&e[e.length-1]}function jb(e){return e.y}function Hb(e){return e.x}var Rk={left:Hb,center:Hb,right:function(e){return e.x+e.width},top:jb,middle:jb,bottom:function(e){return e.y+e.height}};function zo(e,t){this._modeling=e,this._rules=t}zo.$inject=["modeling","rules"],zo.prototype._getOrientationDetails=function(e){var t=["top","bottom","middle"],n="x",i="width";return t.indexOf(e)!==-1&&(n="y",i="height"),{axis:n,dimension:i}},zo.prototype._isType=function(e,t){return t.indexOf(e)!==-1},zo.prototype._alignmentPosition=function(e,t){var n=this._getOrientationDetails(e),i=n.axis,r=n.dimension,o={},a={},s=!1,c,l,u;function f(p,d){return Math.round((p[i]+d[i]+d[r])/2)}if(this._isType(e,["left","top"]))o[e]=t[0][i];else if(this._isType(e,["right","bottom"]))u=Ff(t),o[e]=u[i]+u[r];else if(this._isType(e,["center","middle"])){if(F(t,function(p){var d=p[i]+Math.round(p[r]/2);a[d]?a[d].elements.push(p):a[d]={elements:[p],center:d}}),c=di(a,function(p){return p.elements.length>1&&(s=!0),p.elements.length}),s)return o[e]=Ff(c).center,o;l=t[0],t=di(t,function(p){return p[i]+p[r]}),u=Ff(t),o[e]=f(l,u)}return o},zo.prototype.trigger=function(e,t){var n=this._modeling,i,r=Ke(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:r}),Be(i)&&(r=i),!(r.length<2||!i)){var o=Rk[t],a=di(r,o),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const Ck={__init__:["alignElements"],alignElements:["type",zo]},Ak=new Bo;function Go(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}Go.$inject=["eventBus"],Go.prototype.schedule=function(e,t=Ak.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},Go.prototype._schedule=function(e,t){const n=Pk();return{executionId:setTimeout(()=>{try{this._scheduled[t]=null;try{n.resolve(e())}catch(r){n.reject(r)}}catch(r){console.error("Scheduler#_schedule execution failed",r)}}),promise:n.promise}},Go.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},Go.prototype._cancel=function(e){clearTimeout(e.executionId)};function Pk(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const Mk={scheduler:["type",Go]};var Tk="djs-element-hidden",il=".entry",kk=1e3,zb=8,Ok=300;function Ht(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}Ht.$inject=["canvas","elementRegistry","eventBus","scheduler"],Ht.prototype._init=function(){var e=this;this._eventBus.on("selection.changed",function(t){var n=t.newSelection,i=n.length?n.length===1?n[0]:n:null;i?e.open(i,!0):e.close()}),this._eventBus.on("elements.changed",function(t){var n=t.elements,i=e._current;if(i){var r=i.target,o=Be(r)?r:[r],a=o.filter(function(c){return n.includes(c)});if(a.length){e.close();var s=o.filter(function(c){return e._elementRegistry.get(c.id)});s.length&&e._updateAndOpen(s.length>1?s:s[0])}}}),this._eventBus.on("canvas.viewbox.changed",function(){e._updatePosition()}),this._eventBus.on("element.marker.update",function(t){if(e.isOpen()){var n=t.element,i=e._current,r=Be(i.target)?i.target:[i.target];r.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},Ht.prototype._createContainer=function(){var e=wt('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},Ht.prototype.registerProvider=function(e,t){t||(t=e,e=kk),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},Ht.prototype.getEntries=function(e){var t=this._getProviders(),n=Be(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return F(t,function(r){if(Jt(r[n])){var o=r[n](e);Jt(o)?i=o(i):F(o,function(a,s){i[s]=a})}}),i},Ht.prototype.trigger=function(e,t,n){var i=this,r,o,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(r=gn(a,"data-action"),o=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(r,"hover",o,n)},Ok);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(r,e,o,n)},Ht.prototype.triggerEntry=function(e,t,n,i){if(this.isShown()){var r=this._current.target,o=this._current.entries,a=o[e];if(a){var s=a.action;if(this._eventBus.fire("contextPad.trigger",{entry:a,event:n})!==!1){if(Jt(s)){if(t==="click")return s(n,r,i)}else if(s[t])return s[t](n,r,i);n.preventDefault()}}}},Ht.prototype.open=function(e,t){if(!(!t&&this.isOpen(e))){var n=this._eventBus.fire("contextPad.open.allowed",{target:e});n!==!1&&(this.close(),this._updateAndOpen(e))}},Ht.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Ht.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),i;F(t,function(r,o){var a=r.group||"default",s=wt(r.html||'<div class="entry" draggable="true"></div>'),c;gn(s,"data-action",o),c=ft("[data-group="+Wa(a)+"]",n),c||(c=wt('<div class="group"></div>'),gn(c,"data-group",a),n.appendChild(c)),c.appendChild(s),r.className&&Dk(s,r.className),r.title&&gn(s,"title",r.title),r.imageUrl&&(i=wt("<img>"),gn(i,"src",r.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),Ct(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},Ht.prototype._createHtml=function(e){var t=this,n=wt('<div class="djs-context-pad"></div>');return On.bind(n,il,"click",function(i){t.trigger("click",i)}),On.bind(n,il,"dragstart",function(i){t.trigger("dragstart",i)}),On.bind(n,il,"mouseover",function(i){t.trigger("mouseover",i)}),On.bind(n,il,"mouseout",function(i){t.trigger("mouseout",i)}),je.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},Ht.prototype.getPad=function(e){console.warn(new Error("ContextPad#getPad is deprecated and will be removed in future library versions, cf. https://github.com/bpmn-io/diagram-js/pull/888"));let t;return this.isOpen()&&Lk(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},Ht.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},Ht.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return Be(e)!==Be(n)?!1:Be(e)?e.length===n.length&&kr(e,function(i){return n.includes(i)}):n===e},Ht.prototype.isShown=function(){return this.isOpen()&&Ct(this._current.html).has("open")},Ht.prototype.show=function(){this.isOpen()&&(Ct(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},Ht.prototype.hide=function(){this.isOpen()&&(Ct(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},Ht.prototype._getPosition=function(e){if(!Be(e)&&ht(e)){var t=this._canvas.viewbox(),n=Ik(e),i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale;return{left:i+zb*this._canvas.zoom(),top:r}}var o=this._canvas.getContainer(),a=o.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+zb*this._canvas.zoom(),top:s.top-a.top}},Ht.prototype._updatePosition=function(){const e=()=>{if(this.isOpen()){var t=this._current.html,n=this._getPosition(this._current.target);"x"in n&&"y"in n?(t.style.left=n.x+"px",t.style.top=n.y+"px"):["top","right","bottom","left"].forEach(function(i){i in n&&(t.style[i]=n[i]+"px")})}};this._scheduler.schedule(e,"ContextPad#_updatePosition")},Ht.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=Be(n)?n:[n],r=i.some(function(o){return t._canvas.hasMarker(o,Tk)});r?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},Ht.prototype._getTargetBounds=function(e){var t=this,n=Be(e)?e:[e],i=n.map(function(r){return t._canvas.getGraphics(r)});return i.reduce(function(r,o){const a=o.getBoundingClientRect();return r.top=Math.min(r.top,a.top),r.right=Math.max(r.right,a.right),r.bottom=Math.max(r.bottom,a.bottom),r.left=Math.min(r.left,a.left),r.x=r.left,r.y=r.top,r.width=r.right-r.left,r.height=r.bottom-r.top,r},{top:1/0,right:-1/0,bottom:-1/0,left:1/0})};function Dk(e,t){var n=Ct(e);t=Be(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function Ik(e){return e.waypoints[e.waypoints.length-1]}function Lk(e,t){return e=Be(e)?e:[e],t=Be(t)?t:[t],e.length===t.length&&kr(e,function(n){return t.includes(n)})}const Gb={__depends__:[Ac,Mk,el],contextPad:["type",Ht]};var rl,Tt,Vb,_r,Wb,Ub,Yb,jf,ol,Ya,qb,Hf,zf,Gf,al={},sl=[],Bk=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,cl=Array.isArray;function Wi(e,t){for(var n in t)e[n]=t[n];return e}function Vf(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Kb(e,t,n){var i,r,o,a={};for(o in t)o=="key"?i=t[o]:o=="ref"?r=t[o]:a[o]=t[o];if(arguments.length>2&&(a.children=arguments.length>3?rl.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(o in e.defaultProps)a[o]===void 0&&(a[o]=e.defaultProps[o]);return ll(e,a,i,r,null)}function ll(e,t,n,i,r){var o={type:e,props:t,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r??++Vb,__i:-1,__u:0};return r==null&&Tt.vnode!=null&&Tt.vnode(o),o}function ul(e){return e.children}function pl(e,t){this.props=e,this.context=t}function qr(e,t){if(t==null)return e.__?qr(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?qr(e):null}function Nk(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],r=[],o=Wi({},t);o.__v=t.__v+1,Tt.vnode&&Tt.vnode(o),Wf(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??qr(t),!!(32&t.__u),r),o.__v=t.__v,o.__.__k[o.__i]=o,ix(i,o,r),t.__e=t.__=null,o.__e!=n&&Xb(o)}}function Xb(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),Xb(e)}function Zb(e){(!e.__d&&(e.__d=!0)&&_r.push(e)&&!fl.__r++||Wb!=Tt.debounceRendering)&&((Wb=Tt.debounceRendering)||Ub)(fl)}function fl(){try{for(var e,t=1;_r.length;)_r.length>t&&_r.sort(Yb),e=_r.shift(),t=_r.length,Nk(e)}finally{_r.length=fl.__r=0}}function Qb(e,t,n,i,r,o,a,s,c,l,u){var f,p,d,m,h,y,v=i&&i.__k||sl,g=t.length;for(c=$k(n,t,v,c,g),f=0;f<g;f++)(d=n.__k[f])!=null&&(p=d.__i!=-1&&v[d.__i]||al,d.__i=f,y=Wf(e,d,p,r,o,a,s,c,l,u),m=d.__e,d.ref&&p.ref!=d.ref&&(p.ref&&Uf(p.ref,null,d),u.push(d.ref,d.__c||m,d)),h==null&&m!=null&&(h=m),4&d.__u?(c=Jb(d,c,e),p.__e&&(p.__e=null)):typeof d.type=="function"&&y!==void 0?c=y:m&&(c=m.nextSibling),d.__u&=-7);return n.__e=h,c}function $k(e,t,n,i,r){var o,a,s,c,l,u=n.length,f=u,p=0;for(e.__k=new Array(r),o=0;o<r;o++)(a=t[o])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?a=e.__k[o]=ll(null,a,null,null,null):cl(a)?a=e.__k[o]=ll(ul,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=ll(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[o]=a,c=o+p,a.__=e,a.__b=e.__b+1,s=null,(l=a.__i=Fk(a,n,c,f))!=-1&&(f--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(r>u?p--:r<u&&p++),typeof a.type!="function"&&(a.__u|=4)):l!=c&&(l==c-1?p--:l==c+1?p++:(l>c?p--:p++,a.__u|=4))):e.__k[o]=null;if(f)for(o=0;o<u;o++)(s=n[o])!=null&&(2&s.__u)==0&&(s.__e==i&&(i=qr(s)),ox(s,s));return i}function Jb(e,t,n){var i,r;if(typeof e.type=="function"){for(i=e.__k,r=0;i&&r<i.length;r++)i[r]&&(i[r].__=e,t=Jb(i[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=qr(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function Fk(e,t,n,i){var r,o,a,s=e.key,c=e.type,l=t[n],u=l!=null&&(2&l.__u)==0;if(l===null&&s==null||u&&s==l.key&&c==l.type)return n;if(i>(u?1:0)){for(r=n-1,o=n+1;r>=0||o<t.length;)if((l=t[a=r>=0?r--:o++])!=null&&(2&l.__u)==0&&s==l.key&&c==l.type)return a}return-1}function ex(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||Bk.test(t)?n:n+"px"}function dl(e,t,n,i,r){var o,a;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof i=="string"&&(e.style.cssText=i=""),i)for(t in i)n&&t in n||ex(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||ex(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(qb,"$1")),a=t.toLowerCase(),t=a in e||t=="onFocusOut"||t=="onFocusIn"?a.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?i?n[Ya]=i[Ya]:(n[Ya]=Hf,e.addEventListener(t,o?Gf:zf,o)):e.removeEventListener(t,o?Gf:zf,o);else{if(r=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function tx(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[ol]==null)t[ol]=Hf++;else if(t[ol]<n[Ya])return;return n(Tt.event?Tt.event(t):t)}}}function Wf(e,t,n,i,r,o,a,s,c,l){var u,f,p,d,m,h,y,v,g,b,x,C,M,k,P,B,D=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[s=t.__e=n.__e]),(u=Tt.__b)&&u(t);e:if(typeof D=="function"){f=a.length;try{if(g=t.props,b=D.prototype&&D.prototype.render,x=(u=D.contextType)&&i[u.__c],C=u?x?x.props.value:u.__:i,n.__c?v=(p=t.__c=n.__c).__=p.__E:(b?t.__c=p=new D(g,C):(t.__c=p=new pl(g,C),p.constructor=D,p.render=Hk),x&&x.sub(p),p.state||(p.state={}),p.__n=i,d=p.__d=!0,p.__h=[],p._sb=[]),b&&p.__s==null&&(p.__s=p.state),b&&D.getDerivedStateFromProps!=null&&(p.__s==p.state&&(p.__s=Wi({},p.__s)),Wi(p.__s,D.getDerivedStateFromProps(g,p.__s))),m=p.props,h=p.state,p.__v=t,d)b&&D.getDerivedStateFromProps==null&&p.componentWillMount!=null&&p.componentWillMount(),b&&p.componentDidMount!=null&&p.__h.push(p.componentDidMount);else{if(b&&D.getDerivedStateFromProps==null&&g!==m&&p.componentWillReceiveProps!=null&&p.componentWillReceiveProps(g,C),t.__v==n.__v||!p.__e&&p.shouldComponentUpdate!=null&&p.shouldComponentUpdate(g,p.__s,C)===!1){t.__v!=n.__v&&(p.props=g,p.state=p.__s,p.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(I){I&&(I.__=t)}),sl.push.apply(p.__h,p._sb),p._sb=[],p.__h.length&&a.push(p),s=qr(n);break e}p.componentWillUpdate!=null&&p.componentWillUpdate(g,p.__s,C),b&&p.componentDidUpdate!=null&&p.__h.push(function(){p.componentDidUpdate(m,h,y)})}if(p.context=C,p.props=g,p.__P=e,p.__e=!1,M=Tt.__r,k=0,b)p.state=p.__s,p.__d=!1,M&&M(t),u=p.render(p.props,p.state,p.context),sl.push.apply(p.__h,p._sb),p._sb=[];else do p.__d=!1,M&&M(t),u=p.render(p.props,p.state,p.context),p.state=p.__s;while(p.__d&&++k<25);p.state=p.__s,p.getChildContext!=null&&(i=Wi(Wi({},i),p.getChildContext())),b&&!d&&p.getSnapshotBeforeUpdate!=null&&(y=p.getSnapshotBeforeUpdate(m,h)),P=u!=null&&u.type===ul&&u.key==null?rx(u.props.children):u,s=Qb(e,cl(P)?P:[P],t,n,i,r,o,a,s,c,l),p.base=t.__e,t.__u&=-161,p.__h.length&&a.push(p),v&&(p.__E=p.__=null)}catch(I){if(a.length=f,t.__v=null,c||o!=null){if(I.then){for(t.__u|=c?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;o!=null&&(o[o.indexOf(s)]=null),t.__e=s}else if(o!=null)for(B=o.length;B--;)Vf(o[B])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),I.then||nx(t),Tt.__e(I,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=jk(n.__e,t,n,i,r,o,a,c,l);return(u=Tt.diffed)&&u(t),128&t.__u?void 0:s}function nx(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(nx))}function ix(e,t,n){for(var i=0;i<n.length;i++)Uf(n[i],n[++i],n[++i]);Tt.__c&&Tt.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){Tt.__e(o,r.__v)}})}function rx(e){return typeof e!="object"||e==null||e.__b>0?e:cl(e)?e.map(rx):e.constructor!==void 0?null:Wi({},e)}function jk(e,t,n,i,r,o,a,s,c){var l,u,f,p,d,m,h,y=n.props||al,v=t.props,g=t.type;if(g=="svg"?r="http://www.w3.org/2000/svg":g=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),o!=null){for(l=0;l<o.length;l++)if((d=o[l])&&"setAttribute"in d==!!g&&(g?d.localName==g:d.nodeType==3)){e=d,o[l]=null;break}}if(e==null){if(g==null)return document.createTextNode(v);e=document.createElementNS(r,g,v.is&&v),s&&(Tt.__m&&Tt.__m(t,o),s=!1),o=null}if(g==null)y===v||s&&e.data==v||(e.data=v);else{if(o=g=="textarea"&&v.defaultValue!=null?null:o&&rl.call(e.childNodes),!s&&o!=null)for(y={},l=0;l<e.attributes.length;l++)y[(d=e.attributes[l]).name]=d.value;for(l in y)d=y[l],l=="dangerouslySetInnerHTML"?f=d:l=="children"||l in v||l=="value"&&"defaultValue"in v||l=="checked"&&"defaultChecked"in v||dl(e,l,null,d,r);for(l in v)d=v[l],l=="children"?p=d:l=="dangerouslySetInnerHTML"?u=d:l=="value"?m=d:l=="checked"?h=d:s&&typeof d!="function"||y[l]===d||dl(e,l,d,y[l],r);if(u)s||f&&(u.__html==f.__html||u.__html==e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(f&&(e.innerHTML=""),Qb(t.type=="template"?e.content:e,cl(p)?p:[p],t,n,i,g=="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,a,o?o[0]:n.__k&&qr(n,0),s,c),o!=null)for(l=o.length;l--;)Vf(o[l]);s&&g!="textarea"||(l="value",g=="progress"&&m==null?e.removeAttribute("value"):m!=null&&(m!==e[l]||g=="progress"&&!m||g=="option"&&m!=y[l])&&dl(e,l,m,y[l],r),l="checked",h!=null&&h!=e[l]&&dl(e,l,h,y[l],r))}return e}function Uf(e,t,n){try{if(typeof e=="function"){var i=typeof e.__u=="function";i&&e.__u(),i&&t==null||(e.__u=e(t))}else e.current=t}catch(r){Tt.__e(r,n)}}function ox(e,t,n){var i,r;if(Tt.unmount&&Tt.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||Uf(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){Tt.__e(o,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&ox(i[r],t,n||typeof e.type!="function");n||Vf(e.__e),e.__c=e.__=e.__e=void 0}function Hk(e,t,n){return this.constructor(e,n)}function ax(e,t,n){var i,r,o,a;t==document&&(t=document.documentElement),Tt.__&&Tt.__(e,t),r=(i=!1)?null:t.__k,o=[],a=[],Wf(t,e=t.__k=Kb(ul,null,[e]),r||al,al,t.namespaceURI,r?null:t.firstChild?rl.call(t.childNodes):null,o,r?r.__e:t.firstChild,i,a),ix(o,e,a),e.props.children=null}rl=sl.slice,Tt={__e:function(e,t,n,i){for(var r,o,a;t=t.__;)if((r=t.__c)&&!r.__)try{if((o=r.constructor)&&o.getDerivedStateFromError!=null&&(r.setState(o.getDerivedStateFromError(e)),a=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(e,i||{}),a=r.__d),a)return r.__E=r}catch(s){e=s}throw e}},Vb=0,pl.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Wi({},this.state),typeof e=="function"&&(e=e(Wi({},n),this.props)),e&&Wi(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Zb(this))},pl.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Zb(this))},pl.prototype.render=ul,_r=[],Ub=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Yb=function(e,t){return e.__v.__b-t.__v.__b},fl.__r=0,jf=Math.random().toString(8),ol="__d"+jf,Ya="__a"+jf,qb=/(PointerCapture)$|Capture$/i,Hf=0,zf=tx(!1),Gf=tx(!0);var sx=function(e,t,n,i){var r;t[0]=0;for(var o=1;o<t.length;o++){var a=t[o++],s=t[o]?(t[0]|=a?1:2,n[t[o++]]):t[++o];a===3?i[0]=s:a===4?i[1]=Object.assign(i[1]||{},s):a===5?(i[1]=i[1]||{})[t[++o]]=s:a===6?i[1][t[++o]]+=s+"":a?(r=e.apply(s,sx(e,s,n,["",null])),i.push(r),s[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(s)}return i},cx=new Map;function zk(e){var t=cx.get(this);return t||(t=new Map,cx.set(this,t)),(t=sx(this,t.get(e)||(t.set(e,t=(function(n){for(var i,r,o=1,a="",s="",c=[0],l=function(p){o===1&&(p||(a=a.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?c.push(0,p,a):o===3&&(p||a)?(c.push(3,p,a),o=2):o===2&&a==="..."&&p?c.push(4,p,0):o===2&&a&&!p?c.push(5,0,!0,a):o>=5&&((a||!p&&o===5)&&(c.push(o,0,a,r),o=6),p&&(c.push(o,p,0,r),o=6)),a=""},u=0;u<n.length;u++){u&&(o===1&&l(),l(u));for(var f=0;f<n[u].length;f++)i=n[u][f],o===1?i==="<"?(l(),c=[c],o=3):a+=i:o===4?a==="--"&&i===">"?(o=1,a=""):a=i+a[0]:s?i===s?s="":a+=i:i==='"'||i==="'"?s=i:i===">"?(l(),o=1):o&&(i==="="?(o=5,r=a,a=""):i==="/"&&(o<5||n[u][f+1]===">")?(l(),o===3&&(c=c[0]),o=c,(c=c[0]).push(2,0,o),o=0):i===" "||i===" "||i===`
|
|
11
|
+
`||i==="\r"?(l(),o=2):a+=i),o===3&&a==="!--"&&(o=4,c=c[0])}return l(),c})(e)),t),arguments,[])).length>1?t:t[0]}var gt=zk.bind(Kb),Vo,zt,Yf,lx,qa=0,ux=[],Zt=Tt,px=Zt.__b,fx=Zt.__r,dx=Zt.diffed,hx=Zt.__c,mx=Zt.unmount,gx=Zt.__;function hl(e,t){Zt.__h&&Zt.__h(zt,e,qa||t),qa=0;var n=zt.__H||(zt.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function qf(e){return qa=1,Gk(vx,e)}function Gk(e,t,n){var i=hl(Vo++,2);if(i.t=e,!i.__c&&(i.__=[vx(void 0,t),function(s){var c=i.__N?i.__N[0]:i.__[0],l=i.t(c,s);c!==l&&(i.__N=[l,i.__[1]],i.__c.setState({}))}],i.__c=zt,!zt.__f)){var r=function(s,c,l){if(!i.__c.__H)return!0;var u=!1,f=i.__c.props!==s;if(i.__c.__H.__.some(function(d){if(d.__N){u=!0;var m=d.__[0];d.__=d.__N,d.__N=void 0,m!==d.__[0]&&(f=!0)}}),o){var p=o.call(this,s,c,l);return u?p||f:p}return!u||f};zt.__f=!0;var o=zt.shouldComponentUpdate,a=zt.componentWillUpdate;zt.componentWillUpdate=function(s,c,l){if(this.__e){var u=o;o=void 0,r(s,c,l),o=u}a&&a.call(this,s,c,l)},zt.shouldComponentUpdate=r}return i.__N||i.__}function ml(e,t){var n=hl(Vo++,3);!Zt.__s&&Zf(n.__H,t)&&(n.__=e,n.u=t,zt.__H.__h.push(n))}function Kf(e,t){var n=hl(Vo++,4);!Zt.__s&&Zf(n.__H,t)&&(n.__=e,n.u=t,zt.__h.push(n))}function gl(e){return qa=5,Ui(function(){return{current:e}},[])}function Ui(e,t){var n=hl(Vo++,7);return Zf(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Ka(e,t){return qa=8,Ui(function(){return e},t)}function Vk(){for(var e;e=ux.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(yl),t.__h.some(Xf),t.__h=[]}catch(n){t.__h=[],Zt.__e(n,e.__v)}}}Zt.__b=function(e){zt=null,px&&px(e)},Zt.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),gx&&gx(e,t)},Zt.__r=function(e){fx&&fx(e),Vo=0;var t=(zt=e.__c).__H;t&&(Yf===zt?(t.__h=[],zt.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(yl),t.__h.some(Xf),t.__h=[],Vo=0)),Yf=zt},Zt.diffed=function(e){dx&&dx(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(ux.push(t)!==1&&lx===Zt.requestAnimationFrame||((lx=Zt.requestAnimationFrame)||Wk)(Vk)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),Yf=zt=null},Zt.__c=function(e,t){t.some(function(n){try{n.__h.some(yl),n.__h=n.__h.filter(function(i){return!i.__||Xf(i)})}catch(i){t.some(function(r){r.__h&&(r.__h=[])}),t=[],Zt.__e(i,n.__v)}}),hx&&hx(e,t)},Zt.unmount=function(e){mx&&mx(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{yl(i)}catch(r){t=r}}),n.__H=void 0,t&&Zt.__e(t,n.__v))};var yx=typeof requestAnimationFrame=="function";function Wk(e){var t,n=function(){clearTimeout(i),yx&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);yx&&(t=requestAnimationFrame(n))}function yl(e){var t=zt,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),zt=t}function Xf(e){var t=zt;e.__c=e.__(),zt=t}function Zf(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function vx(e,t){return typeof t=="function"?t(e):t}function Uk(e){const{navigationStack:t,setNavigationStack:n}=e,i=Ui(()=>t.length<=1?[]:t.slice(0,-1).map((a,s)=>({label:a.label,onClick:()=>n(c=>c.slice(0,s+1))})),[t,n]),r=t.length>0?()=>n([]):null,o=t.length>0?t[t.length-1].label:null;return gt`
|
|
12
12
|
<div class="djs-popup-breadcrumbs">
|
|
13
13
|
${r&>`
|
|
14
14
|
<button
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
</span>
|
|
42
42
|
`}
|
|
43
43
|
</div>
|
|
44
|
-
`}function bx(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=bx(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function vl(){for(var e,t,n=0,i="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=bx(e))&&(i&&(i+=" "),i+=t);return i}function
|
|
44
|
+
`}function bx(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=bx(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function vl(){for(var e,t,n=0,i="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=bx(e))&&(i&&(i+=" "),i+=t);return i}function Yk(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:r,title:o}=e,a=Ui(()=>qk(t),[t]),s=l=>l.action&&!l.disabled,c=(l,u)=>{if(s(u))return n(l,u)};return gt`
|
|
45
45
|
<div class="djs-popup-header">
|
|
46
46
|
<h3 class="djs-popup-title" title=${o}>${o}</h3>
|
|
47
47
|
${a.map(l=>gt`
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
${l.entries.map(u=>gt`
|
|
51
51
|
<li key=${u.id}>
|
|
52
52
|
<${s(u)?"button":"span"}
|
|
53
|
-
class=${
|
|
53
|
+
class=${Kk(u,u===i)}
|
|
54
54
|
onClick=${f=>c(f,u)}
|
|
55
55
|
title=${u.title||u.label}
|
|
56
56
|
data-id=${u.id}
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
</ul>
|
|
71
71
|
`)}
|
|
72
72
|
</div>
|
|
73
|
-
`}function
|
|
73
|
+
`}function qk(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 Kk(e,t){return vl("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function xx(e,t){return`${e}-entry-${t.id}`}function Xk(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 gt`
|
|
74
74
|
<li
|
|
75
75
|
class=${vl("entry",{selected:i,disabled:n.disabled})}
|
|
76
76
|
data-id=${n.id}
|
|
@@ -131,7 +131,7 @@
|
|
|
131
131
|
</div>
|
|
132
132
|
`}
|
|
133
133
|
</li>
|
|
134
|
-
`}function
|
|
134
|
+
`}function Zk(e){const{selectedEntry:t,setSelectedEntry:n,groupedEntries:i,keyboardSelection:r,idPrefix:o,id:a,ariaLabel:s,tabIndex:c,ariaActivedescendant:l,...u}=e,f=gl();Kf(()=>{if(!r||!r.current)return;const h=f.current;if(!h)return;const y=h.querySelector(".selected");y&&Qk(y)},[t]);const p=()=>{r.current=!1},d=h=>{r.current||n(h)},m=()=>{r.current||n(null)};return gt`
|
|
135
135
|
<div
|
|
136
136
|
class="djs-popup-results"
|
|
137
137
|
ref=${f}
|
|
@@ -155,7 +155,7 @@
|
|
|
155
155
|
aria-labelledby=${h.name?_x(o,h):void 0}
|
|
156
156
|
>
|
|
157
157
|
${h.entries.map(y=>gt`
|
|
158
|
-
<${
|
|
158
|
+
<${Xk}
|
|
159
159
|
key=${y.id}
|
|
160
160
|
idPrefix=${o}
|
|
161
161
|
entry=${y}
|
|
@@ -168,7 +168,7 @@
|
|
|
168
168
|
</ul>
|
|
169
169
|
`)}
|
|
170
170
|
</div>
|
|
171
|
-
`}function _x(e,t){return`${e}-group-${t.id}`}function
|
|
171
|
+
`}function _x(e,t){return`${e}-group-${t.id}`}function Qk(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const Jk=new Bo("djs-popup");function eO(e){const{onClose:t,onSelect:n,className:i,headerEntries:r,position:o,title:a,width:s,scale:c,search:l,emptyPlaceholder:u,searchFn:f,entries:p,onOpened:d,onClosed:m}=e,[h,y]=qf([]);ml(()=>{y([])},[p]);const[v,g]=qf(""),b=v.trim().length>0,x=Ui(()=>iO(p),[p]),C=Ui(()=>Yt(l)?x.length>5:!1,[l,x]),M=Ui(()=>{const q=h.length?h[h.length-1].entries:p;return C?b?f(x.filter(({searchable:V})=>V!==!1),v,{keys:["label","search","description"]}).map(({item:V})=>V):q.filter(({rank:V=0})=>V>=0):q},[C,b,x,v,f,h,p]),k=Ui(()=>b?M.length?[{id:"default",entries:M}]:[]:rO(M),[M,b]),[P,B]=qf(M[0]),D=gl(null),I=gl(!1),z=Ui(()=>Jk.next(),[]),oe=`${z}-results`,ye=P&&xx(z,P);ml(()=>{const q=D.current;q&&M.includes(q)?B(q):B(M[0]),D.current=null},[M]);const Ve=Ka(q=>{const V=nO(k);let Te=V.indexOf(P)+q;Te<0&&(Te=V.length-1),Te>=V.length&&(Te=0),I.current=!0,B(V[Te])},[k,P]),He=Ka(q=>{q>0&&P&&P.entries&&(I.current=!0,y(V=>[...V,P])),q<0&&h.length>0&&(I.current=!0,D.current=h[h.length+q],y(V=>V.slice(0,q)))},[P,h]),it=Ka((q,V,ne)=>{if(!(!V||V.disabled))return V.entries?(q.preventDefault(),He(1)):n(q,V,ne)},[n,He]),K=Ka(q=>{if(q.key==="Enter"&&P){const V=q.target;return!!Lr(V,"a, button",!0)||P.disabled?void 0:it(q,P)}if(q.key==="Backspace"){const V=q.target;if(!(Tu(V,"input")&&V.value!==""))return He(-1),q.preventDefault()}if(q.key==="ArrowUp")return Ve(-1),q.preventDefault();if(q.key==="ArrowDown")return Ve(1),q.preventDefault();if(q.key==="ArrowRight")return He(1),q.preventDefault();if(q.key==="ArrowLeft")return He(-1),q.preventDefault()},[P,Ve,He,it]),Z=Ka(q=>{Tu(q.target,"input")&&g(()=>q.target.value)},[g]);ml(()=>(d(),()=>{m()}),[]);const se=!b&&h.length>0,xe=(a||r.length>0)&&!se;return gt`
|
|
172
172
|
<${wx}
|
|
173
173
|
onClose=${t}
|
|
174
174
|
onKeyup=${Z}
|
|
@@ -180,7 +180,7 @@
|
|
|
180
180
|
navigationStack=${h}
|
|
181
181
|
>
|
|
182
182
|
${xe&>`
|
|
183
|
-
<${
|
|
183
|
+
<${Yk}
|
|
184
184
|
headerEntries=${r}
|
|
185
185
|
onSelect=${n}
|
|
186
186
|
selectedEntry=${P}
|
|
@@ -189,7 +189,7 @@
|
|
|
189
189
|
/>
|
|
190
190
|
`}
|
|
191
191
|
${se&>`
|
|
192
|
-
<${
|
|
192
|
+
<${Uk}
|
|
193
193
|
navigationStack=${h}
|
|
194
194
|
setNavigationStack=${y}
|
|
195
195
|
/>
|
|
@@ -221,7 +221,7 @@
|
|
|
221
221
|
</div>
|
|
222
222
|
`}
|
|
223
223
|
|
|
224
|
-
<${
|
|
224
|
+
<${Zk}
|
|
225
225
|
groupedEntries=${k}
|
|
226
226
|
selectedEntry=${P}
|
|
227
227
|
setSelectedEntry=${B}
|
|
@@ -261,7 +261,7 @@
|
|
|
261
261
|
`}function wx(e){const{onClose:t,onKeydown:n,onKeyup:i,className:r,children:o,navigationStack:a,position:s}=e,c=gl();return Kf(()=>{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]),Kf(()=>{const l=c.current;if(!l)return;(l.querySelector("input")||l.querySelector('[role="listbox"]')||l).focus()},[a]),ml(()=>{const l=f=>{if(f.key==="Escape")return f.preventDefault(),t()},u=f=>{if(!Lr(f.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)}},[]),gt`
|
|
262
262
|
<div
|
|
263
263
|
class=${vl("djs-popup",r)}
|
|
264
|
-
style=${
|
|
264
|
+
style=${tO(e)}
|
|
265
265
|
onKeydown=${n}
|
|
266
266
|
onKeyup=${i}
|
|
267
267
|
ref=${c}
|
|
@@ -269,8 +269,8 @@
|
|
|
269
269
|
>
|
|
270
270
|
${o}
|
|
271
271
|
</div>
|
|
272
|
-
`}function
|
|
273
|
-
<${
|
|
272
|
+
`}function tO(e){const{width:t}=e,n=typeof t=="number"?`${t}px`:t;return{transform:`scale(${e.scale})`,width:Yt(t)?n:void 0,maxWidth:Yt(t)?"unset":void 0,"transform-origin":"top left"}}function nO(e){const t=[];return e.forEach(n=>{n.entries.forEach(i=>{t.push(i)})}),t}function iO(e){const t=[];function n(i){i.forEach(r=>{if(r.entries){n(r.entries);return}t.push(r)})}return n(e),t}function rO(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 oO="data-id",Ex=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],aO=1e3;function kt(e,t,n,i){this._eventBus=t,this._canvas=n,this._search=i,this._current=null;var r=Yt(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()})}kt.$inject=["config.popupMenu","eventBus","canvas","search"],kt.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:i,emptyPlaceholder:r,options:o}=this._current,a=Sx(n),s=Object.entries(i).map(([p,d])=>({id:p,...d})),c=e&&(p=>this._ensureVisible(p,e)),l=this._updateScale(this._current.container);ax(gt`
|
|
273
|
+
<${eO}
|
|
274
274
|
onClose=${p=>this.close(p)}
|
|
275
275
|
onSelect=${(p,d,m)=>this.trigger(p,d,m)}
|
|
276
276
|
position=${c}
|
|
@@ -284,7 +284,7 @@
|
|
|
284
284
|
searchFn=${this._search}
|
|
285
285
|
...${{...o}}
|
|
286
286
|
/>
|
|
287
|
-
`,this._current.container)},kt.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()},kt.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()},kt.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)}},kt.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},kt.prototype.reset=function(){const e=this._current.container;ax(null,e),vi(e)},kt.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},kt.prototype._onOpened=function(){this._emit("opened")},kt.prototype._onClosed=function(){this._emit("closed")},kt.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},kt.prototype._bindAutoClose=function(){this._eventBus.once(Ex,this.close,this)},kt.prototype._unbindAutoClose=function(){this._eventBus.off(Ex,this.close,this)},kt.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),Yt(n)&&e<n&&(r=n),Yt(i)&&e>i&&(r=i)),r},kt.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}},kt.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},kt.prototype.registerProvider=function(e,t,n){n||(n=t,t=
|
|
287
|
+
`,this._current.container)},kt.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()},kt.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()},kt.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)}},kt.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},kt.prototype.reset=function(){const e=this._current.container;ax(null,e),vi(e)},kt.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},kt.prototype._onOpened=function(){this._emit("opened")},kt.prototype._onClosed=function(){this._emit("closed")},kt.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},kt.prototype._bindAutoClose=function(){this._eventBus.once(Ex,this.close,this)},kt.prototype._unbindAutoClose=function(){this._eventBus.off(Ex,this.close,this)},kt.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),Yt(n)&&e<n&&(r=n),Yt(i)&&e>i&&(r=i)),r},kt.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}},kt.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},kt.prototype.registerProvider=function(e,t,n){n||(n=t,t=aO),this._eventBus.on("popupMenu.getProviders."+e,t,function(i){i.providers.push(n)})},kt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},kt.prototype._getEntries=function(e,t){var n={};return F(t,function(i){if(!i.getPopupMenuEntries){F(i.getEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=hi(o,["id"])});return}var r=i.getPopupMenuEntries(e);Jt(r)?n=r(n):F(r,function(o,a){n[a]=o})}),n},kt.prototype._getHeaderEntries=function(e,t){var n={};return F(t,function(i){if(!i.getPopupMenuHeaderEntries){if(!i.getHeaderEntries)return;F(i.getHeaderEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=hi(o,["id"])});return}var r=i.getPopupMenuHeaderEntries(e);Jt(r)?n=r(n):F(r,function(o,a){n[a]=o})}),n},kt.prototype._getEmptyPlaceholder=function(e){const t=e.find(n=>Jt(n.getEmptyPlaceholder));return t&&t.getEmptyPlaceholder()},kt.prototype.isOpen=function(){return!!this._current},kt.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let r=Lr(e.delegateTarget||e.target,".entry",!0),o=gn(r,oO);t={id:o,...this._getEntry(o)}}const i=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(Jt(i)){if(n==="click")return i(e,t)}else if(i[n])return i[n](e,t)}},kt.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 Sx(e,t=[]){return Object.entries(e).map(([n,i])=>{const r={id:n,...i};return r.entries?r.entries=Sx(r.entries,[...t,...Rx(r.search)]):t.length&&(r.search=[...t,...Rx(r.search)]),r})}function Rx(e){return e?Be(e)?e:[e]:[]}function sO(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=cO(o,r,i);return a?{item:o,tokens:a}:[]}).sort(lO(i))}function cO(e,t,n){const{matchedWords:i,tokens:r}=n.reduce((o,a)=>{const s=e[a],{tokens:c,matchedWords:l}=Be(s)?s.reduce((u,f)=>{const{tokens:p,matchedWords:d}=Tx(f,t);return{tokens:[...u.tokens,p],matchedWords:{...u.matchedWords,...d}}},{matchedWords:{},tokens:[]}):Tx(s,t);return{tokens:{...o.tokens,[a]:c},matchedWords:{...o.matchedWords,...l}}},{matchedWords:{},tokens:{}});return Object.keys(i).length!==t.length?null:r}function lO(e){return(t,n)=>{let i=0,r=1;for(const o of e){const a=uO(t.tokens[o],n.tokens[o]);if(a!==0){i+=a*r,r*=Cx;continue}const s=pO(t.item[o],n.item[o]);if(s!==0){i+=s*r,r*=Cx;continue}}return i}}function uO(e,t){return Ax(t)-Ax(e)}const Cx=.5,Wo={FULL:131.9,START_FULL_WORD:8,START_WORD_PART:7.87,WORD_START:2.19,WORD_PART:1,NO_MATCH:-.07};function Ax(e){const t=e.reduce((s,c)=>s+Px(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 Px(e){if(Be(e))return Math.max(...e.map(Px));const t=Math.log(e.value.length);return e.match?(e.start?e.end?Wo.FULL:e.wordEnd?Wo.START_FULL_WORD:Wo.START_WORD_PART:e.wordStart?Wo.WORD_START:Wo.WORD_PART)*t:Wo.NO_MATCH*t}function Mx(e=""){return Be(e)?e.join(", "):e}function pO(e,t){return Mx(e).localeCompare(Mx(t))}function Tx(e,t){var l;if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},r=t.map(fO),o=[`(?<all>${r.join("\\s+")})`,...r].join("|"),a=new RegExp(o,"ig");let s,c=0;for(;s=a.exec(e);){const[u]=s,f=s.index,p=s.index+u.length,d=f===0,m=p===e.length,h=!!((l=s.groups)!=null&&l.all),y=d||/\s/.test(e.charAt(f-1)),v=m||/\s/.test(e.charAt(p));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:v,start:d,end:m,all:h});const g=h?t:[u];for(const b of g)i[b.toLowerCase()]=!0;c=s.index+u.length}return c<e.length&&n.push({value:e.slice(c),index:c}),{tokens:n,matchedWords:i}}function fO(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}const kx={search:["value",sO]},Qf={__depends__:[kx],__init__:["popupMenu"],popupMenu:["type",kt]};var Ox={align:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2000 2000">
|
|
288
288
|
<line x1="200" y1="150" x2="200" y2="1850" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>
|
|
289
289
|
<rect x="500" y="150" width="1300" height="700" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
|
|
290
290
|
<rect x="500" y="1150" width="700" height="700" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
|
|
@@ -312,8 +312,8 @@
|
|
|
312
312
|
<line x1="150" y1="900" x2="1650" y2="900" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>
|
|
313
313
|
<rect x="150" y="250" width="600" height="1300" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
|
|
314
314
|
<rect x="1050" y="500" width="600" height="800" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
|
|
315
|
-
</svg>`},fO=900;function Uo(e,t,n,i){e.registerProvider(fO,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}Uo.$inject=["contextPad","popupMenu","translate","canvas"],Uo.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&W(t,this._getEntries(e)),t},Uo.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},Uo.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${Ox.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);W(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},Uo.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 dO=["left","center","right","top","middle","bottom"];function Xa(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}Xa.$inject=["popupMenu","alignElements","translate","rules"],Xa.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&W(t,this._getEntries(e)),t},Xa.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},Xa.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return F(dO,function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:Ox[o],action:function(){t.trigger(e,o),i.close()}}}),r};function bl(e){ti.call(this,e)}bl.$inject=["eventBus"],Ee(bl,ti),bl.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=Ke(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=Hs(n),n.length<2?!1:n})};const hO={__depends__:[Rk,Gb,Qf],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",Uo],alignElementsMenuProvider:["type",Xa],bpmnAlignElements:["type",bl]};function Yi(e,t,n,i){te.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=Kl(ro(a.closure.topLevel)),c=a.hints,l=c?c.autoResize:!0;if(l!==!1){var u=oo(s,function(f){return f.parent.id});F(u,function(f,p){Be(l)&&(f=f.filter(function(d){return vt(l,ao({id:d.id}))})),r._expand(f,p)})}}),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)})}Yi.$inject=["eventBus","elementRegistry","modeling","rules"],Ee(Yi,te),Yi.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=Ie(Ft(e)),o=Ie(t),a={};return r.top-o.top<i.top&&(a.top=r.top-n.top),r.left-o.left<i.left&&(a.left=r.left-n.left),o.right-r.right<i.right&&(a.right=r.right+n.right),o.bottom-r.bottom<i.bottom&&(a.bottom=r.bottom+n.bottom),Vs(W({},o,a))},Yi.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(mO(i,t)){var r=gO(li(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:r});var o=t.parent;o&&this._expand([t],o)}}},Yi.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},Yi.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},Yi.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function mO(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function gO(e,t){var n="";return e=Ie(e),t=Ie(t),e.top>t.top&&(n=n.concat("n")),e.right<t.right&&(n=n.concat("w")),e.bottom<t.bottom&&(n=n.concat("s")),e.left>t.left&&(n=n.concat("e")),n}function xl(e){e.invoke(Yi,this)}xl.$inject=["injector"],Ee(xl,Yi),xl.prototype.resize=function(e,t,n){S(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};function Za(e){ti.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}Za.$inject=["eventBus"],Ee(Za,ti),Za.prototype.canResize=function(e,t){return!1};function _l(e,t){Za.call(this,e),this._modeling=t}Ee(_l,Za),_l.$inject=["eventBus","modeling"],_l.prototype.canResize=function(e,t){if(S(t.di,"bpmndi:BPMNPlane")||!S(t,"bpmn:Participant")&&!S(t,"bpmn:Lane")&&!S(t,"bpmn:SubProcess"))return!1;var n=!0;return F(e,function(i){if(S(i,"bpmn:Lane")||Ye(i)){n=!1;return}}),n};const yO={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",xl],bpmnAutoResizeProvider:["type",_l]};function Yo(e,t,n){this._canvas=n,this._opts=W({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var i=this;t.on("drag.move",function(r){var o=i._toBorderPoint(r);i.startScroll(o)}),t.on(["drag.cleanup"],function(){i.stopScroll()})}Yo.$inject=["config.autoScroll","eventBus","canvas"],Yo.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++)vO(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 vO(e,t,n){return t<e&&e<n}Yo.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Yo.prototype.setOptions=function(e){this._opts=W({},this._opts,e)},Yo.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=Hr(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const bO={__depends__:[Hi],__init__:["autoScroll"],autoScroll:["type",Yo]};var Dx="djs-bendpoint",Ix="djs-segment-dragger";function xO(e,t){var n=Hr(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 Jf(e,t,n){var i=xO(e,n),r=hp(t,i);return r}function ed(e,t){var n=Oe("g");et(n).add(Dx),ze(e,n);var i=Oe("circle");Se(i,{cx:0,cy:0,r:4}),et(i).add("djs-visual"),ze(n,i);var r=Oe("circle");return Se(r,{cx:0,cy:0,r:10}),et(r).add("djs-hit"),ze(n,r),t&&et(n).add(t),n}function _O(e,t,n,i){var r=Oe("g");ze(e,r);var o=18,a=6,s=11,c=EO(t,n,i),l=a+s,u=Oe("rect");Se(u,{x:-o/2,y:-a/2,width:o,height:a}),et(u).add("djs-visual"),ze(r,u);var f=Oe("rect");return Se(f,{x:-c/2,y:-l/2,width:c,height:l}),et(f).add("djs-hit"),ze(r,f),eg(r,i==="v"?90:0),r}function Lx(e,t,n){var i=Oe("g"),r=Gu(t,n),o=Li(t,n);return ze(e,i),_O(i,t,n,o),et(i).add(Ix),et(i).add(o==="h"?"horizontal":"vertical"),ln(i,r.x,r.y),i}function td(e){return Math.abs(Math.round(e*2/3))}function wO(e,t){var n=SO(e,t);return xp(e,n)}function EO(e,t,n){var i=t.x-e.x,r=t.y-e.y;return td(n==="h"?i:r)}function SO(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=jg(e,[a,s]);c<i&&(i=c,r=o)}return[n[r],n[r+1]]}function Bx(e,t,n,i,r){function o(b,x,C){var M=b.index,k=b.point,P,B,D,I,z,oe;return M<=0||b.bendpoint?!1:(P=x[M-1],B=x[M],D=Gu(P,B),I=Li(P,B),z=Math.abs(k.x-D.x),oe=Math.abs(k.y-D.y),I&&z<=C&&oe<=C)}function a(b,x){var C=b.waypoints,M,k,P,B;return x.index<=0||x.bendpoint||(M={start:C[x.index-1],end:C[x.index]},k=Li(M.start,M.end),!k)?null:(k==="h"?P=M.end.x-M.start.x:P=M.end.y-M.start.y,B=td(P)/2,B)}function s(b,x){var C=x.waypoints,M=Jf(t,C,b),k;if(M){k=a(x,M);var P;if(o(M,C,k)?P=r.start(b,x,M.index):P=i.start(b,x,M.index,!M.bendpoint),P!==!1)return!0}}function c(b,x,C){je.bind(b,x,function(M){n.triggerMouseEvent(x,M,C),M.stopPropagation()})}function l(b,x){var C=t.getLayer("overlays"),M=ft('.djs-bendpoints[data-element-id="'+Wa(b.id)+'"]',C);return!M&&x&&(M=Oe("g"),Se(M,{"data-element-id":b.id}),et(M).add("djs-bendpoints"),ze(C,M),c(M,"mousedown",b),c(M,"click",b),c(M,"dblclick",b)),M}function u(b,x){return ft('.djs-segment-dragger[data-segment-idx="'+b+'"]',x)}function f(b,x){x.waypoints.forEach(function(C,M){var k=ed(b);ze(b,k),ln(k,C.x,C.y)}),ed(b,"floating")}function p(b,x){for(var C=x.waypoints,M,k,P,B=1;B<C.length;B++)M=C[B-1],k=C[B],Li(M,k)&&(P=Lx(b,M,k),Se(P,{"data-segment-idx":B}),c(P,"mousemove",x))}function d(b){F(Ns("."+Dx,b),function(x){Kt(x)})}function m(b){F(Ns("."+Ix,b),function(x){Kt(x)})}function h(b){var x=l(b);return x||(x=l(b,!0),f(x,b),p(x,b)),x}function y(b){var x=l(b);x&&(m(x),d(x),p(x,b),f(x,b))}function v(b,x){var C=ft(".floating",b),M=x.point;C&&(ln(C,M.x,M.y),et(C).add("positioned"))}function g(b,x,C){var M=u(x.index,b),k=C[x.index-1],P=C[x.index],B=x.point,D=Gu(k,P),I=Li(k,P),z,oe;M&&(z=RO(M),oe={x:B.x-D.x,y:B.y-D.y},I==="v"&&(oe={x:oe.y,y:oe.x}),ln(z,oe.x,oe.y))}e.on("connection.changed",function(b){y(b.element)}),e.on("connection.remove",function(b){var x=l(b.element);x&&Kt(x)}),e.on("element.marker.update",function(b){var x=b.element,C;x.waypoints&&(C=h(x),b.add?et(C).add(b.marker):et(C).remove(b.marker))}),e.on("element.mousemove",function(b){var x=b.element,C=x.waypoints,M,k;if(C){if(M=l(x,!0),k=Jf(t,C,b.originalEvent),!k)return;v(M,k),k.bendpoint||g(M,k,C)}}),e.on("element.mousedown",function(b){if(pr(b)){var x=b.originalEvent,C=b.element;if(C.waypoints)return s(x,C)}}),e.on("selection.changed",function(b){var x=b.newSelection,C=x[0];C&&C.waypoints&&h(C)}),e.on("element.hover",function(b){var x=b.element;x.waypoints&&h(x)}),e.on("element.out",function(b){var x=b.element;if(x.waypoints){var C=l(x);if(C){var M=ft(".floating",C);M&&et(M).remove("positioned")}}}),e.on("element.updateId",function(b){var x=b.element,C=b.newId;if(x.waypoints){var M=l(x);M&&Se(M,{"data-element-id":C})}}),this.addHandles=h,this.updateHandles=y,this.getBendpointsContainer=l,this.getSegmentDragger=u}Bx.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function RO(e){return ft(".djs-visual",e)}var Nx=Math.round,Kr="reconnectStart",Xr="reconnectEnd",Qa="updateWaypoints";function nd(e,t,n,i,r,o){this._injector=e,this.start=function(a,s,c,l){var u=n.getGraphics(s),f=s.source,p=s.target,d=s.waypoints,m;!l&&c===0?m=Kr:!l&&c===d.length-1?m=Xr:m=Qa;var h=m===Qa?"connection.updateWaypoints":"connection.reconnect",y=r.allowed(h,{connection:s,source:f,target:p});if(y===!1&&(y=r.allowed(h,{connection:s,source:p,target:f})),y!==!1)return i.init(a,"bendpoint.move",{data:{connection:s,connectionGfx:u,context:{allowed:y,bendpointIndex:c,connection:s,source:f,target:p,insert:l,type:m}}})},t.on("bendpoint.move.hover",function(a){var s=a.context,c=s.connection,l=c.source,u=c.target,f=a.hover,p=s.type;s.hover=f;var d;if(f){var m=p===Qa?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=r.allowed(m,{connection:c,source:p===Kr?f:l,target:p===Xr?f:u}),d){s.source=p===Kr?f:l,s.target=p===Xr?f:u;return}d===!1&&(d=s.allowed=r.allowed(m,{connection:c,source:p===Xr?f:u,target:p===Kr?f:l})),d&&(s.source=p===Xr?f:u,s.target=p===Kr?f: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!==Qa&&(s.allowed=!1)}),t.on("bendpoint.move.end",function(a){var s=a.context,c=s.allowed,l=s.bendpointIndex,u=s.connection,f=s.insert,p=u.waypoints.slice(),d=s.source,m=s.target,h=s.type,y=s.hints||{},v={x:Nx(a.x),y:Nx(a.y)};if(!c)return!1;h===Qa?(f?p.splice(l,0,v):p[l]=v,y.bendpointMove={insert:f,bendpointIndex:l},p=this.cropWaypoints(u,p),o.updateWaypoints(u,OR(p),y)):(h===Kr?(y.docking="source",wl(s)&&(y.docking="target",y.newWaypoints=p.reverse())):h===Xr&&(y.docking="target",wl(s)&&(y.docking="source",y.newWaypoints=p.reverse())),o.reconnect(u,d,m,v,y))},this)}nd.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],nd.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 wl(e){var t=e.hover,n=e.source,i=e.target,r=e.type;if(r===Kr)return t&&i&&t===i&&n!==i;if(r===Xr)return t&&n&&t===n&&n!==i}var CO="reconnectStart",AO="reconnectEnd",$x="updateWaypoints",Ja="connect-ok",El="connect-not-ok",Fx="connect-hover",jx="djs-updating",Hx="djs-dragging",zx=1100;function Gx(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,f=u.slice();a.waypoints=u,l&&f.splice(s,0,{x:o.x,y:o.y}),c.waypoints=f;var p=a.draggerGfx=ed(i.getLayer("overlays"));et(p).add("djs-dragging"),i.addMarker(c,Hx),i.addMarker(c,jx)}),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,Fx),l===$x)return;s?(i.removeMarker(c,El),i.addMarker(c,Ja)):s===!1&&(i.removeMarker(c,Ja),i.addMarker(c,El))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],zx,function(o){var a=o.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,Fx),i.removeMarker(s,c?Ja:El))}),n.on("bendpoint.move.move",function(o){var a=o.context,s=a.allowed,c=a.bendpointIndex,l=a.draggerGfx,u=a.hover,f=a.type,p=a.connection,d=p.source,m=p.target,h=p.waypoints.slice(),y={x:o.x,y:o.y},v=a.hints||{},g={};r&&(v.connectionStart&&(g.connectionStart=v.connectionStart),v.connectionEnd&&(g.connectionEnd=v.connectionEnd),f===CO?wl(a)?(g.connectionEnd=g.connectionEnd||y,g.source=m,g.target=u||d,h=h.reverse()):(g.connectionStart=g.connectionStart||y,g.source=u||d,g.target=m):f===AO?wl(a)?(g.connectionStart=g.connectionStart||y,g.source=u||m,g.target=d,h=h.reverse()):(g.connectionEnd=g.connectionEnd||y,g.source=d,g.target=u||m):(g.noCropping=!0,g.noLayout=!0,h[c]=y),f===$x&&(h=e.cropWaypoints(p,h)),g.waypoints=h,r.drawPreview(a,s,g)),ln(l,o.x,o.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],zx,function(o){var a=o.context,s=a.connection,c=a.draggerGfx,l=a.hover,u=a.target,f=a.waypoints;s.waypoints=f,Kt(c),i.removeMarker(s,jx),i.removeMarker(s,Hx),l&&(i.removeMarker(l,Ja),i.removeMarker(l,u?Ja:El)),r&&r.cleanUp(a)})}Gx.$inject=["bendpointMove","injector","eventBus","canvas"];var Vx="connect-hover",Wx="djs-updating";function Ux(e,t,n){return id(e,t,e[t]+n)}function id(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function PO(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 id(t,i,s)}function Yx(e){return e==="x"?"y":"x"}function qx(e,t,n){var i,r;return e.original?e.original:(i=Ne(t),r=Yx(n),id(e,r,i[r]))}function Kx(e,t,n,i,r,o){var a=e.get("connectionDocking",!1);this.start=function(f,p,d){var m,h=n.getGraphics(p),y=d-1,v=d,g=p.waypoints,b=g[y],x=g[v],C=Jf(n,g,f),M,k,P;if(M=Li(b,x),!!M)return k=M==="v"?"x":"y",y===0&&(b=qx(b,p.source,k)),v===g.length-1&&(x=qx(x,p.target,k)),C?P=C.point:P={x:(b.x+x.x)/2,y:(b.y+x.y)/2},m={connection:p,segmentStartIndex:y,segmentEndIndex:v,segmentStart:b,segmentEnd:x,axis:k,dragPosition:P},i.init(f,P,"connectionSegment.move",{cursor:k==="x"?"resize-ew":"resize-ns",data:{connection:p,connectionGfx:h,context:m}})};function s(f,p){if(!a)return p;var d=f.waypoints,m;return f.waypoints=p,m=a.getCroppedWaypoints(f),f.waypoints=d,m}function c(f){r.update("connection",f.connection,f.connectionGfx)}function l(f,p,d){var m=f.newWaypoints,h=f.segmentStartIndex+p,y=m[h],v=f.segmentEndIndex+p,g=m[v],b=Yx(f.axis),x=PO(d,y,g,b);ln(f.draggerGfx,x.x,x.y)}function u(f,p){var d=0,m=f.filter(function(h,y){return zu(f[y-1],f[y+1],h)?(d=y<=p?d-1:d,!1):!0});return{waypoints:m,segmentOffset:d}}t.on("connectionSegment.move.start",function(f){var p=f.context,d=f.connection,m=n.getLayer("overlays");p.originalWaypoints=d.waypoints.slice(),p.draggerGfx=Lx(m,p.segmentStart,p.segmentEnd),et(p.draggerGfx).add("djs-dragging"),n.addMarker(d,Wx)}),t.on("connectionSegment.move.move",function(f){var p=f.context,d=p.connection,m=p.segmentStartIndex,h=p.segmentEndIndex,y=p.segmentStart,v=p.segmentEnd,g=p.axis,b=p.originalWaypoints.slice(),x=Ux(y,g,f["d"+g]),C=Ux(v,g,f["d"+g]),M=b.length,k=0;b[m]=x,b[h]=C;var P,B;m<2&&(P=cn(d.source,x),m===1?P==="intersect"&&(b.shift(),b[0]=x,k--):P!=="intersect"&&(b.unshift(y),k++)),h>M-3&&(B=cn(d.target,C),h===M-2?B==="intersect"&&(b.pop(),b[b.length-1]=C):B!=="intersect"&&b.push(v)),p.newWaypoints=d.waypoints=s(d,b),l(p,k,f),p.newSegmentStartIndex=m+k,c(f)}),t.on("connectionSegment.move.hover",function(f){f.context.hover=f.hover,n.addMarker(f.hover,Vx)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(f){var p=f.context.hover;p&&n.removeMarker(p,Vx)}),t.on("connectionSegment.move.cleanup",function(f){var p=f.context,d=p.connection;p.draggerGfx&&Kt(p.draggerGfx),n.removeMarker(d,Wx)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(f){var p=f.context,d=p.connection;d.waypoints=p.originalWaypoints,c(f)}),t.on("connectionSegment.move.end",function(f){var p=f.context,d=p.connection,m=p.newWaypoints,h=p.newSegmentStartIndex;m=m.map(function(C){return{original:C.original,x:Math.round(C.x),y:Math.round(C.y)}});var y=u(m,h),v=y.waypoints,g=s(d,v),b=y.segmentOffset,x={segmentMove:{segmentStartIndex:p.segmentStartIndex,newSegmentStartIndex:h+b}};o.updateWaypoints(d,g,x)})}Kx.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var MO=Math.abs,Xx=Math.round;function TO(e,t,n){n=n===void 0?10:n;var i,r;for(i=0;i<t.length;i++)if(r=t[i],MO(r-e)<=n)return r}function Zx(e){return{x:e.x,y:e.y}}function Qx(e){return{x:e.x+e.width,y:e.y+e.height}}function oi(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:Xx(e.x+e.width/2),y:Xx(e.y+e.height/2)}}function qo(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function Gt(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 Jx(e){return e.children||[]}var kO=Math.abs,e_=Math.round,rd=10;function t_(e){function t(o,a){if(Be(o)){for(var s=o.length;s--;)if(kO(o[s]-a)<=rd)return o[s]}else{o=+o;var c=a%o;if(c<rd)return a-c;if(c>o-rd)return a-c+o}return a}function n(o,a){if(o.waypoints)return wO(a,o);if(o.width)return{x:e_(o.width/2+o.x),y:e_(o.height/2+o.y)}}function i(o){var a=o.context,s=a.snapPoints,c=a.connection,l=c.waypoints,u=a.segmentStart,f=a.segmentStartIndex,p=a.segmentEnd,d=a.segmentEndIndex,m=a.axis;if(s)return s;var h=[l[f-1],u,p,l[d+1]];return f<2&&h.unshift(n(c.source,o)),d>l.length-3&&h.unshift(n(c.target,o)),a.snapPoints=s={horizontal:[],vertical:[]},F(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(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 f=s-l,p=c-u;W(o,{dx:o.dx-f,dy:o.dy-p,x:l,y:u}),(f||a.vertical.indexOf(s)!==-1)&&Gt(o,"x",l),(p||a.horizontal.indexOf(c)!==-1)&&Gt(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:[]},F(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);!ht(s)||!c||!c.x||!c.y||(Gt(o,"x",c.x),Gt(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,f=o.y,p,d;if(s){p=t(l?s.vertical.concat([l.x]):s.vertical,u),d=t(l?s.horizontal.concat([l.y]):s.horizontal,f);var m=u-p,h=f-d;W(o,{dx:o.dx-m,dy:o.dy-h,x:o.x-m,y:o.y-h}),(m||s.vertical.indexOf(u)!==-1)&&Gt(o,"x",p),(h||s.horizontal.indexOf(f)!==-1)&&Gt(o,"y",d)}})}t_.$inject=["eventBus"];const OO={__depends__:[Hi,Si],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",Bx],bendpointMove:["type",nd],bendpointMovePreview:["type",Gx],connectionSegmentMove:["type",Kx],bendpointSnapping:["type",t_]};function n_(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),!io(u)){if(u!==!1){s.source=c,s.target=l;return}u=s.canExecute=o(c,l),!io(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},f=s.source,p=s.target;if(!c)return!1;var d=null,m={connectionStart:od(s)?u:l,connectionEnd:od(s)?l:u};Qt(c)&&(d=c),s.connection=n.connect(f,p,d,m)}),this.start=function(a,s,c,l){Qt(c)||(l=c,c=Ne(s)),t.init(a,"connect",{autoActivate:l,data:{shape:s,context:{start:s,connectionStart:c}}})}}n_.$inject=["eventBus","dragging","modeling","rules"];function od(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var DO=1100,IO=900,i_="connect-ok",r_="connect-not-ok";function o_(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,f=o.target,p=o.connectionStart||u,d=o.connectionEnd||{x:r.x,y:r.y},m=p,h=d;od(o)&&(m=d,h=p),i.drawPreview(o,a,{source:c||l,target:f||s,connectionStart:m,connectionEnd:h})}),t.on("connect.hover",IO,function(r){var o=r.context,a=r.hover,s=o.canExecute;s!==null&&n.addMarker(a,s?i_:r_)}),t.on(["connect.out","connect.cleanup"],DO,function(r){var o=r.hover;o&&(n.removeMarker(o,i_),n.removeMarker(o,r_))}),i&&t.on("connect.cleanup",function(r){i.cleanUp(r.context)})}o_.$inject=["injector","eventBus","canvas"];const ad={__depends__:[ni,Si,Hi],__init__:["connectPreview"],connect:["type",n_],connectPreview:["type",o_]};var LO="djs-dragger";function qi(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)}qi.$inject=["injector","canvas","graphicsFactory","elementFactory"],qi.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,f=n.noCropping,p=n.noNoop,d,m=this;if(i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),$s(i),r||(r=e.getConnection=BO(function(h,y,v){return m.getConnection(h,y,v)})),t&&(d=r(t,o,a)),!d){!p&&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?Ne(o):c,a?Ne(a):l]),this._connectionDocking&&(o||a)&&!f&&(d.waypoints=this._connectionDocking.getCroppedWaypoints(d,o,a)),this._graphicsFactory.drawConnection(i,d,{stroke:"var(--element-dragger-color)"})},qi.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||Ne(n),o=t.connectionEnd||Ne(i),a=this.cropWaypoints(r,o,n,i),s=this.createNoopConnection(a[0],a[1]);ze(e,s)},qi.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&&da(o,s,!0)||e,t=i&&da(a,s,!1)||t,[e,t]},qi.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&Kt(e.connectionPreviewGfx)},qi.prototype.getConnection=function(e){var t=NO(e);return this._elementFactory.createConnection(t)},qi.prototype.createConnectionPreviewGfx=function(){var e=Oe("g");return Se(e,{pointerEvents:"none"}),et(e).add(LO),ze(this._canvas.getActiveLayer(),e),e},qi.prototype.createNoopConnection=function(e,t){return la([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function BO(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 NO(e){return Qt(e)?e:{}}const $O={__init__:["connectionPreview"],connectionPreview:["type",qi]},Sl="complex-preview";class a_{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(Sl);n.filter(s=>!FO(s)).forEach(s=>{let c;ht(s)?(c=this._graphicsFactory._createContainer("connection",Oe("g")),this._graphicsFactory.drawConnection($r(c),s)):(c=this._graphicsFactory._createContainer("shape",Oe("g")),this._graphicsFactory.drawShape($r(c),s),ln(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);ht(s)?ln(l,c.x,c.y):ln(l,s.x+c.x,s.y+c.y)}),r.forEach(s=>{this._previewSupport.addDragger(s,a,void 0,"djs-dragging"),this._canvas.addMarker(s,"djs-element-hidden"),this._markers.push([s,"djs-element-hidden"])}),o.forEach(({shape:s,bounds:c})=>{this._canvas.addMarker(s,"djs-hidden"),this._markers.push([s,"djs-hidden"]),this._previewSupport.addDragger(s,a,void 0,"djs-dragging");const l=this._graphicsFactory._createContainer("shape",Oe("g"));this._graphicsFactory.drawShape($r(l),s,{width:c.width,height:c.height}),ln(l,c.x,c.y),this._previewSupport.addDragger(s,a,l)})}cleanUp(){$s(this._canvas.getLayer(Sl)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(Sl)}hide(){this._canvas.hideLayer(Sl)}}a_.$inject=["canvas","graphicsFactory","previewSupport"];function FO(e){return e.hidden}const jO={__depends__:[No],__init__:["complexPreview"],complexPreview:["type",a_]},s_=Math.round;function Rl(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}Rl.prototype.create=function(e,t,n){const i=this._complexPreview,r=this._connectionDocking,o=this._elementFactory,a=this._eventBus,s=this._layouter,c=this._rules,l=o.createShape(W({type:t},n)),u=a.fire("autoPlace",{source:e,shape:l});if(!u)return;W(l,{x:u.x-s_(l.width/2),y:u.y-s_(l.height/2)});const f=c.allowed("connection.create",{source:e,target:l,hints:{targetParent:e.parent}});let p=null;f&&(p=o.createConnection(f),p.waypoints=s.layoutConnection(p,{source:e,target:l}),p.waypoints=r.getCroppedWaypoints(p,e,l)),i.create({created:[l,p].filter(d=>!io(d))})},Rl.prototype.cleanUp=function(){this._complexPreview.cleanUp()},Rl.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const HO={__depends__:[Zc,jO,Mf],__init__:["appendPreview"],appendPreview:["type",Rl]};var c_=Math.min,l_=Math.max;function sd(e){e.preventDefault()}function es(e){e.stopPropagation()}function zO(e){return e.nodeType===Node.TEXT_NODE}function GO(e){return[].slice.call(e)}function fi(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=ft("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=Rn(this.autoResize,this),this.handlePaste=Rn(this.handlePaste,this)}fi.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=li(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);W(o.style,{width:e.width+"px",height:e.height+"px",maxWidth:e.maxWidth+"px",maxHeight:e.maxHeight+"px",minWidth:e.minWidth+"px",minHeight:e.minHeight+"px",left:e.x+"px",top:e.y+"px",backgroundColor:"#ffffff",position:"absolute",overflow:"visible",border:"1px solid #ccc",boxSizing:"border-box",wordWrap:"normal",textAlign:"center",outline:"none"},c);var l=li(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return W(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},l),i.centerVertically&&W(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},l),a.innerText=n,je.bind(a,"keydown",this.keyHandler),je.bind(a,"mousedown",es),je.bind(a,"paste",r.handlePaste),je.bind(a,"focusout",this.focusoutHandler),i.autoResize&&je.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(o),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),o},fi.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)}},fi.prototype.insertText=function(e){e=VO(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},fi.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,r=t.startOffset,o=t.endOffset,a=t.commonAncestorContainer,s=GO(a.childNodes),c,l;if(zO(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 f=document.createTextNode(e);this.content.insertBefore(f,s[r]),c=f,l=f.textContent.length}else{var p=s.indexOf(n),d=s.indexOf(i);s.forEach(function(m,h){h===p?m.textContent=n.textContent.substring(0,r)+e+i.textContent.substring(o):h>p&&h<=d&&vi(m)}),c=n,l=r+e.length}c&&l!==void 0&&setTimeout(function(){self.setSelection(c,l)})},fi.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})}},fi.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=wt('<div class="djs-direct-editing-resize-handle"></div>');var s,c,l,u,f=function(m){sd(m),es(m),s=m.clientX,c=m.clientY;var h=t.getBoundingClientRect();l=h.width,u=h.height,je.bind(document,"mousemove",p),je.bind(document,"mouseup",d)},p=function(m){sd(m),es(m);var h=c_(l_(l+m.clientX-s,i),o),y=c_(l_(u+m.clientY-c,r),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})},d=function(m){sd(m),es(m),je.unbind(document,"mousemove",p,!1),je.unbind(document,"mouseup",d,!1)};je.bind(n,"mousedown",f)}W(n.style,{position:"absolute",bottom:"0px",right:"0px",cursor:"nwse-resize",width:"0",height:"0",borderTop:(parseInt(this.style.fontSize)/4||3)+"px solid transparent",borderRight:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderBottom:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderLeft:(parseInt(this.style.fontSize)/4||3)+"px solid transparent"}),t.appendChild(n)},fi.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),je.unbind(t,"keydown",this.keyHandler),je.unbind(t,"mousedown",es),je.unbind(t,"input",this.autoResize),je.unbind(t,"paste",this.handlePaste),je.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),vi(n)),vi(e)},fi.prototype.getValue=function(){return this.content.innerText.trim()},fi.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},fi.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 VO(e){return e.replace(/\r\n|\r|\n/g,`
|
|
316
|
-
`)}function Fn(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new fi({container:t.getContainer(),keyHandler:Rn(this._handleKey,this),resizeHandler:Rn(this._handleResize,this),focusoutHandler:Rn(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}Fn.$inject=["eventBus","canvas"],Fn.prototype.registerProvider=function(e){this._providers.push(e)},Fn.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},Fn.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},Fn.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},Fn.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},Fn.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},Fn.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()}},Fn.prototype.getValue=function(){return this._textbox.getValue()},Fn.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()},Fn.prototype._handleResize=function(e){this._fire("resize",e)},Fn.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},Fn.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=vt(this._providers,function(i){return(t=i.activate(e))?i:null});return t&&(this.$textbox=this._textbox.create(t.bounds,t.style,t.text,t.options),this._active={element:e,context:t,provider:n},t.options&&t.options.resizable&&(this.resizable=!0),this._fire("activate")),!!t};const u_={__depends__:[Ac],__init__:["directEditing"],directEditing:["type",Fn]};function WO(e){return function(t){var n=t.target,i=ie(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===Qe(e);return!o||!a||!s||!c}}const UO={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 J(e,t={}){var n=UO[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var YO=[J("none-start-event",{actionName:"replace-with-none-start"}),J("none-intermediate-throwing"),J("none-end-event",{actionName:"replace-with-none-end"}),J("message-start"),J("timer-start"),J("conditional-start"),J("signal-start")],qO=[J("none-start-event",{actionName:"replace-with-none-start"}),J("none-intermediate-throwing"),J("none-end-event",{actionName:"replace-with-none-end"})],KO=[J("none-start-event",{actionName:"replace-with-none-start"}),J("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),J("none-end-event",{actionName:"replace-with-none-end"}),J("message-intermediate-catch"),J("message-intermediate-throw"),J("timer-intermediate-catch"),J("escalation-intermediate-throw"),J("conditional-intermediate-catch"),J("link-intermediate-catch"),J("link-intermediate-throw"),J("compensation-intermediate-throw"),J("signal-intermediate-catch"),J("signal-intermediate-throw")],XO=[J("none-start-event",{actionName:"replace-with-none-start"}),J("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),J("none-end-event",{actionName:"replace-with-none-end"}),J("message-end"),J("escalation-end"),J("error-end"),J("cancel-end"),J("compensation-end"),J("signal-end"),J("terminate-end")],ZO=[J("exclusive-gateway"),J("parallel-gateway"),J("inclusive-gateway"),J("complex-gateway"),J("event-based-gateway")],QO=[J("transaction"),J("event-subprocess"),J("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),J("collapsed-subprocess")],JO=[J("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),J("transaction"),J("event-subprocess"),J("collapsed-ad-hoc-subprocess")],p_=[J("transaction"),J("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),J("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),J("event-subprocess")],eD=p_,f_=[J("task"),J("user-task"),J("service-task"),J("send-task"),J("receive-task"),J("manual-task"),J("rule-task"),J("script-task"),J("call-activity"),J("collapsed-subprocess"),J("expanded-subprocess"),J("collapsed-ad-hoc-subprocess"),J("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],tD=[J("data-store-reference")],nD=[J("data-object-reference")],iD=[J("message-boundary"),J("timer-boundary"),J("escalation-boundary"),J("conditional-boundary"),J("error-boundary"),J("cancel-boundary"),J("signal-boundary"),J("compensation-boundary"),J("non-interrupting-message-boundary"),J("non-interrupting-timer-boundary"),J("non-interrupting-escalation-boundary"),J("non-interrupting-conditional-boundary"),J("non-interrupting-signal-boundary")],rD=[J("message-start"),J("timer-start"),J("conditional-start"),J("signal-start"),J("error-start"),J("escalation-start"),J("compensation-start"),J("non-interrupting-message-start"),J("non-interrupting-timer-start"),J("non-interrupting-conditional-start"),J("non-interrupting-signal-start"),J("non-interrupting-escalation-start")],oD=[{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"}],aD=[J("expanded-pool"),J("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],sD={"bpmn:MessageEventDefinition":[J("message-start"),J("message-intermediate-catch"),J("message-intermediate-throw"),J("message-end")],"bpmn:TimerEventDefinition":[J("timer-start"),J("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[J("conditional-start"),J("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[J("signal-start"),J("signal-intermediate-catch"),J("signal-intermediate-throw"),J("signal-end")],"bpmn:ErrorEventDefinition":[J("error-start"),J("error-end")],"bpmn:EscalationEventDefinition":[J("escalation-start"),J("escalation-intermediate-throw"),J("escalation-end")],"bpmn:CompensateEventDefinition":[J("compensation-start"),J("compensation-intermediate-throw"),J("compensation-end")]};const d_={"start-event-non-interrupting":`
|
|
315
|
+
</svg>`},dO=900;function Uo(e,t,n,i){e.registerProvider(dO,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}Uo.$inject=["contextPad","popupMenu","translate","canvas"],Uo.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&W(t,this._getEntries(e)),t},Uo.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},Uo.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${Ox.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);W(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},Uo.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 hO=["left","center","right","top","middle","bottom"];function Xa(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}Xa.$inject=["popupMenu","alignElements","translate","rules"],Xa.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&W(t,this._getEntries(e)),t},Xa.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},Xa.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return F(hO,function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:Ox[o],action:function(){t.trigger(e,o),i.close()}}}),r};function bl(e){ti.call(this,e)}bl.$inject=["eventBus"],Ee(bl,ti),bl.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=Ke(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=Hs(n),n.length<2?!1:n})};const mO={__depends__:[Ck,Gb,Qf],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",Uo],alignElementsMenuProvider:["type",Xa],bpmnAlignElements:["type",bl]};function Yi(e,t,n,i){te.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=Kl(ro(a.closure.topLevel)),c=a.hints,l=c?c.autoResize:!0;if(l!==!1){var u=oo(s,function(f){return f.parent.id});F(u,function(f,p){Be(l)&&(f=f.filter(function(d){return vt(l,ao({id:d.id}))})),r._expand(f,p)})}}),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)})}Yi.$inject=["eventBus","elementRegistry","modeling","rules"],Ee(Yi,te),Yi.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=Ie(Ft(e)),o=Ie(t),a={};return r.top-o.top<i.top&&(a.top=r.top-n.top),r.left-o.left<i.left&&(a.left=r.left-n.left),o.right-r.right<i.right&&(a.right=r.right+n.right),o.bottom-r.bottom<i.bottom&&(a.bottom=r.bottom+n.bottom),Vs(W({},o,a))},Yi.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(gO(i,t)){var r=yO(li(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:r});var o=t.parent;o&&this._expand([t],o)}}},Yi.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},Yi.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},Yi.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function gO(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function yO(e,t){var n="";return e=Ie(e),t=Ie(t),e.top>t.top&&(n=n.concat("n")),e.right<t.right&&(n=n.concat("w")),e.bottom<t.bottom&&(n=n.concat("s")),e.left>t.left&&(n=n.concat("e")),n}function xl(e){e.invoke(Yi,this)}xl.$inject=["injector"],Ee(xl,Yi),xl.prototype.resize=function(e,t,n){S(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};function Za(e){ti.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}Za.$inject=["eventBus"],Ee(Za,ti),Za.prototype.canResize=function(e,t){return!1};function _l(e,t){Za.call(this,e),this._modeling=t}Ee(_l,Za),_l.$inject=["eventBus","modeling"],_l.prototype.canResize=function(e,t){if(S(t.di,"bpmndi:BPMNPlane")||!S(t,"bpmn:Participant")&&!S(t,"bpmn:Lane")&&!S(t,"bpmn:SubProcess"))return!1;var n=!0;return F(e,function(i){if(S(i,"bpmn:Lane")||Ye(i)){n=!1;return}}),n};const vO={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",xl],bpmnAutoResizeProvider:["type",_l]};function Yo(e,t,n){this._canvas=n,this._opts=W({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var i=this;t.on("drag.move",function(r){var o=i._toBorderPoint(r);i.startScroll(o)}),t.on(["drag.cleanup"],function(){i.stopScroll()})}Yo.$inject=["config.autoScroll","eventBus","canvas"],Yo.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++)bO(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 bO(e,t,n){return t<e&&e<n}Yo.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Yo.prototype.setOptions=function(e){this._opts=W({},this._opts,e)},Yo.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=Hr(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const xO={__depends__:[Hi],__init__:["autoScroll"],autoScroll:["type",Yo]};var Dx="djs-bendpoint",Ix="djs-segment-dragger";function _O(e,t){var n=Hr(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 Jf(e,t,n){var i=_O(e,n),r=hp(t,i);return r}function ed(e,t){var n=Oe("g");et(n).add(Dx),ze(e,n);var i=Oe("circle");Se(i,{cx:0,cy:0,r:4}),et(i).add("djs-visual"),ze(n,i);var r=Oe("circle");return Se(r,{cx:0,cy:0,r:10}),et(r).add("djs-hit"),ze(n,r),t&&et(n).add(t),n}function wO(e,t,n,i){var r=Oe("g");ze(e,r);var o=18,a=6,s=11,c=SO(t,n,i),l=a+s,u=Oe("rect");Se(u,{x:-o/2,y:-a/2,width:o,height:a}),et(u).add("djs-visual"),ze(r,u);var f=Oe("rect");return Se(f,{x:-c/2,y:-l/2,width:c,height:l}),et(f).add("djs-hit"),ze(r,f),eg(r,i==="v"?90:0),r}function Lx(e,t,n){var i=Oe("g"),r=Gu(t,n),o=Li(t,n);return ze(e,i),wO(i,t,n,o),et(i).add(Ix),et(i).add(o==="h"?"horizontal":"vertical"),ln(i,r.x,r.y),i}function td(e){return Math.abs(Math.round(e*2/3))}function EO(e,t){var n=RO(e,t);return xp(e,n)}function SO(e,t,n){var i=t.x-e.x,r=t.y-e.y;return td(n==="h"?i:r)}function RO(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=jg(e,[a,s]);c<i&&(i=c,r=o)}return[n[r],n[r+1]]}function Bx(e,t,n,i,r){function o(b,x,C){var M=b.index,k=b.point,P,B,D,I,z,oe;return M<=0||b.bendpoint?!1:(P=x[M-1],B=x[M],D=Gu(P,B),I=Li(P,B),z=Math.abs(k.x-D.x),oe=Math.abs(k.y-D.y),I&&z<=C&&oe<=C)}function a(b,x){var C=b.waypoints,M,k,P,B;return x.index<=0||x.bendpoint||(M={start:C[x.index-1],end:C[x.index]},k=Li(M.start,M.end),!k)?null:(k==="h"?P=M.end.x-M.start.x:P=M.end.y-M.start.y,B=td(P)/2,B)}function s(b,x){var C=x.waypoints,M=Jf(t,C,b),k;if(M){k=a(x,M);var P;if(o(M,C,k)?P=r.start(b,x,M.index):P=i.start(b,x,M.index,!M.bendpoint),P!==!1)return!0}}function c(b,x,C){je.bind(b,x,function(M){n.triggerMouseEvent(x,M,C),M.stopPropagation()})}function l(b,x){var C=t.getLayer("overlays"),M=ft('.djs-bendpoints[data-element-id="'+Wa(b.id)+'"]',C);return!M&&x&&(M=Oe("g"),Se(M,{"data-element-id":b.id}),et(M).add("djs-bendpoints"),ze(C,M),c(M,"mousedown",b),c(M,"click",b),c(M,"dblclick",b)),M}function u(b,x){return ft('.djs-segment-dragger[data-segment-idx="'+b+'"]',x)}function f(b,x){x.waypoints.forEach(function(C,M){var k=ed(b);ze(b,k),ln(k,C.x,C.y)}),ed(b,"floating")}function p(b,x){for(var C=x.waypoints,M,k,P,B=1;B<C.length;B++)M=C[B-1],k=C[B],Li(M,k)&&(P=Lx(b,M,k),Se(P,{"data-segment-idx":B}),c(P,"mousemove",x))}function d(b){F(Ns("."+Dx,b),function(x){Kt(x)})}function m(b){F(Ns("."+Ix,b),function(x){Kt(x)})}function h(b){var x=l(b);return x||(x=l(b,!0),f(x,b),p(x,b)),x}function y(b){var x=l(b);x&&(m(x),d(x),p(x,b),f(x,b))}function v(b,x){var C=ft(".floating",b),M=x.point;C&&(ln(C,M.x,M.y),et(C).add("positioned"))}function g(b,x,C){var M=u(x.index,b),k=C[x.index-1],P=C[x.index],B=x.point,D=Gu(k,P),I=Li(k,P),z,oe;M&&(z=CO(M),oe={x:B.x-D.x,y:B.y-D.y},I==="v"&&(oe={x:oe.y,y:oe.x}),ln(z,oe.x,oe.y))}e.on("connection.changed",function(b){y(b.element)}),e.on("connection.remove",function(b){var x=l(b.element);x&&Kt(x)}),e.on("element.marker.update",function(b){var x=b.element,C;x.waypoints&&(C=h(x),b.add?et(C).add(b.marker):et(C).remove(b.marker))}),e.on("element.mousemove",function(b){var x=b.element,C=x.waypoints,M,k;if(C){if(M=l(x,!0),k=Jf(t,C,b.originalEvent),!k)return;v(M,k),k.bendpoint||g(M,k,C)}}),e.on("element.mousedown",function(b){if(pr(b)){var x=b.originalEvent,C=b.element;if(C.waypoints)return s(x,C)}}),e.on("selection.changed",function(b){var x=b.newSelection,C=x[0];C&&C.waypoints&&h(C)}),e.on("element.hover",function(b){var x=b.element;x.waypoints&&h(x)}),e.on("element.out",function(b){var x=b.element;if(x.waypoints){var C=l(x);if(C){var M=ft(".floating",C);M&&et(M).remove("positioned")}}}),e.on("element.updateId",function(b){var x=b.element,C=b.newId;if(x.waypoints){var M=l(x);M&&Se(M,{"data-element-id":C})}}),this.addHandles=h,this.updateHandles=y,this.getBendpointsContainer=l,this.getSegmentDragger=u}Bx.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function CO(e){return ft(".djs-visual",e)}var Nx=Math.round,Kr="reconnectStart",Xr="reconnectEnd",Qa="updateWaypoints";function nd(e,t,n,i,r,o){this._injector=e,this.start=function(a,s,c,l){var u=n.getGraphics(s),f=s.source,p=s.target,d=s.waypoints,m;!l&&c===0?m=Kr:!l&&c===d.length-1?m=Xr:m=Qa;var h=m===Qa?"connection.updateWaypoints":"connection.reconnect",y=r.allowed(h,{connection:s,source:f,target:p});if(y===!1&&(y=r.allowed(h,{connection:s,source:p,target:f})),y!==!1)return i.init(a,"bendpoint.move",{data:{connection:s,connectionGfx:u,context:{allowed:y,bendpointIndex:c,connection:s,source:f,target:p,insert:l,type:m}}})},t.on("bendpoint.move.hover",function(a){var s=a.context,c=s.connection,l=c.source,u=c.target,f=a.hover,p=s.type;s.hover=f;var d;if(f){var m=p===Qa?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=r.allowed(m,{connection:c,source:p===Kr?f:l,target:p===Xr?f:u}),d){s.source=p===Kr?f:l,s.target=p===Xr?f:u;return}d===!1&&(d=s.allowed=r.allowed(m,{connection:c,source:p===Xr?f:u,target:p===Kr?f:l})),d&&(s.source=p===Xr?f:u,s.target=p===Kr?f: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!==Qa&&(s.allowed=!1)}),t.on("bendpoint.move.end",function(a){var s=a.context,c=s.allowed,l=s.bendpointIndex,u=s.connection,f=s.insert,p=u.waypoints.slice(),d=s.source,m=s.target,h=s.type,y=s.hints||{},v={x:Nx(a.x),y:Nx(a.y)};if(!c)return!1;h===Qa?(f?p.splice(l,0,v):p[l]=v,y.bendpointMove={insert:f,bendpointIndex:l},p=this.cropWaypoints(u,p),o.updateWaypoints(u,DR(p),y)):(h===Kr?(y.docking="source",wl(s)&&(y.docking="target",y.newWaypoints=p.reverse())):h===Xr&&(y.docking="target",wl(s)&&(y.docking="source",y.newWaypoints=p.reverse())),o.reconnect(u,d,m,v,y))},this)}nd.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],nd.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 wl(e){var t=e.hover,n=e.source,i=e.target,r=e.type;if(r===Kr)return t&&i&&t===i&&n!==i;if(r===Xr)return t&&n&&t===n&&n!==i}var AO="reconnectStart",PO="reconnectEnd",$x="updateWaypoints",Ja="connect-ok",El="connect-not-ok",Fx="connect-hover",jx="djs-updating",Hx="djs-dragging",zx=1100;function Gx(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,f=u.slice();a.waypoints=u,l&&f.splice(s,0,{x:o.x,y:o.y}),c.waypoints=f;var p=a.draggerGfx=ed(i.getLayer("overlays"));et(p).add("djs-dragging"),i.addMarker(c,Hx),i.addMarker(c,jx)}),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,Fx),l===$x)return;s?(i.removeMarker(c,El),i.addMarker(c,Ja)):s===!1&&(i.removeMarker(c,Ja),i.addMarker(c,El))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],zx,function(o){var a=o.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,Fx),i.removeMarker(s,c?Ja:El))}),n.on("bendpoint.move.move",function(o){var a=o.context,s=a.allowed,c=a.bendpointIndex,l=a.draggerGfx,u=a.hover,f=a.type,p=a.connection,d=p.source,m=p.target,h=p.waypoints.slice(),y={x:o.x,y:o.y},v=a.hints||{},g={};r&&(v.connectionStart&&(g.connectionStart=v.connectionStart),v.connectionEnd&&(g.connectionEnd=v.connectionEnd),f===AO?wl(a)?(g.connectionEnd=g.connectionEnd||y,g.source=m,g.target=u||d,h=h.reverse()):(g.connectionStart=g.connectionStart||y,g.source=u||d,g.target=m):f===PO?wl(a)?(g.connectionStart=g.connectionStart||y,g.source=u||m,g.target=d,h=h.reverse()):(g.connectionEnd=g.connectionEnd||y,g.source=d,g.target=u||m):(g.noCropping=!0,g.noLayout=!0,h[c]=y),f===$x&&(h=e.cropWaypoints(p,h)),g.waypoints=h,r.drawPreview(a,s,g)),ln(l,o.x,o.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],zx,function(o){var a=o.context,s=a.connection,c=a.draggerGfx,l=a.hover,u=a.target,f=a.waypoints;s.waypoints=f,Kt(c),i.removeMarker(s,jx),i.removeMarker(s,Hx),l&&(i.removeMarker(l,Ja),i.removeMarker(l,u?Ja:El)),r&&r.cleanUp(a)})}Gx.$inject=["bendpointMove","injector","eventBus","canvas"];var Vx="connect-hover",Wx="djs-updating";function Ux(e,t,n){return id(e,t,e[t]+n)}function id(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function MO(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 id(t,i,s)}function Yx(e){return e==="x"?"y":"x"}function qx(e,t,n){var i,r;return e.original?e.original:(i=Ne(t),r=Yx(n),id(e,r,i[r]))}function Kx(e,t,n,i,r,o){var a=e.get("connectionDocking",!1);this.start=function(f,p,d){var m,h=n.getGraphics(p),y=d-1,v=d,g=p.waypoints,b=g[y],x=g[v],C=Jf(n,g,f),M,k,P;if(M=Li(b,x),!!M)return k=M==="v"?"x":"y",y===0&&(b=qx(b,p.source,k)),v===g.length-1&&(x=qx(x,p.target,k)),C?P=C.point:P={x:(b.x+x.x)/2,y:(b.y+x.y)/2},m={connection:p,segmentStartIndex:y,segmentEndIndex:v,segmentStart:b,segmentEnd:x,axis:k,dragPosition:P},i.init(f,P,"connectionSegment.move",{cursor:k==="x"?"resize-ew":"resize-ns",data:{connection:p,connectionGfx:h,context:m}})};function s(f,p){if(!a)return p;var d=f.waypoints,m;return f.waypoints=p,m=a.getCroppedWaypoints(f),f.waypoints=d,m}function c(f){r.update("connection",f.connection,f.connectionGfx)}function l(f,p,d){var m=f.newWaypoints,h=f.segmentStartIndex+p,y=m[h],v=f.segmentEndIndex+p,g=m[v],b=Yx(f.axis),x=MO(d,y,g,b);ln(f.draggerGfx,x.x,x.y)}function u(f,p){var d=0,m=f.filter(function(h,y){return zu(f[y-1],f[y+1],h)?(d=y<=p?d-1:d,!1):!0});return{waypoints:m,segmentOffset:d}}t.on("connectionSegment.move.start",function(f){var p=f.context,d=f.connection,m=n.getLayer("overlays");p.originalWaypoints=d.waypoints.slice(),p.draggerGfx=Lx(m,p.segmentStart,p.segmentEnd),et(p.draggerGfx).add("djs-dragging"),n.addMarker(d,Wx)}),t.on("connectionSegment.move.move",function(f){var p=f.context,d=p.connection,m=p.segmentStartIndex,h=p.segmentEndIndex,y=p.segmentStart,v=p.segmentEnd,g=p.axis,b=p.originalWaypoints.slice(),x=Ux(y,g,f["d"+g]),C=Ux(v,g,f["d"+g]),M=b.length,k=0;b[m]=x,b[h]=C;var P,B;m<2&&(P=cn(d.source,x),m===1?P==="intersect"&&(b.shift(),b[0]=x,k--):P!=="intersect"&&(b.unshift(y),k++)),h>M-3&&(B=cn(d.target,C),h===M-2?B==="intersect"&&(b.pop(),b[b.length-1]=C):B!=="intersect"&&b.push(v)),p.newWaypoints=d.waypoints=s(d,b),l(p,k,f),p.newSegmentStartIndex=m+k,c(f)}),t.on("connectionSegment.move.hover",function(f){f.context.hover=f.hover,n.addMarker(f.hover,Vx)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(f){var p=f.context.hover;p&&n.removeMarker(p,Vx)}),t.on("connectionSegment.move.cleanup",function(f){var p=f.context,d=p.connection;p.draggerGfx&&Kt(p.draggerGfx),n.removeMarker(d,Wx)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(f){var p=f.context,d=p.connection;d.waypoints=p.originalWaypoints,c(f)}),t.on("connectionSegment.move.end",function(f){var p=f.context,d=p.connection,m=p.newWaypoints,h=p.newSegmentStartIndex;m=m.map(function(C){return{original:C.original,x:Math.round(C.x),y:Math.round(C.y)}});var y=u(m,h),v=y.waypoints,g=s(d,v),b=y.segmentOffset,x={segmentMove:{segmentStartIndex:p.segmentStartIndex,newSegmentStartIndex:h+b}};o.updateWaypoints(d,g,x)})}Kx.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var TO=Math.abs,Xx=Math.round;function kO(e,t,n){n=n===void 0?10:n;var i,r;for(i=0;i<t.length;i++)if(r=t[i],TO(r-e)<=n)return r}function Zx(e){return{x:e.x,y:e.y}}function Qx(e){return{x:e.x+e.width,y:e.y+e.height}}function oi(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:Xx(e.x+e.width/2),y:Xx(e.y+e.height/2)}}function qo(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function Gt(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 Jx(e){return e.children||[]}var OO=Math.abs,e_=Math.round,rd=10;function t_(e){function t(o,a){if(Be(o)){for(var s=o.length;s--;)if(OO(o[s]-a)<=rd)return o[s]}else{o=+o;var c=a%o;if(c<rd)return a-c;if(c>o-rd)return a-c+o}return a}function n(o,a){if(o.waypoints)return EO(a,o);if(o.width)return{x:e_(o.width/2+o.x),y:e_(o.height/2+o.y)}}function i(o){var a=o.context,s=a.snapPoints,c=a.connection,l=c.waypoints,u=a.segmentStart,f=a.segmentStartIndex,p=a.segmentEnd,d=a.segmentEndIndex,m=a.axis;if(s)return s;var h=[l[f-1],u,p,l[d+1]];return f<2&&h.unshift(n(c.source,o)),d>l.length-3&&h.unshift(n(c.target,o)),a.snapPoints=s={horizontal:[],vertical:[]},F(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(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 f=s-l,p=c-u;W(o,{dx:o.dx-f,dy:o.dy-p,x:l,y:u}),(f||a.vertical.indexOf(s)!==-1)&&Gt(o,"x",l),(p||a.horizontal.indexOf(c)!==-1)&&Gt(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:[]},F(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);!ht(s)||!c||!c.x||!c.y||(Gt(o,"x",c.x),Gt(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,f=o.y,p,d;if(s){p=t(l?s.vertical.concat([l.x]):s.vertical,u),d=t(l?s.horizontal.concat([l.y]):s.horizontal,f);var m=u-p,h=f-d;W(o,{dx:o.dx-m,dy:o.dy-h,x:o.x-m,y:o.y-h}),(m||s.vertical.indexOf(u)!==-1)&&Gt(o,"x",p),(h||s.horizontal.indexOf(f)!==-1)&&Gt(o,"y",d)}})}t_.$inject=["eventBus"];const DO={__depends__:[Hi,Si],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",Bx],bendpointMove:["type",nd],bendpointMovePreview:["type",Gx],connectionSegmentMove:["type",Kx],bendpointSnapping:["type",t_]};function n_(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),!io(u)){if(u!==!1){s.source=c,s.target=l;return}u=s.canExecute=o(c,l),!io(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},f=s.source,p=s.target;if(!c)return!1;var d=null,m={connectionStart:od(s)?u:l,connectionEnd:od(s)?l:u};Qt(c)&&(d=c),s.connection=n.connect(f,p,d,m)}),this.start=function(a,s,c,l){Qt(c)||(l=c,c=Ne(s)),t.init(a,"connect",{autoActivate:l,data:{shape:s,context:{start:s,connectionStart:c}}})}}n_.$inject=["eventBus","dragging","modeling","rules"];function od(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var IO=1100,LO=900,i_="connect-ok",r_="connect-not-ok";function o_(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,f=o.target,p=o.connectionStart||u,d=o.connectionEnd||{x:r.x,y:r.y},m=p,h=d;od(o)&&(m=d,h=p),i.drawPreview(o,a,{source:c||l,target:f||s,connectionStart:m,connectionEnd:h})}),t.on("connect.hover",LO,function(r){var o=r.context,a=r.hover,s=o.canExecute;s!==null&&n.addMarker(a,s?i_:r_)}),t.on(["connect.out","connect.cleanup"],IO,function(r){var o=r.hover;o&&(n.removeMarker(o,i_),n.removeMarker(o,r_))}),i&&t.on("connect.cleanup",function(r){i.cleanUp(r.context)})}o_.$inject=["injector","eventBus","canvas"];const ad={__depends__:[ni,Si,Hi],__init__:["connectPreview"],connect:["type",n_],connectPreview:["type",o_]};var BO="djs-dragger";function qi(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)}qi.$inject=["injector","canvas","graphicsFactory","elementFactory"],qi.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,f=n.noCropping,p=n.noNoop,d,m=this;if(i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),$s(i),r||(r=e.getConnection=NO(function(h,y,v){return m.getConnection(h,y,v)})),t&&(d=r(t,o,a)),!d){!p&&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?Ne(o):c,a?Ne(a):l]),this._connectionDocking&&(o||a)&&!f&&(d.waypoints=this._connectionDocking.getCroppedWaypoints(d,o,a)),this._graphicsFactory.drawConnection(i,d,{stroke:"var(--element-dragger-color)"})},qi.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||Ne(n),o=t.connectionEnd||Ne(i),a=this.cropWaypoints(r,o,n,i),s=this.createNoopConnection(a[0],a[1]);ze(e,s)},qi.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&&da(o,s,!0)||e,t=i&&da(a,s,!1)||t,[e,t]},qi.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&Kt(e.connectionPreviewGfx)},qi.prototype.getConnection=function(e){var t=$O(e);return this._elementFactory.createConnection(t)},qi.prototype.createConnectionPreviewGfx=function(){var e=Oe("g");return Se(e,{pointerEvents:"none"}),et(e).add(BO),ze(this._canvas.getActiveLayer(),e),e},qi.prototype.createNoopConnection=function(e,t){return la([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function NO(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 $O(e){return Qt(e)?e:{}}const FO={__init__:["connectionPreview"],connectionPreview:["type",qi]},Sl="complex-preview";class a_{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(Sl);n.filter(s=>!jO(s)).forEach(s=>{let c;ht(s)?(c=this._graphicsFactory._createContainer("connection",Oe("g")),this._graphicsFactory.drawConnection($r(c),s)):(c=this._graphicsFactory._createContainer("shape",Oe("g")),this._graphicsFactory.drawShape($r(c),s),ln(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);ht(s)?ln(l,c.x,c.y):ln(l,s.x+c.x,s.y+c.y)}),r.forEach(s=>{this._previewSupport.addDragger(s,a,void 0,"djs-dragging"),this._canvas.addMarker(s,"djs-element-hidden"),this._markers.push([s,"djs-element-hidden"])}),o.forEach(({shape:s,bounds:c})=>{this._canvas.addMarker(s,"djs-hidden"),this._markers.push([s,"djs-hidden"]),this._previewSupport.addDragger(s,a,void 0,"djs-dragging");const l=this._graphicsFactory._createContainer("shape",Oe("g"));this._graphicsFactory.drawShape($r(l),s,{width:c.width,height:c.height}),ln(l,c.x,c.y),this._previewSupport.addDragger(s,a,l)})}cleanUp(){$s(this._canvas.getLayer(Sl)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(Sl)}hide(){this._canvas.hideLayer(Sl)}}a_.$inject=["canvas","graphicsFactory","previewSupport"];function jO(e){return e.hidden}const HO={__depends__:[No],__init__:["complexPreview"],complexPreview:["type",a_]},s_=Math.round;function Rl(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}Rl.prototype.create=function(e,t,n){const i=this._complexPreview,r=this._connectionDocking,o=this._elementFactory,a=this._eventBus,s=this._layouter,c=this._rules,l=o.createShape(W({type:t},n)),u=a.fire("autoPlace",{source:e,shape:l});if(!u)return;W(l,{x:u.x-s_(l.width/2),y:u.y-s_(l.height/2)});const f=c.allowed("connection.create",{source:e,target:l,hints:{targetParent:e.parent}});let p=null;f&&(p=o.createConnection(f),p.waypoints=s.layoutConnection(p,{source:e,target:l}),p.waypoints=r.getCroppedWaypoints(p,e,l)),i.create({created:[l,p].filter(d=>!io(d))})},Rl.prototype.cleanUp=function(){this._complexPreview.cleanUp()},Rl.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const zO={__depends__:[Zc,HO,Mf],__init__:["appendPreview"],appendPreview:["type",Rl]};var c_=Math.min,l_=Math.max;function sd(e){e.preventDefault()}function es(e){e.stopPropagation()}function GO(e){return e.nodeType===Node.TEXT_NODE}function VO(e){return[].slice.call(e)}function fi(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=ft("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=Rn(this.autoResize,this),this.handlePaste=Rn(this.handlePaste,this)}fi.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=li(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);W(o.style,{width:e.width+"px",height:e.height+"px",maxWidth:e.maxWidth+"px",maxHeight:e.maxHeight+"px",minWidth:e.minWidth+"px",minHeight:e.minHeight+"px",left:e.x+"px",top:e.y+"px",backgroundColor:"#ffffff",position:"absolute",overflow:"visible",border:"1px solid #ccc",boxSizing:"border-box",wordWrap:"normal",textAlign:"center",outline:"none"},c);var l=li(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return W(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},l),i.centerVertically&&W(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},l),a.innerText=n,je.bind(a,"keydown",this.keyHandler),je.bind(a,"mousedown",es),je.bind(a,"paste",r.handlePaste),je.bind(a,"focusout",this.focusoutHandler),i.autoResize&&je.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(o),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),o},fi.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)}},fi.prototype.insertText=function(e){e=WO(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},fi.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,r=t.startOffset,o=t.endOffset,a=t.commonAncestorContainer,s=VO(a.childNodes),c,l;if(GO(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 f=document.createTextNode(e);this.content.insertBefore(f,s[r]),c=f,l=f.textContent.length}else{var p=s.indexOf(n),d=s.indexOf(i);s.forEach(function(m,h){h===p?m.textContent=n.textContent.substring(0,r)+e+i.textContent.substring(o):h>p&&h<=d&&vi(m)}),c=n,l=r+e.length}c&&l!==void 0&&setTimeout(function(){self.setSelection(c,l)})},fi.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})}},fi.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=wt('<div class="djs-direct-editing-resize-handle"></div>');var s,c,l,u,f=function(m){sd(m),es(m),s=m.clientX,c=m.clientY;var h=t.getBoundingClientRect();l=h.width,u=h.height,je.bind(document,"mousemove",p),je.bind(document,"mouseup",d)},p=function(m){sd(m),es(m);var h=c_(l_(l+m.clientX-s,i),o),y=c_(l_(u+m.clientY-c,r),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})},d=function(m){sd(m),es(m),je.unbind(document,"mousemove",p,!1),je.unbind(document,"mouseup",d,!1)};je.bind(n,"mousedown",f)}W(n.style,{position:"absolute",bottom:"0px",right:"0px",cursor:"nwse-resize",width:"0",height:"0",borderTop:(parseInt(this.style.fontSize)/4||3)+"px solid transparent",borderRight:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderBottom:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderLeft:(parseInt(this.style.fontSize)/4||3)+"px solid transparent"}),t.appendChild(n)},fi.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),je.unbind(t,"keydown",this.keyHandler),je.unbind(t,"mousedown",es),je.unbind(t,"input",this.autoResize),je.unbind(t,"paste",this.handlePaste),je.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),vi(n)),vi(e)},fi.prototype.getValue=function(){return this.content.innerText.trim()},fi.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},fi.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 WO(e){return e.replace(/\r\n|\r|\n/g,`
|
|
316
|
+
`)}function Fn(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new fi({container:t.getContainer(),keyHandler:Rn(this._handleKey,this),resizeHandler:Rn(this._handleResize,this),focusoutHandler:Rn(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}Fn.$inject=["eventBus","canvas"],Fn.prototype.registerProvider=function(e){this._providers.push(e)},Fn.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},Fn.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},Fn.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},Fn.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},Fn.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},Fn.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()}},Fn.prototype.getValue=function(){return this._textbox.getValue()},Fn.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()},Fn.prototype._handleResize=function(e){this._fire("resize",e)},Fn.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},Fn.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=vt(this._providers,function(i){return(t=i.activate(e))?i:null});return t&&(this.$textbox=this._textbox.create(t.bounds,t.style,t.text,t.options),this._active={element:e,context:t,provider:n},t.options&&t.options.resizable&&(this.resizable=!0),this._fire("activate")),!!t};const u_={__depends__:[Ac],__init__:["directEditing"],directEditing:["type",Fn]};function UO(e){return function(t){var n=t.target,i=ie(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===Qe(e);return!o||!a||!s||!c}}const YO={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 J(e,t={}){var n=YO[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var qO=[J("none-start-event",{actionName:"replace-with-none-start"}),J("none-intermediate-throwing"),J("none-end-event",{actionName:"replace-with-none-end"}),J("message-start"),J("timer-start"),J("conditional-start"),J("signal-start")],KO=[J("none-start-event",{actionName:"replace-with-none-start"}),J("none-intermediate-throwing"),J("none-end-event",{actionName:"replace-with-none-end"})],XO=[J("none-start-event",{actionName:"replace-with-none-start"}),J("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),J("none-end-event",{actionName:"replace-with-none-end"}),J("message-intermediate-catch"),J("message-intermediate-throw"),J("timer-intermediate-catch"),J("escalation-intermediate-throw"),J("conditional-intermediate-catch"),J("link-intermediate-catch"),J("link-intermediate-throw"),J("compensation-intermediate-throw"),J("signal-intermediate-catch"),J("signal-intermediate-throw")],ZO=[J("none-start-event",{actionName:"replace-with-none-start"}),J("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),J("none-end-event",{actionName:"replace-with-none-end"}),J("message-end"),J("escalation-end"),J("error-end"),J("cancel-end"),J("compensation-end"),J("signal-end"),J("terminate-end")],QO=[J("exclusive-gateway"),J("parallel-gateway"),J("inclusive-gateway"),J("complex-gateway"),J("event-based-gateway")],JO=[J("transaction"),J("event-subprocess"),J("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),J("collapsed-subprocess")],eD=[J("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),J("transaction"),J("event-subprocess"),J("collapsed-ad-hoc-subprocess")],p_=[J("transaction"),J("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),J("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),J("event-subprocess")],tD=p_,f_=[J("task"),J("user-task"),J("service-task"),J("send-task"),J("receive-task"),J("manual-task"),J("rule-task"),J("script-task"),J("call-activity"),J("collapsed-subprocess"),J("expanded-subprocess"),J("collapsed-ad-hoc-subprocess"),J("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],nD=[J("data-store-reference")],iD=[J("data-object-reference")],rD=[J("message-boundary"),J("timer-boundary"),J("escalation-boundary"),J("conditional-boundary"),J("error-boundary"),J("cancel-boundary"),J("signal-boundary"),J("compensation-boundary"),J("non-interrupting-message-boundary"),J("non-interrupting-timer-boundary"),J("non-interrupting-escalation-boundary"),J("non-interrupting-conditional-boundary"),J("non-interrupting-signal-boundary")],oD=[J("message-start"),J("timer-start"),J("conditional-start"),J("signal-start"),J("error-start"),J("escalation-start"),J("compensation-start"),J("non-interrupting-message-start"),J("non-interrupting-timer-start"),J("non-interrupting-conditional-start"),J("non-interrupting-signal-start"),J("non-interrupting-escalation-start")],aD=[{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"}],sD=[J("expanded-pool"),J("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],cD={"bpmn:MessageEventDefinition":[J("message-start"),J("message-intermediate-catch"),J("message-intermediate-throw"),J("message-end")],"bpmn:TimerEventDefinition":[J("timer-start"),J("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[J("conditional-start"),J("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[J("signal-start"),J("signal-intermediate-catch"),J("signal-intermediate-throw"),J("signal-end")],"bpmn:ErrorEventDefinition":[J("error-start"),J("error-end")],"bpmn:EscalationEventDefinition":[J("escalation-start"),J("escalation-intermediate-throw"),J("escalation-end")],"bpmn:CompensateEventDefinition":[J("compensation-start"),J("compensation-intermediate-throw"),J("compensation-end")]};const d_={"start-event-non-interrupting":`
|
|
317
317
|
<svg viewBox="0 0 2048 2048" xmlns="http://www.w3.org/2000/svg">
|
|
318
318
|
<g transform="translate(0 995.64)">
|
|
319
319
|
<path d="m1899 28.357c21.545 567.43-598.38 1023.5-1133.6 835.92-548.09-147.21-801.57-873.95-463.59-1330 302.62-480.3 1071.7-507.54 1407.6-49.847 122.14 153.12 190.07 348.07 189.59 543.91z" fill="none" stroke="currentColor" stroke-dasharray="418.310422, 361.2328165" stroke-linecap="round" stroke-width="100"/>
|
|
@@ -324,7 +324,7 @@
|
|
|
324
324
|
<circle cx="1024" cy="28.357" r="875" stroke-dasharray="418.310422, 361.2328165" stroke-width="100"/>
|
|
325
325
|
<circle cx="1024" cy="28.357" r="685" stroke-dasharray="348.31044857,261.23283643" stroke-dashoffset="500" stroke-width="100"/>
|
|
326
326
|
</g>
|
|
327
|
-
</svg>`};function ai(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()}ai.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],ai.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},ai.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],r,o=[];if(Be(e)||!n.allowed("shape.replace",{element:e}))return{};var a=WO(e);return S(t,"bpmn:DataObjectReference")?this._createEntries(e,tD):S(t,"bpmn:DataStoreReference")&&!S(e.parent,"bpmn:Collaboration")?this._createEntries(e,nD):(S(t,"bpmn:Event")&&!S(t,"bpmn:BoundaryEvent")&&(r=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=sD[r]||[],!vn(t.$parent)&&S(t.$parent,"bpmn:SubProcess")&&(i=Ke(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),S(t,"bpmn:StartEvent")&&!S(t.$parent,"bpmn:SubProcess")?(o=Ke(YO.concat(i),a),this._createEntries(e,o)):S(t,"bpmn:Participant")?(o=Ke(aD,function(c){return Qe(e)!==c.target.isExpanded}),this._createEntries(e,o)):S(t,"bpmn:StartEvent")&&vn(t.$parent)?(o=Ke(rD.concat(i),function(c){var l=c.target,u=l.isInterrupting!==!1,f=t.isInterrupting===u;return a(c)||!a(c)&&!f}),this._createEntries(e,o)):S(t,"bpmn:StartEvent")&&!vn(t.$parent)&&S(t.$parent,"bpmn:SubProcess")?(o=Ke(qO.concat(i),a),this._createEntries(e,o)):S(t,"bpmn:EndEvent")?(o=Ke(XO.concat(i),function(c){var l=c.target;return l.eventDefinitionType=="bpmn:CancelEventDefinition"&&!S(t.$parent,"bpmn:Transaction")?!1:a(c)}),this._createEntries(e,o)):S(t,"bpmn:BoundaryEvent")?(o=Ke(iD,function(c){var l=c.target;if(l.eventDefinitionType=="bpmn:CancelEventDefinition"&&!S(t.attachedToRef,"bpmn:Transaction"))return!1;var u=l.cancelActivity!==!1,f=t.cancelActivity==u;return a(c)||!a(c)&&!f}),this._createEntries(e,o)):S(t,"bpmn:IntermediateCatchEvent")||S(t,"bpmn:IntermediateThrowEvent")?(o=Ke(KO.concat(i),a),this._createEntries(e,o)):S(t,"bpmn:Gateway")?(o=Ke(ZO,a),this._createEntries(e,o)):S(t,"bpmn:Transaction")?(o=Ke(p_,a),this._createEntries(e,o)):vn(t)&&Qe(e)?(o=Ke(eD,a),this._createEntries(e,o)):S(t,"bpmn:AdHocSubProcess")&&Qe(e)?(o=Ke(JO,a),this._createEntries(e,o)):S(t,"bpmn:SubProcess")&&Qe(e)?(o=Ke(QO,a),this._createEntries(e,o)):S(t,"bpmn:SubProcess")&&!Qe(e)?(o=Ke(f_,function(c){var l=c.target.type===e.type,u=c.target.isExpanded===!0;return l===u}),this._createEntries(e,o)):S(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,oD):S(t,"bpmn:FlowNode")?(o=Ke(f_,a),this._createEntries(e,o)):{})},ai.prototype.getPopupMenuHeaderEntries=function(e){var t={};return S(e,"bpmn:Activity")&&!vn(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),S(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),S(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),ty(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},ai.prototype._createEntries=function(e,t){var n={},i=this;return F(t,function(r){n[r.actionName]=i._createEntry(r,e)}),n},ai.prototype._createSequenceFlowEntries=function(e,t){var n=ie(e),i={},r=this._modeling,o=this._moddle,a=this;return F(t,function(s){switch(s.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(S(n.sourceRef,"bpmn:ExclusiveGateway")||S(n.sourceRef,"bpmn:InclusiveGateway")||S(n.sourceRef,"bpmn:ComplexGateway")||S(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&&S(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:S(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e,{conditionExpression:void 0})})}),(S(n.sourceRef,"bpmn:ExclusiveGateway")||S(n.sourceRef,"bpmn:InclusiveGateway")||S(n.sourceRef,"bpmn:ComplexGateway")||S(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},ai.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}},ai.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 f=e.businessObject.get("loopCharacteristics");f&&S(f,u.options.loopCharacteristics)?t._modeling.updateModdleProperties(e,f,{isSequential:u.options.isSequential}):(f=t._moddle.create(u.options.loopCharacteristics,{isSequential:u.options.isSequential}),t._modeling.updateProperties(e,{loopCharacteristics:f}))}var r=ie(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"}}}},ai.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}}},ai.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}}},ai.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=ie(e),i=this,r=ny(e),o=S(e,"bpmn:BoundaryEvent")?d_["intermediate-event-non-interrupting"]:d_["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 cD={__depends__:[Qf,wv,Zc],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",ai]};function ts(e,t,n,i,r,o,a,s,c,l,u,f,p){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=f,this._eventBus=n,this._appendPreview=p,e.autoPlace!==!1&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,function(d){var m=d.context,h=m.shape;if(!(!Ca(d)||!i.isOpen(h))){var y=i.getEntries(h);y.replace&&y.replace.action.click(d,h)}}),n.on("contextPad.close",function(){p.cleanUp()})}ts.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],ts.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&W(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,r){t.removeElements(r.slice())}}}}),n},ts.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return Be(t)?kr(e,n=>t.includes(n)):t},ts.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,i=this._elementFactory,r=this._connect,o=this._create,a=this._popupMenu,s=this._autoPlace,c=this._translate,l=this._appendPreview,u={};if(e.type==="label")return this._isDeleteAllowed([e])&&W(u,m()),u;var f=e.businessObject;function p(b,x){r.start(b,x)}function d(b,x){n.removeElements([x])}function m(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:d}}}}function h(b){var x=5,C=t.getPad(b).html,M=C.getBoundingClientRect(),k={x:M.left,y:M.bottom+x};return k}function y(b,x,C,M){function k(D,I){var z=i.createShape(W({type:b},M));o.start(D,z,{source:I})}var P=s?function(D,I){var z=i.createShape(W({type:b},M));s.append(I,z)}:k,B=s?function(D,I){return l.create(I,b,M),()=>{l.cleanUp()}}:null;return{group:"model",className:x,title:C,action:{dragstart:k,click:P,hover:B}}}function v(b){return function(x,C){n.splitLane(C,b),t.open(C,!0)}}if(qe(f,["bpmn:Lane","bpmn:Participant"])&&Qe(e)){var g=lr(e);W(u,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add lane above"),action:{click:function(b,x){n.addLane(x,"top")}}}}),g.length<2&&((tn(e)?e.height>=120:e.width>=120)&&W(u,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:v(2)}}}),(tn(e)?e.height>=180:e.width>=180)&&W(u,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:v(3)}}})),W(u,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add lane below"),action:{click:function(b,x){n.addLane(x,"bottom")}}}})}return S(f,"bpmn:FlowNode")&&(S(f,"bpmn:EventBasedGateway")?W(u,{"append.receive-task":y("bpmn:ReceiveTask","bpmn-icon-receive-task",c("Append receive task")),"append.message-intermediate-event":y("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",c("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":y("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",c("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":y("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",c("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":y("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",c("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):h_(f,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?W(u,{"append.compensation-activity":y("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!S(f,"bpmn:EndEvent")&&!f.isForCompensation&&!h_(f,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!vn(f)&&W(u,{"append.end-event":y("bpmn:EndEvent","bpmn-icon-end-event-none",c("Append end event")),"append.gateway":y("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",c("Append gateway")),"append.append-task":y("bpmn:Task","bpmn-icon-task",c("Append task")),"append.intermediate-event":y("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",c("Append intermediate/boundary event"))})),a.isEmpty(e,"bpmn-replace")||W(u,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(b,x){var C=W(h(x),{cursor:{x:b.x,y:b.y}});a.open(x,"bpmn-replace",C,{title:c("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),S(f,"bpmn:SequenceFlow")&&W(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),S(f,"bpmn:MessageFlow")&&W(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),qe(f,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&W(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation")),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect to other element"),action:{click:p,dragstart:p}}}),S(f,"bpmn:TextAnnotation")&&W(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:p,dragstart:p}}}),qe(f,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&W(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using data input association"),action:{click:p,dragstart:p}}}),S(f,"bpmn:Group")&&W(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&W(u,m()),u};function h_(e,t,n){var i=e.$instanceOf(t),r=!1,o=e.eventDefinitions||[];return F(o,function(a){a.$type===n&&(r=!0)}),i&&r}const lD={__depends__:[HO,u_,Gb,ni,ad,Mc,cD],__init__:["contextPadProvider"],contextPadProvider:["type",ts]};var uD={horizontal:["x","width"],vertical:["y","height"]},m_=5;function Ki(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return Be(i)?i:i?n:[]})}Ki.$inject=["modeling","rules"],Ki.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},Ki.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},Ki.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(F(t,function(o){r=o(r,n,i)}),r):e},Ki.prototype._createGroups=function(e){var t=[],n=this,i=this._axis,r=this._dimension;if(!i)throw new Error('must have a defined "axis" and "dimension"');var o=di(e,i);return F(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},Ki.prototype._setOrientation=function(e){var t=uD[e];this._axis=t[0],this._dimension=t[1]},Ki.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)},Ki.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+m_,max:t+n-m_}};const pD={__init__:["distributeElements"],distributeElements:["type",Ki]};function Cl(e){ti.call(this,e)}Cl.$inject=["eventBus"],Ee(Cl,ti),Cl.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=Ke(t,function(n){var i=qe(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=Hs(t),t.length<3?!1:t})};var g_={horizontal:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
|
|
327
|
+
</svg>`};function ai(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()}ai.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],ai.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},ai.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],r,o=[];if(Be(e)||!n.allowed("shape.replace",{element:e}))return{};var a=UO(e);return S(t,"bpmn:DataObjectReference")?this._createEntries(e,nD):S(t,"bpmn:DataStoreReference")&&!S(e.parent,"bpmn:Collaboration")?this._createEntries(e,iD):(S(t,"bpmn:Event")&&!S(t,"bpmn:BoundaryEvent")&&(r=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=cD[r]||[],!vn(t.$parent)&&S(t.$parent,"bpmn:SubProcess")&&(i=Ke(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),S(t,"bpmn:StartEvent")&&!S(t.$parent,"bpmn:SubProcess")?(o=Ke(qO.concat(i),a),this._createEntries(e,o)):S(t,"bpmn:Participant")?(o=Ke(sD,function(c){return Qe(e)!==c.target.isExpanded}),this._createEntries(e,o)):S(t,"bpmn:StartEvent")&&vn(t.$parent)?(o=Ke(oD.concat(i),function(c){var l=c.target,u=l.isInterrupting!==!1,f=t.isInterrupting===u;return a(c)||!a(c)&&!f}),this._createEntries(e,o)):S(t,"bpmn:StartEvent")&&!vn(t.$parent)&&S(t.$parent,"bpmn:SubProcess")?(o=Ke(KO.concat(i),a),this._createEntries(e,o)):S(t,"bpmn:EndEvent")?(o=Ke(ZO.concat(i),function(c){var l=c.target;return l.eventDefinitionType=="bpmn:CancelEventDefinition"&&!S(t.$parent,"bpmn:Transaction")?!1:a(c)}),this._createEntries(e,o)):S(t,"bpmn:BoundaryEvent")?(o=Ke(rD,function(c){var l=c.target;if(l.eventDefinitionType=="bpmn:CancelEventDefinition"&&!S(t.attachedToRef,"bpmn:Transaction"))return!1;var u=l.cancelActivity!==!1,f=t.cancelActivity==u;return a(c)||!a(c)&&!f}),this._createEntries(e,o)):S(t,"bpmn:IntermediateCatchEvent")||S(t,"bpmn:IntermediateThrowEvent")?(o=Ke(XO.concat(i),a),this._createEntries(e,o)):S(t,"bpmn:Gateway")?(o=Ke(QO,a),this._createEntries(e,o)):S(t,"bpmn:Transaction")?(o=Ke(p_,a),this._createEntries(e,o)):vn(t)&&Qe(e)?(o=Ke(tD,a),this._createEntries(e,o)):S(t,"bpmn:AdHocSubProcess")&&Qe(e)?(o=Ke(eD,a),this._createEntries(e,o)):S(t,"bpmn:SubProcess")&&Qe(e)?(o=Ke(JO,a),this._createEntries(e,o)):S(t,"bpmn:SubProcess")&&!Qe(e)?(o=Ke(f_,function(c){var l=c.target.type===e.type,u=c.target.isExpanded===!0;return l===u}),this._createEntries(e,o)):S(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,aD):S(t,"bpmn:FlowNode")?(o=Ke(f_,a),this._createEntries(e,o)):{})},ai.prototype.getPopupMenuHeaderEntries=function(e){var t={};return S(e,"bpmn:Activity")&&!vn(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),S(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),S(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),ty(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},ai.prototype._createEntries=function(e,t){var n={},i=this;return F(t,function(r){n[r.actionName]=i._createEntry(r,e)}),n},ai.prototype._createSequenceFlowEntries=function(e,t){var n=ie(e),i={},r=this._modeling,o=this._moddle,a=this;return F(t,function(s){switch(s.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(S(n.sourceRef,"bpmn:ExclusiveGateway")||S(n.sourceRef,"bpmn:InclusiveGateway")||S(n.sourceRef,"bpmn:ComplexGateway")||S(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&&S(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:S(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e,{conditionExpression:void 0})})}),(S(n.sourceRef,"bpmn:ExclusiveGateway")||S(n.sourceRef,"bpmn:InclusiveGateway")||S(n.sourceRef,"bpmn:ComplexGateway")||S(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},ai.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}},ai.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 f=e.businessObject.get("loopCharacteristics");f&&S(f,u.options.loopCharacteristics)?t._modeling.updateModdleProperties(e,f,{isSequential:u.options.isSequential}):(f=t._moddle.create(u.options.loopCharacteristics,{isSequential:u.options.isSequential}),t._modeling.updateProperties(e,{loopCharacteristics:f}))}var r=ie(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"}}}},ai.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}}},ai.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}}},ai.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=ie(e),i=this,r=ny(e),o=S(e,"bpmn:BoundaryEvent")?d_["intermediate-event-non-interrupting"]:d_["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 lD={__depends__:[Qf,wv,Zc],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",ai]};function ts(e,t,n,i,r,o,a,s,c,l,u,f,p){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=f,this._eventBus=n,this._appendPreview=p,e.autoPlace!==!1&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,function(d){var m=d.context,h=m.shape;if(!(!Ca(d)||!i.isOpen(h))){var y=i.getEntries(h);y.replace&&y.replace.action.click(d,h)}}),n.on("contextPad.close",function(){p.cleanUp()})}ts.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],ts.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&W(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,r){t.removeElements(r.slice())}}}}),n},ts.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return Be(t)?kr(e,n=>t.includes(n)):t},ts.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,i=this._elementFactory,r=this._connect,o=this._create,a=this._popupMenu,s=this._autoPlace,c=this._translate,l=this._appendPreview,u={};if(e.type==="label")return this._isDeleteAllowed([e])&&W(u,m()),u;var f=e.businessObject;function p(b,x){r.start(b,x)}function d(b,x){n.removeElements([x])}function m(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:d}}}}function h(b){var x=5,C=t.getPad(b).html,M=C.getBoundingClientRect(),k={x:M.left,y:M.bottom+x};return k}function y(b,x,C,M){function k(D,I){var z=i.createShape(W({type:b},M));o.start(D,z,{source:I})}var P=s?function(D,I){var z=i.createShape(W({type:b},M));s.append(I,z)}:k,B=s?function(D,I){return l.create(I,b,M),()=>{l.cleanUp()}}:null;return{group:"model",className:x,title:C,action:{dragstart:k,click:P,hover:B}}}function v(b){return function(x,C){n.splitLane(C,b),t.open(C,!0)}}if(qe(f,["bpmn:Lane","bpmn:Participant"])&&Qe(e)){var g=lr(e);W(u,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add lane above"),action:{click:function(b,x){n.addLane(x,"top")}}}}),g.length<2&&((tn(e)?e.height>=120:e.width>=120)&&W(u,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:v(2)}}}),(tn(e)?e.height>=180:e.width>=180)&&W(u,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:v(3)}}})),W(u,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add lane below"),action:{click:function(b,x){n.addLane(x,"bottom")}}}})}return S(f,"bpmn:FlowNode")&&(S(f,"bpmn:EventBasedGateway")?W(u,{"append.receive-task":y("bpmn:ReceiveTask","bpmn-icon-receive-task",c("Append receive task")),"append.message-intermediate-event":y("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",c("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":y("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",c("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":y("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",c("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":y("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",c("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):h_(f,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?W(u,{"append.compensation-activity":y("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!S(f,"bpmn:EndEvent")&&!f.isForCompensation&&!h_(f,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!vn(f)&&W(u,{"append.end-event":y("bpmn:EndEvent","bpmn-icon-end-event-none",c("Append end event")),"append.gateway":y("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",c("Append gateway")),"append.append-task":y("bpmn:Task","bpmn-icon-task",c("Append task")),"append.intermediate-event":y("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",c("Append intermediate/boundary event"))})),a.isEmpty(e,"bpmn-replace")||W(u,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(b,x){var C=W(h(x),{cursor:{x:b.x,y:b.y}});a.open(x,"bpmn-replace",C,{title:c("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),S(f,"bpmn:SequenceFlow")&&W(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),S(f,"bpmn:MessageFlow")&&W(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),qe(f,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&W(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation")),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect to other element"),action:{click:p,dragstart:p}}}),S(f,"bpmn:TextAnnotation")&&W(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:p,dragstart:p}}}),qe(f,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&W(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using data input association"),action:{click:p,dragstart:p}}}),S(f,"bpmn:Group")&&W(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&W(u,m()),u};function h_(e,t,n){var i=e.$instanceOf(t),r=!1,o=e.eventDefinitions||[];return F(o,function(a){a.$type===n&&(r=!0)}),i&&r}const uD={__depends__:[zO,u_,Gb,ni,ad,Mc,lD],__init__:["contextPadProvider"],contextPadProvider:["type",ts]};var pD={horizontal:["x","width"],vertical:["y","height"]},m_=5;function Ki(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return Be(i)?i:i?n:[]})}Ki.$inject=["modeling","rules"],Ki.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},Ki.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},Ki.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(F(t,function(o){r=o(r,n,i)}),r):e},Ki.prototype._createGroups=function(e){var t=[],n=this,i=this._axis,r=this._dimension;if(!i)throw new Error('must have a defined "axis" and "dimension"');var o=di(e,i);return F(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},Ki.prototype._setOrientation=function(e){var t=pD[e];this._axis=t[0],this._dimension=t[1]},Ki.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)},Ki.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+m_,max:t+n-m_}};const fD={__init__:["distributeElements"],distributeElements:["type",Ki]};function Cl(e){ti.call(this,e)}Cl.$inject=["eventBus"],Ee(Cl,ti),Cl.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=Ke(t,function(n){var i=qe(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=Hs(t),t.length<3?!1:t})};var g_={horizontal:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
|
|
328
328
|
<polyline points="450 400 450 150 1350 150 1350 400" style="fill:none;stroke:currentColor;stroke-width:100;stroke-linejoin:round;"/>
|
|
329
329
|
<rect x="150" y="450" width="600" height="1200" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
|
|
330
330
|
<rect x="1050" y="450" width="600" height="800" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
|
|
@@ -332,7 +332,7 @@
|
|
|
332
332
|
<polyline points="400 1350 150 1350 150 450 400 450" style="fill:none;stroke:currentColor;stroke-width:100;stroke-linejoin:round;"/>
|
|
333
333
|
<rect x="450" y="150" width="1200" height="600" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
|
|
334
334
|
<rect x="450" y="1050" width="800" height="600" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
|
|
335
|
-
</svg>`},fD=900;function ns(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",fD,this)}ns.$inject=["popupMenu","distributeElements","translate","rules"],ns.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&W(t,this._getEntries(e)),t},ns.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},ns.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:g_.horizontal,action:function(o,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:g_.vertical,action:function(o,a){t.trigger(e,"vertical"),i.close()}}};return r};const dD={__depends__:[Qf,pD],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",Cl],distributeElementsMenuProvider:["type",ns]};var y_="is not a registered action",hD="is already registered";function si(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}si.$inject=["eventBus","injector"],si.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 f=s.allowed("elements.delete",{elements:u});if(f!==!1){var p=Be(f)?f:u;return o.cut(p.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 f=s.allowed("elements.delete",{elements:u}),p;f!==!1&&(Be(f)?p=f:p=u,p.length&&n.removeElements(p.slice()))}}),c&&this.register("moveCanvas",function(u){c.moveCanvas(u)}),l&&this.register("moveSelection",function(u){l.moveSelection(u.direction,u.accelerated)})},si.prototype.trigger=function(e,t){if(!this._actions[e])throw cd(e,y_);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},si.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);F(e,function(i,r){n._registerAction(r,i)})},si.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw cd(e,hD);this._actions[e]=t},si.prototype.unregister=function(e){if(!this.isRegistered(e))throw cd(e,y_);this._actions[e]=void 0},si.prototype.getActions=function(){return Object.keys(this._actions)},si.prototype.isRegistered=function(e){return!!this._actions[e]};function cd(e,t){return new Error(e+" "+t)}const mD={__init__:["editorActions"],editorActions:["type",si]};function Al(e){e.invoke(si,this)}Ee(Al,si),Al.$inject=["injector"],Al.prototype._registerDefaultActions=function(e){si.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),f=e.get("searchPad",!1),p=e.get("modeling",!1),d=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}),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(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=[],v=m.type;h.length&&(y=Ke(h,function(g){return!S(g,"bpmn:Lane")}),l.trigger(y,v))}),i&&p&&this._registerAction("setColor",function(m){var h=i.get();h.length&&p.setColor(h,m)}),i&&u&&this._registerAction("directEditing",function(){var m=i.get();m.length&&u.activate(m[0])}),f&&this._registerAction("find",function(){f.toggle()}),t&&p&&this._registerAction("moveToOrigin",function(){var m=t.getRootElement(),h,y;S(m,"bpmn:Collaboration")?y=n.filter(function(v){return S(v.parent,"bpmn:Collaboration")}):y=n.filter(function(v){return v!==m&&!S(v.parent,"bpmn:SubProcess")}),h=Ft(y),p.moveElements(y,{x:-h.x,y:-h.y},m)}),i&&d&&this._registerAction("replaceElement",function(m){d.triggerEntry("replace","click",m)})};const gD={__depends__:[mD],editorActions:["type",Al]};function v_(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;qe(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}v_.$inject=["eventBus"];function Zr(e,t){te.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;Pn(a)?r.newBounds=n.snapComplex(c,a):r.newBounds=n.snapSimple(s,c)}})}Zr.$inject=["eventBus","gridSnapping","modeling"],Ee(Zr,te),Zr.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},Zr.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},Zr.prototype.snapHorizontally=function(e,t){var n=this._gridSnapping,i=/w/.test(t),r=/e/.test(t),o={};return o.width=n.snapValue(e.width,{min:e.width}),r&&(i?(o.x=n.snapValue(e.x,{max:e.x}),o.width+=n.snapValue(e.x-o.x,{min:e.x-o.x})):e.x=e.x+e.width-o.width),W(e,o),e},Zr.prototype.snapVertically=function(e,t){var n=this._gridSnapping,i=/n/.test(t),r=/s/.test(t),o={};return o.height=n.snapValue(e.height,{min:e.height}),i&&(r?(o.y=n.snapValue(e.y,{max:e.y}),o.height+=n.snapValue(e.y-o.y,{min:e.y-o.y})):e.y=e.y+e.height-o.height),W(e,o),e};var yD=2e3;function b_(e,t){e.on(["spaceTool.move","spaceTool.end"],yD,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)}})}b_.$inject=["eventBus","gridSnapping"];const vD={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",Zr],gridSnappingSpaceToolBehavior:["type",b_]};var Pl=10;function ld(e,t,n){return n||(n="round"),Math[n](e/t)*t}var bD=1200,xD=800;function wr(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var r=this;t.on("diagram.init",xD,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"],bD,function(o){var a=o.originalEvent;if(!(!r.active||a&&Ln(a))){var s=o.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(l){var u={},f=wD(o,l,e);f&&(u.offset=f);var p=_D(o,l);p&&W(u,p),qo(o,l)||r.snapEvent(o,l,u)})}})}wr.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);Gt(e,t,i)},wr.prototype.getGridSpacing=function(){return Pl},wr.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=ld(e,Pl);var i,r;return t&&t.min&&(i=t.min,Fe(i)&&(i=ld(i+n,Pl,"ceil"),e=Math.max(e,i))),t&&t.max&&(r=t.max,Fe(r)&&(r=ld(r+n,Pl,"floor"),e=Math.min(e,r))),e-=n,e},wr.prototype.isActive=function(){return this.active},wr.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},wr.prototype.toggleActive=function(){this.setActive(!this.active)},wr.$inject=["elementRegistry","eventBus","config.gridSnapping"];function _D(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&&(Ml(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&&(Ml(t)?__(s)?a.x.max=c.left:a.x.min=c.right:x_(s)?a.y.max=c.top:a.y.min=c.bottom),l&&(Ml(t)?__(s)?a.x.min=l.left:a.x.max=l.right:x_(s)?a.y.min=l.top:a.y.max=l.bottom),a[t]}function wD(e,t,n){var i=e.context,r=e.shape,o=i.gridSnappingContext,a=o.snapLocation,s=o.snapOffset;return s&&Fe(s[t])||(s||(s=o.snapOffset={}),Fe(s[t])||(s[t]=0),!r)||(n.get(r.id)||(Ml(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 Ml(e){return e==="x"}function x_(e){return e.indexOf("n")!==-1}function __(e){return e.indexOf("w")!==-1}const ED={__depends__:[vD],__init__:["gridSnapping"],gridSnapping:["type",wr]};var SD=2e3;function w_(e,t,n){e.on("autoPlace",SD,function(i){var r=i.source,o=Ne(r),a=i.shape,s=hb(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],S(a,"bpmn:TextAnnotation")&&(RD(c)?l.offset=-a.width/2:l.offset=-a.height/2),s[c]=t.snapValue(s[c],l))}),s})}w_.$inject=["eventBus","gridSnapping","elementRegistry"];function RD(e){return e==="x"}var CD=1750;function E_(e,t,n){t.on(["create.start","shape.move.start"],CD,function(i){var r=i.context,o=r.shape,a=e.getRootElement();if(!(!S(o,"bpmn:Participant")||!S(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}))}})}E_.$inject=["canvas","eventBus","gridSnapping"];var AD=3e3;function Tl(e,t,n){te.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],AD,function(r){var o=r.context,a=o.connection,s=o.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||PD(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}Tl.$inject=["eventBus","gridSnapping","modeling"],Ee(Tl,te),Tl.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=kD(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function PD(e){return e.length>3}function MD(e){return e==="h"}function TD(e){return e==="v"}function kD(e,t,n){var i=Li(t,n),r={};return MD(i)&&(r.y=e.snapValue(t.y)),TD(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=W({},t,r),n=W({},n,r)),[t,n]}const OD={__depends__:[ED,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",w_],gridSnappingParticipantBehavior:["type",E_],gridSnappingLayoutConnectionBehavior:["type",Tl]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",v_]};var DD=30,S_=30;function is(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var r=i.element,o=i.gfx;if(S(r,"bpmn:Lane"))return n._createParticipantHit(r,o);if(S(r,"bpmn:Participant"))return Qe(r)?n._createParticipantHit(r,o):n._createDefaultHit(r,o);if(S(r,"bpmn:SubProcess"))return Qe(r)?n._createSubProcessHit(r,o):n._createDefaultHit(r,o)})}is.$inject=["eventBus","interactionEvents"],is.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},is.prototype._createParticipantHit=function(e,t){this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"no-move",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height});var n=tn(e)?{width:DD,height:e.height}:{width:e.width,height:S_};return this._interactionEvents.createBoxHit(t,"all",n),!0},is.prototype._createSubProcessHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"no-move",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"all",{width:e.width,height:S_}),!0};const ID={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",is]};function kl(e){e.invoke(Ho,this)}Ee(kl,Ho),kl.$inject=["injector"],kl.prototype.registerBindings=function(e,t){Ho.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 LD={__depends__:[Nf],__init__:["keyboardBindings"],keyboardBindings:["type",kl]};var BD={moveSpeed:1,moveSpeedAccelerated:10},ND=1500,R_="left",C_="up",A_="right",P_="down",$D={ArrowLeft:R_,Left:R_,ArrowUp:C_,Up:C_,ArrowRight:A_,Right:A_,ArrowDown:P_,Down:P_},FD={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 M_(e,t,n,i,r){var o=this;this._config=W({},BD,e||{}),t.addListener(ND,function(a){var s=a.keyEvent,c=$D[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=FD[a](l),f=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});f&&n.moveElements(c,u)}}}M_.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const jD={__depends__:[Nf,ni],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",M_]};var T_=10;function rs(e,t,n,i){this._dragging=i,this._rules=t;var r=this;function o(c,l){var u=c.shape,f=c.direction,p=c.resizeConstraints,d;c.delta=l,d=CA(u,f,l),c.newBounds=PA(d,p),c.canExecute=r.canResize(c)}function a(c){var l=c.resizeConstraints,u=c.minBounds;l===void 0&&(u===void 0&&(u=r.computeMinResizeBox(c)),c.resizeConstraints={min:Ie(u)})}function s(c){var l=c.shape,u=c.canExecute,f=c.newBounds;if(u){if(f=jm(f),!HD(l,f))return;n.resizeShape(l,f)}}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)})}rs.prototype.canResize=function(e){var t=this._rules,n=li(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},rs.prototype.activate=function(e,t,n){var i=this._dragging,r,o;if(typeof n=="string"&&(n={direction:n}),r=W({shape:t},n),o=r.direction,!o)throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");i.init(e,k_(t,o),"resize",{autoActivate:!0,cursor:zD(o),data:{shape:t,context:r}})},rs.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,r;return i=e.minDimensions||{width:T_,height:T_},r=Ag(t,e.childrenBoxPadding),MA(n,t,i,r)},rs.$inject=["eventBus","rules","modeling","dragging"];function HD(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function k_(e,t){var n=Ne(e),i=Ie(e),r={x:n.x,y:n.y};return t.indexOf("n")!==-1?r.y=i.top:t.indexOf("s")!==-1&&(r.y=i.bottom),t.indexOf("e")!==-1?r.x=i.right:t.indexOf("w")!==-1&&(r.x=i.left),r}function zD(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 O_="djs-resizing",D_="resize-not-ok",GD=500;function I_(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,O_)),s.width>5&&Se(c,{x:s.x,width:s.width}),s.height>5&&Se(c,{y:s.y,height:s.height}),o.canExecute?et(c).remove(D_):et(c).add(D_)}function r(o){var a=o.shape,s=o.frame;s&&Kt(o.frame),t.removeMarker(a,O_)}e.on("resize.move",GD,function(o){i(o.context)}),e.on("resize.cleanup",function(o){r(o.context)})}I_.$inject=["eventBus","canvas","previewSupport"];var Ol=-6,Dl=8,Il=20,os="djs-resizer",VD=["n","w","s","e","nw","ne","se","sw"];function Er(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&&F(a,Rn(r.addResizer,r))}),e.on("shape.changed",function(o){var a=o.element;n.isSelected(a)&&(r.removeResizers(),r.addResizer(a))})}Er.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(o){pr(o)&&i.activate(o,e,n)}je.bind(t,"mousedown",r),je.bind(t,"touchstart",r)},Er.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=WD(i),a=Oe("g");et(a).add(os),et(a).add(os+"-"+e.id),et(a).add(os+"-"+i),ze(r,a);var s=Oe("rect");Se(s,{x:-Dl/2+o.x,y:-Dl/2+o.y,width:Dl,height:Dl}),et(s).add(os+"-visual"),ze(a,s);var c=Oe("rect");return Se(c,{x:-Il/2+o.x,y:-Il/2+o.y,width:Il,height:Il}),et(c).add(os+"-hit"),ze(a,c),Ys(a,t,n),a},Er.prototype.createResizer=function(e,t){var n=k_(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},Er.prototype.addResizer=function(e){var t=this;ht(e)||F(VD,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},Er.prototype.removeResizers=function(){var e=this._getResizersParent();$s(e)},Er.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},Er.$inject=["eventBus","canvas","selection","resize"];function WD(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-Ol:e.indexOf("w")!==-1&&(t.x=Ol),e.indexOf("s")!==-1?t.y=-Ol:e.indexOf("n")!==-1&&(t.y=Ol),t}const L_={__depends__:[Si,Hi,No],__init__:["resize","resizePreview","resizeHandles"],resize:["type",rs],resizePreview:["type",I_],resizeHandles:["type",Er]};var UD=2e3;function as(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"],UD,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,f=c.context.canExecute,p=c.isTouch;p||f&&(l.hints&&l.hints.createElementsBehavior===!1||s(u))}),e.on("autoPlace.end",500,function(c){s(c.shape)});function s(c,l){(l||qe(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}as.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],as.prototype.activate=function(e){var t=qn(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);W(n,i);var r={},o=n.style||{};return W(o,{backgroundColor:null,border:null}),(qe(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||B_(e))&&W(r,{centerVertically:!0}),sr(e)&&(W(r,{resizable:!0,autoResize:!0}),W(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),S(e,"bpmn:TextAnnotation")&&(W(r,{resizable:!0,autoResize:!0}),W(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),W(n,{options:r,style:o}),n}},as.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,f=s.fontSize*a,p=s.lineHeight,d={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(S(e,"bpmn:Lane")||KD(e)){var m=tn(e),h=m?{width:i.height,height:30*a,x:i.x-i.height/2+15*a,y:r.y-30*a/2}:{width:i.width,height:30*a};W(o,h),W(d,{fontSize:f+"px",lineHeight:p,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:m?"rotate(-90deg)":null})}if(qD(e)){var y=tn(e),v=y?{width:i.width,height:i.height}:{width:i.height,height:i.width,x:r.x-i.height/2,y:r.y-i.width/2};W(o,v),W(d,{fontSize:f+"px",lineHeight:p,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:y?null:"rotate(-90deg)"})}(qe(e,["bpmn:Task","bpmn:CallActivity"])||B_(e))&&(W(o,{width:i.width,height:i.height}),W(d,{fontSize:f+"px",lineHeight:p,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),YD(e)&&(W(o,{width:i.width,x:i.x}),W(d,{fontSize:f+"px",lineHeight:p,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var g=1,b=i.width+2*g;if(n.labelTarget&&(W(o,{width:b,height:i.height+2*g,x:i.x-g,y:i.y-g}),W(d,{fontSize:l+"px",lineHeight:u})),sr(n)&&!Xs(n)&&!Ye(n)){var x=Yu(e),C=t.getAbsoluteBBox({x:x.x,y:x.y,width:0,height:0}),M=l,k=Fr.width*a+2*g;W(o,{width:k,height:M+2*g,x:C.x-k/2,y:C.y-M/2-g}),W(d,{fontSize:l+"px",lineHeight:u})}return S(e,"bpmn:TextAnnotation")&&(W(o,{width:i.width+2*g,height:i.height+2*g,x:i.x-g,y:i.y-g,minWidth:30*a,minHeight:10*a}),W(d,{textAlign:"left",paddingTop:So*a+"px",paddingBottom:So*a+"px",paddingLeft:So*a+"px",paddingRight:So*a+"px",fontSize:f+"px",lineHeight:p})),{bounds:o,style:d}},as.prototype.update=function(e,t,n,i){var r,o;S(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}),XD(t)&&(t=null),this._modeling.updateLabel(e,t,r)};function B_(e){return S(e,"bpmn:SubProcess")&&!Qe(e)}function YD(e){return S(e,"bpmn:SubProcess")&&Qe(e)}function qD(e){return S(e,"bpmn:Participant")&&!Qe(e)}function KD(e){return S(e,"bpmn:Participant")&&Qe(e)}function XD(e){return!e||!e.trim()}var N_="djs-element-hidden",$_="djs-label-hidden";function F_(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,S(o,"bpmn:TextAnnotation")){a=t.getAbsoluteBBox(o),s=Oe("g");var u=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:o.height,position:{mx:0,my:0}}),f=i.path=Oe("path");Se(f,{d:u,strokeWidth:2,stroke:ZD(o)}),ze(s,f),ze(r,s),ln(s,o.x,o.y)}S(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,N_):(S(o,"bpmn:Task")||S(o,"bpmn:CallActivity")||S(o,"bpmn:SubProcess")||S(o,"bpmn:Participant")||S(o,"bpmn:Lane"))&&t.addMarker(o,$_)}),e.on("directEditing.resize",function(c){if(S(o,"bpmn:TextAnnotation")){var l=c.height,u=c.dy,f=Math.max(o.height/a.height*(l+u),0),p=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:f,position:{mx:0,my:0}});Se(i.path,{d:p})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var l=c.active;l&&(t.removeMarker(l.element.label||l.element,N_),t.removeMarker(o,$_)),o=void 0,a=void 0,s&&(Kt(s),s=void 0)})}F_.$inject=["eventBus","canvas","pathMap"];function ZD(e,t){var n=ot(e);return n.get("stroke")||t||"black"}const QD={__depends__:[ff,L_,u_],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",as],labelEditingPreview:["type",F_]};var JD=500,eI=1e3;function Ai(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){PR(o)||i.createOutline(o)}e.on("element.hover",function(o){r(o.element)}),e.on("selection.changed",function(o){F(o.newSelection,r)}),e.on(["shape.changed","connection.changed"],JD,function(o){var a=o.element,s=o.gfx,c=ft(".djs-outline",s);c&&i.updateOutline(a,c)})}Ai.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=ft(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),ze(t,n),this.updateOutline(e,n)),n},Ai.prototype._createOutlineGfx=function(){var e=Oe("rect");return Se(e,W({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},Ai.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},Ai.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&F(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})},Ai.prototype.updateConnectionOutline=function(e,t){var n=Ft(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})},Ai.prototype.registerProvider=function(e,t){t||(t=e,e=eI),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},Ai.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Ai.prototype.getOutline=function(e){var t,n=this._getProviders();return F(n,function(i){Jt(i.getOutline)&&(t=t||i.getOutline(e))}),t},Ai.$inject=["eventBus","styles","elementRegistry"];var Ll=6;function ud(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)})}ud.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");$s(t);var n=e.length>1,i=this._canvas.getContainer();if(et(i)[n?"add":"remove"]("djs-multi-select"),!!n){var r=tI(Ft(e)),o=Oe("rect");Se(o,W({rx:3},r)),et(o).add("djs-selection-outline"),ze(t,o)}},ud.$inject=["eventBus","canvas","selection"];function tI(e){return{x:e.x-Ll,y:e.y-Ll,width:e.width+Ll*2,height:e.height+Ll*2}}const pd={__depends__:[ni],__init__:["outline","multiSelectionOutline"],outline:["type",Ai],multiSelectionOutline:["type",ud]},j_=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],H_={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},nI=15,Bl=2;function z_(e,t,n,i,r){const o=t.getLayer("overlays");e.on(["selection.changed","shape.changed"],function(){s()}),e.on("selection.changed",function({newSelection:f}){var d;const p=f.filter(m=>qe(m,j_));if(p.length===1){const m=p[0];Ye(m)?a(m,m.labelTarget):(d=m.labels)!=null&&d.length&&a(m.labels[0],m)}if(p.length===2){const m=p.find(Ye),h=p.find(y=>{var v;return(v=y.labels)==null?void 0:v.includes(m)});m&&h&&a(m,h)}}),e.on("shape.changed",function({element:f}){var p;!qe(f,j_)||!u(f)||(Ye(f)?a(f,f.labelTarget):(p=f.labels)!=null&&p.length&&a(f.labels[0],f))});function a(f,p){const d=la([Ne(p),Ne(f)],H_),m=d.getAttribute("d"),y=r.isSelected(f)?c(f):l(f),v=da(y,m);if(!v)return;const b=r.isSelected(p)?c(p):l(p),x=da(b,m)||Ne(p);Ea(x,v)<nI||(Fu(d,[x,v]),ze(o,d))}function s(){Ns(`.${H_.class}`,o).forEach(Kt)}function c(f){const p=i.getOutline(f);if(!p)return l(f);if(p.x){const d={x:f.x+Sr(p,"x")-Bl,y:f.y+Sr(p,"y")-Bl,width:Sr(p,"width")+Bl*2,height:Sr(p,"height")+Bl*2};return Ku(d,Sr(p,"rx"))}if(p.cx){const d=Sr(p,"r"),m={x:f.x+Sr(p,"cx")-d,y:f.y+Sr(p,"cy")-d,width:d*2,height:d*2};return ug(m)}}function l(f){return n.getShapePath(f)}function u(f){return r.isSelected(f)}}z_.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function Sr(e,t){return parseFloat(Se(e,t)||0)}const iI={__depends__:[ni,pd],__init__:["labelLink"],labelLink:["type",z_]};var rI=new Bo("tt");function oI(e){var t=wt('<div class="djs-tooltip-container" />');return wn(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function aI(e,t,n){wn(e,{left:t+"px",top:n+"px"})}function fd(e,t){e.style.display=t===!1?"none":""}var G_="djs-tooltip",dd="."+G_;function An(e,t){this._eventBus=e,this._canvas=t,this._ids=rI,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=oI(t.getContainer());var n=this;On.bind(this._tooltipRoot,dd,"mousedown",function(i){i.stopPropagation()}),On.bind(this._tooltipRoot,dd,"mouseover",function(i){n.trigger("mouseover",i)}),On.bind(this._tooltipRoot,dd,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}An.$inject=["eventBus","canvas"],An.prototype.add=function(e){if(!e.position)throw new Error("must specifiy tooltip position");if(!e.html)throw new Error("must specifiy tooltip html");var t=this._ids.next();return e=W({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},An.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(gn(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},An.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},An.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},An.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)}},An.prototype.remove=function(e){var t=this.get(e);t&&(vi(t.html),vi(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},An.prototype.show=function(){fd(this._tooltipRoot)},An.prototype.hide=function(){fd(this._tooltipRoot,!1)},An.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},An.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)),Pn(n)&&(n=wt(n)),i=wt('<div data-tooltip-id="'+t+'" class="'+G_+'">'),wn(i,{position:"absolute"}),i.appendChild(n),e.type&&Ct(i).add("djs-tooltip-"+e.type),e.className&&Ct(i).add(e.className),e.htmlContainer=i,r.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},An.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;aI(n,t.x,t.y)},An.prototype._updateTooltipVisibilty=function(e){F(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,r=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(r=!1),fd(i,r))})},An.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 sI={__init__:["tooltips"],tooltips:["type",An]};var cI="flow elements must be children of pools/participants",lI="Data object must be placed within a pool/participant.";function V_(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;S(s,"bpmn:Collaboration")&&(S(a,"bpmn:FlowNode")?i(r,n(cI)):S(a,"bpmn:DataObjectReference")&&i(r,n(lI)))})}V_.$inject=["eventBus","tooltips","translate"];const uI={__depends__:[sI],__init__:["modelingFeedback"],modelingFeedback:["type",V_]};var pI=500,fI=1250,dI=1500,Nl=Math.round;function hI(e){return{x:e.x+Nl(e.width/2),y:e.y+Nl(e.height/2)}}function W_(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",dI,function(s){var c=s.context,l=s.shape,u=i.get().slice();u.indexOf(l)===-1&&(u=[l]),u=mI(u),W(c,{shapes:u,validatedShapes:u,shape:l})}),e.on("shape.move.start",fI,function(s){var c=s.context,l=c.validatedShapes,u;if(u=c.canExecute=o(l),!u)return!1}),e.on("shape.move.move",pI,function(s){var c=s.context,l=c.validatedShapes,u=s.hover,f={x:s.dx,y:s.dy},p={x:s.x,y:s.y},d;if(d=o(l,f,p,u),c.delta=f,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,f=u==="attach",p=c.shapes;if(u===!1)return!1;l.x=Nl(l.x),l.y=Nl(l.y),!(l.x===0&&l.y===0)&&n.moveElements(p,l,c.target,{primaryShape:c.shape,attach:f})}),e.on("element.mousedown",function(s){if(pr(s)){var c=Oo(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,l,u){if(Qt(l)&&(u=l,l=!1),!(c.waypoints||!c.parent)&&!et(s.target).has("djs-hit-no-move")){var f=hI(c),p=t.init(s,f,"shape.move",{cursor:"grabbing",autoActivate:l,data:{shape:c,context:u||{}}});if(p!==!1)return!0}}this.start=a}W_.$inject=["eventBus","dragging","modeling","selection","rules"];function mI(e){var t=oo(e,"id");return Ke(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var U_=499,hd="djs-dragging",Y_="drop-ok",q_="drop-not-ok",K_="new-parent",X_="attach-ok";function Z_(e,t,n,i){function r(c){var l=o(c),u=gI(l);return u}function o(c){var l=ua(c),u=l.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),f=l.concat(u),p=[...new Set(f)];return p}function a(c,l){[X_,Y_,q_,K_].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,hd),c.allDraggedElements?c.allDraggedElements.push(l):c.allDraggedElements=[l]}e.on("shape.move.start",U_,function(c){var l=c.context,u=l.shapes,f=l.allDraggedElements,p=r(u);if(!l.dragGroup){var d=Oe("g");Se(d,n.cls("djs-drag-group",["no-events"]));var m=t.getActiveLayer();ze(m,d),l.dragGroup=d}p.forEach(function(h){i.addDragger(h,l.dragGroup)}),f?f=Kl([f,o(u)]):f=o(u),F(f,function(h){t.addMarker(h,hd)}),l.allDraggedElements=f,l.differentParents=yI(u)}),e.on("shape.move.move",U_,function(c){var l=c.context,u=l.dragGroup,f=l.target,p=l.shape.parent,d=l.canExecute;f&&(d==="attach"?a(f,X_):l.canExecute&&p&&f.id!==p.id?a(f,K_):a(f,l.canExecute?Y_:q_)),ln(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,f=l.dragGroup;F(u,function(p){t.removeMarker(p,hd)}),f&&Kt(f)}),this.makeDraggable=s}Z_.$inject=["eventBus","canvas","styles","previewSupport"];function gI(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=Ke(e,function(i){return ht(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function yI(e){return D0(oo(e,function(t){return t.parent&&t.parent.id}))!==1}const vI={__depends__:[Ac,ni,pd,Si,Hi,No],__init__:["move","movePreview"],move:["type",W_],movePreview:["type",Z_]};var Q_=".djs-palette-toggle",J_=".entry",bI=Q_+", "+J_,md="djs-palette-",xI="shown",gd="open",ew="two-column",_I=1e3;function Vt(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()})}Vt.$inject=["eventBus","canvas"],Vt.prototype.registerProvider=function(e,t){t||(t=e,e=_I),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},Vt.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(EI,{})},Vt.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},Vt.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=wt(Vt.HTML_MARKUP);n.appendChild(i),Ct(n).add(md+xI),On.bind(i,bI,"click",function(r){var o=r.delegateTarget;if(Tu(o,Q_))return e.toggle();e.trigger("click",r)}),je.bind(i,"mousedown",function(r){r.stopPropagation()}),On.bind(i,J_,"dragstart",function(r){e.trigger("dragstart",r)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},Vt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},Vt.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,r,o=Ct(n),a=Ct(t);"twoColumn"in e?r=e.twoColumn:r=this._needsCollapse(t.clientHeight,this._entries||{}),o.toggle(ew,r),a.toggle(md+ew,r),"open"in e&&(o.toggle(gd,e.open),a.toggle(md+gd,e.open)),i.fire("palette.changed",{twoColumn:r,open:this.isOpen()})},Vt.prototype._update=function(){var e=ft(".djs-palette-entries",this._container),t=this._entries=this.getEntries();Ls(e),F(t,function(n,i){var r=n.group||"default",o=ft("[data-group="+Wa(r)+"]",e);o||(o=wt('<div class="group"></div>'),gn(o,"data-group",r),e.appendChild(o));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=wt(a);if(o.appendChild(s),!n.separator&&(gn(s,"data-action",i),n.title&&gn(s,"title",n.title),n.className&&wI(s,n.className),n.imageUrl)){var c=wt("<img>");gn(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},Vt.prototype.trigger=function(e,t,n){var i,r,o=t.delegateTarget||t.target;return o?(i=gn(o,"data-action"),r=t.originalEvent||t,this.triggerEntry(i,e,r,n)):t.preventDefault()},Vt.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(Jt(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},Vt.prototype._layoutChanged=function(){this._toggleState({})},Vt.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},Vt.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},Vt.prototype.open=function(){this._toggleState({open:!0})},Vt.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Vt.prototype.isActiveTool=function(e){return e&&this._activeTool===e},Vt.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=ft(".djs-palette-entries",this._container),this._toolsContainer=ft("[data-group=tools]",t)),n=this._toolsContainer,F(n.children,function(i){var r=i.getAttribute("data-action");if(r){var o=Ct(i);r=r.replace("-tool",""),o.contains("entry")&&r===e?o.add("highlighted-entry"):o.remove("highlighted-entry")}})},Vt.prototype.isOpen=function(){return Ct(this._container).has(gd)},Vt.prototype._getParentContainer=function(){return this._canvas.getContainer()},Vt.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function wI(e,t){var n=Ct(e),i=Be(t)?t:t.split(/\s+/g);i.forEach(function(r){n.add(r)})}function EI(e,t){var n=t.getPaletteEntries();return Jt(n)?n(e):(F(n,function(i,r){e[r]=i}),e)}const SI={__init__:["palette"],palette:["type",Vt]};var tw="crosshair",nw="selected",RI="djs-dragging-active-lasso";function Rr(e,t,n,i,r,o,a){this._selection=r,this._dragging=n,this._mouse=a;var s=this,c={create:function(f){var p=t.getActiveLayer(),d=f.frame=Oe("rect");Se(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),ze(p,d),l(!0),this.update(f)},update:function(f){var p=f.frame,d=f.bbox;p&&d&&Se(p,{x:d.x,y:d.y,width:d.width,height:d.height});var m=f.marked,h=f.lastMarked;if(m&&h){for(const y of h)m.has(y)||t.removeMarker(y,nw);for(const y of m)h.has(y)||t.addMarker(y,nw)}},remove:function(f){this.update(f),f.frame&&Kt(f.frame),l(!1)}};function l(f){et(t.getContainer()).toggle(RI,f)}function u(f){var p=i.getAll();return new Set(ro(bo(p,f)))}o.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",function(f){var p=f.originalEvent.target;!f.hover&&!(p instanceof SVGElement)||e.once("lasso.selection.ended",function(){s.activateLasso(f.originalEvent,!0)})}),e.on("lasso.end",0,function(f){var p=f.context;s._select(Array.from(p.marked))}),e.on("lasso.start",function(f){var p=f.context;p.bbox=iw(f),p.add=xc(f),p.lastMarked=new Set(r.get()),p.add?p.marked=p.lastMarked:p.marked=new Set,p.initialMarked=p.marked,c.create(p)}),e.on("lasso.move",function(f){var p=f.context,d=p.bbox=iw(f),m=u(d),h=p.initialMarked.union(m);p.lastMarked=p.marked,p.marked=h,c.update(p)}),e.on("lasso.cleanup",function(f){var p=f.context;p.lastMarked=p.marked,p.marked=new Set(r.get()),c.remove(f.context)}),e.on("element.mousedown",1500,function(f){if(xc(f))return s.activateLasso(f.originalEvent),!0})}Rr.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],Rr.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:tw,data:{context:{}},keepSelection:!0})},Rr.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:tw,data:{context:{}},keepSelection:!0})},Rr.prototype._select=function(e){this._selection.select(e)},Rr.prototype.select=function(e,t,n=[]){var i=ro(bo(e,t));this._select([...n,...i])},Rr.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Rr.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function iw(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 CI={__depends__:[kc,Ma],__init__:["lassoTool"],lassoTool:["type",Rr]};var yd=1500,rw="grab";function Ko(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",yd,function(c){if(Ca(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(yd,function(c){if(!(!ow(c.keyEvent)||a.isActive())){var l=a._mouse.getLastMoveEvent();a.activateMove(l,!!l)}},"keyboard.keydown"),s&&s.addListener(yd,function(c){!ow(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!Ca(c)&&u&&e.once("hand.move.ended",function(f){a.activateHand(f.originalEvent,!0,!0)}),!1})}Ko.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Ko.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:rw,data:{context:n||{}}})},Ko.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:rw,data:{context:{reactivate:n}}})},Ko.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Ko.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function ow(e){return Xt("Space",e)}const AI={__depends__:[kc,Ma],__init__:["handTool"],handTool:["type",Ko]};var aw="connect-ok",sw="connect-not-ok";function Xo(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,f=l.canStartConnect=s.canStartConnect(u);f!==null&&(l.startTarget=u,i.addMarker(u,f?aw:sw))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var l=c.context.startTarget,u=c.context.canStartConnect;l&&i.removeMarker(l,u?aw:sw)}),e.on(["global-connect.ended"],function(c){var l=c.context,u=l.startTarget,f={x:c.x,y:c.y},p=s.canStartConnect(u);if(p)return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),n.start(null,u,f)}),!1})}Xo.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],Xo.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},Xo.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},Xo.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Xo.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const PI={__depends__:[ad,Si,Hi,kc,Ma],globalConnect:["type",Xo]};function vd(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)}vd.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],vd.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(f,p,d,m,h){function y(v){var g=n.createShape(W({type:f},h));t.start(v,g)}return{group:p,className:d,title:m,action:{dragstart:y,click:y}}}function l(f){var p=n.createShape({type:"bpmn:SubProcess",x:0,y:0,isExpanded:!0}),d=n.createShape({type:"bpmn:StartEvent",x:40,y:82,parent:p});t.start(f,[p,d],{hints:{autoSelect:[p]}})}function u(f){t.start(f,n.createParticipantShape())}return W(e,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:s("Activate hand tool"),action:{click:function(f){o.activateHand(f)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:s("Activate lasso tool"),action:{click:function(f){r.activateSelection(f)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:s("Activate create/remove space tool"),action:{click:function(f){i.activateSelection(f)}}},"global-connect-tool":{group:"tools",className:"bpmn-icon-connection-multi",title:s("Activate global connect tool"),action:{click:function(f){a.start(f)}}},"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 MI={__depends__:[SI,Mc,Pv,CI,AI,PI,ba],__init__:["paletteProvider"],paletteProvider:["type",vd]};var TI=250;function bd(e,t,n,i,r){te.call(this,e);function o(s){var c=s.canExecute.replacements;F(c,function(l){var u=l.oldElementId,f={type:l.newElementType};if(!s.visualReplacements[u]){var p=t.get(u);W(f,{x:p.x,y:p.y});var d=n.createShape(f);i.addShape(d,p.parent);var m=ft('[data-element-id="'+Wa(p.id)+'"]',s.dragGroup);m&&Se(m,{display:"none"});var h=r.addDragger(d,s.dragGroup);s.visualReplacements[u]=h,i.removeShape(d)}})}function a(s){var c=s.visualReplacements;F(c,function(l,u){var f=ft('[data-element-id="'+Wa(u)+'"]',s.dragGroup);f&&Se(f,{display:"inline"}),l.remove(),c[u]&&delete c[u]})}e.on("shape.move.move",TI,function(s){var c=s.context,l=c.canExecute;c.visualReplacements||(c.visualReplacements={}),l&&l.replacements?o(c):a(c)})}bd.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],Ee(bd,te);const kI={__depends__:[No],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",bd]};var OI=1250,xd=40,DI=20,II=10,cw=20,lw=["x","y"],LI=Math.abs;function uw(e){e.on(["connect.hover","connect.move","connect.end"],OI,function(t){var n=t.context,i=n.canExecute,r=n.start,o=n.hover,a=n.source,s=n.target;t.originalEvent&&Ln(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&o&&BI(t,o,jI(o)),o&&FI(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=oi(r),qe(o,["bpmn:Event","bpmn:Gateway"])&&pw(t,oi(o)),qe(o,["bpmn:Task","bpmn:SubProcess"])&&NI(t,o),S(a,"bpmn:BoundaryEvent")&&s===a.host&&$I(t)):fw(i,"bpmn:MessageFlow")?(S(r,"bpmn:Event")&&(n.connectionStart=oi(r)),S(o,"bpmn:Event")&&pw(t,oi(o))):n.connectionStart=n.initialConnectionStart)})}uw.$inject=["eventBus"];function BI(e,t,n){lw.forEach(function(i){var r=dw(i,t);e[i]<t[i]+n?Gt(e,i,t[i]+n):e[i]>t[i]+r-n&&Gt(e,i,t[i]+r-n)})}function NI(e,t){var n=oi(t);lw.forEach(function(i){HI(e,t,i)&&Gt(e,i,n[i])})}function $I(e){var t=e.context,n=t.source,i=t.target;if(!zI(t)){var r=oi(n),o=cn(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;LI(c-r[s])<xd&&(c>r[s]?l=r[s]+xd:l=r[s]-xd,Gt(e,s,l))})}}function pw(e,t){Gt(e,"x",t.x),Gt(e,"y",t.y)}function fw(e,t){return e&&e.type===t}function FI(e,t){return Xi(t,function(n){return fw(e,n)})}function dw(e,t){return e==="x"?t.width:t.height}function jI(e){return S(e,"bpmn:Task")?II:DI}function HI(e,t,n){return e[n]>t[n]+cw&&e[n]<t[n]+dw(n,t)-cw}function zI(e){var t=e.hover,n=e.source;return t&&n&&t===n}function Cr(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}Cr.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},Cr.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},Cr.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},Cr.prototype.getSnapLocations=function(){return this._snapLocations},Cr.prototype.setSnapLocations=function(e){this._snapLocations=e},Cr.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new $l,n.initDefaults(this._defaultSnaps)),n};function $l(){this._snapValues={}}$l.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)},$l.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&TO(e[n],r[n],i)},$l.prototype.initDefaults=function(e){var t=this;F(e||{},function(n,i){F(n,function(r){t.add(i,r)})})};var GI=1250;function Pi(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"],GI,function(r){var o=r.context,a=o.shape,s=o.snapContext,c=o.target;if(!(r.originalEvent&&Ln(r.originalEvent))&&!(qo(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()})}Pi.$inject=["elementRegistry","eventBus","snapping"],Pi.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,r=n.snapContext;r||(r=n.snapContext=new Cr);var o;t.get(i.id)?o=oi(i,e):o={x:e.x+oi(i).x,y:e.y+oi(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}),Ye(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},Pi.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return F(i,function(r){if(Ye(r)){Ye(t)&&e.add("mid",oi(r));return}if(ht(r)){if(r.waypoints.length<3)return;var o=r.waypoints.slice(1,-1);F(o,function(a){e.add("mid",a)});return}e.add("mid",oi(r))}),!Fe(t.x)||!Fe(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",oi(t)),e},Pi.prototype.getSnapTargets=function(e,t){return Jx(t).filter(function(n){return!VI(n)})};function VI(e){return!!e.hidden}var hw=1500;function Zo(e,t){t.invoke(Pi,this),e.on(["create.move","create.end"],hw,qI),e.on(["create.move","create.end","shape.move.move","shape.move.end"],hw,function(n){var i=n.context,r=i.canExecute,o=i.target,a=r&&(r==="attach"||r.attach);a&&!qo(n)&&WI(n,o)})}Ee(Zo,Pi),Zo.$inject=["eventBus","injector"],Zo.prototype.initSnap=function(e){var t=Pi.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return F(n.outgoing,function(r){var o=r.waypoints[0];o=o.original||o,t.setSnapOrigin(r.id+"-docking",gw(o,i,e))}),F(n.incoming,function(r){var o=r.waypoints[r.waypoints.length-1];o=o.original||o,t.setSnapOrigin(r.id+"-docking",gw(o,i,e))}),S(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},Zo.prototype.addSnapTargetPoints=function(e,t,n){Pi.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);F(i,function(o){(YI(o)||UI([t,o],"bpmn:TextAnnotation"))&&(e.add("top-left",Zx(o)),e.add("bottom-right",Qx(o)))});var r=this._elementRegistry;return F(t.incoming,function(o){if(r.get(t.id)){mw(i,o.source)||e.add("mid",Ne(o.source));var a=o.waypoints[0];e.add(o.id+"-docking",a.original||a)}}),F(t.outgoing,function(o){if(r.get(t.id)){mw(i,o.target)||e.add("mid",Ne(o.target));var a=o.waypoints[o.waypoints.length-1];e.add(o.id+"-docking",a.original||a)}}),S(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},Zo.prototype.getSnapTargets=function(e,t){return Pi.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!S(n,"bpmn:Lane")})};function WI(e,t){var n=Ie(t),i=Sy(e,t),r=e.context,o=r.shape,a;o.parent?a={x:0,y:0}:a=Ne(o),/top/.test(i)?Gt(e,"y",n.top-a.y):/bottom/.test(i)&&Gt(e,"y",n.bottom-a.y),/left/.test(i)?Gt(e,"x",n.left-a.x):/right/.test(i)&&Gt(e,"x",n.right-a.x)}function UI(e,t){return e.every(function(n){return S(n,t)})}function YI(e){return S(e,"bpmn:SubProcess")&&Qe(e)?!0:S(e,"bpmn:Participant")}function qI(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)&&Gt(e,"x",e.x),(i&&i>=e.y||o&&o<=e.y)&&Gt(e,"y",e.y)}}function mw(e,t){return e.indexOf(t)!==-1}function gw(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var KI=1250;function ss(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],KI,function(i){var r=i.context,o=r.shape,a=o.parent,s=r.direction,c=r.snapContext;if(!(i.originalEvent&&Ln(i.originalEvent))&&!qo(i)){var l=c.pointsForTarget(a);l.initialized||(l=n.addSnapTargetPoints(l,o,a,s),l.initialized=!0),QI(s)&&Gt(i,"x",i.x),JI(s)&&Gt(i,"y",i.y),t.snap(i,l)}}),e.on(["resize.cleanup"],function(){t.hide()})}ss.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new Cr);var o=yw(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},ss.prototype.addSnapTargetPoints=function(e,t,n,i){var r=this.getSnapTargets(t,n);return F(r,function(o){e.add("corner",Qx(o)),e.add("corner",Zx(o))}),e.add("corner",yw(t,i)),e},ss.$inject=["eventBus","snapping"],ss.prototype.getSnapTargets=function(e,t){return Jx(t).filter(function(n){return!XI(n,e)&&!ht(n)&&!ZI(n)&&!Ye(n)})};function yw(e,t){var n=Ne(e),i=Ie(e),r={x:n.x,y:n.y};return t.indexOf("n")!==-1?r.y=i.top:t.indexOf("s")!==-1&&(r.y=i.bottom),t.indexOf("e")!==-1?r.x=i.right:t.indexOf("w")!==-1&&(r.x=i.left),r}function XI(e,t){return e.host===t}function ZI(e){return!!e.hidden}function QI(e){return e==="n"||e==="s"}function JI(e){return e==="e"||e==="w"}var eL=7,tL=1e3;function Ar(e){this._canvas=e,this._asyncHide=Zl(Rn(this.hide,this),tL)}Ar.$inject=["canvas"],Ar.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,r=i.getSnapLocations(),o={x:qo(e,"x"),y:qo(e,"y")};F(r,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(F(["x","y"],function(l){var u;o[l]||(u=t.snap(c,a,l,eL),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),F(["x","y"],function(a){var s=o[a];Qt(s)&&Gt(e,a,s.originValue)})},Ar.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=Oe("path");return Se(n,{d:"M0,0 L0,0"}),et(n).add("djs-snap-line"),ze(t,n),{update:function(i){Fe(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"})}}},Ar.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},Ar.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},Ar.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},Ar.prototype.hide=function(){F(this._snapLines,function(e){e.update()})};const nL={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",Pi],resizeSnapping:["type",ss],snapping:["type",Ar]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",uw],createMoveSnapping:["type",Zo]};var vw=300;function Ge(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=ft(Ge.INPUT_SELECTOR,this._container),this._resultsContainer=ft(Ge.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}Ge.$inject=["canvas","eventBus","selection","translate"],Ge.prototype._bindEvents=function(){var e=this;function t(n,i,r,o){e._eventMaps.push({el:n,type:r,listener:On.bind(n,i,r,o)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,Ge.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,Ge.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,Ge.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,Ge.INPUT_SELECTOR,"keydown",function(n){Xt("ArrowUp",n)&&n.preventDefault(),Xt("ArrowDown",n)&&n.preventDefault()}),t(this._container,Ge.INPUT_SELECTOR,"keyup",function(n){if(Xt("Escape",n))return e.close();if(Xt("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(Xt("ArrowUp",n))return e._scrollToDirection(!0);if(Xt("ArrowDown",n))return e._scrollToDirection();Xt(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},Ge.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){On.unbind(e.el,e.type,e.listener)})},Ge.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=ft(Ge.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},Ge.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},Ge.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)}},Ge.prototype._clearResults=function(){Ls(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},Ge.prototype._getCurrentResult=function(){return ft(Ge.RESULT_SELECTED_SELECTOR,this._resultsContainer)},Ge.prototype._createResultNode=function(e,t){var n=wt(Ge.RESULT_HTML);return e.primaryTokens.length>0&&bw(n,e.primaryTokens,Ge.RESULT_PRIMARY_HTML),bw(n,e.secondaryTokens,Ge.RESULT_SECONDARY_HTML),gn(n,Ge.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},Ge.prototype.registerProvider=function(e){this._searchProvider=e},Ge.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,Ct(this._canvas.getContainer()).add("djs-search-open"),Ct(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},Ge.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,Ct(this._canvas.getContainer()).remove("djs-search-open"),Ct(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},Ge.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Ge.prototype.isOpen=function(){return this._open},Ge.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&Ct(t).remove(Ge.RESULT_SELECTED_CLASS);var n=gn(e,Ge.RESULT_ID_ATTRIBUTE),i=this._results[n].element;Ct(e).add(Ge.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:vw}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},Ge.prototype._select=function(e){var t=gn(e,Ge.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:vw}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},Ge.prototype._getBoxHtml=function(){const e=wt(Ge.BOX_HTML),t=ft(Ge.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function bw(e,t,n){var i=iL(t),r=wt(n);r.innerHTML=i,e.appendChild(r)}function iL(e){var t="";return e.forEach(function(n){var i=Ab(n.value||n.matched||n.normal),r=n.match||n.matched;r?t+='<b class="'+Ge.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}Ge.CONTAINER_SELECTOR=".djs-search-container",Ge.INPUT_SELECTOR=".djs-search-input input",Ge.RESULTS_CONTAINER_SELECTOR=".djs-search-results",Ge.RESULT_SELECTOR=".djs-search-result",Ge.RESULT_SELECTED_CLASS="djs-search-result-selected",Ge.RESULT_SELECTED_SELECTOR="."+Ge.RESULT_SELECTED_CLASS,Ge.RESULT_ID_ATTRIBUTE="data-result-id",Ge.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",Ge.BOX_HTML=`<div class="djs-search-container djs-scrollable">
|
|
335
|
+
</svg>`},dD=900;function ns(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",dD,this)}ns.$inject=["popupMenu","distributeElements","translate","rules"],ns.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&W(t,this._getEntries(e)),t},ns.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},ns.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:g_.horizontal,action:function(o,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:g_.vertical,action:function(o,a){t.trigger(e,"vertical"),i.close()}}};return r};const hD={__depends__:[Qf,fD],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",Cl],distributeElementsMenuProvider:["type",ns]};var y_="is not a registered action",mD="is already registered";function si(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}si.$inject=["eventBus","injector"],si.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 f=s.allowed("elements.delete",{elements:u});if(f!==!1){var p=Be(f)?f:u;return o.cut(p.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 f=s.allowed("elements.delete",{elements:u}),p;f!==!1&&(Be(f)?p=f:p=u,p.length&&n.removeElements(p.slice()))}}),c&&this.register("moveCanvas",function(u){c.moveCanvas(u)}),l&&this.register("moveSelection",function(u){l.moveSelection(u.direction,u.accelerated)})},si.prototype.trigger=function(e,t){if(!this._actions[e])throw cd(e,y_);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},si.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);F(e,function(i,r){n._registerAction(r,i)})},si.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw cd(e,mD);this._actions[e]=t},si.prototype.unregister=function(e){if(!this.isRegistered(e))throw cd(e,y_);this._actions[e]=void 0},si.prototype.getActions=function(){return Object.keys(this._actions)},si.prototype.isRegistered=function(e){return!!this._actions[e]};function cd(e,t){return new Error(e+" "+t)}const gD={__init__:["editorActions"],editorActions:["type",si]};function Al(e){e.invoke(si,this)}Ee(Al,si),Al.$inject=["injector"],Al.prototype._registerDefaultActions=function(e){si.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),f=e.get("searchPad",!1),p=e.get("modeling",!1),d=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}),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(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=[],v=m.type;h.length&&(y=Ke(h,function(g){return!S(g,"bpmn:Lane")}),l.trigger(y,v))}),i&&p&&this._registerAction("setColor",function(m){var h=i.get();h.length&&p.setColor(h,m)}),i&&u&&this._registerAction("directEditing",function(){var m=i.get();m.length&&u.activate(m[0])}),f&&this._registerAction("find",function(){f.toggle()}),t&&p&&this._registerAction("moveToOrigin",function(){var m=t.getRootElement(),h,y;S(m,"bpmn:Collaboration")?y=n.filter(function(v){return S(v.parent,"bpmn:Collaboration")}):y=n.filter(function(v){return v!==m&&!S(v.parent,"bpmn:SubProcess")}),h=Ft(y),p.moveElements(y,{x:-h.x,y:-h.y},m)}),i&&d&&this._registerAction("replaceElement",function(m){d.triggerEntry("replace","click",m)})};const yD={__depends__:[gD],editorActions:["type",Al]};function v_(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;qe(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}v_.$inject=["eventBus"];function Zr(e,t){te.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;Pn(a)?r.newBounds=n.snapComplex(c,a):r.newBounds=n.snapSimple(s,c)}})}Zr.$inject=["eventBus","gridSnapping","modeling"],Ee(Zr,te),Zr.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},Zr.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},Zr.prototype.snapHorizontally=function(e,t){var n=this._gridSnapping,i=/w/.test(t),r=/e/.test(t),o={};return o.width=n.snapValue(e.width,{min:e.width}),r&&(i?(o.x=n.snapValue(e.x,{max:e.x}),o.width+=n.snapValue(e.x-o.x,{min:e.x-o.x})):e.x=e.x+e.width-o.width),W(e,o),e},Zr.prototype.snapVertically=function(e,t){var n=this._gridSnapping,i=/n/.test(t),r=/s/.test(t),o={};return o.height=n.snapValue(e.height,{min:e.height}),i&&(r?(o.y=n.snapValue(e.y,{max:e.y}),o.height+=n.snapValue(e.y-o.y,{min:e.y-o.y})):e.y=e.y+e.height-o.height),W(e,o),e};var vD=2e3;function b_(e,t){e.on(["spaceTool.move","spaceTool.end"],vD,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)}})}b_.$inject=["eventBus","gridSnapping"];const bD={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",Zr],gridSnappingSpaceToolBehavior:["type",b_]};var Pl=10;function ld(e,t,n){return n||(n="round"),Math[n](e/t)*t}var xD=1200,_D=800;function wr(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var r=this;t.on("diagram.init",_D,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"],xD,function(o){var a=o.originalEvent;if(!(!r.active||a&&Ln(a))){var s=o.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(l){var u={},f=ED(o,l,e);f&&(u.offset=f);var p=wD(o,l);p&&W(u,p),qo(o,l)||r.snapEvent(o,l,u)})}})}wr.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);Gt(e,t,i)},wr.prototype.getGridSpacing=function(){return Pl},wr.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=ld(e,Pl);var i,r;return t&&t.min&&(i=t.min,Fe(i)&&(i=ld(i+n,Pl,"ceil"),e=Math.max(e,i))),t&&t.max&&(r=t.max,Fe(r)&&(r=ld(r+n,Pl,"floor"),e=Math.min(e,r))),e-=n,e},wr.prototype.isActive=function(){return this.active},wr.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},wr.prototype.toggleActive=function(){this.setActive(!this.active)},wr.$inject=["elementRegistry","eventBus","config.gridSnapping"];function wD(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&&(Ml(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&&(Ml(t)?__(s)?a.x.max=c.left:a.x.min=c.right:x_(s)?a.y.max=c.top:a.y.min=c.bottom),l&&(Ml(t)?__(s)?a.x.min=l.left:a.x.max=l.right:x_(s)?a.y.min=l.top:a.y.max=l.bottom),a[t]}function ED(e,t,n){var i=e.context,r=e.shape,o=i.gridSnappingContext,a=o.snapLocation,s=o.snapOffset;return s&&Fe(s[t])||(s||(s=o.snapOffset={}),Fe(s[t])||(s[t]=0),!r)||(n.get(r.id)||(Ml(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 Ml(e){return e==="x"}function x_(e){return e.indexOf("n")!==-1}function __(e){return e.indexOf("w")!==-1}const SD={__depends__:[bD],__init__:["gridSnapping"],gridSnapping:["type",wr]};var RD=2e3;function w_(e,t,n){e.on("autoPlace",RD,function(i){var r=i.source,o=Ne(r),a=i.shape,s=hb(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],S(a,"bpmn:TextAnnotation")&&(CD(c)?l.offset=-a.width/2:l.offset=-a.height/2),s[c]=t.snapValue(s[c],l))}),s})}w_.$inject=["eventBus","gridSnapping","elementRegistry"];function CD(e){return e==="x"}var AD=1750;function E_(e,t,n){t.on(["create.start","shape.move.start"],AD,function(i){var r=i.context,o=r.shape,a=e.getRootElement();if(!(!S(o,"bpmn:Participant")||!S(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}))}})}E_.$inject=["canvas","eventBus","gridSnapping"];var PD=3e3;function Tl(e,t,n){te.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],PD,function(r){var o=r.context,a=o.connection,s=o.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||MD(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}Tl.$inject=["eventBus","gridSnapping","modeling"],Ee(Tl,te),Tl.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=OD(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function MD(e){return e.length>3}function TD(e){return e==="h"}function kD(e){return e==="v"}function OD(e,t,n){var i=Li(t,n),r={};return TD(i)&&(r.y=e.snapValue(t.y)),kD(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=W({},t,r),n=W({},n,r)),[t,n]}const DD={__depends__:[SD,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",w_],gridSnappingParticipantBehavior:["type",E_],gridSnappingLayoutConnectionBehavior:["type",Tl]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",v_]};var ID=30,S_=30;function is(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var r=i.element,o=i.gfx;if(S(r,"bpmn:Lane"))return n._createParticipantHit(r,o);if(S(r,"bpmn:Participant"))return Qe(r)?n._createParticipantHit(r,o):n._createDefaultHit(r,o);if(S(r,"bpmn:SubProcess"))return Qe(r)?n._createSubProcessHit(r,o):n._createDefaultHit(r,o)})}is.$inject=["eventBus","interactionEvents"],is.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},is.prototype._createParticipantHit=function(e,t){this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"no-move",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height});var n=tn(e)?{width:ID,height:e.height}:{width:e.width,height:S_};return this._interactionEvents.createBoxHit(t,"all",n),!0},is.prototype._createSubProcessHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"no-move",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"all",{width:e.width,height:S_}),!0};const LD={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",is]};function kl(e){e.invoke(Ho,this)}Ee(kl,Ho),kl.$inject=["injector"],kl.prototype.registerBindings=function(e,t){Ho.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 BD={__depends__:[Nf],__init__:["keyboardBindings"],keyboardBindings:["type",kl]};var ND={moveSpeed:1,moveSpeedAccelerated:10},$D=1500,R_="left",C_="up",A_="right",P_="down",FD={ArrowLeft:R_,Left:R_,ArrowUp:C_,Up:C_,ArrowRight:A_,Right:A_,ArrowDown:P_,Down:P_},jD={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 M_(e,t,n,i,r){var o=this;this._config=W({},ND,e||{}),t.addListener($D,function(a){var s=a.keyEvent,c=FD[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=jD[a](l),f=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});f&&n.moveElements(c,u)}}}M_.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const HD={__depends__:[Nf,ni],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",M_]};var T_=10;function rs(e,t,n,i){this._dragging=i,this._rules=t;var r=this;function o(c,l){var u=c.shape,f=c.direction,p=c.resizeConstraints,d;c.delta=l,d=AA(u,f,l),c.newBounds=MA(d,p),c.canExecute=r.canResize(c)}function a(c){var l=c.resizeConstraints,u=c.minBounds;l===void 0&&(u===void 0&&(u=r.computeMinResizeBox(c)),c.resizeConstraints={min:Ie(u)})}function s(c){var l=c.shape,u=c.canExecute,f=c.newBounds;if(u){if(f=jm(f),!zD(l,f))return;n.resizeShape(l,f)}}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)})}rs.prototype.canResize=function(e){var t=this._rules,n=li(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},rs.prototype.activate=function(e,t,n){var i=this._dragging,r,o;if(typeof n=="string"&&(n={direction:n}),r=W({shape:t},n),o=r.direction,!o)throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");i.init(e,k_(t,o),"resize",{autoActivate:!0,cursor:GD(o),data:{shape:t,context:r}})},rs.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,r;return i=e.minDimensions||{width:T_,height:T_},r=Ag(t,e.childrenBoxPadding),TA(n,t,i,r)},rs.$inject=["eventBus","rules","modeling","dragging"];function zD(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function k_(e,t){var n=Ne(e),i=Ie(e),r={x:n.x,y:n.y};return t.indexOf("n")!==-1?r.y=i.top:t.indexOf("s")!==-1&&(r.y=i.bottom),t.indexOf("e")!==-1?r.x=i.right:t.indexOf("w")!==-1&&(r.x=i.left),r}function GD(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 O_="djs-resizing",D_="resize-not-ok",VD=500;function I_(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,O_)),s.width>5&&Se(c,{x:s.x,width:s.width}),s.height>5&&Se(c,{y:s.y,height:s.height}),o.canExecute?et(c).remove(D_):et(c).add(D_)}function r(o){var a=o.shape,s=o.frame;s&&Kt(o.frame),t.removeMarker(a,O_)}e.on("resize.move",VD,function(o){i(o.context)}),e.on("resize.cleanup",function(o){r(o.context)})}I_.$inject=["eventBus","canvas","previewSupport"];var Ol=-6,Dl=8,Il=20,os="djs-resizer",WD=["n","w","s","e","nw","ne","se","sw"];function Er(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&&F(a,Rn(r.addResizer,r))}),e.on("shape.changed",function(o){var a=o.element;n.isSelected(a)&&(r.removeResizers(),r.addResizer(a))})}Er.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(o){pr(o)&&i.activate(o,e,n)}je.bind(t,"mousedown",r),je.bind(t,"touchstart",r)},Er.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=UD(i),a=Oe("g");et(a).add(os),et(a).add(os+"-"+e.id),et(a).add(os+"-"+i),ze(r,a);var s=Oe("rect");Se(s,{x:-Dl/2+o.x,y:-Dl/2+o.y,width:Dl,height:Dl}),et(s).add(os+"-visual"),ze(a,s);var c=Oe("rect");return Se(c,{x:-Il/2+o.x,y:-Il/2+o.y,width:Il,height:Il}),et(c).add(os+"-hit"),ze(a,c),Ys(a,t,n),a},Er.prototype.createResizer=function(e,t){var n=k_(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},Er.prototype.addResizer=function(e){var t=this;ht(e)||F(WD,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},Er.prototype.removeResizers=function(){var e=this._getResizersParent();$s(e)},Er.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},Er.$inject=["eventBus","canvas","selection","resize"];function UD(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-Ol:e.indexOf("w")!==-1&&(t.x=Ol),e.indexOf("s")!==-1?t.y=-Ol:e.indexOf("n")!==-1&&(t.y=Ol),t}const L_={__depends__:[Si,Hi,No],__init__:["resize","resizePreview","resizeHandles"],resize:["type",rs],resizePreview:["type",I_],resizeHandles:["type",Er]};var YD=2e3;function as(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"],YD,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,f=c.context.canExecute,p=c.isTouch;p||f&&(l.hints&&l.hints.createElementsBehavior===!1||s(u))}),e.on("autoPlace.end",500,function(c){s(c.shape)});function s(c,l){(l||qe(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}as.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],as.prototype.activate=function(e){var t=qn(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);W(n,i);var r={},o=n.style||{};return W(o,{backgroundColor:null,border:null}),(qe(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||B_(e))&&W(r,{centerVertically:!0}),sr(e)&&(W(r,{resizable:!0,autoResize:!0}),W(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),S(e,"bpmn:TextAnnotation")&&(W(r,{resizable:!0,autoResize:!0}),W(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),W(n,{options:r,style:o}),n}},as.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,f=s.fontSize*a,p=s.lineHeight,d={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(S(e,"bpmn:Lane")||XD(e)){var m=tn(e),h=m?{width:i.height,height:30*a,x:i.x-i.height/2+15*a,y:r.y-30*a/2}:{width:i.width,height:30*a};W(o,h),W(d,{fontSize:f+"px",lineHeight:p,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:m?"rotate(-90deg)":null})}if(KD(e)){var y=tn(e),v=y?{width:i.width,height:i.height}:{width:i.height,height:i.width,x:r.x-i.height/2,y:r.y-i.width/2};W(o,v),W(d,{fontSize:f+"px",lineHeight:p,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:y?null:"rotate(-90deg)"})}(qe(e,["bpmn:Task","bpmn:CallActivity"])||B_(e))&&(W(o,{width:i.width,height:i.height}),W(d,{fontSize:f+"px",lineHeight:p,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),qD(e)&&(W(o,{width:i.width,x:i.x}),W(d,{fontSize:f+"px",lineHeight:p,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var g=1,b=i.width+2*g;if(n.labelTarget&&(W(o,{width:b,height:i.height+2*g,x:i.x-g,y:i.y-g}),W(d,{fontSize:l+"px",lineHeight:u})),sr(n)&&!Xs(n)&&!Ye(n)){var x=Yu(e),C=t.getAbsoluteBBox({x:x.x,y:x.y,width:0,height:0}),M=l,k=Fr.width*a+2*g;W(o,{width:k,height:M+2*g,x:C.x-k/2,y:C.y-M/2-g}),W(d,{fontSize:l+"px",lineHeight:u})}return S(e,"bpmn:TextAnnotation")&&(W(o,{width:i.width+2*g,height:i.height+2*g,x:i.x-g,y:i.y-g,minWidth:30*a,minHeight:10*a}),W(d,{textAlign:"left",paddingTop:So*a+"px",paddingBottom:So*a+"px",paddingLeft:So*a+"px",paddingRight:So*a+"px",fontSize:f+"px",lineHeight:p})),{bounds:o,style:d}},as.prototype.update=function(e,t,n,i){var r,o;S(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}),ZD(t)&&(t=null),this._modeling.updateLabel(e,t,r)};function B_(e){return S(e,"bpmn:SubProcess")&&!Qe(e)}function qD(e){return S(e,"bpmn:SubProcess")&&Qe(e)}function KD(e){return S(e,"bpmn:Participant")&&!Qe(e)}function XD(e){return S(e,"bpmn:Participant")&&Qe(e)}function ZD(e){return!e||!e.trim()}var N_="djs-element-hidden",$_="djs-label-hidden";function F_(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,S(o,"bpmn:TextAnnotation")){a=t.getAbsoluteBBox(o),s=Oe("g");var u=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:o.height,position:{mx:0,my:0}}),f=i.path=Oe("path");Se(f,{d:u,strokeWidth:2,stroke:QD(o)}),ze(s,f),ze(r,s),ln(s,o.x,o.y)}S(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,N_):(S(o,"bpmn:Task")||S(o,"bpmn:CallActivity")||S(o,"bpmn:SubProcess")||S(o,"bpmn:Participant")||S(o,"bpmn:Lane"))&&t.addMarker(o,$_)}),e.on("directEditing.resize",function(c){if(S(o,"bpmn:TextAnnotation")){var l=c.height,u=c.dy,f=Math.max(o.height/a.height*(l+u),0),p=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:f,position:{mx:0,my:0}});Se(i.path,{d:p})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var l=c.active;l&&(t.removeMarker(l.element.label||l.element,N_),t.removeMarker(o,$_)),o=void 0,a=void 0,s&&(Kt(s),s=void 0)})}F_.$inject=["eventBus","canvas","pathMap"];function QD(e,t){var n=ot(e);return n.get("stroke")||t||"black"}const JD={__depends__:[ff,L_,u_],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",as],labelEditingPreview:["type",F_]};var eI=500,tI=1e3;function Ai(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){MR(o)||i.createOutline(o)}e.on("element.hover",function(o){r(o.element)}),e.on("selection.changed",function(o){F(o.newSelection,r)}),e.on(["shape.changed","connection.changed"],eI,function(o){var a=o.element,s=o.gfx,c=ft(".djs-outline",s);c&&i.updateOutline(a,c)})}Ai.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=ft(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),ze(t,n),this.updateOutline(e,n)),n},Ai.prototype._createOutlineGfx=function(){var e=Oe("rect");return Se(e,W({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},Ai.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},Ai.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&F(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})},Ai.prototype.updateConnectionOutline=function(e,t){var n=Ft(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})},Ai.prototype.registerProvider=function(e,t){t||(t=e,e=tI),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},Ai.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Ai.prototype.getOutline=function(e){var t,n=this._getProviders();return F(n,function(i){Jt(i.getOutline)&&(t=t||i.getOutline(e))}),t},Ai.$inject=["eventBus","styles","elementRegistry"];var Ll=6;function ud(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)})}ud.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");$s(t);var n=e.length>1,i=this._canvas.getContainer();if(et(i)[n?"add":"remove"]("djs-multi-select"),!!n){var r=nI(Ft(e)),o=Oe("rect");Se(o,W({rx:3},r)),et(o).add("djs-selection-outline"),ze(t,o)}},ud.$inject=["eventBus","canvas","selection"];function nI(e){return{x:e.x-Ll,y:e.y-Ll,width:e.width+Ll*2,height:e.height+Ll*2}}const pd={__depends__:[ni],__init__:["outline","multiSelectionOutline"],outline:["type",Ai],multiSelectionOutline:["type",ud]},j_=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],H_={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},iI=15,Bl=2;function z_(e,t,n,i,r){const o=t.getLayer("overlays");e.on(["selection.changed","shape.changed"],function(){s()}),e.on("selection.changed",function({newSelection:f}){var d;const p=f.filter(m=>qe(m,j_));if(p.length===1){const m=p[0];Ye(m)?a(m,m.labelTarget):(d=m.labels)!=null&&d.length&&a(m.labels[0],m)}if(p.length===2){const m=p.find(Ye),h=p.find(y=>{var v;return(v=y.labels)==null?void 0:v.includes(m)});m&&h&&a(m,h)}}),e.on("shape.changed",function({element:f}){var p;!qe(f,j_)||!u(f)||(Ye(f)?a(f,f.labelTarget):(p=f.labels)!=null&&p.length&&a(f.labels[0],f))});function a(f,p){const d=la([Ne(p),Ne(f)],H_),m=d.getAttribute("d"),y=r.isSelected(f)?c(f):l(f),v=da(y,m);if(!v)return;const b=r.isSelected(p)?c(p):l(p),x=da(b,m)||Ne(p);Ea(x,v)<iI||(Fu(d,[x,v]),ze(o,d))}function s(){Ns(`.${H_.class}`,o).forEach(Kt)}function c(f){const p=i.getOutline(f);if(!p)return l(f);if(p.x){const d={x:f.x+Sr(p,"x")-Bl,y:f.y+Sr(p,"y")-Bl,width:Sr(p,"width")+Bl*2,height:Sr(p,"height")+Bl*2};return Ku(d,Sr(p,"rx"))}if(p.cx){const d=Sr(p,"r"),m={x:f.x+Sr(p,"cx")-d,y:f.y+Sr(p,"cy")-d,width:d*2,height:d*2};return ug(m)}}function l(f){return n.getShapePath(f)}function u(f){return r.isSelected(f)}}z_.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function Sr(e,t){return parseFloat(Se(e,t)||0)}const rI={__depends__:[ni,pd],__init__:["labelLink"],labelLink:["type",z_]};var oI=new Bo("tt");function aI(e){var t=wt('<div class="djs-tooltip-container" />');return wn(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function sI(e,t,n){wn(e,{left:t+"px",top:n+"px"})}function fd(e,t){e.style.display=t===!1?"none":""}var G_="djs-tooltip",dd="."+G_;function An(e,t){this._eventBus=e,this._canvas=t,this._ids=oI,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=aI(t.getContainer());var n=this;On.bind(this._tooltipRoot,dd,"mousedown",function(i){i.stopPropagation()}),On.bind(this._tooltipRoot,dd,"mouseover",function(i){n.trigger("mouseover",i)}),On.bind(this._tooltipRoot,dd,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}An.$inject=["eventBus","canvas"],An.prototype.add=function(e){if(!e.position)throw new Error("must specifiy tooltip position");if(!e.html)throw new Error("must specifiy tooltip html");var t=this._ids.next();return e=W({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},An.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(gn(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},An.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},An.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},An.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)}},An.prototype.remove=function(e){var t=this.get(e);t&&(vi(t.html),vi(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},An.prototype.show=function(){fd(this._tooltipRoot)},An.prototype.hide=function(){fd(this._tooltipRoot,!1)},An.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},An.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)),Pn(n)&&(n=wt(n)),i=wt('<div data-tooltip-id="'+t+'" class="'+G_+'">'),wn(i,{position:"absolute"}),i.appendChild(n),e.type&&Ct(i).add("djs-tooltip-"+e.type),e.className&&Ct(i).add(e.className),e.htmlContainer=i,r.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},An.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;sI(n,t.x,t.y)},An.prototype._updateTooltipVisibilty=function(e){F(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,r=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(r=!1),fd(i,r))})},An.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 cI={__init__:["tooltips"],tooltips:["type",An]};var lI="flow elements must be children of pools/participants",uI="Data object must be placed within a pool/participant.";function V_(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;S(s,"bpmn:Collaboration")&&(S(a,"bpmn:FlowNode")?i(r,n(lI)):S(a,"bpmn:DataObjectReference")&&i(r,n(uI)))})}V_.$inject=["eventBus","tooltips","translate"];const pI={__depends__:[cI],__init__:["modelingFeedback"],modelingFeedback:["type",V_]};var fI=500,dI=1250,hI=1500,Nl=Math.round;function mI(e){return{x:e.x+Nl(e.width/2),y:e.y+Nl(e.height/2)}}function W_(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",hI,function(s){var c=s.context,l=s.shape,u=i.get().slice();u.indexOf(l)===-1&&(u=[l]),u=gI(u),W(c,{shapes:u,validatedShapes:u,shape:l})}),e.on("shape.move.start",dI,function(s){var c=s.context,l=c.validatedShapes,u;if(u=c.canExecute=o(l),!u)return!1}),e.on("shape.move.move",fI,function(s){var c=s.context,l=c.validatedShapes,u=s.hover,f={x:s.dx,y:s.dy},p={x:s.x,y:s.y},d;if(d=o(l,f,p,u),c.delta=f,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,f=u==="attach",p=c.shapes;if(u===!1)return!1;l.x=Nl(l.x),l.y=Nl(l.y),!(l.x===0&&l.y===0)&&n.moveElements(p,l,c.target,{primaryShape:c.shape,attach:f})}),e.on("element.mousedown",function(s){if(pr(s)){var c=Oo(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,l,u){if(Qt(l)&&(u=l,l=!1),!(c.waypoints||!c.parent)&&!et(s.target).has("djs-hit-no-move")){var f=mI(c),p=t.init(s,f,"shape.move",{cursor:"grabbing",autoActivate:l,data:{shape:c,context:u||{}}});if(p!==!1)return!0}}this.start=a}W_.$inject=["eventBus","dragging","modeling","selection","rules"];function gI(e){var t=oo(e,"id");return Ke(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var U_=499,hd="djs-dragging",Y_="drop-ok",q_="drop-not-ok",K_="new-parent",X_="attach-ok";function Z_(e,t,n,i){function r(c){var l=o(c),u=yI(l);return u}function o(c){var l=ua(c),u=l.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),f=l.concat(u),p=[...new Set(f)];return p}function a(c,l){[X_,Y_,q_,K_].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,hd),c.allDraggedElements?c.allDraggedElements.push(l):c.allDraggedElements=[l]}e.on("shape.move.start",U_,function(c){var l=c.context,u=l.shapes,f=l.allDraggedElements,p=r(u);if(!l.dragGroup){var d=Oe("g");Se(d,n.cls("djs-drag-group",["no-events"]));var m=t.getActiveLayer();ze(m,d),l.dragGroup=d}p.forEach(function(h){i.addDragger(h,l.dragGroup)}),f?f=Kl([f,o(u)]):f=o(u),F(f,function(h){t.addMarker(h,hd)}),l.allDraggedElements=f,l.differentParents=vI(u)}),e.on("shape.move.move",U_,function(c){var l=c.context,u=l.dragGroup,f=l.target,p=l.shape.parent,d=l.canExecute;f&&(d==="attach"?a(f,X_):l.canExecute&&p&&f.id!==p.id?a(f,K_):a(f,l.canExecute?Y_:q_)),ln(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,f=l.dragGroup;F(u,function(p){t.removeMarker(p,hd)}),f&&Kt(f)}),this.makeDraggable=s}Z_.$inject=["eventBus","canvas","styles","previewSupport"];function yI(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=Ke(e,function(i){return ht(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function vI(e){return D0(oo(e,function(t){return t.parent&&t.parent.id}))!==1}const bI={__depends__:[Ac,ni,pd,Si,Hi,No],__init__:["move","movePreview"],move:["type",W_],movePreview:["type",Z_]};var Q_=".djs-palette-toggle",J_=".entry",xI=Q_+", "+J_,md="djs-palette-",_I="shown",gd="open",ew="two-column",wI=1e3;function Vt(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()})}Vt.$inject=["eventBus","canvas"],Vt.prototype.registerProvider=function(e,t){t||(t=e,e=wI),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},Vt.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(SI,{})},Vt.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},Vt.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=wt(Vt.HTML_MARKUP);n.appendChild(i),Ct(n).add(md+_I),On.bind(i,xI,"click",function(r){var o=r.delegateTarget;if(Tu(o,Q_))return e.toggle();e.trigger("click",r)}),je.bind(i,"mousedown",function(r){r.stopPropagation()}),On.bind(i,J_,"dragstart",function(r){e.trigger("dragstart",r)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},Vt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},Vt.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,r,o=Ct(n),a=Ct(t);"twoColumn"in e?r=e.twoColumn:r=this._needsCollapse(t.clientHeight,this._entries||{}),o.toggle(ew,r),a.toggle(md+ew,r),"open"in e&&(o.toggle(gd,e.open),a.toggle(md+gd,e.open)),i.fire("palette.changed",{twoColumn:r,open:this.isOpen()})},Vt.prototype._update=function(){var e=ft(".djs-palette-entries",this._container),t=this._entries=this.getEntries();Ls(e),F(t,function(n,i){var r=n.group||"default",o=ft("[data-group="+Wa(r)+"]",e);o||(o=wt('<div class="group"></div>'),gn(o,"data-group",r),e.appendChild(o));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=wt(a);if(o.appendChild(s),!n.separator&&(gn(s,"data-action",i),n.title&&gn(s,"title",n.title),n.className&&EI(s,n.className),n.imageUrl)){var c=wt("<img>");gn(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},Vt.prototype.trigger=function(e,t,n){var i,r,o=t.delegateTarget||t.target;return o?(i=gn(o,"data-action"),r=t.originalEvent||t,this.triggerEntry(i,e,r,n)):t.preventDefault()},Vt.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(Jt(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},Vt.prototype._layoutChanged=function(){this._toggleState({})},Vt.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},Vt.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},Vt.prototype.open=function(){this._toggleState({open:!0})},Vt.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Vt.prototype.isActiveTool=function(e){return e&&this._activeTool===e},Vt.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=ft(".djs-palette-entries",this._container),this._toolsContainer=ft("[data-group=tools]",t)),n=this._toolsContainer,F(n.children,function(i){var r=i.getAttribute("data-action");if(r){var o=Ct(i);r=r.replace("-tool",""),o.contains("entry")&&r===e?o.add("highlighted-entry"):o.remove("highlighted-entry")}})},Vt.prototype.isOpen=function(){return Ct(this._container).has(gd)},Vt.prototype._getParentContainer=function(){return this._canvas.getContainer()},Vt.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function EI(e,t){var n=Ct(e),i=Be(t)?t:t.split(/\s+/g);i.forEach(function(r){n.add(r)})}function SI(e,t){var n=t.getPaletteEntries();return Jt(n)?n(e):(F(n,function(i,r){e[r]=i}),e)}const RI={__init__:["palette"],palette:["type",Vt]};var tw="crosshair",nw="selected",CI="djs-dragging-active-lasso";function Rr(e,t,n,i,r,o,a){this._selection=r,this._dragging=n,this._mouse=a;var s=this,c={create:function(f){var p=t.getActiveLayer(),d=f.frame=Oe("rect");Se(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),ze(p,d),l(!0),this.update(f)},update:function(f){var p=f.frame,d=f.bbox;p&&d&&Se(p,{x:d.x,y:d.y,width:d.width,height:d.height});var m=f.marked,h=f.lastMarked;if(m&&h){for(const y of h)m.has(y)||t.removeMarker(y,nw);for(const y of m)h.has(y)||t.addMarker(y,nw)}},remove:function(f){this.update(f),f.frame&&Kt(f.frame),l(!1)}};function l(f){et(t.getContainer()).toggle(CI,f)}function u(f){var p=i.getAll();return new Set(ro(bo(p,f)))}o.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",function(f){var p=f.originalEvent.target;!f.hover&&!(p instanceof SVGElement)||e.once("lasso.selection.ended",function(){s.activateLasso(f.originalEvent,!0)})}),e.on("lasso.end",0,function(f){var p=f.context;s._select(Array.from(p.marked))}),e.on("lasso.start",function(f){var p=f.context;p.bbox=iw(f),p.add=xc(f),p.lastMarked=new Set(r.get()),p.add?p.marked=p.lastMarked:p.marked=new Set,p.initialMarked=p.marked,c.create(p)}),e.on("lasso.move",function(f){var p=f.context,d=p.bbox=iw(f),m=u(d),h=p.initialMarked.union(m);p.lastMarked=p.marked,p.marked=h,c.update(p)}),e.on("lasso.cleanup",function(f){var p=f.context;p.lastMarked=p.marked,p.marked=new Set(r.get()),c.remove(f.context)}),e.on("element.mousedown",1500,function(f){if(xc(f))return s.activateLasso(f.originalEvent),!0})}Rr.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],Rr.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:tw,data:{context:{}},keepSelection:!0})},Rr.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:tw,data:{context:{}},keepSelection:!0})},Rr.prototype._select=function(e){this._selection.select(e)},Rr.prototype.select=function(e,t,n=[]){var i=ro(bo(e,t));this._select([...n,...i])},Rr.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Rr.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function iw(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 AI={__depends__:[kc,Ma],__init__:["lassoTool"],lassoTool:["type",Rr]};var yd=1500,rw="grab";function Ko(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",yd,function(c){if(Ca(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(yd,function(c){if(!(!ow(c.keyEvent)||a.isActive())){var l=a._mouse.getLastMoveEvent();a.activateMove(l,!!l)}},"keyboard.keydown"),s&&s.addListener(yd,function(c){!ow(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!Ca(c)&&u&&e.once("hand.move.ended",function(f){a.activateHand(f.originalEvent,!0,!0)}),!1})}Ko.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Ko.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:rw,data:{context:n||{}}})},Ko.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:rw,data:{context:{reactivate:n}}})},Ko.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Ko.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function ow(e){return Xt("Space",e)}const PI={__depends__:[kc,Ma],__init__:["handTool"],handTool:["type",Ko]};var aw="connect-ok",sw="connect-not-ok";function Xo(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,f=l.canStartConnect=s.canStartConnect(u);f!==null&&(l.startTarget=u,i.addMarker(u,f?aw:sw))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var l=c.context.startTarget,u=c.context.canStartConnect;l&&i.removeMarker(l,u?aw:sw)}),e.on(["global-connect.ended"],function(c){var l=c.context,u=l.startTarget,f={x:c.x,y:c.y},p=s.canStartConnect(u);if(p)return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),n.start(null,u,f)}),!1})}Xo.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],Xo.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},Xo.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},Xo.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Xo.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const MI={__depends__:[ad,Si,Hi,kc,Ma],globalConnect:["type",Xo]};function vd(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)}vd.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],vd.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(f,p,d,m,h){function y(v){var g=n.createShape(W({type:f},h));t.start(v,g)}return{group:p,className:d,title:m,action:{dragstart:y,click:y}}}function l(f){var p=n.createShape({type:"bpmn:SubProcess",x:0,y:0,isExpanded:!0}),d=n.createShape({type:"bpmn:StartEvent",x:40,y:82,parent:p});t.start(f,[p,d],{hints:{autoSelect:[p]}})}function u(f){t.start(f,n.createParticipantShape())}return W(e,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:s("Activate hand tool"),action:{click:function(f){o.activateHand(f)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:s("Activate lasso tool"),action:{click:function(f){r.activateSelection(f)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:s("Activate create/remove space tool"),action:{click:function(f){i.activateSelection(f)}}},"global-connect-tool":{group:"tools",className:"bpmn-icon-connection-multi",title:s("Activate global connect tool"),action:{click:function(f){a.start(f)}}},"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 TI={__depends__:[RI,Mc,Pv,AI,PI,MI,ba],__init__:["paletteProvider"],paletteProvider:["type",vd]};var kI=250;function bd(e,t,n,i,r){te.call(this,e);function o(s){var c=s.canExecute.replacements;F(c,function(l){var u=l.oldElementId,f={type:l.newElementType};if(!s.visualReplacements[u]){var p=t.get(u);W(f,{x:p.x,y:p.y});var d=n.createShape(f);i.addShape(d,p.parent);var m=ft('[data-element-id="'+Wa(p.id)+'"]',s.dragGroup);m&&Se(m,{display:"none"});var h=r.addDragger(d,s.dragGroup);s.visualReplacements[u]=h,i.removeShape(d)}})}function a(s){var c=s.visualReplacements;F(c,function(l,u){var f=ft('[data-element-id="'+Wa(u)+'"]',s.dragGroup);f&&Se(f,{display:"inline"}),l.remove(),c[u]&&delete c[u]})}e.on("shape.move.move",kI,function(s){var c=s.context,l=c.canExecute;c.visualReplacements||(c.visualReplacements={}),l&&l.replacements?o(c):a(c)})}bd.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],Ee(bd,te);const OI={__depends__:[No],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",bd]};var DI=1250,xd=40,II=20,LI=10,cw=20,lw=["x","y"],BI=Math.abs;function uw(e){e.on(["connect.hover","connect.move","connect.end"],DI,function(t){var n=t.context,i=n.canExecute,r=n.start,o=n.hover,a=n.source,s=n.target;t.originalEvent&&Ln(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&o&&NI(t,o,HI(o)),o&&jI(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=oi(r),qe(o,["bpmn:Event","bpmn:Gateway"])&&pw(t,oi(o)),qe(o,["bpmn:Task","bpmn:SubProcess"])&&$I(t,o),S(a,"bpmn:BoundaryEvent")&&s===a.host&&FI(t)):fw(i,"bpmn:MessageFlow")?(S(r,"bpmn:Event")&&(n.connectionStart=oi(r)),S(o,"bpmn:Event")&&pw(t,oi(o))):n.connectionStart=n.initialConnectionStart)})}uw.$inject=["eventBus"];function NI(e,t,n){lw.forEach(function(i){var r=dw(i,t);e[i]<t[i]+n?Gt(e,i,t[i]+n):e[i]>t[i]+r-n&&Gt(e,i,t[i]+r-n)})}function $I(e,t){var n=oi(t);lw.forEach(function(i){zI(e,t,i)&&Gt(e,i,n[i])})}function FI(e){var t=e.context,n=t.source,i=t.target;if(!GI(t)){var r=oi(n),o=cn(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;BI(c-r[s])<xd&&(c>r[s]?l=r[s]+xd:l=r[s]-xd,Gt(e,s,l))})}}function pw(e,t){Gt(e,"x",t.x),Gt(e,"y",t.y)}function fw(e,t){return e&&e.type===t}function jI(e,t){return Xi(t,function(n){return fw(e,n)})}function dw(e,t){return e==="x"?t.width:t.height}function HI(e){return S(e,"bpmn:Task")?LI:II}function zI(e,t,n){return e[n]>t[n]+cw&&e[n]<t[n]+dw(n,t)-cw}function GI(e){var t=e.hover,n=e.source;return t&&n&&t===n}function Cr(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}Cr.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},Cr.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},Cr.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},Cr.prototype.getSnapLocations=function(){return this._snapLocations},Cr.prototype.setSnapLocations=function(e){this._snapLocations=e},Cr.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new $l,n.initDefaults(this._defaultSnaps)),n};function $l(){this._snapValues={}}$l.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)},$l.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&kO(e[n],r[n],i)},$l.prototype.initDefaults=function(e){var t=this;F(e||{},function(n,i){F(n,function(r){t.add(i,r)})})};var VI=1250;function Pi(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"],VI,function(r){var o=r.context,a=o.shape,s=o.snapContext,c=o.target;if(!(r.originalEvent&&Ln(r.originalEvent))&&!(qo(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()})}Pi.$inject=["elementRegistry","eventBus","snapping"],Pi.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,r=n.snapContext;r||(r=n.snapContext=new Cr);var o;t.get(i.id)?o=oi(i,e):o={x:e.x+oi(i).x,y:e.y+oi(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}),Ye(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},Pi.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return F(i,function(r){if(Ye(r)){Ye(t)&&e.add("mid",oi(r));return}if(ht(r)){if(r.waypoints.length<3)return;var o=r.waypoints.slice(1,-1);F(o,function(a){e.add("mid",a)});return}e.add("mid",oi(r))}),!Fe(t.x)||!Fe(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",oi(t)),e},Pi.prototype.getSnapTargets=function(e,t){return Jx(t).filter(function(n){return!WI(n)})};function WI(e){return!!e.hidden}var hw=1500;function Zo(e,t){t.invoke(Pi,this),e.on(["create.move","create.end"],hw,KI),e.on(["create.move","create.end","shape.move.move","shape.move.end"],hw,function(n){var i=n.context,r=i.canExecute,o=i.target,a=r&&(r==="attach"||r.attach);a&&!qo(n)&&UI(n,o)})}Ee(Zo,Pi),Zo.$inject=["eventBus","injector"],Zo.prototype.initSnap=function(e){var t=Pi.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return F(n.outgoing,function(r){var o=r.waypoints[0];o=o.original||o,t.setSnapOrigin(r.id+"-docking",gw(o,i,e))}),F(n.incoming,function(r){var o=r.waypoints[r.waypoints.length-1];o=o.original||o,t.setSnapOrigin(r.id+"-docking",gw(o,i,e))}),S(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},Zo.prototype.addSnapTargetPoints=function(e,t,n){Pi.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);F(i,function(o){(qI(o)||YI([t,o],"bpmn:TextAnnotation"))&&(e.add("top-left",Zx(o)),e.add("bottom-right",Qx(o)))});var r=this._elementRegistry;return F(t.incoming,function(o){if(r.get(t.id)){mw(i,o.source)||e.add("mid",Ne(o.source));var a=o.waypoints[0];e.add(o.id+"-docking",a.original||a)}}),F(t.outgoing,function(o){if(r.get(t.id)){mw(i,o.target)||e.add("mid",Ne(o.target));var a=o.waypoints[o.waypoints.length-1];e.add(o.id+"-docking",a.original||a)}}),S(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},Zo.prototype.getSnapTargets=function(e,t){return Pi.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!S(n,"bpmn:Lane")})};function UI(e,t){var n=Ie(t),i=Sy(e,t),r=e.context,o=r.shape,a;o.parent?a={x:0,y:0}:a=Ne(o),/top/.test(i)?Gt(e,"y",n.top-a.y):/bottom/.test(i)&&Gt(e,"y",n.bottom-a.y),/left/.test(i)?Gt(e,"x",n.left-a.x):/right/.test(i)&&Gt(e,"x",n.right-a.x)}function YI(e,t){return e.every(function(n){return S(n,t)})}function qI(e){return S(e,"bpmn:SubProcess")&&Qe(e)?!0:S(e,"bpmn:Participant")}function KI(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)&&Gt(e,"x",e.x),(i&&i>=e.y||o&&o<=e.y)&&Gt(e,"y",e.y)}}function mw(e,t){return e.indexOf(t)!==-1}function gw(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var XI=1250;function ss(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],XI,function(i){var r=i.context,o=r.shape,a=o.parent,s=r.direction,c=r.snapContext;if(!(i.originalEvent&&Ln(i.originalEvent))&&!qo(i)){var l=c.pointsForTarget(a);l.initialized||(l=n.addSnapTargetPoints(l,o,a,s),l.initialized=!0),JI(s)&&Gt(i,"x",i.x),eL(s)&&Gt(i,"y",i.y),t.snap(i,l)}}),e.on(["resize.cleanup"],function(){t.hide()})}ss.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new Cr);var o=yw(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},ss.prototype.addSnapTargetPoints=function(e,t,n,i){var r=this.getSnapTargets(t,n);return F(r,function(o){e.add("corner",Qx(o)),e.add("corner",Zx(o))}),e.add("corner",yw(t,i)),e},ss.$inject=["eventBus","snapping"],ss.prototype.getSnapTargets=function(e,t){return Jx(t).filter(function(n){return!ZI(n,e)&&!ht(n)&&!QI(n)&&!Ye(n)})};function yw(e,t){var n=Ne(e),i=Ie(e),r={x:n.x,y:n.y};return t.indexOf("n")!==-1?r.y=i.top:t.indexOf("s")!==-1&&(r.y=i.bottom),t.indexOf("e")!==-1?r.x=i.right:t.indexOf("w")!==-1&&(r.x=i.left),r}function ZI(e,t){return e.host===t}function QI(e){return!!e.hidden}function JI(e){return e==="n"||e==="s"}function eL(e){return e==="e"||e==="w"}var tL=7,nL=1e3;function Ar(e){this._canvas=e,this._asyncHide=Zl(Rn(this.hide,this),nL)}Ar.$inject=["canvas"],Ar.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,r=i.getSnapLocations(),o={x:qo(e,"x"),y:qo(e,"y")};F(r,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(F(["x","y"],function(l){var u;o[l]||(u=t.snap(c,a,l,tL),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),F(["x","y"],function(a){var s=o[a];Qt(s)&&Gt(e,a,s.originValue)})},Ar.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=Oe("path");return Se(n,{d:"M0,0 L0,0"}),et(n).add("djs-snap-line"),ze(t,n),{update:function(i){Fe(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"})}}},Ar.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},Ar.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},Ar.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},Ar.prototype.hide=function(){F(this._snapLines,function(e){e.update()})};const iL={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",Pi],resizeSnapping:["type",ss],snapping:["type",Ar]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",uw],createMoveSnapping:["type",Zo]};var vw=300;function Ge(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=ft(Ge.INPUT_SELECTOR,this._container),this._resultsContainer=ft(Ge.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}Ge.$inject=["canvas","eventBus","selection","translate"],Ge.prototype._bindEvents=function(){var e=this;function t(n,i,r,o){e._eventMaps.push({el:n,type:r,listener:On.bind(n,i,r,o)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,Ge.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,Ge.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,Ge.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,Ge.INPUT_SELECTOR,"keydown",function(n){Xt("ArrowUp",n)&&n.preventDefault(),Xt("ArrowDown",n)&&n.preventDefault()}),t(this._container,Ge.INPUT_SELECTOR,"keyup",function(n){if(Xt("Escape",n))return e.close();if(Xt("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(Xt("ArrowUp",n))return e._scrollToDirection(!0);if(Xt("ArrowDown",n))return e._scrollToDirection();Xt(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},Ge.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){On.unbind(e.el,e.type,e.listener)})},Ge.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=ft(Ge.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},Ge.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},Ge.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)}},Ge.prototype._clearResults=function(){Ls(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},Ge.prototype._getCurrentResult=function(){return ft(Ge.RESULT_SELECTED_SELECTOR,this._resultsContainer)},Ge.prototype._createResultNode=function(e,t){var n=wt(Ge.RESULT_HTML);return e.primaryTokens.length>0&&bw(n,e.primaryTokens,Ge.RESULT_PRIMARY_HTML),bw(n,e.secondaryTokens,Ge.RESULT_SECONDARY_HTML),gn(n,Ge.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},Ge.prototype.registerProvider=function(e){this._searchProvider=e},Ge.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,Ct(this._canvas.getContainer()).add("djs-search-open"),Ct(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},Ge.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,Ct(this._canvas.getContainer()).remove("djs-search-open"),Ct(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},Ge.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Ge.prototype.isOpen=function(){return this._open},Ge.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&Ct(t).remove(Ge.RESULT_SELECTED_CLASS);var n=gn(e,Ge.RESULT_ID_ATTRIBUTE),i=this._results[n].element;Ct(e).add(Ge.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:vw}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},Ge.prototype._select=function(e){var t=gn(e,Ge.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:vw}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},Ge.prototype._getBoxHtml=function(){const e=wt(Ge.BOX_HTML),t=ft(Ge.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function bw(e,t,n){var i=rL(t),r=wt(n);r.innerHTML=i,e.appendChild(r)}function rL(e){var t="";return e.forEach(function(n){var i=Ab(n.value||n.matched||n.normal),r=n.match||n.matched;r?t+='<b class="'+Ge.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}Ge.CONTAINER_SELECTOR=".djs-search-container",Ge.INPUT_SELECTOR=".djs-search-input input",Ge.RESULTS_CONTAINER_SELECTOR=".djs-search-results",Ge.RESULT_SELECTOR=".djs-search-result",Ge.RESULT_SELECTED_CLASS="djs-search-result-selected",Ge.RESULT_SELECTED_SELECTOR="."+Ge.RESULT_SELECTED_CLASS,Ge.RESULT_ID_ATTRIBUTE="data-result-id",Ge.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",Ge.BOX_HTML=`<div class="djs-search-container djs-scrollable">
|
|
336
336
|
<div class="djs-search-input">
|
|
337
337
|
<svg class="djs-search-icon" width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
338
338
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.0325 8.5H9.625L13.3675 12.25L12.25 13.3675L8.5 9.625V9.0325L8.2975 8.8225C7.4425 9.5575 6.3325 10 5.125 10C2.4325 10 0.25 7.8175 0.25 5.125C0.25 2.4325 2.4325 0.25 5.125 0.25C7.8175 0.25 10 2.4325 10 5.125C10 6.3325 9.5575 7.4425 8.8225 8.2975L9.0325 8.5ZM1.75 5.125C1.75 6.9925 3.2575 8.5 5.125 8.5C6.9925 8.5 8.5 6.9925 8.5 5.125C8.5 3.2575 6.9925 1.75 5.125 1.75C3.2575 1.75 1.75 3.2575 1.75 5.125Z" fill="#22242A"/>
|
|
@@ -340,4 +340,4 @@
|
|
|
340
340
|
<input type="text" spellcheck="false" />
|
|
341
341
|
</div>
|
|
342
342
|
<div class="djs-search-results" />
|
|
343
|
-
</div>`,Ge.RESULT_HTML='<div class="djs-search-result"></div>',Ge.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',Ge.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const rL={__depends__:[ba,el,ni],searchPad:["type",Ge]};function _d(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}_d.$inject=["elementRegistry","searchPad","canvas","search"],_d.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!Ye(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:qn(i),id:i.id})),e,{keys:["label","id"]}).map(oL)};function oL(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const aL={__depends__:[rL,kx],__init__:["bpmnSearch"],bpmnSearch:["type",_d]},sL="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",cL="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",lL={width:36,height:50},uL={width:50,height:50};function xw(e,t,n){return Oe("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const ci=5;function Fl(e,t){this._styles=t,e.registerProvider(this)}Fl.$inject=["outline","styles"],Fl.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(SC(e))return n=Oe("rect"),Se(n,W({x:-ci,y:-ci,rx:4,width:e.width+ci*2,height:e.height+ci*2},t)),n;if(!Ye(e))return S(e,"bpmn:Gateway")?(n=Oe("rect"),W(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),Se(n,W({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):qe(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=Oe("rect"),Se(n,W({x:-ci,y:-ci,rx:14,width:e.width+ci*2,height:e.height+ci*2},t))):S(e,"bpmn:EndEvent")?(n=Oe("circle"),Se(n,W({cx:e.width/2,cy:e.height/2,r:e.width/2+ci+1},t))):S(e,"bpmn:Event")?(n=Oe("circle"),Se(n,W({cx:e.width/2,cy:e.height/2,r:e.width/2+ci},t))):S(e,"bpmn:DataObjectReference")&&_w(e,"bpmn:DataObjectReference")?n=xw(sL,{x:-6,y:-6},t):S(e,"bpmn:DataStoreReference")&&_w(e,"bpmn:DataStoreReference")&&(n=xw(cL,{x:-6,y:-6},t)),n},Fl.prototype.updateOutline=function(e,t){if(!Ye(e))return qe(e,["bpmn:SubProcess","bpmn:Group"])?(Se(t,{width:e.width+ci*2,height:e.height+ci*2}),!0):!!qe(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function _w(e,t){var n;return t==="bpmn:DataObjectReference"?n=lL:t==="bpmn:DataStoreReference"&&(n=uL),e.width===n.width&&e.height===n.height}const pL={__depends__:[pd],__init__:["outlineProvider"],outlineProvider:["type",Fl]};var fL='<?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 Mi(e){wo.call(this,e)}Ee(Mi,wo),Mi.Viewer=xr,Mi.NavigatedViewer=Ua,Mi.prototype.createDiagram=function(){return this.importXML(fL)},Mi.prototype._interactionModules=[Ib,Bb,Fb],Mi.prototype._modelingModules=[hO,Zc,bO,yO,OO,ad,$O,lD,yv,Mc,dD,gD,OD,ID,LD,jD,QD,iI,Mf,uI,vI,MI,kI,L_,nL,aL,pL],Mi.prototype._modules=[].concat(xr.prototype._modules,Mi.prototype._interactionModules,Mi.prototype._modelingModules);const dL=ge.defineComponent({__name:"BpmnModelerView",props:{xml:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,r=n,o=ge.ref();let a;async function s(l){if(!a)throw new Error("modeler not mounted");try{const{warnings:u}=await a.importXML(l),f=uu(u);return r("imported",f),{warnings:f}}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 ge.onMounted(async()=>{a=new Mi({container:o.value,moddleExtensions:xs}),i.xml&&await s(i.xml),r("ready")}),ge.watch(()=>i.xml,l=>{l&&a&&s(l)}),ge.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(l,u)=>(ge.openBlock(),ge.createElementBlock("div",{ref_key:"container",ref:o,class:"bpmn-modeler-view"},null,512))}}),ww=(e,t)=>{const n=e.__vccOpts||e;for(const[i,r]of t)n[i]=r;return n},hL=ww(dL,[["__scopeId","data-v-a9b41c97"]]),mL=["title","aria-expanded"],gL=["title","onClick"],yL={viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},vL={key:0,d:"M5.6 5.6l4.8 4.8M10.4 5.6l-4.8 4.8",stroke:"currentColor","stroke-width":"1.5"},bL={key:1,d:"M8 4.6v0.2M8 7v4.4",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round"},xL={key:0,class:"bwl-validation__body"},_L={key:0,class:"bwl-validation__empty"},wL={key:1,class:"bwl-validation__empty"},EL={key:2,class:"bwl-validation__list"},SL=["onClick"],RL={key:0,class:"bwl-validation__scope",title:"이번 변경이 만들거나 건드린 요소"},CL={class:"bwl-validation__msg"},AL=["title"],PL=ww(ge.defineComponent({__name:"BpmnValidationPanel",props:{controller:{}},setup(e){const n=e.controller,i=ge.computed(()=>wb(n.issues.value,n.describeElement)),r=ge.computed(()=>Eb(i.value)),o=m=>jo(m,n.changeScope.value),a=ge.computed(()=>Lf(i.value,n.changeScope.value)),s=ge.ref({error:!0,warning:!0,info:!0}),c=ge.computed(()=>Sb(i.value.filter(m=>s.value[m.severity]),n.changeScope.value)),l=ge.ref(!1),u=["error","warning","info"],f={error:"오류",warning:"경고",info:"정보"};function p(m){if(!l.value){l.value=!0;return}s.value[m]=!s.value[m]}function d(m){const h=m.targetRefs[0];h&&n.requestFocus(h)}return(m,h)=>(ge.openBlock(),ge.createElementBlock("section",{class:ge.normalizeClass(["bwl-validation",{"is-open":l.value}])},[ge.createElementVNode("header",{class:"bwl-validation__head",onClick:h[1]||(h[1]=y=>l.value=!l.value)},[ge.createElementVNode("button",{type:"button",class:"bwl-validation__toggle",title:l.value?"접기":"펼치기","aria-expanded":l.value},[(ge.openBlock(),ge.createElementBlock("svg",{class:ge.normalizeClass(["bwl-validation__chevron",{"is-open":l.value}]),viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},[...h[2]||(h[2]=[ge.createElementVNode("path",{d:"M6 3l5 5-5 5",fill:"none",stroke:"currentColor","stroke-width":"1.6"},null,-1)])],2)),h[3]||(h[3]=ge.createElementVNode("span",null,"검증",-1))],8,mL),ge.createElementVNode("div",{class:"bwl-validation__counts",onClick:h[0]||(h[0]=ge.withModifiers(()=>{},["stop"]))},[(ge.openBlock(),ge.createElementBlock(ge.Fragment,null,ge.renderList(u,y=>ge.createElementVNode("button",{key:y,type:"button",class:ge.normalizeClass(["bwl-validation__count",[`is-${y}`,{"is-off":!s.value[y]}]]),title:l.value?`${f[y]} ${s.value[y]?"숨기기":"보이기"}`:"검증 패널 펼치기",onClick:v=>p(y)},[(ge.openBlock(),ge.createElementBlock("svg",yL,[h[4]||(h[4]=ge.createElementVNode("circle",{cx:"8",cy:"8",r:"6.4",fill:"none",stroke:"currentColor","stroke-width":"1.5"},null,-1)),y==="error"?(ge.openBlock(),ge.createElementBlock("path",vL)):(ge.openBlock(),ge.createElementBlock("path",bL))])),ge.createElementVNode("span",null,ge.toDisplayString(r.value[y]),1)],10,gL)),64))])]),l.value?(ge.openBlock(),ge.createElementBlock("div",xL,[i.value.length===0?(ge.openBlock(),ge.createElementBlock("p",_L,"발견된 문제가 없습니다.")):c.value.length===0?(ge.openBlock(),ge.createElementBlock("p",wL," 선택한 심각도에 해당하는 항목이 없습니다. ")):(ge.openBlock(),ge.createElementBlock("ul",EL,[(ge.openBlock(!0),ge.createElementBlock(ge.Fragment,null,ge.renderList(c.value,y=>(ge.openBlock(),ge.createElementBlock("li",{key:y.key,class:ge.normalizeClass(["bwl-validation__item",[`is-${y.severity}`,{"is-clickable":y.targetRefs.length>0}]]),onClick:v=>d(y)},[h[5]||(h[5]=ge.createElementVNode("span",{class:"bwl-validation__dot","aria-hidden":"true"},null,-1)),a.value&&o(y)?(ge.openBlock(),ge.createElementBlock("span",RL,"이번 변경")):ge.createCommentVNode("",!0),ge.createElementVNode("span",CL,ge.toDisplayString(y.message),1),ge.createElementVNode("span",{class:"bwl-validation__cat",title:y.code},ge.toDisplayString(y.category),9,AL)],10,SL))),128))]))])):ge.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-60e8b1a9"]]);ee.ADDABLE_FLOW_NODE_TYPES=fs,ee.APPLY_BPMN_OPS_SCHEMA=M0,ee.BPMN_MODDLE_EXTENSIONS=xs,ee.BWL_MODDLE_SCHEMA=Td,ee.BWL_NS=Md,ee.BWL_PREFIX=Ul,ee.BWL_SIDES=Yl,ee.BpmnModelerView=hL,ee.BpmnValidationPanel=PL,ee.EDITOR=ES,ee.FLOW_LABEL_INDENT=uh,ee.HEADLESS_BPMN_MODULES=yb,ee.HEADLESS_TEXT_METRICS=uo,ee.I18N_NS=s1,ee.I18N_PREFIX=th,ee.IR_FLOW_NODE_TYPES=Mr,ee.LABEL_FORK_MARGIN=hu,ee.SEVERITY_ORDER=If,ee.SYMBOLIC_OP_KINDS=Dd,ee.SYMBOLIC_OP_SCHEMA=Id,ee.UNDO_EPISODE_COMMAND=ql,ee.applyBpmnOpBatch=um,ee.applyBpmnOps=nm,ee.approximateTextWidth=po,ee.auditBpmnGeometry=_h,ee.auditBpmnGeometryXml=D1,ee.auditBpmnSemantics=Au,ee.auditBpmnSemanticsXml=hS,ee.auditGeometry=At,ee.auditTargetsOf=Wn,ee.axisSegmentsOf=_n,ee.blackBoxNameRect=fu,ee.buildBpmnOpBatch=wS,ee.buildRegistryIndex=Eh,ee.containerBoundarySegments=oa,ee.countBySeverity=Eb,ee.createBpmnEditorController=SS,ee.createBpmnModdle=nh,ee.createHeadlessBpmnModeler=V2,ee.crossedShapesOf=an,ee.crossingCost=Vn,ee.describeProcess=am,ee.describeProcessXml=cS,ee.diffBpmnElements=lm,ee.diffBpmnElementsXml=xS,ee.edgeCrossCount=aa,ee.edgeCrossingPairsOf=Rs,ee.edgeCrossingStatsOf=mh,ee.executeAsUndoEpisode=Od,ee.followMovedEdgeLabels=Gh,ee.forwardThreePointCandidates=As,ee.geometryFindingKey=Rt,ee.installHeadlessBpmnDom=rh,ee.isAddableFlowNodeType=Pd,ee.isChangeScopeMixed=Lf,ee.isEdgeOverlapFinding=du,ee.isInChangeScope=jo,ee.isIrFlowNodeType=Ad,ee.labelRectsOf=mo,ee.lineCrossesLabel=Oi,ee.lineThroughLabel=fh,ee.lineThroughShapeLabel=bh,ee.loadBpmnXml=lo,ee.lowerOps=tm,ee.oppositeOverlapCount=x1,ee.oppositeOverlapOf=lh,ee.planBackEdgeBoundaryClearance=Oh,ee.planCrossPoolRoute=Mh,ee.planEdgeRepair=vu,ee.planLabelLineClearance=zh,ee.planLabelPlacement=Hh,ee.planMiddleSegmentShifts=Rh,ee.planOppositeOverlapRepair=Ih,ee.planSegmentDetours=Cs,ee.planShapeLabelClearance=Uh,ee.redockIntroducedDetachedEndpoints=qh,ee.repairIntroducedBoundaryHugging=Dh,ee.repairIntroducedCrossings=bu,ee.repairIntroducedEdgeCrossings=Ah,ee.repairIntroducedFakeMerges=Bh,ee.repairIntroducedLabelLines=Vh,ee.repairIntroducedOppositeOverlaps=jh,ee.repairIntroducedShapeLabelLines=Yh,ee.repairIntroducedSharedSegmentLabels=Wh,ee.rerouteIntroducedCrossPoolEdges=Th,ee.resolverServicesOf=Qh,ee.saveBpmnXml=c1,ee.sceneCrossingCost=hh,ee.sceneFromDefinitions=xh,ee.sceneFromRegistry=nt,ee.sharedSegmentUnderLabel=Ss,ee.sharedSpansOf=Es,ee.sortPanelIssues=Sb,ee.toPanelIssues=wb,ee.touchedElements=_S,ee.unreadableOverlapCount=Gn,ee.unreadableOverlapOf=fo,ee.validateOps=Zh,ee.warningMessages=uu,Object.defineProperty(ee,Symbol.toStringTag,{value:"Module"})}));
|
|
343
|
+
</div>`,Ge.RESULT_HTML='<div class="djs-search-result"></div>',Ge.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',Ge.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const oL={__depends__:[ba,el,ni],searchPad:["type",Ge]};function _d(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}_d.$inject=["elementRegistry","searchPad","canvas","search"],_d.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!Ye(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:qn(i),id:i.id})),e,{keys:["label","id"]}).map(aL)};function aL(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const sL={__depends__:[oL,kx],__init__:["bpmnSearch"],bpmnSearch:["type",_d]},cL="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",lL="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",uL={width:36,height:50},pL={width:50,height:50};function xw(e,t,n){return Oe("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const ci=5;function Fl(e,t){this._styles=t,e.registerProvider(this)}Fl.$inject=["outline","styles"],Fl.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(RC(e))return n=Oe("rect"),Se(n,W({x:-ci,y:-ci,rx:4,width:e.width+ci*2,height:e.height+ci*2},t)),n;if(!Ye(e))return S(e,"bpmn:Gateway")?(n=Oe("rect"),W(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),Se(n,W({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):qe(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=Oe("rect"),Se(n,W({x:-ci,y:-ci,rx:14,width:e.width+ci*2,height:e.height+ci*2},t))):S(e,"bpmn:EndEvent")?(n=Oe("circle"),Se(n,W({cx:e.width/2,cy:e.height/2,r:e.width/2+ci+1},t))):S(e,"bpmn:Event")?(n=Oe("circle"),Se(n,W({cx:e.width/2,cy:e.height/2,r:e.width/2+ci},t))):S(e,"bpmn:DataObjectReference")&&_w(e,"bpmn:DataObjectReference")?n=xw(cL,{x:-6,y:-6},t):S(e,"bpmn:DataStoreReference")&&_w(e,"bpmn:DataStoreReference")&&(n=xw(lL,{x:-6,y:-6},t)),n},Fl.prototype.updateOutline=function(e,t){if(!Ye(e))return qe(e,["bpmn:SubProcess","bpmn:Group"])?(Se(t,{width:e.width+ci*2,height:e.height+ci*2}),!0):!!qe(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function _w(e,t){var n;return t==="bpmn:DataObjectReference"?n=uL:t==="bpmn:DataStoreReference"&&(n=pL),e.width===n.width&&e.height===n.height}const fL={__depends__:[pd],__init__:["outlineProvider"],outlineProvider:["type",Fl]};var dL='<?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 Mi(e){wo.call(this,e)}Ee(Mi,wo),Mi.Viewer=xr,Mi.NavigatedViewer=Ua,Mi.prototype.createDiagram=function(){return this.importXML(dL)},Mi.prototype._interactionModules=[Ib,Bb,Fb],Mi.prototype._modelingModules=[mO,Zc,xO,vO,DO,ad,FO,uD,yv,Mc,hD,yD,DD,LD,BD,HD,JD,rI,Mf,pI,bI,TI,OI,L_,iL,sL,fL],Mi.prototype._modules=[].concat(xr.prototype._modules,Mi.prototype._interactionModules,Mi.prototype._modelingModules);const hL=ge.defineComponent({__name:"BpmnModelerView",props:{xml:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,r=n,o=ge.ref();let a;async function s(l){if(!a)throw new Error("modeler not mounted");try{const{warnings:u}=await a.importXML(l),f=uu(u);return r("imported",f),{warnings:f}}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 ge.onMounted(async()=>{a=new Mi({container:o.value,moddleExtensions:xs}),i.xml&&await s(i.xml),r("ready")}),ge.watch(()=>i.xml,l=>{l&&a&&s(l)}),ge.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(l,u)=>(ge.openBlock(),ge.createElementBlock("div",{ref_key:"container",ref:o,class:"bpmn-modeler-view"},null,512))}}),ww=(e,t)=>{const n=e.__vccOpts||e;for(const[i,r]of t)n[i]=r;return n},mL=ww(hL,[["__scopeId","data-v-a9b41c97"]]),gL=["title","aria-expanded"],yL=["title","onClick"],vL={viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},bL={key:0,d:"M5.6 5.6l4.8 4.8M10.4 5.6l-4.8 4.8",stroke:"currentColor","stroke-width":"1.5"},xL={key:1,d:"M8 4.6v0.2M8 7v4.4",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round"},_L={key:0,class:"bwl-validation__body"},wL={key:0,class:"bwl-validation__empty"},EL={key:1,class:"bwl-validation__empty"},SL={key:2,class:"bwl-validation__list"},RL=["onClick"],CL={key:0,class:"bwl-validation__scope",title:"이번 변경이 만들거나 건드린 요소"},AL={class:"bwl-validation__msg"},PL=["title"],ML=ww(ge.defineComponent({__name:"BpmnValidationPanel",props:{controller:{}},setup(e){const n=e.controller,i=ge.computed(()=>wb(n.issues.value,n.describeElement)),r=ge.computed(()=>Eb(i.value)),o=m=>jo(m,n.changeScope.value),a=ge.computed(()=>Lf(i.value,n.changeScope.value)),s=ge.ref({error:!0,warning:!0,info:!0}),c=ge.computed(()=>Sb(i.value.filter(m=>s.value[m.severity]),n.changeScope.value)),l=ge.ref(!1),u=["error","warning","info"],f={error:"오류",warning:"경고",info:"정보"};function p(m){if(!l.value){l.value=!0;return}s.value[m]=!s.value[m]}function d(m){const h=m.targetRefs[0];h&&n.requestFocus(h)}return(m,h)=>(ge.openBlock(),ge.createElementBlock("section",{class:ge.normalizeClass(["bwl-validation",{"is-open":l.value}])},[ge.createElementVNode("header",{class:"bwl-validation__head",onClick:h[1]||(h[1]=y=>l.value=!l.value)},[ge.createElementVNode("button",{type:"button",class:"bwl-validation__toggle",title:l.value?"접기":"펼치기","aria-expanded":l.value},[(ge.openBlock(),ge.createElementBlock("svg",{class:ge.normalizeClass(["bwl-validation__chevron",{"is-open":l.value}]),viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},[...h[2]||(h[2]=[ge.createElementVNode("path",{d:"M6 3l5 5-5 5",fill:"none",stroke:"currentColor","stroke-width":"1.6"},null,-1)])],2)),h[3]||(h[3]=ge.createElementVNode("span",null,"검증",-1))],8,gL),ge.createElementVNode("div",{class:"bwl-validation__counts",onClick:h[0]||(h[0]=ge.withModifiers(()=>{},["stop"]))},[(ge.openBlock(),ge.createElementBlock(ge.Fragment,null,ge.renderList(u,y=>ge.createElementVNode("button",{key:y,type:"button",class:ge.normalizeClass(["bwl-validation__count",[`is-${y}`,{"is-off":!s.value[y]}]]),title:l.value?`${f[y]} ${s.value[y]?"숨기기":"보이기"}`:"검증 패널 펼치기",onClick:v=>p(y)},[(ge.openBlock(),ge.createElementBlock("svg",vL,[h[4]||(h[4]=ge.createElementVNode("circle",{cx:"8",cy:"8",r:"6.4",fill:"none",stroke:"currentColor","stroke-width":"1.5"},null,-1)),y==="error"?(ge.openBlock(),ge.createElementBlock("path",bL)):(ge.openBlock(),ge.createElementBlock("path",xL))])),ge.createElementVNode("span",null,ge.toDisplayString(r.value[y]),1)],10,yL)),64))])]),l.value?(ge.openBlock(),ge.createElementBlock("div",_L,[i.value.length===0?(ge.openBlock(),ge.createElementBlock("p",wL,"발견된 문제가 없습니다.")):c.value.length===0?(ge.openBlock(),ge.createElementBlock("p",EL," 선택한 심각도에 해당하는 항목이 없습니다. ")):(ge.openBlock(),ge.createElementBlock("ul",SL,[(ge.openBlock(!0),ge.createElementBlock(ge.Fragment,null,ge.renderList(c.value,y=>(ge.openBlock(),ge.createElementBlock("li",{key:y.key,class:ge.normalizeClass(["bwl-validation__item",[`is-${y.severity}`,{"is-clickable":y.targetRefs.length>0}]]),onClick:v=>d(y)},[h[5]||(h[5]=ge.createElementVNode("span",{class:"bwl-validation__dot","aria-hidden":"true"},null,-1)),a.value&&o(y)?(ge.openBlock(),ge.createElementBlock("span",CL,"이번 변경")):ge.createCommentVNode("",!0),ge.createElementVNode("span",AL,ge.toDisplayString(y.message),1),ge.createElementVNode("span",{class:"bwl-validation__cat",title:y.code},ge.toDisplayString(y.category),9,PL)],10,RL))),128))]))])):ge.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-60e8b1a9"]]);ee.ADDABLE_FLOW_NODE_TYPES=fs,ee.APPLY_BPMN_OPS_SCHEMA=M0,ee.BPMN_MODDLE_EXTENSIONS=xs,ee.BWL_MODDLE_SCHEMA=Td,ee.BWL_NS=Md,ee.BWL_PREFIX=Ul,ee.BWL_SIDES=Yl,ee.BpmnModelerView=mL,ee.BpmnValidationPanel=ML,ee.EDITOR=SS,ee.FLOW_LABEL_INDENT=uh,ee.HEADLESS_BPMN_MODULES=yb,ee.HEADLESS_TEXT_METRICS=uo,ee.I18N_NS=s1,ee.I18N_PREFIX=th,ee.IR_FLOW_NODE_TYPES=Mr,ee.LABEL_FORK_MARGIN=hu,ee.SEVERITY_ORDER=If,ee.SYMBOLIC_OP_KINDS=Dd,ee.SYMBOLIC_OP_SCHEMA=Id,ee.UNDO_EPISODE_COMMAND=ql,ee.applyBpmnOpBatch=um,ee.applyBpmnOps=nm,ee.approximateTextWidth=po,ee.auditBpmnGeometry=_h,ee.auditBpmnGeometryXml=I1,ee.auditBpmnSemantics=Au,ee.auditBpmnSemanticsXml=mS,ee.auditGeometry=At,ee.auditTargetsOf=Wn,ee.axisSegmentsOf=_n,ee.blackBoxNameRect=fu,ee.buildBpmnOpBatch=ES,ee.buildRegistryIndex=Eh,ee.containerBoundarySegments=oa,ee.countBySeverity=Eb,ee.createBpmnEditorController=RS,ee.createBpmnModdle=nh,ee.createHeadlessBpmnModeler=W2,ee.crossedShapesOf=an,ee.crossingCost=Vn,ee.describeProcess=am,ee.describeProcessXml=lS,ee.diffBpmnElements=lm,ee.diffBpmnElementsXml=_S,ee.edgeCrossCount=aa,ee.edgeCrossingPairsOf=Rs,ee.edgeCrossingStatsOf=mh,ee.executeAsUndoEpisode=Od,ee.followMovedEdgeLabels=Gh,ee.forwardThreePointCandidates=As,ee.geometryFindingKey=Rt,ee.installHeadlessBpmnDom=rh,ee.isAddableFlowNodeType=Pd,ee.isChangeScopeMixed=Lf,ee.isEdgeOverlapFinding=du,ee.isInChangeScope=jo,ee.isIrFlowNodeType=Ad,ee.labelRectsOf=mo,ee.lineCrossesLabel=Oi,ee.lineThroughLabel=fh,ee.lineThroughShapeLabel=bh,ee.loadBpmnXml=lo,ee.lowerOps=tm,ee.oppositeOverlapCount=x1,ee.oppositeOverlapOf=lh,ee.planBackEdgeBoundaryClearance=Oh,ee.planCrossPoolRoute=Mh,ee.planEdgeRepair=vu,ee.planLabelLineClearance=zh,ee.planLabelPlacement=Hh,ee.planMiddleSegmentShifts=Rh,ee.planOppositeOverlapRepair=Ih,ee.planSegmentDetours=Cs,ee.planShapeLabelClearance=Uh,ee.redockIntroducedDetachedEndpoints=qh,ee.repairIntroducedBoundaryHugging=Dh,ee.repairIntroducedCrossings=bu,ee.repairIntroducedEdgeCrossings=Ah,ee.repairIntroducedFakeMerges=Bh,ee.repairIntroducedLabelLines=Vh,ee.repairIntroducedOppositeOverlaps=jh,ee.repairIntroducedShapeLabelLines=Yh,ee.repairIntroducedSharedSegmentLabels=Wh,ee.rerouteIntroducedCrossPoolEdges=Th,ee.resolverServicesOf=Qh,ee.saveBpmnXml=c1,ee.sceneCrossingCost=hh,ee.sceneFromDefinitions=xh,ee.sceneFromRegistry=nt,ee.sharedSegmentUnderLabel=Ss,ee.sharedSpansOf=Es,ee.sortPanelIssues=Sb,ee.toPanelIssues=wb,ee.touchedElements=wS,ee.unreadableOverlapCount=Gn,ee.unreadableOverlapOf=fo,ee.validateOps=Zh,ee.warningMessages=uu,Object.defineProperty(ee,Symbol.toStringTag,{value:"Module"})}));
|